@xopcai/xopc 0.0.227 → 0.0.229

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 (249) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-BevwE16n.js → activity-store-M0nAY5XB.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BggVQrEZ.js → agent-avatar-dicebear-CsFAJTIN.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DA4b6_0C.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-Bx_BpIt8.js → api-BywYxpaS.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-BtKP9n2r.js → app-management-settings-panel-7KcMWuah.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BoH2NAUX.js → appearance-settings-Cqlw7Fif.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-CsnhdGZ2.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-DnceUyxm.js → archive-plugin-7_DXaMTP.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-Bh8_9gkr.js → attachment-load-q4pDpqkF.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-ZKeAAVxD.js → automations-page-BuTqjKGX.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-CD0E2ThS.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-Cy9er6w-.js → binary-plugins-DUce1Bsc.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Cc0wWvNX.js → block-editor-D8Ejp-QR.js} +3 -3
  16. package/dist/gateway/static/root/assets/browser-settings-page-CY1k3MMd.js +8 -0
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BS7rpLLl.js → browser-workflow-inputs-8NC2qDRF.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-BdBVUZXm.js → browser-workflows-page-BDvZbR9v.js} +2 -2
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-D1VfotHQ.js +7 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-D1Lqz0Tt.js → capability-presets-api-o0y9WgAI.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DXHqRLpU.js +3 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-CGuEl-l2.js → channel-recipient-api-C5ABr73b.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-DrFL57M_.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-CdX_7aQh.js → chat-terminal-dock-h1CKexNz.js} +2 -2
  26. package/dist/gateway/static/root/assets/connectors-page-DUAyfFCF.js +2 -0
  27. package/dist/gateway/static/root/assets/{cron-expression-BnSQc4Ek.js → cron-expression-DlaQQOId.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-BbuG7zQ_.js → date-picker-8R1sXJKb.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-snZeqOmG.js → dependency-picker-CWur0821.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-DJQ8JoR1.js → desktop-pet-Knl-zNDU.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-B9txsRtv.js → desktop-pet-settings-CAQMLVtd.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-D7WKWkNB.js → directory-picker-path-field-Caaz4Rw5.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-D_7cOCj2.js → extension-debug-page-B965Mc15.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-Bwu47iUb.js → extension-page-C0UnkBi5.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-Dwg4dSZM.js → extension-settings-page-BUSIAZCR.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-jURUSte_.js → gateway-config-api-DkH0eEgy.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-6SQXF1yR.js → gateway-config-swr-BWGjnmDl.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-UklJOMLX.js → gateway-settings-BBgLDm6I.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DqWaxyvZ.js → gateway-startup-retry-B_zrtccP.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-Djs_nduD.js → heartbeat-settings-BtEHVXWD.js} +1 -1
  41. package/dist/gateway/static/root/assets/home-page-5SU2TNJj.js +1 -0
  42. package/dist/gateway/static/root/assets/{image-generation-api-Bxmt6LEr.js → image-generation-api-YKP2me5Z.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-BNWhgmjs.js +70 -0
  44. package/dist/gateway/static/root/assets/index-D_hrEKXM.css +2 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ByVsCH3d.js → keyboard-shortcuts-settings-CsRz8NrS.js} +1 -1
  46. package/dist/gateway/static/root/assets/local-app-workbench-page-DYPEUgpP.js +2 -0
  47. package/dist/gateway/static/root/assets/{local-apps-page-D19R-xsz.js → local-apps-page-CTBNUG4a.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-Ci1Qi0Q-.js → locale-store-CXhjfe4q.js} +1 -1
  49. package/dist/gateway/static/root/assets/logs-page-B0P7rG2B.js +2 -0
  50. package/dist/gateway/static/root/assets/{management-settings-G0y7zmfY.js → management-settings-YqUAEwQo.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-B69d2HWt.js → markdown-split-dxpSCXb8.js} +1 -1
  52. package/dist/gateway/static/root/assets/{markdown-view-DD_PgVue.css → markdown-view-CLzTdVLW.css} +1 -1
  53. package/dist/gateway/static/root/assets/markdown-view-DvM5PWEH.js +201 -0
  54. package/dist/gateway/static/root/assets/{media-plugins-6TWEQgN_.js → media-plugins-CJ00i1Lg.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +3 -0
  56. package/dist/gateway/static/root/assets/{notes-api-DLsnnZCS.js → notes-api-BFsOGYkd.js} +1 -1
  57. package/dist/gateway/static/root/assets/{notes-page-CkRJJKDm.js → notes-page-DEnbnkIt.js} +1 -1
  58. package/dist/gateway/static/root/assets/notes-workbench-DmVYu_Oc.js +4 -0
  59. package/dist/gateway/static/root/assets/{product-open-page-HxArIvoN.js → product-open-page-BHxo9U95.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-DV2nGmsq.js +1 -0
  61. package/dist/gateway/static/root/assets/projects-page-BNIFwFfc.js +1 -0
  62. package/dist/gateway/static/root/assets/{registry-api-lEar5FOV.js → registry-api-BFZrVYfy.js} +1 -1
  63. package/dist/gateway/static/root/assets/remote-access-hub-DLXqKiA_.js +1 -0
  64. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bf03UNGD.js → runtime-tools-settings-panel-BpQ2GI-0.js} +1 -1
  65. package/dist/gateway/static/root/assets/{schema-form-CIXMBgx5.js → schema-form-HE1G26Lx.js} +1 -1
  66. package/dist/gateway/static/root/assets/sessions-page-DWaXf_25.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-JFCbnCL2.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-form-section-DgdB26mE.js → settings-form-section-CXAn0Xhy.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-loading-skeleton-efk5W6lG.js → settings-loading-skeleton-DsFu7Bcv.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-BHVf4gEP.js → settings-page-C4iib9nO.js} +1 -1
  71. package/dist/gateway/static/root/assets/{setup-status-panel-WK0dGNMv.js → setup-status-panel-BA83Wr1d.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-Cod-w2qm.js → share-preview-page-BOGl3s6M.js} +1 -1
  73. package/dist/gateway/static/root/assets/{shares-settings-CUqQ31gt.js → shares-settings-Q2MdGaBi.js} +1 -1
  74. package/dist/gateway/static/root/assets/skill-reload-api-cFtfVeFU.js +1 -0
  75. package/dist/gateway/static/root/assets/{skills-page-DwCcipqK.js → skills-page-CdaFtNw9.js} +1 -1
  76. package/dist/gateway/static/root/assets/{skills-page.utils-3WSbtl3S.js → skills-page.utils-DYaAddUL.js} +1 -1
  77. package/dist/gateway/static/root/assets/{system-settings-panel-C5VxqC_s.js → system-settings-panel-Co7gilRd.js} +1 -1
  78. package/dist/gateway/static/root/assets/task-detail-page-5B1pswu8.js +1 -0
  79. package/dist/gateway/static/root/assets/{theme-store-Dd89g_ki.js → theme-store-DOdCjyuw.js} +1 -1
  80. package/dist/gateway/static/root/assets/{use-autosave-CeV8VJh2.js → use-autosave-DnnZtMpA.js} +1 -1
  81. package/dist/gateway/static/root/assets/user-context-page-Dr1FKjXv.js +1 -0
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-EmJ-8aZu.js → voice-api-key-field-wetUpi3i.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-overlay-zsk6E3Mi.js → work-discovery-overlay-tbTWASJJ.js} +1 -1
  84. package/dist/gateway/static/root/assets/workflow-run-setup-panel-Dy0fDs8w.js +3 -0
  85. package/dist/gateway/static/root/assets/workflows-page-IVP3GSkI.js +5 -0
  86. package/dist/gateway/static/root/index.html +12 -12
  87. package/dist/gateway/static/root/notification-sw.js +1 -1
  88. package/dist/package.js +1 -1
  89. package/dist/packages/gateway-contract/src/notifications.js +56 -0
  90. package/dist/packages/gateway-contract/src/turn-outcome.js +114 -0
  91. package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
  92. package/dist/src/agent/agent-manager.d.ts +1 -1
  93. package/dist/src/agent/agent-manager.js +18 -3
  94. package/dist/src/agent/background-review/prompts.d.ts +8 -2
  95. package/dist/src/agent/background-review/prompts.js +25 -12
  96. package/dist/src/agent/background-review/run-background-review.d.ts +7 -2
  97. package/dist/src/agent/background-review/run-background-review.js +175 -160
  98. package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +1 -0
  99. package/dist/src/agent/lifecycle/timeout-wrapper.js +7 -6
  100. package/dist/src/agent/mcp/mcp-transport-config.d.ts +1 -1
  101. package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
  102. package/dist/src/agent/memory/index.d.ts +1 -1
  103. package/dist/src/agent/memory/index.js +2 -2
  104. package/dist/src/agent/memory/manager.d.ts +1 -11
  105. package/dist/src/agent/memory/manager.js +0 -16
  106. package/dist/src/agent/memory/understanding/service.d.ts +0 -11
  107. package/dist/src/agent/memory/understanding/service.js +7 -173
  108. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -3
  109. package/dist/src/agent/memory/user-context-coordinator.js +3 -66
  110. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  111. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +2 -2
  112. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +4 -4
  113. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  114. package/dist/src/agent/tools/create-share-tool.js +14 -1
  115. package/dist/src/agent/tools/exec-command.js +3 -3
  116. package/dist/src/agent/tools/execute-code-tool.js +1 -1
  117. package/dist/src/agent/tools/executor.js +2 -2
  118. package/dist/src/agent/tools/image-generate-tool.js +12 -0
  119. package/dist/src/agent/tools/send-media.js +11 -0
  120. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  121. package/dist/src/cli/command-loaders.js +1 -0
  122. package/dist/src/cli/command-manifest.js +4 -0
  123. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  124. package/dist/src/cli/commands/history.d.ts +1 -0
  125. package/dist/src/cli/commands/history.js +50 -0
  126. package/dist/src/config/agent-profile.js +1 -1
  127. package/dist/src/config/schema.d.ts +4 -0
  128. package/dist/src/config/schema.js +1 -0
  129. package/dist/src/connectors/connected-source-understanding.js +35 -21
  130. package/dist/src/connectors/learning-coordinator.js +1 -42
  131. package/dist/src/gateway/agents-admin.js +1 -1
  132. package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
  133. package/dist/src/gateway/chat-stream/mapper.js +5 -0
  134. package/dist/src/gateway/chat-stream/protocol.d.ts +3 -2
  135. package/dist/src/gateway/chat-stream/turn-outcome-collector.d.ts +16 -0
  136. package/dist/src/gateway/chat-stream/turn-outcome-collector.js +111 -0
  137. package/dist/src/gateway/hono/lib/static-ui.js +7 -5
  138. package/dist/src/gateway/hono/routes/index.js +2 -0
  139. package/dist/src/gateway/hono/routes/mobile.js +18 -40
  140. package/dist/src/gateway/hono/routes/notifications.d.ts +3 -0
  141. package/dist/src/gateway/hono/routes/notifications.js +45 -0
  142. package/dist/src/gateway/hono/routes/sessions.js +31 -0
  143. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  144. package/dist/src/gateway/hono/routes/understanding-sources.js +4 -1
  145. package/dist/src/gateway/hono/routes/you.js +29 -11
  146. package/dist/src/gateway/service/agent-runner.js +6 -2
  147. package/dist/src/gateway/service/run-gateway-agent.js +58 -2
  148. package/dist/src/gateway/service/sessions-api.d.ts +6 -0
  149. package/dist/src/gateway/service/sessions-api.js +60 -3
  150. package/dist/src/gateway/service.d.ts +2 -2
  151. package/dist/src/gateway/service.js +8 -7
  152. package/dist/src/history/ctx/exporter.d.ts +14 -0
  153. package/dist/src/history/ctx/exporter.js +99 -0
  154. package/dist/src/history/ctx/format.d.ts +25 -0
  155. package/dist/src/history/ctx/format.js +282 -0
  156. package/dist/src/knowledge/index.d.ts +0 -1
  157. package/dist/src/knowledge/index.js +1 -2
  158. package/dist/src/media/session-references.d.ts +6 -0
  159. package/dist/src/media/session-references.js +24 -3
  160. package/dist/src/notifications/device-store.d.ts +16 -0
  161. package/dist/src/notifications/device-store.js +96 -0
  162. package/dist/src/notifications/planner.d.ts +6 -0
  163. package/dist/src/notifications/planner.js +160 -0
  164. package/dist/src/notifications/service.d.ts +18 -0
  165. package/dist/src/notifications/service.js +184 -0
  166. package/dist/src/notifications/store.d.ts +53 -0
  167. package/dist/src/notifications/store.js +184 -0
  168. package/dist/src/notifications/types.d.ts +29 -0
  169. package/dist/src/notifications/types.js +14 -0
  170. package/dist/src/session/client-history.d.ts +3 -1
  171. package/dist/src/session/client-history.js +13 -0
  172. package/dist/src/session/index.d.ts +1 -1
  173. package/dist/src/session/manager.d.ts +1 -0
  174. package/dist/src/session/manager.js +6 -0
  175. package/dist/src/session/store.d.ts +15 -0
  176. package/dist/src/session/store.js +58 -0
  177. package/dist/src/storage/sqlite/index.d.ts +2 -2
  178. package/dist/src/storage/sqlite/index.js +3 -3
  179. package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +79 -0
  180. package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +71 -0
  181. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  182. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  183. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  184. package/dist/src/storage/sqlite/schema.js +1 -1
  185. package/dist/src/storage/sqlite/session-input-repository.d.ts +5 -0
  186. package/dist/src/storage/sqlite/session-input-repository.js +9 -1
  187. package/dist/src/storage/sqlite/user-context-repository.d.ts +16 -4
  188. package/dist/src/storage/sqlite/user-context-repository.js +56 -12
  189. package/dist/src/tasks/index.js +2 -2
  190. package/dist/src/tasks/task-application-service.js +42 -6
  191. package/dist/src/tasks/task-change-events.d.ts +9 -0
  192. package/dist/src/tasks/task-change-events.js +17 -1
  193. package/dist/src/tasks/task-outbox-dispatcher.js +5 -1
  194. package/dist/src/tasks/task-run-dispatcher.js +4 -2
  195. package/dist/src/tasks/task-run-repository.js +13 -0
  196. package/dist/src/user-context/config.d.ts +8 -0
  197. package/dist/src/user-context/config.js +3 -0
  198. package/dist/src/user-context/consolidation.js +16 -4
  199. package/dist/src/user-context/extraction/executor.d.ts +22 -0
  200. package/dist/src/user-context/extraction/executor.js +142 -0
  201. package/dist/src/user-context/extraction/registry.d.ts +1 -1
  202. package/dist/src/user-context/extraction/registry.js +5 -34
  203. package/dist/src/user-context/extraction/repair.js +4 -1
  204. package/dist/src/user-context/extraction/semantic.d.ts +18 -0
  205. package/dist/src/user-context/extraction/semantic.js +148 -0
  206. package/dist/src/user-context/understandingQuality.js +4 -0
  207. package/dist/src/work-discovery/analyzer.js +9 -4
  208. package/dist/src/work-discovery/service.d.ts +1 -0
  209. package/dist/src/work-discovery/service.js +5 -4
  210. package/dist/src/work-discovery/types.d.ts +1 -0
  211. package/package.json +14 -8
  212. package/dist/gateway/static/root/assets/agents-TJpjRHnr.js +0 -68
  213. package/dist/gateway/static/root/assets/apps-page-CZ4Da51l.js +0 -1
  214. package/dist/gateway/static/root/assets/automations-workspace-2Y00PvJU.js +0 -6
  215. package/dist/gateway/static/root/assets/browser-settings-page-CbJD27_j.js +0 -8
  216. package/dist/gateway/static/root/assets/capabilities-settings-panel-Dv8y6OuP.js +0 -7
  217. package/dist/gateway/static/root/assets/capability-presets-settings-panel-TZmjzWzt.js +0 -3
  218. package/dist/gateway/static/root/assets/channels-settings-g-68dutA.js +0 -1
  219. package/dist/gateway/static/root/assets/channels-status-swr-D7KsAeWh.js +0 -1
  220. package/dist/gateway/static/root/assets/connectors-page-DXA0rAvQ.js +0 -2
  221. package/dist/gateway/static/root/assets/home-page-i6bXCHdo.js +0 -1
  222. package/dist/gateway/static/root/assets/index-BBBE89vm.css +0 -2
  223. package/dist/gateway/static/root/assets/index-BsD5wygl.js +0 -74
  224. package/dist/gateway/static/root/assets/local-app-workbench-page-BCKEDMlP.js +0 -2
  225. package/dist/gateway/static/root/assets/logs-page-Cy9YQK7j.js +0 -2
  226. package/dist/gateway/static/root/assets/markdown-view-CBM-v2ph.js +0 -69
  227. package/dist/gateway/static/root/assets/mermaid-render-BbqDc_LQ.js +0 -134
  228. package/dist/gateway/static/root/assets/messages-CtOJwGW3.js +0 -3
  229. package/dist/gateway/static/root/assets/notes-workbench-B10T3hGX.js +0 -4
  230. package/dist/gateway/static/root/assets/project-detail-page-DsqRlgsy.js +0 -1
  231. package/dist/gateway/static/root/assets/projects-page-Bu2PN8OK.js +0 -1
  232. package/dist/gateway/static/root/assets/remote-access-hub-CXACdJ2f.js +0 -1
  233. package/dist/gateway/static/root/assets/sessions-page-CS2knWDT.js +0 -1
  234. package/dist/gateway/static/root/assets/settings-advanced-gate-ByFGk0q_.js +0 -1
  235. package/dist/gateway/static/root/assets/skill-reload-api-DweAPjI8.js +0 -1
  236. package/dist/gateway/static/root/assets/task-detail-page-DEj-BFMP.js +0 -1
  237. package/dist/gateway/static/root/assets/user-context-page-f7yh7aD5.js +0 -1
  238. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CBAYvm3G.js +0 -3
  239. package/dist/gateway/static/root/assets/workflows-page-BN0JmHrG.js +0 -5
  240. package/dist/src/agent/memory/understanding/correction.d.ts +0 -3
  241. package/dist/src/agent/memory/understanding/correction.js +0 -39
  242. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +0 -17
  243. package/dist/src/knowledge/connected-understanding-pipeline.js +0 -278
  244. package/dist/src/mobile/notification-service.d.ts +0 -9
  245. package/dist/src/mobile/notification-service.js +0 -156
  246. package/dist/src/mobile/notification-store.d.ts +0 -28
  247. package/dist/src/mobile/notification-store.js +0 -132
  248. package/dist/src/mobile/notification-types.d.ts +0 -37
  249. package/dist/src/mobile/notification-types.js +0 -9
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c}from"./interaction-BmQogeqz.js";import{n as l}from"./is-masked-secret-DOkL5b_X.js";import{t as u}from"./messages-CtOJwGW3.js";import{l as d,n as f,r as p,s as m}from"./locale-store-Ci1Qi0Q-.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{r as g}from"./gateway-config-swr-6SQXF1yR.js";import{n as _,t as v}from"./registry-api-lEar5FOV.js";import{As as y,Dl as b,El as x,En as S,Ll as C,Uc as w,Xs as T,cu as E,so as D,xs as O,yr as k}from"./index-BsD5wygl.js";import{n as A,r as j}from"./settings-page-layout-BRQNel6r.js";import{n as M}from"./settings-loading-skeleton-efk5W6lG.js";import{n as N,t as P}from"./settings-form-section-DgdB26mE.js";var F=e(t(),1),I=n();function L(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&l(e)).length}function R(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t,r=typeof n.defaultPreset==`string`&&n.defaultPreset.trim()?n.defaultPreset.trim():`default`,i=n.capabilityPresets,a=i&&typeof i==`object`&&!Array.isArray(i)?i[r]:void 0,o=a&&typeof a==`object`&&!Array.isArray(a)?a.models:void 0;if(!o||typeof o!=`object`||Array.isArray(o))return``;let s=o,c=s.roles;if(!c||typeof c!=`object`||Array.isArray(c))return``;let l=c,u=typeof s.defaultRole==`string`&&s.defaultRole.trim()?s.defaultRole.trim():Object.keys(l)[0],d=u?l[u]:void 0;if(!d||typeof d!=`object`||Array.isArray(d))return``;let f=d.model;return typeof f==`string`?f.trim():``}function z(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function B(e){if(!e||typeof e!=`object`)return{enabled:!1,backend:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,backend:`extension`};let n=t;return{enabled:n.enabled===!0,backend:typeof n.backend==`string`&&n.backend.trim()?n.backend.trim():`extension`}}function V(e){return e?`pass`:`fail`}function H(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function U(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function ee(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:H(e.id),source:`doctor`})).toSorted((e,t)=>U(t.status)-U(e.status)||e.label.localeCompare(t.label))}function W(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:H(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[])n.push(t);return n}function te(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=z(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=ee(u),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:V(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:V(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:V(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=W({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ne(e){return B(e)}function G(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function re(){return p(`/api/doctor`)}async function ie(){return((await m(re())).checks??[]).map(G).filter(e=>e!==null)}function ae(){return p(`/api/logs/health`)}async function oe(){return m(ae())}function K(e){return e?`pass`:`warn`}function q(e){return`/settings/agent-browser?tab=${encodeURIComponent(e)}`}function se(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function ce(e){if(!e.enabled)return[];if(e.backend===`local`){let e=await m(p(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:K(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:q(`local`)}]}if(e.backend===`cloakbrowser`){let e=await m(p(`/api/browser/cloakbrowser/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-cloakbrowser`,label:`Browser: CloakBrowser`,status:K(t),message:t?`CloakBrowser ${e.payload?.version??``}`.trim():`CloakBrowser is not installed.`,path:q(`cloakbrowser`)}]}if(e.backend===`extension`){let e=await m(p(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:q(`extension`)}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser backend "${e.backend}" is not checked on this overview.`,path:q(e.backend||`overview`)}]}function J(){let e=(0,I.c)(57),t=d(me),n=f(pe),r;e[0]===n?r=e[1]:(r=u(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=D(fe),{data:s,error:c,isLoading:l,mutate:p}=g(!!t),m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},e[2]=m):m=e[2];let{data:y,error:b,isLoading:x,mutate:C}=h(t?`setup-checklist-skills`:null,de,m),w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w={revalidateOnFocus:!1},e[3]=w):w=e[3];let{data:T,error:E,isLoading:O,mutate:k}=h(t?`setup-checklist-provider-meta`:null,S,w),A;e[4]===t?A=e[5]:(A=t?re():null,e[4]=t,e[5]=A);let j;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},e[6]=j):j=e[6];let{data:M,error:N,isLoading:P,mutate:F}=h(A,ie,j),L;e[7]===t?L=e[8]:(L=t?ae():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:z,isLoading:B,mutate:V}=h(L,oe,R);s?.payload?.config;let H=s?.payload?.config,U;e[10]===H?U=e[11]:(U=ne(H),e[10]=H,e[11]=U);let ee=t?U:null,W;e[12]===ee?W=e[13]:(W=se(ee),e[12]=ee,e[13]=W);let G;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1},e[14]=G):G=e[14];let{data:K,isLoading:q,mutate:ce}=h(W,ue,G),J;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(J={revalidateOnFocus:!1},e[15]=J):J=e[15],h(t?v:null,_,J);let Y=!t||!l&&!x&&!O&&!P&&!B&&!q,X=!!(c||b||E||N),Z;bb0:{if(!t||!Y){Z=null;break bb0}let n=y?.catalog?.length??0,r;if(e[16]!==K||e[17]!==s?.payload?.config||e[18]!==M||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==z||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==T||e[33]!==o||e[34]!==n||e[35]!==t){let c=T?.filter(le).length??0,l=T?.length??0,u;e[37]===a.providersConfigured?u=e[38]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=u);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=te({hasToken:!!t,realtimeConnected:o,config:s?.payload?.config,skillCount:n,providerMeta:l>0?{configured:c,total:l}:null,doctorChecks:M,logsHealth:z,browserDiagnostics:K,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=K,e[17]=s?.payload?.config,e[18]=M,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=z,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=T,e[33]=o,e[34]=n,e[35]=t,e[36]=r}else r=e[36];Z=r}let he=Z,Q;e[45]!==ce||e[46]!==p||e[47]!==F||e[48]!==V||e[49]!==k||e[50]!==C?(Q=async()=>{await Promise.all([p(),C(),k(),F(),V(),ce()])},e[45]=ce,e[46]=p,e[47]=F,e[48]=V,e[49]=k,e[50]=C,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==X||e[53]!==Y||e[54]!==ge||e[55]!==he?($={ready:Y,error:X,snapshot:he,refresh:ge},e[52]=X,e[53]=Y,e[54]=ge,e[55]=he,e[56]=$):$=e[56],$}function le(e){return e.configured}function ue(e){let[,t]=e;return ce(t)}function de(){return k()}function fe(e){return e.connectionState===`connected`}function pe(e){return e.language}function me(e){return e.token}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?a:e===`warn`?O:e===`fail`?b:w}function he(e,t){return e===`blocked`?{icon:b,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:O,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:x,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,I.c)(48),{tier:n,issueCount:r,onRunDoctor:a,ready:l,doctorRunning:d,doctorRunState:p}=e,m=f(ge),h,g,_,v,y,b,x,S,w,E,D;if(t[0]!==r||t[1]!==m||t[2]!==n){g=u(m).setupStatus;let e=he(n,g),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;h=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0})]}),D=s(`rounded-xl p-4`,e.className),E=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,S=`flex min-w-0 gap-3`,w=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),y=`min-w-0`,b=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),x=(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-85`,children:e.body}),_=`mt-2 text-xs opacity-75`,v=g.health.issueCount.replace(`{{count}}`,String(r)),t[0]=r,t[1]=m,t[2]=n,t[3]=h,t[4]=g,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x,t[10]=S,t[11]=w,t[12]=E,t[13]=D}else h=t[3],g=t[4],_=t[5],v=t[6],y=t[7],b=t[8],x=t[9],S=t[10],w=t[11],E=t[12],D=t[13];let O;t[14]!==_||t[15]!==v?(O=(0,Y.jsx)(`p`,{className:_,children:v}),t[14]=_,t[15]=v,t[16]=O):O=t[16];let k;t[17]!==O||t[18]!==y||t[19]!==b||t[20]!==x?(k=(0,Y.jsxs)(`div`,{className:y,children:[b,x,O]}),t[17]=O,t[18]=y,t[19]=b,t[20]=x,t[21]=k):k=t[21];let A;t[22]!==k||t[23]!==S||t[24]!==w?(A=(0,Y.jsxs)(`div`,{className:S,children:[w,k]}),t[22]=k,t[23]=S,t[24]=w,t[25]=A):A=t[25];let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=s(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,c.press),t[26]=j):j=t[26];let M=!l||d,N;t[27]===d?N=t[28]:(N=d?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[27]=d,t[28]=N);let P=d?g.health.runDoctorRunning:g.health.runDoctor,F;t[29]!==d||t[30]!==a||t[31]!==M||t[32]!==N||t[33]!==P?(F=(0,Y.jsxs)(`button`,{type:`button`,className:j,onClick:a,disabled:M,"aria-busy":d,children:[N,P]}),t[29]=d,t[30]=a,t[31]=M,t[32]=N,t[33]=P,t[34]=F):F=t[34];let L;t[35]!==h||t[36]!==F?(L=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[h,F]}),t[35]=h,t[36]=F,t[37]=L):L=t[37];let R;t[38]!==A||t[39]!==L||t[40]!==E?(R=(0,Y.jsxs)(`div`,{className:E,children:[A,L]}),t[38]=A,t[39]=L,t[40]=E,t[41]=R):R=t[41];let z=d?g.health.doctorRunningMessage:p===`success`?g.health.doctorCompleteMessage:p===`error`?g.health.doctorFailedMessage:g.health.doctorIdleMessage,B;t[42]===z?B=t[43]:(B=(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:z}),t[42]=z,t[43]=B);let V;return t[44]!==R||t[45]!==B||t[46]!==D?(V=(0,Y.jsxs)(`section`,{className:D,children:[R,B]}),t[44]=R,t[45]=B,t[46]=D,t[47]=V):V=t[47],V}function ge(e){return e.language}function $(e){let t=(0,I.c)(34),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.status?u=t[7]:(u=s(`rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[6]=n.status,t[7]=u);let d;t[8]!==n.status||t[9]!==u?(d=(0,Y.jsx)(`span`,{className:u,children:n.status}),t[8]=n.status,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.message?p=t[15]:(p=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[14]=n.message,t[15]=p);let m;t[16]===n.hints[0]?m=t[17]:(m=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[16]=n.hints[0],t[17]=m);let h;t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p,m]}),t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==r||t[23]!==n.path?(g=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0})]}):null,t[22]=r,t[23]=n.path,t[24]=g):g=t[24];let _;t[25]!==g||t[26]!==c||t[27]!==h?(_=(0,Y.jsxs)(Y.Fragment,{children:[c,h,g]}),t[25]=g,t[26]=c,t[27]=h,t[28]=_):_=t[28];let v=_;if(n.path){let e;return t[29]!==v||t[30]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v}),t[29]=v,t[30]=n.path,t[31]=e):e=t[31],e}let y;return t[32]===v?y=t[33]:(y=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:v}),t[32]=v,t[33]=y),y}function _e(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=s(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Y.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(C,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function ve(e){let t=(0,I.c)(29),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.message?u=t[7]:(u=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n.status?f=t[12]:(f=s(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[11]=n.status,t[12]=f);let p;t[13]!==n.status||t[14]!==f?(p=(0,Y.jsx)(`span`,{className:f,children:n.status}),t[13]=n.status,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n.path?(m=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[16]=r,t[17]=n.path,t[18]=m):m=t[18];let h;t[19]!==c||t[20]!==d||t[21]!==p||t[22]!==m?(h=(0,Y.jsxs)(Y.Fragment,{children:[c,d,p,m]}),t[19]=c,t[20]=d,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g=h;if(n.path){let e;return t[24]!==g||t[25]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:g}),t[24]=g,t[25]=n.path,t[26]=e):e=t[26],e}let _;return t[27]===g?_=t[28]:(_=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:g}),t[27]=g,t[28]=_),_}function ye(){let e=u(f(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,F.useState)(!1),[l,d]=(0,F.useState)(`idle`),p=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],m=async()=>{if(!(a||!t)){o(!0),d(`idle`);try{await i(),d(`success`)}catch{d(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(j,{gap:`gap-6`,children:[(0,Y.jsx)(A,{title:e.title,subtitle:e.subtitle,actions:(0,Y.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-2 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,c.press),onClick:()=>void m(),disabled:!t||a,"aria-busy":a,children:[(0,Y.jsx)(T,{className:s(`size-4`,(!t||a)&&`animate-spin`),"aria-hidden":!0}),a?e.health.runDoctorRunning:e.refresh]})}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(M,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void m(),doctorRunning:a,doctorRunState:l}),(0,Y.jsxs)(P,{id:`next-steps`,children:[(0,Y.jsx)(N,{icon:r.issues.length?O:E,title:e.nextStepsTitle,subtitle:r.issues.length?e.nextStepsIssuesSubtitle:e.nextStepsReadySubtitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)($,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(_e,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(N,{icon:y,title:e.diagnosticsTitle,subtitle:e.diagnosticsSubtitle}),p.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:p.map(t=>(0,Y.jsx)(ve,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})]})]})}export{ye as SetupStatusPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c}from"./interaction-BmQogeqz.js";import{n as l}from"./is-masked-secret-DOkL5b_X.js";import{t as u}from"./messages-BMdD0LWk.js";import{l as d,n as f,r as p,s as m}from"./locale-store-CXhjfe4q.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{r as g}from"./gateway-config-swr-BWGjnmDl.js";import{n as _,t as v}from"./registry-api-BFZrVYfy.js";import{Dn as y,Ds as b,Is as x,Ml as S,Nl as C,Tr as w,Ul as T,Yc as E,mu as D,nc as O,po as k}from"./index-BNWhgmjs.js";import{n as A,r as j}from"./settings-page-layout-BRQNel6r.js";import{n as M}from"./settings-loading-skeleton-DsFu7Bcv.js";import{n as N,t as P}from"./settings-form-section-CXAn0Xhy.js";var F=e(t(),1),I=n();function L(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&l(e)).length}function R(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t,r=typeof n.defaultPreset==`string`&&n.defaultPreset.trim()?n.defaultPreset.trim():`default`,i=n.capabilityPresets,a=i&&typeof i==`object`&&!Array.isArray(i)?i[r]:void 0,o=a&&typeof a==`object`&&!Array.isArray(a)?a.models:void 0;if(!o||typeof o!=`object`||Array.isArray(o))return``;let s=o,c=s.roles;if(!c||typeof c!=`object`||Array.isArray(c))return``;let l=c,u=typeof s.defaultRole==`string`&&s.defaultRole.trim()?s.defaultRole.trim():Object.keys(l)[0],d=u?l[u]:void 0;if(!d||typeof d!=`object`||Array.isArray(d))return``;let f=d.model;return typeof f==`string`?f.trim():``}function z(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function B(e){if(!e||typeof e!=`object`)return{enabled:!1,backend:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,backend:`extension`};let n=t;return{enabled:n.enabled===!0,backend:typeof n.backend==`string`&&n.backend.trim()?n.backend.trim():`extension`}}function V(e){return e?`pass`:`fail`}function H(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function U(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function ee(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:H(e.id),source:`doctor`})).toSorted((e,t)=>U(t.status)-U(e.status)||e.label.localeCompare(t.label))}function W(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:H(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[])n.push(t);return n}function te(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=z(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=ee(u),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:V(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:V(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:V(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=W({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ne(e){return B(e)}function G(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function re(){return p(`/api/doctor`)}async function ie(){return((await m(re())).checks??[]).map(G).filter(e=>e!==null)}function ae(){return p(`/api/logs/health`)}async function oe(){return m(ae())}function K(e){return e?`pass`:`warn`}function q(e){return`/settings/agent-browser?tab=${encodeURIComponent(e)}`}function se(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function ce(e){if(!e.enabled)return[];if(e.backend===`local`){let e=await m(p(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:K(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:q(`local`)}]}if(e.backend===`cloakbrowser`){let e=await m(p(`/api/browser/cloakbrowser/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-cloakbrowser`,label:`Browser: CloakBrowser`,status:K(t),message:t?`CloakBrowser ${e.payload?.version??``}`.trim():`CloakBrowser is not installed.`,path:q(`cloakbrowser`)}]}if(e.backend===`extension`){let e=await m(p(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:q(`extension`)}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser backend "${e.backend}" is not checked on this overview.`,path:q(e.backend||`overview`)}]}function J(){let e=(0,I.c)(57),t=d(me),n=f(pe),r;e[0]===n?r=e[1]:(r=u(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=k(fe),{data:s,error:c,isLoading:l,mutate:p}=g(!!t),m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},e[2]=m):m=e[2];let{data:b,error:x,isLoading:S,mutate:C}=h(t?`setup-checklist-skills`:null,de,m),w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w={revalidateOnFocus:!1},e[3]=w):w=e[3];let{data:T,error:E,isLoading:D,mutate:O}=h(t?`setup-checklist-provider-meta`:null,y,w),A;e[4]===t?A=e[5]:(A=t?re():null,e[4]=t,e[5]=A);let j;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},e[6]=j):j=e[6];let{data:M,error:N,isLoading:P,mutate:F}=h(A,ie,j),L;e[7]===t?L=e[8]:(L=t?ae():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:z,isLoading:B,mutate:V}=h(L,oe,R);s?.payload?.config;let H=s?.payload?.config,U;e[10]===H?U=e[11]:(U=ne(H),e[10]=H,e[11]=U);let ee=t?U:null,W;e[12]===ee?W=e[13]:(W=se(ee),e[12]=ee,e[13]=W);let G;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1},e[14]=G):G=e[14];let{data:K,isLoading:q,mutate:ce}=h(W,ue,G),J;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(J={revalidateOnFocus:!1},e[15]=J):J=e[15],h(t?v:null,_,J);let Y=!t||!l&&!S&&!D&&!P&&!B&&!q,X=!!(c||x||E||N),Z;bb0:{if(!t||!Y){Z=null;break bb0}let n=b?.catalog?.length??0,r;if(e[16]!==K||e[17]!==s?.payload?.config||e[18]!==M||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==z||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==T||e[33]!==o||e[34]!==n||e[35]!==t){let c=T?.filter(le).length??0,l=T?.length??0,u;e[37]===a.providersConfigured?u=e[38]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=u);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=te({hasToken:!!t,realtimeConnected:o,config:s?.payload?.config,skillCount:n,providerMeta:l>0?{configured:c,total:l}:null,doctorChecks:M,logsHealth:z,browserDiagnostics:K,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=K,e[17]=s?.payload?.config,e[18]=M,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=z,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=T,e[33]=o,e[34]=n,e[35]=t,e[36]=r}else r=e[36];Z=r}let he=Z,Q;e[45]!==ce||e[46]!==p||e[47]!==F||e[48]!==V||e[49]!==O||e[50]!==C?(Q=async()=>{await Promise.all([p(),C(),O(),F(),V(),ce()])},e[45]=ce,e[46]=p,e[47]=F,e[48]=V,e[49]=O,e[50]=C,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==X||e[53]!==Y||e[54]!==ge||e[55]!==he?($={ready:Y,error:X,snapshot:he,refresh:ge},e[52]=X,e[53]=Y,e[54]=ge,e[55]=he,e[56]=$):$=e[56],$}function le(e){return e.configured}function ue(e){let[,t]=e;return ce(t)}function de(){return w()}function fe(e){return e.connectionState===`connected`}function pe(e){return e.language}function me(e){return e.token}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?a:e===`warn`?b:e===`fail`?C:E}function he(e,t){return e===`blocked`?{icon:C,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:b,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:S,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,I.c)(48),{tier:n,issueCount:r,onRunDoctor:a,ready:l,doctorRunning:d,doctorRunState:p}=e,m=f(ge),h,g,_,v,y,b,x,S,C,w,E;if(t[0]!==r||t[1]!==m||t[2]!==n){g=u(m).setupStatus;let e=he(n,g),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;h=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})]}),E=s(`rounded-xl p-4`,e.className),w=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,S=`flex min-w-0 gap-3`,C=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),y=`min-w-0`,b=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),x=(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-85`,children:e.body}),_=`mt-2 text-xs opacity-75`,v=g.health.issueCount.replace(`{{count}}`,String(r)),t[0]=r,t[1]=m,t[2]=n,t[3]=h,t[4]=g,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w,t[13]=E}else h=t[3],g=t[4],_=t[5],v=t[6],y=t[7],b=t[8],x=t[9],S=t[10],C=t[11],w=t[12],E=t[13];let D;t[14]!==_||t[15]!==v?(D=(0,Y.jsx)(`p`,{className:_,children:v}),t[14]=_,t[15]=v,t[16]=D):D=t[16];let k;t[17]!==D||t[18]!==y||t[19]!==b||t[20]!==x?(k=(0,Y.jsxs)(`div`,{className:y,children:[b,x,D]}),t[17]=D,t[18]=y,t[19]=b,t[20]=x,t[21]=k):k=t[21];let A;t[22]!==k||t[23]!==S||t[24]!==C?(A=(0,Y.jsxs)(`div`,{className:S,children:[C,k]}),t[22]=k,t[23]=S,t[24]=C,t[25]=A):A=t[25];let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=s(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,c.press),t[26]=j):j=t[26];let M=!l||d,N;t[27]===d?N=t[28]:(N=d?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t[27]=d,t[28]=N);let P=d?g.health.runDoctorRunning:g.health.runDoctor,F;t[29]!==d||t[30]!==a||t[31]!==M||t[32]!==N||t[33]!==P?(F=(0,Y.jsxs)(`button`,{type:`button`,className:j,onClick:a,disabled:M,"aria-busy":d,children:[N,P]}),t[29]=d,t[30]=a,t[31]=M,t[32]=N,t[33]=P,t[34]=F):F=t[34];let L;t[35]!==h||t[36]!==F?(L=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[h,F]}),t[35]=h,t[36]=F,t[37]=L):L=t[37];let R;t[38]!==A||t[39]!==L||t[40]!==w?(R=(0,Y.jsxs)(`div`,{className:w,children:[A,L]}),t[38]=A,t[39]=L,t[40]=w,t[41]=R):R=t[41];let z=d?g.health.doctorRunningMessage:p===`success`?g.health.doctorCompleteMessage:p===`error`?g.health.doctorFailedMessage:g.health.doctorIdleMessage,B;t[42]===z?B=t[43]:(B=(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:z}),t[42]=z,t[43]=B);let V;return t[44]!==R||t[45]!==B||t[46]!==E?(V=(0,Y.jsxs)(`section`,{className:E,children:[R,B]}),t[44]=R,t[45]=B,t[46]=E,t[47]=V):V=t[47],V}function ge(e){return e.language}function $(e){let t=(0,I.c)(34),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.status?u=t[7]:(u=s(`rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[6]=n.status,t[7]=u);let d;t[8]!==n.status||t[9]!==u?(d=(0,Y.jsx)(`span`,{className:u,children:n.status}),t[8]=n.status,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.message?p=t[15]:(p=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[14]=n.message,t[15]=p);let m;t[16]===n.hints[0]?m=t[17]:(m=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[16]=n.hints[0],t[17]=m);let h;t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p,m]}),t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==r||t[23]!==n.path?(g=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})]}):null,t[22]=r,t[23]=n.path,t[24]=g):g=t[24];let _;t[25]!==g||t[26]!==c||t[27]!==h?(_=(0,Y.jsxs)(Y.Fragment,{children:[c,h,g]}),t[25]=g,t[26]=c,t[27]=h,t[28]=_):_=t[28];let v=_;if(n.path){let e;return t[29]!==v||t[30]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v}),t[29]=v,t[30]=n.path,t[31]=e):e=t[31],e}let y;return t[32]===v?y=t[33]:(y=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:v}),t[32]=v,t[33]=y),y}function _e(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=s(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Y.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(T,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function ve(e){let t=(0,I.c)(29),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=c);let l;t[4]===n.label?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=l);let u;t[6]===n.message?u=t[7]:(u=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n.status?f=t[12]:(f=s(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[11]=n.status,t[12]=f);let p;t[13]!==n.status||t[14]!==f?(p=(0,Y.jsx)(`span`,{className:f,children:n.status}),t[13]=n.status,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n.path?(m=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[16]=r,t[17]=n.path,t[18]=m):m=t[18];let h;t[19]!==c||t[20]!==d||t[21]!==p||t[22]!==m?(h=(0,Y.jsxs)(Y.Fragment,{children:[c,d,p,m]}),t[19]=c,t[20]=d,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g=h;if(n.path){let e;return t[24]!==g||t[25]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:g}),t[24]=g,t[25]=n.path,t[26]=e):e=t[26],e}let _;return t[27]===g?_=t[28]:(_=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:g}),t[27]=g,t[28]=_),_}function ye(){let e=u(f(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,F.useState)(!1),[l,d]=(0,F.useState)(`idle`),p=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],m=async()=>{if(!(a||!t)){o(!0),d(`idle`);try{await i(),d(`success`)}catch{d(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(j,{gap:`gap-6`,children:[(0,Y.jsx)(A,{title:e.title,subtitle:e.subtitle,actions:(0,Y.jsxs)(`button`,{type:`button`,className:s(`inline-flex shrink-0 items-center gap-2 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,c.press),onClick:()=>void m(),disabled:!t||a,"aria-busy":a,children:[(0,Y.jsx)(O,{className:s(`size-4`,(!t||a)&&`animate-spin`),"aria-hidden":!0}),a?e.health.runDoctorRunning:e.refresh]})}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(M,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void m(),doctorRunning:a,doctorRunState:l}),(0,Y.jsxs)(P,{id:`next-steps`,children:[(0,Y.jsx)(N,{icon:r.issues.length?b:D,title:e.nextStepsTitle,subtitle:r.issues.length?e.nextStepsIssuesSubtitle:e.nextStepsReadySubtitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)($,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(_e,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(N,{icon:x,title:e.diagnosticsTitle,subtitle:e.diagnosticsSubtitle}),p.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:p.map(t=>(0,Y.jsx)(ve,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})]})]})}export{ye as SetupStatusPanel};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-B2_kr5EA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-zJ_50EbN.js";import{d as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./download-Dk-ZjtO6.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./markdown-view-CBM-v2ph.js";import{n as c,r as l}from"./locale-store-Ci1Qi0Q-.js";import{Ka as u,Xa as d,Zi as f,ea as p,na as m,ra as h}from"./index-BsD5wygl.js";var g=e(t(),1),_=n();function v(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function y(){let{token:e}=i(),t=c(e=>e.language),n=t===`zh`?S:C,[y,w]=(0,g.useState)(null),[T,E]=(0,g.useState)(v),[D,O]=(0,g.useState)(!0),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=(0,g.useMemo)(()=>{if(!y||!e||y.kind!==`file`)return null;let t=m(y.fileName,y.mimeType);return{id:`share:${e}:${y.fileName}`,context:`share`,fileName:y.fileName,mimeType:t,size:y.fileSize,type:p(y.fileName,t),source:{kind:`share`,token:e}}},[y,e]);(0,g.useEffect)(()=>{if(!e){A(n.invalidLink),O(!1);return}let t=!1;return(async()=>{try{O(!0),A(null),E(v());let i=await fetch(l(`/s/${encodeURIComponent(e)}/meta`));if(!i.ok){t||A(i.status===404?n.notFound:n.expired);return}let a=await i.json();if(t)return;if(w(a),!a.valid){A(n.expired);return}if(a.kind===`note`){let r=await fetch(l(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){A(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload&&M(i.payload);return}if(a.kind!==`file`)return;let o=m(a.fileName,a.mimeType),s=p(a.fileName,o),c=h(s),d=l(`/s/${encodeURIComponent(e)}?inline=1`);if(c===`text`){if(a.fileSize>5242880){A(n.tooLarge);return}let e=await fetch(d);if(!e.ok){A(n.expired);return}let r=await e.text();t||E({...v(),textContent:r});return}if(c===`binary`){if(a.fileSize>33554432){A(n.tooLarge);return}let e=await fetch(d);if(!e.ok){A(n.expired);return}let i=await e.arrayBuffer();if(t)return;if(s===`pptx`){let{processPptx:e}=await r(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(i,a.fileName),n=t.length>u;E({textContent:null,binaryBuffer:i,extractedText:n?t.slice(0,u):t,extractedTextTruncated:n});return}E({...v(),binaryBuffer:i})}}catch(e){t||A(e instanceof Error?e.message:String(e))}finally{t||O(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let P=e?l(`/s/${encodeURIComponent(e)}?dl=1`):`#`,F=e?l(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,_.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,_.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y?(0,_.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:y.fileName,children:y.fileName}):D?(0,_.jsx)(d,{className:`h-4 w-48 max-w-full`}):(0,_.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),y?(0,_.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[x(y.fileSize),` · `,n.expiresAt,` `,new Date(y.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]}),y&&y.kind!==`note`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[(0,_.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),n.openInline]}),(0,_.jsxs)(`a`,{href:P,className:`inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white hover:opacity-90`,download:y.fileName,children:[(0,_.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),n.download]})]}):null]}),(0,_.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:D?(0,_.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,_.jsx)(d,{className:`h-5 w-56 max-w-full`}),(0,_.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,_.jsx)(d,{className:`h-4 w-full`}),(0,_.jsx)(d,{className:`h-4 w-11/12`}),(0,_.jsx)(d,{className:`h-4 w-10/12`}),(0,_.jsx)(d,{className:`h-4 w-3/4`})]}),(0,_.jsx)(d,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):k?(0,_.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,_.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,_.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:k})]}):y?.kind===`directory`?(0,_.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):y?.kind===`note`&&j?(0,_.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,_.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:j.title}),(0,_.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(j.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(j.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),j.description?(0,_.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-subtle px-4 py-3 text-sm leading-6 text-fg-muted`,children:j.description}):null,(0,_.jsx)(s,{content:b(j.markdown,n.remoteImageBlocked),className:`mt-8`}),(0,_.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):N?(0,_.jsx)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,_.jsx)(f,{language:t,descriptor:N,loading:!1,loadError:null,textContent:T.textContent,binaryBuffer:T.binaryBuffer,extractedText:T.extractedText,extractedTextTruncated:T.extractedTextTruncated,actions:{onDownload:()=>{window.location.href=P},canDownload:!0}})}):null})]})}function b(e,t){return e.replace(/!\[([^\]]*)\]\((https?:\/\/[^)]+)\)/gi,(e,n,r)=>`[${n.trim()||t}](${r})`)}function x(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var S={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,download:`下载`,openInline:`在新窗口打开`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,remoteImageBlocked:`远程图片(点击打开)`},C={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,download:`Download`,openInline:`Open raw`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,remoteImageBlocked:`Remote image (open manually)`};export{y as SharePreviewPage};
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-zJ_50EbN.js";import{d as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./download-Dk-ZjtO6.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./markdown-view-DvM5PWEH.js";import{n as c,r as l}from"./locale-store-CXhjfe4q.js";import{Qa as u,ca as d,la as f,no as p,oa as m,ra as h}from"./index-BNWhgmjs.js";var g=e(t(),1),_=n();function v(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function y(){let{token:e}=i(),t=c(e=>e.language),n=t===`zh`?S:C,[y,w]=(0,g.useState)(null),[T,E]=(0,g.useState)(v),[D,O]=(0,g.useState)(!0),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=(0,g.useMemo)(()=>{if(!y||!e||y.kind!==`file`)return null;let t=d(y.fileName,y.mimeType);return{id:`share:${e}:${y.fileName}`,context:`share`,fileName:y.fileName,mimeType:t,size:y.fileSize,type:m(y.fileName,t),source:{kind:`share`,token:e}}},[y,e]);(0,g.useEffect)(()=>{if(!e){A(n.invalidLink),O(!1);return}let t=!1;return(async()=>{try{O(!0),A(null),E(v());let i=await fetch(l(`/s/${encodeURIComponent(e)}/meta`));if(!i.ok){t||A(i.status===404?n.notFound:n.expired);return}let a=await i.json();if(t)return;if(w(a),!a.valid){A(n.expired);return}if(a.kind===`note`){let r=await fetch(l(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){A(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload&&M(i.payload);return}if(a.kind!==`file`)return;let o=d(a.fileName,a.mimeType),s=m(a.fileName,o),c=f(s),p=l(`/s/${encodeURIComponent(e)}?inline=1`);if(c===`text`){if(a.fileSize>5242880){A(n.tooLarge);return}let e=await fetch(p);if(!e.ok){A(n.expired);return}let r=await e.text();t||E({...v(),textContent:r});return}if(c===`binary`){if(a.fileSize>33554432){A(n.tooLarge);return}let e=await fetch(p);if(!e.ok){A(n.expired);return}let i=await e.arrayBuffer();if(t)return;if(s===`pptx`){let{processPptx:e}=await r(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(i,a.fileName),n=t.length>u;E({textContent:null,binaryBuffer:i,extractedText:n?t.slice(0,u):t,extractedTextTruncated:n});return}E({...v(),binaryBuffer:i})}}catch(e){t||A(e instanceof Error?e.message:String(e))}finally{t||O(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let P=e?l(`/s/${encodeURIComponent(e)}?dl=1`):`#`,F=e?l(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,_.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,_.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y?(0,_.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:y.fileName,children:y.fileName}):D?(0,_.jsx)(p,{className:`h-4 w-48 max-w-full`}):(0,_.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),y?(0,_.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[x(y.fileSize),` · `,n.expiresAt,` `,new Date(y.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]}),y&&y.kind!==`note`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[(0,_.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),n.openInline]}),(0,_.jsxs)(`a`,{href:P,className:`inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white hover:opacity-90`,download:y.fileName,children:[(0,_.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),n.download]})]}):null]}),(0,_.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:D?(0,_.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,_.jsx)(p,{className:`h-5 w-56 max-w-full`}),(0,_.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,_.jsx)(p,{className:`h-4 w-full`}),(0,_.jsx)(p,{className:`h-4 w-11/12`}),(0,_.jsx)(p,{className:`h-4 w-10/12`}),(0,_.jsx)(p,{className:`h-4 w-3/4`})]}),(0,_.jsx)(p,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):k?(0,_.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,_.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,_.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:k})]}):y?.kind===`directory`?(0,_.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):y?.kind===`note`&&j?(0,_.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,_.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:j.title}),(0,_.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(j.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(j.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),j.description?(0,_.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-subtle px-4 py-3 text-sm leading-6 text-fg-muted`,children:j.description}):null,(0,_.jsx)(s,{content:b(j.markdown,n.remoteImageBlocked),className:`mt-8`}),(0,_.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):N?(0,_.jsx)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,_.jsx)(h,{language:t,descriptor:N,loading:!1,loadError:null,textContent:T.textContent,binaryBuffer:T.binaryBuffer,extractedText:T.extractedText,extractedTextTruncated:T.extractedTextTruncated,actions:{onDownload:()=>{window.location.href=P},canDownload:!0}})}):null})]})}function b(e,t){return e.replace(/!\[([^\]]*)\]\((https?:\/\/[^)]+)\)/gi,(e,n,r)=>`[${n.trim()||t}](${r})`)}function x(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var S={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,download:`下载`,openInline:`在新窗口打开`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,remoteImageBlocked:`远程图片(点击打开)`},C={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,download:`Download`,openInline:`Open raw`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,remoteImageBlocked:`Remote image (open manually)`};export{y as SharePreviewPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-CccGri5Y.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{s as m}from"./form-field-width-DJw_jULe.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./messages-CtOJwGW3.js";import{l as _,n as v,r as y,s as b}from"./locale-store-Ci1Qi0Q-.js";import{a as x,n as S,o as ee,r as C,s as w,t as te}from"./dist-BPoKqzeH.js";import{i as ne}from"./vendor-swr-BIWyz7Rc.js";import{n as T,r as E}from"./gateway-config-swr-6SQXF1yR.js";import{Bi as D,Gi as O,Hi as k,Ki as A,Li as j,Pi as M,Sl as N,Ss as P,Ua as F,Ui as I,Vi as re,Wi as L,Xa as R,Xs as ie,ca as ae,il as oe,ks as z,qi as se,rr as ce,ul as B,ur as le,zi as ue,zl as V}from"./index-BsD5wygl.js";import{n as de,r as fe,t as H}from"./settings-page-layout-BRQNel6r.js";import{t as pe}from"./settings-loading-skeleton-efk5W6lG.js";import{t as me}from"./settings-form-section-DgdB26mE.js";import{t as U}from"./page-tabs-BaEQMYm_.js";var W=e(t(),1),he=n(),G={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function ge(){return structuredClone(G)}var K=36e5,q=864e5,J=1048576;function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _e(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function ve(e){let t=Y(e)?e:{},n=Y(t.gateway)?t.gateway:{},r=Y(n.share)?n.share:{},i=Y(r.directory)?r.directory:{},a=Y(r.note)?r.note:{},o=Y(n.siteShare)?n.siteShare:{},s=Y(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):G.defaultTtlHours*K,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):G.maxTtlDays*q,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):G.maxFileSizeMb*J,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):G.directoryMaxFolderSizeMb*J,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):G.siteDefaultTtlHours*K,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):G.siteMaxTtlDays*q,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):G.siteMaxRootDirSizeMb*J,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):G.noteMaxTotalSizeMb*J;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/K)),maxTtlDays:Math.max(1,Math.round(l/q)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):G.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/J)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/J)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):G.directoryMaxFileCount,inlinePreviewMimes:_e(r.inlinePreviewMimes,32).length?_e(r.inlinePreviewMimes,32):[...G.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/J)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):G.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/K)),siteMaxTtlDays:Math.max(1,Math.round(p/q)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):G.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/J)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):G.siteMaxFileCount}}function ye(e){let t=e.defaultTtlHours*K,n=e.maxTtlDays*q,r=e.siteDefaultTtlHours*K,i=e.siteMaxTtlDays*q;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function X(e){let t=ye(e);if(t)throw Error(t);await b(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*K,maxTtlMs:e.maxTtlDays*q,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*J,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*J,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*J,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*K,maxTtlMs:e.siteMaxTtlDays*q,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*J,maxFileCount:e.siteMaxFileCount}}}})}),T()}var Z=r();function Q(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m,`dark:border-edge`)}function be({hasToken:e}){let t=g(v(e=>e.language)).sharesSettings,{data:n,isLoading:r}=E(e),i=(0,W.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ve(n.payload.config)),[n]),a=(0,W.useRef)(!1),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,m]=(0,W.useState)(!1),h=o??i,_=i,y=(0,W.useMemo)(()=>!h||!_?!1:JSON.stringify(h)!==JSON.stringify(_),[h,_]),b=(0,W.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),x=(0,W.useCallback)(async()=>{if(!(!h||c)){l(!0),d(null),m(!1);try{await X(h),a.current=!1,s(null),m(!0),window.setTimeout(()=>m(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[h,c,t.policySaveError]),S=(0,W.useCallback)(()=>{a.current=!1,s(null),d(null),m(!1)},[]);return!e||!h?r?(0,Z.jsx)(me,{children:(0,Z.jsx)(pe,{rows:2})}):null:(0,Z.jsxs)(me,{children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,Z.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>b(ge()),children:t.policyUseRecommended}),(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:!y||c,onClick:S,children:t.policyDiscard}),(0,Z.jsx)(p,{type:`button`,variant:`primary`,disabled:!y||c,onClick:()=>void x(),children:c?t.policySaving:t.policySave})]})]}),y?(0,Z.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,Z.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,Z.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Z.jsx)(xe,{t,form:h,onChange:b})]})}function xe(e){let t=(0,he.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Z.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Z.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Z.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Z.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let ee=!r.enabled,C;t[47]===i?C=t[48]:(C=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=C);let w;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==ee||t[53]!==C?(w=(0,Z.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:ee,onChange:C}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=ee,t[53]=C,t[54]=w):w=t[54];let te=!r.enabled,ne;t[55]===i?ne=t[56]:(ne=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=ne);let T;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==te||t[61]!==ne?(T=(0,Z.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:te,onChange:ne}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=te,t[61]=ne,t[62]=T):T=t[62];let E;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==w||t[67]!==T||t[68]!==p?(E=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,w,T]}),t[63]=g,t[64]=y,t[65]=S,t[66]=w,t[67]=T,t[68]=p,t[69]=E):E=t[69];let D=!r.enabled,O;t[70]===i?O=t[71]:(O=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=O);let k;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==D||t[75]!==O?(k=(0,Z.jsx)(Se,{t:n,values:r.inlinePreviewMimes,disabled:D,onChange:O}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=D,t[75]=O,t[76]=k):k=t[76];let A;t[77]!==E||t[78]!==k||t[79]!==s||t[80]!==u?(A=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,E,k]}),t[77]=E,t[78]=k,t[79]=s,t[80]=u,t[81]=A):A=t[81];let j;t[82]===n.policyNoteSection?j=t[83]:(j=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=j);let M;t[84]===n.policyNoteSectionHint?M=t[85]:(M=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=M);let N;t[86]!==j||t[87]!==M?(N=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[j,M]}),t[86]=j,t[87]=M,t[88]=N):N=t[88];let P;t[89]===i?P=t[90]:(P=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=P);let F;t[91]!==r.noteEnabled||t[92]!==P?(F=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:P}),t[91]=r.noteEnabled,t[92]=P,t[93]=F):F=t[93];let I;t[94]!==n.policyNoteEnabled||t[95]!==F?(I=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[F,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=F,t[96]=I):I=t[96];let re=!r.enabled||!r.noteEnabled,L;t[97]===i?L=t[98]:(L=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=L);let R;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==re||t[103]!==L?(R=(0,Z.jsx)($,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:re,onChange:L}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=re,t[103]=L,t[104]=R):R=t[104];let ie=!r.enabled||!r.noteEnabled,ae;t[105]===i?ae=t[106]:(ae=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=ae);let oe;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==ie||t[111]!==ae?(oe=(0,Z.jsx)($,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:ie,onChange:ae}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=ie,t[111]=ae,t[112]=oe):oe=t[112];let z;t[113]!==R||t[114]!==oe?(z=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[R,oe]}),t[113]=R,t[114]=oe,t[115]=z):z=t[115];let se;t[116]!==N||t[117]!==I||t[118]!==z?(se=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[N,I,z]}),t[116]=N,t[117]=I,t[118]=z,t[119]=se):se=t[119];let ce;t[120]===n.policySiteSection?ce=t[121]:(ce=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=ce);let B;t[122]===n.policySiteSectionHint?B=t[123]:(B=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=B);let le;t[124]!==ce||t[125]!==B?(le=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[ce,B]}),t[124]=ce,t[125]=B,t[126]=le):le=t[126];let ue;t[127]===i?ue=t[128]:(ue=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=ue);let V;t[129]!==r.siteEnabled||t[130]!==ue?(V=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:ue}),t[129]=r.siteEnabled,t[130]=ue,t[131]=V):V=t[131];let de;t[132]!==n.policySiteEnabled||t[133]!==V?(de=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[V,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=V,t[134]=de):de=t[134];let fe=!r.siteEnabled,H;t[135]===i?H=t[136]:(H=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=H);let pe;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==fe||t[141]!==H?(pe=(0,Z.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:fe,onChange:H}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=fe,t[141]=H,t[142]=pe):pe=t[142];let me=!r.siteEnabled,U;t[143]===i?U=t[144]:(U=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=U);let W;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==me||t[149]!==U?(W=(0,Z.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:me,onChange:U}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=me,t[149]=U,t[150]=W):W=t[150];let G=!r.siteEnabled,ge;t[151]===i?ge=t[152]:(ge=e=>i({maxActiveSites:e}),t[151]=i,t[152]=ge);let K;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==G||t[157]!==ge?(K=(0,Z.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:G,onChange:ge}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=G,t[157]=ge,t[158]=K):K=t[158];let q=!r.siteEnabled,J;t[159]===i?J=t[160]:(J=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=J);let Y;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==q||t[165]!==J?(Y=(0,Z.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:q,onChange:J}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=q,t[165]=J,t[166]=Y):Y=t[166];let _e=!r.siteEnabled,ve;t[167]===i?ve=t[168]:(ve=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=ve);let ye;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==_e||t[173]!==ve?(ye=(0,Z.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:_e,onChange:ve}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=_e,t[173]=ve,t[174]=ye):ye=t[174];let X;t[175]!==pe||t[176]!==W||t[177]!==K||t[178]!==Y||t[179]!==ye?(X=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[pe,W,K,Y,ye]}),t[175]=pe,t[176]=W,t[177]=K,t[178]=Y,t[179]=ye,t[180]=X):X=t[180];let Q;t[181]!==le||t[182]!==de||t[183]!==X?(Q=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[le,de,X]}),t[181]=le,t[182]=de,t[183]=X,t[184]=Q):Q=t[184];let be;return t[185]!==A||t[186]!==se||t[187]!==Q?(be=(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[A,se,Q]}),t[185]=A,t[186]=se,t[187]=Q,t[188]=be):be=t[188],be}function $(e){let t=(0,he.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(Q(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let p;t[4]!==s||t[5]!==o||t[6]!==l?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==p||t[13]!==a?(m=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:p}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==u||t[18]!==m||t[19]!==h?(g=(0,Z.jsxs)(`div`,{children:[u,m,h]}),t[17]=u,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Se(e){let t=(0,he.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Z.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=f(Q(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===s?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Z.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,g]}),t[20]=c,t[21]=l,t[22]=d,t[23]=g,t[24]=_):_=t[24],_}function Ce(e){let t=(0,he.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:c,sessionKey:u,agentId:m}=e,h=c===void 0?`any`:c,y=g(v(Ee)),b=y.workspace,T=y.sharesSettings,E=j(Te),{data:D}=ne(_(we)?`picker-agents-list`:null,le),O;bb0:{let e;t[0]===m?e=t[1]:(e=m?.trim(),t[0]=m,t[1]=e);let n=e;if(n){O=n;break bb0}let r;t[2]===E?r=t[3]:(r=E.trim(),t[2]=E,t[3]=r);let i=r;if(i){O=i;break bb0}if(D?.defaultId){O=D.defaultId;break bb0}if(D?.agents?.[0]?.id){O=D.agents[0].id;break bb0}O=``}let k=O,[A,M]=(0,W.useState)(k),N,P;t[4]===k?(N=t[5],P=t[6]):(N=()=>{M(k)},P=[k],t[4]=k,t[5]=N,t[6]=P),(0,W.useEffect)(N,P);let{tree:F,loading:I,error:re,loadRoot:L,loadChildren:R,reset:z}=ue(A,u??null),se;t[7]===a?se=t[8]:(se=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=se);let[B,V]=(0,W.useState)(se),de;t[9]!==a||t[10]!==L||t[11]!==n||t[12]!==z||t[13]!==V?(de=()=>{if(!n){z(),V(a?{path:a,isDirectory:!1}:null);return}L()},t[9]=a,t[10]=L,t[11]=n,t[12]=z,t[13]=V,t[14]=de):de=t[14];let fe;t[15]!==a||t[16]!==L||t[17]!==n||t[18]!==A||t[19]!==z||t[20]!==u?(fe=[n,A,u,L,z,a],t[15]=a,t[16]=L,t[17]=n,t[18]=A,t[19]=z,t[20]=u,t[21]=fe):fe=t[21],(0,W.useEffect)(de,fe);let H;t[22]===R?H=t[23]:(H=e=>{R(e)},t[22]=R,t[23]=H);let pe=H,me=B!==null&&(h===`any`||h===`file`&&!B.isDirectory||h===`directory`&&B.isDirectory),U;bb1:{if(!B){U=T.pickerHintNone;break bb1}if(h===`file`&&B.isDirectory){U=T.pickerHintNeedsFile;break bb1}if(h===`directory`&&!B.isDirectory){U=T.pickerHintNeedsDirectory;break bb1}U=`${B.isDirectory?`📁`:`📄`} ${B.path}`}let G=U,ge=D?.agents??[],K;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(x,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=K):K=t[24];let q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(q=f(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=q):q=t[25];let J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=J):J=t[26];let Y=y.cron.refresh,_e=y.cron.refresh,ve;t[27]===L?ve=t[28]:(ve=()=>void L(),t[27]=L,t[28]=ve);let ye=I&&`animate-spin`,X;t[29]===ye?X=t[30]:(X=f(`size-4`,ye),t[29]=ye,t[30]=X);let Q;t[31]===X?Q=t[32]:(Q=(0,Z.jsx)(ie,{className:X,"aria-hidden":!0}),t[31]=X,t[32]=Q);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(d,{className:`size-4`}),t[33]=be):be=t[33];let xe;t[34]!==re||t[35]!==b.loadError?(xe=re?(0,Z.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[b.loadError,`: `,re]}):null,t[34]=re,t[35]=b.loadError,t[36]=xe):xe=t[36];let $;t[37]!==pe||t[38]!==I||t[39]!==B?.path||t[40]!==V||t[41]!==b.emptyDir||t[42]!==b.title||t[43]!==F?($=I&&F.length===0?(0,Z.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Z.jsx)(l,{className:`size-4 animate-spin`}),b.title,`…`]}):(0,Z.jsx)(ae,{tree:F,selectedPath:B?.path??null,onSelectFile:e=>V({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>V({path:e,isDirectory:t}),onExpandDir:pe,onAction:void 0,emptyHint:b.emptyDir}),t[37]=pe,t[38]=I,t[39]=B?.path,t[40]=V,t[41]=b.emptyDir,t[42]=b.title,t[43]=F,t[44]=$):$=t[44];let Se;t[45]!==xe||t[46]!==$?(Se=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[xe,$]}),t[45]=xe,t[46]=$,t[47]=Se):Se=t[47];let Ce;t[48]===G?Ce=t[49]:(Ce=(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:G}),t[48]=G,t[49]=Ce);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==T.cancel||t[53]!==De?(Oe=(0,Z.jsx)(p,{type:`button`,variant:`ghost`,onClick:De,children:T.cancel}),t[52]=T.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!me,Ae;t[55]!==i||t[56]!==r||t[57]!==A||t[58]!==B?(Ae=()=>{B&&(i({...B,agentId:A}),r(!1))},t[55]=i,t[56]=r,t[57]=A,t[58]=B,t[59]=Ae):Ae=t[59];let je;t[60]!==T.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Z.jsx)(p,{type:`button`,disabled:ke,onClick:Ae,children:T.pickerConfirm}),t[60]=T.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ce||t[68]!==Me?(Ne=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ce,Me]}),t[67]=Ce,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Z.jsx)(te,{open:n,onOpenChange:r,children:(0,Z.jsxs)(ee,{children:[K,(0,Z.jsxs)(C,{className:q,children:[(0,Z.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[J,(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:T.pickerTitle}),(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:Y,"aria-label":_e,disabled:I,onClick:ve,children:Q}),(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.close,children:be})})]}),ge.length>0?(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Z.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:T.pickerAgentLabel}),(0,Z.jsx)(o,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:A,onChange:e=>{M(e.target.value),V(null)},children:ge.map(e=>(0,Z.jsxs)(s,{value:e.id,children:[ce(e,y.agentsSettings),e.id===D?.defaultId?` ★`:``]},e.id))})]}):null,Se,Ne]})]})})}function we(e){return e.token}function Te(e){return e.agentId}function Ee(e){return e.language}var De=[`shares`,`policy`];function Oe(e){let t=(e??``).trim();return De.includes(t)?t:`shares`}function ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Ae(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var je=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function Me(){let e=(0,he.c)(24),t=v(Pe),n=g(t).sharesSettings,r=!!_(Ne),[a,o]=i(),s;e[0]===a?s=e[1]:(s=Oe(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,Z.jsx)(fe,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=De.map(e=>({id:e,label:d[e]})),p;e[4]!==n.subtitle||e[5]!==n.title?(p=(0,Z.jsx)(de,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=p):p=e[6];let m;e[7]!==c||e[8]!==u||e[9]!==n.tabsAria||e[10]!==f?(m=(0,Z.jsx)(U,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=c,e[8]=u,e[9]=n.tabsAria,e[10]=f,e[11]=m):m=e[11];let h;e[12]!==c||e[13]!==r||e[14]!==t||e[15]!==n?(h=c===`shares`?(0,Z.jsx)(Fe,{t:n,language:t}):(0,Z.jsx)(be,{hasToken:r}),e[12]=c,e[13]=r,e[14]=t,e[15]=n,e[16]=h):h=e[16];let y;e[17]!==c||e[18]!==h?(y=(0,Z.jsx)(H,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[17]=c,e[18]=h,e[19]=y):y=e[19];let b;return e[20]!==p||e[21]!==m||e[22]!==y?(b=(0,Z.jsxs)(fe,{children:[p,m,y]}),e[20]=p,e[21]=m,e[22]=y,e[23]=b):b=e[23],b}function Ne(e){return e.token}function Pe(e){return e.language}function Fe(e){let t=(0,he.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=ne(`shares-list`,I,i),l;t[1]===a?.payload?.shares?l=t[2]:(l=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=l);let u=l,[d,m]=(0,W.useState)(!1),h;bb0:{if(d){h=u;break bb0}let e;t[3]===u?e=t[4]:(e=u.filter(Be),t[3]=u,t[4]=e),h=e}let g=h,_;t[5]===u?_=t[6]:(_=u.filter(ze),t[5]=u,t[6]=_);let v=_.length,y;t[7]===u?y=t[8]:(y=u.filter(Re),t[7]=u,t[8]=y);let b=y.length,x;t[9]===c?x=t[10]:(x=()=>void c(),t[9]=c,t[10]=x);let S;t[11]!==n||t[12]!==x?(S=(0,Z.jsx)(He,{t:n,onCreated:x}),t[11]=n,t[12]=x,t[13]=S):S=t[13];let ee=d?n.allSharesTitle:n.listTitle,C;t[14]===v?C=t[15]:(C=v>0&&(0,Z.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[14]=v,t[15]=C);let w;t[16]!==ee||t[17]!==C?(w=(0,Z.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[ee,C]}),t[16]=ee,t[17]=C,t[18]=w):w=t[18];let te;t[19]===c?te=t[20]:(te=()=>void c(),t[19]=c,t[20]=te);let T=s&&`animate-spin`,E;t[21]===T?E=t[22]:(E=f(`size-3.5`,T),t[21]=T,t[22]=E);let D;t[23]===E?D=t[24]:(D=(0,Z.jsx)(ie,{className:E}),t[23]=E,t[24]=D);let O;t[25]!==s||t[26]!==te||t[27]!==D?(O=(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:te,disabled:s,children:D}),t[25]=s,t[26]=te,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==b||t[30]!==d||t[31]!==n.hideExpired||t[32]!==n.showExpired?(k=b>0&&(0,Z.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Le),children:d?n.hideExpired:n.showExpired}),t[29]=b,t[30]=d,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=k):k=t[33];let A;t[34]!==O||t[35]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==w||t[38]!==A?(j=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[w,A]}),t[37]=w,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==a||t[41]!==o||t[42]!==g||t[43]!==s||t[44]!==r||t[45]!==c||t[46]!==n?(M=s&&!a?(0,Z.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Ie)}):o?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Z.jsx)(`span`,{children:n.error}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Z.jsx)(We,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[40]=a,t[41]=o,t[42]=g,t[43]=s,t[44]=r,t[45]=c,t[46]=n,t[47]=M):M=t[47];let N;t[48]!==b||t[49]!==c||t[50]!==d||t[51]!==n?(N=b>0&&d&&(0,Z.jsx)(Ge,{t:n,onCleaned:()=>void c()}),t[48]=b,t[49]=c,t[50]=d,t[51]=n,t[52]=N):N=t[52];let P;t[53]!==j||t[54]!==M||t[55]!==N?(P=(0,Z.jsxs)(me,{children:[j,M,N]}),t[53]=j,t[54]=M,t[55]=N,t[56]=P):P=t[56];let F;return t[57]!==P||t[58]!==S?(F=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,P]}),t[57]=P,t[58]=S,t[59]=F):F=t[59],F}function Ie(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(R,{className:`h-4 w-2/3`}),(0,Z.jsx)(R,{className:`mt-2 h-3 w-1/2`})]}),(0,Z.jsx)(R,{className:`h-7 w-20 rounded-md`})]})},t)}function Le(e){return!e}function Re(e){return e.expired||e.revoked}function ze(e){return!e.expired&&!e.revoked}function Be(e){return!e.expired&&!e.revoked}var Ve={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function He({t:e,onCreated:t}){let[n,r]=(0,W.useReducer)(F,Ve),{expanded:i,path:a,isDirectory:c,agentId:d,ttlMs:m,maxViews:h,description:g,directoryMode:_,creating:v,result:y,errorMsg:b,resultDialogOpen:x,pickerOpen:S}=n,ee=(0,W.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await re({path:a.trim(),ttlMs:m,maxViews:h,description:g.trim()||void 0,...d?{agentId:d}:{},...c?{kind:`directory`,directoryMode:_}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,c,d,m,h,g,_,t]),C=(0,W.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Z.jsxs)(me,{children:[(0,Z.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Z.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:f(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:c?`📁`:`📄`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Z.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Z.jsxs)(p,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Z.jsx)(B,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),c?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Z.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:_,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Z.jsx)(s,{value:`browse`,children:e.directoryModeBrowse}),(0,Z.jsx)(s,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Z.jsx)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:m,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:je.map(t=>(0,Z.jsx)(s,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Z.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:h??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Z.jsx)(s,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Z.jsx)(s,{value:`1`,children:`1`}),(0,Z.jsx)(s,{value:`5`,children:`5`}),(0,Z.jsx)(s,{value:`10`,children:`10`}),(0,Z.jsx)(s,{value:`50`,children:`50`}),(0,Z.jsx)(s,{value:`100`,children:`100`})]})]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Z.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:g,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Z.jsxs)(p,{type:`button`,disabled:v||!a.trim(),onClick:()=>void ee(),children:[v?(0,Z.jsx)(l,{className:`size-4 animate-spin`}):(0,Z.jsx)(u,{className:`size-4`}),v?e.creating:e.createButton]}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>{C(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),b&&(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b})]}),(0,Z.jsx)(A,{open:x,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:y}),(0,Z.jsx)(Ce,{open:S,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Z.jsxs)(p,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Z.jsx)(u,{className:`size-4`}),e.createTitle]})}var Ue={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function We({share:e,t,language:n,onRevoked:r,onExtended:i}){let[o,s]=(0,W.useReducer)(F,Ue),{revokeOpen:u,revoking:d,linksOpen:m,urlCopied:g,copyFailed:_,extending:v}=o,y=!e.expired&&!e.revoked,b=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,x=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,S=(0,W.useCallback)(async()=>{s({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await L(e.id),r()}catch{}finally{s({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),ee=(0,W.useCallback)(async()=>{if(s({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await h(e.shareUrl)){s({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{copyFailed:!1}}),2500);return}s({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),C=(0,W.useCallback)(async()=>{s({type:`patch`,patch:{extending:!0}});try{await k(e.id,864e5),i()}catch{}finally{s({type:`patch`,patch:{extending:!1}})}},[e.id,i]),w=`share-links-${e.id}`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:f(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":m,"aria-controls":w,onClick:()=>s({type:`patch`,patch:{linksOpen:!m}}),children:[(0,Z.jsx)(V,{className:f(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,m?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,Z.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Z.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Z.jsx)(`span`,{className:f(`text-xs font-medium`,x),children:b})]}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:ke(e.fileSize)}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(N,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Ae(e.expiresAt,n)]}),(0,Z.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Z.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void ee(),children:g?(0,Z.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,Z.jsx)(c,{className:`size-3.5`})}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void C(),disabled:v,title:t.extend,children:v?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(N,{className:`size-3.5`})}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>s({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(P,{className:`size-3.5`})})]})})]}),y&&m?(0,Z.jsxs)(`div`,{id:w,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Z.jsx)(se,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),_?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(O,{reachability:e.reachability})})]}):null]}),(0,Z.jsx)(M,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void S(),onCancel:()=>s({type:`patch`,patch:{revokeOpen:!1}})})]})}function Ge({t:e,onCleaned:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),o=(0,W.useCallback)(async()=>{r(!1),a(!0);try{await D(),t()}catch{}finally{a(!1)}},[t]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(p,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(P,{className:`size-3.5`}),e.cleanExpired]})}),(0,Z.jsx)(M,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Me as SharesSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-CccGri5Y.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{s as m}from"./form-field-width-DJw_jULe.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./messages-BMdD0LWk.js";import{l as _,n as v,r as y,s as b}from"./locale-store-CXhjfe4q.js";import{a as x,n as S,o as ee,r as C,s as w,t as te}from"./dist-BPoKqzeH.js";import{i as ne}from"./vendor-swr-BIWyz7Rc.js";import{n as T,r as E}from"./gateway-config-swr-BWGjnmDl.js";import{$i as D,Bi as O,Fs as k,Gi as A,Gl as j,Ji as M,Ki as N,Ol as P,Os as F,Qi as I,Ui as re,Xi as L,Ya as R,Yi as ie,Zi as z,gl as B,gr as ae,lr as oe,ma as se,nc as ce,no as V,qi as H,ul as le}from"./index-BNWhgmjs.js";import{n as ue,r as de,t as fe}from"./settings-page-layout-BRQNel6r.js";import{t as pe}from"./settings-loading-skeleton-DsFu7Bcv.js";import{t as me}from"./settings-form-section-CXAn0Xhy.js";import{t as U}from"./page-tabs-BaEQMYm_.js";var W=e(t(),1),he=n(),G={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function ge(){return structuredClone(G)}var K=36e5,q=864e5,J=1048576;function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _e(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function ve(e){let t=Y(e)?e:{},n=Y(t.gateway)?t.gateway:{},r=Y(n.share)?n.share:{},i=Y(r.directory)?r.directory:{},a=Y(r.note)?r.note:{},o=Y(n.siteShare)?n.siteShare:{},s=Y(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):G.defaultTtlHours*K,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):G.maxTtlDays*q,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):G.maxFileSizeMb*J,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):G.directoryMaxFolderSizeMb*J,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):G.siteDefaultTtlHours*K,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):G.siteMaxTtlDays*q,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):G.siteMaxRootDirSizeMb*J,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):G.noteMaxTotalSizeMb*J;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/K)),maxTtlDays:Math.max(1,Math.round(l/q)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):G.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/J)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/J)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):G.directoryMaxFileCount,inlinePreviewMimes:_e(r.inlinePreviewMimes,32).length?_e(r.inlinePreviewMimes,32):[...G.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/J)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):G.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/K)),siteMaxTtlDays:Math.max(1,Math.round(p/q)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):G.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/J)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):G.siteMaxFileCount}}function ye(e){let t=e.defaultTtlHours*K,n=e.maxTtlDays*q,r=e.siteDefaultTtlHours*K,i=e.siteMaxTtlDays*q;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function X(e){let t=ye(e);if(t)throw Error(t);await b(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*K,maxTtlMs:e.maxTtlDays*q,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*J,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*J,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*J,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*K,maxTtlMs:e.siteMaxTtlDays*q,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*J,maxFileCount:e.siteMaxFileCount}}}})}),T()}var Z=r();function Q(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m,`dark:border-edge`)}function be({hasToken:e}){let t=g(v(e=>e.language)).sharesSettings,{data:n,isLoading:r}=E(e),i=(0,W.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ve(n.payload.config)),[n]),a=(0,W.useRef)(!1),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,m]=(0,W.useState)(!1),h=o??i,_=i,y=(0,W.useMemo)(()=>!h||!_?!1:JSON.stringify(h)!==JSON.stringify(_),[h,_]),b=(0,W.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),x=(0,W.useCallback)(async()=>{if(!(!h||c)){l(!0),d(null),m(!1);try{await X(h),a.current=!1,s(null),m(!0),window.setTimeout(()=>m(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[h,c,t.policySaveError]),S=(0,W.useCallback)(()=>{a.current=!1,s(null),d(null),m(!1)},[]);return!e||!h?r?(0,Z.jsx)(me,{children:(0,Z.jsx)(pe,{rows:2})}):null:(0,Z.jsxs)(me,{children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,Z.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>b(ge()),children:t.policyUseRecommended}),(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:!y||c,onClick:S,children:t.policyDiscard}),(0,Z.jsx)(p,{type:`button`,variant:`primary`,disabled:!y||c,onClick:()=>void x(),children:c?t.policySaving:t.policySave})]})]}),y?(0,Z.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,Z.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,Z.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Z.jsx)(xe,{t,form:h,onChange:b})]})}function xe(e){let t=(0,he.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Z.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Z.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Z.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Z.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let ee=!r.enabled,C;t[47]===i?C=t[48]:(C=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=C);let w;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==ee||t[53]!==C?(w=(0,Z.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:ee,onChange:C}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=ee,t[53]=C,t[54]=w):w=t[54];let te=!r.enabled,ne;t[55]===i?ne=t[56]:(ne=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=ne);let T;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==te||t[61]!==ne?(T=(0,Z.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:te,onChange:ne}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=te,t[61]=ne,t[62]=T):T=t[62];let E;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==w||t[67]!==T||t[68]!==p?(E=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,w,T]}),t[63]=g,t[64]=y,t[65]=S,t[66]=w,t[67]=T,t[68]=p,t[69]=E):E=t[69];let D=!r.enabled,O;t[70]===i?O=t[71]:(O=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=O);let k;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==D||t[75]!==O?(k=(0,Z.jsx)(Se,{t:n,values:r.inlinePreviewMimes,disabled:D,onChange:O}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=D,t[75]=O,t[76]=k):k=t[76];let A;t[77]!==E||t[78]!==k||t[79]!==s||t[80]!==u?(A=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,E,k]}),t[77]=E,t[78]=k,t[79]=s,t[80]=u,t[81]=A):A=t[81];let j;t[82]===n.policyNoteSection?j=t[83]:(j=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=j);let M;t[84]===n.policyNoteSectionHint?M=t[85]:(M=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=M);let N;t[86]!==j||t[87]!==M?(N=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[j,M]}),t[86]=j,t[87]=M,t[88]=N):N=t[88];let P;t[89]===i?P=t[90]:(P=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=P);let F;t[91]!==r.noteEnabled||t[92]!==P?(F=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:P}),t[91]=r.noteEnabled,t[92]=P,t[93]=F):F=t[93];let I;t[94]!==n.policyNoteEnabled||t[95]!==F?(I=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[F,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=F,t[96]=I):I=t[96];let re=!r.enabled||!r.noteEnabled,L;t[97]===i?L=t[98]:(L=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=L);let R;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==re||t[103]!==L?(R=(0,Z.jsx)($,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:re,onChange:L}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=re,t[103]=L,t[104]=R):R=t[104];let ie=!r.enabled||!r.noteEnabled,z;t[105]===i?z=t[106]:(z=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=z);let B;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==ie||t[111]!==z?(B=(0,Z.jsx)($,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:ie,onChange:z}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=ie,t[111]=z,t[112]=B):B=t[112];let ae;t[113]!==R||t[114]!==B?(ae=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[R,B]}),t[113]=R,t[114]=B,t[115]=ae):ae=t[115];let oe;t[116]!==N||t[117]!==I||t[118]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[N,I,ae]}),t[116]=N,t[117]=I,t[118]=ae,t[119]=oe):oe=t[119];let se;t[120]===n.policySiteSection?se=t[121]:(se=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=se);let ce;t[122]===n.policySiteSectionHint?ce=t[123]:(ce=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=ce);let V;t[124]!==se||t[125]!==ce?(V=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[se,ce]}),t[124]=se,t[125]=ce,t[126]=V):V=t[126];let H;t[127]===i?H=t[128]:(H=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=H);let le;t[129]!==r.siteEnabled||t[130]!==H?(le=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:H}),t[129]=r.siteEnabled,t[130]=H,t[131]=le):le=t[131];let ue;t[132]!==n.policySiteEnabled||t[133]!==le?(ue=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[le,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=le,t[134]=ue):ue=t[134];let de=!r.siteEnabled,fe;t[135]===i?fe=t[136]:(fe=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=fe);let pe;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==de||t[141]!==fe?(pe=(0,Z.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:de,onChange:fe}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=de,t[141]=fe,t[142]=pe):pe=t[142];let me=!r.siteEnabled,U;t[143]===i?U=t[144]:(U=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=U);let W;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==me||t[149]!==U?(W=(0,Z.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:me,onChange:U}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=me,t[149]=U,t[150]=W):W=t[150];let G=!r.siteEnabled,ge;t[151]===i?ge=t[152]:(ge=e=>i({maxActiveSites:e}),t[151]=i,t[152]=ge);let K;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==G||t[157]!==ge?(K=(0,Z.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:G,onChange:ge}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=G,t[157]=ge,t[158]=K):K=t[158];let q=!r.siteEnabled,J;t[159]===i?J=t[160]:(J=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=J);let Y;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==q||t[165]!==J?(Y=(0,Z.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:q,onChange:J}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=q,t[165]=J,t[166]=Y):Y=t[166];let _e=!r.siteEnabled,ve;t[167]===i?ve=t[168]:(ve=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=ve);let ye;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==_e||t[173]!==ve?(ye=(0,Z.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:_e,onChange:ve}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=_e,t[173]=ve,t[174]=ye):ye=t[174];let X;t[175]!==pe||t[176]!==W||t[177]!==K||t[178]!==Y||t[179]!==ye?(X=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[pe,W,K,Y,ye]}),t[175]=pe,t[176]=W,t[177]=K,t[178]=Y,t[179]=ye,t[180]=X):X=t[180];let Q;t[181]!==V||t[182]!==ue||t[183]!==X?(Q=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[V,ue,X]}),t[181]=V,t[182]=ue,t[183]=X,t[184]=Q):Q=t[184];let be;return t[185]!==A||t[186]!==oe||t[187]!==Q?(be=(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[A,oe,Q]}),t[185]=A,t[186]=oe,t[187]=Q,t[188]=be):be=t[188],be}function $(e){let t=(0,he.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(Q(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let p;t[4]!==s||t[5]!==o||t[6]!==l?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==p||t[13]!==a?(m=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:p}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==u||t[18]!==m||t[19]!==h?(g=(0,Z.jsxs)(`div`,{children:[u,m,h]}),t[17]=u,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Se(e){let t=(0,he.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Z.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=f(Q(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===s?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Z.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,g]}),t[20]=c,t[21]=l,t[22]=d,t[23]=g,t[24]=_):_=t[24],_}function Ce(e){let t=(0,he.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:c,sessionKey:u,agentId:m}=e,h=c===void 0?`any`:c,y=g(v(Ee)),b=y.workspace,T=y.sharesSettings,E=re(Te),{data:D}=ne(_(we)?`picker-agents-list`:null,ae),O;bb0:{let e;t[0]===m?e=t[1]:(e=m?.trim(),t[0]=m,t[1]=e);let n=e;if(n){O=n;break bb0}let r;t[2]===E?r=t[3]:(r=E.trim(),t[2]=E,t[3]=r);let i=r;if(i){O=i;break bb0}if(D?.defaultId){O=D.defaultId;break bb0}if(D?.agents?.[0]?.id){O=D.agents[0].id;break bb0}O=``}let k=O,[j,M]=(0,W.useState)(k),N,P;t[4]===k?(N=t[5],P=t[6]):(N=()=>{M(k)},P=[k],t[4]=k,t[5]=N,t[6]=P),(0,W.useEffect)(N,P);let{tree:F,loading:I,error:L,loadRoot:R,loadChildren:ie,reset:z}=A(j,u??null),B;t[7]===a?B=t[8]:(B=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=B);let[V,H]=(0,W.useState)(B),ue;t[9]!==a||t[10]!==R||t[11]!==n||t[12]!==z||t[13]!==H?(ue=()=>{if(!n){z(),H(a?{path:a,isDirectory:!1}:null);return}R()},t[9]=a,t[10]=R,t[11]=n,t[12]=z,t[13]=H,t[14]=ue):ue=t[14];let de;t[15]!==a||t[16]!==R||t[17]!==n||t[18]!==j||t[19]!==z||t[20]!==u?(de=[n,j,u,R,z,a],t[15]=a,t[16]=R,t[17]=n,t[18]=j,t[19]=z,t[20]=u,t[21]=de):de=t[21],(0,W.useEffect)(ue,de);let fe;t[22]===ie?fe=t[23]:(fe=e=>{ie(e)},t[22]=ie,t[23]=fe);let pe=fe,me=V!==null&&(h===`any`||h===`file`&&!V.isDirectory||h===`directory`&&V.isDirectory),U;bb1:{if(!V){U=T.pickerHintNone;break bb1}if(h===`file`&&V.isDirectory){U=T.pickerHintNeedsFile;break bb1}if(h===`directory`&&!V.isDirectory){U=T.pickerHintNeedsDirectory;break bb1}U=`${V.isDirectory?`📁`:`📄`} ${V.path}`}let G=U,ge=D?.agents??[],K;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(x,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=K):K=t[24];let q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(q=f(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=q):q=t[25];let J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(le,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=J):J=t[26];let Y=y.cron.refresh,_e=y.cron.refresh,ve;t[27]===R?ve=t[28]:(ve=()=>void R(),t[27]=R,t[28]=ve);let ye=I&&`animate-spin`,X;t[29]===ye?X=t[30]:(X=f(`size-4`,ye),t[29]=ye,t[30]=X);let Q;t[31]===X?Q=t[32]:(Q=(0,Z.jsx)(ce,{className:X,"aria-hidden":!0}),t[31]=X,t[32]=Q);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(d,{className:`size-4`}),t[33]=be):be=t[33];let xe;t[34]!==L||t[35]!==b.loadError?(xe=L?(0,Z.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[b.loadError,`: `,L]}):null,t[34]=L,t[35]=b.loadError,t[36]=xe):xe=t[36];let $;t[37]!==pe||t[38]!==I||t[39]!==V?.path||t[40]!==H||t[41]!==b.emptyDir||t[42]!==b.title||t[43]!==F?($=I&&F.length===0?(0,Z.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Z.jsx)(l,{className:`size-4 animate-spin`}),b.title,`…`]}):(0,Z.jsx)(se,{tree:F,selectedPath:V?.path??null,onSelectFile:e=>H({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>H({path:e,isDirectory:t}),onExpandDir:pe,onAction:void 0,emptyHint:b.emptyDir}),t[37]=pe,t[38]=I,t[39]=V?.path,t[40]=H,t[41]=b.emptyDir,t[42]=b.title,t[43]=F,t[44]=$):$=t[44];let Se;t[45]!==xe||t[46]!==$?(Se=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[xe,$]}),t[45]=xe,t[46]=$,t[47]=Se):Se=t[47];let Ce;t[48]===G?Ce=t[49]:(Ce=(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:G}),t[48]=G,t[49]=Ce);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==T.cancel||t[53]!==De?(Oe=(0,Z.jsx)(p,{type:`button`,variant:`ghost`,onClick:De,children:T.cancel}),t[52]=T.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!me,Ae;t[55]!==i||t[56]!==r||t[57]!==j||t[58]!==V?(Ae=()=>{V&&(i({...V,agentId:j}),r(!1))},t[55]=i,t[56]=r,t[57]=j,t[58]=V,t[59]=Ae):Ae=t[59];let je;t[60]!==T.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Z.jsx)(p,{type:`button`,disabled:ke,onClick:Ae,children:T.pickerConfirm}),t[60]=T.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ce||t[68]!==Me?(Ne=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ce,Me]}),t[67]=Ce,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Z.jsx)(te,{open:n,onOpenChange:r,children:(0,Z.jsxs)(ee,{children:[K,(0,Z.jsxs)(C,{className:q,children:[(0,Z.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[J,(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:T.pickerTitle}),(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:Y,"aria-label":_e,disabled:I,onClick:ve,children:Q}),(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.close,children:be})})]}),ge.length>0?(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Z.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:T.pickerAgentLabel}),(0,Z.jsx)(o,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:j,onChange:e=>{M(e.target.value),H(null)},children:ge.map(e=>(0,Z.jsxs)(s,{value:e.id,children:[oe(e,y.agentsSettings),e.id===D?.defaultId?` ★`:``]},e.id))})]}):null,Se,Ne]})]})})}function we(e){return e.token}function Te(e){return e.agentId}function Ee(e){return e.language}var De=[`shares`,`policy`];function Oe(e){let t=(e??``).trim();return De.includes(t)?t:`shares`}function ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Ae(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var je=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function Me(){let e=(0,he.c)(24),t=v(Pe),n=g(t).sharesSettings,r=!!_(Ne),[a,o]=i(),s;e[0]===a?s=e[1]:(s=Oe(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,Z.jsx)(de,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=De.map(e=>({id:e,label:d[e]})),p;e[4]!==n.subtitle||e[5]!==n.title?(p=(0,Z.jsx)(ue,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=p):p=e[6];let m;e[7]!==c||e[8]!==u||e[9]!==n.tabsAria||e[10]!==f?(m=(0,Z.jsx)(U,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=c,e[8]=u,e[9]=n.tabsAria,e[10]=f,e[11]=m):m=e[11];let h;e[12]!==c||e[13]!==r||e[14]!==t||e[15]!==n?(h=c===`shares`?(0,Z.jsx)(Fe,{t:n,language:t}):(0,Z.jsx)(be,{hasToken:r}),e[12]=c,e[13]=r,e[14]=t,e[15]=n,e[16]=h):h=e[16];let y;e[17]!==c||e[18]!==h?(y=(0,Z.jsx)(fe,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[17]=c,e[18]=h,e[19]=y):y=e[19];let b;return e[20]!==p||e[21]!==m||e[22]!==y?(b=(0,Z.jsxs)(de,{children:[p,m,y]}),e[20]=p,e[21]=m,e[22]=y,e[23]=b):b=e[23],b}function Ne(e){return e.token}function Pe(e){return e.language}function Fe(e){let t=(0,he.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=ne(`shares-list`,ie,i),l;t[1]===a?.payload?.shares?l=t[2]:(l=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=l);let u=l,[d,m]=(0,W.useState)(!1),h;bb0:{if(d){h=u;break bb0}let e;t[3]===u?e=t[4]:(e=u.filter(Be),t[3]=u,t[4]=e),h=e}let g=h,_;t[5]===u?_=t[6]:(_=u.filter(ze),t[5]=u,t[6]=_);let v=_.length,y;t[7]===u?y=t[8]:(y=u.filter(Re),t[7]=u,t[8]=y);let b=y.length,x;t[9]===c?x=t[10]:(x=()=>void c(),t[9]=c,t[10]=x);let S;t[11]!==n||t[12]!==x?(S=(0,Z.jsx)(He,{t:n,onCreated:x}),t[11]=n,t[12]=x,t[13]=S):S=t[13];let ee=d?n.allSharesTitle:n.listTitle,C;t[14]===v?C=t[15]:(C=v>0&&(0,Z.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[14]=v,t[15]=C);let w;t[16]!==ee||t[17]!==C?(w=(0,Z.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[ee,C]}),t[16]=ee,t[17]=C,t[18]=w):w=t[18];let te;t[19]===c?te=t[20]:(te=()=>void c(),t[19]=c,t[20]=te);let T=s&&`animate-spin`,E;t[21]===T?E=t[22]:(E=f(`size-3.5`,T),t[21]=T,t[22]=E);let D;t[23]===E?D=t[24]:(D=(0,Z.jsx)(ce,{className:E}),t[23]=E,t[24]=D);let O;t[25]!==s||t[26]!==te||t[27]!==D?(O=(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:te,disabled:s,children:D}),t[25]=s,t[26]=te,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==b||t[30]!==d||t[31]!==n.hideExpired||t[32]!==n.showExpired?(k=b>0&&(0,Z.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Le),children:d?n.hideExpired:n.showExpired}),t[29]=b,t[30]=d,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=k):k=t[33];let A;t[34]!==O||t[35]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==w||t[38]!==A?(j=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[w,A]}),t[37]=w,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==a||t[41]!==o||t[42]!==g||t[43]!==s||t[44]!==r||t[45]!==c||t[46]!==n?(M=s&&!a?(0,Z.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Ie)}):o?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Z.jsx)(`span`,{children:n.error}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Z.jsx)(We,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[40]=a,t[41]=o,t[42]=g,t[43]=s,t[44]=r,t[45]=c,t[46]=n,t[47]=M):M=t[47];let N;t[48]!==b||t[49]!==c||t[50]!==d||t[51]!==n?(N=b>0&&d&&(0,Z.jsx)(Ge,{t:n,onCleaned:()=>void c()}),t[48]=b,t[49]=c,t[50]=d,t[51]=n,t[52]=N):N=t[52];let P;t[53]!==j||t[54]!==M||t[55]!==N?(P=(0,Z.jsxs)(me,{children:[j,M,N]}),t[53]=j,t[54]=M,t[55]=N,t[56]=P):P=t[56];let F;return t[57]!==P||t[58]!==S?(F=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,P]}),t[57]=P,t[58]=S,t[59]=F):F=t[59],F}function Ie(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(V,{className:`h-4 w-2/3`}),(0,Z.jsx)(V,{className:`mt-2 h-3 w-1/2`})]}),(0,Z.jsx)(V,{className:`h-7 w-20 rounded-md`})]})},t)}function Le(e){return!e}function Re(e){return e.expired||e.revoked}function ze(e){return!e.expired&&!e.revoked}function Be(e){return!e.expired&&!e.revoked}var Ve={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function He({t:e,onCreated:t}){let[n,r]=(0,W.useReducer)(R,Ve),{expanded:i,path:a,isDirectory:c,agentId:d,ttlMs:m,maxViews:h,description:g,directoryMode:_,creating:v,result:y,errorMsg:b,resultDialogOpen:x,pickerOpen:S}=n,ee=(0,W.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await H({path:a.trim(),ttlMs:m,maxViews:h,description:g.trim()||void 0,...d?{agentId:d}:{},...c?{kind:`directory`,directoryMode:_}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,c,d,m,h,g,_,t]),C=(0,W.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Z.jsxs)(me,{children:[(0,Z.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Z.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:f(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:c?`📁`:`📄`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Z.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Z.jsxs)(p,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Z.jsx)(B,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),c?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Z.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:_,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Z.jsx)(s,{value:`browse`,children:e.directoryModeBrowse}),(0,Z.jsx)(s,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Z.jsx)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:m,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:je.map(t=>(0,Z.jsx)(s,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Z.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:h??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Z.jsx)(s,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Z.jsx)(s,{value:`1`,children:`1`}),(0,Z.jsx)(s,{value:`5`,children:`5`}),(0,Z.jsx)(s,{value:`10`,children:`10`}),(0,Z.jsx)(s,{value:`50`,children:`50`}),(0,Z.jsx)(s,{value:`100`,children:`100`})]})]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Z.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:g,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Z.jsxs)(p,{type:`button`,disabled:v||!a.trim(),onClick:()=>void ee(),children:[v?(0,Z.jsx)(l,{className:`size-4 animate-spin`}):(0,Z.jsx)(u,{className:`size-4`}),v?e.creating:e.createButton]}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>{C(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),b&&(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b})]}),(0,Z.jsx)(I,{open:x,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:y}),(0,Z.jsx)(Ce,{open:S,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Z.jsxs)(p,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Z.jsx)(u,{className:`size-4`}),e.createTitle]})}var Ue={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function We({share:e,t,language:n,onRevoked:r,onExtended:i}){let[o,s]=(0,W.useReducer)(R,Ue),{revokeOpen:u,revoking:d,linksOpen:m,urlCopied:g,copyFailed:_,extending:v}=o,y=!e.expired&&!e.revoked,b=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,x=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,S=(0,W.useCallback)(async()=>{s({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await L(e.id),r()}catch{}finally{s({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),ee=(0,W.useCallback)(async()=>{if(s({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await h(e.shareUrl)){s({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{copyFailed:!1}}),2500);return}s({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),C=(0,W.useCallback)(async()=>{s({type:`patch`,patch:{extending:!0}});try{await M(e.id,864e5),i()}catch{}finally{s({type:`patch`,patch:{extending:!1}})}},[e.id,i]),w=`share-links-${e.id}`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:f(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":m,"aria-controls":w,onClick:()=>s({type:`patch`,patch:{linksOpen:!m}}),children:[(0,Z.jsx)(j,{className:f(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,m?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,Z.jsx)(k,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Z.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Z.jsx)(`span`,{className:f(`text-xs font-medium`,x),children:b})]}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:ke(e.fileSize)}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(P,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Ae(e.expiresAt,n)]}),(0,Z.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Z.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void ee(),children:g?(0,Z.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,Z.jsx)(c,{className:`size-3.5`})}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void C(),disabled:v,title:t.extend,children:v?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(P,{className:`size-3.5`})}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>s({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(F,{className:`size-3.5`})})]})})]}),y&&m?(0,Z.jsxs)(`div`,{id:w,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Z.jsx)(D,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),_?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(z,{reachability:e.reachability})})]}):null]}),(0,Z.jsx)(O,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void S(),onCancel:()=>s({type:`patch`,patch:{revokeOpen:!1}})})]})}function Ge({t:e,onCleaned:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),o=(0,W.useCallback)(async()=>{r(!1),a(!0);try{await N(),t()}catch{}finally{a(!1)}},[t]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(p,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(F,{className:`size-3.5`}),e.cleanExpired]})}),(0,Z.jsx)(O,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Me as SharesSettingsPanel};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./locale-store-CXhjfe4q.js";import{Er as r}from"./index-BNWhgmjs.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};