@xopcai/xopc 0.0.331 → 0.0.332

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 (169) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0BtF24E.js → agent-avatar-dicebear-C2wg3xC_.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DgP5DEJF.js → agent-defaults-settings-panel-Se1Z72VG.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DbvLXQO2.js → agent-plugin-dialog-BeNnu1Ts.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-Bh4XNLyk.js → agents-udIitwV8.js} +3 -3
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-fwzTRJfP.js → app-management-settings-panel-etFSkfzl.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-v_GGe8UZ.js → appearance-settings-DKmU2VAP.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-C9ZMEuuA.js → apps-page-DVNySL58.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-B6EgADeH.js → archive-plugin-D0z_Fr2G.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-B4H_IFeX.js → attachment-load-DNCDbeOX.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-UlVCvg4r.js → automations-page-B7_C-p66.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +7 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-BxTSx30f.js → binary-plugins-BYn2hScX.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-CVzdrpjl.js → block-editor-ChWW8Z9L.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-automations-page-CBVD8k6O.js → browser-automations-page-BV00BXRb.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-settings-page-CC43CC43.js → browser-settings-page-xwTmuZjS.js} +1 -1
  18. package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +1 -0
  19. package/dist/gateway/static/root/assets/{capabilities-page-BAT7Vvb8.js → capabilities-page-v0WkhV5o.js} +2 -2
  20. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DPETQOfF.js → capabilities-settings-panel-DefBGjhV.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capability-header-actions-EETjXmkG.js → capability-header-actions-vmx35sbu.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-CwA619os.js → channels-Eo4ONF5X.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-DCqm9j9W.js → chat-terminal-dock-C41mXCAi.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-CxFWdovV.js → computer-settings-page-BJkqok2G.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-wxsEhmlU.js → connector-service-page-BKCZMmwm.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-l7goF6QS.js → connectors-page-DZYgogQw.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-h_OS6uBR.js → date-picker-CrOV4Ynd.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-DNgSSH3z.js → dependency-picker-CqADAHZp.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-CflvPnB-.js → desktop-pet-Bab-iWED.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CXy0X5Js.js → desktop-pet-settings-BqgzLOdi.js} +1 -1
  31. package/dist/gateway/static/root/assets/{device-pairing-wizard-BDMiJcsK.js → device-pairing-wizard-DFg7FDPf.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-BqkOh13m.js → directory-picker-path-field-hqJ9sFCR.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-VT4s-9pK.js → extension-debug-page-DX3PFhRE.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-CBSeGhGA.js → extension-page-DkREdHLs.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-DRB6uOo8.js → extension-settings-page-wF-HNTM-.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-lF-FpnZy.js → gateway-settings-Du-Dos9O.js} +1 -1
  37. package/dist/gateway/static/root/assets/{home-page-DSaXXoLm.js → home-page-D7YoMHq4.js} +1 -1
  38. package/dist/gateway/static/root/assets/{imports-page-DGkOijwE.js → imports-page-B80Cv043.js} +1 -1
  39. package/dist/gateway/static/root/assets/{index-D99vN3es.js → index-DalslRUx.js} +8 -8
  40. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-iU6c2zg1.js → keyboard-shortcuts-settings-BgoFaTwv.js} +1 -1
  41. package/dist/gateway/static/root/assets/{local-app-workbench-page-rH33N8I9.js → local-app-workbench-page-BKL5UZAj.js} +1 -1
  42. package/dist/gateway/static/root/assets/{local-apps-page-C0BWC8D2.js → local-apps-page-HO6OQlQT.js} +1 -1
  43. package/dist/gateway/static/root/assets/{logs-page-Dpoi-r-_.js → logs-page-CjzR9Rpj.js} +1 -1
  44. package/dist/gateway/static/root/assets/{management-settings-RFDLaquR.js → management-settings-Dk_gTJb9.js} +1 -1
  45. package/dist/gateway/static/root/assets/{media-plugins-C8E_F2F_.js → media-plugins-Dlj6TD3M.js} +1 -1
  46. package/dist/gateway/static/root/assets/{note-detail-panel-DI7CIjmM.js → note-detail-panel-BebJPjjk.js} +3 -3
  47. package/dist/gateway/static/root/assets/{notes-page-BkqnU-Jh.js → notes-page-CmS_hvz8.js} +1 -1
  48. package/dist/gateway/static/root/assets/{page-context-capture-button-qqWG_gs_.js → page-context-capture-button-BArPtqp5.js} +1 -1
  49. package/dist/gateway/static/root/assets/{page-tabs-b3lheKy4.js → page-tabs-vqI30Yrg.js} +1 -1
  50. package/dist/gateway/static/root/assets/{preview-open-alternatives-0Q4rTfGX.js → preview-open-alternatives-B-mwPBJW.js} +1 -1
  51. package/dist/gateway/static/root/assets/{product-open-page-jnJZCrKQ.js → product-open-page-D--sj_uN.js} +1 -1
  52. package/dist/gateway/static/root/assets/{project-detail-page-BvvcTH2F.js → project-detail-page-BFUdtWXF.js} +1 -1
  53. package/dist/gateway/static/root/assets/{projects-page-r96k_2wB.js → projects-page-DBsBwAQ6.js} +1 -1
  54. package/dist/gateway/static/root/assets/{remote-access-hub-B1d8pB_y.js → remote-access-hub-BurdDY0m.js} +1 -1
  55. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Do_iF13W.js → runtime-tools-settings-panel-CAnb0PNY.js} +1 -1
  56. package/dist/gateway/static/root/assets/{scenes-page-DK316w9a.js → scenes-page-Cj8xtr5t.js} +1 -1
  57. package/dist/gateway/static/root/assets/{schema-form-Cfft26Je.js → schema-form-BKj6wIMb.js} +1 -1
  58. package/dist/gateway/static/root/assets/{sessions-page-EIk8iJTK.js → sessions-page-BCsjgkCs.js} +1 -1
  59. package/dist/gateway/static/root/assets/settings-advanced-gate-BLL7csOJ.js +1 -0
  60. package/dist/gateway/static/root/assets/{settings-form-section-iI0MTyuU.js → settings-form-section-78ycUHfv.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-page-C2Ka9oJm.js → settings-page-BOdxIVzo.js} +1 -1
  62. package/dist/gateway/static/root/assets/{setup-status-panel-nnmS_p5h.js → setup-status-panel-CbKHBjrU.js} +1 -1
  63. package/dist/gateway/static/root/assets/{share-preview-page-D0Knvtlp.js → share-preview-page-DyLfktib.js} +1 -1
  64. package/dist/gateway/static/root/assets/{shares-settings-BcaxGQLC.js → shares-settings-BzvSNouj.js} +1 -1
  65. package/dist/gateway/static/root/assets/{skill-api-BuZKcy9b.js → skill-api-CiBGQ0Jg.js} +1 -1
  66. package/dist/gateway/static/root/assets/{skill-reload-api-Cb_CUL-U.js → skill-reload-api-BHnru0F5.js} +1 -1
  67. package/dist/gateway/static/root/assets/{skills-page-DcxWxIrR.js → skills-page-C35VKjhb.js} +1 -1
  68. package/dist/gateway/static/root/assets/{system-settings-panel-CMG0ZAsd.js → system-settings-panel-CyJUeREH.js} +1 -1
  69. package/dist/gateway/static/root/assets/{task-detail-page-Cvr1qUTW.js → task-detail-page-Bd1_Fguk.js} +1 -1
  70. package/dist/gateway/static/root/assets/{tunnel-api-DGYA6GyO.js → tunnel-api-Day9zhKi.js} +1 -1
  71. package/dist/gateway/static/root/assets/{use-autosave-CDemMoSX.js → use-autosave-Bj9hC6ML.js} +1 -1
  72. package/dist/gateway/static/root/assets/{user-model-page-VXfz3rE7.js → user-model-page-DuYzuR1T.js} +1 -1
  73. package/dist/gateway/static/root/assets/{voice-api-key-field-CXArY4t5.js → voice-api-key-field-fWRD6B8r.js} +1 -1
  74. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dk5KsKOm.js → work-discovery-overlay-CnxdvIk8.js} +1 -1
  75. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DNpdaI-2.js → workflow-run-setup-panel-DlWNN1VA.js} +1 -1
  76. package/dist/gateway/static/root/assets/{workflows-page-DDNDLdId.js → workflows-page-B45YDiEw.js} +1 -1
  77. package/dist/gateway/static/root/index.html +2 -2
  78. package/dist/package.js +1 -1
  79. package/dist/packages/gateway-contract/src/automations.js +15 -0
  80. package/dist/src/agent/agent-manager.js +4 -4
  81. package/dist/src/agent/background-review/run-background-review.js +1 -1
  82. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  83. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  84. package/dist/src/agent/image/tool-model-config.js +1 -1
  85. package/dist/src/agent/orchestration/agent-orchestrator.js +0 -21
  86. package/dist/src/agent/service.js +2 -2
  87. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  88. package/dist/src/agent-catalog/capabilities.js +2 -2
  89. package/dist/src/auth/credentials.js +1 -1
  90. package/dist/src/auth/oauth-provider-lock.js +1 -1
  91. package/dist/src/auth/sync-provider-auth.js +1 -1
  92. package/dist/src/automations/capabilities/drafts.js +1 -1
  93. package/dist/src/automations/capabilities/write.d.ts +17 -0
  94. package/dist/src/automations/capabilities/write.js +26 -2
  95. package/dist/src/automations/domain/defaults.js +1 -1
  96. package/dist/src/automations/domain/index.js +2 -2
  97. package/dist/src/automations/domain/types.d.ts +22 -0
  98. package/dist/src/automations/domain/validation.d.ts +68 -0
  99. package/dist/src/automations/domain/validation.js +17 -1
  100. package/dist/src/automations/draft/automation-draft-validator.d.ts +9 -0
  101. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  102. package/dist/src/automations/index.js +2 -2
  103. package/dist/src/automations/service/action-executor.js +16 -0
  104. package/dist/src/automations/storage/automation-repository.js +4 -3
  105. package/dist/src/bootstrap/application-state.js +1 -1
  106. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  107. package/dist/src/capabilities/runtime/product.js +1 -1
  108. package/dist/src/chat-commands/agent-edit.js +1 -1
  109. package/dist/src/chat-commands/builtins/config.js +1 -1
  110. package/dist/src/cli/commands/agent.js +1 -1
  111. package/dist/src/cli/commands/agents.js +1 -1
  112. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  113. package/dist/src/cli/commands/models.js +1 -1
  114. package/dist/src/cli/commands/onboard/model.js +2 -2
  115. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  116. package/dist/src/config/index.js +4 -4
  117. package/dist/src/config/loader.js +2 -2
  118. package/dist/src/config/models-json.js +1 -1
  119. package/dist/src/config/schema.d.ts +4 -0
  120. package/dist/src/config/schema.js +5 -1
  121. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  122. package/dist/src/gateway/agents-admin.js +2 -2
  123. package/dist/src/gateway/file-path-classifier.js +1 -1
  124. package/dist/src/gateway/home-intelligence-automation-reconciler.d.ts +3 -0
  125. package/dist/src/gateway/home-intelligence-automation-reconciler.js +49 -0
  126. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  127. package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -4
  128. package/dist/src/gateway/hono/routes/home.js +0 -1
  129. package/dist/src/gateway/hono/routes/notes.js +2 -2
  130. package/dist/src/gateway/hono/routes/projects.js +2 -2
  131. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  132. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  133. package/dist/src/gateway/hono/routes/update.js +6 -1
  134. package/dist/src/gateway/image-generation-setup.js +2 -2
  135. package/dist/src/gateway/lock.js +1 -1
  136. package/dist/src/gateway/memory-maintenance-automation-reconciler.js +17 -14
  137. package/dist/src/gateway/service.d.ts +1 -0
  138. package/dist/src/gateway/service.js +27 -5
  139. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  140. package/dist/src/home-intelligence/host.d.ts +1 -1
  141. package/dist/src/home-intelligence/host.js +1 -9
  142. package/dist/src/home-intelligence/notification.js +1 -1
  143. package/dist/src/home-intelligence/repository.d.ts +1 -1
  144. package/dist/src/infra/update-check.d.ts +8 -4
  145. package/dist/src/infra/update-check.js +43 -41
  146. package/dist/src/infra/update-startup.d.ts +7 -1
  147. package/dist/src/infra/update-startup.js +15 -6
  148. package/dist/src/local-apps/service.js +1 -1
  149. package/dist/src/memory-maintenance/index.js +2 -2
  150. package/dist/src/memory-maintenance/schedule.d.ts +0 -3
  151. package/dist/src/memory-maintenance/schedule.js +1 -8
  152. package/dist/src/providers/model-catalog-persistence.js +1 -1
  153. package/dist/src/storage/sqlite/migrations/208_automation_management.sql +2 -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/schema.js +1 -1
  157. package/dist/src/tasks/capabilities/read.js +2 -2
  158. package/dist/src/tasks/home-query-service.js +1 -0
  159. package/dist/src/tui/backends/embedded-backend.js +2 -2
  160. package/dist/src/tui/tui-commands.js +1 -1
  161. package/dist/src/tui/tui-startup-resources.js +1 -1
  162. package/dist/src/tui/tui.js +1 -1
  163. package/dist/src/user-context/config.d.ts +9 -0
  164. package/dist/src/user-context/config.js +13 -4
  165. package/dist/src/voice/realtime/persona-context.js +1 -1
  166. package/package.json +5 -5
  167. package/dist/gateway/static/root/assets/automations-workspace-C7VS-yb7.js +0 -7
  168. package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +0 -1
  169. package/dist/gateway/static/root/assets/settings-advanced-gate-DcOsdz78.js +0 -1
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-preview-renderer-wzIchDSv.js","assets/preload-helper-zJ_50EbN.js","assets/pdf-runtime-DU_sMPjG.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{t as a}from"./messages-fmf0dnr4.js";import{Fa as o,Ia as s}from"./index-D99vN3es.js";import{t as c}from"./preview-open-alternatives-0Q4rTfGX.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(l(null),f(!1),!t||!n||!o||!r)return;let c=!1,u,d=document.createElement(`div`);d.className=`flex min-h-0 flex-1 flex-col overflow-auto`,o.replaceChildren(d),_(d,g(e,n));let p=e=>{c?e():u=e};return(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-wzIchDSv.js`),__vite__mapDeps([0,1,2]));if(c)return;let o=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(d,t,{loadingText:o.attachmentPreviewPdfRendering,loadMoreHint:o.attachmentPreviewPdfLoadMore,onPageCount:e=>{c||s?.(e)}});p(e)}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(d,t,{truncationNotice:o.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});p(e),c||f(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(d,t);p(e)}}catch(e){c||l(e instanceof Error?e.message:String(e))}})(),()=>{c=!0,u?.(),d.remove()}},[t,n,o,r,e,s]),{error:c,excelTruncated:d}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=s(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,o]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{o({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||o({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(22),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T);let E=f?(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[(0,p.jsx)(y,{props:e,message:b(e)}),(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600 dark:text-red-400`,children:f})]}):e.kind===`excel`&&m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,D=`${f?`hidden`:`flex`} docx-preview-host min-h-0 flex-1 flex-col overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`,O;t[17]===D?O=t[18]:(O=(0,p.jsx)(`div`,{ref:s,className:D}),t[17]=D,t[18]=O);let k;return t[19]!==O||t[20]!==E?(k=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[E,O]}),t[19]=O,t[20]=E,t[21]=k):k=t[21],k}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,s=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,o):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==s?(u=s?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=s,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==s?(f=s?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=s,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
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{t as a}from"./messages-fmf0dnr4.js";import{Fa as o,Ia as s}from"./index-DalslRUx.js";import{t as c}from"./preview-open-alternatives-B-mwPBJW.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(l(null),f(!1),!t||!n||!o||!r)return;let c=!1,u,d=document.createElement(`div`);d.className=`flex min-h-0 flex-1 flex-col overflow-auto`,o.replaceChildren(d),_(d,g(e,n));let p=e=>{c?e():u=e};return(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-wzIchDSv.js`),__vite__mapDeps([0,1,2]));if(c)return;let o=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(d,t,{loadingText:o.attachmentPreviewPdfRendering,loadMoreHint:o.attachmentPreviewPdfLoadMore,onPageCount:e=>{c||s?.(e)}});p(e)}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(d,t,{truncationNotice:o.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});p(e),c||f(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(d,t);p(e)}}catch(e){c||l(e instanceof Error?e.message:String(e))}})(),()=>{c=!0,u?.(),d.remove()}},[t,n,o,r,e,s]),{error:c,excelTruncated:d}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=s(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,o]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{o({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||o({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(22),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T);let E=f?(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[(0,p.jsx)(y,{props:e,message:b(e)}),(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600 dark:text-red-400`,children:f})]}):e.kind===`excel`&&m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,D=`${f?`hidden`:`flex`} docx-preview-host min-h-0 flex-1 flex-col overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`,O;t[17]===D?O=t[18]:(O=(0,p.jsx)(`div`,{ref:s,className:D}),t[17]=D,t[18]=O);let k;return t[19]!==O||t[20]!==E?(k=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:[E,O]}),t[19]=O,t[20]=E,t[21]=k):k=t[21],k}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,s=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,o):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==s?(u=s?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=s,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==s?(f=s?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=s,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
@@ -1,4 +1,4 @@
1
- import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{d as u,h as d,t as f}from"./markdown-view-DlT9KqwF.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./pencil-DmIY3Oa-.js";import{t as h}from"./messages-fmf0dnr4.js";import{t as g}from"./cn-JdwAhgNB.js";import{n as _}from"./locale-store-wNXWkWu5.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{s as y}from"./vendor-swr-BIWyz7Rc.js";import{a as b,d as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as ee}from"./floating-ui.dom-B7uQOZZW.js";import{Br as k,Fc as te,Gl as A,Hr as j,Ic as ne,Jl as re,Ll as ie,Tl as ae,Uc as oe,Vu as se,Xl as ce,_d as le,_u as ue,bl as de,br as fe,du as pe,gu as me,ml as he,pl as ge,ql as _e,su as ve,vr as ye,vu as be,xr as xe}from"./index-D99vN3es.js";import{C as Se,S as Ce}from"./vendor-codemirror-DFxP3B9T.js";import{t as we}from"./with-selector-aYPsXwdl.js";import{n as Te}from"./note-image-lightbox-1qg2v-9j.js";var M=e(r(),1),Ee=e(i(),1),N=o(),De=y(),Oe=Object.defineProperty,ke=(e,t)=>{let n={};for(var r in e)Oe(n,r,{get:e[r],enumerable:!0});return t||Oe(n,Symbol.toStringTag,{value:`Module`}),n};function P(e){this.content=e}P.prototype={constructor:P,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new P(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new P(n)},addToStart:function(e,t){return new P([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new P(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new P(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=P.from(e),e.size?new P(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=P.from(e),e.size?new P(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=P.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},P.from=function(e){if(e instanceof P)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new P(t)};function Ae(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Ne(e.charCodeAt(r-1))&&Me(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Ae(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function je(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Ne(e.charCodeAt(i-1))&&Me(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=je(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Me(e){return e>=56320&&e<57344}function Ne(e){return e>=55296&&e<56320}var F=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ae(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return je(this,e,t,n)}findIndex(e){if(e==0)return Fe(0,e);if(e==this.size)return Fe(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Fe(t+1,i):Fe(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};F.empty=new F([],0);var Pe={index:0,offset:0};function Fe(e,t){return Pe.index=e,Pe.offset=t,Pe}function Ie(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Ie(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ie(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var I=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ie(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};I.none=[];var Le=class extends Error{},L=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=ze(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Re(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(F.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};L.empty=new L(F.empty,0,0);function Re(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Re(a.content,t-i-1,n-i-1)))}function ze(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=ze(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Be(e,t,n){if(n.openStart>e.depth)throw new Le(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Le(`Inconsistent open depths`);return Ve(e,t,n,0)}function Ve(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Ve(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Ke(a,Je(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ke(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ye(n,e);return Ke(a,qe(e,i,o,t,r))}}function He(e,t){if(!t.type.compatibleContent(e.type))throw new Le(`Cannot join `+t.type.name+` onto `+e.type.name)}function Ue(e,t,n){let r=e.node(n);return He(r,t.node(n)),r}function We(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ge(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(We(e.nodeAfter,r),a++));for(let e=a;e<o;e++)We(i.child(e),r);t&&t.depth==n&&t.textOffset&&We(t.nodeBefore,r)}function Ke(e,t){if(!e.type.validContent(t))throw new Le(`Invalid content for node `+e.type.name);return e.copy(t)}function qe(e,t,n,r,i){let a=e.depth>i&&Ue(e,t,i+1),o=r.depth>i&&Ue(n,r,i+1),s=[];return Ge(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(He(a,o),We(Ke(a,qe(e,t,n,r,i+1)),s)):(a&&We(Ke(a,Je(e,t,i+1)),s),Ge(t,n,i,s),o&&We(Ke(o,Je(n,r,i+1)),s)),Ge(r,null,i,s),new F(s)}function Je(e,t,n){let r=[];return Ge(null,e,n,r),e.depth>n&&We(Ke(Ue(e,t,n+1),Je(e,t,n+1)),r),Ge(t,null,n,r),new F(r)}function Ye(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(F.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Xe=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return I.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new et(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=$e.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else $e.set(t,r=new Ze);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Qe,i}},Ze=class{constructor(){this.elts=[],this.i=0}},Qe=12,$e=new WeakMap,et=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},tt=Object.create(null),nt=class e{constructor(e,t,n,r=I.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Ie(this.attrs,t||e.defaultAttrs||tt)&&I.sameSet(this.marks,n||I.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return L.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new L(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Be(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Xe.resolveCached(this,e)}resolveNoCache(e){return Xe.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),it(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=F.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=I.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!I.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=F.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};nt.prototype.text=void 0;var rt=class e extends nt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):it(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function it(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var at=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ot(t,n);if(r.next==null)return e.empty;let i=st(r);r.next&&r.err(`Unexpected trailing text`);let a=_t(mt(i));return vt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return F.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{a as r,i,n as a,t as o}from"./vendor-react-BOUWij0V.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{d as u,h as d,t as f}from"./markdown-view-DlT9KqwF.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./pencil-DmIY3Oa-.js";import{t as h}from"./messages-fmf0dnr4.js";import{t as g}from"./cn-JdwAhgNB.js";import{n as _}from"./locale-store-wNXWkWu5.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{s as y}from"./vendor-swr-BIWyz7Rc.js";import{a as b,d as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as ee}from"./floating-ui.dom-B7uQOZZW.js";import{Br as k,Fc as te,Gl as A,Hr as j,Ic as ne,Jl as re,Ll as ie,Tl as ae,Uc as oe,Vu as se,Xl as ce,_d as le,_u as ue,bl as de,br as fe,du as pe,gu as me,ml as he,pl as ge,ql as _e,su as ve,vr as ye,vu as be,xr as xe}from"./index-DalslRUx.js";import{C as Se,S as Ce}from"./vendor-codemirror-DFxP3B9T.js";import{t as we}from"./with-selector-aYPsXwdl.js";import{n as Te}from"./note-image-lightbox-1qg2v-9j.js";var M=e(r(),1),Ee=e(i(),1),N=o(),De=y(),Oe=Object.defineProperty,ke=(e,t)=>{let n={};for(var r in e)Oe(n,r,{get:e[r],enumerable:!0});return t||Oe(n,Symbol.toStringTag,{value:`Module`}),n};function P(e){this.content=e}P.prototype={constructor:P,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new P(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new P(n)},addToStart:function(e,t){return new P([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new P(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new P(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=P.from(e),e.size?new P(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=P.from(e),e.size?new P(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=P.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},P.from=function(e){if(e instanceof P)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new P(t)};function Ae(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&Ne(e.charCodeAt(r-1))&&Me(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=Ae(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function je(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&Ne(e.charCodeAt(i-1))&&Me(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=je(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Me(e){return e>=56320&&e<57344}function Ne(e){return e>=55296&&e<56320}var F=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ae(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return je(this,e,t,n)}findIndex(e){if(e==0)return Fe(0,e);if(e==this.size)return Fe(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Fe(t+1,i):Fe(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};F.empty=new F([],0);var Pe={index:0,offset:0};function Fe(e,t){return Pe.index=e,Pe.offset=t,Pe}function Ie(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Ie(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ie(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var I=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ie(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};I.none=[];var Le=class extends Error{},L=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=ze(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Re(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(F.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};L.empty=new L(F.empty,0,0);function Re(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Re(a.content,t-i-1,n-i-1)))}function ze(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=ze(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Be(e,t,n){if(n.openStart>e.depth)throw new Le(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Le(`Inconsistent open depths`);return Ve(e,t,n,0)}function Ve(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Ve(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Ke(a,Je(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ke(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ye(n,e);return Ke(a,qe(e,i,o,t,r))}}function He(e,t){if(!t.type.compatibleContent(e.type))throw new Le(`Cannot join `+t.type.name+` onto `+e.type.name)}function Ue(e,t,n){let r=e.node(n);return He(r,t.node(n)),r}function We(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ge(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(We(e.nodeAfter,r),a++));for(let e=a;e<o;e++)We(i.child(e),r);t&&t.depth==n&&t.textOffset&&We(t.nodeBefore,r)}function Ke(e,t){if(!e.type.validContent(t))throw new Le(`Invalid content for node `+e.type.name);return e.copy(t)}function qe(e,t,n,r,i){let a=e.depth>i&&Ue(e,t,i+1),o=r.depth>i&&Ue(n,r,i+1),s=[];return Ge(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(He(a,o),We(Ke(a,qe(e,t,n,r,i+1)),s)):(a&&We(Ke(a,Je(e,t,i+1)),s),Ge(t,n,i,s),o&&We(Ke(o,Je(n,r,i+1)),s)),Ge(r,null,i,s),new F(s)}function Je(e,t,n){let r=[];return Ge(null,e,n,r),e.depth>n&&We(Ke(Ue(e,t,n+1),Je(e,t,n+1)),r),Ge(t,null,n,r),new F(r)}function Ye(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(F.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Xe=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return I.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new et(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=$e.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else $e.set(t,r=new Ze);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Qe,i}},Ze=class{constructor(){this.elts=[],this.i=0}},Qe=12,$e=new WeakMap,et=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},tt=Object.create(null),nt=class e{constructor(e,t,n,r=I.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Ie(this.attrs,t||e.defaultAttrs||tt)&&I.sameSet(this.marks,n||I.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return L.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new L(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Be(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Xe.resolveCached(this,e)}resolveNoCache(e){return Xe.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),it(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=F.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=I.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!I.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=F.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};nt.prototype.text=void 0;var rt=class e extends nt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):it(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function it(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var at=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new ot(t,n);if(r.next==null)return e.empty;let i=st(r);r.next&&r.err(`Unexpected trailing text`);let a=_t(mt(i));return vt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return F.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};at.empty=new at(!0);var ot=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function st(e){let t=[];do t.push(ct(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function ct(e){let t=[];do t.push(lt(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function lt(e){let t=pt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=dt(e,t);else break;return t}function ut(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function dt(e,t){let n=ut(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ut(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function ft(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function pt(e){if(e.eat(`(`)){let t=st(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=ft(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function mt(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function ht(e,t){return t-e}function gt(e,t){let n=[];return r(t),n.sort(ht);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function _t(e){let t=Object.create(null);return n(gt(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);gt(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new at(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(ht);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function vt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function yt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function bt(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function xt(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function St(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Tt(e,r,t[r]);return n}var Ct=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=St(e,n.attrs),this.defaultAttrs=yt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==at.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:bt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new nt(this,this.computeAttrs(e),F.from(t),I.setFrom(n))}createChecked(e=null,t,n){return t=F.from(t),this.checkContent(t),new nt(this,this.computeAttrs(e),t,I.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=F.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(F.empty,!0);return i?new nt(this,e,t.append(i),I.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){xt(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:I.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function wt(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Tt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?wt(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Et=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=St(e,r.attrs),this.excluded=null;let i=yt(this.attrs);this.instance=i?new I(this,i):null}create(e=null){return!e&&this.instance?this.instance:new I(this,bt(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){xt(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Dt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=P.from(e.nodes),t.marks=P.from(e.marks||{}),this.nodes=Ct.compile(this.spec.nodes,this),this.marks=Et.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=at.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Ot(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Ot(this,n.split(` `))}this.nodeFromJSON=e=>nt.fromJSON(this,e),this.markFromJSON=e=>I.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Ct))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new rt(n,n.defaultAttrs,e,I.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Ot(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function kt(e){return e.tag!=null}function At(e){return e.style!=null}var jt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(kt(e))this.tags.push(e);else if(At(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Bt(this,t,!1);return n.addAll(e,I.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Bt(this,t,!0);return n.addAll(e,I.none,t.from,t.to),L.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Ht(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Ut(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Ut(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Mt={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Nt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Pt={ol:!0,ul:!0},Ft=1,It=2,Lt=4;function Rt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Ft:0)|(t===`full`?It:0)}var zt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=I.none,this.match=i||(a&Lt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(F.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ft)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=F.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Bt=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Rt(null,t.preserveWhitespace,0)|(n?Lt:0);i=r?new zt(r.type,r.attrs,I.none,!0,t.topMatch||r.type.contentMatch,a):n?new zt(null,null,I.none,!0,null,a):new zt(e.schema.topNodeType,null,I.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&It?`full`:this.localPreserveWS||(r.options&Ft)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Pt.hasOwnProperty(a)&&this.parser.normalizeLists&&Vt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Nt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Mt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=I.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Wt(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Rt(e,i,a.options);a.options&Lt&&a.content.length==0&&(o|=Lt);let s=I.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Wt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new zt(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Ft);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Vt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Pt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Ht(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ut(e){let t={};for(let n in e)t[n]=e[n];return t}function Wt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Gt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=qt(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return qt(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Zt(qt(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Zt(qt(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Zt(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Kt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Kt(e.marks)}};function Kt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function qt(e){return e.document||window.document}var Jt=new WeakMap;function Yt(e){let t=Jt.get(e);return t===void 0&&Jt.set(e,t=Xt(e)),t}function Xt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Zt(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Yt(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Zt(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Qt=a(),$t=65535,en=2**16;function tn(e,t){return e+t*en}function nn(e){return e&$t}function rn(e){return(e-(e&$t))/en}var an=1,on=2,sn=4,cn=8,ln=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&cn)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&sn)>0}},un=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=nn(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+rn(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:tn(o/3,e-s),f=e==s?on:e==u?an:sn;return(t<0?e!=s:e!=u)&&(f|=cn),new ln(a,f,d)}r+=l-c}return n?e+r:new ln(e+r,0,null)}touches(e,t){let n=0,r=nn(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};un.empty=new un([]);var dn=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ln(e,r,null)}},fn=Object.create(null),pn=class{getMap(){return un.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=fn[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in fn)throw RangeError(`Duplicate use of step JSON ID `+e);return fn[e]=t,t.prototype.jsonID=e,t}},mn=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Le)return e.fail(t.message);throw t}}};function hn(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(hn(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return F.fromArray(r)}var gn=class e extends pn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new L(hn(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return mn.fromReplace(e,this.from,this.to,i)}invert(){return new _n(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};pn.jsonID(`addMark`,gn);var _n=class e extends pn{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new L(hn(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return mn.fromReplace(e,this.from,this.to,n)}invert(){return new gn(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};pn.jsonID(`removeMark`,_n);var vn=class e extends pn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return mn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return mn.fromReplace(e,this.pos,this.pos+1,new L(F.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new yn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};pn.jsonID(`addNodeMark`,vn);var yn=class e extends pn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return mn.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return mn.fromReplace(e,this.pos,this.pos+1,new L(F.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new vn(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};pn.jsonID(`removeNodeMark`,yn);var bn=class e extends pn{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Sn(e,this.from,this.to)?mn.fail(`Structure replace would overwrite content`):mn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new un([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?L.empty:new L(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?L.empty:new L(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,L.fromJSON(t,n.slice),!!n.structure)}};bn.MAP_BIAS=1,pn.jsonID(`replace`,bn);var xn=class e extends pn{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Sn(e,this.from,this.gapFrom)||Sn(e,this.gapTo,this.to)))return mn.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return mn.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?mn.fromReplace(e,this.from,this.to,n):mn.fail(`Content does not fit in gap`)}getMap(){return new un([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,L.fromJSON(t,n.slice),n.insert,!!n.structure)}};pn.jsonID(`replaceAround`,xn);function Sn(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Cn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new _n(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new gn(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function wn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Et){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new _n(t.from,t.to,t.style)))}function Tn(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new bn(s,l,L.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new _n(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new L(F.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new bn(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(F.empty,!0);e.replace(s,s,new L(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function En(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Dn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!En(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function On(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=F.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=F.from(r.node(e).copy(u)),d++):c--;let f=F.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=F.from(i.node(e).copy(f)),p++):l++;e.step(new xn(c,l,o,s,new L(u.append(f),d,p),u.size-d,!0))}function kn(e,t,n=null,r=e){let i=jn(e,t),a=i&&Mn(r,t);return a?i.map(An).concat({type:t,attrs:n}).concat(a.map(An)):null}function An(e){return{type:e,attrs:null}}function jn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Mn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function Nn(e,t,n){let r=F.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=F.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new xn(i,a,i,a,new L(r,0,0),n.length,!0))}function Pn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Ln(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&In(e,t,n,a),Tn(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new xn(c,l,c+1,l-1,new L(F.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Fn(e,t,n,a),!1}})}function Fn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function In(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as i}from"./pencil-DmIY3Oa-.js";import{n as a}from"./locale-store-wNXWkWu5.js";import{t as o}from"./button-CS04eWY9.js";import{t as s}from"./skeleton-BwbyijEw.js";import{$u as c,Fu as l,Gu as u,Ho as d,Jc as f,Qu as p,Rc as m,bl as h,pd as g}from"./index-D99vN3es.js";import{i as _,n as v,r as y,t as b}from"./browser-automation-inputs-C5s1yHOu.js";var x=e(t(),1),S=n(),C={en:{title:`Browser automations`,subtitle:`Let your assistant repeat routine actions on the web.`,emptyTitle:`No browser automations yet`,emptyBody:`Tell your assistant what to do on the web. Once it works, save it and run it again whenever you need.`,create:`Create with assistant`,edit:`Edit with assistant`,run:`Run now`,stop:`Stop`,enable:`Enable`,pause:`Pause`,enabled:`Enabled`,paused:`Paused`,inputs:`Before running`,noInputs:`This automation is ready to run.`,history:`Recent activity`,delete:`Delete automation`,confirmDelete:`Delete this browser automation?`,required:`Please complete all required fields.`,queued:`Waiting to start`,running:`Running`,succeeded:`Completed`,failed:`Needs attention`,cancelled:`Stopped`,result:`Result`,read:`Reads information`,draft:`Edits the page locally`,external_effect:`Affects an external system`,destructive:`Destructive action`,sensitive:`Sensitive action`,createPrompt:`Help me create a reusable browser automation. Ask what I want the browser to do, perform it once with me, then save the successful steps. Keep all technical details hidden.`,editPrompt:`Help me update the browser automation "{name}" (id: {id}). Ask what should change, test the new browser steps, then save it.`},zh:{title:`浏览器自动化`,subtitle:`让助手自动重复完成网页上的固定操作。`,emptyTitle:`还没有浏览器自动化`,emptyBody:`告诉助手你希望在网页上自动完成什么。成功执行一次后,即可保存并重复运行。`,create:`让助手帮我创建`,edit:`让助手帮我修改`,run:`立即运行`,stop:`停止`,enable:`启用`,pause:`暂停`,enabled:`已启用`,paused:`已暂停`,inputs:`运行前需要填写`,noInputs:`这个自动化可以直接运行。`,history:`最近运行`,delete:`删除自动化`,confirmDelete:`确定删除这个浏览器自动化吗?`,required:`请填写所有必填内容。`,queued:`等待开始`,running:`正在运行`,succeeded:`已完成`,failed:`需要处理`,cancelled:`已停止`,result:`运行结果`,read:`仅读取信息`,draft:`仅在页面内编辑`,external_effect:`会影响外部系统`,destructive:`破坏性操作`,sensitive:`包含敏感操作`,createPrompt:`请帮我创建一个可重复运行的浏览器自动化。先询问我希望浏览器完成什么,陪我实际执行成功一次,然后保存成功步骤。不要让我处理技术细节。`,editPrompt:`请帮我修改浏览器自动化“{name}”(id:{id})。先询问我要修改什么,实际测试新的浏览器步骤,然后保存。`}};function w(e){return e!==`queued`&&e!==`running`}function T(e){return e==null?`-`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>`• ${T(e)}`).join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as i}from"./pencil-DmIY3Oa-.js";import{n as a}from"./locale-store-wNXWkWu5.js";import{t as o}from"./button-CS04eWY9.js";import{t as s}from"./skeleton-BwbyijEw.js";import{$u as c,Fu as l,Gu as u,Ho as d,Jc as f,Qu as p,Rc as m,bl as h,pd as g}from"./index-DalslRUx.js";import{i as _,n as v,r as y,t as b}from"./browser-automation-inputs-C5s1yHOu.js";var x=e(t(),1),S=n(),C={en:{title:`Browser automations`,subtitle:`Let your assistant repeat routine actions on the web.`,emptyTitle:`No browser automations yet`,emptyBody:`Tell your assistant what to do on the web. Once it works, save it and run it again whenever you need.`,create:`Create with assistant`,edit:`Edit with assistant`,run:`Run now`,stop:`Stop`,enable:`Enable`,pause:`Pause`,enabled:`Enabled`,paused:`Paused`,inputs:`Before running`,noInputs:`This automation is ready to run.`,history:`Recent activity`,delete:`Delete automation`,confirmDelete:`Delete this browser automation?`,required:`Please complete all required fields.`,queued:`Waiting to start`,running:`Running`,succeeded:`Completed`,failed:`Needs attention`,cancelled:`Stopped`,result:`Result`,read:`Reads information`,draft:`Edits the page locally`,external_effect:`Affects an external system`,destructive:`Destructive action`,sensitive:`Sensitive action`,createPrompt:`Help me create a reusable browser automation. Ask what I want the browser to do, perform it once with me, then save the successful steps. Keep all technical details hidden.`,editPrompt:`Help me update the browser automation "{name}" (id: {id}). Ask what should change, test the new browser steps, then save it.`},zh:{title:`浏览器自动化`,subtitle:`让助手自动重复完成网页上的固定操作。`,emptyTitle:`还没有浏览器自动化`,emptyBody:`告诉助手你希望在网页上自动完成什么。成功执行一次后,即可保存并重复运行。`,create:`让助手帮我创建`,edit:`让助手帮我修改`,run:`立即运行`,stop:`停止`,enable:`启用`,pause:`暂停`,enabled:`已启用`,paused:`已暂停`,inputs:`运行前需要填写`,noInputs:`这个自动化可以直接运行。`,history:`最近运行`,delete:`删除自动化`,confirmDelete:`确定删除这个浏览器自动化吗?`,required:`请填写所有必填内容。`,queued:`等待开始`,running:`正在运行`,succeeded:`已完成`,failed:`需要处理`,cancelled:`已停止`,result:`运行结果`,read:`仅读取信息`,draft:`仅在页面内编辑`,external_effect:`会影响外部系统`,destructive:`破坏性操作`,sensitive:`包含敏感操作`,createPrompt:`请帮我创建一个可重复运行的浏览器自动化。先询问我希望浏览器完成什么,陪我实际执行成功一次,然后保存成功步骤。不要让我处理技术细节。`,editPrompt:`请帮我修改浏览器自动化“{name}”(id:{id})。先询问我要修改什么,实际测试新的浏览器步骤,然后保存。`}};function w(e){return e!==`queued`&&e!==`running`}function T(e){return e==null?`-`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>`• ${T(e)}`).join(`
2
2
  `):typeof e==`object`?Object.entries(e).map(([e,t])=>`${e}: ${T(t)}`).join(`
