@xopcai/xopc 0.0.187 → 0.0.188

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 (216) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/demo-memory/src/index.js +1 -0
  3. package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -3
  4. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +0 -2
  5. package/dist/extensions/telegram/src/draft-stream.d.ts +0 -4
  6. package/dist/extensions/telegram/src/draft-stream.js +1 -53
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/gateway/static/root/assets/{activity-store-WlR2zEvA.js → activity-store--QoUGhiS.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-RedDszrG.js → agent-avatar-dicebear-B0yweLNQ.js} +1 -1
  10. package/dist/gateway/static/root/assets/{agents-Df9mTa-K.js → agents-C6OV-gMm.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-tVOllncq.js → api-5laWqfiE.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-C9hKBzaF.js → app-management-settings-panel-BXJ8Jiv_.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-5cQvq7hd.js → appearance-settings-DG9n9D1M.js} +1 -1
  14. package/dist/gateway/static/root/assets/{apps-page-Bd3tN-k2.js → apps-page-Ci14lDeO.js} +1 -1
  15. package/dist/gateway/static/root/assets/{archive-plugin-Ct-shK4n.js → archive-plugin-Ceh5qrZf.js} +1 -1
  16. package/dist/gateway/static/root/assets/{attachment-load-CpPj3m-q.js → attachment-load-jFW7uYf7.js} +1 -1
  17. package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +6 -0
  18. package/dist/gateway/static/root/assets/{binary-plugins-BpSXZBle.js → binary-plugins-XDlkI1r4.js} +1 -1
  19. package/dist/gateway/static/root/assets/{block-editor-B8hR2tXc.js → block-editor-kyKc2IhE.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-settings-page-jb5Hf-hm.js → browser-settings-page-DbowrHXD.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_LAXUrh.js → browser-workflow-inputs-BJa5Iz_v.js} +1 -1
  22. package/dist/gateway/static/root/assets/{browser-workflows-page-CPAs7-6s.js → browser-workflows-page-CTQQOsn5.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BjUe4raq.js → capabilities-settings-panel-DoZPFdKF.js} +1 -1
  24. package/dist/gateway/static/root/assets/{capability-presets-api-CKklVY2p.js → capability-presets-api-Dn-7MMEo.js} +1 -1
  25. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DiWIMYRr.js → capability-presets-settings-panel-Bt8Hnx0h.js} +1 -1
  26. package/dist/gateway/static/root/assets/{channel-recipient-api-WWN-nbFL.js → channel-recipient-api-BgIkWq01.js} +1 -1
  27. package/dist/gateway/static/root/assets/{channels-settings-D8IkjMuX.js → channels-settings-Bpsebsru.js} +1 -1
  28. package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +1 -0
  29. package/dist/gateway/static/root/assets/{connector-logo-CdNkVFdB.js → connector-logo-TRr9ybf6.js} +1 -1
  30. package/dist/gateway/static/root/assets/{connectors-page-BT2ahw52.js → connectors-page-Tg5kl22i.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-Bm_IEAf3.js → desktop-pet-CSwd00CV.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-settings-C0Ve04-G.js → desktop-pet-settings-CuNQvHGu.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-B2cvhvAI.js → directory-picker-path-field-ct0n5Rje.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-DNashgGu.js → extension-debug-page-BeRBuMUU.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-Bvo-5htX.js → extension-page-DbK-Cwao.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-BBESdISV.js → extension-settings-page-C9ag5tb5.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-api-ClQvokMo.js → gateway-config-api-CC7EvEFp.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-CIRs2QVy.js → gateway-settings-9g8uIry9.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-CntXJF6W.js → gateway-startup-retry-B2DmdlwO.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-CWKcZuvc.js → heartbeat-settings-fl1oC_-5.js} +1 -1
  41. package/dist/gateway/static/root/assets/{home-page-C59f8UJw.js → home-page-Bao9jq_z.js} +1 -1
  42. package/dist/gateway/static/root/assets/{image-generation-api-DjSAQwGy.js → image-generation-api-GMTaS6eI.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +1 -0
  44. package/dist/gateway/static/root/assets/index-OJgiMh07.js +223 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ahKHpjoW.js → keyboard-shortcuts-settings-DhGYddbI.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-app-workbench-page-DRB4UQBE.js → local-app-workbench-page-B69NvtvH.js} +1 -1
  47. package/dist/gateway/static/root/assets/{local-apps-page-B6GKdgza.js → local-apps-page-CmnrBmWi.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-Bff30u5V.js → locale-store-D6hs74o5.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-CNp4XiBN.js → logs-page-Cq3cABqg.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-split-BeNMJm_i.js → markdown-split-CZaBPOVn.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-Bdzrj_-6.js → media-plugins-CiKvSgCv.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +3 -0
  53. package/dist/gateway/static/root/assets/{notes-page-MYIi-9S9.js → notes-page-Bisbzqlz.js} +1 -1
  54. package/dist/gateway/static/root/assets/{notes-workbench-DqSkeDXX.js → notes-workbench-BOZfJFhE.js} +2 -2
  55. package/dist/gateway/static/root/assets/{page-tabs-3t88bbGx.js → page-tabs-BxlwhAbH.js} +1 -1
  56. package/dist/gateway/static/root/assets/{preview-open-alternatives-Cf_BWbeE.js → preview-open-alternatives-RM8wXxfT.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-open-page-CKq73c98.js → product-open-page-DdBlibek.js} +1 -1
  58. package/dist/gateway/static/root/assets/{project-detail-page-BrbHs4Wp.js → project-detail-page-TSKFb2tN.js} +1 -1
  59. package/dist/gateway/static/root/assets/{projects-page-B80rtkj6.js → projects-page-BokeBrTT.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-_Q3GEznb.js → remote-access-hub-C56anxCX.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-NqOm-OG1.js → schema-form-BDKbpmXv.js} +1 -1
  62. package/dist/gateway/static/root/assets/{sessions-page-55dJOUVg.js → sessions-page-C7TQADrD.js} +1 -1
  63. package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +1 -0
  64. package/dist/gateway/static/root/assets/{settings-form-section-DYAS8p8z.js → settings-form-section-zxo5ZGOu.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DZFhxihA.js → settings-loading-skeleton-DgIp8_S6.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-BSIiMLi-.js → settings-page-BUPSIa9P.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-layout-DfFfkdED.js → settings-page-layout-97LmwrzC.js} +1 -1
  68. package/dist/gateway/static/root/assets/{setup-status-panel-q_yE6-H1.js → setup-status-panel-BRg766eW.js} +1 -1
  69. package/dist/gateway/static/root/assets/{share-preview-page-CYtrQaZN.js → share-preview-page-BH7i3g1S.js} +1 -1
  70. package/dist/gateway/static/root/assets/{shares-settings-gYkRX9Ik.js → shares-settings-DhEAviQ_.js} +1 -1
  71. package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +1 -0
  72. package/dist/gateway/static/root/assets/{skills-page-GZHKDFSb.js → skills-page-DoVuprZm.js} +1 -1
  73. package/dist/gateway/static/root/assets/{skills-page.utils-BBXirAjc.js → skills-page.utils-s-a5WV9j.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-DLf5YvFl.js → system-settings-panel-BxjeMT5k.js} +1 -1
  75. package/dist/gateway/static/root/assets/{task-detail-page-DFGkuYfl.js → task-detail-page-BahycnfW.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-y7e_tvYi.js → theme-store-BRxdsmic.js} +1 -1
  77. package/dist/gateway/static/root/assets/{time-picker-5sHEZ5w5.js → time-picker-BGk_Tbsj.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib-DR12j_dr.js → typed-models-lib-39MjwPSq.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-save-bar-registration-BsvcJgZl.js → use-save-bar-registration-5aVSjTjO.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-context-page-q5dr8JFG.js → user-context-page-B9K41qmy.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-DKADXFWD.js → voice-api-key-field-XU-7sBSg.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-BC1nExf8.js → work-discovery-overlay-CJqu8UHq.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-page-fNvSg40M.js → work-discovery-page-BBVnRHju.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C8X5W-8k.js → workflow-run-setup-panel-DXtg8Qxl.js} +1 -1
  85. package/dist/gateway/static/root/assets/{workflows-page-YJBKmPYK.js → workflows-page-Bs_tYfst.js} +1 -1
  86. package/dist/gateway/static/root/index.html +7 -7
  87. package/dist/package.js +1 -1
  88. package/dist/packages/gateway-contract/src/tool-activity.js +223 -0
  89. package/dist/src/agent/agent-manager.js +2 -8
  90. package/dist/src/agent/code-intelligence/binary.js +1 -1
  91. package/dist/src/agent/embedded/run-for-session.d.ts +0 -2
  92. package/dist/src/agent/embedded/run-for-session.js +99 -112
  93. package/dist/src/agent/external-tools/composio-provider.d.ts +29 -0
  94. package/dist/src/agent/external-tools/composio-provider.js +307 -0
  95. package/dist/src/agent/external-tools/extension-provider.d.ts +20 -0
  96. package/dist/src/agent/external-tools/extension-provider.js +68 -0
  97. package/dist/src/agent/external-tools/gateway-tools.d.ts +8 -0
  98. package/dist/src/agent/external-tools/gateway-tools.js +89 -0
  99. package/dist/src/agent/external-tools/index.d.ts +24 -0
  100. package/dist/src/agent/external-tools/index.js +40 -0
  101. package/dist/src/agent/external-tools/mcp-provider.d.ts +29 -0
  102. package/dist/src/agent/external-tools/mcp-provider.js +118 -0
  103. package/dist/src/agent/external-tools/memory-provider.d.ts +21 -0
  104. package/dist/src/agent/external-tools/memory-provider.js +56 -0
  105. package/dist/src/agent/external-tools/refs.d.ts +5 -0
  106. package/dist/src/agent/external-tools/refs.js +18 -0
  107. package/dist/src/agent/external-tools/service.d.ts +26 -0
  108. package/dist/src/agent/external-tools/service.js +117 -0
  109. package/dist/src/agent/external-tools/types.d.ts +28 -0
  110. package/dist/src/agent/external-tools/types.js +9 -0
  111. package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
  112. package/dist/src/agent/inbound/inbound-loop.js +0 -3
  113. package/dist/src/agent/mcp/{bundle-mcp-materialize.d.ts → bundle-mcp-gateway.d.ts} +1 -19
  114. package/dist/src/agent/mcp/bundle-mcp-gateway.js +60 -0
  115. package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -8
  116. package/dist/src/agent/mcp/bundle-mcp-names.js +2 -29
  117. package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +4 -7
  118. package/dist/src/agent/mcp/bundle-mcp-policy.js +6 -20
  119. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  120. package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -2
  121. package/dist/src/agent/mcp/bundle-mcp-tools.js +1 -2
  122. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -5
  123. package/dist/src/agent/mcp/index.d.ts +0 -2
  124. package/dist/src/agent/mcp/index.js +2 -5
  125. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  126. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  127. package/dist/src/agent/memory/context/planner.d.ts +1 -0
  128. package/dist/src/agent/memory/context/planner.js +22 -7
  129. package/dist/src/agent/memory/manager.d.ts +4 -1
  130. package/dist/src/agent/memory/manager.js +5 -2
  131. package/dist/src/agent/memory/types.d.ts +2 -0
  132. package/dist/src/agent/messaging/stream-manager.d.ts +2 -14
  133. package/dist/src/agent/messaging/stream-manager.js +0 -12
  134. package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -3
  135. package/dist/src/agent/orchestration/agent-event-handler.js +0 -36
  136. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -5
  137. package/dist/src/agent/orchestration/agent-orchestrator.js +0 -5
  138. package/dist/src/agent/prompt/sections/behavior.js +6 -4
  139. package/dist/src/agent/service.d.ts +0 -3
  140. package/dist/src/agent/service.js +0 -28
  141. package/dist/src/agent/service.types.d.ts +0 -3
  142. package/dist/src/agent/skills/hub-pull.js +1 -1
  143. package/dist/src/agent/starter-agents.js +2 -2
  144. package/dist/src/agent/tools/delegate-tool.js +5 -1
  145. package/dist/src/agent/tools/executor.js +1 -1
  146. package/dist/src/agent/tools/factory.d.ts +2 -1
  147. package/dist/src/agent/tools/factory.js +16 -22
  148. package/dist/src/agent/tools/index.d.ts +0 -1
  149. package/dist/src/agent/tools/index.js +1 -2
  150. package/dist/src/agent/workflow/workflow-child-tools.js +7 -1
  151. package/dist/src/browser/providers/cloakbrowser.js +1 -1
  152. package/dist/src/channels/channel-domain.d.ts +0 -4
  153. package/dist/src/channels/plugin-types.d.ts +0 -2
  154. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  155. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  156. package/dist/src/connectors/health.js +1 -1
  157. package/dist/src/extensions/extension-registry-impl.d.ts +3 -1
  158. package/dist/src/extensions/extension-registry-impl.js +7 -1
  159. package/dist/src/extensions/loader.js +1 -1
  160. package/dist/src/extensions/types/core.d.ts +2 -1
  161. package/dist/src/extensions/update.js +1 -1
  162. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  163. package/dist/src/gateway/agent-builtin-tools.js +5 -2
  164. package/dist/src/gateway/chat-stream/mapper.js +16 -1
  165. package/dist/src/gateway/chat-stream/protocol.d.ts +4 -0
  166. package/dist/src/gateway/file-reference-errors.d.ts +6 -0
  167. package/dist/src/gateway/file-reference-errors.js +21 -0
  168. package/dist/src/gateway/heartbeat/service.js +1 -1
  169. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  170. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  171. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  172. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  173. package/dist/src/gateway/hono/routes/projects.js +34 -13
  174. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  175. package/dist/src/gateway/hono/routes/workspace.js +34 -13
  176. package/dist/src/gateway/hono/routes/you.js +3 -3
  177. package/dist/src/gateway/service/config-coordinator.js +1 -1
  178. package/dist/src/gateway/service/run-gateway-agent.js +4 -1
  179. package/dist/src/gateway/service.js +6 -6
  180. package/dist/src/heartbeat/index.js +1 -1
  181. package/dist/src/infra/update-runner.js +1 -1
  182. package/dist/src/share/share-zip.js +1 -1
  183. package/dist/src/storage/sqlite/memory-records-repository.js +3 -1
  184. package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +18 -0
  185. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  186. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  187. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  188. package/dist/src/storage/sqlite/schema.js +1 -1
  189. package/dist/src/tui/tool-summary.d.ts +1 -2
  190. package/dist/src/tui/tool-summary.js +2 -18
  191. package/dist/src/tunnel/frpc-binary.js +1 -1
  192. package/dist/src/user-context/projection.d.ts +1 -0
  193. package/dist/src/user-context/projection.js +2 -1
  194. package/dist/src/voice/local/model-files.js +1 -1
  195. package/dist/src/work-discovery/service.js +1 -1
  196. package/package.json +1 -1
  197. package/dist/gateway/static/root/assets/automations-page-w6K9GZQ7.js +0 -6
  198. package/dist/gateway/static/root/assets/channels-status-swr-CySs1GQX.js +0 -1
  199. package/dist/gateway/static/root/assets/index-D-YfWVyS.css +0 -1
  200. package/dist/gateway/static/root/assets/index-vi5KlR5_.js +0 -222
  201. package/dist/gateway/static/root/assets/messages-CPxz48hr.js +0 -3
  202. package/dist/gateway/static/root/assets/settings-advanced-gate-CSFCZj14.js +0 -1
  203. package/dist/gateway/static/root/assets/skill-reload-api-BoNBMKW6.js +0 -1
  204. package/dist/src/agent/feedback/feedback-coordinator.d.ts +0 -73
  205. package/dist/src/agent/feedback/feedback-coordinator.js +0 -156
  206. package/dist/src/agent/feedback/index.d.ts +0 -4
  207. package/dist/src/agent/feedback/index.js +0 -2
  208. package/dist/src/agent/lifecycle/progress.d.ts +0 -90
  209. package/dist/src/agent/lifecycle/progress.js +0 -339
  210. package/dist/src/agent/mcp/bundle-mcp-materialize.js +0 -183
  211. package/dist/src/agent/mcp/mcp-tool-meta.d.ts +0 -8
  212. package/dist/src/agent/mcp/mcp-tool-meta.js +0 -13
  213. package/dist/src/agent/mcp/resolve-embedded-mcp-tools.d.ts +0 -14
  214. package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +0 -48
  215. package/dist/src/agent/tools/composio-tool.d.ts +0 -21
  216. package/dist/src/agent/tools/composio-tool.js +0 -261
@@ -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-CPxz48hr.js";import{n as a}from"./locale-store-Bff30u5V.js";import{Fl as o,Uo as s,ac as c,bi as l,bs as u,gc as d,kt as f,yi as p}from"./index-vi5KlR5_.js";import{n as m,r as h}from"./settings-page-layout-DfFfkdED.js";import{r as g,t as _}from"./settings-form-section-DYAS8p8z.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.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`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)(f,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 l(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)(c,{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`,u.press),onClick:()=>void B(),children:[(0,y.jsx)(d,{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]),s=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return s?(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:s.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.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`,u.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`,u.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`,u.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`,u.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`,u.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(o,{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-D02NNLCZ.js";import{n as a}from"./locale-store-D6hs74o5.js";import{Fl as o,Uo as s,ac as c,bi as l,bs as u,gc as d,kt as f,yi as p}from"./index-OJgiMh07.js";import{n as m,r as h}from"./settings-page-layout-97LmwrzC.js";import{r as g,t as _}from"./settings-form-section-zxo5ZGOu.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.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`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)(f,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 l(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)(c,{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`,u.press),onClick:()=>void B(),children:[(0,y.jsx)(d,{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]),s=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return s?(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:s.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.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`,u.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`,u.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`,u.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`,u.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`,u.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(o,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
@@ -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{d as i,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{l as s,n as c}from"./locale-store-Bff30u5V.js";import{Ct as l,Es as u,Eu as d,Fl as f,Tc as p,Xi as m,Yi as h,do as g,ht as _,jc as v,ks as y,ou as b,pt as x,rt as S,to as C,yt as w}from"./index-vi5KlR5_.js";var T=n(),E=e(t(),1),D=r();function O(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function k(){let e=(0,T.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,D.jsx)(C,{className:`h-32 rounded-2xl`}),(0,D.jsx)(C,{className:`h-52 rounded-2xl`}),(0,D.jsx)(C,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function A(e){let t=(0,T.c)(6),{items:n,empty:r}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,D.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let i;t[2]===n?i=t[3]:(i=n.map(j),t[2]=n,t[3]=i);let a;return t[4]===i?a=t[5]:(a=(0,D.jsx)(`ul`,{className:`space-y-2`,children:i}),t[4]=i,t[5]=a),a}function j(e){return(0,D.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,D.jsx)(b,{className:`mt-1 size-4 shrink-0 text-success`}),(0,D.jsx)(`span`,{children:e})]},e)}function M(){let{taskId:e=``}=i(),[t]=a(),n=c(e=>e.language),r=s(e=>e.token),b=(0,E.useMemo)(()=>x(n),[n]),C=g(e=>e.setPageHeader),T=g(e=>e.clearPageHeader),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(!1),L=(0,E.useMemo)(()=>h(t.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[t]);(0,E.useEffect)(()=>{let t=!0;return M(null),P(null),w(e).then(e=>{t&&M(e)}).catch(()=>{t&&P(b.taskNotFound)}),()=>{t=!1}},[b.taskNotFound,e,r]);let R=async t=>{if(j){I(!0),P(null);try{M(await _(e,t,j.task.version))}catch{P(b.actionFailed)}finally{I(!1)}}};if((0,E.useLayoutEffect)(()=>(C({startExtra:(0,D.jsx)(o,{to:L,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":b.backToWork,children:(0,D.jsx)(d,{className:`size-4`})}),main:j?(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:j.task.title}),(0,D.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[O(j.task.phase,n),` · `,j.operationalState]})]}):null,end:null}),T),[T,b.backToWork,j,n,L,C]),N&&!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:N});if(!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,D.jsx)(k,{})});let z=j.waits[0],B=j.receipts[0],V=j.allowedCommands.includes(`start`),H=j.allowedCommands.includes(`add_wait`);return(0,D.jsxs)(`main`,{className:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`p`,{className:`text-xs font-medium text-accent`,children:[O(j.task.phase,n),` · `,j.operationalState]}),(0,D.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-fg`,children:j.task.title}),j.task.body?(0,D.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:j.task.body}):null]}),j.task.phase===`closed`?null:(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[z?(0,D.jsxs)(u,{disabled:F,onClick:()=>void R({type:`resolve_wait`,waitId:z.id}),children:[(0,D.jsx)(p,{className:`size-4`}),b.resumeTask]}):null,!z&&V?(0,D.jsxs)(u,{disabled:F,onClick:()=>void R({type:`start`,executor:{kind:`agent`,agentId:j.task.delegateAgentId??`main`}}),children:[(0,D.jsx)(p,{className:`size-4`}),b.runTask]}):null,!z&&H?(0,D.jsxs)(u,{variant:`secondary`,disabled:F,onClick:()=>void R({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,D.jsx)(v,{className:`size-4`}),b.pauseTask]}):null,(0,D.jsxs)(u,{variant:`ghost`,disabled:F,onClick:()=>void R({type:`close`,resolution:`cancelled`}),children:[(0,D.jsx)(y,{className:`size-4`}),b.cancelTask]})]})]}),j.task.dueAt?(0,D.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:S(j.task.dueAt)}):null,N?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:N}):null]}),j.attention.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.needsAttention}),(0,D.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:j.attention.map((e,t)=>(0,D.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,D.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.successDefinition}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.acceptanceCriteria??[],empty:b.noDefinition})})]}),(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.expectedOutputs}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.expectedOutputs??[],empty:b.noDefinition})})]})]}),j.dependencies.length>0||j.dependents.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.taskRelations}),(0,D.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:b.dependencies}),j.dependencies.map(e=>(0,D.jsxs)(o,{to:m(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:b.dependents}),j.dependents.map(e=>(0,D.jsxs)(o,{to:m(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]})]})]}):null,(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.executionReceipts}),j.receipts.length===0?(0,D.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:b.noReceipts}):(0,D.jsx)(`div`,{className:`mt-4 space-y-4`,children:j.receipts.map(e=>(0,D.jsxs)(`article`,{className:`border-t border-edge pt-4 first:border-0 first:pt-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`p`,{className:`font-medium text-fg`,children:e.summary}),(0,D.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]}),e.nextAction?(0,D.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e.nextAction}):null,(0,D.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,D.jsx)(u,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void l(e.runId,`helpful`),children:b.doneWell}),(0,D.jsx)(u,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void l(e.runId,`not_helpful`),children:b.needsFix}),e.evidence[0]?.uri?(0,D.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent`,href:e.evidence[0].uri,children:[(0,D.jsx)(f,{className:`size-3`}),b.evidenceDetails]}):null]})]},e.runId))})]}),B?.needsUser?(0,D.jsx)(`p`,{className:`text-sm text-warning`,children:B.nextAction??b.noDecisionNeeded}):null]})}export{M as TaskDetailPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{l as s,n as c}from"./locale-store-D6hs74o5.js";import{Ct as l,Es as u,Eu as d,Fl as f,Tc as p,Xi as m,Yi as h,do as g,ht as _,jc as v,ks as y,ou as b,pt as x,rt as S,to as C,yt as w}from"./index-OJgiMh07.js";var T=n(),E=e(t(),1),D=r();function O(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function k(){let e=(0,T.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,D.jsx)(C,{className:`h-32 rounded-2xl`}),(0,D.jsx)(C,{className:`h-52 rounded-2xl`}),(0,D.jsx)(C,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function A(e){let t=(0,T.c)(6),{items:n,empty:r}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,D.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let i;t[2]===n?i=t[3]:(i=n.map(j),t[2]=n,t[3]=i);let a;return t[4]===i?a=t[5]:(a=(0,D.jsx)(`ul`,{className:`space-y-2`,children:i}),t[4]=i,t[5]=a),a}function j(e){return(0,D.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,D.jsx)(b,{className:`mt-1 size-4 shrink-0 text-success`}),(0,D.jsx)(`span`,{children:e})]},e)}function M(){let{taskId:e=``}=i(),[t]=a(),n=c(e=>e.language),r=s(e=>e.token),b=(0,E.useMemo)(()=>x(n),[n]),C=g(e=>e.setPageHeader),T=g(e=>e.clearPageHeader),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(!1),L=(0,E.useMemo)(()=>h(t.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[t]);(0,E.useEffect)(()=>{let t=!0;return M(null),P(null),w(e).then(e=>{t&&M(e)}).catch(()=>{t&&P(b.taskNotFound)}),()=>{t=!1}},[b.taskNotFound,e,r]);let R=async t=>{if(j){I(!0),P(null);try{M(await _(e,t,j.task.version))}catch{P(b.actionFailed)}finally{I(!1)}}};if((0,E.useLayoutEffect)(()=>(C({startExtra:(0,D.jsx)(o,{to:L,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":b.backToWork,children:(0,D.jsx)(d,{className:`size-4`})}),main:j?(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:j.task.title}),(0,D.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[O(j.task.phase,n),` · `,j.operationalState]})]}):null,end:null}),T),[T,b.backToWork,j,n,L,C]),N&&!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:N});if(!j)return(0,D.jsx)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,D.jsx)(k,{})});let z=j.waits[0],B=j.receipts[0],V=j.allowedCommands.includes(`start`),H=j.allowedCommands.includes(`add_wait`);return(0,D.jsxs)(`main`,{className:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`p`,{className:`text-xs font-medium text-accent`,children:[O(j.task.phase,n),` · `,j.operationalState]}),(0,D.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-fg`,children:j.task.title}),j.task.body?(0,D.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:j.task.body}):null]}),j.task.phase===`closed`?null:(0,D.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[z?(0,D.jsxs)(u,{disabled:F,onClick:()=>void R({type:`resolve_wait`,waitId:z.id}),children:[(0,D.jsx)(p,{className:`size-4`}),b.resumeTask]}):null,!z&&V?(0,D.jsxs)(u,{disabled:F,onClick:()=>void R({type:`start`,executor:{kind:`agent`,agentId:j.task.delegateAgentId??`main`}}),children:[(0,D.jsx)(p,{className:`size-4`}),b.runTask]}):null,!z&&H?(0,D.jsxs)(u,{variant:`secondary`,disabled:F,onClick:()=>void R({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,D.jsx)(v,{className:`size-4`}),b.pauseTask]}):null,(0,D.jsxs)(u,{variant:`ghost`,disabled:F,onClick:()=>void R({type:`close`,resolution:`cancelled`}),children:[(0,D.jsx)(y,{className:`size-4`}),b.cancelTask]})]})]}),j.task.dueAt?(0,D.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:S(j.task.dueAt)}):null,N?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:N}):null]}),j.attention.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.needsAttention}),(0,D.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:j.attention.map((e,t)=>(0,D.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,D.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.successDefinition}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.acceptanceCriteria??[],empty:b.noDefinition})})]}),(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.expectedOutputs}),(0,D.jsx)(`div`,{className:`mt-4`,children:(0,D.jsx)(A,{items:j.task.contract?.expectedOutputs??[],empty:b.noDefinition})})]})]}),j.dependencies.length>0||j.dependents.length>0?(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.taskRelations}),(0,D.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:b.dependencies}),j.dependencies.map(e=>(0,D.jsxs)(o,{to:m(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:b.dependents}),j.dependents.map(e=>(0,D.jsxs)(o,{to:m(`/tasks/${e.id}`,L),className:`block text-sm text-accent hover:underline`,children:[e.title,` · `,O(e.phase,n)]},e.id))]})]})]}):null,(0,D.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:b.executionReceipts}),j.receipts.length===0?(0,D.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:b.noReceipts}):(0,D.jsx)(`div`,{className:`mt-4 space-y-4`,children:j.receipts.map(e=>(0,D.jsxs)(`article`,{className:`border-t border-edge pt-4 first:border-0 first:pt-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,D.jsx)(`p`,{className:`font-medium text-fg`,children:e.summary}),(0,D.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]}),e.nextAction?(0,D.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e.nextAction}):null,(0,D.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,D.jsx)(u,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void l(e.runId,`helpful`),children:b.doneWell}),(0,D.jsx)(u,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void l(e.runId,`not_helpful`),children:b.needsFix}),e.evidence[0]?.uri?(0,D.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent`,href:e.evidence[0].uri,children:[(0,D.jsx)(f,{className:`size-3`}),b.evidenceDetails]}):null]})]},e.runId))})]}),B?.needsUser?(0,D.jsx)(`p`,{className:`text-sm text-warning`,children:B.nextAction??b.noDecisionNeeded}):null]})}export{M as TaskDetailPage};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-Bff30u5V.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-D6hs74o5.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{Yl as o,fs as ee,is as te,ks as ne,ns as re,ps as s,rs as ie}from"./index-vi5KlR5_.js";var ae=n(),c=e(t(),1),l=r(),oe=Array.from({length:24},(e,t)=>t);function se(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 ce(){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,ae.c)(80),{value:n,onChange:r,disabled:d,allowEmpty:de,clearLabel:f,ariaLabel:p,ariaLabelledBy:fe,className:pe,triggerClassName:me,id:he,name:m,minuteStep:ge}=e,h=de===void 0?!1:de,_e=ge===void 0?1:ge,g=se(n),ve=g??ce(),[ye,be]=(0,c.useState)(!1),[_,xe]=(0,c.useState)(ve.hour),[v,Se]=(0,c.useState)(ve.minute),y=(0,c.useRef)([]),Ce=(0,c.useRef)([]),we=re(),Te=ie(),Ee=te(we,Te!==null),De=Math.max(1,Math.min(60,Math.round(_e))),Oe=Array.from({length:Math.ceil(60/De)},(e,t)=>t*De).filter(ue),b;t[0]===r?b=t[1]:(b=(e,t,n)=>{let i=n===void 0?!1:n;xe(e),Se(t),r(u(e,t)),i&&be(!1)},t[0]=r,t[1]=b);let x=b,ke=le,S;t[2]===pe?S=t[3]:(S=a(`relative min-w-0`,pe),t[2]=pe,t[3]=S);let C=s,w;t[4]===n?w=t[5]:(w=e=>{if(e){let e=se(n)??ce();xe(e.hour),Se(e.minute)}be(e)},t[4]=n,t[5]=w);let T=h&&n&&`pr-9`,E=d&&`cursor-not-allowed opacity-50 hover:border-edge`,D;t[6]!==T||t[7]!==E||t[8]!==me?(D=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`,T,E,me),t[6]=T,t[7]=E,t[8]=me,t[9]=D):D=t[9];let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,l.jsx)(o,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=O):O=t[10];let k=!g&&`text-fg-subtle`,A;t[11]===k?A=t[12]:(A=a(`tabular-nums`,k),t[11]=k,t[12]=A);let j=g?u(g.hour,g.minute):`--:--`,M;t[13]!==A||t[14]!==j?(M=(0,l.jsx)(`span`,{className:A,children:j}),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N;t[16]!==p||t[17]!==fe||t[18]!==d||t[19]!==he||t[20]!==M||t[21]!==D?(N=(0,l.jsx)(ee,{asChild:!0,children:(0,l.jsxs)(`button`,{id:he,type:`button`,disabled:d,"aria-label":p,"aria-labelledby":fe,"aria-haspopup":`listbox`,className:D,children:[O,M]})}),t[16]=p,t[17]=fe,t[18]=d,t[19]=he,t[20]=M,t[21]=D,t[22]=N):N=t[22];let P=s,F=Te??void 0,I=s,Ae=a(Ee,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),je=e=>{e.preventDefault(),requestAnimationFrame(()=>y.current[_]?.focus())},L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,l.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=L):L=t[23];let Me=p??`HH:mm`,R;t[24]===Me?R=t[25]:(R=(0,l.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[L,Me]}),t[24]=Me,t[25]=R);let z;t[26]!==_||t[27]!==v?(z=u(_,v),t[26]=_,t[27]=v,t[28]=z):z=t[28];let B;t[29]===z?B=t[30]:(B=(0,l.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:z}),t[29]=z,t[30]=B);let V;t[31]!==R||t[32]!==B?(V=(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[R,B]}),t[31]=R,t[32]=B,t[33]=V):V=t[33];let H;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=H):H=t[34];let Ne=`${p??`HH:mm`} HH`,Pe=oe.map((e,t)=>(0,l.jsx)(`button`,{ref:e=>{y.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:()=>x(e,v),onKeyDown:e=>ke(e,oe,_,e=>x(e,v),y),children:String(e).padStart(2,`0`)},e)),U;t[35]!==Ne||t[36]!==Pe?(U=(0,l.jsxs)(`div`,{className:`pr-2`,children:[H,(0,l.jsx)(`div`,{role:`listbox`,"aria-label":Ne,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Pe})]}),t[35]=Ne,t[36]=Pe,t[37]=U):U=t[37];let W;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=W):W=t[38];let Fe=`${p??`HH:mm`} MM`,Ie=Oe.map((e,t)=>(0,l.jsxs)(`button`,{ref:e=>{Ce.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:()=>x(_,e,!0),onKeyDown:e=>ke(e,Oe,v,e=>x(_,e),Ce),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]!==Fe||t[40]!==Ie?(G=(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[39]=Fe,t[40]=Ie,t[41]=G):G=t[41];let K;t[42]!==W||t[43]!==G?(K=(0,l.jsxs)(`div`,{className:`pl-2`,children:[W,G]}),t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==U||t[46]!==K?(q=(0,l.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[U,K]}),t[45]=U,t[46]=K,t[47]=q):q=t[47];let J;t[48]!==I.Content||t[49]!==Ae||t[50]!==je||t[51]!==V||t[52]!==q?(J=(0,l.jsxs)(I.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Ae,onOpenAutoFocus:je,children:[V,q]}),t[48]=I.Content,t[49]=Ae,t[50]=je,t[51]=V,t[52]=q,t[53]=J):J=t[53];let Y;t[54]!==P.Portal||t[55]!==F||t[56]!==J?(Y=(0,l.jsx)(P.Portal,{container:F,children:J}),t[54]=P.Portal,t[55]=F,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==ye||t[59]!==N||t[60]!==Y||t[61]!==C.Root||t[62]!==w?(X=(0,l.jsxs)(C.Root,{open:ye,onOpenChange:w,children:[N,Y]}),t[58]=ye,t[59]=N,t[60]=Y,t[61]=C.Root,t[62]=w,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)(ne,{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]!==S||t[76]!==X||t[77]!==Z||t[78]!==Q?($=(0,l.jsxs)(`div`,{className:S,children:[X,Z,Q]}),t[75]=S,t[76]=X,t[77]=Z,t[78]=Q,t[79]=$):$=t[79],$}function le(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 ee=t[a];r(ee),i.current?.[a]?.focus()}function ue(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{Yl as o,fs as ee,is as te,ks as ne,ns as re,ps as s,rs as ie}from"./index-OJgiMh07.js";var ae=n(),c=e(t(),1),l=r(),oe=Array.from({length:24},(e,t)=>t);function se(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 ce(){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,ae.c)(80),{value:n,onChange:r,disabled:d,allowEmpty:de,clearLabel:f,ariaLabel:p,ariaLabelledBy:fe,className:pe,triggerClassName:me,id:he,name:m,minuteStep:ge}=e,h=de===void 0?!1:de,_e=ge===void 0?1:ge,g=se(n),ve=g??ce(),[ye,be]=(0,c.useState)(!1),[_,xe]=(0,c.useState)(ve.hour),[v,Se]=(0,c.useState)(ve.minute),y=(0,c.useRef)([]),Ce=(0,c.useRef)([]),we=re(),Te=ie(),Ee=te(we,Te!==null),De=Math.max(1,Math.min(60,Math.round(_e))),Oe=Array.from({length:Math.ceil(60/De)},(e,t)=>t*De).filter(ue),b;t[0]===r?b=t[1]:(b=(e,t,n)=>{let i=n===void 0?!1:n;xe(e),Se(t),r(u(e,t)),i&&be(!1)},t[0]=r,t[1]=b);let x=b,ke=le,S;t[2]===pe?S=t[3]:(S=a(`relative min-w-0`,pe),t[2]=pe,t[3]=S);let C=s,w;t[4]===n?w=t[5]:(w=e=>{if(e){let e=se(n)??ce();xe(e.hour),Se(e.minute)}be(e)},t[4]=n,t[5]=w);let T=h&&n&&`pr-9`,E=d&&`cursor-not-allowed opacity-50 hover:border-edge`,D;t[6]!==T||t[7]!==E||t[8]!==me?(D=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`,T,E,me),t[6]=T,t[7]=E,t[8]=me,t[9]=D):D=t[9];let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,l.jsx)(o,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=O):O=t[10];let k=!g&&`text-fg-subtle`,A;t[11]===k?A=t[12]:(A=a(`tabular-nums`,k),t[11]=k,t[12]=A);let j=g?u(g.hour,g.minute):`--:--`,M;t[13]!==A||t[14]!==j?(M=(0,l.jsx)(`span`,{className:A,children:j}),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N;t[16]!==p||t[17]!==fe||t[18]!==d||t[19]!==he||t[20]!==M||t[21]!==D?(N=(0,l.jsx)(ee,{asChild:!0,children:(0,l.jsxs)(`button`,{id:he,type:`button`,disabled:d,"aria-label":p,"aria-labelledby":fe,"aria-haspopup":`listbox`,className:D,children:[O,M]})}),t[16]=p,t[17]=fe,t[18]=d,t[19]=he,t[20]=M,t[21]=D,t[22]=N):N=t[22];let P=s,F=Te??void 0,I=s,Ae=a(Ee,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),je=e=>{e.preventDefault(),requestAnimationFrame(()=>y.current[_]?.focus())},L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,l.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=L):L=t[23];let Me=p??`HH:mm`,R;t[24]===Me?R=t[25]:(R=(0,l.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[L,Me]}),t[24]=Me,t[25]=R);let z;t[26]!==_||t[27]!==v?(z=u(_,v),t[26]=_,t[27]=v,t[28]=z):z=t[28];let B;t[29]===z?B=t[30]:(B=(0,l.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:z}),t[29]=z,t[30]=B);let V;t[31]!==R||t[32]!==B?(V=(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[R,B]}),t[31]=R,t[32]=B,t[33]=V):V=t[33];let H;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=H):H=t[34];let Ne=`${p??`HH:mm`} HH`,Pe=oe.map((e,t)=>(0,l.jsx)(`button`,{ref:e=>{y.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:()=>x(e,v),onKeyDown:e=>ke(e,oe,_,e=>x(e,v),y),children:String(e).padStart(2,`0`)},e)),U;t[35]!==Ne||t[36]!==Pe?(U=(0,l.jsxs)(`div`,{className:`pr-2`,children:[H,(0,l.jsx)(`div`,{role:`listbox`,"aria-label":Ne,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Pe})]}),t[35]=Ne,t[36]=Pe,t[37]=U):U=t[37];let W;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,l.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=W):W=t[38];let Fe=`${p??`HH:mm`} MM`,Ie=Oe.map((e,t)=>(0,l.jsxs)(`button`,{ref:e=>{Ce.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:()=>x(_,e,!0),onKeyDown:e=>ke(e,Oe,v,e=>x(_,e),Ce),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]!==Fe||t[40]!==Ie?(G=(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[39]=Fe,t[40]=Ie,t[41]=G):G=t[41];let K;t[42]!==W||t[43]!==G?(K=(0,l.jsxs)(`div`,{className:`pl-2`,children:[W,G]}),t[42]=W,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==U||t[46]!==K?(q=(0,l.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[U,K]}),t[45]=U,t[46]=K,t[47]=q):q=t[47];let J;t[48]!==I.Content||t[49]!==Ae||t[50]!==je||t[51]!==V||t[52]!==q?(J=(0,l.jsxs)(I.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Ae,onOpenAutoFocus:je,children:[V,q]}),t[48]=I.Content,t[49]=Ae,t[50]=je,t[51]=V,t[52]=q,t[53]=J):J=t[53];let Y;t[54]!==P.Portal||t[55]!==F||t[56]!==J?(Y=(0,l.jsx)(P.Portal,{container:F,children:J}),t[54]=P.Portal,t[55]=F,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==ye||t[59]!==N||t[60]!==Y||t[61]!==C.Root||t[62]!==w?(X=(0,l.jsxs)(C.Root,{open:ye,onOpenChange:w,children:[N,Y]}),t[58]=ye,t[59]=N,t[60]=Y,t[61]=C.Root,t[62]=w,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)(ne,{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]!==S||t[76]!==X||t[77]!==Z||t[78]!==Q?($=(0,l.jsxs)(`div`,{className:S,children:[X,Z,Q]}),t[75]=S,t[76]=X,t[77]=Z,t[78]=Q,t[79]=$):$=t[79],$}function le(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 ee=t[a];r(ee),i.current?.[a]?.focus()}function ue(e){return e<60}export{d as t};
@@ -1 +1 @@
1
- import{t as e}from"./cn-JdwAhgNB.js";import{Cs as t,Ts as n,ws as r}from"./index-vi5KlR5_.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`,n,`dark:border-edge`)}function a(){return e(r,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{Cs as t,Ts as n,ws as r}from"./index-OJgiMh07.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`,n,`dark:border-edge`)}function a(){return e(r,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{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"./cn-JdwAhgNB.js";import{t as a}from"./messages-CPxz48hr.js";import{n as o,p as s}from"./locale-store-Bff30u5V.js";import{Es as c,qc as l}from"./index-vi5KlR5_.js";var u=e(t(),1),d=n();function f(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var p=s((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...f(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...f(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...f(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...f(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}})),m=r();function h(){let e=(0,d.c)(26),t=a(o(x)).capabilitiesSettings.saveBar,n=p(b),r=p(y),s=p(v),f=p(_),h=p(g),S;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],e[0]=S):S=e[0];let[C,w]=(0,u.useState)(S),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===f?D=e[2]:(D=async()=>{w([]),E(!1);let e=await f();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=f,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,m.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===h?M=e[5]:(M=()=>h(),e[4]=h,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,m.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,m.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,m.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,m.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,m.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,m.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,m.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(s)):T?t.savedSummary:t.cleanSummary}),B]})}function g(e){return e.discardAll}function _(e){return e.saveAll}function v(e){return e.dirtyCount}function y(e){return e.anySaving}function b(e){return e.anyDirty}function x(e){return e.language}function S({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=p(e=>e.registerSection),c=p(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}export{h as n,p as r,S 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"./cn-JdwAhgNB.js";import{t as a}from"./messages-D02NNLCZ.js";import{n as o,p as s}from"./locale-store-D6hs74o5.js";import{Es as c,qc as l}from"./index-OJgiMh07.js";var u=e(t(),1),d=n();function f(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var p=s((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...f(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...f(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...f(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...f(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}})),m=r();function h(){let e=(0,d.c)(26),t=a(o(x)).capabilitiesSettings.saveBar,n=p(b),r=p(y),s=p(v),f=p(_),h=p(g),S;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],e[0]=S):S=e[0];let[C,w]=(0,u.useState)(S),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===f?D=e[2]:(D=async()=>{w([]),E(!1);let e=await f();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=f,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,m.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===h?M=e[5]:(M=()=>h(),e[4]=h,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,m.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,m.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,m.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,m.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,m.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,m.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,m.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(s)):T?t.savedSummary:t.cleanSummary}),B]})}function g(e){return e.discardAll}function _(e){return e.saveAll}function v(e){return e.dirtyCount}function y(e){return e.anySaving}function b(e){return e.anyDirty}function x(e){return e.language}function S({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=p(e=>e.registerSection),c=p(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}export{h as n,p as r,S as t};