@shumai-one/shumai 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/bin/{chunk-adekdctx.css → chunk-0ccg9ddn.css} +1 -1
  2. package/bin/chunk-0e4wawpq.js +2 -0
  3. package/bin/chunk-185qefn1.js +2 -0
  4. package/bin/chunk-1kw2mbqb.js +1 -0
  5. package/bin/chunk-1wm6ptdx.js +1 -0
  6. package/bin/chunk-1yacmegc.js +2 -0
  7. package/bin/chunk-2291ehh5.js +3 -0
  8. package/bin/chunk-2520aq8j.js +2 -0
  9. package/bin/chunk-29zdp63z.js +3 -0
  10. package/bin/chunk-2yxj593j.js +2 -0
  11. package/bin/chunk-32pcmaqm.js +3 -0
  12. package/bin/chunk-3a13dcs1.js +1 -0
  13. package/bin/chunk-3cyrcgm5.js +13 -0
  14. package/bin/chunk-3swpwb9v.js +1 -0
  15. package/bin/chunk-3wmcx2bv.js +2 -0
  16. package/bin/chunk-4r81ghg8.js +2 -0
  17. package/bin/chunk-4v5n0ayb.js +2 -0
  18. package/bin/chunk-5a8nt4me.js +1 -0
  19. package/bin/chunk-66hsjnw6.js +2 -0
  20. package/bin/chunk-6bhn1p8v.js +211 -0
  21. package/bin/chunk-6gg1ymer.js +2 -0
  22. package/bin/chunk-70c3xrgd.js +2 -0
  23. package/bin/chunk-7esm0hqb.js +2 -0
  24. package/bin/chunk-7fst8kdw.js +12 -0
  25. package/bin/chunk-83e12sjg.js +3 -0
  26. package/bin/chunk-87zxtf66.js +3 -0
  27. package/bin/chunk-8fmy5jtp.js +2 -0
  28. package/bin/chunk-8zqgaxvv.js +1 -0
  29. package/bin/chunk-9t1ne8xr.js +2 -0
  30. package/bin/chunk-a32vreya.js +2 -0
  31. package/bin/chunk-a3dmtt2j.js +1 -0
  32. package/bin/chunk-abt0azmv.js +2 -0
  33. package/bin/chunk-ag6p3mbf.js +2 -0
  34. package/bin/chunk-aqbrzx9z.js +1 -0
  35. package/bin/chunk-av1a8fqp.js +3 -0
  36. package/bin/chunk-awfwk64v.js +2 -0
  37. package/bin/chunk-b235azv4.js +45 -0
  38. package/bin/chunk-b9yrw9et.js +10 -0
  39. package/bin/chunk-bay038pj.js +2 -0
  40. package/bin/chunk-c007p0t8.js +299 -0
  41. package/bin/chunk-cak32x57.js +2 -0
  42. package/bin/chunk-ce8m4zeg.js +3 -0
  43. package/bin/chunk-ck8azecb.js +12 -0
  44. package/bin/chunk-cnxwmycy.js +6 -0
  45. package/bin/chunk-cqb415s6.js +5 -0
  46. package/bin/chunk-e2mvmq2m.js +1 -0
  47. package/bin/chunk-e7mqtkzn.js +2 -0
  48. package/bin/chunk-e99dv20z.js +3 -0
  49. package/bin/chunk-ea79xnn3.js +2 -0
  50. package/bin/chunk-ehc9adfz.js +2 -0
  51. package/bin/chunk-ejbvfj4r.js +1 -0
  52. package/bin/chunk-ekfem7kf.js +1 -0
  53. package/bin/chunk-etwkk0xh.js +1 -0
  54. package/bin/chunk-evrdd32b.js +2 -0
  55. package/bin/chunk-f15qyp41.js +1 -0
  56. package/bin/chunk-f3ehv01n.js +54 -0
  57. package/bin/chunk-fm6p03ad.js +2 -0
  58. package/bin/chunk-fxswt9hc.js +3 -0
  59. package/bin/chunk-fyha3r13.js +2 -0
  60. package/bin/chunk-g0vs7k2x.js +1 -0
  61. package/bin/chunk-g84z2w7v.js +16 -0
  62. package/bin/chunk-gk3eqd50.js +2 -0
  63. package/bin/chunk-h3tbf521.js +2 -0
  64. package/bin/chunk-h837fyed.js +2 -0
  65. package/bin/chunk-hfh0c082.js +2 -0
  66. package/bin/chunk-j20e0qsw.js +7 -0
  67. package/bin/chunk-j8fxp8ej.js +2 -0
  68. package/bin/chunk-jje8nj8h.js +3 -0
  69. package/bin/chunk-jy006gcv.js +7 -0
  70. package/bin/chunk-k7hss0bd.js +4 -0
  71. package/bin/chunk-m7m9d4fb.js +2 -0
  72. package/bin/chunk-n1jwdb0a.js +1 -0
  73. package/bin/chunk-p5gf1zdm.js +4 -0
  74. package/bin/chunk-pb1zf0vb.js +2 -0
  75. package/bin/chunk-pfgxggaj.js +11 -0
  76. package/bin/chunk-q16490pv.js +2 -0
  77. package/bin/chunk-q2bvyv39.js +8 -0
  78. package/bin/chunk-qf24e71w.js +2 -0
  79. package/bin/chunk-qh81zhg1.js +1 -0
  80. package/bin/chunk-qwp3kwbz.js +2 -0
  81. package/bin/chunk-qwqvt9v6.js +2 -0
  82. package/bin/chunk-qydeqgyj.js +5 -0
  83. package/bin/chunk-r7dty1tg.js +2 -0
  84. package/bin/chunk-rbj4fad9.js +32 -0
  85. package/bin/chunk-rhdxwebf.js +2 -0
  86. package/bin/chunk-rhh716z0.js +42 -0
  87. package/bin/chunk-rpywcvg1.js +3 -0
  88. package/bin/chunk-rza4ae5z.js +3 -0
  89. package/bin/chunk-sfx2588q.js +3 -0
  90. package/bin/chunk-sk4e6rb1.js +1 -0
  91. package/bin/chunk-t2n1dbgx.js +4 -0
  92. package/bin/chunk-tf28796q.js +2 -0
  93. package/bin/chunk-twdxayky.js +3 -0
  94. package/bin/chunk-v9b3w8q5.js +3 -0
  95. package/bin/chunk-v9w25rp2.js +2 -0
  96. package/bin/chunk-vgn5zcpv.js +3 -0
  97. package/bin/chunk-wfzqnpc1.js +3 -0
  98. package/bin/chunk-wry2hvrq.js +24 -0
  99. package/bin/chunk-x8f4defx.js +3 -0
  100. package/bin/chunk-xp59apdb.js +2 -0
  101. package/bin/chunk-xtf3c29c.css +1 -0
  102. package/bin/chunk-z3gkt8w1.js +3 -0
  103. package/bin/chunk-zehyn6vd.js +2 -0
  104. package/bin/chunk-zh6fqq44.js +1 -0
  105. package/bin/chunk-zmv8cg4s.js +8 -0
  106. package/bin/chunk-zqv0zhfb.js +3 -0
  107. package/bin/{pdf.worker.min-szxdj13d.mjs → pdf.worker.min-vf48er29.mjs} +14423 -13889
  108. package/bin/shumai-app.html +1 -1
  109. package/bin/shumai-app.js +630 -452
  110. package/package.json +18 -18
  111. package/prisma/migrations/20260904022457_add_agent_id_to_assets_and_audit_logs/migration.sql +17 -0
  112. package/prisma/migrations/20260906081230_default_denied_tools_delete_asset/migration.sql +15 -0
  113. package/prisma/schema.prisma +9 -0
  114. package/bin/chunk-082zg4nr.js +0 -307
  115. package/bin/chunk-09pe07g6.js +0 -7
  116. package/bin/chunk-0qdzjcny.js +0 -2
  117. package/bin/chunk-0z1p2pvf.js +0 -1
  118. package/bin/chunk-116p639c.js +0 -3
  119. package/bin/chunk-13ypr8v0.js +0 -8
  120. package/bin/chunk-16txy3r1.js +0 -2
  121. package/bin/chunk-1vs91e4q.js +0 -2
  122. package/bin/chunk-29e0mb43.js +0 -1
  123. package/bin/chunk-2a0egvsg.js +0 -1
  124. package/bin/chunk-2f35h4fn.js +0 -2
  125. package/bin/chunk-2jsjrqw4.js +0 -2
  126. package/bin/chunk-2q7ew7yz.js +0 -2
  127. package/bin/chunk-2sc2jxd3.js +0 -2
  128. package/bin/chunk-2vc6pw8q.js +0 -2
  129. package/bin/chunk-3gqdepkd.js +0 -12
  130. package/bin/chunk-44370df5.js +0 -4
  131. package/bin/chunk-44xtwvd7.js +0 -2
  132. package/bin/chunk-47r5b77s.js +0 -41
  133. package/bin/chunk-4azttb3w.js +0 -1
  134. package/bin/chunk-4ee336e3.js +0 -2
  135. package/bin/chunk-4k2d8w9w.js +0 -2
  136. package/bin/chunk-4yhd7bmp.js +0 -5
  137. package/bin/chunk-4yybby29.js +0 -2
  138. package/bin/chunk-5395g4kq.js +0 -4
  139. package/bin/chunk-5bkj2n94.js +0 -2
  140. package/bin/chunk-5c4h0t33.js +0 -2
  141. package/bin/chunk-6nrynqdw.js +0 -2
  142. package/bin/chunk-6tv7rm3x.js +0 -2
  143. package/bin/chunk-785kxysj.js +0 -68
  144. package/bin/chunk-78cxvbjd.js +0 -4
  145. package/bin/chunk-7g2k89gq.js +0 -2
  146. package/bin/chunk-7psq38hv.js +0 -1
  147. package/bin/chunk-7qzt5nhz.js +0 -3
  148. package/bin/chunk-7sf0gbbm.js +0 -2
  149. package/bin/chunk-7wvw67f3.js +0 -5
  150. package/bin/chunk-7xcyn1ba.js +0 -2
  151. package/bin/chunk-7zgvmn5q.js +0 -2
  152. package/bin/chunk-8pfgh13x.js +0 -4
  153. package/bin/chunk-8rcfhfq5.js +0 -3
  154. package/bin/chunk-8yt4m2pb.js +0 -2
  155. package/bin/chunk-90tbc5f4.js +0 -2
  156. package/bin/chunk-92yvt66q.js +0 -2
  157. package/bin/chunk-93v3tm93.js +0 -1
  158. package/bin/chunk-9f83pnfc.js +0 -2
  159. package/bin/chunk-a5b3aevg.js +0 -2
  160. package/bin/chunk-af6m9p1d.js +0 -2
  161. package/bin/chunk-ajryg2e2.js +0 -1
  162. package/bin/chunk-axb1f1ae.js +0 -2
  163. package/bin/chunk-b0cqsrse.js +0 -9
  164. package/bin/chunk-b27jgdsf.css +0 -1
  165. package/bin/chunk-bbar8rsh.js +0 -3
  166. package/bin/chunk-be9a7kc6.js +0 -2
  167. package/bin/chunk-bkbqvxfv.js +0 -65
  168. package/bin/chunk-bwyph9a0.js +0 -1
  169. package/bin/chunk-c43nmcfq.js +0 -2
  170. package/bin/chunk-c97vh5wb.js +0 -44
  171. package/bin/chunk-cerjktz2.js +0 -11
  172. package/bin/chunk-cyvx7gcx.js +0 -2
  173. package/bin/chunk-d6d1j7qq.js +0 -14
  174. package/bin/chunk-d9sh922y.js +0 -13
  175. package/bin/chunk-dbjc1vxt.js +0 -1
  176. package/bin/chunk-djkajvn7.js +0 -24
  177. package/bin/chunk-dyvmwafa.js +0 -2
  178. package/bin/chunk-ewge52nq.js +0 -3
  179. package/bin/chunk-f32kxe6c.js +0 -2
  180. package/bin/chunk-f4d3v0nc.js +0 -2
  181. package/bin/chunk-f8ysqfyv.js +0 -2
  182. package/bin/chunk-fcsar7p0.js +0 -2
  183. package/bin/chunk-gfdfkqrc.js +0 -6
  184. package/bin/chunk-gr30nssh.js +0 -1
  185. package/bin/chunk-gtwhwdbs.js +0 -1
  186. package/bin/chunk-gyaem1t4.js +0 -3
  187. package/bin/chunk-hk6tvf7b.js +0 -1
  188. package/bin/chunk-hmmzbyy1.js +0 -2
  189. package/bin/chunk-hx2mvd20.js +0 -3
  190. package/bin/chunk-hzz4hsss.js +0 -1
  191. package/bin/chunk-j10gz94w.js +0 -2
  192. package/bin/chunk-j5rx3x1q.js +0 -3
  193. package/bin/chunk-j9q9rjvd.js +0 -4
  194. package/bin/chunk-jw00fmkp.js +0 -67
  195. package/bin/chunk-k1f3gj25.js +0 -3
  196. package/bin/chunk-k20w9eaz.js +0 -3
  197. package/bin/chunk-kejt7kcr.js +0 -2
  198. package/bin/chunk-kkveddbn.js +0 -2
  199. package/bin/chunk-kryt6pg3.js +0 -1
  200. package/bin/chunk-ktvmxqfg.js +0 -5
  201. package/bin/chunk-m49g5tf4.js +0 -2
  202. package/bin/chunk-me3xj7na.js +0 -2
  203. package/bin/chunk-mgnxa0vy.js +0 -2
  204. package/bin/chunk-mgytr7nc.js +0 -3
  205. package/bin/chunk-mkb4dycy.js +0 -2
  206. package/bin/chunk-n21a21vx.js +0 -2
  207. package/bin/chunk-n8gsjwht.js +0 -3
  208. package/bin/chunk-nndzhn3n.js +0 -2
  209. package/bin/chunk-pcxjm1re.js +0 -2
  210. package/bin/chunk-pg00gkr4.js +0 -3
  211. package/bin/chunk-pn94h6x7.js +0 -3
  212. package/bin/chunk-pt51m9h1.js +0 -2
  213. package/bin/chunk-px2cvc1n.js +0 -2
  214. package/bin/chunk-q059y3wx.js +0 -2
  215. package/bin/chunk-q46rc697.js +0 -3
  216. package/bin/chunk-r6g1srb3.js +0 -3
  217. package/bin/chunk-r88vwaxc.js +0 -1
  218. package/bin/chunk-r9pzpqst.js +0 -2
  219. package/bin/chunk-rar0gk7s.js +0 -3
  220. package/bin/chunk-rfrpb986.js +0 -1
  221. package/bin/chunk-rfsbzd39.js +0 -2
  222. package/bin/chunk-s503pcvb.js +0 -7
  223. package/bin/chunk-s9sgkkjp.js +0 -2
  224. package/bin/chunk-srs9jq8f.js +0 -2
  225. package/bin/chunk-t77dwtcc.js +0 -2
  226. package/bin/chunk-tcqw0q8x.js +0 -45
  227. package/bin/chunk-thd9zasr.js +0 -1
  228. package/bin/chunk-tkgpc6c9.js +0 -2
  229. package/bin/chunk-ts10cfmc.js +0 -2
  230. package/bin/chunk-txkmks1h.js +0 -3
  231. package/bin/chunk-v9hbssqd.js +0 -3
  232. package/bin/chunk-v9zc56qr.js +0 -1
  233. package/bin/chunk-vh7eb7tp.js +0 -6
  234. package/bin/chunk-w9p59ahz.js +0 -73
  235. package/bin/chunk-wfee9d83.js +0 -12
  236. package/bin/chunk-wxsq9zmf.js +0 -3
  237. package/bin/chunk-wzdnsgwq.js +0 -2
  238. package/bin/chunk-x2nnv4j8.js +0 -1
  239. package/bin/chunk-xxtcmzcv.js +0 -2
  240. package/bin/chunk-xyzmew7g.js +0 -2
  241. package/bin/chunk-ygsbmfcy.js +0 -2
  242. package/bin/chunk-ym9xavj0.js +0 -7
  243. package/bin/chunk-z340qkez.js +0 -8
  244. package/bin/chunk-za7ga4bf.js +0 -3
  245. package/bin/chunk-zqvavykq.js +0 -2
  246. package/bin/chunk-zt15ht52.js +0 -2
  247. /package/bin/{chunk-24ke0th1.css → chunk-kegybs91.css} +0 -0
