@shumai-one/shumai 0.4.0 → 0.4.2

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.
Files changed (184) hide show
  1. package/bin/{chunk-2xgvs3as.js → chunk-07h4b77v.js} +2 -2
  2. package/bin/{chunk-gazp5662.js → chunk-0t4n4d5w.js} +2 -2
  3. package/bin/{chunk-x9akgj7w.js → chunk-1611z9jg.js} +2 -2
  4. package/bin/{chunk-kvnfgr29.js → chunk-1phqxp6z.js} +1 -1
  5. package/bin/chunk-23hckrrz.js +2 -0
  6. package/bin/{chunk-ymr5ybxk.js → chunk-30z44j1g.js} +2 -2
  7. package/bin/{chunk-fcsfssar.js → chunk-3j463k1g.js} +1 -1
  8. package/bin/{chunk-zye42cfp.js → chunk-4181tdds.js} +1 -1
  9. package/bin/chunk-480jtqng.js +4 -0
  10. package/bin/{chunk-m8z8jvdq.js → chunk-4c3g146q.js} +2 -2
  11. package/bin/chunk-4ca0zt5e.js +1 -0
  12. package/bin/chunk-4d9bgmf2.js +2 -0
  13. package/bin/{chunk-fvbd5dk7.js → chunk-4ev56fss.js} +5 -5
  14. package/bin/{chunk-zmyawgth.js → chunk-4gk52tjq.js} +1 -1
  15. package/bin/chunk-4mdqkj4d.js +1 -0
  16. package/bin/{chunk-mhps85dd.js → chunk-4r91fggc.js} +1 -1
  17. package/bin/chunk-50fb1x3w.js +1 -0
  18. package/bin/chunk-59gj1njz.js +1 -0
  19. package/bin/{chunk-j04sztp3.js → chunk-5pr0t7fb.js} +1 -1
  20. package/bin/chunk-5vewxmz7.js +3 -0
  21. package/bin/chunk-62zx96pe.js +2 -0
  22. package/bin/chunk-63y0eb07.js +2 -0
  23. package/bin/chunk-6d5xrgfx.js +2 -0
  24. package/bin/{chunk-etprs58p.js → chunk-6gbtz5bf.js} +2 -2
  25. package/bin/{chunk-wrgwjg2g.js → chunk-6gjg5egq.js} +1 -1
  26. package/bin/{chunk-4q782s34.js → chunk-6m4jz9s1.js} +3 -3
  27. package/bin/{chunk-wehhpcm1.js → chunk-6s4x525w.js} +1 -1
  28. package/bin/{chunk-xzag8w1v.js → chunk-6w2wmvqs.js} +1 -1
  29. package/bin/{chunk-r2shjtte.js → chunk-77d23vcn.js} +2 -2
  30. package/bin/{chunk-vhcqazqf.js → chunk-77m5p188.js} +2 -2
  31. package/bin/chunk-7bvx087f.js +1 -0
  32. package/bin/chunk-7pfjfrjg.js +5 -0
  33. package/bin/{chunk-1qr0ajc8.js → chunk-7q10s127.js} +1 -1
  34. package/bin/{chunk-c3msq02x.js → chunk-7thx8ctx.js} +2 -2
  35. package/bin/{chunk-vvhs586e.js → chunk-8t4s91gh.js} +1 -1
  36. package/bin/{chunk-k3r97v7j.js → chunk-98ey5p2e.js} +1 -1
  37. package/bin/{chunk-44edgqvy.js → chunk-9amndcyh.js} +3 -3
  38. package/bin/chunk-9bk23g9x.js +1 -0
  39. package/bin/chunk-9mkcfy43.js +1 -0
  40. package/bin/{chunk-0h8rjeyj.js → chunk-9t3nsq5n.js} +2 -2
  41. package/bin/{chunk-j536e9nx.js → chunk-9tjq99ds.js} +2 -2
  42. package/bin/chunk-9wm9rwh1.js +2 -0
  43. package/bin/{chunk-nz2v1jmd.js → chunk-ab16fyg4.js} +2 -2
  44. package/bin/chunk-arv0g2av.js +1 -0
  45. package/bin/{chunk-hx2mvd20.js → chunk-aytj4zxg.js} +2 -2
  46. package/bin/{chunk-02afmyqy.js → chunk-b1ypjqgp.js} +2 -2
  47. package/bin/{chunk-93ecxcy4.js → chunk-bdjv0ykq.js} +1 -1
  48. package/bin/chunk-c1k86mfa.js +10 -0
  49. package/bin/{chunk-wy2f6mby.js → chunk-caa96dgd.js} +1 -1
  50. package/bin/chunk-ce4v2yjy.js +1 -0
  51. package/bin/{chunk-m2tbft2c.js → chunk-cqh60y54.js} +2 -2
  52. package/bin/chunk-cvq7zgw7.js +1 -0
  53. package/bin/{chunk-tcm57j8r.js → chunk-d9mjbtp2.js} +2 -2
  54. package/bin/{chunk-xkhwj8mw.js → chunk-dn7sbjws.js} +2 -2
  55. package/bin/{chunk-p49h5fxs.js → chunk-dxyq9h8n.js} +1 -1
  56. package/bin/{chunk-3twtxs5m.js → chunk-e3cabksx.js} +1 -1
  57. package/bin/{chunk-52dr035y.js → chunk-egcrbj94.js} +2 -2
  58. package/bin/chunk-ev17v1mv.js +2 -0
  59. package/bin/chunk-evtpwg71.js +2 -0
  60. package/bin/{chunk-2rbexbv0.js → chunk-f3e0nsv2.js} +1 -1
  61. package/bin/chunk-f40gjqpq.js +2 -0
  62. package/bin/chunk-fe7822ak.js +299 -0
  63. package/bin/{chunk-4b7jcpgv.js → chunk-g8tkhw9j.js} +2 -2
  64. package/bin/{chunk-mgnxa0vy.js → chunk-g9r0p4t8.js} +1 -1
  65. package/bin/chunk-gbjyh9ms.js +1 -0
  66. package/bin/{chunk-thbfw1ed.js → chunk-gtbsb39v.js} +1 -1
  67. package/bin/{chunk-zh752hw8.js → chunk-gytz1q13.js} +1 -1
  68. package/bin/chunk-h0fxysxs.js +7 -0
  69. package/bin/{chunk-aw5zkdma.js → chunk-h8bdvsqt.js} +2 -2
  70. package/bin/{chunk-76433x4d.js → chunk-hag024w8.js} +2 -2
  71. package/bin/chunk-hc6w5nw4.js +7 -0
  72. package/bin/chunk-j69dqc48.js +2 -0
  73. package/bin/{chunk-yfqz6f72.js → chunk-jbtw1zym.js} +1 -1
  74. package/bin/{chunk-9k76s3y6.js → chunk-jc1vb7rj.js} +2 -2
  75. package/bin/{chunk-41d9gkx7.js → chunk-jdv78w9r.js} +1 -1
  76. package/bin/{chunk-dag45evp.js → chunk-jjs70y9v.js} +1 -1
  77. package/bin/{chunk-ysvhtgve.js → chunk-jmdar2gz.js} +2 -2
  78. package/bin/chunk-jvwz10n4.js +2 -0
  79. package/bin/{chunk-ck6msfch.js → chunk-k47md1g4.js} +2 -2
  80. package/bin/{chunk-yyjx8nbq.js → chunk-k4v0brcb.js} +1 -1
  81. package/bin/chunk-k6n7c07e.js +1 -0
  82. package/bin/{chunk-kjjhvrk1.js → chunk-kk2cstsg.js} +1 -1
  83. package/bin/{chunk-3r33kewe.js → chunk-knz4h56q.js} +3 -3
  84. package/bin/{chunk-j5rx3x1q.js → chunk-kqqtt6bd.js} +1 -1
  85. package/bin/{chunk-ez6veng7.js → chunk-kvyp1t4j.js} +1 -1
  86. package/bin/{chunk-djx2r4nj.js → chunk-kxskpgsq.js} +2 -2
  87. package/bin/{chunk-3gjn4pyp.js → chunk-m6srbjcs.js} +2 -2
  88. package/bin/{chunk-8956rryj.js → chunk-mcc1scxs.js} +2 -2
  89. package/bin/{chunk-0bfqrx5q.js → chunk-mq83a0kk.js} +2 -2
  90. package/bin/chunk-mxm8g4q0.js +1 -0
  91. package/bin/{chunk-6m1k317a.js → chunk-nhpgdqq5.js} +2 -2
  92. package/bin/{chunk-pdjar480.js → chunk-nne496aa.js} +2 -2
  93. package/bin/{chunk-s73c0brj.js → chunk-nqpb0r9h.js} +1 -1
  94. package/bin/chunk-ns0zww9g.js +2 -0
  95. package/bin/{chunk-9cmvymm5.js → chunk-ps4xfp23.js} +1 -1
  96. package/bin/chunk-pz2ec6xt.js +2 -0
  97. package/bin/{chunk-vkgxrn1h.js → chunk-q163k309.js} +2 -2
  98. package/bin/chunk-q1da61ps.js +1 -0
  99. package/bin/{chunk-7x1vkftb.js → chunk-qrf0ady6.js} +2 -2
  100. package/bin/{chunk-d7en47eh.js → chunk-qy28f25e.js} +1 -1
  101. package/bin/{chunk-xjnghr99.js → chunk-r7s4ypw1.js} +1 -1
  102. package/bin/chunk-ran23vm9.js +1 -0
  103. package/bin/chunk-rfvdc4n0.js +2 -0
  104. package/bin/{chunk-8rcfhfq5.js → chunk-rgthkvgx.js} +1 -1
  105. package/bin/chunk-s39n3yw3.js +2 -0
  106. package/bin/{chunk-xv5h4dv1.js → chunk-s7wdd0g7.js} +1 -1
  107. package/bin/{chunk-n8gsjwht.js → chunk-s88ha5kx.js} +2 -2
  108. package/bin/chunk-sf91bt9m.js +2 -0
  109. package/bin/{chunk-2x46963w.js → chunk-sjwbjf9j.js} +1 -1
  110. package/bin/chunk-t62076pv.js +1 -0
  111. package/bin/{chunk-he1ywtxx.js → chunk-tbbwss3v.js} +1 -1
  112. package/bin/{chunk-06spnkta.js → chunk-tjcc7a6y.js} +1 -1
  113. package/bin/{chunk-qac5hr5h.js → chunk-tp6ab26e.js} +1 -1
  114. package/bin/{chunk-md12a1sf.js → chunk-v2wxk9p5.js} +2 -2
  115. package/bin/chunk-vbk6y4hk.js +2 -0
  116. package/bin/{chunk-vcf2qk9h.js → chunk-vfgfg5fk.js} +2 -2
  117. package/bin/{chunk-gjnrd32m.js → chunk-vm6c3xx9.js} +2 -2
  118. package/bin/{chunk-agabtxrc.js → chunk-vsx96mt6.js} +1 -1
  119. package/bin/{chunk-et0cewj7.js → chunk-wbyw1shz.js} +2 -2
  120. package/bin/chunk-whh2vh50.css +1 -0
  121. package/bin/{chunk-792t2653.js → chunk-wjkcq65s.js} +2 -2
  122. package/bin/{chunk-5yhn31rd.js → chunk-wkefwkfp.js} +1 -1
  123. package/bin/{chunk-gcc6pte2.js → chunk-x7bsnk1e.js} +2 -2
  124. package/bin/{chunk-tn67sjb2.js → chunk-xbhw6bpz.js} +2 -2
  125. package/bin/{chunk-34kaja59.js → chunk-xg5yrcj5.js} +2 -2
  126. package/bin/{chunk-wzmpvadf.js → chunk-xw2gpcsh.js} +1 -1
  127. package/bin/{chunk-sx6y697s.js → chunk-ycq8ank7.js} +1 -1
  128. package/bin/chunk-yp9hvkc5.js +73 -0
  129. package/bin/{chunk-dkjkn8t3.js → chunk-ytypyfkc.js} +2 -2
  130. package/bin/{chunk-62ebss6h.js → chunk-z1kjmf60.js} +2 -2
  131. package/bin/chunk-z36bx86r.js +2 -0
  132. package/bin/chunk-z7hdnecp.js +3 -0
  133. package/bin/chunk-zeby1cq7.js +2 -0
  134. package/bin/chunk-zs5e8z1w.js +1 -0
  135. package/bin/chunk-zxnyefg5.js +2 -0
  136. package/bin/shumai-app.html +1 -1
  137. package/bin/shumai-app.js +312 -342
  138. package/package.json +7 -7
  139. package/prisma/schema.prisma +1 -1
  140. package/bin/chunk-045f1bw7.js +0 -2
  141. package/bin/chunk-0n1wfwcm.js +0 -2
  142. package/bin/chunk-1fwzepfn.js +0 -2
  143. package/bin/chunk-2xevs82j.js +0 -2
  144. package/bin/chunk-31y5j4hr.js +0 -1
  145. package/bin/chunk-34adtqqh.js +0 -1
  146. package/bin/chunk-4j8fbckp.js +0 -1
  147. package/bin/chunk-57s7yj35.js +0 -1
  148. package/bin/chunk-6tse78c7.js +0 -2
  149. package/bin/chunk-8nyve0cr.js +0 -7
  150. package/bin/chunk-ajndx51c.js +0 -2
  151. package/bin/chunk-bbyc2jfq.js +0 -1
  152. package/bin/chunk-br7d2qwc.js +0 -1
  153. package/bin/chunk-by6g0vye.js +0 -2
  154. package/bin/chunk-c24fvhm6.js +0 -1
  155. package/bin/chunk-c6aszz6p.js +0 -1
  156. package/bin/chunk-csqvmx1m.js +0 -2
  157. package/bin/chunk-dg8c91j5.js +0 -1
  158. package/bin/chunk-dk8vk17v.js +0 -2
  159. package/bin/chunk-ex2ym5pz.js +0 -2
  160. package/bin/chunk-f2zbsrc9.js +0 -2
  161. package/bin/chunk-gcpr2a24.js +0 -7
  162. package/bin/chunk-gpjkegdp.js +0 -1
  163. package/bin/chunk-jt6d0zb1.js +0 -2
  164. package/bin/chunk-jwgfkpek.js +0 -3
  165. package/bin/chunk-k2065y29.js +0 -2
  166. package/bin/chunk-k514bttd.js +0 -1
  167. package/bin/chunk-k7chm9a9.js +0 -2
  168. package/bin/chunk-kjgejwjp.css +0 -1
  169. package/bin/chunk-kqpzx5az.js +0 -73
  170. package/bin/chunk-kxr8fjsq.js +0 -2
  171. package/bin/chunk-mha3rsh7.js +0 -2
  172. package/bin/chunk-nn0px81k.js +0 -307
  173. package/bin/chunk-ns804tmv.js +0 -2
  174. package/bin/chunk-p1temt1j.js +0 -1
  175. package/bin/chunk-rkz6x3r0.js +0 -2
  176. package/bin/chunk-svz0ds0g.js +0 -1
  177. package/bin/chunk-t31basc5.js +0 -1
  178. package/bin/chunk-t6qdrw24.js +0 -1
  179. package/bin/chunk-wvwqgff4.js +0 -1
  180. package/bin/chunk-ww1cy08p.js +0 -1
  181. package/bin/chunk-xfp27ya9.js +0 -2
  182. package/bin/chunk-y0f4bc9f.js +0 -2
  183. package/bin/chunk-y2s0tjaa.js +0 -3
  184. package/bin/chunk-y3dy4pdt.js +0 -2
