@xopcai/xopc 0.0.175 → 0.0.177

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 (286) 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-CM6mQUS2.js → activity-store-Wu2ikfbM.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-eckyE9AY.js → agent-avatar-dicebear-B0_biISn.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-TpIpJk59.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-BfMRS6FX.js → api-DljBt-N5.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DYkzZQzZ.js → app-management-settings-panel-CKoZRi7Y.js} +1 -1
  8. package/dist/gateway/static/root/assets/appearance-settings-DOdXhNDo.js +1 -0
  9. package/dist/gateway/static/root/assets/apps-page-Cxbn5hy8.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-k909a76t.js → archive-plugin-D18gyP76.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CqNzyhdJ.js → attachment-load-CZh9fc8u.js} +2 -2
  12. package/dist/gateway/static/root/assets/{attachment-preview-renderer-DonnL2dL.js → attachment-preview-renderer-Cmo-5BP5.js} +2 -2
  13. package/dist/gateway/static/root/assets/{attachment-process-heavy-RnGYy9bC.js → attachment-process-heavy-B2_kr5EA.js} +3 -3
  14. package/dist/gateway/static/root/assets/{automation-suggestion-card-snNG6u0v.js → automation-suggestion-card-DKrVoiiK.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-page-DYv16QMU.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-PfQ9ZHDF.js → binary-plugins-DdSyGL6M.js} +2 -2
  17. package/dist/gateway/static/root/assets/{block-editor-Xrw-DnE_.js → block-editor-BOpNApiX.js} +6 -6
  18. package/dist/gateway/static/root/assets/{browser-settings-page-G92AdEnX.js → browser-settings-page-DlcqaGu1.js} +4 -4
  19. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DJPF2lUY.js → browser-workflow-inputs-C0SnSj_R.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-workflows-page-BoXs4pgc.js → browser-workflows-page-CzlzH7HA.js} +2 -2
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-QPX4wsGZ.js +7 -0
  22. package/dist/gateway/static/root/assets/{capability-presets-api-BgY-Ysmi.js → capability-presets-api-RM6S7ES5.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DmCeusO8.js +1 -0
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-D32T1EJM.js → channel-recipient-api-B4sha-30.js} +1 -1
  25. package/dist/gateway/static/root/assets/channels-settings-HcKoP1wm.js +1 -0
  26. package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +1 -0
  27. package/dist/gateway/static/root/assets/{connector-logo-C-l8haIK.js → connector-logo-BPsKIyoM.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-DwbThFvd.js +2 -0
  29. package/dist/gateway/static/root/assets/desktop-pet-DjL1GWON.js +1 -0
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-Cldo_pA3.js → desktop-pet-settings-u_abAXh7.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-CMASXbgJ.js → directory-picker-path-field-BoZGualI.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dreaming-settings-BnMx02w0.js → dreaming-settings-s3gn3f9h.js} +3 -3
  33. package/dist/gateway/static/root/assets/{extension-debug-page-mUFs3ign.js → extension-debug-page-DIbMngCF.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BsFBOZ5N.js → extension-page-D94f2bWQ.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-CTEoovnV.js → extension-settings-page-B7TI13ex.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-Bwx-EetD.js → gateway-config-api-Do77rV8R.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CvgyqhR_.js → gateway-settings-Dt1PNJmb.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C8f5KwkT.js → gateway-startup-retry-WaXTw3fi.js} +1 -1
  39. package/dist/gateway/static/root/assets/{goal-create-dialog-Bhynl9LN.js → goal-create-dialog-DEiOOLGU.js} +1 -1
  40. package/dist/gateway/static/root/assets/goal-detail-page-C1Qj4o1K.js +4 -0
  41. package/dist/gateway/static/root/assets/{goals-config-api-CUnfbgHa.js → goals-config-api-BL0fAEns.js} +1 -1
  42. package/dist/gateway/static/root/assets/{goals-page-BAS_liXl.js → goals-page-qJDcEDzc.js} +2 -2
  43. package/dist/gateway/static/root/assets/{goals-settings-Bkk-tOcf.js → goals-settings-DV3ZlrdI.js} +1 -1
  44. package/dist/gateway/static/root/assets/{heartbeat-settings-D9Pldf5E.js → heartbeat-settings-C3kzg6ai.js} +1 -1
  45. package/dist/gateway/static/root/assets/{image-generation-api-D7aCMgOv.js → image-generation-api-BgISY8i-.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-C1h0zkNo.js +212 -0
  47. package/dist/gateway/static/root/assets/index-Da36E3WH.css +1 -0
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CBhtXhHb.js → keyboard-shortcuts-settings-0KSmaPu0.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-DcD4mVId.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-BtJGF3M8.js → local-apps-page-BMrU8u7w.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-DO-u1yS7.js → locale-store-DVGhFXRz.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-0lvwfLAA.js → logs-page-CW5m9Cov.js} +3 -3
  53. package/dist/gateway/static/root/assets/{markdown-split-BGPaeTch.js → markdown-split-BVqbtN9o.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-C_Cx8v6u.js → media-plugins-Dr_wtkNJ.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +3 -0
  56. package/dist/gateway/static/root/assets/{notes-page-CIYy5BKF.js → notes-page-BWZRXsq6.js} +1 -1
  57. package/dist/gateway/static/root/assets/notes-workbench-DdnwNz9x.js +4 -0
  58. package/dist/gateway/static/root/assets/{page-tabs-C2vsdfJO.js → page-tabs-DWWgy0bF.js} +1 -1
  59. package/dist/gateway/static/root/assets/pdf-D4PI9qAw.js +54 -0
  60. package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-D_VT83bW.js → preview-open-alternatives-Bnfs93ZP.js} +1 -1
  62. package/dist/gateway/static/root/assets/{product-open-page-BNP9kZ3Q.js → product-open-page-BR7QFmT-.js} +1 -1
  63. package/dist/gateway/static/root/assets/project-detail-page-B8GeS4dl.js +1 -0
  64. package/dist/gateway/static/root/assets/projects-page-DOeu1Hk_.js +1 -0
  65. package/dist/gateway/static/root/assets/remote-access-hub-De94rxnE.js +1 -0
  66. package/dist/gateway/static/root/assets/{save-bar-controls-BJL6Xb-F.js → save-bar-controls-BzS-rRTP.js} +1 -1
  67. package/dist/gateway/static/root/assets/{schedule-field-CxCPSLbu.js → schedule-field-Cl2IIDAN.js} +1 -1
  68. package/dist/gateway/static/root/assets/{schema-form-Cao1wGbk.js → schema-form-BjKjp5eZ.js} +1 -1
  69. package/dist/gateway/static/root/assets/sessions-page-A7p8G0OJ.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-form-section-9pgClEud.js → settings-form-section-BSDNBfHn.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CQz0gEUK.js → settings-loading-skeleton-BD4peoAv.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-page-DgsMzZLm.js → settings-page-S-P3U7at.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-page-layout-BhqupMfG.js → settings-page-layout-BQTLh-86.js} +1 -1
  75. package/dist/gateway/static/root/assets/{setup-status-panel-B7BsWxJt.js → setup-status-panel-W3p6kNyA.js} +1 -1
  76. package/dist/gateway/static/root/assets/{share-preview-page-CC4dQsQN.js → share-preview-page-DQjMxyvw.js} +2 -2
  77. package/dist/gateway/static/root/assets/shares-settings-Xo3N99PO.js +1 -0
  78. package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +1 -0
  79. package/dist/gateway/static/root/assets/skills-page-C019Ml5q.js +2 -0
  80. package/dist/gateway/static/root/assets/{skills-page.utils-CF4AYPQg.js → skills-page.utils-CXnpudm6.js} +1 -1
  81. package/dist/gateway/static/root/assets/{system-settings-panel-CzZHWI4u.js → system-settings-panel-BhFwdYJP.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-BZWNdSZC.js → theme-store-DQI-HPL-.js} +1 -1
  83. package/dist/gateway/static/root/assets/{time-picker-BC922Mdg.js → time-picker-C0DCya4U.js} +1 -1
  84. package/dist/gateway/static/root/assets/{typed-models-lib-C1S-B1pk.js → typed-models-lib-C-M3Fv2N.js} +1 -1
  85. package/dist/gateway/static/root/assets/{use-channel-catalog-DTiLxcLF.js → use-channel-catalog-Bndq4y4I.js} +1 -1
  86. package/dist/gateway/static/root/assets/user-context-page-fYBzpus-.js +1 -0
  87. package/dist/gateway/static/root/assets/{voice-api-key-field-CtIYRNfI.js → voice-api-key-field-p_g4UI1-.js} +1 -1
  88. package/dist/gateway/static/root/assets/work-discovery-page-DI0gCZRw.js +1 -0
  89. package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +1 -0
  90. package/dist/gateway/static/root/assets/work-page-Z-nUaS_n.js +3 -0
  91. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CHEXVvhH.js +3 -0
  92. package/dist/gateway/static/root/assets/workflows-page-BDfwnM-Y.js +11 -0
  93. package/dist/gateway/static/root/index.html +7 -7
  94. package/dist/package.js +1 -1
  95. package/dist/src/agent/agent-manager.js +7 -7
  96. package/dist/src/agent/context/execution-scope.d.ts +26 -0
  97. package/dist/src/agent/context/execution-scope.js +84 -0
  98. package/dist/src/agent/context/project-context.d.ts +3 -1
  99. package/dist/src/agent/context/project-context.js +26 -8
  100. package/dist/src/agent/embedded/model-runtime.d.ts +1 -2
  101. package/dist/src/agent/embedded/model-runtime.js +17 -29
  102. package/dist/src/agent/embedded/session-runner.js +2 -3
  103. package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
  104. package/dist/src/agent/prompt/system-prompt.js +1 -1
  105. package/dist/src/agent/service/process-direct-streaming.js +7 -4
  106. package/dist/src/agent/session/session-config-service.d.ts +4 -1
  107. package/dist/src/agent/session/session-config-service.js +5 -3
  108. package/dist/src/agent/session/session-inspector.d.ts +6 -0
  109. package/dist/src/agent/session/session-inspector.js +9 -2
  110. package/dist/src/agent/workflow/subagent-runner.js +2 -0
  111. package/dist/src/agent/workflow/types.d.ts +1 -0
  112. package/dist/src/auth/model-credential-store.d.ts +17 -0
  113. package/dist/src/auth/model-credential-store.js +110 -0
  114. package/dist/src/auth/oauth/github-copilot.js +2 -2
  115. package/dist/src/auth/oauth/openai-codex.js +98 -7
  116. package/dist/src/auth/oauth/types.d.ts +4 -1
  117. package/dist/src/auth/oauth/xopc-cloud.js +124 -6
  118. package/dist/src/automations/service/automation-service.d.ts +3 -0
  119. package/dist/src/automations/service/automation-service.js +37 -7
  120. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  121. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  122. package/dist/src/config/agent-profile.js +1 -1
  123. package/dist/src/config/index.js +2 -2
  124. package/dist/src/config/schema.d.ts +21 -0
  125. package/dist/src/config/schema.js +12 -2
  126. package/dist/src/gateway/agents-admin.js +1 -1
  127. package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
  128. package/dist/src/gateway/hono/lib/config-payload.js +1 -0
  129. package/dist/src/gateway/hono/oauth-async.d.ts +5 -0
  130. package/dist/src/gateway/hono/oauth-async.js +20 -8
  131. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  132. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +1 -1
  133. package/dist/src/gateway/hono/routes/config-patch/gateway.js +9 -0
  134. package/dist/src/gateway/hono/routes/goals.js +13 -0
  135. package/dist/src/gateway/hono/routes/home.d.ts +18 -2
  136. package/dist/src/gateway/hono/routes/home.js +19 -0
  137. package/dist/src/gateway/hono/routes/index.js +2 -2
  138. package/dist/src/gateway/hono/routes/proactive.d.ts +4 -0
  139. package/dist/src/gateway/hono/routes/proactive.js +157 -0
  140. package/dist/src/gateway/hono/routes/projects.js +2 -2
  141. package/dist/src/gateway/service/sessions-api.d.ts +2 -1
  142. package/dist/src/gateway/service.d.ts +10 -1
  143. package/dist/src/gateway/service.js +31 -31
  144. package/dist/src/infra/update-restart.js +1 -1
  145. package/dist/src/mobile/notification-service.d.ts +1 -0
  146. package/dist/src/mobile/notification-service.js +38 -18
  147. package/dist/src/mobile/notification-types.d.ts +2 -2
  148. package/dist/src/proactive/events/envelope.d.ts +2 -0
  149. package/dist/src/proactive/events/envelope.js +54 -0
  150. package/dist/src/proactive/events/publisher.d.ts +4 -0
  151. package/dist/src/proactive/events/repository.d.ts +9 -0
  152. package/dist/src/proactive/events/repository.js +62 -0
  153. package/dist/src/proactive/events/types.d.ts +44 -0
  154. package/dist/src/proactive/events/types.js +15 -0
  155. package/dist/src/proactive/execution/agent-executor.d.ts +16 -0
  156. package/dist/src/proactive/execution/agent-executor.js +104 -0
  157. package/dist/src/proactive/execution/context.d.ts +31 -0
  158. package/dist/src/proactive/execution/context.js +72 -0
  159. package/dist/src/proactive/execution/insight.d.ts +4 -0
  160. package/dist/src/proactive/execution/insight.js +74 -0
  161. package/dist/src/proactive/execution/repository.d.ts +23 -0
  162. package/dist/src/proactive/execution/repository.js +122 -0
  163. package/dist/src/proactive/execution/types.d.ts +54 -0
  164. package/dist/src/proactive/execution/types.js +1 -0
  165. package/dist/src/proactive/execution/worker.d.ts +15 -0
  166. package/dist/src/proactive/execution/worker.js +96 -0
  167. package/dist/src/proactive/inbox/repository.d.ts +24 -0
  168. package/dist/src/proactive/inbox/repository.js +117 -0
  169. package/dist/src/proactive/inbox/service.d.ts +17 -0
  170. package/dist/src/proactive/inbox/service.js +22 -0
  171. package/dist/src/proactive/inbox/types.d.ts +38 -0
  172. package/dist/src/proactive/inbox/types.js +1 -0
  173. package/dist/src/proactive/inbox/worker.d.ts +12 -0
  174. package/dist/src/proactive/inbox/worker.js +56 -0
  175. package/dist/src/proactive/index.d.ts +17 -0
  176. package/dist/src/proactive/index.js +11 -0
  177. package/dist/src/proactive/routing/batch-repository.d.ts +27 -0
  178. package/dist/src/proactive/routing/batch-repository.js +56 -0
  179. package/dist/src/proactive/routing/matcher.d.ts +5 -0
  180. package/dist/src/proactive/routing/matcher.js +56 -0
  181. package/dist/src/proactive/routing/types.d.ts +44 -0
  182. package/dist/src/proactive/routing/types.js +1 -0
  183. package/dist/src/proactive/scenarios/prompt-composer.d.ts +14 -0
  184. package/dist/src/proactive/scenarios/prompt-composer.js +24 -0
  185. package/dist/src/proactive/scenarios/repository.d.ts +23 -0
  186. package/dist/src/proactive/scenarios/repository.js +162 -0
  187. package/dist/src/proactive/scenarios/service.d.ts +15 -0
  188. package/dist/src/proactive/scenarios/service.js +26 -0
  189. package/dist/src/proactive/scenarios/types.d.ts +36 -0
  190. package/dist/src/proactive/scenarios/types.js +1 -0
  191. package/dist/src/proactive/service.d.ts +18 -0
  192. package/dist/src/proactive/service.js +61 -0
  193. package/dist/src/projects/project-service.d.ts +3 -1
  194. package/dist/src/projects/project-service.js +62 -32
  195. package/dist/src/providers/index.js +4 -2
  196. package/dist/src/providers/provider-auth-service.d.ts +22 -0
  197. package/dist/src/providers/provider-auth-service.js +66 -0
  198. package/dist/src/providers/register-runtime-providers.d.ts +6 -0
  199. package/dist/src/providers/register-runtime-providers.js +55 -0
  200. package/dist/src/providers/xopc-cloud-account-service.d.ts +2 -2
  201. package/dist/src/providers/xopc-cloud-account-service.js +6 -5
  202. package/dist/src/providers/xopc-cloud-config.d.ts +3 -0
  203. package/dist/src/providers/xopc-cloud-config.js +13 -0
  204. package/dist/src/providers/xopc-cloud-model-source.d.ts +2 -2
  205. package/dist/src/providers/xopc-cloud-model-source.js +6 -5
  206. package/dist/src/session/index.d.ts +1 -1
  207. package/dist/src/session/index.js +2 -2
  208. package/dist/src/session/thinking-resolve.d.ts +8 -0
  209. package/dist/src/session/thinking-resolve.js +6 -3
  210. package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +71 -0
  211. package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +69 -0
  212. package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +55 -0
  213. package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +45 -0
  214. package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +14 -0
  215. package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +13 -0
  216. package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +5 -0
  217. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  218. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  219. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  220. package/dist/src/storage/sqlite/schema.js +1 -1
  221. package/dist/src/tui/tui.js +2 -2
  222. package/dist/src/tui/xopc-tui-keybindings.d.ts +44 -4
  223. package/dist/src/work-discovery/thread-service.d.ts +1 -3
  224. package/dist/src/work-discovery/thread-service.js +13 -25
  225. package/dist/src/work-items/work-item-service.d.ts +3 -1
  226. package/dist/src/work-items/work-item-service.js +67 -36
  227. package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
  228. package/dist/src/workflows/engine/workflow-engine.js +2 -0
  229. package/dist/src/workflows/service/workflow-run-service.js +12 -6
  230. package/dist/src/workflows/service/workflow-session-bridge.js +2 -1
  231. package/package.json +5 -5
  232. package/dist/gateway/static/root/assets/agents-D-OIB_r0.js +0 -2
  233. package/dist/gateway/static/root/assets/api-2SLLStKp.js +0 -1
  234. package/dist/gateway/static/root/assets/appearance-settings-CDXXN57j.js +0 -1
  235. package/dist/gateway/static/root/assets/apps-page-CuvFyvuu.js +0 -1
  236. package/dist/gateway/static/root/assets/automations-page-DetGVTjI.js +0 -6
  237. package/dist/gateway/static/root/assets/capabilities-settings-panel-nS_AMN1K.js +0 -7
  238. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DIO8ZNHW.js +0 -1
  239. package/dist/gateway/static/root/assets/channels-settings-4Im3vtnO.js +0 -1
  240. package/dist/gateway/static/root/assets/channels-status-swr-CMctpuqb.js +0 -1
  241. package/dist/gateway/static/root/assets/connectors-page-vL3SjHSc.js +0 -2
  242. package/dist/gateway/static/root/assets/copy-VueTIC2x.js +0 -1
  243. package/dist/gateway/static/root/assets/desktop-pet-CwOI_Hei.js +0 -1
  244. package/dist/gateway/static/root/assets/focus-detail-page-CCaZthpU.js +0 -1
  245. package/dist/gateway/static/root/assets/goal-detail-page-ChS2rU0w.js +0 -4
  246. package/dist/gateway/static/root/assets/index-DJ5vdaHk.css +0 -1
  247. package/dist/gateway/static/root/assets/index-TnouSpay.js +0 -212
  248. package/dist/gateway/static/root/assets/local-app-workbench-page-HQeu_F1C.js +0 -2
  249. package/dist/gateway/static/root/assets/messages-BP8aQX-5.js +0 -3
  250. package/dist/gateway/static/root/assets/notes-workbench-_FgNPlOx.js +0 -4
  251. package/dist/gateway/static/root/assets/pdf-epILhEOn.js +0 -54
  252. package/dist/gateway/static/root/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
  253. package/dist/gateway/static/root/assets/project-detail-page-MNi-3mZU.js +0 -1
  254. package/dist/gateway/static/root/assets/projects-page-xx8nUKZO.js +0 -1
  255. package/dist/gateway/static/root/assets/remote-access-hub-H5DSn2bR.js +0 -1
  256. package/dist/gateway/static/root/assets/sessions-page-CMQsupwM.js +0 -1
  257. package/dist/gateway/static/root/assets/settings-advanced-gate-OBUdG6bV.js +0 -1
  258. package/dist/gateway/static/root/assets/shares-settings-Bhz21P05.js +0 -1
  259. package/dist/gateway/static/root/assets/skill-reload-api-CBP-UB88.js +0 -1
  260. package/dist/gateway/static/root/assets/skills-page-A0rNObNB.js +0 -2
  261. package/dist/gateway/static/root/assets/user-context-page-8XdpiAyP.js +0 -1
  262. package/dist/gateway/static/root/assets/work-discovery-page-DBer86NF.js +0 -1
  263. package/dist/gateway/static/root/assets/work-item-detail-page-BUPyfYaq.js +0 -1
  264. package/dist/gateway/static/root/assets/work-page-G8phwwI1.js +0 -1
  265. package/dist/gateway/static/root/assets/workflow-run-setup-panel-IKxqDAXw.js +0 -3
  266. package/dist/gateway/static/root/assets/workflows-page-CNls7g6v.js +0 -11
  267. package/dist/src/focuses/candidate-repository.d.ts +0 -15
  268. package/dist/src/focuses/candidate-repository.js +0 -91
  269. package/dist/src/focuses/index.d.ts +0 -7
  270. package/dist/src/focuses/index.js +0 -7
  271. package/dist/src/focuses/insight-repository.d.ts +0 -22
  272. package/dist/src/focuses/insight-repository.js +0 -77
  273. package/dist/src/focuses/prompts.d.ts +0 -2
  274. package/dist/src/focuses/prompts.js +0 -18
  275. package/dist/src/focuses/reconciler.d.ts +0 -5
  276. package/dist/src/focuses/reconciler.js +0 -26
  277. package/dist/src/focuses/repository.d.ts +0 -61
  278. package/dist/src/focuses/repository.js +0 -214
  279. package/dist/src/focuses/run-processor.d.ts +0 -18
  280. package/dist/src/focuses/run-processor.js +0 -162
  281. package/dist/src/focuses/service.d.ts +0 -42
  282. package/dist/src/focuses/service.js +0 -241
  283. package/dist/src/focuses/types.d.ts +0 -89
  284. package/dist/src/gateway/hono/routes/focuses.d.ts +0 -3
  285. package/dist/src/gateway/hono/routes/focuses.js +0 -319
  286. /package/dist/src/{focuses/types.js → proactive/events/publisher.js} +0 -0
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
+ 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"./preload-helper-zJ_50EbN.js";import{c as a,f as o,l as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./circle-alert-BEjgurr2.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./messages-r8L6Ur3A.js";import{l as d,n as f}from"./locale-store-DVGhFXRz.js";import{t as p}from"./config-reload-event-Bjh2zoKp.js";import{$r as m,Ac as h,As as g,Bo as _,Go as v,Gs as y,Hl as b,Ji as x,Ki as S,Ks as C,Ns as w,To as T,Uo as E,Vo as D,Wl as O,Wo as k,gc as A,gu as j,hu as M,nc as N,oa as P,pu as F,tl as I,ts as L,vl as R,wo as z,ws as B,zo as ee}from"./index-C1h0zkNo.js";import{t as V}from"./page-tabs-DWWgy0bF.js";import{t as H}from"./skill-reload-api-ByPEG5t1.js";import{a as U,c as W,d as te,f as G,g as K,h as q,i as ne,l as J,m as Y,n as X,o as re,p as ie,r as ae,s as oe,t as se,u as ce}from"./skills-page.utils-CXnpudm6.js";var le=n(),Z=e(t(),1),Q=r(),ue=(0,Z.memo)(function(e){let t=(0,le.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,Q.jsx)(P,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(A,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,m;t[8]!==i||t[9]!==f||t[10]!==p?(m=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:f,placeholder:p,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[8]=i,t[9]=f,t[10]=p,t[11]=m):m=t[11];let _;t[12]!==l||t[13]!==c?(_=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=_):_=t[14];let v;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=v):v=t[15];let y;t[16]!==s.installCta||t[17]!==_?(y=(0,Q.jsxs)(g,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:_,children:[v,s.installCta]}),t[16]=s.installCta,t[17]=_,t[18]=y):y=t[18];let b;return t[19]!==u||t[20]!==m||t[21]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,m,y]}),t[19]=u,t[20]=m,t[21]=y,t[22]=b):b=t[22],b}),de=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function fe(){let e=(0,le.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:l(`h-4 min-w-0 flex-1`,de)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(`div`,{className:l(`size-8 shrink-0 rounded-lg`,de)}),(0,Q.jsx)(`div`,{className:l(`h-8 w-[4.5rem] shrink-0 rounded-lg`,de)})]})]}),r=(0,Q.jsx)(`div`,{className:l(`h-3 w-full`,de)}),i=(0,Q.jsx)(`div`,{className:l(`h-3 w-[92%]`,de)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,Q.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,Q.jsx)(`div`,{className:l(`h-3 w-full`,de)}),(0,Q.jsx)(`div`,{className:l(`h-2.5 w-4/5`,de)})]})]})})}),e[4]=a):a=e[4],a}function pe(){let e=(0,le.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(fe,{}),e[0]=t):t=e[0],t}var me=new Set([`installed`,`marketplace`]),he=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),ge=new Set([`all`,`enabled`,`disabled`]),_e=`mprov`,ve=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],ye=[`business`,`creative`,`documents`,`engineering`,`tools`];function be(e){let t=(0,le.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:u,catalogDisplayRows:d,catalogStatusFilter:f,resolveSkillEnabled:p,categoryLabel:m,sourceLabel:h,openSkillDetail:_,onSkillToggle:v,onUseSkillInChat:y,usingSkillInChatName:b,togglingSkillName:x}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=ve.map(xe),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(a.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let S;t[7]!==o||t[8]!==s||t[9]!==m||t[10]!==u||t[11]!==n?(S=o.length>1?(0,Q.jsx)(V,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:m(e),title:m(e)}))],activeTab:s,onChange:u,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=o,t[8]=s,t[9]=m,t[10]=u,t[11]=n,t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==f||t[15]!==v||t[16]!==y||t[17]!==_||t[18]!==p||t[19]!==n||t[20]!==h||t[21]!==x||t[22]!==b?(C=d.length===0?(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:f===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>{let t=p(e);return(0,Q.jsxs)(`article`,{className:l(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,Q.jsx)(`button`,{type:`button`,className:l(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,B.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void _(e),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,Q.jsxs)(`span`,{className:l(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,Q.jsx)(F,{className:`size-3`,"aria-hidden":!0}):(0,Q.jsx)(c,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]})]}),(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:h(e.source)}),e.managed?(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,Q.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})}),(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:t?(0,Q.jsx)(g,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name||x===e.name,onClick:()=>void y({name:e.name,source:`catalog`}),children:b===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,Q.jsx)(g,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===e.name,onClick:()=>void v(e.name,!0),children:x===e.name?n.uploading:n.detailModalEnable})})]},`${e.directoryId}-${e.path}`)})}),t[13]=d,t[14]=f,t[15]=v,t[16]=y,t[17]=_,t[18]=p,t[19]=n,t[20]=h,t[21]=x,t[22]=b,t[23]=C):C=t[23];let w;return t[24]!==S||t[25]!==C?(w=(0,Q.jsxs)(Q.Fragment,{children:[S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26],w}function xe(e){return(0,Q.jsx)(pe,{},e)}function Se(e){let t=(0,le.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?X(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,Q.jsx)(g,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let h;t[16]===s?h=t[17]:(h=()=>void s(),t[16]=s,t[17]=h);let _;t[18]!==n.deleteConfirm||t[19]!==h?(_=(0,Q.jsx)(g,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:h,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=h,t[20]=_):_=t[20];let y;t[21]!==m||t[22]!==_?(y=(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,_]}),t[21]=m,t[22]=_,t[23]=y):y=t[23];let b;t[24]!==y||t[25]!==u||t[26]!==f?(b=(0,Q.jsxs)(k,{children:[l,(0,Q.jsxs)(D,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,y]})]}),t[24]=y,t[25]=u,t[26]=f,t[27]=b):b=t[27];let x;return t[28]!==r||t[29]!==c||t[30]!==b?(x=(0,Q.jsx)(ee,{open:r,onOpenChange:c,children:b}),t[28]=r,t[29]=c,t[30]=b,t[31]=x):x=t[31],x}function Ce(e){let t=(0,le.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function we(e){let t=(0,le.c)(118),{preview:n,sk:r}=e,i=n.metadata,a=n.toolConditions,o=!!a&&(a.requiresTools.length>0||a.requiresToolsets.length>0||a.fallbackForTools.length>0||a.fallbackForToolsets.length>0),s=i.requires,c=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),u,d,f,p,m,h,g,_,v,y,b,S,C,w,T;if(t[0]!==a||t[1]!==c||t[2]!==o||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==s||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(De)??[],x=n.requiredEnvVarNames?.filter(Ee)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,Q.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=h),v=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?y=t[44]:(y=i.emoji?.trim()?(0,Q.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=y);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=l(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(b=(0,Q.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=b):b=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(S=n.disableModelInvocation?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=S):S=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,Q.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(C=(0,Q.jsx)(Ce,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=C):C=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(w=(0,Q.jsx)(Ce,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=w):w=t[64];let A;t[65]!==c||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=c&&s?(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),s.anyBins.join(`, `)]}):null]}):null,t[65]=c,t[66]=s,t[67]=r.detailRequiresAnyBins,t[68]=r.detailRequiresBins,t[69]=r.detailRequiresEnv,t[70]=A):A=t[70],t[71]!==r.detailRequiresLabel||t[72]!==A?(T=(0,Q.jsx)(Ce,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=T):T=t[73];let j=e.length>0?(0,Q.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Te)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,Q.jsx)(Ce,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==a||t[78]!==o||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=o&&a?(0,Q.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),a.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=a,t[78]=o,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,Q.jsx)(Ce,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],u=Ce,d=r.detailEnvVarsLabel,_=x.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:x.join(`, `)}):null,t[0]=a,t[1]=c,t[2]=o,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=s,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=S,t[38]=C,t[39]=w,t[40]=T}else u=t[26],d=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],y=t[35],b=t[36],S=t[37],C=t[38],w=t[39],T=t[40];let E;t[87]!==u||t[88]!==d||t[89]!==_?(E=(0,Q.jsx)(u,{label:d,children:_}),t[87]=u,t[88]=d,t[89]=_,t[90]=E):E=t[90];let D;t[91]!==f||t[92]!==p||t[93]!==E||t[94]!==v||t[95]!==y||t[96]!==b||t[97]!==S||t[98]!==C||t[99]!==w||t[100]!==T?(D=(0,Q.jsxs)(`div`,{className:v,children:[y,b,S,C,w,T,f,p,E]}),t[91]=f,t[92]=p,t[93]=E,t[94]=v,t[95]=y,t[96]=b,t[97]=S,t[98]=C,t[99]=w,t[100]=T,t[101]=D):D=t[101];let O;t[102]!==m||t[103]!==h||t[104]!==D?(O=(0,Q.jsxs)(`section`,{"aria-labelledby":m,children:[h,D]}),t[102]=m,t[103]=h,t[104]=D,t[105]=O):O=t[105];let k;t[106]===r.detailInstructionsHeading?k=t[107]:(k=(0,Q.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=k);let A;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(A=n.bodyMarkdown.trim()?(0,Q.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,Q.jsx)(x,{content:n.bodyMarkdown})}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=A):A=t[110];let j;t[111]!==k||t[112]!==A?(j=(0,Q.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[k,A]}),t[111]=k,t[112]=A,t[113]=j):j=t[113];let M;return t[114]!==g||t[115]!==O||t[116]!==j?(M=(0,Q.jsxs)(`div`,{className:g,children:[O,j]}),t[114]=g,t[115]=O,t[116]=j,t[117]=M):M=t[117],M}function Te(e,t){return(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,Q.jsx)(`span`,{className:`text-fg`,children:se(e)})},e.id||`${e.kind}-${t}`)}function Ee(e){return e.trim()}function De(e){return e&&typeof e.kind==`string`}var Oe=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function ke(e){let t=(0,le.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:f,setDetailMarketplacePreview:p,detailLoading:m,detailError:h,setDetailError:b,detailEnabled:x,detailDirectoryId:S,detailManaged:T,detailExternalUrl:A,usingSkillInChatName:j,installingMarketName:M,togglingSkillName:N,isSkillInstalledByName:P,onUseSkillInChat:F,onMarketInstall:I,onSkillToggle:L,setConfirmId:z,setConfirmOpen:V}=e,H;t[0]!==d||t[1]!==b||t[2]!==p||t[3]!==i||t[4]!==o||t[5]!==c?(H=e=>{i(e),e||(o(`catalog`),d(null),p(null),b(null),c(``))},t[0]=d,t[1]=b,t[2]=p,t[3]=i,t[4]=o,t[5]=c,t[6]=H):H=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=l(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=W):W=t[8];let te=s||`?`,G;t[9]===te?G=t[10]:(G=(0,Q.jsx)(re,{name:te}),t[9]=te,t[10]=G);let K=s||`—`,q;t[11]===K?q=t[12]:(q=(0,Q.jsx)(v,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:K}),t[11]=K,t[12]=q);let ne;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ne=l(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,B.focusRingPanel),t[13]=ne):ne=t[13];let J;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(w,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=J):J=t[14];let Y;t[15]===n.detailCloseAria?Y=t[16]:(Y=(0,Q.jsx)(_,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ne,"aria-label":n.detailCloseAria,children:J})}),t[15]=n.detailCloseAria,t[16]=Y);let X;t[17]!==G||t[18]!==q||t[19]!==Y?(X=(0,Q.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[G,q,Y]}),t[17]=G,t[18]=q,t[19]=Y,t[20]=X):X=t[20];let ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ie):ie=t[21];let ae=a===`store`&&f?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,oe;t[22]===ae?oe=t[23]:(oe=(0,Q.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ie,(0,Q.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:ae})]}),t[22]=ae,t[23]=oe);let se;t[24]!==u||t[25]!==x||t[26]!==h||t[27]!==m||t[28]!==f||t[29]!==a||t[30]!==n?(se=(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:m?(0,Q.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Oe.map(Ae)}):h?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):a===`catalog`&&u?(0,Q.jsxs)(Q.Fragment,{children:[x?null:(0,Q.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,Q.jsx)(y,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,Q.jsx)(we,{preview:u,sk:n})]}):a===`store`&&f?(0,Q.jsx)(we,{preview:f,sk:n}):(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=x,t[26]=h,t[27]=m,t[28]=f,t[29]=a,t[30]=n,t[31]=se):se=t[31];let ce;t[32]!==A||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(ce=a===`store`&&A?(0,Q.jsxs)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:l(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,B.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,Q.jsx)(O,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=A,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=ce):ce=t[36];let Z;t[37]!==S||t[38]!==T||t[39]!==a||t[40]!==z||t[41]!==V||t[42]!==n.delete?(Z=a===`catalog`&&T&&S?(0,Q.jsxs)(g,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{z(S),V(!0)},children:[(0,Q.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=S,t[38]=T,t[39]=a,t[40]=z,t[41]=V,t[42]=n.delete,t[43]=Z):Z=t[43];let ue;t[44]!==ce||t[45]!==Z?(ue=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce,Z]}),t[44]=ce,t[45]=Z,t[46]=ue):ue=t[46];let de;t[47]!==x||t[48]!==m||t[49]!==a||t[50]!==s||t[51]!==M||t[52]!==P||t[53]!==I||t[54]!==L||t[55]!==F||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==N||t[67]!==j?(de=(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,Q.jsx)(g,{type:`button`,variant:`secondary`,disabled:!s||m||j===s||M===s,onClick:()=>void F(),children:j===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,Q.jsx)(g,{type:`button`,variant:P(s)?`secondary`:`primary`,disabled:!s||M===s,onClick:()=>{s&&I(s,{useDetailProvider:!0})},children:M===s?n.uploading:P(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,Q.jsxs)(Q.Fragment,{children:[x?(0,Q.jsx)(g,{type:`button`,variant:`secondary`,disabled:!s||N===s,onClick:()=>{s&&L(s,!1)},children:N===s?n.uploading:n.detailModalDisable}):(0,Q.jsx)(g,{type:`button`,variant:`primary`,disabled:!s||N===s,onClick:()=>{s&&L(s,!0)},children:N===s?n.uploading:n.detailModalEnable}),(0,Q.jsx)(g,{type:`button`,variant:`secondary`,disabled:!s||!x||m||j===s||N===s,title:x?void 0:n.useRequiresEnabled,onClick:()=>void F(),children:j===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=x,t[48]=m,t[49]=a,t[50]=s,t[51]=M,t[52]=P,t[53]=I,t[54]=L,t[55]=F,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=N,t[67]=j,t[68]=de):de=t[68];let fe;t[69]!==ue||t[70]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[ue,de]}),t[69]=ue,t[70]=de,t[71]=fe):fe=t[71];let pe;t[72]!==X||t[73]!==oe||t[74]!==se||t[75]!==fe?(pe=(0,Q.jsxs)(k,{children:[U,(0,Q.jsxs)(D,{className:W,children:[X,oe,se,fe]})]}),t[72]=X,t[73]=oe,t[74]=se,t[75]=fe,t[76]=pe):pe=t[76];let me;return t[77]!==r||t[78]!==H||t[79]!==pe?(me=(0,Q.jsx)(ee,{open:r,onOpenChange:H,children:pe}),t[77]=r,t[78]=H,t[79]=pe,t[80]=me):me=t[80],me}function Ae(e){return(0,Q.jsx)(`div`,{className:l(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function je(e){let t=(0,le.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:u,onModalDragOver:d,onModalDragLeave:f,onModalDrop:p,onFileInputChange:m,onInstallSubmit:h}=e,g;t[0]!==c||t[1]!==i||t[2]!==o?(g=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=g):g=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(E,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=y):y=t[4];let x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=x):x=t[5];let S;t[6]===n.installModalTitle?S=t[7]:(S=(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=S);let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=l(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,B.focusRingPanel),t[8]=C):C=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(w,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=T):T=t[9];let O;t[10]===n.installClose?O=t[11]:(O=(0,Q.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=O);let A;t[12]!==n.installClose||t[13]!==O?(A=(0,Q.jsx)(_,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:C,"aria-label":n.installClose,children:[T,O]})}),t[12]=n.installClose,t[13]=O,t[14]=A):A=t[14];let j;t[15]!==S||t[16]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[S,A]}),t[15]=S,t[16]=A,t[17]=j):j=t[17];let M=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,N;t[18]===M?N=t[19]:(N=l(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,M),t[18]=M,t[19]=N);let P;t[20]!==m||t[21]!==n.installModalDropHint||t[22]!==u?(P=(0,Q.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:u,onChange:m}),t[20]=m,t[21]=n.installModalDropHint,t[22]=u,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(b,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=F):F=t[24];let I;t[25]===n.installModalDropHint?I=t[26]:(I=(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=I);let L;t[27]===a?L=t[28]:(L=a?(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=L);let R;t[29]!==f||t[30]!==d||t[31]!==p||t[32]!==N||t[33]!==P||t[34]!==I||t[35]!==L?(R=(0,Q.jsxs)(`label`,{className:N,onDragLeave:f,onDragOver:d,onDrop:p,children:[P,F,I,L]}),t[29]=f,t[30]=d,t[31]=p,t[32]=N,t[33]=P,t[34]=I,t[35]=L,t[36]=R):R=t[36];let z;t[37]===n.installModalReqTitle?z=t[38]:(z=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=z);let V;t[39]===n.installModalReq1?V=t[40]:(V=(0,Q.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=V);let H;t[41]===n.installModalReq2?H=t[42]:(H=(0,Q.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==z||t[47]!==U?(W=(0,Q.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[z,U]}),t[46]=z,t[47]=U,t[48]=W):W=t[48];let te=!a||u,G=!a||u?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,K;t[49]===G?K=t[50]:(K=l(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,G,B.focusRingPanel),t[49]=G,t[50]=K);let q;t[51]===h?q=t[52]:(q=()=>void h(),t[51]=h,t[52]=q);let ne=u?n.uploading:n.installAction,J;t[53]!==te||t[54]!==K||t[55]!==q||t[56]!==ne?(J=(0,Q.jsx)(`button`,{type:`button`,disabled:te,className:K,onClick:q,children:ne}),t[53]=te,t[54]=K,t[55]=q,t[56]=ne,t[57]=J):J=t[57];let Y;t[58]!==R||t[59]!==W||t[60]!==J||t[61]!==j?(Y=(0,Q.jsxs)(k,{children:[y,(0,Q.jsxs)(D,{className:x,children:[j,R,W,J]})]}),t[58]=R,t[59]=W,t[60]=J,t[61]=j,t[62]=Y):Y=t[62];let X;return t[63]!==r||t[64]!==g||t[65]!==Y?(X=(0,Q.jsx)(ee,{open:r,onOpenChange:g,children:Y}),t[63]=r,t[64]=g,t[65]=Y,t[66]=X):X=t[66],X}function Me(e){let t=(0,le.c)(66),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:u,setMarketCategoryId:d,marketPage:f,setMarketPage:p,isSkillInstalledByName:m,openMarketplaceDetail:h,onMarketInstall:_,installingMarketName:v,onUseSkillInChat:y,usingSkillInChatName:b,searchInputActive:x,searchQuery:S,setSearchQuery:C,registeredProviders:w,marketBrowseProvider:T,setMarketBrowseProvider:E}=e,D=!x,O,k,A;if(t[0]!==v||t[1]!==m||t[2]!==T||t[3]!==u||t[4]!==f||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==y||t[13]!==h||t[14]!==w||t[15]!==x||t[16]!==S||t[17]!==E||t[18]!==d||t[19]!==p||t[20]!==C||t[21]!==D||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==b){let e;t[44]===T?e=t[45]:(e=e=>e.id!==T,t[44]=T,t[45]=e);let P=w.filter(e),L=S.trim(),R;t[46]===n.marketplaceCategoryAll?R=t[47]:(R={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=R);let z;t[48]!==r||t[49]!==R?(z=[R,...r.map(Ie)],t[48]=r,t[49]=R,t[50]=z):z=t[50];let ee=z;t[51]!==ee||t[52]!==u||t[53]!==r.length||t[54]!==i||t[55]!==d||t[56]!==D||t[57]!==n.marketplaceCategoriesAria?(O=D?r.length>0?(0,Q.jsx)(V,{items:ee,activeTab:u,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,Q.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Fe)}):null:null,t[51]=ee,t[52]=u,t[53]=r.length,t[54]=i,t[55]=d,t[56]=D,t[57]=n.marketplaceCategoriesAria,t[58]=O):O=t[58],t[59]!==a||t[60]!==D?(k=D&&a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[59]=a,t[60]=D,t[61]=k):k=t[61],A=!o&&!c?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:ve.map(Pe)}):c&&!o?(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:c}):o?(0,Q.jsxs)(`div`,{className:`relative`,children:[s?(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,Q.jsx)(I,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,o.items.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{className:`px-4`,children:x&&L?X(n.marketplaceEmptySearch,{query:L}):n.marketplaceEmpty}),x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[P.map(e=>(0,Q.jsx)(g,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>E(e.id),children:X(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,Q.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>C(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,Q.jsx)(`div`,{className:l(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,s&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:o.items.map(e=>{let t=ae(e,e.providerId??T),r=m(t);return(0,Q.jsxs)(`article`,{className:l(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,Q.jsx)(`button`,{type:`button`,className:l(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,B.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void h(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),r?(0,Q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(F,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):null]}),(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,Q.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,Q.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,Q.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,Q.jsx)(N,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,Q.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:r?(0,Q.jsx)(g,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||b===t,onClick:()=>void y({name:t,source:`store`,providerOverride:e.providerId??null}),children:b===t?n.previewUseInChatBusy:n.previewUseInChat}):(0,Q.jsx)(g,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||v===t,onClick:()=>void _(t,{providerOverride:e.providerId??null}),children:v===t?n.uploading:n.marketplaceInstall})})]},e.id)})}),o.items.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,Q.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:X(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(g,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Ne),children:[(0,Q.jsx)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,Q.jsxs)(g,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f>=o.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>p(e=>Math.min(o.meta.totalPages,e+1)),children:[(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,Q.jsx)(M,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]}):null]}):null,t[0]=v,t[1]=m,t[2]=T,t[3]=u,t[4]=f,t[5]=r,t[6]=a,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=_,t[12]=y,t[13]=h,t[14]=w,t[15]=x,t[16]=S,t[17]=E,t[18]=d,t[19]=p,t[20]=C,t[21]=D,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=b,t[41]=O,t[42]=k,t[43]=A}else O=t[41],k=t[42],A=t[43];let P;return t[62]!==O||t[63]!==k||t[64]!==A?(P=(0,Q.jsxs)(Q.Fragment,{children:[O,k,A]}),t[62]=O,t[63]=k,t[64]=A,t[65]=P):P=t[65],P}function Ne(e){return Math.max(1,e-1)}function Pe(e){return(0,Q.jsx)(fe,{},e)}function Fe(e){return(0,Q.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function Ie(e){return{id:e.id,label:e.label,title:e.label}}function Le(e){let t=(0,le.c)(118),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:c,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:m,catalogDisabledCount:h,catalogStatusFilter:g,setCatalogStatusFilter:_,marketSort:v,setMarketSort:y,marketBrowseProvider:b,setMarketBrowseProvider:x,registeredProviders:S,inSettingsShell:C,searchInputActive:w,resultTab:T,setResultTab:E,aggregatedTabCounts:D,aggregatedProviderStatus:O}=n;if(!i){let e;t[0]===n?e=t[1]:(e=(0,Q.jsx)(We,{vm:n}),t[0]=n,t[1]=e);let i;t[2]===r.needToken?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[2]=r.needToken,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[e,i]}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}let k=p.total+m.total,A=p.enabled+m.enabled,j=p.total+m.total-p.enabled-m.enabled,M;t[7]!==k||t[8]!==A||t[9]!==j||t[10]!==m.total?(M={total:k,ready:A,needsAttention:j,added:m.total},t[7]=k,t[8]=A,t[9]=j,t[10]=m.total,t[11]=M):M=t[11];let N=M,P;t[12]!==N.total||t[13]!==r.tabInstalled?(P={id:`installed`,label:r.tabInstalled,count:N.total},t[12]=N.total,t[13]=r.tabInstalled,t[14]=P):P=t[14];let F;t[15]===r.tabDiscover?F=t[16]:(F={id:`marketplace`,label:r.tabDiscover},t[15]=r.tabDiscover,t[16]=F);let I;t[17]!==P||t[18]!==F?(I=[P,F],t[17]=P,t[18]=F,t[19]=I):I=t[19];let R=I,z;t[20]===S?z=t[21]:(z=[`all`,...S.map(Ue)],t[20]=S,t[21]=z);let B=z,ee;t[22]!==O||t[23]!==D||t[24]!==S||t[25]!==r.marketplaceLoadFailed||t[26]!==r.marketplaceResultsTabAll||t[27]!==B?(ee=B.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:S.find(t=>t.id===e)?.displayName??e,n=D[e]??0,i=e===`all`?null:O[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[22]=O,t[23]=D,t[24]=S,t[25]=r.marketplaceLoadFailed,t[26]=r.marketplaceResultsTabAll,t[27]=B,t[28]=ee):ee=t[28];let H=ee,U;t[29]===n?U=t[30]:(U=(0,Q.jsx)(We,{vm:n}),t[29]=n,t[30]=U);let W;t[31]!==o||t[32]!==a?(W=o?(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:l(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:a}):null,t[31]=o,t[32]=a,t[33]=W):W=t[33];let te;t[34]!==r.diagnosticsHint||t[35]!==r.diagnosticsTitle||t[36]!==s?(te=s.length>0?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,Q.jsx)(`div`,{className:`font-medium`,children:X(r.diagnosticsTitle,{count:s.length})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:r.diagnosticsHint}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:s.slice(0,3).map(He)})]}):null,t[34]=r.diagnosticsHint,t[35]=r.diagnosticsTitle,t[36]=s,t[37]=te):te=t[37];let G;t[38]!==C||t[39]!==n.loading||t[40]!==n.mainTab||t[41]!==n.onReloadClick||t[42]!==n.searchQuery||t[43]!==n.setInstallOpen||t[44]!==n.setPendingFile||t[45]!==n.setSearchQuery||t[46]!==n.sk?(G=C?(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,Q.jsx)(ue,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[38]=C,t[39]=n.loading,t[40]=n.mainTab,t[41]=n.onReloadClick,t[42]=n.searchQuery,t[43]=n.setInstallOpen,t[44]=n.setPendingFile,t[45]=n.setSearchQuery,t[46]=n.sk,t[47]=G):G=t[47];let K;t[48]!==c||t[49]!==R||t[50]!==u||t[51]!==r.skillsNavAria?(K=(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(V,{items:R,activeTab:c,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[48]=c,t[49]=R,t[50]=u,t[51]=r.skillsNavAria,t[52]=K):K=t[52];let q;t[53]!==h||t[54]!==g||t[55]!==N.added||t[56]!==N.needsAttention||t[57]!==N.ready||t[58]!==c||t[59]!==b||t[60]!==v||t[61]!==S||t[62]!==T||t[63]!==H||t[64]!==w||t[65]!==_||t[66]!==x||t[67]!==y||t[68]!==E||t[69]!==f||t[70]!==r.discoverHeading||t[71]!==r.discoverHint||t[72]!==r.filterAll||t[73]!==r.filterDisabledOnly||t[74]!==r.filterEnabled||t[75]!==r.filterExtra||t[76]!==r.filterGlobal||t[77]!==r.filterInstalled||t[78]!==r.filterWorkspace||t[79]!==r.installedHeading||t[80]!==r.installedHint||t[81]!==r.marketplaceBrowseSwitchAria||t[82]!==r.marketplaceResultsTabsAria||t[83]!==r.marketplaceSortDownloads||t[84]!==r.marketplaceSortLabel||t[85]!==r.marketplaceSortNewest||t[86]!==r.sourceFilterAria||t[87]!==r.statusFilterAria||t[88]!==r.summaryAdded||t[89]!==r.summaryNeedsAttention||t[90]!==r.summaryReady||t[91]!==r.tabBuiltin||t[92]!==d?(q=c===`installed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.installedHint})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,Q.jsx)(L,{value:d,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>f(e)}),(0,Q.jsx)(L,{value:g,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:X(r.filterDisabledOnly,{count:h})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>_(e)})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,"aria-label":r.installedHeading,children:[(0,Q.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`enabled`&&`border-emerald-500/40 bg-emerald-500/5`),"aria-pressed":g===`enabled`,onClick:()=>_(Ve),children:[(0,Q.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:N.ready}),(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryReady})]}),(0,Q.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`disabled`&&`border-amber-500/50 bg-amber-500/5`),"aria-pressed":g===`disabled`,onClick:()=>_(Be),children:[(0,Q.jsx)(`div`,{className:l(`text-xl font-semibold tabular-nums`,N.needsAttention>0?`text-warning`:`text-fg`),children:N.needsAttention}),(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryNeedsAttention})]}),(0,Q.jsxs)(`button`,{type:`button`,className:l(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,d===`installed`&&`border-accent/40 bg-accent/5`),"aria-pressed":d===`installed`,onClick:()=>f(ze),children:[(0,Q.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:N.added}),(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryAdded})]})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.discoverHint})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[w?null:(0,Q.jsx)(L,{value:b??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:S.map(Re),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:x}),(0,Q.jsx)(L,{value:v,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>y(e)})]})]}),w?(0,Q.jsx)(V,{items:H,activeTab:T,onChange:E,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null]}),t[53]=h,t[54]=g,t[55]=N.added,t[56]=N.needsAttention,t[57]=N.ready,t[58]=c,t[59]=b,t[60]=v,t[61]=S,t[62]=T,t[63]=H,t[64]=w,t[65]=_,t[66]=x,t[67]=y,t[68]=E,t[69]=f,t[70]=r.discoverHeading,t[71]=r.discoverHint,t[72]=r.filterAll,t[73]=r.filterDisabledOnly,t[74]=r.filterEnabled,t[75]=r.filterExtra,t[76]=r.filterGlobal,t[77]=r.filterInstalled,t[78]=r.filterWorkspace,t[79]=r.installedHeading,t[80]=r.installedHint,t[81]=r.marketplaceBrowseSwitchAria,t[82]=r.marketplaceResultsTabsAria,t[83]=r.marketplaceSortDownloads,t[84]=r.marketplaceSortLabel,t[85]=r.marketplaceSortNewest,t[86]=r.sourceFilterAria,t[87]=r.statusFilterAria,t[88]=r.summaryAdded,t[89]=r.summaryNeedsAttention,t[90]=r.summaryReady,t[91]=r.tabBuiltin,t[92]=d,t[93]=q):q=t[93];let ne;t[94]!==c||t[95]!==n?(ne=c===`marketplace`?(0,Q.jsx)(Me,{...n}):(0,Q.jsx)(be,{...n}),t[94]=c,t[95]=n,t[96]=ne):ne=t[96];let J;t[97]!==K||t[98]!==q||t[99]!==ne?(J=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[K,q,ne]}),t[97]=K,t[98]=q,t[99]=ne,t[100]=J):J=t[100];let Y;t[101]!==W||t[102]!==te||t[103]!==G||t[104]!==J?(Y=(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[W,te,G,J]}),t[101]=W,t[102]=te,t[103]=G,t[104]=J,t[105]=Y):Y=t[105];let re,ie,ae;t[106]===n?(re=t[107],ie=t[108],ae=t[109]):(re=(0,Q.jsx)(ke,{...n}),ie=(0,Q.jsx)(je,{...n}),ae=(0,Q.jsx)(Se,{...n}),t[106]=n,t[107]=re,t[108]=ie,t[109]=ae);let oe;t[110]!==Y||t[111]!==re||t[112]!==ie||t[113]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[Y,re,ie,ae]}),t[110]=Y,t[111]=re,t[112]=ie,t[113]=ae,t[114]=oe):oe=t[114];let se;return t[115]!==U||t[116]!==oe?(se=(0,Q.jsxs)(Q.Fragment,{children:[U,oe]}),t[115]=U,t[116]=oe,t[117]=se):se=t[117],se}function Re(e){return{value:e.id,label:e.displayName}}function ze(e){return e===`installed`?`all`:`installed`}function Be(e){return e===`disabled`?`all`:`disabled`}function Ve(e){return e===`enabled`?`all`:`enabled`}function He(e,t){return(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function Ue(e){return e.id}function We(e){let t=(0,le.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=T(Ke),m=T(Ge),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,Q.jsx)(ue,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,Z.useLayoutEffect)(_,v),null}function Ge(e){return e.clearPageHeader}function Ke(e){return e.setPageHeader}async function qe(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function Je(){let e=u(f(e=>e.language)).skills,t=!!d(e=>e.token),n=s(),[r,i]=o(),c=r.get(`mprov`)?.trim()||null,[l,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),b=r.get(`q`)??``,x=r.get(`tab`),C=r.get(`source`),w=r.get(`status`),T=me.has(x)?x:`installed`,E=x===`builtin`?`builtin`:x===`user`?`installed`:null,D=he.has(C)?C:E??`all`,O=ge.has(w)?w:`all`,[k,A]=(0,Z.useState)(b),[j]=S(k,250),M=j.trim(),N=k.trim().length>0,P=M.length>0,[F,I]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(T),[B,ee]=(0,Z.useState)(D),[V,X]=(0,Z.useState)(``),[re,ae]=(0,Z.useState)(O),[se,le]=(0,Z.useState)(!1),[Q,ue]=(0,Z.useState)(null),[de,fe]=(0,Z.useState)(!1),[pe,ve]=(0,Z.useState)(!1),[be,xe]=(0,Z.useState)(null),[Se,Ce]=(0,Z.useState)(null),[we,Te]=(0,Z.useState)({}),[Ee,De]=(0,Z.useState)(!1),[Oe,ke]=(0,Z.useState)(`catalog`),[Ae,je]=(0,Z.useState)(``),[Me,Ne]=(0,Z.useState)(null),[Pe,Fe]=(0,Z.useState)(null),[Ie,Le]=(0,Z.useState)(!1),[Re,ze]=(0,Z.useState)(null),[Be,Ve]=(0,Z.useState)(`downloads`),[He,Ue]=(0,Z.useState)(1),[We,Ge]=(0,Z.useState)(null),[Ke,Je]=(0,Z.useState)(null),[Ye,Xe]=(0,Z.useState)(``),[$,Ze]=(0,Z.useState)(()=>c),[Qe,$e]=(0,Z.useState)(0),[et,tt]=(0,Z.useState)(0),[nt,rt]=(0,Z.useState)([]),it=(0,Z.useRef)(null),at=(0,Z.useRef)(c),ot=(0,Z.useRef)(null),st=(0,Z.useRef)(``),ct=(0,Z.useRef)(null),lt=(0,Z.useRef)(!1),[ut,dt]=(0,Z.useState)({query:``,byProvider:{}}),[ft,pt]=(0,Z.useState)(`all`),mt=(0,Z.useRef)(0),ht=(0,Z.useRef)(M);ht.current!==M&&(ht.current=M,pt(e=>e===`all`?e:`all`));let gt=z(()=>m().then(e=>(rt(e.diagnostics??[]),e.catalog.map(U))),[t,et],{enabled:t,initial:[],errorData:[]}),{data:_t,loading:vt,setData:yt}=gt,bt=z(async()=>{try{let{providers:e,current:t}=await te();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await ce()).provider}}catch{return{providers:[],current:`store`}}}},[t,Qe],{enabled:t,initial:{providers:[],current:null}}),xt=l||vt,St=bt.data.providers;(0,Z.useEffect)(()=>{let e=e=>{if(p(e.detail)===`skills`){if(lt.current){lt.current=!1;return}tt(e=>e+1)}else $e(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let Ct=r.toString(),wt=(0,Z.useRef)(Ct);if(wt.current!==Ct){wt.current=Ct;let e=r.get(`q`)??``,t=r.get(`tab`),n=r.get(`source`),i=r.get(`status`),a=me.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=he.has(n)?n:o??`all`,c=ge.has(i)?i:`all`;A(t=>t===e?t:e),R(e=>e===a?e:a),ee(e=>e===s?e:s),ae(e=>e===c?e:c);let l=r.get(`mcat`)??``;Xe(a===`marketplace`?e=>e===l?e:l:``)}let Tt=(0,Z.useRef)(t);!t&&Tt.current&&(Ze(null),it.current=null),Tt.current=t,t&&c&&at.current!==c&&(at.current=c,Ze(c)),t&&c==null&&bt.data.current&&bt.data.current!==ot.current&&(ot.current=bt.data.current,Ze(e=>e??bt.data.current));let Et=`${M}|${Be}|${L}|${Ye}|${$??``}|${ft}`;st.current!==Et&&(st.current=Et,Ue(1)),L===`marketplace`&&$&&ct.current!=null&&ct.current!==$&&Xe(``),ct.current=$;let Dt=z(()=>G({page:He,pageSize:20,sort:Be,category:Ye.trim()||void 0,provider:$}),[t,L,Ye,He,Be,P,$],{enabled:t&&L===`marketplace`&&!!$&&!P,initial:null,errorData:null});(0,Z.useEffect)(()=>{if(!t||!P||L!==`marketplace`||St.length===0)return;let n=++mt.current,r={};for(let e of St)r[e.id]={status:`loading`,rows:[]};dt({query:M,byProvider:r});let i=[],a=[];for(let t of St){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),G({provider:t.id,q:M,page:1,pageSize:40,sort:Be,signal:r.signal}).then(e=>{if(window.clearTimeout(o),n!==mt.current)return;let r=e.items.map(e=>({...e,providerId:t.id}));dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),n!==mt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?e.marketplaceLoadFailed:r instanceof Error?r.message:e.marketplaceLoadFailed;dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[t,L,P,M,St,Be,e.marketplaceLoadFailed]);let Ot=z(()=>W({provider:$}).then(e=>e.items),[t,L,$],{enabled:t&&L===`marketplace`&&!!$,initial:[],errorData:[]}),kt=(0,Z.useMemo)(()=>{if(!P||ut.query!==M)return[];let e=St.map(e=>({id:e.id,rows:[...ut.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[P,M,ut,St]),At=(0,Z.useMemo)(()=>{if(!P)return{};let e={all:kt.length};for(let t of St)e[t.id]=kt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[P,kt,St]),jt=(0,Z.useMemo)(()=>P?ft===`all`?kt:kt.filter(e=>e.providerId===ft||(e.additionalSources??[]).some(e=>e.providerId===ft)):[],[P,kt,ft]),Mt=(0,Z.useMemo)(()=>{if(!P)return{};let e={};for(let t of St)e[t.id]=ut.byProvider[t.id]?.status??`loading`;return e},[P,ut,St]),Nt=(0,Z.useMemo)(()=>Object.values(Mt).some(e=>e===`loading`),[Mt]),Pt=(0,Z.useMemo)(()=>{if(!P)return!1;let e=Object.values(Mt);return e.length>0&&e.every(e=>e===`error`)},[P,Mt]),Ft=(0,Z.useMemo)(()=>{if(!P||kt.length===0&&Nt)return null;let e=jt.length,t=(He-1)*20;return{items:jt.slice(t,t+20),meta:{page:He,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:ft}},[P,kt,Nt,jt,He,ft]),It=L===`marketplace`?N?P?Ft:null:Dt.data:null,Lt=L===`marketplace`?N?P?Nt:!0:Dt.loading:!1,Rt=P?Pt?e.marketplaceLoadFailed:null:Dt.error instanceof Error?Dt.error.message:Dt.error?e.marketplaceLoadFailed:null,zt=L===`marketplace`?Ot.data:[],Bt=L===`marketplace`?Ot.loading:!1,Vt=Ot.error instanceof Error?Ot.error.message:Ot.error?e.marketplaceCategoriesFailed:null;Ye.trim()&&zt.length>0&&!zt.some(e=>e.id===Ye)&&Xe(``);let Ht=(0,Z.useCallback)(async t=>{let n=t?.silent===!0;n||h(!0),_(null);try{let e=await m();return rt(e.diagnostics??[]),yt(e.catalog.map(U)),{ok:!0}}catch(t){let n=t instanceof Error?t.message:e.loadFailed;return _(n),{ok:!1,message:n}}finally{n||h(!1)}},[yt,e.loadFailed]),Ut=!l&&gt.error?gt.error instanceof Error?gt.error.message:e.loadFailed:null,Wt=g??Ut;(0,Z.useEffect)(()=>{i(e=>{let t=new URLSearchParams(e);return M?t.set(`q`,M):t.delete(`q`),L===`marketplace`?t.set(`tab`,L):t.delete(`tab`),B===`all`?t.delete(`source`):t.set(`source`,B),L===`installed`&&re!==`all`?t.set(`status`,re):t.delete(`status`),L===`marketplace`&&Ye.trim()?t.set(`mcat`,Ye.trim()):t.delete(`mcat`),L===`marketplace`&&$?t.set(_e,$):t.delete(_e),t.toString()===e.toString()?e:t},{replace:!0})},[L,Ye,$,M,re,i,B]);let Gt=(0,Z.useCallback)((e,t,n=5e3)=>{I({kind:e,message:t}),window.setTimeout(()=>I(null),n)},[]),Kt=(0,Z.useCallback)(t=>{let n=t.availability;if(!n)return e.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[e.installSuccess]),qt=(0,Z.useCallback)(async t=>{ke(`catalog`),De(!0),je(t.name),Ne(null),Fe(null),ze(null),Le(!0);try{let e=await ie(t.name);Ne(e),je(e.name)}catch(t){Ne(null),ze(t instanceof Error?t.message:e.detailLoadFailed)}finally{Le(!1)}},[e.detailLoadFailed]),Jt=(0,Z.useCallback)(async t=>{let n=t.trim();if(n){ke(`catalog`),De(!0),je(n),Ne(null),Fe(null),ze(null),Le(!0);try{let e=await ie(n);Ne(e),je(e.name)}catch(t){Ne(null),ze(t instanceof Error?t.message:e.detailLoadFailed)}finally{Le(!1)}}},[e.detailLoadFailed]),Yt=(0,Z.useCallback)(async(t,n,r)=>{let i=r?.trim()||$;if(i){it.current=i,ke(`store`),De(!0),je(n?.trim()||t),Ne(null),Fe(null),ze(null),Le(!0);try{let e=await J(t,{provider:i});je(e.name),Fe(e.skillDocPreview)}catch(t){Fe(null),ze(t instanceof Error?t.message:e.detailLoadFailed)}finally{Le(!1)}}},[$,e.detailLoadFailed]),Xt=(0,Z.useCallback)(async(t,n)=>{Ce(t),Te(e=>({...e,[t]:n})),I(null);try{return await q(t,n),await Ht({silent:!0}),!0}catch(n){return Te(e=>{let{[t]:n,...r}=e;return r}),Gt(`error`,n instanceof Error?n.message:e.skillToggleFailed),!1}finally{Ce(null),Te(e=>{let{[t]:n,...r}=e;return r})}},[Ht,Gt,e.skillToggleFailed]),Zt=(0,Z.useCallback)(async()=>{I(null),h(!0),_(null);try{await H()}catch(t){_(t instanceof Error?t.message:e.reloadFailed),h(!1);return}await Ht()},[Ht,e.reloadFailed]),Qt=(0,Z.useMemo)(()=>{let e=k.trim().toLowerCase();return e?_t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):_t},[_t,k]),$t=(0,Z.useMemo)(()=>{let e=_t.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>we[e.name]??e.enabled).length}},[_t,we]),en=(0,Z.useMemo)(()=>{let e=_t.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>we[e.name]??e.enabled).length}},[_t,we]),tn=(0,Z.useMemo)(()=>Ae?_t.find(e=>e.name===Ae):void 0,[_t,Ae]),nn=tn==null?!0:we[Ae]??tn.enabled,rn=tn?.directoryId??null,an=tn?.managed??!1,on=(0,Z.useMemo)(()=>Oe!==`store`||!Ae?null:ne(it.current??$,Ae),[Oe,Ae,$]),sn=(0,Z.useMemo)(()=>{let e=Qt;return L===`installed`&&B!==`all`&&(e=B===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===B)),e},[Qt,L,B]),cn=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of sn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=ye.indexOf(e),r=ye.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[sn]),ln=(0,Z.useCallback)(t=>e.categoryLabel?.[t]||t,[e.categoryLabel]),un=(0,Z.useMemo)(()=>V?sn.filter(e=>e.category===V):sn,[sn,V]);(0,Z.useEffect)(()=>{X(``)},[B]);let dn=(0,Z.useCallback)(e=>we[e.name]??e.enabled,[we]),fn=(0,Z.useMemo)(()=>un.filter(e=>!dn(e)).length,[un,dn]),pn=(0,Z.useMemo)(()=>{let e=un;return re===`disabled`&&(e=e.filter(e=>!dn(e))),re===`enabled`&&(e=e.filter(e=>dn(e))),[...e].toSorted((e,t)=>{let n=dn(e);return n===dn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[un,re,dn]),mn=async t=>{I(null),y(!0),_(null);try{let n;try{n=await qe(t)}catch{_(e.invalidFile),Gt(`error`,e.invalidFile);return}let r=await K(n,{overwrite:!0});lt.current=!0,await Ht(),Gt(`success`,Kt(r)),le(!1),ue(null),R(`installed`),ee(`installed`),await Jt(r.availability?.skillName||r.skillId)}catch(t){_(t instanceof Error?t.message:e.uploadFailed),Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{y(!1)}},hn=()=>{Q&&mn(Q)},gn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&ue(t)},_n=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(fe(!0),e.dataTransfer.dropEffect=`copy`)},vn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||fe(!1)},yn=e=>{e.preventDefault(),e.stopPropagation(),fe(!1);let t=e.dataTransfer?.files?.[0];t&&ue(t)},bn=t=>{switch(t){case`builtin`:return e.source.builtin;case`workspace`:return e.source.workspace;case`global`:return e.source.global;case`extra`:return e.source.extra;default:return t}},xn=async()=>{let t=be,n=Ee&&Oe===`catalog`&&rn===t;if(ve(!1),xe(null),t){I(null);try{await oe(t),lt.current=!0,await Ht(),n&&(De(!1),ke(`catalog`),je(``),Ne(null),Fe(null),ze(null))}catch(t){_(t instanceof Error?t.message:e.deleteFailed)}}},Sn=(0,Z.useCallback)(e=>_t.some(t=>t.name===e),[_t]),Cn=(0,Z.useCallback)(async t=>{let r=(t?.name??Ae).trim();if(!r)return;let i=t?.source??Oe;if(i===`catalog`){let e=_t.find(e=>e.name===r);if(e&&!(we[e.name]??e.enabled))return}I(null);let a=i===`store`&&!Sn(r);Je(r);try{if(a){let e=t?.providerOverride?.trim()||it.current||$;await Y({name:r,overwrite:!1,...e?{provider:e}:{}}),lt.current=!0,await Ht({silent:!0})}De(!1),n(`/chat/new?skill=${encodeURIComponent(r)}`)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Je(null)}},[_t,Ae,Oe,we,Sn,Ht,n,Gt,e.uploadFailed,$]),wn=(0,Z.useCallback)(async(t,n)=>{let r=Sn(t);if(!(r&&!window.confirm(e.marketplaceReinstallConfirm))){I(null),Ge(t);try{let e=n?.providerOverride?.trim()||(n?.useDetailProvider?it.current??$:$),i=await Y({name:t,overwrite:r,...e?{provider:e}:{}});lt.current=!0,await Ht({silent:!0}),Gt(`success`,Kt(i)),R(`installed`),ee(`installed`),await Jt(i.availability?.skillName||i.skillId||t)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Ge(null)}}},[Sn,Kt,Ht,$,Jt,Gt,e.marketplaceReinstallConfirm,e.uploadFailed]),{pathname:Tn}=a();return{sk:e,hasToken:t,catalog:_t,loading:xt,error:Wt,uploading:v,searchQuery:k,setSearchQuery:A,actionFeedback:F,skillDiagnostics:nt,mainTab:L,setMainTab:R,sourceFilter:B,setSourceFilter:ee,builtinCategoryFilter:V,setBuiltinCategoryFilter:X,installOpen:se,setInstallOpen:le,pendingFile:Q,setPendingFile:ue,dropActive:de,setDropActive:fe,confirmOpen:pe,setConfirmOpen:ve,confirmId:be,setConfirmId:xe,togglingSkillName:Se,enabledOverride:we,detailOpen:Ee,setDetailOpen:De,detailSource:Oe,setDetailSource:ke,detailTitle:Ae,setDetailTitle:je,detailCatalogPreview:Me,setDetailCatalogPreview:Ne,detailMarketplacePreview:Pe,setDetailMarketplacePreview:Fe,detailLoading:Ie,detailError:Re,setDetailError:ze,marketSort:Be,setMarketSort:Ve,marketPage:He,setMarketPage:Ue,mpLoading:Lt,mpError:Rt,mpPayload:It,searchActive:P,searchInputActive:N,resultTab:ft,setResultTab:pt,aggregatedTabCounts:At,aggregatedProviderStatus:Mt,aggregatedAllFailed:Pt,installingMarketName:We,usingSkillInChatName:Ke,onUseSkillInChat:Cn,marketCategoryId:Ye,setMarketCategoryId:Xe,mpCategories:zt,mpCategoriesError:Vt,mpCategoriesLoading:Bt,marketBrowseProvider:$,setMarketBrowseProvider:Ze,registeredProviders:St,builtinTabStats:$t,userTabStats:en,detailEnabled:nn,detailDirectoryId:rn,detailManaged:an,detailExternalUrl:on,filteredCatalog:sn,builtinCategories:cn,categoryFilteredCatalog:un,catalogDisplayRows:pn,catalogDisabledCount:fn,catalogStatusFilter:re,setCatalogStatusFilter:ae,resolveSkillEnabled:dn,inSettingsShell:Tn.startsWith(`/settings/`),categoryLabel:ln,onReloadClick:Zt,openSkillDetail:qt,openMarketplaceDetail:Yt,onSkillToggle:Xt,onInstallSubmit:hn,onFileInputChange:gn,onModalDragOver:_n,onModalDragLeave:vn,onModalDrop:yn,sourceLabel:bn,runDelete:xn,onMarketInstall:wn,isSkillInstalledByName:Sn}}function Ye(){let e=(0,le.c)(2),t=Je(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(Le,{vm:t}),e[0]=t,e[1]=n),n}export{Ye as SkillsPage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{l as r,o as i,r as a}from"./locale-store-DO-u1yS7.js";import{ei as o}from"./index-TnouSpay.js";import"./skill-reload-api-CBP-UB88.js";async function s(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`global`);let i=r.getState().token,o=new Headers;i&&o.set(`Authorization`,`Bearer ${i}`);let s=await fetch(a(`/api/skills/upload`),{method:`POST`,headers:o,body:n});s.status===401&&r.getState().onUnauthorized();let c=await s.json().catch(()=>({}));if(!s.ok)throw Error(c.error||`HTTP ${s.status}`);if(!c.payload?.skillId)throw Error(`Invalid response`);return c.payload}async function c(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await i(a(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await o(r))}async function l(e,t){let n=await i(a(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await o(n))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),u(t,e.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;u(r,t?.provider);let s=r.toString(),c=await i(a(`/api/skills/marketplace/packages/${n}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await i(a(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function h(e){let t=await i(a(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function g(){let e=await i(a(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await i(a(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function x(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function S(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function C(e){let t=(0,v.c)(9),{name:r,className:i}=e,a;t[0]===r?a=t[1]:(a=S(r),t[0]=r,t[1]=a);let o=a,s=b[x(r)%b.length],c;t[2]!==i||t[3]!==s.dark||t[4]!==s.light?(c=n(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,i),t[2]=i,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function M(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{M as a,d as c,_ as d,f,s as g,l as h,O as i,p as l,m,A as n,C as o,h as p,k as r,c as s,j as t,g as u};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{l as r,o as i,r as a}from"./locale-store-DVGhFXRz.js";import{ei as o}from"./index-C1h0zkNo.js";import"./skill-reload-api-ByPEG5t1.js";async function s(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`global`);let i=r.getState().token,o=new Headers;i&&o.set(`Authorization`,`Bearer ${i}`);let s=await fetch(a(`/api/skills/upload`),{method:`POST`,headers:o,body:n});s.status===401&&r.getState().onUnauthorized();let c=await s.json().catch(()=>({}));if(!s.ok)throw Error(c.error||`HTTP ${s.status}`);if(!c.payload?.skillId)throw Error(`Invalid response`);return c.payload}async function c(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await i(a(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await o(r))}async function l(e,t){let n=await i(a(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await o(n))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),u(t,e.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;u(r,t?.provider);let s=r.toString(),c=await i(a(`/api/skills/marketplace/packages/${n}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await i(a(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function h(e){let t=await i(a(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function g(){let e=await i(a(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await i(a(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function x(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function S(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function C(e){let t=(0,v.c)(9),{name:r,className:i}=e,a;t[0]===r?a=t[1]:(a=S(r),t[0]=r,t[1]=a);let o=a,s=b[x(r)%b.length],c;t[2]!==i||t[3]!==s.dark||t[4]!==s.light?(c=n(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,i),t[2]=i,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function M(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{M as a,d as c,_ as d,f,s as g,l as h,O as i,p as l,m,A as n,C as o,h as p,k as r,c as s,j as t,g as u};
@@ -1 +1 @@
1
- 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"./cn-JdwAhgNB.js";import{t as i}from"./messages-BP8aQX-5.js";import{n as a}from"./locale-store-DO-u1yS7.js";import{Cc as o,Gl as s,Ko as c,Nt as l,bi as u,lc as d,ws as f,yi as p}from"./index-TnouSpay.js";import{n as m,r as h}from"./settings-page-layout-BhqupMfG.js";import{r as g,t as _}from"./settings-form-section-9pgClEud.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(l,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&p()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,f.press),onClick:()=>void B(),children:[(0,y.jsx)(o,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,f.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(s,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
1
+ 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"./cn-JdwAhgNB.js";import{t as i}from"./messages-r8L6Ur3A.js";import{n as a}from"./locale-store-DVGhFXRz.js";import{Cc as o,Ko as s,Nt as c,Wl as l,bi as u,lc as d,ws as f,yi as p}from"./index-C1h0zkNo.js";import{n as m,r as h}from"./settings-page-layout-BQTLh-86.js";import{r as g,t as _}from"./settings-form-section-BSDNBfHn.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(c,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{s()&&R&&z()},[R,z]),!s()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&p()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,f.press),onClick:()=>void B(),children:[(0,y.jsx)(o,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],s=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),s?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,f.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(l,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-DO-u1yS7.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
1
+ import{p as e}from"./locale-store-DVGhFXRz.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
@@ -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"./check-DUBLcKHA.js";import{t as a}from"./cn-JdwAhgNB.js";import{Ns as o,_s as s,cs as ee,ds as te,gs as ne,iu as re,os as ie,ss as ae}from"./index-TnouSpay.js";var oe=n(),c=e(t(),1),l=r(),se=Array.from({length:24},(e,t)=>t);function ce(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function le(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function u(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function d(e){let t=(0,oe.c)(80),{value:n,onChange:r,disabled:d,allowEmpty:fe,clearLabel:f,ariaLabel:p,ariaLabelledBy:pe,className:me,triggerClassName:he,id:ge,name:m,minuteStep:_e}=e,h=fe===void 0?!1:fe,ve=_e===void 0?1:_e,g=ce(n),ye=g??le(),[be,xe]=(0,c.useState)(!1),[_,Se]=(0,c.useState)(ye.hour),[v,Ce]=(0,c.useState)(ye.minute),we=(0,c.useRef)([]),Te=(0,c.useRef)([]),Ee=ie(),De=ae(),Oe=Ee==="default"?te:ee(Ee),ke=Math.max(1,Math.min(60,Math.round(ve))),Ae=Array.from({length:Math.ceil(60/ke)},(e,t)=>t*ke).filter(de),y;t[0]===r?y=t[1]:(y=(e,t,n)=>{let i=n===void 0?!1:n;Se(e),Ce(t),r(u(e,t)),i&&xe(!1)},t[0]=r,t[1]=y);let b=y,je=ue,x;t[2]===me?x=t[3]:(x=a(`relative min-w-0`,me),t[2]=me,t[3]=x);let S=s,C;t[4]===n?C=t[5]:(C=e=>{if(e){let e=ce(n)??le();Se(e.hour),Ce(e.minute)}xe(e)},t[4]=n,t[5]=C);let w=h&&n&&`pr-9`,T=d&&`cursor-not-allowed opacity-50 hover:border-edge`,E;t[6]!==w||t[7]!==T||t[8]!==he?(E=a(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,w,T,he),t[6]=w,t[7]=T,t[8]=he,t[9]=E):E=t[9];let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,l.jsx)(re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=D):D=t[10];let O=!g&&`text-fg-subtle`,k;t[11]===O?k=t[12]:(k=a(`tabular-nums`,O),t[11]=O,t[12]=k);let A=g?u(g.hour,g.minute):`--:--`,j;t[13]!==k||t[14]!==A?(j=(0,l.jsx)(`span`,{className:k,children:A}),t[13]=k,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==p||t[17]!==pe||t[18]!==d||t[19]!==ge||t[20]!==j||t[21]!==E?(M=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsxs)(`button`,{id:ge,type:`button`,disabled:d,"aria-label":p,"aria-labelledby":pe,"aria-haspopup":`listbox`,className:E,children:[D,j]})}),t[16]=p,t[17]=pe,t[18]=d,t[19]=ge,t[20]=j,t[21]=E,t[22]=M):M=t[22];let N=s,P=De??void 0,F=s,Me=a(Oe,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),Ne=e=>{e.preventDefault(),requestAnimationFrame(()=>we.current[_]?.focus())},I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,l.jsx)(re,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=I):I=t[23];let Pe=p??`HH:mm`,L;t[24]===Pe?L=t[25]:(L=(0,l.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[I,Pe]}),t[24]=Pe,t[25]=L);let R;t[26]!==_||t[27]!==v?(R=u(_,v),t[26]=_,t[27]=v,t[28]=R):R=t[28];let z;t[29]===R?z=t[30]:(z=(0,l.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:R}),t[29]=R,t[30]=z);let B;t[31]!==L||t[32]!==z?(B=(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[L,z]}),t[31]=L,t[32]=z,t[33]=B):B=t[33];let V;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=V):V=t[34];let Fe=`${p??`HH:mm`} HH`,Ie=se.map((e,t)=>(0,l.jsx)(`button`,{ref:e=>{we.current[t]=e},type:`button`,role:`option`,"aria-selected":_===e,tabIndex:_===e?0:-1,className:a(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,_===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>b(e,v),onKeyDown:e=>je(e,se,_,e=>b(e,v),we),children:String(e).padStart(2,`0`)},e)),H;t[35]!==Fe||t[36]!==Ie?(H=(0,l.jsxs)(`div`,{className:`pr-2`,children:[V,(0,l.jsx)(`div`,{role:`listbox`,"aria-label":Fe,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Ie})]}),t[35]=Fe,t[36]=Ie,t[37]=H):H=t[37];let U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=U):U=t[38];let W=`${p??`HH:mm`} MM`,Le=Ae.map((e,t)=>(0,l.jsxs)(`button`,{ref:e=>{Te.current[t]=e},type:`button`,role:`option`,"aria-selected":v===e,tabIndex:v===e?0:-1,className:a(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,v===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>b(_,e,!0),onKeyDown:e=>je(e,Ae,v,e=>b(_,e),Te),children:[(0,l.jsx)(i,{className:a(`absolute left-0.5 size-3`,v!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),G;t[39]!==W||t[40]!==Le?(G=(0,l.jsx)(`div`,{role:`listbox`,"aria-label":W,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Le}),t[39]=W,t[40]=Le,t[41]=G):G=t[41];let K;t[42]!==U||t[43]!==G?(K=(0,l.jsxs)(`div`,{className:`pl-2`,children:[U,G]}),t[42]=U,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==H||t[46]!==K?(q=(0,l.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[H,K]}),t[45]=H,t[46]=K,t[47]=q):q=t[47];let J;t[48]!==F.Content||t[49]!==Me||t[50]!==Ne||t[51]!==B||t[52]!==q?(J=(0,l.jsxs)(F.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Me,onOpenAutoFocus:Ne,children:[B,q]}),t[48]=F.Content,t[49]=Me,t[50]=Ne,t[51]=B,t[52]=q,t[53]=J):J=t[53];let Y;t[54]!==N.Portal||t[55]!==P||t[56]!==J?(Y=(0,l.jsx)(N.Portal,{container:P,children:J}),t[54]=N.Portal,t[55]=P,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==be||t[59]!==M||t[60]!==Y||t[61]!==S.Root||t[62]!==C?(X=(0,l.jsxs)(S.Root,{open:be,onOpenChange:C,children:[M,Y]}),t[58]=be,t[59]=M,t[60]=Y,t[61]=S.Root,t[62]=C,t[63]=X):X=t[63];let Z;t[64]!==h||t[65]!==p||t[66]!==f||t[67]!==d||t[68]!==r||t[69]!==n?(Z=h&&n?(0,l.jsx)(`button`,{type:`button`,disabled:d,"aria-label":f??p,title:f,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,l.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=h,t[65]=p,t[66]=f,t[67]=d,t[68]=r,t[69]=n,t[70]=Z):Z=t[70];let Q;t[71]!==d||t[72]!==m||t[73]!==n?(Q=m?(0,l.jsx)(`input`,{type:`hidden`,name:m,value:n,disabled:d}):null,t[71]=d,t[72]=m,t[73]=n,t[74]=Q):Q=t[74];let $;return t[75]!==x||t[76]!==X||t[77]!==Z||t[78]!==Q?($=(0,l.jsxs)(`div`,{className:x,children:[X,Z,Q]}),t[75]=x,t[76]=X,t[77]=Z,t[78]=Q,t[79]=$):$=t[79],$}function ue(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function de(e){return e<60}export{d as t};
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"./check-DUBLcKHA.js";import{t as a}from"./cn-JdwAhgNB.js";import{Ns as o,_s as s,cs as ee,ds as te,gs as ne,os as re,ru as ie,ss as ae}from"./index-C1h0zkNo.js";var oe=n(),c=e(t(),1),l=r(),se=Array.from({length:24},(e,t)=>t);function ce(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function le(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function u(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function d(e){let t=(0,oe.c)(80),{value:n,onChange:r,disabled:d,allowEmpty:fe,clearLabel:f,ariaLabel:p,ariaLabelledBy:pe,className:me,triggerClassName:he,id:ge,name:m,minuteStep:_e}=e,h=fe===void 0?!1:fe,ve=_e===void 0?1:_e,g=ce(n),ye=g??le(),[be,xe]=(0,c.useState)(!1),[_,Se]=(0,c.useState)(ye.hour),[v,Ce]=(0,c.useState)(ye.minute),we=(0,c.useRef)([]),Te=(0,c.useRef)([]),Ee=re(),De=ae(),Oe=Ee==="default"?te:ee(Ee),ke=Math.max(1,Math.min(60,Math.round(ve))),Ae=Array.from({length:Math.ceil(60/ke)},(e,t)=>t*ke).filter(de),y;t[0]===r?y=t[1]:(y=(e,t,n)=>{let i=n===void 0?!1:n;Se(e),Ce(t),r(u(e,t)),i&&xe(!1)},t[0]=r,t[1]=y);let b=y,je=ue,x;t[2]===me?x=t[3]:(x=a(`relative min-w-0`,me),t[2]=me,t[3]=x);let S=s,C;t[4]===n?C=t[5]:(C=e=>{if(e){let e=ce(n)??le();Se(e.hour),Ce(e.minute)}xe(e)},t[4]=n,t[5]=C);let w=h&&n&&`pr-9`,T=d&&`cursor-not-allowed opacity-50 hover:border-edge`,E;t[6]!==w||t[7]!==T||t[8]!==he?(E=a(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,w,T,he),t[6]=w,t[7]=T,t[8]=he,t[9]=E):E=t[9];let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,l.jsx)(ie,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=D):D=t[10];let O=!g&&`text-fg-subtle`,k;t[11]===O?k=t[12]:(k=a(`tabular-nums`,O),t[11]=O,t[12]=k);let A=g?u(g.hour,g.minute):`--:--`,j;t[13]!==k||t[14]!==A?(j=(0,l.jsx)(`span`,{className:k,children:A}),t[13]=k,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==p||t[17]!==pe||t[18]!==d||t[19]!==ge||t[20]!==j||t[21]!==E?(M=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsxs)(`button`,{id:ge,type:`button`,disabled:d,"aria-label":p,"aria-labelledby":pe,"aria-haspopup":`listbox`,className:E,children:[D,j]})}),t[16]=p,t[17]=pe,t[18]=d,t[19]=ge,t[20]=j,t[21]=E,t[22]=M):M=t[22];let N=s,P=De??void 0,F=s,Me=a(Oe,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),Ne=e=>{e.preventDefault(),requestAnimationFrame(()=>we.current[_]?.focus())},I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,l.jsx)(ie,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=I):I=t[23];let Pe=p??`HH:mm`,L;t[24]===Pe?L=t[25]:(L=(0,l.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[I,Pe]}),t[24]=Pe,t[25]=L);let R;t[26]!==_||t[27]!==v?(R=u(_,v),t[26]=_,t[27]=v,t[28]=R):R=t[28];let z;t[29]===R?z=t[30]:(z=(0,l.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:R}),t[29]=R,t[30]=z);let B;t[31]!==L||t[32]!==z?(B=(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[L,z]}),t[31]=L,t[32]=z,t[33]=B):B=t[33];let V;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=V):V=t[34];let Fe=`${p??`HH:mm`} HH`,Ie=se.map((e,t)=>(0,l.jsx)(`button`,{ref:e=>{we.current[t]=e},type:`button`,role:`option`,"aria-selected":_===e,tabIndex:_===e?0:-1,className:a(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,_===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>b(e,v),onKeyDown:e=>je(e,se,_,e=>b(e,v),we),children:String(e).padStart(2,`0`)},e)),H;t[35]!==Fe||t[36]!==Ie?(H=(0,l.jsxs)(`div`,{className:`pr-2`,children:[V,(0,l.jsx)(`div`,{role:`listbox`,"aria-label":Fe,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Ie})]}),t[35]=Fe,t[36]=Ie,t[37]=H):H=t[37];let U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=U):U=t[38];let W=`${p??`HH:mm`} MM`,Le=Ae.map((e,t)=>(0,l.jsxs)(`button`,{ref:e=>{Te.current[t]=e},type:`button`,role:`option`,"aria-selected":v===e,tabIndex:v===e?0:-1,className:a(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,v===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>b(_,e,!0),onKeyDown:e=>je(e,Ae,v,e=>b(_,e),Te),children:[(0,l.jsx)(i,{className:a(`absolute left-0.5 size-3`,v!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),G;t[39]!==W||t[40]!==Le?(G=(0,l.jsx)(`div`,{role:`listbox`,"aria-label":W,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Le}),t[39]=W,t[40]=Le,t[41]=G):G=t[41];let K;t[42]!==U||t[43]!==G?(K=(0,l.jsxs)(`div`,{className:`pl-2`,children:[U,G]}),t[42]=U,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==H||t[46]!==K?(q=(0,l.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[H,K]}),t[45]=H,t[46]=K,t[47]=q):q=t[47];let J;t[48]!==F.Content||t[49]!==Me||t[50]!==Ne||t[51]!==B||t[52]!==q?(J=(0,l.jsxs)(F.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Me,onOpenAutoFocus:Ne,children:[B,q]}),t[48]=F.Content,t[49]=Me,t[50]=Ne,t[51]=B,t[52]=q,t[53]=J):J=t[53];let Y;t[54]!==N.Portal||t[55]!==P||t[56]!==J?(Y=(0,l.jsx)(N.Portal,{container:P,children:J}),t[54]=N.Portal,t[55]=P,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==be||t[59]!==M||t[60]!==Y||t[61]!==S.Root||t[62]!==C?(X=(0,l.jsxs)(S.Root,{open:be,onOpenChange:C,children:[M,Y]}),t[58]=be,t[59]=M,t[60]=Y,t[61]=S.Root,t[62]=C,t[63]=X):X=t[63];let Z;t[64]!==h||t[65]!==p||t[66]!==f||t[67]!==d||t[68]!==r||t[69]!==n?(Z=h&&n?(0,l.jsx)(`button`,{type:`button`,disabled:d,"aria-label":f??p,title:f,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,l.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=h,t[65]=p,t[66]=f,t[67]=d,t[68]=r,t[69]=n,t[70]=Z):Z=t[70];let Q;t[71]!==d||t[72]!==m||t[73]!==n?(Q=m?(0,l.jsx)(`input`,{type:`hidden`,name:m,value:n,disabled:d}):null,t[71]=d,t[72]=m,t[73]=n,t[74]=Q):Q=t[74];let $;return t[75]!==x||t[76]!==X||t[77]!==Z||t[78]!==Q?($=(0,l.jsxs)(`div`,{className:x,children:[X,Z,Q]}),t[75]=x,t[76]=X,t[77]=Z,t[78]=Q,t[79]=$):$=t[79],$}function ue(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function de(e){return e<60}export{d as t};
@@ -1 +1 @@
1
- import{t as e}from"./cn-JdwAhgNB.js";import{Ds as t,Os as n,ks as r}from"./index-TnouSpay.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,r,`dark:border-edge`)}function a(){return e(n,t)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
1
+ import{t as e}from"./cn-JdwAhgNB.js";import{Ds as t,Os as n,ks as r}from"./index-C1h0zkNo.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,r,`dark:border-edge`)}function a(){return e(n,t)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
@@ -1 +1 @@
1
- import{n as e}from"./vendor-react-BOUWij0V.js";import{r as t,s as n}from"./locale-store-DO-u1yS7.js";import{i as r}from"./vendor-swr-BIWyz7Rc.js";var i=e();function a(e){return t(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function o(e){return(await n(a(e))).payload?.channels??[]}function s(e,t){let n=(0,i.c)(14),s;n[0]!==e||n[1]!==t?(s=e?a(t):null,n[0]=e,n[1]=t,n[2]=s):s=n[2];let c;n[3]===t?c=n[4]:(c=()=>o(t),n[3]=t,n[4]=c);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={revalidateOnFocus:!1},n[5]=l):l=n[5];let{data:u,error:d,isLoading:f,isValidating:p,mutate:m}=r(s,c,l),h;n[6]===u?h=n[7]:(h=u??[],n[6]=u,n[7]=h);let g;return n[8]!==d||n[9]!==f||n[10]!==p||n[11]!==m||n[12]!==h?(g={entries:h,isLoading:f,isValidating:p,error:d,mutate:m},n[8]=d,n[9]=f,n[10]=p,n[11]=m,n[12]=h,n[13]=g):g=n[13],g}export{s as t};
1
+ import{n as e}from"./vendor-react-BOUWij0V.js";import{r as t,s as n}from"./locale-store-DVGhFXRz.js";import{i as r}from"./vendor-swr-BIWyz7Rc.js";var i=e();function a(e){return t(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function o(e){return(await n(a(e))).payload?.channels??[]}function s(e,t){let n=(0,i.c)(14),s;n[0]!==e||n[1]!==t?(s=e?a(t):null,n[0]=e,n[1]=t,n[2]=s):s=n[2];let c;n[3]===t?c=n[4]:(c=()=>o(t),n[3]=t,n[4]=c);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={revalidateOnFocus:!1},n[5]=l):l=n[5];let{data:u,error:d,isLoading:f,isValidating:p,mutate:m}=r(s,c,l),h;n[6]===u?h=n[7]:(h=u??[],n[6]=u,n[7]=h);let g;return n[8]!==d||n[9]!==f||n[10]!==p||n[11]!==m||n[12]!==h?(g={entries:h,isLoading:f,isValidating:p,error:d,mutate:m},n[8]=d,n[9]=f,n[10]=p,n[11]=m,n[12]=h,n[13]=g):g=n[13],g}export{s as t};
@@ -0,0 +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{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-r8L6Ur3A.js";import{n as u}from"./locale-store-DVGhFXRz.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$t as f,Ac as p,As as m,Bo as h,Cc as g,Cl as _,Eu as v,Go as y,Gt as b,Ho as x,Hs as S,Ht as C,Ic as w,Jl as T,Jt as E,Ks as D,Kt as O,Ns as k,Qt as A,Rc as j,Rs as M,Tl as N,To as P,Uo as F,Us as I,Ut as L,Vo as R,Wo as z,Wt as B,Xt as V,Yl as H,Yt as U,Zt as W,an as G,cn as K,cu as q,dn as ee,en as te,fc as J,gn as ne,hn as Y,hu as re,in as ie,is as X,ln as ae,ls as oe,nn as se,nr as ce,ns as le,oc as ue,on as de,pn as fe,pu as pe,qo as Z,qt as me,rn as he,ro as ge,ru as _e,sn as ve,tn as ye,uc as be,ul as xe,un as Se,us as Ce,uu as we,vt as Te,ws as Ee,xu as De,zo as Oe}from"./index-C1h0zkNo.js";import{t as ke}from"./page-tabs-DWWgy0bF.js";import{t as Ae}from"./time-picker-C0DCya4U.js";import{D as je,E as Me,t as Ne}from"./connector-logo-BPsKIyoM.js";var Pe=n(),Q=e(t(),1),$=r();function Fe(e){let t=(0,Pe.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,s;t[0]===n.timezone?s=t[1]:(s=()=>Y.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=s);let[l,u]=(0,Q.useState)(s),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!Y.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,Q.useState)(d),m;t[4]===n.pronouns?m=t[5]:(m=()=>!!n.pronouns&&!fe.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[h,g]=(0,Q.useState)(m),_;bb0:{if(f){_=`__custom__`;break bb0}_=Y.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let v=_,y;t[6]!==r||t[7]!==n?(y=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=y):y=t[8];let b=y,x;t[9]===a?x=t[10]:(x=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=x);let S=x,C;t[11]===i.callName?C=t[12]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=C);let w;t[13]===b?w=t[14]:(w=e=>b({callName:e.target.value}),t[13]=b,t[14]=w);let T;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==w||t[18]!==n.callName?(T=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:w,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=w,t[18]=n.callName,t[19]=T):T=t[19];let E;t[20]!==C||t[21]!==T?(E=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,T]}),t[20]=C,t[21]=T,t[22]=E):E=t[22];let D;t[23]===i.pronouns?D=t[24]:(D=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=D);let O=h?`__custom__`:n.pronouns,k;t[25]!==b||t[26]!==n.pronouns?(k=e=>{if(e.target.value===`__custom__`){g(!0),fe.some(e=>e.value===n.pronouns)&&b({pronouns:``});return}g(!1),b({pronouns:e.target.value})},t[25]=b,t[26]=n.pronouns,t[27]=k):k=t[27];let A;t[28]===i.pronounsPlaceholder?A=t[29]:(A=(0,$.jsx)(X,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=A);let j;t[30]===S?j=t[31]:(j=fe.map(e=>(0,$.jsx)(X,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[30]=S,t[31]=j);let M;t[32]===i.custom?M=t[33]:(M=(0,$.jsx)(X,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=M);let N;t[34]!==o||t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==M?(N=(0,$.jsxs)(le,{className:o,value:O,onChange:k,children:[A,j,M]}),t[34]=o,t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M,t[40]=N):N=t[40];let P;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==b||t[45]!==n.pronouns?(P=h?(0,$.jsx)(`input`,{className:c(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>b({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=h,t[44]=b,t[45]=n.pronouns,t[46]=P):P=t[46];let F;t[47]!==D||t[48]!==N||t[49]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[D,N,P]}),t[47]=D,t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===i.timezone?I=t[52]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=I);let L;t[53]===o?L=t[54]:(L=c(o,`min-w-0 flex-1`),t[53]=o,t[54]=L);let R;t[55]===b?R=t[56]:(R=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),b({timezone:e.target.value})},t[55]=b,t[56]=R);let z;t[57]===S?z=t[58]:(z=Y.map(e=>(0,$.jsx)(X,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[57]=S,t[58]=z);let B;t[59]===i.timezoneCustom?B=t[60]:(B=(0,$.jsx)(X,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=B);let V;t[61]!==L||t[62]!==R||t[63]!==z||t[64]!==B||t[65]!==v?(V=(0,$.jsxs)(le,{className:L,value:v,onChange:R,children:[z,B]}),t[61]=L,t[62]=R,t[63]=z,t[64]=B,t[65]=v,t[66]=V):V=t[66];let H;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(H=c(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Ee.press),t[67]=H):H=t[67];let U;t[68]===b?U=t[69]:(U=()=>{let e=ne();if(!e)return;let t=Y.some(t=>t.value===e);p(!t),u(t?``:e),b({timezone:e})},t[68]=b,t[69]=U);let W;t[70]!==i.timezoneDetect||t[71]!==U?(W=(0,$.jsx)(`button`,{type:`button`,className:H,onClick:U,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==V||t[74]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[V,W]}),t[73]=V,t[74]=W,t[75]=G):G=t[75];let K;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==b?(K=f?(0,$.jsx)(`input`,{className:c(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),b({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=b,t[80]=K):K=t[80];let q;t[81]!==I||t[82]!==G||t[83]!==K?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[I,G,K]}),t[81]=I,t[82]=G,t[83]=K,t[84]=q):q=t[84];let ee;t[85]===i.notes?ee=t[86]:(ee=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=ee);let te;t[87]===o?te=t[88]:(te=c(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=te);let J;t[89]===b?J=t[90]:(J=e=>b({notes:e.target.value}),t[89]=b,t[90]=J);let re;t[91]!==i.notesPlaceholder||t[92]!==te||t[93]!==J||t[94]!==n.notes?(re=(0,$.jsx)(`textarea`,{className:te,value:n.notes,onChange:J,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=te,t[93]=J,t[94]=n.notes,t[95]=re):re=t[95];let ie;t[96]!==ee||t[97]!==re?(ie=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ee,re]}),t[96]=ee,t[97]=re,t[98]=ie):ie=t[98];let ae;return t[99]!==E||t[100]!==F||t[101]!==q||t[102]!==ie?(ae=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[E,F,q,ie]}),t[99]=E,t[100]=F,t[101]=q,t[102]=ie,t[103]=ae):ae=t[103],ae}function Ie(e){let t=(0,Pe.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:De,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let s;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(s={icon:M,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=s):s=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:H,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:be,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==s||t[14]!==l||t[15]!==u?(d=[o,s,l,u],t[12]=o,t[13]=s,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(F,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Ce)}),t[17]=p):p=t[17];let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=c(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,oe,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=g):g=t[18];let _;t[19]===r.helpTitle?_=t[20]:(_=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=_);let v;t[21]===r.helpSubtitle?v=t[22]:(v=(0,$.jsx)(x,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=v);let b;t[23]!==_||t[24]!==v?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,v]}),t[23]=_,t[24]=v,t[25]=b):b=t[25];let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[26]=S):S=t[26];let C;t[27]===r.close?C=t[28]:(C=(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:S})}),t[27]=r.close,t[28]=C);let w;t[29]!==b||t[30]!==C?(w=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[b,C]}),t[29]=b,t[30]=C,t[31]=w):w=t[31];let T;t[32]===f?T=t[33]:(T=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(Le)}),t[32]=f,t[33]=T);let E;t[34]!==a||t[35]!==i?(E=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=E):E=t[36];let D;t[37]!==r.tabs.sources||t[38]!==E?(D=(0,$.jsx)(m,{type:`button`,variant:`ghost`,onClick:E,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=E,t[39]=D):D=t[39];let O;t[40]!==a||t[41]!==i?(O=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=O):O=t[42];let A;t[43]!==r.openPrivacyControls||t[44]!==O?(A=(0,$.jsx)(m,{type:`button`,variant:`secondary`,onClick:O,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=O,t[45]=A):A=t[45];let j;t[46]!==D||t[47]!==A?(j=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[D,A]}),t[46]=D,t[47]=A,t[48]=j):j=t[48];let N;t[49]!==w||t[50]!==T||t[51]!==j?(N=(0,$.jsxs)(z,{children:[p,(0,$.jsxs)(R,{className:g,children:[w,T,j]})]}),t[49]=w,t[50]=T,t[51]=j,t[52]=N):N=t[52];let P;return t[53]!==i||t[54]!==n||t[55]!==N?(P=(0,$.jsx)(Oe,{open:n,onOpenChange:i,children:N}),t[53]=i,t[54]=n,t[55]=N,t[56]=P):P=t[56],P}function Le(e){let{icon:t,title:n,body:r}=e;return(0,$.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}function Re(e){let t=(0,Pe.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,s=l(r).you,[u,d]=(0,Q.useState)(!1),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?s.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),p,g;t[0]===n?(p=t[1],g=t[2]):(p=()=>{n&&d(!1)},g=[n],t[0]=n,t[1]=p,t[2]=g),(0,Q.useEffect)(p,g);let _;t[3]!==i||t[4]!==a?(_=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=v):v=t[6];let b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[7]=b):b=t[7];let S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(!1),t[8]=S):S=t[8];let C=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,w;t[9]===C?w=t[10]:(w=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,C),t[9]=C,t[10]=w);let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=T):T=t[11];let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>d(!0),t[12]=E):E=t[12];let O=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,A;t[13]===O?A=t[14]:(A=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,O),t[13]=O,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(D,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=j):j=t[15];let M=s.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),N;t[16]===M?N=t[17]:(N=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:M}),t[16]=M,t[17]=N);let P;t[18]!==i||t[19]!==s.cancel?(P=(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(m,{type:`button`,variant:`ghost`,disabled:i,children:s.cancel})}),t[18]=i,t[19]=s.cancel,t[20]=P):P=t[20];let L=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,B;t[21]!==u||t[22]!==o?(B=()=>o(u),t[21]=u,t[22]=o,t[23]=B):B=t[23];let V;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0}),t[24]=V):V=t[24];let U=i?s.disconnecting:s.disconnectAction,W;t[25]!==i||t[26]!==L||t[27]!==B||t[28]!==U?(W=(0,$.jsxs)(m,{type:`button`,variant:`secondary`,className:L,disabled:i,onClick:B,children:[V,U]}),t[25]=i,t[26]=L,t[27]=B,t[28]=U,t[29]=W):W=t[29];let G;return t[30]!==P||t[31]!==W?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[P,W]}),t[30]=P,t[31]=W,t[32]=G):G=t[32],(0,$.jsx)(Oe,{open:n!==null,onOpenChange:_,children:(0,$.jsxs)(z,{children:[v,(0,$.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:s.disconnectTitle}),(0,$.jsx)(x,{className:`mt-1 text-sm text-fg-muted`,children:s.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":s.cancel,disabled:i,children:b})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:s.disconnectAccount.replace(`{{account}}`,f)}):null,(0,$.jsx)(`p`,{children:s.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:S,className:w,children:[T,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:s.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:E,disabled:!n?.derivedUnderstandingCount,className:A,children:[j,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectDeleteTitle}),N]})]})]}),G]})]})})}var ze={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function Be(e){if(e.branding?.logoUrl)return e.branding;let t=ze[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function Ve(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function He(e){return e.status===`active`||e.status===`connected`}function Ue(e,t){return!He(e)||e.learning?.status===`failed`||e.lastSyncStatus===`failed`?{summary:t.sourceNeedsAttention,tone:`attention`,badge:t.attentionTitle}:e.learning?.status===`paused`?{summary:t.sourcePausedSummary,tone:`paused`,badge:t.paused}:e.learning?.status===`queued`||e.learning?.status===`running`?{summary:t.sourceReading,tone:`learning`}:e.learningFunnel.provisionalClaims>0?{summary:Ve(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:Ve(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:Ve(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:Ve(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function We(e,t){let n=e.id.toLocaleLowerCase();return/(github|gitlab|linear|jira)/.test(n)?t.sourcePurposeWork:/(gmail|outlook|slack|teams)/.test(n)?t.sourcePurposeCommunication:/calendar/.test(n)?t.sourcePurposeSchedule:/(docs|drive|notion|sheets|excel|onedrive|one-drive|local-files)/.test(n)?t.sourcePurposeDocuments:t.sourcePurposeDefault}function Ge(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?Ve(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function Ke(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function qe(e,t){let n=Date.parse(e);return Number.isFinite(n)?Te(n,t):e}function Je(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[Ue(e,t).tone]}function Ye(e){let t=(0,Pe.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:s,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let p;t[0]!==n||t[1]!==i?(p=Ue(n,i),t[0]=n,t[1]=i,t[2]=p):p=t[2];let _=p,v,b,S,C,w,T,E,D,O,A,M,N,P,L,B,V;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==_.summary||t[7]!==_.tone||t[8]!==n||t[9]!==i){let e=Ke(n);C=n.learning?.status===`paused`,w=_.tone===`attention`,S=Oe,E=!0,D=o,b=z,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=T):T=t[26],v=R,B=`fixed inset-y-0 right-0 z-[131] flex h-dvh w-[min(34rem,100vw)] flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-elevated`;let a=n.displayName,s;t[27]===n?s=t[28]:(s=Be(n),t[27]=n,t[28]=s);let l;t[29]!==n.displayName||t[30]!==s?(l=(0,$.jsx)(Ne,{connector:{displayName:a,branding:s},size:`sm`}),t[29]=n.displayName,t[30]=s,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(y,{className:`truncate text-base font-semibold text-fg`,children:n.displayName}),t[32]=n.displayName,t[33]=u);let d;t[34]!==n||t[35]!==i?(d=Ge(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let p;t[37]===d?p=t[38]:(p=(0,$.jsx)(x,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=p);let g;t[39]!==u||t[40]!==p?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[39]=u,t[40]=p,t[41]=g):g=t[41];let j;t[42]!==l||t[43]!==g?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,g]}),t[42]=l,t[43]=g,t[44]=j):j=t[44];let I;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[45]=I):I=t[45];let H;t[46]===i.close?H=t[47]:(H=(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.close,children:I})}),t[46]=i.close,t[47]=H),t[48]!==j||t[49]!==H?(V=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[j,H]}),t[48]=j,t[49]=H,t[50]=V):V=t[50],P=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(De,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=U):U=t[51];let W;t[52]===i.sourceOutcomeTitle?W=t[53]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceOutcomeTitle]}),t[52]=i.sourceOutcomeTitle,t[53]=W);let G=_.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,K;t[54]===G?K=t[55]:(K=c(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,G),t[54]=G,t[55]=K);let q;t[56]!==_.summary||t[57]!==K?(q=(0,$.jsx)(`p`,{className:K,children:_.summary}),t[56]=_.summary,t[57]=K,t[58]=q):q=t[58];let ee;t[59]===n.learningFunnel.activeClaims?ee=t[60]:(ee=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=ee);let te;t[61]===i.sourceReliableMetric?te=t[62]:(te=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=te);let J;t[63]!==ee||t[64]!==te?(J=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ee,te]}),t[63]=ee,t[64]=te,t[65]=J):J=t[65];let ne;t[66]===n.learningFunnel.provisionalClaims?ne=t[67]:(ne=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=ne);let Y;t[68]===i.sourcePendingMetric?Y=t[69]:(Y=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=Y);let ie;t[70]!==ne||t[71]!==Y?(ie=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ne,Y]}),t[70]=ne,t[71]=Y,t[72]=ie):ie=t[72];let X;t[73]!==J||t[74]!==ie?(X=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[J,ie]}),t[73]=J,t[74]=ie,t[75]=X):X=t[75];let ae;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(ae=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})]}):null,t[76]=f,t[77]=n.learningFunnel.activeClaims,t[78]=n.learningFunnel.provisionalClaims,t[79]=i.sourceViewUnderstanding,t[80]=ae):ae=t[80],t[81]!==W||t[82]!==q||t[83]!==X||t[84]!==ae?(L=(0,$.jsxs)(`section`,{children:[W,q,X,ae]}),t[81]=W,t[82]=q,t[83]=X,t[84]=ae,t[85]=L):L=t[85],O=`border-t border-edge-subtle pt-5`;let oe;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(_e,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=oe):oe=t[86],t[87]===i.sourceRecentRunTitle?A=t[88]:(A=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[oe,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=A);let se;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(se=Ve(i.sourceRecentRunSummary,{indexed:n.learningFunnel.indexedItems,attributed:n.learningFunnel.attributedItems,claims:n.learningFunnel.activeClaims}),t[89]=n.learningFunnel.activeClaims,t[90]=n.learningFunnel.attributedItems,t[91]=n.learningFunnel.indexedItems,t[92]=i.sourceRecentRunSummary,t[93]=se):se=t[93],t[94]===se?M=t[95]:(M=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:se}),t[94]=se,t[95]=M),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceUpdatedAt,{time:qe(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=_.summary,t[7]=_.tone,t[8]=n,t[9]=i,t[10]=v,t[11]=b,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=D,t[18]=O,t[19]=A,t[20]=M,t[21]=N,t[22]=P,t[23]=L,t[24]=B,t[25]=V}else v=t[10],b=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],D=t[17],O=t[18],A=t[19],M=t[20],N=t[21],P=t[22],L=t[23],B=t[24],V=t[25];let H;t[96]!==O||t[97]!==A||t[98]!==M||t[99]!==N?(H=(0,$.jsxs)(`section`,{className:O,children:[A,M,N]}),t[96]=O,t[97]=A,t[98]=M,t[99]=N,t[100]=H):H=t[100];let U;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(be,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=U):U=t[101];let W;t[102]===i.sourceAccessTitle?W=t[103]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=W);let G;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(pe,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=G):G=t[104];let K;t[105]===i.sourceReadAccess?K=t[106]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[G,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=K);let q;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(pe,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=q):q=t[107];let ee;t[108]===i.sourceMemoryAccess?ee=t[109]:(ee=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[q,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=ee);let te;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(be,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=te):te=t[110];let ne=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,Y;t[111]===ne?Y=t[112]:(Y=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[te,(0,$.jsx)(`span`,{children:ne})]}),t[111]=ne,t[112]=Y);let ie;t[113]!==K||t[114]!==ee||t[115]!==Y?(ie=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[K,ee,Y]}),t[113]=K,t[114]=ee,t[115]=Y,t[116]=ie):ie=t[116];let X;t[117]!==W||t[118]!==ie?(X=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[W,ie]}),t[117]=W,t[118]=ie,t[119]=X):X=t[119];let ae;t[120]!==H||t[121]!==X||t[122]!==P||t[123]!==L?(ae=(0,$.jsxs)(`div`,{className:P,children:[L,H,X]}),t[120]=H,t[121]=X,t[122]=P,t[123]=L,t[124]=ae):ae=t[124];let oe;t[125]===i.sourceManagementTitle?oe=t[126]:(oe=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=oe);let se;t[127]!==a||t[128]!==C||t[129]!==w||t[130]!==s||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(se=He(n)?C||w?(0,$.jsxs)(m,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>s(n),children:[a?(0,$.jsx)(g,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),w?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(m,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=C,t[129]=w,t[130]=s,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=se):se=t[136];let ce;t[137]!==u||t[138]!==n?(ce=()=>u(n),t[137]=u,t[138]=n,t[139]=ce):ce=t[139];let le;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(J,{className:`size-4`,"aria-hidden":!0}),t[140]=le):le=t[140];let de;t[141]!==i.sourceConnectionSettings||t[142]!==ce?(de=(0,$.jsxs)(m,{type:`button`,variant:`secondary`,onClick:ce,children:[le,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=ce,t[143]=de):de=t[143];let fe;t[144]!==d||t[145]!==n?(fe=()=>d(n),t[144]=d,t[145]=n,t[146]=fe):fe=t[146];let Z;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0}),t[147]=Z):Z=t[147];let me;t[148]!==i.disconnect||t[149]!==fe?(me=(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:fe,children:[Z,i.disconnect]}),t[148]=i.disconnect,t[149]=fe,t[150]=me):me=t[150];let he;t[151]!==se||t[152]!==de||t[153]!==me?(he=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[se,de,me]}),t[151]=se,t[152]=de,t[153]=me,t[154]=he):he=t[154];let ge;t[155]!==oe||t[156]!==he?(ge=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[oe,he]}),t[155]=oe,t[156]=he,t[157]=ge):ge=t[157];let ve;t[158]!==v||t[159]!==ae||t[160]!==ge||t[161]!==B||t[162]!==V?(ve=(0,$.jsxs)(v,{className:B,children:[V,ae,ge]}),t[158]=v,t[159]=ae,t[160]=ge,t[161]=B,t[162]=V,t[163]=ve):ve=t[163];let ye;t[164]!==b||t[165]!==T||t[166]!==ve?(ye=(0,$.jsxs)(b,{children:[T,ve]}),t[164]=b,t[165]=T,t[166]=ve,t[167]=ye):ye=t[167];let xe;return t[168]!==S||t[169]!==E||t[170]!==D||t[171]!==ye?(xe=(0,$.jsx)(S,{open:E,onOpenChange:D,children:ye}),t[168]=S,t[169]=E,t[170]=D,t[171]=ye,t[172]=xe):xe=t[172],xe}function Xe(e){let t=(0,Pe.c)(69),{sources:n,language:r,t:i,busyId:a,onAddSource:o,onLearn:l,onPause:u,onConfigure:d,onDisconnect:f,onViewUnderstanding:h}=e,[g,_]=(0,Q.useState)(null),v;if(t[0]!==n||t[1]!==i){let e=n.filter(Qe),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let a;t[3]===i?a=t[4]:(a=(e,t)=>Math.min(...e.accounts.map(e=>Je(e,i)))-Math.min(...t.accounts.map(e=>Je(e,i)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=i,t[4]=a),v=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>Je(e,i)-Je(t,i)||Ge(e,i).localeCompare(Ge(t,i)))})).sort(a),t[0]=n,t[1]=i,t[2]=v}else v=t[2];let y=v,b,x,S,C,w,T,E,D,O;if(t[5]!==y||t[6]!==g||t[7]!==n||t[8]!==i.sourceConnectedSummary||t[9]!==i.sourcesSubtitle||t[10]!==i.sourcesTitle){let e=y.reduce(Ze,0),r;t[20]!==g||t[21]!==n?(r=g?n.find(e=>e.instanceId===g)??null:null,t[20]=g,t[21]=n,t[22]=r):r=t[22],b=r,T=`you-panel-sources`,E=`tabpanel`,D=`you-tab-sources`,O=`space-y-5`,w=`flex flex-wrap items-start justify-between gap-3`,t[23]===i.sourcesTitle?x=t[24]:(x=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.sourcesTitle}),t[23]=i.sourcesTitle,t[24]=x),t[25]===i.sourcesSubtitle?S=t[26]:(S=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:i.sourcesSubtitle}),t[25]=i.sourcesSubtitle,t[26]=S),C=y.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceConnectedSummary,{accounts:e,sources:y.length})}):null,t[5]=y,t[6]=g,t[7]=n,t[8]=i.sourceConnectedSummary,t[9]=i.sourcesSubtitle,t[10]=i.sourcesTitle,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O}else b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19];let k;t[27]!==x||t[28]!==S||t[29]!==C?(k=(0,$.jsxs)(`div`,{children:[x,S,C]}),t[27]=x,t[28]=S,t[29]=C,t[30]=k):k=t[30];let A;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[31]=A):A=t[31];let j;t[32]!==o||t[33]!==i.addSource?(j=(0,$.jsxs)(m,{type:`button`,variant:`primary`,onClick:o,children:[A,i.addSource]}),t[32]=o,t[33]=i.addSource,t[34]=j):j=t[34];let M;t[35]!==k||t[36]!==j||t[37]!==w?(M=(0,$.jsxs)(`div`,{className:w,children:[k,j]}),t[35]=k,t[36]=j,t[37]=w,t[38]=M):M=t[38];let N;t[39]!==y||t[40]!==r||t[41]!==o||t[42]!==i?(N=y.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:y.map(e=>{let{source:t,accounts:n}=e;return(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3.5 sm:px-5`,children:[(0,$.jsx)(Ne,{connector:{displayName:t.displayName,branding:Be(t)},size:`sm`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.displayName}),n.length>1?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ve(i.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:We(t,i)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=Ue(e,i),n=Ke(e);return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:px-5`,onClick:()=>_(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-full`,t.tone===`attention`?`bg-warning`:t.tone===`useful`?`bg-success`:t.tone===`learning`?`bg-accent`:`bg-fg-subtle/50`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Ge(e,i)}),t.badge?(0,$.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t.tone===`attention`?`bg-warning-soft text-fg`:`bg-surface-muted text-fg-muted`),children:t.badge}):null]}),(0,$.jsx)(`span`,{className:c(`mt-1 block text-xs leading-5`,t.tone===`attention`?`text-fg`:`text-fg-muted`),children:t.summary})]}),n?(0,$.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle sm:block`,children:Ve(i.sourceUpdatedAt,{time:qe(n,r)})}):null,(0,$.jsx)(re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]},e.instanceId)})})]},t.id)})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center`,children:[(0,$.jsx)(s,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i.noSources}),(0,$.jsxs)(m,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:o,children:[(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),i.addSource]})]}),t[39]=y,t[40]=r,t[41]=o,t[42]=i,t[43]=N):N=t[43];let P=b?a===`source-learning:${b.instanceId}`:!1,F;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||_(null)},t[44]=F):F=t[44];let I;t[45]===d?I=t[46]:(I=e=>{_(null),d(e)},t[45]=d,t[46]=I);let L;t[47]===f?L=t[48]:(L=e=>{_(null),f(e)},t[47]=f,t[48]=L);let R;t[49]===h?R=t[50]:(R=()=>{_(null),h()},t[49]=h,t[50]=R);let z;t[51]!==r||t[52]!==l||t[53]!==u||t[54]!==b||t[55]!==i||t[56]!==P||t[57]!==I||t[58]!==L||t[59]!==R?(z=(0,$.jsx)(Ye,{source:b,language:r,t:i,busy:P,onOpenChange:F,onLearn:l,onPause:u,onConfigure:I,onDisconnect:L,onViewUnderstanding:R}),t[51]=r,t[52]=l,t[53]=u,t[54]=b,t[55]=i,t[56]=P,t[57]=I,t[58]=L,t[59]=R,t[60]=z):z=t[60];let B;return t[61]!==M||t[62]!==N||t[63]!==z||t[64]!==T||t[65]!==E||t[66]!==D||t[67]!==O?(B=(0,$.jsxs)(`div`,{id:T,role:E,"aria-labelledby":D,className:O,children:[M,N,z]}),t[61]=M,t[62]=N,t[63]=z,t[64]=T,t[65]=E,t[66]=D,t[67]=O,t[68]=B):B=t[68],B}function Ze(e,t){return e+t.accounts.length}function Qe(e){return e.installed}var $e=new Set([`overview`,`memory`,`collaboration`,`sources`,`privacy`]);function et(e){return e&&$e.has(e)?e:`overview`}var tt=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],nt=[`relationship`,`routine`,`long_term_goal`],rt=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function it(e,t){return e.replace(`{{count}}`,String(t))}function at(e){let t=(0,Pe.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function ot(e,t){let n=Date.parse(e);return Number.isFinite(n)?Te(n,t):e}function st(){let e=(0,Pe.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ge,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(ge,{className:`h-64 rounded-2xl`}),(0,$.jsx)(ge,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function ct(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function lt(e){let t=(0,Pe.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:s,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n.statement),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),S=n.status!==`active`,C=S?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,T;t[0]===C?T=t[1]:(T=c(`rounded-xl border p-3.5`,C),t[0]=C,t[1]=T);let E;t[2]!==a||t[3]!==h||t[4]!==f||t[5]!==v||t[6]!==b||t[7]!==n||t[8]!==r||t[9]!==S||t[10]!==s||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(E=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-20 resize-y`),value:h,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),p(!1)},children:i.cancel}),(0,$.jsx)(m,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!h.trim(),onClick:()=>{u(h.trim()),p(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(ue,{className:`size-3 text-accent`,"aria-hidden":!0}),ct(n,i)]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>0?(0,$.jsx)(`span`,{children:it(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,$.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,ot(n.latestEvidenceAt,r))}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:s,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:b,onClick:()=>{if(v){y(null);return}x(!0),U(n.id).then(e=>y(e.history)).finally(()=>x(!1))},children:[(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ot(n.updatedAt,r)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:it(i.evidenceCount,n.evidenceCount)})]}),n.evidenceBasis?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:i.evidenceRuleValue.replace(`{{events}}`,String(n.evidenceBasis.eventCount)).replace(`{{days}}`,String(n.evidenceBasis.activeDays)).replace(`{{window}}`,String(n.evidenceBasis.windowDays))})]}):null,n.confidence===void 0?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,$.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ot(n.validTo,r)})]}):null,n.expiresAt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ot(n.expiresAt,r)})]}):null]})]}),v?(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),v.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:ot(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=h,t[4]=f,t[5]=v,t[6]=b,t[7]=n,t[8]=r,t[9]=S,t[10]=s,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=E):E=t[15];let O;return t[16]!==T||t[17]!==E?(O=(0,$.jsx)(`article`,{className:T,children:E}),t[16]=T,t[17]=E,t[18]=O):O=t[18],O}function ut(e){let t=(0,Pe.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:s}=e,l=typeof n.value.label==`string`?n.value.label:``,u;if(t[0]!==n.class||t[1]!==n.value.hour||t[2]!==n.value.weekday||t[3]!==l||t[4]!==r||t[5]!==i.claimProject||t[6]!==i.claimRelationship||t[7]!==i.claimRoutine){let e=r===`zh`?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];u=n.class===`relationship`?i.claimRelationship.replace(`{{label}}`,l):n.class===`project`?i.claimProject.replace(`{{label}}`,l):i.claimRoutine.replace(`{{weekday}}`,e[Number(n.value.weekday)]??``).replace(`{{hour}}`,String(n.value.hour).padStart(2,`0`)),t[0]=n.class,t[1]=n.value.hour,t[2]=n.value.weekday,t[3]=l,t[4]=r,t[5]=i.claimProject,t[6]=i.claimRelationship,t[7]=i.claimRoutine,t[8]=u}else u=t[8];let d=u,f;t[9]===n.evidence?f=t[10]:(f=new Set(n.evidence.map(dt)),t[9]=n.evidence,t[10]=f);let p;t[11]===f?p=t[12]:(p=[...f],t[11]=f,t[12]=p);let h=p,g=n.state===`provisional`||n.state===`stale`,_=g?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,v;t[13]===_?v=t[14]:(v=c(`rounded-xl border p-3.5`,_),t[13]=_,t[14]=v);let y=i.claimClasses[n.class],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:y}),t[15]=y,t[16]=b);let x;t[17]===d?x=t[18]:(x=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=x);let S;t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{children:[b,x]}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C=i.claimStates[n.state],w;t[22]===C?w=t[23]:(w=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:C}),t[22]=C,t[23]=w);let T;t[24]!==w||t[25]!==S?(T=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[S,w]}),t[24]=w,t[25]=S,t[26]=T):T=t[26];let E;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(E=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:E}),t[31]=E,t[32]=D);let O;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(O=i.observedAt.replace(`{{time}}`,ot(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=O):O=t[36];let A;t[37]===O?A=t[38]:(A=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:O}),t[37]=O,t[38]=A);let j;t[39]!==a||t[40]!==g||t[41]!==s||t[42]!==i.confirm||t[43]!==i.notTrue?(j=g?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`reject`),children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=g,t[41]=s,t[42]=i.confirm,t[43]=i.notTrue,t[44]=j):j=t[44];let M;t[45]!==A||t[46]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[A,j]}),t[45]=A,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i.viewEvidence?N=t[49]:(N=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=N);let P;t[50]===i.evidenceSource?P=t[51]:(P=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=P);let F=h.join(`, `),I;t[52]===F?I=t[53]:(I=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:F}),t[52]=F,t[53]=I);let L;t[54]!==P||t[55]!==I?(L=(0,$.jsxs)(`div`,{children:[P,I]}),t[54]=P,t[55]=I,t[56]=L):L=t[56];let R;t[57]===i.evidenceConfidence?R=t[58]:(R=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=R);let z;t[59]===n.confidence?z=t[60]:(z=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=z);let B;t[61]===z?B=t[62]:(B=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[z,`%`]}),t[61]=z,t[62]=B);let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;t[66]===i.evidenceRule?H=t[67]:(H=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=H);let U;t[68]===i.claimRule?U=t[69]:(U=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=U);let W;t[70]!==H||t[71]!==U?(W=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[H,U]}),t[70]=H,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==L||t[74]!==V||t[75]!==W?(G=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[L,V,W]}),t[73]=L,t[74]=V,t[75]=W,t[76]=G):G=t[76];let K;t[77]!==N||t[78]!==G?(K=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[N,G]}),t[77]=N,t[78]=G,t[79]=K):K=t[79];let q;return t[80]!==T||t[81]!==D||t[82]!==M||t[83]!==K||t[84]!==v?(q=(0,$.jsxs)(`article`,{className:v,children:[T,D,M,K]}),t[80]=T,t[81]=D,t[82]=M,t[83]=K,t[84]=v,t[85]=q):q=t[85],q}function dt(e){return e.sourceInstanceId}function ft(e){let t=(0,Pe.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:s,onDelete:l,onRollback:u}=e,[d,f]=(0,Q.useState)(``),[p,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),v=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,y;t[0]===v?y=t[1]:(y=c(`rounded-xl border p-4`,v),t[0]=v,t[1]=y);let b=i.playbookNames[n.id],x;t[2]===b?x=t[3]:(x=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b}),t[2]=b,t[3]=x);let S;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(S=it(i.playbookRuleCount,n.rules.filter(ht).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=S):S=t[6];let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S}),t[7]=S,t[8]=C);let T;t[9]!==x||t[10]!==C?(T=(0,$.jsxs)(`div`,{children:[x,C]}),t[9]=x,t[10]=C,t[11]=T):T=t[11];let E=n.enabled?i.pausePlaybook:i.resumePlaybook,O;t[12]!==r||t[13]!==a||t[14]!==E?(O=(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:E}),t[12]=r,t[13]=a,t[14]=E,t[15]=O):O=t[15];let k;t[16]!==T||t[17]!==O?(k=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,O]}),t[16]=T,t[17]=O,t[18]=k):k=t[18];let A;t[19]!==r||t[20]!==p||t[21]!==g||t[22]!==l||t[23]!==u||t[24]!==s||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(A=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:c(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:p===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-16 resize-y`),value:g,onChange:e=>_(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>h(null),children:i.cancel}),(0,$.jsx)(m,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!g.trim(),onClick:()=>{s(e.id,{statement:g.trim()}),h(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(le,{value:e.context.supportNeed??``,disabled:r,onChange:t=>s(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(X,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(X,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(le,{value:e.context.channel??``,disabled:r,onChange:t=>s(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(X,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(mt)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>s(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>s(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>s(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{h(e.id),_(e.statement)},children:[(0,$.jsx)(w,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(D,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,$.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(pt).map(t=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,$.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=p,t[21]=g,t[22]=l,t[23]=u,t[24]=s,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=A):A=t[40];let j;t[41]===A?j=t[42]:(j=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:A}),t[41]=A,t[42]=j);let M;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>f(e.target.value),t[43]=M):M=t[43];let N;t[44]!==d||t[45]!==i.newRulePlaceholder?(N=(0,$.jsx)(`input`,{className:rt,value:d,onChange:M,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==d?(P=r||!d.trim(),t[47]=r,t[48]=d,t[49]=P):P=t[49];let F;t[50]!==d||t[51]!==o?(F=()=>{o(d.trim()),f(``)},t[50]=d,t[51]=o,t[52]=F):F=t[52];let I;t[53]!==i.addRule||t[54]!==P||t[55]!==F?(I=(0,$.jsx)(m,{type:`button`,variant:`secondary`,disabled:P,onClick:F,children:i.addRule}),t[53]=i.addRule,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==N||t[58]!==I?(L=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[N,I]}),t[57]=N,t[58]=I,t[59]=L):L=t[59];let R=i.playbookRuleExamples[n.id],z;t[60]===R?z=t[61]:(z=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:R}),t[60]=R,t[61]=z);let B;t[62]!==L||t[63]!==z?(B=(0,$.jsxs)(`div`,{className:`mt-3`,children:[L,z]}),t[62]=L,t[63]=z,t[64]=B):B=t[64];let V;return t[65]!==k||t[66]!==j||t[67]!==y||t[68]!==B?(V=(0,$.jsxs)(`article`,{className:y,children:[k,j,B]}),t[65]=k,t[66]=j,t[67]=y,t[68]=B,t[69]=V):V=t[69],V}function pt(e){return!e.current}function mt(e){return(0,$.jsx)(X,{value:e,children:e},e)}function ht(e){return e.enabled}function gt(e){let t=(0,Pe.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:s,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,$.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let h;t[8]===l.callName?h=t[9]:(h=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=h);let g;t[10]===a?g=t[11]:(g=e=>a(e.target.value),t[10]=a,t[11]=g);let _;t[12]!==i||t[13]!==r||t[14]!==o?(_=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=_):_=t[15];let v=l.meetPlaceholder,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=c(rt,`h-10 flex-1 bg-surface-base/90`),t[16]=y):y=t[16];let b;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==g||t[20]!==_?(b=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:g,onKeyDown:_,placeholder:v,className:y}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=g,t[20]=_,t[21]=b):b=t[21];let x;t[22]!==i||t[23]!==r?(x=i||!r.trim(),t[22]=i,t[23]=r,t[24]=x):x=t[24];let S=i?l.meetSaving:l.meetSave,C;t[25]!==o||t[26]!==x||t[27]!==S?(C=(0,$.jsx)(m,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:x,onClick:o,children:S}),t[25]=o,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==b||t[30]!==C||t[31]!==h?(w=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[h,b,C]}),t[29]=b,t[30]=C,t[31]=h,t[32]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(be,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==s||t[38]!==l.meetLater?(E=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:s,children:l.meetLater}),t[36]=i,t[37]=s,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==p?(D=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=p,t[45]=D):D=t[45],D}function _t(){let e=u(e=>e.language),t=l(e).you,n=a(),[r,s]=i(),p=et(r.get(`tab`)),h=P(e=>e.setPageHeader),g=P(e=>e.clearPageHeader),{data:_,error:y,isLoading:x,mutate:D}=d(`/api/you`,V),[k,j]=(0,Q.useState)(null),[M,F]=(0,Q.useState)(!1),[I,R]=(0,Q.useState)(``),[z,U]=(0,Q.useState)(`preference`),[J,Y]=(0,Q.useState)(!1),[oe,ue]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(!1),[ge,_e]=(0,Q.useState)(null),[Ce,Te]=(0,Q.useState)(!1),[Ee,Oe]=(0,Q.useState)(``),[Ne,Pe]=(0,Q.useState)(!1),[Le,ze]=(0,Q.useState)(null),[Be,Ve]=(0,Q.useState)(!1),[He,Ue]=(0,Q.useState)(!1),[We,Ge]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(null),[Je,Ye]=(0,Q.useState)(!1),[Ze,Qe]=(0,Q.useState)(null),[$e,dt]=(0,Q.useState)(null),[pt,mt]=(0,Q.useState)(!1),[ht,_t]=(0,Q.useState)(null),[vt,yt]=(0,Q.useState)(null),bt=(0,Q.useRef)(null),xt=(0,Q.useRef)(null),St=(0,Q.useRef)(null),Ct=_?.profile??{callName:``,pronouns:``,timezone:``,notes:``},wt=(0,Q.useMemo)(()=>_?.understanding.filter(e=>e.status===`active`)??[],[_]),Tt=(0,Q.useMemo)(()=>_?.understanding.filter(e=>e.status!==`active`)??[],[_]),Et=(0,Q.useMemo)(()=>_?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[_]),Dt=(0,Q.useMemo)(()=>Et.filter(e=>e.state!==`active`),[Et]),Ot=(0,Q.useMemo)(()=>new Map(tt.map(e=>[e,wt.filter(t=>t.facet===e)])),[wt]),kt=Le??_?.controls??null,At=_?.sources.filter(e=>e.installed&&e.enabled)??[],jt=At.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{D()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[D]),(0,Q.useEffect)(()=>{if(p!==`memory`||!vt)return;let e=requestAnimationFrame(()=>{(vt===`profile`?bt:xt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),yt(null)});return()=>cancelAnimationFrame(e)},[vt,p]);async function Mt(e){if(!(!_||We)){Ge(!0);try{let n=await de(e);await D({..._,relationship:n.relationship},{revalidate:!1}),Z({type:`success`,title:t.collaborationTitle,message:t.saved})}catch{Z({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{Ge(!1)}}}async function Nt(e,n){j(`claim:${e.id}`);try{let t=await he(e.id,n);await D(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{Z({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{j(null)}}let Pt=e=>{let t=new URLSearchParams;e!==`overview`&&t.set(`tab`,e),s(t,{replace:!0})},Ft=e=>{yt(e),Pt(`memory`)},It=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},Lt=async e=>{if(e.instanceId){j(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Me(e.instanceId,!1):await je(e.instanceId),await D(),Z({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{j(null)}}},Rt=async e=>{if(e.instanceId){j(`source-learning:${e.instanceId}`);try{await Me(e.instanceId,!0),await D()}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{j(null)}}};(0,Q.useLayoutEffect)(()=>(h({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Ye(!0),children:[(0,$.jsx)(we,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>g()),[g,h,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!_||_.profile.callName||Oe(_.profileSetup.callNameSuggestion?.value??``)},[_,_?.profile.callName,_?.profileSetup.callNameSuggestion?.id]);async function zt(e,n,r){j(e.id);try{let t=await ve(e.id,{action:n,content:r});await D(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),D()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{j(null)}}async function Bt(e,n){j(`consent:${e}`);try{await b(e,n),await D(),Z({type:`success`,title:t.title,message:t.saved})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{j(null)}}async function Vt(){let e=I.trim();if(e){j(`understanding:new`);try{await B({content:e,kind:z}),R(``),F(!1),Y(!1),await D(),Z({type:`success`,title:t.understandingTitle,message:t.saved})}catch{Z({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{j(null)}}}async function Ht(){if(Tt.length){j(`understanding:batch`);try{await C(Tt.map(e=>e.id),`confirm`),await D()}catch{Z({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{j(null)}}}async function Ut(e,n){j(`conflict:${e}`);try{await f(e,n),await D()}catch{Z({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{j(null)}}async function Wt(e){j(`grant:${e}`);try{await te(e),await D()}catch{Z({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{j(null)}}async function Gt(r,i){j(`insight:${r.id}`);try{let t=await ie(r.id,{action:i,uiLocale:e});await D(),i===`apply`&&t.href&&n(t.href)}catch{Z({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{j(null)}}async function Kt(e){j(`playbook:${e.id}`);try{await se(e.id,!e.enabled),await D()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{j(null)}}async function qt(e,n){j(`playbook:${e}`);try{await n(),await D()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{j(null)}}async function Jt(){if(oe){j(oe.id);try{await W(oe.id);let e=oe.id;ue(null),await D(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),D()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{j(null)}}}async function Yt(){if(ge){Te(!0);try{let e=await ae(ge);pe(!1),_e(null),await D(t=>t&&{...t,...e},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Te(!1)}}}async function Xt(){let e=Ee.trim();if(!(!e||Ne)){Pe(!0);try{let t=await ae({callName:e,timezone:Ct.timezone||ne()});await D(e=>e&&{...e,...t},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}async function Zt(){if(!Ne){Pe(!0);try{let e=await Se(`snooze`);await D(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}function Qt(){_e(Ct),pe(!0),Ft(`profile`)}function $t(e,t=!1){U(e),Y(t),F(!0),Pt(`memory`)}function en(){F(!1),Y(!1),R(``)}async function tn(e){if(!Be){ze(e),Ve(!0);try{ze(await K(e)),await D(),Z({type:`success`,title:t.privacyTitle,message:t.saved})}catch{ze(null),Z({type:`error`,title:t.privacyTitle,message:t.saveError})}finally{Ve(!1)}}}async function nn(e){if(!(He||e===_?.trust.defaultActionLevel)){Ue(!0);try{let n=await ee(e);await D(e=>e&&{...e,trust:n},{revalidate:!1}),Z({type:`success`,title:t.trustTitle,message:t.saved})}catch{Z({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ue(!1),qe(null)}}}async function rn(e){if(!(!$e?.instanceId||pt)){mt(!0);try{let n=await me($e.instanceId,e);dt(null),await D(),Z({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{Z({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{mt(!1)}}}async function an(){if(!ht){_t(`export`);try{let e=await E(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{Z({type:`error`,title:t.transferTitle,message:t.saveError})}finally{_t(null)}}}async function on(e){if(!(!e||ht)){_t(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await A(JSON.parse(await e.text()));await D(),Ft(`review`),Z({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{Z({type:`error`,title:t.transferTitle,message:t.importError})}finally{St.current&&(St.current.value=``),Qe(null),_t(null)}}}function sn(){Qe(null),St.current&&(St.current.value=``)}return(0,$.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ke,{items:[{id:`overview`,label:t.tabs.overview,icon:N},{id:`memory`,label:t.tabs.memory,icon:De,count:Tt.length+Dt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:v},{id:`sources`,label:t.tabs.sources,icon:H},{id:`privacy`,label:t.tabs.privacy,icon:be}],activeTab:p,onChange:Pt,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),x?(0,$.jsx)(st,{}):y||!_?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,_&&p===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Ct.callName&&_.profileSetup.shouldPrompt?(0,$.jsx)(gt,{suggestion:_.profileSetup.callNameSuggestion,draft:Ee,busy:Ne,onDraftChange:Oe,onSave:()=>void Xt(),onLater:()=>void Zt(),t}):null,Tt.length>0||Dt.length>0||jt.length>0||!Ct.callName?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[Tt.length+Dt.length>0?(0,$.jsxs)(m,{type:`button`,variant:`secondary`,onClick:()=>Ft(`review`),children:[it(t.reviewCount,Tt.length+Dt.length),(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})]}):null,jt.length>0?(0,$.jsxs)(m,{type:`button`,variant:`secondary`,onClick:()=>Pt(`sources`),children:[it(t.sourceIssues,jt.length),(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})]}):null,Ct.callName?null:(0,$.jsxs)(m,{type:`button`,variant:`secondary`,onClick:Qt,children:[t.completeProfile,(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Pt(`memory`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:wt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Pt(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:At.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Ft(`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Tt.length+Dt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),_.insights.length>0?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(at,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:_.insights.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?it(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:k===`insight:${e.id}`,onClick:()=>void Gt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(m,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:k===`insight:${e.id}`,onClick:()=>void Gt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(q,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Ft(`profile`),children:(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.pronouns||`—`})]}),Ct.notes?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:Ct.notes})]}):null]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(De,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Pt(`memory`),children:(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[wt.slice(0,4).map(e=>(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),wt.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,_&&p===`memory`?(0,$.jsxs)(`div`,{id:`you-panel-memory`,role:`tabpanel`,"aria-labelledby":`you-tab-memory`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.memoryTitle}),(0,$.jsx)(at,{children:t.sharedAgentsBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.memoryHint})]}),(0,$.jsxs)(`section`,{ref:bt,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(q,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(at,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),fe?null:(0,$.jsxs)(m,{type:`button`,variant:`secondary`,onClick:Qt,children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),fe&&ge?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(Fe,{value:ge,onChange:_e,language:e,inputClassName:rt,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>{pe(!1),_e(null)},children:t.cancel}),(0,$.jsx)(m,{type:`button`,variant:`primary`,disabled:Ce,onClick:()=>void Yt(),children:Ce?t.saving:t.save})]})]}):(0,$.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.pronouns||`—`})]}),(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:Ct.notes||`—`})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":M&&!J&&z===`preference`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,M&&!J&&z===`preference`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`preference`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":M&&!J&&z===`boundary`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,M&&!J&&z===`boundary`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`boundary`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":M&&!J&&z===`current_state`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,M&&!J&&z===`current_state`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`current_state`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":M&&J,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,M&&J?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`relationship`,!0),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addOther}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addOtherHint})]})]}),M?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J?t.addOther:z===`preference`?t.addPreference:z===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:J?t.addOtherHint:z===`preference`?t.addPreferenceHint:z===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),J?null:(0,$.jsx)(at,{children:t.understandingKinds[z]})]}),(0,$.jsx)(`textarea`,{className:c(rt,`mt-3 min-h-24 resize-y`),value:I,onChange:e=>R(e.target.value),placeholder:t.understandingPlaceholders[z],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[J?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(le,{value:z,onChange:e=>U(e.target.value),children:nt.map(e=>(0,$.jsx)(X,{value:e,children:t.understandingKinds[e]},e))})]}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,onClick:en,children:t.cancel}),(0,$.jsx)(m,{type:`button`,variant:`primary`,disabled:!I.trim()||k===`understanding:new`,onClick:()=>void Vt(),children:t.add})]})]})]}):null]}),_.conflictGroups.some(e=>e.unresolved)?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,$.jsx)(`div`,{className:`mt-3 space-y-3`,children:_.conflictGroups.filter(e=>e.unresolved).map(n=>(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[ct(r,t),` · `,ot(r.updatedAt,e)]})]}),(0,$.jsx)(m,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:k===`conflict:${n.id}`,onClick:()=>void Ut(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,_.consentRequests.length>0?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),_.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(m,{type:`button`,variant:`ghost`,disabled:k===`consent:${e.id}`,onClick:()=>void Bt(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(m,{type:`button`,variant:`secondary`,disabled:k===`consent:${e.id}`,onClick:()=>void Bt(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(m,{type:`button`,variant:`secondary`,disabled:k===`consent:${e.id}`,onClick:()=>void Bt(e.id,`session`),children:t.consentSession}),(0,$.jsx)(m,{type:`button`,variant:`primary`,disabled:k===`consent:${e.id}`,onClick:()=>void Bt(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,(0,$.jsxs)(`div`,{ref:xt,className:`space-y-6 scroll-mt-6`,children:[Et.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.connectedClaimsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectedClaimsHint})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Et.map(n=>(0,$.jsx)(ut,{claim:n,language:e,t,busy:k===`claim:${n.id}`,onDecision:e=>void Nt(n,e)},n.id))})]}):null,Tt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,$.jsx)(m,{type:`button`,variant:`secondary`,disabled:k===`understanding:batch`,onClick:()=>void Ht(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Tt.map(n=>(0,$.jsx)(lt,{item:n,language:e,t,busy:k===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>ue(n)},n.id))})]}):wt.length>0||Et.some(e=>e.state===`active`)?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,$.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null]}),tt.map(n=>{let r=Ot.get(n)??[];return r.length===0?null:(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,$.jsx)(lt,{item:n,language:e,t,busy:k===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>ue(n)},n.id))})]},n)}),_.understanding.length===0&&Et.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,_&&p===`collaboration`?(0,$.jsxs)(`div`,{id:`you-panel-collaboration`,role:`tabpanel`,"aria-labelledby":`you-tab-collaboration`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.collaborationTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.collaborationHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(N,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,$.jsx)(le,{value:_.relationship.supportMode,disabled:We,onChange:e=>void Mt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(X,{value:e,children:t},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:_.relationship.proactiveEnabled,disabled:We,onChange:e=>void Mt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Ae,{value:_.relationship.quietStart??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Mt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Ae,{value:_.relationship.quietEnd??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Mt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:rt,defaultValue:_.relationship.blockedTopics.join(`, `),disabled:We,onBlur:e=>void Mt({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]}),(0,$.jsx)(`p`,{className:`mt-3 text-right text-xs text-fg-subtle`,children:We?t.saving:t.autoSaveHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(v,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(at,{children:t.affectsAgentsBadge})]}),_.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:_.playbooks.map(e=>(0,$.jsx)(ft,{playbook:e,busy:k===`playbook:${e.id}`,t,onToggleGroup:()=>void Kt(e),onCreate:t=>void qt(e.id,()=>L(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void qt(e.id,()=>G(e.id,t,n)),onDelete:t=>void qt(e.id,()=>O(e.id,t)),onRollback:(t,n)=>void qt(e.id,()=>ye(e.id,t,n))},e.id))}):(0,$.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,_&&p===`sources`?(0,$.jsx)(Xe,{sources:_.sources,language:e,t,busyId:k,onAddSource:()=>n(`/connectors?personalContext=1`),onLearn:e=>void Lt(e),onPause:e=>void Rt(e),onConfigure:It,onDisconnect:dt,onViewUnderstanding:()=>Pt(`memory`)}):null,_&&p===`privacy`&&kt?(0,$.jsxs)(`div`,{id:`you-panel-privacy`,role:`tabpanel`,"aria-labelledby":`you-tab-privacy`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.privacyTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.privacyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,$.jsx)(le,{value:kt.mode,disabled:Be,onChange:e=>void tn({...kt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(X,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(le,{value:kt.sensitiveWritePolicy,disabled:Be,onChange:e=>void tn({...kt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(X,{value:e,children:t},e))}),(0,$.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[kt.sensitiveWritePolicy]})]}),(0,$.jsx)(`p`,{className:`text-right text-xs text-fg-subtle`,children:Be?t.saving:t.autoSaveHint})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:_.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===_.trust.defaultActionLevel,disabled:He,onClick:()=>{e!==_.trust.defaultActionLevel&&(e===`auto`?qe(e):nn(e))},className:c(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===_.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===_.trust.defaultActionLevel?(0,$.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(be,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.sharingTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.sharingHint})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),_.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:_.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${ot(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:k===`grant:${n.id}`,onClick:()=>void Wt(n.id),children:t.revoke})]},n.id))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(m,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>void an(),children:[(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),ht===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(m,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>St.current?.click(),children:[(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),ht===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:St,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>Qe(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(ce,{open:oe!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Jt(),onCancel:()=>ue(null)}),(0,$.jsx)(ce,{open:Ke===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void nn(`auto`),onCancel:()=>qe(null)}),(0,$.jsx)(ce,{open:Ze!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,Ze?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=Ze;Qe(null),on(e)},onCancel:sn}),(0,$.jsx)(Re,{source:$e,language:e,busy:pt,onOpenChange:e=>{e||dt(null)},onConfirm:e=>void rn(e)}),(0,$.jsx)(Ie,{open:Je,t,onOpenChange:Ye,onNavigate:Pt})]})}export{_t as UserContextPage};