@@ -1,7 +0,0 @@
1
- import{$i as W0,Sl as R$,Wl as m,Zl as Z0,_l as U0,bj as F,cj as F0,ij as f2,qm as o0}from"./chunk-w9p59ahz.js";import{rn as X0}from"./chunk-txkmks1h.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 ui,W2 as vi,C0 as wi,P2 as xi,w2 as yi,V2 as zi,N2 as Ai,K2 as Bi,B2 as Ci,S$ as Di,gz as Ei,l1 as Fi,q$ as Gi,g$ as Hi,yz as Ii,uz as Ji,iz as Ki,rz as Li,nz as Mi,oz as Ni,az as Oi,sz as Pi,tz as Qi,Z8 as Ri,J8 as Si,A8 as Ti,W8 as Ui,P8 as Vi,U8 as Wi,H8 as Xi,K8 as Yi,B8 as Zi};
@@ -1,2 +0,0 @@
1
- import{ag as F}from"./chunk-ktvmxqfg.js";import{Dl as B,Rl as E,mk as x,nk as z,sl as A,tm as k}from"./chunk-w9p59ahz.js";var J={agent_total_tokens:{label:()=>k.quota_resource_agent_total_tokens(),icon:x,unit:"tokens"},agent_cost:{label:()=>k.quota_resource_agent_cost(),icon:z,unit:"$"},agent_mcp_call_count:{label:()=>k.quota_resource_agent_mcp_call_count(),icon:A,unit:"calls"},agent_bash_call_count:{label:()=>k.quota_resource_agent_bash_call_count(),icon:B,unit:"calls"},agent_tool_call_count:{label:()=>k.quota_resource_agent_tool_call_count(),icon:E,unit:"calls"}};function K(q,w){if(q==="agent_cost")return`$${w.toFixed(2)}`;return w.toLocaleString()}function L(q){switch(F(q)){case"1hour":return k.quota_period_1hour();case"5hour":return k.quota_period_5hour();case"1day":return k.quota_period_1day();case"7day":return k.quota_period_7day();default:return q}}
2
- export{J as a,K as b,L as c};
@@ -1,2 +0,0 @@
1
- import{$i as m,Wl as i,Xl as d,bj as o,nm as p}from"./chunk-w9p59ahz.js";import{rn as c}from"./chunk-txkmks1h.js";var n=c(m(),1);var l=d("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var u=n.createContext({size:"default",variant:"default",spacing:0});function y({className:s,variant:r,size:a,spacing:e=0,children:g,...t}){return o(p.Root,{"data-slot":"toggle-group","data-variant":r,"data-size":a,"data-spacing":e,style:{"--gap":e},className:i("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",s),...t,children:o(u.Provider,{value:{variant:r,size:a,spacing:e},children:g})})}function R({className:s,children:r,variant:a,size:e,...g}){let t=n.useContext(u);return o(p.Item,{"data-slot":"toggle-group-item","data-variant":t.variant||a,"data-size":t.size||e,"data-spacing":t.spacing,className:i(l({variant:t.variant||a,size:t.size||e}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",s),...g,children:r})}
2
- export{y as $,R as aa};
@@ -1,2 +0,0 @@
1
- import{Ze as S0}from"./chunk-6nrynqdw.js";import{_e as Kb}from"./chunk-5bkj2n94.js";import{Af as Ab,Bf as k0,Cf as u0,Df as Tb,zf as Pb}from"./chunk-kejt7kcr.js";import{Kf as o0,Lf as hb}from"./chunk-2q7ew7yz.js";import{Nf as i0,Of as l0,Pf as x0,Qf as D,Rf as x,Sf as d,bg as _b,dg as t0}from"./chunk-ktvmxqfg.js";import{gg as K0,hg as E0,ig as G0,jg as $0,kg as u}from"./chunk-hmmzbyy1.js";import{lg as Qb}from"./chunk-d6d1j7qq.js";import{mg as bb}from"./chunk-7g2k89gq.js";import{gh as p0}from"./chunk-785kxysj.js";import{hh as k}from"./chunk-ygsbmfcy.js";import{kh as a0}from"./chunk-16txy3r1.js";import{bi as P0}from"./chunk-2sc2jxd3.js";import{ci as Eb}from"./chunk-f32kxe6c.js";import{di as w0,ei as Y0,fi as W0}from"./chunk-2f35h4fn.js";import{gi as Wb,ii as Hb,ji as Jb,ki as Zb}from"./chunk-4k2d8w9w.js";import{Bi as N0,Ci as A0,Ii as Q,Ji as qb,Ki as Vb,Li as Xb,Mi as zb,Ni as Ob,Oi as Ub,Pi as ob,Qi as Db,Ri as V0,Ti as X0,Ui as z0,Vi as M0,Wi as O0,Yi as m,wi as D0,zi as P}from"./chunk-s503pcvb.js";import{_i as I}from"./chunk-axb1f1ae.js";import{$i as Z0,Aj as $b,Cl as fb,Dj as M,Fl as Yb,Gk as Cb,Nk as d0,Qj as Rb,Sl as U0,Wl as j,Xj as B0,_k as Mb,aj as T0,ak as C0,bj as b,cj as r,el as vb,il as L0,ok as wb,qk as g0,qm as A,rk as h0,rl as I0,sk as s0,tm as y,um as v0,xk as a}from"./chunk-w9p59ahz.js";import{rn as J0}from"./chunk-txkmks1h.js";var Ib=[D.TODO,D.READY,D.IN_PROGRESS,D.BLOCKED,D.IN_REVIEW,D.DONE];function f0(N){switch(N){case D.TODO:return y.status_todo();case D.READY:return y.status_ready();case D.IN_PROGRESS:return y.status_in_progress();case D.BLOCKED:return y.status_blocked();case D.IN_REVIEW:return y.status_in_review();case D.DONE:return y.status_done();default:return N}}function kb(N){switch(N){case D.TODO:return{badge:"bg-muted text-muted-foreground border-border",border:"border-border",dot:"bg-muted-foreground",bg:"bg-muted/30"};case D.READY:return{badge:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",border:"border-blue-500/30",dot:"bg-blue-500",bg:"bg-blue-500/5"};case D.IN_PROGRESS:return{badge:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",border:"border-amber-500/30",dot:"bg-amber-500",bg:"bg-amber-500/5"};case D.BLOCKED:return{badge:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",border:"border-red-500/30",dot:"bg-red-500",bg:"bg-red-500/5"};case D.IN_REVIEW:return{badge:"bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20",border:"border-purple-500/30",dot:"bg-purple-500",bg:"bg-purple-500/5"};case D.DONE:return{badge:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",border:"border-emerald-500/30",dot:"bg-emerald-500",bg:"bg-emerald-500/5"}}}function Q0(N){return kb(N).badge}function m0(N){switch(N){case x.LOW:return y.priority_low();case x.MEDIUM:return y.priority_medium();case x.HIGH:return y.priority_high();case x.URGENT:return y.priority_urgent();default:return N}}function c0(N){switch(N){case x.LOW:return"bg-muted text-muted-foreground border-border";case x.MEDIUM:return"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20";case x.HIGH:return"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20";case x.URGENT:return"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20 font-semibold";default:return"bg-muted text-muted-foreground border-border"}}var H0=J0(Z0(),1);var _0=J0(Z0(),1);var ub=[D.TODO,D.READY,D.IN_PROGRESS,D.IN_REVIEW,D.DONE,D.BLOCKED];function j0({teamId:N,currentTaskId:_,excludeTaskIds:E=[],value:W=[],knownTasks:O=[],onChange:q,disabled:z=!1,canEdit:T=!0,className:$}){let[J,B]=_0.useState(!1),[h,Z]=_0.useState(D.TODO),[X,w]=_0.useState(""),[p,H]=_0.useState(()=>{let G={};for(let U of O)G[U.id]={title:U.title,status:U.status};return G}),{data:R,isLoading:y0}=P({queryKey:["teams",N,"kanban","tasks","status",h],queryFn:async()=>{let G=await Q.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:N},query:{status:h,first:"100"}});if(!G.ok)return{data:[]};return await G.json()},enabled:!!N&&J}),F=R?.data||[];_0.useMemo(()=>{if(F.length>0)H((G)=>{let U=!1,g={...G};for(let S of F)if(!g[S.id]||g[S.id].title!==S.title||g[S.id].status!==S.status)g[S.id]={title:S.title,status:S.status},U=!0;return U?g:G})},[F]);let n=_0.useMemo(()=>{let G=new Set(E);if(_)G.add(_);return G},[_,E]),i=_0.useMemo(()=>{let G=X.trim().toLowerCase();return F.filter((U)=>{if(n.has(U.id))return!1;if(!G)return!0;return U.title.toLowerCase().includes(G)})},[F,n,X]),l=(G)=>{if(!T||z)return;let g=W.includes(G)?W.filter((S)=>S!==G):[...W,G];q?.(g)},f=(G,U)=>{if(U.stopPropagation(),!T||z)return;q?.(W.filter((g)=>g!==G))},V=T&&!z;return r(i0,{open:J&&V,onOpenChange:(G)=>V&&B(G),children:[b(l0,{asChild:!0,children:b("div",{role:"button",tabIndex:V?0:-1,className:j("w-full min-h-[36px] px-2.5 py-1.5 flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background text-xs transition-colors",V?"cursor-pointer hover:border-ring/60 focus:outline-none focus:ring-2 focus:ring-ring/50":"cursor-not-allowed opacity-70",$),children:W.length===0?r("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[b(d0,{className:"w-3.5 h-3.5 text-muted-foreground/70"}),b("span",{children:y.select_parent_tasks()})]}):W.map((G)=>{let U=p[G];return r("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] bg-muted text-foreground border border-border/80 shrink-0 max-w-[220px]",children:[U?.status&&b("span",{className:j("px-1 py-0.2 rounded text-[9px] uppercase font-semibold shrink-0",Q0(U.status)),children:f0(U.status)}),b("span",{className:"truncate font-medium",children:U?.title||G}),V&&b("button",{type:"button",onClick:(g)=>f(G,g),className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 -mr-1",children:b(U0,{className:"w-3 h-3"})})]},G)})})}),r(x0,{align:"start",sideOffset:4,className:"w-[var(--radix-popover-trigger-width)] min-w-[320px] sm:min-w-[420px] max-w-[500px] p-2.5 space-y-2 bg-popover border border-border rounded-lg shadow-lg",children:[b("div",{className:"flex flex-wrap gap-1.5 pb-0.5",children:ub.map((G)=>{return b("button",{type:"button",onClick:()=>Z(G),className:j("text-[11px] h-7 px-2.5 rounded-md font-medium transition-colors border shrink-0",h===G?"bg-primary text-primary-foreground border-primary shadow-xs":"bg-muted/50 hover:bg-accent text-muted-foreground hover:text-foreground border-border/60"),children:f0(G)},G)})}),r("div",{className:"relative",children:[b(I0,{className:"w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),b(v0,{value:X,onChange:(G)=>w(G.target.value),placeholder:y.filter_tasks_placeholder(),className:"h-8 pl-8 text-xs bg-muted/40",autoFocus:!0})]}),b("div",{className:"border rounded-md overflow-hidden bg-background/50",children:b(k,{className:"h-48 p-1",children:y0?b("div",{className:"flex items-center justify-center py-8",children:b(M,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):i.length===0?b("div",{className:"py-8 text-center text-xs text-muted-foreground italic",children:y.no_matching_tasks()}):b("div",{className:"space-y-1",children:i.map((G)=>{let U=W.includes(G.id);return r("div",{onClick:()=>l(G.id),className:j("flex items-center justify-between p-2 rounded-md hover:bg-accent cursor-pointer transition-colors text-xs border border-transparent",U&&"bg-accent/50 border-border/50"),children:[r("div",{className:"flex items-center gap-2 min-w-0 flex-1 pr-2",children:[b("div",{className:j("w-4 h-4 rounded border flex items-center justify-center shrink-0 transition-colors",U?"bg-primary border-primary text-primary-foreground":"border-input bg-background"),children:U&&b(C0,{className:"w-3 h-3 stroke-[3]"})}),b("span",{className:j("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium shrink-0",Q0(G.status)),children:f0(G.status)}),b("span",{className:"font-medium text-foreground truncate",children:G.title})]}),G.assignee&&b("span",{className:"text-[10px] text-muted-foreground truncate shrink-0",children:G.assignee.name})]},G.id)})})})})]})]})}var rb=J0(Z0(),1);var q0=J0(Z0(),1);function e0({teamId:N,initialProjectId:_,excludeAssetIds:E=[],isOpen:W,onClose:O,onConfirm:q}){let[z,T]=q0.useState(_||""),[$,J]=q0.useState(null),[B,h]=q0.useState(new Map),{data:Z,isLoading:X}=P({queryKey:["teams",N,"projects"],queryFn:async()=>{let K=await Q.api.teams[":teamId"].projects.$get({param:{teamId:N},query:{first:"100"}});if(!K.ok)throw Error("Failed to fetch projects");return await K.json()},enabled:!!N&&W}),w=Z?.data||[],p=z||(w[0]?.id??""),H=w.find((K)=>K.id===p),R=$?.id||H?.rootFolder||"",y0=R===H?.rootFolder,{data:F,fetchNextPage:n,hasNextPage:i,isFetchingNextPage:l,isLoading:f}=A0({queryKey:["folders",R,"children","folder","picker"],queryFn:async({pageParam:K})=>{let L=await Q.api.folders[":folderId"].children.$get({param:{folderId:R},query:{assetType:"folder",after:K,first:"20"}});if(!L.ok)throw Error("Failed to fetch folders");return await L.json()},initialPageParam:"",getNextPageParam:(K)=>K.pageInfo?.cursor||void 0,enabled:!!R&&W}),{data:V,fetchNextPage:G,hasNextPage:U,isFetchingNextPage:g,isLoading:S}=A0({queryKey:["folders",R,"children","file","picker"],queryFn:async({pageParam:K})=>{let L=await Q.api.folders[":folderId"].children.$get({param:{folderId:R},query:{assetType:"file",after:K,first:"20"}});if(!L.ok)throw Error("Failed to fetch files");return await L.json()},initialPageParam:"",getNextPageParam:(K)=>K.pageInfo?.cursor||void 0,enabled:!!R&&W}),{ref:Y,inView:o}=a0();q0.useEffect(()=>{if(o){if(i&&!l)n();else if(U&&!g)G()}},[o,i,l,n,U,g,G]);let t=f&&!F||S&&!V,v=l||g,C=q0.useMemo(()=>{let K=F?.pages.flatMap((r0)=>r0.data??[])??[],L=V?.pages.flatMap((r0)=>r0.data??[])??[];return[...K,...L]},[F,V]),e=(K)=>{let L=new Map(B);if(L.has(K.id))L.delete(K.id);else{let r0=H?`/${[H.name,...(K.ancestorFolders||[]).map((R0)=>R0.name)].filter(Boolean).join("/")}`:"/";L.set(K.id,{id:K.id,name:K.name,type:K.type,proxyType:K.proxyType??null,thumbnailUrl:K.preview?.thumbnailUrl??null,path:r0,creator:K.creator?{id:K.creator.id,name:K.creator.name,image:K.creator.image??void 0}:null,sizeByte:K.sizeByte??0,fileCount:K.fileCount??null,projectId:K.projectId??H?.id??null,createdAt:K.createdAt??new Date().toISOString()})}h(L)},s=()=>{if(!$||y0)return;let K=new Map(B);if(K.has($.id))K.delete($.id);else{let L=H?`/${[H.name,...($.ancestorFolders||[]).map((r0)=>r0.name)].filter(Boolean).join("/")}`:"/";K.set($.id,{id:$.id,name:$.name,type:"folder",proxyType:null,thumbnailUrl:null,path:L,creator:$.creator?{id:$.creator.id,name:$.creator.name,image:$.creator.image??void 0}:null,sizeByte:$.sizeByte??0,fileCount:$.fileCount??null,projectId:$.projectId??H?.id??null,createdAt:$.createdAt??new Date().toISOString()})}h(K)},b0=()=>{q(Array.from(B.values())),O()};return b(V0,{open:W,onOpenChange:(K)=>{if(!K)O()},children:r(X0,{className:"sm:max-w-4xl flex flex-col h-[650px] p-0 overflow-hidden gap-1",children:[b(z0,{className:"px-4 py-3 border-b shrink-0",children:r("div",{className:"flex items-center gap-2",children:[b(a,{className:"w-5 h-5 text-primary"}),b(O0,{children:y.select_assets()})]})}),r("div",{className:"flex items-center gap-2.5 px-4 py-1.5 border-b bg-transparent shrink-0",children:[r("span",{className:"text-xs font-medium text-muted-foreground whitespace-nowrap",children:[y.current_project_label(),":"]}),b("div",{className:"w-64",children:r(K0,{value:p,onValueChange:(K)=>{T(K),J(null)},children:[b(G0,{className:"h-8 text-xs bg-background",children:b(E0,{placeholder:y.select_project()})}),b($0,{children:w.map((K)=>b(u,{value:K.id,className:"text-xs",children:K.name},K.id))})]})})]}),r("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[b("div",{className:"w-1/3 min-h-0 border-r bg-sidebar/30 flex flex-col overflow-hidden",children:b(k,{className:"flex-1 min-h-0 [&>div>div]:block!",children:H&&H.rootFolder?b("div",{className:"p-2",children:b(p0,{teamId:N,projectId:H.id,projectName:H.name,rootFolderId:H.rootFolder,onSelect:(K)=>J(K),selectedFolderId:R,hideCollections:!0,hideShares:!0,hideRecentlyDeleted:!0})}):b("div",{className:"flex items-center justify-center h-full p-6 text-xs text-muted-foreground",children:X?b(M,{className:"w-5 h-5 animate-spin text-muted-foreground"}):y.no_project_selected()})})}),r("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden bg-background",children:[r("div",{className:"p-2.5 px-4 border-b flex items-center justify-between bg-muted/20 shrink-0",children:[r("div",{className:"flex items-center gap-2 text-xs font-medium truncate",children:[b(a,{className:"w-4 h-4 text-muted-foreground shrink-0"}),b("span",{className:"truncate",children:$?$.name:H?.name||""}),y0&&b("span",{className:"text-[10px] text-muted-foreground/70 bg-muted px-1.5 py-0.5 rounded",children:"Root"})]}),!y0&&$&&b(A,{size:"sm",variant:B.has($.id)?"secondary":"outline",className:"h-7 text-xs gap-1.5",onClick:s,disabled:E.includes($.id),children:B.has($.id)?r(T0,{children:[b(C0,{className:"w-3.5 h-3.5 text-primary"}),y.saved()]}):r(T0,{children:[b(L0,{className:"w-3.5 h-3.5"}),y.select_current_folder()]})})]}),b(k,{className:"flex-1 min-h-0 [&>div>div]:block!",children:t?b("div",{className:"flex items-center justify-center p-12",children:b(M,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):C.length===0?r("div",{className:"flex flex-col items-center justify-center p-12 text-center text-xs text-muted-foreground gap-2",children:[b(a,{className:"w-8 h-8 opacity-30"}),b("p",{children:y.no_assets_in_folder()})]}):r("div",{className:"divide-y divide-border/40",children:[C.map((K)=>{let L=E.includes(K.id),r0=B.has(K.id),R0=K.type==="folder";return r("div",{onClick:()=>{if(!L)e(K)},className:`flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 cursor-pointer transition-colors ${r0?"bg-primary/5":""} ${L?"opacity-50 cursor-not-allowed":""}`,children:[b(t0,{checked:r0,disabled:L,onCheckedChange:()=>{if(!L)e(K)},onClick:(Fb)=>Fb.stopPropagation()}),b("div",{className:"w-9 h-9 rounded bg-muted/60 border shrink-0 flex items-center justify-center overflow-hidden",children:K.preview?.thumbnailUrl?b("img",{src:K.preview.thumbnailUrl,alt:K.name,className:"w-full h-full object-cover"}):R0?b(a,{className:"w-5 h-5 text-primary fill-primary/20"}):b(h0,{className:"w-5 h-5 text-muted-foreground"})}),r("div",{className:"flex-1 min-w-0",children:[b("p",{className:"text-xs font-medium truncate text-foreground",children:K.name}),r("p",{className:"text-[11px] text-muted-foreground truncate",children:[R0?`${K.fileCount??0} items`:o0(K.sizeByte||0),K.creator?.name?` • ${K.creator.name}`:""]})]})]},K.id)}),b("div",{ref:Y,className:"h-1"}),v&&b("div",{className:"flex items-center justify-center p-3",children:b(M,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})})]})]}),r(M0,{className:"p-3 px-4 border-t flex items-center justify-between sm:justify-between bg-muted/10 shrink-0",children:[b("div",{className:"text-xs text-muted-foreground",children:B.size>0&&y.n_assets_selected({count:B.size})}),r("div",{className:"flex items-center gap-2",children:[b(A,{variant:"outline",size:"sm",onClick:O,children:y.cancel()}),b(A,{size:"sm",onClick:b0,disabled:B.size===0,children:y.add_assets()})]})]})]})})}function Nb({teamId:N,projectId:_,assets:E,onAddAssets:W,onRemoveAsset:O,disabled:q=!1}){let[z,T]=rb.useState(!1),$=(J)=>{let B=new Set(E.map((Z)=>Z.id)),h=J.filter((Z)=>!B.has(Z.id));if(h.length>0)W(h)};return r("div",{className:"space-y-2",children:[r("div",{className:"flex items-center justify-between",children:[r("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-foreground",children:[b(s0,{className:"w-3.5 h-3.5 text-muted-foreground"}),b("span",{children:y.related_assets()}),E.length>0&&r("span",{className:"text-[11px] text-muted-foreground font-normal",children:["(",E.length,")"]})]}),!q&&b(A,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted",onClick:()=>T(!0),title:y.add_assets(),children:b(L0,{className:"w-3.5 h-3.5"})})]}),b(bb,{}),E.length===0?b("p",{className:"text-xs text-muted-foreground/70 py-1 italic",children:y.no_related_assets()}):b("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:E.map((J)=>{let B=J.type==="folder";return r("div",{className:"flex items-center justify-between gap-2 p-1.5 px-2 rounded-md bg-muted/40 hover:bg-muted/70 transition-colors text-xs border border-border/40",children:[r("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[b("div",{className:"w-7 h-7 rounded bg-muted border shrink-0 flex items-center justify-center overflow-hidden",children:J.thumbnailUrl?b("img",{src:J.thumbnailUrl,alt:J.name,className:"w-full h-full object-cover"}):B?b(a,{className:"w-4 h-4 text-primary fill-primary/20"}):b(h0,{className:"w-4 h-4 text-muted-foreground"})}),r("div",{className:"flex-1 min-w-0",children:[b("p",{className:"font-medium truncate text-foreground leading-snug",children:J.name}),b("p",{className:"text-[10px] text-muted-foreground truncate leading-none mt-0.5",children:J.path||"/"})]})]}),r("div",{className:"flex items-center gap-2 shrink-0",children:[J.creator&&r("div",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",title:J.creator.name,children:[r(w0,{className:"w-4 h-4 text-[9px]",children:[b(Y0,{src:J.creator.image||void 0}),b(W0,{children:J.creator.name.slice(0,1).toUpperCase()})]}),b("span",{className:"hidden sm:inline text-[11px] max-w-[80px] truncate",children:J.creator.name})]}),!q&&b(A,{type:"button",variant:"ghost",size:"sm",className:"h-5 w-5 p-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>O(J.id),title:y.unlink_asset(),children:b(U0,{className:"w-3 h-3"})})]})]},J.id)})}),z&&b(e0,{teamId:N,initialProjectId:_,excludeAssetIds:E.map((J)=>J.id),isOpen:z,onClose:()=>T(!1),onConfirm:$})]})}var n0=J0(Z0(),1);function yb({teamId:N,currentProjectId:_,currentTargetFolderId:E,isOpen:W,onClose:O,onSelect:q}){let[z,T]=n0.useState(_||""),[$,J]=n0.useState(null),{data:B,isLoading:h}=P({queryKey:["teams",N,"projects"],queryFn:async()=>{let H=await Q.api.teams[":teamId"].projects.$get({param:{teamId:N},query:{first:"100"}});if(!H.ok)throw Error("Failed to fetch projects");return await H.json()},enabled:!!N&&W}),Z=B?.data||[],X=z||(Z[0]?.id??""),w=Z.find((H)=>H.id===X),p=()=>{if(!X)return;let H=$?.id||w?.rootFolder;if(H)q(X,H,$?.name||w?.name),O()};return b(V0,{open:W,onOpenChange:(H)=>!H&&O(),children:r(X0,{className:"sm:max-w-2xl flex flex-col h-[580px]",children:[b(z0,{children:r("div",{className:"flex items-center gap-2",children:[b(a,{className:"w-5 h-5 text-primary"}),b(O0,{children:y.select_target_folder()})]})}),r("div",{className:"flex flex-col gap-3 flex-1 overflow-hidden py-2",children:[r("div",{className:"space-y-1.5",children:[b("label",{className:"text-xs font-medium text-muted-foreground",children:y.select_project()}),r(K0,{value:X,onValueChange:(H)=>{T(H),J(null)},children:[b(G0,{className:"h-9",children:b(E0,{placeholder:y.select_project()})}),b($0,{children:Z.map((H)=>b(u,{value:H.id,children:H.name},H.id))})]})]}),r("div",{className:"space-y-1.5 flex-1 flex flex-col overflow-hidden",children:[b("label",{className:"text-xs font-medium text-muted-foreground",children:y.target_folder()}),b("div",{className:"border rounded-md flex-1 overflow-hidden bg-sidebar/50",children:b(k,{className:"h-full",children:w&&w.rootFolder?b(p0,{teamId:N,projectId:w.id,projectName:w.name,rootFolderId:w.rootFolder,onSelect:J,selectedFolderId:$?.id||E||w.rootFolder,hideCollections:!0,hideShares:!0,hideRecentlyDeleted:!0}):b("div",{className:"flex items-center justify-center h-full p-6 text-xs text-muted-foreground",children:h?b(M,{className:"w-5 h-5 animate-spin text-muted-foreground"}):y.no_project_selected()})})})]})]}),r(M0,{children:[b(A,{variant:"outline",onClick:O,children:y.cancel()}),b(A,{onClick:p,disabled:!X,children:y.confirm()})]})]})})}function Gb({teamId:N,task:_,canEdit:E=!0}){let W=D0(),[O,q]=H0.useState(_.title),[z,T]=H0.useState(_.description||""),[$,J]=H0.useState(!1),[B,h]=H0.useState(null),Z=H0.useRef(null);H0.useEffect(()=>{q(_.title),T(_.description||"")},[_.id,_.title,_.description]);let{data:X=[]}=P({queryKey:["teams",N,"members","human"],queryFn:async()=>{let f=await Q.api.teams[":teamId"].members.$get({param:{teamId:N},query:{includeAgents:"false"}});if(!f.ok)return[];let V=await f.json();return Array.isArray(V)?V:[]},enabled:!!N}),{data:w=[]}=P({queryKey:["teams",N,"agents"],queryFn:async()=>{let f=await Q.api.teams[":teamId"].agents.$get({param:{teamId:N}});if(!f.ok)return[];return await f.json()||[]},enabled:!!N}),{data:p}=P({queryKey:["teams",N,"kanban","goals"],queryFn:async()=>{let f=await Q.api.teams[":teamId"].kanban.goals.$get({param:{teamId:N},query:{}});if(!f.ok)return{data:[]};return await f.json()},enabled:!!N}),H=p?.data||[],{mutate:R,isPending:y0}=N0({mutationFn:async(f)=>{let V=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:N,taskId:_.id},json:f});if(!V.ok){let G=await V.json().catch(()=>({message:y.error()}));throw Error(G.message||y.error())}return await V.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",N,"kanban","task",_.id]}),W.invalidateQueries({queryKey:["teams",N,"kanban","tasks"]})},onError:(f)=>{m.error(f.message)}}),{mutate:F}=N0({mutationFn:async(f)=>{let V=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].assets.$post({param:{teamId:N,taskId:_.id},json:{assetIds:f.map((G)=>G.id)}});if(!V.ok)throw Error("Failed to link assets");return await V.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",N,"kanban","task",_.id]}),W.invalidateQueries({queryKey:["teams",N,"kanban","tasks"]}),m.success(y.asset_linked())},onError:(f)=>{m.error(f.message)}}),{mutate:n}=N0({mutationFn:async(f)=>{let V=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].assets[":assetId"].$delete({param:{teamId:N,taskId:_.id,assetId:f}});if(!V.ok)throw Error("Failed to unlink asset");return await V.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",N,"kanban","task",_.id]}),W.invalidateQueries({queryKey:["teams",N,"kanban","tasks"]}),m.success(y.asset_unlinked())},onError:(f)=>{m.error(f.message)}}),i=(f,V)=>{if(f==="title")q(V);if(f==="description")T(V);if(Z.current)clearTimeout(Z.current);Z.current=setTimeout(()=>{if(f==="title"&&V.trim()&&V.trim()!==_.title)R({title:V.trim()});else if(f==="description"&&V!==(_.description||""))R({description:V.trim()||null})},600)},l=_.isAgentTask;return r(k,{className:"h-full p-5",children:[r("div",{className:"space-y-6 w-full pr-3",children:[r("div",{className:"space-y-1.5",children:[r("div",{className:"flex items-center justify-between",children:[b(I,{htmlFor:"task-title",className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:y.task_title()}),y0&&r("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground animate-pulse",children:[b(M,{className:"w-3 h-3 animate-spin"}),y.saving()]})]}),b(v0,{id:"task-title",value:O,onChange:(f)=>i("title",f.target.value),disabled:!E,className:"text-base font-semibold h-10 bg-background",placeholder:y.task_title_placeholder()})]}),r("div",{className:"space-y-1.5",children:[b(I,{htmlFor:"task-description",className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:y.task_description()}),b(Kb,{id:"task-description",value:z,onChange:(f)=>i("description",f.target.value),disabled:!E,rows:5,className:"text-xs leading-relaxed bg-background",placeholder:y.task_description_placeholder()})]}),r("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 rounded-lg bg-muted/20 border border-border/60",children:[r("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-md border border-border/60 bg-background/50 px-3 py-2 h-14",children:[r("div",{className:"space-y-0.5 min-w-0 pr-2",children:[r(I,{className:"text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[b(B0,{className:"w-3.5 h-3.5 text-orange-500"}),b("span",{children:y.task_type_agent()})]}),b("p",{className:"text-[11px] text-muted-foreground/80 line-clamp-1",children:y.task_type_agent_desc()})]}),b(Eb,{checked:_.isAgentTask,disabled:!0})]}),r("div",{className:"space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.task_priority()}),r(K0,{value:_.priority,onValueChange:(f)=>R({priority:f}),disabled:!E,children:[b(G0,{className:"w-full h-8 text-xs bg-background",children:b(E0,{})}),b($0,{children:Object.values(x).map((f)=>b(u,{value:f,children:b("span",{className:j("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",c0(f)),children:m0(f)})},f))})]})]}),r("div",{className:"space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.goals()}),r(K0,{value:_.goal?.id||"none",onValueChange:(f)=>R({goalId:f==="none"?null:f}),disabled:!E,children:[b(G0,{className:"w-full h-8 text-xs bg-background",children:b(E0,{placeholder:y.no_folder_selected()})}),r($0,{children:[b(u,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:"None"})}),H.filter((f)=>f.id!==_b).map((f)=>b(u,{value:f.id,children:r("div",{className:"flex items-center gap-2",children:[b(fb,{className:"w-3.5 h-3.5 text-primary"}),b("span",{children:f.title})]})},f.id))]})]})]}),r("div",{className:"space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:l?y.select_agent():y.assignee()}),r(K0,{value:_.assignee?.id||"none",onValueChange:(f)=>R({assigneeId:f==="none"?null:f}),disabled:!E,children:[b(G0,{className:"w-full h-8 text-xs bg-background",children:b(E0,{placeholder:y.unassigned()})}),r($0,{children:[b(u,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:y.unassigned()})}),l?w.map((f)=>b(u,{value:f.id,children:r("div",{className:"flex items-center gap-2",children:[b(B0,{className:"w-3.5 h-3.5 text-purple-500"}),b("span",{children:f.name})]})},f.id)):X.map((f)=>b(u,{value:f.id,children:r("div",{className:"flex items-center gap-2",children:[r(w0,{size:"sm",className:"w-4 h-4",children:[b(Y0,{src:f.image}),b(W0,{className:"text-[8px]",children:f.name.slice(0,2).toUpperCase()})]}),b("span",{children:f.name})]})},f.id))]})]})]}),r("div",{className:"space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.reporter()}),r(K0,{value:_.reporter?.id||"none",onValueChange:(f)=>R({reporterId:f==="none"?null:f}),disabled:!E,children:[b(G0,{className:"w-full h-8 text-xs bg-background",children:b(E0,{placeholder:y.unassigned()})}),r($0,{children:[b(u,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:y.unassigned()})}),X.map((f)=>b(u,{value:f.id,children:r("div",{className:"flex items-center gap-2",children:[r(w0,{size:"sm",className:"w-4 h-4",children:[b(Y0,{src:f.image}),b(W0,{className:"text-[8px]",children:f.name.slice(0,2).toUpperCase()})]}),b("span",{children:f.name})]})},f.id))]})]})]}),l&&r("div",{className:"sm:col-span-2 space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.target_folder()}),b("div",{className:"flex items-center gap-2",children:r(A,{type:"button",variant:"outline",size:"sm",onClick:()=>J(!0),disabled:!E,className:"w-full justify-start h-8 text-xs bg-background truncate font-normal",children:[b(a,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),b("span",{className:"truncate",children:B||(_.targetFolderId?"Selected Folder":y.select_target_folder())})]})})]}),r("div",{className:"space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.start_date()}),b(S0,{value:_.startDate?new Date(_.startDate):void 0,onChange:(f)=>R({startDate:f?f.toISOString():null}),disabled:!E,placeholder:y.start_date(),className:"h-8 text-xs bg-background"})]}),r("div",{className:"space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.due_date()}),b(S0,{value:_.dueDate?new Date(_.dueDate):void 0,onChange:(f)=>R({dueDate:f?f.toISOString():null}),disabled:!E,placeholder:y.due_date(),className:"h-8 text-xs bg-background"})]}),r("div",{className:"sm:col-span-2 space-y-1.5",children:[b(I,{className:"text-xs font-medium text-muted-foreground",children:y.parent_tasks()}),b(j0,{teamId:N,currentTaskId:_.id,excludeTaskIds:_.dependents.map((f)=>f.id),value:_.dependencies.map((f)=>f.id),knownTasks:[..._.dependencies,..._.dependents],onChange:(f)=>R({parentIds:f}),canEdit:E})]}),b("div",{className:"sm:col-span-2 pt-1",children:b(Nb,{teamId:N,projectId:_.projectId,assets:_.assets||[],onAddAssets:(f)=>F(f),onRemoveAsset:(f)=>n(f),disabled:!E})})]})]}),$&&b(yb,{teamId:N,currentProjectId:_.projectId,currentTargetFolderId:_.targetFolderId,isOpen:$,onClose:()=>J(!1),onSelect:(f,V,G)=>{h(G||"Selected Folder"),R({projectId:f,targetFolderId:V})}})]})}var nb=J0(Z0(),1);var F0=J0(Z0(),1);function Bb({teamId:N,taskId:_,comment:E,currentUserId:W,isOwnerOrAdmin:O}){let q=D0(),[z,T]=F0.useState(!1),[$,J]=F0.useState(null),B=O||E.author.id===W,{mutate:h,isPending:Z}=N0({mutationFn:async()=>{let w=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].comments[":commentId"].$delete({param:{teamId:N,taskId:_,commentId:E.id}});if(!w.ok){let p=await w.json().catch(()=>({message:y.error()}));throw Error(p.message||y.error())}return await w.json()},onSuccess:()=>{q.invalidateQueries({queryKey:["teams",N,"kanban","tasks",_,"comments"]}),q.invalidateQueries({queryKey:["teams",N,"kanban","task",_]}),q.invalidateQueries({queryKey:["teams",N,"kanban","tasks"]}),m.success("Comment deleted"),T(!1)},onError:(w)=>{m.error(w.message)}}),X=(E.author.name||"U").split(" ").map((w)=>w[0]).slice(0,2).join("").toUpperCase();return r("div",{className:"relative flex gap-3 p-3 rounded-xl border border-transparent bg-foreground/[0.03] dark:bg-foreground/[0.08] hover:bg-foreground/[0.06] dark:hover:bg-foreground/[0.12] transition-colors group w-full max-w-full overflow-hidden",children:[r(w0,{className:"w-7 h-7 shrink-0 mt-0.5 border border-border",children:[E.author.image&&b(Y0,{src:E.author.image,alt:E.author.name}),b(W0,{className:"text-[10px] font-medium bg-muted text-muted-foreground",children:X})]}),r("div",{className:"flex-1 min-w-0 space-y-1.5 overflow-hidden",children:[r("div",{className:"flex items-center justify-between gap-2",children:[r("div",{className:"flex items-center gap-2 min-w-0",children:[b("span",{className:"font-semibold text-xs text-foreground truncate",children:E.author.name}),b("span",{className:"text-[10px] text-muted-foreground shrink-0 font-mono",children:P0(new Date(E.createdAt),"MMM d, h:mm a")})]}),B&&b("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:r(Wb,{modal:!1,children:[b(Hb,{asChild:!0,children:b(A,{size:"icon-xs",variant:"ghost",className:"h-5 w-5 text-muted-foreground",children:b($b,{className:"h-3.5 w-3.5"})})}),b(Jb,{align:"end",children:r(Zb,{className:"text-destructive focus:text-destructive cursor-pointer text-xs",onClick:()=>T(!0),children:[b(Yb,{className:"mr-1.5 h-3.5 w-3.5"}),b("span",{children:y.delete()})]})})]})})]}),E.body&&b("div",{className:"text-xs leading-relaxed prose prose-xs dark:prose-invert max-w-none break-words text-foreground/90 font-sans",children:b(Qb,{children:E.body})}),E.attachments&&E.attachments.length>0&&b("div",{className:"flex flex-col gap-1.5 pt-1.5 w-full max-w-full overflow-hidden",children:E.attachments.map((w)=>{let p=Tb(w.name||w.url);return r("div",{className:`group/att relative flex items-center w-full max-w-full rounded-lg border border-border bg-card hover:bg-muted/40 transition-colors overflow-hidden ${p?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"}`,onClick:()=>{if(p)J({url:w.url,name:w.name});else window.open(w.url,"_blank","noreferrer")},children:[p?b("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-muted/40 shrink-0",children:b("img",{src:w.url,alt:w.name,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):b(g0,{className:"w-4 h-4 text-muted-foreground shrink-0"}),r("div",{className:"min-w-0 flex-1 overflow-hidden",children:[b("p",{className:"text-xs font-medium text-foreground truncate block w-full",title:w.name,children:w.name}),w.sizeByte!==void 0&&w.sizeByte>0&&b("p",{className:"text-[10px] text-muted-foreground font-mono truncate",children:o0(w.sizeByte)})]}),b("a",{href:w.url,download:w.name,target:"_blank",rel:"noreferrer",className:"p-1 text-muted-foreground hover:text-foreground shrink-0 rounded-md hover:bg-muted transition-colors opacity-0 group-hover/att:opacity-100",onClick:(H)=>H.stopPropagation(),title:y.download(),children:b(wb,{className:"w-3.5 h-3.5"})})]},w.id)})})]}),b(qb,{open:z,onOpenChange:T,children:r(Vb,{children:[r(Xb,{children:[b(Ob,{children:y.delete_comment_confirm()}),b(Ub,{children:y.delete_comment_description()})]}),r(zb,{children:[b(Db,{disabled:Z,children:y.cancel()}),b(ob,{className:"bg-destructive hover:bg-destructive/90 text-white",disabled:Z,onClick:()=>h(),children:y.delete()})]})]})}),b(V0,{open:!!$,onOpenChange:(w)=>!w&&J(null),children:r(X0,{className:"w-auto max-w-[80vw] sm:max-w-[80vw] max-h-[80vh] p-2 sm:p-3 bg-background/95 backdrop-blur-sm border-border flex flex-col items-center justify-center overflow-hidden",onClick:(w)=>w.stopPropagation(),children:[b(z0,{className:"sr-only",children:b(O0,{children:$?.name||"Image Preview"})}),$&&r("div",{className:"flex flex-col items-center justify-center max-w-[80vw] max-h-[80vh] overflow-hidden",children:[b("img",{src:$.url,alt:$.name,className:"max-w-[80vw] max-h-[calc(80vh-2.5rem)] w-auto h-auto object-contain rounded-md"}),b("p",{className:"text-xs text-muted-foreground truncate max-w-full px-2 pt-1.5 text-center",children:$.name})]})]})})]})}var c=J0(Z0(),1);function Lb({teamId:N,onSendMessage:_,isSubmitting:E}){let[W,O]=c.useState(""),[q,z]=c.useState([]),[T,$]=c.useState(!1),[J,B]=c.useState(""),[h,Z]=c.useState(0),X=c.useRef(null),w=c.useRef(null),p=c.useRef(null),{members:H,fetchMembers:R}=hb();c.useEffect(()=>{if(N)R(N,!0,!0)},[N,R]);let{mutateAsync:y0}=N0({mutationFn:async(Y)=>{let o=await Q.api.teams[":teamId"].kanban.attachments.$post({param:{teamId:N},json:Y});if(!o.ok)throw Error("Failed to get attachment upload url");return await o.json()}}),F=(Y)=>{let o=Y.target.value;if(O(o),X.current)X.current.style.height="auto",X.current.style.height=`${Math.min(X.current.scrollHeight,160)}px`;let t=Y.target.selectionStart||0,v=o.slice(0,t),C=v.lastIndexOf("@");if(C!==-1){let e=C===0,s=v[C-1];if(e||/\s/.test(s)){let K=v.slice(C+1);if(!/\s/.test(K)){B(K),$(!0);return}}}$(!1)},n=H.filter((Y)=>Y.name?.toLowerCase().includes(J.toLowerCase()));c.useEffect(()=>{Z(0)},[J,T]);let i=(Y)=>{if(!X.current)return;let o=X.current.selectionStart||0,t=W.slice(0,o),v=W.slice(o),C=t.lastIndexOf("@");if(C!==-1){let e=`${W.slice(0,C)}@${Y.name} ${v}`;O(e),$(!1),setTimeout(()=>{if(X.current){X.current.focus();let s=C+Y.name.length+2;X.current.setSelectionRange(s,s)}},0)}},l=async(Y)=>{let o=Array.from(Y.target.files||[]);if(o.length===0)return;let t=o.map((v)=>({id:`${Date.now()}-${v.name}-${Math.random()}`,file:v,isUploading:!0}));z((v)=>[...v,...t]);for(let v of t)try{let C=await y0({fileName:v.file.name,size:v.file.size,contentType:v.file.type||"application/octet-stream"});if(!(await fetch(C.uploadUrl,{method:"PUT",body:v.file,headers:{"Content-Type":v.file.type||"application/octet-stream"}})).ok)throw Error("Failed to upload file to storage");z((s)=>s.map((b0)=>b0.id===v.id?{...b0,isUploading:!1,payload:{id:C.id,name:C.name,key:C.key,sizeByte:C.sizeByte,contentType:C.contentType,proxyType:C.proxyType}}:b0))}catch(C){let e=C instanceof Error?C.message:"Upload failed";m.error(`${v.file.name}: ${e}`),z((s)=>s.map((b0)=>b0.id===v.id?{...b0,isUploading:!1,error:e}:b0))}if(w.current)w.current.value=""},f=(Y)=>{z((o)=>o.filter((t)=>t.id!==Y))},V=q.some((Y)=>Y.isUploading),G=q.map((Y)=>Y.payload).filter((Y)=>!!Y),U=(W.trim().length>0||G.length>0)&&!V,g=async()=>{if(!U||E)return;try{if(await _(W.trim(),G.length>0?G:void 0),O(""),z([]),X.current)X.current.style.height="auto"}catch{}},S=(Y)=>{if(T&&n.length>0){if(Y.key==="ArrowDown"){Y.preventDefault(),Z((o)=>(o+1)%n.length);return}if(Y.key==="ArrowUp"){Y.preventDefault(),Z((o)=>(o-1+n.length)%n.length);return}if(Y.key==="Enter"||Y.key==="Tab"){Y.preventDefault();let o=n[h];if(o)i(o);return}if(Y.key==="Escape"){$(!1);return}}if(Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey))Y.preventDefault(),g()};return r("div",{className:"relative flex flex-col w-full border border-border focus-within:border-foreground/40 bg-card rounded-2xl p-2.5 shadow-2xs transition-all",children:[T&&n.length>0&&b("div",{ref:p,className:"absolute bottom-full left-0 mb-2 w-64 max-h-48 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50",children:n.map((Y,o)=>r("button",{type:"button",onClick:()=>i(Y),className:`w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-xs transition-colors text-left ${o===h?"bg-primary text-primary-foreground font-medium":"hover:bg-muted text-foreground"}`,children:[r(w0,{className:"w-5 h-5",children:[Y.image&&b(Y0,{src:Y.image}),b(W0,{className:"text-[9px]",children:Y.name?.slice(0,2).toUpperCase()})]}),b("span",{className:"truncate",children:Y.name})]},Y.id))}),q.length>0&&b("div",{className:"flex flex-wrap gap-1.5 pb-2 mb-1.5 border-b border-border/50",children:q.map((Y)=>{let o=Y.file.type.startsWith("image/");return r("div",{className:"flex items-center gap-1.5 pl-2 pr-1.5 py-1 rounded-lg bg-muted/60 border border-border text-xs max-w-[200px]",children:[Y.isUploading?b(M,{className:"w-3.5 h-3.5 animate-spin text-primary shrink-0"}):o?b(Cb,{className:"w-3.5 h-3.5 text-primary shrink-0"}):b(g0,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),r("div",{className:"min-w-0 flex-1 truncate",children:[b("span",{className:"truncate block font-medium text-[11px]",children:Y.file.name}),b("span",{className:"text-[9px] text-muted-foreground font-mono",children:o0(Y.file.size)})]}),b("button",{type:"button",onClick:()=>f(Y.id),className:"p-0.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",children:b(U0,{className:"w-3 h-3"})})]},Y.id)})}),b("textarea",{ref:X,value:W,onChange:F,onKeyDown:S,placeholder:y.comment_placeholder(),rows:1,className:"w-full min-h-[44px] max-h-[160px] bg-transparent border-0 focus:outline-hidden focus-visible:ring-0 resize-none text-xs text-foreground placeholder:text-muted-foreground/70 p-1 font-sans leading-relaxed"}),r("div",{className:"flex items-center justify-between pt-1 mt-1 border-t border-border/40",children:[r("div",{className:"flex items-center gap-1",children:[b("input",{ref:w,type:"file",multiple:!0,className:"hidden",onChange:l}),b(A,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>w.current?.click(),className:"h-7 w-7 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted",title:"Attach files",disabled:E,children:b(vb,{className:"w-3.5 h-3.5"})}),b("span",{className:"text-[10px] text-muted-foreground/60 hidden sm:inline pl-1",children:"Cmd+Enter to send"})]}),b(A,{type:"button",size:"icon-xs",onClick:g,disabled:!U||E,className:"h-7 w-7 rounded-full shadow-xs bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-all shrink-0",title:"Send comment",children:E||V?b(M,{className:"w-3.5 h-3.5 animate-spin"}):b(Rb,{className:"w-3.5 h-3.5 stroke-[2.5]"})})]})]})}function pb({teamId:N,taskId:_,initialComments:E}){let W=D0(),{data:O}=P({queryKey:["teams",N,"me"],queryFn:async()=>{let Z=await Q.api.teams[":teamId"].me.$get({param:{teamId:N}});if(!Z.ok)throw Error("Failed to fetch me");return await Z.json()},enabled:!!N}),q=O?.role?.toLowerCase()==="owner"||O?.role?.toLowerCase()==="editor",{data:z,isLoading:T}=P({queryKey:["teams",N,"kanban","tasks",_,"comments"],queryFn:async()=>{let Z=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].comments.$get({param:{teamId:N,taskId:_}});if(!Z.ok)throw Error("Failed to fetch comments");return await Z.json()},initialData:E?{data:E}:void 0,enabled:!!N&&!!_,refetchInterval:4000}),$=z?.data||[],{mutateAsync:J,isPending:B}=N0({mutationFn:async({body:Z,attachments:X})=>{let w=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].comments.$post({param:{teamId:N,taskId:_},json:{body:Z,attachments:X}});if(!w.ok){let p=await w.json().catch(()=>({message:y.error()}));throw Error(p.message||y.error())}return await w.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",N,"kanban","tasks",_,"comments"]}),W.invalidateQueries({queryKey:["teams",N,"kanban","task",_]}),W.invalidateQueries({queryKey:["teams",N,"kanban","tasks"]})},onError:(Z)=>{m.error(Z.message)}}),h=async(Z,X)=>{await J({body:Z,attachments:X})};return r("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[b(k,{className:"flex-1 min-h-0 p-3.5 [&>div>div]:block!",children:b("div",{className:"space-y-3 pr-1 pb-2 w-full max-w-full",children:T?b("div",{className:"flex items-center justify-center py-12",children:b(M,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):$.length===0?r("div",{className:"flex flex-col items-center justify-center py-16 text-center text-xs text-muted-foreground/80 space-y-2",children:[b("div",{className:"w-10 h-10 rounded-full bg-muted/60 flex items-center justify-center",children:b(Mb,{className:"w-5 h-5 opacity-40"})}),b("p",{className:"font-medium",children:y.no_comments_yet()})]}):$.map((Z)=>b(Bb,{teamId:N,taskId:_,comment:Z,currentUserId:O?.id,isOwnerOrAdmin:q},Z.id))})}),b("div",{className:"p-3 border-t border-border/60 bg-card/60 shrink-0",children:b(Lb,{teamId:N,onSendMessage:h,isSubmitting:B})})]})}function mb(N){let _=N.data||{};switch(N.type){case d.CREATED:return"Created task";case d.STATUS_CHANGED:return`Changed status from ${N.fromStatus?f0(N.fromStatus):"None"} to ${N.toStatus?f0(N.toStatus):"None"}`;case d.ASSIGNED:return"Assigned task";case d.UNASSIGNED:return"Unassigned task";case d.PRIORITY_CHANGED:return`Changed priority to ${String(_.to||"")}`;case d.GOAL_CHANGED:return"Updated goal association";case d.DEPENDENCY_ADDED:return"Added prerequisite dependency";case d.DEPENDENCY_REMOVED:return"Removed prerequisite dependency";case d.CHANGES_REQUESTED:return`Requested changes: "${String(_.reason||"")}"`;case d.BLOCKED:return`Task blocked: "${String(_.reason||_.blockReason||"")}"`;case d.UNBLOCKED:return"Task unblocked";case d.COMMENTED:return"Added a comment";default:return N.type}}function gb({teamId:N,taskId:_,initialEvents:E}){let{data:W,isLoading:O}=P({queryKey:["teams",N,"kanban","tasks",_,"events"],queryFn:async()=>{let z=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].events.$get({param:{teamId:N,taskId:_}});if(!z.ok)throw Error("Failed to fetch events");return await z.json()},initialData:E?{data:E}:void 0,enabled:!!N&&!!_}),q=W?.data||[];return b(k,{className:"h-full p-3",children:b("div",{className:"space-y-4 pr-2",children:b("div",{className:"space-y-2",children:O?b("div",{className:"flex items-center justify-center py-6",children:b(M,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):q.length===0?b("div",{className:"py-6 text-center text-xs text-muted-foreground",children:y.no_activity_yet()}):b("div",{className:"relative pl-5 space-y-3 before:absolute before:left-[4px] before:top-2 before:bottom-2 before:w-[2px] before:bg-border/60",children:q.map((z)=>r("div",{className:"relative flex items-start gap-2 text-xs",children:[b("div",{className:"absolute -left-5 top-[3px] w-2.5 h-2.5 rounded-full bg-background border-2 border-primary shrink-0"}),r("div",{className:"flex-1 min-w-0",children:[r("div",{className:"flex items-center justify-between gap-1",children:[b("span",{className:"font-medium text-foreground truncate",children:z.actor?.name||"System"}),b("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:P0(new Date(z.createdAt),"MM/dd HH:mm")})]}),b("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5",children:mb(z)})]})]},z.id))})})})})}function Sb({teamId:N,task:_}){let[E,W]=nb.useState("comments");return b("div",{className:"flex flex-col h-full bg-sidebar/30 border-l border-border/60 overflow-hidden",children:r(Pb,{value:E,onValueChange:(O)=>W(O),className:"flex flex-col h-full",children:[b("div",{className:"px-3 pt-2.5 pb-1 border-b border-border/60 bg-card/50 shrink-0",children:r(Ab,{className:"w-full grid grid-cols-2 h-8 bg-muted/60",children:[r(k0,{value:"comments",className:"text-xs h-7",children:[b("span",{children:y.comments()}),_.comments.length>0&&r("span",{className:"text-[10px] font-mono text-muted-foreground ml-1",children:["(",_.comments.length,")"]})]}),b(k0,{value:"activity",className:"text-xs h-7",children:b("span",{children:y.activity()})})]})}),r("div",{className:"flex-1 overflow-hidden",children:[b(u0,{value:"comments",className:"h-full m-0 data-[state=active]:flex data-[state=active]:flex-col",children:b(pb,{teamId:N,taskId:_.id,initialComments:_.comments})}),b(u0,{value:"activity",className:"h-full m-0 data-[state=active]:block",children:b(gb,{teamId:N,taskId:_.id,initialEvents:_.events})})]})]})})}function q5({teamId:N,taskId:_,isOpen:E,onClose:W,canEdit:O=!0}){let{data:q,isLoading:z,error:T}=P({queryKey:["teams",N,"kanban","task",_],queryFn:async()=>{if(!_)return null;let $=await Q.api.teams[":teamId"].kanban.tasks[":taskId"].$get({param:{teamId:N,taskId:_}});if(!$.ok)throw Error("Failed to fetch task details");return await $.json()},enabled:!!N&&!!_&&E});return b(V0,{open:E,onOpenChange:($)=>!$&&W(),children:r(X0,{className:"sm:max-w-5xl w-[95vw] h-[88vh] p-0 gap-0 flex flex-col overflow-hidden bg-background",children:[b(z0,{className:"px-5 py-3 border-b border-border/70 flex flex-row items-center justify-between space-y-0 shrink-0 bg-card/80",children:r("div",{className:"flex items-center gap-2 min-w-0 pr-4",children:[q?.isAgentTask&&r("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[b(B0,{className:"w-3.5 h-3.5"}),b("span",{children:y.task_type_agent()})]}),q?.status&&b("span",{className:j("px-2 py-0.5 rounded text-[11px] font-medium border uppercase shrink-0",Q0(q.status)),children:f0(q.status)}),b(O0,{className:"text-sm font-semibold truncate text-foreground",children:q?.title||y.edit_task()})]})}),b("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:z?b("div",{className:"flex-1 flex items-center justify-center p-12",children:b(M,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):T||!q?b("div",{className:"flex-1 flex items-center justify-center p-12 text-xs text-muted-foreground",children:y.file_not_found()}):r(T0,{children:[b("div",{className:"flex-1 md:w-2/3 h-full overflow-hidden flex flex-col",children:b(Gb,{teamId:N,task:q,canEdit:O})}),b("div",{className:"md:w-1/3 h-full overflow-hidden flex flex-col",children:b(Sb,{teamId:N,task:q})})]})})]})})}
2
- export{Ib as Pe,f0 as Qe,kb as Re,Q0 as Se,m0 as Te,c0 as Ue,j0 as Ve,Nb as We,yb as Xe,q5 as Ye};