@shumai-one/shumai 0.3.10 → 0.4.0

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 (193) hide show
  1. package/bin/chunk-02afmyqy.js +2 -0
  2. package/bin/chunk-045f1bw7.js +2 -0
  3. package/bin/{chunk-v1ybpqrz.js → chunk-06spnkta.js} +1 -1
  4. package/bin/chunk-0bfqrx5q.js +2 -0
  5. package/bin/chunk-0h8rjeyj.js +2 -0
  6. package/bin/chunk-0n1wfwcm.js +2 -0
  7. package/bin/chunk-1fwzepfn.js +2 -0
  8. package/bin/{chunk-gtenq4kq.js → chunk-1qr0ajc8.js} +1 -1
  9. package/bin/{chunk-0hbqkcsd.js → chunk-2rbexbv0.js} +1 -1
  10. package/bin/{chunk-y7b5gy17.js → chunk-2x46963w.js} +1 -1
  11. package/bin/chunk-2xevs82j.js +2 -0
  12. package/bin/{chunk-qk9npww4.js → chunk-2xgvs3as.js} +2 -2
  13. package/bin/chunk-31y5j4hr.js +1 -0
  14. package/bin/chunk-34adtqqh.js +1 -0
  15. package/bin/{chunk-vwz2pa54.js → chunk-34kaja59.js} +2 -2
  16. package/bin/chunk-3gjn4pyp.js +2 -0
  17. package/bin/{chunk-bv5mh0e0.js → chunk-3r33kewe.js} +3 -3
  18. package/bin/{chunk-8zmk029n.js → chunk-3twtxs5m.js} +1 -1
  19. package/bin/{chunk-stggq92k.js → chunk-41d9gkx7.js} +1 -1
  20. package/bin/{chunk-j6dea33m.js → chunk-44edgqvy.js} +3 -3
  21. package/bin/{chunk-62ag2nfa.js → chunk-4b7jcpgv.js} +2 -2
  22. package/bin/chunk-4j8fbckp.js +1 -0
  23. package/bin/{chunk-t16qt2ka.js → chunk-4q782s34.js} +3 -3
  24. package/bin/chunk-52dr035y.js +2 -0
  25. package/bin/chunk-57s7yj35.js +1 -0
  26. package/bin/{chunk-zdmcc6ps.js → chunk-5yhn31rd.js} +3 -3
  27. package/bin/chunk-62ebss6h.js +2 -0
  28. package/bin/{chunk-02tqxzgz.js → chunk-6m1k317a.js} +2 -2
  29. package/bin/chunk-6tse78c7.js +2 -0
  30. package/bin/{chunk-dgvcraag.js → chunk-76433x4d.js} +2 -2
  31. package/bin/chunk-792t2653.js +2 -0
  32. package/bin/chunk-7x1vkftb.js +68 -0
  33. package/bin/{chunk-hcaw54dj.js → chunk-8956rryj.js} +2 -2
  34. package/bin/chunk-8nyve0cr.js +7 -0
  35. package/bin/{chunk-xext4yvc.js → chunk-8rcfhfq5.js} +1 -1
  36. package/bin/chunk-93ecxcy4.js +2 -0
  37. package/bin/{chunk-y45tzhdn.js → chunk-9cmvymm5.js} +1 -1
  38. package/bin/{chunk-7r6h3fta.js → chunk-9k76s3y6.js} +2 -2
  39. package/bin/{chunk-g6aq2cyq.js → chunk-agabtxrc.js} +1 -1
  40. package/bin/chunk-ajndx51c.js +2 -0
  41. package/bin/chunk-aw5zkdma.js +2 -0
  42. package/bin/chunk-bbyc2jfq.js +1 -0
  43. package/bin/chunk-br7d2qwc.js +1 -0
  44. package/bin/chunk-by6g0vye.js +2 -0
  45. package/bin/chunk-c24fvhm6.js +1 -0
  46. package/bin/{chunk-k2w676wz.js → chunk-c3msq02x.js} +2 -2
  47. package/bin/chunk-c6aszz6p.js +1 -0
  48. package/bin/{chunk-y8ffp5zj.js → chunk-ck6msfch.js} +2 -2
  49. package/bin/chunk-csqvmx1m.js +2 -0
  50. package/bin/{chunk-qphebjbv.js → chunk-d7en47eh.js} +1 -1
  51. package/bin/{chunk-mk5hqjjd.js → chunk-dag45evp.js} +1 -1
  52. package/bin/chunk-dg8c91j5.js +1 -0
  53. package/bin/{chunk-ch25gq27.js → chunk-djx2r4nj.js} +2 -2
  54. package/bin/chunk-dk8vk17v.js +2 -0
  55. package/bin/chunk-dkjkn8t3.js +65 -0
  56. package/bin/{chunk-60xawsa6.js → chunk-et0cewj7.js} +2 -2
  57. package/bin/{chunk-2t2wjzme.js → chunk-etprs58p.js} +2 -2
  58. package/bin/{chunk-6529sh41.js → chunk-ex2ym5pz.js} +2 -2
  59. package/bin/{chunk-69sf7kb1.js → chunk-ez6veng7.js} +1 -1
  60. package/bin/chunk-f2zbsrc9.js +2 -0
  61. package/bin/chunk-fcsfssar.js +1 -0
  62. package/bin/chunk-fvbd5dk7.js +9 -0
  63. package/bin/chunk-gazp5662.js +4 -0
  64. package/bin/{chunk-0fpgfrv8.js → chunk-gcc6pte2.js} +2 -2
  65. package/bin/chunk-gcpr2a24.js +7 -0
  66. package/bin/chunk-gjnrd32m.js +2 -0
  67. package/bin/chunk-gpjkegdp.js +1 -0
  68. package/bin/{chunk-d4ktgq49.js → chunk-he1ywtxx.js} +1 -1
  69. package/bin/{chunk-s9yzt7s3.js → chunk-hx2mvd20.js} +2 -2
  70. package/bin/{chunk-fk9pd7ra.js → chunk-j04sztp3.js} +1 -1
  71. package/bin/{chunk-y5ptk39s.js → chunk-j536e9nx.js} +2 -2
  72. package/bin/{chunk-p9w4ar11.js → chunk-j5rx3x1q.js} +1 -1
  73. package/bin/chunk-jt6d0zb1.js +2 -0
  74. package/bin/chunk-jwgfkpek.js +3 -0
  75. package/bin/chunk-k2065y29.js +2 -0
  76. package/bin/{chunk-0qcp4v52.js → chunk-k3r97v7j.js} +1 -1
  77. package/bin/chunk-k514bttd.js +1 -0
  78. package/bin/chunk-k7chm9a9.js +2 -0
  79. package/bin/chunk-kjgejwjp.css +1 -0
  80. package/bin/{chunk-e26p9vrv.js → chunk-kjjhvrk1.js} +1 -1
  81. package/bin/chunk-kqpzx5az.js +73 -0
  82. package/bin/{chunk-k33qdrdp.js → chunk-kvnfgr29.js} +1 -1
  83. package/bin/chunk-kxr8fjsq.js +2 -0
  84. package/bin/{chunk-rakz3pe6.js → chunk-m2tbft2c.js} +2 -2
  85. package/bin/chunk-m8z8jvdq.js +2 -0
  86. package/bin/{chunk-p31qe5mc.js → chunk-md12a1sf.js} +2 -2
  87. package/bin/{chunk-nw03w9pa.js → chunk-mgnxa0vy.js} +1 -1
  88. package/bin/chunk-mha3rsh7.js +2 -0
  89. package/bin/chunk-mhps85dd.js +2 -0
  90. package/bin/{chunk-8r2agmv2.js → chunk-n8gsjwht.js} +2 -2
  91. package/bin/{chunk-bxexm2hd.js → chunk-nn0px81k.js} +58 -58
  92. package/bin/chunk-ns804tmv.js +2 -0
  93. package/bin/{chunk-42f9r1sg.js → chunk-nz2v1jmd.js} +2 -2
  94. package/bin/chunk-p1temt1j.js +1 -0
  95. package/bin/{chunk-wwjqqqr4.js → chunk-p49h5fxs.js} +1 -1
  96. package/bin/chunk-pdjar480.js +2 -0
  97. package/bin/{chunk-94fyesf6.js → chunk-qac5hr5h.js} +1 -1
  98. package/bin/{chunk-g5qfxnz1.js → chunk-r2shjtte.js} +2 -2
  99. package/bin/{chunk-a80aab0f.js → chunk-rkz6x3r0.js} +2 -2
  100. package/bin/{chunk-pv4scagf.js → chunk-s73c0brj.js} +1 -1
  101. package/bin/chunk-svz0ds0g.js +1 -0
  102. package/bin/{chunk-ag0pavv1.js → chunk-sx6y697s.js} +2 -2
  103. package/bin/chunk-t31basc5.js +1 -0
  104. package/bin/chunk-t6qdrw24.js +1 -0
  105. package/bin/{chunk-rjga1vn2.js → chunk-tcm57j8r.js} +2 -2
  106. package/bin/{chunk-7m07t899.js → chunk-thbfw1ed.js} +1 -1
  107. package/bin/{chunk-g2bkj92r.js → chunk-tn67sjb2.js} +2 -2
  108. package/bin/chunk-vcf2qk9h.js +2 -0
  109. package/bin/{chunk-6w395tfy.js → chunk-vhcqazqf.js} +2 -2
  110. package/bin/chunk-vkgxrn1h.js +2 -0
  111. package/bin/{chunk-7xwmj4ew.js → chunk-vvhs586e.js} +1 -1
  112. package/bin/{chunk-28axgckk.js → chunk-wehhpcm1.js} +1 -1
  113. package/bin/{chunk-2mxqjx3x.js → chunk-wrgwjg2g.js} +1 -1
  114. package/bin/chunk-wvwqgff4.js +1 -0
  115. package/bin/chunk-ww1cy08p.js +1 -0
  116. package/bin/{chunk-41de755j.js → chunk-wy2f6mby.js} +1 -1
  117. package/bin/{chunk-4shqnfq1.js → chunk-wzmpvadf.js} +1 -1
  118. package/bin/{chunk-gra1fhdp.js → chunk-x9akgj7w.js} +2 -2
  119. package/bin/chunk-xfp27ya9.js +2 -0
  120. package/bin/{chunk-1qd83phd.js → chunk-xjnghr99.js} +1 -1
  121. package/bin/{chunk-34f4hk54.js → chunk-xkhwj8mw.js} +2 -2
  122. package/bin/{chunk-m3ghgqc2.js → chunk-xv5h4dv1.js} +1 -1
  123. package/bin/{chunk-1whn0v5n.js → chunk-xzag8w1v.js} +1 -1
  124. package/bin/{chunk-tsym31yb.js → chunk-y0f4bc9f.js} +2 -2
  125. package/bin/{chunk-n3vzdzdw.js → chunk-y2s0tjaa.js} +2 -2
  126. package/bin/chunk-y3dy4pdt.js +2 -0
  127. package/bin/{chunk-2sk6e4q0.js → chunk-yfqz6f72.js} +1 -1
  128. package/bin/{chunk-enq1hf8g.js → chunk-ymr5ybxk.js} +2 -2
  129. package/bin/chunk-ysvhtgve.js +2 -0
  130. package/bin/{chunk-z7b132c0.js → chunk-yyjx8nbq.js} +2 -2
  131. package/bin/{chunk-emyax05s.js → chunk-zh752hw8.js} +1 -1
  132. package/bin/{chunk-at5ksmqs.js → chunk-zmyawgth.js} +1 -1
  133. package/bin/{chunk-1ev668rp.js → chunk-zye42cfp.js} +2 -2
  134. package/bin/shumai-app.html +1 -1
  135. package/bin/shumai-app.js +260 -230
  136. package/package.json +7 -7
  137. package/prisma/migrations/20260825080704_add_recent_file_items/migration.sql +28 -0
  138. package/prisma/schema.prisma +22 -2
  139. package/bin/chunk-09c03qdg.js +0 -2
  140. package/bin/chunk-0te5kcy3.js +0 -2
  141. package/bin/chunk-15zbprbe.js +0 -1
  142. package/bin/chunk-2sp0gkaw.js +0 -2
  143. package/bin/chunk-301pewt3.js +0 -1
  144. package/bin/chunk-33hax7fe.js +0 -66
  145. package/bin/chunk-39s0cxq1.js +0 -2
  146. package/bin/chunk-42et2rqa.js +0 -2
  147. package/bin/chunk-484yr1a7.js +0 -1
  148. package/bin/chunk-63emv4q3.js +0 -1
  149. package/bin/chunk-661mcdxj.js +0 -2
  150. package/bin/chunk-6gx6gdnk.js +0 -2
  151. package/bin/chunk-7735r8d7.js +0 -1
  152. package/bin/chunk-90jcmarf.js +0 -2
  153. package/bin/chunk-94yxj3yy.js +0 -2
  154. package/bin/chunk-9rhckjgf.js +0 -2
  155. package/bin/chunk-9ykcjdsv.js +0 -3
  156. package/bin/chunk-9yn5r2hh.js +0 -2
  157. package/bin/chunk-cc9fftnv.js +0 -2
  158. package/bin/chunk-csky7q56.js +0 -2
  159. package/bin/chunk-day61cfg.js +0 -2
  160. package/bin/chunk-f03whbny.js +0 -2
  161. package/bin/chunk-fscyvjzb.js +0 -2
  162. package/bin/chunk-gh6j1nsm.js +0 -1
  163. package/bin/chunk-h5jre78a.js +0 -2
  164. package/bin/chunk-hsemzjvr.js +0 -2
  165. package/bin/chunk-hte6gd36.js +0 -1
  166. package/bin/chunk-j99cr9mz.js +0 -2
  167. package/bin/chunk-jn805ccq.js +0 -1
  168. package/bin/chunk-kmhkhcy6.js +0 -68
  169. package/bin/chunk-kp4kn4b4.js +0 -2
  170. package/bin/chunk-m84qgdyj.js +0 -2
  171. package/bin/chunk-mnhg12fm.js +0 -2
  172. package/bin/chunk-p48npmbh.js +0 -2
  173. package/bin/chunk-pbztc6kv.js +0 -1
  174. package/bin/chunk-pg55qp08.js +0 -2
  175. package/bin/chunk-q0hrd0yw.js +0 -2
  176. package/bin/chunk-qev7trtm.js +0 -2
  177. package/bin/chunk-rt8yqz51.js +0 -1
  178. package/bin/chunk-s542e1y0.js +0 -1
  179. package/bin/chunk-s6e91ky2.js +0 -2
  180. package/bin/chunk-s9s9hhet.js +0 -2
  181. package/bin/chunk-sjsn35mp.js +0 -1
  182. package/bin/chunk-tc5evq8x.js +0 -2
  183. package/bin/chunk-tjrdsmdw.js +0 -1
  184. package/bin/chunk-tkh0s7hg.js +0 -2
  185. package/bin/chunk-vbkwteh4.js +0 -1
  186. package/bin/chunk-vevscfh2.js +0 -2
  187. package/bin/chunk-vg33qt6z.js +0 -11
  188. package/bin/chunk-vgwjg37a.js +0 -2
  189. package/bin/chunk-we3vdyhb.js +0 -1
  190. package/bin/chunk-whn6dvak.js +0 -1
  191. package/bin/chunk-xr1wr22v.css +0 -1
  192. package/bin/chunk-xvpttxen.js +0 -7
  193. package/bin/chunk-yfgwknpa.js +0 -78
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumai-one/shumai",
3
- "version": "0.3.10",
3
+ "version": "0.4.0",
4
4
  "description": "A fullstack AI-powered media workspace and workflow engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,12 +27,12 @@
