@xopcai/xopc 0.0.175 → 0.0.177

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-CM6mQUS2.js → activity-store-Wu2ikfbM.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-eckyE9AY.js → agent-avatar-dicebear-B0_biISn.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-TpIpJk59.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-BfMRS6FX.js → api-DljBt-N5.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DYkzZQzZ.js → app-management-settings-panel-CKoZRi7Y.js} +1 -1
  8. package/dist/gateway/static/root/assets/appearance-settings-DOdXhNDo.js +1 -0
  9. package/dist/gateway/static/root/assets/apps-page-Cxbn5hy8.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-k909a76t.js → archive-plugin-D18gyP76.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CqNzyhdJ.js → attachment-load-CZh9fc8u.js} +2 -2
  12. package/dist/gateway/static/root/assets/{attachment-preview-renderer-DonnL2dL.js → attachment-preview-renderer-Cmo-5BP5.js} +2 -2
  13. package/dist/gateway/static/root/assets/{attachment-process-heavy-RnGYy9bC.js → attachment-process-heavy-B2_kr5EA.js} +3 -3
  14. package/dist/gateway/static/root/assets/{automation-suggestion-card-snNG6u0v.js → automation-suggestion-card-DKrVoiiK.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-page-DYv16QMU.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-PfQ9ZHDF.js → binary-plugins-DdSyGL6M.js} +2 -2
  17. package/dist/gateway/static/root/assets/{block-editor-Xrw-DnE_.js → block-editor-BOpNApiX.js} +6 -6
  18. package/dist/gateway/static/root/assets/{browser-settings-page-G92AdEnX.js → browser-settings-page-DlcqaGu1.js} +4 -4
  19. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DJPF2lUY.js → browser-workflow-inputs-C0SnSj_R.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-workflows-page-BoXs4pgc.js → browser-workflows-page-CzlzH7HA.js} +2 -2
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-QPX4wsGZ.js +7 -0
  22. package/dist/gateway/static/root/assets/{capability-presets-api-BgY-Ysmi.js → capability-presets-api-RM6S7ES5.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DmCeusO8.js +1 -0
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-D32T1EJM.js → channel-recipient-api-B4sha-30.js} +1 -1
  25. package/dist/gateway/static/root/assets/channels-settings-HcKoP1wm.js +1 -0
  26. package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +1 -0
  27. package/dist/gateway/static/root/assets/{connector-logo-C-l8haIK.js → connector-logo-BPsKIyoM.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-DwbThFvd.js +2 -0
  29. package/dist/gateway/static/root/assets/desktop-pet-DjL1GWON.js +1 -0
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-Cldo_pA3.js → desktop-pet-settings-u_abAXh7.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-CMASXbgJ.js → directory-picker-path-field-BoZGualI.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dreaming-settings-BnMx02w0.js → dreaming-settings-s3gn3f9h.js} +3 -3
  33. package/dist/gateway/static/root/assets/{extension-debug-page-mUFs3ign.js → extension-debug-page-DIbMngCF.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BsFBOZ5N.js → extension-page-D94f2bWQ.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-CTEoovnV.js → extension-settings-page-B7TI13ex.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-Bwx-EetD.js → gateway-config-api-Do77rV8R.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CvgyqhR_.js → gateway-settings-Dt1PNJmb.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C8f5KwkT.js → gateway-startup-retry-WaXTw3fi.js} +1 -1
  39. package/dist/gateway/static/root/assets/{goal-create-dialog-Bhynl9LN.js → goal-create-dialog-DEiOOLGU.js} +1 -1
  40. package/dist/gateway/static/root/assets/goal-detail-page-C1Qj4o1K.js +4 -0
  41. package/dist/gateway/static/root/assets/{goals-config-api-CUnfbgHa.js → goals-config-api-BL0fAEns.js} +1 -1
  42. package/dist/gateway/static/root/assets/{goals-page-BAS_liXl.js → goals-page-qJDcEDzc.js} +2 -2
  43. package/dist/gateway/static/root/assets/{goals-settings-Bkk-tOcf.js → goals-settings-DV3ZlrdI.js} +1 -1
  44. package/dist/gateway/static/root/assets/{heartbeat-settings-D9Pldf5E.js → heartbeat-settings-C3kzg6ai.js} +1 -1
  45. package/dist/gateway/static/root/assets/{image-generation-api-D7aCMgOv.js → image-generation-api-BgISY8i-.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-C1h0zkNo.js +212 -0
  47. package/dist/gateway/static/root/assets/index-Da36E3WH.css +1 -0
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CBhtXhHb.js → keyboard-shortcuts-settings-0KSmaPu0.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-DcD4mVId.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-BtJGF3M8.js → local-apps-page-BMrU8u7w.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-DO-u1yS7.js → locale-store-DVGhFXRz.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-0lvwfLAA.js → logs-page-CW5m9Cov.js} +3 -3
  53. package/dist/gateway/static/root/assets/{markdown-split-BGPaeTch.js → markdown-split-BVqbtN9o.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-C_Cx8v6u.js → media-plugins-Dr_wtkNJ.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +3 -0
  56. package/dist/gateway/static/root/assets/{notes-page-CIYy5BKF.js → notes-page-BWZRXsq6.js} +1 -1
  57. package/dist/gateway/static/root/assets/notes-workbench-DdnwNz9x.js +4 -0
  58. package/dist/gateway/static/root/assets/{page-tabs-C2vsdfJO.js → page-tabs-DWWgy0bF.js} +1 -1
  59. package/dist/gateway/static/root/assets/pdf-D4PI9qAw.js +54 -0
  60. package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-D_VT83bW.js → preview-open-alternatives-Bnfs93ZP.js} +1 -1
  62. package/dist/gateway/static/root/assets/{product-open-page-BNP9kZ3Q.js → product-open-page-BR7QFmT-.js} +1 -1
  63. package/dist/gateway/static/root/assets/project-detail-page-B8GeS4dl.js +1 -0
  64. package/dist/gateway/static/root/assets/projects-page-DOeu1Hk_.js +1 -0
  65. package/dist/gateway/static/root/assets/remote-access-hub-De94rxnE.js +1 -0
  66. package/dist/gateway/static/root/assets/{save-bar-controls-BJL6Xb-F.js → save-bar-controls-BzS-rRTP.js} +1 -1
  67. package/dist/gateway/static/root/assets/{schedule-field-CxCPSLbu.js → schedule-field-Cl2IIDAN.js} +1 -1
  68. package/dist/gateway/static/root/assets/{schema-form-Cao1wGbk.js → schema-form-BjKjp5eZ.js} +1 -1
  69. package/dist/gateway/static/root/assets/sessions-page-A7p8G0OJ.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-form-section-9pgClEud.js → settings-form-section-BSDNBfHn.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CQz0gEUK.js → settings-loading-skeleton-BD4peoAv.js} +1 -1
  73. package/dist/gateway/static/root/assets/{settings-page-DgsMzZLm.js → settings-page-S-P3U7at.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-page-layout-BhqupMfG.js → settings-page-layout-BQTLh-86.js} +1 -1
  75. package/dist/gateway/static/root/assets/{setup-status-panel-B7BsWxJt.js → setup-status-panel-W3p6kNyA.js} +1 -1
  76. package/dist/gateway/static/root/assets/{share-preview-page-CC4dQsQN.js → share-preview-page-DQjMxyvw.js} +2 -2
  77. package/dist/gateway/static/root/assets/shares-settings-Xo3N99PO.js +1 -0
  78. package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +1 -0
  79. package/dist/gateway/static/root/assets/skills-page-C019Ml5q.js +2 -0
  80. package/dist/gateway/static/root/assets/{skills-page.utils-CF4AYPQg.js → skills-page.utils-CXnpudm6.js} +1 -1
  81. package/dist/gateway/static/root/assets/{system-settings-panel-CzZHWI4u.js → system-settings-panel-BhFwdYJP.js} +1 -1
  82. package/dist/gateway/static/root/assets/{theme-store-BZWNdSZC.js → theme-store-DQI-HPL-.js} +1 -1
  83. package/dist/gateway/static/root/assets/{time-picker-BC922Mdg.js → time-picker-C0DCya4U.js} +1 -1
  84. package/dist/gateway/static/root/assets/{typed-models-lib-C1S-B1pk.js → typed-models-lib-C-M3Fv2N.js} +1 -1
  85. package/dist/gateway/static/root/assets/{use-channel-catalog-DTiLxcLF.js → use-channel-catalog-Bndq4y4I.js} +1 -1
  86. package/dist/gateway/static/root/assets/user-context-page-fYBzpus-.js +1 -0
  87. package/dist/gateway/static/root/assets/{voice-api-key-field-CtIYRNfI.js → voice-api-key-field-p_g4UI1-.js} +1 -1
  88. package/dist/gateway/static/root/assets/work-discovery-page-DI0gCZRw.js +1 -0
  89. package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +1 -0
  90. package/dist/gateway/static/root/assets/work-page-Z-nUaS_n.js +3 -0
  91. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CHEXVvhH.js +3 -0
  92. package/dist/gateway/static/root/assets/workflows-page-BDfwnM-Y.js +11 -0
  93. package/dist/gateway/static/root/index.html +7 -7
  94. package/dist/package.js +1 -1
  95. package/dist/src/agent/agent-manager.js +7 -7
  96. package/dist/src/agent/context/execution-scope.d.ts +26 -0
  97. package/dist/src/agent/context/execution-scope.js +84 -0
  98. package/dist/src/agent/context/project-context.d.ts +3 -1
  99. package/dist/src/agent/context/project-context.js +26 -8
  100. package/dist/src/agent/embedded/model-runtime.d.ts +1 -2
  101. package/dist/src/agent/embedded/model-runtime.js +17 -29
  102. package/dist/src/agent/embedded/session-runner.js +2 -3
  103. package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
  104. package/dist/src/agent/prompt/system-prompt.js +1 -1
  105. package/dist/src/agent/service/process-direct-streaming.js +7 -4
  106. package/dist/src/agent/session/session-config-service.d.ts +4 -1
  107. package/dist/src/agent/session/session-config-service.js +5 -3
  108. package/dist/src/agent/session/session-inspector.d.ts +6 -0
  109. package/dist/src/agent/session/session-inspector.js +9 -2
  110. package/dist/src/agent/workflow/subagent-runner.js +2 -0
  111. package/dist/src/agent/workflow/types.d.ts +1 -0
  112. package/dist/src/auth/model-credential-store.d.ts +17 -0
  113. package/dist/src/auth/model-credential-store.js +110 -0
  114. package/dist/src/auth/oauth/github-copilot.js +2 -2
  115. package/dist/src/auth/oauth/openai-codex.js +98 -7
  116. package/dist/src/auth/oauth/types.d.ts +4 -1
  117. package/dist/src/auth/oauth/xopc-cloud.js +124 -6
  118. package/dist/src/automations/service/automation-service.d.ts +3 -0
  119. package/dist/src/automations/service/automation-service.js +37 -7
  120. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  121. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  122. package/dist/src/config/agent-profile.js +1 -1
  123. package/dist/src/config/index.js +2 -2
  124. package/dist/src/config/schema.d.ts +21 -0
  125. package/dist/src/config/schema.js +12 -2
  126. package/dist/src/gateway/agents-admin.js +1 -1
  127. package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
  128. package/dist/src/gateway/hono/lib/config-payload.js +1 -0
  129. package/dist/src/gateway/hono/oauth-async.d.ts +5 -0
  130. package/dist/src/gateway/hono/oauth-async.js +20 -8
  131. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  132. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +1 -1
  133. package/dist/src/gateway/hono/routes/config-patch/gateway.js +9 -0
  134. package/dist/src/gateway/hono/routes/goals.js +13 -0
  135. package/dist/src/gateway/hono/routes/home.d.ts +18 -2
  136. package/dist/src/gateway/hono/routes/home.js +19 -0
  137. package/dist/src/gateway/hono/routes/index.js +2 -2
  138. package/dist/src/gateway/hono/routes/proactive.d.ts +4 -0
  139. package/dist/src/gateway/hono/routes/proactive.js +157 -0
  140. package/dist/src/gateway/hono/routes/projects.js +2 -2
  141. package/dist/src/gateway/service/sessions-api.d.ts +2 -1
  142. package/dist/src/gateway/service.d.ts +10 -1
  143. package/dist/src/gateway/service.js +31 -31
  144. package/dist/src/infra/update-restart.js +1 -1
  145. package/dist/src/mobile/notification-service.d.ts +1 -0
  146. package/dist/src/mobile/notification-service.js +38 -18
  147. package/dist/src/mobile/notification-types.d.ts +2 -2
  148. package/dist/src/proactive/events/envelope.d.ts +2 -0
  149. package/dist/src/proactive/events/envelope.js +54 -0
  150. package/dist/src/proactive/events/publisher.d.ts +4 -0
  151. package/dist/src/proactive/events/repository.d.ts +9 -0
  152. package/dist/src/proactive/events/repository.js +62 -0
  153. package/dist/src/proactive/events/types.d.ts +44 -0
  154. package/dist/src/proactive/events/types.js +15 -0
  155. package/dist/src/proactive/execution/agent-executor.d.ts +16 -0
  156. package/dist/src/proactive/execution/agent-executor.js +104 -0
  157. package/dist/src/proactive/execution/context.d.ts +31 -0
  158. package/dist/src/proactive/execution/context.js +72 -0
  159. package/dist/src/proactive/execution/insight.d.ts +4 -0
  160. package/dist/src/proactive/execution/insight.js +74 -0
  161. package/dist/src/proactive/execution/repository.d.ts +23 -0
  162. package/dist/src/proactive/execution/repository.js +122 -0
  163. package/dist/src/proactive/execution/types.d.ts +54 -0
  164. package/dist/src/proactive/execution/types.js +1 -0
  165. package/dist/src/proactive/execution/worker.d.ts +15 -0
  166. package/dist/src/proactive/execution/worker.js +96 -0
  167. package/dist/src/proactive/inbox/repository.d.ts +24 -0
  168. package/dist/src/proactive/inbox/repository.js +117 -0
  169. package/dist/src/proactive/inbox/service.d.ts +17 -0
  170. package/dist/src/proactive/inbox/service.js +22 -0
  171. package/dist/src/proactive/inbox/types.d.ts +38 -0
  172. package/dist/src/proactive/inbox/types.js +1 -0
  173. package/dist/src/proactive/inbox/worker.d.ts +12 -0
  174. package/dist/src/proactive/inbox/worker.js +56 -0
  175. package/dist/src/proactive/index.d.ts +17 -0
  176. package/dist/src/proactive/index.js +11 -0
  177. package/dist/src/proactive/routing/batch-repository.d.ts +27 -0
  178. package/dist/src/proactive/routing/batch-repository.js +56 -0
  179. package/dist/src/proactive/routing/matcher.d.ts +5 -0
  180. package/dist/src/proactive/routing/matcher.js +56 -0
  181. package/dist/src/proactive/routing/types.d.ts +44 -0
  182. package/dist/src/proactive/routing/types.js +1 -0
  183. package/dist/src/proactive/scenarios/prompt-composer.d.ts +14 -0
  184. package/dist/src/proactive/scenarios/prompt-composer.js +24 -0
  185. package/dist/src/proactive/scenarios/repository.d.ts +23 -0
  186. package/dist/src/proactive/scenarios/repository.js +162 -0
  187. package/dist/src/proactive/scenarios/service.d.ts +15 -0
  188. package/dist/src/proactive/scenarios/service.js +26 -0
  189. package/dist/src/proactive/scenarios/types.d.ts +36 -0
  190. package/dist/src/proactive/scenarios/types.js +1 -0
  191. package/dist/src/proactive/service.d.ts +18 -0
  192. package/dist/src/proactive/service.js +61 -0
  193. package/dist/src/projects/project-service.d.ts +3 -1
  194. package/dist/src/projects/project-service.js +62 -32
  195. package/dist/src/providers/index.js +4 -2
  196. package/dist/src/providers/provider-auth-service.d.ts +22 -0
  197. package/dist/src/providers/provider-auth-service.js +66 -0
  198. package/dist/src/providers/register-runtime-providers.d.ts +6 -0
  199. package/dist/src/providers/register-runtime-providers.js +55 -0
  200. package/dist/src/providers/xopc-cloud-account-service.d.ts +2 -2
  201. package/dist/src/providers/xopc-cloud-account-service.js +6 -5
  202. package/dist/src/providers/xopc-cloud-config.d.ts +3 -0
  203. package/dist/src/providers/xopc-cloud-config.js +13 -0
  204. package/dist/src/providers/xopc-cloud-model-source.d.ts +2 -2
  205. package/dist/src/providers/xopc-cloud-model-source.js +6 -5
  206. package/dist/src/session/index.d.ts +1 -1
  207. package/dist/src/session/index.js +2 -2
  208. package/dist/src/session/thinking-resolve.d.ts +8 -0
  209. package/dist/src/session/thinking-resolve.js +6 -3
  210. package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +71 -0
  211. package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +69 -0
  212. package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +55 -0
  213. package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +45 -0
  214. package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +14 -0
  215. package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +13 -0
  216. package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +5 -0
  217. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  218. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  219. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  220. package/dist/src/storage/sqlite/schema.js +1 -1
  221. package/dist/src/tui/tui.js +2 -2
  222. package/dist/src/tui/xopc-tui-keybindings.d.ts +44 -4
  223. package/dist/src/work-discovery/thread-service.d.ts +1 -3
  224. package/dist/src/work-discovery/thread-service.js +13 -25
  225. package/dist/src/work-items/work-item-service.d.ts +3 -1
  226. package/dist/src/work-items/work-item-service.js +67 -36
  227. package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
  228. package/dist/src/workflows/engine/workflow-engine.js +2 -0
  229. package/dist/src/workflows/service/workflow-run-service.js +12 -6
  230. package/dist/src/workflows/service/workflow-session-bridge.js +2 -1
  231. package/package.json +5 -5
  232. package/dist/gateway/static/root/assets/agents-D-OIB_r0.js +0 -2
  233. package/dist/gateway/static/root/assets/api-2SLLStKp.js +0 -1
  234. package/dist/gateway/static/root/assets/appearance-settings-CDXXN57j.js +0 -1
  235. package/dist/gateway/static/root/assets/apps-page-CuvFyvuu.js +0 -1
  236. package/dist/gateway/static/root/assets/automations-page-DetGVTjI.js +0 -6
  237. package/dist/gateway/static/root/assets/capabilities-settings-panel-nS_AMN1K.js +0 -7
  238. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DIO8ZNHW.js +0 -1
  239. package/dist/gateway/static/root/assets/channels-settings-4Im3vtnO.js +0 -1
  240. package/dist/gateway/static/root/assets/channels-status-swr-CMctpuqb.js +0 -1
  241. package/dist/gateway/static/root/assets/connectors-page-vL3SjHSc.js +0 -2
  242. package/dist/gateway/static/root/assets/copy-VueTIC2x.js +0 -1
  243. package/dist/gateway/static/root/assets/desktop-pet-CwOI_Hei.js +0 -1
  244. package/dist/gateway/static/root/assets/focus-detail-page-CCaZthpU.js +0 -1
  245. package/dist/gateway/static/root/assets/goal-detail-page-ChS2rU0w.js +0 -4
  246. package/dist/gateway/static/root/assets/index-DJ5vdaHk.css +0 -1
  247. package/dist/gateway/static/root/assets/index-TnouSpay.js +0 -212
  248. package/dist/gateway/static/root/assets/local-app-workbench-page-HQeu_F1C.js +0 -2
  249. package/dist/gateway/static/root/assets/messages-BP8aQX-5.js +0 -3
  250. package/dist/gateway/static/root/assets/notes-workbench-_FgNPlOx.js +0 -4
  251. package/dist/gateway/static/root/assets/pdf-epILhEOn.js +0 -54
  252. package/dist/gateway/static/root/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
  253. package/dist/gateway/static/root/assets/project-detail-page-MNi-3mZU.js +0 -1
  254. package/dist/gateway/static/root/assets/projects-page-xx8nUKZO.js +0 -1
  255. package/dist/gateway/static/root/assets/remote-access-hub-H5DSn2bR.js +0 -1
  256. package/dist/gateway/static/root/assets/sessions-page-CMQsupwM.js +0 -1
  257. package/dist/gateway/static/root/assets/settings-advanced-gate-OBUdG6bV.js +0 -1
  258. package/dist/gateway/static/root/assets/shares-settings-Bhz21P05.js +0 -1
  259. package/dist/gateway/static/root/assets/skill-reload-api-CBP-UB88.js +0 -1
  260. package/dist/gateway/static/root/assets/skills-page-A0rNObNB.js +0 -2
  261. package/dist/gateway/static/root/assets/user-context-page-8XdpiAyP.js +0 -1
  262. package/dist/gateway/static/root/assets/work-discovery-page-DBer86NF.js +0 -1
  263. package/dist/gateway/static/root/assets/work-item-detail-page-BUPyfYaq.js +0 -1
  264. package/dist/gateway/static/root/assets/work-page-G8phwwI1.js +0 -1
  265. package/dist/gateway/static/root/assets/workflow-run-setup-panel-IKxqDAXw.js +0 -3
  266. package/dist/gateway/static/root/assets/workflows-page-CNls7g6v.js +0 -11
  267. package/dist/src/focuses/candidate-repository.d.ts +0 -15
  268. package/dist/src/focuses/candidate-repository.js +0 -91
  269. package/dist/src/focuses/index.d.ts +0 -7
  270. package/dist/src/focuses/index.js +0 -7
  271. package/dist/src/focuses/insight-repository.d.ts +0 -22
  272. package/dist/src/focuses/insight-repository.js +0 -77
  273. package/dist/src/focuses/prompts.d.ts +0 -2
  274. package/dist/src/focuses/prompts.js +0 -18
  275. package/dist/src/focuses/reconciler.d.ts +0 -5
  276. package/dist/src/focuses/reconciler.js +0 -26
  277. package/dist/src/focuses/repository.d.ts +0 -61
  278. package/dist/src/focuses/repository.js +0 -214
  279. package/dist/src/focuses/run-processor.d.ts +0 -18
  280. package/dist/src/focuses/run-processor.js +0 -162
  281. package/dist/src/focuses/service.d.ts +0 -42
  282. package/dist/src/focuses/service.js +0 -241
  283. package/dist/src/focuses/types.d.ts +0 -89
  284. package/dist/src/gateway/hono/routes/focuses.d.ts +0 -3
  285. package/dist/src/gateway/hono/routes/focuses.js +0 -319
  286. /package/dist/src/{focuses/types.js → proactive/events/publisher.js} +0 -0
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as r}from"./notes-workbench-_FgNPlOx.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as r}from"./notes-workbench-DdnwNz9x.js";var i=e(),a=t();function o(){let e=(0,i.c)(2),{noteId:t}=n(),o;return e[0]===t?o=e[1]:(o=(0,a.jsx)(r,{selectedNoteId:t,basePath:`/notes`,managePageHeader:!0,showLibrary:!0,allowMediaCapture:!0,listWidthStorageKey:`xopc.notes.listWidth`}),e[0]=t,e[1]=o),o}export{o as NotesPage};
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-BOpNApiX.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C1h0zkNo.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/circle-alert-BEjgurr2.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-DVGhFXRz.js","assets/messages-r8L6Ur3A.js","assets/cn-JdwAhgNB.js","assets/schemas-DgQq6Z5S.js","assets/product-delivery-BTRT9kCS.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry-WaXTw3fi.js","assets/activity-store-Wu2ikfbM.js","assets/theme-store-DQI-HPL-.js","assets/index-Da36E3WH.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BvUebh3C.js","assets/code-editor-D4_k-6QN.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-r8L6Ur3A.js";import{l as c,n as l}from"./locale-store-DVGhFXRz.js";import{i as u}from"./theme-store-DQI-HPL-.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Ac as p,Bc as m,Bo as h,Cc as g,Ci as _,Cl as v,Cr as y,Ei as b,Er as x,Fc as S,Fu as C,Go as w,Ho as T,Ic as E,Iu as D,Jc as O,Js as k,Kl as A,Ks as j,Mc as M,Ns as N,Nt as P,Nu as F,Pc as ee,Qc as I,Rc as L,Rl as te,Si as ne,Sl as re,Ti as ie,To as ae,Tu as oe,U as se,Ul as R,Uo as z,Vo as B,Wo as V,_ as ce,_r as H,ac as U,ar as le,bl as W,br as G,cr as ue,dr as de,ec as fe,er as pe,eu as K,fr as me,gc as he,gr as ge,hc as _e,hl as q,hr as J,is as ve,lr as ye,mr as Y,ns as be,oc as xe,or as Se,pr as Ce,qo as we,qs as Te,rc as Ee,ru as De,sr as Oe,tl as ke,tr as Ae,ur as je,vr as Me,wi as X,wr as Ne,xi as Pe,xr as Fe,yl as Ie,yr as Le,zo as Re,zu as ze}from"./index-C1h0zkNo.js";import{t as Be}from"./automation-suggestion-card-DKrVoiiK.js";var Z=n(),Q=e(t(),1),$=r(),Ve=(0,Q.createContext)(null);function He(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Ve);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ue},e[0]=t):t=e[0],t}return t}function Ue(){}function We(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(z,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=o(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=g):g=t[4];let _=a?.alt||`Image preview`,v;t[5]===_?v=t[6]:(v=(0,$.jsx)(w,{className:`sr-only`,children:_}),t[5]=_,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(N,{className:`size-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:y})}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,$.jsxs)(V,{children:[m,(0,$.jsxs)(B,{className:g,"aria-describedby":void 0,children:[v,b,x]})]}),t[12]=b,t[13]=x,t[14]=v,t[15]=S):S=t[15];let C;t[16]!==S||t[17]!==f?(C=(0,$.jsx)(Re,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=C):C=t[18];let T;return t[19]!==n||t[20]!==C?(T=(0,$.jsxs)(Ve.Provider,{value:d,children:[n,C]}),t[19]=n,t[20]=C,t[21]=T):T=t[21],T}function Ge(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=x(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(re,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(Ne,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var Ke=6e4,qe=36e5,Je=864e5;function Ye(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Xe(e,t,n){let r=t-e;if(r<Ke)return n.justNow;if(r<qe){let e=Math.floor(r/Ke);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=Ye(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-Je)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*Je){let e=Math.floor(r/Je);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Ze(e,t,n){let r=Ye(t);if(e>=r)return n.today;if(e>=r-Je)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Qe(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function $e(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function et(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=Ae(),p=Ae(nt),m=d===n&&f===r,h=m&&s,g=m&&c,_=m?l:0,v=m&&u>0?u:i??0,y=v>0?Math.min(_/v*100,100):0,b;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(b=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=b):b=t[4];let x=b,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=o(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=h?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=h?`Pause`:`Play`,O;t[14]!==g||t[15]!==h?(O=g?(0,$.jsx)(ke,{className:`size-3.5 animate-spin`}):h?(0,$.jsx)(L,{className:`size-3.5`}):(0,$.jsx)(M,{className:`size-3.5 ml-0.5`}),t[14]=g,t[15]=h,t[16]=O):O=t[16];let k;t[17]!==x||t[18]!==C||t[19]!==E||t[20]!==D||t[21]!==O?(k=(0,$.jsx)(`button`,{type:`button`,onClick:x,onKeyDown:C,className:E,"aria-label":D,children:O}),t[17]=x,t[18]=C,t[19]=E,t[20]=D,t[21]=O,t[22]=k):k=t[22];let A=`${y}%`,j;t[23]===A?j=t[24]:(j=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:A}})}),t[23]=A,t[24]=j);let N;t[25]!==v||t[26]!==m||t[27]!==_?(N=$e(m&&_>0?_:v),t[25]=v,t[26]=m,t[27]=_,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==j||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[j,P]}),t[31]=j,t[32]=P,t[33]=F):F=t[33];let ee;return t[34]!==F||t[35]!==w||t[36]!==k?(ee=(0,$.jsxs)(`div`,{className:w,onClick:tt,children:[k,F]}),t[34]=F,t[35]=w,t[36]=k,t[37]=ee):ee=t[37],ee}function tt(e){return e.stopPropagation()}function nt(e){return e.toggle}function rt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function it(e){let t=(0,Z.c)(80),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=rt(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let p=f,m=!n.snippet?.trim(),[h]=(0,Q.useState)(ct),g;t[3]!==n.createdAt||t[4]!==h||t[5]!==u?(g=Xe(n.createdAt,h,u),t[3]=n.createdAt,t[4]=h,t[5]=u,t[6]=g):g=t[6];let v=g,y,x;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),x=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=x):(y=t[9],x=t[10]);let C=d?`bg-surface-active hover:bg-surface-active`:`bg-surface-base hover:bg-surface-hover`,w;t[11]===C?w=t[12]:(w=o(`group relative flex cursor-pointer flex-col gap-2 rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,C),t[11]=C,t[12]=w);let T=d?`true`:void 0,E;t[13]!==n.coverAttachmentId||t[14]!==n.id||t[15]!==n.kind||t[16]!==n.voiceAttachmentId||t[17]!==n.voiceDurationSec?(E=n.coverAttachmentId?(0,$.jsx)(Ge,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[13]=n.coverAttachmentId,t[14]=n.id,t[15]=n.kind,t[16]=n.voiceAttachmentId,t[17]=n.voiceDurationSec,t[18]=E):E=t[18];let O;t[19]===n.title?O=t[20]:(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[19]=n.title,t[20]=O);let k=n.title?`text-fg-muted`:m?`italic text-fg-muted`:`text-fg`,M;t[21]===k?M=t[22]:(M=o(`truncate text-sm leading-5`,k),t[21]=k,t[22]=M);let N;t[23]!==p||t[24]!==M?(N=(0,$.jsx)(`p`,{className:M,children:p}),t[23]=p,t[24]=M,t[25]=N):N=t[25];let P;t[26]!==O||t[27]!==N?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,N]}),t[26]=O,t[27]=N,t[28]=P):P=t[28];let F;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:st,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(A,{className:`size-4`})})}),t[29]=F):F=t[29];let I;t[30]!==n.id||t[31]!==n.pinned||t[32]!==a?(I=()=>a(n.id,!n.pinned),t[30]=n.id,t[31]=n.pinned,t[32]=a,t[33]=I):I=t[33];let L;t[34]===n.pinned?L=t[35]:(L=n.pinned?(0,$.jsx)(ee,{className:`size-4`}):(0,$.jsx)(S,{className:`size-4`}),t[34]=n.pinned,t[35]=L);let te=n.pinned?l.unpin:l.pin,re;t[36]!==I||t[37]!==L||t[38]!==te?(re=(0,$.jsxs)(ne,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:I,children:[L,te]}),t[36]=I,t[37]=L,t[38]=te,t[39]=re):re=t[39];let ae;t[40]!==n.id||t[41]!==s?(ae=()=>s(n.id),t[40]=n.id,t[41]=s,t[42]=ae):ae=t[42];let oe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(D,{className:`size-4`}),t[43]=oe):oe=t[43];let se;t[44]!==l.archive||t[45]!==ae?(se=(0,$.jsxs)(ne,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:ae,children:[oe,l.archive]}),t[44]=l.archive,t[45]=ae,t[46]=se):se=t[46];let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ie,{className:`my-1 h-px bg-edge-subtle`}),t[47]=R):R=t[47];let z;t[48]!==n.id||t[49]!==c?(z=()=>c(n.id),t[48]=n.id,t[49]=c,t[50]=z):z=t[50];let B;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(j,{className:`size-4`}),t[51]=B):B=t[51];let V;t[52]!==l.delete||t[53]!==z?(V=(0,$.jsxs)(ne,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[B,l.delete]}),t[52]=l.delete,t[53]=z,t[54]=V):V=t[54];let ce;t[55]!==re||t[56]!==se||t[57]!==V?(ce=(0,$.jsxs)(X,{children:[F,(0,$.jsx)(_,{children:(0,$.jsxs)(Pe,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ot,children:[re,se,R,V]})})]}),t[55]=re,t[56]=se,t[57]=V,t[58]=ce):ce=t[58];let H;t[59]!==P||t[60]!==ce||t[61]!==E?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,P,ce]}),t[59]=P,t[60]=ce,t[61]=E,t[62]=H):H=t[62];let U;t[63]===n.pinned?U=t[64]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(S,{className:`size-3`})}),t[63]=n.pinned,t[64]=U);let le;t[65]===n.tags?le=t[66]:(le=n.tags?.slice(0,2).map(at),t[65]=n.tags,t[66]=le);let W;t[67]===v?W=t[68]:(W=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[67]=v,t[68]=W);let G;t[69]!==U||t[70]!==le||t[71]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,le,W]}),t[69]=U,t[70]=le,t[71]=W,t[72]=G):G=t[72];let ue;return t[73]!==H||t[74]!==G||t[75]!==y||t[76]!==x||t[77]!==w||t[78]!==T?(ue=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:x,className:w,"aria-current":T,children:[H,G]}),t[73]=H,t[74]=G,t[75]=y,t[76]=x,t[77]=w,t[78]=T,t[79]=ue):ue=t[79],ue}function at(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ot(e){return e.stopPropagation()}function st(e){return e.stopPropagation()}function ct(){return Date.now()}var lt={edit:E,ai_edit:xe,sync:g,restore:C};function ut(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function dt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>de(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(async t=>{p(!0);try{await G(e,t),h(null),i()}catch{we({type:`error`,title:a.restoreFailed})}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),_=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=lt[e.trigger]??E,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:ut(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:Xe(e.timestamp,_,c)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),g(e.timestamp)},disabled:f,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})})]})}function ft(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:f,openingChat:p,onOpenChat:m,onOpenNewChat:h}=e,g=s(l(yt)).notes,_=a(),v=r?.aiDeep?.catalysis,y=v?.report??null,b;t[0]===n?b=t[1]:(b=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=b);let x;t[2]===n?x=t[3]:(x=()=>ye(n),t[2]=n,t[3]=x);let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S={revalidateOnFocus:!1},t[4]=S):S=t[4];let{data:C,mutate:w,isLoading:T}=d(b,x,S),E;t[5]===n?E=t[6]:(E=async e=>{try{await Le(n,e)}catch{}},t[5]=n,t[6]=E);let D=E,O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=O):O=t[7];let A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(F,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=A):A=t[8];let j;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(I,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=j):j=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:g.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":g.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:A})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:g.catalysisSectionDescription}),C?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void w(()=>Me(n),{revalidate:!1}),disabled:T,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,C.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:C.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:C.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:g.contextStatusDetail.replace(`{{attachments}}`,String(C.attachments.length)).replace(`{{tokens}}`,String(C.tokenEstimate??0))}),C.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:C.attachments.slice(0,5).map(vt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?g.processing:y?g.recatalyze:g.catalyzeAction}),y?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:y.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.targetUsers.slice(0,5).map(_t)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.keyQuestions.slice(0,3).map(gt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.mvpPath.slice(0,3).map(ht)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.risks.slice(0,3).map(mt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:g.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:y.nextActions.slice(0,4).map(pt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:g.confidenceLabel.replace(`{{percent}}`,String(Math.round(y.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackHelpfulAria,children:(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void D(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,v?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":g.feedbackNotHelpfulAria,children:(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:g.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[j,g.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:g.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:m,disabled:p,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:p?g.openingChat:g.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:p,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:g.newThread})]})]}),f.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:f.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>_(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||g.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:g.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:g.noThreads})]})]})]})}function pt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function ht(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function gt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function _t(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function vt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function yt(e){return e.language}var bt=()=>i(()=>import(`./block-editor-BOpNApiX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])),xt=()=>i(()=>import(`./markdown-editor-BvUebh3C.js`).then(e=>e.n),__vite__mapDeps([28,1,3,25,5,29])),St=(0,Q.lazy)(()=>bt().then(e=>({default:e.BlockEditor}))),Ct=(0,Q.lazy)(()=>xt().then(e=>({default:e.MarkdownEditor})));function wt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Tt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:te},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:K},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:R},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},onFocus:()=>{t===`wysiwyg`&&bt(),t===`source`&&xt()},className:o(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Et(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Dt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(Ot,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)(We,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Dt(e){return e.language}function Ot({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:p,autoFocus:m=!1,onAutoFocusConsumed:h}){let g=l(e=>e.language),_=s(g).notes,b=s(g).automations.suggestions,x=a(),S=u(e=>e.resolved)===`dark`,{openImage:C}=He(),[w,T]=(0,Q.useState)(`wysiwyg`),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[P,ee]=(0,Q.useState)(360),[L,te]=(0,Q.useState)(!1),[ne,re]=(0,Q.useState)(!1),[ie,oe]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),K=(0,Q.useRef)(null),ge=ae(e=>e.setPageHeader),_e=ae(e=>e.clearPageHeader),{data:q,mutate:J}=d(e?[`note-detail`,e]:null,()=>ue(e)),{data:ve=[],mutate:ye}=d(e?[`note-threads`,e]:null,()=>me(e),{revalidateOnFocus:!1}),be=O!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&J()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[J,e]),(0,Q.useEffect)(()=>{R.current=!1,N(``),k(null),D(null),z.current=!1,K.current=null},[e]),(0,Q.useEffect)(()=>{!q||R.current||(N(q.title??``),R.current=!0)},[q]),(0,Q.useEffect)(()=>{if(!m||!q||be||K.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),h?.()});return K.current=e,()=>window.cancelAnimationFrame(t)},[m,be,q,e,h]);let Se=q?new Date(q.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,Ce=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ze,i),children:(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),Te=(0,Q.useCallback)(t=>{N(t),e&&(U.current=t,V.current&&clearTimeout(V.current),V.current=setTimeout(async()=>{let t=U.current;if(U.current=null,t!==null){j(!0);try{await Fe(e,{title:t}),await J(),n?.()}catch{}finally{j(!1)}}},600))},[e,J,n]),Ee=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||Se||void 0,children:M||Se}),A?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,A,Se,M]),De=(0,Q.useCallback)(async(t=!1)=>{oe(!0);try{let n=await Y(e,{forceNew:t});await J(),await ye(),x(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){we({type:`error`,title:_.chatOpenFailedTitle,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{oe(!1)}},[J,ye,x,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{re(!0);try{await le(e),await J()}catch(e){we({type:`error`,title:_.catalysisFailed,message:e instanceof Error?e.message:_.chatOpenFailedMessage})}finally{re(!1)}},[J,e]),ke=(0,Q.useCallback)(()=>{D(E===`breakdown`?null:`breakdown`),!q?.aiDeep?.catalysis?.report&&!ne&&Oe()},[E,ne,Oe,q?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=O?.markdown??H.current??q?.markdown??``,n=O?.title??M,r=f([n,t].filter(Boolean).join(`
3
+
4
+ `));return{source:{type:`note`,id:e,title:n||_.titlePlaceholder},text:r,language:pe(r,g)}},[g,_.titlePlaceholder,q?.markdown,e,O,M]),Me=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,ze),children:[p?(0,$.jsx)(`button`,{type:`button`,onClick:p,"aria-label":_.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(se,{input:Ae,labels:{read:_.readAloud,preparing:_.readAloudPreparing,pause:_.readAloudPause,resume:_.readAloudResume,retry:_.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:ne,"aria-label":_.catalysisSectionTitle,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,E===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),ne?_.catalyzing:_.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(!1),disabled:ie,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),ie?_.openingChat:_.openChatButton]}),(0,$.jsx)(Tt,{mode:w,onModeChange:T,labels:{edit:_.modeEdit,source:_.modeSource,preview:_.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(E===`history`?null:`history`),"aria-label":_.history,className:o(`rounded-lg p-1.5 transition-colors`,E===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}),[ne,ke,De,w,_.history,_.modeEdit,_.modePreview,_.modeSource,ie,E,p,_.searchDialogTitle,_.readAloud,_.readAloudPause,_.readAloudPreparing,_.readAloudResume,_.readAloudRetry,Ae]);(0,Q.useLayoutEffect)(()=>(ge({startExtra:Ce,main:q?Ee:null,end:q?Me:null}),()=>{c&&_e()}),[c,_e,Me,Ee,Ce,q,ge]);let X=(0,Q.useCallback)(t=>{e&&(H.current=t,B.current&&clearTimeout(B.current),B.current=setTimeout(async()=>{let t=H.current;if(H.current=null,t!==null){j(!0);try{await Fe(e,{markdown:t}),await J(),n?.()}catch(e){we({type:`error`,title:_.saveFailed,message:e instanceof Error?e.message:_.saveFailedHint})}finally{j(!1)}}},600))},[e,J,_.saveFailed,_.saveFailedHint,n]),Ne=(0,Q.useCallback)(t=>{je(e,t.timestamp).then(e=>{e&&k(e)})},[e]),Pe=(0,Q.useCallback)(()=>{D(null),k(null)},[]),Ie=(0,Q.useCallback)(()=>{D(null),k(null),J(),n?.()},[J,n]);if((0,Q.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),V.current&&clearTimeout(V.current);let t=H.current,n=U.current;H.current=null,U.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Fe(e,r)},[e]),q===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(q===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:_.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:_.back})]});let Le=be?O.title??``:M,Re=be?O.markdown??``:q.markdown??``,Z=new Date(q.createdAt).getTime(),Ve=Number.isFinite(Z)&&Date.now()-Z<3600*1e3?(0,$.jsx)(Be,{title:b.noteCreatedTitle,description:b.noteCreatedDescription,prompt:b.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(ce,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ce,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(`div`,{ref:W,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:be?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Le&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Le}),Re?(0,$.jsx)(y,{noteId:e,content:Re,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[w===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Te(e.target.value),onCompositionStart:()=>{z.current=!0},onCompositionEnd:()=>{z.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!z.current&&!t.isComposing&&(e.preventDefault(),(W.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(St,{initialContent:q.markdown??``,onChange:X,noteId:e},`wysiwyg-${e}`)})})]}),w===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Te(e.target.value),placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Ve]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(wt,{}),children:(0,$.jsx)(Ct,{initialContent:q.markdown??``,onChange:X,isDark:S},`source-${e}`)})})]}),w===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&C(t.currentSrc||t.src,t.alt)},children:[M&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:M}),q.markdown?(0,$.jsx)(y,{noteId:e,content:q.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]})]})})]}),(0,$.jsx)(`div`,{ref:G,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!L&&`transition-[width] duration-300 ease-in-out`),style:{width:E?P:0},children:(0,$.jsxs)(`div`,{ref:de,className:`flex min-h-0 flex-1 flex-col`,style:{width:P},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),te(!0);let n=e.clientX,r=P,i=e.pointerId,a=0,o=P,s=P,c=()=>{a=0,s=o,E&&G.current?.style.setProperty(`width`,`${s}px`),de.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}te(!1),ee(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:o(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,L&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:E===`history`?(0,$.jsx)(dt,{noteId:e,activeTimestamp:O?.timestamp??null,onSelect:Ne,onClose:Pe,onRestored:Ie}):E===`breakdown`?(0,$.jsx)(ft,{noteId:e,note:q??null,catalyzing:ne,onCatalyze:Oe,onClose:()=>D(null),noteThreads:ve,openingChat:ie,onOpenChat:()=>De(!1),onOpenNewChat:()=>De(!0)}):null})]})})]})}var kt=3e4;function At(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function jt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(0),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(null),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)([]),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useCallback)(()=>{w.current&&=(clearInterval(w.current),null),T.current&&=(clearTimeout(T.current),null),x.current?.getTracks().forEach(e=>e.stop()),x.current=null,b.current=null,S.current=[],m(!1),g(0)},[]);(0,Q.useEffect)(()=>()=>E(),[E]);let D=(0,Q.useCallback)(async()=>{let e=b.current;if(!e||e.state!==`recording`)return;v(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-C.current)/1e3)),n=e.mimeType||At()||`audio/webm`,r=new Blob(S.current,{type:n});if(E(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{v(!1)}return}v(!1)},[E,i]),k=(0,Q.useCallback)(async()=>{if(!(!i||_||p)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=At(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);x.current=e,b.current=n,S.current=[],C.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&S.current.push(e.data)},n.start(),m(!0),g(0),w.current=setInterval(()=>{g(Math.round((Date.now()-C.current)/1e3))},250),T.current=setTimeout(()=>{D()},kt)}catch{E()}},[E,i,p,D,_]),A=(0,Q.useCallback)(()=>{if(p){D();return}k()},[p,k,D]),j=(0,Q.useCallback)(async e=>{let t=l.trim();if(!(!t||d)){f(!0),u(``);try{await n(t,e)}catch{u(t)}finally{f(!1),y.current?.focus()}}},[l,d,n]),M=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),j()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),j({navigate:!1}))},[j]),N=d||_;return(0,$.jsxs)(`div`,{className:o(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,p&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:N||s||p,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(W,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:A,disabled:N||c||d,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,p?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":p?`Stop recording`:`Voice`,"aria-pressed":p,children:p?(0,$.jsx)(Ee,{className:`size-4 fill-current`}):(0,$.jsx)(O,{className:`size-4`})}),p?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(h))}):(0,$.jsx)(`textarea`,{ref:y,value:l,onChange:e=>u(e.target.value),onKeyDown:M,placeholder:e,rows:1,disabled:N,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!l.trim()||N||p,onClick:e=>void j({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,l.trim()&&!N&&!p?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(_e,{className:`size-4`})})]})}var Mt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Nt=240,Pt=320,Ft=520,It=560;function Lt(e){if(globalThis.localStorage===void 0)return Pt;try{let t=globalThis.localStorage.getItem(e);if(!t)return Pt;let n=Number(t);return Number.isFinite(n)?n:Pt}catch{return Pt}}function Rt(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var zt={thought:fe,todo:U,voice:O,media:W,bookmark:oe,mixed:fe,task:U};function Bt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Vt(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function Ht(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Ut({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,listTag:u,captureTags:f=[],listTitle:g,listDescription:_,emptyText:v,emptyDescription:y,listWidthStorageKey:b=`xopc.notes.listWidth`}){let x=s(l(e=>e.language)).notes,C=!!c(e=>e.token),[E,k]=(0,Q.useReducer)(P,Mt),[A,j]=(0,Q.useState)(!1),[M,F]=(0,Q.useState)(``),[ee,I]=(0,Q.useState)(0),[L,te]=(0,Q.useState)(()=>Lt(b)),[ne,re]=(0,Q.useState)(!1),[ie,se]=(0,Q.useState)(!1),[R,ce]=(0,Q.useState)(!1),[le,G]=(0,Q.useState)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),[pe]=(0,Q.useState)(()=>Date.now()),K=a(),me=(0,Q.useCallback)(e=>{let t=ue.current?.clientWidth??window.innerWidth,n=Math.max(Nt,t-It);return Math.max(Nt,Math.min(Math.min(Ft,n),e))},[]),_e=(0,Q.useCallback)(e=>{let t=me(e);te(t),Rt(b,t)},[me,b]);(0,Q.useLayoutEffect)(()=>{te(e=>me(e))},[me]);let{data:ye,mutate:Y,isLoading:xe}=d((0,Q.useMemo)(()=>C?[`notes-list`,u,E.statusFilter,E.kindFilter,E.pinnedOnly]:null,[C,u,E.statusFilter,E.kindFilter,E.pinnedOnly]),()=>Ce({status:E.statusFilter===`all`?void 0:E.statusFilter,kind:E.kindFilter===`all`?void 0:E.kindFilter,tag:u,pinned:E.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),Te=xe&&!ye,Ee=ye?.items??[],ke=ye?.total??0,Ae=M.trim(),{data:je,isLoading:Me}=d(C&&A&&Ae?[`notes-search`,u,Ae]:null,()=>Ce({search:Ae,tag:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=je?.items??[],Ne=e?Ee.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{I(0)},[Ae]),(0,Q.useEffect)(()=>{ee>=X.length&&I(Math.max(0,X.length-1))},[ee,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Pe=ae(e=>e.setPageHeader),Le=ae(e=>e.clearPageHeader),Be=ke>0?x.noteCount.replace(`{{count}}`,String(ke)):null,Z=x.searchDialogTitle,Ve=x.searchClose,He=x.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>j(!0),className:o(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,ze),"aria-label":Z,children:[(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Z})]}),[Z]);(0,Q.useLayoutEffect)(()=>{if(n)return C?(Pe({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,ze),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:g??x.title}),Be?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Be}):null]}),end:Ue}),()=>Le()):(Le(),()=>Le())},[Le,C,Ue,g,n,x.title,Be,e,Pe]);let We=(0,Q.useMemo)(()=>({justNow:x.justNow,minutesAgo:x.minutesAgo,today:x.today,yesterday:x.yesterday,daysAgo:x.daysAgo}),[x.justNow,x.minutesAgo,x.today,x.yesterday,x.daysAgo]),Ge=(0,Q.useMemo)(()=>[{id:`recent`,label:x.viewRecent,description:x.viewRecentDescription,icon:De,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:x.filterInbox,description:x.viewInboxDescription,icon:Ie,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:x.pinned,description:x.viewPinnedDescription,icon:S,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:x.viewTasks,description:x.viewTasksDescription,icon:U,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:x.kindVoice,description:x.viewVoiceDescription,icon:O,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:x.kindMedia,description:x.viewMediaDescription,icon:W,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:x.kindBookmark,description:x.viewBookmarksDescription,icon:oe,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:x.filterProcessed,description:x.viewProcessedDescription,icon:q,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:x.filterArchived,description:x.viewArchiveDescription,icon:D,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[x.filterArchived,x.filterInbox,x.filterProcessed,x.kindBookmark,x.kindMedia,x.kindVoice,x.pinned,x.viewArchiveDescription,x.viewBookmarksDescription,x.viewInboxDescription,x.viewMediaDescription,x.viewPinnedDescription,x.viewProcessedDescription,x.viewRecent,x.viewRecentDescription,x.viewTasks,x.viewTasksDescription,x.viewVoiceDescription]),Ke=Ge.find(e=>Vt(E,e))??Ge[0],qe=g??Ke.label,Je=_??Ke.description,Ye=(0,Q.useCallback)(async(e,n)=>{let r=f.length?await Se({markdown:e,kind:`thought`,tags:f,channel:`web`}):await J(e,`web`);await Y(),n?.navigate!==!1&&K(Ht(t,r.id))},[t,f,Y,K]),$e=(0,Q.useCallback)(async()=>{if(!R){ce(!0);try{let e=await Se({markdown:``,kind:`thought`,tags:f,channel:`web`});k({type:`patch`,patch:Mt}),await Y(),G(e.id),K(Ht(t,e.id))}catch(e){we({type:`error`,title:x.createBlankFailed,message:e instanceof Error?e.message:x.createBlankFailedHint})}finally{ce(!1)}}},[t,f,R,Y,x.createBlankFailed,x.createBlankFailedHint,K]),et=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{await ge(t,`web`),await Y()}catch(e){we({type:`error`,title:x.imageUploadFailed,message:e instanceof Error?e.message:x.imageUploadFailedHint})}},e.click()},[Y,x.imageUploadFailed,x.imageUploadFailedHint]),tt=(0,Q.useCallback)(async(e,t)=>{try{await H(e,t,`web`),await Y()}catch(e){we({type:`error`,title:x.voiceUploadFailed,message:e instanceof Error?e.message:x.voiceUploadFailedHint})}},[Y,x.voiceUploadFailed,x.voiceUploadFailedHint]),nt=(0,Q.useCallback)(async(e,t)=>{await Fe(e,{pinned:t}),await Y()},[Y]),rt=(0,Q.useCallback)(async e=>{await Fe(e,{status:`archived`}),await Y()},[Y]),at=(0,Q.useCallback)(async e=>{await Oe(e),await Y()},[Y]),ot=(0,Q.useCallback)(e=>{K(Ht(t,e))},[t,K]),st=(0,Q.useCallback)(e=>{K(Ht(t,e)),j(!1)},[t,K]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),I(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),I(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[ee]??X[0];t&&st(t.id)}}},[ee,st,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=de.current;t.setPointerCapture(e.pointerId),re(!0);let r=ue.current?.clientWidth??window.innerWidth,i=Math.max(Nt,r-It),a=Math.min(Ft,i),o=e=>Math.max(Nt,Math.min(a,e)),s=e.clientX,c=o(L),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}re(!1),ue.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),te(f),Rt(b,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[b,L]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),$e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$e]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),_e(L-16)):e.key===`ArrowRight`?(e.preventDefault(),_e(L+16)):e.key===`Home`?(e.preventDefault(),_e(Nt)):e.key===`End`&&(e.preventDefault(),_e(Ft))},[_e,L]);return C?(0,$.jsxs)(`div`,{ref:ue,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,style:{"--notes-list-width":`${L}px`},children:[(0,$.jsxs)(`section`,{ref:de,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden bg-surface-panel`,!ne&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ie?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":ie?!0:void 0,children:[(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(be,{value:Ke.id,onChange:e=>{let t=Ge.find(t=>t.id===e.target.value);t&&k({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":x.libraryTitle,children:Ge.map(e=>(0,$.jsx)(ve,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:qe}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Be??Je})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>se(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":x.collapseNotesList,title:x.collapseNotesList,children:(0,$.jsx)(m,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:$e,disabled:R,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":x.createBlankNote,title:x.createBlankShortcut,children:(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>j(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":x.searchDialogTitle,children:(0,$.jsx)(he,{className:`size-4`,"aria-hidden":!0})})]})]})}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:Te?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Ee.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(fe,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Ne?x.noteOutsideCurrentView:v??x.noNotes}),e&&!Ne?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y??x.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Ne?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:x.noteOutsideCurrentView}):null,Ee.map((t,n)=>{let r=n>0?Qe(Ee[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[Qe(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:Ze(t.createdAt,pe,We)}),(0,$.jsx)(it,{note:t,selected:t.id===e,onPress:ot,onPin:nt,onArchive:rt,onDelete:at,timeLabels:We,labels:{pin:x.pin,unpin:x.unpin,archive:x.archive,delete:x.delete,imageNote:x.imageNote,noText:x.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(jt,{placeholder:x.quickCapturePlaceholder,sendLabel:x.send,onCapture:Ye,onImagePick:i?et:void 0,onVoiceCapture:i?tt:void 0,recordingLabel:x.recording})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":x.resizeNotesList,"aria-valuemin":Nt,"aria-valuemax":Ft,"aria-valuenow":Math.round(L),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>_e(Pt),onKeyDown:ut,title:x.resizeNotesList,className:o(`group relative hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,ie?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-3 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:o(`h-8 w-1 rounded-pill opacity-0 transition-[background-color,opacity,transform] duration-150`,`bg-edge-strong/55 group-hover:opacity-100 group-focus-visible:opacity-100`,`group-hover:scale-y-110 group-focus-visible:scale-y-110`,ne&&`bg-accent opacity-100 scale-y-125`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-panel`,!e&&`hidden lg:flex`),children:[ie?(0,$.jsx)(`button`,{type:`button`,onClick:()=>se(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":x.expandNotesList,title:x.expandNotesList,children:(0,$.jsx)(m,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Et,{noteId:e,onBack:()=>K(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>j(!0),autoFocus:e===le,onAutoFocusConsumed:()=>G(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(fe,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:x.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:x.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:$e,disabled:R,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),R?x.creatingBlankNote:x.createBlankNote]})]})})]}),(0,$.jsx)(Re,{open:A,onOpenChange:j,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(z,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(B,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(w,{className:`text-sm font-semibold text-fg`,children:Z}),(0,$.jsx)(T,{className:`sr-only`,children:x.searchPlaceholder}),(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Ve,children:(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(he,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:M,onChange:e=>F(e.target.value),onKeyDown:ct,placeholder:x.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),M?(0,$.jsx)(`button`,{type:`button`,onClick:()=>F(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":He,children:(0,$.jsx)(N,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:Ae?Me&&!je?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(fe,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:x.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:x.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:x.searchResultsCount.replace(`{{count}}`,String(je?.total??X.length))}),X.map((e,t)=>{let n=zt[e.kind]||fe,r=Bt(e,{imageNote:x.imageNote,noText:x.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>st(e.id),onMouseEnter:()=>I(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===ee?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Xe(e.updatedAt,pe,We)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(he,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:x.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:x.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(fe,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x.needToken})]})}export{He as n,Ut 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{ws as a}from"./index-TnouSpay.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l 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{ws as a}from"./index-C1h0zkNo.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-accent-soft text-accent-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=n.findIndex(e=>e.id===r);t<0||l(n[(t+(e.key===`ArrowRight`?1:-1)+n.length)%n.length].id)},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-[10px] tabular-nums text-fg-subtle`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};