@shumai-one/shumai 0.3.6 → 0.3.7

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 (135) hide show
  1. package/bin/{chunk-gg1gwjtn.js → chunk-0jkqmbcx.js} +1 -1
  2. package/bin/{chunk-t5561vz5.js → chunk-0t8q76ac.js} +1 -1
  3. package/bin/chunk-0xern7e4.js +1 -0
  4. package/bin/{chunk-9p5n3m2z.js → chunk-0ycwr0kb.js} +1 -1
  5. package/bin/{chunk-55myfmhy.js → chunk-0yngn45x.js} +2 -2
  6. package/bin/{chunk-jtd7rydv.js → chunk-1khzycf9.js} +1 -1
  7. package/bin/{chunk-fwbrcfaq.js → chunk-1sqz0va1.js} +2 -2
  8. package/bin/{chunk-w4ycztv5.js → chunk-1xzc6z02.js} +1 -1
  9. package/bin/{chunk-y1t47c7f.js → chunk-2086rsb2.js} +1 -1
  10. package/bin/{chunk-5wrakb8p.js → chunk-260wywfb.js} +1 -1
  11. package/bin/{chunk-6edadcpn.js → chunk-2mqqghrz.js} +2 -2
  12. package/bin/{chunk-ghz19a7t.js → chunk-2xmsrq7f.js} +2 -2
  13. package/bin/{chunk-nh8azwsx.js → chunk-38g3s1f3.js} +2 -2
  14. package/bin/{chunk-0jesq6sm.js → chunk-3dx0p1ge.js} +1 -1
  15. package/bin/{chunk-ce50f746.js → chunk-3kqdgddm.js} +2 -2
  16. package/bin/{chunk-z0tbq08w.js → chunk-3xzgddev.js} +1 -1
  17. package/bin/{chunk-1b7shyfp.js → chunk-48nzw50r.js} +1 -1
  18. package/bin/{chunk-w16jgdfx.js → chunk-4bn9eb9h.js} +1 -1
  19. package/bin/chunk-4egayx81.js +2 -0
  20. package/bin/{chunk-ef5v7gta.js → chunk-4rbzswqs.js} +2 -2
  21. package/bin/{chunk-crdvxq38.js → chunk-503qq6sa.js} +2 -2
  22. package/bin/{chunk-d8bpqbdw.js → chunk-50keqtz9.js} +1 -1
  23. package/bin/{chunk-mmrtjcst.js → chunk-5gtew41y.js} +1 -1
  24. package/bin/chunk-60hpa5kf.js +3 -0
  25. package/bin/{chunk-4a9sdfyp.js → chunk-69tt1pvr.js} +2 -2
  26. package/bin/{chunk-rmm6y799.js → chunk-6fv38qdc.js} +2 -2
  27. package/bin/{chunk-vgr9db5g.js → chunk-6v39c8eg.js} +2 -2
  28. package/bin/{chunk-kaxwma6y.js → chunk-6zs49mef.js} +1 -1
  29. package/bin/{chunk-y8vw7zv1.js → chunk-7872prvg.js} +1 -1
  30. package/bin/{chunk-kk0gx8eg.js → chunk-7hnw6y6d.js} +2 -2
  31. package/bin/{chunk-47093mwk.js → chunk-7k3ccca6.js} +1 -1
  32. package/bin/chunk-815ezj20.js +1 -0
  33. package/bin/{chunk-ew4cxkcc.js → chunk-81tb4v5v.js} +2 -2
  34. package/bin/{chunk-ym47952x.js → chunk-83k0wa5k.js} +2 -2
  35. package/bin/{chunk-8js9m1j7.js → chunk-85eg9xqx.js} +1 -1
  36. package/bin/{chunk-vqgz25av.js → chunk-86aagej8.js} +1 -1
  37. package/bin/{chunk-f44d9fpd.js → chunk-87wqbn4g.js} +2 -2
  38. package/bin/chunk-8y1v9dm9.js +2 -0
  39. package/bin/{chunk-20wtz3kc.js → chunk-98j2z6he.js} +3 -3
  40. package/bin/chunk-9gq9782d.js +1 -0
  41. package/bin/{chunk-y0yrmcf3.js → chunk-9gzy30zm.js} +2 -2
  42. package/bin/{chunk-0sajh8fw.js → chunk-9nyhmtp9.js} +2 -2
  43. package/bin/{chunk-7b60a9sy.js → chunk-9s02m95j.js} +2 -2
  44. package/bin/{chunk-c9bpf8gp.js → chunk-9xhnmnnb.js} +2 -2
  45. package/bin/{chunk-hcvpb1hw.js → chunk-a0k1b4sq.js} +1 -1
  46. package/bin/{chunk-7fm1hznx.js → chunk-af6wbhkv.js} +2 -2
  47. package/bin/{chunk-sx7kparv.js → chunk-b3jh3hf1.js} +2 -2
  48. package/bin/{chunk-74zstxav.js → chunk-b8v7jvkb.js} +2 -2
  49. package/bin/{chunk-9tnfhrnh.js → chunk-bancgvrc.js} +2 -2
  50. package/bin/{chunk-a5fw02xq.js → chunk-br5xkaf7.js} +3 -3
  51. package/bin/chunk-bv88se28.css +1 -0
  52. package/bin/{chunk-nh31ma8d.js → chunk-cqq8e3hc.js} +2 -2
  53. package/bin/{chunk-mgbqjbfc.js → chunk-dej1gq35.js} +1 -1
  54. package/bin/{chunk-mhj0pqq3.js → chunk-dv1zpd2p.js} +2 -2
  55. package/bin/{chunk-0jr6q4j4.js → chunk-eetrc0j1.js} +2 -2
  56. package/bin/{chunk-6awkqp09.js → chunk-esrtafz0.js} +1 -1
  57. package/bin/chunk-eztggp8r.js +1 -0
  58. package/bin/{chunk-n198tewr.js → chunk-f2j2cqd1.js} +2 -2
  59. package/bin/{chunk-1f8rr3ef.js → chunk-fcs4v6jq.js} +2 -2
  60. package/bin/{chunk-dfzmqx1v.js → chunk-ftc48rbb.js} +3 -3
  61. package/bin/{chunk-pm64et9d.js → chunk-g60v3jc1.js} +1 -1
  62. package/bin/chunk-gf5ds9r9.js +2 -0
  63. package/bin/{chunk-f2eh802w.js → chunk-gjdmnfms.js} +1 -1
  64. package/bin/{chunk-gra3617w.js → chunk-gjn3w26y.js} +2 -2
  65. package/bin/{chunk-8jdgzy22.js → chunk-h9emz0zb.js} +2 -2
  66. package/bin/{chunk-3egeywt8.js → chunk-h9k2atte.js} +1 -1
  67. package/bin/{chunk-fzaw1e34.js → chunk-hqkmdp31.js} +2 -2
  68. package/bin/{chunk-9annjnj2.js → chunk-jszpvg8e.js} +2 -2
  69. package/bin/{chunk-snexx7ks.js → chunk-k48y9e5s.js} +1 -1
  70. package/bin/{chunk-d2qp8g98.js → chunk-karn564z.js} +2 -2
  71. package/bin/{chunk-fdm1yc29.js → chunk-kkq4wvnc.js} +1 -1
  72. package/bin/{chunk-aeg4kya9.js → chunk-kpn9d97x.js} +1 -1
  73. package/bin/chunk-ksx113sp.js +1 -0
  74. package/bin/chunk-m6a4rzdt.js +62 -0
  75. package/bin/chunk-mw8f8ngt.js +7 -0
  76. package/bin/{chunk-w98wvk17.js → chunk-n4gghgrj.js} +2 -2
  77. package/bin/{chunk-hqbzjzsm.js → chunk-n76r6s9k.js} +2 -2
  78. package/bin/{chunk-g70eyttc.js → chunk-nvjp2rnh.js} +2 -2
  79. package/bin/{chunk-29nhtrfv.js → chunk-p4c4z0f2.js} +1 -1
  80. package/bin/{chunk-ex4qa7gv.js → chunk-ptw49k86.js} +1 -1
  81. package/bin/{chunk-tqxmj05h.js → chunk-qcqw7wnv.js} +2 -2
  82. package/bin/{chunk-z0zevgb6.js → chunk-qdycy714.js} +1 -1
  83. package/bin/{chunk-gewh7p42.js → chunk-qh9rz2ee.js} +2 -2
  84. package/bin/{chunk-mxee09jk.js → chunk-qmpph1gt.js} +2 -2
  85. package/bin/{chunk-dmjzrdan.js → chunk-qy93r7tm.js} +2 -2
  86. package/bin/{chunk-j1awxx51.js → chunk-r5dv0rfv.js} +2 -2
  87. package/bin/{chunk-gct52xks.js → chunk-rfyaphas.js} +2 -2
  88. package/bin/chunk-rvspnthy.js +1 -0
  89. package/bin/{chunk-9hsfjqgq.js → chunk-s0hgykza.js} +2 -2
  90. package/bin/chunk-sjjndwt4.js +2 -0
  91. package/bin/{chunk-8g0mhzsg.js → chunk-t3tp9trj.js} +2 -2
  92. package/bin/{chunk-1fq10abj.js → chunk-t9t9evan.js} +2 -2
  93. package/bin/{chunk-vw1rhgjs.js → chunk-tpp9qf5m.js} +2 -2
  94. package/bin/chunk-tvg9gvqs.js +1 -0
  95. package/bin/{chunk-yzra1x8f.js → chunk-tzt4c1dm.js} +2 -2
  96. package/bin/{chunk-js0genbf.js → chunk-v8w2nxew.js} +1 -1
  97. package/bin/{chunk-z2ef8zpz.js → chunk-v98e3gex.js} +1 -1
  98. package/bin/{chunk-89kqtj7x.js → chunk-vxpnp4xg.js} +2 -2
  99. package/bin/{chunk-4ajat3xv.js → chunk-x3ynjbt5.js} +14 -14
  100. package/bin/{chunk-800vdz5n.js → chunk-x6532q76.js} +1 -1
  101. package/bin/chunk-xp4dcyk3.js +1 -0
  102. package/bin/chunk-y8aehqr8.js +2 -0
  103. package/bin/{chunk-n9cjmkky.js → chunk-ytzk81tr.js} +1 -1
  104. package/bin/chunk-yvxt48r4.js +1 -0
  105. package/bin/{chunk-q7xfrtnj.js → chunk-zg60j9x2.js} +1 -1
  106. package/bin/{chunk-bq2aq6v8.js → chunk-zjj9qj6y.js} +2 -2
  107. package/bin/{chunk-gx5rjm9m.js → chunk-zqg4f56h.js} +1 -1
  108. package/bin/{chunk-thj4cpev.js → chunk-zwgf211t.js} +2 -2
  109. package/bin/shumai-app.html +1 -1
  110. package/bin/shumai-app.js +240 -245
  111. package/package.json +7 -7
  112. package/prisma/migrations/20260813022501_backfill_autofill_source_in_config/migration.sql +8 -0
  113. package/prisma/migrations/20260813022502_drop_legacy_autofill_columns/migration.sql +12 -0
  114. package/prisma/migrations/20260813122613_add_network_sandbox_enabled_column/migration.sql +2 -0
  115. package/prisma/migrations/20260813122618_migrate_legacy_sandboxes_enabled/migration.sql +2 -0
  116. package/prisma/schema.prisma +8 -9
  117. package/bin/chunk-1hn9v6hv.js +0 -2
  118. package/bin/chunk-2882s5sp.js +0 -1
  119. package/bin/chunk-3htn4m2d.js +0 -7
  120. package/bin/chunk-6bztpk7h.js +0 -1
  121. package/bin/chunk-76hs7g0x.js +0 -2
  122. package/bin/chunk-e5s7202g.js +0 -2
  123. package/bin/chunk-f5zg7b38.js +0 -1
  124. package/bin/chunk-gh64hag9.js +0 -2
  125. package/bin/chunk-h0p8yew4.js +0 -1
  126. package/bin/chunk-hgngnc1k.js +0 -1
  127. package/bin/chunk-jt4yh37q.js +0 -62
  128. package/bin/chunk-k0xpskyq.js +0 -1
  129. package/bin/chunk-nhc72y4x.js +0 -2
  130. package/bin/chunk-px6q3jpz.js +0 -1
  131. package/bin/chunk-sx3by19j.js +0 -1
  132. package/bin/chunk-vz75bqvx.js +0 -2
  133. package/bin/chunk-wa8k9fwx.js +0 -1
  134. package/bin/chunk-z3p3qz9d.js +0 -3
  135. package/bin/chunk-zv85aqwb.css +0 -1