@@ -1,7 +0,0 @@
1
- import{Ll as R$,Pl as m,Sl as Z0,Tl as U0,Vi as W0,Xi as F,Yi as F0,cj as f2,jm as o0}from"./chunk-kqpzx5az.js";import{kn as X0}from"./chunk-p49h5fxs.js";var s$={setTimeout:($,z)=>setTimeout($,z),clearTimeout:($)=>clearTimeout($),setInterval:($,z)=>setInterval($,z),clearInterval:($)=>clearInterval($)},t$=class{#z=s$;#$=!1;setTimeoutProvider($){this.#z=$}setTimeout($,z){return this.#z.setTimeout($,z)}clearTimeout($){this.#z.clearTimeout($)}setInterval($,z){return this.#z.setInterval($,z)}clearInterval($){this.#z.clearInterval($)}},z0=new t$;function e1($){setTimeout($,0)}var y=typeof window>"u"||"Deno"in globalThis;function x(){}function G$($,z){return typeof $==="function"?$(z):$}function m0($){return typeof $==="number"&&$>=0&&$!==1/0}function X1($,z){return Math.max($+(z||0)-Date.now(),0)}function t($,z){return typeof $==="function"?$(z):$}function d($,z){return typeof $==="function"?$(z):$}function Y1($,z){let{type:G="all",exact:X,fetchStatus:Y,predicate:A,queryKey:P,stale:J}=$;if(P){if(X){if(z.queryHash!==y0(P,z.options))return!1}else if(!D0(z.queryKey,P))return!1}if(G!=="all"){let U=z.isActive();if(G==="active"&&!U)return!1;if(G==="inactive"&&U)return!1}if(typeof J==="boolean"&&z.isStale()!==J)return!1;if(Y&&Y!==z.state.fetchStatus)return!1;if(A&&!A(z))return!1;return!0}function Z1($,z){let{exact:G,status:X,predicate:Y,mutationKey:A}=$;if(A){if(!z.options.mutationKey)return!1;if(G){if(G0(z.options.mutationKey)!==G0(A))return!1}else if(!D0(z.options.mutationKey,A))return!1}if(X&&z.state.status!==X)return!1;if(Y&&!Y(z))return!1;return!0}function y0($,z){return(z?.queryKeyHashFn||G0)($)}function G0($){return JSON.stringify($,(z,G)=>j1(G)?Object.keys(G).sort().reduce((X,Y)=>{return X[Y]=G[Y],X},{}):G)}function D0($,z){if($===z)return!0;if(typeof $!==typeof z)return!1;if($&&z&&typeof $==="object"&&typeof z==="object")return Object.keys(z).every((G)=>D0($[G],z[G]));return!1}var e$=Object.prototype.hasOwnProperty;function d0($,z){if($===z)return $;let G=$$($)&&$$(z);if(!G&&!(j1($)&&j1(z)))return z;let Y=(G?$:Object.keys($)).length,A=G?z:Object.keys(z),P=A.length,J=G?Array(P):{},U=0;for(let N=0;N<P;N++){let W=G?N:A[N],Z=$[W],w=z[W];if(Z===w){if(J[W]=Z,G?N<Y:e$.call($,W))U++;continue}if(Z===null||w===null||typeof Z!=="object"||typeof w!=="object"){J[W]=w;continue}let L=d0(Z,w);if(J[W]=L,L===Z)U++}return Y===P&&U===Y?$:J}function B0($,z){if(!z||Object.keys($).length!==Object.keys(z).length)return!1;for(let G in $)if($[G]!==z[G])return!1;return!0}function $$($){return Array.isArray($)&&$.length===Object.keys($).length}function j1($){if(!z$($))return!1;let z=$.constructor;if(z===void 0)return!0;let G=z.prototype;if(!z$(G))return!1;if(!G.hasOwnProperty("isPrototypeOf"))return!1;if(Object.getPrototypeOf($)!==Object.prototype)return!1;return!0}function z$($){return Object.prototype.toString.call($)==="[object Object]"}function X$($){return new Promise((z)=>{z0.setTimeout(z,$)})}function l0($,z,G){if(typeof G.structuralSharing==="function")return G.structuralSharing($,z);else if(G.structuralSharing!==!1)return d0($,z);return z}function $2($){return $}function Y$($,z,G=0){let X=[...$,z];return G&&X.length>G?X.slice(1):X}function Z$($,z,G=0){let X=[z,...$];return G&&X.length>G?X.slice(0,-1):X}var I0=Symbol();function J1($,z){if(!$.queryFn&&z?.initialPromise)return()=>z.initialPromise;if(!$.queryFn||$.queryFn===I0)return()=>Promise.reject(Error(`Missing queryFn: '${$.queryHash}'`));return $.queryFn}function p0($,z){if(typeof $==="function")return $(...z);return!!$}var l=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe($){return this.listeners.add($),this.onSubscribe(),()=>{this.listeners.delete($),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var z2=class extends l{#z;#$;#G;constructor(){super();this.#G=($)=>{if(!y&&window.addEventListener){let z=()=>$();return window.addEventListener("visibilitychange",z,!1),()=>{window.removeEventListener("visibilitychange",z)}}return}}onSubscribe(){if(!this.#$)this.setEventListener(this.#G)}onUnsubscribe(){if(!this.hasListeners())this.#$?.(),this.#$=void 0}setEventListener($){this.#G=$,this.#$?.(),this.#$=$((z)=>{if(typeof z==="boolean")this.setFocused(z);else this.onFocus()})}setFocused($){if(this.#z!==$)this.#z=$,this.onFocus()}onFocus(){let $=this.isFocused();this.listeners.forEach((z)=>{z($)})}isFocused(){if(typeof this.#z==="boolean")return this.#z;return globalThis.document?.visibilityState!=="hidden"}},S0=new z2;function c0(){let $,z,G=new Promise((Y,A)=>{$=Y,z=A});G.status="pending",G.catch(()=>{});function X(Y){Object.assign(G,Y),delete G.resolve,delete G.reject}return G.resolve=(Y)=>{X({status:"fulfilled",value:Y}),$(Y)},G.reject=(Y)=>{X({status:"rejected",reason:Y}),z(Y)},G}var J$=e1;function G2(){let $=[],z=0,G=(J)=>{J()},X=(J)=>{J()},Y=J$,A=(J)=>{if(z)$.push(J);else Y(()=>{G(J)})},P=()=>{let J=$;if($=[],J.length)Y(()=>{X(()=>{J.forEach((U)=>{G(U)})})})};return{batch:(J)=>{let U;z++;try{U=J()}finally{if(z--,!z)P()}return U},batchCalls:(J)=>{return(...U)=>{A(()=>{J(...U)})}},schedule:A,setNotifyFunction:(J)=>{G=J},setBatchNotifyFunction:(J)=>{X=J},setScheduler:(J)=>{Y=J}}}var I=G2();var X2=class extends l{#z=!0;#$;#G;constructor(){super();this.#G=($)=>{if(!y&&window.addEventListener){let z=()=>$(!0),G=()=>$(!1);return window.addEventListener("online",z,!1),window.addEventListener("offline",G,!1),()=>{window.removeEventListener("online",z),window.removeEventListener("offline",G)}}return}}onSubscribe(){if(!this.#$)this.setEventListener(this.#G)}onUnsubscribe(){if(!this.hasListeners())this.#$?.(),this.#$=void 0}setEventListener($){this.#G=$,this.#$?.(),this.#$=$(this.setOnline.bind(this))}setOnline($){if(this.#z!==$)this.#z=$,this.listeners.forEach((G)=>{G($)})}isOnline(){return this.#z}},O0=new X2;function Y2($){return Math.min(1000*2**$,30000)}function M1($){return($??"online")==="online"?O0.isOnline():!0}var A1=class extends Error{constructor($){super("CancelledError");this.revert=$?.revert,this.silent=$?.silent}};function W1($){let z=!1,G=0,X,Y=c0(),A=()=>Y.status!=="pending",P=(K)=>{if(!A()){let B=new A1(K);w(B),$.onCancel?.(B)}},J=()=>{z=!0},U=()=>{z=!1},N=()=>S0.isFocused()&&($.networkMode==="always"||O0.isOnline())&&$.canRun(),W=()=>M1($.networkMode)&&$.canRun(),Z=(K)=>{if(!A())X?.(),Y.resolve(K)},w=(K)=>{if(!A())X?.(),Y.reject(K)},L=()=>{return new Promise((K)=>{X=(B)=>{if(A()||N())K(B)},$.onPause?.()}).then(()=>{if(X=void 0,!A())$.onContinue?.()})},k=()=>{if(A())return;let K,B=G===0?$.initialPromise:void 0;try{K=B??$.fn()}catch(H){K=Promise.reject(H)}Promise.resolve(K).then(Z).catch((H)=>{if(A())return;let D=$.retry??(y?0:3),j=$.retryDelay??Y2,Q=typeof j==="function"?j(G,H):j,S=D===!0||typeof D==="number"&&G<D||typeof D==="function"&&D(G,H);if(z||!S){w(H);return}G++,$.onFail?.(G,H),X$(Q).then(()=>{return N()?void 0:L()}).then(()=>{if(z)w(H);else k()})})};return{promise:Y,status:()=>Y.status,cancel:P,continue:()=>{return X?.(),Y},cancelRetry:J,continueRetry:U,canStart:W,start:()=>{if(W())k();else L().then(k);return Y}}}var P1=class{#z;destroy(){this.clearGcTimeout()}scheduleGc(){if(this.clearGcTimeout(),m0(this.gcTime))this.#z=z0.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime($){this.gcTime=Math.max(this.gcTime||0,$??(y?1/0:300000))}clearGcTimeout(){if(this.#z)z0.clearTimeout(this.#z),this.#z=void 0}};var P$=class extends P1{#z;#$;#G;#Y;#X;#Z;#A;constructor($){super();this.#A=!1,this.#Z=$.defaultOptions,this.setOptions($.options),this.observers=[],this.#Y=$.client,this.#G=this.#Y.getQueryCache(),this.queryKey=$.queryKey,this.queryHash=$.queryHash,this.#z=W$(this.options),this.state=$.state??this.#z,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#X?.promise}setOptions($){if(this.options={...this.#Z,...$},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let z=W$(this.options);if(z.data!==void 0)this.setState(A$(z.data,z.dataUpdatedAt)),this.#z=z}}optionalRemove(){if(!this.observers.length&&this.state.fetchStatus==="idle")this.#G.remove(this)}setData($,z){let G=l0(this.state.data,$,this.options);return this.#J({data:G,type:"success",dataUpdatedAt:z?.updatedAt,manual:z?.manual}),G}setState($,z){this.#J({type:"setState",state:$,setStateOptions:z})}cancel($){let z=this.#X?.promise;return this.#X?.cancel($),z?z.then(x).catch(x):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#z)}isActive(){return this.observers.some(($)=>d($.options.enabled,this)!==!1)}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===I0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){if(this.getObserversCount()>0)return this.observers.some(($)=>t($.options.staleTime,this)==="static");return!1}isStale(){if(this.getObserversCount()>0)return this.observers.some(($)=>$.getCurrentResult().isStale);return this.state.data===void 0||this.state.isInvalidated}isStaleByTime($=0){if(this.state.data===void 0)return!0;if($==="static")return!1;if(this.state.isInvalidated)return!0;return!X1(this.state.dataUpdatedAt,$)}onFocus(){this.observers.find((z)=>z.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#X?.continue()}onOnline(){this.observers.find((z)=>z.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#X?.continue()}addObserver($){if(!this.observers.includes($))this.observers.push($),this.clearGcTimeout(),this.#G.notify({type:"observerAdded",query:this,observer:$})}removeObserver($){if(this.observers.includes($)){if(this.observers=this.observers.filter((z)=>z!==$),!this.observers.length){if(this.#X)if(this.#A)this.#X.cancel({revert:!0});else this.#X.cancelRetry();this.scheduleGc()}this.#G.notify({type:"observerRemoved",query:this,observer:$})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#J({type:"invalidate"})}async fetch($,z){if(this.state.fetchStatus!=="idle"&&this.#X?.status()!=="rejected"){if(this.state.data!==void 0&&z?.cancelRefetch)this.cancel({silent:!0});else if(this.#X)return this.#X.continueRetry(),this.#X.promise}if($)this.setOptions($);if(!this.options.queryFn){let J=this.observers.find((U)=>U.options.queryFn);if(J)this.setOptions(J.options)}let G=new AbortController,X=(J)=>{Object.defineProperty(J,"signal",{enumerable:!0,get:()=>{return this.#A=!0,G.signal}})},Y=()=>{let J=J1(this.options,z),N=(()=>{let W={client:this.#Y,queryKey:this.queryKey,meta:this.meta};return X(W),W})();if(this.#A=!1,this.options.persister)return this.options.persister(J,N,this);return J(N)},P=(()=>{let J={fetchOptions:z,options:this.options,queryKey:this.queryKey,client:this.#Y,state:this.state,fetchFn:Y};return X(J),J})();if(this.options.behavior?.onFetch(P,this),this.#$=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==P.fetchOptions?.meta)this.#J({type:"fetch",meta:P.fetchOptions?.meta});this.#X=W1({initialPromise:z?.initialPromise,fn:P.fetchFn,onCancel:(J)=>{if(J instanceof A1&&J.revert)this.setState({...this.#$,fetchStatus:"idle"});G.abort()},onFail:(J,U)=>{this.#J({type:"failed",failureCount:J,error:U})},onPause:()=>{this.#J({type:"pause"})},onContinue:()=>{this.#J({type:"continue"})},retry:P.options.retry,retryDelay:P.options.retryDelay,networkMode:P.options.networkMode,canRun:()=>!0});try{let J=await this.#X.start();if(J===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(J),this.#G.config.onSuccess?.(J,this),this.#G.config.onSettled?.(J,this.state.error,this),J}catch(J){if(J instanceof A1){if(J.silent)return this.#X.promise;else if(J.revert){if(this.state.data===void 0)throw J;return this.state.data}}throw this.#J({type:"error",error:J}),this.#G.config.onError?.(J,this),this.#G.config.onSettled?.(this.state.data,J,this),J}finally{this.scheduleGc()}}#J($){let z=(G)=>{switch($.type){case"failed":return{...G,fetchFailureCount:$.failureCount,fetchFailureReason:$.error};case"pause":return{...G,fetchStatus:"paused"};case"continue":return{...G,fetchStatus:"fetching"};case"fetch":return{...G,...x1(G.data,this.options),fetchMeta:$.meta??null};case"success":let X={...G,...A$($.data,$.dataUpdatedAt),dataUpdateCount:G.dataUpdateCount+1,...!$.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#$=$.manual?X:void 0,X;case"error":let Y=$.error;return{...G,error:Y,errorUpdateCount:G.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:G.fetchFailureCount+1,fetchFailureReason:Y,fetchStatus:"idle",status:"error"};case"invalidate":return{...G,isInvalidated:!0};case"setState":return{...G,...$.state}}};this.state=z(this.state),I.batch(()=>{this.observers.forEach((G)=>{G.onQueryUpdate()}),this.#G.notify({query:this,type:"updated",action:$})})}};function x1($,z){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:M1(z.networkMode)?"fetching":"paused",...$===void 0&&{error:null,status:"pending"}}}function A$($,z){return{data:$,dataUpdatedAt:z??Date.now(),error:null,isInvalidated:!1,status:"success"}}function W$($){let z=typeof $.initialData==="function"?$.initialData():$.initialData,G=z!==void 0,X=G?typeof $.initialDataUpdatedAt==="function"?$.initialDataUpdatedAt():$.initialDataUpdatedAt:0;return{data:z,dataUpdateCount:0,dataUpdatedAt:G?X??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:G?"success":"pending",fetchStatus:"idle"}}var e=class extends l{constructor($,z){super();this.options=z,this.#z=$,this.#J=null,this.#A=c0(),this.bindMethods(),this.setOptions(z)}#z;#$=void 0;#G=void 0;#Y=void 0;#X;#Z;#A;#J;#N;#H;#V;#P;#U;#W;#B=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){if(this.listeners.size===1){if(this.#$.addObserver(this),U$(this.#$,this.options))this.#K();else this.updateResult();this.#E()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return T1(this.#$,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return T1(this.#$,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#D(),this.#I(),this.#$.removeObserver(this)}setOptions($){let z=this.options,G=this.#$;if(this.options=this.#z.defaultQueryOptions($),this.options.enabled!==void 0&&typeof this.options.enabled!=="boolean"&&typeof this.options.enabled!=="function"&&typeof d(this.options.enabled,this.#$)!=="boolean")throw Error("Expected enabled to be a boolean or a callback that returns a boolean");if(this.#C(),this.#$.setOptions(this.options),z._defaulted&&!B0(this.options,z))this.#z.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#$,observer:this});let X=this.hasListeners();if(X&&H$(this.#$,G,this.options,z))this.#K();if(this.updateResult(),X&&(this.#$!==G||d(this.options.enabled,this.#$)!==d(z.enabled,this.#$)||t(this.options.staleTime,this.#$)!==t(z.staleTime,this.#$)))this.#w();let Y=this.#L();if(X&&(this.#$!==G||d(this.options.enabled,this.#$)!==d(z.enabled,this.#$)||Y!==this.#W))this.#k(Y)}getOptimisticResult($){let z=this.#z.getQueryCache().build(this.#z,$),G=this.createResult(z,$);if(J2(this,G))this.#Y=G,this.#Z=this.options,this.#X=this.#$.state;return G}getCurrentResult(){return this.#Y}trackResult($,z){return new Proxy($,{get:(G,X)=>{if(this.trackProp(X),z?.(X),X==="promise"){if(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#A.status==="pending")this.#A.reject(Error("experimental_prefetchInRender feature flag is not enabled"))}return Reflect.get(G,X)}})}trackProp($){this.#B.add($)}getCurrentQuery(){return this.#$}refetch({...$}={}){return this.fetch({...$})}fetchOptimistic($){let z=this.#z.defaultQueryOptions($),G=this.#z.getQueryCache().build(this.#z,z);return G.fetch().then(()=>this.createResult(G,z))}fetch($){return this.#K({...$,cancelRefetch:$.cancelRefetch??!0}).then(()=>{return this.updateResult(),this.#Y})}#K($){this.#C();let z=this.#$.fetch(this.options,$);if(!$?.throwOnError)z=z.catch(x);return z}#w(){this.#D();let $=t(this.options.staleTime,this.#$);if(y||this.#Y.isStale||!m0($))return;let G=X1(this.#Y.dataUpdatedAt,$)+1;this.#P=z0.setTimeout(()=>{if(!this.#Y.isStale)this.updateResult()},G)}#L(){return(typeof this.options.refetchInterval==="function"?this.options.refetchInterval(this.#$):this.options.refetchInterval)??!1}#k($){if(this.#I(),this.#W=$,y||d(this.options.enabled,this.#$)===!1||!m0(this.#W)||this.#W===0)return;this.#U=z0.setInterval(()=>{if(this.options.refetchIntervalInBackground||S0.isFocused())this.#K()},this.#W)}#E(){this.#w(),this.#k(this.#L())}#D(){if(this.#P)z0.clearTimeout(this.#P),this.#P=void 0}#I(){if(this.#U)z0.clearInterval(this.#U),this.#U=void 0}createResult($,z){let G=this.#$,X=this.options,Y=this.#Y,A=this.#X,P=this.#Z,U=$!==G?$.state:this.#G,{state:N}=$,W={...N},Z=!1,w;if(z._optimisticResults){let q=this.hasListeners(),H0=!q&&U$($,z),n=q&&H$($,G,z,X);if(H0||n)W={...W,...x1(N.data,$.options)};if(z._optimisticResults==="isRestoring")W.fetchStatus="idle"}let{error:L,errorUpdatedAt:k,status:K}=W;w=W.data;let B=!1;if(z.placeholderData!==void 0&&w===void 0&&K==="pending"){let q;if(Y?.isPlaceholderData&&z.placeholderData===P?.placeholderData)q=Y.data,B=!0;else q=typeof z.placeholderData==="function"?z.placeholderData(this.#V?.state.data,this.#V):z.placeholderData;if(q!==void 0)K="success",w=l0(Y?.data,q,z),Z=!0}if(z.select&&w!==void 0&&!B)if(Y&&w===A?.data&&z.select===this.#N)w=this.#H;else try{this.#N=z.select,w=z.select(w),w=l0(Y?.data,w,z),this.#H=w,this.#J=null}catch(q){this.#J=q}if(this.#J)L=this.#J,w=this.#H,k=Date.now(),K="error";let H=W.fetchStatus==="fetching",D=K==="pending",j=K==="error",Q=D&&H,S=w!==void 0,R={status:K,fetchStatus:W.fetchStatus,isPending:D,isSuccess:K==="success",isError:j,isInitialLoading:Q,isLoading:Q,data:w,dataUpdatedAt:W.dataUpdatedAt,error:L,errorUpdatedAt:k,failureCount:W.fetchFailureCount,failureReason:W.fetchFailureReason,errorUpdateCount:W.errorUpdateCount,isFetched:W.dataUpdateCount>0||W.errorUpdateCount>0,isFetchedAfterMount:W.dataUpdateCount>U.dataUpdateCount||W.errorUpdateCount>U.errorUpdateCount,isFetching:H,isRefetching:H&&!D,isLoadingError:j&&!S,isPaused:W.fetchStatus==="paused",isPlaceholderData:Z,isRefetchError:j&&S,isStale:S1($,z),refetch:this.refetch,promise:this.#A,isEnabled:d(z.enabled,$)!==!1};if(this.options.experimental_prefetchInRender){let q=(V0)=>{if(R.status==="error")V0.reject(R.error);else if(R.data!==void 0)V0.resolve(R.data)},H0=()=>{let V0=this.#A=R.promise=c0();q(V0)},n=this.#A;switch(n.status){case"pending":if($.queryHash===G.queryHash)q(n);break;case"fulfilled":if(R.status==="error"||R.data!==n.value)H0();break;case"rejected":if(R.status!=="error"||R.error!==n.reason)H0();break}}return R}updateResult(){let $=this.#Y,z=this.createResult(this.#$,this.options);if(this.#X=this.#$.state,this.#Z=this.options,this.#X.data!==void 0)this.#V=this.#$;if(B0(z,$))return;this.#Y=z;let G=()=>{if(!$)return!0;let{notifyOnChangeProps:X}=this.options,Y=typeof X==="function"?X():X;if(Y==="all"||!Y&&!this.#B.size)return!0;let A=new Set(Y??this.#B);if(this.options.throwOnError)A.add("error");return Object.keys(this.#Y).some((P)=>{let J=P;return this.#Y[J]!==$[J]&&A.has(J)})};this.#F({listeners:G()})}#C(){let $=this.#z.getQueryCache().build(this.#z,this.options);if($===this.#$)return;let z=this.#$;if(this.#$=$,this.#G=$.state,this.hasListeners())z?.removeObserver(this),$.addObserver(this)}onQueryUpdate(){if(this.updateResult(),this.hasListeners())this.#E()}#F($){I.batch(()=>{if($.listeners)this.listeners.forEach((z)=>{z(this.#Y)});this.#z.getQueryCache().notify({query:this.#$,type:"observerResultsUpdated"})})}};function Z2($,z){return d(z.enabled,$)!==!1&&$.state.data===void 0&&!($.state.status==="error"&&z.retryOnMount===!1)}function U$($,z){return Z2($,z)||$.state.data!==void 0&&T1($,z,z.refetchOnMount)}function T1($,z,G){if(d(z.enabled,$)!==!1&&t(z.staleTime,$)!=="static"){let X=typeof G==="function"?G($):G;return X==="always"||X!==!1&&S1($,z)}return!1}function H$($,z,G,X){return($!==z||d(X.enabled,$)===!1)&&(!G.suspense||$.state.status!=="error")&&S1($,G)}function S1($,z){return d(z.enabled,$)!==!1&&$.isStaleByTime(t(z.staleTime,$))}function J2($,z){if(!B0($.getCurrentResult(),z))return!0;return!1}function q0($){return{onFetch:(z,G)=>{let X=z.options,Y=z.fetchOptions?.meta?.fetchMore?.direction,A=z.state.data?.pages||[],P=z.state.data?.pageParams||[],J={pages:[],pageParams:[]},U=0,N=async()=>{let W=!1,Z=(k)=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>{if(z.signal.aborted)W=!0;else z.signal.addEventListener("abort",()=>{W=!0});return z.signal}})},w=J1(z.options,z.fetchOptions),L=async(k,K,B)=>{if(W)return Promise.reject();if(K==null&&k.pages.length)return Promise.resolve(k);let D=(()=>{let f={client:z.client,queryKey:z.queryKey,pageParam:K,direction:B?"backward":"forward",meta:z.options.meta};return Z(f),f})(),j=await w(D),{maxPages:Q}=z.options,S=B?Z$:Y$;return{pages:S(k.pages,j,Q),pageParams:S(k.pageParams,K,Q)}};if(Y&&A.length){let k=Y==="backward",K=k?V$:O1,B={pages:A,pageParams:P},H=K(X,B);J=await L(B,H,k)}else{let k=$??A.length;do{let K=U===0?P[0]??X.initialPageParam:O1(X,J);if(U>0&&K==null)break;J=await L(J,K),U++}while(U<k)}return J};if(z.options.persister)z.fetchFn=()=>{return z.options.persister?.(N,{client:z.client,queryKey:z.queryKey,meta:z.options.meta,signal:z.signal},G)};else z.fetchFn=N}}}function O1($,{pages:z,pageParams:G}){let X=z.length-1;return z.length>0?$.getNextPageParam(z[X],z,G[X],G):void 0}function V$($,{pages:z,pageParams:G}){return z.length>0?$.getPreviousPageParam?.(z[0],z,G[0],G):void 0}function N$($,z){if(!z)return!1;return O1($,z)!=null}function K$($,z){if(!z||!$.getPreviousPageParam)return!1;return V$($,z)!=null}var q1=class extends e{constructor($,z){super($,z)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions($){super.setOptions({...$,behavior:q0()})}getOptimisticResult($){return $.behavior=q0(),super.getOptimisticResult($)}fetchNextPage($){return this.fetch({...$,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage($){return this.fetch({...$,meta:{fetchMore:{direction:"backward"}}})}createResult($,z){let{state:G}=$,X=super.createResult($,z),{isFetching:Y,isRefetching:A,isError:P,isRefetchError:J}=X,U=G.fetchMeta?.fetchMore?.direction,N=P&&U==="forward",W=Y&&U==="forward",Z=P&&U==="backward",w=Y&&U==="backward";return{...X,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:N$(z,G.data),hasPreviousPage:K$(z,G.data),isFetchNextPageError:N,isFetchingNextPage:W,isFetchPreviousPageError:Z,isFetchingPreviousPage:w,isRefetchError:J&&!N&&!Z,isRefetching:A&&!W&&!w}}};var B$=class extends P1{#z;#$;#G;#Y;constructor($){super();this.#z=$.client,this.mutationId=$.mutationId,this.#G=$.mutationCache,this.#$=[],this.state=$.state||g1(),this.setOptions($.options),this.scheduleGc()}setOptions($){this.options=$,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver($){if(!this.#$.includes($))this.#$.push($),this.clearGcTimeout(),this.#G.notify({type:"observerAdded",mutation:this,observer:$})}removeObserver($){this.#$=this.#$.filter((z)=>z!==$),this.scheduleGc(),this.#G.notify({type:"observerRemoved",mutation:this,observer:$})}optionalRemove(){if(!this.#$.length)if(this.state.status==="pending")this.scheduleGc();else this.#G.remove(this)}continue(){return this.#Y?.continue()??this.execute(this.state.variables)}async execute($){let z=()=>{this.#X({type:"continue"})},G={client:this.#z,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#Y=W1({fn:()=>{if(!this.options.mutationFn)return Promise.reject(Error("No mutationFn found"));return this.options.mutationFn($,G)},onFail:(A,P)=>{this.#X({type:"failed",failureCount:A,error:P})},onPause:()=>{this.#X({type:"pause"})},onContinue:z,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#G.canRun(this)});let X=this.state.status==="pending",Y=!this.#Y.canStart();try{if(X)z();else{this.#X({type:"pending",variables:$,isPaused:Y}),await this.#G.config.onMutate?.($,this,G);let P=await this.options.onMutate?.($,G);if(P!==this.state.context)this.#X({type:"pending",context:P,variables:$,isPaused:Y})}let A=await this.#Y.start();return await this.#G.config.onSuccess?.(A,$,this.state.context,this,G),await this.options.onSuccess?.(A,$,this.state.context,G),await this.#G.config.onSettled?.(A,null,this.state.variables,this.state.context,this,G),await this.options.onSettled?.(A,null,$,this.state.context,G),this.#X({type:"success",data:A}),A}catch(A){try{throw await this.#G.config.onError?.(A,$,this.state.context,this,G),await this.options.onError?.(A,$,this.state.context,G),await this.#G.config.onSettled?.(void 0,A,this.state.variables,this.state.context,this,G),await this.options.onSettled?.(void 0,A,$,this.state.context,G),A}finally{this.#X({type:"error",error:A})}}finally{this.#G.runNext(this)}}#X($){let z=(G)=>{switch($.type){case"failed":return{...G,failureCount:$.failureCount,failureReason:$.error};case"pause":return{...G,isPaused:!0};case"continue":return{...G,isPaused:!1};case"pending":return{...G,context:$.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:$.isPaused,status:"pending",variables:$.variables,submittedAt:Date.now()};case"success":return{...G,data:$.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...G,data:void 0,error:$.error,failureCount:G.failureCount+1,failureReason:$.error,isPaused:!1,status:"error"}}};this.state=z(this.state),I.batch(()=>{this.#$.forEach((G)=>{G.onMutationUpdate($)}),this.#G.notify({mutation:this,type:"updated",action:$})})}};function g1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var w$=class extends l{constructor($={}){super();this.config=$,this.#z=new Set,this.#$=new Map,this.#G=0}#z;#$;#G;build($,z,G){let X=new B$({client:$,mutationCache:this,mutationId:++this.#G,options:$.defaultMutationOptions(z),state:G});return this.add(X),X}add($){this.#z.add($);let z=U1($);if(typeof z==="string"){let G=this.#$.get(z);if(G)G.push($);else this.#$.set(z,[$])}this.notify({type:"added",mutation:$})}remove($){if(this.#z.delete($)){let z=U1($);if(typeof z==="string"){let G=this.#$.get(z);if(G){if(G.length>1){let X=G.indexOf($);if(X!==-1)G.splice(X,1)}else if(G[0]===$)this.#$.delete(z)}}}this.notify({type:"removed",mutation:$})}canRun($){let z=U1($);if(typeof z==="string"){let X=this.#$.get(z)?.find((Y)=>Y.state.status==="pending");return!X||X===$}else return!0}runNext($){let z=U1($);if(typeof z==="string")return this.#$.get(z)?.find((X)=>X!==$&&X.state.isPaused)?.continue()??Promise.resolve();else return Promise.resolve()}clear(){I.batch(()=>{this.#z.forEach(($)=>{this.notify({type:"removed",mutation:$})}),this.#z.clear(),this.#$.clear()})}getAll(){return Array.from(this.#z)}find($){let z={exact:!0,...$};return this.getAll().find((G)=>Z1(z,G))}findAll($={}){return this.getAll().filter((z)=>Z1($,z))}notify($){I.batch(()=>{this.listeners.forEach((z)=>{z($)})})}resumePausedMutations(){let $=this.getAll().filter((z)=>z.state.isPaused);return I.batch(()=>Promise.all($.map((z)=>z.continue().catch(x))))}};function U1($){return $.options.scope?.id}var R1=class extends l{#z;#$=void 0;#G;#Y;constructor($,z){super();this.#z=$,this.setOptions(z),this.bindMethods(),this.#X()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions($){let z=this.options;if(this.options=this.#z.defaultMutationOptions($),!B0(this.options,z))this.#z.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#G,observer:this});if(z?.mutationKey&&this.options.mutationKey&&G0(z.mutationKey)!==G0(this.options.mutationKey))this.reset();else if(this.#G?.state.status==="pending")this.#G.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners())this.#G?.removeObserver(this)}onMutationUpdate($){this.#X(),this.#Z($)}getCurrentResult(){return this.#$}reset(){this.#G?.removeObserver(this),this.#G=void 0,this.#X(),this.#Z()}mutate($,z){return this.#Y=z,this.#G?.removeObserver(this),this.#G=this.#z.getMutationCache().build(this.#z,this.options),this.#G.addObserver(this),this.#G.execute($)}#X(){let $=this.#G?.state??g1();this.#$={...$,isPending:$.status==="pending",isSuccess:$.status==="success",isError:$.status==="error",isIdle:$.status==="idle",mutate:this.mutate,reset:this.reset}}#Z($){I.batch(()=>{if(this.#Y&&this.hasListeners()){let z=this.#$.variables,G=this.#$.context,X={client:this.#z,meta:this.options.meta,mutationKey:this.options.mutationKey};if($?.type==="success")this.#Y.onSuccess?.($.data,z,G,X),this.#Y.onSettled?.($.data,null,z,G,X);else if($?.type==="error")this.#Y.onError?.($.error,z,G,X),this.#Y.onSettled?.(void 0,$.error,z,G,X)}this.listeners.forEach((z)=>{z(this.#$)})})}};function L$($,z){let G=new Set(z);return $.filter((X)=>!G.has(X))}function A2($,z,G){let X=$.slice(0);return X[z]=G,X}var f1=class extends l{#z;#$;#G;#Y;#X;#Z;#A;#J;#N=[];constructor($,z,G){super();this.#z=$,this.#Y=G,this.#G=[],this.#X=[],this.#$=[],this.setQueries(z)}onSubscribe(){if(this.listeners.size===1)this.#X.forEach(($)=>{$.subscribe((z)=>{this.#U($,z)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#X.forEach(($)=>{$.destroy()})}setQueries($,z){this.#G=$,this.#Y=z,I.batch(()=>{let G=this.#X,X=this.#P(this.#G);this.#N=X,X.forEach((W)=>W.observer.setOptions(W.defaultedQueryOptions));let Y=X.map((W)=>W.observer),A=Y.map((W)=>W.getCurrentResult()),P=G.length!==Y.length,J=Y.some((W,Z)=>W!==G[Z]),U=P||J,N=U?!0:A.some((W,Z)=>{let w=this.#$[Z];return!w||!B0(W,w)});if(!U&&!N)return;if(U)this.#X=Y;if(this.#$=A,!this.hasListeners())return;if(U)L$(G,Y).forEach((W)=>{W.destroy()}),L$(Y,G).forEach((W)=>{W.subscribe((Z)=>{this.#U(W,Z)})});this.#W()})}getCurrentResult(){return this.#$}getQueries(){return this.#X.map(($)=>$.getCurrentQuery())}getObservers(){return this.#X}getOptimisticResult($,z){let G=this.#P($),X=G.map((Y)=>Y.observer.getOptimisticResult(Y.defaultedQueryOptions));return[X,(Y)=>{return this.#V(Y??X,z)},()=>{return this.#H(X,G)}]}#H($,z){return z.map((G,X)=>{let Y=$[X];return!G.defaultedQueryOptions.notifyOnChangeProps?G.observer.trackResult(Y,(A)=>{z.forEach((P)=>{P.observer.trackProp(A)})}):Y})}#V($,z){if(z){if(!this.#Z||this.#$!==this.#J||z!==this.#A)this.#A=z,this.#J=this.#$,this.#Z=d0(this.#Z,z($));return this.#Z}return $}#P($){let z=new Map(this.#X.map((X)=>[X.options.queryHash,X])),G=[];return $.forEach((X)=>{let Y=this.#z.defaultQueryOptions(X),A=z.get(Y.queryHash);if(A)G.push({defaultedQueryOptions:Y,observer:A});else G.push({defaultedQueryOptions:Y,observer:new e(this.#z,Y)})}),G}#U($,z){let G=this.#X.indexOf($);if(G!==-1)this.#$=A2(this.#$,G,z),this.#W()}#W(){if(this.hasListeners()){let $=this.#Z,z=this.#H(this.#$,this.#N),G=this.#V(z,this.#Y?.combine);if($!==G)I.batch(()=>{this.listeners.forEach((X)=>{X(this.#$)})})}}};var k$=class extends l{constructor($={}){super();this.config=$,this.#z=new Map}#z;build($,z,G){let X=z.queryKey,Y=z.queryHash??y0(X,z),A=this.get(Y);if(!A)A=new P$({client:$,queryKey:X,queryHash:Y,options:$.defaultQueryOptions(z),state:G,defaultOptions:$.getQueryDefaults(X)}),this.add(A);return A}add($){if(!this.#z.has($.queryHash))this.#z.set($.queryHash,$),this.notify({type:"added",query:$})}remove($){let z=this.#z.get($.queryHash);if(z){if($.destroy(),z===$)this.#z.delete($.queryHash);this.notify({type:"removed",query:$})}}clear(){I.batch(()=>{this.getAll().forEach(($)=>{this.remove($)})})}get($){return this.#z.get($)}getAll(){return[...this.#z.values()]}find($){let z={exact:!0,...$};return this.getAll().find((G)=>Y1(z,G))}findAll($={}){let z=this.getAll();return Object.keys($).length>0?z.filter((G)=>Y1($,G)):z}notify($){I.batch(()=>{this.listeners.forEach((z)=>{z($)})})}onFocus(){I.batch(()=>{this.getAll().forEach(($)=>{$.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(($)=>{$.onOnline()})})}};var W2=class{#z;#$;#G;#Y;#X;#Z;#A;#J;constructor($={}){this.#z=$.queryCache||new k$,this.#$=$.mutationCache||new w$,this.#G=$.defaultOptions||{},this.#Y=new Map,this.#X=new Map,this.#Z=0}mount(){if(this.#Z++,this.#Z!==1)return;this.#A=S0.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#z.onFocus()}),this.#J=O0.subscribe(async($)=>{if($)await this.resumePausedMutations(),this.#z.onOnline()})}unmount(){if(this.#Z--,this.#Z!==0)return;this.#A?.(),this.#A=void 0,this.#J?.(),this.#J=void 0}isFetching($){return this.#z.findAll({...$,fetchStatus:"fetching"}).length}isMutating($){return this.#$.findAll({...$,status:"pending"}).length}getQueryData($){let z=this.defaultQueryOptions({queryKey:$});return this.#z.get(z.queryHash)?.state.data}ensureQueryData($){let z=this.defaultQueryOptions($),G=this.#z.build(this,z),X=G.state.data;if(X===void 0)return this.fetchQuery($);if($.revalidateIfStale&&G.isStaleByTime(t(z.staleTime,G)))this.prefetchQuery(z);return Promise.resolve(X)}getQueriesData($){return this.#z.findAll($).map(({queryKey:z,state:G})=>{let X=G.data;return[z,X]})}setQueryData($,z,G){let X=this.defaultQueryOptions({queryKey:$}),A=this.#z.get(X.queryHash)?.state.data,P=G$(z,A);if(P===void 0)return;return this.#z.build(this,X).setData(P,{...G,manual:!0})}setQueriesData($,z,G){return I.batch(()=>this.#z.findAll($).map(({queryKey:X})=>[X,this.setQueryData(X,z,G)]))}getQueryState($){let z=this.defaultQueryOptions({queryKey:$});return this.#z.get(z.queryHash)?.state}removeQueries($){let z=this.#z;I.batch(()=>{z.findAll($).forEach((G)=>{z.remove(G)})})}resetQueries($,z){let G=this.#z;return I.batch(()=>{return G.findAll($).forEach((X)=>{X.reset()}),this.refetchQueries({type:"active",...$},z)})}cancelQueries($,z={}){let G={revert:!0,...z},X=I.batch(()=>this.#z.findAll($).map((Y)=>Y.cancel(G)));return Promise.all(X).then(x).catch(x)}invalidateQueries($,z={}){return I.batch(()=>{if(this.#z.findAll($).forEach((G)=>{G.invalidate()}),$?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...$,type:$?.refetchType??$?.type??"active"},z)})}refetchQueries($,z={}){let G={...z,cancelRefetch:z.cancelRefetch??!0},X=I.batch(()=>this.#z.findAll($).filter((Y)=>!Y.isDisabled()&&!Y.isStatic()).map((Y)=>{let A=Y.fetch(void 0,G);if(!G.throwOnError)A=A.catch(x);return Y.state.fetchStatus==="paused"?Promise.resolve():A}));return Promise.all(X).then(x)}fetchQuery($){let z=this.defaultQueryOptions($);if(z.retry===void 0)z.retry=!1;let G=this.#z.build(this,z);return G.isStaleByTime(t(z.staleTime,G))?G.fetch(z):Promise.resolve(G.state.data)}prefetchQuery($){return this.fetchQuery($).then(x).catch(x)}fetchInfiniteQuery($){return $.behavior=q0($.pages),this.fetchQuery($)}prefetchInfiniteQuery($){return this.fetchInfiniteQuery($).then(x).catch(x)}ensureInfiniteQueryData($){return $.behavior=q0($.pages),this.ensureQueryData($)}resumePausedMutations(){if(O0.isOnline())return this.#$.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#z}getMutationCache(){return this.#$}getDefaultOptions(){return this.#G}setDefaultOptions($){this.#G=$}setQueryDefaults($,z){this.#Y.set(G0($),{queryKey:$,defaultOptions:z})}getQueryDefaults($){let z=[...this.#Y.values()],G={};return z.forEach((X)=>{if(D0($,X.queryKey))Object.assign(G,X.defaultOptions)}),G}setMutationDefaults($,z){this.#X.set(G0($),{mutationKey:$,defaultOptions:z})}getMutationDefaults($){let z=[...this.#X.values()],G={};return z.forEach((X)=>{if(D0($,X.mutationKey))Object.assign(G,X.defaultOptions)}),G}defaultQueryOptions($){if($._defaulted)return $;let z={...this.#G.queries,...this.getQueryDefaults($.queryKey),...$,_defaulted:!0};if(!z.queryHash)z.queryHash=y0(z.queryKey,z);if(z.refetchOnReconnect===void 0)z.refetchOnReconnect=z.networkMode!=="always";if(z.throwOnError===void 0)z.throwOnError=!!z.suspense;if(!z.networkMode&&z.persister)z.networkMode="offlineFirst";if(z.queryFn===I0)z.enabled=!1;return z}defaultMutationOptions($){if($?._defaulted)return $;return{...this.#G.mutations,...$?.mutationKey&&this.getMutationDefaults($.mutationKey),...$,_defaulted:!0}}clear(){this.#z.clear(),this.#$.clear()}};var g0=X0(W0(),1);var v1=g0.createContext(void 0),C0=($)=>{let z=g0.useContext(v1);if($)return $;if(!z)throw Error("No QueryClient set, use QueryClientProvider to set one");return z},P2=({client:$,children:z})=>{return g0.useEffect(()=>{return $.mount(),()=>{$.unmount()}},[$]),F(v1.Provider,{value:$,children:z})};var w0=X0(W0(),1);var u0=X0(W0(),1);function U2(){let $=!1;return{clearReset:()=>{$=!1},reset:()=>{$=!0},isReset:()=>{return $}}}var H2=u0.createContext(U2()),H1=()=>u0.useContext(H2);var E$=X0(W0(),1);var V1=($,z)=>{if($.suspense||$.throwOnError||$.experimental_prefetchInRender){if(!z.isReset())$.retryOnMount=!1}},N1=($)=>{E$.useEffect(()=>{$.clearReset()},[$])},K1=({result:$,errorResetBoundary:z,throwOnError:G,query:X,suspense:Y})=>{return $.isError&&!z.isReset()&&!$.isFetching&&X&&(Y&&$.data===void 0||p0(G,[$.error,X]))};var B1=X0(W0(),1),D$=B1.createContext(!1),w1=()=>B1.useContext(D$),z4=D$.Provider;var I$=($,z)=>z.state.data===void 0,L1=($)=>{if($.suspense){let G=(Y)=>Y==="static"?Y:Math.max(Y??1000,1000),X=$.staleTime;if($.staleTime=typeof X==="function"?(...Y)=>G(X(...Y)):G(X),typeof $.gcTime==="number")$.gcTime=Math.max($.gcTime,1000)}},k1=($,z)=>$.isLoading&&$.isFetching&&!z,i0=($,z)=>$?.suspense&&z.isPending,R0=($,z,G)=>z.fetchOptimistic($).catch(()=>{G.clearReset()});function f0($,z,G){let X=w1(),Y=H1(),A=C0(G),P=A.defaultQueryOptions($);A.getDefaultOptions().queries?._experimental_beforeQuery?.(P),P._optimisticResults=X?"isRestoring":"optimistic",L1(P),V1(P,Y),N1(Y);let J=!A.getQueryCache().get(P.queryHash),[U]=w0.useState(()=>new z(A,P)),N=U.getOptimisticResult(P),W=!X&&$.subscribed!==!1;if(w0.useSyncExternalStore(w0.useCallback((Z)=>{let w=W?U.subscribe(I.batchCalls(Z)):x;return U.updateResult(),w},[U,W]),()=>U.getCurrentResult(),()=>U.getCurrentResult()),w0.useEffect(()=>{U.setOptions(P)},[P,U]),i0(P,N))throw R0(P,U,Y);if(K1({result:N,errorResetBoundary:Y,throwOnError:P.throwOnError,query:A.getQueryCache().get(P.queryHash),suspense:P.suspense}))throw N.error;if(A.getDefaultOptions().queries?._experimental_afterQuery?.(P,N),P.experimental_prefetchInRender&&!y&&k1(N,X))(J?R0(P,U,Y):A.getQueryCache().get(P.queryHash)?.promise)?.catch(x).finally(()=>{U.updateResult()});return!P.notifyOnChangeProps?U.trackResult(N):N}function V2($,z){return f0($,e,z)}function N2($,z){return f0({...$,enabled:!0,suspense:!0,throwOnError:I$,placeholderData:void 0},e,z)}var P0=X0(W0(),1);function K2($,z){let G=C0(z),[X]=P0.useState(()=>new R1(G,$));P0.useEffect(()=>{X.setOptions($)},[X,$]);let Y=P0.useSyncExternalStore(P0.useCallback((P)=>X.subscribe(I.batchCalls(P)),[X]),()=>X.getCurrentResult(),()=>X.getCurrentResult()),A=P0.useCallback((P,J)=>{X.mutate(P,J).catch(x)},[X]);if(Y.error&&p0(X.options.throwOnError,[Y.error]))throw Y.error;return{...Y,mutate:A,mutateAsync:Y.mutate}}function B2($,z){return f0($,q1,z)}var Y0=X0(W0(),1);function w2({queries:$,...z},G){let X=C0(G),Y=w1(),A=H1(),P=Y0.useMemo(()=>$.map((K)=>{let B=X.defaultQueryOptions(K);return B._optimisticResults=Y?"isRestoring":"optimistic",B}),[$,X,Y]);P.forEach((K)=>{L1(K),V1(K,A)}),N1(A);let[J]=Y0.useState(()=>new f1(X,P,z)),[U,N,W]=J.getOptimisticResult(P,z.combine),Z=!Y&&z.subscribed!==!1;Y0.useSyncExternalStore(Y0.useCallback((K)=>Z?J.subscribe(I.batchCalls(K)):x,[J,Z]),()=>J.getCurrentResult(),()=>J.getCurrentResult()),Y0.useEffect(()=>{J.setQueries(P,z)},[P,z,J]);let L=U.some((K,B)=>i0(P[B],K))?U.flatMap((K,B)=>{let H=P[B];if(H){let D=new e(X,H);if(i0(H,K))return R0(H,D,A);else if(k1(K,Y))R0(H,D,A)}return[]}):[];if(L.length>0)throw Promise.all(L);let k=U.find((K,B)=>{let H=P[B];return H&&K1({result:K,errorResetBoundary:A,throwOnError:H.throwOnError,query:X.getQueryCache().get(H.queryHash),suspense:H.suspense})});if(k?.error)throw k.error;return N(W())}var L2=/^[\w!#$%&'*.^`|~+-]+$/;var k2=($,z,G={})=>{if(!L2.test($))throw Error("Invalid cookie name");let X=`${$}=${z}`;if($.startsWith("__Secure-")&&!G.secure)throw Error("__Secure- Cookie must have Secure attributes");if($.startsWith("__Host-")){if(!G.secure)throw Error("__Host- Cookie must have Secure attributes");if(G.path!=="/")throw Error('__Host- Cookie must have Path attributes with "/"');if(G.domain)throw Error("__Host- Cookie must not have Domain attributes")}for(let Y of["domain","path","sameSite","priority"])if(G[Y]&&/[;\r\n]/.test(G[Y]))throw Error(`${Y} must not contain ";", "\\r", or "\\n"`);if(G&&typeof G.maxAge==="number"&&G.maxAge>=0){if(G.maxAge>34560000)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");X+=`; Max-Age=${G.maxAge|0}`}if(G.domain&&G.prefix!=="host")X+=`; Domain=${G.domain}`;if(G.path)X+=`; Path=${G.path}`;if(G.expires){if(G.expires.getTime()-Date.now()>34560000000)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");X+=`; Expires=${G.expires.toUTCString()}`}if(G.httpOnly)X+="; HttpOnly";if(G.secure)X+="; Secure";if(G.sameSite)X+=`; SameSite=${G.sameSite.charAt(0).toUpperCase()+G.sameSite.slice(1)}`;if(G.priority)X+=`; Priority=${G.priority.charAt(0).toUpperCase()+G.priority.slice(1)}`;if(G.partitioned){if(!G.secure)throw Error("Partitioned Cookie must have Secure attributes");X+="; Partitioned"}return X},C$=($,z,G)=>{return z=encodeURIComponent(z),k2($,z,G)};var F$=($,z)=>{return $=$.replace(/\/+$/,""),$=$+"/",z=z.replace(/^\/+/,""),$+z},D1=($,z)=>{for(let[G,X]of Object.entries(z)){let Y=new RegExp("/:"+G+"(?:{[^/]+})?\\??");$=$.replace(Y,X?`/${X}`:"")}return $},Q$=($)=>{let z=new URLSearchParams;for(let[G,X]of Object.entries($)){if(X===void 0)continue;if(Array.isArray(X))for(let Y of X)z.append(G,Y);else z.set(G,X)}return z},_$=($,z)=>{switch(z){case"ws":return $.replace(/^http/,"ws");case"http":return $.replace(/^ws/,"http")}},h1=($)=>{if(/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test($))return $.replace(/\/index(?=\?|$)/,"/");return $.replace(/\/index(?=\?|$)/,"")};function E1($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function b1($,z){if(!E1($)&&!E1(z))return z;let G={...$};for(let X in z){let Y=z[X];if(E1(G[X])&&E1(Y))G[X]=b1(G[X],Y);else G[X]=Y}return G}var j$=($,z)=>{return new Proxy(()=>{},{get(X,Y){if(typeof Y!=="string"||Y==="then")return;return j$($,[...z,Y])},apply(X,Y,A){return $({path:z,args:A})}})},D2=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor($,z,G){this.url=$,this.method=z,this.buildSearchParams=G.buildSearchParams}fetch=async($,z)=>{if($){if($.query)this.queryParams=this.buildSearchParams($.query);if($.form){let J=new FormData;for(let[U,N]of Object.entries($.form)){if(N===void 0)continue;if(Array.isArray(N))for(let W of N)J.append(U,W);else J.append(U,N)}this.rBody=J}if($.json)this.rBody=JSON.stringify($.json),this.cType="application/json";if($.param)this.pathParams=$.param}let G=this.method.toUpperCase(),X={...$?.header,...typeof z?.headers==="function"?await z.headers():z?.headers};if($?.cookie){let J=[];for(let[U,N]of Object.entries($.cookie))J.push(C$(U,N,{path:"/"}));X.Cookie=J.join(",")}if(this.cType)X["Content-Type"]=this.cType;let Y=new Headers(X??void 0),A=this.url;if(A=h1(A),A=D1(A,this.pathParams),this.queryParams)A=A+"?"+this.queryParams.toString();G=this.method.toUpperCase();let P=!(G==="GET"||G==="HEAD");return(z?.fetch||fetch)(A,{body:P?this.rBody:void 0,method:G,headers:Y,...z?.init})}},m1=($,z)=>j$(function G(X){let Y=z?.buildSearchParams??Q$,A=[...X.path],P=A.slice(-3).reverse();if(P[0]==="toString"){if(P[1]==="name")return P[2]||"";return G.toString()}if(P[0]==="valueOf"){if(P[1]==="name")return P[2]||"";return G}let J="";if(/^\$/.test(P[0])){let Z=A.pop();if(Z)J=Z.replace(/^\$/,"")}let U=A.join("/"),N=F$($,U);if(J==="url"||J==="path"){let Z=N;if(X.args[0]){if(X.args[0].param)Z=D1(N,X.args[0].param);if(X.args[0].query)Z=Z+"?"+Y(X.args[0].query).toString()}if(Z=h1(Z),J==="url")return new URL(Z);return Z.slice($.replace(/\/+$/,"").length).replace(/^\/?/,"/")}if(J==="ws"){let Z=_$(X.args[0]&&X.args[0].param?D1(N,X.args[0].param):N,"ws"),w=new URL(Z),L=X.args[0]?.query;if(L)Object.entries(L).forEach(([K,B])=>{if(Array.isArray(B))B.forEach((H)=>w.searchParams.append(K,H));else w.searchParams.set(K,B)});return((...K)=>{if(z?.webSocket!==void 0&&typeof z.webSocket==="function")return z.webSocket(...K);return new WebSocket(...K)})(w.toString())}let W=new D2(N,J,{buildSearchParams:Y});if(J){z??={};let Z=b1(z,{...X.args[1]});return W.fetch(X.args[0],Z)}return W},[]);var M$=($)=>{let z,G=new Set,X=(N,W)=>{let Z=typeof N==="function"?N(z):N;if(!Object.is(Z,z)){let w=z;z=(W!=null?W:typeof Z!=="object"||Z===null)?Z:Object.assign({},z,Z),G.forEach((L)=>L(z,w))}},Y=()=>z,J={setState:X,getState:Y,getInitialState:()=>U,subscribe:(N)=>{return G.add(N),()=>G.delete(N)}},U=z=$(X,Y,J);return J},x$=($)=>$?M$($):M$;var r0=X0(W0(),1);var I2=($)=>$;function C2($,z=I2){let G=r0.default.useSyncExternalStore($.subscribe,r0.default.useCallback(()=>z($.getState()),[$,z]),r0.default.useCallback(()=>z($.getInitialState()),[$,z]));return r0.default.useDebugValue(G),G}var T$=($)=>{let z=x$($),G=(X)=>C2(z,X);return Object.assign(G,z),G},S$=($)=>$?T$($):T$;var O$=($)=>!!$.dispatchFromDevtools&&typeof $.dispatch==="function",n0=new Map,I1=($)=>{let z=n0.get($);if(!z)return{};return Object.fromEntries(Object.entries(z.stores).map(([G,X])=>[G,X.getState()]))},F2=($,z,G)=>{if($===void 0)return{type:"untracked",connection:z.connect(G)};let X=n0.get(G.name);if(X)return{type:"tracked",store:$,...X};let Y={connection:z.connect(G),stores:{}};return n0.set(G.name,Y),{type:"tracked",store:$,...Y}},Q2=($,z)=>{if(z===void 0)return;let G=n0.get($);if(!G)return;if(delete G.stores[z],Object.keys(G.stores).length===0)n0.delete($)},_2=/.+ (.+) .+/,j2=/^([^@]+)@/;function M2($){var z,G,X;if(!$)return;let Y=$.split(`
2
- `),A=Y.findIndex((J)=>J.includes("api.setState"));if(A<0)return;let P=((z=Y[A+1])==null?void 0:z.trim())||"";return((G=_2.exec(P))==null?void 0:G[1])||((X=j2.exec(P))==null?void 0:X[1])}var x2=($,z={})=>(G,X,Y)=>{let{enabled:A,anonymousActionType:P,store:J,...U}=z,N;try{N=(A!=null?A:(import.meta.env?import.meta.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(K){}if(!N)return $(G,X,Y);let{connection:W,...Z}=F2(J,N,U),w=!0;Y.setState=(K,B,H)=>{let D=G(K,B);if(!w)return D;let j=H===void 0?{type:P||M2(Error().stack)||"anonymous"}:typeof H==="string"?{type:H}:H;if(J===void 0)return W==null||W.send(j,X()),D;return W==null||W.send({...j,type:`${J}/${j.type}`},{...I1(U.name),[J]:Y.getState()}),D},Y.devtools={cleanup:()=>{if(W&&typeof W.unsubscribe==="function")W.unsubscribe();Q2(U.name,J)}};let L=(...K)=>{let B=w;w=!1,G(...K),w=B},k=$(Y.setState,X,Y);if(Z.type==="untracked")W==null||W.init(k);else Z.stores[Z.store]=Y,W==null||W.init(Object.fromEntries(Object.entries(Z.stores).map(([K,B])=>[K,K===Z.store?k:B.getState()])));if(O$(Y)){let K=!1,B=Y.dispatch;Y.dispatch=(...H)=>{if((import.meta.env?import.meta.env.MODE:void 0)!=="production"&&H[0].type==="__setState"&&!K)console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),K=!0;B(...H)}}return W.subscribe((K)=>{var B;switch(K.type){case"ACTION":if(typeof K.payload!=="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return y1(K.payload,(H)=>{if(H.type==="__setState"){if(J===void 0){L(H.state);return}if(Object.keys(H.state).length!==1)console.error(`
3
- [zustand devtools middleware] Unsupported __setState action format.
4
- When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5
- and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
6
- `);let D=H.state[J];if(D===void 0||D===null)return;if(JSON.stringify(Y.getState())!==JSON.stringify(D))L(D);return}if(O$(Y))Y.dispatch(H)});case"DISPATCH":switch(K.payload.type){case"RESET":if(L(k),J===void 0)return W==null?void 0:W.init(Y.getState());return W==null?void 0:W.init(I1(U.name));case"COMMIT":if(J===void 0){W==null||W.init(Y.getState());return}return W==null?void 0:W.init(I1(U.name));case"ROLLBACK":return y1(K.state,(H)=>{if(J===void 0){L(H),W==null||W.init(Y.getState());return}L(H[J]),W==null||W.init(I1(U.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return y1(K.state,(H)=>{if(J===void 0){L(H);return}if(JSON.stringify(Y.getState())!==JSON.stringify(H[J]))L(H[J])});case"IMPORT_STATE":{let{nextLiftedState:H}=K.payload,D=(B=H.computedStates.slice(-1)[0])==null?void 0:B.state;if(!D)return;if(J===void 0)L(D);else L(D[J]);W==null||W.send(null,H);return}case"PAUSE_RECORDING":return w=!w}return}}),k},gz=x2,y1=($,z)=>{let G;try{G=JSON.parse($)}catch(X){console.error("[zustand devtools middleware] Could not parse the received json",X)}if(G!==void 0)z(G)};function l1($,z){let G;try{G=$()}catch(Y){return}return{getItem:(Y)=>{var A;let P=(U)=>{if(U===null)return null;return JSON.parse(U,z==null?void 0:z.reviver)},J=(A=G.getItem(Y))!=null?A:null;if(J instanceof Promise)return J.then(P);return P(J)},setItem:(Y,A)=>G.setItem(Y,JSON.stringify(A,z==null?void 0:z.replacer)),removeItem:(Y)=>G.removeItem(Y)}}var d1=($)=>(z)=>{try{let G=$(z);if(G instanceof Promise)return G;return{then(X){return d1(X)(G)},catch(X){return this}}}catch(G){return{then(X){return this},catch(X){return d1(X)(G)}}}},T2=($,z)=>(G,X,Y)=>{let A={storage:l1(()=>window.localStorage),partialize:(B)=>B,version:0,merge:(B,H)=>({...H,...B}),...z},P=!1,J=0,U=new Set,N=new Set,W=A.storage;if(!W)return $((...B)=>{console.warn(`[zustand persist middleware] Unable to update item '${A.name}', the given storage is currently unavailable.`),G(...B)},X,Y);let Z=()=>{let B=A.partialize({...X()});return W.setItem(A.name,{state:B,version:A.version})},w=Y.setState;Y.setState=(B,H)=>{return w(B,H),Z()};let L=$((...B)=>{return G(...B),Z()},X,Y);Y.getInitialState=()=>L;let k,K=()=>{var B,H;if(!W)return;let D=++J;P=!1,U.forEach((Q)=>{var S;return Q((S=X())!=null?S:L)});let j=((H=A.onRehydrateStorage)==null?void 0:H.call(A,(B=X())!=null?B:L))||void 0;return d1(W.getItem.bind(W))(A.name).then((Q)=>{if(Q)if(typeof Q.version==="number"&&Q.version!==A.version){if(A.migrate){let S=A.migrate(Q.state,Q.version);if(S instanceof Promise)return S.then((f)=>[!0,f]);return[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,Q.state];return[!1,void 0]}).then((Q)=>{var S;if(D!==J)return;let[f,R]=Q;if(k=A.merge(R,(S=X())!=null?S:L),G(k,!0),f)return Z()}).then(()=>{if(D!==J)return;j==null||j(X(),void 0),k=X(),P=!0,N.forEach((Q)=>Q(k))}).catch((Q)=>{if(D!==J)return;j==null||j(void 0,Q)})};if(Y.persist={setOptions:(B)=>{if(A={...A,...B},B.storage)W=B.storage},clearStorage:()=>{W==null||W.removeItem(A.name)},getOptions:()=>A,rehydrate:()=>K(),hasHydrated:()=>P,onHydrate:(B)=>{return U.add(B),()=>{U.delete(B)}},onFinishHydration:(B)=>{return N.add(B),()=>{N.delete(B)}}},!A.skipHydration)K();return k||L},q$=T2;var g$=S$()(q$(($)=>({user:null,setUser:(z)=>$({user:z}),clearAuth:()=>$({user:null})}),{name:"auth-storage",storage:l1(()=>localStorage)}));var S2=async($,z)=>{let G=await fetch($,z);if(G.status===401){let X=$.toString();if(!window.location.pathname.includes("/login")&&!window.location.pathname.includes("/signup")&&!window.location.pathname.startsWith("/share/")&&!X.includes("/api/authn"))g$.getState().clearAuth(),window.location.href="/login"}return G},yz=m1("/",{fetch:S2,init:{credentials:"include"}});function uz({...$}){return F(U0.Root,{"data-slot":"alert-dialog",...$})}function O2({...$}){return F(U0.Portal,{"data-slot":"alert-dialog-portal",...$})}function q2({className:$,...z}){return F(U0.Overlay,{"data-slot":"alert-dialog-overlay",className:m("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",$),...z})}function iz({className:$,size:z="default",...G}){return F0(O2,{children:[F(q2,{}),F(U0.Content,{"data-slot":"alert-dialog-content","data-size":z,className:m("group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs 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 data-[size=default]:sm:max-w-lg",$),...G})]})}function rz({className:$,...z}){return F("div",{"data-slot":"alert-dialog-header",className:m("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",$),...z})}function nz({className:$,...z}){return F("div",{"data-slot":"alert-dialog-footer",className:m("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",$),...z})}function oz({className:$,...z}){return F(U0.Title,{"data-slot":"alert-dialog-title",className:m("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",$),...z})}function az({className:$,...z}){return F(U0.Description,{"data-slot":"alert-dialog-description",className:m("text-sm text-muted-foreground",$),...z})}function sz({className:$,variant:z="default",size:G="default",...X}){return F(o0,{variant:z,size:G,asChild:!0,children:F(U0.Action,{"data-slot":"alert-dialog-action",className:m($),...X})})}function tz({className:$,variant:z="outline",size:G="default",...X}){return F(o0,{variant:z,size:G,asChild:!0,children:F(U0.Cancel,{"data-slot":"alert-dialog-cancel",className:m($),...X})})}function Z8({...$}){return F(Z0.Root,{"data-slot":"dialog",...$})}function J8({...$}){return F(Z0.Trigger,{"data-slot":"dialog-trigger",...$})}function g2({...$}){return F(Z0.Portal,{"data-slot":"dialog-portal",...$})}function R2({className:$,...z}){return F(Z0.Overlay,{"data-slot":"dialog-overlay",className:m("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",$),...z})}function A8({className:$,children:z,showCloseButton:G=!0,...X}){return F0(g2,{"data-slot":"dialog-portal",children:[F(R2,{}),F0(Z0.Content,{"data-slot":"dialog-content",className:m("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none 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 sm:max-w-lg",$),...X,children:[z,G&&F0(Z0.Close,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[F(R$,{}),F("span",{className:"sr-only",children:"Close"})]})]})]})}function W8({className:$,...z}){return F("div",{"data-slot":"dialog-header",className:m("flex flex-col gap-2 text-center sm:text-left",$),...z})}function P8({className:$,showCloseButton:z=!1,children:G,...X}){return F0("div",{"data-slot":"dialog-footer",className:m("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",$),...X,children:[G,z&&F(Z0.Close,{asChild:!0,children:F(o0,{variant:"outline",children:"Close"})})]})}function U8({className:$,...z}){return F(Z0.Title,{"data-slot":"dialog-title",className:m("text-lg leading-none font-semibold",$),...z})}function H8({className:$,...z}){return F(Z0.Description,{"data-slot":"dialog-description",className:m("text-sm text-muted-foreground",$),...z})}var V=X0(W0(),1),h$=X0(f2(),1);function v2($){if(!$||typeof document>"u")return;let z=document.head||document.getElementsByTagName("head")[0],G=document.createElement("style");G.type="text/css",z.appendChild(G),G.styleSheet?G.styleSheet.cssText=$:G.appendChild(document.createTextNode($))}var h2=($)=>{switch($){case"success":return y2;case"info":return l2;case"warning":return d2;case"error":return p2;default:return null}},b2=Array(12).fill(0),m2=({visible:$,className:z})=>{return V.default.createElement("div",{className:["sonner-loading-wrapper",z].filter(Boolean).join(" "),"data-visible":$},V.default.createElement("div",{className:"sonner-spinner"},b2.map((G,X)=>V.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${X}`}))))},y2=V.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},V.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),d2=V.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},V.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),l2=V.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},V.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),p2=V.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},V.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),c2=V.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},V.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),V.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),u2=()=>{let[$,z]=V.default.useState(document.hidden);return V.default.useEffect(()=>{let G=()=>{z(document.hidden)};return document.addEventListener("visibilitychange",G),()=>window.removeEventListener("visibilitychange",G)},[]),$},p1=1;class b${constructor(){this.subscribe=($)=>{return this.subscribers.push($),()=>{let z=this.subscribers.indexOf($);this.subscribers.splice(z,1)}},this.publish=($)=>{this.subscribers.forEach((z)=>z($))},this.addToast=($)=>{this.publish($),this.toasts=[...this.toasts,$]},this.create=($)=>{var z;let{message:G,...X}=$,Y=typeof($==null?void 0:$.id)==="number"||((z=$.id)==null?void 0:z.length)>0?$.id:p1++,A=this.toasts.find((J)=>{return J.id===Y}),P=$.dismissible===void 0?!0:$.dismissible;if(this.dismissedToasts.has(Y))this.dismissedToasts.delete(Y);if(A)this.toasts=this.toasts.map((J)=>{if(J.id===Y)return this.publish({...J,...$,id:Y,title:G}),{...J,...$,id:Y,dismissible:P,title:G};return J});else this.addToast({title:G,...X,dismissible:P,id:Y});return Y},this.dismiss=($)=>{if($)this.dismissedToasts.add($),requestAnimationFrame(()=>this.subscribers.forEach((z)=>z({id:$,dismiss:!0})));else this.toasts.forEach((z)=>{this.subscribers.forEach((G)=>G({id:z.id,dismiss:!0}))});return $},this.message=($,z)=>{return this.create({...z,message:$})},this.error=($,z)=>{return this.create({...z,message:$,type:"error"})},this.success=($,z)=>{return this.create({...z,type:"success",message:$})},this.info=($,z)=>{return this.create({...z,type:"info",message:$})},this.warning=($,z)=>{return this.create({...z,type:"warning",message:$})},this.loading=($,z)=>{return this.create({...z,type:"loading",message:$})},this.promise=($,z)=>{if(!z)return;let G=void 0;if(z.loading!==void 0)G=this.create({...z,promise:$,type:"loading",message:z.loading,description:typeof z.description!=="function"?z.description:void 0});let X=Promise.resolve($ instanceof Function?$():$),Y=G!==void 0,A,P=X.then(async(U)=>{if(A=["resolve",U],V.default.isValidElement(U))Y=!1,this.create({id:G,type:"default",message:U});else if(r2(U)&&!U.ok){Y=!1;let W=typeof z.error==="function"?await z.error(`HTTP error! status: ${U.status}`):z.error,Z=typeof z.description==="function"?await z.description(`HTTP error! status: ${U.status}`):z.description,L=typeof W==="object"&&!V.default.isValidElement(W)?W:{message:W};this.create({id:G,type:"error",description:Z,...L})}else if(U instanceof Error){Y=!1;let W=typeof z.error==="function"?await z.error(U):z.error,Z=typeof z.description==="function"?await z.description(U):z.description,L=typeof W==="object"&&!V.default.isValidElement(W)?W:{message:W};this.create({id:G,type:"error",description:Z,...L})}else if(z.success!==void 0){Y=!1;let W=typeof z.success==="function"?await z.success(U):z.success,Z=typeof z.description==="function"?await z.description(U):z.description,L=typeof W==="object"&&!V.default.isValidElement(W)?W:{message:W};this.create({id:G,type:"success",description:Z,...L})}}).catch(async(U)=>{if(A=["reject",U],z.error!==void 0){Y=!1;let N=typeof z.error==="function"?await z.error(U):z.error,W=typeof z.description==="function"?await z.description(U):z.description,w=typeof N==="object"&&!V.default.isValidElement(N)?N:{message:N};this.create({id:G,type:"error",description:W,...w})}}).finally(()=>{if(Y)this.dismiss(G),G=void 0;z.finally==null||z.finally.call(z)}),J=()=>new Promise((U,N)=>P.then(()=>A[0]==="reject"?N(A[1]):U(A[1])).catch(N));if(typeof G!=="string"&&typeof G!=="number")return{unwrap:J};else return Object.assign(G,{unwrap:J})},this.custom=($,z)=>{let G=(z==null?void 0:z.id)||p1++;return this.create({jsx:$(G),id:G,...z}),G},this.getActiveToasts=()=>{return this.toasts.filter(($)=>!this.dismissedToasts.has($.id))},this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}var p=new b$,i2=($,z)=>{let G=(z==null?void 0:z.id)||p1++;return p.addToast({title:$,...z,id:G}),G},r2=($)=>{return $&&typeof $==="object"&&"ok"in $&&typeof $.ok==="boolean"&&"status"in $&&typeof $.status==="number"},n2=i2,o2=()=>p.toasts,a2=()=>p.getActiveToasts(),K8=Object.assign(n2,{success:p.success,info:p.info,warning:p.warning,error:p.error,custom:p.custom,message:p.message,promise:p.promise,dismiss:p.dismiss,loading:p.loading},{getHistory:o2,getToasts:a2});v2("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function C1($){return $.label!==void 0}var s2=3,t2="24px",e2="16px",f$=4000,$5=356,z5=14,G5=45,X5=200;function J0(...$){return $.filter(Boolean).join(" ")}function Y5($){let[z,G]=$.split("-"),X=[];if(z)X.push(z);if(G)X.push(G);return X}var Z5=($)=>{var z,G,X,Y,A,P,J,U,N;let{invert:W,toast:Z,unstyled:w,interacting:L,setHeights:k,visibleToasts:K,heights:B,index:H,toasts:D,expanded:j,removeToast:Q,defaultRichColors:S,closeButton:f,style:R,cancelButtonStyle:q,actionButtonStyle:H0,className:n="",descriptionClassName:V0="",duration:v0,position:$0,gap:a0,expandByDefault:h0,classNames:_,icons:v,closeButtonAriaLabel:N0="Close toast"}=$,[L0,o]=V.default.useState(null),[k0,s0]=V.default.useState(null),[C,O]=V.default.useState(!1),[T,i]=V.default.useState(!1),[Q0,M]=V.default.useState(!1),[_0,t0]=V.default.useState(!1),[e0,j0]=V.default.useState(!1),[m$,F1]=V.default.useState(0),[y$,c1]=V.default.useState(0),b0=V.default.useRef(Z.duration||v0||f$),u1=V.default.useRef(null),A0=V.default.useRef(null),d$=H===0,l$=H+1<=K,c=Z.type,M0=Z.dismissible!==!1,p$=Z.className||"",c$=Z.descriptionClassName||"",$1=V.default.useMemo(()=>B.findIndex((E)=>E.toastId===Z.id)||0,[B,Z.id]),u$=V.default.useMemo(()=>{var E;return(E=Z.closeButton)!=null?E:f},[Z.closeButton,f]),i1=V.default.useMemo(()=>Z.duration||v0||f$,[Z.duration,v0]),Q1=V.default.useRef(0),x0=V.default.useRef(0),r1=V.default.useRef(0),T0=V.default.useRef(null),[i$,r$]=$0.split("-"),n1=V.default.useMemo(()=>{return B.reduce((E,g,h)=>{if(h>=$1)return E;return E+g.height},0)},[B,$1]),o1=u2(),n$=Z.invert||W,_1=c==="loading";x0.current=V.default.useMemo(()=>$1*a0+n1,[$1,n1]),V.default.useEffect(()=>{b0.current=i1},[i1]),V.default.useEffect(()=>{O(!0)},[]),V.default.useEffect(()=>{let E=A0.current;if(E){let g=E.getBoundingClientRect().height;return c1(g),k((h)=>[{toastId:Z.id,height:g,position:Z.position},...h]),()=>k((h)=>h.filter((u)=>u.toastId!==Z.id))}},[k,Z.id]),V.default.useLayoutEffect(()=>{if(!C)return;let E=A0.current,g=E.style.height;E.style.height="auto";let h=E.getBoundingClientRect().height;E.style.height=g,c1(h),k((u)=>{if(!u.find((b)=>b.toastId===Z.id))return[{toastId:Z.id,height:h,position:Z.position},...u];else return u.map((b)=>b.toastId===Z.id?{...b,height:h}:b)})},[C,Z.title,Z.description,k,Z.id,Z.jsx,Z.action,Z.cancel]);let K0=V.default.useCallback(()=>{i(!0),F1(x0.current),k((E)=>E.filter((g)=>g.toastId!==Z.id)),setTimeout(()=>{Q(Z)},X5)},[Z,Q,k,x0]);V.default.useEffect(()=>{if(Z.promise&&c==="loading"||Z.duration===1/0||Z.type==="loading")return;let E,g=()=>{if(r1.current<Q1.current){let u=new Date().getTime()-Q1.current;b0.current=b0.current-u}r1.current=new Date().getTime()},h=()=>{if(b0.current===1/0)return;Q1.current=new Date().getTime(),E=setTimeout(()=>{Z.onAutoClose==null||Z.onAutoClose.call(Z,Z),K0()},b0.current)};if(j||L||o1)g();else h();return()=>clearTimeout(E)},[j,L,Z,c,o1,K0]),V.default.useEffect(()=>{if(Z.delete)K0(),Z.onDismiss==null||Z.onDismiss.call(Z,Z)},[K0,Z.delete]);function o$(){var E;if(v==null?void 0:v.loading){var g;return V.default.createElement("div",{className:J0(_==null?void 0:_.loader,Z==null?void 0:(g=Z.classNames)==null?void 0:g.loader,"sonner-loader"),"data-visible":c==="loading"},v.loading)}return V.default.createElement(m2,{className:J0(_==null?void 0:_.loader,Z==null?void 0:(E=Z.classNames)==null?void 0:E.loader),visible:c==="loading"})}let a$=Z.icon||(v==null?void 0:v[c])||h2(c);var a1,s1;return V.default.createElement("li",{tabIndex:0,ref:A0,className:J0(n,p$,_==null?void 0:_.toast,Z==null?void 0:(z=Z.classNames)==null?void 0:z.toast,_==null?void 0:_.default,_==null?void 0:_[c],Z==null?void 0:(G=Z.classNames)==null?void 0:G[c]),"data-sonner-toast":"","data-rich-colors":(a1=Z.richColors)!=null?a1:S,"data-styled":!Boolean(Z.jsx||Z.unstyled||w),"data-mounted":C,"data-promise":Boolean(Z.promise),"data-swiped":e0,"data-removed":T,"data-visible":l$,"data-y-position":i$,"data-x-position":r$,"data-index":H,"data-front":d$,"data-swiping":Q0,"data-dismissible":M0,"data-type":c,"data-invert":n$,"data-swipe-out":_0,"data-swipe-direction":k0,"data-expanded":Boolean(j||h0&&C),"data-testid":Z.testId,style:{"--index":H,"--toasts-before":H,"--z-index":D.length-H,"--offset":`${T?m$:x0.current}px`,"--initial-height":h0?"auto":`${y$}px`,...R,...Z.style},onDragEnd:()=>{M(!1),o(null),T0.current=null},onPointerDown:(E)=>{if(E.button===2)return;if(_1||!M0)return;if(u1.current=new Date,F1(x0.current),E.target.setPointerCapture(E.pointerId),E.target.tagName==="BUTTON")return;M(!0),T0.current={x:E.clientX,y:E.clientY}},onPointerUp:()=>{var E,g,h;if(_0||!M0)return;T0.current=null;let u=Number(((E=A0.current)==null?void 0:E.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),z1=Number(((g=A0.current)==null?void 0:g.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),b=new Date().getTime()-((h=u1.current)==null?void 0:h.getTime()),r=L0==="x"?u:z1,G1=Math.abs(r)/b;if(Math.abs(r)>=G5||G1>0.11){if(F1(x0.current),Z.onDismiss==null||Z.onDismiss.call(Z,Z),L0==="x")s0(u>0?"right":"left");else s0(z1>0?"down":"up");K0(),t0(!0);return}else{var a,s;(a=A0.current)==null||a.style.setProperty("--swipe-amount-x","0px"),(s=A0.current)==null||s.style.setProperty("--swipe-amount-y","0px")}j0(!1),M(!1),o(null)},onPointerMove:(E)=>{var g,h,u;if(!T0.current||!M0)return;if(((g=window.getSelection())==null?void 0:g.toString().length)>0)return;let b=E.clientY-T0.current.y,r=E.clientX-T0.current.x;var G1;let a=(G1=$.swipeDirections)!=null?G1:Y5($0);if(!L0&&(Math.abs(r)>1||Math.abs(b)>1))o(Math.abs(r)>Math.abs(b)?"x":"y");let s={x:0,y:0},t1=(E0)=>{return 1/(1.5+Math.abs(E0)/20)};if(L0==="y"){if(a.includes("top")||a.includes("bottom"))if(a.includes("top")&&b<0||a.includes("bottom")&&b>0)s.y=b;else{let E0=b*t1(b);s.y=Math.abs(E0)<Math.abs(b)?E0:b}}else if(L0==="x"){if(a.includes("left")||a.includes("right"))if(a.includes("left")&&r<0||a.includes("right")&&r>0)s.x=r;else{let E0=r*t1(r);s.x=Math.abs(E0)<Math.abs(r)?E0:r}}if(Math.abs(s.x)>0||Math.abs(s.y)>0)j0(!0);(h=A0.current)==null||h.style.setProperty("--swipe-amount-x",`${s.x}px`),(u=A0.current)==null||u.style.setProperty("--swipe-amount-y",`${s.y}px`)}},u$&&!Z.jsx&&c!=="loading"?V.default.createElement("button",{"aria-label":N0,"data-disabled":_1,"data-close-button":!0,onClick:_1||!M0?()=>{}:()=>{K0(),Z.onDismiss==null||Z.onDismiss.call(Z,Z)},className:J0(_==null?void 0:_.closeButton,Z==null?void 0:(X=Z.classNames)==null?void 0:X.closeButton)},(s1=v==null?void 0:v.close)!=null?s1:c2):null,(c||Z.icon||Z.promise)&&Z.icon!==null&&((v==null?void 0:v[c])!==null||Z.icon)?V.default.createElement("div",{"data-icon":"",className:J0(_==null?void 0:_.icon,Z==null?void 0:(Y=Z.classNames)==null?void 0:Y.icon)},Z.promise||Z.type==="loading"&&!Z.icon?Z.icon||o$():null,Z.type!=="loading"?a$:null):null,V.default.createElement("div",{"data-content":"",className:J0(_==null?void 0:_.content,Z==null?void 0:(A=Z.classNames)==null?void 0:A.content)},V.default.createElement("div",{"data-title":"",className:J0(_==null?void 0:_.title,Z==null?void 0:(P=Z.classNames)==null?void 0:P.title)},Z.jsx?Z.jsx:typeof Z.title==="function"?Z.title():Z.title),Z.description?V.default.createElement("div",{"data-description":"",className:J0(V0,c$,_==null?void 0:_.description,Z==null?void 0:(J=Z.classNames)==null?void 0:J.description)},typeof Z.description==="function"?Z.description():Z.description):null),V.default.isValidElement(Z.cancel)?Z.cancel:Z.cancel&&C1(Z.cancel)?V.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:Z.cancelButtonStyle||q,onClick:(E)=>{if(!C1(Z.cancel))return;if(!M0)return;Z.cancel.onClick==null||Z.cancel.onClick.call(Z.cancel,E),K0()},className:J0(_==null?void 0:_.cancelButton,Z==null?void 0:(U=Z.classNames)==null?void 0:U.cancelButton)},Z.cancel.label):null,V.default.isValidElement(Z.action)?Z.action:Z.action&&C1(Z.action)?V.default.createElement("button",{"data-button":!0,"data-action":!0,style:Z.actionButtonStyle||H0,onClick:(E)=>{if(!C1(Z.action))return;if(Z.action.onClick==null||Z.action.onClick.call(Z.action,E),E.defaultPrevented)return;K0()},className:J0(_==null?void 0:_.actionButton,Z==null?void 0:(N=Z.classNames)==null?void 0:N.actionButton)},Z.action.label):null)};function v$(){if(typeof window>"u")return"ltr";if(typeof document>"u")return"ltr";let $=document.documentElement.getAttribute("dir");if($==="auto"||!$)return window.getComputedStyle(document.documentElement).direction;return $}function J5($,z){let G={};return[$,z].forEach((X,Y)=>{let A=Y===1,P=A?"--mobile-offset":"--offset",J=A?e2:t2;function U(N){["top","right","bottom","left"].forEach((W)=>{G[`${P}-${W}`]=typeof N==="number"?`${N}px`:N})}if(typeof X==="number"||typeof X==="string")U(X);else if(typeof X==="object")["top","right","bottom","left"].forEach((N)=>{if(X[N]===void 0)G[`${P}-${N}`]=J;else G[`${P}-${N}`]=typeof X[N]==="number"?`${X[N]}px`:X[N]});else U(J)}),G}var B8=V.default.forwardRef(function(z,G){let{id:X,invert:Y,position:A="bottom-right",hotkey:P=["altKey","KeyT"],expand:J,closeButton:U,className:N,offset:W,mobileOffset:Z,theme:w="light",richColors:L,duration:k,style:K,visibleToasts:B=s2,toastOptions:H,dir:D=v$(),gap:j=z5,icons:Q,containerAriaLabel:S="Notifications"}=z,[f,R]=V.default.useState([]),q=V.default.useMemo(()=>{if(X)return f.filter((C)=>C.toasterId===X);return f.filter((C)=>!C.toasterId)},[f,X]),H0=V.default.useMemo(()=>{return Array.from(new Set([A].concat(q.filter((C)=>C.position).map((C)=>C.position))))},[q,A]),[n,V0]=V.default.useState([]),[v0,$0]=V.default.useState(!1),[a0,h0]=V.default.useState(!1),[_,v]=V.default.useState(w!=="system"?w:typeof window<"u"?window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":"light"),N0=V.default.useRef(null),L0=P.join("+").replace(/Key/g,"").replace(/Digit/g,""),o=V.default.useRef(null),k0=V.default.useRef(!1),s0=V.default.useCallback((C)=>{R((O)=>{var T;if(!((T=O.find((i)=>i.id===C.id))==null?void 0:T.delete))p.dismiss(C.id);return O.filter(({id:i})=>i!==C.id)})},[]);return V.default.useEffect(()=>{return p.subscribe((C)=>{if(C.dismiss){requestAnimationFrame(()=>{R((O)=>O.map((T)=>T.id===C.id?{...T,delete:!0}:T))});return}setTimeout(()=>{h$.default.flushSync(()=>{R((O)=>{let T=O.findIndex((i)=>i.id===C.id);if(T!==-1)return[...O.slice(0,T),{...O[T],...C},...O.slice(T+1)];return[C,...O]})})})})},[f]),V.default.useEffect(()=>{if(w!=="system"){v(w);return}if(w==="system")if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)v("dark");else v("light");if(typeof window>"u")return;let C=window.matchMedia("(prefers-color-scheme: dark)");try{C.addEventListener("change",({matches:O})=>{if(O)v("dark");else v("light")})}catch(O){C.addListener(({matches:T})=>{try{if(T)v("dark");else v("light")}catch(i){console.error(i)}})}},[w]),V.default.useEffect(()=>{if(f.length<=1)$0(!1)},[f]),V.default.useEffect(()=>{let C=(O)=>{var T;if(P.every((M)=>O[M]||O.code===M)){var Q0;$0(!0),(Q0=N0.current)==null||Q0.focus()}if(O.code==="Escape"&&(document.activeElement===N0.current||((T=N0.current)==null?void 0:T.contains(document.activeElement))))$0(!1)};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[P]),V.default.useEffect(()=>{if(N0.current)return()=>{if(o.current)o.current.focus({preventScroll:!0}),o.current=null,k0.current=!1}},[N0.current]),V.default.createElement("section",{ref:G,"aria-label":`${S} ${L0}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},H0.map((C,O)=>{var T;let[i,Q0]=C.split("-");if(!q.length)return null;return V.default.createElement("ol",{key:C,dir:D==="auto"?v$():D,tabIndex:-1,ref:N0,className:N,"data-sonner-toaster":!0,"data-sonner-theme":_,"data-y-position":i,"data-x-position":Q0,style:{"--front-toast-height":`${((T=n[0])==null?void 0:T.height)||0}px`,"--width":`${$5}px`,"--gap":`${j}px`,...K,...J5(W,Z)},onBlur:(M)=>{if(k0.current&&!M.currentTarget.contains(M.relatedTarget)){if(k0.current=!1,o.current)o.current.focus({preventScroll:!0}),o.current=null}},onFocus:(M)=>{if(M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false")return;if(!k0.current)k0.current=!0,o.current=M.relatedTarget},onMouseEnter:()=>$0(!0),onMouseMove:()=>$0(!0),onMouseLeave:()=>{if(!a0)$0(!1)},onDragEnd:()=>$0(!1),onPointerDown:(M)=>{if(M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false")return;h0(!0)},onPointerUp:()=>h0(!1)},q.filter((M)=>!M.position&&O===0||M.position===C).map((M,_0)=>{var t0,e0;return V.default.createElement(Z5,{key:M.id,icons:Q,index:_0,toast:M,defaultRichColors:L,duration:(t0=H==null?void 0:H.duration)!=null?t0:k,className:H==null?void 0:H.className,descriptionClassName:H==null?void 0:H.descriptionClassName,invert:Y,visibleToasts:B,closeButton:(e0=H==null?void 0:H.closeButton)!=null?e0:U,interacting:a0,position:C,style:H==null?void 0:H.style,unstyled:H==null?void 0:H.unstyled,classNames:H==null?void 0:H.classNames,cancelButtonStyle:H==null?void 0:H.cancelButtonStyle,actionButtonStyle:H==null?void 0:H.actionButtonStyle,closeButtonAriaLabel:H==null?void 0:H.closeButtonAriaLabel,removeToast:s0,toasts:q.filter((j0)=>j0.position==M.position),heights:n.filter((j0)=>j0.position==M.position),setHeights:V0,expandByDefault:J,gap:j,expanded:v0,swipeDirections:z.swipeDirections})}))}))});
7
- export{$2 as oi,W2 as pi,C0 as qi,P2 as ri,w2 as si,V2 as ti,N2 as ui,K2 as vi,B2 as wi,S$ as xi,gz as yi,l1 as zi,q$ as Ai,g$ as Bi,yz as Ci,uz as Di,iz as Ei,rz as Fi,nz as Gi,oz as Hi,az as Ii,sz as Ji,tz as Ki,Z8 as Li,J8 as Mi,A8 as Ni,W8 as Oi,P8 as Pi,U8 as Qi,H8 as Ri,K8 as Si,B8 as Ti};
@@ -1,2 +0,0 @@
1
- import{xi as Z}from"./chunk-8nyve0cr.js";import{Vi as W,Xi as b,Yi as Y}from"./chunk-kqpzx5az.js";import{kn as R}from"./chunk-p49h5fxs.js";var r=Z((u)=>({uploading:0,tasks:{},fileProgress:{},increment:()=>u((d)=>({uploading:d.uploading+1})),decrement:()=>u((d)=>({uploading:d.uploading-1})),startTask:(d,k,F)=>u((o)=>{let l={},s=0;F.forEach((f)=>{l[f.fileId]={fileId:f.fileId,name:f.name,loaded:0,total:f.size,status:"uploading"},s+=f.size});let g={...o.tasks,[d]:{taskId:d,name:k,loaded:0,total:s,files:l}},P={...o.fileProgress};return F.forEach((f)=>{P[f.fileId]=l[f.fileId]}),{tasks:g,fileProgress:P}}),updateFileProgress:(d,k,F)=>u((o)=>{let l=o.tasks[d];if(!l)return{};let s=l.files[k];if(!s)return{};let g={...s,loaded:F},P={...l.files,[k]:g},f=Object.values(P).reduce((p,w)=>p+w.loaded,0);return{tasks:{...o.tasks,[d]:{...l,loaded:f,files:P}},fileProgress:{...o.fileProgress,[k]:g}}}),completeFile:(d,k)=>u((F)=>{let o=F.tasks[d];if(!o)return{};let l=o.files[k];if(!l)return{};let s={...l,status:"completed",loaded:l.total},g={...o.files,[k]:s},P=Object.values(g).reduce((f,p)=>f+p.loaded,0);return{tasks:{...F.tasks,[d]:{...o,loaded:P,files:g}},fileProgress:{...F.fileProgress,[k]:s}}}),failFile:(d,k)=>u((F)=>{let o=F.tasks[d];if(!o)return{};let l=o.files[k];if(!l)return{};let s={...l,status:"failed"},g={...o.files,[k]:s},P=Object.values(g).reduce((f,p)=>f+p.loaded,0);return{tasks:{...F.tasks,[d]:{...o,loaded:P,files:g}},fileProgress:{...F.fileProgress,[k]:s}}})}));var a=R(W(),1);var q=10,Q=10,$=q*Q,S=({spriteUrl:u,thumbnailUrl:d,videoWidth:k,videoHeight:F,className:o=""})=>{let l=a.useRef(null),[s,g]=a.useState({width:0,height:0}),[P,f]=a.useState({width:0,height:0}),[p,w]=a.useState(!1),[c,E]=a.useState(!1),[V,J]=a.useState(!1),[K,N]=a.useState(0),[j,n]=a.useState(0);a.useEffect(()=>{if(!l.current)return;let t=new ResizeObserver((m)=>{for(let B of m)g({width:B.contentRect.width,height:B.contentRect.height})});return t.observe(l.current),()=>t.disconnect()},[]);let X=a.useCallback(()=>{if(c||V)return;J(!0);let t=new Image;t.src=u,t.onload=()=>{f({width:t.naturalWidth,height:t.naturalHeight}),E(!0),J(!1)},t.onerror=()=>{console.error("Failed to load sprite image"),J(!1)}},[u,c,V]),M=()=>{w(!0),X()},A=()=>{w(!1)},D=(t)=>{if(!l.current)return;let m=l.current.getBoundingClientRect(),B=t.clientX-m.left,y=Math.max(0,Math.min(B,m.width));n(y);let T=y/m.width,U=Math.min(Math.floor(T*$),$-1);N(U)},G=a.useMemo(()=>{if(s.width===0||s.height===0)return{};let t=k/F;if(P.width>0&&P.height>0){let z=P.width/q,i=P.height/Q;t=z/i}let m=s.width/s.height,B,y;if(m>t)y=s.height,B=y*t;else B=s.width,y=B/t;let T=Math.ceil(B),U=Math.ceil(y),I=T*q,O=U*Q,v=K%q,x=Math.floor(K/q),C=-(v*T),_=-(x*U);return{backgroundImage:`url(${u})`,backgroundSize:`${I}px ${O}px`,backgroundPosition:`${C}px ${_}px`,backgroundRepeat:"no-repeat",width:`${T}px`,height:`${U}px`,imageRendering:"auto"}},[s,k,F,K,u,P]);return Y("div",{ref:l,className:`relative w-full h-full overflow-hidden cursor-crosshair group bg-black select-none ${o}`,onMouseEnter:M,onMouseLeave:A,onMouseMove:D,children:[b("img",{src:d,alt:"Thumbnail",className:`absolute inset-0 w-full h-full object-contain transition-opacity duration-200 ${p&&c?"opacity-0":"opacity-100"}`,draggable:!1}),p&&!c&&b("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:b("div",{className:"w-6 h-6 border-2 border-white/30 border-t-white rounded-full animate-spin"})}),c&&b("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-75 ${p?"opacity-100":"opacity-0"}`,children:b("div",{style:G})}),p&&b("div",{className:"absolute top-0 bottom-0 w-0.5 bg-red-500 shadow-[0_0_4px_rgba(255,0,0,0.8)] z-20 pointer-events-none",style:{transform:`translateX(${j}px)`}})]})};
2
- export{S as hf,r as if};
@@ -1 +0,0 @@
1
- import{o as a}from"./chunk-k7chm9a9.js";import"./chunk-f2zbsrc9.js";import"./chunk-by6g0vye.js";import"./chunk-gcpr2a24.js";import"./chunk-nn0px81k.js";import"./chunk-mha3rsh7.js";import"./chunk-jt6d0zb1.js";import"./chunk-4b7jcpgv.js";import"./chunk-djx2r4nj.js";import"./chunk-y3dy4pdt.js";import"./chunk-mgnxa0vy.js";import"./chunk-csqvmx1m.js";import"./chunk-ysvhtgve.js";import"./chunk-1fwzepfn.js";import"./chunk-ex2ym5pz.js";import"./chunk-34kaja59.js";import"./chunk-x9akgj7w.js";import"./chunk-ajndx51c.js";import"./chunk-93ecxcy4.js";import"./chunk-mhps85dd.js";import"./chunk-r2shjtte.js";import"./chunk-ns804tmv.js";import"./chunk-ymr5ybxk.js";import"./chunk-2xevs82j.js";import"./chunk-y2s0tjaa.js";import"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import"./chunk-rkz6x3r0.js";import"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import"./chunk-tcm57j8r.js";import"./chunk-0bfqrx5q.js";import"./chunk-dkjkn8t3.js";import"./chunk-76433x4d.js";import"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import"./chunk-6m1k317a.js";import"./chunk-kxr8fjsq.js";import"./chunk-02afmyqy.js";import"./chunk-8nyve0cr.js";import"./chunk-62ebss6h.js";import{Xi as e,gj as t}from"./chunk-kqpzx5az.js";import"./chunk-p49h5fxs.js";function n(){let{shareId:s}=o.useParams();return e(a,{shareId:s})}var o=t("/share/$shareId/")({component:n});export{o as Route};
@@ -1 +0,0 @@
1
- import{a as QJ,b as a,c as dJ}from"./chunk-vvhs586e.js";import{i as c,j as i,k as j,l as R,m as q,n as E}from"./chunk-sx6y697s.js";import{_ as LJ}from"./chunk-jt6d0zb1.js";import{$ as _J,aa as u}from"./chunk-4b7jcpgv.js";import{ve as jJ}from"./chunk-gcc6pte2.js";import{bf as v,cf as T,df as I,ef as b,ff as g}from"./chunk-x9akgj7w.js";import{Lf as O}from"./chunk-ymr5ybxk.js";import{Mf as kJ,Nf as FJ,Of as MJ,_f as mJ,bg as HJ}from"./chunk-2xevs82j.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import"./chunk-vhcqazqf.js";import{eh as JJ}from"./chunk-tcm57j8r.js";import"./chunk-dkjkn8t3.js";import{Ch as KJ,Eh as EJ}from"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import{$h as A,Zh as S,_h as C}from"./chunk-kxr8fjsq.js";import{Ci as M,Di as TJ,Ei as IJ,Fi as bJ,Gi as gJ,Hi as nJ,Ii as uJ,Ji as cJ,Ki as iJ,Si as qJ,qi as SJ,si as BJ,ti as D,vi as CJ,wi as e}from"./chunk-8nyve0cr.js";import{El as pJ,Fj as l,Gl as vJ,Hl as NJ,Ll as lJ,Pl as s,Uk as r,Vi as t,Wi as hJ,Wj as AJ,Wl as YJ,Xi as J,Yi as K,ck as ZJ,gj as tJ,jm as n,kl as $J,mm as W,nj as rJ,nm as XJ,ol as aJ,pj as GJ,rk as x,vj as wJ,wj as k}from"./chunk-kqpzx5az.js";import{kn as o}from"./chunk-p49h5fxs.js";var sJ=o(t(),1);var VJ=o(t(),1);function UJ({teamId:Y}){let[Z,z]=VJ.useState("team"),[G,Q]=VJ.useState("1h"),{data:V,isLoading:H}=D({queryKey:["teams",Y,"ai-usage",G,"team"],queryFn:async()=>{let _=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:Y},query:{timeframe:G}});if(!_.ok)throw Error("Failed to fetch team AI usage");return await _.json()},enabled:!!Y&&Z==="team"}),{data:f,isLoading:y}=D({queryKey:["teams",Y,"members"],queryFn:async()=>{let _=await M.api.teams[":teamId"].members.$get({param:{teamId:Y},query:{}});if(!_.ok)throw Error("Failed to fetch team members");return await _.json()},enabled:!!Y&&Z==="members"}),P=BJ({queries:(f||[]).map((_)=>({queryKey:["teams",Y,"ai-usage",G,_.id],queryFn:async()=>{let L=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:Y},query:{timeframe:G,userId:_.id}});if(!L.ok)throw Error(`Failed to fetch AI usage for member ${_.id}`);return await L.json()},enabled:!!Y&&Z==="members"}))}),B=y||P.some((_)=>_.isLoading),U=(_)=>{if(!_)return"U";let L=_.split(" ");if(L.length>1)return`${L[0][0]}${L[L.length-1][0]}`.toUpperCase();return _.substring(0,2).toUpperCase()},F=(_)=>{if(!_)return"";switch(_.toLowerCase()){case"owner":return W.owner();case"editor":return W.editor();case"reviewer":return W.reviewer();default:return _}},X=(_)=>(_??0).toLocaleString(),w=(_)=>`$${(_??0).toFixed(6)}`;return K(v,{className:"border-border/60 shadow-sm",children:[K(T,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[K("div",{children:[J(I,{className:"text-xl font-semibold tracking-tight",children:W.ai_usage()}),J(b,{className:"text-sm text-muted-foreground mt-1",children:W.ai_usage_description()})]}),K("div",{className:"flex flex-wrap items-center gap-3",children:[K(_J,{type:"single",value:Z,onValueChange:(_)=>{if(_)z(_)},className:"border rounded-lg p-1 bg-muted/30",children:[J(u,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:W.team_view()}),J(u,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:W.members_view()})]}),K(_J,{type:"single",value:G,onValueChange:(_)=>{if(_)Q(_)},className:"border rounded-lg p-1 bg-muted/30",children:[J(u,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),J(u,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),J(u,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),J(u,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),J(g,{children:Z==="team"?H?J("div",{className:"flex h-48 items-center justify-center",children:J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(c,{children:[J(i,{children:K(R,{children:[J(q,{children:W.team()}),J(q,{className:"text-right",children:W.input_tokens()}),J(q,{className:"text-right",children:W.output_tokens()}),J(q,{className:"text-right",children:W.cache_read_tokens()}),J(q,{className:"text-right",children:W.total_tokens()}),J(q,{className:"text-right",children:W.cost()})]})}),J(j,{children:K(R,{children:[J(E,{className:"font-medium",children:W.team()}),J(E,{className:"text-right",children:X(V?.team?.inputTokens)}),J(E,{className:"text-right",children:X(V?.team?.outputTokens)}),J(E,{className:"text-right",children:X(V?.team?.cacheReadTokens)}),J(E,{className:"text-right font-medium",children:X(V?.team?.totalTokens)}),J(E,{className:"text-right font-medium",children:w(V?.team?.cost)})]})})]})}):B?J("div",{className:"flex h-48 items-center justify-center",children:J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(c,{children:[J(i,{children:K(R,{children:[J(q,{children:W.members()}),J(q,{children:W.role()}),J(q,{className:"text-right",children:W.input_tokens()}),J(q,{className:"text-right",children:W.output_tokens()}),J(q,{className:"text-right",children:W.cache_read_tokens()}),J(q,{className:"text-right",children:W.total_tokens()}),J(q,{className:"text-right",children:W.cost()})]})}),J(j,{children:(f||[]).map((_,L)=>{let p=P[L]?.data?.member;return K(R,{children:[J(E,{children:K("div",{className:"flex items-center gap-3",children:[K(S,{className:"h-8 w-8 rounded-full",children:[_.image&&J(C,{src:_.image,alt:_.name,className:"object-cover"}),J(A,{className:"bg-primary/20 text-xs",children:U(_.name)})]}),K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-medium leading-none",children:_.name}),J("span",{className:"text-xs text-muted-foreground mt-0.5",children:_.email})]})]})}),J(E,{className:"text-xs text-muted-foreground",children:F(_.role)}),J(E,{className:"text-right",children:X(p?.inputTokens)}),J(E,{className:"text-right",children:X(p?.outputTokens)}),J(E,{className:"text-right",children:X(p?.cacheReadTokens)}),J(E,{className:"text-right font-medium",children:X(p?.totalTokens)}),J(E,{className:"text-right font-medium",children:w(p?.cost)})]},_.id)})})]})})})]})}var WJ=o(t(),1);function yJ({teamId:Y}){let[Z,z]=WJ.useState(null),{ref:G,inView:Q}=JJ(),{data:V,isLoading:H,isError:f,fetchNextPage:y,hasNextPage:P,isFetchingNextPage:B}=e({queryKey:["teams",Y,"agent-sessions"],queryFn:async({pageParam:X})=>{let w=await M.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:Y},query:{first:"20",after:X?String(X):void 0}});if(!w.ok)throw Error("Failed to fetch agent sessions");return await w.json()},initialPageParam:"",getNextPageParam:(X)=>X.pageInfo.cursor||void 0,enabled:!!Y});WJ.useEffect(()=>{if(Q&&P&&!B)y()},[Q,P,B,y]);let U=V?.pages.flatMap((X)=>X.data).filter((X)=>X.id!=="pending")||[],F=(X)=>{switch(X){case"comment":return J(O,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:W.session_type_comment()});case"chat":return J(O,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:W.session_type_chat()});case"naming":return J(O,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:W.session_type_naming()});default:return J(O,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:X})}};return K("div",{className:"space-y-6",children:[K(v,{className:"border border-border/50 shadow-xs",children:[J(T,{className:"pb-4",children:J("div",{className:"flex items-center justify-between",children:K("div",{children:[K(I,{className:"text-xl font-bold flex items-center gap-2",children:[J(r,{className:"w-5 h-5 text-violet-500"}),W.sessions()]}),J(b,{className:"mt-1 text-sm text-muted-foreground",children:W.sessions_description()})]})})}),J(g,{children:H?J("div",{className:"flex h-64 items-center justify-center",children:J(k,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):f?J("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):U.length===0?K("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[J(r,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),J("p",{className:"text-base font-medium",children:W.no_sessions_found()})]}):K("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[K(c,{children:[J(i,{className:"bg-muted/40",children:K(R,{children:[J(q,{children:W.session_name()}),J(q,{children:W.creator()}),J(q,{children:W.session_type()}),J(q,{className:"text-right",children:W.create_time()})]})}),J(j,{children:U.map((X)=>K(R,{onClick:()=>z(X.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[J(E,{className:"font-medium",children:K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-semibold text-foreground",children:X.name||W.untitled_session()}),J("span",{className:"text-xs font-mono text-muted-foreground/70",children:X.id})]})}),J(E,{children:K("div",{className:"flex items-center gap-2",children:[K(S,{className:"h-6 w-6",children:[J(C,{src:X.creator?.image||void 0}),J(A,{className:"text-[10px]",children:X.creator?.name?.[0]?.toUpperCase()||"?"})]}),J("span",{className:"text-sm text-foreground/90",children:X.creator?.name||"System / Agent"})]})}),J(E,{children:F(X.type)}),J(E,{className:"text-right text-xs text-muted-foreground",children:KJ(X.createdAt)})]},X.id))})]}),J("div",{ref:G,className:"py-4 flex justify-center",children:B&&J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),J(LJ,{sessionId:Z,open:!!Z,onOpenChange:(X)=>{if(!X)z(null)}})]})}var d=o(t(),1);function RJ({...Y}){return J(YJ.Root,{"data-slot":"collapsible",...Y})}function fJ({...Y}){return J(YJ.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...Y})}function DJ({...Y}){return J(YJ.CollapsibleContent,{"data-slot":"collapsible-content",...Y})}function OJ(Y){switch(Y.toLowerCase()){case"owner":return W.owner();case"editor":return W.editor();case"reviewer":return W.reviewer();default:return Y}}function YK(Y,Z){if(typeof Y==="object"&&Y!==null&&"message"in Y){let z=Y.message;if(typeof z==="string")return z}return Z}function ZK({rule:Y}){let Z=Y.resourceData??{};if(Y.resource==="agent_mcp_call_count")return J("span",{children:W.quota_target_server({value:String(Z.id??"")})});if(Y.resource==="agent_bash_call_count")return J("span",{children:W.quota_target_match({value:String(Z.match??"*")})});if(Y.resource==="agent_tool_call_count")return J("span",{children:W.quota_target_tool({value:String(Z.name??Z.toolName??"*")})});return null}function $K({rule:Y}){if(Y.scopeMode==="all_members")return K(O,{variant:"secondary",className:"gap-1 text-xs",children:[J(NJ,{className:"h-3 w-3"}),K("span",{children:[W.quota_scope_mode_all_members(),Y.role?` (${OJ(Y.role)})`:` (${W.quota_scope_team()})`]})]});if(Y.scopeMode==="each_member")return K(O,{variant:"secondary",className:"gap-1 text-xs",children:[J(vJ,{className:"h-3 w-3"}),K("span",{children:[W.quota_scope_mode_each_member(),Y.role?` (${OJ(Y.role)})`:` (${W.quota_scope_team()})`]})]});return K(O,{variant:"secondary",className:"gap-1 text-xs",children:[J(pJ,{className:"h-3 w-3"}),K("span",{children:[W.quota_scope_mode_selected_members()," (",Y.userIds?.length||0,")"]})]})}function XK({teamId:Y,rule:Z,record:z}){let G=SJ(),[Q,V]=d.useState(!1),[H,f]=d.useState(()=>new Date),y=QJ[Z.resource],P=Z.scopeMode==="all_members",B=z.percent>=100,U=P?Z.role?`${W.quota_role_shared_pool()}: ${OJ(Z.role)}`:W.quota_team_shared_pool():z.user?.name||z.userId||W.unknown();d.useEffect(()=>{if(!z.isWindowActive||!z.periodEnd)return;let X=window.setInterval(()=>f(new Date),60000);return()=>window.clearInterval(X)},[z.isWindowActive,z.periodEnd]);let F=CJ({mutationFn:async()=>{let X=await M.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:Y,id:Z.id},json:{userId:z.userId??null}});if(!X.ok){let w=await X.json().catch(()=>null);throw Error(YK(w,W.failed_to_reset_quota()))}return await X.json()},onSuccess:()=>{G.invalidateQueries({queryKey:["teams",Y,"quotas",Z.id,"records"]}),G.invalidateQueries({queryKey:["teams",Y,"quotas"]}),V(!1),qJ.success(W.quota_reset_successfully())},onError:(X)=>{let w=X instanceof Error?X.message:W.failed_to_reset_quota();V(!1),qJ.error(w)}});return K(hJ,{children:[K("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[K("div",{className:"flex items-center justify-between gap-3",children:[K("div",{className:"flex min-w-0 items-center gap-3",children:[P?J("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:J(NJ,{className:"h-5 w-5"})}):K(S,{className:"h-9 w-9 shrink-0 border border-border/50",children:[J(C,{src:z.user?.image||void 0}),J(A,{className:"text-xs font-semibold",children:z.user?.name?.[0]?.toUpperCase()||"U"})]}),K("div",{className:"min-w-0",children:[J("div",{className:"truncate text-sm font-semibold text-foreground",children:U}),!P&&z.user?.email&&J("div",{className:"truncate text-xs text-muted-foreground",children:z.user.email})]})]}),K("div",{className:"flex shrink-0 items-center gap-2",children:[z.isWindowActive&&z.periodEnd?K(O,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[J(ZJ,{className:"h-3 w-3"}),J("span",{children:W.quota_refreshes_in({time:EJ(z.periodEnd,H)})})]}):K(O,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[J(GJ,{className:"h-3 w-3 text-primary"}),J("span",{children:W.quota_available()})]}),K(n,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>V(!0),disabled:F.isPending,children:[F.isPending?J(k,{className:"h-3.5 w-3.5 animate-spin"}):J(l,{className:"h-3.5 w-3.5"}),W.quota_reset_usage()]})]})]}),K("div",{className:"space-y-1.5 pt-1",children:[J(jJ,{value:Math.min(100,Math.max(0,z.percent)),className:"h-2"}),K("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[K("span",{className:B?"font-bold text-destructive":"text-foreground",children:[a(Z.resource,z.consumed)," /"," ",a(Z.resource,Z.limit)," ",y?.unit]}),K("span",{className:B?"font-bold text-destructive":"text-muted-foreground",children:[z.percent,"%"]})]})]}),K("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[z.isWindowActive&&z.periodEnd?K("span",{className:"flex items-center gap-1 text-primary",children:[J(ZJ,{className:"h-3 w-3"}),W.quota_refreshes_in({time:EJ(z.periodEnd,H)})]}):K("span",{className:"flex items-center gap-1",children:[J(GJ,{className:"h-3 w-3 text-primary"}),W.quota_available()]}),K("span",{children:[W.quota_remaining(),": ",a(Z.resource,z.remaining)," ",y?.unit]})]})]}),J(TJ,{open:Q,onOpenChange:V,children:K(IJ,{children:[K(bJ,{children:[J(nJ,{children:W.quota_reset_usage()}),J(uJ,{children:W.quota_reset_usage_confirm({target:U})})]}),K(gJ,{children:[J(iJ,{disabled:F.isPending,children:W.cancel()}),K(cJ,{onClick:(X)=>{X.preventDefault(),F.mutate()},disabled:F.isPending,children:[F.isPending&&J(k,{className:"mr-2 h-4 w-4 animate-spin"}),W.confirm()]})]})]})})]})}function zK({teamId:Y,rule:Z}){let[z,G]=d.useState(!1),[Q,V]=d.useState(""),H=QJ[Z.resource],f=H?.icon||x,{data:y,isLoading:P,isError:B}=D({queryKey:["teams",Y,"quotas",Z.id,"records"],queryFn:async()=>{let X=await M.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:Y,id:Z.id}});if(!X.ok)throw Error(W.failed_to_load_quota_usage());return await X.json()},enabled:z,refetchInterval:z?1e4:!1}),U=y?.records??[],F=U.filter((X)=>{if(!Q.trim())return!0;let w=Q.toLowerCase();return X.user?.name.toLowerCase().includes(w)||X.user?.email.toLowerCase().includes(w)});return K(RJ,{open:z,onOpenChange:G,className:"rounded-xl border border-border/70",children:[J(fJ,{asChild:!0,children:K("button",{type:"button","aria-label":z?W.quota_collapse_rule():W.quota_expand_rule(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[K("div",{className:"flex min-w-0 items-start gap-3",children:[J("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:J(f,{className:"h-5 w-5"})}),K("div",{className:"min-w-0",children:[K("div",{className:"flex flex-wrap items-center gap-2",children:[J("span",{className:"font-semibold text-foreground",children:H?.label()||Z.resource}),!Z.enabled&&J(O,{variant:"secondary",children:W.quota_disabled()})]}),K("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[J($K,{rule:Z}),K(O,{variant:"outline",className:"gap-1 text-xs",children:[J(ZJ,{className:"h-3 w-3"}),a(Z.resource,Z.limit)," ",H?.unit," /"," ",dJ(Z.period)]}),J(ZK,{rule:Z})]})]})]}),J(AJ,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${z?"rotate-180":""}`})]})}),J(DJ,{children:K("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[Z.scopeMode!=="all_members"&&U.length>3&&K("div",{className:"relative",children:[J($J,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),J(XJ,{value:Q,onChange:(X)=>V(X.target.value),placeholder:W.quota_search_members(),className:"h-9 pl-9 text-sm"})]}),P?J("div",{className:"flex justify-center py-10",children:J(k,{className:"h-7 w-7 animate-spin text-primary"})}):B?J("div",{className:"py-8 text-center text-sm text-destructive",children:W.failed_to_load_quota_usage()}):F.length===0?J("div",{className:"py-8 text-center text-sm text-muted-foreground",children:W.quota_no_usage_records()}):F.map((X,w)=>J(XK,{teamId:Y,rule:Z,record:X},X.id||X.userId||`record-${w}`))]})})]})}function xJ({teamId:Y}){let{data:Z,isLoading:z,isError:G}=D({queryKey:["teams",Y,"quotas"],queryFn:async()=>{let V=await M.api.teams[":teamId"].quotas.$get({param:{teamId:Y}});if(!V.ok)throw Error(W.failed_load_settings());return await V.json()},enabled:!!Y}),Q=Z?.rules??[];return K(v,{className:"border-border/60 shadow-sm",children:[K(T,{children:[K(I,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[J(x,{className:"h-5 w-5 text-primary"}),W.quotas()]}),J(b,{children:W.quota_dashboard_description()})]}),J(g,{children:z?J("div",{className:"flex h-48 items-center justify-center",children:J(k,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):G?J("div",{className:"py-10 text-center text-sm text-destructive",children:W.failed_load_settings()}):Q.length===0?K("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[J(x,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),J("p",{className:"text-base font-medium text-foreground",children:W.no_quotas_title()}),J("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:W.no_quotas_description()})]}):J("div",{className:"space-y-3",children:Q.map((V)=>J(zK,{teamId:Y,rule:V},V.id))})})]})}var m=o(t(),1);var _K=Object.values(mJ);function oJ({teamId:Y}){let[Z,z]=m.useState([]),[G,Q]=m.useState([]),[V,H]=m.useState(""),{ref:f,inView:y}=JJ(),{data:P}=D({queryKey:["teams",Y,"members"],queryFn:async()=>{let $=await M.api.teams[":teamId"].members.$get({param:{teamId:Y},query:{}});if(!$.ok)return[];return await $.json()},enabled:!!Y}),B=P||[],{data:U,isLoading:F,isError:X,fetchNextPage:w,hasNextPage:_,isFetchingNextPage:L}=e({queryKey:["teams",Y,"audit-logs",Z,G,V],queryFn:async({pageParam:$})=>{let N=await M.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:Y},query:{first:"20",after:$?String($):void 0,actions:Z.length>0?Z:void 0,userIds:G.length>0?G:void 0,itemId:V.trim()||void 0}});if(!N.ok)throw Error("Failed to fetch audit logs");return await N.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo.endCursor||void 0,enabled:!!Y});m.useEffect(()=>{if(y&&_&&!L)w()},[y,_,L,w]);let p=U?.pages.flatMap(($)=>$.nodes)||[],PJ=U?.pages[0]?.total??0,eJ=($)=>{z((N)=>N.includes($)?N.filter((h)=>h!==$):[...N,$])},JK=($)=>{Q((N)=>N.includes($)?N.filter((h)=>h!==$):[...N,$])},KK=($)=>{if($.includes("delete")||$.includes("remove")||$.includes("revoke"))return J(O,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:$});if($.includes("create")||$.includes("add"))return J(O,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:$});if($.includes("update")||$.includes("reparent")||$.includes("copy"))return J(O,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:$});return J(O,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:$})},WK=new Map(B.map(($)=>[$.userId||$.id,$]));return J("div",{className:"space-y-6",children:K(v,{className:"border border-border/50 shadow-xs",children:[K(T,{className:"pb-4",children:[K("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[K("div",{children:[K(I,{className:"text-xl font-bold flex items-center gap-2",children:[J(l,{className:"h-5 w-5 text-primary"}),W.audit_logs()]}),J(b,{className:"mt-1",children:W.audit_logs_description()})]}),PJ>0&&K(O,{variant:"secondary",className:"w-fit text-xs font-normal",children:[PJ," ",W.audit_logs()]})]}),K("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[K(kJ,{children:[J(FJ,{asChild:!0,children:K(n,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(wJ,{className:"h-3.5 w-3.5"}),W.filter_by_action(),Z.length>0&&J(O,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:Z.length})]})}),K(MJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:W.select_actions()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:_K.map(($)=>K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(HJ,{checked:Z.includes($),onCheckedChange:()=>eJ($)}),J("span",{className:"font-mono",children:$})]},$))}),Z.length>0&&J(n,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>z([]),children:"Clear Actions"})]})]}),K(kJ,{children:[J(FJ,{asChild:!0,children:K(n,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(wJ,{className:"h-3.5 w-3.5"}),W.filter_by_user(),G.length>0&&J(O,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:G.length})]})}),K(MJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:W.select_users()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:B.map(($)=>{let N=$.userId||$.user?.id||$.id,h=$.user?.name||$.name||N,zJ=$.user?.image||$.image;return K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(HJ,{checked:G.includes(N),onCheckedChange:()=>JK(N)}),K(S,{className:"h-5 w-5",children:[J(C,{src:zJ||void 0}),J(A,{className:"text-[10px]",children:h.slice(0,2).toUpperCase()})]}),J("span",{className:"truncate",children:h})]},N)})}),G.length>0&&J(n,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>Q([]),children:"Clear Users"})]})]}),K("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[J($J,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),J(XJ,{type:"text",placeholder:W.search_item_id(),value:V,onChange:($)=>H($.target.value),className:"pl-8 pr-8 h-9 text-xs"}),V&&J("button",{onClick:()=>H(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:J(lJ,{className:"h-4 w-4"})})]}),(Z.length>0||G.length>0||V)&&J(n,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{z([]),Q([]),H("")},children:"Clear all"})]})]}),K(g,{className:"p-0",children:[F?J("div",{className:"flex h-64 items-center justify-center",children:J(k,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):X?J("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):p.length===0?J("div",{className:"p-12 text-center text-sm text-muted-foreground",children:W.no_audit_logs()}):K(c,{children:[J(i,{children:K(R,{className:"hover:bg-transparent border-b border-border/50",children:[J(q,{className:"w-[180px] text-xs font-semibold",children:W.action()}),J(q,{className:"w-[200px] text-xs font-semibold",children:W.user()}),J(q,{className:"text-xs font-semibold",children:W.item_id()}),J(q,{className:"text-xs font-semibold",children:W.project_id()}),J(q,{className:"w-[160px] text-right text-xs font-semibold",children:W.timestamp()})]})}),J(j,{children:p.map(($)=>{let N=$.userId?WK.get($.userId):null,h=N?.user?.name||N?.name||$.userId||"System",zJ=N?.user?.image||N?.image;return K(R,{className:"hover:bg-muted/40 transition-colors",children:[J(E,{className:"py-3 font-medium",children:KK($.action)}),J(E,{className:"py-3",children:K("div",{className:"flex items-center gap-2",children:[K(S,{className:"h-6 w-6",children:[J(C,{src:zJ||void 0}),J(A,{className:"text-[10px]",children:h.slice(0,2).toUpperCase()})]}),J("span",{className:"text-xs font-medium text-foreground truncate max-w-[140px]",children:h})]})}),J(E,{className:"py-3 text-xs font-mono text-muted-foreground",children:$.itemId||"-"}),J(E,{className:"py-3 text-xs font-mono text-muted-foreground",children:$.projectId||"-"}),J(E,{className:"py-3 text-right text-xs text-muted-foreground",children:KJ($.createdAt)})]},$.id)})})]}),J("div",{ref:f,className:"py-4 flex justify-center",children:L&&J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function VK(){let{teamId:Y}=GK.useParams(),[Z,z]=sJ.useState("audit-logs"),{data:G,isLoading:Q}=D({queryKey:["teams",Y,"me"],queryFn:async()=>{let V=await M.api.teams[":teamId"].me.$get({param:{teamId:Y}});if(!V.ok)throw Error("Failed to fetch me");return await V.json()},enabled:!!Y});if(Q)return J("div",{className:"flex h-screen items-center justify-center",children:J(k,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(G?.role?.toLowerCase()!=="owner")return K("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[J(aJ,{className:"h-12 w-12 text-destructive mb-4"}),J("h2",{className:"text-xl font-bold tracking-tight mb-2",children:W.access_denied()}),J("p",{className:"text-sm text-muted-foreground max-w-md",children:W.only_owner_dashboard()})]});return J("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:K("div",{className:"flex flex-col md:flex-row h-full",children:[J("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:K("nav",{className:"p-4 space-y-1 mt-4",children:[J("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:W.dashboard()}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:W.team_category()}),K("button",{onClick:()=>z("audit-logs"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(l,{className:"w-5 h-5"}),W.audit_logs(),Z==="audit-logs"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>z("quotas"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(x,{className:"w-5 h-5"}),W.quotas(),Z==="quotas"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:W.ai()}),K("button",{onClick:()=>z("ai-usage"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(rJ,{className:"w-5 h-5"}),W.usage(),Z==="ai-usage"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>z("ai-sessions"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(r,{className:"w-5 h-5"}),W.sessions(),Z==="ai-sessions"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),J("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:K("div",{className:"max-w-6xl mx-auto space-y-8",children:[Z==="audit-logs"&&J(oJ,{teamId:Y}),Z==="ai-usage"&&J(UJ,{teamId:Y}),Z==="ai-sessions"&&J(yJ,{teamId:Y}),Z==="quotas"&&J(xJ,{teamId:Y})]})})]})})}var GK=tJ("/teams/$teamId/dashboard")({component:VK});export{GK as Route};
@@ -1,2 +0,0 @@
1
- import{t as GJ,u as JJ,v as KJ}from"./chunk-gcpr2a24.js";import{I as VG}from"./chunk-mha3rsh7.js";import{if as U}from"./chunk-ajndx51c.js";import{Jf as zG}from"./chunk-ns804tmv.js";import{eh as eG}from"./chunk-tcm57j8r.js";import{ai as aG,ci as iG,di as lG,ei as u,ni as sG}from"./chunk-02afmyqy.js";import{Ci as C,Di as s,Ei as e,Fi as GG,Gi as JG,Hi as KG,Ii as XG,Ji as YG,Ki as ZG,Li as _G,Ni as QG,Oi as $G,Pi as HG,Qi as WG,Ri as BG,Si as T,qi as cG,vi as y}from"./chunk-8nyve0cr.js";import{Dl as t,Ej as a,Vi as IJ,Wi as o,Wj as i,Xi as J,Yi as X,Yj as l,bl as oG,hk as nG,jm as O,mm as K,nk as rG,nm as tG,pk as dG,wj as I}from"./chunk-kqpzx5az.js";import{kn as gJ}from"./chunk-p49h5fxs.js";var B=gJ(IJ(),1);var mG=[];function XK({teamId:W,projectId:S,assetId:b,folders:L,files:E,totalFolders:XJ,totalFiles:YJ,totalFoldersSize:ZJ,totalFilesSize:_J,selectedItem:qG,selectedIds:R,onItemSelect:MG,onItemDoubleClick:OG,onSaveField:QJ,onClearSelection:$J,fetchNextFoldersPage:bG,hasNextFoldersPage:LG,isFetchingNextFoldersPage:P,fetchNextFilesPage:EG,hasNextFilesPage:TG,isFetchingNextFilesPage:w,isRecentlyDeleted:N=!1,isRecents:h=!1,isShareView:f=!1,isPublic:UG=!1,shareId:HJ,allowDownload:vG=!0}){let M=cG(),{canEdit:D,canAdmin:WJ}=sG(S),AG=B.useRef(null),RG=B.useRef(null),[x,BJ]=B.useState(!0),[m,zJ]=B.useState(!0),[VJ,j]=B.useState(!1),[F,kG]=B.useState(""),[qJ,c]=B.useState(!1),yG=XJ??L.length,CG=YJ??E.length,SG=ZJ??(L.length>0?L.reduce((G,Y)=>G+(Y.sizeByte||0),0):-1),PG=_J??(E.length>0?E.reduce((G,Y)=>G+(Y.sizeByte||0),0):-1),MJ=SG>-1,OJ=PG>-1,wG=(G,Y)=>{if(Y)return G===1?K.n_assets_singular({count:G}):K.n_assets_plural({count:G});else return G===1?K.n_folders_singular({count:G}):K.n_folders_plural({count:G})},{editingItemId:NG,setEditingItemId:hG,handleAction:DG,onRenameSubmit:jG,isDeleteDialogOpen:bJ,setIsDeleteDialogOpen:LJ,confirmDelete:EJ,isDownloadDialogOpen:TJ,setIsDownloadDialogOpen:n,isLoadingLinks:p,resolvedFiles:FG,startDownload:UJ}=KJ({teamId:W,projectId:S,assetId:b,folders:L,files:E,selectedIds:R,isPublic:UG,shareId:HJ}),{ref:vJ,inView:pG}=eG();B.default.useEffect(()=>{if(pG){if(LG&&!P)bG();else if(TG&&!w)EG()}},[pG,LG,P,TG,w,bG,EG]);let AJ=U((G)=>G.increment),RJ=U((G)=>G.decrement),kJ=U((G)=>G.startTask),yJ=U((G)=>G.updateFileProgress),CJ=U((G)=>G.completeFile),gG=U((G)=>G.failFile),SJ=C.api.teams[":teamId"].upload.tasks[":taskId"].$patch,{mutateAsync:r}=y({mutationFn:async(G)=>{let Y=await SJ(G);if(!Y.ok)throw Error("Failed to confirm upload");return await Y.json()}}),PJ=async(G,Y,Q)=>{let z=Y?.reduce(($,Z)=>{if(Z.id)$[Z.id]={url:Z.url||"",fileId:Z.fileId||""};return $},{});if(!z)return;let q=5,V=[...G],v=async()=>{while(V.length>0){let $=V.shift();if($){let Z=z[$.id];if(Z&&Z.url){AJ();try{let _=new XMLHttpRequest,A=await new Promise((g,fG)=>{_.open("PUT",Z.url),_.setRequestHeader("Content-Type",$.file.type),_.upload.onprogress=(xG)=>{if(xG.lengthComputable)yJ(Q,Z.fileId,xG.loaded)},_.onload=()=>{if(_.status>=200&&_.status<300)g({ok:!0,status:_.status});else g({ok:!1,status:_.status})},_.onerror=()=>fG(Error("Network error")),_.onabort=()=>fG(Error("Upload aborted")),_.send($.file)});if(A.ok)CJ(Q,Z.fileId),await r({param:{teamId:W,taskId:Q},json:{fileId:Z.fileId}});else{gG(Q,Z.fileId),T.error(`Failed to upload file: ${$.file.name}`),await r({param:{teamId:W,taskId:Q},json:{fileId:Z.fileId,errorMessage:`upload failed with status: ${A.status}`}});return}}catch(_){gG(Q,Z.fileId),T.error(`Failed to upload file: ${$.file.name}`),await r({param:{teamId:W,taskId:Q},json:{fileId:Z.fileId,errorMessage:`upload failed with error: ${_ instanceof Error?_.message:String(_)}`}});return}finally{RJ(),M.invalidateQueries({queryKey:["search",W,b]})}}}}},H=Array(q).fill(null).map(()=>v());await Promise.all(H)},wJ=C.api.teams[":teamId"].upload.tasks.$post,{mutate:NJ}=y({mutationFn:async(G)=>{let Y=await wJ(G);if(!Y.ok)throw Error("Failed to create upload task");return await Y.json()},onMutate:()=>{return{files:[...mG]}},onSuccess:async(G,Y,Q)=>{let z=Q?.files||[],q=z.map((H)=>{return{fileId:G.presignedUrls?.find((Z)=>Z.id===H.id)?.fileId||H.id,name:H.file.name,size:H.file.size}}).filter((H)=>!!H.fileId),V=z.filter((H)=>!H.file.name.startsWith(".")),v=V.length===1?V[0].file.name:`${V.length} Items`;if(G.taskId)kJ(G.taskId,v,q);M.invalidateQueries({queryKey:["search",W,b]}),M.invalidateQueries({queryKey:["teams",W,"upload","tasks"]}),await PJ(z,G.presignedUrls,G.taskId),M.invalidateQueries({queryKey:["search",W,b]}),M.invalidateQueries({queryKey:["teams",W,"upload","tasks"]})}}),IG=(G)=>{if(!G||G.length===0)return;let Y=[],Q=[],z=new Map;for(let q of G){let V=(q.webkitRelativePath||q.name).split("/");if(V.some((k)=>k.startsWith(".")))continue;let v=V.pop(),H=Q,$="";for(let k of V)if($=`${$}/${k}`,!z.has($)){let A=[],g={name:k,type:"folder",id:VG(),children:A,size:0};H.push(g),z.set($,A),H=A}else H=z.get($);let Z={file:q,id:VG()};Y.push(Z);let _=q.type;if(v.toLowerCase().endsWith(".wma")&&_?.startsWith("video/"))_=_.replace(/^video\//,"audio/");H.push({name:v,size:q.size,type:"file",id:Z.id,children:[],mediaType:_})}mG=Y,NJ({param:{teamId:W},json:{parentId:b,files:Q}})},hJ=C.api.folders.$post,{mutate:DJ,isPending:uG}=y({mutationFn:async(G)=>{let Y=await hJ({json:{name:G,parentId:b}});if(!Y.ok)throw Error("Failed to create folder");return await Y.json()},onSuccess:()=>{T.success(K.new_folder()),j(!1),kG(""),M.invalidateQueries({queryKey:["search",W,b]}),M.invalidateQueries({queryKey:["folders"]})},onError:(G)=>{T.error(`Error: ${G.message}`)}}),{mutate:jJ,isPending:d}=y({mutationFn:async()=>{let G=await C.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:S}});if(!G.ok)throw Error("Failed to empty trash");return await G.json()},onSuccess:()=>{T.success(K.trash_emptied_successfully()),M.invalidateQueries({queryKey:["projects",S,"recently-deleted"]}),$J(),c(!1)},onError:(G)=>{T.error(`Error: ${G.message}`)}}),FJ=(G)=>{if(G.preventDefault(),!F.trim())return;DJ(F.trim())},pJ=L.length===0&&E.length===0&&!P&&!w;return X("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[D&&X(o,{children:[J("input",{type:"file",ref:AG,multiple:!0,className:"hidden",onChange:(G)=>{if(G.target.files)IG(G.target.files)}}),J("input",{type:"file",ref:RG,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(G)=>{if(G.target.files)IG(G.target.files)}})]}),N&&X("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[X("div",{className:"flex items-center gap-2 text-muted-foreground",children:[J(a,{className:"h-4 w-4 text-amber-500 shrink-0"}),J("span",{className:"text-xs",children:K.recently_deleted_notice()})]}),WJ&&J(O,{variant:"destructive",size:"sm",disabled:d||L.length===0&&E.length===0,onClick:()=>c(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),X("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[X("div",{className:"max-w-lg mx-auto w-full",children:[yG>0&&X("div",{className:"mb-4",children:[X("button",{onClick:()=>BJ(!x),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[x?J(i,{className:"h-4 w-4"}):J(l,{className:"h-4 w-4"}),X("span",{children:[wG(yG,!1),MJ?` • ${zG(SG)}`:""]})]}),x&&J("div",{className:"grid grid-cols-1 gap-4 w-full",children:L.map((G)=>J(JJ,{item:G,isSelected:qG?.id===G.id,isChecked:R.has(G.id),isEditing:NG===G.id,onSelect:MG,onDoubleClick:OG,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(Y)=>jG(G,Y),onFinishEditing:()=>hG(null),onAction:(Y,Q)=>DG(Y,Q),isRecentlyDeleted:N,isRecents:h,selectedCount:R.size,canEdit:D,isShareView:f,allowDownload:vG},G.id))})]}),CG>0&&X("div",{className:"mb-4",children:[X("button",{onClick:()=>zJ(!m),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[m?J(i,{className:"h-4 w-4"}):J(l,{className:"h-4 w-4"}),X("span",{children:[wG(CG,!0),OJ?` • ${zG(PG)}`:""]})]}),m&&J("div",{className:"grid grid-cols-1 gap-4 w-full",children:E.map((G)=>J(GJ,{teamId:W,item:G,isSelected:qG?.id===G.id,isChecked:R.has(G.id),isEditing:NG===G.id,onSelect:MG,onDoubleClick:OG,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(Y)=>jG(G,Y),onFinishEditing:()=>hG(null),onSaveField:(Y,Q)=>QJ?.(G.id,Y,Q),fields:[],onAction:(Y,Q)=>DG(Y,Q),isRecentlyDeleted:N,isRecents:h,selectedCount:R.size,canEdit:D,isShareView:f,allowDownload:vG},G.id))})]})]}),pJ&&J("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:h?X("div",{className:"flex flex-col items-center gap-2",children:[J(rG,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),J("p",{className:"font-medium text-foreground",children:K.no_recent_files()}),J("p",{className:"text-xs text-muted-foreground",children:K.no_recent_files_description()})]}):J("span",{children:K.this_folder_is_empty()})}),J("div",{ref:vJ,className:"py-4 flex justify-center items-center min-h-6",children:(P||w)&&J(I,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),D&&!N&&!h&&!f&&!UG&&J("div",{className:"fixed bottom-6 right-6 z-30",children:X(aG,{modal:!1,children:[J(iG,{asChild:!0,children:J(O,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:J(oG,{className:"h-6 w-6"})})}),X(lG,{align:"end",side:"top",className:"w-48 mb-2",children:[X(u,{onClick:()=>AG.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[J(t,{className:"h-4 w-4"}),J("span",{children:K.upload_file()})]}),X(u,{onClick:()=>RG.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[J(t,{className:"h-4 w-4"}),J("span",{children:K.upload_folder()})]}),X(u,{onClick:()=>j(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[J(dG,{className:"h-4 w-4"}),J("span",{children:K.new_folder()})]})]})]})}),J(_G,{open:VJ,onOpenChange:j,children:J(QG,{className:"sm:max-w-md",children:X("form",{onSubmit:FJ,children:[X($G,{children:[J(WG,{children:K.new_folder()}),J(BG,{children:K.folder_name()})]}),J("div",{className:"py-4",children:J(tG,{autoFocus:!0,placeholder:K.folder_name(),value:F,onChange:(G)=>kG(G.target.value)})}),X(HG,{children:[J(O,{type:"button",variant:"outline",onClick:()=>j(!1),children:K.cancel()}),X(O,{type:"submit",disabled:!F.trim()||uG,children:[uG?J(I,{className:"h-4 w-4 animate-spin mr-2"}):null,K.confirm()]})]})]})})}),J(s,{open:bJ,onOpenChange:LJ,children:X(e,{children:[X(GG,{children:[J(KG,{children:K.delete_asset_title()}),J(XG,{children:K.delete_asset_description()})]}),X(JG,{children:[J(ZG,{children:K.cancel()}),J(YG,{onClick:()=>EJ(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:K.delete()})]})]})}),J(s,{open:qJ,onOpenChange:c,children:X(e,{children:[X(GG,{children:[J(KG,{children:K.empty_trash_title()}),J(XG,{children:K.empty_trash_description()})]}),X(JG,{children:[J(ZG,{children:K.cancel()}),J(YG,{onClick:()=>jJ(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:d,children:d?"Deleting...":K.delete()})]})]})}),J(_G,{open:TJ,onOpenChange:n,children:X(QG,{className:"sm:max-w-md",children:[X($G,{children:[J(WG,{children:p?K.preparing_download():K.confirm_download()}),J(BG,{children:p?K.resolving_files_wait():K.folder_files_download_description()})]}),p?X("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[J(I,{className:"h-8 w-8 animate-spin text-primary"}),J("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:K.preparing_download_links()})]}):X("div",{className:"space-y-4 py-2",children:[J("div",{className:"text-sm text-muted-foreground",children:K.download_includes_files({count:FG.length})}),X("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:[J(a,{className:"h-5 w-5 shrink-0 mt-0.5"}),X("div",{children:[J("p",{className:"font-semibold",children:K.no_folder_structure()}),J("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:K.folder_structure_warning()})]})]})]}),J(HG,{children:!p?X(o,{children:[J(O,{variant:"outline",onClick:()=>n(!1),children:K.cancel()}),X(O,{onClick:UJ,className:"gap-2",disabled:FG.length===0,children:[J(nG,{className:"h-4 w-4"}),K.start_download()]})]}):J(O,{variant:"outline",onClick:()=>n(!1),children:K.cancel()})})]})})]})}
2
- export{XK as s};
@@ -1 +0,0 @@
1
- import{d as x}from"./chunk-k2065y29.js";import"./chunk-6tse78c7.js";import"./chunk-0n1wfwcm.js";import"./chunk-by6g0vye.js";import"./chunk-gcpr2a24.js";import"./chunk-nn0px81k.js";import"./chunk-mha3rsh7.js";import"./chunk-jt6d0zb1.js";import"./chunk-4b7jcpgv.js";import"./chunk-djx2r4nj.js";import"./chunk-y3dy4pdt.js";import"./chunk-mgnxa0vy.js";import{we as f}from"./chunk-vcf2qk9h.js";import{Ee as p}from"./chunk-y0f4bc9f.js";import"./chunk-j536e9nx.js";import"./chunk-ajndx51c.js";import"./chunk-93ecxcy4.js";import"./chunk-mhps85dd.js";import"./chunk-r2shjtte.js";import"./chunk-ns804tmv.js";import"./chunk-ymr5ybxk.js";import"./chunk-2xevs82j.js";import"./chunk-y2s0tjaa.js";import"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import"./chunk-rkz6x3r0.js";import"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import"./chunk-tcm57j8r.js";import"./chunk-0bfqrx5q.js";import"./chunk-dkjkn8t3.js";import"./chunk-76433x4d.js";import"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import"./chunk-6m1k317a.js";import"./chunk-kxr8fjsq.js";import{mi as h}from"./chunk-02afmyqy.js";import{Ci as c,ti as l,ui as r}from"./chunk-8nyve0cr.js";import"./chunk-62ebss6h.js";import{Vi as m,Xi as a,gj as o}from"./chunk-kqpzx5az.js";import{kn as d}from"./chunk-p49h5fxs.js";var g=d(m(),1);function w(){let{projectId:e}=v.useParams(),{teamId:s,ensureTeamIdForProject:n}=h();g.useEffect(()=>{n(e)},[e,n]);let{data:i}=r(f(e)),t=i?.rootFolder,{data:b}=l({queryKey:["folders",t],queryFn:()=>(async()=>{return await(await c.api.folders[":folderId"].$get({param:{folderId:t}})).json()})(),enabled:!!t});if(!s||!t||!b)return a(p,{});return a(x,{teamId:s,projectId:e,projectName:i.name??"",assetId:"recents",rootFolderId:t})}var v=o("/projects/$projectId/recents")({component:w});export{v as Route};
@@ -1 +0,0 @@
1
- import{h as Y1}from"./chunk-0n1wfwcm.js";import{p as w1,q as K1,r as J1}from"./chunk-f2zbsrc9.js";import{E as X1,y as y1}from"./chunk-nn0px81k.js";import{K as z1}from"./chunk-mha3rsh7.js";import"./chunk-jt6d0zb1.js";import"./chunk-4b7jcpgv.js";import{ba as G1}from"./chunk-djx2r4nj.js";import{Fe as ez}from"./chunk-y0f4bc9f.js";import"./chunk-ysvhtgve.js";import"./chunk-1fwzepfn.js";import"./chunk-ex2ym5pz.js";import"./chunk-34kaja59.js";import{wf as tz}from"./chunk-93ecxcy4.js";import"./chunk-mhps85dd.js";import"./chunk-r2shjtte.js";import{Kf as rz}from"./chunk-ns804tmv.js";import"./chunk-ymr5ybxk.js";import"./chunk-2xevs82j.js";import{cg as az,dg as iz}from"./chunk-y2s0tjaa.js";import"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import{lg as sz}from"./chunk-rkz6x3r0.js";import"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import{eh as Lz}from"./chunk-tcm57j8r.js";import"./chunk-0bfqrx5q.js";import"./chunk-dkjkn8t3.js";import"./chunk-76433x4d.js";import"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import"./chunk-6m1k317a.js";import"./chunk-kxr8fjsq.js";import{mi as oz}from"./chunk-02afmyqy.js";import{Ci as H,Di as Sz,Ei as vz,Fi as Dz,Gi as fz,Hi as Fz,Ii as jz,Ji as pz,Ki as mz,Li as cz,Ni as uz,Oi as Iz,Pi as dz,Qi as lz,Si as j,oi as Kz,qi as Az,ti as F,vi as l}from"./chunk-8nyve0cr.js";import"./chunk-62ebss6h.js";import{Lj as hz,Pl as Nz,Vi as Pz,Wi as xz,Xi as y,Yi as _,bj as Rz,dj as bz,gj as Cz,jm as Xz,kk as Ez,mm as U,nm as nz,wj as C}from"./chunk-kqpzx5az.js";import{kn as qz}from"./chunk-p49h5fxs.js";var Q=qz(Pz(),1);var p1=({item:w})=>{if(w.preview?.thumbnailUrl)return y("img",{src:w.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(w.preview?.proxyType==="audio"||w.proxyType==="audio")return y("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:y(hz,{className:"w-5 h-5 text-muted-foreground"})});return y("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:y(Ez,{className:"w-5 h-5 text-muted-foreground"})})},Mz=({projectId:w,currentAssetId:G,parentFolderId:V,initialFiles:W,initialNextCursor:b})=>{let{ref:J,inView:L}=Lz({threshold:0,rootMargin:"200px"}),q=Q.useRef(null),M=Q.useRef(!0),[B,h]=Q.useState(W),[$,S]=Q.useState(b),[v,p]=Q.useState(!!b),[g,E]=Q.useState(!1);return Q.useEffect(()=>{h(W),S(b),p(!!b),M.current=!0},[W,b]),Q.useEffect(()=>{(async()=>{if(!$||g||!L||!v)return;E(!0);try{let k=await H.api.folders[":folderId"].search.$post({param:{folderId:V},json:{assetType:"file",after:$,first:200,recursively:!1,conditions:[]}});if(!k.ok)throw Error("Failed to fetch next page");let D=await k.json(),x=D.data||[];h((n)=>[...n,...x]),S(D.pageInfo?.cursor||void 0),p(!!D.pageInfo?.cursor&&x.length>0)}catch(k){console.error("Error fetching next page:",k)}finally{E(!1)}})()},[L,$,v,g,V]),Q.useEffect(()=>{if(B.some((k)=>k?.id===G)&&q.current)if(M.current)q.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),M.current=!1;else q.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[B,G]),y("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:_("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[B.map((T)=>{if(!T)return null;let k=T.id===G;return y("div",{ref:T.id===G?q:null,className:"flex-shrink-0",children:y(bz,{to:"/projects/$projectId/files/$fileId",params:{projectId:w,fileId:T.id},search:{version:void 0},className:Nz("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",k?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:y(p1,{item:T})})},T.id)}),v&&y("div",{ref:J,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:g&&y(C,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var X=qz(Pz(),1);function m1(){let{projectId:w,fileId:G}=gz.useParams(),V=gz.useSearch(),W=V.version,b=V.start,J=W||G,L=V.cmpLeft,q=V.cmpRight,M=V.cmpActive??"left",B=!!V.compare&&!!L&&!!q,h=X.useRef(null),{teamId:$,ensureTeamIdForProject:S}=oz(),[v,p]=X.useState(360),[g,E]=X.useState([]),{fileViewRightSidebarCollapsed:T}=sz(),{isChatbotOpen:k}=iz(),[D,x]=X.useState(0),[n,m]=X.useState(null),[Gz,Z1]=X.useState(null),[_1,U1]=X.useState(void 0),[A,o]=X.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),W1=H.api.files[":fileId"].metadata.$patch,{mutate:B1}=l({mutationFn:async(z)=>{let K=await W1(z);if(!K.ok)throw Error("Failed to patch metadata");return await K.json()}}),f=Az(),{members:$1,fetchProjectMembers:Jz}=rz(),H1=tz();X.useEffect(()=>{S(w)},[w,S]),X.useEffect(()=>{if(w)Jz(w,!0)},[w,Jz]),X.useEffect(()=>{if(w&&G)H.api.projects[":projectId"].recents.view.$post({param:{projectId:w},json:{assetId:G}}).catch(()=>{})},[w,G]);let{data:Yz,isLoading:Q1,isError:k1,isFetching:T1}=F({queryKey:["files",G],queryFn:async()=>{let z=await H.api.files[":fileId"].$get({param:{fileId:G}});if(!z.ok)throw Error("Failed to fetch stack");return await z.json()},enabled:!!$,placeholderData:Kz}),{data:O1,isLoading:V1,isError:q1,isFetching:P1}=F({queryKey:["files",W],queryFn:async()=>{let z=await H.api.files[":fileId"].$get({param:{fileId:W}});if(!z.ok)throw Error("Failed to fetch version");return await z.json()},enabled:!!$&&!!W,placeholderData:Kz}),{data:b1}=F({queryKey:["version_stacks",G,"versions"],queryFn:async()=>{let z=await H.api.version_stacks[":stackId"].versions.$get({param:{stackId:G}});if(!z.ok)throw Error("Failed to fetch versions");return await z.json()},enabled:!!w&&!!G&&(!!W||B)}),{data:N}=F({queryKey:["projects",w],queryFn:async()=>{let z=await H.api.projects[":projectId"].$get({param:{projectId:w}});if(!z.ok)throw Error("Failed to fetch project");return await z.json()}}),O=Rz(),{setProjectState:Zz,clearProjectState:_z}=az(),h1=Q1||!!W&&V1,E1=k1||!!W&&q1,N1=T1||!!W&&P1,Y=O1||Yz,P=W?b1:Yz?.versionStack?.versions,Z=Y?.ancestorFolders?.[0]?.id??N?.rootFolder??"",[a,c]=X.useState(!1),[u,Uz]=X.useState(""),r=X.useRef(null),s=X.useRef(!1),[L1,i]=X.useState(!1),M1=H.api.files[":fileId"].$put,{mutate:g1,mutateAsync:x1,isPending:Wz}=l({mutationFn:async(z)=>{let K=await M1(z);if(!K.ok)throw Error("Failed to rename file");return await K.json()},onSuccess:()=>{f.invalidateQueries({queryKey:["files"]}),f.invalidateQueries({queryKey:["version_stacks"]}),j.success(U.renamed_successfully?.()||"Renamed successfully"),c(!1)},onError:()=>{j.error(U.failed_to_rename?.()||"Failed to rename")}}),A1=H.api.files.$delete,{mutate:R1,mutateAsync:C1,isPending:Bz}=l({mutationFn:async(z)=>{if(!(await A1(z)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(f.invalidateQueries({queryKey:["files"]}),f.invalidateQueries({queryKey:["version_stacks"]}),j.success(U.deleted?.()||"Deleted"),i(!1),Z&&Z!==N?.rootFolder)O({to:"/projects/$projectId/folders/$folderId",params:{projectId:w,folderId:Z}});else O({to:"/projects/$projectId",params:{projectId:w}})},onError:()=>{j.error(U.failed_to_delete?.()||"Failed to delete")}}),S1=(z)=>{if(z?.preventDefault(),!u.trim()||!J)return;g1({param:{fileId:J},json:{name:u.trim()}})},v1=()=>{if(!J)return;R1({json:{ids:[J]}})};X.useEffect(()=>{if(Y&&N&&$)Zz({teamId:$,projectId:w,projectName:N.name??"",ancestorFolders:Y.ancestorFolders??[],currentAsset:{id:J||G,name:Y.name,type:"file",version:P?P.find((z)=>z.id===J)?.version??P.length:void 0,proxyType:Y.proxyType},isRootFolder:!1,fileId:G,downloadInfo:{originalKey:Y.media?.original?.key,videoTranscodes:Y.media?.videoTranscodes?.map((z)=>({key:z.key,width:z.width,height:z.height}))},versions:P,compareMode:B,canCompareVersions:(P?.length??0)>=2,onCompareVersions:()=>{let z=y1(P);if(!z)return;O({to:"/projects/$projectId/files/$fileId",params:{projectId:w,fileId:G},search:(K)=>({...K,version:void 0,compare:!0,cmpLeft:z.left.id,cmpRight:z.right.id,cmpActive:"left"})})},onFolderClick:(z)=>{O({to:"/projects/$projectId/folders/$folderId",params:{projectId:w,folderId:z}})},onRename:()=>{s.current=!1,Uz(Y?.name??""),c(!0)},onDelete:()=>{i(!0)}});return()=>_z()},[$,w,N,Y,P,J,G,B,Zz,_z,O]),X.useEffect(()=>{if(!a)return;let z=setTimeout(()=>{s.current=!0},1000);return()=>clearTimeout(z)},[a]);let D1=()=>{if(s.current)return;setTimeout(()=>{if(r.current)z1(r.current)},0)};if(X.useEffect(()=>{if(!Z||!J)return;if(A.folderId===Z)return;let z=!0;return(async()=>{try{let I="",kz=!1,zz=[],yz=void 0;for(let Tz=0;Tz<5;Tz++){let Oz=await H.api.folders[":folderId"].search.$post({param:{folderId:Z},json:{assetType:"file",after:I,first:200,recursively:!1,conditions:[]}});if(!Oz.ok)throw Error("Failed to search parent folder for carousel");let R=await Oz.json(),wz=R.data||[];if(zz.push(...wz),wz.some((d)=>d.id===J)){if(kz=!0,yz=R.pageInfo?.cursor||void 0,R.pageInfo?.cursor)try{let d=await H.api.folders[":folderId"].search.$post({param:{folderId:Z},json:{assetType:"file",after:R.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(d.ok){let Vz=await d.json(),j1=Vz.data||[];zz.push(...j1),yz=Vz.pageInfo?.cursor||void 0}}catch{}break}if(!R.pageInfo?.cursor||wz.length<200)break;I=R.pageInfo.cursor}if(z)if(kz)o({show:!0,files:zz,nextCursor:yz,folderId:Z});else o({show:!1,files:[],nextCursor:void 0,folderId:Z})}catch(I){if(console.error(I),z)o({show:!1,files:[],nextCursor:void 0,folderId:Z})}})(),()=>{z=!1}},[Z,J,A.folderId]),X.useEffect(()=>{x(0),m(null),E([])},[Y?.id]),X.useEffect(()=>{m(null),E([])},[Gz?.id]),h1&&!Y)return y(ez,{});if(E1||!Y||!N||!$)return y("div",{children:U.file_not_found()});let t=B?Gz:Y,$z=t?.id??J,Hz=(z,K)=>{if(!$)return;B1({param:{fileId:$z},json:[{key:z,value:K}]},{onSuccess:()=>{f.invalidateQueries({queryKey:["files",$z]})}})},e=(z)=>{O({to:"/projects/$projectId/files/$fileId",params:{projectId:w,fileId:G},search:(K)=>({...K,...z})})},f1=()=>{e({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:M==="left"?L:q})},F1=(z)=>{m(z.id||null);let K=z.annotations;if(K&&K.length>0)E(K);else E([]);if(B){if(z.second!==null&&z.second!==void 0)U1({second:z.second,nonce:Date.now()});return}if(z.second!==null&&z.second!==void 0)h.current?.seekTo(z.second),h.current?.pause();else if(K&&K.length>0)h.current?.pause()},Qz=()=>{E([]),m(null)};if(H1&&!B)return y(K1,{projectId:w,teamId:$,fileId:G,file:Y,projectInfo:N,ancestorFolders:Y.ancestorFolders??[],parentFolderId:Z,versions:P,activeFileId:J,startTime:b,siblingFiles:A.files,onNavigateToFile:(z)=>{O({to:"/projects/$projectId/files/$fileId",params:{projectId:w,fileId:z}})},onNavigateBack:()=>{if(Z&&Z!==N?.rootFolder)O({to:"/projects/$projectId/folders/$folderId",params:{projectId:w,folderId:Z}});else O({to:"/projects/$projectId",params:{projectId:w}})},onSelectVersion:(z)=>{O({to:"/projects/$projectId/files/$fileId",params:{projectId:w,fileId:G},search:(K)=>({...K,version:z})})},onRenameFile:async(z)=>{await x1({param:{fileId:J},json:{name:z}})},onDeleteFile:async()=>{await C1({json:{ids:[J]}})},onSaveField:Hz});return _("div",{className:"h-full flex flex-1 flex-col bg-background",children:[_("div",{className:"h-full flex flex-1 overflow-hidden",children:[_("div",{className:"flex-1 relative",children:[N1&&!B&&y("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:y(C,{className:"h-8 w-8 animate-spin text-foreground"})}),B&&L&&q?y(J1,{versions:P??[],leftId:L,rightId:q,activeSide:M,annotations:g,seekRequest:_1,onActiveSideChange:(z)=>e({cmpActive:z}),onSwitchVersion:(z,K)=>e(z==="left"?{cmpLeft:K}:{cmpRight:K}),onExit:f1,onActiveAssetChange:Z1,onPlay:Qz,onTimeUpdate:x}):y(w1,{file:Y,mediaControllerRef:h,onPlay:Qz,onTimeUpdate:x,annotations:g,startTime:b,children:A.show&&y(Mz,{projectId:w,currentAssetId:J,parentFolderId:Z,initialFiles:A.files,initialNextCursor:A.nextCursor})})]}),(!T||k)&&_(xz,{children:[y(G1,{onResize:(z)=>{p((K)=>Math.max(300,Math.min(600,K-z)))},className:"hidden md:block"}),y("div",{style:{width:v},className:"flex-shrink-0 bg-background flex flex-col",children:k?y(Y1,{projectId:w,contextAssetId:J}):y(X1,{teamId:$,projectId:w,file:t,onSaveField:Hz,members:$1,onCommentSelect:F1,currentTime:D,onTyping:()=>{if(B)return;h.current?.pause()},selectedCommentId:n,hideAnnotationControl:t?.proxyType==="audio"})})]})]}),y(cz,{open:a,onOpenChange:c,children:y(uz,{children:_("form",{onSubmit:S1,children:[y(Iz,{children:y(lz,{children:U.rename()})}),y("div",{className:"py-4",children:y(nz,{ref:r,value:u,onChange:(z)=>Uz(z.target.value),placeholder:U.enter_new_name?.()||"Enter new name",onFocus:D1,autoFocus:!0})}),_(dz,{children:[y(Xz,{type:"button",variant:"outline",onClick:()=>c(!1),children:U.cancel()}),_(Xz,{type:"submit",disabled:Wz||!u.trim(),children:[Wz&&y(C,{className:"mr-2 h-4 w-4 animate-spin"}),U.save()]})]})]})})}),y(Sz,{open:L1,onOpenChange:i,children:_(vz,{children:[_(Dz,{children:[y(Fz,{children:U.delete_asset_title?.()||"Delete Asset?"}),y(jz,{children:U.delete_asset_description?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),_(fz,{children:[y(mz,{children:U.cancel()}),_(pz,{onClick:v1,disabled:Bz,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[Bz&&y(C,{className:"mr-2 h-4 w-4 animate-spin"}),U.delete()]})]})]})})]})}var gz=Cz("/projects/$projectId/files/$fileId")({component:m1});export{gz as Route};
@@ -1,2 +0,0 @@
1
- import{Qe as Z0}from"./chunk-ysvhtgve.js";import{wf as K0}from"./chunk-93ecxcy4.js";import{yf as pN,zf as uN}from"./chunk-mhps85dd.js";import{Lf as z0}from"./chunk-ymr5ybxk.js";import{cg as $0,dg as Q0}from"./chunk-y2s0tjaa.js";import{lg as G0}from"./chunk-rkz6x3r0.js";import{Lg as AN,Mg as wN,Ng as gN,Wg as kN}from"./chunk-7x1vkftb.js";import{bh as TN}from"./chunk-ck6msfch.js";import{fh as U0,gh as J0,hh as W0,ih as X0,jh as Y0,mh as H0}from"./chunk-0bfqrx5q.js";import{vh as rN,wh as oN,xh as nN,yh as eN}from"./chunk-76433x4d.js";import{Bh as vN}from"./chunk-2xgvs3as.js";import{Xh as DN}from"./chunk-9cmvymm5.js";import{ai as i,bi as GN,ci as d,di as t,ei as C,hi as sN,ii as n,ji as QN,ki as KN,li as BN,ni as N0}from"./chunk-02afmyqy.js";import{Ci as y,Li as hN,Ni as yN,Oi as PN,Qi as VN,Si as j,qi as ON,ti as zN,vi as HN,xi as fN}from"./chunk-8nyve0cr.js";import{Bj as lN,Fk as dN,Lk as tN,Pl as a,Qj as xN,Rk as JN,Vi as EN,Vj as jN,Wi as g,Wj as aN,Xi as N,Yi as J,bj as IN,dj as o,jm as k,kk as UN,mm as Z,sj as cN,tj as CN,tk as bN,yk as iN,yl as FN}from"./chunk-kqpzx5az.js";import{kn as MN}from"./chunk-p49h5fxs.js";var RN=MN(EN(),1);var NN=fN((W)=>({isMobileMenuOpen:!1,activeItem:null,activeItemId:null,openMobileMenu:(z=null)=>W({isMobileMenuOpen:!0,activeItemId:typeof z==="string"?z:null,activeItem:typeof z==="number"?z:null}),closeMobileMenu:()=>W({isMobileMenuOpen:!1,activeItem:null,activeItemId:null}),toggleMobileMenu:()=>W((z)=>({isMobileMenuOpen:!z.isMobileMenuOpen,activeItem:z.isMobileMenuOpen?null:z.activeItem,activeItemId:z.isMobileMenuOpen?null:z.activeItemId})),setActiveItem:(z)=>W({activeItem:z,activeItemId:null}),setActiveItemId:(z)=>W({activeItemId:z})}));var r=MN(EN(),1);function M0(W){if(!W)return null;try{let z=vN(W);if(isNaN(z.getTime()))return null;return DN(z,"MMM d, yyyy")}catch{return null}}function E0({version:W,displayVersionNumber:z,index:K,canEdit:B,onRemove:$}){let[b,G]=r.useState(!1),{ref:R,handleRef:L}=uN({id:W.id,index:K,disabled:!B}),q=M0(W.createdAt);return J("div",{ref:R,className:"group flex items-center gap-3 p-2.5 rounded-lg border border-border bg-card hover:bg-accent/40 transition-colors",children:[J("div",{className:"flex-shrink-0 flex items-center justify-center bg-muted text-muted-foreground rounded-full px-2.5 py-0.5 text-xs font-semibold select-none min-w-[2.25rem]",children:["v",z]}),B?N("div",{ref:L,className:"cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground p-1 -m-1 rounded touch-none flex items-center justify-center",children:N(bN,{className:"h-4 w-4"})}):N("div",{className:"w-4"}),N("div",{className:"h-12 w-20 flex-shrink-0 overflow-hidden rounded-md border border-border bg-muted flex items-center justify-center",children:W.previewUrl?N("img",{src:W.previewUrl,alt:W.name||"",className:"h-full w-full object-cover"}):N(UN,{className:"h-5 w-5 text-muted-foreground"})}),J("div",{className:"flex flex-col flex-1 min-w-0 text-left",children:[N("span",{className:"truncate text-sm font-medium text-foreground",title:W.name||"",children:W.name||"Untitled"}),J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground truncate",children:[N("span",{children:W.creator?.name||Z.unknown()}),q&&J(g,{children:[N("span",{children:"•"}),N("span",{children:q})]})]})]}),B&&J(i,{modal:!1,open:b,onOpenChange:G,children:[N(d,{asChild:!0,children:N(k,{variant:"ghost",size:"icon","aria-label":"More options",className:a("h-8 w-8 text-muted-foreground hover:text-foreground transition-opacity flex-shrink-0",b?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100"),children:N(CN,{className:"h-4 w-4"})})}),N(t,{align:"end",children:J(C,{onClick:()=>$(W.id),className:"text-destructive focus:text-destructive cursor-pointer",children:[N(FN,{className:"h-4 w-4 mr-2"}),N("span",{children:Z.remove_from_stack()})]})})]})]})}function mN({open:W,onOpenChange:z,stackId:K,canEdit:B=!0,onVersionRemoved:$,onStackDissolved:b}){let G=ON(),[R,L]=r.useState([]),{data:q,isLoading:D}=zN({queryKey:["version_stacks",K,"versions"],queryFn:async()=>{let X=await y.api.version_stacks[":stackId"].versions.$get({param:{stackId:K}});if(!X.ok)throw Error("Failed to fetch versions");return await X.json()},enabled:W&&!!K});r.useEffect(()=>{if(q)L(q)},[q]);let{mutate:T}=HN({mutationFn:async({fileId:X,beforeId:Q})=>{if(!(await y.api.version_stacks[":stackId"].order.$post({param:{stackId:K},json:{fileId:X,beforeId:Q}})).ok)throw Error("Failed to reorder versions")},onSuccess:()=>{G.invalidateQueries({queryKey:["version_stacks"]}),G.invalidateQueries({queryKey:["files"]}),G.invalidateQueries({queryKey:["projects"]}),j.success(Z.version_reordered_successfully())},onError:()=>{if(j.error(Z.failed_to_reorder_versions()),q)L(q)}}),{mutate:v,isPending:P}=HN({mutationFn:async(X)=>{if(!(await y.api.version_stacks[":stackId"].versions[":versionId"].$delete({param:{stackId:K,versionId:X}})).ok)throw Error("Failed to remove version from stack");return X},onSuccess:(X)=>{j.success(Z.version_removed_successfully());let Q=R.filter((S)=>S.id!==X);if(L(Q),G.invalidateQueries({queryKey:["version_stacks"]}),G.invalidateQueries({queryKey:["files"]}),G.invalidateQueries({queryKey:["projects"]}),Q.length<=1){let S=Q[0];if(z(!1),S)b?.(S.id)}else $?.(X,Q)},onError:()=>{j.error(Z.failed_to_remove_version())}}),p=(X)=>{if(X.canceled)return;let{source:Q}=X.operation;if(!pN(Q))return;let{initialIndex:S,index:H}=Q;if(S===H)return;let f=[...R],[u]=f.splice(S,1);f.splice(H,0,u),L(f);let E=H===f.length-1?"-1":f[H+1].id;T({fileId:u.id,beforeId:E})},_=(X)=>{if(P)return;v(X)};return N(hN,{open:W,onOpenChange:z,children:J(yN,{className:"max-w-lg p-0 gap-0 overflow-hidden",children:[N(PN,{className:"p-4 pb-3 border-b border-border",children:N(VN,{className:"text-base font-semibold",children:Z.manage_versions_title()})}),N(TN,{className:"max-h-[60vh] p-4",children:D?N("div",{className:"py-8 text-center text-sm text-muted-foreground",children:Z.loading?.()||"Loading..."}):R.length===0?N("div",{className:"py-8 text-center text-sm text-muted-foreground",children:Z.no_versions_found()}):N("div",{className:"space-y-2",children:N(kN,{sensors:[gN.configure({activationConstraints:[new wN.Distance({value:6})]}),AN],onDragEnd:p,children:R.map((X,Q)=>N(E0,{version:X,displayVersionNumber:R.length-Q,index:Q,canEdit:B,onRemove:_},X.id))})})})]})})}function _0({teamId:W,projectId:z,projectName:K,ancestorFolders:B,currentAsset:$,isRootFolder:b,customTerminalBreadcrumb:G,displayStyle:R,onDisplayStyleChange:L,isLeftSidebarCollapsed:q,onLeftSidebarToggle:D,isRightSidebarCollapsed:T,onRightSidebarToggle:v,isChatbotOpen:P=!1,onChatbotToggle:p,isPublic:_=!1,onFolderClick:X,onRename:Q,onDelete:S,fileId:H,shareId:f,allowDownload:u=!0,downloadInfo:E,versions:A,compareMode:M=!1,canCompareVersions:e=!1,onCompareVersions:F}){let m=IN(),{canEdit:c}=N0(z),{openMobileMenu:WN}=NN(),[XN,l]=RN.useState(!1),[s,YN]=RN.useState(!1),V=H||$.id,B0=$.name==="Recently Deleted",R0=$.name==="All Collections",ZN=!_&&!b&&!B0&&!R0&&!M&&!!V,{data:qN}=zN({queryKey:["teams",W,"kanban","assets",V,"tasks"],queryFn:async()=>{if(!W||!V)return{data:[],total:0};let U=await y.api.teams[":teamId"].kanban.assets[":assetId"].tasks.$get({param:{teamId:W,assetId:V}});if(!U.ok)return{data:[],total:0};return await U.json()},enabled:!!W&&!!V&&ZN}),SN=qN?.total??qN?.data?.length??0,C0=!1,q0=(U)=>{if(!H)return;if(_&&f){m({to:"/share/$shareId/files/$fileId",params:{shareId:f,fileId:H},search:(Y)=>({...Y,version:U})});return}if(!z)return;m({to:"/projects/$projectId/files/$fileId",params:{projectId:z,fileId:H},search:(Y)=>({...Y,version:U})})},_N=async(U)=>{if(!H)return;try{let Y=f?await y.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:f,fileId:H},json:{key:U}}):await y.api.files["download-url"].$post({json:{key:U,assetId:H}});if(!Y.ok)return;let{url:O}=await Y.json(),h=document.createElement("a");h.href=O,h.download="",document.body.appendChild(h),h.click(),document.body.removeChild(h)}catch{}},S0=$.proxyType!=="audio"&&(E?.videoTranscodes?.length??0)>0,I=Boolean(G||!b&&!M),w={name:K,path:_?void 0:`/projects/${z}`,id:"root"},x=B.slice().reverse().map((U)=>({name:U.name||"",path:_?void 0:`/projects/${z}/folders/${U.id}`,id:U.id})),$N=I?x:x.slice(0,-1),LN=!I&&x.length>0?x[x.length-1]:null,L0=()=>{if(G)return N("span",{className:"truncate rounded px-2 py-1 text-sm font-medium text-foreground",children:G});if(!b&&!M){if($.type==="folder")return N("span",{className:"truncate rounded px-2 py-1 text-sm font-medium text-foreground",children:$.name});return J(i,{modal:!1,children:[J(d,{className:"flex items-center gap-1 truncate rounded px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:[N("span",{className:"truncate",children:$.name}),$.version!==void 0&&J(z0,{variant:"outline",className:"px-1 py-0 text-xs shrink-0",children:["v",$.version]}),N(aN,{className:"h-4 w-4 shrink-0"})]}),J(t,{className:"w-56",align:"start",children:[u&&(S0?J(QN,{children:[N(KN,{className:"flex items-center gap-2",children:N("span",{children:Z.download()})}),N(GN,{children:J(BN,{className:"w-48",children:[N(sN,{children:Z.download()}),E?.videoTranscodes?.map((U)=>{let Y=Math.max(U.width,U.height),O=`${U.height}p`;if(Y>=3840)O="2160p";else if(Y>=1920)O="1080p";else if(Y>=1280)O="720p";else if(Y>=960)O="540p";else if(Y>=640)O="360p";else if(Y>=320)O="180p";return J(C,{onClick:()=>_N(U.key),className:"flex items-center justify-between",children:[N("span",{children:O}),N("span",{className:"text-xs text-muted-foreground",children:"MP4"})]},O)}),E?.originalKey&&J(g,{children:[N(n,{}),J(C,{onClick:()=>_N(E.originalKey),className:"flex items-center justify-between",children:[N("span",{children:"Original"}),N("span",{className:"text-xs text-muted-foreground",children:$.name?.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})})]}):N(C,{onClick:()=>E?.originalKey&&_N(E.originalKey),disabled:!E?.originalKey,children:Z.download()})),c&&Q&&N(C,{onClick:Q,children:Z.rename()}),c&&S&&N(C,{onClick:S,className:"text-destructive focus:text-destructive",children:Z.delete()}),e&&F&&J(g,{children:[N(n,{}),J(C,{onClick:()=>F(),children:[N(cN,{className:"h-4 w-4"}),N("span",{children:Z.compare_versions()})]})]}),A&&A.length>0&&J(g,{children:[N(n,{}),J(QN,{children:[J(KN,{className:"flex items-center gap-2",children:[N(iN,{className:"h-4 w-4"}),N("span",{children:"Versions"})]}),N(GN,{children:J(BN,{className:"w-80 p-1",children:[N("div",{className:"flex flex-col gap-1 max-h-96 overflow-y-auto",children:A.map((U)=>{let Y=$.version===U.version;return J(C,{onClick:()=>q0(U.id),className:"flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer focus:bg-accent focus:text-accent-foreground",children:[J("div",{className:"flex-shrink-0 flex items-center justify-center bg-muted dark:bg-muted-foreground/20 text-muted-foreground dark:text-muted-foreground rounded-full px-2 py-0.5 text-xs font-semibold select-none min-w-[2rem]",children:["v",U.version]}),N("div",{className:"h-10 w-16 flex-shrink-0 overflow-hidden rounded-md border border-border bg-muted flex items-center justify-center",children:U.previewUrl?N("img",{src:U.previewUrl,alt:U.name||void 0,className:"h-full w-full object-cover"}):N(UN,{className:"h-4 w-4 text-muted-foreground"})}),J("div",{className:"flex flex-col flex-1 min-w-0 text-left",children:[N("span",{className:"truncate text-sm font-semibold text-foreground",children:U.name}),N("span",{className:"truncate text-xs text-muted-foreground",children:U.creator?.name||"Unknown"})]}),Y&&N(jN,{className:"h-4 w-4 text-primary ml-auto flex-shrink-0"})]},U.id)})}),N(n,{}),N("div",{className:"p-1",children:N("button",{className:"w-full text-center text-xs font-medium py-2 px-3 rounded-md bg-muted/80 hover:bg-muted text-foreground transition-colors cursor-pointer",onClick:()=>l(!0),children:Z.manage_versions()})})]})})]})]})]})]})}return null};return J("div",{className:"flex h-14 flex-nowrap items-center justify-between gap-2 border-b border-border bg-card px-4 py-2 overflow-hidden",children:[J("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:[!_&&N(k,{variant:"ghost",size:"icon",onClick:()=>WN(),className:"md:hidden h-8 w-8 text-foreground hover:bg-accent shrink-0 -ml-2 mr-1","aria-label":"Open navigation menu",children:N(JN,{className:"h-5 w-5"})}),!_&&J("div",{className:"hidden md:flex items-center gap-1 shrink-0",children:[N(o,{to:`/teams/${W}`,className:"truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-muted-foreground",children:Z.all_projects()}),N("span",{className:"text-muted-foreground",children:"/"})]}),I||B.length>0?w.path?N(o,{to:w.path,className:"min-w-0 max-w-[45%] md:max-w-none truncate rounded px-1.5 md:px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground shrink",children:w.name}):N("button",{onClick:()=>w.id&&X?.(w.id),className:"min-w-0 max-w-[45%] md:max-w-none truncate rounded px-1.5 md:px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground text-left shrink cursor-pointer",children:w.name}):N("span",{className:"min-w-0 flex-1 truncate rounded px-1.5 md:px-2 py-1 text-sm font-medium text-foreground",children:w.name}),$N.length>0&&J("div",{className:"flex md:hidden items-center gap-1 shrink-0",children:[N("span",{className:"text-muted-foreground shrink-0",children:"/"}),J(i,{modal:!1,children:[N(d,{asChild:!0,children:N("button",{className:"text-muted-foreground hover:text-foreground text-sm font-medium px-1.5 py-0.5 rounded hover:bg-accent shrink-0 cursor-pointer","aria-label":"Show omitted folders",children:"..."})}),N(t,{align:"start",children:$N.map((U,Y)=>N(C,{asChild:!0,children:U.path?N(o,{to:U.path,className:"cursor-pointer",children:U.name}):N("button",{onClick:()=>U.id&&X?.(U.id),className:"cursor-pointer w-full text-left",children:U.name})},Y))})]}),N("span",{className:"text-muted-foreground shrink-0",children:"/"})]}),B.slice().reverse().map((U)=>{let Y=_?void 0:`/projects/${z}/folders/${U.id}`;return J("div",{className:"hidden md:flex items-center gap-1",children:[N("span",{className:"text-muted-foreground",children:"/"}),Y?N(o,{to:Y,className:"truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground",children:U.name}):N("button",{onClick:()=>U.id&&X?.(U.id),className:"truncate rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground text-foreground",children:U.name})]},U.id)}),(I||!I&&B.length>0)&&J("div",{className:"flex items-center gap-1 min-w-0 shrink overflow-hidden",children:[N("span",{className:a("text-muted-foreground shrink-0",$N.length>0?"hidden md:inline":"inline"),children:"/"}),I?L0():LN&&N("span",{className:"min-w-0 truncate rounded px-2 py-1 text-sm font-medium text-foreground",children:LN.name})]}),ZN&&J(k,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1.5 text-muted-foreground hover:text-foreground hover:bg-muted ml-1 cursor-pointer shrink-0",onClick:()=>YN(!0),title:Z.linked_tasks(),children:[N(lN,{className:"w-4 h-4"}),SN>0&&N("span",{className:"inline-flex items-center justify-center px-1.5 py-0.2 text-[10px] font-semibold rounded-full bg-muted-foreground/15 text-foreground",children:SN})]})]}),ZN&&s&&V&&N(Z0,{teamId:W,assetId:V,assetName:$.name,isOpen:s,onClose:()=>YN(!1)}),H&&A&&A.length>0&&N(mN,{open:XN,onOpenChange:l,stackId:H,canEdit:c,onStackDissolved:(U)=>{l(!1),m({to:"/projects/$projectId/files/$fileId",params:{projectId:z,fileId:U}})},onVersionRemoved:(U,Y)=>{if(($.version?A.find((h)=>h.version===$.version)?.id:void 0)===U){let h=Y[0];if(h)m({to:"/projects/$projectId/files/$fileId",params:{projectId:z,fileId:H},search:(f0)=>({...f0,version:h.id})})}}}),J("div",{className:"hidden md:flex items-center gap-2",children:[J("div",{className:"flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1",children:[!H&&!_&&D&&N("button",{onClick:D,className:"rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",title:q?"Show Left Sidebar":"Hide Left Sidebar",children:q?N(U0,{className:"h-4 w-4"}):N(W0,{className:"h-4 w-4 fill-primary stroke-0"})}),!H&&!_&&R&&L&&J(g,{children:[N("button",{onClick:()=>L("card"),className:`rounded p-1.5 transition-colors ${R==="card"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:"Card View",children:N(dN,{className:"h-4 w-4"})}),N("button",{onClick:()=>L("list"),className:`rounded p-1.5 transition-colors ${R==="list"?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:"List View",children:N(tN,{className:"h-4 w-4"})})]}),N("button",{onClick:v,className:`rounded p-1.5 transition-colors ${!T&&!P?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,title:T?"Show Right Sidebar":"Hide Right Sidebar",children:!T&&!P?N(X0,{className:"h-4 w-4 fill-primary stroke-0"}):N(J0,{className:"h-4 w-4"})})]}),!_&&p&&N(rN,{children:J(oN,{children:[N(nN,{asChild:!0,children:N("span",{children:N("button",{disabled:!1,onClick:p,className:a("h-9 w-9 flex items-center justify-center rounded-full border border-border bg-background transition-colors",P?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground",!1),children:P?N(Y0,{className:"h-6 w-6 text-primary transition-colors"}):N(xN,{className:"h-6 w-6 text-muted-foreground transition-colors"})})})}),N(eN,{children:N("p",{children:P?Z.hide_chatbot():Z.show_chatbot()})})]})})]})]})}function Q1(){let{projectState:W}=$0(),z=G0(),{isChatbotOpen:K,setIsChatbotOpen:B}=Q0();if(K0()&&W?.fileId)return null;if(!W)return N(O0,{});let{teamId:b,projectId:G,projectName:R,ancestorFolders:L,currentAsset:q,isRootFolder:D,customTerminalBreadcrumb:T,fileId:v,downloadInfo:P,versions:p,isPublic:_,shareId:X,allowDownload:Q,onFolderClick:S,onRename:H,onDelete:f,compareMode:u,canCompareVersions:E,onCompareVersions:A}=W,M=!!v,e=!!T,F=!!X&&!M,m=M?z.fileViewLeftSidebarCollapsed:F?z.shareConfigLeftSidebarCollapsed:z.fileListLeftSidebarCollapsed,c=_?void 0:()=>M?z.setFileViewLeftSidebarCollapsed(!z.fileViewLeftSidebarCollapsed):F?z.setShareConfigLeftSidebarCollapsed(!z.shareConfigLeftSidebarCollapsed):z.setFileListLeftSidebarCollapsed(!z.fileListLeftSidebarCollapsed),WN=_&&W.isRightSidebarCollapsed!==void 0?W.isRightSidebarCollapsed:M?z.fileViewRightSidebarCollapsed:F?z.shareConfigRightSidebarCollapsed:z.fileListRightSidebarCollapsed,XN=_&&W.onRightSidebarToggle?W.onRightSidebarToggle:()=>{if(!_&&K)if(B(!1),M)z.setFileViewRightSidebarCollapsed(!1);else if(F)z.setShareConfigRightSidebarCollapsed(!1);else z.setFileListRightSidebarCollapsed(!1);else if(M)z.setFileViewRightSidebarCollapsed(!z.fileViewRightSidebarCollapsed);else if(F)z.setShareConfigRightSidebarCollapsed(!z.shareConfigRightSidebarCollapsed);else z.setFileListRightSidebarCollapsed(!z.fileListRightSidebarCollapsed)},l=_?void 0:()=>{B(!K)},s=G?z.viewModes[G]??"card":"card";return N(_0,{teamId:b,projectId:G,projectName:R,ancestorFolders:L,currentAsset:q,isRootFolder:D,customTerminalBreadcrumb:T,displayStyle:M||F||e?void 0:s,onDisplayStyleChange:M||F||e?void 0:_?void 0:(V)=>{if(G)z.setViewMode(G,V)},isLeftSidebarCollapsed:m,onLeftSidebarToggle:c,isRightSidebarCollapsed:WN,onRightSidebarToggle:XN,isChatbotOpen:!_&&K,onChatbotToggle:l,isPublic:_,shareId:X,allowDownload:Q,fileId:v,downloadInfo:P,versions:p,onFolderClick:S,onRename:H,onDelete:f,compareMode:u,canCompareVersions:E,onCompareVersions:A})}function O0(){let{toggleMobileMenu:W}=NN();return J("div",{className:"flex h-14 items-center justify-between border-b border-border bg-card px-4 py-2 flex-shrink-0",children:[N(k,{variant:"ghost",size:"icon",onClick:W,className:"md:hidden text-foreground hover:bg-accent -ml-2","aria-label":"Open navigation menu",children:N(JN,{className:"h-5 w-5"})}),N("div",{className:"flex flex-1 items-center justify-center",children:N(H0,{className:"w-10 h-10 text-orange-600"})}),N("div",{className:"w-9 md:hidden"})]})}
2
- export{NN as Oe,Q1 as Pe};
@@ -1 +0,0 @@
1
- import{d as x}from"./chunk-k2065y29.js";import"./chunk-6tse78c7.js";import"./chunk-0n1wfwcm.js";import"./chunk-by6g0vye.js";import"./chunk-gcpr2a24.js";import"./chunk-nn0px81k.js";import"./chunk-mha3rsh7.js";import"./chunk-jt6d0zb1.js";import"./chunk-4b7jcpgv.js";import"./chunk-djx2r4nj.js";import"./chunk-y3dy4pdt.js";import"./chunk-mgnxa0vy.js";import{me as f}from"./chunk-m8z8jvdq.js";import{Ee as p}from"./chunk-y0f4bc9f.js";import"./chunk-j536e9nx.js";import"./chunk-ajndx51c.js";import"./chunk-93ecxcy4.js";import"./chunk-mhps85dd.js";import"./chunk-r2shjtte.js";import"./chunk-ns804tmv.js";import"./chunk-ymr5ybxk.js";import"./chunk-2xevs82j.js";import"./chunk-y2s0tjaa.js";import"./chunk-yyjx8nbq.js";import"./chunk-zye42cfp.js";import"./chunk-dk8vk17v.js";import"./chunk-rkz6x3r0.js";import"./chunk-7x1vkftb.js";import"./chunk-ck6msfch.js";import"./chunk-vhcqazqf.js";import"./chunk-tcm57j8r.js";import"./chunk-0bfqrx5q.js";import"./chunk-dkjkn8t3.js";import"./chunk-76433x4d.js";import"./chunk-2xgvs3as.js";import"./chunk-9cmvymm5.js";import"./chunk-6m1k317a.js";import"./chunk-kxr8fjsq.js";import{mi as h}from"./chunk-02afmyqy.js";import{Ci as c,ti as l,ui as r}from"./chunk-8nyve0cr.js";import"./chunk-62ebss6h.js";import{Vi as v,Xi as a,gj as o}from"./chunk-kqpzx5az.js";import{kn as w}from"./chunk-p49h5fxs.js";var g=w(v(),1);function y(){let{projectId:e,folderId:b}=d.useParams(),{teamId:s,ensureTeamIdForProject:n}=h();g.useEffect(()=>{n(e)},[e,n]);let{data:i}=r(f(e)),t=i?.rootFolder,{data:m}=l({queryKey:["folders",t],queryFn:()=>(async()=>{return await(await c.api.folders[":folderId"].$get({param:{folderId:t}})).json()})(),enabled:!!t});if(!s||!t||!m)return a(p,{});return a(x,{teamId:s,projectId:e,projectName:i.name??"",assetId:b,rootFolderId:t})}var d=o("/projects/$projectId/folders/$folderId")({component:y});export{d as Route};
@@ -1,2 +0,0 @@
1
- import{Pl as t,Xi as o,cm as a}from"./chunk-kqpzx5az.js";function m({className:r,orientation:i="horizontal",decorative:e=!0,...n}){return o(a.Root,{"data-slot":"separator",decorative:e,orientation:i,className:t("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",r),...n})}
2
- export{m as kg};