@shumai-one/shumai 0.3.7 → 0.3.8

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 (151) hide show
  1. package/bin/{chunk-9nyhmtp9.js → chunk-0mmw31pj.js} +2 -2
  2. package/bin/{chunk-gjn3w26y.js → chunk-0pm8c9bq.js} +2 -2
  3. package/bin/{chunk-50keqtz9.js → chunk-0qpz48vc.js} +1 -1
  4. package/bin/{chunk-zjj9qj6y.js → chunk-0zbwpfsk.js} +2 -2
  5. package/bin/chunk-15jsnygy.js +5 -0
  6. package/bin/chunk-16s5kfy8.css +1 -0
  7. package/bin/{chunk-hqkmdp31.js → chunk-21rp4vzr.js} +2 -2
  8. package/bin/chunk-24ke0th1.css +1 -0
  9. package/bin/{chunk-260wywfb.js → chunk-28n8xqhm.js} +1 -1
  10. package/bin/{chunk-7hnw6y6d.js → chunk-2dxd0bar.js} +2 -2
  11. package/bin/{chunk-3dx0p1ge.js → chunk-2ejky9qv.js} +1 -1
  12. package/bin/{chunk-dej1gq35.js → chunk-2em77vjv.js} +1 -1
  13. package/bin/{chunk-zg60j9x2.js → chunk-2q26gz0p.js} +1 -1
  14. package/bin/{chunk-9s02m95j.js → chunk-2t0asg3w.js} +2 -2
  15. package/bin/{chunk-rfyaphas.js → chunk-2xaq1y16.js} +2 -2
  16. package/bin/{chunk-qmpph1gt.js → chunk-33r4w0yv.js} +2 -2
  17. package/bin/{chunk-1xzc6z02.js → chunk-3bm3be9d.js} +1 -1
  18. package/bin/{chunk-1sqz0va1.js → chunk-3mx22sn7.js} +2 -2
  19. package/bin/chunk-4cmw4qmt.js +1 -0
  20. package/bin/chunk-4d3wm83a.js +2 -0
  21. package/bin/{chunk-0jkqmbcx.js → chunk-4g4g02e0.js} +1 -1
  22. package/bin/{chunk-tpp9qf5m.js → chunk-5386brz2.js} +2 -2
  23. package/bin/{chunk-98j2z6he.js → chunk-5f9fk8x0.js} +3 -3
  24. package/bin/chunk-5fj5w0gg.js +2 -0
  25. package/bin/chunk-61bxmjd9.js +2 -0
  26. package/bin/{chunk-ptw49k86.js → chunk-6pcs8810.js} +1 -1
  27. package/bin/{chunk-x3ynjbt5.js → chunk-6pmsknnk.js} +2 -2
  28. package/bin/{chunk-9xhnmnnb.js → chunk-6vwqg1ra.js} +2 -2
  29. package/bin/{chunk-2mqqghrz.js → chunk-75segwsp.js} +2 -2
  30. package/bin/{chunk-ftc48rbb.js → chunk-7c85cyn0.js} +3 -3
  31. package/bin/chunk-7eyg2kgv.js +1 -0
  32. package/bin/chunk-7r22vcjy.js +2 -0
  33. package/bin/{chunk-0ycwr0kb.js → chunk-80g5kcm0.js} +1 -1
  34. package/bin/{chunk-5gtew41y.js → chunk-8bhsdk1v.js} +1 -1
  35. package/bin/{chunk-1khzycf9.js → chunk-8fsrs7mh.js} +1 -1
  36. package/bin/chunk-8jfm1j41.js +1 -0
  37. package/bin/chunk-8n6segk5.js +1 -0
  38. package/bin/chunk-99f9r6xm.js +2 -0
  39. package/bin/{chunk-2086rsb2.js → chunk-9acfydwy.js} +1 -1
  40. package/bin/{chunk-vxpnp4xg.js → chunk-9ntwrvhz.js} +2 -2
  41. package/bin/{chunk-s0hgykza.js → chunk-agdza65r.js} +2 -2
  42. package/bin/{chunk-6zs49mef.js → chunk-antsxrw9.js} +1 -1
  43. package/bin/chunk-bapy3qv8.js +1 -0
  44. package/bin/chunk-bc2bf144.js +2 -0
  45. package/bin/{chunk-v8w2nxew.js → chunk-bznz6h19.js} +1 -1
  46. package/bin/{chunk-qcqw7wnv.js → chunk-c24an5j3.js} +1 -1
  47. package/bin/chunk-cm74nd4n.js +1 -0
  48. package/bin/{chunk-87wqbn4g.js → chunk-cynjx7ha.js} +2 -2
  49. package/bin/chunk-cyq3m4qz.js +1 -0
  50. package/bin/chunk-ddff7vm3.js +2 -0
  51. package/bin/{chunk-br5xkaf7.js → chunk-djqs6m7w.js} +3 -3
  52. package/bin/{chunk-60hpa5kf.js → chunk-dn8k5ef5.js} +1 -1
  53. package/bin/chunk-dqdqs0d9.js +1 -0
  54. package/bin/chunk-drjaw6a5.js +14 -0
  55. package/bin/chunk-drvwchyn.js +2 -0
  56. package/bin/{chunk-esrtafz0.js → chunk-e4se9q6n.js} +1 -1
  57. package/bin/chunk-eb551xw7.js +1 -0
  58. package/bin/{chunk-nvjp2rnh.js → chunk-en96pr5c.js} +2 -2
  59. package/bin/{chunk-r5dv0rfv.js → chunk-ep138kb3.js} +2 -2
  60. package/bin/{chunk-jszpvg8e.js → chunk-eqf7k7ax.js} +2 -2
  61. package/bin/{chunk-f2j2cqd1.js → chunk-f3rqamey.js} +2 -2
  62. package/bin/{chunk-3kqdgddm.js → chunk-fvwz4mgw.js} +2 -2
  63. package/bin/chunk-g3p6h6sw.js +68 -0
  64. package/bin/{chunk-81tb4v5v.js → chunk-h9f55mjv.js} +2 -2
  65. package/bin/{chunk-n4gghgrj.js → chunk-jfjjh86p.js} +2 -2
  66. package/bin/{chunk-83k0wa5k.js → chunk-jg31cnqc.js} +2 -2
  67. package/bin/chunk-jk87gxbb.js +2 -0
  68. package/bin/{chunk-4bn9eb9h.js → chunk-jqzvazsf.js} +1 -1
  69. package/bin/chunk-jyk483r4.js +1 -0
  70. package/bin/{chunk-48nzw50r.js → chunk-k0ysbh3h.js} +1 -1
  71. package/bin/{chunk-fcs4v6jq.js → chunk-k5yxntns.js} +2 -2
  72. package/bin/chunk-khjybf4y.js +1 -0
  73. package/bin/{chunk-38g3s1f3.js → chunk-kmt9fj1z.js} +2 -2
  74. package/bin/{chunk-503qq6sa.js → chunk-m49ar48r.js} +2 -2
  75. package/bin/{chunk-a0k1b4sq.js → chunk-m7d52gfe.js} +1 -1
  76. package/bin/{chunk-x6532q76.js → chunk-mjxay7yv.js} +1 -1
  77. package/bin/{chunk-zqg4f56h.js → chunk-mp5etccz.js} +1 -1
  78. package/bin/{chunk-9gzy30zm.js → chunk-n8pas7tj.js} +2 -2
  79. package/bin/{chunk-b8v7jvkb.js → chunk-nc632fxz.js} +2 -2
  80. package/bin/{chunk-6fv38qdc.js → chunk-nffrjwb7.js} +2 -2
  81. package/bin/{chunk-7k3ccca6.js → chunk-p1rrkrn4.js} +1 -1
  82. package/bin/chunk-p6ep6grv.js +1 -0
  83. package/bin/{chunk-p4c4z0f2.js → chunk-ph43tgr6.js} +1 -1
  84. package/bin/{chunk-3xzgddev.js → chunk-pqtwzb3s.js} +1 -1
  85. package/bin/chunk-q0xv46wa.js +2 -0
  86. package/bin/{chunk-qh9rz2ee.js → chunk-qhxznkjk.js} +5 -5
  87. package/bin/chunk-qmja7bsr.js +2 -0
  88. package/bin/{chunk-v98e3gex.js → chunk-qyegjbzd.js} +1 -1
  89. package/bin/{chunk-gjdmnfms.js → chunk-r5rf62aa.js} +1 -1
  90. package/bin/{chunk-2xmsrq7f.js → chunk-rjkj0dr9.js} +2 -2
  91. package/bin/chunk-rjr8c8be.js +3 -0
  92. package/bin/{chunk-af6wbhkv.js → chunk-rq4h4p2g.js} +2 -2
  93. package/bin/{chunk-zwgf211t.js → chunk-scmhhrte.js} +2 -2
  94. package/bin/chunk-sjr6mvgm.js +78 -0
  95. package/bin/{chunk-t9t9evan.js → chunk-ssz62jfs.js} +2 -2
  96. package/bin/{chunk-g60v3jc1.js → chunk-ta02azkp.js} +1 -1
  97. package/bin/{chunk-tzt4c1dm.js → chunk-tfnh9sk9.js} +2 -2
  98. package/bin/{chunk-cqq8e3hc.js → chunk-thqahbva.js} +2 -2
  99. package/bin/chunk-tvzfm7g8.js +2 -0
  100. package/bin/{chunk-k48y9e5s.js → chunk-twm329fs.js} +1 -1
  101. package/bin/{chunk-0t8q76ac.js → chunk-ve826t5r.js} +1 -1
  102. package/bin/chunk-vpfj3q7r.js +1 -0
  103. package/bin/chunk-vqakgjsf.js +1 -0
  104. package/bin/chunk-wgjghs54.js +7 -0
  105. package/bin/chunk-wy1ytxw7.js +41 -0
  106. package/bin/{chunk-t3tp9trj.js → chunk-x788nk6z.js} +2 -2
  107. package/bin/{chunk-b3jh3hf1.js → chunk-x8ksced7.js} +2 -2
  108. package/bin/{chunk-qdycy714.js → chunk-xexxh1zq.js} +1 -1
  109. package/bin/{chunk-6v39c8eg.js → chunk-xktnqktj.js} +2 -2
  110. package/bin/{chunk-7872prvg.js → chunk-xpce3j7g.js} +1 -1
  111. package/bin/{chunk-karn564z.js → chunk-xyzsmjtk.js} +2 -2
  112. package/bin/chunk-y03s8bkz.js +1 -0
  113. package/bin/{chunk-kpn9d97x.js → chunk-y5g2ge6f.js} +1 -1
  114. package/bin/{chunk-qy93r7tm.js → chunk-ygcmv04c.js} +2 -2
  115. package/bin/{chunk-ytzk81tr.js → chunk-ykarhcph.js} +1 -1
  116. package/bin/{chunk-bancgvrc.js → chunk-yr8a8nzv.js} +2 -2
  117. package/bin/chunk-yxtb7xn8.js +2 -0
  118. package/bin/{chunk-n76r6s9k.js → chunk-zaft3sfe.js} +2 -2
  119. package/bin/shumai-app.html +1 -1
  120. package/bin/shumai-app.js +237 -215
  121. package/package.json +7 -7
  122. package/prisma/migrations/20260814090300_add_asset_agentmd/migration.sql +2 -0
  123. package/prisma/migrations/20260814125921_create_asset_agentmd_table/migration.sql +21 -0
  124. package/prisma/schema.prisma +12 -0
  125. package/bin/chunk-0xern7e4.js +0 -1
  126. package/bin/chunk-0yngn45x.js +0 -2
  127. package/bin/chunk-4egayx81.js +0 -2
  128. package/bin/chunk-4rbzswqs.js +0 -71
  129. package/bin/chunk-69tt1pvr.js +0 -2
  130. package/bin/chunk-815ezj20.js +0 -1
  131. package/bin/chunk-85eg9xqx.js +0 -1
  132. package/bin/chunk-86aagej8.js +0 -1
  133. package/bin/chunk-8y1v9dm9.js +0 -2
  134. package/bin/chunk-9gq9782d.js +0 -1
  135. package/bin/chunk-bv88se28.css +0 -1
  136. package/bin/chunk-dv1zpd2p.js +0 -15
  137. package/bin/chunk-eetrc0j1.js +0 -3
  138. package/bin/chunk-eztggp8r.js +0 -1
  139. package/bin/chunk-gf5ds9r9.js +0 -2
  140. package/bin/chunk-h9emz0zb.js +0 -2
  141. package/bin/chunk-h9k2atte.js +0 -1
  142. package/bin/chunk-kkq4wvnc.js +0 -1
  143. package/bin/chunk-ksx113sp.js +0 -1
  144. package/bin/chunk-m6a4rzdt.js +0 -62
  145. package/bin/chunk-mw8f8ngt.js +0 -7
  146. package/bin/chunk-rvspnthy.js +0 -1
  147. package/bin/chunk-sjjndwt4.js +0 -2
  148. package/bin/chunk-tvg9gvqs.js +0 -1
  149. package/bin/chunk-xp4dcyk3.js +0 -1
  150. package/bin/chunk-y8aehqr8.js +0 -2
  151. package/bin/chunk-yvxt48r4.js +0 -1