@@ -1,2 +1,2 @@
1
- import{Uh as a,Wh as l,Xh as o}from"./chunk-jt4yh37q.js";var p=a()(o((i)=>({fileViewLeftSidebarCollapsed:!0,setFileViewLeftSidebarCollapsed:(e)=>i({fileViewLeftSidebarCollapsed:e}),fileViewRightSidebarCollapsed:!1,setFileViewRightSidebarCollapsed:(e)=>i({fileViewRightSidebarCollapsed:e}),fileListLeftSidebarCollapsed:!1,setFileListLeftSidebarCollapsed:(e)=>i({fileListLeftSidebarCollapsed:e}),fileListRightSidebarCollapsed:!0,setFileListRightSidebarCollapsed:(e)=>i({fileListRightSidebarCollapsed:e}),shareConfigLeftSidebarCollapsed:!1,setShareConfigLeftSidebarCollapsed:(e)=>i({shareConfigLeftSidebarCollapsed:e}),shareConfigRightSidebarCollapsed:!1,setShareConfigRightSidebarCollapsed:(e)=>i({shareConfigRightSidebarCollapsed:e}),viewModes:{},setViewMode:(e,d)=>i((s)=>({viewModes:{...s.viewModes,[e]:d}})),videoTimeDisplayMode:"standard",setVideoTimeDisplayMode:(e)=>i({videoTimeDisplayMode:e})}),{name:"ui-storage",storage:l(()=>localStorage)}));
2
- export{p as Cg};
1
+ import{Wh as a,Yh as l,Zh as o}from"./chunk-m6a4rzdt.js";var p=a()(o((i)=>({fileViewLeftSidebarCollapsed:!0,setFileViewLeftSidebarCollapsed:(e)=>i({fileViewLeftSidebarCollapsed:e}),fileViewRightSidebarCollapsed:!1,setFileViewRightSidebarCollapsed:(e)=>i({fileViewRightSidebarCollapsed:e}),fileListLeftSidebarCollapsed:!1,setFileListLeftSidebarCollapsed:(e)=>i({fileListLeftSidebarCollapsed:e}),fileListRightSidebarCollapsed:!0,setFileListRightSidebarCollapsed:(e)=>i({fileListRightSidebarCollapsed:e}),shareConfigLeftSidebarCollapsed:!1,setShareConfigLeftSidebarCollapsed:(e)=>i({shareConfigLeftSidebarCollapsed:e}),shareConfigRightSidebarCollapsed:!1,setShareConfigRightSidebarCollapsed:(e)=>i({shareConfigRightSidebarCollapsed:e}),viewModes:{},setViewMode:(e,d)=>i((s)=>({viewModes:{...s.viewModes,[e]:d}})),videoTimeDisplayMode:"standard",setVideoTimeDisplayMode:(e)=>i({videoTimeDisplayMode:e})}),{name:"ui-storage",storage:l(()=>localStorage)}));
2
+ export{p as Eg};
@@ -1,2 +1,2 @@
1
- import{Qf as A}from"./chunk-9hsfjqgq.js";import{$h as z,Oh as w,xh as v}from"./chunk-jt4yh37q.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
- export{B as Ff,H as Gf};
1
+ import{Sf as A}from"./chunk-s0hgykza.js";import{Qh as w,bi as z,zh as v}from"./chunk-m6a4rzdt.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
+ export{B as Hf,H as If};
@@ -1,2 +1,2 @@
1
- import{wk as r,xh as o}from"./chunk-jt4yh37q.js";function d({className:t,...a}){return o("div",{"data-slot":"card",className:r("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...a})}function n({className:t,...a}){return o("div",{"data-slot":"card-header",className:r("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function c({className:t,...a}){return o("div",{"data-slot":"card-title",className:r("leading-none font-semibold",t),...a})}function s({className:t,...a}){return o("div",{"data-slot":"card-description",className:r("text-sm text-muted-foreground",t),...a})}function i({className:t,...a}){return o("div",{"data-slot":"card-content",className:r("px-6",t),...a})}function l({className:t,...a}){return o("div",{"data-slot":"card-footer",className:r("flex items-center px-6 [.border-t]:pt-6",t),...a})}
2
- export{d as If,n as Jf,c as Kf,s as Lf,i as Mf,l as Nf};
1
+ import{Ak as r,zh as o}from"./chunk-m6a4rzdt.js";function d({className:t,...a}){return o("div",{"data-slot":"card",className:r("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...a})}function n({className:t,...a}){return o("div",{"data-slot":"card-header",className:r("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function c({className:t,...a}){return o("div",{"data-slot":"card-title",className:r("leading-none font-semibold",t),...a})}function s({className:t,...a}){return o("div",{"data-slot":"card-description",className:r("text-sm text-muted-foreground",t),...a})}function i({className:t,...a}){return o("div",{"data-slot":"card-content",className:r("px-6",t),...a})}function l({className:t,...a}){return o("div",{"data-slot":"card-footer",className:r("flex items-center px-6 [.border-t]:pt-6",t),...a})}
2
+ export{d as Kf,n as Lf,c as Mf,s as Nf,i as Of,l as Pf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function N(k){if(!(k instanceof Error)||!("status"in k)||!("headers"in k))return!1;return(k.status===void 0||typeof k.status==="number")&&(k.headers===void 0||k.headers instanceof Headers)}function O(k){let w=k.headers?.get("x-should-retry");if(w==="true")return!0;if(w==="false")return!1;if(k.status===void 0)return!0;return k.status===408||k.status===409||k.status===429||typeof k.status==="number"&&k.status>=500}function J(k,w,C){let z=w??60000;if(z>0&&k>z)throw Error(`Server requested ${Math.ceil(k/1000)}s retry delay (max: ${Math.ceil(z/1000)}s). ${C}`);return k}function Q(k,w,C){let z=k.headers?.get("retry-after-ms");if(z){let F=Number.parseFloat(z);if(!Number.isNaN(F))return J(F,C,k.message)}let B=k.headers?.get("retry-after");if(B){let F=Number.parseFloat(B),K=Number.isNaN(F)?Date.parse(B)-Date.now():F*1000;return J(K,C,k.message)}return Math.min(0.5*2**w,8)*1000*(1-Math.random()*0.25)}function H(){let k=Error("Request aborted");return k.name="AbortError",k}function T(k,w){return new Promise((C,z)=>{if(w?.aborted){z(H());return}let B=()=>{clearTimeout(G),z(H())},G=setTimeout(()=>{w?.removeEventListener("abort",B),C()},Math.max(0,k));w?.addEventListener("abort",B,{once:!0})})}async function V(k,w={}){let C=w.maxRetries??0,z=C;for(;;)try{return await k()}catch(B){if(w.signal?.aborted)throw H();if(z<=0||!N(B)||!O(B))throw B;let G=C-z;z--,await T(Q(B,G,w.maxRetryDelayMs),w.signal)}}
3
- export{V as Wk};
3
+ export{V as $k};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Jl as q,Nl as M}from"./chunk-mgbqjbfc.js";var GG=q((xK,e)=>{var y=1000,f=y*60,x=f*60,I=x*24,CG=I*7,IG=I*365.25;e.exports=function(G,Q){Q=Q||{};var K=typeof G;if(K==="string"&&G.length>0)return _G(G);else if(K==="number"&&isFinite(G))return Q.long?yG(G):DG(G);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(G))};function _G(G){if(G=String(G),G.length>100)return;var Q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(G);if(!Q)return;var K=parseFloat(Q[1]),V=(Q[2]||"ms").toLowerCase();switch(V){case"years":case"year":case"yrs":case"yr":case"y":return K*IG;case"weeks":case"week":case"w":return K*CG;case"days":case"day":case"d":return K*I;case"hours":case"hour":case"hrs":case"hr":case"h":return K*x;case"minutes":case"minute":case"mins":case"min":case"m":return K*f;case"seconds":case"second":case"secs":case"sec":case"s":return K*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return K;default:return}}function DG(G){var Q=Math.abs(G);if(Q>=I)return Math.round(G/I)+"d";if(Q>=x)return Math.round(G/x)+"h";if(Q>=f)return Math.round(G/f)+"m";if(Q>=y)return Math.round(G/y)+"s";return G+"ms"}function yG(G){var Q=Math.abs(G);if(Q>=I)return u(G,Q,I,"day");if(Q>=x)return u(G,Q,x,"hour");if(Q>=f)return u(G,Q,f,"minute");if(Q>=y)return u(G,Q,y,"second");return G+" ms"}function u(G,Q,K,V){var Z=Q>=K*1.5;return Math.round(G/K)+" "+V+(Z?"s":"")}});var m=q((hK,KG)=>{function fG(G){K.debug=K,K.default=K,K.coerce=L,K.disable=J,K.enable=Z,K.enabled=N,K.humanize=GG(),K.destroy=v,Object.keys(G).forEach(($)=>{K[$]=G[$]}),K.names=[],K.skips=[],K.formatters={};function Q($){let w=0;for(let W=0;W<$.length;W++)w=(w<<5)-w+$.charCodeAt(W),w|=0;return K.colors[Math.abs(w)%K.colors.length]}K.selectColor=Q;function K($){let w,W=null,Y,R;function B(...X){if(!B.enabled)return;let T=B,j=Number(new Date),A=j-(w||j);if(T.diff=A,T.prev=w,T.curr=j,w=j,X[0]=K.coerce(X[0]),typeof X[0]!=="string")X.unshift("%O");let F=0;X[0]=X[0].replace(/%([a-zA-Z%])/g,(C,D)=>{if(C==="%%")return"%";F++;let s=K.formatters[D];if(typeof s==="function"){let AG=X[F];C=s.call(T,AG),X.splice(F,1),F--}return C}),K.formatArgs.call(T,X),(T.log||K.log).apply(T,X)}if(B.namespace=$,B.useColors=K.useColors(),B.color=K.selectColor($),B.extend=V,B.destroy=K.destroy,Object.defineProperty(B,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(W!==null)return W;if(Y!==K.namespaces)Y=K.namespaces,R=K.enabled($);return R},set:(X)=>{W=X}}),typeof K.init==="function")K.init(B);return B}function V($,w){let W=K(this.namespace+(typeof w>"u"?":":w)+$);return W.log=this.log,W}function Z($){K.save($),K.namespaces=$,K.names=[],K.skips=[];let w=(typeof $==="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let W of w)if(W[0]==="-")K.skips.push(W.slice(1));else K.names.push(W)}function z($,w){let W=0,Y=0,R=-1,B=0;while(W<$.length)if(Y<w.length&&(w[Y]===$[W]||w[Y]==="*"))if(w[Y]==="*")R=Y,B=W,Y++;else W++,Y++;else if(R!==-1)Y=R+1,B++,W=B;else return!1;while(Y<w.length&&w[Y]==="*")Y++;return Y===w.length}function J(){let $=[...K.names,...K.skips.map((w)=>"-"+w)].join(",");return K.enable(""),$}function N($){for(let w of K.skips)if(z($,w))return!1;for(let w of K.names)if(z($,w))return!0;return!1}function L($){if($ instanceof Error)return $.stack||$.message;return $}function v(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return K.enable(K.load()),K}KG.exports=fG});var VG=q((QG,g)=>{QG.formatArgs=hG;QG.save=vG;QG.load=bG;QG.useColors=xG;QG.storage=iG();QG.destroy=(()=>{let G=!1;return()=>{if(!G)G=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();QG.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xG(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let G;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(G=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(G[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hG(G){if(G[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+G[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;let Q="color: "+this.color;G.splice(1,0,Q,"color: inherit");let K=0,V=0;G[0].replace(/%[a-zA-Z%]/g,(Z)=>{if(Z==="%%")return;if(K++,Z==="%c")V=K}),G.splice(V,0,Q)}QG.log=console.debug||console.log||(()=>{});function vG(G){try{if(G)QG.storage.setItem("debug",G);else QG.storage.removeItem("debug")}catch(Q){}}function bG(){let G;try{G=QG.storage.getItem("debug")||QG.storage.getItem("DEBUG")}catch(Q){}if(!G&&typeof process<"u"&&"env"in process)G=process.env.DEBUG;return G}function iG(){try{return localStorage}catch(G){}}g.exports=m()(QG);var{formatters:kG}=g.exports;kG.j=function(G){try{return JSON.stringify(G)}catch(Q){return"[UnexpectedJSONParseError]: "+Q.message}}});var $G=q((bK,ZG)=>{ZG.exports=(G,Q=process.argv)=>{let K=G.startsWith("-")?"":G.length===1?"-":"--",V=Q.indexOf(K+G),Z=Q.indexOf("--");return V!==-1&&(Z===-1||V<Z)}});var JG=q((iK,zG)=>{var mG=M("os"),wG=M("tty"),O=$G(),{env:U}=process,d;if(O("no-color")||O("no-colors")||O("color=false")||O("color=never"))d=0;else if(O("color")||O("colors")||O("color=true")||O("color=always"))d=1;function rG(){if("FORCE_COLOR"in U){if(U.FORCE_COLOR==="true")return 1;if(U.FORCE_COLOR==="false")return 0;return U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}}function aG(G){if(G===0)return!1;return{level:G,hasBasic:!0,has256:G>=2,has16m:G>=3}}function oG(G,{streamIsTTY:Q,sniffFlags:K=!0}={}){let V=rG();if(V!==void 0)d=V;let Z=K?d:V;if(Z===0)return 0;if(K){if(O("color=16m")||O("color=full")||O("color=truecolor"))return 3;if(O("color=256"))return 2}if(G&&!Q&&Z===void 0)return 0;let z=Z||0;if(U.TERM==="dumb")return z;if(process.platform==="win32"){let J=mG.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in U){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((J)=>(J in U))||U.CI_NAME==="codeship")return 1;return z}if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in U){let J=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(U.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM))return 1;if("COLORTERM"in U)return 1;return z}function r(G,Q={}){let K=oG(G,{streamIsTTY:G&&G.isTTY,...Q});return aG(K)}zG.exports={supportsColor:r,stdout:r({isTTY:wG.isatty(1)}),stderr:r({isTTY:wG.isatty(2)})}});var BG=q((YG,l)=>{var tG=M("tty"),c=M("util");YG.init=ZK;YG.log=KK;YG.formatArgs=eG;YG.save=QK;YG.load=VK;YG.useColors=sG;YG.destroy=c.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");YG.colors=[6,2,3,4,5,1];try{let G=JG();if(G&&(G.stderr||G).level>=2)YG.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(G){}YG.inspectOpts=Object.keys(process.env).filter((G)=>{return/^debug_/i.test(G)}).reduce((G,Q)=>{let K=Q.substring(6).toLowerCase().replace(/_([a-z])/g,(Z,z)=>{return z.toUpperCase()}),V=process.env[Q];if(/^(yes|on|true|enabled)$/i.test(V))V=!0;else if(/^(no|off|false|disabled)$/i.test(V))V=!1;else if(V==="null")V=null;else V=Number(V);return G[K]=V,G},{});function sG(){return"colors"in YG.inspectOpts?Boolean(YG.inspectOpts.colors):tG.isatty(process.stderr.fd)}function eG(G){let{namespace:Q,useColors:K}=this;if(K){let V=this.color,Z="\x1B[3"+(V<8?V:"8;5;"+V),z=` ${Z};1m${Q} \x1B[0m`;G[0]=z+G[0].split(`
2
+ import{Ol as q,Sl as M}from"./chunk-dej1gq35.js";var GG=q((xK,e)=>{var y=1000,f=y*60,x=f*60,I=x*24,CG=I*7,IG=I*365.25;e.exports=function(G,Q){Q=Q||{};var K=typeof G;if(K==="string"&&G.length>0)return _G(G);else if(K==="number"&&isFinite(G))return Q.long?yG(G):DG(G);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(G))};function _G(G){if(G=String(G),G.length>100)return;var Q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(G);if(!Q)return;var K=parseFloat(Q[1]),V=(Q[2]||"ms").toLowerCase();switch(V){case"years":case"year":case"yrs":case"yr":case"y":return K*IG;case"weeks":case"week":case"w":return K*CG;case"days":case"day":case"d":return K*I;case"hours":case"hour":case"hrs":case"hr":case"h":return K*x;case"minutes":case"minute":case"mins":case"min":case"m":return K*f;case"seconds":case"second":case"secs":case"sec":case"s":return K*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return K;default:return}}function DG(G){var Q=Math.abs(G);if(Q>=I)return Math.round(G/I)+"d";if(Q>=x)return Math.round(G/x)+"h";if(Q>=f)return Math.round(G/f)+"m";if(Q>=y)return Math.round(G/y)+"s";return G+"ms"}function yG(G){var Q=Math.abs(G);if(Q>=I)return u(G,Q,I,"day");if(Q>=x)return u(G,Q,x,"hour");if(Q>=f)return u(G,Q,f,"minute");if(Q>=y)return u(G,Q,y,"second");return G+" ms"}function u(G,Q,K,V){var Z=Q>=K*1.5;return Math.round(G/K)+" "+V+(Z?"s":"")}});var m=q((hK,KG)=>{function fG(G){K.debug=K,K.default=K,K.coerce=L,K.disable=J,K.enable=Z,K.enabled=N,K.humanize=GG(),K.destroy=v,Object.keys(G).forEach(($)=>{K[$]=G[$]}),K.names=[],K.skips=[],K.formatters={};function Q($){let w=0;for(let W=0;W<$.length;W++)w=(w<<5)-w+$.charCodeAt(W),w|=0;return K.colors[Math.abs(w)%K.colors.length]}K.selectColor=Q;function K($){let w,W=null,Y,R;function B(...X){if(!B.enabled)return;let T=B,j=Number(new Date),A=j-(w||j);if(T.diff=A,T.prev=w,T.curr=j,w=j,X[0]=K.coerce(X[0]),typeof X[0]!=="string")X.unshift("%O");let F=0;X[0]=X[0].replace(/%([a-zA-Z%])/g,(C,D)=>{if(C==="%%")return"%";F++;let s=K.formatters[D];if(typeof s==="function"){let AG=X[F];C=s.call(T,AG),X.splice(F,1),F--}return C}),K.formatArgs.call(T,X),(T.log||K.log).apply(T,X)}if(B.namespace=$,B.useColors=K.useColors(),B.color=K.selectColor($),B.extend=V,B.destroy=K.destroy,Object.defineProperty(B,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(W!==null)return W;if(Y!==K.namespaces)Y=K.namespaces,R=K.enabled($);return R},set:(X)=>{W=X}}),typeof K.init==="function")K.init(B);return B}function V($,w){let W=K(this.namespace+(typeof w>"u"?":":w)+$);return W.log=this.log,W}function Z($){K.save($),K.namespaces=$,K.names=[],K.skips=[];let w=(typeof $==="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let W of w)if(W[0]==="-")K.skips.push(W.slice(1));else K.names.push(W)}function z($,w){let W=0,Y=0,R=-1,B=0;while(W<$.length)if(Y<w.length&&(w[Y]===$[W]||w[Y]==="*"))if(w[Y]==="*")R=Y,B=W,Y++;else W++,Y++;else if(R!==-1)Y=R+1,B++,W=B;else return!1;while(Y<w.length&&w[Y]==="*")Y++;return Y===w.length}function J(){let $=[...K.names,...K.skips.map((w)=>"-"+w)].join(",");return K.enable(""),$}function N($){for(let w of K.skips)if(z($,w))return!1;for(let w of K.names)if(z($,w))return!0;return!1}function L($){if($ instanceof Error)return $.stack||$.message;return $}function v(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return K.enable(K.load()),K}KG.exports=fG});var VG=q((QG,g)=>{QG.formatArgs=hG;QG.save=vG;QG.load=bG;QG.useColors=xG;QG.storage=iG();QG.destroy=(()=>{let G=!1;return()=>{if(!G)G=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();QG.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xG(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let G;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(G=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(G[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hG(G){if(G[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+G[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;let Q="color: "+this.color;G.splice(1,0,Q,"color: inherit");let K=0,V=0;G[0].replace(/%[a-zA-Z%]/g,(Z)=>{if(Z==="%%")return;if(K++,Z==="%c")V=K}),G.splice(V,0,Q)}QG.log=console.debug||console.log||(()=>{});function vG(G){try{if(G)QG.storage.setItem("debug",G);else QG.storage.removeItem("debug")}catch(Q){}}function bG(){let G;try{G=QG.storage.getItem("debug")||QG.storage.getItem("DEBUG")}catch(Q){}if(!G&&typeof process<"u"&&"env"in process)G=process.env.DEBUG;return G}function iG(){try{return localStorage}catch(G){}}g.exports=m()(QG);var{formatters:kG}=g.exports;kG.j=function(G){try{return JSON.stringify(G)}catch(Q){return"[UnexpectedJSONParseError]: "+Q.message}}});var $G=q((bK,ZG)=>{ZG.exports=(G,Q=process.argv)=>{let K=G.startsWith("-")?"":G.length===1?"-":"--",V=Q.indexOf(K+G),Z=Q.indexOf("--");return V!==-1&&(Z===-1||V<Z)}});var JG=q((iK,zG)=>{var mG=M("os"),wG=M("tty"),O=$G(),{env:U}=process,d;if(O("no-color")||O("no-colors")||O("color=false")||O("color=never"))d=0;else if(O("color")||O("colors")||O("color=true")||O("color=always"))d=1;function rG(){if("FORCE_COLOR"in U){if(U.FORCE_COLOR==="true")return 1;if(U.FORCE_COLOR==="false")return 0;return U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}}function aG(G){if(G===0)return!1;return{level:G,hasBasic:!0,has256:G>=2,has16m:G>=3}}function oG(G,{streamIsTTY:Q,sniffFlags:K=!0}={}){let V=rG();if(V!==void 0)d=V;let Z=K?d:V;if(Z===0)return 0;if(K){if(O("color=16m")||O("color=full")||O("color=truecolor"))return 3;if(O("color=256"))return 2}if(G&&!Q&&Z===void 0)return 0;let z=Z||0;if(U.TERM==="dumb")return z;if(process.platform==="win32"){let J=mG.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in U){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((J)=>(J in U))||U.CI_NAME==="codeship")return 1;return z}if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in U){let J=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(U.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM))return 1;if("COLORTERM"in U)return 1;return z}function r(G,Q={}){let K=oG(G,{streamIsTTY:G&&G.isTTY,...Q});return aG(K)}zG.exports={supportsColor:r,stdout:r({isTTY:wG.isatty(1)}),stderr:r({isTTY:wG.isatty(2)})}});var BG=q((YG,l)=>{var tG=M("tty"),c=M("util");YG.init=ZK;YG.log=KK;YG.formatArgs=eG;YG.save=QK;YG.load=VK;YG.useColors=sG;YG.destroy=c.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");YG.colors=[6,2,3,4,5,1];try{let G=JG();if(G&&(G.stderr||G).level>=2)YG.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(G){}YG.inspectOpts=Object.keys(process.env).filter((G)=>{return/^debug_/i.test(G)}).reduce((G,Q)=>{let K=Q.substring(6).toLowerCase().replace(/_([a-z])/g,(Z,z)=>{return z.toUpperCase()}),V=process.env[Q];if(/^(yes|on|true|enabled)$/i.test(V))V=!0;else if(/^(no|off|false|disabled)$/i.test(V))V=!1;else if(V==="null")V=null;else V=Number(V);return G[K]=V,G},{});function sG(){return"colors"in YG.inspectOpts?Boolean(YG.inspectOpts.colors):tG.isatty(process.stderr.fd)}function eG(G){let{namespace:Q,useColors:K}=this;if(K){let V=this.color,Z="\x1B[3"+(V<8?V:"8;5;"+V),z=` ${Z};1m${Q} \x1B[0m`;G[0]=z+G[0].split(`
3
3
  `).join(`
4
4
  `+z),G.push(Z+"m+"+l.exports.humanize(this.diff)+"\x1B[0m")}else G[0]=GK()+Q+" "+G[0]}function GK(){if(YG.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function KK(...G){return process.stderr.write(c.formatWithOptions(YG.inspectOpts,...G)+`
5
5
  `)}function QK(G){if(G)process.env.DEBUG=G;else delete process.env.DEBUG}function VK(){return process.env.DEBUG}function ZK(G){G.inspectOpts={};let Q=Object.keys(YG.inspectOpts);for(let K=0;K<Q.length;K++)G.inspectOpts[Q[K]]=YG.inspectOpts[Q[K]]}l.exports=m()(YG);var{formatters:WG}=l.exports;WG.o=function(G){return this.inspectOpts.colors=this.useColors,c.inspect(G,this.inspectOpts).split(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Rd as a}from"./chunk-w16jgdfx.js";var l=/"/g,n=/[\\'"]/g;class r extends a{visitOrAction(t){this.append("or "),this.append(t.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(t){return t.replace(l,'""')}sanitizeJSONPathMemberValue(t){return t.replace(n,(e)=>e==="\\"?"\\\\":e==="'"?"''":"\\\"")}visitDefaultInsertValue(t){this.append("null")}}class s{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}class p extends s{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(t,e){}async releaseMigrationLock(t,e){}}
3
- export{s as dd,r as ed,p as fd};
2
+ import{Td as a}from"./chunk-4bn9eb9h.js";var l=/"/g,n=/[\\'"]/g;class r extends a{visitOrAction(t){this.append("or "),this.append(t.action)}getCurrentParameterPlaceholder(){return"?"}getLeftExplainOptionsWrapper(){return""}getRightExplainOptionsWrapper(){return""}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}sanitizeIdentifier(t){return t.replace(l,'""')}sanitizeJSONPathMemberValue(t){return t.replace(n,(e)=>e==="\\"?"\\\\":e==="'"?"''":"\\\"")}visitDefaultInsertValue(t){this.append("null")}}class s{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!1}get supportsOutput(){return!1}}class p extends s{get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(t,e){}async releaseMigrationLock(t,e){}}
3
+ export{s as fd,r as gd,p as hd};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Mk as O}from"./chunk-z0tbq08w.js";import{Nk as C,Ok as E}from"./chunk-y1t47c7f.js";import{Pk as y,Qk as K,Rk as P}from"./chunk-nh31ma8d.js";import{Sk as b}from"./chunk-w4ycztv5.js";import"./chunk-pm64et9d.js";import{Uk as M}from"./chunk-snexx7ks.js";import{Wk as H}from"./chunk-kaxwma6y.js";import{Xk as k}from"./chunk-fzaw1e34.js";import"./chunk-yzra1x8f.js";import{kl as A,ll as N}from"./chunk-z0zevgb6.js";import{ql as $,sl as S}from"./chunk-29nhtrfv.js";import"./chunk-800vdz5n.js";import{wl as _}from"./chunk-f2eh802w.js";import{Dl as f}from"./chunk-ew4cxkcc.js";import{El as U}from"./chunk-hcvpb1hw.js";import"./chunk-mgbqjbfc.js";var g=new Set(["openai","openai-codex","opencode"]),u=16;function V(j,D){if(!j)return!1;let w=D.toLowerCase();for(let[z,F]of Object.entries(j))if(z.toLowerCase()===w&&F!==null&&F.trim().length>0)return!0;return!1}function R(j,D,w){if(D)return D;if(V(w,"authorization")||V(w,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${j}`)}function c(j){return j.provider==="openrouter"||j.baseUrl.includes("openrouter.ai")?"openrouter":"openai"}function T(j,D){if(j)return j;if(k("PI_CACHE_RETENTION",D)==="long")return"long";return"short"}function q(j){return{supportsDeveloperRole:j.compat?.supportsDeveloperRole??!0,sessionAffinityFormat:j.compat?.sessionAffinityFormat??c(j),supportsLongCacheRetention:j.compat?.supportsLongCacheRetention??!0,supportsStrictMode:j.compat?.supportsStrictMode??!1,supportsOpenAIGrammarTools:j.compat?.supportsOpenAIGrammarTools??!1,supportsToolSearch:j.compat?.supportsToolSearch??!1,supportsExplicitPromptCacheMode:j.compat?.supportsExplicitPromptCacheMode??!1}}function r(j,D){return D==="long"&&j.supportsLongCacheRetention?"24h":void 0}function d(j){return N(A(j),"OpenAI API error")}var l=(j,D,w)=>{let z=new U;return(async()=>{let F={role:"assistant",content:[],api:j.api,provider:j.provider,model:j.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let Q=R(j.provider,w?.apiKey,w?.headers),W=T(w?.cacheRetention,w?.env)==="none"?void 0:w?.sessionId,X=q(j),J=$(D.tools,X.supportsOpenAIGrammarTools),Y=a(j,D,Q,w?.headers,W),Z=m(j,D,w,X,J),B=await w?.onPayload?.(Z,j);if(B!==void 0)Z=B;let v={...w?.signal?{signal:w.signal}:{},...w?.timeoutMs!==void 0?{timeout:w.timeoutMs}:{},maxRetries:0},{data:I,response:L}=await H(()=>Y.responses.create(Z,v).withResponse(),{maxRetries:w?.maxRetries,maxRetryDelayMs:w?.maxRetryDelayMs,signal:w?.signal});if(await w?.onResponse?.({status:L.status,headers:_(L.headers)},j),z.push({type:"start",partial:F}),await P(I,F,z,j,{serviceTier:w?.serviceTier,grammarToolInputProperties:J,applyServiceTierPricing:(x,h)=>n(x,h,j)}),w?.signal?.aborted)throw Error("Request was aborted");if(F.stopReason==="aborted"||F.stopReason==="error")throw Error("An unknown error occurred");z.push({type:"done",reason:F.stopReason,message:F}),z.end()}catch(Q){for(let G of F.content)delete G.index,delete G.partialJson,delete G.customInput;F.stopReason=w?.signal?.aborted?"aborted":"error",F.errorMessage=d(Q),z.push({type:"error",reason:F.stopReason,error:F}),z.end()}})(),z},Wj=(j,D,w)=>{R(j.provider,w?.apiKey,w?.headers);let z=S(j,D,w,w?.apiKey),F=w?.reasoning?f(j,w.reasoning):void 0;return l(j,D,{...z,reasoningEffort:F==="off"?void 0:F})};function a(j,D,w,z,F){let Q=q(j),G={...j.headers};if(j.provider==="github-copilot"){let W=C(D.messages),X=E({messages:D.messages,hasImages:W});Object.assign(G,X)}if(F)if(Q.sessionAffinityFormat==="openrouter")G["x-session-id"]=F;else{if(Q.sessionAffinityFormat==="openai")G.session_id=F;G["x-client-request-id"]=F}if(z)Object.assign(G,z);return new M({apiKey:w,baseURL:j.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:G})}function m(j,D,w,z=q(j),F=$(D.tools,z.supportsOpenAIGrammarTools)){let Q=O(D,z.supportsToolSearch),G=y(j,D,g,{grammarToolInputProperties:F,deferredTools:Q.deferred,toolOptions:{supportsStrictMode:z.supportsStrictMode,supportsOpenAIGrammarTools:z.supportsOpenAIGrammarTools}}),W=T(w?.cacheRetention,w?.env),X=W==="none"&&z.supportsExplicitPromptCacheMode,J={model:j.id,input:G,stream:!0,prompt_cache_key:W==="none"?void 0:b(w?.sessionId),prompt_cache_retention:r(z,W),prompt_cache_options:X?{mode:"explicit"}:void 0,store:!1};if(w?.maxTokens)J.max_output_tokens=Math.max(w.maxTokens,u);if(w?.temperature!==void 0)J.temperature=w?.temperature;if(w?.serviceTier!==void 0)J.service_tier=w.serviceTier;if(Q.immediate.length>0)J.tools=K(Q.immediate,{supportsStrictMode:z.supportsStrictMode,supportsOpenAIGrammarTools:z.supportsOpenAIGrammarTools});if(w?.toolChoice!==void 0)J.tool_choice=w.toolChoice;if(j.reasoning){if(w?.reasoningEffort||w?.reasoningSummary){let Y=w?.reasoningEffort?j.thinkingLevelMap?.[w.reasoningEffort]??w.reasoningEffort:"medium";J.reasoning={effort:Y,summary:w?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(j.provider!=="github-copilot"&&j.thinkingLevelMap?.off!==null)J.reasoning={effort:j.thinkingLevelMap?.off??"none"};if(j.provider==="xai")J.include=["reasoning.encrypted_content"]}return J}function i(j,D){switch(D){case"flex":return 0.5;case"priority":return j.id==="gpt-5.5"?2.5:2;default:return 1}}function n(j,D,w){let z=i(w,D);if(z===1)return;j.cost.input*=z,j.cost.output*=z,j.cost.cacheRead*=z,j.cost.cacheWrite*=z,j.cost.total=j.cost.input+j.cost.output+j.cost.cacheRead+j.cost.cacheWrite}export{Wj as streamSimple,l as stream};
2
+ import{Rk as O}from"./chunk-3xzgddev.js";import{Sk as C,Tk as E}from"./chunk-2086rsb2.js";import{Uk as y,Vk as K,Wk as P}from"./chunk-cqq8e3hc.js";import{Xk as b}from"./chunk-1xzc6z02.js";import"./chunk-g60v3jc1.js";import{Zk as M}from"./chunk-k48y9e5s.js";import{$k as H}from"./chunk-6zs49mef.js";import{al as k}from"./chunk-hqkmdp31.js";import"./chunk-tzt4c1dm.js";import{pl as A,ql as N}from"./chunk-qdycy714.js";import{vl as $,xl as S}from"./chunk-p4c4z0f2.js";import"./chunk-x6532q76.js";import{Bl as _}from"./chunk-gjdmnfms.js";import{Il as f}from"./chunk-81tb4v5v.js";import{Jl as U}from"./chunk-a0k1b4sq.js";import"./chunk-dej1gq35.js";var g=new Set(["openai","openai-codex","opencode"]),u=16;function V(j,D){if(!j)return!1;let w=D.toLowerCase();for(let[z,F]of Object.entries(j))if(z.toLowerCase()===w&&F!==null&&F.trim().length>0)return!0;return!1}function R(j,D,w){if(D)return D;if(V(w,"authorization")||V(w,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${j}`)}function c(j){return j.provider==="openrouter"||j.baseUrl.includes("openrouter.ai")?"openrouter":"openai"}function T(j,D){if(j)return j;if(k("PI_CACHE_RETENTION",D)==="long")return"long";return"short"}function q(j){return{supportsDeveloperRole:j.compat?.supportsDeveloperRole??!0,sessionAffinityFormat:j.compat?.sessionAffinityFormat??c(j),supportsLongCacheRetention:j.compat?.supportsLongCacheRetention??!0,supportsStrictMode:j.compat?.supportsStrictMode??!1,supportsOpenAIGrammarTools:j.compat?.supportsOpenAIGrammarTools??!1,supportsToolSearch:j.compat?.supportsToolSearch??!1,supportsExplicitPromptCacheMode:j.compat?.supportsExplicitPromptCacheMode??!1}}function r(j,D){return D==="long"&&j.supportsLongCacheRetention?"24h":void 0}function d(j){return N(A(j),"OpenAI API error")}var l=(j,D,w)=>{let z=new U;return(async()=>{let F={role:"assistant",content:[],api:j.api,provider:j.provider,model:j.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let Q=R(j.provider,w?.apiKey,w?.headers),W=T(w?.cacheRetention,w?.env)==="none"?void 0:w?.sessionId,X=q(j),J=$(D.tools,X.supportsOpenAIGrammarTools),Y=a(j,D,Q,w?.headers,W),Z=m(j,D,w,X,J),B=await w?.onPayload?.(Z,j);if(B!==void 0)Z=B;let v={...w?.signal?{signal:w.signal}:{},...w?.timeoutMs!==void 0?{timeout:w.timeoutMs}:{},maxRetries:0},{data:I,response:L}=await H(()=>Y.responses.create(Z,v).withResponse(),{maxRetries:w?.maxRetries,maxRetryDelayMs:w?.maxRetryDelayMs,signal:w?.signal});if(await w?.onResponse?.({status:L.status,headers:_(L.headers)},j),z.push({type:"start",partial:F}),await P(I,F,z,j,{serviceTier:w?.serviceTier,grammarToolInputProperties:J,applyServiceTierPricing:(x,h)=>n(x,h,j)}),w?.signal?.aborted)throw Error("Request was aborted");if(F.stopReason==="aborted"||F.stopReason==="error")throw Error("An unknown error occurred");z.push({type:"done",reason:F.stopReason,message:F}),z.end()}catch(Q){for(let G of F.content)delete G.index,delete G.partialJson,delete G.customInput;F.stopReason=w?.signal?.aborted?"aborted":"error",F.errorMessage=d(Q),z.push({type:"error",reason:F.stopReason,error:F}),z.end()}})(),z},Wj=(j,D,w)=>{R(j.provider,w?.apiKey,w?.headers);let z=S(j,D,w,w?.apiKey),F=w?.reasoning?f(j,w.reasoning):void 0;return l(j,D,{...z,reasoningEffort:F==="off"?void 0:F})};function a(j,D,w,z,F){let Q=q(j),G={...j.headers};if(j.provider==="github-copilot"){let W=C(D.messages),X=E({messages:D.messages,hasImages:W});Object.assign(G,X)}if(F)if(Q.sessionAffinityFormat==="openrouter")G["x-session-id"]=F;else{if(Q.sessionAffinityFormat==="openai")G.session_id=F;G["x-client-request-id"]=F}if(z)Object.assign(G,z);return new M({apiKey:w,baseURL:j.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:G})}function m(j,D,w,z=q(j),F=$(D.tools,z.supportsOpenAIGrammarTools)){let Q=O(D,z.supportsToolSearch),G=y(j,D,g,{grammarToolInputProperties:F,deferredTools:Q.deferred,toolOptions:{supportsStrictMode:z.supportsStrictMode,supportsOpenAIGrammarTools:z.supportsOpenAIGrammarTools}}),W=T(w?.cacheRetention,w?.env),X=W==="none"&&z.supportsExplicitPromptCacheMode,J={model:j.id,input:G,stream:!0,prompt_cache_key:W==="none"?void 0:b(w?.sessionId),prompt_cache_retention:r(z,W),prompt_cache_options:X?{mode:"explicit"}:void 0,store:!1};if(w?.maxTokens)J.max_output_tokens=Math.max(w.maxTokens,u);if(w?.temperature!==void 0)J.temperature=w?.temperature;if(w?.serviceTier!==void 0)J.service_tier=w.serviceTier;if(Q.immediate.length>0)J.tools=K(Q.immediate,{supportsStrictMode:z.supportsStrictMode,supportsOpenAIGrammarTools:z.supportsOpenAIGrammarTools});if(w?.toolChoice!==void 0)J.tool_choice=w.toolChoice;if(j.reasoning){if(w?.reasoningEffort||w?.reasoningSummary){let Y=w?.reasoningEffort?j.thinkingLevelMap?.[w.reasoningEffort]??w.reasoningEffort:"medium";J.reasoning={effort:Y,summary:w?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(j.provider!=="github-copilot"&&j.thinkingLevelMap?.off!==null)J.reasoning={effort:j.thinkingLevelMap?.off??"none"};if(j.provider==="xai")J.include=["reasoning.encrypted_content"]}return J}function i(j,D){switch(D){case"flex":return 0.5;case"priority":return j.id==="gpt-5.5"?2.5:2;default:return 1}}function n(j,D,w){let z=i(w,D);if(z===1)return;j.cost.input*=z,j.cost.output*=z,j.cost.cacheRead*=z,j.cost.cacheWrite*=z,j.cost.total=j.cost.input+j.cost.output+j.cost.cacheRead+j.cost.cacheWrite}export{Wj as streamSimple,l as stream};
@@ -0,0 +1 @@
1
+ import{a as P,b as A,c as C,d as D,e as z,f as _}from"./chunk-b3jh3hf1.js";import{t as VJ}from"./chunk-dv1zpd2p.js";import{ba as ZJ}from"./chunk-r5dv0rfv.js";import{ca as $J,da as OJ,ea as XJ}from"./chunk-83k0wa5k.js";import{ma as DJ,na as KJ,oa as S}from"./chunk-8y1v9dm9.js";import{Kf as u,Lf as g,Mf as b,Nf as c,Of as n}from"./chunk-6v39c8eg.js";import{zg as Q}from"./chunk-9s02m95j.js";import"./chunk-87wqbn4g.js";import{Fg as t}from"./chunk-f2j2cqd1.js";import{fh as m}from"./chunk-2mqqghrz.js";import{Ah as K,Ak as e,Ck as d,Dh as _J,Dk as v,Eh as f,Ek as p,Fk as I,Hh as r,Ik as Y,Jk as kJ,Lj as GJ,Pj as wJ,Rh as NJ,bi as M,ei as RJ,fk as QJ,mi as YJ,ni as N,ui as s,xh as o,xj as i,zh as J}from"./chunk-m6a4rzdt.js";import{Nl as l}from"./chunk-dej1gq35.js";var yJ=l(o(),1);var WJ=l(o(),1);function EJ({teamId:O}){let[X,k]=WJ.useState("team"),[V,R]=WJ.useState("1h"),{data:q,isLoading:F}=f({queryKey:["teams",O,"ai-usage",V,"team"],queryFn:async()=>{let Z=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:O},query:{timeframe:V}});if(!Z.ok)throw Error("Failed to fetch team AI usage");return await Z.json()},enabled:!!O&&X==="team"}),{data:T,isLoading:B}=f({queryKey:["teams",O,"members"],queryFn:async()=>{let Z=await M.api.teams[":teamId"].members.$get({param:{teamId:O},query:{}});if(!Z.ok)throw Error("Failed to fetch team members");return await Z.json()},enabled:!!O&&X==="members"}),h=_J({queries:(T||[]).map((Z)=>({queryKey:["teams",O,"ai-usage",V,Z.id],queryFn:async()=>{let G=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:O},query:{timeframe:V,userId:Z.id}});if(!G.ok)throw Error(`Failed to fetch AI usage for member ${Z.id}`);return await G.json()},enabled:!!O&&X==="members"}))}),y=B||h.some((Z)=>Z.isLoading),H=(Z)=>{if(!Z)return"U";let G=Z.split(" ");if(G.length>1)return`${G[0][0]}${G[G.length-1][0]}`.toUpperCase();return Z.substring(0,2).toUpperCase()},x=(Z)=>{if(!Z)return"";switch(Z.toLowerCase()){case"owner":return Y.owner();case"editor":return Y.editor();case"reviewer":return Y.reviewer();default:return Z}},$=(Z)=>(Z??0).toLocaleString(),L=(Z)=>`$${(Z??0).toFixed(6)}`;return K(u,{className:"border-border/60 shadow-sm",children:[K(g,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[K("div",{children:[J(b,{className:"text-xl font-semibold tracking-tight",children:Y.ai_usage()}),J(c,{className:"text-sm text-muted-foreground mt-1",children:Y.ai_usage_description()})]}),K("div",{className:"flex flex-wrap items-center gap-3",children:[K(KJ,{type:"single",value:X,onValueChange:(Z)=>{if(Z)k(Z)},className:"border rounded-lg p-1 bg-muted/30",children:[J(S,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:Y.team_view()}),J(S,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:Y.members_view()})]}),K(KJ,{type:"single",value:V,onValueChange:(Z)=>{if(Z)R(Z)},className:"border rounded-lg p-1 bg-muted/30",children:[J(S,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),J(S,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),J(S,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),J(S,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),J(n,{children:X==="team"?F?J("div",{className:"flex h-48 items-center justify-center",children:J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(P,{children:[J(A,{children:K(D,{children:[J(z,{children:Y.team()}),J(z,{className:"text-right",children:Y.input_tokens()}),J(z,{className:"text-right",children:Y.output_tokens()}),J(z,{className:"text-right",children:Y.cache_read_tokens()}),J(z,{className:"text-right",children:Y.total_tokens()}),J(z,{className:"text-right",children:Y.cost()})]})}),J(C,{children:K(D,{children:[J(_,{className:"font-medium",children:Y.team()}),J(_,{className:"text-right",children:$(q?.team?.inputTokens)}),J(_,{className:"text-right",children:$(q?.team?.outputTokens)}),J(_,{className:"text-right",children:$(q?.team?.cacheReadTokens)}),J(_,{className:"text-right font-medium",children:$(q?.team?.totalTokens)}),J(_,{className:"text-right font-medium",children:L(q?.team?.cost)})]})})]})}):y?J("div",{className:"flex h-48 items-center justify-center",children:J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(P,{children:[J(A,{children:K(D,{children:[J(z,{children:Y.members()}),J(z,{children:Y.role()}),J(z,{className:"text-right",children:Y.input_tokens()}),J(z,{className:"text-right",children:Y.output_tokens()}),J(z,{className:"text-right",children:Y.cache_read_tokens()}),J(z,{className:"text-right",children:Y.total_tokens()}),J(z,{className:"text-right",children:Y.cost()})]})}),J(C,{children:(T||[]).map((Z,G)=>{let U=h[G]?.data?.member;return K(D,{children:[J(_,{children:K("div",{className:"flex items-center gap-3",children:[K(v,{className:"h-8 w-8 rounded-full",children:[Z.image&&J(p,{src:Z.image,alt:Z.name,className:"object-cover"}),J(I,{className:"bg-primary/20 text-xs",children:H(Z.name)})]}),K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-medium leading-none",children:Z.name}),J("span",{className:"text-xs text-muted-foreground mt-0.5",children:Z.email})]})]})}),J(_,{className:"text-xs text-muted-foreground",children:x(Z.role)}),J(_,{className:"text-right",children:$(U?.inputTokens)}),J(_,{className:"text-right",children:$(U?.outputTokens)}),J(_,{className:"text-right",children:$(U?.cacheReadTokens)}),J(_,{className:"text-right font-medium",children:$(U?.totalTokens)}),J(_,{className:"text-right font-medium",children:L(U?.cost)})]},Z.id)})})]})})})]})}var a=l(o(),1);function qJ({teamId:O}){let[X,k]=a.useState(null),{ref:V,inView:R}=t(),{data:q,isLoading:F,isError:T,fetchNextPage:B,hasNextPage:h,isFetchingNextPage:y}=r({queryKey:["teams",O,"agent-sessions"],queryFn:async({pageParam:$})=>{let L=await M.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:O},query:{first:"20",after:$?String($):void 0}});if(!L.ok)throw Error("Failed to fetch agent sessions");return await L.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo.cursor||void 0,enabled:!!O});a.useEffect(()=>{if(R&&h&&!y)B()},[R,h,y,B]);let H=q?.pages.flatMap(($)=>$.data).filter(($)=>$.id!=="pending")||[],x=($)=>{switch($){case"comment":return J(Q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:Y.session_type_comment()});case"chat":return J(Q,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:Y.session_type_chat()});case"naming":return J(Q,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:Y.session_type_naming()});default:return J(Q,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:$})}};return K("div",{className:"space-y-6",children:[K(u,{className:"border border-border/50 shadow-xs",children:[J(g,{className:"pb-4",children:J("div",{className:"flex items-center justify-between",children:K("div",{children:[K(b,{className:"text-xl font-bold flex items-center gap-2",children:[J(i,{className:"w-5 h-5 text-violet-500"}),Y.sessions()]}),J(c,{className:"mt-1 text-sm text-muted-foreground",children:Y.sessions_description()})]})})}),J(n,{children:F?J("div",{className:"flex h-64 items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):T?J("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):H.length===0?K("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[J(i,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),J("p",{className:"text-base font-medium",children:Y.no_sessions_found()})]}):K("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[K(P,{children:[J(A,{className:"bg-muted/40",children:K(D,{children:[J(z,{children:Y.session_name()}),J(z,{children:Y.creator()}),J(z,{children:Y.session_type()}),J(z,{className:"text-right",children:Y.create_time()})]})}),J(C,{children:H.map(($)=>K(D,{onClick:()=>k($.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[J(_,{className:"font-medium",children:K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-semibold text-foreground",children:$.name||Y.untitled_session()}),J("span",{className:"text-xs font-mono text-muted-foreground/70",children:$.id})]})}),J(_,{children:K("div",{className:"flex items-center gap-2",children:[K(v,{className:"h-6 w-6",children:[J(p,{src:$.creator?.image||void 0}),J(I,{className:"text-[10px]",children:$.creator?.name?.[0]?.toUpperCase()||"?"})]}),J("span",{className:"text-sm text-foreground/90",children:$.creator?.name||"System / Agent"})]})}),J(_,{children:x($.type)}),J(_,{className:"text-right text-xs text-muted-foreground",children:m($.createdAt)})]},$.id))})]}),J("div",{ref:V,className:"py-4 flex justify-center",children:y&&J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),J(VJ,{sessionId:X,open:!!X,onOpenChange:($)=>{if(!$)k(null)}})]})}var j=l(o(),1);var hJ=Object.values(DJ);function MJ({teamId:O}){let[X,k]=j.useState([]),[V,R]=j.useState([]),[q,F]=j.useState(""),{ref:T,inView:B}=t(),{data:h}=f({queryKey:["teams",O,"members"],queryFn:async()=>{let W=await M.api.teams[":teamId"].members.$get({param:{teamId:O},query:{}});if(!W.ok)return[];return await W.json()},enabled:!!O}),y=h||[],{data:H,isLoading:x,isError:$,fetchNextPage:L,hasNextPage:Z,isFetchingNextPage:G}=r({queryKey:["teams",O,"audit-logs",X,V,q],queryFn:async({pageParam:W})=>{let E=await M.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:O},query:{first:"20",after:W?String(W):void 0,actions:X.length>0?X:void 0,userIds:V.length>0?V:void 0,itemId:q.trim()||void 0}});if(!E.ok)throw Error("Failed to fetch audit logs");return await E.json()},initialPageParam:"",getNextPageParam:(W)=>W.pageInfo.endCursor||void 0,enabled:!!O});j.useEffect(()=>{if(B&&Z&&!G)L()},[B,Z,G,L]);let U=H?.pages.flatMap((W)=>W.nodes)||[],zJ=H?.pages[0]?.total??0,LJ=(W)=>{k((E)=>E.includes(W)?E.filter((w)=>w!==W):[...E,W])},UJ=(W)=>{R((E)=>E.includes(W)?E.filter((w)=>w!==W):[...E,W])},FJ=(W)=>{if(W.includes("delete")||W.includes("remove")||W.includes("revoke"))return J(Q,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:W});if(W.includes("create")||W.includes("add"))return J(Q,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:W});if(W.includes("update")||W.includes("reparent")||W.includes("copy"))return J(Q,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:W});return J(Q,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:W})},BJ=new Map(y.map((W)=>[W.userId||W.id,W]));return J("div",{className:"space-y-6",children:K(u,{className:"border border-border/50 shadow-xs",children:[K(g,{className:"pb-4",children:[K("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[K("div",{children:[K(b,{className:"text-xl font-bold flex items-center gap-2",children:[J(s,{className:"h-5 w-5 text-primary"}),Y.audit_logs()]}),J(c,{className:"mt-1",children:Y.audit_logs_description()})]}),zJ>0&&K(Q,{variant:"secondary",className:"w-fit text-xs font-normal",children:[zJ," ",Y.audit_logs()]})]}),K("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[K($J,{children:[J(OJ,{asChild:!0,children:K(d,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(YJ,{className:"h-3.5 w-3.5"}),Y.filter_by_action(),X.length>0&&J(Q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:X.length})]})}),K(XJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:Y.select_actions()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:hJ.map((W)=>K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(ZJ,{checked:X.includes(W),onCheckedChange:()=>LJ(W)}),J("span",{className:"font-mono",children:W})]},W))}),X.length>0&&J(d,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>k([]),children:"Clear Actions"})]})]}),K($J,{children:[J(OJ,{asChild:!0,children:K(d,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(YJ,{className:"h-3.5 w-3.5"}),Y.filter_by_user(),V.length>0&&J(Q,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:V.length})]})}),K(XJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:Y.select_users()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:y.map((W)=>{let E=W.userId||W.user?.id||W.id,w=W.user?.name||W.name||E,JJ=W.user?.image||W.image;return K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(ZJ,{checked:V.includes(E),onCheckedChange:()=>UJ(E)}),K(v,{className:"h-5 w-5",children:[J(p,{src:JJ||void 0}),J(I,{className:"text-[10px]",children:w.slice(0,2).toUpperCase()})]}),J("span",{className:"truncate",children:w})]},E)})}),V.length>0&&J(d,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>R([]),children:"Clear Users"})]})]}),K("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[J(GJ,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),J(kJ,{type:"text",placeholder:Y.search_item_id(),value:q,onChange:(W)=>F(W.target.value),className:"pl-8 pr-8 h-9 text-xs"}),q&&J("button",{onClick:()=>F(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:J(QJ,{className:"h-4 w-4"})})]}),(X.length>0||V.length>0||q)&&J(d,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{k([]),R([]),F("")},children:"Clear all"})]})]}),K(n,{className:"p-0",children:[x?J("div",{className:"flex h-64 items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):$?J("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):U.length===0?J("div",{className:"p-12 text-center text-sm text-muted-foreground",children:Y.no_audit_logs()}):K(P,{children:[J(A,{children:K(D,{className:"hover:bg-transparent border-b border-border/50",children:[J(z,{className:"w-[180px] text-xs font-semibold",children:Y.action()}),J(z,{className:"w-[200px] text-xs font-semibold",children:Y.user()}),J(z,{className:"text-xs font-semibold",children:Y.item_id()}),J(z,{className:"text-xs font-semibold",children:Y.project_id()}),J(z,{className:"w-[160px] text-right text-xs font-semibold",children:Y.timestamp()})]})}),J(C,{children:U.map((W)=>{let E=W.userId?BJ.get(W.userId):null,w=E?.user?.name||E?.name||W.userId||"System",JJ=E?.user?.image||E?.image;return K(D,{className:"hover:bg-muted/40 transition-colors",children:[J(_,{className:"py-3 font-medium",children:FJ(W.action)}),J(_,{className:"py-3",children:K("div",{className:"flex items-center gap-2",children:[K(v,{className:"h-6 w-6",children:[J(p,{src:JJ||void 0}),J(I,{className:"text-[10px]",children:w.slice(0,2).toUpperCase()})]}),J("span",{className:"text-xs font-medium text-foreground truncate max-w-[140px]",children:w})]})}),J(_,{className:"py-3 text-xs font-mono text-muted-foreground",children:W.itemId||"-"}),J(_,{className:"py-3 text-xs font-mono text-muted-foreground",children:W.projectId||"-"}),J(_,{className:"py-3 text-right text-xs text-muted-foreground",children:m(W.createdAt)})]},W.id)})})]}),J("div",{ref:T,className:"py-4 flex justify-center",children:G&&J(N,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function HJ(){let{teamId:O}=SJ.useParams(),[X,k]=yJ.useState("audit-logs"),{data:V,isLoading:R}=f({queryKey:["teams",O,"me"],queryFn:async()=>{let q=await M.api.teams[":teamId"].me.$get({param:{teamId:O}});if(!q.ok)throw Error("Failed to fetch me");return await q.json()},enabled:!!O});if(R)return J("div",{className:"flex h-screen items-center justify-center",children:J(N,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(V?.role?.toLowerCase()!=="owner")return K("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[J(wJ,{className:"h-12 w-12 text-destructive mb-4"}),J("h2",{className:"text-xl font-bold tracking-tight mb-2",children:Y.access_denied()}),J("p",{className:"text-sm text-muted-foreground max-w-md",children:Y.only_owner_dashboard()})]});return J("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:K("div",{className:"flex flex-col md:flex-row h-full",children:[J("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:K("nav",{className:"p-4 space-y-1 mt-4",children:[J("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:Y.dashboard()}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:Y.team_category()}),K("button",{onClick:()=>k("audit-logs"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(s,{className:"w-5 h-5"}),Y.audit_logs(),X==="audit-logs"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:Y.ai()}),K("button",{onClick:()=>k("ai-usage"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(RJ,{className:"w-5 h-5"}),Y.usage(),X==="ai-usage"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>k("ai-sessions"),className:e("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",X==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(i,{className:"w-5 h-5"}),Y.sessions(),X==="ai-sessions"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),J("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:K("div",{className:"max-w-6xl mx-auto space-y-8",children:[X==="audit-logs"&&J(MJ,{teamId:O}),X==="ai-usage"&&J(EJ,{teamId:O}),X==="ai-sessions"&&J(qJ,{teamId:O})]})})]})})}var SJ=NJ("/teams/$teamId/dashboard")({component:HJ});export{SJ as Route};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{El as w,Fl as T}from"./chunk-hcvpb1hw.js";function S(B,Q){return{role:"assistant",content:[],api:B.api,provider:B.provider,model:B.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:Q instanceof Error?Q.message:String(Q),timestamp:Date.now()}}function f(B){return typeof B.result==="function"}async function L(B,Q){for await(let Y of Q)B.push(Y);B.end(f(Q)?await Q.result():void 0)}function H(B,Q){let Y=new w;return Q().then((Z)=>L(Y,Z)).catch((Z)=>{let $=S(B,Z);Y.push({type:"error",reason:"error",error:$}),Y.end($)}),Y}function g(B){return{stream:(Q,Y,Z)=>H(Q,async()=>(await B()).stream(Q,Y,Z)),streamSimple:(Q,Y,Z)=>H(Q,async()=>(await B()).streamSimple(Q,Y,Z))}}var b=function(B,Q){if(typeof B==="string"&&/^\.\.?\//.test(B))return B.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(Y,Z,$,F,J){return Z?Q?".jsx":".js":$&&(!F||!J)?Y:$+F+"."+J.toLowerCase()+"js"});return B},A=(B)=>import(b(B));function N(){return globalThis.process?.env}function C(){return{async env(B){let Q=N()?.[B];return typeof Q==="string"&&Q.trim().length>0?Q:void 0},async fileExists(B){try{let Q=await A("node:fs/promises"),Y=B;if(Y.startsWith("~"))Y=(await A("node:os")).homedir()+Y.slice(1);return await Q.access(Y),!0}catch{return!1}}}}class D{credentials=new Map;chains=new Map;enqueue(B,Q){let Y=this.chains.get(B)??Promise.resolve(),Z=(async()=>{return await Y.catch(()=>{}),Q()})();return this.chains.set(B,Z.catch(()=>{})),Z}async read(B){return this.credentials.get(B)}async list(){return[...this.credentials].map(([B,Q])=>({providerId:B,type:Q.type}))}modify(B,Q){return this.enqueue(B,async()=>{let Y=this.credentials.get(B),Z=await Q(Y);if(Z!==void 0)this.credentials.set(B,Z);return Z??Y})}delete(B){return this.enqueue(B,async()=>{this.credentials.delete(B)})}}class G extends Error{code;constructor(B,Q,Y){super(y(Q,Y?.cause),Y);this.name="ModelsError",this.code=B}}function y(B,Q){if(Q===void 0||Q===null)return B;let Y=T(Q).trim();if(!Y||B.includes(Y))return B;return`${B}: ${Y}`}async function _(B,Q,Y,Z){let $=Z?.env?E(Y,Z.env):Y;if(Z?.apiKey!==void 0&&B.auth.apiKey)return q($,B.auth.apiKey,B.id,{type:"api_key",key:Z.apiKey,env:Z.env});let F=await x(Q,B.id);if(F){if(F.type==="oauth"&&B.auth.oauth)return M(Q,B.id,B.auth.oauth,F);if(F.type==="api_key"&&B.auth.apiKey){let J=Z?.env?{...F,env:{...F.env,...Z.env}}:F;return q($,B.auth.apiKey,B.id,J)}return}return B.auth.apiKey?q($,B.auth.apiKey,B.id,void 0):void 0}function E(B,Q){return{env:async(Y)=>Q[Y]||await B.env(Y),fileExists:(Y)=>B.fileExists(Y)}}async function M(B,Q,Y,Z){let $=Z;if(Date.now()>=$.expires){let F;try{F=await B.modify(Q,async(J)=>{if(J?.type!=="oauth")return;if(Date.now()<J.expires)return;try{return await Y.refresh(J)}catch(W){throw new G("oauth",`OAuth refresh failed for ${Q}`,{cause:W})}})}catch(J){if(J instanceof G)throw J;throw new G("auth",`Credential store modify failed for ${Q}`,{cause:J})}if(F?.type!=="oauth")return;$=F}try{return{auth:await Y.toAuth($),source:"OAuth"}}catch(F){throw new G("oauth",`OAuth auth derivation failed for ${Q}`,{cause:F})}}async function q(B,Q,Y,Z){try{return await Q.resolve({ctx:B,credential:Z})}catch($){throw new G("auth",`API key auth failed for provider ${Y}`,{cause:$})}}async function x(B,Q){try{return await B.read(Q)}catch(Y){throw new G("auth",`Credential store read failed for ${Q}`,{cause:Y})}}class j{entries=new Map;async read(B){let Q=this.entries.get(B);return Q?structuredClone(Q):void 0}async write(B,Q){this.entries.set(B,structuredClone(Q))}async delete(B){this.entries.delete(B)}}function K(B,Q){if(!B&&!Q)return;let Y={...B};for(let[Z,$]of Object.entries(Q??{})){let F=Z.toLowerCase();for(let J of Object.keys(Y))if(J.toLowerCase()===F)delete Y[J];Y[Z]=$}return Y}class O{providers=new Map;credentials;modelsStore;authContext;constructor(B){this.credentials=B?.credentials??new D,this.modelsStore=B?.modelsStore??new j,this.authContext=B?.authContext??C()}setProvider(B){this.providers.set(B.id,B)}deleteProvider(B){this.providers.delete(B)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(B){return this.providers.get(B)}getModels(B){if(B!==void 0){let Y=this.providers.get(B);if(!Y)return[];try{return Y.getModels()}catch{return[]}}let Q=[];for(let Y of this.providers.values())try{Q.push(...Y.getModels())}catch{}return Q}getModel(B,Q){return this.getModels(B).find((Y)=>Y.id===Q)}async refresh(B={}){let Q=B.allowNetwork??!0,Y=new Map,Z=Array.from(this.providers.values()).filter(($)=>$.refreshModels!==void 0);return await Promise.all(Z.map(async($)=>{if(B.signal?.aborted)return;let F={read:()=>this.modelsStore.read($.id),write:(W)=>this.modelsStore.write($.id,W),delete:()=>this.modelsStore.delete($.id)},J;try{J=await this.readCredential($.id);let W=await this.resolveRefreshCredential($,J,Q,B.signal);if(!W)return;await $.refreshModels({credential:W,store:F,allowNetwork:Q,force:B.force,signal:B.signal})}catch(W){if(!B.signal?.aborted)Y.set($.id,W instanceof Error?W:new G("model_source",`Model refresh failed for ${$.id}`,{cause:W}));try{await $.refreshModels({credential:J,store:F,allowNetwork:!1,signal:B.signal})}catch{}}})),{aborted:B.signal?.aborted??!1,errors:Y}}async resolveRefreshCredential(B,Q,Y,Z){if(Q?.type==="oauth"){let W=B.auth.oauth;if(!W)return;if(!Y||Date.now()<Q.expires)return Q;if(Z?.aborted)return;let k=await this.credentials.modify(B.id,async(z)=>{if(z?.type!=="oauth"||Date.now()<z.expires)return;return W.refresh(z,Z)});return k?.type==="oauth"?k:void 0}let $=B.auth.apiKey;if(!$)return;let F=Q?.type==="api_key"?Q:void 0,J=await $.resolve({ctx:this.authContext,credential:F});if(!J)return;return{type:"api_key",key:J.auth.apiKey,env:J.env}}async readCredential(B){try{return await this.credentials.read(B)}catch(Q){throw new G("auth",`Credential store read failed for ${B}`,{cause:Q})}}async checkProviderAuth(B,Q){if(Q?.type==="oauth")return B.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let Y=B.auth.apiKey;if(!Y)return;if(Y.check)try{return await Y.check({ctx:this.authContext,credential:Q?.type==="api_key"?Q:void 0})}catch($){throw new G("auth",`API key auth check failed for provider ${B.id}`,{cause:$})}let Z=await _(B,this.credentials,this.authContext);return Z?{source:Z.source,type:"api_key"}:void 0}async checkAuth(B){let Q=this.providers.get(B);if(!Q)return;return this.checkProviderAuth(Q,await this.readCredential(B))}async getAvailable(B){let Q=B?[this.providers.get(B)].filter((Z)=>Z!==void 0):this.getProviders();return(await Promise.all(Q.map(async(Z)=>{let $=await this.readCredential(Z.id);return{provider:Z,credential:$,auth:await this.checkProviderAuth(Z,$)}}))).flatMap(({provider:Z,credential:$,auth:F})=>{if(!F)return[];let J=Z.getModels();return Z.filterModels?.(J,$)??J})}async getAuth(B,Q){let Y=typeof B==="string"?B:B.provider,Z=this.providers.get(Y);if(!Z)return;let $=await _(Z,this.credentials,this.authContext,Q);if(!$||typeof B==="string"||!B.headers)return $;return{...$,auth:{...$.auth,headers:K($.auth.headers,B.headers)}}}async login(B,Q,Y){let Z=this.providers.get(B);if(!Z)throw new G("provider",`Unknown provider: ${B}`);let $=Q==="oauth"?Z.auth.oauth:Z.auth.apiKey;if(!$?.login)throw new G("auth",`${Z.name} does not support ${Q} login`);let F=await $.login(Y);try{await this.credentials.modify(B,async()=>F)}catch(J){throw new G("auth",`Credential store modify failed for ${B}`,{cause:J})}return F}async logout(B){try{await this.credentials.delete(B)}catch(Q){throw new G("auth",`Credential store delete failed for ${B}`,{cause:Q})}}requireProvider(B){let Q=this.providers.get(B.provider);if(!Q)throw new G("provider",`Unknown provider: ${B.provider}`);return Q}async applyAuth(B,Q){this.requireProvider(B);let Y=await this.getAuth(B,{apiKey:Q?.apiKey,env:Q?.env});if(!Y)throw new G("auth",`Provider is not configured: ${B.provider}`);let Z=Y.auth,$=Q?.apiKey??Z.apiKey,F=K(Z.headers,Q?.headers);if(Q?.transformHeaders)F=await Q.transformHeaders(F??{});let J=Y.env||Q?.env?{...Y.env??{},...Q?.env??{}}:void 0,W=Z.baseUrl?{...B,baseUrl:Z.baseUrl}:B,{transformHeaders:k,...z}=Q??{},P={...z,apiKey:$,headers:F,env:J};return{requestModel:W,requestOptions:P}}stream(B,Q,Y){return H(B,async()=>{let Z=this.requireProvider(B),{requestModel:$,requestOptions:F}=await this.applyAuth(B,Y);return Z.stream($,Q,F)})}async complete(B,Q,Y){return this.stream(B,Q,Y).result()}streamSimple(B,Q,Y){return H(B,async()=>{let Z=this.requireProvider(B),{requestModel:$,requestOptions:F}=await this.applyAuth(B,Y);return Z.streamSimple($,Q,F)})}async completeSimple(B,Q,Y){return this.streamSimple(B,Q,Y).result()}}function d(B){return new O(B)}function o(B){let Q=B.models,Y=[],Z,$=B.fetchModels,F=()=>{let P=[...Q];for(let U of Y){let X=P.findIndex((V)=>V.id===U.id);if(X>=0)P[X]=U;else P.push(U)}return P},J=typeof B.api.stream==="function"?B.api:void 0,W=J?void 0:B.api,k=(P)=>J??W?.[P.api],z=(P,U)=>{let X=k(P);if(!X)return H(P,async()=>{throw new G("stream",`Provider ${B.id} has no API implementation for "${P.api}"`)});return U(X)};return{id:B.id,name:B.name??B.id,baseUrl:B.baseUrl,headers:B.headers,auth:B.auth,getModels:F,refreshModels:$?(P)=>{return Z??=(async()=>{try{let U=await P.store.read();if(U)Y=U.models.filter((V)=>V.provider===B.id).map((V)=>V);if(!P.allowNetwork||P.signal?.aborted)return;let X=await $(P);if(P.signal?.aborted)return;Y=X,await P.store.write({models:X,checkedAt:Date.now()})}finally{Z=void 0}})(),Z}:void 0,filterModels:B.filterModels,stream:(P,U,X)=>z(P,(V)=>V.stream(P,U,X)),streamSimple:(P,U,X)=>z(P,(V)=>V.streamSimple(P,U,X))}}function r(B,Q){let Y=Q.input+Q.cacheRead+Q.cacheWrite,Z=B.cost,$=-1;for(let W of B.cost.tiers??[])if(Y>W.inputTokensAbove&&W.inputTokensAbove>$)Z=W,$=W.inputTokensAbove;let F=Q.cacheWrite1h??0,J=Q.cacheWrite-F;return Q.cost.input=Z.input/1e6*Q.input,Q.cost.output=Z.output/1e6*Q.output,Q.cost.cacheRead=Z.cacheRead/1e6*Q.cacheRead,Q.cost.cacheWrite=(Z.cacheWrite*J+Z.input*2*F)/1e6,Q.cost.total=Q.cost.input+Q.cost.output+Q.cost.cacheRead+Q.cost.cacheWrite,Q.cost}var R=["off","minimal","low","medium","high","xhigh","max"];function h(B){if(!B.reasoning)return["off"];return R.filter((Q)=>{let Y=B.thinkingLevelMap?.[Q];if(Y===null)return!1;if(Q==="xhigh"||Q==="max")return Y!==void 0;return!0})}function e(B,Q){let Y=h(B);if(Y.includes(Q))return Q;let Z=R.indexOf(Q);if(Z===-1)return Y[0]??"off";for(let $=Z;$<R.length;$++){let F=R[$];if(Y.includes(F))return F}for(let $=Z-1;$>=0;$--){let F=R[$];if(Y.includes(F))return F}return Y[0]??"off"}
3
- export{g as yl,D as zl,d as Al,o as Bl,r as Cl,e as Dl};
2
+ import{Jl as w,Kl as T}from"./chunk-a0k1b4sq.js";function S(B,Q){return{role:"assistant",content:[],api:B.api,provider:B.provider,model:B.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:Q instanceof Error?Q.message:String(Q),timestamp:Date.now()}}function f(B){return typeof B.result==="function"}async function L(B,Q){for await(let Y of Q)B.push(Y);B.end(f(Q)?await Q.result():void 0)}function H(B,Q){let Y=new w;return Q().then((Z)=>L(Y,Z)).catch((Z)=>{let $=S(B,Z);Y.push({type:"error",reason:"error",error:$}),Y.end($)}),Y}function g(B){return{stream:(Q,Y,Z)=>H(Q,async()=>(await B()).stream(Q,Y,Z)),streamSimple:(Q,Y,Z)=>H(Q,async()=>(await B()).streamSimple(Q,Y,Z))}}var b=function(B,Q){if(typeof B==="string"&&/^\.\.?\//.test(B))return B.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(Y,Z,$,F,J){return Z?Q?".jsx":".js":$&&(!F||!J)?Y:$+F+"."+J.toLowerCase()+"js"});return B},A=(B)=>import(b(B));function N(){return globalThis.process?.env}function C(){return{async env(B){let Q=N()?.[B];return typeof Q==="string"&&Q.trim().length>0?Q:void 0},async fileExists(B){try{let Q=await A("node:fs/promises"),Y=B;if(Y.startsWith("~"))Y=(await A("node:os")).homedir()+Y.slice(1);return await Q.access(Y),!0}catch{return!1}}}}class D{credentials=new Map;chains=new Map;enqueue(B,Q){let Y=this.chains.get(B)??Promise.resolve(),Z=(async()=>{return await Y.catch(()=>{}),Q()})();return this.chains.set(B,Z.catch(()=>{})),Z}async read(B){return this.credentials.get(B)}async list(){return[...this.credentials].map(([B,Q])=>({providerId:B,type:Q.type}))}modify(B,Q){return this.enqueue(B,async()=>{let Y=this.credentials.get(B),Z=await Q(Y);if(Z!==void 0)this.credentials.set(B,Z);return Z??Y})}delete(B){return this.enqueue(B,async()=>{this.credentials.delete(B)})}}class G extends Error{code;constructor(B,Q,Y){super(y(Q,Y?.cause),Y);this.name="ModelsError",this.code=B}}function y(B,Q){if(Q===void 0||Q===null)return B;let Y=T(Q).trim();if(!Y||B.includes(Y))return B;return`${B}: ${Y}`}async function _(B,Q,Y,Z){let $=Z?.env?E(Y,Z.env):Y;if(Z?.apiKey!==void 0&&B.auth.apiKey)return q($,B.auth.apiKey,B.id,{type:"api_key",key:Z.apiKey,env:Z.env});let F=await x(Q,B.id);if(F){if(F.type==="oauth"&&B.auth.oauth)return M(Q,B.id,B.auth.oauth,F);if(F.type==="api_key"&&B.auth.apiKey){let J=Z?.env?{...F,env:{...F.env,...Z.env}}:F;return q($,B.auth.apiKey,B.id,J)}return}return B.auth.apiKey?q($,B.auth.apiKey,B.id,void 0):void 0}function E(B,Q){return{env:async(Y)=>Q[Y]||await B.env(Y),fileExists:(Y)=>B.fileExists(Y)}}async function M(B,Q,Y,Z){let $=Z;if(Date.now()>=$.expires){let F;try{F=await B.modify(Q,async(J)=>{if(J?.type!=="oauth")return;if(Date.now()<J.expires)return;try{return await Y.refresh(J)}catch(W){throw new G("oauth",`OAuth refresh failed for ${Q}`,{cause:W})}})}catch(J){if(J instanceof G)throw J;throw new G("auth",`Credential store modify failed for ${Q}`,{cause:J})}if(F?.type!=="oauth")return;$=F}try{return{auth:await Y.toAuth($),source:"OAuth"}}catch(F){throw new G("oauth",`OAuth auth derivation failed for ${Q}`,{cause:F})}}async function q(B,Q,Y,Z){try{return await Q.resolve({ctx:B,credential:Z})}catch($){throw new G("auth",`API key auth failed for provider ${Y}`,{cause:$})}}async function x(B,Q){try{return await B.read(Q)}catch(Y){throw new G("auth",`Credential store read failed for ${Q}`,{cause:Y})}}class j{entries=new Map;async read(B){let Q=this.entries.get(B);return Q?structuredClone(Q):void 0}async write(B,Q){this.entries.set(B,structuredClone(Q))}async delete(B){this.entries.delete(B)}}function K(B,Q){if(!B&&!Q)return;let Y={...B};for(let[Z,$]of Object.entries(Q??{})){let F=Z.toLowerCase();for(let J of Object.keys(Y))if(J.toLowerCase()===F)delete Y[J];Y[Z]=$}return Y}class O{providers=new Map;credentials;modelsStore;authContext;constructor(B){this.credentials=B?.credentials??new D,this.modelsStore=B?.modelsStore??new j,this.authContext=B?.authContext??C()}setProvider(B){this.providers.set(B.id,B)}deleteProvider(B){this.providers.delete(B)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(B){return this.providers.get(B)}getModels(B){if(B!==void 0){let Y=this.providers.get(B);if(!Y)return[];try{return Y.getModels()}catch{return[]}}let Q=[];for(let Y of this.providers.values())try{Q.push(...Y.getModels())}catch{}return Q}getModel(B,Q){return this.getModels(B).find((Y)=>Y.id===Q)}async refresh(B={}){let Q=B.allowNetwork??!0,Y=new Map,Z=Array.from(this.providers.values()).filter(($)=>$.refreshModels!==void 0);return await Promise.all(Z.map(async($)=>{if(B.signal?.aborted)return;let F={read:()=>this.modelsStore.read($.id),write:(W)=>this.modelsStore.write($.id,W),delete:()=>this.modelsStore.delete($.id)},J;try{J=await this.readCredential($.id);let W=await this.resolveRefreshCredential($,J,Q,B.signal);if(!W)return;await $.refreshModels({credential:W,store:F,allowNetwork:Q,force:B.force,signal:B.signal})}catch(W){if(!B.signal?.aborted)Y.set($.id,W instanceof Error?W:new G("model_source",`Model refresh failed for ${$.id}`,{cause:W}));try{await $.refreshModels({credential:J,store:F,allowNetwork:!1,signal:B.signal})}catch{}}})),{aborted:B.signal?.aborted??!1,errors:Y}}async resolveRefreshCredential(B,Q,Y,Z){if(Q?.type==="oauth"){let W=B.auth.oauth;if(!W)return;if(!Y||Date.now()<Q.expires)return Q;if(Z?.aborted)return;let k=await this.credentials.modify(B.id,async(z)=>{if(z?.type!=="oauth"||Date.now()<z.expires)return;return W.refresh(z,Z)});return k?.type==="oauth"?k:void 0}let $=B.auth.apiKey;if(!$)return;let F=Q?.type==="api_key"?Q:void 0,J=await $.resolve({ctx:this.authContext,credential:F});if(!J)return;return{type:"api_key",key:J.auth.apiKey,env:J.env}}async readCredential(B){try{return await this.credentials.read(B)}catch(Q){throw new G("auth",`Credential store read failed for ${B}`,{cause:Q})}}async checkProviderAuth(B,Q){if(Q?.type==="oauth")return B.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let Y=B.auth.apiKey;if(!Y)return;if(Y.check)try{return await Y.check({ctx:this.authContext,credential:Q?.type==="api_key"?Q:void 0})}catch($){throw new G("auth",`API key auth check failed for provider ${B.id}`,{cause:$})}let Z=await _(B,this.credentials,this.authContext);return Z?{source:Z.source,type:"api_key"}:void 0}async checkAuth(B){let Q=this.providers.get(B);if(!Q)return;return this.checkProviderAuth(Q,await this.readCredential(B))}async getAvailable(B){let Q=B?[this.providers.get(B)].filter((Z)=>Z!==void 0):this.getProviders();return(await Promise.all(Q.map(async(Z)=>{let $=await this.readCredential(Z.id);return{provider:Z,credential:$,auth:await this.checkProviderAuth(Z,$)}}))).flatMap(({provider:Z,credential:$,auth:F})=>{if(!F)return[];let J=Z.getModels();return Z.filterModels?.(J,$)??J})}async getAuth(B,Q){let Y=typeof B==="string"?B:B.provider,Z=this.providers.get(Y);if(!Z)return;let $=await _(Z,this.credentials,this.authContext,Q);if(!$||typeof B==="string"||!B.headers)return $;return{...$,auth:{...$.auth,headers:K($.auth.headers,B.headers)}}}async login(B,Q,Y){let Z=this.providers.get(B);if(!Z)throw new G("provider",`Unknown provider: ${B}`);let $=Q==="oauth"?Z.auth.oauth:Z.auth.apiKey;if(!$?.login)throw new G("auth",`${Z.name} does not support ${Q} login`);let F=await $.login(Y);try{await this.credentials.modify(B,async()=>F)}catch(J){throw new G("auth",`Credential store modify failed for ${B}`,{cause:J})}return F}async logout(B){try{await this.credentials.delete(B)}catch(Q){throw new G("auth",`Credential store delete failed for ${B}`,{cause:Q})}}requireProvider(B){let Q=this.providers.get(B.provider);if(!Q)throw new G("provider",`Unknown provider: ${B.provider}`);return Q}async applyAuth(B,Q){this.requireProvider(B);let Y=await this.getAuth(B,{apiKey:Q?.apiKey,env:Q?.env});if(!Y)throw new G("auth",`Provider is not configured: ${B.provider}`);let Z=Y.auth,$=Q?.apiKey??Z.apiKey,F=K(Z.headers,Q?.headers);if(Q?.transformHeaders)F=await Q.transformHeaders(F??{});let J=Y.env||Q?.env?{...Y.env??{},...Q?.env??{}}:void 0,W=Z.baseUrl?{...B,baseUrl:Z.baseUrl}:B,{transformHeaders:k,...z}=Q??{},P={...z,apiKey:$,headers:F,env:J};return{requestModel:W,requestOptions:P}}stream(B,Q,Y){return H(B,async()=>{let Z=this.requireProvider(B),{requestModel:$,requestOptions:F}=await this.applyAuth(B,Y);return Z.stream($,Q,F)})}async complete(B,Q,Y){return this.stream(B,Q,Y).result()}streamSimple(B,Q,Y){return H(B,async()=>{let Z=this.requireProvider(B),{requestModel:$,requestOptions:F}=await this.applyAuth(B,Y);return Z.streamSimple($,Q,F)})}async completeSimple(B,Q,Y){return this.streamSimple(B,Q,Y).result()}}function d(B){return new O(B)}function o(B){let Q=B.models,Y=[],Z,$=B.fetchModels,F=()=>{let P=[...Q];for(let U of Y){let X=P.findIndex((V)=>V.id===U.id);if(X>=0)P[X]=U;else P.push(U)}return P},J=typeof B.api.stream==="function"?B.api:void 0,W=J?void 0:B.api,k=(P)=>J??W?.[P.api],z=(P,U)=>{let X=k(P);if(!X)return H(P,async()=>{throw new G("stream",`Provider ${B.id} has no API implementation for "${P.api}"`)});return U(X)};return{id:B.id,name:B.name??B.id,baseUrl:B.baseUrl,headers:B.headers,auth:B.auth,getModels:F,refreshModels:$?(P)=>{return Z??=(async()=>{try{let U=await P.store.read();if(U)Y=U.models.filter((V)=>V.provider===B.id).map((V)=>V);if(!P.allowNetwork||P.signal?.aborted)return;let X=await $(P);if(P.signal?.aborted)return;Y=X,await P.store.write({models:X,checkedAt:Date.now()})}finally{Z=void 0}})(),Z}:void 0,filterModels:B.filterModels,stream:(P,U,X)=>z(P,(V)=>V.stream(P,U,X)),streamSimple:(P,U,X)=>z(P,(V)=>V.streamSimple(P,U,X))}}function r(B,Q){let Y=Q.input+Q.cacheRead+Q.cacheWrite,Z=B.cost,$=-1;for(let W of B.cost.tiers??[])if(Y>W.inputTokensAbove&&W.inputTokensAbove>$)Z=W,$=W.inputTokensAbove;let F=Q.cacheWrite1h??0,J=Q.cacheWrite-F;return Q.cost.input=Z.input/1e6*Q.input,Q.cost.output=Z.output/1e6*Q.output,Q.cost.cacheRead=Z.cacheRead/1e6*Q.cacheRead,Q.cost.cacheWrite=(Z.cacheWrite*J+Z.input*2*F)/1e6,Q.cost.total=Q.cost.input+Q.cost.output+Q.cost.cacheRead+Q.cost.cacheWrite,Q.cost}var R=["off","minimal","low","medium","high","xhigh","max"];function h(B){if(!B.reasoning)return["off"];return R.filter((Q)=>{let Y=B.thinkingLevelMap?.[Q];if(Y===null)return!1;if(Q==="xhigh"||Q==="max")return Y!==void 0;return!0})}function e(B,Q){let Y=h(B);if(Y.includes(Q))return Q;let Z=R.indexOf(Q);if(Z===-1)return Y[0]??"off";for(let $=Z;$<R.length;$++){let F=R[$];if(Y.includes(F))return F}for(let $=Z-1;$>=0;$--){let F=R[$];if(Y.includes(F))return F}return Y[0]??"off"}
3
+ export{g as Dl,D as El,d as Fl,o as Gl,r as Hl,e as Il};
@@ -1,2 +1,2 @@
1
- import{mk as e,wk as r,xh as t}from"./chunk-jt4yh37q.js";function m({...o}){return t(e.Root,{"data-slot":"popover",...o})}function s({...o}){return t(e.Trigger,{"data-slot":"popover-trigger",...o})}function v({className:o,align:n="center",sideOffset:a=4,...i}){return t(e.Portal,{children:t(e.Content,{"data-slot":"popover-content",align:n,sideOffset:a,className:r("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",o),...i})})}
2
- export{m as da,s as ea,v as fa};
1
+ import{Ak as r,qk as e,zh as t}from"./chunk-m6a4rzdt.js";function m({...o}){return t(e.Root,{"data-slot":"popover",...o})}function s({...o}){return t(e.Trigger,{"data-slot":"popover-trigger",...o})}function v({className:o,align:n="center",sideOffset:a=4,...i}){return t(e.Portal,{children:t(e.Content,{"data-slot":"popover-content",align:n,sideOffset:a,className:r("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",o),...i})})}
2
+ export{m as ca,s as da,v as ea};
@@ -1 +1 @@
1
- import{c as a,d as s,e,f as E,g as $,h as q}from"./chunk-sx7kparv.js";import{oa as t}from"./chunk-vw1rhgjs.js";import{cb as r}from"./chunk-ef5v7gta.js";import"./chunk-gct52xks.js";import{gb as x}from"./chunk-mmrtjcst.js";import{hb as j}from"./chunk-ce50f746.js";import"./chunk-d2qp8g98.js";import{Bf as l}from"./chunk-9annjnj2.js";import{Qf as o}from"./chunk-9hsfjqgq.js";import{Cg as i}from"./chunk-4a9sdfyp.js";import{Dg as d}from"./chunk-n198tewr.js";import{rh as h}from"./chunk-w98wvk17.js";import{$h as A,Ak as c,Bk as n,Dh as y,Di as T,Eh as F,Ek as X,Fh as S,Kh as P,Kj as u,Ph as C,Qi as g,Ui as b,Zh as B,hj as I,ki as f,vh as OG,wh as k,xh as G,yh as K,yk as m,zh as L,zk as p}from"./chunk-jt4yh37q.js";import{Il as qG}from"./chunk-mgbqjbfc.js";var _=qG(OG(),1);var zG=(Y)=>{if(!Y)return"??";return Y.split(" ").map((z)=>z[0]).slice(0,2).join("").toUpperCase()};function BG(){let{projectId:Y}=MG.useParams(),{teamId:z,ensureTeamIdForProject:U}=h(),GG=L(),JG=P();_.useEffect(()=>{U(Y)},[Y,U]);let{data:M}=y(l(Y)),D=M?.rootFolder,[KG,XG]=_.useState(240),{shareConfigLeftSidebarCollapsed:Q,setShareConfigLeftSidebarCollapsed:YG}=i(),{data:V,isLoading:ZG,fetchNextPage:R,hasNextPage:v,isFetchingNextPage:W}=S({queryKey:["shares",Y],queryFn:async({pageParam:J})=>{let Z=await A.api.projects[":projectId"].shares.$get({param:{projectId:Y},query:{first:"20",after:J}});if(!Z.ok)throw Error("Failed to fetch share links");return await Z.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!Y}),{ref:_G,inView:w}=d();_.useEffect(()=>{if(w&&v&&!W)R()},[w,v,W,R]);let H=_.useMemo(()=>V?.pages.flatMap((J)=>J.data)||[],[V]),{mutate:$G}=F({mutationFn:async({id:J,isDisabled:Z})=>{let O=await A.api.shares[":shareId"].$put({param:{shareId:J},json:{isDisabled:Z}});if(!O.ok)throw Error("Failed to update share link");return await O.json()},onSuccess:()=>{GG.invalidateQueries({queryKey:["shares",Y]}),B.success(X.share_link_status_updated())},onError:(J)=>{B.error(X.error_message({message:J.message}))}});if(!z||!D||!M)return G(o,{});let N=async(J)=>{let Z=`${window.location.origin}/share/${J}`;if(await x(Z))B.success(X.link_copied())};return G("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!Q&&G("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>YG(!0)}),!Q&&K(k,{children:[G("div",{className:"bg-background",style:{width:KG},children:G(t,{teamId:z,projectId:Y,projectName:M.name??"",rootFolderId:D})}),G(r,{onResize:(J)=>{XG((Z)=>Math.max(180,Math.min(400,Z+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[G("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[G(u,{className:"h-5 w-5 text-primary"}),G("h1",{className:"font-bold text-lg text-foreground",children:X.all_share_links()})]})}),G("div",{className:"flex-1 overflow-y-auto p-6",children:ZG?G("div",{className:"flex justify-center items-center h-64",children:G("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):H.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[G(I,{className:"h-10 w-10 text-muted-foreground/50"}),G("p",{children:X.no_share_links_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(a,{children:[G(s,{children:K(E,{className:"hover:bg-transparent bg-muted/20",children:[G($,{className:"font-semibold px-4 py-3",children:X.name()}),G($,{className:"font-semibold px-4 py-3",children:X.public_link()}),G($,{className:"font-semibold px-4 py-3",children:X.creator()}),G($,{className:"font-semibold px-4 py-3 w-[150px]",children:X.created_date()}),G($,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:X.active()})]})}),G(e,{children:H.map((J)=>{let Z=`${window.location.origin}/share/${J.id}`;return K(E,{className:"hover:bg-muted/10 transition-colors",children:[G(q,{className:"font-medium px-4 py-3.5",children:G("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>JG({to:"/projects/$projectId/shares/$shareId",params:{projectId:Y,shareId:J.id}}),children:J.name})}),G(q,{className:"px-4 py-3.5 max-w-[300px]",children:K("div",{className:"flex items-center gap-2 group",children:[G("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>N(J.id),title:X.click_to_copy_link(),children:Z}),G(m,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>N(J.id),children:G(g,{className:"h-3.5 w-3.5"})}),G("a",{href:Z,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:G(b,{className:"h-3.5 w-3.5"})})]})}),G(q,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(p,{className:"h-6 w-6",children:[J.creator?.image&&G(c,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),G(n,{className:"text-[10px]",children:zG(J.creator?.name)})]}),G("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:J.creator?.name||X.unknown()})]})}),G(q,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[G(T,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),G("span",{children:new Date(J.createdAt).toLocaleDateString()})]})}),G(q,{className:"px-4 py-3.5 text-right",children:G("div",{className:"flex justify-end",children:G(j,{checked:!J.isDisabled,onCheckedChange:(O)=>$G({id:J.id,isDisabled:!O})})})})]},J.id)})})]}),G("div",{ref:_G,className:"h-10 w-full flex items-center justify-center",children:W&&G(f,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var MG=C("/projects/$projectId/shares/")({component:BG});export{MG as Route};
1
+ import{a,b as s,c as e,d as E,e as $,f as q}from"./chunk-b3jh3hf1.js";import{qa as t}from"./chunk-tpp9qf5m.js";import{eb as r}from"./chunk-4rbzswqs.js";import"./chunk-rfyaphas.js";import{ib as x}from"./chunk-5gtew41y.js";import{jb as j}from"./chunk-3kqdgddm.js";import"./chunk-karn564z.js";import{Df as l}from"./chunk-jszpvg8e.js";import{Sf as o}from"./chunk-s0hgykza.js";import{Eg as i}from"./chunk-69tt1pvr.js";import{Fg as d}from"./chunk-f2j2cqd1.js";import{th as h}from"./chunk-n4gghgrj.js";import{$h as B,Ah as K,Bh as L,Ck as m,Dk as p,Ek as c,Fh as y,Fk as n,Gh as F,Hh as S,Hi as T,Ik as X,Mh as P,Oj as u,Rh as C,Ui as g,Yi as b,bi as A,lj as I,ni as f,xh as OG,yh as k,zh as G}from"./chunk-m6a4rzdt.js";import{Nl as qG}from"./chunk-dej1gq35.js";var _=qG(OG(),1);var zG=(Y)=>{if(!Y)return"??";return Y.split(" ").map((z)=>z[0]).slice(0,2).join("").toUpperCase()};function BG(){let{projectId:Y}=MG.useParams(),{teamId:z,ensureTeamIdForProject:U}=h(),GG=L(),JG=P();_.useEffect(()=>{U(Y)},[Y,U]);let{data:M}=y(l(Y)),D=M?.rootFolder,[KG,XG]=_.useState(240),{shareConfigLeftSidebarCollapsed:Q,setShareConfigLeftSidebarCollapsed:YG}=i(),{data:V,isLoading:ZG,fetchNextPage:R,hasNextPage:v,isFetchingNextPage:W}=S({queryKey:["shares",Y],queryFn:async({pageParam:J})=>{let Z=await A.api.projects[":projectId"].shares.$get({param:{projectId:Y},query:{first:"20",after:J}});if(!Z.ok)throw Error("Failed to fetch share links");return await Z.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!Y}),{ref:_G,inView:w}=d();_.useEffect(()=>{if(w&&v&&!W)R()},[w,v,W,R]);let H=_.useMemo(()=>V?.pages.flatMap((J)=>J.data)||[],[V]),{mutate:$G}=F({mutationFn:async({id:J,isDisabled:Z})=>{let O=await A.api.shares[":shareId"].$put({param:{shareId:J},json:{isDisabled:Z}});if(!O.ok)throw Error("Failed to update share link");return await O.json()},onSuccess:()=>{GG.invalidateQueries({queryKey:["shares",Y]}),B.success(X.share_link_status_updated())},onError:(J)=>{B.error(X.error_message({message:J.message}))}});if(!z||!D||!M)return G(o,{});let N=async(J)=>{let Z=`${window.location.origin}/share/${J}`;if(await x(Z))B.success(X.link_copied())};return G("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!Q&&G("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>YG(!0)}),!Q&&K(k,{children:[G("div",{className:"bg-background",style:{width:KG},children:G(t,{teamId:z,projectId:Y,projectName:M.name??"",rootFolderId:D})}),G(r,{onResize:(J)=>{XG((Z)=>Math.max(180,Math.min(400,Z+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[G("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[G(u,{className:"h-5 w-5 text-primary"}),G("h1",{className:"font-bold text-lg text-foreground",children:X.all_share_links()})]})}),G("div",{className:"flex-1 overflow-y-auto p-6",children:ZG?G("div",{className:"flex justify-center items-center h-64",children:G("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):H.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[G(I,{className:"h-10 w-10 text-muted-foreground/50"}),G("p",{children:X.no_share_links_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(a,{children:[G(s,{children:K(E,{className:"hover:bg-transparent bg-muted/20",children:[G($,{className:"font-semibold px-4 py-3",children:X.name()}),G($,{className:"font-semibold px-4 py-3",children:X.public_link()}),G($,{className:"font-semibold px-4 py-3",children:X.creator()}),G($,{className:"font-semibold px-4 py-3 w-[150px]",children:X.created_date()}),G($,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:X.active()})]})}),G(e,{children:H.map((J)=>{let Z=`${window.location.origin}/share/${J.id}`;return K(E,{className:"hover:bg-muted/10 transition-colors",children:[G(q,{className:"font-medium px-4 py-3.5",children:G("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>JG({to:"/projects/$projectId/shares/$shareId",params:{projectId:Y,shareId:J.id}}),children:J.name})}),G(q,{className:"px-4 py-3.5 max-w-[300px]",children:K("div",{className:"flex items-center gap-2 group",children:[G("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>N(J.id),title:X.click_to_copy_link(),children:Z}),G(m,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>N(J.id),children:G(g,{className:"h-3.5 w-3.5"})}),G("a",{href:Z,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:G(b,{className:"h-3.5 w-3.5"})})]})}),G(q,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(p,{className:"h-6 w-6",children:[J.creator?.image&&G(c,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),G(n,{className:"text-[10px]",children:zG(J.creator?.name)})]}),G("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:J.creator?.name||X.unknown()})]})}),G(q,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[G(T,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),G("span",{children:new Date(J.createdAt).toLocaleDateString()})]})}),G(q,{className:"px-4 py-3.5 text-right",children:G("div",{className:"flex justify-end",children:G(j,{checked:!J.isDisabled,onCheckedChange:(O)=>$G({id:J.id,isDisabled:!O})})})})]},J.id)})})]}),G("div",{ref:_G,className:"h-10 w-full flex items-center justify-center",children:W&&G(f,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var MG=C("/projects/$projectId/shares/")({component:BG});export{MG as Route};
@@ -1 +1 @@
1
- import{fb as cz}from"./chunk-55myfmhy.js";import"./chunk-mmrtjcst.js";import{hb as r}from"./chunk-ce50f746.js";import{ib as Cz,jb as fz,kb as Iz,lb as gz,mb as uz,nb as lz,ob as dz,pb as pz}from"./chunk-d2qp8g98.js";import{Sf as Dz}from"./chunk-nh8azwsx.js";import"./chunk-ghz19a7t.js";import{Jg as m}from"./chunk-7fm1hznx.js";import{eh as yz}from"./chunk-6edadcpn.js";import{fh as C,hh as f,ih as I,jh as w,sh as bz}from"./chunk-w98wvk17.js";import{$h as X,Ak as Sz,Bj as Zz,Bk as wz,Ch as o,Eh as q,Ek as V,Fi as a,Fk as j,Gk as kz,Hk as qz,Ik as Az,Jk as Ez,Kh as n,Kk as Fz,Lk as Uz,Ph as Bz,Wj as Jz,Zh as Yz,ai as Vz,bi as Pz,bk as Kz,ii as vz,ki as Gz,mi as Tz,ni as Lz,th as Mz,vh as $z,wh as P,wk as _z,xh as z,yh as J,yi as Rz,yk as F,zh as i,zk as hz}from"./chunk-jt4yh37q.js";import{Il as Wz}from"./chunk-mgbqjbfc.js";var k=Wz($z(),1);function Nz({open:Z,onOpenChange:T,mode:L,teamId:U,project:W}){let A=i(),K=n(),[H,O]=k.useState(""),[y,B]=k.useState(!0),[g,M]=k.useState(void 0),[b,N]=k.useState(void 0),[E,D]=k.useState(!1),v=k.useRef(null);k.useEffect(()=>{if(Z)if(L==="edit"&&W)O(W.name||""),M(W.coverImageKey),N(W.coverImage),B(W.enableNotification!==!1);else O(""),M(void 0),N(void 0),B(!0)},[Z,L,W]);let u=X.api.teams[":teamId"].projects.$post,{mutate:t}=q({mutationFn:async(Q)=>{let _=await u({param:{teamId:U},json:Q});if(!_.ok)throw Error(V.failed_create_project());return await _.json()},onSuccess:(Q)=>{A.invalidateQueries({queryKey:["teams",U,"projects"]}),T(!1);let _=Q;if(_&&typeof _.id==="string")K({to:"/projects/$projectId",params:{projectId:_.id}})}}),l=X.api.projects[":projectId"].$put,{mutate:s}=q({mutationFn:async(Q)=>{let _=await l({param:{projectId:W.id},json:Q});if(!_.ok)throw Error(V.failed_update_project());return await _.json()},onSuccess:()=>{A.invalidateQueries({queryKey:["teams",U,"projects"]}),T(!1)}}),e=X.api.teams[":teamId"].files.$post,{mutate:d}=q({mutationFn:async({file:Q})=>{let _=await e({param:{teamId:U},form:{file:Q}});if(!_.ok)throw Error(V.failed_upload_file());return await _.json()},onSuccess:(Q)=>{let _=Q;if(_&&typeof _.key==="string")M(_.key);D(!1)},onError:()=>{D(!1)}}),R=(Q)=>{let _=Q.target.files?.[0];if(_){D(!0);let zz=URL.createObjectURL(_);N(zz),d({file:_})}},h=()=>{v.current?.click()},p=(Q)=>{Q.stopPropagation(),M(void 0),N(void 0)},S=()=>{if(!H.trim())return;if(L==="create")t({name:H.trim(),coverImageKey:g,enableNotification:y});else if(L==="edit"&&W?.id)s({name:H.trim(),coverImageKey:g,enableNotification:y})};return z(kz,{open:Z,onOpenChange:T,children:J(qz,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[J(Az,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[z("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),z("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),z("div",{className:"flex items-center gap-3",children:J("div",{children:[z(Fz,{className:"text-xl font-semibold tracking-tight text-foreground",children:L==="create"?V.create_new_project():V.project_settings()}),z(Uz,{className:"text-xs text-muted-foreground/80 mt-1",children:L==="create"?V.configure_new_project_description():V.manage_project_description()})]})})]}),J("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[J("div",{className:"space-y-2",children:[z(m,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:V.project_name()}),J("div",{className:"relative",children:[z(j,{id:"name",value:H,onChange:(Q)=>O(Q.target.value),placeholder:V.project_name_placeholder(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),H.trim()&&z("div",{className:"absolute inset-y-0 right-3 flex items-center",children:z(a,{className:"w-4 h-4 text-primary"})})]}),z("p",{className:"text-[11px] text-muted-foreground",children:V.project_name_hint()})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J("div",{className:"flex items-center justify-between",children:[J(m,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z(Lz,{className:"w-4 h-4 text-primary"}),V.project_cover()]}),b&&J("button",{type:"button",onClick:p,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[z(Kz,{className:"w-3.5 h-3.5"}),V.remove_cover()]})]}),J("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:h,children:[z("input",{type:"file",ref:v,className:"hidden",accept:"image/*",onChange:R}),E&&z("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:J("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[z(Gz,{className:"w-4 h-4 animate-spin text-primary"}),z("span",{className:"text-xs font-semibold text-foreground",children:V.uploading()})]})}),b?J(P,{children:[z("img",{src:b,alt:V.cover_preview(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),J("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[z(Jz,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),z("span",{className:"text-xs font-semibold",children:V.upload_image()})]})]}):J("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[z("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:z(Jz,{className:"w-4 h-4 text-muted-foreground"})}),J("div",{children:[z("p",{className:"text-xs font-medium text-foreground",children:V.upload_cover()}),z("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:V.upload_cover_hint()})]})]})]})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J(m,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z(Tz,{className:"w-4 h-4 text-primary"}),V.project_preferences()]}),J("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[J("div",{className:"space-y-1 pr-4",children:[J("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[z(Rz,{className:"w-4 h-4 text-primary"}),V.activity_notifications()]}),z("p",{className:"text-xs text-muted-foreground leading-normal",children:V.activity_notifications_description()})]}),z(r,{checked:y,onCheckedChange:B,disabled:E,className:"mt-0.5"})]})]})]}),J(Ez,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[z(F,{type:"button",variant:"ghost",onClick:()=>T(!1),disabled:E,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:V.cancel()}),z(F,{type:"submit",onClick:S,disabled:!H.trim()||E,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:E?J(P,{children:[z(Gz,{className:"w-4 h-4 animate-spin"}),V.processing()]}):L==="create"?V.create_project():V.save_changes()})]})]})})}function Oz({sortBy:Z,sortDirection:T,onSortChange:L}){let U=(H)=>{L(H,T)},W=()=>{L(Z,T==="asc"?"desc":"asc")},A=(H)=>{switch(H){case"name":return V.sort_name();case"created_at":return V.sort_created();case"updated_at":return V.sort_updated();default:return H}},K=T==="asc";return J(C,{children:[z(f,{asChild:!0,children:J(F,{variant:"outline",className:"gap-2 bg-muted/50",children:[z("span",{className:"text-muted-foreground",children:V.sorted_by_label()}),z("span",{className:"font-medium text-foreground",children:A(Z)})]})}),J(I,{align:"end",className:"w-56 p-2",children:[z("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:V.sort_by()}),J(C,{children:[z(f,{asChild:!0,children:J(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[z("span",{children:A(Z)}),z(Vz,{className:"h-4 w-4 opacity-50"})]})}),z(I,{className:"w-52",children:["name","created_at","updated_at"].map((H)=>J(w,{onClick:()=>U(H),className:"justify-between",children:[A(H),Z===H&&z(a,{className:"h-4 w-4"})]},H))})]}),J(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:W,children:[z("span",{className:"text-muted-foreground",children:Z==="name"?K?z(P,{children:V.sort_a_to_z()}):z(P,{children:V.sort_z_to_a()}):K?z(P,{children:V.sort_oldest_to_newest()}):z(P,{children:V.sort_newest_to_oldest()})}),K?z(Pz,{className:"h-4 w-4 opacity-50"}):z(Vz,{className:"h-4 w-4 opacity-50"})]})]})]})}var $=Wz($z(),1);function JG(){let{teamId:Z}=VG.useParams(),{canEdit:T,canAdmin:L}=bz(),U=n(),W=i(),[A,K]=$.useState(null),[H,O]=$.useState(!1),[y,B]=$.useState("create"),[g,M]=$.useState(void 0),[b,N]=$.useState(!1),[E,D]=$.useState(void 0),[v,u]=$.useState(""),[t,l]=$.useState(!1),{metadata:s,setMetadata:e}=Dz(),d=`team:${Z}:projects:sort`,R=s[d],[h,p]=$.useState(()=>R?.sortBy||"name"),[S,Q]=$.useState(()=>R?.sortDirection||"asc");$.useEffect(()=>{if(R?.sortBy&&R.sortBy!==h)p(R.sortBy);if(R?.sortDirection&&R.sortDirection!==S)Q(R.sortDirection)},[R]);let _=X.api.teams[":teamId"].projects.$get,{data:zz}=o({queryKey:["teams",Z,"projects",h,S],queryFn:async()=>{let G=await _({param:{teamId:Z},query:{sortBy:h,sortDirection:S}});if(!G.ok)throw Error("Failed to fetch projects");return await G.json()},placeholderData:Mz}),{data:Hz}=o({queryKey:["teams",Z,"members"],queryFn:async()=>{let G=await X.api.teams[":teamId"].members.$get({param:{teamId:Z},query:{}});if(!G.ok)throw Error("Failed to fetch members");return await G.json()}}),{data:Qz}=o({queryKey:["teams",Z,"me"],queryFn:async()=>{let G=await X.api.teams[":teamId"].me.$get({param:{teamId:Z}});if(!G.ok)throw Error("Failed to fetch me");return await G.json()}}),xz=X.api.teams[":teamId"].invite.$post,mz=q({mutationFn:async(G)=>{let Y=await xz(G);if(!Y.ok)throw Error("Failed to invite");return await Y.json()}}),c=q({mutationFn:async(G)=>{if(!(await X.api.projects[":projectId"].$delete({param:{projectId:G}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]})}}),iz=q({mutationFn:async(G)=>{let Y=await X.api.projects[":projectId"].$put({param:{projectId:G.id},json:{enableNotification:!G.enableNotification}});if(!Y.ok)throw Error("Failed to update project notification settings");return await Y.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]}),Yz.success(V.project_notification_updated())},onError:(G)=>{Yz.error(G instanceof Error?G.message:V.failed_update_project_notification())}}),Xz=()=>{B("create"),M(void 0),O(!0)},nz=()=>{K("create"),setTimeout(()=>{K(null)},100),setTimeout(()=>{Xz()},200)},az=(G)=>{B("edit"),M(G),O(!0)},jz=(G)=>{D(G),u(""),N(!0)},rz=async()=>{if(E&&v==="delete")try{await c.mutateAsync(E.id),N(!1)}catch(G){console.error(G)}},oz=(G,Y)=>{if(Y.detail>1)return;K(G),setTimeout(()=>{K(null)},100),setTimeout(()=>{U({to:"/projects/$projectId",params:{projectId:G}})},200)},tz=async(G)=>{return(await mz.mutateAsync({param:{teamId:Z},json:{role:G}})).code},sz=q({mutationFn:async({userId:G,role:Y})=>{if(!(await X.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:Z,userId:G},json:{role:Y}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),ez=q({mutationFn:async(G)=>{if(!(await X.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:Z,userId:G}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),zG=(G)=>{if(!G)return"??";return G.split(" ").map((Y)=>Y[0]).slice(0,2).join("").toUpperCase()},GG=(G,Y)=>{p(G),Q(Y),e(Z,d,{sortBy:G,sortDirection:Y})},x=Array.isArray(Hz)?Hz:[];return J("div",{className:"flex-1 overflow-y-auto p-4",children:[J("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[z("h1",{className:"text-2xl font-bold",children:V.projects()}),J("div",{className:"flex flex-wrap items-center gap-4",children:[J("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>l(!0),"data-testid":"team-members-trigger",children:[x.slice(0,3).map((G)=>J(hz,{className:"border-2 border-background w-8 h-8",children:[G.image&&z(Sz,{src:G.image,alt:G.name,className:"object-cover"}),z(wz,{className:"text-[10px]",children:zG(G.name)})]},G.id)),x.length>3&&J("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",x.length-3]})]}),z(Oz,{sortBy:h,sortDirection:S,onSortChange:GG}),T&&J(F,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:Xz,children:[z(Zz,{className:"w-4 h-4"}),V.create_project()]})]})]}),J("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[zz?.data?.map((G)=>z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",A===G.id?"scale-95":"scale-100"),onClick:(Y)=>oz(G.id,Y),children:J("div",{className:"flex flex-col",children:[J("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[G.coverImage?z("img",{src:G.coverImage,alt:G.name,className:"w-full h-full object-cover rounded"}):J("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[z("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),z("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),z("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),z("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),z("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),z("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),z("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),z("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),z("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),z("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),z("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),z("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),z("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),z("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),z("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),z("p",{className:"absolute left-1 bottom-2 text-white",children:G.name})]}),J("div",{className:"px-2 h-10 flex justify-between items-center",children:[J("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[V.updated_ago()," ",yz(G.updatedAt??"")]}),z("div",{onClick:(Y)=>Y.stopPropagation(),children:J(C,{modal:!1,children:[z(f,{asChild:!0,children:z("button",{className:"hover:bg-muted outline-none flex px-1",children:z(vz,{className:"w-5 h-5 text-muted-foreground"})})}),J(I,{align:"end",children:[T&&z(w,{onClick:(Y)=>{Y.stopPropagation(),az(G)},children:V.project_settings()}),J(w,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(Y)=>{Y.preventDefault(),iz.mutate(G)},children:[z("span",{children:V.notification()}),z(r,{checked:G.enableNotification??!0,className:"pointer-events-none"})]}),L&&z(w,{className:"text-destructive focus:text-destructive",onClick:()=>jz(G),children:V.delete()})]})]})})]})]})},G.id)),T&&z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",A==="create"?"scale-95":"scale-100"),onClick:nz,children:J("div",{className:"flex flex-col",children:[z("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:z(Zz,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),z("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:z("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:V.create_project()})})]})})]}),z(Nz,{open:H,onOpenChange:O,mode:y,teamId:Z,project:g}),z(Cz,{open:b,onOpenChange:N,children:J(fz,{children:[J(Iz,{children:[z(uz,{children:V.are_you_sure()}),J(lz,{children:[V.delete_project_warning({name:E?.name??""}),J("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[z("span",{className:"text-sm font-medium",children:V.type_delete_to_confirm()}),z(j,{value:v,onChange:(G)=>u(G.target.value),placeholder:V.delete_placeholder(),className:"h-9",autoFocus:!0})]})]})]}),J(gz,{children:[z(pz,{disabled:c.isPending,children:V.cancel()}),z(dz,{onClick:(G)=>{G.preventDefault(),rz()},disabled:v!=="delete"||c.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:c.isPending?V.deleting():V.delete()})]})]})}),z(cz,{open:t,onOpenChange:l,title:V.team_members(),type:"team",members:x,isOwner:Qz?.role==="owner",onInvite:tz,onUpdateRole:async(G,Y)=>{await sz.mutateAsync({userId:G,role:Y})},onRemoveMember:async(G)=>{await ez.mutateAsync(G)},currentUserId:Qz?.id})]})}var VG=Bz("/teams/$teamId/")({component:JG});export{VG as Route};
1
+ import{hb as cz}from"./chunk-0yngn45x.js";import"./chunk-5gtew41y.js";import{jb as r}from"./chunk-3kqdgddm.js";import{kb as Cz,lb as fz,mb as Iz,nb as gz,ob as uz,pb as lz,qb as dz,rb as pz}from"./chunk-karn564z.js";import{Uf as Dz}from"./chunk-38g3s1f3.js";import"./chunk-2xmsrq7f.js";import{Lg as m}from"./chunk-af6wbhkv.js";import{gh as yz}from"./chunk-2mqqghrz.js";import{hh as C,jh as f,kh as I,lh as w,uh as bz}from"./chunk-n4gghgrj.js";import{$h as Yz,Ah as J,Ak as _z,Bh as i,Ci as Rz,Ck as F,Dk as hz,Eh as o,Ek as Sz,Fj as Zz,Fk as wz,Gh as q,Ik as V,Ji as a,Jk as j,Kk as kz,Mh as n,Mk as qz,Nk as Az,Ok as Ez,Pk as Fz,Qk as Uz,Rh as Bz,_j as Jz,bi as X,ci as Vz,di as Pz,fk as Kz,li as vz,ni as Gz,pi as Tz,qi as Lz,vh as Mz,xh as $z,yh as P,zh as z}from"./chunk-m6a4rzdt.js";import{Nl as Wz}from"./chunk-dej1gq35.js";var k=Wz($z(),1);function Nz({open:Z,onOpenChange:T,mode:L,teamId:U,project:W}){let A=i(),K=n(),[H,O]=k.useState(""),[y,B]=k.useState(!0),[g,M]=k.useState(void 0),[b,N]=k.useState(void 0),[E,D]=k.useState(!1),v=k.useRef(null);k.useEffect(()=>{if(Z)if(L==="edit"&&W)O(W.name||""),M(W.coverImageKey),N(W.coverImage),B(W.enableNotification!==!1);else O(""),M(void 0),N(void 0),B(!0)},[Z,L,W]);let u=X.api.teams[":teamId"].projects.$post,{mutate:t}=q({mutationFn:async(Q)=>{let _=await u({param:{teamId:U},json:Q});if(!_.ok)throw Error(V.failed_create_project());return await _.json()},onSuccess:(Q)=>{A.invalidateQueries({queryKey:["teams",U,"projects"]}),T(!1);let _=Q;if(_&&typeof _.id==="string")K({to:"/projects/$projectId",params:{projectId:_.id}})}}),l=X.api.projects[":projectId"].$put,{mutate:s}=q({mutationFn:async(Q)=>{let _=await l({param:{projectId:W.id},json:Q});if(!_.ok)throw Error(V.failed_update_project());return await _.json()},onSuccess:()=>{A.invalidateQueries({queryKey:["teams",U,"projects"]}),T(!1)}}),e=X.api.teams[":teamId"].files.$post,{mutate:d}=q({mutationFn:async({file:Q})=>{let _=await e({param:{teamId:U},form:{file:Q}});if(!_.ok)throw Error(V.failed_upload_file());return await _.json()},onSuccess:(Q)=>{let _=Q;if(_&&typeof _.key==="string")M(_.key);D(!1)},onError:()=>{D(!1)}}),R=(Q)=>{let _=Q.target.files?.[0];if(_){D(!0);let zz=URL.createObjectURL(_);N(zz),d({file:_})}},h=()=>{v.current?.click()},p=(Q)=>{Q.stopPropagation(),M(void 0),N(void 0)},S=()=>{if(!H.trim())return;if(L==="create")t({name:H.trim(),coverImageKey:g,enableNotification:y});else if(L==="edit"&&W?.id)s({name:H.trim(),coverImageKey:g,enableNotification:y})};return z(kz,{open:Z,onOpenChange:T,children:J(qz,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[J(Az,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[z("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),z("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),z("div",{className:"flex items-center gap-3",children:J("div",{children:[z(Fz,{className:"text-xl font-semibold tracking-tight text-foreground",children:L==="create"?V.create_new_project():V.project_settings()}),z(Uz,{className:"text-xs text-muted-foreground/80 mt-1",children:L==="create"?V.configure_new_project_description():V.manage_project_description()})]})})]}),J("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[J("div",{className:"space-y-2",children:[z(m,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:V.project_name()}),J("div",{className:"relative",children:[z(j,{id:"name",value:H,onChange:(Q)=>O(Q.target.value),placeholder:V.project_name_placeholder(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),H.trim()&&z("div",{className:"absolute inset-y-0 right-3 flex items-center",children:z(a,{className:"w-4 h-4 text-primary"})})]}),z("p",{className:"text-[11px] text-muted-foreground",children:V.project_name_hint()})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J("div",{className:"flex items-center justify-between",children:[J(m,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z(Lz,{className:"w-4 h-4 text-primary"}),V.project_cover()]}),b&&J("button",{type:"button",onClick:p,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[z(Kz,{className:"w-3.5 h-3.5"}),V.remove_cover()]})]}),J("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:h,children:[z("input",{type:"file",ref:v,className:"hidden",accept:"image/*",onChange:R}),E&&z("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:J("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[z(Gz,{className:"w-4 h-4 animate-spin text-primary"}),z("span",{className:"text-xs font-semibold text-foreground",children:V.uploading()})]})}),b?J(P,{children:[z("img",{src:b,alt:V.cover_preview(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),J("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[z(Jz,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),z("span",{className:"text-xs font-semibold",children:V.upload_image()})]})]}):J("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[z("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:z(Jz,{className:"w-4 h-4 text-muted-foreground"})}),J("div",{children:[z("p",{className:"text-xs font-medium text-foreground",children:V.upload_cover()}),z("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:V.upload_cover_hint()})]})]})]})]}),J("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[J(m,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[z(Tz,{className:"w-4 h-4 text-primary"}),V.project_preferences()]}),J("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[J("div",{className:"space-y-1 pr-4",children:[J("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[z(Rz,{className:"w-4 h-4 text-primary"}),V.activity_notifications()]}),z("p",{className:"text-xs text-muted-foreground leading-normal",children:V.activity_notifications_description()})]}),z(r,{checked:y,onCheckedChange:B,disabled:E,className:"mt-0.5"})]})]})]}),J(Ez,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[z(F,{type:"button",variant:"ghost",onClick:()=>T(!1),disabled:E,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:V.cancel()}),z(F,{type:"submit",onClick:S,disabled:!H.trim()||E,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:E?J(P,{children:[z(Gz,{className:"w-4 h-4 animate-spin"}),V.processing()]}):L==="create"?V.create_project():V.save_changes()})]})]})})}function Oz({sortBy:Z,sortDirection:T,onSortChange:L}){let U=(H)=>{L(H,T)},W=()=>{L(Z,T==="asc"?"desc":"asc")},A=(H)=>{switch(H){case"name":return V.sort_name();case"created_at":return V.sort_created();case"updated_at":return V.sort_updated();default:return H}},K=T==="asc";return J(C,{children:[z(f,{asChild:!0,children:J(F,{variant:"outline",className:"gap-2 bg-muted/50",children:[z("span",{className:"text-muted-foreground",children:V.sorted_by_label()}),z("span",{className:"font-medium text-foreground",children:A(Z)})]})}),J(I,{align:"end",className:"w-56 p-2",children:[z("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:V.sort_by()}),J(C,{children:[z(f,{asChild:!0,children:J(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[z("span",{children:A(Z)}),z(Vz,{className:"h-4 w-4 opacity-50"})]})}),z(I,{className:"w-52",children:["name","created_at","updated_at"].map((H)=>J(w,{onClick:()=>U(H),className:"justify-between",children:[A(H),Z===H&&z(a,{className:"h-4 w-4"})]},H))})]}),J(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:W,children:[z("span",{className:"text-muted-foreground",children:Z==="name"?K?z(P,{children:V.sort_a_to_z()}):z(P,{children:V.sort_z_to_a()}):K?z(P,{children:V.sort_oldest_to_newest()}):z(P,{children:V.sort_newest_to_oldest()})}),K?z(Pz,{className:"h-4 w-4 opacity-50"}):z(Vz,{className:"h-4 w-4 opacity-50"})]})]})]})}var $=Wz($z(),1);function JG(){let{teamId:Z}=VG.useParams(),{canEdit:T,canAdmin:L}=bz(),U=n(),W=i(),[A,K]=$.useState(null),[H,O]=$.useState(!1),[y,B]=$.useState("create"),[g,M]=$.useState(void 0),[b,N]=$.useState(!1),[E,D]=$.useState(void 0),[v,u]=$.useState(""),[t,l]=$.useState(!1),{metadata:s,setMetadata:e}=Dz(),d=`team:${Z}:projects:sort`,R=s[d],[h,p]=$.useState(()=>R?.sortBy||"name"),[S,Q]=$.useState(()=>R?.sortDirection||"asc");$.useEffect(()=>{if(R?.sortBy&&R.sortBy!==h)p(R.sortBy);if(R?.sortDirection&&R.sortDirection!==S)Q(R.sortDirection)},[R]);let _=X.api.teams[":teamId"].projects.$get,{data:zz}=o({queryKey:["teams",Z,"projects",h,S],queryFn:async()=>{let G=await _({param:{teamId:Z},query:{sortBy:h,sortDirection:S}});if(!G.ok)throw Error("Failed to fetch projects");return await G.json()},placeholderData:Mz}),{data:Hz}=o({queryKey:["teams",Z,"members"],queryFn:async()=>{let G=await X.api.teams[":teamId"].members.$get({param:{teamId:Z},query:{}});if(!G.ok)throw Error("Failed to fetch members");return await G.json()}}),{data:Qz}=o({queryKey:["teams",Z,"me"],queryFn:async()=>{let G=await X.api.teams[":teamId"].me.$get({param:{teamId:Z}});if(!G.ok)throw Error("Failed to fetch me");return await G.json()}}),xz=X.api.teams[":teamId"].invite.$post,mz=q({mutationFn:async(G)=>{let Y=await xz(G);if(!Y.ok)throw Error("Failed to invite");return await Y.json()}}),c=q({mutationFn:async(G)=>{if(!(await X.api.projects[":projectId"].$delete({param:{projectId:G}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]})}}),iz=q({mutationFn:async(G)=>{let Y=await X.api.projects[":projectId"].$put({param:{projectId:G.id},json:{enableNotification:!G.enableNotification}});if(!Y.ok)throw Error("Failed to update project notification settings");return await Y.json()},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"projects"]}),Yz.success(V.project_notification_updated())},onError:(G)=>{Yz.error(G instanceof Error?G.message:V.failed_update_project_notification())}}),Xz=()=>{B("create"),M(void 0),O(!0)},nz=()=>{K("create"),setTimeout(()=>{K(null)},100),setTimeout(()=>{Xz()},200)},az=(G)=>{B("edit"),M(G),O(!0)},jz=(G)=>{D(G),u(""),N(!0)},rz=async()=>{if(E&&v==="delete")try{await c.mutateAsync(E.id),N(!1)}catch(G){console.error(G)}},oz=(G,Y)=>{if(Y.detail>1)return;K(G),setTimeout(()=>{K(null)},100),setTimeout(()=>{U({to:"/projects/$projectId",params:{projectId:G}})},200)},tz=async(G)=>{return(await mz.mutateAsync({param:{teamId:Z},json:{role:G}})).code},sz=q({mutationFn:async({userId:G,role:Y})=>{if(!(await X.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:Z,userId:G},json:{role:Y}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),ez=q({mutationFn:async(G)=>{if(!(await X.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:Z,userId:G}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{W.invalidateQueries({queryKey:["teams",Z,"members"]})}}),zG=(G)=>{if(!G)return"??";return G.split(" ").map((Y)=>Y[0]).slice(0,2).join("").toUpperCase()},GG=(G,Y)=>{p(G),Q(Y),e(Z,d,{sortBy:G,sortDirection:Y})},x=Array.isArray(Hz)?Hz:[];return J("div",{className:"flex-1 overflow-y-auto p-4",children:[J("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[z("h1",{className:"text-2xl font-bold",children:V.projects()}),J("div",{className:"flex flex-wrap items-center gap-4",children:[J("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>l(!0),"data-testid":"team-members-trigger",children:[x.slice(0,3).map((G)=>J(hz,{className:"border-2 border-background w-8 h-8",children:[G.image&&z(Sz,{src:G.image,alt:G.name,className:"object-cover"}),z(wz,{className:"text-[10px]",children:zG(G.name)})]},G.id)),x.length>3&&J("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",x.length-3]})]}),z(Oz,{sortBy:h,sortDirection:S,onSortChange:GG}),T&&J(F,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:Xz,children:[z(Zz,{className:"w-4 h-4"}),V.create_project()]})]})]}),J("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[zz?.data?.map((G)=>z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",A===G.id?"scale-95":"scale-100"),onClick:(Y)=>oz(G.id,Y),children:J("div",{className:"flex flex-col",children:[J("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[G.coverImage?z("img",{src:G.coverImage,alt:G.name,className:"w-full h-full object-cover rounded"}):J("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[z("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),z("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),z("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),z("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),z("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),z("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),z("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),z("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),z("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),z("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),z("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),z("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),z("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),z("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),z("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),z("p",{className:"absolute left-1 bottom-2 text-white",children:G.name})]}),J("div",{className:"px-2 h-10 flex justify-between items-center",children:[J("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[V.updated_ago()," ",yz(G.updatedAt??"")]}),z("div",{onClick:(Y)=>Y.stopPropagation(),children:J(C,{modal:!1,children:[z(f,{asChild:!0,children:z("button",{className:"hover:bg-muted outline-none flex px-1",children:z(vz,{className:"w-5 h-5 text-muted-foreground"})})}),J(I,{align:"end",children:[T&&z(w,{onClick:(Y)=>{Y.stopPropagation(),az(G)},children:V.project_settings()}),J(w,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(Y)=>{Y.preventDefault(),iz.mutate(G)},children:[z("span",{children:V.notification()}),z(r,{checked:G.enableNotification??!0,className:"pointer-events-none"})]}),L&&z(w,{className:"text-destructive focus:text-destructive",onClick:()=>jz(G),children:V.delete()})]})]})})]})]})},G.id)),T&&z("div",{className:_z("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",A==="create"?"scale-95":"scale-100"),onClick:nz,children:J("div",{className:"flex flex-col",children:[z("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:z(Zz,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),z("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:z("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:V.create_project()})})]})})]}),z(Nz,{open:H,onOpenChange:O,mode:y,teamId:Z,project:g}),z(Cz,{open:b,onOpenChange:N,children:J(fz,{children:[J(Iz,{children:[z(uz,{children:V.are_you_sure()}),J(lz,{children:[V.delete_project_warning({name:E?.name??""}),J("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[z("span",{className:"text-sm font-medium",children:V.type_delete_to_confirm()}),z(j,{value:v,onChange:(G)=>u(G.target.value),placeholder:V.delete_placeholder(),className:"h-9",autoFocus:!0})]})]})]}),J(gz,{children:[z(pz,{disabled:c.isPending,children:V.cancel()}),z(dz,{onClick:(G)=>{G.preventDefault(),rz()},disabled:v!=="delete"||c.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:c.isPending?V.deleting():V.delete()})]})]})}),z(cz,{open:t,onOpenChange:l,title:V.team_members(),type:"team",members:x,isOwner:Qz?.role==="owner",onInvite:tz,onUpdateRole:async(G,Y)=>{await sz.mutateAsync({userId:G,role:Y})},onRemoveMember:async(G)=>{await ez.mutateAsync(G)},currentUserId:Qz?.id})]})}var VG=Bz("/teams/$teamId/")({component:JG});export{VG as Route};