@xopcai/xopc 0.0.246 → 0.0.248

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 (199) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/update-offset-store.js +17 -54
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/extensions/weixin/src/auth/accounts.js +3 -5
  5. package/dist/extensions/weixin/src/monitor/monitor.js +3 -5
  6. package/dist/extensions/weixin/src/storage/sync-buf.d.ts +3 -6
  7. package/dist/extensions/weixin/src/storage/sync-buf.js +9 -22
  8. package/dist/gateway/static/root/assets/{activity-store-BlxqErph.js → activity-store-etpmyV7S.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CJJzpYYS.js → agent-avatar-dicebear-BmKxSM1k.js} +1 -1
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CUXApfcE.js +1 -0
  11. package/dist/gateway/static/root/assets/{agents-je3sRGmk.js → agents-DNq_GKuc.js} +1 -1
  12. package/dist/gateway/static/root/assets/{api-BbXzyQMj.js → api-B0-hLuZ1.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-Cnn3i00c.js → app-management-settings-panel-qfwAgyhQ.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-BToQaw_v.js → appearance-settings-DqQVUpCC.js} +1 -1
  15. package/dist/gateway/static/root/assets/apps-page-dwIqYmXk.js +1 -0
  16. package/dist/gateway/static/root/assets/{archive-plugin-DD2SweEH.js → archive-plugin-BnMSgZvR.js} +1 -1
  17. package/dist/gateway/static/root/assets/{attachment-load-BFtcib5t.js → attachment-load-CejsQMev.js} +1 -1
  18. package/dist/gateway/static/root/assets/{automations-page-XS8wIl5o.js → automations-page-RC8EyoAf.js} +1 -1
  19. package/dist/gateway/static/root/assets/automations-workspace-SkdcSZ0i.js +6 -0
  20. package/dist/gateway/static/root/assets/{binary-plugins-Xs7pLHxR.js → binary-plugins-DGjppLSG.js} +1 -1
  21. package/dist/gateway/static/root/assets/{block-editor-BPdSzceB.js → block-editor-CWdP4bUc.js} +44 -44
  22. package/dist/gateway/static/root/assets/browser-settings-page-CKCa6TvG.js +8 -0
  23. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BAAc151l.js → browser-workflow-inputs-BQ1Ilw_o.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-workflows-page-DUPPvE30.js → browser-workflows-page-CJh4NyxT.js} +2 -2
  25. package/dist/gateway/static/root/assets/{capabilities-settings-panel-cl9kYilL.js → capabilities-settings-panel-DSp--zIZ.js} +5 -5
  26. package/dist/gateway/static/root/assets/channels-settings-CMd2dDrI.js +1 -0
  27. package/dist/gateway/static/root/assets/{channels-status-swr-CCBCtLDg.js → channels-status-swr-Ohhee4vm.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-DKW1M6aJ.js → chat-terminal-dock-BOtoKTK3.js} +2 -2
  29. package/dist/gateway/static/root/assets/connectors-page-udWs5Kdm.js +2 -0
  30. package/dist/gateway/static/root/assets/{cron-expression-Bijb0ZQu.js → cron-expression-DTj1V3Sw.js} +1 -1
  31. package/dist/gateway/static/root/assets/{date-picker-BZuHw-SY.js → date-picker-Yr6OCvGL.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dependency-picker-BsBD2JFY.js → dependency-picker-DpN3XZg9.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-Ceuw3QKb.js → desktop-pet-DbGzggPF.js} +1 -1
  34. package/dist/gateway/static/root/assets/{desktop-pet-settings-DctOXexM.js → desktop-pet-settings-DinCToZh.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-BNlMPATK.js → extension-debug-page-DgTtk4KC.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-CK4Uvzge.js → extension-page-DtQeiP6f.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-CpnXXemw.js → extension-settings-page-DcguCgsH.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-api-C_mlpe-r.js → gateway-config-api-Br7lSf6H.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-config-swr-826dipyU.js → gateway-config-swr-DXuXtU1w.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-settings-DSSW17ed.js → gateway-settings-CdPoDMuj.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-startup-retry-DyvcAIMm.js → gateway-startup-retry-CzBzglzQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/{heartbeat-settings-hbmIZTpg.js → heartbeat-settings-DHk1hawP.js} +1 -1
  43. package/dist/gateway/static/root/assets/home-page-YGipe_W6.js +1 -0
  44. package/dist/gateway/static/root/assets/{image-generation-api-D7cyfks6.js → image-generation-api-TIgsn04n.js} +1 -1
  45. package/dist/gateway/static/root/assets/{index-eZjksPvq.js → index-D5TQQpeb.js} +44 -44
  46. package/dist/gateway/static/root/assets/index-DReBaaTX.css +2 -0
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BQrDwwgi.js → keyboard-shortcuts-settings-wsWuoa8p.js} +1 -1
  48. package/dist/gateway/static/root/assets/local-app-workbench-page-CpyvYyrb.js +2 -0
  49. package/dist/gateway/static/root/assets/{local-apps-page-D-YWD6LS.js → local-apps-page-CXrbrGo8.js} +1 -1
  50. package/dist/gateway/static/root/assets/local-context-graph-BjUf7fQ9.js +1 -0
  51. package/dist/gateway/static/root/assets/{locale-store-CBoCuIMx.js → locale-store-BJFLQY8O.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-DvLc9l59.js → logs-page-CXKy6E_l.js} +2 -2
  53. package/dist/gateway/static/root/assets/{management-settings-DsULLUUv.js → management-settings-BdJZFR7U.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-split-CjqlP6IB.js → markdown-split-NK3ACVG2.js} +1 -1
  55. package/dist/gateway/static/root/assets/{markdown-view-BXsHghJd.js → markdown-view-DTF9v1gg.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-DQL029DU.js → media-plugins-F0jcUxyl.js} +1 -1
  57. package/dist/gateway/static/root/assets/messages-CHNYp8EQ.js +3 -0
  58. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-gauprAae.js → mobile-pairing-wizard-3NKCniSp.js} +1 -1
  59. package/dist/gateway/static/root/assets/models-hub-cache-nCfkBN8M.js +1 -0
  60. package/dist/gateway/static/root/assets/{notes-page-AsEfLZt9.js → notes-page-DuqLahi6.js} +1 -1
  61. package/dist/gateway/static/root/assets/notes-workbench-C7j9EdQk.js +5 -0
  62. package/dist/gateway/static/root/assets/{oauth-api-BjSUDIgq.js → oauth-api-8lP_qJpq.js} +1 -1
  63. package/dist/gateway/static/root/assets/{product-open-page-CAJeUXeU.js → product-open-page-CxGGlWA8.js} +1 -1
  64. package/dist/gateway/static/root/assets/project-detail-page-CfebYVX0.js +1 -0
  65. package/dist/gateway/static/root/assets/projects-page-48GvzSVa.js +1 -0
  66. package/dist/gateway/static/root/assets/{registry-api-BhGKnvLP.js → registry-api-CIsNlSBi.js} +1 -1
  67. package/dist/gateway/static/root/assets/remote-access-hub-64xj_s2m.js +1 -0
  68. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DH6EilMV.js → runtime-tools-settings-panel-YkjhiQfA.js} +2 -2
  69. package/dist/gateway/static/root/assets/{schema-form-DYHmEZeZ.js → schema-form-oFGf3G3s.js} +1 -1
  70. package/dist/gateway/static/root/assets/sessions-page-CcwcdRN8.js +1 -0
  71. package/dist/gateway/static/root/assets/settings-advanced-gate-BaN84CyW.js +1 -0
  72. package/dist/gateway/static/root/assets/{settings-page-BHwPd_M3.js → settings-page-C7VWs0IT.js} +1 -1
  73. package/dist/gateway/static/root/assets/setup-status-panel-DVVOCNbr.js +1 -0
  74. package/dist/gateway/static/root/assets/{share-preview-page-BjwrS03F.js → share-preview-page-t5oz18rh.js} +1 -1
  75. package/dist/gateway/static/root/assets/shares-settings-DUYbYLi7.js +1 -0
  76. package/dist/gateway/static/root/assets/skill-reload-api-BGyD0gB9.js +1 -0
  77. package/dist/gateway/static/root/assets/{skills-page-OHyK25op.js → skills-page-CjF8DTsN.js} +1 -1
  78. package/dist/gateway/static/root/assets/{skills-page.utils-DQx9ulmg.js → skills-page.utils-DEDTYs2W.js} +1 -1
  79. package/dist/gateway/static/root/assets/{system-settings-panel-wO7DWv4C.js → system-settings-panel-BSYuRgFI.js} +1 -1
  80. package/dist/gateway/static/root/assets/task-detail-page-YZYSTJH7.js +1 -0
  81. package/dist/gateway/static/root/assets/{theme-store-hybK3oC9.js → theme-store-O597U8q_.js} +1 -1
  82. package/dist/gateway/static/root/assets/{tunnel-api-CVC8BHZu.js → tunnel-api-FKUi9wDL.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-autosave-DMvRu2XZ.js → use-autosave-B5eUJ6Zq.js} +1 -1
  84. package/dist/gateway/static/root/assets/user-context-page-BCyiduKd.js +2 -0
  85. package/dist/gateway/static/root/assets/{voice-api-key-field-DuBK2NDG.js → voice-api-key-field-CMKSwz4C.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-config-api-CBbiF1T3.js → voice-config-api-q7B6fOFB.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-B7VXWpDr.js → work-discovery-overlay-jhT2EzeH.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BokVAsWN.js → workflow-run-setup-panel-DZmvLZjb.js} +2 -2
  89. package/dist/gateway/static/root/assets/workflows-page-DQC0TpMa.js +5 -0
  90. package/dist/gateway/static/root/index.html +12 -12
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/commands/command-registry.d.ts +1 -0
  93. package/dist/src/agent/commands/command-registry.js +12 -22
  94. package/dist/src/agent/ipc/inbox.d.ts +8 -31
  95. package/dist/src/agent/ipc/inbox.js +64 -133
  96. package/dist/src/agent/service/process-direct-one-shot.js +15 -10
  97. package/dist/src/agent/workflow/catalog.d.ts +1 -8
  98. package/dist/src/agent/workflow/catalog.js +44 -102
  99. package/dist/src/agent/workflow/index.d.ts +1 -1
  100. package/dist/src/agent/workflow/index.js +2 -2
  101. package/dist/src/automations/domain/types.d.ts +1 -0
  102. package/dist/src/automations/service/action-executor.js +2 -2
  103. package/dist/src/automations/service/automation-service.js +2 -2
  104. package/dist/src/channels/manager.d.ts +1 -1
  105. package/dist/src/channels/manager.js +2 -2
  106. package/dist/src/channels/outbound/persist-store.d.ts +2 -8
  107. package/dist/src/channels/outbound/persist-store.js +11 -38
  108. package/dist/src/channels/outbound-sender.d.ts +1 -1
  109. package/dist/src/channels/outbound-sender.js +2 -2
  110. package/dist/src/cli/commands/connectors.js +1 -1
  111. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  112. package/dist/src/config/schema.js +2 -2
  113. package/dist/src/connectors/auth-provider-registry.js +1 -1
  114. package/dist/src/connectors/composio-triggers.d.ts +2 -2
  115. package/dist/src/connectors/composio-triggers.js +8 -15
  116. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  117. package/dist/src/connectors/health.js +1 -1
  118. package/dist/src/gateway/automation-agent-session.js +3 -0
  119. package/dist/src/gateway/heartbeat/service.js +1 -1
  120. package/dist/src/gateway/hono/lib/extension-store.js +8 -25
  121. package/dist/src/gateway/hono/routes/capabilities.js +1 -1
  122. package/dist/src/gateway/hono/routes/connectors.js +3 -3
  123. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  124. package/dist/src/gateway/hono/routes/projects.js +1 -1
  125. package/dist/src/gateway/hono/routes/you.js +20 -4
  126. package/dist/src/gateway/service.js +4 -5
  127. package/dist/src/heartbeat/index.js +1 -1
  128. package/dist/src/notes/index.d.ts +1 -1
  129. package/dist/src/notes/index.js +2 -2
  130. package/dist/src/notes/paths.d.ts +0 -3
  131. package/dist/src/notes/paths.js +1 -10
  132. package/dist/src/notes/service.d.ts +0 -1
  133. package/dist/src/notes/service.js +0 -3
  134. package/dist/src/notes/store.d.ts +0 -2
  135. package/dist/src/notes/store.js +33 -80
  136. package/dist/src/share/hosted-session-share.d.ts +1 -4
  137. package/dist/src/share/hosted-session-share.js +14 -47
  138. package/dist/src/share/share-auto.d.ts +1 -1
  139. package/dist/src/share/share-auto.js +2 -2
  140. package/dist/src/share/share-store.d.ts +2 -7
  141. package/dist/src/share/share-store.js +153 -195
  142. package/dist/src/share/share-types.d.ts +0 -4
  143. package/dist/src/share/site-share-store.d.ts +3 -8
  144. package/dist/src/share/site-share-store.js +94 -153
  145. package/dist/src/share/site-share-types.d.ts +0 -4
  146. package/dist/src/storage/sqlite/connection.d.ts +1 -2
  147. package/dist/src/storage/sqlite/connection.js +50 -47
  148. package/dist/src/storage/sqlite/durable-queue.d.ts +16 -0
  149. package/dist/src/storage/sqlite/durable-queue.js +52 -0
  150. package/dist/src/storage/sqlite/durable-state.d.ts +16 -0
  151. package/dist/src/storage/sqlite/durable-state.js +43 -0
  152. package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +9 -0
  153. package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +39 -0
  154. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  155. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  156. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  157. package/dist/src/storage/sqlite/schema.js +1 -1
  158. package/dist/src/storage/sqlite/understanding-focus-exclusions.d.ts +2 -0
  159. package/dist/src/storage/sqlite/understanding-focus-exclusions.js +24 -0
  160. package/dist/src/tui/tui-scoped-models.js +9 -6
  161. package/dist/src/tui/tui-startup-resources.js +1 -1
  162. package/dist/src/voice/dashscope/streaming-tts-stream.js +49 -0
  163. package/dist/src/voice/realtime/agentEngine.js +63 -18
  164. package/dist/src/voice/realtime/conversationTurn.d.ts +20 -0
  165. package/dist/src/voice/realtime/conversationTurn.js +83 -0
  166. package/dist/src/voice/realtime/omniEngine.js +72 -18
  167. package/dist/src/workflows/authoring/workflow-draft-store.d.ts +1 -5
  168. package/dist/src/workflows/authoring/workflow-draft-store.js +23 -43
  169. package/dist/src/workflows/index.js +2 -2
  170. package/dist/src/workflows/store/event-store.d.ts +1 -2
  171. package/dist/src/workflows/store/event-store.js +19 -64
  172. package/dist/src/workflows/store/paths.d.ts +0 -2
  173. package/dist/src/workflows/store/paths.js +1 -7
  174. package/dist/src/workflows/store/run-store.d.ts +0 -1
  175. package/dist/src/workflows/store/run-store.js +1 -24
  176. package/package.json +3 -3
  177. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0dRjnL2s.js +0 -1
  178. package/dist/gateway/static/root/assets/apps-page-EpUZsl4h.js +0 -1
  179. package/dist/gateway/static/root/assets/automations-workspace-BGQdHrip.js +0 -6
  180. package/dist/gateway/static/root/assets/browser-settings-page-DJGcm7rH.js +0 -8
  181. package/dist/gateway/static/root/assets/channels-settings-BcIr-_GM.js +0 -1
  182. package/dist/gateway/static/root/assets/connectors-page-DNHqaZfX.js +0 -2
  183. package/dist/gateway/static/root/assets/home-page-CaVvW77l.js +0 -1
  184. package/dist/gateway/static/root/assets/index-Dbh5SXyV.css +0 -2
  185. package/dist/gateway/static/root/assets/local-app-workbench-page-D3K1XmOM.js +0 -2
  186. package/dist/gateway/static/root/assets/messages-BbdwoxVo.js +0 -3
  187. package/dist/gateway/static/root/assets/models-hub-cache-88f4fzYS.js +0 -1
  188. package/dist/gateway/static/root/assets/notes-workbench-CI30cDh3.js +0 -4
  189. package/dist/gateway/static/root/assets/project-detail-page-jO_4I5zN.js +0 -1
  190. package/dist/gateway/static/root/assets/projects-page-BrTGFME0.js +0 -1
  191. package/dist/gateway/static/root/assets/remote-access-hub-CH70D5SH.js +0 -1
  192. package/dist/gateway/static/root/assets/sessions-page-hbfUNtNs.js +0 -1
  193. package/dist/gateway/static/root/assets/settings-advanced-gate-Vg3_jua6.js +0 -1
  194. package/dist/gateway/static/root/assets/setup-status-panel-DkcpWSss.js +0 -1
  195. package/dist/gateway/static/root/assets/shares-settings-BL4DEt6p.js +0 -1
  196. package/dist/gateway/static/root/assets/skill-reload-api-CafhNktn.js +0 -1
  197. package/dist/gateway/static/root/assets/task-detail-page-anyomXsu.js +0 -1
  198. package/dist/gateway/static/root/assets/user-context-page-BBk9YdBn.js +0 -1
  199. package/dist/gateway/static/root/assets/workflows-page-RUTv0yvR.js +0 -5
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-BbdwoxVo.js";import{n as m}from"./locale-store-CBoCuIMx.js";import{t as h}from"./cn-JdwAhgNB.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-CtTvuElV.js";import{t as v}from"./skeleton-BwbyijEw.js";import{i as y,o as b}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as x,n as S,r as C}from"./oauth-api-BjSUDIgq.js";import{Hr as w,aa as T}from"./index-eZjksPvq.js";import{_ as E,c as D,f as O,g as ee,i as k,l as A,m as j,n as M,o as N,p as te,r as P,t as F}from"./tunnel-api-CVC8BHZu.js";import{t as I}from"./browser-BLJWD7WI.js";import{n as L,r as R,t as z}from"./oauth-authorization-window-Cdolr2wE.js";var B=e(n(),1),V=r(),H=e(I(),1),U={width:216,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ne(e){let t=await H.toString(e,{...U,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var W=i();function re(){let e=p(m(e=>e.language)),t=e.endpointToolsSettings.mobileAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=g(`tunnel-status`,F,{refreshInterval:1500}),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!0),[f,h]=(0,B.useState)(`idle`),[y,b]=(0,B.useState)(!1),[w,T]=(0,B.useState)(``),E=(0,B.useRef)(!0);(0,B.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let D=async()=>{if(!r)return;if(r.consentRequired&&!o){l(!0);return}let e=r.registrationSecret?.configured?null:R(),t,n=!1;b(!1);try{if(r.consentRequired&&await k(),!r.registrationSecret?.configured){h(`authorizing`);let r=sessionStorage.getItem(`mobile-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await x(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`mobile-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;E.current&&Date.now()<o;){let r=await C(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await L(a,e)||T(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!E.current)return;if(!s)throw Error(`Authorization expired`);await P()}if(!E.current)return;h(`starting`),await N(),u&&await M({autoStart:!0}),await a(),n=!0}catch{n=!0,E.current&&b(!0)}finally{z(e),n&&(sessionStorage.removeItem(`mobile-pairing-oauth`),t&&S(t).catch(()=>{})),E.current&&(h(`idle`),T(``))}};if(!r&&!i)return(0,W.jsxs)(`div`,{className:`space-y-5`,children:[(0,W.jsx)(v,{className:`h-5 w-4/5`}),(0,W.jsx)(v,{className:`h-24 w-full`})]});let O=f===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,W.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:O?t.preparingHint:f===`authorizing`?t.authorizing:t.enableHint}),w&&f===`authorizing`?(0,W.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,O?(0,W.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,W.jsx)(v,{className:`h-2 w-full`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&f===`idle`?(0,W.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,W.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,W.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,W.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,y||i||r?.state===`error`?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.failed}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f!==`idle`,onChange:e=>d(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:!r||f!==`idle`||O||c&&!o,onClick:()=>void D(),children:f===`authorizing`?t.authorizing:O?t.preparing:y?t.retry:t.enable}),i&&!r?(0,W.jsx)(_,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var G=t({MobilePairingWizard:()=>K});function K(e){let t=(0,V.c)(8),{open:n,onOpenChange:r,onPaired:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=n?(0,W.jsx)(q,{onClose:()=>r(!1),onPaired:i}):null,t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==n||t[6]!==a?(o=(0,W.jsx)(u,{open:n,onOpenChange:r,children:a}),t[4]=r,t[5]=n,t[6]=a,t[7]=o):o=t[7],o}function q({onClose:e,onPaired:t}){let n=p(m(e=>e.language)),r=n.endpointToolsSettings.mobileAccess,i=r.flow,u=g(`mobile-pairing-readiness`,ee,{refreshInterval:1500}),[x,S]=(0,B.useState)(),[C,k]=(0,B.useState)(!1),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(Date.now()),[I,L]=(0,B.useState)(null),R=(0,B.useRef)(!0),z=(0,B.useRef)(null),V=(0,B.useRef)(!1),H=(0,B.useRef)(!1),U=g(x?[`mobile-pairing-setup`,x.id]:null,()=>E(x.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=g(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T(()=>ne(x?.universalLink??``),[x?.universalLink],{enabled:!!x,initial:null,errorData:null});(0,B.useEffect)(()=>{R.current=!0;let e=setInterval(()=>F(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&O(z.current).catch(()=>{})}},[]);let Y=(0,B.useCallback)(async()=>{if(!V.current){V.current=!0,N(!0),k(!1);try{z.current&&await O(z.current),z.current=null,S(void 0);let e=await te();if(e.kind===`ready`){if(!R.current){await O(e.setup.id);return}z.current=e.setup.id,S(e.setup)}else await u.mutate()}catch{R.current&&k(!0)}finally{V.current=!1,R.current&&N(!1)}}},[u]);(0,B.useEffect)(()=>{u.data?.ready&&u.data.protocolVersions?.includes(3)&&!x&&!C&&!V.current&&Y()},[u.data,x,C,Y]),(0,B.useEffect)(()=>{K&&!H.current&&(H.current=!0,t?.())},[K,t]);let X=async e=>{if(G){N(!0),k(!1);try{await j(G,e),await U.mutate()}catch{k(!0),await U.mutate()}finally{R.current&&N(!1)}}},Z=(0,B.useRef)(0);(0,B.useEffect)(()=>{U.data&&(Z.current=U.data.serverTime-Date.now())},[U.data]);let Q=P+Z.current,$=x&&Q>=x.expiresAt&&!G,ie=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),ae=u.data&&!u.data.protocolVersions?.includes(3),oe=K?i.success:G?.status===`pending`?i.allowTitle:G?.status===`approved`?i.waiting:x?i.scan:i.title;return(0,W.jsxs)(s,{children:[(0,W.jsx)(a,{className:h(`fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,W.jsxs)(c,{className:h(`fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover`,y),children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,W.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,W.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":i.cancel,onClick:e,children:(0,W.jsx)(f,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,W.jsx)(d,{className:`mb-5 size-7 text-success`}):null,(0,W.jsx)(l,{className:`text-xl font-semibold tracking-tight text-fg`,children:oe}),(0,W.jsx)(o,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:K?i.successHint:G?G.displayName:x?i.scanHint:i.intro}),C||u.error||U.error||J.error?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:i.failed}):null,ae?(0,W.jsx)(`p`,{className:`mt-8 text-sm text-fg-muted`,children:i.update}):u.data?K?(0,W.jsxs)(W.Fragment,{children:[q.data?(0,W.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[i.background,(0,W.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>k(!0))}})]}):null,(0,W.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:i.sleep})]}):ie||$?(0,W.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:$||G?.status===`expired`?i.expired:i.declined}),(0,W.jsx)(_,{variant:`primary`,onClick:()=>void Y(),disabled:M,children:i.refresh})]}):G?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i.scope}),(0,W.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i.compare}),(0,W.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.access}),(0,W.jsx)(`p`,{children:i.accessHint})]})]}):x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`my-6 flex justify-center`,children:J.data?(0,W.jsx)(`img`,{src:J.data,alt:r.qrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):(0,W.jsx)(v,{className:`size-[216px]`})}),(0,W.jsx)(`p`,{className:`text-center text-xs text-fg-muted`,children:x.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((x.expiresAt-Q)/1e3))}s`:i.valid}),(0,W.jsxs)(`details`,{className:`mt-5 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.fallback}),(0,W.jsx)(w,{text:x.universalLink,labels:{copy:r.copy,copied:r.copied,copyFailed:n.clipboard.copyFailed}})]})]}):u.data.ready?(0,W.jsx)(`div`,{className:`mt-8`,children:(0,W.jsx)(v,{className:`mx-auto size-[216px]`})}):(0,W.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,W.jsx)(A,{embedded:!0}):I===`https`?(0,W.jsx)(D,{}):I===`choices`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:r.useTailscale}),(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:r.useOwnHttps})]}):(0,W.jsx)(re,{}),(0,W.jsx)(_,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?i.back:i.existing})]}):(0,W.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,W.jsx)(v,{className:`h-5 w-3/4`}),(0,W.jsx)(v,{className:`h-40 w-full`})]})]}),K||G?.status===`pending`||C?(0,W.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:K?(0,W.jsx)(_,{className:`w-full`,variant:`primary`,onClick:e,children:i.done}):G?.status===`pending`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void X(`approve`),children:i.allow}),(0,W.jsx)(_,{className:`w-full`,variant:`ghost`,disabled:M,onClick:()=>void X(`reject`),children:i.cancel})]}):(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void Y(),children:i.retry})}):null]})]})}export{G as n,K as t};
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{a,i as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./messages-CHNYp8EQ.js";import{n as m}from"./locale-store-BJFLQY8O.js";import{t as h}from"./cn-JdwAhgNB.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-CtTvuElV.js";import{t as v}from"./skeleton-BwbyijEw.js";import{i as y,o as b}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as x,n as S,r as C}from"./oauth-api-8lP_qJpq.js";import{Ur as w,oa as T}from"./index-D5TQQpeb.js";import{_ as E,c as D,f as O,g as ee,i as k,l as A,m as j,n as M,o as N,p as te,r as P,t as F}from"./tunnel-api-FKUi9wDL.js";import{t as I}from"./browser-BLJWD7WI.js";import{n as L,r as R,t as z}from"./oauth-authorization-window-Cdolr2wE.js";var B=e(n(),1),V=r(),H=e(I(),1),U={width:216,margin:4,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function ne(e){let t=await H.toString(e,{...U,type:`svg`});return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}var W=i();function re(){let e=p(m(e=>e.language)),t=e.endpointToolsSettings.mobileAccess.flow,n=e.tunnelSettings,{data:r,error:i,mutate:a}=g(`tunnel-status`,F,{refreshInterval:1500}),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!0),[f,h]=(0,B.useState)(`idle`),[y,b]=(0,B.useState)(!1),[w,T]=(0,B.useState)(``),E=(0,B.useRef)(!0);(0,B.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let D=async()=>{if(!r)return;if(r.consentRequired&&!o){l(!0);return}let e=r.registrationSecret?.configured?null:R(),t,n=!1;b(!1);try{if(r.consentRequired&&await k(),!r.registrationSecret?.configured){h(`authorizing`);let r=sessionStorage.getItem(`mobile-pairing-oauth`),i=r?JSON.parse(r):null;t=i&&i.expiresAt>Date.now()?i.sessionId:(await x(`xopc-tunnel`)).sessionId,sessionStorage.setItem(`mobile-pairing-oauth`,JSON.stringify({sessionId:t,expiresAt:i&&i.expiresAt>Date.now()?i.expiresAt:Date.now()+5*6e4}));let a=``,o=Date.now()+5*6e4,s=!1;for(;E.current&&Date.now()<o;){let r=await C(t);if(r.authUrl&&r.authUrl!==a&&(a=r.authUrl,await L(a,e)||T(a)),r.status===`completed`){s=!0,n=!0;break}if(r.status===`failed`||r.status===`cancelled`)throw Error(`Authorization cancelled`);await new Promise(e=>setTimeout(e,1e3))}if(!E.current)return;if(!s)throw Error(`Authorization expired`);await P()}if(!E.current)return;h(`starting`),await N(),u&&await M({autoStart:!0}),await a(),n=!0}catch{n=!0,E.current&&b(!0)}finally{z(e),n&&(sessionStorage.removeItem(`mobile-pairing-oauth`),t&&S(t).catch(()=>{})),E.current&&(h(`idle`),T(``))}};if(!r&&!i)return(0,W.jsxs)(`div`,{className:`space-y-5`,children:[(0,W.jsx)(v,{className:`h-5 w-4/5`}),(0,W.jsx)(v,{className:`h-24 w-full`})]});let O=f===`starting`||r?.state===`connecting`||r?.state===`reconnecting`;return(0,W.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:O?t.preparingHint:f===`authorizing`?t.authorizing:t.enableHint}),w&&f===`authorizing`?(0,W.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,className:`mt-4 inline-flex min-h-11 items-center text-sm text-accent`,children:t.openAuthorization}):null,O?(0,W.jsxs)(`div`,{className:`mt-8 space-y-3`,"aria-label":t.preparing,children:[(0,W.jsx)(v,{className:`h-2 w-full`}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.preparing})]}):null,(c||r?.consentRequired)&&f===`idle`?(0,W.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,W.jsxs)(`details`,{open:c,className:`text-sm text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t.details}),(0,W.jsx)(`p`,{className:`mt-2`,children:n.consentIntro}),(0,W.jsx)(`ul`,{className:`mt-3 list-disc space-y-2 pl-5`,children:[n.consentBullet1,n.consentBullet2,n.consentBullet3].map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),className:`mt-1 size-4 accent-accent`}),n.consentCheckbox]})]}):null,y||i||r?.state===`error`?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.failed}):null,(0,W.jsx)(`div`,{className:`flex-1`}),(0,W.jsxs)(`label`,{className:`my-5 flex items-center gap-3 text-sm text-fg-muted`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f!==`idle`,onChange:e=>d(e.target.checked),className:`size-4 accent-accent`}),t.autoStart]}),(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:!r||f!==`idle`||O||c&&!o,onClick:()=>void D(),children:f===`authorizing`?t.authorizing:O?t.preparing:y?t.retry:t.enable}),i&&!r?(0,W.jsx)(_,{variant:`ghost`,onClick:()=>void a(),children:t.retry}):null]})}var G=t({MobilePairingWizard:()=>K});function K(e){let t=(0,V.c)(8),{open:n,onOpenChange:r,onPaired:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=n?(0,W.jsx)(q,{onClose:()=>r(!1),onPaired:i}):null,t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==r||t[5]!==n||t[6]!==a?(o=(0,W.jsx)(u,{open:n,onOpenChange:r,children:a}),t[4]=r,t[5]=n,t[6]=a,t[7]=o):o=t[7],o}function q({onClose:e,onPaired:t}){let n=p(m(e=>e.language)),r=n.endpointToolsSettings.mobileAccess,i=r.flow,u=g(`mobile-pairing-readiness`,ee,{refreshInterval:1500}),[x,S]=(0,B.useState)(),[C,k]=(0,B.useState)(!1),[M,N]=(0,B.useState)(!1),[P,F]=(0,B.useState)(Date.now()),[I,L]=(0,B.useState)(null),R=(0,B.useRef)(!0),z=(0,B.useRef)(null),V=(0,B.useRef)(!1),H=(0,B.useRef)(!1),U=g(x?[`mobile-pairing-setup`,x.id]:null,()=>E(x.id),{refreshInterval:1500}),G=U.data?.request,K=G?.status===`completed`,q=g(K&&window.electronAPI?.system?`system-behavior`:null,()=>window.electronAPI.system.getBehavior()),J=T(()=>ne(x?.universalLink??``),[x?.universalLink],{enabled:!!x,initial:null,errorData:null});(0,B.useEffect)(()=>{R.current=!0;let e=setInterval(()=>F(Date.now()),1e3);return()=>{R.current=!1,clearInterval(e),z.current&&O(z.current).catch(()=>{})}},[]);let Y=(0,B.useCallback)(async()=>{if(!V.current){V.current=!0,N(!0),k(!1);try{z.current&&await O(z.current),z.current=null,S(void 0);let e=await te();if(e.kind===`ready`){if(!R.current){await O(e.setup.id);return}z.current=e.setup.id,S(e.setup)}else await u.mutate()}catch{R.current&&k(!0)}finally{V.current=!1,R.current&&N(!1)}}},[u]);(0,B.useEffect)(()=>{u.data?.ready&&u.data.protocolVersions?.includes(3)&&!x&&!C&&!V.current&&Y()},[u.data,x,C,Y]),(0,B.useEffect)(()=>{K&&!H.current&&(H.current=!0,t?.())},[K,t]);let X=async e=>{if(G){N(!0),k(!1);try{await j(G,e),await U.mutate()}catch{k(!0),await U.mutate()}finally{R.current&&N(!1)}}},Z=(0,B.useRef)(0);(0,B.useEffect)(()=>{U.data&&(Z.current=U.data.serverTime-Date.now())},[U.data]);let Q=P+Z.current,$=x&&Q>=x.expiresAt&&!G,ie=G&&[`expired`,`rejected`,`cancelled`].includes(G.status),ae=u.data&&!u.data.protocolVersions?.includes(3),oe=K?i.success:G?.status===`pending`?i.allowTitle:G?.status===`approved`?i.waiting:x?i.scan:i.title;return(0,W.jsxs)(s,{children:[(0,W.jsx)(a,{className:h(`fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,W.jsxs)(c,{className:h(`fixed left-1/2 top-1/2 flex h-[min(600px,calc(100dvh-48px))] w-[min(560px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover`,y),children:[(0,W.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge-subtle px-6 py-3`,children:[(0,W.jsx)(`span`,{className:`text-lg font-semibold tracking-tight text-fg`,children:`xopc`}),(0,W.jsx)(`button`,{type:`button`,className:`flex size-10 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":i.cancel,onClick:e,children:(0,W.jsx)(f,{className:`size-4`})})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-8 py-7`,children:[K?(0,W.jsx)(d,{className:`mb-5 size-7 text-success`}):null,(0,W.jsx)(l,{className:`text-xl font-semibold tracking-tight text-fg`,children:oe}),(0,W.jsx)(o,{className:`mt-2 text-sm leading-relaxed text-fg-muted`,children:K?i.successHint:G?G.displayName:x?i.scanHint:i.intro}),C||u.error||U.error||J.error?(0,W.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:i.failed}):null,ae?(0,W.jsx)(`p`,{className:`mt-8 text-sm text-fg-muted`,children:i.update}):u.data?K?(0,W.jsxs)(W.Fragment,{children:[q.data?(0,W.jsxs)(`label`,{className:`mt-8 flex items-center justify-between gap-4 border-y border-edge-subtle py-5 text-sm text-fg`,children:[i.background,(0,W.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":q.data.runInBackground??!1,disabled:!q.data.backgroundSupported,checked:q.data.runInBackground??!1,className:`size-5 accent-accent`,onChange:e=>{window.electronAPI.system.setBehavior({runInBackground:e.target.checked}).then(e=>q.mutate(e.behavior)).catch(()=>k(!0))}})]}):null,(0,W.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:i.sleep})]}):ie||$?(0,W.jsxs)(`div`,{className:`mt-10 space-y-5`,children:[(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:$||G?.status===`expired`?i.expired:i.declined}),(0,W.jsx)(_,{variant:`primary`,onClick:()=>void Y(),disabled:M,children:i.refresh})]}):G?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i.scope}),(0,W.jsxs)(`p`,{className:`mt-10 font-mono text-4xl tracking-[0.16em] text-fg`,"aria-live":`polite`,children:[G.confirmationCode.slice(0,3),` `,G.confirmationCode.slice(3)]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i.compare}),(0,W.jsxs)(`details`,{className:`mt-6 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.access}),(0,W.jsx)(`p`,{children:i.accessHint})]})]}):x?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`my-6 flex justify-center`,children:J.data?(0,W.jsx)(`img`,{src:J.data,alt:r.qrAlt,width:216,height:216,className:`size-[216px] max-w-full rounded-lg bg-white`}):(0,W.jsx)(v,{className:`size-[216px]`})}),(0,W.jsx)(`p`,{className:`text-center text-xs text-fg-muted`,children:x.expiresAt-Q<6e4?`${Math.max(0,Math.ceil((x.expiresAt-Q)/1e3))}s`:i.valid}),(0,W.jsxs)(`details`,{className:`mt-5 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer py-2`,children:i.fallback}),(0,W.jsx)(w,{text:x.universalLink,labels:{copy:r.copy,copied:r.copied,copyFailed:n.clipboard.copyFailed}})]})]}):u.data.ready?(0,W.jsx)(`div`,{className:`mt-8`,children:(0,W.jsx)(v,{className:`mx-auto size-[216px]`})}):(0,W.jsxs)(`div`,{className:`mt-6 flex flex-1 flex-col`,children:[I===`tailscale`?(0,W.jsx)(A,{embedded:!0}):I===`https`?(0,W.jsx)(D,{}):I===`choices`?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`tailscale`),children:r.useTailscale}),(0,W.jsx)(_,{variant:`secondary`,className:`w-full`,onClick:()=>L(`https`),children:r.useOwnHttps})]}):(0,W.jsx)(re,{}),(0,W.jsx)(_,{variant:`ghost`,className:`mt-3 w-full`,onClick:()=>L(I?null:`choices`),children:I?i.back:i.existing})]}):(0,W.jsxs)(`div`,{className:`mt-8 space-y-4`,children:[(0,W.jsx)(v,{className:`h-5 w-3/4`}),(0,W.jsx)(v,{className:`h-40 w-full`})]})]}),K||G?.status===`pending`||C?(0,W.jsx)(`footer`,{className:`shrink-0 px-8 pb-6`,children:K?(0,W.jsx)(_,{className:`w-full`,variant:`primary`,onClick:e,children:i.done}):G?.status===`pending`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void X(`approve`),children:i.allow}),(0,W.jsx)(_,{className:`w-full`,variant:`ghost`,disabled:M,onClick:()=>void X(`reject`),children:i.cancel})]}):(0,W.jsx)(_,{className:`w-full`,variant:`primary`,disabled:M,onClick:()=>void Y(),children:i.retry})}):null]})]})}export{G as n,K as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./locale-store-BJFLQY8O.js";import{o as t}from"./vendor-swr-BIWyz7Rc.js";import{n}from"./gateway-config-swr-DXuXtU1w.js";import{r}from"./registry-api-CIsNlSBi.js";var i=`models-json-config`,a=`model-catalog`,o=`capability-readiness`;async function s(){await Promise.all([n(),t(e(`/api/providers/meta`)),t(i),t(a),t(o),r()])}export{s as i,i as n,a as r,o as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as r}from"./notes-workbench-CI30cDh3.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-BaASWQor.js";import{t as r}from"./notes-workbench-C7j9EdQk.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,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CWdP4bUc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-D5TQQpeb.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-BvLh9GaE.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-DBS3OB8K.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DTF9v1gg.js","assets/dist-CpzYSoz7.js","assets/chunk-KS7C4IRE-BaASWQor.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-BJFLQY8O.js","assets/messages-CHNYp8EQ.js","assets/cn-JdwAhgNB.js","assets/product-delivery-CV4pDOtG.js","assets/schemas-BHS7bo06.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Y68dCxuc.css","assets/dist-DLmwHyAh.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-C-Hj-nXR.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-DCp6ykjQ.js","assets/circle-check-C23XjkUj.js","assets/cloud-C4-yfnnk.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-off-DEAzt3g1.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/files-D6vf3S30.js","assets/tool-activity-R8V9l6nk.js","assets/button-CtTvuElV.js","assets/registry-api-CIsNlSBi.js","assets/gateway-startup-retry-CzBzglzQ.js","assets/config-reload-event-Bjh2zoKp.js","assets/gateway-config-swr-DXuXtU1w.js","assets/models-hub-cache-nCfkBN8M.js","assets/oauth-api-8lP_qJpq.js","assets/electron-env-DH5wF8X8.js","assets/form-field-width-DJw_jULe.js","assets/interaction-BmQogeqz.js","assets/is-masked-secret-DOkL5b_X.js","assets/activity-store-etpmyV7S.js","assets/theme-store-O597U8q_.js","assets/index-DReBaaTX.css","assets/vendor-codemirror--gTq3YAI.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-nDLmA_LF.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-BaASWQor.js";import{a as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CpzYSoz7.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,r as h}from"./popover-select-C-Hj-nXR.js";import{t as g}from"./circle-check-C23XjkUj.js";import{t as _}from"./copy-Dv6d4Dvw.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./eye-CABVeTq0.js";import{t as b}from"./loader-circle-CifKLtgG.js";import{t as x}from"./pencil-DmIY3Oa-.js";import{t as S}from"./plus-Q2yW6OE7.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./x-B_N4OPjy.js";import{t as T}from"./copy-to-clipboard-HOJ79TWv.js";import{t as E}from"./messages-CHNYp8EQ.js";import{d as D,n as O,s as k}from"./locale-store-BJFLQY8O.js";import{t as A}from"./cn-JdwAhgNB.js";import{i as j}from"./vendor-swr-BIWyz7Rc.js";import{t as M}from"./button-CtTvuElV.js";import{i as N}from"./theme-store-O597U8q_.js";import{t as P}from"./skeleton-BwbyijEw.js";import{$l as F,$s as I,As as L,Bn as R,Cc as z,Cn as B,Dn as V,Ds as H,Ec as U,En as W,Fn as ee,Fs as G,Hn as K,Hs as te,In as q,Jl as ne,Lc as re,Ln as J,Lr as ie,Mn as ae,On as oe,Os as se,Ri as ce,Rn as le,Rs as ue,Sn as de,Tn as fe,Vn as pe,Vs as Y,Yc as X,Yi as me,Ys as he,Zc as ge,_c as _e,_n as ve,a as ye,an as Z,bn as be,c as xe,cn as Se,dl as Ce,dn as we,fc as Te,fn as Ee,gn as De,hc as Oe,hn as ke,in as Ae,io as je,iu as Me,jn as Ne,kn as Pe,ks as Fe,kt as Ie,l as Le,ln as Re,ml as ze,mn as Be,nc as Ve,nu as He,o as Ue,on as We,pc as Ge,pn as Ke,qc as qe,ru as Je,s as Ye,sa as Xe,sn as Ze,uc as Qe,un as $e,vn as et,wn as tt,xl as nt,xn as rt,yn as it,zn as at,zr as ot}from"./index-D5TQQpeb.js";var st=n(),Q=e(t(),1),$=r(),ct=(0,Q.createContext)(null);function lt(){let e=(0,st.c)(1),t=(0,Q.useContext)(ct);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:ut},e[0]=t):t=e[0],t}return t}function ut(){}function dt(e){let t=(0,st.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(e,t)=>{s({src:e,alt:t})},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={openImage:m},t[1]=h):h=t[1];let g=h,_=a!==null,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||s(null)},t[2]=v):v=t[2];let y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=y):y=t[3];let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=A(`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]=b):b=t[4];let x=a?.alt||`Image preview`,S;t[5]===x?S=t[6]:(S=(0,$.jsx)(d,{className:`sr-only`,children:x}),t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(w,{className:`size-5`,"aria-hidden":!0}),t[7]=C):C=t[7];let T;t[8]===i?T=t[9]:(T=(0,$.jsx)(c,{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:C})}),t[8]=i,t[9]=T);let E;t[10]===a?E=t[11]:(E=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]=E);let D;t[12]!==T||t[13]!==E||t[14]!==S?(D=(0,$.jsxs)(l,{children:[y,(0,$.jsxs)(u,{className:b,"aria-describedby":void 0,children:[S,T,E]})]}),t[12]=T,t[13]=E,t[14]=S,t[15]=D):D=t[15];let O;t[16]!==D||t[17]!==_?(O=(0,$.jsx)(f,{open:_,onOpenChange:v,children:D}),t[16]=D,t[17]=_,t[18]=O):O=t[18];let k;return t[19]!==n||t[20]!==O?(k=(0,$.jsxs)(ct.Provider,{value:g,children:[n,O]}),t[19]=n,t[20]=O,t[21]=k):k=t[21],k}function ft(e){let t=(0,st.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,o]=(0,Q.useState)(!1),s;t[0]!==r||t[1]!==n?(s=K(n,r),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s;if(a){let e;t[3]===i?e=t[4]:(e=A(`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)(X,{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 l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(!0),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=A(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=u);let d;return t[11]!==n||t[12]!==c||t[13]!==u?(d=(0,$.jsx)(ae,{src:c,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:l,className:u}),t[11]=n,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}var pt=6e4,mt=36e5,ht=864e5;function gt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function _t(e,t,n){let r=t-e;if(r<pt)return n.justNow;if(r<mt){let e=Math.floor(r/pt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=gt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-ht)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*ht){let e=Math.floor(r/ht);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function vt(e,t,n){let r=gt(t);if(e>=r)return n.today;if(e>=r-ht)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function yt(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function bt(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 xt(e){let t=(0,st.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:o,loading:s,currentTime:c,duration:l,noteId:u,attachmentId:d}=at(),f=at(Ct),p=u===n&&d===r,m=p&&o,h=p&&s,g=p?c:0,_=p&&l>0?l:i??0,v=_>0?Math.min(g/_*100,100):0,y;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==f?(y=e=>{e.stopPropagation(),f(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=f,t[4]=y):y=t[4];let x=y,S;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==f?(S=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),f(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=f,t[9]=S):S=t[9];let C=S,w;t[10]===a?w=t[11]:(w=A(`flex items-center gap-2`,a),t[10]=a,t[11]=w);let T=m?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,E;t[12]===T?E=t[13]:(E=A(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,T),t[12]=T,t[13]=E);let D=m?`Pause`:`Play`,O;t[14]!==h||t[15]!==m?(O=h?(0,$.jsx)(b,{className:`size-3.5 animate-spin`}):m?(0,$.jsx)(Oe,{className:`size-3.5`}):(0,$.jsx)(Qe,{className:`size-3.5 ml-0.5`}),t[14]=h,t[15]=m,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 j=`${v}%`,M;t[23]===j?M=t[24]:(M=(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:j}})}),t[23]=j,t[24]=M);let N;t[25]!==_||t[26]!==p||t[27]!==g?(N=bt(p&&g>0?g:_),t[25]=_,t[26]=p,t[27]=g,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]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==w||t[36]!==k?(I=(0,$.jsxs)(`div`,{className:w,onClick:St,children:[k,F]}),t[34]=F,t[35]=w,t[36]=k,t[37]=I):I=t[37],I}function St(e){return e.stopPropagation()}function Ct(e){return e.toggle}function wt(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Tt(e){let t=(0,st.c)(88),{note:n,selected:r,onPress:i,onPin:a,onArchive:o,onDelete:s,labels:c,timeLabels:l}=e,u=r===void 0?!1:r,d;t[0]!==c||t[1]!==n?(d=wt(n,c),t[0]=c,t[1]=n,t[2]=d):d=t[2];let f=d,p=!n.snippet?.trim(),[m]=(0,Q.useState)(Mt),h;t[3]!==n.createdAt||t[4]!==m||t[5]!==l?(h=_t(n.createdAt,m,l),t[3]=n.createdAt,t[4]=m,t[5]=l,t[6]=h):h=t[6];let g=h,_,v;t[7]!==n.id||t[8]!==i?(_=()=>i(n.id),v=e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),i(n.id))},t[7]=n.id,t[8]=i,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=u?`bg-surface-active hover:bg-surface-active`:`bg-transparent hover:bg-surface-panel/70`,b;t[11]===y?b=t[12]:(b=A(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden 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-rail`,y),t[11]=y,t[12]=b);let x=u?`true`:void 0,S;t[13]===u?S=t[14]:(S=u?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=u,t[14]=S);let C;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(C=n.coverAttachmentId?(0,$.jsx)(ft,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(xt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=w);let T=n.title?`text-fg-muted`:p?`italic text-fg-muted`:`text-fg`,E;t[23]===T?E=t[24]:(E=A(`truncate text-sm leading-5`,T),t[23]=T,t[24]=E);let D;t[25]!==f||t[26]!==E?(D=(0,$.jsx)(`p`,{className:E,children:f}),t[25]=f,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==w||t[29]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,D]}),t[28]=w,t[29]=D,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(ze,{className:`size-4`}),t[31]=k):k=t[31];let j;t[32]===c.actions?j=t[33]:(j=(0,$.jsx)(Re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:jt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-100 transition-opacity hover:bg-surface-panel focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:opacity-0 lg:group-hover:opacity-100 lg:focus-visible:opacity-100`,"aria-label":c.actions,title:c.actions,children:k})}),t[32]=c.actions,t[33]=j);let M;t[34]!==n.id||t[35]!==n.pinned||t[36]!==a?(M=()=>{a(n.id,!n.pinned).catch(kt)},t[34]=n.id,t[35]=n.pinned,t[36]=a,t[37]=M):M=t[37];let N;t[38]===n.pinned?N=t[39]:(N=n.pinned?(0,$.jsx)(Te,{className:`size-4`}):(0,$.jsx)(Ge,{className:`size-4`}),t[38]=n.pinned,t[39]=N);let P=n.pinned?c.unpin:c.pin,F;t[40]!==M||t[41]!==N||t[42]!==P?(F=(0,$.jsxs)(Z,{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:M,children:[N,P]}),t[40]=M,t[41]=N,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==n.id||t[45]!==o?(I=()=>{o(n.id).catch(Ot)},t[44]=n.id,t[45]=o,t[46]=I):I=t[46];let L;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(Me,{className:`size-4`}),t[47]=L):L=t[47];let R;t[48]!==c.archive||t[49]!==I?(R=(0,$.jsxs)(Z,{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,c.archive]}),t[48]=c.archive,t[49]=I,t[50]=R):R=t[50];let z;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(Se,{className:`my-1 h-px bg-edge-subtle`}),t[51]=z):z=t[51];let B;t[52]!==n.id||t[53]!==s?(B=()=>{s(n.id).catch(Dt)},t[52]=n.id,t[53]=s,t[54]=B):B=t[54];let V;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(se,{className:`size-4`}),t[55]=V):V=t[55];let H;t[56]!==c.delete||t[57]!==B?(H=(0,$.jsxs)(Z,{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:B,children:[V,c.delete]}),t[56]=c.delete,t[57]=B,t[58]=H):H=t[58];let U;t[59]!==F||t[60]!==R||t[61]!==H?(U=(0,$.jsx)(We,{children:(0,$.jsxs)(Ae,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:At,children:[F,R,z,H]})}),t[59]=F,t[60]=R,t[61]=H,t[62]=U):U=t[62];let W;t[63]!==j||t[64]!==U?(W=(0,$.jsxs)(Ze,{children:[j,U]}),t[63]=j,t[64]=U,t[65]=W):W=t[65];let ee;t[66]!==C||t[67]!==O||t[68]!==W?(ee=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[C,O,W]}),t[66]=C,t[67]=O,t[68]=W,t[69]=ee):ee=t[69];let G;t[70]===n.pinned?G=t[71]:(G=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)(Ge,{className:`size-3`})}),t[70]=n.pinned,t[71]=G);let K;t[72]===n.tags?K=t[73]:(K=n.tags?.slice(0,2).map(Et),t[72]=n.tags,t[73]=K);let te;t[74]===g?te=t[75]:(te=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:g}),t[74]=g,t[75]=te);let q;t[76]!==G||t[77]!==K||t[78]!==te?(q=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[G,K,te]}),t[76]=G,t[77]=K,t[78]=te,t[79]=q):q=t[79];let ne;return t[80]!==ee||t[81]!==q||t[82]!==_||t[83]!==v||t[84]!==b||t[85]!==x||t[86]!==S?(ne=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:_,onKeyDown:v,className:b,"aria-current":x,children:[S,ee,q]}),t[80]=ee,t[81]=q,t[82]=_,t[83]=v,t[84]=b,t[85]=x,t[86]=S,t[87]=ne):ne=t[87],ne}function Et(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 Dt(){}function Ot(){}function kt(){}function At(e){return e.stopPropagation()}function jt(e){return e.stopPropagation()}function Mt(){return Date.now()}function Nt(e){let t=(0,st.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,u=O(It),d=E(u).automations.suggestions,f=E(u).automations,p=a(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=m):m=t[0];let{data:h}=j(o?`automation-suggestion-coverage`:null,Ft,m),_=o?h?.automations.find(e=>xe(e,o)):void 0,v=_?Ue(_,f):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=A(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(g,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===p?r=t[5]:(r=()=>p(`/automations`),t[4]=p,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:d.coveredTitle}),(0,$.jsx)(M,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:d.manage})]})}let e;t[6]===s?e=t[7]:(e=A(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(re,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==p||t[13]!==i?(c=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=p,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,o,(0,$.jsxs)(M,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,d.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=A(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===p?r=t[20]:(r=()=>p(`/automations`),t[19]=p,t[20]=r);let i;return t[21]!==d||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(M,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:d.manage})}),t[21]=d,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:d.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ye(d.coveredDescription,{name:_.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:f.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(Pt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=A(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===n?x=t[28]:(x=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=x);let S;t[29]===r?S=t[30]:(S=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=S);let C;t[31]!==x||t[32]!==S?(C=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[b,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]})]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==p||t[35]!==i?(w=()=>{p(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=p,t[35]=i,t[36]=w):w=t[36];let T;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),t[37]=T):T=t[37];let D;t[38]!==d.create||t[39]!==w?(D=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(M,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:w,children:[T,d.create]})}),t[38]=d.create,t[39]=w,t[40]=D):D=t[40];let k;return t[41]!==D||t[42]!==y||t[43]!==C?(k=(0,$.jsxs)(`section`,{className:y,children:[C,D]}),t[41]=D,t[42]=y,t[43]=C,t[44]=k):k=t[44],k}function Pt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Ft(){return Le.list()}function It(e){return e.language}function Lt(e){let t=(0,st.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Rt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Rt(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function zt(e){let t=(0,st.c)(10),{noteId:n,attachmentId:r,label:i,unavailableLabel:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u,d;if(t[0]!==r||t[1]!==n?(u=()=>{let e=!1,t=!1;return s(null),l(!1),R(n,r).then(i=>{if(e=!0,t){pe(n,r);return}s(i)}).catch(()=>{t||l(!0)}),()=>{t=!0,e&&pe(n,r)}},d=[r,n],t[0]=r,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]),(0,Q.useEffect)(u,d),c){let e;return t[4]===a?e=t[5]:(e=(0,$.jsx)(`p`,{className:`text-xs text-danger`,children:a}),t[4]=a,t[5]=e),e}if(!o){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(P,{className:`h-10 w-full max-w-md`}),t[6]=e):e=t[6],e}let f;return t[7]!==i||t[8]!==o?(f=(0,$.jsx)(`audio`,{controls:!0,preload:`metadata`,src:o,className:`w-full max-w-md`,"aria-label":i}),t[7]=i,t[8]=o,t[9]=f):f=t[9],f}function Bt(e){let t=(0,st.c)(39),{noteId:n}=e,r=E(O(Ut)).notes.discussionCapture,i,a;t[0]===n?(i=t[1],a=t[2]):(i=[`note-discussion-document`,n],a=()=>Ie(n),t[0]=n,t[1]=i,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[3]=o):o=t[3];let{data:s,mutate:c}=j(i,a,o),l,u;if(t[4]===c?(l=t[5],u=t[6]):(l=()=>{let e=e=>{let t=e.detail;t&&c(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Ht);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void c();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},u=[c],t[4]=c,t[5]=l,t[6]=u),(0,Q.useEffect)(l,u),!s)return null;let{discussion:d,transcript:f}=s,p=s.organization?.organization,m=[`stopping`,`sealing`,`organizing`].includes(d.status),h=f.stats.uploaded+f.stats.transcribing,_=f.stats.failed>0?r.failedSegments.replace(`{{count}}`,String(f.stats.failed)):h>0?r.processingSegments.replace(`{{count}}`,String(h)):m?r.finalizing:d.status===`completed`?r.transcriptReady:null,v;t[7]!==r.actionItems||t[8]!==r.decisions||t[9]!==r.openQuestions||t[10]!==r.organization||t[11]!==r.risks||t[12]!==p?(v=p?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),r.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2 xl:grid-cols-1`,children:[p.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.decisions}),(0,$.jsx)(Lt,{values:p.decisions})]}):null,p.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.actionItems}),(0,$.jsx)(Lt,{values:p.actionItems.map(Vt)})]}):null,p.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.risks}),(0,$.jsx)(Lt,{values:p.risks})]}):null,p.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:r.openQuestions}),(0,$.jsx)(Lt,{values:p.openQuestions})]}):null]})]}):null,t[7]=r.actionItems,t[8]=r.decisions,t[9]=r.openQuestions,t[10]=r.organization,t[11]=r.risks,t[12]=p,t[13]=v):v=t[13];let y;t[14]!==r.recordingAudio||t[15]!==r.recordingUnavailable||t[16]!==d.audioAttachmentId||t[17]!==n?(y=d.audioAttachmentId?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),r.recordingAudio]}),(0,$.jsx)(zt,{noteId:n,attachmentId:d.audioAttachmentId,label:r.recordingAudio,unavailableLabel:r.recordingUnavailable})]}):null,t[14]=r.recordingAudio,t[15]=r.recordingUnavailable,t[16]=d.audioAttachmentId,t[17]=n,t[18]=y):y=t[18];let b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),t[19]=b):b=t[19];let x=d.status===`recording`?r.draftTranscript:r.fullTranscript,S;t[20]===x?S=t[21]:(S=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[b,x]}),t[20]=x,t[21]=S);let C;t[22]===d.status?C=t[23]:(C=d.status===`needs_attention`?(0,$.jsx)(H,{className:`size-3.5 text-danger`}):d.status===`completed`?(0,$.jsx)(g,{className:`size-3.5 text-success`}):null,t[22]=d.status,t[23]=C);let w=d.status===`needs_attention`?d.failureMessage:_,T;t[24]!==C||t[25]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let D;t[27]!==S||t[28]!==T?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[S,T]}),t[27]=S,t[28]=T,t[29]=D):D=t[29];let k=f.text||r.waitingTranscript,A;t[30]===k?A=t[31]:(A=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted xl:max-h-none xl:overflow-visible`,children:k}),t[30]=k,t[31]=A);let M;t[32]!==D||t[33]!==A?(M=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[D,A]}),t[32]=D,t[33]=A,t[34]=M):M=t[34];let N;return t[35]!==M||t[36]!==v||t[37]!==y?(N=(0,$.jsxs)(`aside`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle xl:h-full xl:max-h-none xl:w-[clamp(20rem,34%,27rem)] xl:border-r xl:border-b-0`,children:[v,y,M]}),t[35]=M,t[36]=v,t[37]=y,t[38]=N):N=t[38],N}function Vt(e){return e.title}function Ht(e,t){return e.sequence-t.sequence}function Ut(e){return e.language}var Wt={edit:x,ai_edit:te,sync:Ve,restore:Je};function Gt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function Kt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=O(e=>e.language),o=E(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:D(a)},{data:c}=j(e?[`note-history`,e]:null,()=>ve(e)),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),h=(0,Q.useCallback)(async t=>{u(!0),m(null);try{await oe(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=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)(ge,{className:`size-4`,"aria-hidden":!0}),o.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)(w,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=Wt[e.trigger]??x,i=t===e.timestamp,a=d===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:A(`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:Gt(e.trigger,o)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:_t(e.timestamp,g,s)})]}),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:a?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,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:l?`...`:o.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(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(),f(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:o.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:o.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function qt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=E(O(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),{data:v,mutate:y,isLoading:b}=j(e?[`note-agent-context-status`,e]:null,()=>ke(e),{revalidateOnFocus:!1}),x=(0,Q.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>fe(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),S=(0,Q.useCallback)(async t=>{try{await W(e,t)}catch{}},[e]);return(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:[(0,$.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(He,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(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:u.catalysisSectionDescription}),v?(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:u.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:b||g,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?u.processing:u.contextRebuild}),(0,$.jsx)(`span`,{className:A(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.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:v.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,$.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(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))}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:n,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:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(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:u.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(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))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(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))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(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}`))})]}),(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:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(`helpful`),className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,$.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void S(`not_helpful`),className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,$.jsx)(L,{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:u.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:[(0,$.jsx)(U,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:s,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:s?u.openingChat:u.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:s,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:u.newThread})]})]}),o.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(`/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||u.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.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:u.noThreads})]})]})]})}var Jt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function Yt({open:e,onOpenChange:t,note:n}){let r=O(e=>e.language)===`zh`,i=r?Qt:$t,{data:a,mutate:g}=j(e?[`note-shares`,n.id]:null,()=>et(n.id)),[y,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(`86400000`),[E,D]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(null),W=(0,Q.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Q.useEffect)(()=>{e&&(x(new Set(W.map(e=>e.id))),R(null),B(!1),U(null))},[e,W]);let ee=async()=>{P(!0),U(null);try{R((await Ee(n.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y],ttlMs:Number(S),maxViews:E.trim()?Number(E):null,description:k.trim()||void 0})).payload.shareUrl),await g()}catch(e){U(e instanceof Error?e.message:String(e))}finally{P(!1)}},G=async(e,t)=>{I(e.id),U(null);try{t===`refresh`?await V(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y]}):t===`extend`?await ie(e.id,864e5):await ot(e.id),await g()}catch(e){U(e instanceof Error?e.message:String(e))}finally{I(null)}},K=async e=>{U(null);try{if(!await T(e)){B(!1),U(i.copyFailed);return}B(!0),window.setTimeout(()=>B(!1),1500)}catch{B(!1),U(i.copyFailed)}};return(0,$.jsx)(f,{open:e,onOpenChange:t,children:(0,$.jsxs)(l,{children:[(0,$.jsx)(o,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(u,{className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(d,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(he,{className:`size-4`}),i.title]}),(0,$.jsx)(s,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,$.jsx)(w,{className:`size-4`})})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,$.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),W.length>0?(0,$.jsxs)(`section`,{className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:W.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:y.has(e.id),onChange:()=>x(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Zt(e.size)})]},e.id))})]}):null,(0,$.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,$.jsx)(m,{value:S,onChange:e=>C(e.target.value),children:Jt.map(e=>(0,$.jsx)(h,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,$.jsx)(`input`,{type:`number`,min:1,max:1e3,value:E,onChange:e=>D(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,$.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),L?(0,$.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(`input`,{readOnly:!0,value:L,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,$.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void K(L),children:[z?(0,$.jsx)(p,{className:`size-4`}):(0,$.jsx)(_,{className:`size-4`}),z?i.copied:i.copy]}),(0,$.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(L,`_blank`,`noopener,noreferrer`),children:[(0,$.jsx)(v,{className:`size-4`}),i.open]})]})}):null,H?(0,$.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:H}):null,(a?.items.length??0)>0?(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,$.jsx)(Xt,{share:e,busy:F===e.id,t:i,onCopy:K,onAction:G},e.id))})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,$.jsx)(c,{asChild:!0,children:(0,$.jsx)(M,{type:`button`,variant:`ghost`,children:i.close})}),(0,$.jsxs)(M,{type:`button`,onClick:()=>void ee(),disabled:N,children:[N?(0,$.jsx)(b,{className:`size-4 animate-spin`}):(0,$.jsx)(he,{className:`size-4`}),N?i.creating:i.create]})]})]})]})})}function Xt(e){let t=(0,st.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=A(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,d;t[2]===u?d=t[3]:(d=(0,$.jsx)(`span`,{children:u}),t[2]=u,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{children:`·`}),t[4]=f):f=t[4];let p=n.maxViews===null?``:` / ${n.maxViews}`,m;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==p?(m=(0,$.jsxs)(`span`,{children:[i.views,` `,n.viewCount,p]}),t[5]=n.viewCount,t[6]=i.views,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`span`,{children:`·`}),t[9]=h):h=t[9];let g;t[10]===n.expiresAt?g=t[11]:(g=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=g);let y;t[12]===g?y=t[13]:(y=(0,$.jsx)(`span`,{children:g}),t[12]=g,t[13]=y);let x;t[14]!==y||t[15]!==d||t[16]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[d,f,m,h,y]}),t[14]=y,t[15]=d,t[16]=m,t[17]=x):x=t[17];let S;t[18]===n.shareUrl?S=t[19]:(S=(0,$.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=S);let C;t[20]!==x||t[21]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===r?w=t[24]:(w=r?(0,$.jsx)(b,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=w);let T;t[25]!==C||t[26]!==w?(T=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==a||t[29]!==n.shareUrl?(E=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=E):E=t[30];let D;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(_,{className:`size-3.5`}),t[31]=D):D=t[31];let O;t[32]!==i.copy||t[33]!==E?(O=(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:E,children:[D,i.copy]}),t[32]=i.copy,t[33]=E,t[34]=O):O=t[34];let k;t[35]===n.shareUrl?k=t[36]:(k=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=k);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(v,{className:`size-3.5`}),t[37]=j):j=t[37];let N;t[38]!==i.open||t[39]!==k?(N=(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:k,children:[j,i.open]}),t[38]=i.open,t[39]=k,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,$.jsx)(Ve,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,$.jsx)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,$.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,$.jsx)(se,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==O||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[O,N,P,F,I]}),t[58]=O,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==T||t[65]!==l||t[66]!==L?(R=(0,$.jsxs)(`div`,{className:l,children:[T,L]}),t[64]=T,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function Zt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Qt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},$t={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function en(e){let t=(0,st.c)(17),{input:n,labels:r}=e,i;t[0]===n?i=t[1]:(i=n(),t[0]=n,t[1]=i);let a=i.source.id,o;t[2]===a?o=t[3]:(o=e=>e.source?.type===`note`&&e.source.id===a&&e.status!==`idle`,t[2]=a,t[3]=o);let s=q(o),c;t[4]===a?c=t[5]:(c=e=>e.source?.type===`note`&&e.source.id===a&&e.status===`preparing`,t[4]=a,t[5]=c);let l=q(c),u=q(tn),d;t[6]!==n||t[7]!==r||t[8]!==l?(d=(0,$.jsx)(ee,{input:n,labels:r,disabled:l,showLabel:!0}),t[6]=n,t[7]=r,t[8]=l,t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==r||t[12]!==u?(f=s?(0,$.jsx)(`button`,{type:`button`,onClick:u,title:r.stop,"aria-label":r.stop,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`,children:(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0})}):null,t[10]=s,t[11]=r,t[12]=u,t[13]=f):f=t[13];let p;return t[14]!==d||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[d,f]}),t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function tn(e){return e.stop}function nn(e,t){let n=J(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=J(e);return!r||n.split(`
3
+ `)[0]===r?n:[r,n].filter(Boolean).join(`
4
+
5
+ `)}var rn=()=>i(()=>import(`./block-editor-CWdP4bUc.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,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65])),an=()=>i(()=>import(`./markdown-editor-nDLmA_LF.js`),__vite__mapDeps([66,1,3,63,5,67])),on=(0,Q.lazy)(()=>rn().then(e=>({default:e.BlockEditor}))),sn=(0,Q.lazy)(()=>an().then(e=>({default:e.MarkdownEditor})));function cn(){let e=(0,st.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 ln(e){let t=(0,st.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Ce},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:nt},t[2]=i.source,t[3]=o);let s;t[4]===i.preview?s=t[5]:(s={id:`preview`,label:i.preview,Icon:y},t[4]=i.preview,t[5]=s);let c;t[6]!==a||t[7]!==o||t[8]!==s?(c=[a,o,s],t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9];let l=c,u;return t[10]!==n||t[11]!==l||t[12]!==r?(u=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:l.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&rn(),t===`source`&&an()},onFocus:()=>{t===`wysiwyg`&&rn(),t===`source`&&an()},className:A(`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]=l,t[12]=r,t[13]=u):u=t[13],u}function un(e){let t=(0,st.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,onAutoFocusConsumed:u}=e,d=a===void 0?!0:a,f=s===void 0?!0:s,p=l===void 0?!1:l,m=O(dn),h;t[0]===m?h=t[1]:(h=E(m),t[0]=m,t[1]=h);let g=h.notes.lightboxClose,_;t[2]!==p||t[3]!==o||t[4]!==f||t[5]!==n||t[6]!==u||t[7]!==r||t[8]!==c||t[9]!==i||t[10]!==d?(_=(0,$.jsx)(fn,{noteId:n,onBack:r,onSaved:i,showBackButton:d,backButtonClassName:o,clearHeaderOnCleanup:f,onOpenSearch:c,autoFocus:p,onAutoFocusConsumed:u}),t[2]=p,t[3]=o,t[4]=f,t[5]=n,t[6]=u,t[7]=r,t[8]=c,t[9]=i,t[10]=d,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,$.jsx)(dt,{closeLabel:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function dn(e){return e.language}function fn({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:s,autoFocus:c=!1,onAutoFocusConsumed:l}){let u=O(e=>e.language),d=E(u).notes,f=E(u).automations.suggestions,p=a(),m=N(e=>e.resolved)===`dark`,{openImage:h}=lt(),[g,_]=(0,Q.useState)(`wysiwyg`),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,w]=(0,Q.useState)(!1),[T,D]=(0,Q.useState)(``),[k,M]=(0,Q.useState)(360),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(null),[H,W]=(0,Q.useState)(!1),[ee,G]=(0,Q.useState)(null),K=(0,Q.useRef)(!1),ne=(0,Q.useRef)(!1),re=(0,Q.useRef)(null),J=(0,Q.useRef)(null),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=Xe(e=>e.setPageHeader),pe=Xe(e=>e.clearPageHeader),{data:Y,mutate:X}=j(e?[`note-detail`,e]:null,()=>Be(e)),{data:me=[],mutate:_e}=j(e?[`note-threads`,e]:null,()=>it(e),{revalidateOnFocus:!1}),ve=b!==null,Z=(0,Q.useCallback)(e=>{V(`${d.refreshFailed}: ${e instanceof Error?e.message:d.quickCaptureFailedHint}`)},[d.quickCaptureFailedHint,d.refreshFailed]);(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(Z)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,Z]),(0,Q.useEffect)(()=>{K.current=!1,D(``),x(null),y(null),ne.current=!1,de.current=null},[e]),(0,Q.useEffect)(()=>{!Y||K.current||(D(Y.title??``),K.current=!0)},[Y]),(0,Q.useEffect)(()=>{if(!c||!Y||ve||de.current===e)return;let t=window.requestAnimationFrame(()=>{ue.current?.focus(),l?.()});return de.current=e,()=>window.cancelAnimationFrame(t)},[c,ve,Y,e,l]);let be=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,xe=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":d.back,className:A(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,je,i),children:(0,$.jsx)(He,{className:`size-4`,"aria-hidden":!0})}):null,[i,d.back,t,r]),Se=(0,Q.useCallback)(()=>{let t=q.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),Ce=(0,Q.useCallback)(e=>{e!==`preview`&&Se(),_(e)},[Se]),we=(0,Q.useCallback)(t=>{Se(),D(t),e&&(ae.current=t,J.current&&clearTimeout(J.current),J.current=setTimeout(async()=>{let t=ae.current;if(ae.current=null,t!==null){w(!0);try{await Pe(e,{title:t}),await X(),n?.()}catch{}finally{w(!1)}}},600))},[Se,e,X,n]),Te=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:A(`flex min-w-0 items-center gap-2`,je),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:T||be||void 0,children:T||be}),S?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:d.saving}):null]}),[d.saving,S,be,T]),Ee=(0,Q.useCallback)(async(t=!1)=>{z(!0),V(null);try{let n=await rt(e,{forceNew:t});await X(),await _e(),p(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){V(`${d.chatOpenFailedTitle}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{z(!1)}},[X,_e,p,e,d.chatOpenFailedMessage,d.chatOpenFailedTitle]),Oe=(0,Q.useCallback)(async()=>{L(!0),V(null);try{await $e(e),await X()}catch(e){V(`${d.catalysisFailed}: ${e instanceof Error?e.message:d.chatOpenFailedMessage}`)}finally{L(!1)}},[X,e]),ke=(0,Q.useCallback)(()=>{y(v===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!I&&Oe()},[v,I,Oe,Y?.aiDeep?.catalysis?.report]),Ae=(0,Q.useCallback)(()=>{let t=b?b.markdown??``:ie.current??Y?.markdown??``,n=b?b.title??``:T,r=nn(n,t);return{source:{type:`note`,id:e,title:n||d.titlePlaceholder},text:r,language:le(r,u)}},[u,d.titlePlaceholder,Y?.markdown,e,b,T]),Me=(0,Q.useCallback)(async()=>{re.current&&clearTimeout(re.current),J.current&&clearTimeout(J.current),re.current=null,J.current=null;let t=ie.current,r=ae.current;ie.current=null,ae.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;w(!0);try{let t=await Pe(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`),null}finally{w(!1)}},[X,d.saveFailed,d.saveFailedHint,Y,e,n]),Fe=(0,Q.useCallback)(async()=>{V(null);let e=await Me();e&&(G(e),W(!0))},[Me]),Ie=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:A(`flex items-center gap-2`,je),children:[s?(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":d.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)(C,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(en,{input:Ae,labels:{read:d.readAloud,preparing:d.readAloudPreparing,pause:d.readAloudPause,resume:d.readAloudResume,retry:d.readAloudRetry,stop:d.readAloudStop}}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Fe(),className:`inline-flex items-center gap-1.5 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`,children:[(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),u===`zh`?`分享`:`Share`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:ke,disabled:I,"aria-label":d.catalysisSectionTitle,className:A(`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`,v===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),I?d.catalyzing:d.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Ee(!1),disabled:R,className:A(`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)(U,{className:`size-3.5`,"aria-hidden":!0}),R?d.openingChat:d.openChatButton]}),(0,$.jsx)(ln,{mode:g,onModeChange:Ce,labels:{edit:d.modeEdit,source:d.modeSource,preview:d.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(v===`history`?null:`history`),"aria-label":d.history,className:A(`rounded-lg p-1.5 transition-colors`,v===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]}),[I,ke,Ee,g,d.history,d.modeEdit,d.modePreview,d.modeSource,R,v,s,d.searchDialogTitle,d.readAloud,d.readAloudPause,d.readAloudPreparing,d.readAloudResume,d.readAloudRetry,d.readAloudStop,Ce,Ae,Fe,u]);(0,Q.useLayoutEffect)(()=>(fe({startExtra:xe,main:Y?Te:null,end:Y?Ie:null}),()=>{o&&pe()}),[o,pe,Ie,Te,xe,Y,fe]);let Le=(0,Q.useCallback)(t=>{e&&(Se(),ie.current=t,re.current&&clearTimeout(re.current),re.current=setTimeout(async()=>{let t=ie.current;if(ie.current=null,t!==null){w(!0),V(null);try{await Pe(e,{markdown:t}),await X(),n?.()}catch(e){V(`${d.saveFailed}: ${e instanceof Error?e.message:d.saveFailedHint}`)}finally{w(!1)}}},600))},[Se,e,X,d.saveFailed,d.saveFailedHint,n]),Re=(0,Q.useCallback)(t=>{De(e,t.timestamp).then(e=>{e&&(Se(),x(e))})},[e,Se]),ze=(0,Q.useCallback)(()=>{Se(),y(null),x(null)},[Se]),Ve=(0,Q.useCallback)(()=>{Se(),y(null),x(null),X().catch(Z),n?.()},[X,n,Z,Se]);if((0,Q.useEffect)(()=>()=>{re.current&&clearTimeout(re.current),J.current&&clearTimeout(J.current);let t=ie.current,n=ae.current;ie.current=null,ae.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Pe(e,r).catch(()=>void 0)},[e]),Y===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(Y===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:d.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.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:d.back})]});let Ue=ve?b.title??``:T,We=ve?b.markdown??``:ie.current??Y.markdown??``,Ge=new Date(Y.createdAt).getTime(),Ke=Number.isFinite(Ge)&&Date.now()-Ge<3600*1e3?(0,$.jsx)(Nt,{title:f.noteCreatedTitle,description:f.noteCreatedDescription,prompt:f.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)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[B?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:B}):null,(0,$.jsx)(ye,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ye,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:oe,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[(0,$.jsx)(Bt,{noteId:e}),(0,$.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:ve?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ue&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ue}),We?(0,$.jsx)(Ne,{noteId:e,content:We,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[g===`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:ue,type:`text`,value:T,onChange:e=>we(e.target.value),onCompositionStart:()=>{ne.current=!0},onCompositionEnd:()=>{ne.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!ne.current&&!t.isComposing&&(e.preventDefault(),(oe.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:d.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`}),Ke]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(cn,{}),children:(0,$.jsx)(on,{initialContent:Y.markdown??``,onChange:Le,noteId:e},`wysiwyg-${e}`)})})]}),g===`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:ue,type:`text`,value:T,onChange:e=>we(e.target.value),placeholder:d.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`}),Ke]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(cn,{}),children:(0,$.jsx)(sn,{initialContent:Y.markdown??``,onChange:Le,isDark:m},`source-${e}`)})})]}),g===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&h(t.currentSrc||t.src,t.alt)},children:[T&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:T}),Y.markdown?(0,$.jsx)(Ne,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:d.emptyPreview})]})]})})]})]}),(0,$.jsx)(`div`,{ref:se,className:A(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!P&&`transition-[width] duration-300 ease-in-out`),style:{width:v?k:0},children:(0,$.jsxs)(`div`,{ref:ce,className:`flex min-h-0 flex-1 flex-col`,style:{width:k},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),F(!0);let n=e.clientX,r=k,i=e.pointerId,a=0,o=k,s=k,c=()=>{a=0,s=o,v&&se.current?.style.setProperty(`width`,`${s}px`),ce.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{}F(!1),M(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:A(`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`,P&&`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:v===`history`?(0,$.jsx)(Kt,{noteId:e,activeTimestamp:b?.timestamp??null,onSelect:Re,onClose:ze,onRestored:Ve}):v===`breakdown`?(0,$.jsx)(qt,{noteId:e,note:Y??null,catalyzing:I,onCatalyze:Oe,onClose:()=>y(null),noteThreads:me,openingChat:R,onOpenChat:()=>Ee(!1),onOpenNewChat:()=>Ee(!0)}):null})]})})]}),ee?(0,$.jsx)(Yt,{open:H,onOpenChange:W,note:ee}):null]})}var pn=3e4;function mn(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function hn({placeholder:e,submitLabel:t,actionsLabel:n,imageLabel:r,voiceLabel:i,stopRecordingLabel:a,onCapture:o,onImagePick:s,onVoiceCapture:c,onVoiceError:l,recordingLabel:u,imageDisabled:d=!1,voiceDisabled:f=!1,onDiscussionCapture:p,discussionCaptureLabel:m}){let[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useRef)([]),j=(0,Q.useRef)(0),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.useCallback)(()=>{M.current&&=(clearInterval(M.current),null),N.current&&=(clearTimeout(N.current),null),O.current?.getTracks().forEach(e=>e.stop()),O.current=null,D.current=null,k.current=[],b(!1),C(0)},[]);(0,Q.useEffect)(()=>()=>P(),[P]);let L=(0,Q.useCallback)(async()=>{let e=D.current;if(!e||e.state!==`recording`)return;T(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-j.current)/1e3)),n=e.mimeType||mn()||`audio/webm`,r=new Blob(k.current,{type:n});if(P(),r.size>0&&c){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,i=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await c(i,t)}finally{T(!1)}return}T(!1)},[P,c]),R=(0,Q.useCallback)(async()=>{if(!(!c||w||y)){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){l?.();return}try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});O.current=e;let t=mn(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);D.current=n,k.current=[],j.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&k.current.push(e.data)},n.start(),b(!0),C(0),M.current=setInterval(()=>{C(Math.round((Date.now()-j.current)/1e3))},250),N.current=setTimeout(()=>{L()},pn)}catch{P(),l?.()}}},[P,c,l,y,L,w]),B=(0,Q.useCallback)(async()=>{let e=h.trim();if(!(!e||_)){v(!0),g(``);try{await o(e)}catch{g(e)}finally{v(!1),E.current?.focus()}}},[h,_,o]),V=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),B())},[B]),H=_||w,U=!!(s||c||p);return(0,$.jsxs)(`div`,{className:A(`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`,y&&`border-danger ring-1 ring-danger/40`),"aria-busy":H,children:[y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void L(),disabled:w,className:`shrink-0 rounded-lg bg-danger-soft p-2 text-danger transition-colors hover:bg-danger-soft disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":a,title:a,"aria-pressed":`true`,children:(0,$.jsx)(ue,{className:`size-4 fill-current`,"aria-hidden":!0})}):U?(0,$.jsxs)(Ze,{children:[(0,$.jsx)(Re,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:H,className:`shrink-0 rounded-lg p-2 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":n,title:n,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})})}),(0,$.jsx)(We,{children:(0,$.jsxs)(Ae,{side:`top`,align:`start`,sideOffset:8,className:`z-50 min-w-44 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[s?(0,$.jsxs)(Z,{disabled:d,onSelect:s,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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(qe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),r]}):null,c?(0,$.jsxs)(Z,{disabled:f,onSelect:()=>void R(),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 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,$.jsx)(z,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i]}):null,p?(0,$.jsxs)(Z,{onSelect:p,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`,children:[(0,$.jsx)(F,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),m]}):null]})})]}):null,y?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:u.replace(`{{seconds}}`,String(x))}):(0,$.jsx)(`textarea`,{ref:E,value:h,onChange:e=>g(e.target.value),onKeyDown:V,placeholder:e,"aria-label":e,rows:1,disabled:H,className:`max-h-28 min-h-8 flex-1 resize-none overflow-y-auto 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:!h.trim()||H||y,onClick:()=>void B(),"aria-label":t,title:t,className:A(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h.trim()&&!H&&!y?`bg-accent text-white hover:bg-accent-hover`:`text-fg-disabled`),children:(0,$.jsx)(I,{className:`size-4`,"aria-hidden":!0})})]})}var gn={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},_n=240,vn=320,yn=520,bn=560;function xn(e){if(globalThis.localStorage===void 0)return vn;try{let t=globalThis.localStorage.getItem(e);if(!t)return vn;let n=Number(t);return Number.isFinite(n)?n:vn}catch{return vn}}function Sn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var Cn={thought:G,todo:Y,voice:z,media:qe,bookmark:ne,mixed:G,task:Y};function wn(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function Tn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function En(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function Dn({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:p,listTitle:g,listDescription:_,emptyText:v,emptyDescription:y,listWidthStorageKey:b=`xopc.notes.listWidth`}){let x=O(e=>e.language),T=E(x).notes,M=!!k(e=>e.token),[N,P]=(0,Q.useReducer)(ce,gn),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(``),[z,V]=(0,Q.useState)(0),[H,U]=(0,Q.useState)(()=>xn(b)),[W,ee]=(0,Q.useState)(!1),[K,te]=(0,Q.useState)(!1),[q,ne]=(0,Q.useState)(!1),[re,J]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(null),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),[le]=(0,Q.useState)(()=>Date.now()),ue=a(),fe=(0,Q.useCallback)(e=>{let t=oe.current?.clientWidth??window.innerWidth,n=Math.max(_n,t-bn);return Math.max(_n,Math.min(Math.min(yn,n),e))},[]),pe=(0,Q.useCallback)(e=>{let t=fe(e);U(t),Sn(b,t)},[fe,b]);(0,Q.useLayoutEffect)(()=>{U(e=>fe(e))},[fe]);let{data:Y,mutate:X,isLoading:he}=j((0,Q.useMemo)(()=>M?[`notes-list`,p,N.statusFilter,N.kindFilter,N.pinnedOnly]:null,[M,p,N.statusFilter,N.kindFilter,N.pinnedOnly]),()=>be({status:N.statusFilter===`all`?void 0:N.statusFilter,kind:N.kindFilter===`all`?void 0:N.kindFilter,projectId:p,pinned:N.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),ge=he&&!Y,ve=Y?.items??[],ye=Y?.total??0,Z=L.trim(),{data:xe,isLoading:Se}=j(M&&F&&Z?[`notes-search`,p,Z]:null,()=>be({search:Z,projectId:p,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),Ce=xe?.items??[],Te=e?ve.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{V(0)},[Z]),(0,Q.useEffect)(()=>{z>=Ce.length&&V(Math.max(0,Ce.length-1))},[z,Ce.length]),(0,Q.useEffect)(()=>{let e=()=>{X().catch(e=>{J(`${T.refreshFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)})};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[X,T.quickCaptureFailedHint,T.refreshFailed]);let Ee=Xe(e=>e.setPageHeader),De=Xe(e=>e.clearPageHeader),Oe=T.noteCount.replace(`{{count}}`,String(ye)),ke=!r&&ye===0&&_?_:Oe,Ae=T.searchDialogTitle,Me=T.searchClose,Ne=T.searchClear,Fe=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>I(!0),className:A(`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`,je),"aria-label":Ae,children:[(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:Ae})]}),[Ae]);(0,Q.useLayoutEffect)(()=>{if(n)return M?(Ee({startExtra:null,main:(0,$.jsxs)(`div`,{className:A(`flex min-w-0 items-center gap-2`,je),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:g??T.title}),Oe?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Oe}):null]}),end:Fe}),()=>De()):(De(),()=>De())},[De,M,Fe,g,n,T.title,Oe,e,Ee]);let Ie=(0,Q.useMemo)(()=>({justNow:T.justNow,minutesAgo:T.minutesAgo,today:T.today,yesterday:T.yesterday,daysAgo:T.daysAgo,locale:D(x)}),[x,T.justNow,T.minutesAgo,T.today,T.yesterday,T.daysAgo]),Le=(0,Q.useMemo)(()=>[{id:`recent`,label:T.viewRecent,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:T.filterInbox,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:T.pinned,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:T.viewTasks,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:T.kindVoice,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:T.kindMedia,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:T.kindBookmark,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:T.filterProcessed,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:T.filterArchived,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[T.filterArchived,T.filterInbox,T.filterProcessed,T.kindBookmark,T.kindMedia,T.kindVoice,T.pinned,T.viewRecent,T.viewTasks]),Re=Le.find(e=>Tn(N,e))??Le[0],ze=g??Re.label,Be=(0,Q.useCallback)(async e=>{J(null);try{let n=p?await we({markdown:e,kind:`thought`,projectId:p,channel:`web`}):await de(e,`web`);await X(),ue(En(t,n.id))}catch(e){throw J(`${T.quickCaptureFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`),e}},[t,X,T.quickCaptureFailed,T.quickCaptureFailedHint,ue,p]),Ve=(0,Q.useCallback)(async()=>{if(!q){ne(!0),J(null);try{let e=await we({markdown:``,kind:`thought`,projectId:p,channel:`web`});P({type:`patch`,patch:gn}),await X(),ae(e.id),ue(En(t,e.id))}catch(e){J(`${T.createBlankFailed}: ${e instanceof Error?e.message:T.createBlankFailedHint}`)}finally{ne(!1)}}},[t,q,X,T.createBlankFailed,T.createBlankFailedHint,ue,p]),He=(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{J(null),await B(t,`web`),await X()}catch(e){J(`${T.imageUploadFailed}: ${e instanceof Error?e.message:T.imageUploadFailedHint}`)}},e.click()},[X,T.imageUploadFailed,T.imageUploadFailedHint]),Ue=(0,Q.useCallback)(async(e,t)=>{try{J(null),await tt(e,t,`web`),await X()}catch(e){J(`${T.voiceUploadFailed}: ${e instanceof Error?e.message:T.voiceUploadFailedHint}`)}},[X,T.voiceUploadFailed,T.voiceUploadFailedHint]),We=(0,Q.useCallback)(()=>{J(`${T.voiceCaptureFailed}: ${T.voiceCaptureFailedHint}`)},[T.voiceCaptureFailed,T.voiceCaptureFailedHint]),Ge=(0,Q.useCallback)(async(e,t)=>{J(null);try{await Pe(e,{pinned:t}),await X()}catch(e){J(`${T.actionFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)}},[X,T.actionFailed,T.quickCaptureFailedHint]),qe=(0,Q.useCallback)(async e=>{J(null);try{await Pe(e,{status:`archived`}),await X()}catch(e){J(`${T.actionFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)}},[X,T.actionFailed,T.quickCaptureFailedHint]),Je=(0,Q.useCallback)(async e=>{J(null);try{await Ke(e),await X()}catch(e){J(`${T.actionFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)}},[X,T.actionFailed,T.quickCaptureFailedHint]),Ye=(0,Q.useCallback)(e=>{ue(En(t,e))},[t,ue]),Ze=(0,Q.useCallback)(e=>{ue(En(t,e)),I(!1)},[t,ue]),Qe=(0,Q.useCallback)(e=>{if(Ce.length){if(e.key===`ArrowDown`)e.preventDefault(),V(e=>Math.min(Ce.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),V(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=Ce[z]??Ce[0];t&&Ze(t.id)}}},[z,Ze,Ce]),$e=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=se.current;t.setPointerCapture(e.pointerId),ee(!0);let r=oe.current?.clientWidth??window.innerWidth,i=Math.max(_n,r-bn),a=Math.min(yn,i),o=e=>Math.max(_n,Math.min(a,e)),s=e.clientX,c=o(H),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{}ee(!1),oe.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),U(f),Sn(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,H]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ve())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ve]);let et=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),pe(H-16)):e.key===`ArrowRight`?(e.preventDefault(),pe(H+16)):e.key===`Home`?(e.preventDefault(),pe(_n)):e.key===`End`&&(e.preventDefault(),pe(yn))},[pe,H]);return M?(0,$.jsxs)(`div`,{ref:oe,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${H}px`},children:[(0,$.jsxs)(`section`,{ref:se,className:A(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!W&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,K?`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":K?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[re?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:re}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,$.jsx)(m,{value:Re.id,onChange:e=>{let t=Le.find(t=>t.id===e.target.value);t&&P({type:`patch`,patch:t.patch})},className:`-ml-1 h-7 w-full max-w-44 rounded-lg border border-transparent bg-transparent px-2 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":T.libraryTitle,children:Le.map(e=>(0,$.jsx)(h,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:ze}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:ke})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>te(!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":T.collapseNotesList,title:T.collapseNotesList,children:(0,$.jsx)(_e,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ve,disabled:q,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":T.createBlankNote,title:T.createBlankShortcut,children:(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>I(!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":T.searchDialogTitle,title:T.searchDialogTitle,children:(0,$.jsx)(C,{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:ge?(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))}):ve.length===0?(0,$.jsxs)(`div`,{className:`flex h-full min-h-48 flex-col items-center justify-center gap-2 px-6 py-10 text-center`,children:[(0,$.jsx)(`span`,{className:`mb-1 inline-flex size-12 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-fg-muted`,children:(0,$.jsx)(G,{className:`size-6`,"aria-hidden":!0})}),(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:e&&!Te?T.noteOutsideCurrentView:v??T.noNotes}),e&&!Te?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:y??T.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Te?(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:T.noteOutsideCurrentView}):null,ve.map((t,n)=>{let r=n>0?yt(ve[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[yt(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:A(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:vt(t.createdAt,le,Ie)}),(0,$.jsx)(Tt,{note:t,selected:t.id===e,onPress:Ye,onPin:Ge,onArchive:qe,onDelete:Je,timeLabels:Ie,labels:{pin:T.pin,unpin:T.unpin,archive:T.archive,delete:T.delete,actions:T.noteActions,imageNote:T.imageNote,noText:T.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(hn,{placeholder:T.quickCapturePlaceholder,submitLabel:T.quickCaptureSubmit,actionsLabel:T.quickCaptureActions,imageLabel:T.quickCaptureImage,voiceLabel:T.quickCaptureVoice,stopRecordingLabel:T.stopRecording,onCapture:Be,onImagePick:i?He:void 0,onVoiceCapture:i?Ue:void 0,onVoiceError:We,recordingLabel:T.recording,discussionCaptureLabel:T.discussionCapture.title,onDiscussionCapture:()=>me(p)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":T.resizeNotesList,"aria-valuemin":_n,"aria-valuemax":yn,"aria-valuenow":Math.round(H),tabIndex:0,onPointerDown:$e,onDoubleClick:()=>pe(vn),onKeyDown:et,title:T.resizeNotesList,className:A(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,K?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 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:A(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,W&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:A(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[K?(0,$.jsx)(`button`,{type:`button`,onClick:()=>te(!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":T.expandNotesList,title:T.expandNotesList,children:(0,$.jsx)(_e,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(un,{noteId:e,onBack:()=>ue(t),onSaved:()=>{X().catch(e=>{J(`${T.refreshFailed}: ${e instanceof Error?e.message:T.quickCaptureFailedHint}`)})},backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>I(!0),autoFocus:e===ie,onAutoFocusConsumed:()=>ae(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)(G,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:T.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:T.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ve,disabled:q,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)(S,{className:`size-4`,"aria-hidden":!0}),q?T.creatingBlankNote:T.createBlankNote]})]})})]}),(0,$.jsx)(f,{open:F,onOpenChange:I,children:(0,$.jsxs)(l,{children:[(0,$.jsx)(o,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(u,{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)(d,{className:`text-sm font-semibold text-fg`,children:Ae}),(0,$.jsx)(s,{className:`sr-only`,children:T.searchPlaceholder}),(0,$.jsx)(c,{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":Me,children:(0,$.jsx)(w,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(C,{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:L,onChange:e=>R(e.target.value),onKeyDown:Qe,placeholder:T.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`}),L?(0,$.jsx)(`button`,{type:`button`,onClick:()=>R(``),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":Ne,children:(0,$.jsx)(w,{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:Z?Se&&!xe?(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))}):Ce.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)(G,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:T.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:T.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:T.searchResultsCount.replace(`{{count}}`,String(xe?.total??Ce.length))}),Ce.map((e,t)=>{let n=Cn[e.kind]||G,r=wn(e,{imageNote:T.imageNote,noText:T.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Ze(e.id),onMouseEnter:()=>V(t),className:A(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===z?`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:_t(e.updatedAt,le,Ie)})]}),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)(C,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:T.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:T.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(G,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:T.needToken})]})}export{lt as n,Dn as t};
@@ -1 +1 @@
1
- import{i as e,r as t}from"./locale-store-CBoCuIMx.js";import{t as n}from"./electron-env-DH5wF8X8.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
1
+ import{i as e,r as t}from"./locale-store-BJFLQY8O.js";import{t as n}from"./electron-env-DH5wF8X8.js";function r(){if(!n())return;let e=window.location.hash.startsWith(`#/`)?window.location.hash.slice(1):`/`;return e.length<=2048?e:`/`}async function i(i){let a=await e(t(`/api/auth/oauth-async/start`),{method:`POST`,body:JSON.stringify({provider:i,client:n()?`desktop`:`web`,returnPath:r()})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`OAuth start failed: ${a.status}`)}return(await a.json()).payload}async function a(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/status`));if(!r.ok)throw Error(`OAuth status: ${r.status}`);return(await r.json()).payload}async function o(n,r){let i=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/code`),{method:`POST`,body:JSON.stringify({code:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||`Submit code failed: ${i.status}`)}}async function s(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}/cancel`),{method:`POST`});if(!r.ok)throw Error(`Cancel OAuth failed: ${r.status}`)}async function c(n){let r=await e(t(`/api/auth/oauth-async/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Cleanup session failed: ${r.status}`)}async function l(n){let r=await e(t(`/api/auth/oauth/${encodeURIComponent(n)}`),{method:`DELETE`});if(!r.ok)throw Error(`Revoke OAuth failed: ${r.status}`)}export{i as a,l as i,c as n,o,a as r,s as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{a,r as o}from"./product-delivery-CV4pDOtG.js";import{n as s}from"./locale-store-CBoCuIMx.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{n as u}from"./api-BbXzyQMj.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=s(h)===`zh`,m=o(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=a({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{c as n,r,t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{a,r as o}from"./product-delivery-CV4pDOtG.js";import{n as s}from"./locale-store-BJFLQY8O.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{n as u}from"./api-B0-hLuZ1.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=n(),i=s(h)===`zh`,m=o(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=a({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};