27
27
  "zod": "4.4.3"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@shumai-one/shumai-darwin-arm64": "0.3.10",
31
- "@shumai-one/shumai-darwin-x64": "0.3.10",
32
- "@shumai-one/shumai-linux-arm64": "0.3.10",
33
- "@shumai-one/shumai-linux-x64": "0.3.10",
34
- "@shumai-one/shumai-win32-arm64": "0.3.10",
35
- "@shumai-one/shumai-win32-x64": "0.3.10"
30
+ "@shumai-one/shumai-darwin-arm64": "0.4.0",
31
+ "@shumai-one/shumai-darwin-x64": "0.4.0",
32
+ "@shumai-one/shumai-linux-arm64": "0.4.0",
33
+ "@shumai-one/shumai-linux-x64": "0.4.0",
34
+ "@shumai-one/shumai-win32-arm64": "0.4.0",
35
+ "@shumai-one/shumai-win32-x64": "0.4.0"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
@@ -0,0 +1,28 @@
1
+ -- CreateTable
2
+ CREATE TABLE "recent_file_items" (
3
+ "id" TEXT NOT NULL,
4
+ "user_id" TEXT NOT NULL,
5
+ "project_id" TEXT NOT NULL,
6
+ "asset_id" TEXT NOT NULL,
7
+ "viewed_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
8
+
9
+ CONSTRAINT "recent_file_items_pkey" PRIMARY KEY ("id")
10
+ );
11
+
12
+ -- CreateIndex
13
+ CREATE INDEX "recent_file_items_user_id_project_id_viewed_at_idx" ON "recent_file_items"("user_id", "project_id", "viewed_at" DESC);
14
+
15
+ -- CreateIndex
16
+ CREATE INDEX "recent_file_items_asset_id_idx" ON "recent_file_items"("asset_id");
17
+
18
+ -- CreateIndex
19
+ CREATE UNIQUE INDEX "recent_file_items_user_id_project_id_asset_id_key" ON "recent_file_items"("user_id", "project_id", "asset_id");
20
+
21
+ -- AddForeignKey
22
+ ALTER TABLE "recent_file_items" ADD CONSTRAINT "recent_file_items_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
23
+
24
+ -- AddForeignKey
25
+ ALTER TABLE "recent_file_items" ADD CONSTRAINT "recent_file_items_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
26
+
27
+ -- AddForeignKey
28
+ ALTER TABLE "recent_file_items" ADD CONSTRAINT "recent_file_items_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -236,8 +236,9 @@ model User {
236
236
  kanbanTasksReported KanbanTask[] @relation("KanbanTaskReporter")
237
237
  kanbanTasksAssigned KanbanTask[] @relation("KanbanTaskAssignee")
238
238
  kanbanGoalsCreated KanbanGoal[] @relation("UserToKanbanGoal")
239
- kanbanTaskComments KanbanTaskComment[]
240
- kanbanTaskEvents KanbanTaskEvent[]
239
+ kanbanTaskComments KanbanTaskComment[]
240
+ kanbanTaskEvents KanbanTaskEvent[]
241
+ recentFiles RecentFileItem[]
241
242
 
242
243
  @@map("users")
243
244
  }