3
3
  `):String(e)}function E(){let e=a(e=>e.language),t=C[e],n=r(),E=d(e=>e.setPageHeader),D=d(e=>e.clearPageHeader),[O,k]=(0,x.useState)(null),[A,j]=(0,x.useState)(),[M,N]=(0,x.useState)({}),[P,F]=(0,x.useState)([]),[I,L]=(0,x.useState)(),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(!1),H=(0,x.useMemo)(()=>O?.find(e=>e.id===A),[A,O]),U=(0,x.useCallback)(async()=>{let e=await _.list();k(e.automations),j(t=>t&&e.automations.some(e=>e.id===t)?t:e.automations[0]?.id)},[]);(0,x.useEffect)(()=>{U().catch(e=>z(String(e)))},[U]),(0,x.useEffect)(()=>{H&&(N(y(H)),L(void 0),z(``),_.listRuns(H.id).then(e=>F(e.runs)).catch(e=>z(String(e))))},[H]),(0,x.useEffect)(()=>{if(!I||w(I.status))return;let e=window.setInterval(()=>{_.getRun(I.id).then(({run:e})=>{L(e),w(e.status)&&H&&_.listRuns(H.id).then(e=>F(e.runs))}).catch(e=>z(String(e)))},700);return()=>window.clearInterval(e)},[I,H]);let W=(0,x.useCallback)(e=>{n(`/chat/new?draft=${encodeURIComponent(e)}`)},[n]),G=(0,x.useMemo)(()=>(0,S.jsxs)(o,{onClick:()=>W(t.createPrompt),children:[(0,S.jsx)(g,{className:`size-4`}),t.create]}),[W,t.create,t.createPrompt]);(0,x.useLayoutEffect)(()=>(E({startExtra:null,main:(0,S.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),end:G}),()=>D()),[D,G,E,t.title]);let K=async()=>{if(H){V(!0);try{await _.setEnabled(H.id,!H.enabled),await U()}catch(e){z(String(e))}finally{V(!1)}}},q=async()=>{if(H){if(!v(H,M)){z(t.required);return}V(!0);try{let{run:e}=await _.run(H.id,M);L(e),z(``)}catch(e){z(String(e))}finally{V(!1)}}},J=async()=>{if(!(!H||!window.confirm(t.confirmDelete))){V(!0);try{await _.remove(H.id),j(void 0),F([]),await U()}catch(e){z(String(e))}finally{V(!1)}}};return O===null?(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-surface-panel p-4 sm:p-6`,children:(0,S.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,S.jsx)(s,{className:`h-[420px] rounded-xl`}),(0,S.jsx)(s,{className:`h-[420px] rounded-xl`})]})}):O.length===0?(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-surface-panel p-4 sm:p-6`,children:(0,S.jsxs)(`div`,{className:`m-auto max-w-md py-12 text-center`,children:[(0,S.jsx)(g,{className:`mx-auto size-10 text-accent`}),(0,S.jsx)(`h2`,{className:`mt-4 text-lg font-semibold text-fg`,children:t.emptyTitle}),(0,S.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:t.emptyBody}),(0,S.jsxs)(o,{className:`mt-5`,onClick:()=>W(t.createPrompt),children:[(0,S.jsx)(g,{className:`size-4`}),t.create]})]})}):(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-surface-panel p-4 sm:p-6`,children:(0,S.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-4 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,S.jsx)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge bg-surface-base p-2`,children:O.map(e=>(0,S.jsxs)(`button`,{onClick:()=>j(e.id),className:`mb-1 w-full rounded-lg p-3 text-left ${A===e.id?`bg-accent-soft text-accent-fg`:`hover:bg-surface-hover`}`,children:[(0,S.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,S.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 text-xs text-fg-muted`,children:[e.enabled?(0,S.jsx)(p,{className:`size-3.5 text-emerald-600`}):(0,S.jsx)(c,{className:`size-3.5`}),e.enabled?t.enabled:t.paused]})]},e.id))}),H&&(0,S.jsxs)(`main`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:H.name}),H.description&&(0,S.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:H.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs`,children:[(0,S.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2.5 py-1 text-fg-muted`,children:t[H.risk]}),H.domains.map(e=>(0,S.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full bg-surface-inset px-2.5 py-1 text-fg-muted`,children:[(0,S.jsx)(l,{className:`size-3`}),e]},e))]})]}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsxs)(o,{variant:`secondary`,disabled:B,onClick:()=>void K(),children:[H.enabled?(0,S.jsx)(c,{className:`size-4`}):(0,S.jsx)(p,{className:`size-4`}),H.enabled?t.pause:t.enable]}),(0,S.jsxs)(o,{variant:`secondary`,onClick:()=>W(t.editPrompt.replace(`{name}`,H.name).replace(`{id}`,H.id)),children:[(0,S.jsx)(i,{className:`size-4`}),t.edit]})]})]}),(0,S.jsxs)(`section`,{className:`mt-7 max-w-xl`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.inputs}),Object.keys(H.inputs).length===0?(0,S.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.noInputs}):(0,S.jsx)(`div`,{className:`mt-3`,children:(0,S.jsx)(b,{automation:H,values:M,language:e,onChange:N})}),(0,S.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,S.jsxs)(o,{variant:`primary`,disabled:!H.enabled||B||!!(I&&!w(I.status)),onClick:()=>void q(),children:[(0,S.jsx)(h,{className:`size-4`}),t.run]}),I&&!w(I.status)&&(0,S.jsxs)(o,{variant:`secondary`,onClick:()=>void _.cancel(I.id),children:[(0,S.jsx)(f,{className:`size-4`}),t.stop]})]}),R&&(0,S.jsx)(`p`,{className:`mt-3 text-sm text-red-700 dark:text-red-300`,children:R})]}),I&&(0,S.jsxs)(`section`,{className:`mt-7 rounded-xl border border-edge bg-surface-inset p-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,S.jsx)(u,{className:`size-4`}),t[I.status]]}),I.error&&(0,S.jsx)(`p`,{className:`mt-2 text-sm text-red-700 dark:text-red-300`,children:I.error}),I.status===`succeeded`&&I.result!==void 0&&(0,S.jsxs)(`div`,{className:`mt-3`,children:[(0,S.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:t.result}),(0,S.jsx)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap text-sm text-fg`,children:T(I.result)})]})]}),(0,S.jsxs)(`section`,{className:`mt-8`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.history}),(0,S.jsx)(`div`,{className:`mt-2 divide-y divide-edge`,children:P.slice(0,10).map(e=>(0,S.jsxs)(`button`,{className:`flex w-full items-center justify-between gap-3 py-3 text-left text-sm hover:text-accent`,onClick:()=>L(e),children:[(0,S.jsx)(`span`,{children:t[e.status]}),(0,S.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[new Date(e.createdAtMs).toLocaleString(),e.durationMs?` · ${Math.max(1,Math.round(e.durationMs/1e3))}s`:``]})]},e.id))})]}),(0,S.jsx)(`div`,{className:`mt-8 border-t border-edge pt-4`,children:(0,S.jsxs)(o,{variant:`ghost`,className:`text-red-700 dark:text-red-300`,disabled:B,onClick:()=>void J(),children:[(0,S.jsx)(m,{className:`size-4`}),t.delete]})})]})]})})}export{E as BrowserAutomationsPage};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./popover-select-DcsFzD_i.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./eye-CABVeTq0.js";import{t as d}from"./folder-open-CyzJ19I9.js";import{t as f}from"./loader-circle-CifKLtgG.js";import{t as p}from"./messages-fmf0dnr4.js";import{a as m,c as h,n as g,r as _}from"./locale-store-wNXWkWu5.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-CS04eWY9.js";import{n as b,r as x}from"./gateway-config-swr-cR-tz7-Q.js";import{t as S}from"./skeleton-BwbyijEw.js";import{Aa as C,G as w,H as T,K as E,Lc as ee,Lu as D,Nl as O,U as te,W as ne,Wl as k,fl as re,ja as ie,q as A,xl as ae,xu as j}from"./index-D99vN3es.js";import{n as oe,r as M}from"./settings-page-layout-X1x-2Cp9.js";import{n as se}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as N,t as P}from"./use-autosave-CDemMoSX.js";import{t as ce}from"./settings-advanced-gate-DcOsdz78.js";var F=n(),I=e(t(),1);function le(e){let[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),l=(0,I.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,I.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await w(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,I.useCallback)(async()=>{l.current&&(i(!0),await T().catch(()=>{}),l.current.abort())},[])}}var L=r(),R={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function z(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,o=i(),c=v(t?[`browser-control-status`,n]:null,te,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,u]=(0,I.useState)(null),[d,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(null),g=r===`dirty`||r===`saving`;(0,I.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let _=(0,I.useCallback)(async(e,t,n)=>{u(e),p(null),h(null);try{await t(),h(n),await c.mutate()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(null)}},[c.mutate]),b=le((0,I.useCallback)(()=>{h(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),x=c.data?.payload,C=x?.driverKind===n,w=t?g||!C?`syncing`:x?.state:`disabled`;return(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(w===`ready`?s:w===`syncing`?f:ee,{className:`size-4 shrink-0 ${w===`ready`?`text-success`:w===`syncing`?`animate-spin text-fg-muted`:w===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,L.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${w===`ready`?`bg-success-soft text-success`:w===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:w===`ready`?a?`已就绪`:`Ready`:w===`disabled`?a?`未启用`:`Disabled`:w===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[R[n],x?.detail&&C?` · ${x.detail}`:``]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(y,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,L.jsx)(re,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,L.jsxs)(y,{variant:`secondary`,className:`h-9`,disabled:!t||g||l!==null||b.running,onClick:()=>void _(`test`,A,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,L.jsx)(f,{className:`size-3.5 animate-spin`}):(0,L.jsx)(ae,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,L.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,L.jsx)(S,{className:`h-12`}),(0,L.jsx)(S,{className:`h-12`}),(0,L.jsx)(S,{className:`h-12`})]}):null,t&&c.error?(0,L.jsx)(H,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,d||b.error?(0,L.jsx)(H,{tone:`error`,children:d??b.error}):null,m?(0,L.jsx)(H,{tone:`success`,children:m}):null,t&&n===`extension`&&C?(0,L.jsx)(ue,{status:x?.driverStatus,zh:a,busy:l,run:_,onConnectRemote:()=>o(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&C?(0,L.jsx)(B,{status:x?.driverStatus,zh:a,installer:b}):null,t&&n===`cdp`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function ue(e){let t=(0,F.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,s=n?.artifacts,u=r?`扩展文件`:`Extension files`,p=s?.installed===!0,m=s?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,h;t[0]!==u||t[1]!==p||t[2]!==m?(h=(0,L.jsx)(V,{label:u,ok:p,value:m}),t[0]=u,t[1]=p,t[2]=m,t[3]=h):h=t[3];let g=r?`本机自动发现`:`Local auto-discovery`,_=s?.nativeHost?.installed===!0,v=s?.nativeHost?.installed?r?`已就绪`:`Ready`:s?.nativeHost?.reason??(r?`需要修复`:`Repair required`),b;t[4]!==g||t[5]!==_||t[6]!==v?(b=(0,L.jsx)(V,{label:g,ok:_,value:v}),t[4]=g,t[5]=_,t[6]=v,t[7]=b):b=t[7];let x=r?`安全通道`:`Secure channel`,S=n?.transport===`gateway-realtime`,C=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,w;t[8]!==C||t[9]!==x||t[10]!==S?(w=(0,L.jsx)(V,{label:x,ok:S,value:C}),t[8]=C,t[9]=x,t[10]=S,t[11]=w):w=t[11];let T=r?`Chrome 连接`:`Chrome connection`,E=n?.connected===!0,ee=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,D;t[12]!==T||t[13]!==E||t[14]!==ee?(D=(0,L.jsx)(V,{label:T,ok:E,value:ee}),t[12]=T,t[13]=E,t[14]=ee,t[15]=D):D=t[15];let O;t[16]!==w||t[17]!==D||t[18]!==h||t[19]!==b?(O=(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[h,b,w,D]}),t[16]=w,t[17]=D,t[18]=h,t[19]=b,t[20]=O):O=t[20];let te=s?.extensionDir??`Gateway Realtime`,k;t[21]===te?k=t[22]:(k=(0,L.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:te}),t[21]=te,t[22]=k);let re=s?.installed?`secondary`:`primary`,ie=i!==null,A;t[23]!==s?.installed||t[24]!==a||t[25]!==r?(A=()=>void a(`extension-install`,()=>ne(!!s?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=s?.installed,t[24]=a,t[25]=r,t[26]=A):A=t[26];let j;t[27]===i?j=t[28]:(j=i===`extension-install`?(0,L.jsx)(f,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[27]=i,t[28]=j);let oe=s?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,M;t[29]!==re||t[30]!==ie||t[31]!==A||t[32]!==j||t[33]!==oe?(M=(0,L.jsxs)(y,{className:`h-9`,variant:re,disabled:ie,onClick:A,children:[j,oe]}),t[29]=re,t[30]=ie,t[31]=A,t[32]=j,t[33]=oe,t[34]=M):M=t[34];let se=!s?.installed||i!==null,N;t[35]!==a||t[36]!==r?(N=()=>void a(`extension-open`,fe,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=N):N=t[37];let P;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,L.jsx)(l,{className:`size-3.5`}),t[38]=P):P=t[38];let ce=r?`打开扩展页`:`Open extensions`,I;t[39]!==se||t[40]!==N||t[41]!==ce?(I=(0,L.jsxs)(y,{className:`h-9`,variant:`secondary`,disabled:se,onClick:N,children:[P,ce]}),t[39]=se,t[40]=N,t[41]=ce,t[42]=I):I=t[42];let le=!s?.installed||i!==null,R;t[43]!==a||t[44]!==r?(R=()=>void a(`extension-folder`,de,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=R):R=t[45];let z;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,L.jsx)(d,{className:`size-3.5`}),t[46]=z):z=t[46];let ue=r?`打开扩展目录`:`Open folder`,B;t[47]!==le||t[48]!==R||t[49]!==ue?(B=(0,L.jsxs)(y,{className:`h-9`,variant:`ghost`,disabled:le,onClick:R,children:[z,ue]}),t[47]=le,t[48]=R,t[49]=ue,t[50]=B):B=t[50];let H=i!==null,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,L.jsx)(ae,{className:`size-3.5`}),t[51]=U):U=t[51];let pe=r?`连接远程 Chrome`:`Connect remote Chrome`,W;t[52]!==o||t[53]!==H||t[54]!==pe?(W=(0,L.jsxs)(y,{className:`h-9`,variant:`secondary`,disabled:H,onClick:o,children:[U,pe]}),t[52]=o,t[53]=H,t[54]=pe,t[55]=W):W=t[55];let G;t[56]!==M||t[57]!==I||t[58]!==B||t[59]!==W?(G=(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M,I,B,W]}),t[56]=M,t[57]=I,t[58]=B,t[59]=W,t[60]=G):G=t[60];let K;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(K=n?.connected?null:(0,L.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;只有连接另一台电脑时才需要一次性邀请和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A one-time invitation and explicit approval are only required for Chrome on another computer.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=K):K=t[64];let q;return t[65]!==O||t[66]!==k||t[67]!==G||t[68]!==K?(q=(0,L.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[O,k,G,K]}),t[65]=O,t[66]=k,t[67]=G,t[68]=K,t[69]=q):q=t[69],q}function de(){return E(`folder`)}function fe(){return E(`chrome`)}function B(e){let t=(0,F.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),s;t[0]!==a||t[1]!==o?(s=(0,L.jsx)(V,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,L.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let u;t[5]===i.progress?u=t[6]:(u=i.progress?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,L.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,L.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,L.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=u);let d=n?.installed?`secondary`:`primary`,p;t[7]===i?p=t[8]:(p=()=>void i.install(),t[7]=i,t[8]=p);let m;t[9]===i.running?m=t[10]:(m=i.running?(0,L.jsx)(f,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[9]=i.running,t[10]=m);let h=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,g;t[11]!==i.running||t[12]!==d||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,L.jsxs)(y,{variant:d,className:`h-9`,disabled:i.running,onClick:p,children:[m,h]}),t[11]=i.running,t[12]=d,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==i||t[18]!==r?(_=i.running?(0,L.jsx)(y,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=_):_=t[19];let v;t[20]!==_||t[21]!==g?(v=(0,L.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[g,_]}),t[20]=_,t[21]=g,t[22]=v):v=t[22];let b;return t[23]!==v||t[24]!==s||t[25]!==l||t[26]!==u?(b=(0,L.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[s,l,u,v]}),t[23]=v,t[24]=s,t[25]=l,t[26]=u,t[27]=b):b=t[27],b}function V(e){let t=(0,F.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,L.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,L.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function H(e){let t=(0,F.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,L.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function U(e){let t=(0,F.c)(36),{sectionId:n,vm:r,children:i}=e,a=g(pe),o;t[0]===a?o=t[1]:(o=p(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,L.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,L.jsx)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,L.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(M,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,L.jsx)(se,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,L.jsx)(y,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,L.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,L.jsx)(N,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let d;t[24]!==l||t[25]!==u?(d=(0,L.jsx)(oe,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=d):d=t[26];let f;t[27]===r.error?f=t[28]:(f=r.error?(0,L.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=f);let m;t[29]===i?m=t[30]:(m=(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=m);let h;return t[31]!==d||t[32]!==f||t[33]!==m||t[34]!==r.onBlurCapture?(h=(0,L.jsxs)(M,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[d,f,m]}),t[31]=d,t[32]=f,t[33]=m,t[34]=r.onBlurCapture,t[35]=h):h=t[35],h}function pe(e){return e.language}var W={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`ask`,uploads:`ask`,consequentialActions:`ask`};function G(e){let t=J(J(e).browser),n=J(t.driver),r=J(t.observation),i=J(t.limits),a=J(t.security),o=n.kind;return{...W,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:Y(n.executablePath,``),cdpEndpoint:Y(n.endpoint,W.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:Y(n.apiKey,``),remoteProjectId:Y(n.projectId,``),remoteRegion:Y(n.region,``),maxNodes:X(r.maxNodes,W.maxNodes),maxCharacters:X(r.maxCharacters,W.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:X(i.actionTimeoutMs,W.actionTimeoutMs),sessionTimeoutMs:X(i.sessionTimeoutMs,W.sessionTimeoutMs),maxSequenceLength:X(i.maxSequenceLength,W.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,g as a}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as o}from"./popover-select-DcsFzD_i.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./eye-CABVeTq0.js";import{t as d}from"./folder-open-CyzJ19I9.js";import{t as f}from"./loader-circle-CifKLtgG.js";import{t as p}from"./messages-fmf0dnr4.js";import{a as m,c as h,n as g,r as _}from"./locale-store-wNXWkWu5.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-CS04eWY9.js";import{n as b,r as x}from"./gateway-config-swr-cR-tz7-Q.js";import{t as S}from"./skeleton-BwbyijEw.js";import{Aa as C,G as w,H as T,K as E,Lc as ee,Lu as D,Nl as O,U as te,W as ne,Wl as k,fl as re,ja as ie,q as A,xl as ae,xu as j}from"./index-DalslRUx.js";import{n as oe,r as M}from"./settings-page-layout-X1x-2Cp9.js";import{n as se}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as N,t as P}from"./use-autosave-Bj9hC6ML.js";import{t as ce}from"./settings-advanced-gate-BLL7csOJ.js";var F=n(),I=e(t(),1);function le(e){let[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),l=(0,I.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,I.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await w(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,I.useCallback)(async()=>{l.current&&(i(!0),await T().catch(()=>{}),l.current.abort())},[])}}var L=r(),R={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function z(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,o=i(),c=v(t?[`browser-control-status`,n]:null,te,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,u]=(0,I.useState)(null),[d,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(null),g=r===`dirty`||r===`saving`;(0,I.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let _=(0,I.useCallback)(async(e,t,n)=>{u(e),p(null),h(null);try{await t(),h(n),await c.mutate()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(null)}},[c.mutate]),b=le((0,I.useCallback)(()=>{h(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),x=c.data?.payload,C=x?.driverKind===n,w=t?g||!C?`syncing`:x?.state:`disabled`;return(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(w===`ready`?s:w===`syncing`?f:ee,{className:`size-4 shrink-0 ${w===`ready`?`text-success`:w===`syncing`?`animate-spin text-fg-muted`:w===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,L.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${w===`ready`?`bg-success-soft text-success`:w===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:w===`ready`?a?`已就绪`:`Ready`:w===`disabled`?a?`未启用`:`Disabled`:w===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[R[n],x?.detail&&C?` · ${x.detail}`:``]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(y,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,L.jsx)(re,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,L.jsxs)(y,{variant:`secondary`,className:`h-9`,disabled:!t||g||l!==null||b.running,onClick:()=>void _(`test`,A,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,L.jsx)(f,{className:`size-3.5 animate-spin`}):(0,L.jsx)(ae,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,L.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,L.jsx)(S,{className:`h-12`}),(0,L.jsx)(S,{className:`h-12`}),(0,L.jsx)(S,{className:`h-12`})]}):null,t&&c.error?(0,L.jsx)(H,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,d||b.error?(0,L.jsx)(H,{tone:`error`,children:d??b.error}):null,m?(0,L.jsx)(H,{tone:`success`,children:m}):null,t&&n===`extension`&&C?(0,L.jsx)(ue,{status:x?.driverStatus,zh:a,busy:l,run:_,onConnectRemote:()=>o(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&C?(0,L.jsx)(B,{status:x?.driverStatus,zh:a,installer:b}):null,t&&n===`cdp`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function ue(e){let t=(0,F.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,s=n?.artifacts,u=r?`扩展文件`:`Extension files`,p=s?.installed===!0,m=s?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,h;t[0]!==u||t[1]!==p||t[2]!==m?(h=(0,L.jsx)(V,{label:u,ok:p,value:m}),t[0]=u,t[1]=p,t[2]=m,t[3]=h):h=t[3];let g=r?`本机自动发现`:`Local auto-discovery`,_=s?.nativeHost?.installed===!0,v=s?.nativeHost?.installed?r?`已就绪`:`Ready`:s?.nativeHost?.reason??(r?`需要修复`:`Repair required`),b;t[4]!==g||t[5]!==_||t[6]!==v?(b=(0,L.jsx)(V,{label:g,ok:_,value:v}),t[4]=g,t[5]=_,t[6]=v,t[7]=b):b=t[7];let x=r?`安全通道`:`Secure channel`,S=n?.transport===`gateway-realtime`,C=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,w;t[8]!==C||t[9]!==x||t[10]!==S?(w=(0,L.jsx)(V,{label:x,ok:S,value:C}),t[8]=C,t[9]=x,t[10]=S,t[11]=w):w=t[11];let T=r?`Chrome 连接`:`Chrome connection`,E=n?.connected===!0,ee=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,D;t[12]!==T||t[13]!==E||t[14]!==ee?(D=(0,L.jsx)(V,{label:T,ok:E,value:ee}),t[12]=T,t[13]=E,t[14]=ee,t[15]=D):D=t[15];let O;t[16]!==w||t[17]!==D||t[18]!==h||t[19]!==b?(O=(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[h,b,w,D]}),t[16]=w,t[17]=D,t[18]=h,t[19]=b,t[20]=O):O=t[20];let te=s?.extensionDir??`Gateway Realtime`,k;t[21]===te?k=t[22]:(k=(0,L.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:te}),t[21]=te,t[22]=k);let re=s?.installed?`secondary`:`primary`,ie=i!==null,A;t[23]!==s?.installed||t[24]!==a||t[25]!==r?(A=()=>void a(`extension-install`,()=>ne(!!s?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=s?.installed,t[24]=a,t[25]=r,t[26]=A):A=t[26];let j;t[27]===i?j=t[28]:(j=i===`extension-install`?(0,L.jsx)(f,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[27]=i,t[28]=j);let oe=s?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,M;t[29]!==re||t[30]!==ie||t[31]!==A||t[32]!==j||t[33]!==oe?(M=(0,L.jsxs)(y,{className:`h-9`,variant:re,disabled:ie,onClick:A,children:[j,oe]}),t[29]=re,t[30]=ie,t[31]=A,t[32]=j,t[33]=oe,t[34]=M):M=t[34];let se=!s?.installed||i!==null,N;t[35]!==a||t[36]!==r?(N=()=>void a(`extension-open`,fe,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=N):N=t[37];let P;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,L.jsx)(l,{className:`size-3.5`}),t[38]=P):P=t[38];let ce=r?`打开扩展页`:`Open extensions`,I;t[39]!==se||t[40]!==N||t[41]!==ce?(I=(0,L.jsxs)(y,{className:`h-9`,variant:`secondary`,disabled:se,onClick:N,children:[P,ce]}),t[39]=se,t[40]=N,t[41]=ce,t[42]=I):I=t[42];let le=!s?.installed||i!==null,R;t[43]!==a||t[44]!==r?(R=()=>void a(`extension-folder`,de,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=R):R=t[45];let z;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,L.jsx)(d,{className:`size-3.5`}),t[46]=z):z=t[46];let ue=r?`打开扩展目录`:`Open folder`,B;t[47]!==le||t[48]!==R||t[49]!==ue?(B=(0,L.jsxs)(y,{className:`h-9`,variant:`ghost`,disabled:le,onClick:R,children:[z,ue]}),t[47]=le,t[48]=R,t[49]=ue,t[50]=B):B=t[50];let H=i!==null,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,L.jsx)(ae,{className:`size-3.5`}),t[51]=U):U=t[51];let pe=r?`连接远程 Chrome`:`Connect remote Chrome`,W;t[52]!==o||t[53]!==H||t[54]!==pe?(W=(0,L.jsxs)(y,{className:`h-9`,variant:`secondary`,disabled:H,onClick:o,children:[U,pe]}),t[52]=o,t[53]=H,t[54]=pe,t[55]=W):W=t[55];let G;t[56]!==M||t[57]!==I||t[58]!==B||t[59]!==W?(G=(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M,I,B,W]}),t[56]=M,t[57]=I,t[58]=B,t[59]=W,t[60]=G):G=t[60];let K;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(K=n?.connected?null:(0,L.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;只有连接另一台电脑时才需要一次性邀请和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A one-time invitation and explicit approval are only required for Chrome on another computer.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=K):K=t[64];let q;return t[65]!==O||t[66]!==k||t[67]!==G||t[68]!==K?(q=(0,L.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[O,k,G,K]}),t[65]=O,t[66]=k,t[67]=G,t[68]=K,t[69]=q):q=t[69],q}function de(){return E(`folder`)}function fe(){return E(`chrome`)}function B(e){let t=(0,F.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),s;t[0]!==a||t[1]!==o?(s=(0,L.jsx)(V,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,L.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let u;t[5]===i.progress?u=t[6]:(u=i.progress?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,L.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,L.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,L.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=u);let d=n?.installed?`secondary`:`primary`,p;t[7]===i?p=t[8]:(p=()=>void i.install(),t[7]=i,t[8]=p);let m;t[9]===i.running?m=t[10]:(m=i.running?(0,L.jsx)(f,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[9]=i.running,t[10]=m);let h=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,g;t[11]!==i.running||t[12]!==d||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,L.jsxs)(y,{variant:d,className:`h-9`,disabled:i.running,onClick:p,children:[m,h]}),t[11]=i.running,t[12]=d,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==i||t[18]!==r?(_=i.running?(0,L.jsx)(y,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=_):_=t[19];let v;t[20]!==_||t[21]!==g?(v=(0,L.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[g,_]}),t[20]=_,t[21]=g,t[22]=v):v=t[22];let b;return t[23]!==v||t[24]!==s||t[25]!==l||t[26]!==u?(b=(0,L.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base/45 p-4`,children:[s,l,u,v]}),t[23]=v,t[24]=s,t[25]=l,t[26]=u,t[27]=b):b=t[27],b}function V(e){let t=(0,F.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,L.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,L.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-inset px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function H(e){let t=(0,F.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,L.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function U(e){let t=(0,F.c)(36),{sectionId:n,vm:r,children:i}=e,a=g(pe),o;t[0]===a?o=t[1]:(o=p(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(D,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,L.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,L.jsx)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,L.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(M,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,L.jsx)(se,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,L.jsx)(y,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,L.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,L.jsx)(N,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let d;t[24]!==l||t[25]!==u?(d=(0,L.jsx)(oe,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=d):d=t[26];let f;t[27]===r.error?f=t[28]:(f=r.error?(0,L.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=f);let m;t[29]===i?m=t[30]:(m=(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=m);let h;return t[31]!==d||t[32]!==f||t[33]!==m||t[34]!==r.onBlurCapture?(h=(0,L.jsxs)(M,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[d,f,m]}),t[31]=d,t[32]=f,t[33]=m,t[34]=r.onBlurCapture,t[35]=h):h=t[35],h}function pe(e){return e.language}var W={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`ask`,uploads:`ask`,consequentialActions:`ask`};function G(e){let t=J(J(e).browser),n=J(t.driver),r=J(t.observation),i=J(t.limits),a=J(t.security),o=n.kind;return{...W,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:Y(n.executablePath,``),cdpEndpoint:Y(n.endpoint,W.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:Y(n.apiKey,``),remoteProjectId:Y(n.projectId,``),remoteRegion:Y(n.region,``),maxNodes:X(r.maxNodes,W.maxNodes),maxCharacters:X(r.maxCharacters,W.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:X(i.actionTimeoutMs,W.actionTimeoutMs),sessionTimeoutMs:X(i.sessionTimeoutMs,W.sessionTimeoutMs),maxSequenceLength:X(i.maxSequenceLength,W.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
2
2
  `):``,crossDomainNavigation:he(a.crossDomainNavigation),uploads:he(a.uploads),consequentialActions:he(a.consequentialActions)}}function K(e){let t=e.driverKind===`extension`?{kind:`extension`}:e.driverKind===`playwright`?{kind:`playwright`,headless:e.headless,...e.executablePath.trim()?{executablePath:e.executablePath.trim()}:{}}:e.driverKind===`cdp`?{kind:`cdp`,endpoint:e.cdpEndpoint.trim()}:{kind:`remote`,provider:e.remoteProvider,...e.remoteApiKey.trim()?{apiKey:e.remoteApiKey.trim()}:{},...e.remoteProjectId.trim()?{projectId:e.remoteProjectId.trim()}:{},...e.remoteRegion.trim()?{region:e.remoteRegion.trim()}:{}};return{enabled:e.enabled,driver:t,observation:{maxNodes:e.maxNodes,maxCharacters:e.maxCharacters,visualFallback:e.visualFallback},limits:{actionTimeoutMs:e.actionTimeoutMs,sessionTimeoutMs:e.sessionTimeoutMs,maxSequenceLength:e.maxSequenceLength},security:{privateNetworks:`deny`,allowedPrivateHosts:e.allowedPrivateHosts.split(`
3
3
  `).map(e=>e.trim()).filter(Boolean),crossDomainNavigation:e.crossDomainNavigation,uploads:e.uploads,consequentialActions:e.consequentialActions}}}function q(e){if(e.driverKind===`cdp`)try{let t=new URL(e.cdpEndpoint);if(t.protocol!==`http:`&&t.protocol!==`https:`&&t.protocol!==`ws:`&&t.protocol!==`wss:`)return`CDP endpoint must use http, https, ws, or wss.`}catch{return`Enter a valid CDP endpoint URL.`}return!Number.isInteger(e.maxNodes)||e.maxNodes<20||e.maxNodes>500?`Max nodes must be between 20 and 500.`:!Number.isInteger(e.maxCharacters)||e.maxCharacters<1e3||e.maxCharacters>5e4?`Max characters must be between 1,000 and 50,000.`:!Number.isInteger(e.actionTimeoutMs)||e.actionTimeoutMs<1e3||e.actionTimeoutMs>12e4?`Action timeout must be between 1,000 and 120,000 ms.`:!Number.isInteger(e.sessionTimeoutMs)||e.sessionTimeoutMs<6e4||e.sessionTimeoutMs>36e5?`Session timeout must be between 60,000 and 3,600,000 ms.`:!Number.isInteger(e.maxSequenceLength)||e.maxSequenceLength<1||e.maxSequenceLength>10?`Sequence length must be between 1 and 10.`:null}async function me(e){await m(_(`/api/config`),{method:`PATCH`,body:JSON.stringify({browser:K(e)})}),b()}function J(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e,t){return typeof e==`string`?e:t}function X(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function he(e){return e===`allow`||e===`deny`?e:`ask`}var ge=C();function _e(e){let t=!!h(e=>e.conversationId),[n,r]=(0,I.useReducer)(ge,{form:null,baseline:null}),i=n.form,a=n.baseline,o=(0,I.useRef)(!1),s=(0,I.useRef)(i);s.current=i;let c=(0,I.useRef)(null),{data:l,error:u,isLoading:d,mutate:f}=x(t);ie({enabled:t,parsed:(0,I.useMemo)(()=>l?.payload?.config===void 0?null:G(l.payload.config),[l]),dirty:o.current,trackedParsedRef:c,dispatch:r,onResetDirty:()=>{o.current=!1}});let p=!!(t&&d&&l===void 0&&!u),m=u instanceof Error?u.message:u?String(u):null,g=(0,I.useMemo)(()=>!i||!a?!1:JSON.stringify(i)!==JSON.stringify(a),[i,a]),_=(0,I.useCallback)(e=>{o.current=!0,r({type:`patch`,patch:e})},[]),v=P({value:i,dirty:g,onSave:(0,I.useCallback)(async t=>{try{await me(t),r({type:`saved`,value:t}),o.current=!!(s.current&&JSON.stringify(s.current)!==JSON.stringify(t))}catch(t){throw Error(t instanceof Error?t.message:e.saveError)}},[e.saveError]),validate:q});return{hasToken:t,loading:p,fetchError:m,form:i,update:_,autosaveStatus:v.status,error:v.error,onBlurCapture:v.onBlurCapture,mutate:f}}var ve=[`extension`,`playwright`,`cdp`,`remote`];function ye(){let e=(0,F.c)(29),t=g(be),n;e[0]===t?n=e[1]:(n=p(t),e[0]=t,e[1]=n);let r=_e(n.agentSettings),i=r.form,s=t===`zh`,[c]=a(),l=(0,I.useRef)(!1),d;e[2]!==i||e[3]!==c||e[4]!==r?(d=()=>{if(!i||l.current)return;l.current=!0;let e=c.get(`driver`);ve.includes(e)&&e!==i.driverKind&&r.update({driverKind:e})},e[2]=i,e[3]=c,e[4]=r,e[5]=d):d=e[5];let f;e[6]!==i||e[7]!==c||e[8]!==r.update?(f=[i,c,r.update],e[6]=i,e[7]=c,e[8]=r.update,e[9]=f):f=e[9],(0,I.useEffect)(d,f);let m=s?`Chrome 扩展(推荐)`:`Chrome extension (recommended)`,h;e[10]===m?h=e[11]:(h={value:`extension`,label:m},e[10]=m,e[11]=h);let _;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(_={value:`playwright`,label:`Playwright Chromium`},e[12]=_):_=e[12];let v=s?`CDP 已有浏览器`:`Existing browser over CDP`,y;e[13]===v?y=e[14]:(y={value:`cdp`,label:v},e[13]=v,e[14]=y);let b=s?`远程浏览器`:`Remote browser`,x;e[15]===b?x=e[16]:(x={value:`remote`,label:b},e[15]=b,e[16]=x);let S;e[17]!==h||e[18]!==y||e[19]!==x?(S=[h,_,y,x],e[17]=h,e[18]=y,e[19]=x,e[20]=S):S=e[20];let C=S,w;e[21]!==C||e[22]!==i||e[23]!==r||e[24]!==s?(w=i?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z,{enabled:i.enabled,driverKind:i.driverKind,autosaveStatus:r.autosaveStatus,zh:s}),(0,L.jsxs)(Se,{title:s?`运行方式`:`Connection`,icon:(0,L.jsx)(O,{className:`size-4`}),children:[(0,L.jsx)(Ce,{label:s?`启用浏览器控制`:`Enable browser control`,checked:i.enabled,onChange:e=>r.update({enabled:e})}),(0,L.jsx)(Z,{label:s?`浏览器连接`:`Browser connection`,children:(0,L.jsx)(o,{value:i.driverKind,options:C,placeholder:s?`选择连接方式`:`Choose a connection`,allowEmpty:!1,onChange:e=>r.update({driverKind:e})})}),(0,L.jsx)(xe,{kind:i.driverKind,zh:s}),i.driverKind===`playwright`?(0,L.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-inset p-4`,children:[(0,L.jsx)(Ce,{label:s?`无头模式`:`Headless mode`,description:s?`后台运行,不显示浏览器窗口。关闭后可观察智能体的操作过程。`:`Run in the background without a visible window. Turn off to watch the agent work.`,checked:i.headless,onChange:e=>r.update({headless:e})}),(0,L.jsx)(Q,{label:s?`Chromium 可执行文件(可选)`:`Chromium executable (optional)`,description:s?`留空时使用由 xopc 安装的 Chromium。`:`Leave empty to use Chromium installed by xopc.`,value:i.executablePath,onChange:e=>r.update({executablePath:e})})]}):null,i.driverKind===`cdp`?(0,L.jsx)(`div`,{className:`rounded-lg bg-surface-inset p-4`,children:(0,L.jsx)(Q,{label:`CDP endpoint`,description:s?`例如 http://127.0.0.1:9222。Chrome 需要开启 remote debugging。`:`For example http://127.0.0.1:9222. Chrome must be started with remote debugging enabled.`,value:i.cdpEndpoint,onChange:e=>r.update({cdpEndpoint:e})})}):null,i.driverKind===`remote`?(0,L.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-inset p-4`,children:[(0,L.jsx)(Z,{label:s?`服务商`:`Provider`,children:(0,L.jsx)(o,{value:i.remoteProvider,options:[{value:`browserbase`,label:`Browserbase`},{value:`browser-use`,label:`Browser Use`}],placeholder:s?`选择服务商`:`Choose a provider`,allowEmpty:!1,onChange:e=>r.update({remoteProvider:e})})}),(0,L.jsx)(Q,{label:`API key`,type:`password`,autoComplete:`off`,value:i.remoteApiKey,onChange:e=>r.update({remoteApiKey:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsx)(Q,{label:`Project ID`,value:i.remoteProjectId,onChange:e=>r.update({remoteProjectId:e})}),(0,L.jsx)(Q,{label:`Region`,value:i.remoteRegion,onChange:e=>r.update({remoteRegion:e})})]})]}):null]}),(0,L.jsx)(ce,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Se,{title:s?`页面理解`:`Page understanding`,icon:(0,L.jsx)(u,{className:`size-4`}),children:[(0,L.jsx)(Ce,{label:s?`需要时附加截图`:`Attach screenshots when needed`,checked:i.visualFallback,onChange:e=>r.update({visualFallback:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsx)($,{label:s?`语义节点上限`:`Semantic node limit`,description:`20–500`,min:20,max:500,value:i.maxNodes,onChange:e=>r.update({maxNodes:e})}),(0,L.jsx)($,{label:s?`文本字符上限`:`Text character limit`,description:`1,000–50,000`,min:1e3,max:5e4,step:1e3,value:i.maxCharacters,onChange:e=>r.update({maxCharacters:e})})]})]}),(0,L.jsx)(Se,{title:s?`执行限制`:`Execution limits`,icon:(0,L.jsx)(j,{className:`size-4`}),children:(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,L.jsx)($,{label:s?`操作超时(毫秒)`:`Action timeout (ms)`,min:1e3,max:12e4,step:1e3,value:i.actionTimeoutMs,onChange:e=>r.update({actionTimeoutMs:e})}),(0,L.jsx)($,{label:s?`会话超时(毫秒)`:`Session timeout (ms)`,min:6e4,max:36e5,step:6e4,value:i.sessionTimeoutMs,onChange:e=>r.update({sessionTimeoutMs:e})}),(0,L.jsx)($,{label:s?`批量步骤上限`:`Sequence step limit`,min:1,max:10,value:i.maxSequenceLength,onChange:e=>r.update({maxSequenceLength:e})})]})}),(0,L.jsxs)(Se,{title:s?`安全与审批`:`Safety and approvals`,icon:(0,L.jsx)(k,{className:`size-4`}),children:[(0,L.jsx)(Q,{label:s?`允许访问的私网主机`:`Allowed private hosts`,description:s?`每行一个主机名或 IP,不支持通配符。`:`One hostname or IP per line. Wildcards are not supported.`,multiline:!0,value:i.allowedPrivateHosts,onChange:e=>r.update({allowedPrivateHosts:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,L.jsx)(we,{zh:s,label:s?`跨域导航`:`Cross-domain navigation`,value:i.crossDomainNavigation,onChange:e=>r.update({crossDomainNavigation:e})}),(0,L.jsx)(we,{zh:s,label:s?`高影响动作`:`Consequential actions`,value:i.consequentialActions,onChange:e=>r.update({consequentialActions:e})}),(0,L.jsx)(we,{zh:s,label:s?`文件上传`:`File uploads`,value:i.uploads,onChange:e=>r.update({uploads:e})})]})]})]})})]}):null,e[21]=C,e[22]=i,e[23]=r,e[24]=s,e[25]=w):w=e[25];let T;return e[26]!==w||e[27]!==r?(T=(0,L.jsx)(U,{sectionId:`agent-browser`,vm:r,children:w}),e[26]=w,e[27]=r,e[28]=T):T=e[28],T}function be(e){return e.language}function xe(e){let t=(0,F.c)(7),{kind:n,zh:r}=e,i=r?`直接操作你正在使用的 Chrome,保留登录状态和现有标签页;最适合日常协作。`:`Operate your current Chrome with its signed-in state and existing tabs; best for daily collaboration.`,a=r?`由 xopc 启动独立 Chromium,环境隔离、自动化稳定,适合无人值守任务。`:`Let xopc launch an isolated Chromium; stable for unattended automation.`,o=r?`连接已开启远程调试的 Chrome 或 Chromium,适合自定义浏览器启动方式。`:`Connect to Chrome or Chromium already running with remote debugging.`,s=r?`使用 Browserbase 或 Browser Use 的云端浏览器,适合服务器环境和长任务。`:`Use a Browserbase or Browser Use cloud browser for servers and long-running tasks.`,c;t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==s?(c={extension:i,playwright:a,cdp:o,remote:s},t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c):c=t[4];let l=c[n],u;return t[5]===l?u=t[6]:(u=(0,L.jsx)(`p`,{className:`rounded-lg bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:l}),t[5]=l,t[6]=u),u}function Se(e){let t=(0,F.c)(17),{title:n,description:r,icon:i,children:a}=e,o;t[0]===i?o=t[1]:(o=(0,L.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:i}),t[0]=i,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=r?(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,L.jsxs)(`div`,{children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-2`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===a?d=t[13]:(d=(0,L.jsx)(`div`,{className:`space-y-4`,children:a}),t[12]=a,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,L.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-5`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Z(e){let t=(0,F.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`span`,{className:`mb-1.5 block font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,L.jsx)(`span`,{className:`mt-1.5 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,L.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Q(e){let t=(0,F.c)(10),{label:n,description:r,value:i,onChange:a,type:o,multiline:s,autoComplete:c}=e,l=o===void 0?`text`:o,u=s===void 0?!1:s,d;t[0]!==c||t[1]!==u||t[2]!==a||t[3]!==l||t[4]!==i?(d=u?(0,L.jsx)(`textarea`,{rows:3,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg outline-none focus:border-accent`}):(0,L.jsx)(`input`,{type:l,autoComplete:c,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-inset px-3 py-2 text-sm text-fg outline-none focus:border-accent`}),t[0]=c,t[1]=u,t[2]=a,t[3]=l,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==n||t[8]!==d?(f=(0,L.jsx)(Z,{label:n,description:r,children:d}),t[6]=r,t[7]=n,t[8]=d,t[9]=f):f=t[9],f}function $(e){let t=(0,F.c)(12),{label:n,description:r,value:i,onChange:a,min:o,max:s,step:c}=e,l=c===void 0?1:c,u;t[0]===a?u=t[1]:(u=e=>{let t=Number(e.target.value);Number.isFinite(t)&&a(t)},t[0]=a,t[1]=u);let d;t[2]!==s||t[3]!==o||t[4]!==l||t[5]!==u||t[6]!==i?(d=(0,L.jsx)(`input`,{type:`number`,min:o,max:s,step:l,value:i,onChange:u,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none focus:border-accent`}),t[2]=s,t[3]=o,t[4]=l,t[5]=u,t[6]=i,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==n||t[10]!==d?(f=(0,L.jsx)(Z,{label:n,description:r,children:d}),t[8]=r,t[9]=n,t[10]=d,t[11]=f):f=t[11],f}function Ce(e){let t=(0,F.c)(15),{label:n,description:r,checked:i,onChange:a}=e,o;t[0]===a?o=t[1]:(o=e=>a(e.target.checked),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,L.jsx)(`input`,{type:`checkbox`,checked:i,onChange:o,className:`mt-0.5 size-4 accent-accent`}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n?c=t[6]:(c=(0,L.jsx)(`span`,{className:`block font-medium`,children:n}),t[5]=n,t[6]=c);let l;t[7]===r?l=t[8]:(l=r?(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,L.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==s||t[13]!==u?(d=(0,L.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14],d}function we(e){let t=(0,F.c)(20),{zh:n,label:r,value:i,onChange:a}=e,s=n?`每次询问`:`Ask each time`,c;t[0]===s?c=t[1]:(c={value:`ask`,label:s},t[0]=s,t[1]=c);let l=n?`允许`:`Allow`,u;t[2]===l?u=t[3]:(u={value:`allow`,label:l},t[2]=l,t[3]=u);let d=n?`拒绝`:`Deny`,f;t[4]===d?f=t[5]:(f={value:`deny`,label:d},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h=n?`选择策略`:`Choose a policy`,g;t[10]===a?g=t[11]:(g=e=>a(e),t[10]=a,t[11]=g);let _;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==i?(_=(0,L.jsx)(o,{value:i,options:m,placeholder:h,allowEmpty:!1,onChange:g}),t[12]=m,t[13]=h,t[14]=g,t[15]=i,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_?(v=(0,L.jsx)(Z,{label:r,children:_}),t[17]=r,t[18]=_,t[19]=v):v=t[19],v}export{ye as AgentBrowserSettingsPage};
@@ -0,0 +1 @@
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as ee,i as o,l as s,n as te,o as c,p as l,r as u,s as d,t as f,u as p}from"./schemas-88fK3zzl.js";import{_ as m,c as ne,d as re,f as h,h as ie,l as g,n as ae,o as _,s as oe}from"./tasks-CDR_RVbQ.js";import{i as se,n as ce,t as v}from"./local-apps-Bpja8nC6.js";var le=p({id:l(),kind:f([`task`,`connector_approval`]),title:l(),detail:l().optional(),reason:f([`needs_input`,`blocked`,`user_input`,`user_approval`,`dependency`,`external`,`scheduled`,`retry`,`paused`,`overdue`,`due_soon`,`decision_needed`,`approval_required`]),urgency:f([`now`,`soon`]),href:l(),projectId:l().optional(),projectName:l().optional(),dueAt:s().int().nonnegative().optional(),updatedAt:s(),response:t(`kind`,[p({kind:d(`connector_approval`),approvalId:l()})]).optional()});p({id:l(),kind:f([`automation_run`,`workflow_run`]),runId:l(),title:l(),detail:l(),reason:f([`run_failed`,`run_timeout`]),href:l(),updatedAt:s(),conversationId:l().optional()});var y=t(`type`,[p({type:d(`open`),label:l(),href:l()}),p({type:d(`connector_decision`),label:l(),approvalId:l(),decision:f([`approve`,`deny`])}),p({type:d(`retry_run`),label:l(),subjectKind:f([`automation_run`,`workflow_run`]),runId:l()}),p({type:d(`acknowledge_run`),label:l(),subjectKind:f([`automation_run`,`workflow_run`]),runId:l()})]),b=p({id:l(),kind:f([`decision`,`failure`,`running`,`scheduled`]),title:l(),summary:l(),recommendation:l().optional(),dueAt:s().int().nonnegative().optional(),statusLabel:l().optional(),updatedAt:s(),openAction:y.optional(),primaryAction:y.optional(),secondaryActions:u(y).max(2).default([])}),ue=p({conversationId:l(),runId:l(),title:l().optional(),agentId:l().optional(),updatedAt:s()}),de=i({id:l().trim().min(1).max(300),sourceType:f([`project`,`task`,`conversation`,`scene`,`calendar`,`mail`,`communication`,`file`,`user_model`]),sourceRef:l().trim().min(1).max(1e3),revision:l().trim().min(1).max(300),observation:l().trim().min(1).max(1e3),observedAt:s().int().nonnegative(),freshUntil:s().int().nonnegative(),href:l().trim().min(1).max(2e3).optional()}),fe=i({kind:f([`connector`,`skill`,`agent`]),capability:l().trim().min(1).max(200),resolvedId:l().trim().min(1).max(300).optional(),readiness:f([`ready`,`needs_setup`,`unavailable`]),required:o(),recoveryPath:l().trim().min(1).max(2e3).optional(),reason:l().trim().min(1).max(500).optional()}),pe=i({kind:f([`connector`,`skill`,`agent`]),capability:l().trim().min(1).max(200),code:f([`not_installed`,`disabled`,`agent_not_allowed`,`scope_too_narrow`,`connection_missing`,`account_selection_required`,`reauthorization_required`,`requirements_unmet`,`model_invocation_disabled`,`tool_gated`,`agent_unavailable`]),message:l().trim().min(1).max(500),recoveryPath:l().trim().min(1).max(2e3)}),me=t(`state`,[i({state:d(`ready`)}),i({state:d(`needs_setup`),blockers:u(pe).min(1).max(12),recoveryActions:u(i({capability:l().trim().min(1).max(200),href:l().trim().min(1).max(2e3)})).min(1).max(12),degradedAction:i({mode:d(`degraded_start`)}).optional()})]),x=i({id:l().trim().min(1).max(200),revision:s().int().positive(),kind:f([`project_next_step`,`delivery_risk`,`meeting_prep`,`commitment_follow_up`,`automation_candidate`]),projectId:l().trim().min(1).max(200).optional(),title:l().trim().min(1).max(160),outcome:l().trim().min(1).max(1e3),rationale:l().trim().min(1).max(1500),evidence:u(de).min(1).max(8),confidence:f([`high`,`medium`,`low`]),urgency:f([`now`,`today`,`this_week`]),estimatedMinutes:s().int().min(1).max(480).optional(),risk:f([`analysis`,`external_read`,`file_write`,`external_write`]),proposedSteps:u(l().trim().min(1).max(500)).min(1).max(6),capabilities:u(fe).max(12),verification:u(l().trim().min(1).max(500)).max(8),actionPrompt:l().trim().min(1).max(4e3),degradedActionPrompt:l().trim().min(1).max(4e3).optional(),continuation:t(`kind`,[i({kind:d(`scene`),reason:d(`prior_success`),href:l().trim().min(1).max(2e3)}),i({kind:d(`automation`),reason:d(`repeated_success`),href:l().trim().min(1).max(4e3),successCount:s().int().min(2)})]).optional(),actions:i({canStart:o(),canDiscuss:o(),degradedStartAvailable:o()}),generatedAt:s().int().nonnegative(),expiresAt:s().int().nonnegative()}),he=i({id:l().trim().min(1).max(200),revision:s().int().positive(),question:l().trim().min(1).max(500),options:u(i({id:l().trim().min(1).max(100),label:l().trim().min(1).max(200)})).min(2).max(3),evidenceIds:u(l().trim().min(1).max(300)).min(1).max(8)}),ge=t(`state`,[i({state:d(`disabled`)}),i({state:d(`quiet`),reason:f([`no_change`,`insufficient_value`,`model_unavailable`,`generation_failed`,`budget_exhausted`])}),i({state:d(`refreshing`),previous:x.optional(),requestedAt:s().int().nonnegative()}),i({state:d(`clarification`),question:he,generatedAt:s().int().nonnegative(),expiresAt:s().int().nonnegative()}),i({state:d(`ready`),primary:x,alternatives:u(x).max(2),placement:f([`primary`,`compact`]),generatedAt:s().int().nonnegative(),expiresAt:s().int().nonnegative(),stale:o()})]);i({idempotencyKey:l().trim().min(1).max(200),locale:l().trim().max(30).optional()}),i({idempotencyKey:l().trim().min(1).max(200),expectedRevision:s().int().positive(),kind:f([`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]),reasonCode:l().trim().min(1).max(100).optional(),note:l().trim().min(1).max(1e3).optional(),snoozedUntil:s().int().nonnegative().optional()}),i({idempotencyKey:l().trim().min(1).max(200)});var _e=i({items:u(i({opportunity:x,status:f([`available`,`started`,`discussing`,`completed`,`snoozed`,`dismissed`,`expired`,`superseded`]),feedbackKind:f([`started`,`discussed`,`already_done`,`irrelevant`,`too_early`,`source_incorrect`,`less_like_this`,`snoozed`]).optional(),updatedAt:s().int().nonnegative(),snoozedUntil:s().int().nonnegative().optional(),href:l().trim().min(1).max(2e3).optional()})).max(100)});i({idempotencyKey:l().trim().min(1).max(200),expectedRevision:s().int().positive(),mode:f([`start`,`degraded_start`,`discuss`])});var ve=t(`outcome`,[i({outcome:d(`task`),taskId:l(),href:l()}),i({outcome:d(`chat_draft`),href:l()}),i({outcome:d(`needs_setup`),preflight:me})]),ye=p({runningConversations:u(ue).default([]),needsUser:u(b),background:u(b),backgroundCount:s().int().nonnegative(),decisions:u(le),advisor:ge,attentionPolicy:p({visibleDecisionCount:s().int().nonnegative(),suppressedDecisionCount:s().int().nonnegative(),visibleAttentionCount:s().int().nonnegative(),suppressedAttentionCount:s().int().nonnegative()}).default({visibleDecisionCount:0,suppressedDecisionCount:0,visibleAttentionCount:0,suppressedAttentionCount:0})});i({window:i({since:s().int().nonnegative(),until:s().int().nonnegative()}),currentStrategyVersion:l().trim().min(1).max(100),generations:i({total:s().int().nonnegative(),succeeded:s().int().nonnegative(),quiet:s().int().nonnegative(),failed:s().int().nonnegative(),estimatedCostUsd:s().nonnegative()}),outcomes:i({opportunities:s().int().nonnegative(),started:s().int().nonnegative(),discussed:s().int().nonnegative(),completed:s().int().nonnegative(),corrected:s().int().nonnegative(),expired:s().int().nonnegative()}),rates:i({start:s().min(0).max(1),completionFromStarted:s().min(0).max(1),correction:s().min(0).max(1)}),feedback:i({alreadyDone:s().int().nonnegative(),irrelevant:s().int().nonnegative(),tooEarly:s().int().nonnegative(),sourceIncorrect:s().int().nonnegative(),lessLikeThis:s().int().nonnegative()}),strategies:u(i({version:l().trim().min(1).max(100),generations:s().int().nonnegative(),opportunities:s().int().nonnegative(),started:s().int().nonnegative(),completed:s().int().nonnegative()}))});var S=p({northStar:p({weeklyTrustedProgress:s(),weeklyActiveUsers:s(),trustedProgressPerWeeklyActiveUser:s()}),tasks:p({total:s(),achieved:s(),partial:s(),notAchieved:s(),userCorrected:s(),achievementRate:s(),correctionRate:s(),trusted:s(),trustedRate:s()})});function be(e){return ye.parse(e)}var xe=t(`kind`,[p({kind:d(`once`),at:l()}),p({kind:d(`interval`),everyMs:s().positive(),anchorMs:s().optional()}),p({kind:d(`cron`),expr:l(),tz:l().optional()})]),C=t(`kind`,[p({kind:d(`manual`)}),p({kind:d(`schedule`),schedule:xe}),p({kind:d(`webhook`),secretId:l().optional()}),p({kind:d(`event`),eventType:l(),source:l().optional(),payloadMatch:r(l(),ee([l(),s(),o(),te()])).optional()})]),w=t(`kind`,[p({kind:d(`agent`),agentId:l().optional(),instruction:l(),workingDirectory:l().optional(),model:l().optional(),timeoutSeconds:s().positive().optional()}),p({kind:d(`workflow`),workflowId:l(),agentId:l().optional(),input:a().optional(),inputEnvelope:a().optional(),goal:l().optional(),concurrency:s().int().positive().optional(),maxSubagents:s().int().nonnegative().optional(),timeoutSeconds:s().positive().optional()}),p({kind:d(`browser_automation`),automationId:l(),inputs:r(l(),a()).optional(),timeoutSeconds:s().positive().optional()}),p({kind:d(`task_command`),taskId:l(),command:ae}),p({kind:d(`system`),capability:f([`home.advisor.refresh`,`memory.temporal_sweep`,`memory.daily_reconciliation`,`memory.weekly_knowledge`])})]),T=f([`queued`,`running`,`cancelling`,`succeeded`,`failed`,`cancelled`,`timeout`]),E=p({id:l(),name:l(),description:l().optional(),projectId:l().optional(),enabled:o(),trigger:C,action:w,safety:p({mode:f([`suggest_only`,`ask_before_apply`,`auto_apply`])}).optional(),conversationMode:f([`new_session`,`continuous`]).optional(),notificationPolicy:f([`attention`,`all`,`none`]).optional(),completionWebhookUrl:l().optional(),reliability:p({executionTimeoutSeconds:s().positive().optional(),timeoutSeconds:s().positive().optional(),retryCount:s().int().nonnegative().optional(),maxConcurrentRuns:s().int().positive().optional(),disableAfterConsecutiveFailures:s().int().positive().optional()}).optional(),management:p({owner:l(),editable:u(f([`enabled`,`trigger`])),runnable:o(),deletable:o()}).optional(),state:p({nextRunAtMs:s().optional(),runningRunId:l().optional(),lastRunAtMs:s().optional(),lastRunStatus:T.optional(),lastError:l().optional(),consecutiveFailures:s().int().nonnegative().optional()}),createdAtMs:s(),updatedAtMs:s()}),D=p({id:l(),automationId:l(),automationName:l(),status:T,triggerSnapshot:C,actionSnapshot:w,manual:o(),createdAtMs:s(),startedAtMs:s().optional(),endedAtMs:s().optional(),durationMs:s().optional(),summary:l().optional(),error:l().optional(),conversationId:l().optional(),workflowRunId:l().optional(),model:l().optional(),deadlineAtMs:s().optional(),currentPhase:f([`queued`,`action`,`completion_hook`,`cancelling`,`completed`]).optional(),cancelRequestedAtMs:s().optional(),cancelConfirmedAtMs:s().optional(),termination:p({reason:f([`completed`,`failed`,`user_cancelled`,`deadline_exceeded`]),component:f([`automation`,`agent_turn`,`tool`,`mcp`,`process`]).optional(),componentName:l().optional(),cancellationConfirmed:o()}).optional(),heartbeatAtMs:s().optional(),leaseOwner:l().optional(),leaseExpiresAtMs:s().optional(),attemptNumber:s().int().positive().optional(),rootRunId:l().optional()}),O=p({id:l(),runId:l(),automationId:l(),type:f([`run.queued`,`run.started`,`run.deadline_resolved`,`run.cancel_requested`,`run.cancel_confirmed`,`run.cancellation_unconfirmed`,`run.recovered`,`action.started`,`action.retry_scheduled`,`action.completed`,`action.failed`,`completion_hook.started`,`completion_hook.completed`,`completion_hook.failed`,`run.completed`]),message:l(),data:a().optional(),createdAtMs:s()}),k=p({totalAutomations:s().int().nonnegative(),enabledAutomations:s().int().nonnegative(),runningRuns:s().int().nonnegative(),failedLastHour:s().int().nonnegative(),nextRun:p({automationId:l(),name:l(),runAtMs:s()}).optional()}),A=i({kind:f([`note`,`task`,`project`,`scene`,`local_app`]),id:l().min(1).max(512),revision:l().min(1).max(128)}),j=i({version:d(1),clientInstanceId:l().uuid(),tabId:l().uuid(),sequence:s().int().nonnegative().max(2**53-1),surface:f([`web`,`electron`,`mobile`]),resourceRefs:u(A).max(20),selection:i({text:l().max(16e3),draft:o().default(!1)}).optional(),capturedAt:s().int().nonnegative().max(2**53-1)}),M=p({snapshot:j,resources:u(p({reference:A,title:l(),text:l().max(16e3),truncated:o()})).max(20),selectionTrust:d(`user-supplied`)});function Se(e){let t=j.parse(e);if(new TextEncoder().encode(JSON.stringify(t)).byteLength>65536)throw Error(`App context exceeds 64 KiB`);let n=t.resourceRefs.map(e=>`${e.kind}:${e.id}`);if(new Set(n).size!==n.length)throw Error(`App context contains duplicate resources`);return t}var N=l().trim().min(1).max(200),P=u(N).max(100).refine(e=>new Set(e).size===e.length,`Duplicate identifiers`),Ce=[`no_change`,`observation`,`artifact`,`decision`,`state_change`,`effect_proposal`,`receipt`],F=[`needs_setup`,`active`,`paused`,`completed`,`archived`],we=t(`kind`,[i({kind:d(`personal`)}),i({kind:d(`project`),id:N}),i({kind:d(`conversation`),id:N}),i({kind:d(`objects`),ids:P.refine(e=>e.length>0)})]),Te=i({timeoutSeconds:s().int().min(1).max(600),maxIterations:s().int().min(1).max(30),maxToolCalls:s().int().min(0).max(100),maxOutputTokens:s().int().min(1).max(32768)}),I=i({schemaVersion:d(1),key:l().regex(/^[a-z][a-z0-9-]{0,79}$/),version:l().regex(/^\d+\.\d+\.\d+$/),title:l().trim().min(1).max(120),description:l().trim().min(1).max(2e3),goalMode:f([`finite`,`ongoing`]),contextProviders:P,triggers:u(t(`type`,[i({id:N,type:d(`manual`)}),i({id:N,type:d(`event`),eventType:N}),i({id:N,type:d(`schedule`)})])).min(1).max(20).refine(e=>new Set(e.map(e=>e.id)).size===e.length,`Duplicate trigger IDs`),execution:i({kind:d(`agent`),instruction:l().trim().min(1).max(32e3),limits:Te}),allowedOutcomeKinds:u(f(Ce)).min(1),allowedEffectHandlers:P}),Ee=i({accountIds:P,contextProviders:P,effectHandlers:P}),L=i({expectedRevision:s().int().nonnegative(),content:l().trim().max(32e3),validUntil:s().int().nonnegative().nullable().default(null)}),R=i({templateKey:N,templateVersion:N,goal:l().trim().min(1).max(12e3),scope:we,permissions:Ee}),z=R.extend({id:N,ownerId:N,workspaceId:l().min(1),status:f(F),setupMissing:u(l()).optional(),revision:s().int().positive()}),De=R.pick({goal:!0,scope:!0,permissions:!0}).extend({expectedRevision:s().int().positive()}),Oe=i({expectedRevision:s().int().positive(),status:f(F)}),B=i({subjectId:N,accountId:N,dueAt:s().int().nonnegative()}),ke=i({expectedRevision:s().int().positive(),dueAt:s().int().nonnegative().optional(),status:f([`watching`,`paused`,`completed`]).optional()}).refine(e=>e.dueAt!==void 0||e.status!==void 0,`Work item update is empty`),V=B.extend({id:N,activationId:N,revision:s().int().positive(),status:f([`watching`,`paused`,`completed`])}),H=s().int().min(0).max(23),U=i({level:f([`quiet`,`balanced`,`active`]).default(`balanced`),timezone:l().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}}).default(`Asia/Shanghai`),quietStartHour:H.default(22),quietEndHour:H.default(8),dailyNotificationLimit:s().int().min(0).max(30).default(3),digestEnabled:o().default(!1),digestHour:H.default(18),digestMinute:s().int().min(0).max(59).default(0),preferredChannel:f([`in_app`,`browser`]).default(`browser`),suppressWhileViewing:o().default(!0),checksPaused:o().default(!1),checksPausedUntil:l().datetime({offset:!0}).nullable().default(null),notificationsMuted:o().default(!1)}),W=U.shape;i({expectedRevision:s().int().nonnegative(),level:W.level.removeDefault().optional(),timezone:W.timezone.removeDefault().optional(),quietStartHour:W.quietStartHour.removeDefault().optional(),quietEndHour:W.quietEndHour.removeDefault().optional(),dailyNotificationLimit:W.dailyNotificationLimit.removeDefault().optional(),digestEnabled:W.digestEnabled.removeDefault().optional(),digestHour:W.digestHour.removeDefault().optional(),digestMinute:W.digestMinute.removeDefault().optional(),preferredChannel:W.preferredChannel.removeDefault().optional(),suppressWhileViewing:W.suppressWhileViewing.removeDefault().optional(),checksPaused:W.checksPaused.removeDefault().optional(),checksPausedUntil:W.checksPausedUntil.removeDefault().optional(),notificationsMuted:W.notificationsMuted.removeDefault().optional()});var Ae=i({expectedRevision:s().int().nonnegative(),rating:f([`useful`,`not_useful`]),note:l().trim().max(2e3).optional()}),je=i({weekdays:u(s().int().min(0).max(6)).min(1).max(7).refine(e=>new Set(e).size===e.length,`Duplicate weekdays`),hour:s().int().min(0).max(23),minute:s().int().min(0).max(59),timeZone:l().trim().min(1).max(100).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid time zone`)});f([`http`,`agent`,`cli`,`automation`,`mcp`,`extension`]),f([`INVALID_INPUT`,`FORBIDDEN`,`NOT_FOUND`,`REVISION_CONFLICT`,`CONTRACT_CHANGED`,`APPROVAL_REQUIRED`,`IN_PROGRESS`,`UNAVAILABLE`,`OUTCOME_UNKNOWN`,`CANCELLED`,`INTERNAL`]);var Me=i({majorVersion:s().int().positive(),descriptorDigest:l().regex(/^[a-f0-9]{64}$/),input:c(),idempotencyKey:l().min(1).max(200).optional()}),Ne=p({triggerSummary:l(),actionSummary:l(),safetyNotes:u(l()),requiredConfirmations:u(l()),canRunNow:o(),runNowBlockedReason:l().optional()});i({agentId:l().trim().min(1).max(64).optional(),language:f([`en`,`zh`]).default(`en`)}),p({draftId:l(),explanation:l(),assumptions:u(l()),risks:u(l()),automation:n({name:l(),trigger:c(),action:c()}),simulation:Ne,repairAttempts:s().int().nonnegative()}),p({draftId:l(),patch:r(l(),c()),explanation:l(),expectedEffect:l(),risks:u(l()),requiresApproval:o(),repairAttempts:s().int().nonnegative()});var Pe=i({eventId:l().min(1),kind:f([`note`,`task`,`project`,`automation`,`scene`,`local_app`]),id:l().min(1),revision:s().int().nonnegative(),operation:f([`created`,`updated`,`deleted`]),operationId:l().optional()}),G=i({id:l().trim().min(1).max(512)}),K=i({limit:s().int().min(1).max(100).default(50),afterId:l().max(200).default(``)});p({activation:z}),Oe.extend({id:l().min(1).max(512)}),p({activation:z}),U.extend({revision:s().int().positive()}),Ae.extend({id:l().min(1).max(512)}),p({revision:s().int().positive()}),G.extend({read:o()}),p({ok:d(!0),presentationId:l(),read:o()}),G.extend({triggerKey:l().min(1).max(200),expectedRevision:s().int().nonnegative(),schedule:je}),p({revision:s().int().positive()}),De.extend({id:l().min(1).max(512)}),p({activation:z}),p({intentId:l()}),L.extend({id:l().min(1).max(512)}),p({revision:s().int().positive()}),B.extend({id:l().min(1).max(512)}),p({workItem:V}),ke.safeExtend({id:l().min(1).max(512)}),p({workItem:V});var q=n({id:l(),activationId:l(),outcomeId:l(),status:l(),content:c(),readOnly:o(),createdAt:s(),sources:u(p({kind:l(),title:l(),sender:l(),href:l()})),sourceHealth:r(l(),c()).nullable()});G.extend({expectedVersion:s().int().positive(),reason:l().trim().min(1).max(4096).default(`TaskRun cancelled`)}),G.extend({rating:f([`helpful`,`not_helpful`]),reason:l().trim().max(4096).optional()}),p({ok:d(!0),feedback:p({id:l(),runId:l(),rating:f([`helpful`,`not_helpful`]),reason:l().optional(),createdAt:s()})}),p({ok:d(!0),run:h,receipt:g,model:_.pick({task:!0,operationalState:!0,attention:!0,allowedCommands:!0}),executionStopConfirmed:d(!1)}),G.extend({enabled:o(),expectedRevision:s().int().nonnegative()}),p({ok:d(!0),automation:E.loose()}).extend({run:D.loose()}),p({ok:d(!0),cancelled:o(),confirmed:o()}),p({ok:d(!0),marked:d(!0)}),i({projectId:l().trim().min(1).max(512).optional()}),p({ok:d(!0),count:s().int().nonnegative()}),G.extend({expectedRevision:s().int().nonnegative().nullable()}),p({ok:d(!0),removed:o(),automation:E.loose().optional(),cancelRunId:l().optional()});var Fe=i({status:f([`inbox`,`processed`,`archived`,`trashed`]).optional(),kind:f([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]).optional(),tag:l().max(512).optional(),projectId:l().min(1).max(512).optional(),unassigned:o().optional(),agentEdited:o().optional(),search:l().max(4096).optional(),pinned:o().optional(),limit:s().int().min(1).max(100).default(20),offset:s().int().min(0).default(0),sortBy:f([`createdAt`,`updatedAt`,`lastOpenedAt`]).optional(),sortOrder:f([`asc`,`desc`]).optional()}),J=n({id:l().min(1),markdown:l(),kind:f([`thought`,`todo`,`voice`,`media`,`bookmark`,`mixed`,`task`]),status:f([`inbox`,`processed`,`archived`,`trashed`]),createdAt:s(),updatedAt:s(),title:l().optional(),localVersion:s().optional()}),Ie=p({note:J});G.extend({expectedRevision:s().int().positive(),revokeShares:o().default(!0)}),p({deleted:d(!0),revokedShares:s().int().nonnegative()});var Le=i({title:l().max(1e3).optional(),markdown:l().max(2e6).default(``),kind:J.shape.kind.optional(),tags:u(l().max(512)).max(100).optional(),capturedVia:i({channel:f([`app`,`web`,`electron`,`tui`,`telegram`,`wechat`,`feishu`]),platform:f([`ios`,`android`,`harmonyos`]).optional()}).default({channel:`web`}),pinned:o().default(!1),projectId:l().min(1).optional()});i({id:l().min(1),expectedRevision:s().int().positive(),trigger:f([`edit`,`ai_edit`,`sync`,`restore`]).optional(),patch:i({title:l().max(1e3).optional(),markdown:l().max(2e6).optional(),tags:u(l().max(512)).max(100).optional(),pinned:o().optional(),kind:J.shape.kind.optional(),status:J.shape.status.optional(),localVersion:s().int().positive().optional(),ai:r(l(),c()).optional(),aiDeep:n({processedAt:s()}).optional()})}),i({text:l().trim().min(1).max(2e6),capturedVia:Le.shape.capturedVia}),i({id:l().min(1),expectedRevision:s().int().positive().optional(),content:l().trim().min(1).max(2e6),heading:l().trim().min(1).max(1e3).default(`AI 讨论沉淀`)}),i({id:l().min(1),timestamp:s().int().positive(),expectedRevision:s().int().positive()});var Re=n({items:u(n({id:l().min(1)})),total:s().int().nonnegative()}),ze=i({phase:ie.optional(),priority:ne.optional(),projectId:l().min(1).max(512).optional(),search:l().max(4096).optional(),limit:s().int().min(1).max(200).default(50),offset:s().int().nonnegative().default(0)}),Y=n({id:l().min(1),name:l(),slug:l(),status:f([`planned`,`active`,`paused`,`completed`,`cancelled`,`archived`]),executionMode:f([`local_checkout`,`managed_worktree`]),successCriteria:u(l()),scope:r(l(),a()),nonGoals:u(l()),health:f([`unknown`,`on_track`,`at_risk`,`off_track`]),version:s().int().positive(),createdAt:s(),updatedAt:s(),workspaceRoot:l().optional(),defaultAgentId:l().optional()}),Be=i({id:l().trim().min(1),expectedVersion:s().int().positive(),pinned:o()});p({ok:d(!0),project:Y}),i({workspacePath:l().trim().min(1).max(4096),agentId:l().trim().min(1).max(512).optional(),defaultAgentId:l().trim().max(512).optional(),projectKind:f([`auto`,`coding`,`general`,`unknown`]).optional(),autoCreate:o().default(!1),conversationId:e().optional()}),p({ok:d(!0),project:Y.nullable(),reason:f([`exact`,`contained`,`auto_created`]).optional(),created:o().optional()}),Be.omit({pinned:!0}),p({ok:d(!0),deleted:d(!0),executionStopConfirmed:d(!1)});var X={name:l().trim().min(1).max(1e3).optional(),description:l().max(2e4).optional(),defaultAgentId:l().trim().max(512).optional(),workspaceRoot:l().trim().min(1).max(4096).optional(),createWorkspaceRoot:o().optional(),executionMode:Y.shape.executionMode.optional(),brief:l().max(2e4).optional(),instructions:l().max(1e5).optional(),outcome:l().max(2e4).optional(),successCriteria:u(l().max(4096)).max(100).optional(),scope:r(l(),c()).optional(),nonGoals:u(l().max(4096)).max(100).optional(),health:Y.shape.health.optional(),ownerId:l().max(512).optional(),targetAt:s().finite().optional()};i({...X,projectKind:f([`auto`,`coding`,`general`,`unknown`]).optional(),autoUnderstand:o().default(!1)}).refine(e=>!!(e.name||e.workspaceRoot),`name or workspaceRoot is required`),i({id:l().trim().min(1),expectedVersion:s().int().positive(),patch:i({...X,status:Y.shape.status.optional(),description:X.description.unwrap().nullable().optional(),defaultAgentId:X.defaultAgentId.unwrap().nullable().optional(),workspaceRoot:l().trim().max(4096).nullable().optional(),brief:X.brief.unwrap().nullable().optional(),instructions:X.instructions.unwrap().nullable().optional(),outcome:X.outcome.unwrap().nullable().optional(),ownerId:X.ownerId.unwrap().nullable().optional(),targetAt:X.targetAt.unwrap().nullable().optional()}).refine(e=>Object.values(e).some(e=>e!==void 0),`Empty project patch`)});var Ve=i({status:Y.shape.status.optional(),search:l().max(4096).optional(),sortBy:f([`updatedAt`,`createdAt`,`name`]).optional(),sortOrder:f([`asc`,`desc`]).optional(),limit:s().int().min(1).max(500).default(50),offset:s().int().nonnegative().default(0)}),Z=n({id:l(),projectId:l(),title:l(),status:f([`planned`,`active`,`completed`,`cancelled`]),sortOrder:s(),createdAt:s(),updatedAt:s()}),Q=n({id:l(),projectId:l(),summary:l(),health:Y.shape.health,createdAt:s()}),$={title:l().trim().min(1).max(1e3),description:l().max(2e4).optional(),status:Z.shape.status.optional(),targetAt:s().int().nonnegative().optional(),sortOrder:s().int().optional()};i({projectId:l().trim().min(1),...$}),i({projectId:l().trim().min(1),id:l().trim().min(1),expectedRevision:s().int().nonnegative(),patch:i({...$,description:l().max(2e4).nullable().optional(),targetAt:s().int().nonnegative().nullable().optional()}).partial().refine(e=>Object.values(e).some(e=>e!==void 0),`Empty milestone patch`)}).omit({patch:!0}),p({ok:d(!0),milestone:Z,project:Y}),p({ok:d(!0),deleted:d(!0)}),i({projectId:l().trim().min(1),expectedVersion:s().int().positive(),health:Y.shape.health,summary:l().trim().min(1).max(2e4),progress:u(l().max(1e4)).max(100).default([]),risks:u(l().max(1e4)).max(100).default([]),nextSteps:u(l().max(1e4)).max(100).default([])}),p({ok:d(!0),update:Q,project:Y});var He={"xopc.context.resolve":{input:j,output:M},"xopc.notes.preview_edit":{input:G.extend({instruction:l().trim().min(1).max(16e3),markdown:l().max(2e6).optional()}),output:p({message:l(),patch:p({id:l(),summary:l(),operations:u(p({type:d(`replaceRange`),from:s().int().nonnegative(),to:s().int().nonnegative(),markdown:l()}))})})},"xopc.automations.get_run":{input:G,output:p({ok:d(!0),run:D.loose()})},"xopc.automations.run_events":{input:G,output:p({ok:d(!0),events:u(O.loose())})},"xopc.automations.metrics":{input:i({}),output:p({ok:d(!0),metrics:k})},"xopc.automations.product_events":{input:i({eventType:l().trim().min(1).max(512),source:l().trim().min(1).max(512).optional(),payloadKey:l().trim().min(1).max(512).optional(),payloadValue:l().max(4096).optional(),limit:s().int().min(1).max(100).default(10)}).refine(e=>e.payloadKey===void 0==(e.payloadValue===void 0),`payloadKey and payloadValue must be supplied together`),output:p({ok:d(!0),items:u(p({run:D.loose(),triggerEvent:O.loose()}))})},"xopc.automations.list":{input:i({projectId:l().trim().min(1).optional()}),output:p({ok:d(!0),items:u(E.loose()),projectId:l().optional()})},"xopc.automations.get":{input:G,output:p({ok:d(!0),automation:E.loose()})},"xopc.automations.history":{input:i({automationId:l().trim().min(1).optional(),projectId:l().trim().min(1).optional(),limit:s().int().min(1).max(200).default(50)}),output:p({ok:d(!0),items:u(D.loose()),projectId:l().optional()})},"xopc.scenes.templates":{input:i({}),output:p({templates:u(I)})},"xopc.scenes.mail_accounts":{input:i({}),output:p({accounts:u(p({id:l(),label:l()}))})},"xopc.scenes.mail_sources":{input:K,output:p({sources:u(p({id:l(),accountId:l(),subject:l(),sender:l()})),nextCursor:l().nullable()})},"xopc.scenes.results":{input:K.extend({activationId:l().min(1).max(200).optional()}),output:p({outcomes:u(q),nextCursor:l().nullable()})},"xopc.scenes.get_presentation":{input:G,output:p({outcome:q})},"xopc.scenes.get_feedback":{input:G,output:p({feedback:p({rating:f([`useful`,`not_useful`]),note:l(),revision:s().int().nonnegative()}).nullable()})},"xopc.scenes.digest_results":{input:K.extend({id:l().min(1).max(512)}),output:p({outcomes:u(q),nextCursor:l().nullable()})},"xopc.scenes.metrics":{input:i({days:s().int().min(1).max(90).default(7)}),output:p({window:p({since:s(),until:s(),days:s().int()}),ratedOutcomes:s().int().nonnegative(),usefulOutcomes:s().int().nonnegative(),unhelpfulOutcomes:s().int().nonnegative(),scenesWithUsefulOutcomes:s().int().nonnegative(),checks:s().int().nonnegative(),failedChecks:s().int().nonnegative(),skippedChecks:s().int().nonnegative()})},"xopc.scenes.diagnostics":{input:i({}),output:p({checksPaused:o(),currentModel:l().nullable(),pendingChecks:s().int().nonnegative(),oldestDueWaitMs:s().nonnegative(),lastSevenDays:p({modelCalls:s().int().nonnegative(),connectorReads:s().int().nonnegative(),tokens:s().nonnegative(),estimatedCost:s().nonnegative()}),notifications:u(p({status:l(),count:s().int().nonnegative()})),activations:u(r(l(),c()))})},"xopc.scenes.get_preferences":{input:i({}),output:U.extend({revision:s().int().nonnegative()})},"xopc.scenes.preflight":{input:R,output:p({ready:o(),missing:u(l())})},"xopc.scenes.get_template":{input:i({key:l().min(1).max(200),version:l().min(1).max(200)}),output:p({template:I})},"xopc.scenes.list":{input:K,output:p({activations:u(z),nextCursor:l().nullable()})},"xopc.scenes.get":{input:G,output:p({activation:z,runs:u(n({id:l(),status:l(),attempt:s().int(),reason:l().nullable(),createdAt:s()})),schedules:u(n({triggerKey:l(),revision:s().int(),nextDueAt:s(),schedule:c()}))})},"xopc.scenes.read_notes":{input:G,output:p({notes:p({content:l(),revision:s().int().nonnegative(),validUntil:s().nullable()})})},"xopc.scenes.list_runs":{input:K.extend({id:l().min(1).max(512)}),output:p({runs:u(n({id:l(),activationId:l(),status:l(),attempt:s().int(),reason:l().nullable(),createdAt:s()})),nextCursor:l().nullable()})},"xopc.scenes.list_schedules":{input:G,output:p({schedules:u(n({triggerKey:l(),revision:s().int(),nextDueAt:s(),schedule:c()}))})},"xopc.scenes.list_work_items":{input:K.extend({id:l().min(1).max(512)}),output:p({workItems:u(n({id:l(),subjectId:l(),accountId:l(),dueAt:s(),status:l(),revision:s().int(),lastCheckReason:l().nullable()})),nextCursor:l().nullable()})},"xopc.settings.open":{input:i({section:l().trim().regex(/^[a-z0-9][a-z0-9/_-]*$/i).max(512).default(`overview`),title:l().trim().min(1).max(512).default(`Settings`),summary:l().trim().max(4096).optional()}),output:p({ok:d(!0),settings:p({section:l(),title:l(),summary:l().optional()})})},"xopc.local_apps.list":{input:i({}),output:p({apps:u(ce)})},"xopc.local_apps.get":{input:G,output:p({app:v})},"xopc.local_apps.validate":{input:G,output:p({validation:se})},"xopc.projects.get":{input:G,output:p({ok:d(!0),project:Y})},"xopc.projects.list":{input:Ve,output:n({ok:d(!0),items:u(Y),total:s().int().nonnegative()})},"xopc.projects.list_milestones":{input:G,output:p({ok:d(!0),projectId:l(),items:u(Z)})},"xopc.projects.list_updates":{input:G.extend({limit:s().int().min(1).max(500).default(20)}),output:p({ok:d(!0),projectId:l(),items:u(Q)})},"xopc.task_runs.get":{input:G,output:p({ok:d(!0),run:h,receipt:g.optional(),events:u(re),activeWaits:u(m)})},"xopc.task_runs.list":{input:i({taskId:l().trim().min(1),limit:s().int().min(1).max(200).default(20)}),output:p({ok:d(!0),taskId:l(),items:u(h),receipts:u(g),activeWaits:u(m)})},"xopc.notes.project_summaries":{input:i({}),output:p({items:u(p({id:l(),name:l(),description:l().optional(),noteCount:s().int().nonnegative(),updatedAt:s().optional()}))})},"xopc.notes.history":{input:G,output:p({entries:u(p({timestamp:s().int().nonnegative(),trigger:f([`edit`,`ai_edit`,`sync`,`restore`]),snippet:l().optional()}))})},"xopc.notes.snapshot":{input:G.extend({timestamp:s().int().nonnegative()}),output:p({snapshot:p({noteId:l(),timestamp:s().int().nonnegative(),trigger:f([`edit`,`ai_edit`,`sync`,`restore`]),title:l().optional(),markdown:l(),tags:u(l()).optional(),kind:J.shape.kind,status:J.shape.status})})},"xopc.notes.get":{input:G,output:Ie},"xopc.notes.list":{input:Fe,output:Re},"xopc.tasks.metrics":{input:i({}),output:p({ok:d(!0),metrics:S})},"xopc.tasks.get":{input:G,output:_},"xopc.tasks.list":{input:ze,output:oe.extend({total:s().int().nonnegative()})}};export{ve as a,Se as i,He as n,_e as o,Pe as r,be as s,Me as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-DcxWxIrR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-D99vN3es.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DlT9KqwF.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-wNXWkWu5.js","assets/messages-fmf0dnr4.js","assets/cn-JdwAhgNB.js","assets/app-link-C6gA5Nck.js","assets/product-delivery-bv3z8Xkh.js","assets/schemas-88fK3zzl.js","assets/local-apps-Bpja8nC6.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-DcsFzD_i.js","assets/dist-3h6cXXhT.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.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/capabilities-sAZT4brT.js","assets/tasks-CDR_RVbQ.js","assets/conversation-identity-Cw0n9uzK.js","assets/files-BK6enEvD.js","assets/tool-activity-BtJkgjFf.js","assets/turn-outcome-D0SnyZ3Z.js","assets/button-CS04eWY9.js","assets/registry-api-BIpltJ47.js","assets/gateway-startup-retry-6jLRcQsu.js","assets/gateway-config-swr-cR-tz7-Q.js","assets/electron-env-Dit0bHgy.js","assets/index-BEw0xrde.css","assets/page-tabs-b3lheKy4.js","assets/capability-header-actions-EETjXmkG.js","assets/capability-icon-BYm2-nS-.js","assets/skill-api-BuZKcy9b.js","assets/skill-reload-api-Cb_CUL-U.js","assets/connectors-page-l7goF6QS.js","assets/connector-service-page-wxsEhmlU.js","assets/agent-plugin-dialog-DbvLXQO2.js","assets/apps-page-C9ZMEuuA.js","assets/agents-Bh4XNLyk.js","assets/directory-picker-path-field-BqkOh13m.js","assets/settings-page-layout-X1x-2Cp9.js","assets/channels-CwA619os.js","assets/browser-BLJWD7WI.js","assets/schema-form-Cfft26Je.js","assets/settings-loading-skeleton-CAmWMaOT.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{m as a,r as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./messages-fmf0dnr4.js";import{n as c}from"./locale-store-wNXWkWu5.js";import{t as l}from"./skeleton-BwbyijEw.js";import{Ec as u,Ho as d}from"./index-D99vN3es.js";import{t as f}from"./capability-header-actions-EETjXmkG.js";var p=n(),m=e(t(),1),h=r(),g=(0,m.lazy)(()=>i(()=>import(`./skills-page-DcxWxIrR.js`).then(e=>({default:e.SkillsPage})),__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]))),_=(0,m.lazy)(()=>i(()=>import(`./connectors-page-l7goF6QS.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([65,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,66,67]))),v=(0,m.lazy)(()=>i(()=>import(`./apps-page-C9ZMEuuA.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([68,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,67]))),y=(0,m.lazy)(()=>i(()=>import(`./agents-Bh4XNLyk.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([69,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,70,71]))),b=(0,m.lazy)(()=>i(()=>import(`./channels-CwA619os.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([72,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,73,74,75,71])));function x(e){return u.includes(e)?e:null}function S(e){let t=(0,p.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},C),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,h.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function C(e,t){return(0,h.jsx)(l,{className:`h-40 rounded-xl`},t)}function w(){let e=(0,p.c)(41),t=c(D),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:l,detailId:u}=a(),C;e[2]===l?C=e[3]:(C=x(l),e[2]=l,e[3]=C);let w=C,O=w??`skills`,k=r.productNavigation.sections[`capabilities-${O}`],A=d(E),j=d(T),M;e[4]===O?M=e[5]:(M={section:O,value:null},e[4]=O,e[5]=M);let[N,P]=(0,m.useState)(M),F=N.section===O?N.value:null,I;e[6]===O?I=e[7]:(I=e=>{P({section:O,value:e})},e[6]=O,e[7]=I);let L=I,R,z;if(e[8]!==j||e[9]!==F||e[10]!==k||e[11]!==A?(R=()=>(A({startExtra:null,main:(0,h.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k}),end:(0,h.jsx)(f,{contribution:F})}),()=>j()),z=[j,F,k,A],e[8]=j,e[9]=F,e[10]=k,e[11]=A,e[12]=R,e[13]=z):(R=e[12],z=e[13]),(0,m.useLayoutEffect)(R,z),!w){let t;return e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsx)(o,{to:`/capabilities/skills`,replace:!0}),e[14]=t):t=e[14],t}let B;e[15]===i.discoverLoading?B=e[16]:(B=(0,h.jsx)(S,{label:i.discoverLoading}),e[15]=i.discoverLoading,e[16]=B);let V;e[17]!==u||e[18]!==L||e[19]!==O?(V=O===`agents`?(0,h.jsx)(y,{agentId:u,onHeaderActionChange:L}):null,e[17]=u,e[18]=L,e[19]=O,e[20]=V):V=e[20];let H;e[21]!==L||e[22]!==O?(H=O===`skills`?(0,h.jsx)(g,{embedded:!0,onHeaderActionChange:L}):null,e[21]=L,e[22]=O,e[23]=H):H=e[23];let U;e[24]!==L||e[25]!==O?(U=O===`connectors`?(0,h.jsx)(_,{embedded:!0,onHeaderActionChange:L}):null,e[24]=L,e[25]=O,e[26]=U):U=e[26];let W;e[27]!==u||e[28]!==L||e[29]!==O?(W=O===`channels`?(0,h.jsx)(b,{channelId:u,onHeaderActionChange:L}):null,e[27]=u,e[28]=L,e[29]=O,e[30]=W):W=e[30];let G;e[31]!==L||e[32]!==O?(G=O===`extensions`?(0,h.jsx)(v,{embedded:!0,onHeaderActionChange:L}):null,e[31]=L,e[32]=O,e[33]=G):G=e[33];let K;return e[34]!==W||e[35]!==G||e[36]!==B||e[37]!==V||e[38]!==H||e[39]!==U?(K=(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,h.jsxs)(m.Suspense,{fallback:B,children:[V,H,U,W,G]})}),e[34]=W,e[35]=G,e[36]=B,e[37]=V,e[38]=H,e[39]=U,e[40]=K):K=e[40],K}function T(e){return e.clearPageHeader}function E(e){return e.setPageHeader}function D(e){return e.language}export{w as CapabilitiesPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-page-C35VKjhb.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DalslRUx.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-DlT9KqwF.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-wNXWkWu5.js","assets/messages-fmf0dnr4.js","assets/cn-JdwAhgNB.js","assets/app-link-C6gA5Nck.js","assets/product-delivery-bv3z8Xkh.js","assets/schemas-88fK3zzl.js","assets/local-apps-Bpja8nC6.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-DcsFzD_i.js","assets/dist-3h6cXXhT.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.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/capabilities-CHA-sTAZ.js","assets/tasks-CDR_RVbQ.js","assets/conversation-identity-Cw0n9uzK.js","assets/files-BK6enEvD.js","assets/tool-activity-BtJkgjFf.js","assets/turn-outcome-D0SnyZ3Z.js","assets/button-CS04eWY9.js","assets/registry-api-BIpltJ47.js","assets/gateway-startup-retry-6jLRcQsu.js","assets/gateway-config-swr-cR-tz7-Q.js","assets/electron-env-Dit0bHgy.js","assets/index-BEw0xrde.css","assets/page-tabs-vqI30Yrg.js","assets/capability-header-actions-vmx35sbu.js","assets/capability-icon-BYm2-nS-.js","assets/skill-api-CiBGQ0Jg.js","assets/skill-reload-api-BHnru0F5.js","assets/connectors-page-DZYgogQw.js","assets/connector-service-page-BKCZMmwm.js","assets/agent-plugin-dialog-BeNnu1Ts.js","assets/apps-page-DVNySL58.js","assets/agents-udIitwV8.js","assets/directory-picker-path-field-hqJ9sFCR.js","assets/settings-page-layout-X1x-2Cp9.js","assets/channels-Eo4ONF5X.js","assets/browser-BLJWD7WI.js","assets/schema-form-BKj6wIMb.js","assets/settings-loading-skeleton-CAmWMaOT.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{m as a,r as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./messages-fmf0dnr4.js";import{n as c}from"./locale-store-wNXWkWu5.js";import{t as l}from"./skeleton-BwbyijEw.js";import{Ec as u,Ho as d}from"./index-DalslRUx.js";import{t as f}from"./capability-header-actions-vmx35sbu.js";var p=n(),m=e(t(),1),h=r(),g=(0,m.lazy)(()=>i(()=>import(`./skills-page-C35VKjhb.js`).then(e=>({default:e.SkillsPage})),__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]))),_=(0,m.lazy)(()=>i(()=>import(`./connectors-page-DZYgogQw.js`).then(e=>({default:e.ConnectorsPage})),__vite__mapDeps([65,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,66,67]))),v=(0,m.lazy)(()=>i(()=>import(`./apps-page-DVNySL58.js`).then(e=>({default:e.ExtensionsPage})),__vite__mapDeps([68,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,67]))),y=(0,m.lazy)(()=>i(()=>import(`./agents-udIitwV8.js`).then(e=>({default:e.AgentsSettingsPanel})),__vite__mapDeps([69,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,70,71]))),b=(0,m.lazy)(()=>i(()=>import(`./channels-Eo4ONF5X.js`).then(e=>({default:e.ChannelsSettingsPanel})),__vite__mapDeps([72,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,73,74,75,71])));function x(e){return u.includes(e)?e:null}function S(e){let t=(0,p.c)(3),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:6},C),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,h.jsx)(`div`,{className:`mx-auto grid w-full max-w-7xl gap-4 px-4 pb-7 pt-3 sm:grid-cols-2 sm:px-6 lg:grid-cols-3 lg:px-8 lg:pb-9 lg:pt-4`,"aria-label":n,"aria-busy":!0,children:r}),t[1]=n,t[2]=i),i}function C(e,t){return(0,h.jsx)(l,{className:`h-40 rounded-xl`},t)}function w(){let e=(0,p.c)(41),t=c(D),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n,i=r.capabilitiesHub,{section:l,detailId:u}=a(),C;e[2]===l?C=e[3]:(C=x(l),e[2]=l,e[3]=C);let w=C,O=w??`skills`,k=r.productNavigation.sections[`capabilities-${O}`],A=d(E),j=d(T),M;e[4]===O?M=e[5]:(M={section:O,value:null},e[4]=O,e[5]=M);let[N,P]=(0,m.useState)(M),F=N.section===O?N.value:null,I;e[6]===O?I=e[7]:(I=e=>{P({section:O,value:e})},e[6]=O,e[7]=I);let L=I,R,z;if(e[8]!==j||e[9]!==F||e[10]!==k||e[11]!==A?(R=()=>(A({startExtra:null,main:(0,h.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k}),end:(0,h.jsx)(f,{contribution:F})}),()=>j()),z=[j,F,k,A],e[8]=j,e[9]=F,e[10]=k,e[11]=A,e[12]=R,e[13]=z):(R=e[12],z=e[13]),(0,m.useLayoutEffect)(R,z),!w){let t;return e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,h.jsx)(o,{to:`/capabilities/skills`,replace:!0}),e[14]=t):t=e[14],t}let B;e[15]===i.discoverLoading?B=e[16]:(B=(0,h.jsx)(S,{label:i.discoverLoading}),e[15]=i.discoverLoading,e[16]=B);let V;e[17]!==u||e[18]!==L||e[19]!==O?(V=O===`agents`?(0,h.jsx)(y,{agentId:u,onHeaderActionChange:L}):null,e[17]=u,e[18]=L,e[19]=O,e[20]=V):V=e[20];let H;e[21]!==L||e[22]!==O?(H=O===`skills`?(0,h.jsx)(g,{embedded:!0,onHeaderActionChange:L}):null,e[21]=L,e[22]=O,e[23]=H):H=e[23];let U;e[24]!==L||e[25]!==O?(U=O===`connectors`?(0,h.jsx)(_,{embedded:!0,onHeaderActionChange:L}):null,e[24]=L,e[25]=O,e[26]=U):U=e[26];let W;e[27]!==u||e[28]!==L||e[29]!==O?(W=O===`channels`?(0,h.jsx)(b,{channelId:u,onHeaderActionChange:L}):null,e[27]=u,e[28]=L,e[29]=O,e[30]=W):W=e[30];let G;e[31]!==L||e[32]!==O?(G=O===`extensions`?(0,h.jsx)(v,{embedded:!0,onHeaderActionChange:L}):null,e[31]=L,e[32]=O,e[33]=G):G=e[33];let K;return e[34]!==W||e[35]!==G||e[36]!==B||e[37]!==V||e[38]!==H||e[39]!==U?(K=(0,h.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,h.jsxs)(m.Suspense,{fallback:B,children:[V,H,U,W,G]})}),e[34]=W,e[35]=G,e[36]=B,e[37]=V,e[38]=H,e[39]=U,e[40]=K):K=e[40],K}function T(e){return e.clearPageHeader}function E(e){return e.setPageHeader}function D(e){return e.language}export{w as CapabilitiesPage};