@@ -1,3 +1,3 @@
1
1
  // @bun
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};
2
+ import{bd as a}from"./chunk-jqzvazsf.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 pc,r as qc,p as rc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{al as F}from"./chunk-hqkmdp31.js";import{dl as B,el as A,fl as b,gl as h,hl as x,il as f,jl as g}from"./chunk-fcs4v6jq.js";import{ll as N,nl as v,ol as H}from"./chunk-98j2z6he.js";import{pl as K,ql as y}from"./chunk-qdycy714.js";import{xl as I}from"./chunk-p4c4z0f2.js";import{Al as C}from"./chunk-x6532q76.js";import{Cl as T}from"./chunk-gjdmnfms.js";import{Hl as L,Il as P}from"./chunk-81tb4v5v.js";import{Jl as U}from"./chunk-a0k1b4sq.js";import"./chunk-dej1gq35.js";var k="v1",u="gcp-vertex-credentials",c={THINKING_LEVEL_UNSPECIFIED:N.THINKING_LEVEL_UNSPECIFIED,MINIMAL:N.MINIMAL,LOW:N.LOW,MEDIUM:N.MEDIUM,HIGH:N.HIGH},s=0,V=(q,w,J)=>{let X=new U;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",provider:q.provider,model:q.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 z=e(J),$=z?l(q,z,J?.headers):p(q,o(J),qq(J),J?.headers,J?.env),R=wq(q,w,J),_=await J?.onPayload?.(R,q);if(_!==void 0)R=_;let d=await $.models.generateContentStream(R);X.push({type:"start",partial:Q});let Y=null,M=Q.content,D=()=>M.length-1;for await(let W of d){Q.responseId||=W.responseId;let G=W.candidates?.[0];if(G?.content?.parts)for(let Z of G.content.parts){if(Z.text!==void 0){let S=B(Z);if(!Y||S&&Y.type!=="thinking"||!S&&Y.type!=="text"){if(Y)if(Y.type==="text")X.push({type:"text_end",contentIndex:M.length-1,content:Y.text,partial:Q});else X.push({type:"thinking_end",contentIndex:D(),content:Y.thinking,partial:Q});if(S)Y={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Y),X.push({type:"thinking_start",contentIndex:D(),partial:Q});else Y={type:"text",text:""},Q.content.push(Y),X.push({type:"text_start",contentIndex:D(),partial:Q})}if(Y.type==="thinking")Y.thinking+=Z.text,Y.thinkingSignature=A(Y.thinkingSignature,Z.thoughtSignature),X.push({type:"thinking_delta",contentIndex:D(),delta:Z.text,partial:Q});else Y.text+=Z.text,Y.textSignature=A(Y.textSignature,Z.thoughtSignature),X.push({type:"text_delta",contentIndex:D(),delta:Z.text,partial:Q})}if(Z.functionCall){if(Y){if(Y.type==="text")X.push({type:"text_end",contentIndex:D(),content:Y.text,partial:Q});else X.push({type:"thinking_end",contentIndex:D(),content:Y.thinking,partial:Q});Y=null}let S=Z.functionCall.id,j={type:"toolCall",id:!S||Q.content.some((O)=>O.type==="toolCall"&&O.id===S)?`${Z.functionCall.name}_${Date.now()}_${++s}`:S,name:Z.functionCall.name||"",arguments:Z.functionCall.args??{},...Z.thoughtSignature&&{thoughtSignature:Z.thoughtSignature}};Q.content.push(j),X.push({type:"toolcall_start",contentIndex:D(),partial:Q}),X.push({type:"toolcall_delta",contentIndex:D(),delta:JSON.stringify(j.arguments),partial:Q}),X.push({type:"toolcall_end",contentIndex:D(),toolCall:j,partial:Q})}}if(G?.finishReason){if(Q.stopReason=g(G.finishReason),Q.content.some((Z)=>Z.type==="toolCall"))Q.stopReason="toolUse"}if(W.usageMetadata)Q.usage={input:(W.usageMetadata.promptTokenCount||0)-(W.usageMetadata.cachedContentTokenCount||0),output:(W.usageMetadata.candidatesTokenCount||0)+(W.usageMetadata.thoughtsTokenCount||0),cacheRead:W.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:W.usageMetadata.thoughtsTokenCount||0,totalTokens:W.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},L(q,Q.usage)}if(Y)if(Y.type==="text")X.push({type:"text_end",contentIndex:D(),content:Y.text,partial:Q});else X.push({type:"thinking_end",contentIndex:D(),content:Y.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");X.push({type:"done",reason:Q.stopReason,message:Q}),X.end()}catch(z){for(let $ of Q.content)if("index"in $)delete $.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=y(K(z)),X.push({type:"error",reason:Q.stopReason,error:Q}),X.end()}})(),X},Gq=(q,w,J)=>{let X=I(q,w,J,void 0);if(!J?.reasoning)return V(q,w,{...X,thinking:{enabled:!1}});let Q=P(q,J.reasoning),z=Q==="off"?"high":Q,$=q;if(E($)||a($))return V(q,w,{...X,thinking:{enabled:!0,level:Qq(z,$)}});return V(q,w,{...X,thinking:{enabled:!0,budgetTokens:Xq($,z,J.thinkingBudgets)}})};function p(q,w,J,X,Q){let z=n(Q);return new H({vertexai:!0,project:w,location:J,apiVersion:k,...z?{googleAuthOptions:z}:{},httpOptions:m(q,X)})}function l(q,w,J){return new H({vertexai:!0,apiKey:w,apiVersion:k,httpOptions:m(q,J)})}function m(q,w){let J={},X=r(q.baseUrl);if(X){if(J.baseUrl=X,J.baseUrlResourceScope=v.COLLECTION,i(X))J.apiVersion=""}let Q=T({...q.headers,...w});if(Q)J.headers=Q;return Object.keys(J).length>0?J:void 0}function r(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function i(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function n(q){let w=F("GOOGLE_APPLICATION_CREDENTIALS",q);return w?{keyFilename:w}:void 0}function e(q){let w=q?.apiKey?.trim();if(!w||w===u||t(w))return;return w}function t(q){return/^<[^>]+>$/.test(q)}function o(q){let w=q?.project||F("GOOGLE_CLOUD_PROJECT",q?.env)||F("GCLOUD_PROJECT",q?.env);if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function qq(q){let w=q?.location||F("GOOGLE_CLOUD_LOCATION",q?.env);if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function wq(q,w,J={}){let X=b(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let z=w.tools?.length?f(w.tools,J.toolChoice,x(q.id)):void 0,$={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:C(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:h(w.tools)},...z!==void 0&&{toolConfig:{functionCallingConfig:{mode:z}}}};if(J.thinking?.enabled&&q.reasoning){let _={includeThoughts:!0};if(J.thinking.level!==void 0)_.thinkingLevel=c[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)_.thinkingBudget=J.thinking.budgetTokens;$.thinkingConfig=_}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)$.thinkingConfig=Jq(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");$.abortSignal=J.signal}return{model:q.id,contents:X,config:$}}function E(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function a(q){let w=q.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(w)||w==="gemini-flash-latest"||w==="gemini-flash-lite-latest"}function Jq(q){let w=q;if(E(w))return{thinkingLevel:N.LOW};if(a(w))return{thinkingLevel:N.MINIMAL};return{thinkingBudget:0}}function Qq(q,w){if(E(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function Xq(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Gq as streamSimple,V as stream};
2
+ import{tl as F}from"./chunk-21rp4vzr.js";import{Al as x,Bl as f,Cl as g,wl as B,xl as A,yl as b,zl as h}from"./chunk-k5yxntns.js";import{El as N,Gl as v,Hl as H}from"./chunk-5f9fk8x0.js";import{Il as K,Jl as y}from"./chunk-xexxh1zq.js";import{Ql as I}from"./chunk-ph43tgr6.js";import{Tl as C}from"./chunk-mjxay7yv.js";import{Vl as T}from"./chunk-r5rf62aa.js";import{$l as P,_l as L}from"./chunk-h9f55mjv.js";import{am as U}from"./chunk-m7d52gfe.js";import"./chunk-2em77vjv.js";var k="v1",u="gcp-vertex-credentials",c={THINKING_LEVEL_UNSPECIFIED:N.THINKING_LEVEL_UNSPECIFIED,MINIMAL:N.MINIMAL,LOW:N.LOW,MEDIUM:N.MEDIUM,HIGH:N.HIGH},s=0,V=(q,w,J)=>{let X=new U;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",provider:q.provider,model:q.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 z=e(J),$=z?l(q,z,J?.headers):p(q,o(J),qq(J),J?.headers,J?.env),R=wq(q,w,J),_=await J?.onPayload?.(R,q);if(_!==void 0)R=_;let d=await $.models.generateContentStream(R);X.push({type:"start",partial:Q});let Y=null,M=Q.content,D=()=>M.length-1;for await(let W of d){Q.responseId||=W.responseId;let G=W.candidates?.[0];if(G?.content?.parts)for(let Z of G.content.parts){if(Z.text!==void 0){let S=B(Z);if(!Y||S&&Y.type!=="thinking"||!S&&Y.type!=="text"){if(Y)if(Y.type==="text")X.push({type:"text_end",contentIndex:M.length-1,content:Y.text,partial:Q});else X.push({type:"thinking_end",contentIndex:D(),content:Y.thinking,partial:Q});if(S)Y={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Y),X.push({type:"thinking_start",contentIndex:D(),partial:Q});else Y={type:"text",text:""},Q.content.push(Y),X.push({type:"text_start",contentIndex:D(),partial:Q})}if(Y.type==="thinking")Y.thinking+=Z.text,Y.thinkingSignature=A(Y.thinkingSignature,Z.thoughtSignature),X.push({type:"thinking_delta",contentIndex:D(),delta:Z.text,partial:Q});else Y.text+=Z.text,Y.textSignature=A(Y.textSignature,Z.thoughtSignature),X.push({type:"text_delta",contentIndex:D(),delta:Z.text,partial:Q})}if(Z.functionCall){if(Y){if(Y.type==="text")X.push({type:"text_end",contentIndex:D(),content:Y.text,partial:Q});else X.push({type:"thinking_end",contentIndex:D(),content:Y.thinking,partial:Q});Y=null}let S=Z.functionCall.id,j={type:"toolCall",id:!S||Q.content.some((O)=>O.type==="toolCall"&&O.id===S)?`${Z.functionCall.name}_${Date.now()}_${++s}`:S,name:Z.functionCall.name||"",arguments:Z.functionCall.args??{},...Z.thoughtSignature&&{thoughtSignature:Z.thoughtSignature}};Q.content.push(j),X.push({type:"toolcall_start",contentIndex:D(),partial:Q}),X.push({type:"toolcall_delta",contentIndex:D(),delta:JSON.stringify(j.arguments),partial:Q}),X.push({type:"toolcall_end",contentIndex:D(),toolCall:j,partial:Q})}}if(G?.finishReason){if(Q.stopReason=g(G.finishReason),Q.content.some((Z)=>Z.type==="toolCall"))Q.stopReason="toolUse"}if(W.usageMetadata)Q.usage={input:(W.usageMetadata.promptTokenCount||0)-(W.usageMetadata.cachedContentTokenCount||0),output:(W.usageMetadata.candidatesTokenCount||0)+(W.usageMetadata.thoughtsTokenCount||0),cacheRead:W.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:W.usageMetadata.thoughtsTokenCount||0,totalTokens:W.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},L(q,Q.usage)}if(Y)if(Y.type==="text")X.push({type:"text_end",contentIndex:D(),content:Y.text,partial:Q});else X.push({type:"thinking_end",contentIndex:D(),content:Y.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");X.push({type:"done",reason:Q.stopReason,message:Q}),X.end()}catch(z){for(let $ of Q.content)if("index"in $)delete $.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=y(K(z)),X.push({type:"error",reason:Q.stopReason,error:Q}),X.end()}})(),X},Gq=(q,w,J)=>{let X=I(q,w,J,void 0);if(!J?.reasoning)return V(q,w,{...X,thinking:{enabled:!1}});let Q=P(q,J.reasoning),z=Q==="off"?"high":Q,$=q;if(E($)||a($))return V(q,w,{...X,thinking:{enabled:!0,level:Qq(z,$)}});return V(q,w,{...X,thinking:{enabled:!0,budgetTokens:Xq($,z,J.thinkingBudgets)}})};function p(q,w,J,X,Q){let z=n(Q);return new H({vertexai:!0,project:w,location:J,apiVersion:k,...z?{googleAuthOptions:z}:{},httpOptions:m(q,X)})}function l(q,w,J){return new H({vertexai:!0,apiKey:w,apiVersion:k,httpOptions:m(q,J)})}function m(q,w){let J={},X=r(q.baseUrl);if(X){if(J.baseUrl=X,J.baseUrlResourceScope=v.COLLECTION,i(X))J.apiVersion=""}let Q=T({...q.headers,...w});if(Q)J.headers=Q;return Object.keys(J).length>0?J:void 0}function r(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function i(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function n(q){let w=F("GOOGLE_APPLICATION_CREDENTIALS",q);return w?{keyFilename:w}:void 0}function e(q){let w=q?.apiKey?.trim();if(!w||w===u||t(w))return;return w}function t(q){return/^<[^>]+>$/.test(q)}function o(q){let w=q?.project||F("GOOGLE_CLOUD_PROJECT",q?.env)||F("GCLOUD_PROJECT",q?.env);if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function qq(q){let w=q?.location||F("GOOGLE_CLOUD_LOCATION",q?.env);if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function wq(q,w,J={}){let X=b(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let z=w.tools?.length?f(w.tools,J.toolChoice,x(q.id)):void 0,$={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:C(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:h(w.tools)},...z!==void 0&&{toolConfig:{functionCallingConfig:{mode:z}}}};if(J.thinking?.enabled&&q.reasoning){let _={includeThoughts:!0};if(J.thinking.level!==void 0)_.thinkingLevel=c[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)_.thinkingBudget=J.thinking.budgetTokens;$.thinkingConfig=_}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)$.thinkingConfig=Jq(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");$.abortSignal=J.signal}return{model:q.id,contents:X,config:$}}function E(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function a(q){let w=q.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(w)||w==="gemini-flash-latest"||w==="gemini-flash-lite-latest"}function Jq(q){let w=q;if(E(w))return{thinkingLevel:N.LOW};if(a(w))return{thinkingLevel:N.MINIMAL};return{thinkingBudget:0}}function Qq(q,w){if(E(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function Xq(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Gq as streamSimple,V as stream};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var j=Object.create;var{getPrototypeOf:k,defineProperty:f,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,s=(a,b,c)=>{var g=a!=null&&typeof a==="object";if(g){var h=b?o??=new WeakMap:p??=new WeakMap,i=h.get(a);if(i)return i}c=a!=null?j(k(a)):{};let d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of l(a))if(!m.call(d,e))f(d,e,{get:n.bind(a,e),enumerable:!0});if(g)h.set(a,d);return d};var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var q=(a)=>a;function r(a,b){this[a]=q.bind(null,b)}var u=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0,configurable:!0,set:r.bind(b,c)})};var v=(a,b)=>()=>(a&&(b=a(a=0)),b);var w=(a)=>JSON.parse(a);var x=import.meta.require;
3
- export{s as Nl,t as Ol,u as Pl,v as Ql,w as Rl,x as Sl};
3
+ export{s as em,t as fm,u as gm,v as hm,w as im,x as jm};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-xg9xscqz.js";import{Fc as w,nc as I}from"./chunk-ftc48rbb.js";import"./chunk-nvjp2rnh.js";import"./chunk-dej1gq35.js";function R(q,$){if(typeof q==="string"&&typeof $==="string")return q.toLowerCase()===$.toLowerCase();return q===$}function y(q,$){if(typeof q!=="string")return $.includes(q);return $.some((E)=>typeof E==="string"&&q.toLowerCase()===E.toLowerCase())}function j(q,$){return!y(q,$)}function g(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().includes($.toLowerCase())}function f(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().startsWith($.toLowerCase())}function V(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().endsWith($.toLowerCase())}var v=(q,$)=>{let E=null,M=w({config:{adapterId:"memory",adapterName:"Memory Adapter",usePlural:!1,debugLogs:$?.debugLogs||!1,supportsArrays:!0,customTransformInput(P){if(P.options.advanced?.database?.generateId==="serial"&&P.field==="id"&&P.action==="create")return q[P.model].length+1;return P.data},transaction:async(P)=>{let A=structuredClone(q);try{return await P(M(E))}catch(_){throw Object.keys(q).forEach((S)=>{q[S]=A[S]}),_}}},adapter:({getFieldName:P,getDefaultFieldName:A,options:_,getModelName:S})=>{let N=(x,K,Y)=>{if(!K)return x;return x.sort((L,Z)=>{let z=P({model:Y,field:K.field}),D=L[z],X=Z[z],Q=0;if(D==null&&X==null)Q=0;else if(D==null)Q=-1;else if(X==null)Q=1;else if(typeof D==="string"&&typeof X==="string")Q=D.localeCompare(X);else if(D instanceof Date&&X instanceof Date)Q=D.getTime()-X.getTime();else if(typeof D==="number"&&typeof X==="number")Q=D-X;else if(typeof D==="boolean"&&typeof X==="boolean")Q=D===X?0:D?1:-1;else Q=String(D).localeCompare(String(X));return K.direction==="asc"?Q:-Q})};function F(x,K,Y,L){let Z=(()=>{let X=q[K];if(!X)throw I.error(`[MemoryAdapter] Model ${K} not found in the DB`,Object.keys(q)),Error(`Model ${K} not found`);let Q=(G,O)=>{let{field:J,value:H,operator:B,mode:k="sensitive"}=O,U=k==="insensitive"&&(typeof H==="string"||Array.isArray(H)&&H.every((W)=>typeof W==="string"));switch(B){case"in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return y(G[J],H);return H.includes(G[J]);case"not_in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return j(G[J],H);return!H.includes(G[J]);case"contains":if(U)return g(G[J],H);return G[J]?.includes(H);case"starts_with":if(U)return f(G[J],H);return G[J].startsWith(H);case"ends_with":if(U)return V(G[J],H);return G[J].endsWith(H);case"ne":return U?!R(G[J],H):G[J]!==H;case"gt":return H!=null&&Boolean(G[J]>H);case"gte":return H!=null&&Boolean(G[J]>=H);case"lt":return H!=null&&Boolean(G[J]<H);case"lte":return H!=null&&Boolean(G[J]<=H);default:if(U)return R(G[J],H);if(H===null)return G[J]==null;return G[J]===H}},T=X.filter((G)=>{if(!x.length||x.length===0)return!0;let O=Q(G,x[0]);for(let J of x){let H=Q(G,J);if(J.connector==="OR")O=O||H;else O=O&&H}return O});if(L?.length&&L.length>0)T=T.map((G)=>Object.fromEntries(Object.entries(G).filter(([O])=>L.includes(A({model:K,field:O})))));return T})();if(!Y)return Z;let z=new Map,D=new Map;for(let X of Z){let Q=String(X.id);if(!z.has(Q)){let G={...X};for(let[O,J]of Object.entries(Y)){let H=S(O);if(J.relation==="one-to-one")G[H]=null;else G[H]=[],D.set(`${Q}-${O}`,new Set)}z.set(Q,G)}let T=z.get(Q);for(let[G,O]of Object.entries(Y)){let J=S(G),H=q[J];if(!H)throw I.error(`[MemoryAdapter] JoinOption model ${J} not found in the DB`,Object.keys(q)),Error(`JoinOption model ${J} not found`);let B=H.filter((k)=>k[O.on.to]===X[O.on.from]);if(O.relation==="one-to-one")T[J]=B[0]||null;else{let k=D.get(`${Q}-${G}`),U=O.limit??100,W=0;for(let C of B){if(W>=U)break;if(!k.has(C.id))T[J].push(C),k.add(C.id),W++}}}}return Array.from(z.values())}return{create:async({model:x,data:K})=>{if(_.advanced?.database?.generateId==="serial")K.id=q[S(x)].length+1;if(!q[x])q[x]=[];return q[x].push(K),K},findOne:async({model:x,where:K,select:Y,join:L})=>{let Z=F(K,x,L,Y);if(L){let z=Z;if(!z.length)return null;return z[0]}return Z[0]||null},findMany:async({model:x,where:K,sortBy:Y,limit:L,select:Z,offset:z,join:D})=>{let X=F(K||[],x,D,Z);if(D){let T=X;if(!T.length)return[];N(T,Y,x);let G=T;if(z!==void 0)G=G.slice(z);if(L!==void 0)G=G.slice(0,L);return G}let Q=N(X,Y,x);if(z!==void 0)Q=Q.slice(z);if(L!==void 0)Q=Q.slice(0,L);return Q||[]},count:async({model:x,where:K})=>{if(K)return F(K,x).length;return q[x].length},update:async({model:x,where:K,update:Y})=>{let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null},delete:async({model:x,where:K})=>{let Y=q[x],L=F(K,x);q[x]=Y.filter((Z)=>!L.includes(Z))},deleteMany:async({model:x,where:K})=>{let Y=q[x],L=F(K,x),Z=0;return q[x]=Y.filter((z)=>{if(L.includes(z))return Z++,!1;return!L.includes(z)}),Z},consumeOne:async({model:x,where:K})=>{let Y=q[x],L=F(K,x)[0];if(!L)return null;return q[x]=Y.filter((Z)=>Z!==L),L},updateMany({model:x,where:K,update:Y}){let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null}}}});return(P)=>{return E=P,M(P)}};export{v as memoryAdapter};
2
+ import"./chunk-xg9xscqz.js";import{Pb as w,xb as I}from"./chunk-7c85cyn0.js";import"./chunk-en96pr5c.js";import"./chunk-2em77vjv.js";function R(q,$){if(typeof q==="string"&&typeof $==="string")return q.toLowerCase()===$.toLowerCase();return q===$}function y(q,$){if(typeof q!=="string")return $.includes(q);return $.some((E)=>typeof E==="string"&&q.toLowerCase()===E.toLowerCase())}function j(q,$){return!y(q,$)}function g(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().includes($.toLowerCase())}function f(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().startsWith($.toLowerCase())}function V(q,$){if(typeof q!=="string"||typeof $!=="string")return!1;return q.toLowerCase().endsWith($.toLowerCase())}var v=(q,$)=>{let E=null,M=w({config:{adapterId:"memory",adapterName:"Memory Adapter",usePlural:!1,debugLogs:$?.debugLogs||!1,supportsArrays:!0,customTransformInput(P){if(P.options.advanced?.database?.generateId==="serial"&&P.field==="id"&&P.action==="create")return q[P.model].length+1;return P.data},transaction:async(P)=>{let A=structuredClone(q);try{return await P(M(E))}catch(_){throw Object.keys(q).forEach((S)=>{q[S]=A[S]}),_}}},adapter:({getFieldName:P,getDefaultFieldName:A,options:_,getModelName:S})=>{let N=(x,K,Y)=>{if(!K)return x;return x.sort((L,Z)=>{let z=P({model:Y,field:K.field}),D=L[z],X=Z[z],Q=0;if(D==null&&X==null)Q=0;else if(D==null)Q=-1;else if(X==null)Q=1;else if(typeof D==="string"&&typeof X==="string")Q=D.localeCompare(X);else if(D instanceof Date&&X instanceof Date)Q=D.getTime()-X.getTime();else if(typeof D==="number"&&typeof X==="number")Q=D-X;else if(typeof D==="boolean"&&typeof X==="boolean")Q=D===X?0:D?1:-1;else Q=String(D).localeCompare(String(X));return K.direction==="asc"?Q:-Q})};function F(x,K,Y,L){let Z=(()=>{let X=q[K];if(!X)throw I.error(`[MemoryAdapter] Model ${K} not found in the DB`,Object.keys(q)),Error(`Model ${K} not found`);let Q=(G,O)=>{let{field:J,value:H,operator:B,mode:k="sensitive"}=O,U=k==="insensitive"&&(typeof H==="string"||Array.isArray(H)&&H.every((W)=>typeof W==="string"));switch(B){case"in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return y(G[J],H);return H.includes(G[J]);case"not_in":if(!Array.isArray(H))throw Error("Value must be an array");if(U)return j(G[J],H);return!H.includes(G[J]);case"contains":if(U)return g(G[J],H);return G[J]?.includes(H);case"starts_with":if(U)return f(G[J],H);return G[J].startsWith(H);case"ends_with":if(U)return V(G[J],H);return G[J].endsWith(H);case"ne":return U?!R(G[J],H):G[J]!==H;case"gt":return H!=null&&Boolean(G[J]>H);case"gte":return H!=null&&Boolean(G[J]>=H);case"lt":return H!=null&&Boolean(G[J]<H);case"lte":return H!=null&&Boolean(G[J]<=H);default:if(U)return R(G[J],H);if(H===null)return G[J]==null;return G[J]===H}},T=X.filter((G)=>{if(!x.length||x.length===0)return!0;let O=Q(G,x[0]);for(let J of x){let H=Q(G,J);if(J.connector==="OR")O=O||H;else O=O&&H}return O});if(L?.length&&L.length>0)T=T.map((G)=>Object.fromEntries(Object.entries(G).filter(([O])=>L.includes(A({model:K,field:O})))));return T})();if(!Y)return Z;let z=new Map,D=new Map;for(let X of Z){let Q=String(X.id);if(!z.has(Q)){let G={...X};for(let[O,J]of Object.entries(Y)){let H=S(O);if(J.relation==="one-to-one")G[H]=null;else G[H]=[],D.set(`${Q}-${O}`,new Set)}z.set(Q,G)}let T=z.get(Q);for(let[G,O]of Object.entries(Y)){let J=S(G),H=q[J];if(!H)throw I.error(`[MemoryAdapter] JoinOption model ${J} not found in the DB`,Object.keys(q)),Error(`JoinOption model ${J} not found`);let B=H.filter((k)=>k[O.on.to]===X[O.on.from]);if(O.relation==="one-to-one")T[J]=B[0]||null;else{let k=D.get(`${Q}-${G}`),U=O.limit??100,W=0;for(let C of B){if(W>=U)break;if(!k.has(C.id))T[J].push(C),k.add(C.id),W++}}}}return Array.from(z.values())}return{create:async({model:x,data:K})=>{if(_.advanced?.database?.generateId==="serial")K.id=q[S(x)].length+1;if(!q[x])q[x]=[];return q[x].push(K),K},findOne:async({model:x,where:K,select:Y,join:L})=>{let Z=F(K,x,L,Y);if(L){let z=Z;if(!z.length)return null;return z[0]}return Z[0]||null},findMany:async({model:x,where:K,sortBy:Y,limit:L,select:Z,offset:z,join:D})=>{let X=F(K||[],x,D,Z);if(D){let T=X;if(!T.length)return[];N(T,Y,x);let G=T;if(z!==void 0)G=G.slice(z);if(L!==void 0)G=G.slice(0,L);return G}let Q=N(X,Y,x);if(z!==void 0)Q=Q.slice(z);if(L!==void 0)Q=Q.slice(0,L);return Q||[]},count:async({model:x,where:K})=>{if(K)return F(K,x).length;return q[x].length},update:async({model:x,where:K,update:Y})=>{let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null},delete:async({model:x,where:K})=>{let Y=q[x],L=F(K,x);q[x]=Y.filter((Z)=>!L.includes(Z))},deleteMany:async({model:x,where:K})=>{let Y=q[x],L=F(K,x),Z=0;return q[x]=Y.filter((z)=>{if(L.includes(z))return Z++,!1;return!L.includes(z)}),Z},consumeOne:async({model:x,where:K})=>{let Y=q[x],L=F(K,x)[0];if(!L)return null;return q[x]=Y.filter((Z)=>Z!==L),L},updateMany({model:x,where:K,update:Y}){let L=F(K,x);return L.forEach((Z)=>{Object.assign(Z,Y)}),L[0]||null}}}});return(P)=>{return E=P,M(P)}};export{v as memoryAdapter};
@@ -1,2 +1,2 @@
1
- import{Ak as o,jk as t,kk as a,zh as r}from"./chunk-m6a4rzdt.js";var c=t("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function f({className:i,variant:e="default",asChild:n=!1,...s}){let d=n?a.Root:"span";return r(d,{"data-slot":"badge","data-variant":e,className:o(c({variant:e}),i),...s})}
2
- export{f as zg};
1
+ import{Ek as t,Fk as a,Hh as r,Wk as o}from"./chunk-sjr6mvgm.js";var c=t("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function f({className:i,variant:e="default",asChild:n=!1,...s}){let d=n?a.Root:"span";return r(d,{"data-slot":"badge","data-variant":e,className:o(c({variant:e}),i),...s})}
2
+ export{f as Nf};
@@ -1,2 +1,2 @@
1
- import{Ah as i,Ak as t,sk as o,zh as r}from"./chunk-m6a4rzdt.js";function m({className:e,children:l,...a}){return i(o.Root,{"data-slot":"scroll-area",className:t("relative",e),...a,children:[r(o.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:l}),r(c,{}),r(o.Corner,{})]})}function c({className:e,orientation:l="vertical",...a}){return r(o.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:l,className:t("flex touch-none p-px transition-colors select-none",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...a,children:r(o.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}
2
- export{m as fb,c as gb};
1
+ import{Hh as r,Ih as i,Ok as o,Wk as t}from"./chunk-sjr6mvgm.js";function m({className:e,children:l,...a}){return i(o.Root,{"data-slot":"scroll-area",className:t("relative",e),...a,children:[r(o.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:l}),r(c,{}),r(o.Corner,{})]})}function c({className:e,orientation:l="vertical",...a}){return r(o.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:l,className:t("flex touch-none p-px transition-colors select-none",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...a,children:r(o.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}
2
+ export{m as Ig,c as Jg};
@@ -1,2 +1,2 @@
1
- import{Ah as F,Ak as R,jk as L,xk as O,zh as z}from"./chunk-m6a4rzdt.js";import{Ql as m}from"./chunk-dej1gq35.js";function d(a,b){var g=a.length;a.push(b);a:for(;0<g;){var w=g-1>>>1,V=a[w];if(0<Q(V,b))a[w]=b,a[g]=V,g=w;else break a}}function N(a){return a.length===0?null:a[0]}function M(a){if(a.length===0)return null;var b=a[0],g=a.pop();if(g!==b){a[0]=g;a:for(var w=0,V=a.length,G=V>>>1;w<G;){var Y=2*(w+1)-1,D=a[Y],B=Y+1,q=a[B];if(0>Q(D,g))B<V&&0>Q(q,D)?(a[w]=q,a[B]=g,w=B):(a[w]=D,a[Y]=g,w=Y);else if(B<V&&0>Q(q,g))a[w]=q,a[B]=g,w=B;else break a}}return b}function Q(a,b){var g=a.sortIndex-b.sortIndex;return g!==0?g:a.id-b.id}function U(a){for(var b=N(C);b!==null;){if(b.callback===null)M(C);else if(b.startTime<=a)M(C),b.sortIndex=b.expirationTime,d(f,b);else break;b=N(C)}}function T(a){if(Z=!1,U(a),!X)if(N(f)!==null)X=!0,K||(K=!0,J());else{var b=N(C);b!==null&&j(T,b.startTime-a)}}function h(){return k?!0:A()-x<l?!1:!0}function W(){if(k=!1,K){var a=A();x=a;var b=!0;try{a:{X=!1,Z&&(Z=!1,s($),$=-1),y=!0;var g=E;try{b:{U(a);for(_=N(f);_!==null&&!(_.expirationTime>a&&h());){var w=_.callback;if(typeof w==="function"){_.callback=null,E=_.priorityLevel;var V=w(_.expirationTime<=a);if(a=A(),typeof V==="function"){_.callback=V,U(a),b=!0;break b}_===N(f)&&M(f),U(a)}else M(f);_=N(f)}if(_!==null)b=!0;else{var G=N(C);G!==null&&j(T,G.startTime-a),b=!1}}break a}finally{_=null,E=g,y=!1}b=void 0}}finally{b?J():K=!1}}}function j(a,b){$=u(function(){a(A())},b)}var A=void 0,P,H,t,f,C,o=1,_=null,E=3,y=!1,X=!1,Z=!1,k=!1,u,s,c,K=!1,$=-1,l=5,x=-1,J,v,I,p=5,i=1,r=4,e=3,aa=2,ba=function(a){a.callback=null},za=function(){return E},ga=function(){k=!0},wa=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var g=E;E=a;try{return b()}finally{E=g}},Va=function(a,b,g){var w=A();switch(typeof g==="object"&&g!==null?(g=g.delay,g=typeof g==="number"&&0<g?w+g:w):g=w,a){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5000}return V=g+V,a={id:o++,callback:b,priorityLevel:a,startTime:g,expirationTime:V,sortIndex:-1},g>w?(a.sortIndex=g,d(C,a),N(f)===null&&a===N(C)&&(Z?(s($),$=-1):Z=!0,j(T,g-w))):(a.sortIndex=V,d(f,a),X||y||(X=!0,K||(K=!0,J()))),a},_a;var Na=m(()=>{if(typeof performance==="object"&&typeof performance.now==="function")P=performance,A=function(){return P.now()};else H=Date,t=H.now(),A=function(){return H.now()-t};f=[],C=[],u=typeof setTimeout==="function"?setTimeout:null,s=typeof clearTimeout==="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;if(typeof c==="function")J=function(){c(W)};else if(typeof MessageChannel<"u")v=new MessageChannel,I=v.port2,v.port1.onmessage=W,J=function(){I.postMessage(null)};else J=function(){u(W,0)};_a=h});function Ba({className:a,orientation:b="horizontal",...g}){return z(O.Root,{"data-slot":"tabs","data-orientation":b,orientation:b,className:R("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",a),...g})}var n=L("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Ea({className:a,variant:b="default",...g}){return z(O.List,{"data-slot":"tabs-list","data-variant":b,className:R(n({variant:b}),a),...g})}function Fa({className:a,...b}){return z(O.Trigger,{"data-slot":"tabs-trigger",className:R("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",a),...b})}function Ja({className:a,...b}){return z(O.Content,{"data-slot":"tabs-content",className:R("flex-1 outline-none",a),...b})}var S={viewBox:"0 -960 960 960",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},Ra=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Z"})}),Xa=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Zm200 0v-560H640v560h120Z"})}),Za=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm560-80v-560H400v560h360Z"})}),$a=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Z"})}),Ga=(a)=>F("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[z("path",{d:"M12 8V4H8"}),z("path",{d:"M6 7H18A3 3 0 0 1 21 10V18A3 3 0 0 1 18 21H6A3 3 0 0 1 3 18V10A3 3 0 0 1 6 7ZM8 13V15A1 1 0 0 0 10 15V13A1 1 0 0 0 8 13ZM14 13V15A1 1 0 0 0 16 15V13A1 1 0 0 0 14 13Z",fill:"currentColor",stroke:"none"}),z("path",{d:"M2 14h2"}),z("path",{d:"M20 14h2"})]}),Ya=(a)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",width:30,height:30,viewBox:"120 -792 720 720",fill:"none","aria-hidden":"true",focusable:"false",...a,children:z("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M 160 -180 v -72 h 80 v -252 q 0 -74.7 50 -132.75 T 420 -712.8 v -25.2 q 0 -22.5 17.5 -38.25 T 480 -792 q 25 0 42.5 15.75 T 540 -738 v 25.2 q 80 18 130 76.05 T 720 -504 v 252 h 80 v 72 H 160 Z M 480 -72 q -33 0 -56.5 -21.15 T 400 -144 h 160 q 0 29.7 -23.5 50.85 T 480 -72 Z",fill:"currentColor"})}),qa=(a)=>F("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",...a,children:[z("path",{d:"M10.77 10.377a1 1 0 0 0-.132.437l-.105 1.665a.5.5 0 0 0 .793.436l1.32-.96a1 1 0 0 0 .278-.309l3.912-6.775a1.25 1.25 0 1 0-2.165-1.25l-3.901 6.756Z",fill:"currentColor"}),z("path",{d:"M11.016 6.75a.758.758 0 0 1-.758.748c-2.938 0-4.882 1.71-5.517 3.95-.708 2.499.245 4.459 1.979 5.851 1.767 1.42 4.31 2.203 6.547 2.203.415 0 .749.335.745.748a.758.758 0 0 1-.758.748c-2.536 0-5.421-.873-7.485-2.531-2.098-1.686-3.38-4.225-2.475-7.414.818-2.883 3.354-5.051 6.977-5.051.415 0 .749.335.745.748Z",fill:"currentColor"}),z("path",{d:"M17.147 8.315a.767.767 0 0 1 1.058-.168c1.666 1.188 2.508 2.542 2.733 3.876a4.5 4.5 0 0 1-.805 3.392c-.919 1.434-2.714 2.074-4.479 2.185-1.799.113-3.78-.302-5.292-1.216a.733.733 0 0 1-.242-1.022.768.768 0 0 1 1.042-.246c1.216.734 2.881 1.096 4.409 1 1.553-.097 2.755-.647 3.292-1.5l.015-.022.015-.021a3.025 3.025 0 0 0 .553-2.294c-.148-.876-.72-1.915-2.137-2.926a.733.733 0 0 1-.162-1.038Z",fill:"currentColor"})]}),Sa=(a)=>{return F("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a,children:[z("defs",{children:z("clipPath",{id:"bg-clip",children:z("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22"})})}),z("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22",fill:"#D95A66"}),z("path",{d:"M 35 75 L 65 75 L 80 60 L 75 30 L 175 130 L 135 175 Z",fill:"#A8384D",clipPath:"url(#bg-clip)"}),z("path",{d:"M 25 30 Q 38 36 50 42 L 35 55 L 35 75 L 20 60 Z",fill:"#FDF0D5"}),z("path",{d:"M 50 42 Q 62 36 75 30 L 80 60 L 65 75 L 65 55 Z",fill:"#E77A65"}),z("path",{d:"M 35 75 L 65 75 L 65 55 L 50 42 L 35 55 Z",fill:"#F5B895"}),z("path",{d:"M 50 42 Q 38 36 25 30 Q 38 26 50 20 Q 62 26 75 30 Q 62 36 50 42 Z",fill:"#F4B8B8"}),z("path",{d:"M 50 25 L 42 30 L 50 35 Z",fill:"#E57A5F"}),z("path",{d:"M 50 25 L 58 30 L 50 35 Z",fill:"#C2523C"})]})},Qa=(a)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"24 24 152 152",fill:"none","aria-hidden":"true",focusable:"false",...a,children:z("path",{d:"M 44 170 L 44 100 L 24 100 L 100 30 L 126 54 L 126 36 L 142 36 L 142 69 L 176 100 L 156 100 L 156 170 L 120 170 L 120 136 A 20 20 0 0 0 80 136 L 80 170 Z",fill:"currentColor"})});function Ha({uploading:a=!1,className:b="",...g}){return F("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"15 15 70 70",width:30,height:30,className:`${b} ${a?"animate-upload-breathing":""}`,"aria-hidden":"true",focusable:"false",style:a?{transformOrigin:"center"}:void 0,...g,children:[a&&z("defs",{children:F("linearGradient",{id:"upload-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[z("stop",{offset:"0%",stopColor:"#3b82f6",children:z("animate",{attributeName:"stop-color",values:"#3b82f6;#ec4899;#8b5cf6;#3b82f6",dur:"3s",repeatCount:"indefinite"})}),z("stop",{offset:"50%",stopColor:"#8b5cf6",children:z("animate",{attributeName:"stop-color",values:"#8b5cf6;#3b82f6;#ec4899;#8b5cf6",dur:"3s",repeatCount:"indefinite"})}),z("stop",{offset:"100%",stopColor:"#ec4899",children:z("animate",{attributeName:"stop-color",values:"#ec4899;#8b5cf6;#3b82f6;#ec4899",dur:"3s",repeatCount:"indefinite"})})]})}),z("path",{d:"M 44.1 75 H 30 A 15 15 0 0 1 30 45 A 20 20 0 0 1 70 45 A 15 15 0 0 1 70 75 H 55.9 V 60.2 H 61.9 L 50 45.3 L 38.1 60.2 H 44.1 Z",fill:a?"url(#upload-gradient)":"currentColor"})]})}
2
- export{A as Vf,p as Wf,i as Xf,r as Yf,e as Zf,aa as _f,ba as $f,za as ag,ga as bg,wa as cg,Va as dg,_a as eg,Na as fg,Ba as gg,Ea as hg,Fa as ig,Ja as jg,Ra as kg,Xa as lg,Za as mg,$a as ng,Ga as og,Ya as pg,qa as qg,Sa as rg,Qa as sg,Ha as tg};
1
+ import{Ek as L,Hh as z,Ih as F,Tk as O,Wk as R}from"./chunk-sjr6mvgm.js";import{hm as m}from"./chunk-2em77vjv.js";function d(a,b){var g=a.length;a.push(b);a:for(;0<g;){var w=g-1>>>1,V=a[w];if(0<Q(V,b))a[w]=b,a[g]=V,g=w;else break a}}function N(a){return a.length===0?null:a[0]}function M(a){if(a.length===0)return null;var b=a[0],g=a.pop();if(g!==b){a[0]=g;a:for(var w=0,V=a.length,G=V>>>1;w<G;){var Y=2*(w+1)-1,D=a[Y],B=Y+1,q=a[B];if(0>Q(D,g))B<V&&0>Q(q,D)?(a[w]=q,a[B]=g,w=B):(a[w]=D,a[Y]=g,w=Y);else if(B<V&&0>Q(q,g))a[w]=q,a[B]=g,w=B;else break a}}return b}function Q(a,b){var g=a.sortIndex-b.sortIndex;return g!==0?g:a.id-b.id}function U(a){for(var b=N(C);b!==null;){if(b.callback===null)M(C);else if(b.startTime<=a)M(C),b.sortIndex=b.expirationTime,d(f,b);else break;b=N(C)}}function T(a){if(Z=!1,U(a),!X)if(N(f)!==null)X=!0,K||(K=!0,J());else{var b=N(C);b!==null&&j(T,b.startTime-a)}}function h(){return k?!0:A()-x<l?!1:!0}function W(){if(k=!1,K){var a=A();x=a;var b=!0;try{a:{X=!1,Z&&(Z=!1,s($),$=-1),y=!0;var g=E;try{b:{U(a);for(_=N(f);_!==null&&!(_.expirationTime>a&&h());){var w=_.callback;if(typeof w==="function"){_.callback=null,E=_.priorityLevel;var V=w(_.expirationTime<=a);if(a=A(),typeof V==="function"){_.callback=V,U(a),b=!0;break b}_===N(f)&&M(f),U(a)}else M(f);_=N(f)}if(_!==null)b=!0;else{var G=N(C);G!==null&&j(T,G.startTime-a),b=!1}}break a}finally{_=null,E=g,y=!1}b=void 0}}finally{b?J():K=!1}}}function j(a,b){$=u(function(){a(A())},b)}var A=void 0,P,H,t,f,C,o=1,_=null,E=3,y=!1,X=!1,Z=!1,k=!1,u,s,c,K=!1,$=-1,l=5,x=-1,J,v,I,p=5,i=1,r=4,e=3,aa=2,ba=function(a){a.callback=null},za=function(){return E},ga=function(){k=!0},wa=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var g=E;E=a;try{return b()}finally{E=g}},Va=function(a,b,g){var w=A();switch(typeof g==="object"&&g!==null?(g=g.delay,g=typeof g==="number"&&0<g?w+g:w):g=w,a){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5000}return V=g+V,a={id:o++,callback:b,priorityLevel:a,startTime:g,expirationTime:V,sortIndex:-1},g>w?(a.sortIndex=g,d(C,a),N(f)===null&&a===N(C)&&(Z?(s($),$=-1):Z=!0,j(T,g-w))):(a.sortIndex=V,d(f,a),X||y||(X=!0,K||(K=!0,J()))),a},_a;var Na=m(()=>{if(typeof performance==="object"&&typeof performance.now==="function")P=performance,A=function(){return P.now()};else H=Date,t=H.now(),A=function(){return H.now()-t};f=[],C=[],u=typeof setTimeout==="function"?setTimeout:null,s=typeof clearTimeout==="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;if(typeof c==="function")J=function(){c(W)};else if(typeof MessageChannel<"u")v=new MessageChannel,I=v.port2,v.port1.onmessage=W,J=function(){I.postMessage(null)};else J=function(){u(W,0)};_a=h});function Ba({className:a,orientation:b="horizontal",...g}){return z(O.Root,{"data-slot":"tabs","data-orientation":b,orientation:b,className:R("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",a),...g})}var n=L("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Ea({className:a,variant:b="default",...g}){return z(O.List,{"data-slot":"tabs-list","data-variant":b,className:R(n({variant:b}),a),...g})}function Fa({className:a,...b}){return z(O.Trigger,{"data-slot":"tabs-trigger",className:R("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",a),...b})}function Ja({className:a,...b}){return z(O.Content,{"data-slot":"tabs-content",className:R("flex-1 outline-none",a),...b})}var S={viewBox:"0 -960 960 960",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},Ra=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Z"})}),Xa=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Zm200 0v-560H640v560h120Z"})}),Za=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm560-80v-560H400v560h360Z"})}),$a=(a)=>z("svg",{...S,...a,children:z("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Z"})}),Ga=(a)=>F("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...a,children:[z("path",{d:"M12 8V4H8"}),z("path",{d:"M6 7H18A3 3 0 0 1 21 10V18A3 3 0 0 1 18 21H6A3 3 0 0 1 3 18V10A3 3 0 0 1 6 7ZM8 13V15A1 1 0 0 0 10 15V13A1 1 0 0 0 8 13ZM14 13V15A1 1 0 0 0 16 15V13A1 1 0 0 0 14 13Z",fill:"currentColor",stroke:"none"}),z("path",{d:"M2 14h2"}),z("path",{d:"M20 14h2"})]}),Ya=(a)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",width:30,height:30,viewBox:"120 -792 720 720",fill:"none","aria-hidden":"true",focusable:"false",...a,children:z("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M 160 -180 v -72 h 80 v -252 q 0 -74.7 50 -132.75 T 420 -712.8 v -25.2 q 0 -22.5 17.5 -38.25 T 480 -792 q 25 0 42.5 15.75 T 540 -738 v 25.2 q 80 18 130 76.05 T 720 -504 v 252 h 80 v 72 H 160 Z M 480 -72 q -33 0 -56.5 -21.15 T 400 -144 h 160 q 0 29.7 -23.5 50.85 T 480 -72 Z",fill:"currentColor"})}),qa=(a)=>F("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",...a,children:[z("path",{d:"M10.77 10.377a1 1 0 0 0-.132.437l-.105 1.665a.5.5 0 0 0 .793.436l1.32-.96a1 1 0 0 0 .278-.309l3.912-6.775a1.25 1.25 0 1 0-2.165-1.25l-3.901 6.756Z",fill:"currentColor"}),z("path",{d:"M11.016 6.75a.758.758 0 0 1-.758.748c-2.938 0-4.882 1.71-5.517 3.95-.708 2.499.245 4.459 1.979 5.851 1.767 1.42 4.31 2.203 6.547 2.203.415 0 .749.335.745.748a.758.758 0 0 1-.758.748c-2.536 0-5.421-.873-7.485-2.531-2.098-1.686-3.38-4.225-2.475-7.414.818-2.883 3.354-5.051 6.977-5.051.415 0 .749.335.745.748Z",fill:"currentColor"}),z("path",{d:"M17.147 8.315a.767.767 0 0 1 1.058-.168c1.666 1.188 2.508 2.542 2.733 3.876a4.5 4.5 0 0 1-.805 3.392c-.919 1.434-2.714 2.074-4.479 2.185-1.799.113-3.78-.302-5.292-1.216a.733.733 0 0 1-.242-1.022.768.768 0 0 1 1.042-.246c1.216.734 2.881 1.096 4.409 1 1.553-.097 2.755-.647 3.292-1.5l.015-.022.015-.021a3.025 3.025 0 0 0 .553-2.294c-.148-.876-.72-1.915-2.137-2.926a.733.733 0 0 1-.162-1.038Z",fill:"currentColor"})]}),Sa=(a)=>{return F("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a,children:[z("defs",{children:z("clipPath",{id:"bg-clip",children:z("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22"})})}),z("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22",fill:"#D95A66"}),z("path",{d:"M 35 75 L 65 75 L 80 60 L 75 30 L 175 130 L 135 175 Z",fill:"#A8384D",clipPath:"url(#bg-clip)"}),z("path",{d:"M 25 30 Q 38 36 50 42 L 35 55 L 35 75 L 20 60 Z",fill:"#FDF0D5"}),z("path",{d:"M 50 42 Q 62 36 75 30 L 80 60 L 65 75 L 65 55 Z",fill:"#E77A65"}),z("path",{d:"M 35 75 L 65 75 L 65 55 L 50 42 L 35 55 Z",fill:"#F5B895"}),z("path",{d:"M 50 42 Q 38 36 25 30 Q 38 26 50 20 Q 62 26 75 30 Q 62 36 50 42 Z",fill:"#F4B8B8"}),z("path",{d:"M 50 25 L 42 30 L 50 35 Z",fill:"#E57A5F"}),z("path",{d:"M 50 25 L 58 30 L 50 35 Z",fill:"#C2523C"})]})},Qa=(a)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"24 24 152 152",fill:"none","aria-hidden":"true",focusable:"false",...a,children:z("path",{d:"M 44 170 L 44 100 L 24 100 L 100 30 L 126 54 L 126 36 L 142 36 L 142 69 L 176 100 L 156 100 L 156 170 L 120 170 L 120 136 A 20 20 0 0 0 80 136 L 80 170 Z",fill:"currentColor"})});function Ha({uploading:a=!1,className:b="",...g}){return F("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"15 15 70 70",width:30,height:30,className:`${b} ${a?"animate-upload-breathing":""}`,"aria-hidden":"true",focusable:"false",style:a?{transformOrigin:"center"}:void 0,...g,children:[a&&z("defs",{children:F("linearGradient",{id:"upload-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[z("stop",{offset:"0%",stopColor:"#3b82f6",children:z("animate",{attributeName:"stop-color",values:"#3b82f6;#ec4899;#8b5cf6;#3b82f6",dur:"3s",repeatCount:"indefinite"})}),z("stop",{offset:"50%",stopColor:"#8b5cf6",children:z("animate",{attributeName:"stop-color",values:"#8b5cf6;#3b82f6;#ec4899;#8b5cf6",dur:"3s",repeatCount:"indefinite"})}),z("stop",{offset:"100%",stopColor:"#ec4899",children:z("animate",{attributeName:"stop-color",values:"#ec4899;#8b5cf6;#3b82f6;#ec4899",dur:"3s",repeatCount:"indefinite"})})]})}),z("path",{d:"M 44.1 75 H 30 A 15 15 0 0 1 30 45 A 20 20 0 0 1 70 45 A 15 15 0 0 1 70 75 H 55.9 V 60.2 H 61.9 L 50 45.3 L 38.1 60.2 H 44.1 Z",fill:a?"url(#upload-gradient)":"currentColor"})]})}
2
+ export{A as jf,p as kf,i as lf,r as mf,e as nf,aa as of,ba as pf,za as qf,ga as rf,wa as sf,Va as tf,_a as uf,Na as vf,Ba as wf,Ea as xf,Fa as yf,Ja as zf,Ra as Af,Xa as Bf,Za as Cf,$a as Df,Ga as Ef,Ya as Ff,qa as Gf,Sa as Hf,Qa as If,Ha as Jf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function f(b){if(b===void 0)return;let d=Array.from(b);if(d.length<=64)return b;return d.slice(0,64).join("")}
3
- export{f as Xk};
3
+ export{f as ol};
@@ -1,2 +1,2 @@
1
- import{Ik as c,Qh as n,bi as e,zh as r}from"./chunk-m6a4rzdt.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
- export{i as yf,l as zf,u as Af};
1
+ import{$k as c,Hh as r,Yh as n,ji as e}from"./chunk-sjr6mvgm.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
+ export{i as Ke,l as Le,u as Me};
@@ -0,0 +1 @@
1
+ import{k as g}from"./chunk-scmhhrte.js";import"./chunk-c24an5j3.js";import"./chunk-qmja7bsr.js";import"./chunk-wgjghs54.js";import"./chunk-6pmsknnk.js";import"./chunk-61bxmjd9.js";import"./chunk-ep138kb3.js";import"./chunk-99f9r6xm.js";import"./chunk-jg31cnqc.js";import"./chunk-yxtb7xn8.js";import"./chunk-0mmw31pj.js";import"./chunk-drjaw6a5.js";import"./chunk-tvzfm7g8.js";import"./chunk-5386brz2.js";import"./chunk-15jsnygy.js";import"./chunk-4d3wm83a.js";import"./chunk-8bhsdk1v.js";import"./chunk-fvwz4mgw.js";import"./chunk-xyzsmjtk.js";import{cf as x}from"./chunk-9ntwrvhz.js";import{ef as f}from"./chunk-agdza65r.js";import"./chunk-kmt9fj1z.js";import"./chunk-0zbwpfsk.js";import"./chunk-33r4w0yv.js";import"./chunk-q0xv46wa.js";import"./chunk-2t0asg3w.js";import"./chunk-cynjx7ha.js";import"./chunk-rjr8c8be.js";import"./chunk-g3p6h6sw.js";import"./chunk-2xaq1y16.js";import"./chunk-f3rqamey.js";import"./chunk-rjkj0dr9.js";import"./chunk-rq4h4p2g.js";import"./chunk-75segwsp.js";import"./chunk-5fj5w0gg.js";import{Bh as p}from"./chunk-jfjjh86p.js";import{Fh as v,Hh as a,Mh as r,Nh as o,Zh as c,ji as h}from"./chunk-sjr6mvgm.js";import{em as w}from"./chunk-2em77vjv.js";var b=w(v(),1);function d(){let{projectId:e}=y.useParams(),{teamId:s,ensureTeamIdForProject:n}=p();b.useEffect(()=>{n(e)},[e,n]);let{data:i}=o(x(e)),t=i?.rootFolder,{data:m}=r({queryKey:["folders",t],queryFn:async()=>{let l=await h.api.folders[":folderId"].$get({param:{folderId:t}});if(!l.ok)throw Error("failed to fetch folder");return await l.json()},enabled:!!t});if(!s||!t||!m)return a(f,{});return a(g,{teamId:s,projectId:e,projectName:i.name??"",assetId:t,rootFolderId:t})}var y=c("/projects/$projectId/")({component:d});export{y as Route};
@@ -0,0 +1,2 @@
1
+ import{sa as Vq}from"./chunk-8bhsdk1v.js";import{Aa as $q,Ba as Hq,ua as Qq,va as Wq,wa as Xq,xa as Yq,ya as Zq,za as _q}from"./chunk-xyzsmjtk.js";import{Mg as o,Ng as r,Og as m,Pg as e}from"./chunk-rjkj0dr9.js";import{mh as h,nh as C,oh as O}from"./chunk-5fj5w0gg.js";import{ph as P,rh as k,sh as G,uh as B,vh as Y}from"./chunk-jfjjh86p.js";import{$k as J,Fh as Cq,Gh as t,Hh as E,Ih as K,Ti as H,Yk as X,al as qq,bj as n,cl as Eq,dl as Jq,fl as Kq,hi as W,hl as Nq,ok as s,vi as z}from"./chunk-sjr6mvgm.js";import{em as hq}from"./chunk-2em77vjv.js";var Z=hq(Cq(),1);function uq({open:fq,onOpenChange:Fq,title:zq,members:g,isOwner:_,onInvite:c,onUpdateRole:I,onRemoveMember:v,currentUserId:Pq,availableMembersToAdd:M,onAddMember:L,type:V="team"}){let[T,u]=Z.useState("editor"),[S,p]=Z.useState(null),[l,x]=Z.useState(!1),[D,U]=Z.useState(null),[f,A]=Z.useState(null),[j,i]=Z.useState({}),[$,F]=Z.useState(null),y=(q)=>{if(!q)return"";switch(q.toLowerCase()){case"owner":return J.owner();case"editor":return J.editor();case"reviewer":return J.reviewer();default:return q}},a=(q,N)=>{i((Q)=>({...Q,[q]:N}))},kq=async(q,N)=>{if(!I)return;U(q);try{await I(q,N),W.success(J.member_role_updated())}catch(Q){console.error(Q),W.error(J.failed_to_update_member_role())}finally{U(null)}},Gq=async()=>{if(!v||!f?.id)return;U(f.id);try{await v(f.id),W.success(J.member_removed()),A(null)}catch(q){console.error(q),W.error(J.failed_to_remove_member())}finally{U(null)}},Bq=async()=>{if(!c)return;x(!0);try{let q=await c(T),N=`${window.location.origin}/signup?inviteCode=${q}`;p(N)}catch(q){console.error(q),W.error(J.failed_to_generate_invite_link())}finally{x(!1)}},Lq=async()=>{if(S){if(await Vq(S))W.success(J.invite_link_copied())}},R=(q)=>{if(!q)return"??";return q.split(" ").map((N)=>N[0]).slice(0,2).join("").toUpperCase()},Sq=(q)=>{if(!q)p(null),u("editor"),i({}),F(null);Fq(q)},w=Array.isArray(g)?g:[],Uq=Array.isArray(M)?M:[],yq=V==="project"&&_?w.filter((q)=>q.role==="owner"||q.scope==="project"||q.hasCustomRole):w,d=V==="project"&&_?w.filter((q)=>q.scope==="team"&&q.role!=="owner"&&!q.hasCustomRole):[],b=V==="project"&&_?Uq.filter((q)=>q.scope==="project"):[];return E(qq,{open:fq,onOpenChange:Sq,children:K(Eq,{className:"sm:max-w-xl",onOpenAutoFocus:(q)=>q.preventDefault(),children:[E(Jq,{children:E(Kq,{children:zq})}),K("div",{className:"space-y-4",children:[E("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:yq.map((q)=>{let N=V==="team"&&q.scope==="project";return K("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[K("div",{className:"flex items-center gap-3",children:[K(h,{children:[q.image&&E(C,{src:q.image,alt:q.name,className:"object-cover"}),E(O,{children:R(q.name)})]}),K("div",{className:"flex flex-col",children:[E("span",{className:"text-sm font-medium",children:q.name}),K("div",{className:"flex items-center gap-2",children:[!N&&E("span",{className:"text-xs text-muted-foreground capitalize",children:y(q.role)}),q.scope&&K(t,{children:[!N&&E("span",{className:"text-[10px] text-muted-foreground/70",children:"•"}),E("span",{className:"text-xs text-muted-foreground capitalize",children:q.scope==="team"?J.team_member():J.project_member()})]})]})]})]}),_&&q.role!=="owner"&&q.id!==Pq&&K("div",{className:"flex items-center gap-2",children:[N?E(o,{children:K(r,{children:[E(m,{asChild:!0,children:E("span",{children:E(X,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26 justify-between",disabled:!0,children:E(H,{className:"ml-auto h-3 w-3 opacity-50"})})})}),E(e,{side:"top",children:E("p",{className:"text-xs",children:J.project_member_role_tooltip()})})]})}):K(P,{children:[E(k,{asChild:!0,children:K(X,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:D===q.id,children:[y(q.role),E(H,{className:"ml-1 h-3 w-3 opacity-50"})]})}),E(G,{children:K(B,{value:q.role,onValueChange:(Q)=>kq(q.id,Q),children:[E(Y,{value:"editor",className:"text-xs",children:J.editor()}),E(Y,{value:"reviewer",className:"text-xs",children:J.reviewer()})]})})]}),E(X,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>A(q),disabled:D===q.id,children:D===q.id?E(z,{className:"h-3 w-3 animate-spin"}):E(s,{className:"h-3 w-3"})})]})]},q.id)})}),E(Qq,{open:!!f,onOpenChange:(q)=>!q&&A(null),children:K(Wq,{children:[K(Xq,{children:[E(Zq,{children:J.remove_member()}),E(_q,{children:J.remove_member_confirmation({name:f?.name||"",type:V==="project"?J.project():J.team()})})]}),K(Yq,{children:[E(Hq,{children:J.cancel()}),E($q,{onClick:Gq,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:J.remove()})]})]})})," ",_&&L&&d.length>0&&K("div",{className:"border-t pt-4",children:[E("h4",{className:"text-sm font-medium mb-1",children:J.add_team_member_to_project()}),E("p",{className:"text-xs text-muted-foreground mb-3 font-normal",children:J.add_team_member_to_project_hint()}),E("div",{className:"max-h-[200px] overflow-y-auto space-y-2 pr-1",children:d.map((q)=>{let N=j[q.id]||"editor";return K("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[K("div",{className:"flex items-center gap-3",children:[K(h,{children:[q.image&&E(C,{src:q.image,alt:q.name,className:"object-cover"}),E(O,{children:R(q.name)})]}),K("div",{className:"flex flex-col",children:[E("span",{className:"text-sm font-medium",children:q.name}),E("span",{className:"text-xs text-muted-foreground capitalize",children:q.scope==="team"?J.team_member():J.project_member()})]})]}),K("div",{className:"flex items-center gap-2",children:[K(P,{children:[E(k,{asChild:!0,children:K(X,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:$===q.id,children:[y(N),E(H,{className:"ml-1 h-3 w-3 opacity-50"})]})}),E(G,{children:K(B,{value:N,onValueChange:(Q)=>a(q.id,Q),children:[E(Y,{value:"editor",className:"text-xs",children:J.editor()}),E(Y,{value:"reviewer",className:"text-xs",children:J.reviewer()})]})})]}),E(X,{onClick:async()=>{F(q.id);try{await L(q.id,N),W.success(J.added_member_successfully({name:q.name||""}))}catch(Q){console.error(Q),W.error(J.failed_to_add_member({name:q.name||""}))}finally{F(null)}},disabled:$!==null,size:"sm",className:"h-8 text-xs px-3",children:$===q.id?E(z,{className:"h-3 w-3 animate-spin"}):J.set_role()})]})]},q.id)})})]}),_&&L&&b.length>0&&K("div",{className:"border-t pt-4",children:[E("h4",{className:"text-sm font-medium mb-1",children:J.add_members_from_other_projects()}),E("p",{className:"text-xs text-muted-foreground mb-3 font-normal",children:J.add_members_from_other_projects_hint()}),E("div",{className:"max-h-[200px] overflow-y-auto space-y-2 pr-1",children:b.map((q)=>{let N=j[q.id]||"editor";return K("div",{className:"flex items-center justify-between p-2 rounded-lg hover:bg-muted/50",children:[K("div",{className:"flex items-center gap-3",children:[K(h,{children:[q.image&&E(C,{src:q.image,alt:q.name,className:"object-cover"}),E(O,{children:R(q.name)})]}),K("div",{className:"flex flex-col",children:[E("span",{className:"text-sm font-medium",children:q.name}),E("span",{className:"text-xs text-muted-foreground capitalize",children:q.scope==="team"?J.team_member():J.project_member()})]})]}),K("div",{className:"flex items-center gap-2",children:[K(P,{children:[E(k,{asChild:!0,children:K(X,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs capitalize w-26",disabled:$===q.id,children:[y(N),E(H,{className:"ml-1 h-3 w-3 opacity-50"})]})}),E(G,{children:K(B,{value:N,onValueChange:(Q)=>a(q.id,Q),children:[E(Y,{value:"editor",className:"text-xs",children:J.editor()}),E(Y,{value:"reviewer",className:"text-xs",children:J.reviewer()})]})})]}),E(X,{onClick:async()=>{F(q.id);try{await L(q.id,N),W.success(J.added_member_successfully({name:q.name||""}))}catch(Q){console.error(Q),W.error(J.failed_to_add_member({name:q.name||""}))}finally{F(null)}},disabled:$!==null,size:"sm",className:"h-8 text-xs px-3",children:$===q.id?E(z,{className:"h-3 w-3 animate-spin"}):J.add_to_project()})]})]},q.id)})})]}),_&&c&&K("div",{className:"border-t pt-4",children:[E("h4",{className:"text-sm font-medium mb-3",children:J.invite_new_member()}),K("div",{className:"space-y-3",children:[K("div",{className:"flex gap-2",children:[K(P,{children:[E(k,{asChild:!0,children:K(X,{variant:"outline",className:"w-[120px] justify-between",children:[T==="editor"?J.editor():J.reviewer(),E(H,{className:"h-4 w-4 opacity-50"})]})}),E(G,{children:K(B,{value:T,onValueChange:(q)=>u(q),children:[E(Y,{value:"editor",children:J.editor()}),E(Y,{value:"reviewer",children:J.reviewer()})]})})]}),K(X,{onClick:Bq,disabled:l,className:"flex-1",children:[l&&E(z,{className:"mr-2 h-4 w-4 animate-spin"}),J.generate_link()]})]}),S&&K("div",{className:"flex gap-2",children:[E(Nq,{value:S,readOnly:!0}),E(X,{variant:"outline",size:"icon",onClick:Lq,children:E(n,{className:"h-4 w-4"})})]})]})]})]})]})})}
2
+ export{uq as ra};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$e as p,Le as a,Ne as b,Oe as c,Pe as d,Qe as e,Re as f,Se as g,Te as h,Ue as i,Ve as j,We as k,Xe as l,Ye as m,Ze as n,_e as o,af as q,bf as r,cf as s,df as t,ef as u,ff as v,gf as w,hf as x,if as y,jf as z,kf as A,lf as B,mf as C,nf as D,of as E,pf as F,qf as G,rf as H,sf as I,tf as J,uf as K,vf as L}from"./chunk-b8v7jvkb.js";import"./chunk-dej1gq35.js";export{r as jwtVerify,s as jwtDecrypt,E as jwksCache,d as importX509,c as importSPKI,e as importPKCS8,f as importJWK,K as generateSecret,J as generateKeyPair,q as generalVerify,l as generalDecrypt,o as flattenedVerify,j as flattenedDecrypt,g as exportSPKI,h as exportPKCS8,i as exportJWK,b as errors,H as decodeProtectedHeader,I as decodeJwt,D as customFetch,L as cryptoRuntime,F as createRemoteJWKSet,C as createLocalJWKSet,p as compactVerify,k as compactDecrypt,A as calculateJwkThumbprintUri,z as calculateJwkThumbprint,a as base64url,G as UnsecuredJWT,x as SignJWT,w as GeneralSign,n as GeneralEncrypt,u as FlattenedSign,m as FlattenedEncrypt,y as EncryptJWT,B as EmbeddedJWK,v as CompactSign,t as CompactEncrypt};
2
+ import{$d as f,Ae as G,Be as H,Ce as I,De as J,Ee as K,Fe as L,Vd as a,Xd as b,Yd as c,Zd as d,_d as e,ae as g,be as h,ce as i,de as j,ee as k,fe as l,ge as m,he as n,ie as o,je as p,ke as q,le as r,me as s,ne as t,oe as u,pe as v,qe as w,re as x,se as y,te as z,ue as A,ve as B,we as C,xe as D,ye as E,ze as F}from"./chunk-nc632fxz.js";import"./chunk-2em77vjv.js";export{r as jwtVerify,s as jwtDecrypt,E as jwksCache,d as importX509,c as importSPKI,e as importPKCS8,f as importJWK,K as generateSecret,J as generateKeyPair,q as generalVerify,l as generalDecrypt,o as flattenedVerify,j as flattenedDecrypt,g as exportSPKI,h as exportPKCS8,i as exportJWK,b as errors,H as decodeProtectedHeader,I as decodeJwt,D as customFetch,L as cryptoRuntime,F as createRemoteJWKSet,C as createLocalJWKSet,p as compactVerify,k as compactDecrypt,A as calculateJwkThumbprintUri,z as calculateJwkThumbprint,a as base64url,G as UnsecuredJWT,x as SignJWT,w as GeneralSign,n as GeneralEncrypt,u as FlattenedSign,m as FlattenedEncrypt,y as EncryptJWT,B as EmbeddedJWK,v as CompactSign,t as CompactEncrypt};
@@ -1,2 +1,2 @@
1
- import{bb as BK,db as gJ}from"./chunk-4rbzswqs.js";import{fb as ZJ}from"./chunk-rfyaphas.js";import{kb as ZK,lb as _K,mb as $K,nb as GK,ob as zK,pb as QK,qb as HK,rb as UK}from"./chunk-karn564z.js";import{Fg as $J}from"./chunk-f2j2cqd1.js";import{hh as QJ,jh as HJ,kh as UJ,lh as w,ph as KK,uh as WK}from"./chunk-n4gghgrj.js";import{$h as z,Ah as X,Ak as O,Bh as lJ,Ck as N,Di as rJ,Fj as wJ,Gh as v,Hh as _J,Ik as W,Jk as XK,Kh as dJ,Ki as oJ,Kk as TJ,Lh as h,Mh as GJ,Mi as sJ,Mk as RJ,Nk as SJ,Oi as XJ,Oj as JK,Ok as fJ,Pi as YJ,Pk as hJ,Qk as YK,Ri as tJ,Xi as DJ,Xj as uJ,bi as U,cj as eJ,kj as kJ,li as zJ,ni as p,ri as nJ,ti as aJ,xh as NK,yh as iJ,zh as J}from"./chunk-m6a4rzdt.js";import{Nl as vK}from"./chunk-dej1gq35.js";var _=vK(NK(),1);function cK({teamId:B,projectId:Z,projectName:$,rootFolderId:P,dragState:b,onSelect:M,selectedFolderId:A,hideCollections:m,hideShares:C,ancestorFolders:D}){let q=GJ(),Q=lJ(),{canEdit:V}=WK(Z),j=dJ({from:"/projects/$projectId/recently-deleted",shouldThrow:!1}),[L,r]=_.useState(!0),[T,BJ]=_.useState(!0),[u,bJ]=_.useState(!0),{data:c,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:R}=_J({queryKey:["shares",Z],queryFn:async({pageParam:K})=>{let Y=await U.api.projects[":projectId"].shares.$get({param:{projectId:Z},query:{first:"20",after:K}});if(!Y.ok)throw Error(W.failed_fetch_share_links());return await Y.json()},initialPageParam:"",getNextPageParam:(K)=>K.pageInfo?.cursor||void 0,enabled:!!Z}),{data:l,fetchNextPage:o,hasNextPage:d,isFetchingNextPage:n}=_J({queryKey:["collections",Z],queryFn:async({pageParam:K})=>{let Y=await U.api.projects[":projectId"].collections.$get({param:{projectId:Z},query:{first:"20",after:K}});if(!Y.ok)throw Error(W.failed_fetch_collections());return await Y.json()},initialPageParam:"",getNextPageParam:(K)=>K.pageInfo?.cursor||void 0,enabled:!!Z}),{ref:qJ,inView:s}=$J(),{ref:VJ,inView:t}=$J();_.useEffect(()=>{if(s&&d&&!n)o()},[s,d,n,o]),_.useEffect(()=>{if(t&&g&&!R)i()},[t,g,R,i]);let AJ=_.useMemo(()=>l?.pages.flatMap((K)=>K.data)||[],[l]),OJ=_.useMemo(()=>c?.pages.flatMap((K)=>K.data)||[],[c]),{mutate:PJ}=v({mutationFn:async()=>{let K=await U.api.projects[":projectId"].collections.$post({param:{projectId:Z},json:{name:W.untitled_collection(),filter:{sourceFolderId:P,searchFilter:{conditions:[],recursively:!0}}}});if(!K.ok)throw Error(W.failed_create_collection());return await K.json()},onSuccess:(K)=>{Q.invalidateQueries({queryKey:["collections",Z]}),z.success(W.collection_created()),q({to:"/projects/$projectId/collections/$collectionId",params:{projectId:Z,collectionId:K.id}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:MJ}=v({mutationFn:async()=>{let K=await U.api.projects[":projectId"].shares.$post({param:{projectId:Z},json:{name:new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}});if(!K.ok)throw Error(W.failed_create_share_link());return await K.json()},onSuccess:(K)=>{Q.invalidateQueries({queryKey:["shares",Z]}),z.success(W.share_link_created()),q({to:"/projects/$projectId/shares/$shareId",params:{projectId:Z,shareId:K.id}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),e=h({from:"/projects/$projectId/collections/$collectionId",shouldThrow:!1}),LJ=h({from:"/projects/$projectId/shares/$shareId",shouldThrow:!1}),G=h({from:"/projects/$projectId/folders/$folderId",shouldThrow:!1}),[y,yJ]=_.useState(null),[F,EJ]=_.useState("collection"),[E,JJ]=_.useState(""),[qK,k]=_.useState(!1),[vJ,NJ]=_.useState(null),[S,CJ]=_.useState("collection"),[VK,f]=_.useState(!1),{mutate:IJ}=v({mutationFn:async({id:K,name:Y})=>{let H=await U.api.folders[":folderId"].$put({param:{folderId:K},json:{name:Y}});if(!H.ok)throw Error(W.failed_rename_folder());return await H.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["search",B]}),Q.invalidateQueries({queryKey:["folders"]}),z.success(W.folder_renamed()),k(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:AK}=v({mutationFn:async(K)=>{if(!(await U.api.folders.$delete({json:{ids:[K]}})).ok)throw Error(W.failed_delete_folder());return K},onSuccess:(K)=>{if(Q.invalidateQueries({queryKey:["search",B]}),Q.invalidateQueries({queryKey:["folders"]}),z.success(W.folder_deleted()),f(!1),G?.folderId===K)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),[OK,a]=_.useState(!1),[KJ,xJ]=_.useState(!1),[FJ,pJ]=_.useState([]),PK=async(K)=>{a(!0),xJ(!0),pJ([]);try{let Y=await U.api.files["download-links"].$post({json:{ids:[K]}});if(!Y.ok)throw Error(W.failed_to_prepare_download_links());let H=await Y.json();pJ(H.files)}catch(Y){z.error(W.failed_to_prepare_download_links()),a(!1),console.error(Y)}finally{xJ(!1)}},MK=()=>{let K=[...FJ];if(a(!1),K.length===0)return;z.info(W.starting_download_files({count:K.length}),{duration:5000});let Y=(WJ)=>new Promise((I)=>setTimeout(I,WJ));(async()=>{for(let I=0;I<K.length;I+=5){let EK=K.slice(I,I+5);for(let cJ of EK){let x=document.createElement("a");x.href=cJ.url,x.download=cJ.name,x.target="_blank",document.body.appendChild(x),x.click(),x.remove()}await Y(1000)}})().catch((WJ)=>{console.error("Background downloads failed:",WJ),z.error(W.some_downloads_failed())})},{mutate:mJ}=v({mutationFn:async({id:K,name:Y})=>{let H=await U.api.collections[":collectionId"].$patch({param:{collectionId:K},json:{name:Y}});if(!H.ok)throw Error(W.failed_rename_collection());return await H.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["collections",Z]}),z.success(W.collection_renamed()),k(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:LK}=v({mutationFn:async(K)=>{let Y=await U.api.collections[":collectionId"].$delete({param:{collectionId:K}});if(!Y.ok)throw Error(W.failed_delete_collection());return await Y.json()},onSuccess:(K,Y)=>{if(Q.invalidateQueries({queryKey:["collections",Z]}),z.success(W.collection_deleted()),f(!1),e?.collectionId===Y)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:jJ}=v({mutationFn:async({id:K,name:Y})=>{let H=await U.api.shares[":shareId"].$put({param:{shareId:K},json:{name:Y}});if(!H.ok)throw Error(W.failed_rename_share_link());return await H.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["shares",Z]}),z.success(W.share_link_renamed()),k(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:yK}=v({mutationFn:async(K)=>{if(!(await U.api.shares[":shareId"].$delete({param:{shareId:K}})).ok)throw Error(W.failed_delete_share_link());return K},onSuccess:(K)=>{if(Q.invalidateQueries({queryKey:["shares",Z]}),z.success(W.share_link_deleted()),f(!1),LJ?.shareId===K)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}});return X("div",{className:"flex flex-col h-full overflow-hidden p-3 gap-4 bg-background",children:[X("div",{className:O("flex flex-col overflow-hidden transition-all duration-300 ease-in-out border-b border-border pb-4",L?"flex-1 min-h-[50%] h-full":"flex-none h-[44px] max-h-[44px]"),children:[J("header",{className:"group flex items-center justify-between px-2 mb-1 flex-none",children:X("div",{className:"flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors",onClick:()=>r(!L),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.folder_tree_assets()}),L?J(XJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(YJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]})}),J(ZJ,{className:O("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",L?"opacity-100 visible pointer-events-auto":"opacity-0 invisible pointer-events-none h-0"),children:X("div",{className:"space-y-0.5 pr-3",children:[J(bK,{teamId:B,projectId:Z,folder:{id:P,name:$,type:"folder",sizeByte:0,fileCount:0,status:"processed",createdAt:"",updatedAt:""},level:0,isRoot:!0,dragState:b,onSelect:M,selectedFolderId:A,canEdit:V,onRenameTrigger:(K,Y)=>{yJ(K),EJ("folder"),JJ(Y),k(!0)},onDeleteTrigger:(K)=>{NJ(K),CJ("folder"),f(!0)},onDownloadTrigger:(K)=>{PK(K)},ancestorFolders:D},P),V&&X("div",{className:O("group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",j&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),onClick:()=>q({to:"/projects/$projectId/recently-deleted",params:{projectId:Z}}),children:[J("div",{className:"flex h-4 w-4 items-center justify-center",children:J(uJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.recently_deleted()})]})]})})]}),!m&&X("div",{className:O("flex flex-col overflow-hidden transition-all duration-300 ease-in-out border-b border-border pb-4",T?"flex-1 min-h-0 h-full":"flex-none h-[44px] max-h-[44px]"),children:[X("header",{className:"group flex items-center justify-between px-2 mb-1 flex-none",children:[X("div",{className:"flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors",onClick:()=>BJ(!T),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.collections()}),T?J(XJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(YJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),V&&J("button",{"data-testid":"create-collection",onClick:()=>PJ(),className:"text-muted-foreground hover:text-foreground flex-none",children:J(wJ,{className:"h-3.5 w-3.5"})})]}),J(ZJ,{className:O("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",T?"opacity-100 visible pointer-events-auto":"opacity-0 invisible pointer-events-none h-0"),children:X("div",{className:"space-y-0.5 pr-3",children:[X("div",{className:"group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>q({to:"/projects/$projectId/collections",params:{projectId:Z}}),children:[J("div",{className:"flex h-4 w-4 items-center justify-center",children:J(kJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.all_collections_count({count:l?.pages[0]?.pageInfo?.total||0})})]}),AJ.map((K)=>{let Y=e?.collectionId===K.id;return X("div",{className:O("group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0",Y&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),onClick:()=>q({to:"/projects/$projectId/collections/$collectionId",params:{projectId:Z,collectionId:K.id}}),children:[X("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[J("div",{className:"flex h-4 w-4 items-center justify-center shrink-0",children:J(rJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"truncate text-sidebar-foreground flex-1",children:K.name})]}),V&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(H)=>H.stopPropagation(),children:X(QJ,{modal:!1,children:[J(HJ,{asChild:!0,children:J(N,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(zJ,{className:"h-3.5 w-3.5"})})}),X(UJ,{align:"end",className:"w-32",children:[J(w,{onClick:()=>{yJ(K.id),EJ("collection"),JJ(K.name),k(!0)},children:W.rename()}),J(w,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{NJ(K.id),CJ("collection"),f(!0)},children:W.delete()})]})]})})]},K.id)}),J("div",{ref:qJ,className:"h-1"}),n&&J("div",{className:"flex justify-center p-2",children:J(p,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]})})]}),!C&&X("div",{className:O("flex flex-col overflow-hidden transition-all duration-300 ease-in-out",u?"flex-1 min-h-0 h-full":"flex-none h-[44px] max-h-[44px]"),children:[X("header",{className:"group flex items-center justify-between px-2 mb-1 flex-none",children:[X("div",{className:"flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors",onClick:()=>bJ(!u),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.share_links()}),u?J(XJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(YJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),V&&J("div",{className:"flex items-center gap-1 flex-none",children:J("button",{onClick:()=>MJ(),className:"text-muted-foreground hover:text-foreground",children:J(wJ,{className:"h-3.5 w-3.5"})})})]}),J(ZJ,{className:O("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",u?"opacity-100 visible pointer-events-auto":"opacity-0 invisible pointer-events-none h-0"),children:X("div",{className:"space-y-0.5 pr-3",children:[X("div",{className:"group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>q({to:"/projects/$projectId/shares",params:{projectId:Z}}),children:[J("div",{className:"flex h-4 w-4 items-center justify-center",children:J(kJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.all_share_links_count({count:c?.pages[0]?.pageInfo?.total||0})})]}),OJ.map((K)=>J(CK,{link:K,projectId:Z,dragState:b,canEdit:V,onRenameTrigger:(Y,H)=>{yJ(Y),EJ("share"),JJ(H),k(!0)},onDeleteTrigger:(Y)=>{NJ(Y),CJ("share"),f(!0)}},K.id)),J("div",{ref:VJ,className:"h-1"}),R&&J("div",{className:"flex justify-center p-2",children:J(p,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]})})]}),J(TJ,{open:qK,onOpenChange:k,children:X(RJ,{onClick:(K)=>K.stopPropagation(),children:[J(SJ,{children:J(hJ,{children:F==="collection"?W.rename_collection():F==="share"?W.rename_share_link():W.rename_folder()})}),J("div",{className:"py-4",children:J(XK,{value:E,onChange:(K)=>JJ(K.target.value),placeholder:W.enter_new_name(),onKeyDown:(K)=>{if(K.key==="Enter"&&E.trim()){if(F==="collection")mJ({id:y,name:E});else if(F==="share")jJ({id:y,name:E});else if(F==="folder")IJ({id:y,name:E})}}})}),X(fJ,{children:[J(N,{variant:"ghost",onClick:()=>k(!1),children:W.cancel()}),J(N,{disabled:!E.trim(),onClick:()=>{if(F==="collection")mJ({id:y,name:E});else if(F==="share")jJ({id:y,name:E});else if(F==="folder")IJ({id:y,name:E})},children:W.rename()})]})]})}),J(ZK,{open:VK,onOpenChange:f,children:X(_K,{onClick:(K)=>K.stopPropagation(),children:[X($K,{children:[J(zK,{children:S==="collection"?W.delete_collection_confirm():S==="share"?W.delete_share_link_confirm():W.delete_folder_confirm()}),J(QK,{children:W.delete_confirm_description({type:S==="collection"?W.collection():S==="share"?W.share_link():W.folder().toLowerCase()})})]}),X(GK,{children:[J(UK,{children:W.cancel()}),J(HK,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(S==="collection")LK(vJ);else if(S==="share")yK(vJ);else if(S==="folder")AK(vJ)},children:W.delete()})]})]})}),J(TJ,{open:OK,onOpenChange:a,children:X(RJ,{className:"sm:max-w-md",children:[X(SJ,{children:[J(hJ,{children:KJ?W.preparing_download():W.confirm_download()}),J(YK,{children:KJ?W.resolving_files_wait():W.folder_files_download_description()})]}),KJ?X("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[J(p,{className:"h-8 w-8 animate-spin text-primary"}),J("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:W.preparing_download_links()})]}):X("div",{className:"space-y-4 py-2",children:[J("div",{className:"text-sm text-muted-foreground",children:W.download_includes_files({count:FJ.length})}),X("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[J(aJ,{className:"h-5 w-5 shrink-0 mt-0.5"}),X("div",{children:[J("p",{className:"font-semibold",children:W.no_folder_structure()}),J("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:W.folder_structure_warning()})]})]})]}),J(fJ,{children:!KJ?X(iJ,{children:[J(N,{variant:"outline",onClick:()=>a(!1),children:W.cancel()}),X(N,{onClick:MK,className:"gap-2",disabled:FJ.length===0,children:[J(DJ,{className:"h-4 w-4"}),W.start_download()]})]}):J(N,{disabled:!0,variant:"outline",children:W.cancel()})})]})})]})}function CK({link:B,projectId:Z,dragState:$,canEdit:P,onRenameTrigger:b,onDeleteTrigger:M}){let A=GJ(),C=h({from:"/projects/$projectId/shares/$shareId",shouldThrow:!1})?.shareId===B.id,{ref:D,isDropTarget:q}=gJ({id:`share:${B.id}`,data:{type:"share-link",id:B.id}}),Q=!!$?.isActive;return X("div",{ref:D,className:O("group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0",C&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium",q&&Q&&"bg-sidebar-accent ring-2 ring-primary ring-inset"),onClick:()=>A({to:"/projects/$projectId/shares/$shareId",params:{projectId:Z,shareId:B.id}}),children:[X("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[J("div",{className:"flex h-4 w-4 items-center justify-center shrink-0",children:J(JK,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"truncate text-sidebar-foreground flex-1",children:B.name})]}),P&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(V)=>V.stopPropagation(),children:X(QJ,{modal:!1,children:[J(HJ,{asChild:!0,children:J(N,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(zJ,{className:"h-3.5 w-3.5"})})}),X(UJ,{align:"end",className:"w-32",children:[J(w,{onClick:()=>{b(B.id,B.name)},children:W.rename()}),J(w,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{M(B.id)},children:W.delete()})]})]})})]})}function bK({teamId:B,projectId:Z,folder:$,level:P,isRoot:b,dragState:M,onSelect:A,selectedFolderId:m,canEdit:C,onRenameTrigger:D,onDeleteTrigger:q,onDownloadTrigger:Q,ancestorFolders:V}){let j=_.useMemo(()=>{return V?.some((G)=>G.id===$.id)??!1},[V,$.id]),[L,r]=_.useState(b||j);_.useEffect(()=>{if(j)r(!0)},[j]);let T=GJ(),BJ=h({from:"/projects/$projectId/folders/$folderId",select:(G)=>({folderId:G.folderId}),shouldThrow:!1}),u=h({from:"/projects/$projectId/",shouldThrow:!1}),bJ=b?!!u:BJ?.folderId===$.id,{data:c,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:R,isLoading:l}=_J({queryKey:["folders",$.id,"children",{assetType:"folder"}],queryFn:async({pageParam:G})=>{let y=await U.api.folders[":folderId"].children.$get({param:{folderId:$.id},query:{assetType:"folder",after:G,first:"20"}});if(!y.ok)throw Error(W.failed_to_fetch_folder_children());return await y.json()},initialPageParam:"",getNextPageParam:(G)=>{return G.pageInfo?.cursor||void 0},enabled:L||!!b}),{ref:o,inView:d}=$J();_.useEffect(()=>{if(d&&g&&!R)i()},[d,g,R,i]);let n=c?.pages.flatMap((G)=>G.data??[])??[],qJ=(G)=>{G.stopPropagation(),r(!L)},s=()=>{if(A){A($);return}if(b)T({to:"/projects/$projectId",params:{projectId:Z}});else T({to:"/projects/$projectId/folders/$folderId",params:{projectId:Z,folderId:$.id}})},{ref:VJ,isDragging:t}=BK({id:`tree:${$.id}`,data:{type:"folder",item:$},disabled:!!b||!!A||!C}),{ref:AJ,isDropTarget:OJ}=gJ({id:`tree:${$.id}`,data:{type:"folder",item:$},disabled:M?.draggedIds.has($.id)||!!A||!C}),PJ=(G)=>{VJ(G),AJ(G)},MJ=_.useMemo(()=>{if(A)return!1;if(!M?.isActive)return!1;if(M.draggedIds.has($.id))return!1;return!0},[M,$.id,A]),e=OJ&&MJ,LJ=m===$.id;return X("div",{children:[X("div",{ref:PJ,className:O("group flex cursor-pointer items-center gap-1 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0",(bJ||LJ)&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium",t&&"opacity-50",e&&"bg-sidebar-accent ring-2 ring-primary ring-inset"),style:{...b?{}:{paddingLeft:`${P*12+8}px`}},onClick:s,children:[!b&&J("button",{onClick:qJ,className:"flex h-4 w-4 items-center justify-center shrink-0",children:L?J(oJ,{className:"h-3 w-3"}):J(sJ,{className:"h-3 w-3"})}),b?J(tJ,{className:"h-4 w-4 text-sidebar-primary shrink-0"}):J(eJ,{className:"h-4 w-4 text-sidebar-primary shrink-0"}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:$.name}),C&&!b&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(G)=>G.stopPropagation(),children:X(QJ,{modal:!1,children:[J(HJ,{asChild:!0,children:J(N,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(zJ,{className:"h-3.5 w-3.5"})})}),X(UJ,{align:"end",className:"w-32",children:[X(w,{onClick:()=>{D($.id,$.name)},children:[J(nJ,{className:"mr-2 h-4 w-4"}),W.rename()]}),X(w,{onClick:()=>{Q($.id)},children:[J(DJ,{className:"mr-2 h-4 w-4"}),W.download()]}),J(KK,{}),X(w,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{q($.id)},children:[J(uJ,{className:"mr-2 h-4 w-4"}),W.delete()]})]})]})})]}),L&&X("div",{children:[l&&J("div",{className:"flex items-center justify-center p-2",style:{paddingLeft:`${(P+1)*12+8}px`},children:J(p,{className:"h-4 w-4 animate-spin"})}),n.map((G)=>J(bK,{teamId:B,projectId:Z,folder:G,level:P+1,dragState:M,onSelect:A,selectedFolderId:m,canEdit:C,onRenameTrigger:D,onDeleteTrigger:q,onDownloadTrigger:Q,ancestorFolders:V},G.id)),g&&J("div",{ref:o,className:"flex items-center justify-center p-2",style:{paddingLeft:`${(P+1)*12+8}px`},children:R&&J(p,{className:"h-4 w-4 animate-spin"})})]})]})}
2
- export{cK as qa};
1
+ import{Aa as UK,Ba as BK,ua as _K,va as $K,wa as GK,xa as zK,ya as QK,za as HK}from"./chunk-xyzsmjtk.js";import{Eg as YK,Gg as gJ}from"./chunk-g3p6h6sw.js";import{Ig as ZJ}from"./chunk-2xaq1y16.js";import{Kg as $J}from"./chunk-f3rqamey.js";import{Ch as WK,ph as QJ,rh as HJ,sh as UJ,th as w,xh as KK}from"./chunk-jfjjh86p.js";import{$k as W,Bi as aJ,Fh as NK,Gh as iJ,Hh as J,Ih as X,Jh as lJ,Mi as rJ,Oh as v,Ph as _J,Sh as dJ,Th as h,Ti as oJ,Uh as GJ,Uj as wJ,Vi as sJ,Wk as O,Xi as XJ,Yi as YJ,Yk as N,_i as tJ,al as TJ,cl as RJ,dl as SJ,ej as DJ,ek as JK,el as fJ,fl as hJ,gl as XK,hi as z,hl as ZK,ji as U,lj as eJ,ok as uJ,ti as zJ,vi as p,xj as kJ,zi as nJ}from"./chunk-sjr6mvgm.js";import{em as vK}from"./chunk-2em77vjv.js";var _=vK(NK(),1);function cK({teamId:B,projectId:Z,projectName:$,rootFolderId:P,dragState:b,onSelect:M,selectedFolderId:A,hideCollections:m,hideShares:C,ancestorFolders:D}){let q=GJ(),Q=lJ(),{canEdit:V}=WK(Z),j=dJ({from:"/projects/$projectId/recently-deleted",shouldThrow:!1}),[L,r]=_.useState(!0),[T,BJ]=_.useState(!0),[u,bJ]=_.useState(!0),{data:c,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:R}=_J({queryKey:["shares",Z],queryFn:async({pageParam:K})=>{let Y=await U.api.projects[":projectId"].shares.$get({param:{projectId:Z},query:{first:"20",after:K}});if(!Y.ok)throw Error(W.failed_fetch_share_links());return await Y.json()},initialPageParam:"",getNextPageParam:(K)=>K.pageInfo?.cursor||void 0,enabled:!!Z}),{data:l,fetchNextPage:o,hasNextPage:d,isFetchingNextPage:n}=_J({queryKey:["collections",Z],queryFn:async({pageParam:K})=>{let Y=await U.api.projects[":projectId"].collections.$get({param:{projectId:Z},query:{first:"20",after:K}});if(!Y.ok)throw Error(W.failed_fetch_collections());return await Y.json()},initialPageParam:"",getNextPageParam:(K)=>K.pageInfo?.cursor||void 0,enabled:!!Z}),{ref:qJ,inView:s}=$J(),{ref:VJ,inView:t}=$J();_.useEffect(()=>{if(s&&d&&!n)o()},[s,d,n,o]),_.useEffect(()=>{if(t&&g&&!R)i()},[t,g,R,i]);let AJ=_.useMemo(()=>l?.pages.flatMap((K)=>K.data)||[],[l]),OJ=_.useMemo(()=>c?.pages.flatMap((K)=>K.data)||[],[c]),{mutate:PJ}=v({mutationFn:async()=>{let K=await U.api.projects[":projectId"].collections.$post({param:{projectId:Z},json:{name:W.untitled_collection(),filter:{sourceFolderId:P,searchFilter:{conditions:[],recursively:!0}}}});if(!K.ok)throw Error(W.failed_create_collection());return await K.json()},onSuccess:(K)=>{Q.invalidateQueries({queryKey:["collections",Z]}),z.success(W.collection_created()),q({to:"/projects/$projectId/collections/$collectionId",params:{projectId:Z,collectionId:K.id}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:MJ}=v({mutationFn:async()=>{let K=await U.api.projects[":projectId"].shares.$post({param:{projectId:Z},json:{name:new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}});if(!K.ok)throw Error(W.failed_create_share_link());return await K.json()},onSuccess:(K)=>{Q.invalidateQueries({queryKey:["shares",Z]}),z.success(W.share_link_created()),q({to:"/projects/$projectId/shares/$shareId",params:{projectId:Z,shareId:K.id}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),e=h({from:"/projects/$projectId/collections/$collectionId",shouldThrow:!1}),LJ=h({from:"/projects/$projectId/shares/$shareId",shouldThrow:!1}),G=h({from:"/projects/$projectId/folders/$folderId",shouldThrow:!1}),[y,yJ]=_.useState(null),[F,EJ]=_.useState("collection"),[E,JJ]=_.useState(""),[qK,k]=_.useState(!1),[vJ,NJ]=_.useState(null),[S,CJ]=_.useState("collection"),[VK,f]=_.useState(!1),{mutate:IJ}=v({mutationFn:async({id:K,name:Y})=>{let H=await U.api.folders[":folderId"].$put({param:{folderId:K},json:{name:Y}});if(!H.ok)throw Error(W.failed_rename_folder());return await H.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["search",B]}),Q.invalidateQueries({queryKey:["folders"]}),z.success(W.folder_renamed()),k(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:AK}=v({mutationFn:async(K)=>{if(!(await U.api.folders.$delete({json:{ids:[K]}})).ok)throw Error(W.failed_delete_folder());return K},onSuccess:(K)=>{if(Q.invalidateQueries({queryKey:["search",B]}),Q.invalidateQueries({queryKey:["folders"]}),z.success(W.folder_deleted()),f(!1),G?.folderId===K)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),[OK,a]=_.useState(!1),[KJ,xJ]=_.useState(!1),[FJ,pJ]=_.useState([]),PK=async(K)=>{a(!0),xJ(!0),pJ([]);try{let Y=await U.api.files["download-links"].$post({json:{ids:[K]}});if(!Y.ok)throw Error(W.failed_to_prepare_download_links());let H=await Y.json();pJ(H.files)}catch(Y){z.error(W.failed_to_prepare_download_links()),a(!1),console.error(Y)}finally{xJ(!1)}},MK=()=>{let K=[...FJ];if(a(!1),K.length===0)return;z.info(W.starting_download_files({count:K.length}),{duration:5000});let Y=(WJ)=>new Promise((I)=>setTimeout(I,WJ));(async()=>{for(let I=0;I<K.length;I+=5){let EK=K.slice(I,I+5);for(let cJ of EK){let x=document.createElement("a");x.href=cJ.url,x.download=cJ.name,x.target="_blank",document.body.appendChild(x),x.click(),x.remove()}await Y(1000)}})().catch((WJ)=>{console.error("Background downloads failed:",WJ),z.error(W.some_downloads_failed())})},{mutate:mJ}=v({mutationFn:async({id:K,name:Y})=>{let H=await U.api.collections[":collectionId"].$patch({param:{collectionId:K},json:{name:Y}});if(!H.ok)throw Error(W.failed_rename_collection());return await H.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["collections",Z]}),z.success(W.collection_renamed()),k(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:LK}=v({mutationFn:async(K)=>{let Y=await U.api.collections[":collectionId"].$delete({param:{collectionId:K}});if(!Y.ok)throw Error(W.failed_delete_collection());return await Y.json()},onSuccess:(K,Y)=>{if(Q.invalidateQueries({queryKey:["collections",Z]}),z.success(W.collection_deleted()),f(!1),e?.collectionId===Y)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:jJ}=v({mutationFn:async({id:K,name:Y})=>{let H=await U.api.shares[":shareId"].$put({param:{shareId:K},json:{name:Y}});if(!H.ok)throw Error(W.failed_rename_share_link());return await H.json()},onSuccess:()=>{Q.invalidateQueries({queryKey:["shares",Z]}),z.success(W.share_link_renamed()),k(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:yK}=v({mutationFn:async(K)=>{if(!(await U.api.shares[":shareId"].$delete({param:{shareId:K}})).ok)throw Error(W.failed_delete_share_link());return K},onSuccess:(K)=>{if(Q.invalidateQueries({queryKey:["shares",Z]}),z.success(W.share_link_deleted()),f(!1),LJ?.shareId===K)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}});return X("div",{className:"flex flex-col h-full overflow-hidden p-3 gap-4 bg-background",children:[X("div",{className:O("flex flex-col overflow-hidden transition-all duration-300 ease-in-out border-b border-border pb-4",L?"flex-1 min-h-[50%] h-full":"flex-none h-[44px] max-h-[44px]"),children:[J("header",{className:"group flex items-center justify-between px-2 mb-1 flex-none",children:X("div",{className:"flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors",onClick:()=>r(!L),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.folder_tree_assets()}),L?J(XJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(YJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]})}),J(ZJ,{className:O("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",L?"opacity-100 visible pointer-events-auto":"opacity-0 invisible pointer-events-none h-0"),children:X("div",{className:"space-y-0.5 pr-3",children:[J(bK,{teamId:B,projectId:Z,folder:{id:P,name:$,type:"folder",sizeByte:0,fileCount:0,status:"processed",createdAt:"",updatedAt:""},level:0,isRoot:!0,dragState:b,onSelect:M,selectedFolderId:A,canEdit:V,onRenameTrigger:(K,Y)=>{yJ(K),EJ("folder"),JJ(Y),k(!0)},onDeleteTrigger:(K)=>{NJ(K),CJ("folder"),f(!0)},onDownloadTrigger:(K)=>{PK(K)},ancestorFolders:D},P),V&&X("div",{className:O("group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",j&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),onClick:()=>q({to:"/projects/$projectId/recently-deleted",params:{projectId:Z}}),children:[J("div",{className:"flex h-4 w-4 items-center justify-center",children:J(uJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.recently_deleted()})]})]})})]}),!m&&X("div",{className:O("flex flex-col overflow-hidden transition-all duration-300 ease-in-out border-b border-border pb-4",T?"flex-1 min-h-0 h-full":"flex-none h-[44px] max-h-[44px]"),children:[X("header",{className:"group flex items-center justify-between px-2 mb-1 flex-none",children:[X("div",{className:"flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors",onClick:()=>BJ(!T),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.collections()}),T?J(XJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(YJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),V&&J("button",{"data-testid":"create-collection",onClick:()=>PJ(),className:"text-muted-foreground hover:text-foreground flex-none",children:J(wJ,{className:"h-3.5 w-3.5"})})]}),J(ZJ,{className:O("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",T?"opacity-100 visible pointer-events-auto":"opacity-0 invisible pointer-events-none h-0"),children:X("div",{className:"space-y-0.5 pr-3",children:[X("div",{className:"group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>q({to:"/projects/$projectId/collections",params:{projectId:Z}}),children:[J("div",{className:"flex h-4 w-4 items-center justify-center",children:J(kJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.all_collections_count({count:l?.pages[0]?.pageInfo?.total||0})})]}),AJ.map((K)=>{let Y=e?.collectionId===K.id;return X("div",{className:O("group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0",Y&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),onClick:()=>q({to:"/projects/$projectId/collections/$collectionId",params:{projectId:Z,collectionId:K.id}}),children:[X("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[J("div",{className:"flex h-4 w-4 items-center justify-center shrink-0",children:J(rJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"truncate text-sidebar-foreground flex-1",children:K.name})]}),V&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(H)=>H.stopPropagation(),children:X(QJ,{modal:!1,children:[J(HJ,{asChild:!0,children:J(N,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(zJ,{className:"h-3.5 w-3.5"})})}),X(UJ,{align:"end",className:"w-32",children:[J(w,{onClick:()=>{yJ(K.id),EJ("collection"),JJ(K.name),k(!0)},children:W.rename()}),J(w,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{NJ(K.id),CJ("collection"),f(!0)},children:W.delete()})]})]})})]},K.id)}),J("div",{ref:qJ,className:"h-1"}),n&&J("div",{className:"flex justify-center p-2",children:J(p,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]})})]}),!C&&X("div",{className:O("flex flex-col overflow-hidden transition-all duration-300 ease-in-out",u?"flex-1 min-h-0 h-full":"flex-none h-[44px] max-h-[44px]"),children:[X("header",{className:"group flex items-center justify-between px-2 mb-1 flex-none",children:[X("div",{className:"flex-1 flex items-center gap-1.5 cursor-pointer select-none text-muted-foreground hover:text-foreground transition-colors",onClick:()=>bJ(!u),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.share_links()}),u?J(XJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(YJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),V&&J("div",{className:"flex items-center gap-1 flex-none",children:J("button",{onClick:()=>MJ(),className:"text-muted-foreground hover:text-foreground",children:J(wJ,{className:"h-3.5 w-3.5"})})})]}),J(ZJ,{className:O("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",u?"opacity-100 visible pointer-events-auto":"opacity-0 invisible pointer-events-none h-0"),children:X("div",{className:"space-y-0.5 pr-3",children:[X("div",{className:"group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>q({to:"/projects/$projectId/shares",params:{projectId:Z}}),children:[J("div",{className:"flex h-4 w-4 items-center justify-center",children:J(kJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.all_share_links_count({count:c?.pages[0]?.pageInfo?.total||0})})]}),OJ.map((K)=>J(CK,{link:K,projectId:Z,dragState:b,canEdit:V,onRenameTrigger:(Y,H)=>{yJ(Y),EJ("share"),JJ(H),k(!0)},onDeleteTrigger:(Y)=>{NJ(Y),CJ("share"),f(!0)}},K.id)),J("div",{ref:VJ,className:"h-1"}),R&&J("div",{className:"flex justify-center p-2",children:J(p,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]})})]}),J(TJ,{open:qK,onOpenChange:k,children:X(RJ,{onClick:(K)=>K.stopPropagation(),children:[J(SJ,{children:J(hJ,{children:F==="collection"?W.rename_collection():F==="share"?W.rename_share_link():W.rename_folder()})}),J("div",{className:"py-4",children:J(ZK,{value:E,onChange:(K)=>JJ(K.target.value),placeholder:W.enter_new_name(),onKeyDown:(K)=>{if(K.key==="Enter"&&E.trim()){if(F==="collection")mJ({id:y,name:E});else if(F==="share")jJ({id:y,name:E});else if(F==="folder")IJ({id:y,name:E})}}})}),X(fJ,{children:[J(N,{variant:"ghost",onClick:()=>k(!1),children:W.cancel()}),J(N,{disabled:!E.trim(),onClick:()=>{if(F==="collection")mJ({id:y,name:E});else if(F==="share")jJ({id:y,name:E});else if(F==="folder")IJ({id:y,name:E})},children:W.rename()})]})]})}),J(_K,{open:VK,onOpenChange:f,children:X($K,{onClick:(K)=>K.stopPropagation(),children:[X(GK,{children:[J(QK,{children:S==="collection"?W.delete_collection_confirm():S==="share"?W.delete_share_link_confirm():W.delete_folder_confirm()}),J(HK,{children:W.delete_confirm_description({type:S==="collection"?W.collection():S==="share"?W.share_link():W.folder().toLowerCase()})})]}),X(zK,{children:[J(BK,{children:W.cancel()}),J(UK,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(S==="collection")LK(vJ);else if(S==="share")yK(vJ);else if(S==="folder")AK(vJ)},children:W.delete()})]})]})}),J(TJ,{open:OK,onOpenChange:a,children:X(RJ,{className:"sm:max-w-md",children:[X(SJ,{children:[J(hJ,{children:KJ?W.preparing_download():W.confirm_download()}),J(XK,{children:KJ?W.resolving_files_wait():W.folder_files_download_description()})]}),KJ?X("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[J(p,{className:"h-8 w-8 animate-spin text-primary"}),J("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:W.preparing_download_links()})]}):X("div",{className:"space-y-4 py-2",children:[J("div",{className:"text-sm text-muted-foreground",children:W.download_includes_files({count:FJ.length})}),X("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[J(aJ,{className:"h-5 w-5 shrink-0 mt-0.5"}),X("div",{children:[J("p",{className:"font-semibold",children:W.no_folder_structure()}),J("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:W.folder_structure_warning()})]})]})]}),J(fJ,{children:!KJ?X(iJ,{children:[J(N,{variant:"outline",onClick:()=>a(!1),children:W.cancel()}),X(N,{onClick:MK,className:"gap-2",disabled:FJ.length===0,children:[J(DJ,{className:"h-4 w-4"}),W.start_download()]})]}):J(N,{disabled:!0,variant:"outline",children:W.cancel()})})]})})]})}function CK({link:B,projectId:Z,dragState:$,canEdit:P,onRenameTrigger:b,onDeleteTrigger:M}){let A=GJ(),C=h({from:"/projects/$projectId/shares/$shareId",shouldThrow:!1})?.shareId===B.id,{ref:D,isDropTarget:q}=gJ({id:`share:${B.id}`,data:{type:"share-link",id:B.id}}),Q=!!$?.isActive;return X("div",{ref:D,className:O("group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0",C&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium",q&&Q&&"bg-sidebar-accent ring-2 ring-primary ring-inset"),onClick:()=>A({to:"/projects/$projectId/shares/$shareId",params:{projectId:Z,shareId:B.id}}),children:[X("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[J("div",{className:"flex h-4 w-4 items-center justify-center shrink-0",children:J(JK,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"truncate text-sidebar-foreground flex-1",children:B.name})]}),P&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(V)=>V.stopPropagation(),children:X(QJ,{modal:!1,children:[J(HJ,{asChild:!0,children:J(N,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(zJ,{className:"h-3.5 w-3.5"})})}),X(UJ,{align:"end",className:"w-32",children:[J(w,{onClick:()=>{b(B.id,B.name)},children:W.rename()}),J(w,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{M(B.id)},children:W.delete()})]})]})})]})}function bK({teamId:B,projectId:Z,folder:$,level:P,isRoot:b,dragState:M,onSelect:A,selectedFolderId:m,canEdit:C,onRenameTrigger:D,onDeleteTrigger:q,onDownloadTrigger:Q,ancestorFolders:V}){let j=_.useMemo(()=>{return V?.some((G)=>G.id===$.id)??!1},[V,$.id]),[L,r]=_.useState(b||j);_.useEffect(()=>{if(j)r(!0)},[j]);let T=GJ(),BJ=h({from:"/projects/$projectId/folders/$folderId",select:(G)=>({folderId:G.folderId}),shouldThrow:!1}),u=h({from:"/projects/$projectId/",shouldThrow:!1}),bJ=b?!!u:BJ?.folderId===$.id,{data:c,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:R,isLoading:l}=_J({queryKey:["folders",$.id,"children",{assetType:"folder"}],queryFn:async({pageParam:G})=>{let y=await U.api.folders[":folderId"].children.$get({param:{folderId:$.id},query:{assetType:"folder",after:G,first:"20"}});if(!y.ok)throw Error(W.failed_to_fetch_folder_children());return await y.json()},initialPageParam:"",getNextPageParam:(G)=>{return G.pageInfo?.cursor||void 0},enabled:L||!!b}),{ref:o,inView:d}=$J();_.useEffect(()=>{if(d&&g&&!R)i()},[d,g,R,i]);let n=c?.pages.flatMap((G)=>G.data??[])??[],qJ=(G)=>{G.stopPropagation(),r(!L)},s=()=>{if(A){A($);return}if(b)T({to:"/projects/$projectId",params:{projectId:Z}});else T({to:"/projects/$projectId/folders/$folderId",params:{projectId:Z,folderId:$.id}})},{ref:VJ,isDragging:t}=YK({id:`tree:${$.id}`,data:{type:"folder",item:$},disabled:!!b||!!A||!C}),{ref:AJ,isDropTarget:OJ}=gJ({id:`tree:${$.id}`,data:{type:"folder",item:$},disabled:M?.draggedIds.has($.id)||!!A||!C}),PJ=(G)=>{VJ(G),AJ(G)},MJ=_.useMemo(()=>{if(A)return!1;if(!M?.isActive)return!1;if(M.draggedIds.has($.id))return!1;return!0},[M,$.id,A]),e=OJ&&MJ,LJ=m===$.id;return X("div",{children:[X("div",{ref:PJ,className:O("group flex cursor-pointer items-center gap-1 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground min-w-0",(bJ||LJ)&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium",t&&"opacity-50",e&&"bg-sidebar-accent ring-2 ring-primary ring-inset"),style:{...b?{}:{paddingLeft:`${P*12+8}px`}},onClick:s,children:[!b&&J("button",{onClick:qJ,className:"flex h-4 w-4 items-center justify-center shrink-0",children:L?J(oJ,{className:"h-3 w-3"}):J(sJ,{className:"h-3 w-3"})}),b?J(tJ,{className:"h-4 w-4 text-sidebar-primary shrink-0"}):J(eJ,{className:"h-4 w-4 text-sidebar-primary shrink-0"}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:$.name}),C&&!b&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(G)=>G.stopPropagation(),children:X(QJ,{modal:!1,children:[J(HJ,{asChild:!0,children:J(N,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(zJ,{className:"h-3.5 w-3.5"})})}),X(UJ,{align:"end",className:"w-32",children:[X(w,{onClick:()=>{D($.id,$.name)},children:[J(nJ,{className:"mr-2 h-4 w-4"}),W.rename()]}),X(w,{onClick:()=>{Q($.id)},children:[J(DJ,{className:"mr-2 h-4 w-4"}),W.download()]}),J(KK,{}),X(w,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{q($.id)},children:[J(uJ,{className:"mr-2 h-4 w-4"}),W.delete()]})]})]})})]}),L&&X("div",{children:[l&&J("div",{className:"flex items-center justify-center p-2",style:{paddingLeft:`${(P+1)*12+8}px`},children:J(p,{className:"h-4 w-4 animate-spin"})}),n.map((G)=>J(bK,{teamId:B,projectId:Z,folder:G,level:P+1,dragState:M,onSelect:A,selectedFolderId:m,canEdit:C,onRenameTrigger:D,onDeleteTrigger:q,onDownloadTrigger:Q,ancestorFolders:V},G.id)),g&&J("div",{ref:o,className:"flex items-center justify-center p-2",style:{paddingLeft:`${(P+1)*12+8}px`},children:R&&J(p,{className:"h-4 w-4 animate-spin"})})]})]})}
2
+ export{cK as pa};