@@ -414,6 +415,7 @@ model Project {
414
415
  collections Collection[] @relation("ProjectToCollection")
415
416
  auditLogs AuditLog[] @relation("ProjectToAuditLog")
416
417
  kanbanTasks KanbanTask[] @relation("ProjectToKanbanTask")
418
+ recentFiles RecentFileItem[]
417
419
 
418
420
  @@map("projects")
419
421
  @@index([createdAt])
@@ -564,6 +566,7 @@ model Asset {
564
566
  agentMd AssetAgentMd? @relation("AssetToAgentMd")
565
567
  kanbanTargetTasks KanbanTask[] @relation("KanbanTaskTargetFolder")
566
568
  kanbanTasks KanbanTaskAsset[]
569
+ recentFiles RecentFileItem[]
567
570
 
568
571
  @@map("assets")
569
572
  @@index([type])
@@ -1273,5 +1276,22 @@ model KanbanTaskEvent {
1273
1276
  @@map("kanban_task_events")
1274
1277
  }
1275
1278
 
1279
+ model RecentFileItem {
1280
+ id String @id @default(ulid())
1281
+ userId String @map("user_id")
1282
+ projectId String @map("project_id")
1283
+ assetId String @map("asset_id")
1284
+ viewedAt DateTime @default(now()) @map("viewed_at")
1285
+
1286
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
1287
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
1288
+ asset Asset @relation(fields: [assetId], references: [id], onDelete: Cascade)
1289
+
1290
+ @@unique([userId, projectId, assetId], name: "userIdProjectIdAssetId")
1291
+ @@index([userId, projectId, viewedAt(sort: Desc)])
1292
+ @@index([assetId])
1293
+ @@map("recent_file_items")
1294
+ }
1295
+
1276
1296
 
1277
1297
 
@@ -1,2 +0,0 @@
1
- import{l as qy,m as By}from"./chunk-s9s9hhet.js";import{r as Zy}from"./chunk-xvpttxen.js";import{t as _y,w as $y}from"./chunk-bxexm2hd.js";import{V as Wy}from"./chunk-ch25gq27.js";import{se as Yy}from"./chunk-csky7q56.js";import{Fe as p,Ge as v,He as g,Je as f}from"./chunk-gra1fhdp.js";import{Zf as Jy}from"./chunk-n3vzdzdw.js";import{$h as Z,Ai as $,Ei as Ky,Hl as Uy,Mi as R,Yh as oy,Zh as zy,_h as O,_j as Oy,di as Q,gi as w,li as by,ul as Xy,xl as Gy}from"./chunk-yfgwknpa.js";import{Mm as ty}from"./chunk-wwjqqqr4.js";var X=ty(oy(),1);function _z({shareId:b,initialFolderId:Hy,initialFileId:u,startTime:Ty,versionId:B,compare:Vy,compareLeftId:L,compareRightId:x,compareActiveSide:F="left"}){let W=by(),q=!!Vy&&!!L&&!!x,[J,c]=X.useState(()=>{return localStorage.getItem(`share_pwd_${b}`)||""}),[P,Qy]=X.useState(""),{data:K,error:H,isLoading:ky}=Q({queryKey:["share-info",b,J],queryFn:async()=>{let y=await $.api.shares[":shareId"].info.$get({param:{shareId:b}},{headers:{"x-share-password":J}});if(y.status===401)throw Error("Unauthorized");if(y.status===403){let z=await y.json();throw Error(z.error||"Forbidden")}if(!y.ok)throw Error("Failed to fetch share info");return await y.json()},retry:!1}),G=Hy||K?.rootFolderId,U=u||null,h=B||U,[l,m]=X.useState([]),{data:A}=Q({queryKey:["public-share-folder",b,G,J],queryFn:async()=>{let y=await $.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:b,fileId:G}},{headers:{"x-share-password":J}});if(y.status===401)throw Error("Unauthorized");return await y.json()},enabled:!!K&&!!G});X.useEffect(()=>{if(A?.ancestorFolders&&K){let y=A.ancestorFolders.findIndex((z)=>z.id===K.rootFolderId);if(y!==-1)m(A.ancestorFolders.slice(0,y));else if(G===K.rootFolderId)m([])}},[A,K,G]);let[k,M]=X.useState(new Set),[My,Ny]=X.useState(360),[D,Ey]=X.useState(()=>!u),N=X.useRef(null),[n,C]=X.useState([]),[Ly,t]=X.useState(0),[xy,o]=X.useState(null),[I,Ay]=X.useState(null),[Ry,Py]=X.useState(void 0),{data:i,fetchNextPage:Dy,hasNextPage:Cy,isFetchingNextPage:jy,error:a}=w({queryKey:["public-share-children",b,G,"folder",J],queryFn:async({pageParam:y})=>{let z=await $.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:b,folderId:G},query:{assetType:"folder",after:y}},{headers:{"x-share-password":J}});if(z.status===401)throw Error("Unauthorized");if(z.status===403)throw Error("Expired");return await z.json()},enabled:!!K&&!!G,initialPageParam:"",getNextPageParam:(y)=>y.pageInfo?.cursor||void 0,retry:!1}),{data:d,fetchNextPage:Sy,hasNextPage:wy,isFetchingNextPage:py}=w({queryKey:["public-share-children",b,G,"file",J],queryFn:async({pageParam:y})=>{let z=await $.api.shares[":shareId"].folders[":folderId"].children.$get({param:{shareId:b,folderId:G},query:{assetType:"file",after:y}},{headers:{"x-share-password":J}});if(z.status===401)throw Error("Unauthorized");if(z.status===403)throw Error("Expired");return await z.json()},enabled:!!K&&!!G,initialPageParam:"",getNextPageParam:(y)=>y.pageInfo?.cursor||void 0,retry:!1}),{data:vy}=Q({queryKey:["public-share-fields",b,J],queryFn:async()=>{let y=await $.api.shares[":shareId"].fields.$get({param:{shareId:b}},{headers:{"x-share-password":J}});if(y.status===401)throw Error("Unauthorized");return await y.json()},enabled:!!K}),{data:_,isLoading:gy}=Q({queryKey:["public-share-file",b,U,J],queryFn:async()=>{let y=await $.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:b,fileId:U}},{headers:{"x-share-password":J}});if(y.status===401)throw Error("Unauthorized");return await y.json()},enabled:!!U&&!!K}),{data:fy,isLoading:uy}=Q({queryKey:["public-share-file",b,B,J],queryFn:async()=>{let y=await $.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:b,fileId:B}},{headers:{"x-share-password":J}});if(y.status===401)throw Error("Unauthorized");return await y.json()},enabled:!!B&&!!K}),Y=B?fy:_,Fy=gy||!!B&&uy;X.useEffect(()=>{if(a?.message==="Unauthorized")c(""),localStorage.removeItem(`share_pwd_${b}`)},[a,b]);let E=X.useMemo(()=>i?.pages.flatMap((y)=>y.data??[])??[],[i]),j=X.useMemo(()=>d?.pages.flatMap((y)=>y.data??[])??[],[d]),s=X.useMemo(()=>{if(Y)return Y;if(k.size!==1)return null;let y=Array.from(k)[0];return[...E,...j].find((z)=>z.id===y)||null},[k,E,j,Y]),cy=(y)=>{y.preventDefault(),c(P),localStorage.setItem(`share_pwd_${b}`,P)},hy=(y)=>{if(y.type==="folder"||y.targetType==="folder")W({to:"/share/$shareId/folders/$folderId",params:{shareId:b,folderId:y.id}});else W({to:"/share/$shareId/files/$fileId",params:{shareId:b,fileId:y.versionStack?y.versionStack.id:y.id}});M(new Set)},ly=(y)=>{if(!K)return;let z=y==="root"?K.rootFolderId:y;if(z===K.rootFolderId)W({to:"/share/$shareId",params:{shareId:b}});else W({to:"/share/$shareId/folders/$folderId",params:{shareId:b,folderId:z}});M(new Set)},my=(y)=>{o(y.id||null);let z=y.annotations;if(z&&z.length>0)C(z);else C([]);if(q){if(y.second!==null&&y.second!==void 0)Py({second:y.second,nonce:Date.now()});return}if(y.second!==null&&y.second!==void 0)N.current?.seekTo(y.second),N.current?.pause();else if(z&&z.length>0)N.current?.pause()},r=()=>{C([]),o(null)},S=(y)=>{if(!U)return;W({to:"/share/$shareId/files/$fileId",params:{shareId:b,fileId:U},search:(z)=>({...z,...y})})},ny=()=>{S({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:F==="left"?L:x})},{setProjectState:e,clearProjectState:yy}=Jy();X.useEffect(()=>{if(K&&G){let y=G===K.rootFolderId?K.name:E.find((z)=>z.id===G)?.name||K.name;e({teamId:"",projectId:K.projectId,projectName:K.name,ancestorFolders:l,currentAsset:{name:Y?.name||y,type:U?"file":"folder",version:_?.versionStack?_.versionStack.versions.find((z)=>z.id===h)?.version??_.versionStack.versions.length:void 0,proxyType:Y?.proxyType||null},isRootFolder:G===K.rootFolderId&&!U,isPublic:!0,shareId:b,fileId:U||void 0,allowDownload:K.allowDownload,downloadInfo:Y?{originalKey:Y.media?.original?.key,videoTranscodes:Y.media?.videoTranscodes?.map((z)=>({key:z.key,width:z.width,height:z.height}))}:void 0,onFolderClick:ly,isRightSidebarCollapsed:D,onRightSidebarToggle:()=>Ey((z)=>!z),versions:_?.versionStack?.versions,compareMode:q,canCompareVersions:(_?.versionStack?.versions?.length??0)>=2,onCompareVersions:()=>{let z=_y(_?.versionStack?.versions);if(!z||!U)return;W({to:"/share/$shareId/files/$fileId",params:{shareId:b,fileId:U},search:(V)=>({...V,compare:!0,cmpLeft:z.left.id,cmpRight:z.right.id,cmpActive:"left"})})}})}return()=>yy()},[K,G,E,Y,_,h,U,l,e,yy,D,q,W,b]);let T;if(ky&&!H)T=O("div",{className:"flex flex-1 items-center justify-center bg-background",children:O(R,{className:"h-8 w-8 animate-spin text-foreground"})});else if(H)if(H.message==="Unauthorized"){let y=J!=="";T=O("div",{className:"flex flex-1 items-center justify-center p-4",children:Z(p,{className:"w-full max-w-md",children:[Z(v,{className:"text-center",children:[O("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:O(Oy,{className:"h-6 w-6 text-primary"})}),O(g,{children:Gy.password_protected()})]}),O(f,{children:Z("form",{onSubmit:cy,className:"space-y-4",children:[Z("div",{className:"space-y-2",children:[O(Uy,{type:"password",placeholder:"Enter password",value:P,onChange:(z)=>Qy(z.target.value),autoFocus:!0}),y&&O("p",{className:"text-sm font-medium text-destructive",children:"Incorrect password. Please try again."})]}),O(Xy,{type:"submit",className:"w-full",children:"Access Share"})]})})]})})}else{let y=H.message.includes("expired"),z=H.message.includes("disabled");T=O("div",{className:"flex flex-1 items-center justify-center p-4",children:Z(p,{className:"w-full max-w-md",children:[Z(v,{className:"text-center",children:[O("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:O(Ky,{className:"h-6 w-6 text-destructive"})}),O(g,{children:y?"Share Expired":z?"Share Disabled":"Error"})]}),O(f,{className:"text-center text-muted-foreground",children:H.message})]})})}else if(!K)T=O("div",{className:"flex flex-1 items-center justify-center bg-background",children:O(R,{className:"h-8 w-8 animate-spin text-foreground"})});else T=Z("div",{className:"flex flex-1 overflow-hidden relative",children:[U?Z("div",{className:"flex-1 relative bg-muted/30",children:[Fy&&!q&&O("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:O(R,{className:"h-8 w-8 animate-spin text-foreground"})}),q&&L&&x?O(By,{isPublic:!0,shareId:b,versions:Y?.versionStack?.versions??[],leftId:L,rightId:x,activeSide:F,annotations:n,seekRequest:Ry,allowDownload:K.allowDownload,onActiveSideChange:(y)=>S({cmpActive:y}),onSwitchVersion:(y,z)=>S(y==="left"?{cmpLeft:z}:{cmpRight:z}),onExit:ny,onActiveAssetChange:Ay,onPlay:r,onTimeUpdate:t}):Y&&O(qy,{file:Y,mediaControllerRef:N,onPlay:r,onTimeUpdate:t,annotations:n,startTime:Ty,shareId:b,allowDownload:K.allowDownload})]}):G&&O(Zy,{teamId:"",projectId:K.projectId,assetId:G,folders:E,files:j,selectedItem:null,selectedIds:k,onItemSelect:(y,z)=>{if(z.metaKey||z.ctrlKey){let V=new Set(k);if(V.has(y.id))V.delete(y.id);else V.add(y.id);M(V)}else M(new Set([y.id]))},onItemDoubleClick:hy,onSaveField:()=>{},displayStyle:K.viewMode??"card",onClearSelection:()=>M(new Set),fetchNextFoldersPage:Dy,hasNextFoldersPage:Cy,isFetchingNextFoldersPage:jy,fetchNextFilesPage:Sy,hasNextFilesPage:wy,isFetchingNextFilesPage:py,isShareView:!0,isPublic:!0,shareId:b,allowDownload:K.allowDownload}),!D&&Z(zy,{children:[O(Wy,{onResize:(y)=>Ny((z)=>Math.max(240,Math.min(600,z-y)))}),O("div",{style:{width:My},className:"flex-shrink-0 border-l",children:O($y,{teamId:"",projectId:K.projectId,file:q?I:s,onSaveField:()=>{},members:[],readOnly:!0,publicFields:vy,onCommentSelect:my,isPublic:!0,shareId:b,currentTime:Ly,onTyping:()=>{N.current?.pause()},selectedCommentId:xy,hideAnnotationControl:(q?I:s)?.proxyType==="audio"})})]})]});return Z("div",{className:"flex h-screen flex-col bg-background",children:[O(Yy,{}),T]})}
2
- export{_z as k};
@@ -1,2 +0,0 @@
1
- import{Ug as ZK,Wg as IJ}from"./chunk-kmhkhcy6.js";import{Yg as $J}from"./chunk-y8ffp5zj.js";import{$g as zJ}from"./chunk-rjga1vn2.js";import{Ih as UJ,Kh as BJ,Lh as bJ,Mh as F,Qh as WK,Vh as XK}from"./chunk-hsemzjvr.js";import{$h as X,Ai as U,Ak as KK,Al as SJ,Bl as fJ,Cl as hJ,Dl as DJ,El as YK,Fj as JK,Fl as z,Hl as _K,Il as $K,Jl as GK,Ki as HJ,Kl as zK,Lk as gJ,Ll as QK,Mi as c,Ml as HK,Nl as UK,Ol as BK,Pl as bK,Si as aJ,Tj as wJ,Ui as rJ,Yh as CK,Zh as lJ,_h as J,ai as dJ,dj as oJ,fi as y,gi as GJ,ji as nJ,ki as R,kj as sJ,li as QJ,mj as tJ,oj as ZJ,ok as TJ,pj as _J,rj as eJ,sl as A,ul as E,xj as uJ,xl as W,yl as RJ}from"./chunk-yfgwknpa.js";import{Mm as NK}from"./chunk-wwjqqqr4.js";var _=NK(CK(),1);function iK({teamId:B,projectId:Z,projectName:$,rootFolderId:O,dragState:b,onSelect:M,selectedFolderId:V,hideCollections:i,hideShares:v,hideRecentlyDeleted:S,ancestorFolders:f}){let q=QJ(),Q=dJ(),{canEdit:P}=XK(Z),h=nJ({from:"/projects/$projectId/recently-deleted",shouldThrow:!1}),[k,o]=_.useState(!0),[D,qJ]=_.useState(!0),[u,VJ]=_.useState(!0),{data:g,fetchNextPage:I,hasNextPage:x,isFetchingNextPage:l}=GJ({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:d,fetchNextPage:n,hasNextPage:s,isFetchingNextPage:a}=GJ({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:AJ,inView:t}=zJ(),{ref:OJ,inView:e}=zJ();_.useEffect(()=>{if(t&&s&&!a)n()},[t,s,a,n]),_.useEffect(()=>{if(e&&x&&!l)I()},[e,x,l,I]);let PJ=_.useMemo(()=>d?.pages.flatMap((K)=>K.data)||[],[d]),MJ=_.useMemo(()=>g?.pages.flatMap((K)=>K.data)||[],[g]),{mutate:LJ}=y({mutationFn:async()=>{let K=await U.api.projects[":projectId"].collections.$post({param:{projectId:Z},json:{name:W.untitled_collection(),filter:{sourceFolderId:O,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:yJ}=y({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}`)}}),JJ=R({from:"/projects/$projectId/collections/$collectionId",shouldThrow:!1}),G=R({from:"/projects/$projectId/shares/$shareId",shouldThrow:!1}),KJ=R({from:"/projects/$projectId/folders/$folderId",shouldThrow:!1}),[p,EJ]=_.useState(null),[N,vJ]=_.useState("collection"),[L,WJ]=_.useState(""),[VK,C]=_.useState(!1),[NJ,CJ]=_.useState(null),[w,FJ]=_.useState("collection"),[AK,T]=_.useState(!1),{mutate:xJ}=y({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()),C(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:OK}=y({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()),T(!1),KJ?.folderId===K)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),[PK,r]=_.useState(!1),[XJ,pJ]=_.useState(!1),[kJ,mJ]=_.useState([]),MK=async(K)=>{r(!0),pJ(!0),mJ([]);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();mJ(H.files)}catch(Y){z.error(W.failed_to_prepare_download_links()),r(!1),console.error(Y)}finally{pJ(!1)}},LK=()=>{let K=[...kJ];if(r(!1),K.length===0)return;z.info(W.starting_download_files({count:K.length}),{duration:5000});let Y=(YJ)=>new Promise((m)=>setTimeout(m,YJ));(async()=>{for(let m=0;m<K.length;m+=5){let vK=K.slice(m,m+5);for(let iJ of vK){let j=document.createElement("a");j.href=iJ.url,j.download=iJ.name,j.target="_blank",document.body.appendChild(j),j.click(),j.remove()}await Y(1000)}})().catch((YJ)=>{console.error("Background downloads failed:",YJ),z.error(W.some_downloads_failed())})},{mutate:jJ}=y({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()),C(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:yK}=y({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()),T(!1),JJ?.collectionId===Y)q({to:"/projects/$projectId",params:{projectId:Z}})},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:cJ}=y({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()),C(!1)},onError:(K)=>{z.error(`Error: ${K.message}`)}}),{mutate:EK}=y({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()),T(!1),G?.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:A("flex flex-col overflow-hidden transition-all duration-300 ease-in-out border-b border-border pb-4",k?"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:()=>o(!k),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.folder_tree_assets()}),k?J(ZJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(_J,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]})}),J($J,{className:A("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",k?"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(qK,{teamId:B,projectId:Z,folder:{id:O,name:$,type:"folder",sizeByte:0,fileCount:0,status:"processed",createdAt:"",updatedAt:""},level:0,isRoot:!0,dragState:b,onSelect:M,selectedFolderId:V,canEdit:P,onRenameTrigger:(K,Y)=>{EJ(K),vJ("folder"),WJ(Y),C(!0)},onDeleteTrigger:(K)=>{CJ(K),FJ("folder"),T(!0)},onDownloadTrigger:(K)=>{MK(K)},ancestorFolders:f},O),P&&!S&&X("div",{className:A("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",h&&"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(gJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.recently_deleted()})]})]})})]}),!i&&X("div",{className:A("flex flex-col overflow-hidden transition-all duration-300 ease-in-out border-b border-border pb-4",D?"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:()=>qJ(!D),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.collections()}),D?J(ZJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(_J,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),P&&J("button",{"data-testid":"create-collection",onClick:()=>LJ(),className:"text-muted-foreground hover:text-foreground flex-none",children:J(TJ,{className:"h-3.5 w-3.5"})})]}),J($J,{className:A("flex-1 min-h-0 transition-all duration-300 ease-in-out [&>div>div]:block!",D?"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(wJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.all_collections_count({count:d?.pages[0]?.pageInfo?.total||0})})]}),PJ.map((K)=>{let Y=JJ?.collectionId===K.id;return X("div",{className:A("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(oJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"truncate text-sidebar-foreground flex-1",children:K.name})]}),P&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(H)=>H.stopPropagation(),children:X(UJ,{modal:!1,children:[J(BJ,{asChild:!0,children:J(E,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(HJ,{className:"h-3.5 w-3.5"})})}),X(bJ,{align:"end",className:"w-32",children:[J(F,{onClick:()=>{EJ(K.id),vJ("collection"),WJ(K.name),C(!0)},children:W.rename()}),J(F,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{CJ(K.id),FJ("collection"),T(!0)},children:W.delete()})]})]})})]},K.id)}),J("div",{ref:AJ,className:"h-1"}),a&&J("div",{className:"flex justify-center p-2",children:J(c,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]})})]}),!v&&X("div",{className:A("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:()=>VJ(!u),children:[J("h3",{className:"text-xs font-semibold uppercase tracking-wider",children:W.share_links()}),u?J(ZJ,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"}):J(_J,{className:"h-3.5 w-3.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),P&&J("div",{className:"flex items-center gap-1 flex-none",children:J("button",{onClick:()=>yJ(),className:"text-muted-foreground hover:text-foreground",children:J(TJ,{className:"h-3.5 w-3.5"})})})]}),J($J,{className:A("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(wJ,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:W.all_share_links_count({count:g?.pages[0]?.pageInfo?.total||0})})]}),MJ.map((K)=>J(FK,{link:K,projectId:Z,dragState:b,canEdit:P,onRenameTrigger:(Y,H)=>{EJ(Y),vJ("share"),WJ(H),C(!0)},onDeleteTrigger:(Y)=>{CJ(Y),FJ("share"),T(!0)}},K.id)),J("div",{ref:OJ,className:"h-1"}),l&&J("div",{className:"flex justify-center p-2",children:J(c,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]})})]}),J(RJ,{open:VK,onOpenChange:C,children:X(SJ,{onClick:(K)=>K.stopPropagation(),children:[J(fJ,{children:J(DJ,{children:N==="collection"?W.rename_collection():N==="share"?W.rename_share_link():W.rename_folder()})}),J("div",{className:"py-4",children:J(_K,{value:L,onChange:(K)=>WJ(K.target.value),placeholder:W.enter_new_name(),onKeyDown:(K)=>{if(K.key==="Enter"&&L.trim()){if(N==="collection")jJ({id:p,name:L});else if(N==="share")cJ({id:p,name:L});else if(N==="folder")xJ({id:p,name:L})}}})}),X(hJ,{children:[J(E,{variant:"ghost",onClick:()=>C(!1),children:W.cancel()}),J(E,{disabled:!L.trim(),onClick:()=>{if(N==="collection")jJ({id:p,name:L});else if(N==="share")cJ({id:p,name:L});else if(N==="folder")xJ({id:p,name:L})},children:W.rename()})]})]})}),J($K,{open:AK,onOpenChange:T,children:X(GK,{onClick:(K)=>K.stopPropagation(),children:[X(zK,{children:[J(HK,{children:w==="collection"?W.delete_collection_confirm():w==="share"?W.delete_share_link_confirm():W.delete_folder_confirm()}),J(UK,{children:W.delete_confirm_description({type:w==="collection"?W.collection():w==="share"?W.share_link():W.folder().toLowerCase()})})]}),X(QK,{children:[J(bK,{children:W.cancel()}),J(BK,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(w==="collection")yK(NJ);else if(w==="share")EK(NJ);else if(w==="folder")OK(NJ)},children:W.delete()})]})]})}),J(RJ,{open:PK,onOpenChange:r,children:X(SJ,{className:"sm:max-w-md",children:[X(fJ,{children:[J(DJ,{children:XJ?W.preparing_download():W.confirm_download()}),J(YK,{children:XJ?W.resolving_files_wait():W.folder_files_download_description()})]}),XJ?X("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[J(c,{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:kJ.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(rJ,{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(hJ,{children:!XJ?X(lJ,{children:[J(E,{variant:"outline",onClick:()=>r(!1),children:W.cancel()}),X(E,{onClick:LK,className:"gap-2",disabled:kJ.length===0,children:[J(uJ,{className:"h-4 w-4"}),W.start_download()]})]}):J(E,{disabled:!0,variant:"outline",children:W.cancel()})})]})})]})}function FK({link:B,projectId:Z,dragState:$,canEdit:O,onRenameTrigger:b,onDeleteTrigger:M}){let V=QJ(),v=R({from:"/projects/$projectId/shares/$shareId",shouldThrow:!1})?.shareId===B.id,{ref:S,isDropTarget:f}=IJ({id:`share:${B.id}`,data:{type:"share-link",id:B.id}}),q=!!$?.isActive;return X("div",{ref:S,className:A("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",v&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium",f&&q&&"bg-sidebar-accent ring-2 ring-primary ring-inset"),onClick:()=>V({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(KK,{className:"h-4 w-4 text-sidebar-primary"})}),J("span",{className:"truncate text-sidebar-foreground flex-1",children:B.name})]}),O&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(Q)=>Q.stopPropagation(),children:X(UJ,{modal:!1,children:[J(BJ,{asChild:!0,children:J(E,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(HJ,{className:"h-3.5 w-3.5"})})}),X(bJ,{align:"end",className:"w-32",children:[J(F,{onClick:()=>{b(B.id,B.name)},children:W.rename()}),J(F,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{M(B.id)},children:W.delete()})]})]})})]})}function qK({teamId:B,projectId:Z,folder:$,level:O,isRoot:b,dragState:M,onSelect:V,selectedFolderId:i,canEdit:v,onRenameTrigger:S,onDeleteTrigger:f,onDownloadTrigger:q,ancestorFolders:Q}){let P=_.useMemo(()=>{return Q?.some((G)=>G.id===$.id)??!1},[Q,$.id]),[h,k]=_.useState(b||P);_.useEffect(()=>{if(P)k(!0)},[P]);let o=QJ(),D=R({from:"/projects/$projectId/folders/$folderId",select:(G)=>({folderId:G.folderId}),shouldThrow:!1}),qJ=R({from:"/projects/$projectId/",shouldThrow:!1}),u=b?!!qJ:D?.folderId===$.id,{data:VJ,fetchNextPage:g,hasNextPage:I,isFetchingNextPage:x,isLoading:l}=GJ({queryKey:["folders",$.id,"children",{assetType:"folder"}],queryFn:async({pageParam:G})=>{let KJ=await U.api.folders[":folderId"].children.$get({param:{folderId:$.id},query:{assetType:"folder",after:G,first:"20"}});if(!KJ.ok)throw Error(W.failed_to_fetch_folder_children());return await KJ.json()},initialPageParam:"",getNextPageParam:(G)=>{return G.pageInfo?.cursor||void 0},enabled:h||!!b}),{ref:d,inView:n}=zJ();_.useEffect(()=>{if(n&&I&&!x)g()},[n,I,x,g]);let s=VJ?.pages.flatMap((G)=>G.data??[])??[],a=(G)=>{G.stopPropagation(),k(!h)},AJ=()=>{if(V){V($);return}if(b)o({to:"/projects/$projectId",params:{projectId:Z}});else o({to:"/projects/$projectId/folders/$folderId",params:{projectId:Z,folderId:$.id}})},{ref:t,isDragging:OJ}=ZK({id:`tree:${$.id}`,data:{type:"folder",item:$},disabled:!!b||!!V||!v}),{ref:e,isDropTarget:PJ}=IJ({id:`tree:${$.id}`,data:{type:"folder",item:$},disabled:M?.draggedIds.has($.id)||!!V||!v}),MJ=(G)=>{t(G),e(G)},LJ=_.useMemo(()=>{if(V)return!1;if(!M?.isActive)return!1;if(M.draggedIds.has($.id))return!1;return!0},[M,$.id,V]),yJ=PJ&&LJ,JJ=i===$.id;return X("div",{children:[X("div",{ref:MJ,className:A("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",(u||JJ)&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium",OJ&&"opacity-50",yJ&&"bg-sidebar-accent ring-2 ring-primary ring-inset"),style:{...b?{}:{paddingLeft:`${O*12+8}px`}},onClick:AJ,children:[!b&&J("button",{onClick:a,className:"flex h-4 w-4 items-center justify-center shrink-0",children:h?J(sJ,{className:"h-3 w-3"}):J(tJ,{className:"h-3 w-3"})}),b?J(eJ,{className:"h-4 w-4 text-sidebar-primary shrink-0"}):J(JK,{className:"h-4 w-4 text-sidebar-primary shrink-0"}),J("span",{className:"flex-1 truncate text-sidebar-foreground",children:$.name}),v&&!b&&J("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:(G)=>G.stopPropagation(),children:X(UJ,{modal:!1,children:[J(BJ,{asChild:!0,children:J(E,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0",children:J(HJ,{className:"h-3.5 w-3.5"})})}),X(bJ,{align:"end",className:"w-32",children:[X(F,{onClick:()=>{S($.id,$.name)},children:[J(aJ,{className:"mr-2 h-4 w-4"}),W.rename()]}),X(F,{onClick:()=>{q($.id)},children:[J(uJ,{className:"mr-2 h-4 w-4"}),W.download()]}),J(WK,{}),X(F,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{f($.id)},children:[J(gJ,{className:"mr-2 h-4 w-4"}),W.delete()]})]})]})})]}),h&&X("div",{children:[l&&J("div",{className:"flex items-center justify-center p-2",style:{paddingLeft:`${(O+1)*12+8}px`},children:J(c,{className:"h-4 w-4 animate-spin"})}),s.map((G)=>J(qK,{teamId:B,projectId:Z,folder:G,level:O+1,dragState:M,onSelect:V,selectedFolderId:i,canEdit:v,onRenameTrigger:S,onDeleteTrigger:f,onDownloadTrigger:q,ancestorFolders:Q},G.id)),I&&J("div",{ref:d,className:"flex items-center justify-center p-2",style:{paddingLeft:`${(O+1)*12+8}px`},children:x&&J(c,{className:"h-4 w-4 animate-spin"})})]})]})}
2
- export{iK as hg};
@@ -1 +0,0 @@
1
- import{a as QJ,b as a,c as dJ}from"./chunk-7xwmj4ew.js";import{e as c,f as i,g as j,h as R,i as q,j as E}from"./chunk-ag0pavv1.js";import{S as LJ}from"./chunk-cc9fftnv.js";import{T as _J,U as u}from"./chunk-62ag2nfa.js";import{je as jJ}from"./chunk-0fpgfrv8.js";import{Fe as v,Ge as T,He as I,Ie as b,Je as g}from"./chunk-gra1fhdp.js";import{Df as O}from"./chunk-enq1hf8g.js";import{Ef as HJ}from"./chunk-vgwjg37a.js";import{Ff as kJ,Gf as FJ,Hf as MJ,Wf as mJ}from"./chunk-33hax7fe.js";import"./chunk-1ev668rp.js";import"./chunk-mnhg12fm.js";import"./chunk-6w395tfy.js";import{$g as KJ}from"./chunk-rjga1vn2.js";import{ih as JJ,kh as qJ}from"./chunk-qk9npww4.js";import"./chunk-y45tzhdn.js";import{Fh as S,Gh as C,Hh as A}from"./chunk-42et2rqa.js";import{$h as K,Ai as M,Bk as aJ,Di as rJ,Fi as GJ,Fl as EJ,Gj as x,Hl as XJ,Il as TJ,Jl as IJ,Kl as bJ,Li as wJ,Ll as gJ,Mi as k,Ml as nJ,Nl as uJ,Ol as cJ,Pl as iJ,Rk as pJ,Tk as vJ,Uk as NJ,Vi as l,Yh as t,Yk as lJ,Zh as hJ,_h as J,ai as SJ,ci as BJ,di as D,el as YJ,fi as CJ,gi as e,gk as r,kj as AJ,qi as tJ,sj as ZJ,sl as s,ul as n,xk as $J,xl as W}from"./chunk-yfgwknpa.js";import{Mm as o}from"./chunk-wwjqqqr4.js";var sJ=o(t(),1);var VJ=o(t(),1);function UJ({teamId:Y}){let[Z,z]=VJ.useState("team"),[G,Q]=VJ.useState("1h"),{data:V,isLoading:H}=D({queryKey:["teams",Y,"ai-usage",G,"team"],queryFn:async()=>{let _=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:Y},query:{timeframe:G}});if(!_.ok)throw Error("Failed to fetch team AI usage");return await _.json()},enabled:!!Y&&Z==="team"}),{data:f,isLoading:y}=D({queryKey:["teams",Y,"members"],queryFn:async()=>{let _=await M.api.teams[":teamId"].members.$get({param:{teamId:Y},query:{}});if(!_.ok)throw Error("Failed to fetch team members");return await _.json()},enabled:!!Y&&Z==="members"}),P=BJ({queries:(f||[]).map((_)=>({queryKey:["teams",Y,"ai-usage",G,_.id],queryFn:async()=>{let L=await M.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:Y},query:{timeframe:G,userId:_.id}});if(!L.ok)throw Error(`Failed to fetch AI usage for member ${_.id}`);return await L.json()},enabled:!!Y&&Z==="members"}))}),B=y||P.some((_)=>_.isLoading),U=(_)=>{if(!_)return"U";let L=_.split(" ");if(L.length>1)return`${L[0][0]}${L[L.length-1][0]}`.toUpperCase();return _.substring(0,2).toUpperCase()},F=(_)=>{if(!_)return"";switch(_.toLowerCase()){case"owner":return W.owner();case"editor":return W.editor();case"reviewer":return W.reviewer();default:return _}},X=(_)=>(_??0).toLocaleString(),w=(_)=>`$${(_??0).toFixed(6)}`;return K(v,{className:"border-border/60 shadow-sm",children:[K(T,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[K("div",{children:[J(I,{className:"text-xl font-semibold tracking-tight",children:W.ai_usage()}),J(b,{className:"text-sm text-muted-foreground mt-1",children:W.ai_usage_description()})]}),K("div",{className:"flex flex-wrap items-center gap-3",children:[K(_J,{type:"single",value:Z,onValueChange:(_)=>{if(_)z(_)},className:"border rounded-lg p-1 bg-muted/30",children:[J(u,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:W.team_view()}),J(u,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:W.members_view()})]}),K(_J,{type:"single",value:G,onValueChange:(_)=>{if(_)Q(_)},className:"border rounded-lg p-1 bg-muted/30",children:[J(u,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),J(u,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),J(u,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),J(u,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),J(g,{children:Z==="team"?H?J("div",{className:"flex h-48 items-center justify-center",children:J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(c,{children:[J(i,{children:K(R,{children:[J(q,{children:W.team()}),J(q,{className:"text-right",children:W.input_tokens()}),J(q,{className:"text-right",children:W.output_tokens()}),J(q,{className:"text-right",children:W.cache_read_tokens()}),J(q,{className:"text-right",children:W.total_tokens()}),J(q,{className:"text-right",children:W.cost()})]})}),J(j,{children:K(R,{children:[J(E,{className:"font-medium",children:W.team()}),J(E,{className:"text-right",children:X(V?.team?.inputTokens)}),J(E,{className:"text-right",children:X(V?.team?.outputTokens)}),J(E,{className:"text-right",children:X(V?.team?.cacheReadTokens)}),J(E,{className:"text-right font-medium",children:X(V?.team?.totalTokens)}),J(E,{className:"text-right font-medium",children:w(V?.team?.cost)})]})})]})}):B?J("div",{className:"flex h-48 items-center justify-center",children:J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):J("div",{className:"rounded-md border",children:K(c,{children:[J(i,{children:K(R,{children:[J(q,{children:W.members()}),J(q,{children:W.role()}),J(q,{className:"text-right",children:W.input_tokens()}),J(q,{className:"text-right",children:W.output_tokens()}),J(q,{className:"text-right",children:W.cache_read_tokens()}),J(q,{className:"text-right",children:W.total_tokens()}),J(q,{className:"text-right",children:W.cost()})]})}),J(j,{children:(f||[]).map((_,L)=>{let p=P[L]?.data?.member;return K(R,{children:[J(E,{children:K("div",{className:"flex items-center gap-3",children:[K(S,{className:"h-8 w-8 rounded-full",children:[_.image&&J(C,{src:_.image,alt:_.name,className:"object-cover"}),J(A,{className:"bg-primary/20 text-xs",children:U(_.name)})]}),K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-medium leading-none",children:_.name}),J("span",{className:"text-xs text-muted-foreground mt-0.5",children:_.email})]})]})}),J(E,{className:"text-xs text-muted-foreground",children:F(_.role)}),J(E,{className:"text-right",children:X(p?.inputTokens)}),J(E,{className:"text-right",children:X(p?.outputTokens)}),J(E,{className:"text-right",children:X(p?.cacheReadTokens)}),J(E,{className:"text-right font-medium",children:X(p?.totalTokens)}),J(E,{className:"text-right font-medium",children:w(p?.cost)})]},_.id)})})]})})})]})}var WJ=o(t(),1);function yJ({teamId:Y}){let[Z,z]=WJ.useState(null),{ref:G,inView:Q}=KJ(),{data:V,isLoading:H,isError:f,fetchNextPage:y,hasNextPage:P,isFetchingNextPage:B}=e({queryKey:["teams",Y,"agent-sessions"],queryFn:async({pageParam:X})=>{let w=await M.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:Y},query:{first:"20",after:X?String(X):void 0}});if(!w.ok)throw Error("Failed to fetch agent sessions");return await w.json()},initialPageParam:"",getNextPageParam:(X)=>X.pageInfo.cursor||void 0,enabled:!!Y});WJ.useEffect(()=>{if(Q&&P&&!B)y()},[Q,P,B,y]);let U=V?.pages.flatMap((X)=>X.data).filter((X)=>X.id!=="pending")||[],F=(X)=>{switch(X){case"comment":return J(O,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:W.session_type_comment()});case"chat":return J(O,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:W.session_type_chat()});case"naming":return J(O,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:W.session_type_naming()});default:return J(O,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:X})}};return K("div",{className:"space-y-6",children:[K(v,{className:"border border-border/50 shadow-xs",children:[J(T,{className:"pb-4",children:J("div",{className:"flex items-center justify-between",children:K("div",{children:[K(I,{className:"text-xl font-bold flex items-center gap-2",children:[J(r,{className:"w-5 h-5 text-violet-500"}),W.sessions()]}),J(b,{className:"mt-1 text-sm text-muted-foreground",children:W.sessions_description()})]})})}),J(g,{children:H?J("div",{className:"flex h-64 items-center justify-center",children:J(k,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):f?J("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):U.length===0?K("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[J(r,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),J("p",{className:"text-base font-medium",children:W.no_sessions_found()})]}):K("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[K(c,{children:[J(i,{className:"bg-muted/40",children:K(R,{children:[J(q,{children:W.session_name()}),J(q,{children:W.creator()}),J(q,{children:W.session_type()}),J(q,{className:"text-right",children:W.create_time()})]})}),J(j,{children:U.map((X)=>K(R,{onClick:()=>z(X.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[J(E,{className:"font-medium",children:K("div",{className:"flex flex-col",children:[J("span",{className:"text-sm font-semibold text-foreground",children:X.name||W.untitled_session()}),J("span",{className:"text-xs font-mono text-muted-foreground/70",children:X.id})]})}),J(E,{children:K("div",{className:"flex items-center gap-2",children:[K(S,{className:"h-6 w-6",children:[J(C,{src:X.creator?.image||void 0}),J(A,{className:"text-[10px]",children:X.creator?.name?.[0]?.toUpperCase()||"?"})]}),J("span",{className:"text-sm text-foreground/90",children:X.creator?.name||"System / Agent"})]})}),J(E,{children:F(X.type)}),J(E,{className:"text-right text-xs text-muted-foreground",children:JJ(X.createdAt)})]},X.id))})]}),J("div",{ref:G,className:"py-4 flex justify-center",children:B&&J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),J(LJ,{sessionId:Z,open:!!Z,onOpenChange:(X)=>{if(!X)z(null)}})]})}var d=o(t(),1);function RJ({...Y}){return J(YJ.Root,{"data-slot":"collapsible",...Y})}function fJ({...Y}){return J(YJ.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...Y})}function DJ({...Y}){return J(YJ.CollapsibleContent,{"data-slot":"collapsible-content",...Y})}function OJ(Y){switch(Y.toLowerCase()){case"owner":return W.owner();case"editor":return W.editor();case"reviewer":return W.reviewer();default:return Y}}function YK(Y,Z){if(typeof Y==="object"&&Y!==null&&"message"in Y){let z=Y.message;if(typeof z==="string")return z}return Z}function ZK({rule:Y}){let Z=Y.resourceData??{};if(Y.resource==="agent_mcp_call_count")return J("span",{children:W.quota_target_server({value:String(Z.id??"")})});if(Y.resource==="agent_bash_call_count")return J("span",{children:W.quota_target_match({value:String(Z.match??"*")})});if(Y.resource==="agent_tool_call_count")return J("span",{children:W.quota_target_tool({value:String(Z.name??Z.toolName??"*")})});return null}function $K({rule:Y}){if(Y.scopeMode==="all_members")return K(O,{variant:"secondary",className:"gap-1 text-xs",children:[J(NJ,{className:"h-3 w-3"}),K("span",{children:[W.quota_scope_mode_all_members(),Y.role?` (${OJ(Y.role)})`:` (${W.quota_scope_team()})`]})]});if(Y.scopeMode==="each_member")return K(O,{variant:"secondary",className:"gap-1 text-xs",children:[J(vJ,{className:"h-3 w-3"}),K("span",{children:[W.quota_scope_mode_each_member(),Y.role?` (${OJ(Y.role)})`:` (${W.quota_scope_team()})`]})]});return K(O,{variant:"secondary",className:"gap-1 text-xs",children:[J(pJ,{className:"h-3 w-3"}),K("span",{children:[W.quota_scope_mode_selected_members()," (",Y.userIds?.length||0,")"]})]})}function XK({teamId:Y,rule:Z,record:z}){let G=SJ(),[Q,V]=d.useState(!1),[H,f]=d.useState(()=>new Date),y=QJ[Z.resource],P=Z.scopeMode==="all_members",B=z.percent>=100,U=P?Z.role?`${W.quota_role_shared_pool()}: ${OJ(Z.role)}`:W.quota_team_shared_pool():z.user?.name||z.userId||W.unknown();d.useEffect(()=>{if(!z.isWindowActive||!z.periodEnd)return;let X=window.setInterval(()=>f(new Date),60000);return()=>window.clearInterval(X)},[z.isWindowActive,z.periodEnd]);let F=CJ({mutationFn:async()=>{let X=await M.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:Y,id:Z.id},json:{userId:z.userId??null}});if(!X.ok){let w=await X.json().catch(()=>null);throw Error(YK(w,W.failed_to_reset_quota()))}return await X.json()},onSuccess:()=>{G.invalidateQueries({queryKey:["teams",Y,"quotas",Z.id,"records"]}),G.invalidateQueries({queryKey:["teams",Y,"quotas"]}),V(!1),EJ.success(W.quota_reset_successfully())},onError:(X)=>{let w=X instanceof Error?X.message:W.failed_to_reset_quota();V(!1),EJ.error(w)}});return K(hJ,{children:[K("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[K("div",{className:"flex items-center justify-between gap-3",children:[K("div",{className:"flex min-w-0 items-center gap-3",children:[P?J("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:J(NJ,{className:"h-5 w-5"})}):K(S,{className:"h-9 w-9 shrink-0 border border-border/50",children:[J(C,{src:z.user?.image||void 0}),J(A,{className:"text-xs font-semibold",children:z.user?.name?.[0]?.toUpperCase()||"U"})]}),K("div",{className:"min-w-0",children:[J("div",{className:"truncate text-sm font-semibold text-foreground",children:U}),!P&&z.user?.email&&J("div",{className:"truncate text-xs text-muted-foreground",children:z.user.email})]})]}),K("div",{className:"flex shrink-0 items-center gap-2",children:[z.isWindowActive&&z.periodEnd?K(O,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[J(ZJ,{className:"h-3 w-3"}),J("span",{children:W.quota_refreshes_in({time:qJ(z.periodEnd,H)})})]}):K(O,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[J(GJ,{className:"h-3 w-3 text-primary"}),J("span",{children:W.quota_available()})]}),K(n,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>V(!0),disabled:F.isPending,children:[F.isPending?J(k,{className:"h-3.5 w-3.5 animate-spin"}):J(l,{className:"h-3.5 w-3.5"}),W.quota_reset_usage()]})]})]}),K("div",{className:"space-y-1.5 pt-1",children:[J(jJ,{value:Math.min(100,Math.max(0,z.percent)),className:"h-2"}),K("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[K("span",{className:B?"font-bold text-destructive":"text-foreground",children:[a(Z.resource,z.consumed)," /"," ",a(Z.resource,Z.limit)," ",y?.unit]}),K("span",{className:B?"font-bold text-destructive":"text-muted-foreground",children:[z.percent,"%"]})]})]}),K("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[z.isWindowActive&&z.periodEnd?K("span",{className:"flex items-center gap-1 text-primary",children:[J(ZJ,{className:"h-3 w-3"}),W.quota_refreshes_in({time:qJ(z.periodEnd,H)})]}):K("span",{className:"flex items-center gap-1",children:[J(GJ,{className:"h-3 w-3 text-primary"}),W.quota_available()]}),K("span",{children:[W.quota_remaining(),": ",a(Z.resource,z.remaining)," ",y?.unit]})]})]}),J(TJ,{open:Q,onOpenChange:V,children:K(IJ,{children:[K(bJ,{children:[J(nJ,{children:W.quota_reset_usage()}),J(uJ,{children:W.quota_reset_usage_confirm({target:U})})]}),K(gJ,{children:[J(iJ,{disabled:F.isPending,children:W.cancel()}),K(cJ,{onClick:(X)=>{X.preventDefault(),F.mutate()},disabled:F.isPending,children:[F.isPending&&J(k,{className:"mr-2 h-4 w-4 animate-spin"}),W.confirm()]})]})]})})]})}function zK({teamId:Y,rule:Z}){let[z,G]=d.useState(!1),[Q,V]=d.useState(""),H=QJ[Z.resource],f=H?.icon||x,{data:y,isLoading:P,isError:B}=D({queryKey:["teams",Y,"quotas",Z.id,"records"],queryFn:async()=>{let X=await M.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:Y,id:Z.id}});if(!X.ok)throw Error(W.failed_to_load_quota_usage());return await X.json()},enabled:z,refetchInterval:z?1e4:!1}),U=y?.records??[],F=U.filter((X)=>{if(!Q.trim())return!0;let w=Q.toLowerCase();return X.user?.name.toLowerCase().includes(w)||X.user?.email.toLowerCase().includes(w)});return K(RJ,{open:z,onOpenChange:G,className:"rounded-xl border border-border/70",children:[J(fJ,{asChild:!0,children:K("button",{type:"button","aria-label":z?W.quota_collapse_rule():W.quota_expand_rule(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[K("div",{className:"flex min-w-0 items-start gap-3",children:[J("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:J(f,{className:"h-5 w-5"})}),K("div",{className:"min-w-0",children:[K("div",{className:"flex flex-wrap items-center gap-2",children:[J("span",{className:"font-semibold text-foreground",children:H?.label()||Z.resource}),!Z.enabled&&J(O,{variant:"secondary",children:W.quota_disabled()})]}),K("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[J($K,{rule:Z}),K(O,{variant:"outline",className:"gap-1 text-xs",children:[J(ZJ,{className:"h-3 w-3"}),a(Z.resource,Z.limit)," ",H?.unit," /"," ",dJ(Z.period)]}),J(ZK,{rule:Z})]})]})]}),J(AJ,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${z?"rotate-180":""}`})]})}),J(DJ,{children:K("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[Z.scopeMode!=="all_members"&&U.length>3&&K("div",{className:"relative",children:[J($J,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),J(XJ,{value:Q,onChange:(X)=>V(X.target.value),placeholder:W.quota_search_members(),className:"h-9 pl-9 text-sm"})]}),P?J("div",{className:"flex justify-center py-10",children:J(k,{className:"h-7 w-7 animate-spin text-primary"})}):B?J("div",{className:"py-8 text-center text-sm text-destructive",children:W.failed_to_load_quota_usage()}):F.length===0?J("div",{className:"py-8 text-center text-sm text-muted-foreground",children:W.quota_no_usage_records()}):F.map((X,w)=>J(XK,{teamId:Y,rule:Z,record:X},X.id||X.userId||`record-${w}`))]})})]})}function xJ({teamId:Y}){let{data:Z,isLoading:z,isError:G}=D({queryKey:["teams",Y,"quotas"],queryFn:async()=>{let V=await M.api.teams[":teamId"].quotas.$get({param:{teamId:Y}});if(!V.ok)throw Error(W.failed_load_settings());return await V.json()},enabled:!!Y}),Q=Z?.rules??[];return K(v,{className:"border-border/60 shadow-sm",children:[K(T,{children:[K(I,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[J(x,{className:"h-5 w-5 text-primary"}),W.quotas()]}),J(b,{children:W.quota_dashboard_description()})]}),J(g,{children:z?J("div",{className:"flex h-48 items-center justify-center",children:J(k,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):G?J("div",{className:"py-10 text-center text-sm text-destructive",children:W.failed_load_settings()}):Q.length===0?K("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[J(x,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),J("p",{className:"text-base font-medium text-foreground",children:W.no_quotas_title()}),J("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:W.no_quotas_description()})]}):J("div",{className:"space-y-3",children:Q.map((V)=>J(zK,{teamId:Y,rule:V},V.id))})})]})}var m=o(t(),1);var _K=Object.values(mJ);function oJ({teamId:Y}){let[Z,z]=m.useState([]),[G,Q]=m.useState([]),[V,H]=m.useState(""),{ref:f,inView:y}=KJ(),{data:P}=D({queryKey:["teams",Y,"members"],queryFn:async()=>{let $=await M.api.teams[":teamId"].members.$get({param:{teamId:Y},query:{}});if(!$.ok)return[];return await $.json()},enabled:!!Y}),B=P||[],{data:U,isLoading:F,isError:X,fetchNextPage:w,hasNextPage:_,isFetchingNextPage:L}=e({queryKey:["teams",Y,"audit-logs",Z,G,V],queryFn:async({pageParam:$})=>{let N=await M.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:Y},query:{first:"20",after:$?String($):void 0,actions:Z.length>0?Z:void 0,userIds:G.length>0?G:void 0,itemId:V.trim()||void 0}});if(!N.ok)throw Error("Failed to fetch audit logs");return await N.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo.endCursor||void 0,enabled:!!Y});m.useEffect(()=>{if(y&&_&&!L)w()},[y,_,L,w]);let p=U?.pages.flatMap(($)=>$.nodes)||[],PJ=U?.pages[0]?.total??0,eJ=($)=>{z((N)=>N.includes($)?N.filter((h)=>h!==$):[...N,$])},JK=($)=>{Q((N)=>N.includes($)?N.filter((h)=>h!==$):[...N,$])},KK=($)=>{if($.includes("delete")||$.includes("remove")||$.includes("revoke"))return J(O,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:$});if($.includes("create")||$.includes("add"))return J(O,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:$});if($.includes("update")||$.includes("reparent")||$.includes("copy"))return J(O,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:$});return J(O,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:$})},WK=new Map(B.map(($)=>[$.userId||$.id,$]));return J("div",{className:"space-y-6",children:K(v,{className:"border border-border/50 shadow-xs",children:[K(T,{className:"pb-4",children:[K("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[K("div",{children:[K(I,{className:"text-xl font-bold flex items-center gap-2",children:[J(l,{className:"h-5 w-5 text-primary"}),W.audit_logs()]}),J(b,{className:"mt-1",children:W.audit_logs_description()})]}),PJ>0&&K(O,{variant:"secondary",className:"w-fit text-xs font-normal",children:[PJ," ",W.audit_logs()]})]}),K("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[K(kJ,{children:[J(FJ,{asChild:!0,children:K(n,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(wJ,{className:"h-3.5 w-3.5"}),W.filter_by_action(),Z.length>0&&J(O,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:Z.length})]})}),K(MJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:W.select_actions()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:_K.map(($)=>K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(HJ,{checked:Z.includes($),onCheckedChange:()=>eJ($)}),J("span",{className:"font-mono",children:$})]},$))}),Z.length>0&&J(n,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>z([]),children:"Clear Actions"})]})]}),K(kJ,{children:[J(FJ,{asChild:!0,children:K(n,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[J(wJ,{className:"h-3.5 w-3.5"}),W.filter_by_user(),G.length>0&&J(O,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:G.length})]})}),K(MJ,{className:"w-64 p-2",align:"start",children:[J("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:W.select_users()}),J("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:B.map(($)=>{let N=$.userId||$.user?.id||$.id,h=$.user?.name||$.name||N,zJ=$.user?.image||$.image;return K("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[J(HJ,{checked:G.includes(N),onCheckedChange:()=>JK(N)}),K(S,{className:"h-5 w-5",children:[J(C,{src:zJ||void 0}),J(A,{className:"text-[10px]",children:h.slice(0,2).toUpperCase()})]}),J("span",{className:"truncate",children:h})]},N)})}),G.length>0&&J(n,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>Q([]),children:"Clear Users"})]})]}),K("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[J($J,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),J(XJ,{type:"text",placeholder:W.search_item_id(),value:V,onChange:($)=>H($.target.value),className:"pl-8 pr-8 h-9 text-xs"}),V&&J("button",{onClick:()=>H(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:J(lJ,{className:"h-4 w-4"})})]}),(Z.length>0||G.length>0||V)&&J(n,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{z([]),Q([]),H("")},children:"Clear all"})]})]}),K(g,{className:"p-0",children:[F?J("div",{className:"flex h-64 items-center justify-center",children:J(k,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):X?J("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):p.length===0?J("div",{className:"p-12 text-center text-sm text-muted-foreground",children:W.no_audit_logs()}):K(c,{children:[J(i,{children:K(R,{className:"hover:bg-transparent border-b border-border/50",children:[J(q,{className:"w-[180px] text-xs font-semibold",children:W.action()}),J(q,{className:"w-[200px] text-xs font-semibold",children:W.user()}),J(q,{className:"text-xs font-semibold",children:W.item_id()}),J(q,{className:"text-xs font-semibold",children:W.project_id()}),J(q,{className:"w-[160px] text-right text-xs font-semibold",children:W.timestamp()})]})}),J(j,{children:p.map(($)=>{let N=$.userId?WK.get($.userId):null,h=N?.user?.name||N?.name||$.userId||"System",zJ=N?.user?.image||N?.image;return K(R,{className:"hover:bg-muted/40 transition-colors",children:[J(E,{className:"py-3 font-medium",children:KK($.action)}),J(E,{className:"py-3",children:K("div",{className:"flex items-center gap-2",children:[K(S,{className:"h-6 w-6",children:[J(C,{src:zJ||void 0}),J(A,{className:"text-[10px]",children:h.slice(0,2).toUpperCase()})]}),J("span",{className:"text-xs font-medium text-foreground truncate max-w-[140px]",children:h})]})}),J(E,{className:"py-3 text-xs font-mono text-muted-foreground",children:$.itemId||"-"}),J(E,{className:"py-3 text-xs font-mono text-muted-foreground",children:$.projectId||"-"}),J(E,{className:"py-3 text-right text-xs text-muted-foreground",children:JJ($.createdAt)})]},$.id)})})]}),J("div",{ref:f,className:"py-4 flex justify-center",children:L&&J(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function VK(){let{teamId:Y}=GK.useParams(),[Z,z]=sJ.useState("audit-logs"),{data:G,isLoading:Q}=D({queryKey:["teams",Y,"me"],queryFn:async()=>{let V=await M.api.teams[":teamId"].me.$get({param:{teamId:Y}});if(!V.ok)throw Error("Failed to fetch me");return await V.json()},enabled:!!Y});if(Q)return J("div",{className:"flex h-screen items-center justify-center",children:J(k,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(G?.role?.toLowerCase()!=="owner")return K("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[J(aJ,{className:"h-12 w-12 text-destructive mb-4"}),J("h2",{className:"text-xl font-bold tracking-tight mb-2",children:W.access_denied()}),J("p",{className:"text-sm text-muted-foreground max-w-md",children:W.only_owner_dashboard()})]});return J("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:K("div",{className:"flex flex-col md:flex-row h-full",children:[J("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:K("nav",{className:"p-4 space-y-1 mt-4",children:[J("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:W.dashboard()}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:W.team_category()}),K("button",{onClick:()=>z("audit-logs"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(l,{className:"w-5 h-5"}),W.audit_logs(),Z==="audit-logs"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>z("quotas"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(x,{className:"w-5 h-5"}),W.quotas(),Z==="quotas"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),J("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:W.ai()}),K("button",{onClick:()=>z("ai-usage"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(rJ,{className:"w-5 h-5"}),W.usage(),Z==="ai-usage"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),K("button",{onClick:()=>z("ai-sessions"),className:s("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",Z==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[J(r,{className:"w-5 h-5"}),W.sessions(),Z==="ai-sessions"&&J("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),J("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:K("div",{className:"max-w-6xl mx-auto space-y-8",children:[Z==="audit-logs"&&J(oJ,{teamId:Y}),Z==="ai-usage"&&J(UJ,{teamId:Y}),Z==="ai-sessions"&&J(yJ,{teamId:Y}),Z==="quotas"&&J(xJ,{teamId:Y})]})})]})})}var GK=tJ("/teams/$teamId/dashboard")({component:VK});export{GK as Route};
@@ -1,2 +0,0 @@
1
- import{Ne as A}from"./chunk-tsym31yb.js";import{Ai as z,_h as v,pi as w}from"./chunk-yfgwknpa.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
- export{B as ae,H as be};
@@ -1 +0,0 @@
1
- import{e as a,f as s,g as e,h as E,i as $,j as q}from"./chunk-ag0pavv1.js";import{V as r}from"./chunk-ch25gq27.js";import{X as t}from"./chunk-nw03w9pa.js";import{oe as j}from"./chunk-day61cfg.js";import{Ne as x}from"./chunk-tsym31yb.js";import{gg as l}from"./chunk-a80aab0f.js";import{hg as o}from"./chunk-0te5kcy3.js";import"./chunk-kmhkhcy6.js";import"./chunk-y8ffp5zj.js";import"./chunk-6w395tfy.js";import{$g as d}from"./chunk-rjga1vn2.js";import{Eh as i}from"./chunk-02tqxzgz.js";import{Fh as p,Gh as c,Hh as n}from"./chunk-42et2rqa.js";import{Uh as h}from"./chunk-hsemzjvr.js";import{$h as K,Ai as A,Ak as u,Fl as B,Mi as f,Uj as I,Yh as OG,Zh as k,_h as G,ai as L,ei as y,fi as F,gi as S,hj as T,li as P,qi as C,uj as g,ul as m,xl as X,yj as b}from"./chunk-yfgwknpa.js";import{Mm as qG}from"./chunk-wwjqqqr4.js";var _=qG(OG(),1);var zG=(Y)=>{if(!Y)return"??";return Y.split(" ").map((z)=>z[0]).slice(0,2).join("").toUpperCase()};function BG(){let{projectId:Y}=MG.useParams(),{teamId:z,ensureTeamIdForProject:U}=h(),GG=L(),JG=P();_.useEffect(()=>{U(Y)},[Y,U]);let{data:M}=y(j(Y)),D=M?.rootFolder,[KG,XG]=_.useState(240),{shareConfigLeftSidebarCollapsed:Q,setShareConfigLeftSidebarCollapsed:YG}=l(),{data:V,isLoading:ZG,fetchNextPage:R,hasNextPage:v,isFetchingNextPage:W}=S({queryKey:["shares",Y],queryFn:async({pageParam:J})=>{let Z=await A.api.projects[":projectId"].shares.$get({param:{projectId:Y},query:{first:"20",after:J}});if(!Z.ok)throw Error("Failed to fetch share links");return await Z.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!Y}),{ref:_G,inView:w}=d();_.useEffect(()=>{if(w&&v&&!W)R()},[w,v,W,R]);let H=_.useMemo(()=>V?.pages.flatMap((J)=>J.data)||[],[V]),{mutate:$G}=F({mutationFn:async({id:J,isDisabled:Z})=>{let O=await A.api.shares[":shareId"].$put({param:{shareId:J},json:{isDisabled:Z}});if(!O.ok)throw Error("Failed to update share link");return await O.json()},onSuccess:()=>{GG.invalidateQueries({queryKey:["shares",Y]}),B.success(X.share_link_status_updated())},onError:(J)=>{B.error(X.error_message({message:J.message}))}});if(!z||!D||!M)return G(x,{});let N=async(J)=>{let Z=`${window.location.origin}/share/${J}`;if(await t(Z))B.success(X.link_copied())};return G("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!Q&&G("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>YG(!0)}),!Q&&K(k,{children:[G("div",{className:"bg-background",style:{width:KG},children:G(o,{teamId:z,projectId:Y,projectName:M.name??"",rootFolderId:D})}),G(r,{onResize:(J)=>{XG((Z)=>Math.max(180,Math.min(400,Z+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[G("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[G(u,{className:"h-5 w-5 text-primary"}),G("h1",{className:"font-bold text-lg text-foreground",children:X.all_share_links()})]})}),G("div",{className:"flex-1 overflow-y-auto p-6",children:ZG?G("div",{className:"flex justify-center items-center h-64",children:G("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):H.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[G(I,{className:"h-10 w-10 text-muted-foreground/50"}),G("p",{children:X.no_share_links_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(a,{children:[G(s,{children:K(E,{className:"hover:bg-transparent bg-muted/20",children:[G($,{className:"font-semibold px-4 py-3",children:X.name()}),G($,{className:"font-semibold px-4 py-3",children:X.public_link()}),G($,{className:"font-semibold px-4 py-3",children:X.creator()}),G($,{className:"font-semibold px-4 py-3 w-[150px]",children:X.created_date()}),G($,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:X.active()})]})}),G(e,{children:H.map((J)=>{let Z=`${window.location.origin}/share/${J.id}`;return K(E,{className:"hover:bg-muted/10 transition-colors",children:[G(q,{className:"font-medium px-4 py-3.5",children:G("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>JG({to:"/projects/$projectId/shares/$shareId",params:{projectId:Y,shareId:J.id}}),children:J.name})}),G(q,{className:"px-4 py-3.5 max-w-[300px]",children:K("div",{className:"flex items-center gap-2 group",children:[G("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>N(J.id),title:X.click_to_copy_link(),children:Z}),G(m,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>N(J.id),children:G(g,{className:"h-3.5 w-3.5"})}),G("a",{href:Z,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:G(b,{className:"h-3.5 w-3.5"})})]})}),G(q,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(p,{className:"h-6 w-6",children:[J.creator?.image&&G(c,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),G(n,{className:"text-[10px]",children:zG(J.creator?.name)})]}),G("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:J.creator?.name||X.unknown()})]})}),G(q,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[G(T,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),G("span",{children:new Date(J.createdAt).toLocaleDateString()})]})}),G(q,{className:"px-4 py-3.5 text-right",children:G("div",{className:"flex justify-end",children:G(i,{checked:!J.isDisabled,onCheckedChange:(O)=>$G({id:J.id,isDisabled:!O})})})})]},J.id)})})]}),G("div",{ref:_G,className:"h-10 w-full flex items-center justify-center",children:W&&G(f,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var MG=C("/projects/$projectId/shares/")({component:BG});export{MG as Route};