@xopcai/xopc 0.0.254 → 0.0.255

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 (154) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-Ci5Rxmi_.js → activity-store-DvjK5FEm.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D82jpmFL.js → agent-avatar-dicebear-Cqspzbf_.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CL3Mi-uM.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-odqXmGhA.js +1 -0
  7. package/dist/gateway/static/root/assets/{api-CXIzQJ2Z.js → api-CsYi3heY.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-mhxcQpkQ.js → app-management-settings-panel-Gd4a5hdE.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-BIMwACUF.js → appearance-settings-CZ6KOnbd.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-DyBDoCam.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-C63Xp_sU.js → archive-plugin-y82Rwhjm.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-D12KYOav.js → attachment-load-D46SGNpv.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-DXj0o5CY.js → automations-page-wilciIZ1.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-8U86Umig.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-Bcv8hun6.js → binary-plugins-CuMkNNCe.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-C61LqK_-.js → block-editor-DFnPsrxI.js} +24 -24
  17. package/dist/gateway/static/root/assets/{browser-automation-inputs-CAclu735.js → browser-automation-inputs-hlmcSp4p.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automations-page-BITfKX8L.js → browser-automations-page-OjZvbARU.js} +2 -2
  19. package/dist/gateway/static/root/assets/browser-settings-page-DOUG84qV.js +8 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-CG73Mwi8.js +7 -0
  21. package/dist/gateway/static/root/assets/channels-settings-MDywEWWM.js +1 -0
  22. package/dist/gateway/static/root/assets/{channels-status-swr-Cmbx0E8O.js → channels-status-swr-D1HHFzkE.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-CNBgHN9U.js → chat-terminal-dock-Ce_T9BPq.js} +2 -2
  24. package/dist/gateway/static/root/assets/connectors-page-D29p6Zvm.js +2 -0
  25. package/dist/gateway/static/root/assets/{cron-expression-DCTN4QAG.js → cron-expression-BRrCwYyD.js} +1 -1
  26. package/dist/gateway/static/root/assets/date-picker-C35RuuWW.js +1 -0
  27. package/dist/gateway/static/root/assets/{dependency-picker-l6IXzk0C.js → dependency-picker-4pNXVcRM.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-DIfccDKS.js → desktop-pet-settings-BvV1UA5g.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-cGn_20DO.js → desktop-pet-z91GYnPf.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-debug-page-CTS5RP_D.js → extension-debug-page-CkVF5HvV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-Dg9YssYH.js → extension-page-DW0zQGaB.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-CWZYL8Fi.js → extension-settings-page-BLQhizZ3.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-swr-Chsr5wGH.js → gateway-config-swr-02BBC1mK.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-settings-vHI_Que8.js → gateway-settings-rAXx8FGP.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-C9ynH6VV.js → gateway-startup-retry-XZnY6621.js} +1 -1
  36. package/dist/gateway/static/root/assets/heartbeat-settings-BaW_r1t9.js +1 -0
  37. package/dist/gateway/static/root/assets/home-page-BoTS8-Z9.js +1 -0
  38. package/dist/gateway/static/root/assets/{image-generation-api-D_TsVe7h.js → image-generation-api-CIcKz4Xs.js} +1 -1
  39. package/dist/gateway/static/root/assets/index-DsonmRCH.css +2 -0
  40. package/dist/gateway/static/root/assets/index-PksHo9hS.js +74 -0
  41. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGBf6YfD.js → keyboard-shortcuts-settings-yfaGz6SE.js} +1 -1
  42. package/dist/gateway/static/root/assets/local-app-workbench-page-B3flRQH1.js +2 -0
  43. package/dist/gateway/static/root/assets/{local-apps-page-DGWP_xsQ.js → local-apps-page-Cp-nEtgV.js} +1 -1
  44. package/dist/gateway/static/root/assets/{locale-store-B2v8mNJw.js → locale-store-VsboRLD7.js} +1 -1
  45. package/dist/gateway/static/root/assets/logs-page-DkqsRCri.js +2 -0
  46. package/dist/gateway/static/root/assets/{management-settings-DUAZ-dtt.js → management-settings-24_JyDPk.js} +1 -1
  47. package/dist/gateway/static/root/assets/{markdown-view-DBWu9d_n.js → markdown-view-CPXhy6nh.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-CsUjcIBy.js → media-plugins-CwLvIb9r.js} +1 -1
  49. package/dist/gateway/static/root/assets/messages-DngsF_Kx.js +3 -0
  50. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-Dxu8twiQ.js → mobile-pairing-wizard-BbJCDv57.js} +1 -1
  51. package/dist/gateway/static/root/assets/note-detail-panel-OklYXK7y.js +5 -0
  52. package/dist/gateway/static/root/assets/notes-page-BjfgJIQw.js +8 -0
  53. package/dist/gateway/static/root/assets/{page-tabs-YeJKwV-7.js → page-tabs-0YXn9Gkl.js} +1 -1
  54. package/dist/gateway/static/root/assets/popover-select-CKBYnT3c.js +1 -0
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-BfJ3jMDG.js → preview-open-alternatives-2jVV5kfZ.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-B7NRGPox.js → product-open-page-D7p0NfTK.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-rLNM2mP0.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-D6jY2ZWl.js +1 -0
  59. package/dist/gateway/static/root/assets/{registry-api-B9OZUdwC.js → registry-api-DlTWbXQA.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-DTO-faxH.js → remote-access-hub-CZZg0kXc.js} +1 -1
  61. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-uJ8Br3ZL.js → runtime-tools-settings-panel-B-NDgmJ4.js} +2 -2
  62. package/dist/gateway/static/root/assets/{schema-form-CXwn6up5.js → schema-form-DZYeBS1v.js} +1 -1
  63. package/dist/gateway/static/root/assets/sessions-page-BvuxJegi.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-BAQHP4mB.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-YVNYsR0U.js → settings-form-section-zy5UMvPk.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-cHqrIdVR.js → settings-page-CTuipbJq.js} +1 -1
  67. package/dist/gateway/static/root/assets/setup-status-panel-BkWoc5j5.js +1 -0
  68. package/dist/gateway/static/root/assets/{share-preview-page-DnjSDQru.js → share-preview-page-D3Uawo_h.js} +1 -1
  69. package/dist/gateway/static/root/assets/shares-settings-B2doziIn.js +1 -0
  70. package/dist/gateway/static/root/assets/skill-reload-api-D2ymjqG5.js +1 -0
  71. package/dist/gateway/static/root/assets/{skills-page-DkrGEdiY.js → skills-page-DDbabz7p.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skills-page.utils-CqZbiZuK.js → skills-page.utils-DkGhbiMa.js} +1 -1
  73. package/dist/gateway/static/root/assets/{system-settings-panel-Dmw0RfxZ.js → system-settings-panel-Fc-WbX6-.js} +1 -1
  74. package/dist/gateway/static/root/assets/task-detail-page-7w7eB9nB.js +1 -0
  75. package/dist/gateway/static/root/assets/{theme-store-CubltMKm.js → theme-store-vdB57bTn.js} +1 -1
  76. package/dist/gateway/static/root/assets/{tunnel-api-CiieC6HP.js → tunnel-api-DZ0evABj.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-autosave-XQ3SuyB9.js → use-autosave-Ckof_m7e.js} +1 -1
  78. package/dist/gateway/static/root/assets/user-model-page-CcNCyrXZ.js +2 -0
  79. package/dist/gateway/static/root/assets/{voice-api-key-field-D4QzVgdt.js → voice-api-key-field-CnmtpWlq.js} +1 -1
  80. package/dist/gateway/static/root/assets/{voice-config-api-B1ZbyVmF.js → voice-config-api-OA04c71t.js} +1 -1
  81. package/dist/gateway/static/root/assets/{work-discovery-overlay-D5Tf8GRZ.js → work-discovery-overlay-sxvsDIC3.js} +1 -1
  82. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CUCfBpPF.js +3 -0
  83. package/dist/gateway/static/root/assets/workflows-page-Bp-nvnLa.js +5 -0
  84. package/dist/gateway/static/root/index.html +11 -11
  85. package/dist/package.js +1 -1
  86. package/dist/src/agent/tools/create-share-tool.js +39 -1
  87. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  88. package/dist/src/cli/commands/tunnel.js +3 -3
  89. package/dist/src/gateway/device-routes.js +1 -1
  90. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  91. package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -2
  92. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  93. package/dist/src/gateway/hono/routes/shares.js +404 -7
  94. package/dist/src/gateway/hono/routes/site-shares.js +19 -13
  95. package/dist/src/gateway/hono/routes/tunnel.js +1 -1
  96. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  97. package/dist/src/gateway/service/sessions-api.js +1 -1
  98. package/dist/src/gateway/service.js +3 -3
  99. package/dist/src/remote-access/exposure-manager.js +1 -1
  100. package/dist/src/session/index.js +1 -1
  101. package/dist/src/session/store.js +1 -1
  102. package/dist/src/share/hosted-note-publication.d.ts +22 -0
  103. package/dist/src/share/hosted-note-publication.js +96 -0
  104. package/dist/src/share/hosted-session-share.d.ts +86 -7
  105. package/dist/src/share/hosted-session-share.js +72 -15
  106. package/dist/src/share/hosted-static-site-publication.d.ts +16 -0
  107. package/dist/src/share/hosted-static-site-publication.js +108 -0
  108. package/dist/src/share/hosted-static-site-publish.d.ts +23 -0
  109. package/dist/src/share/hosted-static-site-publish.js +53 -0
  110. package/dist/src/share/note-share-service.d.ts +1 -0
  111. package/dist/src/share/note-share-service.js +4 -4
  112. package/dist/src/share/share-url.d.ts +1 -1
  113. package/dist/src/share/share-url.js +14 -9
  114. package/dist/src/tasks/home-query-service.js +2 -2
  115. package/dist/src/tui/backends/embedded-backend.js +2 -2
  116. package/dist/src/tui/tui-agent-events.js +1 -1
  117. package/dist/src/tunnel/index.js +1 -1
  118. package/dist/src/tunnel/tunnel-service.js +1 -1
  119. package/dist/src/voice/realtime/agentEngine.js +17 -0
  120. package/dist/src/voice/realtime/memory-context.js +1 -1
  121. package/dist/src/voice/realtime/playback-echo.d.ts +2 -0
  122. package/dist/src/voice/realtime/playback-echo.js +15 -0
  123. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  124. package/package.json +3 -3
  125. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-vul32IsP.js +0 -1
  126. package/dist/gateway/static/root/assets/agents-p3kWyz1T.js +0 -1
  127. package/dist/gateway/static/root/assets/apps-page-CJFJKNwS.js +0 -1
  128. package/dist/gateway/static/root/assets/automations-workspace-B2wxcpgq.js +0 -6
  129. package/dist/gateway/static/root/assets/browser-settings-page-BMjY8cyv.js +0 -8
  130. package/dist/gateway/static/root/assets/capabilities-settings-panel-wB3Vgmp3.js +0 -7
  131. package/dist/gateway/static/root/assets/channels-settings-U5ffzu4r.js +0 -1
  132. package/dist/gateway/static/root/assets/connectors-page-BGaF--m5.js +0 -2
  133. package/dist/gateway/static/root/assets/date-picker-BuEyUxZn.js +0 -1
  134. package/dist/gateway/static/root/assets/heartbeat-settings-WUhSfvob.js +0 -1
  135. package/dist/gateway/static/root/assets/home-page-CYjlMzPx.js +0 -1
  136. package/dist/gateway/static/root/assets/index-BBlJYVxR.js +0 -74
  137. package/dist/gateway/static/root/assets/index-_I0dD2LN.css +0 -2
  138. package/dist/gateway/static/root/assets/local-app-workbench-page-CLlIl83V.js +0 -2
  139. package/dist/gateway/static/root/assets/logs-page-DuhCigiB.js +0 -2
  140. package/dist/gateway/static/root/assets/messages-ChSTFZR5.js +0 -3
  141. package/dist/gateway/static/root/assets/note-detail-panel-DMdbaTZp.js +0 -5
  142. package/dist/gateway/static/root/assets/notes-page-xe_vX0nM.js +0 -8
  143. package/dist/gateway/static/root/assets/popover-select-C-Hj-nXR.js +0 -1
  144. package/dist/gateway/static/root/assets/project-detail-page-hG7ELibZ.js +0 -1
  145. package/dist/gateway/static/root/assets/projects-page-C5G2ET4w.js +0 -1
  146. package/dist/gateway/static/root/assets/sessions-page-CwzsUCgP.js +0 -1
  147. package/dist/gateway/static/root/assets/settings-advanced-gate-Djc3EdoO.js +0 -1
  148. package/dist/gateway/static/root/assets/setup-status-panel-MUAMcZLD.js +0 -1
  149. package/dist/gateway/static/root/assets/shares-settings-C7A0aywX.js +0 -1
  150. package/dist/gateway/static/root/assets/skill-reload-api-D1xSGJAQ.js +0 -1
  151. package/dist/gateway/static/root/assets/task-detail-page-BvZSCLUH.js +0 -1
  152. package/dist/gateway/static/root/assets/user-model-page-BKJC7tyW.js +0 -2
  153. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BW9p8Maz.js +0 -3
  154. package/dist/gateway/static/root/assets/workflows-page-DuqRodIc.js +0 -5
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-ChSTFZR5.js";import{a as c,n as l,r as u,s as d}from"./locale-store-B2v8mNJw.js";import{t as f}from"./cn-JdwAhgNB.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{r as m}from"./gateway-config-swr-Chsr5wGH.js";import{n as h,t as g}from"./registry-api-B9OZUdwC.js";import{$c as _,Bl as v,Go as y,Ls as b,Os as x,Za as S,_u as C,ac as w,ql as T,rn as E,wa as D,wt as O,zl as k}from"./index-BBlJYVxR.js";import{n as A,r as j}from"./settings-page-layout-BRQNel6r.js";import{n as M}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as N,t as P}from"./settings-form-section-YVNYsR0U.js";var F=e(t(),1),I=n();function L(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&S(e)).length}function R(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function z(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function B(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function V(e){return e?`pass`:`fail`}function H(e){if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function U(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function W(e){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>({id:e.id,label:e.label,status:e.status,message:e.message,hints:e.hints,path:H(e.id),source:`doctor`})).toSorted((e,t)=>U(t.status)-U(e.status)||e.label.localeCompare(t.label))}function G(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let e of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let r=t.get(e);r&&n.push({id:r.id,label:r.label,status:r.status,message:r.message,path:H(r.id)})}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[])n.push(t);return n}function ee(e){let t=L(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=R(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=z(e.config),l=e.skillCount>0,u=e.doctorChecks??[],d=W(u),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:V(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:V(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:V(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=G({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function te(e){return B(e)}function K(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function ne(){return u(`/api/doctor`)}async function re(){return((await c(ne())).checks??[]).map(K).filter(e=>e!==null)}function ie(){return u(`/api/logs/health`)}async function ae(){return c(ie())}function q(e){return e?`pass`:`warn`}function oe(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function se(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await c(u(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:q(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await c(u(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function J(){let e=(0,I.c)(57),t=d(pe),n=l(fe),r;e[0]===n?r=e[1]:(r=s(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=D(de),{data:c,error:u,isLoading:f,mutate:_}=m(!!t),v;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},e[2]=v):v=e[2];let{data:y,error:b,isLoading:x,mutate:S}=p(t?`setup-checklist-skills`:null,ue,v),C;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},e[3]=C):C=e[3];let{data:w,error:T,isLoading:E,mutate:k}=p(t?`setup-checklist-provider-meta`:null,O,C),A;e[4]===t?A=e[5]:(A=t?ne():null,e[4]=t,e[5]=A);let j;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(j={revalidateOnFocus:!1},e[6]=j):j=e[6];let{data:M,error:N,isLoading:P,mutate:F}=p(A,re,j),L;e[7]===t?L=e[8]:(L=t?ie():null,e[7]=t,e[8]=L);let R;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(R={revalidateOnFocus:!1},e[9]=R):R=e[9];let{data:z,isLoading:B,mutate:V}=p(L,ae,R);c?.payload?.config;let H=c?.payload?.config,U;e[10]===H?U=e[11]:(U=te(H),e[10]=H,e[11]=U);let W=t?U:null,G;e[12]===W?G=e[13]:(G=oe(W),e[12]=W,e[13]=G);let K;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(K={revalidateOnFocus:!1},e[14]=K):K=e[14];let{data:q,isLoading:se,mutate:J}=p(G,le,K),Y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(Y={revalidateOnFocus:!1},e[15]=Y):Y=e[15],p(t?g:null,h,Y);let X=!t||!f&&!x&&!E&&!P&&!B&&!se,Z=!!(u||b||T||N),me;bb0:{if(!t||!X){me=null;break bb0}let n=y?.catalog?.length??0,r;if(e[16]!==q||e[17]!==c?.payload?.config||e[18]!==M||e[19]!==a.channelConfigured||e[20]!==a.channelMissing||e[21]!==a.gatewayOffline||e[22]!==a.gatewayOnline||e[23]!==a.modelConfigured||e[24]!==a.modelMissing||e[25]!==a.providersConfigured||e[26]!==a.providersMetaReady||e[27]!==a.providersMissing||e[28]!==a.skillsConfigured||e[29]!==a.skillsMissing||e[30]!==z||e[31]!==i.setupStatus.requiredCompleteMessage||e[32]!==w||e[33]!==o||e[34]!==n||e[35]!==t){let s=w?.filter(ce).length??0,l=w?.length??0,u;e[37]===a.providersConfigured?u=e[38]:(u=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[37]=a.providersConfigured,e[38]=u);let d;e[39]===a.providersMetaReady?d=e[40]:(d=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[39]=a.providersMetaReady,e[40]=d);let f;e[41]===a.modelConfigured?f=e[42]:(f=e=>a.modelConfigured.replace(`{{model}}`,e),e[41]=a.modelConfigured,e[42]=f);let p;e[43]===a.skillsConfigured?p=e[44]:(p=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[43]=a.skillsConfigured,e[44]=p),r=ee({hasToken:!!t,realtimeConnected:o,config:c?.payload?.config,skillCount:n,providerMeta:l>0?{configured:s,total:l}:null,doctorChecks:M,logsHealth:z,browserDiagnostics:q,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:u,providersMetaReady:d,providersMissing:a.providersMissing,modelConfigured:f,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:p,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage}}),e[16]=q,e[17]=c?.payload?.config,e[18]=M,e[19]=a.channelConfigured,e[20]=a.channelMissing,e[21]=a.gatewayOffline,e[22]=a.gatewayOnline,e[23]=a.modelConfigured,e[24]=a.modelMissing,e[25]=a.providersConfigured,e[26]=a.providersMetaReady,e[27]=a.providersMissing,e[28]=a.skillsConfigured,e[29]=a.skillsMissing,e[30]=z,e[31]=i.setupStatus.requiredCompleteMessage,e[32]=w,e[33]=o,e[34]=n,e[35]=t,e[36]=r}else r=e[36];me=r}let he=me,Q;e[45]!==J||e[46]!==_||e[47]!==F||e[48]!==V||e[49]!==k||e[50]!==S?(Q=async()=>{await Promise.all([_(),S(),k(),F(),V(),J()])},e[45]=J,e[46]=_,e[47]=F,e[48]=V,e[49]=k,e[50]=S,e[51]=Q):Q=e[51];let ge=Q,$;return e[52]!==Z||e[53]!==X||e[54]!==ge||e[55]!==he?($={ready:X,error:Z,snapshot:he,refresh:ge},e[52]=Z,e[53]=X,e[54]=ge,e[55]=he,e[56]=$):$=e[56],$}function ce(e){return e.configured}function le(e){let[,t]=e;return se(t)}function ue(){return E()}function de(e){return e.connectionState===`connected`}function fe(e){return e.language}function pe(e){return e.token}var Y=r();function X(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function Z(e){return e===`pass`?a:e===`warn`?x:e===`fail`?v:_}function me(e,t){return e===`blocked`?{icon:v,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:x,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:k,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function he(e){let t=(0,I.c)(48),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:u,doctorRunState:d}=e,p=l(Q),m,h,g,_,v,b,x,S,C,E,D;if(t[0]!==r||t[1]!==p||t[2]!==n){h=s(p).setupStatus;let e=me(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})]}),D=f(`rounded-xl p-4`,e.className),E=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,S=`flex min-w-0 gap-3`,C=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),v=`min-w-0`,b=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),x=(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-85`,children:e.body}),g=`mt-2 text-xs opacity-75`,_=h.health.issueCount.replace(`{{count}}`,String(r)),t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=E,t[13]=D}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],b=t[8],x=t[9],S=t[10],C=t[11],E=t[12],D=t[13];let O;t[14]!==g||t[15]!==_?(O=(0,Y.jsx)(`p`,{className:g,children:_}),t[14]=g,t[15]=_,t[16]=O):O=t[16];let k;t[17]!==O||t[18]!==v||t[19]!==b||t[20]!==x?(k=(0,Y.jsxs)(`div`,{className:v,children:[b,x,O]}),t[17]=O,t[18]=v,t[19]=b,t[20]=x,t[21]=k):k=t[21];let A;t[22]!==k||t[23]!==S||t[24]!==C?(A=(0,Y.jsxs)(`div`,{className:S,children:[C,k]}),t[22]=k,t[23]=S,t[24]=C,t[25]=A):A=t[25];let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=f(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,y.press),t[26]=j):j=t[26];let M=!c||u,N;t[27]===u?N=t[28]:(N=u?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[27]=u,t[28]=N);let P=u?h.health.runDoctorRunning:h.health.runDoctor,F;t[29]!==u||t[30]!==a||t[31]!==M||t[32]!==N||t[33]!==P?(F=(0,Y.jsxs)(`button`,{type:`button`,className:j,onClick:a,disabled:M,"aria-busy":u,children:[N,P]}),t[29]=u,t[30]=a,t[31]=M,t[32]=N,t[33]=P,t[34]=F):F=t[34];let L;t[35]!==m||t[36]!==F?(L=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,F]}),t[35]=m,t[36]=F,t[37]=L):L=t[37];let R;t[38]!==A||t[39]!==L||t[40]!==E?(R=(0,Y.jsxs)(`div`,{className:E,children:[A,L]}),t[38]=A,t[39]=L,t[40]=E,t[41]=R):R=t[41];let z=u?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:d===`error`?h.health.doctorFailedMessage:h.health.doctorIdleMessage,B;t[42]===z?B=t[43]:(B=(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:z}),t[42]=z,t[43]=B);let V;return t[44]!==R||t[45]!==B||t[46]!==D?(V=(0,Y.jsxs)(`section`,{className:D,children:[R,B]}),t[44]=R,t[45]=B,t[46]=D,t[47]=V):V=t[47],V}function Q(e){return e.language}function ge(e){let t=(0,I.c)(34),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.status?l=t[7]:(l=f(`rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[6]=n.status,t[7]=l);let u;t[8]!==n.status||t[9]!==l?(u=(0,Y.jsx)(`span`,{className:l,children:n.status}),t[8]=n.status,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==c||t[12]!==u?(d=(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13];let p;t[14]===n.message?p=t[15]:(p=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[14]=n.message,t[15]=p);let m;t[16]===n.hints[0]?m=t[17]:(m=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[16]=n.hints[0],t[17]=m);let h;t[18]!==d||t[19]!==p||t[20]!==m?(h=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p,m]}),t[18]=d,t[19]=p,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==r||t[23]!==n.path?(g=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})]}):null,t[22]=r,t[23]=n.path,t[24]=g):g=t[24];let _;t[25]!==g||t[26]!==s||t[27]!==h?(_=(0,Y.jsxs)(Y.Fragment,{children:[s,h,g]}),t[25]=g,t[26]=s,t[27]=h,t[28]=_):_=t[28];let v=_;if(n.path){let e;return t[29]!==v||t[30]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:v}),t[29]=v,t[30]=n.path,t[31]=e):e=t[31],e}let y;return t[32]===v?y=t[33]:(y=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:v}),t[32]=v,t[33]=y),y}function $(e){let t=(0,I.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s=r[n.id]??n.title,c;t[2]===n.status?c=t[3]:(c=f(`flex size-7 shrink-0 items-center justify-center rounded-full border`,X(n.status)),t[2]=n.status,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Y.jsx)(`span`,{className:c,children:l}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===s?d=t[10]:(d=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:s}),t[9]=s,t[10]=d);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==d||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[13]=d,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(T,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[u,m,h]}),t[18]=u,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function _e(e){let t=(0,I.c)(29),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=Z(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]===n.status?d=t[12]:(d=f(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium uppercase`,X(n.status)),t[11]=n.status,t[12]=d);let p;t[13]!==n.status||t[14]!==d?(p=(0,Y.jsx)(`span`,{className:d,children:n.status}),t[13]=n.status,t[14]=d,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n.path?(m=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[16]=r,t[17]=n.path,t[18]=m):m=t[18];let h;t[19]!==s||t[20]!==u||t[21]!==p||t[22]!==m?(h=(0,Y.jsxs)(Y.Fragment,{children:[s,u,p,m]}),t[19]=s,t[20]=u,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g=h;if(n.path){let e;return t[24]!==g||t[25]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:g}),t[24]=g,t[25]=n.path,t[26]=e):e=t[26],e}let _;return t[27]===g?_=t[28]:(_=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:g}),t[27]=g,t[28]=_),_}function ve(){let e=s(l(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,F.useState)(!1),[c,u]=(0,F.useState)(`idle`),d=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],p=async()=>{if(!(a||!t)){o(!0),u(`idle`);try{await i(),u(`success`)}catch{u(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(j,{gap:`gap-6`,children:[(0,Y.jsx)(A,{title:e.title,subtitle:e.subtitle,actions:(0,Y.jsxs)(`button`,{type:`button`,className:f(`inline-flex shrink-0 items-center gap-2 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,y.press),onClick:()=>void p(),disabled:!t||a,"aria-busy":a,children:[(0,Y.jsx)(w,{className:f(`size-4`,(!t||a)&&`animate-spin`),"aria-hidden":!0}),a?e.health.runDoctorRunning:e.refresh]})}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(M,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(he,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void p(),doctorRunning:a,doctorRunState:c}),(0,Y.jsxs)(P,{id:`next-steps`,children:[(0,Y.jsx)(N,{icon:r.issues.length?x:C,title:e.nextStepsTitle,subtitle:r.issues.length?e.nextStepsIssuesSubtitle:e.nextStepsReadySubtitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)(ge,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)($,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(N,{icon:b,title:e.diagnosticsTitle,subtitle:e.diagnosticsSubtitle}),d.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:d.map(t=>(0,Y.jsx)(_e,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})]})]})}export{ve as SetupStatusPanel};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-C-Hj-nXR.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./copy-to-clipboard-HOJ79TWv.js";import{t as y}from"./messages-ChSTFZR5.js";import{a as b,n as x,r as S,s as C}from"./locale-store-B2v8mNJw.js";import{t as w}from"./cn-JdwAhgNB.js";import{i as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as T}from"./button-CtTvuElV.js";import{n as E,r as D}from"./gateway-config-swr-Chsr5wGH.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$r as te,Di as k,Fl as A,Is as j,Ti as M,Yl as N,Zt as P,ac as ne,ai as F,bl as I,ci as re,en as ie,hl as ae,ii as oe,kc as L,ks as R,li as z,no as se,oi as B,ri as ce,sa as V,si as H,ti as le,ui as ue}from"./index-BBlJYVxR.js";import{n as de,r as U,t as fe}from"./settings-page-layout-BRQNel6r.js";import{t as pe}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as W}from"./settings-form-section-YVNYsR0U.js";import{t as me}from"./page-tabs-YeJKwV-7.js";var G=e(t(),1),he=n(),K={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function ge(){return structuredClone(K)}var q=36e5,J=864e5,Y=1048576;function _e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function ve(e){let t=_e(e)?e:{},n=_e(t.gateway)?t.gateway:{},r=_e(n.share)?n.share:{},i=_e(r.directory)?r.directory:{},a=_e(r.note)?r.note:{},o=_e(n.siteShare)?n.siteShare:{},s=_e(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):K.defaultTtlHours*q,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):K.maxTtlDays*J,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):K.maxFileSizeMb*Y,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):K.directoryMaxFolderSizeMb*Y,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):K.siteDefaultTtlHours*q,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):K.siteMaxTtlDays*J,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):K.siteMaxRootDirSizeMb*Y,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):K.noteMaxTotalSizeMb*Y;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/q)),maxTtlDays:Math.max(1,Math.round(l/J)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):K.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/Y)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/Y)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):K.directoryMaxFileCount,inlinePreviewMimes:X(r.inlinePreviewMimes,32).length?X(r.inlinePreviewMimes,32):[...K.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/Y)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):K.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/q)),siteMaxTtlDays:Math.max(1,Math.round(p/J)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):K.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/Y)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):K.siteMaxFileCount}}function Z(e){let t=e.defaultTtlHours*q,n=e.maxTtlDays*J,r=e.siteDefaultTtlHours*q,i=e.siteMaxTtlDays*J;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function ye(e){let t=Z(e);if(t)throw Error(t);await b(S(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*q,maxTtlMs:e.maxTtlDays*J,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Y,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Y,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*Y,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*q,maxTtlMs:e.siteMaxTtlDays*J,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Y,maxFileCount:e.siteMaxFileCount}}}})}),E()}var Q=r();function be(){return w(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,se,`dark:border-edge`)}function xe({hasToken:e}){let t=y(x(e=>e.language)).sharesSettings,{data:n,isLoading:r}=D(e),i=(0,G.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ve(n.payload.config)),[n]),a=(0,G.useRef)(!1),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(!1),m=o??i,h=i,g=(0,G.useMemo)(()=>!m||!h?!1:JSON.stringify(m)!==JSON.stringify(h),[m,h]),_=(0,G.useCallback)(e=>{a.current=!0,s(t=>{let n=t??h;return n?{...n,...e}:null})},[h]),v=(0,G.useCallback)(async()=>{if(!(!m||c)){l(!0),d(null),p(!1);try{await ye(m),a.current=!1,s(null),p(!0),window.setTimeout(()=>p(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[m,c,t.policySaveError]),b=(0,G.useCallback)(()=>{a.current=!1,s(null),d(null),p(!1)},[]);return!e||!m?r?(0,Q.jsx)(W,{children:(0,Q.jsx)(pe,{rows:2})}):null:(0,Q.jsxs)(W,{children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>_(ge()),children:t.policyUseRecommended}),(0,Q.jsx)(T,{type:`button`,variant:`secondary`,disabled:!g||c,onClick:b,children:t.policyDiscard}),(0,Q.jsx)(T,{type:`button`,variant:`primary`,disabled:!g||c,onClick:()=>void v(),children:c?t.policySaving:t.policySave})]})]}),g?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Q.jsx)(Se,{t,form:m,onChange:_})]})}function Se(e){let t=(0,he.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Q.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Q.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Q.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Q.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let ee;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(ee=(0,Q.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=ee):ee=t[54];let T=!r.enabled,E;t[55]===i?E=t[56]:(E=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=E);let D;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==T||t[61]!==E?(D=(0,Q.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:T,onChange:E}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=T,t[61]=E,t[62]=D):D=t[62];let O;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==ee||t[67]!==D||t[68]!==p?(O=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,ee,D]}),t[63]=g,t[64]=y,t[65]=S,t[66]=ee,t[67]=D,t[68]=p,t[69]=O):O=t[69];let te=!r.enabled,k;t[70]===i?k=t[71]:(k=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=k);let A;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==te||t[75]!==k?(A=(0,Q.jsx)(Ce,{t:n,values:r.inlinePreviewMimes,disabled:te,onChange:k}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=te,t[75]=k,t[76]=A):A=t[76];let j;t[77]!==O||t[78]!==A||t[79]!==s||t[80]!==u?(j=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,O,A]}),t[77]=O,t[78]=A,t[79]=s,t[80]=u,t[81]=j):j=t[81];let M;t[82]===n.policyNoteSection?M=t[83]:(M=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=M);let N;t[84]===n.policyNoteSectionHint?N=t[85]:(N=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=N);let P;t[86]!==M||t[87]!==N?(P=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[M,N]}),t[86]=M,t[87]=N,t[88]=P):P=t[88];let ne;t[89]===i?ne=t[90]:(ne=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=ne);let F;t[91]!==r.noteEnabled||t[92]!==ne?(F=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:ne}),t[91]=r.noteEnabled,t[92]=ne,t[93]=F):F=t[93];let I;t[94]!==n.policyNoteEnabled||t[95]!==F?(I=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[F,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=F,t[96]=I):I=t[96];let re=!r.enabled||!r.noteEnabled,ie;t[97]===i?ie=t[98]:(ie=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=ie);let ae;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==re||t[103]!==ie?(ae=(0,Q.jsx)($,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:re,onChange:ie}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=re,t[103]=ie,t[104]=ae):ae=t[104];let oe=!r.enabled||!r.noteEnabled,L;t[105]===i?L=t[106]:(L=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=L);let R;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==oe||t[111]!==L?(R=(0,Q.jsx)($,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:oe,onChange:L}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=oe,t[111]=L,t[112]=R):R=t[112];let z;t[113]!==ae||t[114]!==R?(z=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ae,R]}),t[113]=ae,t[114]=R,t[115]=z):z=t[115];let se;t[116]!==P||t[117]!==I||t[118]!==z?(se=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[P,I,z]}),t[116]=P,t[117]=I,t[118]=z,t[119]=se):se=t[119];let B;t[120]===n.policySiteSection?B=t[121]:(B=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=B);let ce;t[122]===n.policySiteSectionHint?ce=t[123]:(ce=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=ce);let V;t[124]!==B||t[125]!==ce?(V=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[B,ce]}),t[124]=B,t[125]=ce,t[126]=V):V=t[126];let H;t[127]===i?H=t[128]:(H=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=H);let le;t[129]!==r.siteEnabled||t[130]!==H?(le=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:H}),t[129]=r.siteEnabled,t[130]=H,t[131]=le):le=t[131];let ue;t[132]!==n.policySiteEnabled||t[133]!==le?(ue=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[le,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=le,t[134]=ue):ue=t[134];let de=!r.siteEnabled,U;t[135]===i?U=t[136]:(U=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=U);let fe;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==de||t[141]!==U?(fe=(0,Q.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:de,onChange:U}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=de,t[141]=U,t[142]=fe):fe=t[142];let pe=!r.siteEnabled,W;t[143]===i?W=t[144]:(W=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=W);let me;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==pe||t[149]!==W?(me=(0,Q.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:pe,onChange:W}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=pe,t[149]=W,t[150]=me):me=t[150];let G=!r.siteEnabled,K;t[151]===i?K=t[152]:(K=e=>i({maxActiveSites:e}),t[151]=i,t[152]=K);let ge;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==G||t[157]!==K?(ge=(0,Q.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:G,onChange:K}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=G,t[157]=K,t[158]=ge):ge=t[158];let q=!r.siteEnabled,J;t[159]===i?J=t[160]:(J=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=J);let Y;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==q||t[165]!==J?(Y=(0,Q.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:q,onChange:J}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=q,t[165]=J,t[166]=Y):Y=t[166];let _e=!r.siteEnabled,X;t[167]===i?X=t[168]:(X=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=X);let ve;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==_e||t[173]!==X?(ve=(0,Q.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:_e,onChange:X}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=_e,t[173]=X,t[174]=ve):ve=t[174];let Z;t[175]!==fe||t[176]!==me||t[177]!==ge||t[178]!==Y||t[179]!==ve?(Z=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[fe,me,ge,Y,ve]}),t[175]=fe,t[176]=me,t[177]=ge,t[178]=Y,t[179]=ve,t[180]=Z):Z=t[180];let ye;t[181]!==V||t[182]!==ue||t[183]!==Z?(ye=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[V,ue,Z]}),t[181]=V,t[182]=ue,t[183]=Z,t[184]=ye):ye=t[184];let be;return t[185]!==j||t[186]!==se||t[187]!==ye?(be=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[j,se,ye]}),t[185]=j,t[186]=se,t[187]=ye,t[188]=be):be=t[188],be}function $(e){let t=(0,he.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=w(be(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let f;t[4]!==s||t[5]!==o||t[6]!==l?(f=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==f||t[13]!==a?(p=(0,Q.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:f}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=f,t[13]=a,t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=m);let h;return t[17]!==u||t[18]!==p||t[19]!==m?(h=(0,Q.jsxs)(`div`,{children:[u,p,m]}),t[17]=u,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function Ce(e){let t=(0,he.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Q.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=w(be(),`font-mono text-xs`),t[13]=f):f=t[13];let p=i||r.length>=32,m;t[14]===s?m=t[15]:(m=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=m);let h;t[16]!==n.policyMimePlaceholder||t[17]!==p||t[18]!==m?(h=(0,Q.jsx)(`input`,{className:f,placeholder:n.policyMimePlaceholder,disabled:p,onKeyDown:m}),t[16]=n.policyMimePlaceholder,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==h?(g=(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,h]}),t[20]=c,t[21]=l,t[22]=d,t[23]=h,t[24]=g):g=t[24],g}function we(e){let t=(0,he.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:d,selectKind:m,sessionKey:g,agentId:v}=e,b=m===void 0?`any`:m,S=y(x(De)),E=S.workspace,D=S.sharesSettings,O=te(Ee),{data:k}=ee(C(Te)?`picker-agents-list`:null,ie),A;bb0:{let e;t[0]===v?e=t[1]:(e=v?.trim(),t[0]=v,t[1]=e);let n=e;if(n){A=n;break bb0}let r;t[2]===O?r=t[3]:(r=O.trim(),t[2]=O,t[3]=r);let i=r;if(i){A=i;break bb0}if(k?.defaultId){A=k.defaultId;break bb0}if(k?.agents?.[0]?.id){A=k.agents[0].id;break bb0}A=``}let j=A,[N,F]=(0,G.useState)(j),I,re;t[4]===j?(I=t[5],re=t[6]):(I=()=>{F(j)},re=[j],t[4]=j,t[5]=I,t[6]=re),(0,G.useEffect)(I,re);let{tree:oe,loading:L,error:R,loadRoot:z,loadChildren:se,reset:B}=le(N,g??null),ce;t[7]===d?ce=t[8]:(ce=d?{path:d,isDirectory:!1}:null,t[7]=d,t[8]=ce);let[V,H]=(0,G.useState)(ce),ue;t[9]!==d||t[10]!==z||t[11]!==n||t[12]!==B||t[13]!==H?(ue=()=>{if(!n){B(),H(d?{path:d,isDirectory:!1}:null);return}z()},t[9]=d,t[10]=z,t[11]=n,t[12]=B,t[13]=H,t[14]=ue):ue=t[14];let de;t[15]!==d||t[16]!==z||t[17]!==n||t[18]!==N||t[19]!==B||t[20]!==g?(de=[n,N,g,z,B,d],t[15]=d,t[16]=z,t[17]=n,t[18]=N,t[19]=B,t[20]=g,t[21]=de):de=t[21],(0,G.useEffect)(ue,de);let U;t[22]===se?U=t[23]:(U=e=>{se(e)},t[22]=se,t[23]=U);let fe=U,pe=V!==null&&(b===`any`||b===`file`&&!V.isDirectory||b===`directory`&&V.isDirectory),W;bb1:{if(!V){W=D.pickerHintNone;break bb1}if(b===`file`&&V.isDirectory){W=D.pickerHintNeedsFile;break bb1}if(b===`directory`&&!V.isDirectory){W=D.pickerHintNeedsDirectory;break bb1}W=`${V.isDirectory?`📁`:`📄`} ${V.path}`}let me=W,K=k?.agents??[],ge;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Q.jsx)(a,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=ge):ge=t[24];let q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(q=w(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=q):q=t[25];let J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(ae,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=J):J=t[26];let Y=S.cron.refresh,_e=S.cron.refresh,X;t[27]===z?X=t[28]:(X=()=>void z(),t[27]=z,t[28]=X);let ve=L&&`animate-spin`,Z;t[29]===ve?Z=t[30]:(Z=w(`size-4`,ve),t[29]=ve,t[30]=Z);let ye;t[31]===Z?ye=t[32]:(ye=(0,Q.jsx)(ne,{className:Z,"aria-hidden":!0}),t[31]=Z,t[32]=ye);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(_,{className:`size-4`}),t[33]=be):be=t[33];let xe;t[34]!==R||t[35]!==E.loadError?(xe=R?(0,Q.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[E.loadError,`: `,R]}):null,t[34]=R,t[35]=E.loadError,t[36]=xe):xe=t[36];let Se;t[37]!==fe||t[38]!==L||t[39]!==V?.path||t[40]!==H||t[41]!==E.emptyDir||t[42]!==E.title||t[43]!==oe?(Se=L&&oe.length===0?(0,Q.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(h,{className:`size-4 animate-spin`}),E.title,`…`]}):(0,Q.jsx)(M,{tree:oe,selectedPath:V?.path??null,onSelectFile:e=>H({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>H({path:e,isDirectory:t}),onExpandDir:fe,onAction:void 0,emptyHint:E.emptyDir}),t[37]=fe,t[38]=L,t[39]=V?.path,t[40]=H,t[41]=E.emptyDir,t[42]=E.title,t[43]=oe,t[44]=Se):Se=t[44];let $;t[45]!==xe||t[46]!==Se?($=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[xe,Se]}),t[45]=xe,t[46]=Se,t[47]=$):$=t[47];let Ce;t[48]===me?Ce=t[49]:(Ce=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:me}),t[48]=me,t[49]=Ce);let we;t[50]===r?we=t[51]:(we=()=>r(!1),t[50]=r,t[51]=we);let Oe;t[52]!==D.cancel||t[53]!==we?(Oe=(0,Q.jsx)(T,{type:`button`,variant:`ghost`,onClick:we,children:D.cancel}),t[52]=D.cancel,t[53]=we,t[54]=Oe):Oe=t[54];let ke=!pe,Ae;t[55]!==i||t[56]!==r||t[57]!==N||t[58]!==V?(Ae=()=>{V&&(i({...V,agentId:N}),r(!1))},t[55]=i,t[56]=r,t[57]=N,t[58]=V,t[59]=Ae):Ae=t[59];let je;t[60]!==D.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Q.jsx)(T,{type:`button`,disabled:ke,onClick:Ae,children:D.pickerConfirm}),t[60]=D.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ce||t[68]!==Me?(Ne=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ce,Me]}),t[67]=Ce,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Q.jsx)(u,{open:n,onOpenChange:r,children:(0,Q.jsxs)(s,{children:[ge,(0,Q.jsxs)(c,{className:q,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[J,(0,Q.jsx)(l,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:D.pickerTitle}),(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:Y,"aria-label":_e,disabled:L,onClick:X,children:ye}),(0,Q.jsx)(o,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":E.close,children:be})})]}),K.length>0?(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Q.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:D.pickerAgentLabel}),(0,Q.jsx)(f,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:N,onChange:e=>{F(e.target.value),H(null)},children:K.map(e=>(0,Q.jsxs)(p,{value:e.id,children:[P(e,S.agentsSettings),e.id===k?.defaultId?` ★`:``]},e.id))})]}):null,$,Ne]})]})})}function Te(e){return e.token}function Ee(e){return e.agentId}function De(e){return e.language}var Oe=[`shares`,`policy`];function ke(e){let t=(e??``).trim();return Oe.includes(t)?t:`shares`}function Ae(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function je(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var Me=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function Ne(){let e=(0,he.c)(24),t=x(Fe),n=y(t).sharesSettings,r=!!C(Pe),[a,o]=i(),s;e[0]===a?s=e[1]:(s=ke(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,Q.jsx)(U,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=Oe.map(e=>({id:e,label:d[e]})),p;e[4]!==n.subtitle||e[5]!==n.title?(p=(0,Q.jsx)(de,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=p):p=e[6];let m;e[7]!==c||e[8]!==u||e[9]!==n.tabsAria||e[10]!==f?(m=(0,Q.jsx)(me,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=c,e[8]=u,e[9]=n.tabsAria,e[10]=f,e[11]=m):m=e[11];let h;e[12]!==c||e[13]!==r||e[14]!==t||e[15]!==n?(h=c===`shares`?(0,Q.jsx)(Ie,{t:n,language:t}):(0,Q.jsx)(xe,{hasToken:r}),e[12]=c,e[13]=r,e[14]=t,e[15]=n,e[16]=h):h=e[16];let g;e[17]!==c||e[18]!==h?(g=(0,Q.jsx)(fe,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[17]=c,e[18]=h,e[19]=g):g=e[19];let _;return e[20]!==p||e[21]!==m||e[22]!==g?(_=(0,Q.jsxs)(U,{children:[p,m,g]}),e[20]=p,e[21]=m,e[22]=g,e[23]=_):_=e[23],_}function Pe(e){return e.token}function Fe(e){return e.language}function Ie(e){let t=(0,he.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=ee(`shares-list`,B,i),l;t[1]===a?.payload?.shares?l=t[2]:(l=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=l);let u=l,[d,f]=(0,G.useState)(!1),p;bb0:{if(d){p=u;break bb0}let e;t[3]===u?e=t[4]:(e=u.filter(Ve),t[3]=u,t[4]=e),p=e}let m=p,h;t[5]===u?h=t[6]:(h=u.filter(Be),t[5]=u,t[6]=h);let g=h.length,_;t[7]===u?_=t[8]:(_=u.filter(ze),t[7]=u,t[8]=_);let v=_.length,y;t[9]===c?y=t[10]:(y=()=>void c(),t[9]=c,t[10]=y);let b;t[11]!==n||t[12]!==y?(b=(0,Q.jsx)(Ue,{t:n,onCreated:y}),t[11]=n,t[12]=y,t[13]=b):b=t[13];let x=d?n.allSharesTitle:n.listTitle,S;t[14]===g?S=t[15]:(S=g>0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,g,`)`]}),t[14]=g,t[15]=S);let C;t[16]!==x||t[17]!==S?(C=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[x,S]}),t[16]=x,t[17]=S,t[18]=C):C=t[18];let E;t[19]===c?E=t[20]:(E=()=>void c(),t[19]=c,t[20]=E);let D=s&&`animate-spin`,O;t[21]===D?O=t[22]:(O=w(`size-3.5`,D),t[21]=D,t[22]=O);let te;t[23]===O?te=t[24]:(te=(0,Q.jsx)(ne,{className:O}),t[23]=O,t[24]=te);let k;t[25]!==s||t[26]!==E||t[27]!==te?(k=(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:E,disabled:s,children:te}),t[25]=s,t[26]=E,t[27]=te,t[28]=k):k=t[28];let A;t[29]!==v||t[30]!==d||t[31]!==n.hideExpired||t[32]!==n.showExpired?(A=v>0&&(0,Q.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>f(Re),children:d?n.hideExpired:n.showExpired}),t[29]=v,t[30]=d,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=A):A=t[33];let j;t[34]!==k||t[35]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[k,A]}),t[34]=k,t[35]=A,t[36]=j):j=t[36];let M;t[37]!==C||t[38]!==j?(M=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[C,j]}),t[37]=C,t[38]=j,t[39]=M):M=t[39];let N;t[40]!==a||t[41]!==o||t[42]!==m||t[43]!==s||t[44]!==r||t[45]!==c||t[46]!==n?(N=s&&!a?(0,Q.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Le)}):o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Q.jsx)(`span`,{children:n.error}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):m.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:m.map(e=>(0,Q.jsx)(Ge,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[40]=a,t[41]=o,t[42]=m,t[43]=s,t[44]=r,t[45]=c,t[46]=n,t[47]=N):N=t[47];let P;t[48]!==v||t[49]!==c||t[50]!==d||t[51]!==n?(P=v>0&&d&&(0,Q.jsx)(Ke,{t:n,onCleaned:()=>void c()}),t[48]=v,t[49]=c,t[50]=d,t[51]=n,t[52]=P):P=t[52];let F;t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,Q.jsxs)(W,{children:[M,N,P]}),t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;return t[57]!==F||t[58]!==b?(I=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[b,F]}),t[57]=F,t[58]=b,t[59]=I):I=t[59],I}function Le(e,t){return(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(O,{className:`h-4 w-2/3`}),(0,Q.jsx)(O,{className:`mt-2 h-3 w-1/2`})]}),(0,Q.jsx)(O,{className:`h-7 w-20 rounded-md`})]})},t)}function Re(e){return!e}function ze(e){return e.expired||e.revoked}function Be(e){return!e.expired&&!e.revoked}function Ve(e){return!e.expired&&!e.revoked}var He={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function Ue({t:e,onCreated:t}){let[n,r]=(0,G.useReducer)(V,He),{expanded:i,path:a,isDirectory:o,agentId:s,ttlMs:c,maxViews:l,description:u,directoryMode:d,creating:m,result:_,errorMsg:v,resultDialogOpen:y,pickerOpen:b}=n,x=(0,G.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await oe({path:a.trim(),ttlMs:c,maxViews:l,description:u.trim()||void 0,...s?{agentId:s}:{},...o?{kind:`directory`,directoryMode:d}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,o,s,c,l,u,d,t]),S=(0,G.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Q.jsxs)(W,{children:[(0,Q.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:w(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,children:o?`📁`:`📄`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Q.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Q.jsxs)(T,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Q.jsx)(I,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),o?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Q.jsxs)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:d,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Q.jsx)(p,{value:`browse`,children:e.directoryModeBrowse}),(0,Q.jsx)(p,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Q.jsx)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:c,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Me.map(t=>(0,Q.jsx)(p,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Q.jsxs)(f,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:l??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Q.jsx)(p,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Q.jsx)(p,{value:`1`,children:`1`}),(0,Q.jsx)(p,{value:`5`,children:`5`}),(0,Q.jsx)(p,{value:`10`,children:`10`}),(0,Q.jsx)(p,{value:`50`,children:`50`}),(0,Q.jsx)(p,{value:`100`,children:`100`})]})]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Q.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:u,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Q.jsxs)(T,{type:`button`,disabled:m||!a.trim(),onClick:()=>void x(),children:[m?(0,Q.jsx)(h,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),m?e.creating:e.createButton]}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,onClick:()=>{S(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),v&&(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v})]}),(0,Q.jsx)(z,{open:y,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:_}),(0,Q.jsx)(we,{open:b,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Q.jsxs)(T,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Q.jsx)(g,{className:`size-4`}),e.createTitle]})}var We={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function Ge({share:e,t,language:n,onRevoked:r,onExtended:i}){let[a,o]=(0,G.useReducer)(V,We),{revokeOpen:s,revoking:c,linksOpen:l,urlCopied:u,copyFailed:f,extending:p}=a,g=!e.expired&&!e.revoked,_=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,y=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,b=(0,G.useCallback)(async()=>{o({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await H(e.id),r()}catch{}finally{o({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),x=(0,G.useCallback)(async()=>{if(o({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await v(e.shareUrl)){o({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{copyFailed:!1}}),2500);return}o({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),S=(0,G.useCallback)(async()=>{o({type:`patch`,patch:{extending:!0}});try{await F(e.id,864e5),i()}catch{}finally{o({type:`patch`,patch:{extending:!1}})}},[e.id,i]),C=`share-links-${e.id}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:w(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":l,"aria-controls":C,onClick:()=>o({type:`patch`,patch:{linksOpen:!l}}),children:[(0,Q.jsx)(N,{className:w(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,l?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,Q.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):e.kind===`session`?(0,Q.jsx)(L,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Q.jsx)(I,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:w(`text-xs font-medium`,y),children:_})]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.kind===`session`?n===`zh`?`会话快照 · ${e.messageCount??0} 条消息 · 版本 ${e.snapshotRevision??1}`:`Conversation snapshot · ${e.messageCount??0} messages · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Ae(e.fileSize)}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(A,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:je(e.expiresAt,n)]}),(0,Q.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Q.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:g&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void x(),children:u?(0,Q.jsx)(d,{className:`size-3.5 text-emerald-500`}):(0,Q.jsx)(m,{className:`size-3.5`})}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void S(),disabled:p,title:t.extend,children:p?(0,Q.jsx)(h,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(A,{className:`size-3.5`})}),(0,Q.jsx)(T,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>o({type:`patch`,patch:{revokeOpen:!0}}),disabled:c,children:c?(0,Q.jsx)(h,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(R,{className:`size-3.5`})})]})})]}),g&&l?(0,Q.jsxs)(`div`,{id:C,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Q.jsx)(ue,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),f?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(re,{reachability:e.reachability})})]}):null]}),(0,Q.jsx)(k,{open:s,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void b(),onCancel:()=>o({type:`patch`,patch:{revokeOpen:!1}})})]})}function Ke({t:e,onCleaned:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(!1),o=(0,G.useCallback)(async()=>{r(!1),a(!0);try{await ce(),t()}catch{}finally{a(!1)}},[t]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(T,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Q.jsx)(h,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(R,{className:`size-3.5`}),e.cleanExpired]})}),(0,Q.jsx)(k,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Ne as SharesSettingsPanel};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{i as t,r as n}from"./locale-store-B2v8mNJw.js";import{in as r}from"./index-BBlJYVxR.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{d as a,l as o,p as s,t as c}from"./chunk-KS7C4IRE-BaASWQor.js";import{i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CpzYSoz7.js";import{n as h,r as g}from"./popover-select-C-Hj-nXR.js";import{t as _}from"./circle-check-C23XjkUj.js";import{t as v}from"./external-link-DjqjBmc3.js";import{d as ee,p as te,t as ne}from"./markdown-view-DBWu9d_n.js";import{t as re}from"./x-B_N4OPjy.js";import{n as ie,s as y}from"./locale-store-B2v8mNJw.js";import{t as b}from"./cn-JdwAhgNB.js";import{t as x}from"./button-CtTvuElV.js";import{t as S}from"./skeleton-BwbyijEw.js";import{Bl as ae,Di as C,Hn as oe,Jo as w,Ki as se,Ko as ce,Lt as T,N as le,Qo as ue,Qr as E,Tr as de,Va as fe,Yo as pe,Zr as me,dn as D,ds as he,fn as O,fs as ge,gl as k,gn as _e,ha as ve,hl as ye,hn as A,kc as j,ls as M,mn as N,ms as P,n as F,pc as I,pn as be,ps as xe,pu as Se,rs as Ce,ss as we,wl as Te,yc as Ee,zl as De}from"./index-BBlJYVxR.js";import{t as Oe}from"./date-picker-BuEyUxZn.js";import{t as ke}from"./dependency-picker-l6IXzk0C.js";var L=e(t(),1),Ae=e(n(),1),R=r();function je(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Me(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var z=i();function Ne(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Pe(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,z.jsx)(S,{className:`h-32 rounded-2xl`}),(0,z.jsx)(S,{className:`h-52 rounded-2xl`}),(0,z.jsx)(S,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Fe(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ie(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var B=[`backlog`,`ready`,`active`,`review`,`closed`],V=[`low`,`normal`,`high`,`critical`],Le=(0,L.memo)(function(e){let t=(0,R.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,z.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=B.map(e=>(0,z.jsx)(g,{value:e,disabled:d(e),children:Ne(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let _;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(_=(0,z.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==_?(v=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,_]}),t[17]=f,t[18]=_,t[19]=v):v=t[19],v}),Re=(0,L.memo)(function(e){let t=(0,R.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=V.map(e=>(0,z.jsx)(g,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,z.jsx)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),ze=(0,L.memo)(function(e){let t=(0,R.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,z.jsx)(Oe,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Be=(0,L.memo)(function(e){let t=(0,R.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let l;t[2]===s?l=t[3]:(l=e=>s(e.target.value),t[2]=s,t[3]=l);let u;t[4]===a?u=t[5]:(u=(0,z.jsx)(g,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=u);let d;t[6]===o?d=t[7]:(d=o.map(rt),t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==n?(f=(0,z.jsxs)(h,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:l,children:[u,d]}),t[8]=r,t[9]=l,t[10]=u,t[11]=d,t[12]=n,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}),Ve=(0,L.memo)(function(e){let t=(0,R.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(it),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,z.jsx)(ke,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),He=`xopc.taskDetail.chatPanelPercent`,Ue=42;function We(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ue:Math.min(r,Math.max(n,e))}function Ge(){try{let e=Number(window.localStorage.getItem(He));return Number.isFinite(e)&&e>=30&&e<=60?e:Ue}catch{return Ue}}function Ke(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,R.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,z.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,z.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,z.jsx)(t===`passed`?_:t===`failed`?ae:De,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,z.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,z.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function qe({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=s(),a=o(),l=ie(e=>e.language),u=y(e=>e.token),d=(0,L.useMemo)(()=>P(l),[l]),f=fe(e=>e.setPageHeader),p=fe(e=>e.clearPageHeader),m=E(e=>e.open),h=E(e=>e.sessionKeyOverride),g=E(e=>e.openForSession),re=oe(e=>e.setOpen),{data:S,error:ae,mutate:T,lastChange:me,conversationLoading:De,conversationError:Oe}=ce(e),[ke,R]=(0,L.useState)(null),[Ne,B]=(0,L.useState)(null),[V,qe]=(0,L.useState)(()=>new Set),[Je,Ye]=(0,L.useState)([]),[U,Xe]=(0,L.useState)(null),[Ze,Qe]=(0,L.useState)([]),[$e,W]=(0,L.useState)(!1),[et,tt]=(0,L.useState)(``),[nt,G]=(0,L.useState)(!1),[rt,it]=(0,L.useState)(``),[at,ot]=(0,L.useState)(Ge),[st,ct]=(0,L.useState)(!1),lt=(0,L.useRef)(null),ut=(0,L.useRef)(!1),dt=(0,L.useRef)(!1),ft=(0,L.useRef)(``),pt=(0,L.useRef)(null),mt=(0,L.useRef)(null),ht=(0,L.useRef)(null),gt=(0,L.useRef)(S),[_t,K]=(0,L.useState)(null),[vt,yt]=(0,L.useState)(null),[bt,xt]=(0,L.useState)(!1),St=(0,L.useMemo)(()=>({link:d.linkDependencies,linked:d.linkedDependencies,searchPlaceholder:d.dependencySearchPlaceholder,noMatches:d.noDependencyMatches,noCandidates:d.noDependencyCandidates,remove:d.removeDependency}),[d.dependencySearchPlaceholder,d.linkDependencies,d.linkedDependencies,d.noDependencyCandidates,d.noDependencyMatches,d.removeDependency]),Ct=S?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,wt=(0,L.useMemo)(()=>ee(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);gt.current=S;let q=(0,L.useCallback)((e,t)=>{qe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,L.useEffect)(()=>{B(null),K(null),W(!1),G(!1),yt(null),xt(!1)},[e]),(0,L.useEffect)(()=>{let e=!0;return ve().then(t=>{e&&Qe(t.items)}).catch(()=>void 0),()=>{e=!1}},[u]),(0,L.useEffect)(()=>{if(!me||me.source===`user`)return;yt(me);let e=window.setTimeout(()=>yt(null),3500);return()=>window.clearTimeout(e)},[me]),(0,L.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){ht.current=null,Xe(null),Ye(n);return}ht.current!==t&&(ht.current=t,Xe(null));let r=!0;return se(t).then(t=>{if(!r)return;Xe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ye([...i.values()])}).catch(()=>{r&&Ye(n)}),()=>{r=!1}},[Ct,S?.task.projectId,e]);let J=(0,L.useCallback)(async(t,n=`command`)=>{let r=gt.current;if(r){q(n,!0),B(null);try{await T(await pe(e,t,r.task.version),{revalidate:!1})}catch{B(d.actionFailed)}finally{q(n,!1)}}},[d.actionFailed,T,q,e]),Y=(0,L.useCallback)(async(t,n)=>{let r=gt.current;if(!r)return!1;n&&q(n,!0),B(null);try{return await T(M(e,t,r.task.version),{optimisticData:Me(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return B(d.actionFailed),!1}finally{n&&q(n,!1)}},[d.actionFailed,T,q,e]),Tt=async()=>{if(!S)return;if(ut.current){ut.current=!1;return}let e=et.trim(),t=pt.current;if(je(t,S.task.version,S.task.title,e)){K(`title`);return}if(!e||e===S.task.title){tt(S.task.title),W(!1);return}await Y({title:e})&&(K(null),W(!1))},Et=async()=>{if(!S)return;if(dt.current){dt.current=!1;return}let e=rt.trim(),t=mt.current;if(je(t,S.task.version,S.task.body??``,e)){K(`description`);return}if(rt===ft.current||e===(S.task.body??``).trim()){G(!1);return}await Y({body:e||null})&&(K(null),G(!1))},Dt=(0,L.useCallback)(async e=>{let t=gt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),Ot=(0,L.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),kt=(0,L.useCallback)(e=>{Y({dueAt:Ie(e)},`dueAt`)},[Y]),At=(0,L.useCallback)(e=>{ot(e);try{window.localStorage.setItem(He,String(e))}catch{}},[]),jt=(0,L.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=lt.current?.clientWidth??0;At(We(e.key===`Home`?Ue:at+(e.key===`ArrowLeft`?2:-2),t))},[at,At]),Mt=(0,L.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=lt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),ct(!0);let i=at,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=We((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}ct(!1),At(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[at,At]),Nt=(0,L.useCallback)(async t=>{let n=gt.current;if(n){q(`dependencies`,!0),B(null);try{await T(await he(e,t,n.task.version),{revalidate:!1})}catch{B(d.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[d.dependencyUpdateFailed,T,q,e]),Pt=(0,L.useCallback)(async t=>{let n=gt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),B(null);try{await T(await Ce(e,t,n.task.version),{revalidate:!1})}catch{B(d.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[d.actionFailed,T,q,e]),Ft=(0,L.useCallback)(async()=>{q(`delete`,!0),B(null);try{await ue(e),r?r():a(wt,{replace:!0})}catch(e){B(e instanceof Error?e.message:d.actionFailed)}finally{q(`delete`,!1)}},[d.actionFailed,a,r,wt,q,e]);if((0,L.useLayoutEffect)(()=>{if(t!==`modal`)return f({startExtra:(0,z.jsx)(c,{to:wt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":d.backToWork,children:(0,z.jsx)(Se,{className:`size-4`})}),main:S?(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${d.taskLabel}`:d.taskLabel}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:d.detailStatuses[Ke(S)]})]}):null,end:(0,z.jsx)(`div`,{ref:R,className:`flex min-w-0 items-center justify-end`})}),p},[p,d.backToWork,d.detailStatuses,d.taskLabel,S,t,U,wt,f]),ae&&!S)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:d.taskNotFound});if(!S)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,z.jsx)(Pe,{})});let It=S.waits[0],Lt=It?.kind===`paused`?It:void 0,X=S.receipts[0],Rt=d.detailStatuses[Ke(S)],zt=d.detailStatusDescriptions[Ke(S)],Bt=S.task.body?.trim()||S.task.contract?.objective.trim(),Vt=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),Ht=S.allowedCommands.includes(`mark_ready`),Ut=S.allowedCommands.includes(`start`),Wt=S.allowedCommands.includes(`add_wait`),Gt=S.task.phase===`review`&&S.allowedCommands.includes(`close`),Kt=S.allowedCommands.includes(`reopen`),Z=S.conversation.activeSessionKey,qt=S.conversation.currentExecutorAgentId??S.task.delegateAgentId??S.task.ownerId,Jt=Ze.find(e=>e.id===qt),Yt=!!(Z&&m&&h===Z),Xt=S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Zt=S.task.contract?.acceptanceCriteria??[],Qt=Zt.filter(e=>Vt.get(e)===`passed`).length,$t=S.task.contract?.expectedOutputs??[],en=S.task.contract?.constraints??[],tn=S.task.contract?.approvalRequired??[],nn=S.task.contract?.assumptions??[],rn=S.task.contract?.risks??[],Q=(...e)=>!!vt?.changedFields.some(t=>e.includes(t)),an=e=>t===`modal`&&n?xe(n,e):te(`/tasks/${e}`,wt),on=S.allowedCommands.includes(`move`),$=V.has(`command`),sn=V.has(`delete`),cn=S.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),ln=cn!==void 0,un=(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ht?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,z.jsx)(I,{className:`size-4`}),d.scheduleTask]}):null,Lt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Lt.id}),children:[(0,z.jsx)(I,{className:`size-4`}),d.resumeTask]}):null,!It&&Ut&&qt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:qt}}),children:[(0,z.jsx)(I,{className:`size-4`}),d.runTask]}):null,Gt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,z.jsx)(_,{className:`size-4`}),d.approveTask]}):null,Kt?(0,z.jsxs)(x,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,z.jsx)(I,{className:`size-4`}),d.reopenTask]}):null,!It&&Wt?(0,z.jsxs)(x,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,z.jsx)(Ee,{className:`size-4`}),d.pauseTask]}):null,(0,z.jsxs)(N,{children:[(0,z.jsx)(_e,{asChild:!0,children:(0,z.jsx)(x,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||sn,"aria-label":d.moreActions,children:(0,z.jsx)(Te,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(be,{children:(0,z.jsxs)(D,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[cn?(0,z.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{q(`command`,!0),B(null),T(w(e,cn.id,cn.version),{revalidate:!1}).catch(()=>B(d.actionFailed)).finally(()=>q(`command`,!1))},children:d.cancelActiveRun}):null,cn?(0,z.jsx)(A,{className:`my-1 h-px bg-edge`}):null,S.task.phase===`closed`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:d.cancelTask}),(0,z.jsx)(A,{className:`my-1 h-px bg-edge`})]}),(0,z.jsx)(O,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(ln){B(d.deleteActiveTaskBlocked);return}xt(!0)},children:d.deleteTask})]})})]})]}),Z&&t!==`modal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(x,{type:`button`,variant:`ghost`,className:b(`h-8 shrink-0 px-2 text-xs`,Yt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Yt,onClick:()=>{re(Z,!1),g(Z)},children:[(0,z.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,z.jsx)(x,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,z.jsxs)(c,{to:ge(e),children:[(0,z.jsx)(v,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,z.jsxs)(`div`,{ref:lt,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${st?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${at}%`},children:[t===`page`&&ke?(0,Ae.createPortal)(un,ke):null,(0,z.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,z.jsxs)(`header`,{className:b(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,z.jsx)(`span`,{children:`/`}),(0,z.jsx)(`span`,{children:d.taskLabel}),vt?(0,z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:vt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),$e?(0,z.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:et,onChange:e=>tt(e.target.value),onBlur:()=>void Tt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ut.current=!0,tt(S.task.title),W(!1),queueMicrotask(()=>{ut.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,z.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{pt.current={value:S.task.title,version:S.task.version},K(null),tt(S.task.title),W(!0)},children:(0,z.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:S.task.title})}),_t===`title`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{tt(S.task.title),K(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:et.trim()}).then(e=>{e&&(K(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),Ne?(0,z.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:Ne}):null]}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,z.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDescription}),nt?(0,z.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:rt,onChange:e=>it(e.target.value),onBlur:()=>void Et(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),dt.current=!0,it(S.task.body??S.task.contract?.objective??``),G(!1),queueMicrotask(()=>{dt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,z.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=S.task.body??S.task.contract?.objective??``;ft.current=e,mt.current={value:S.task.body??``,version:S.task.version},K(null),it(e),G(!0)},children:(0,z.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Bt&&Bt!==S.task.title?Bt:d.noTaskDescription})}),_t===`description`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{it(S.task.body??``),K(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:rt.trim()||null}).then(e=>{e&&(K(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),S.attention.length>0?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h3`,{className:`font-medium text-fg`,children:Xt?d.needsAttention:d.waitingStatus}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:S.attention.map((e,t)=>(0,z.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDefinition}),(0,z.jsxs)(`div`,{className:`mt-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.successDefinition}),Zt.length>0?(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:d.criteriaProgress.replace(`{{verified}}`,String(Qt)).replace(`{{total}}`,String(Zt.length))}):null]}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Zt,empty:d.noDefinition,verificationByCriterion:Vt})})]}),$t.length>0?(0,z.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.expectedOutputs}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:$t,empty:d.noDefinition})})]}):null,en.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.constraints}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:en,empty:d.noDefinition})})]}):null,tn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.approvalRequired}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:tn,empty:d.noDefinition})})]}):null,nn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextAssumptions}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:nn,empty:d.noDefinition})})]}):null,rn.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextRisks}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:rn,empty:d.noDefinition})})]}):null]}),X?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.latestResult}),(0,z.jsx)(ne,{content:X.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,z.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[d.receiptStatuses[X.status],` · `,d.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:d.remainingWork}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(H,{items:X.remainingWork,empty:d.noRemainingWork})})]}):null,X.nextAction?(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.nextAction}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(x,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void we(X.runId,`helpful`),children:d.doneWell}),(0,z.jsx)(x,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void we(X.runId,`not_helpful`),children:d.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,z.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,z.jsx)(v,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),S.receipts.length>1?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:d.executionHistory.replace(`{{count}}`,String(S.receipts.length-1))}),(0,z.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.receipts.slice(1).map(e=>(0,z.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:d.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,S.context.length>0?(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.contextUsed}),(0,z.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:S.context.map(e=>(0,z.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[d.contextRoleLabels[e.role],` · `,d.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,z.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,z.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,z.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskProperties}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,z.jsx)(Le,{value:S.task.phase,disabled:V.has(`phase`),canMove:on,canApprove:Gt,canReopen:Kt,language:l,label:d.taskPhase,onChange:Dt}),(0,z.jsx)(Re,{value:S.task.priority,disabled:V.has(`priority`),label:d.priority,labels:d.priorityLabels,onChange:Ot}),(0,z.jsx)(ze,{value:Fe(S.task.dueAt),disabled:V.has(`dueAt`),label:d.dueDate,onChange:kt}),(0,z.jsx)(Be,{value:S.conversation.currentExecutorAgentId??``,disabled:V.has(`delegateAgentId`),label:d.executorLabel,unassignedLabel:d.unassigned,agents:Ze,onChange:Pt}),U?(0,z.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:d.projectLabel}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,z.jsx)(k,{className:`size-3.5`}),U]})]}):null]}),(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,z.jsx)(`p`,{children:Rt}),(0,z.jsx)(`p`,{children:zt}),(0,z.jsx)(`p`,{className:`mt-2`,children:d.updatedAt.replace(`{{date}}`,de(S.task.updatedAt,l))})]})]}),(0,z.jsxs)(`section`,{className:b(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskRelations}),(0,z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependencies}),(0,z.jsx)(Ve,{candidates:Je,selected:S.dependencies,disabled:V.has(`dependencies`),labels:St,onChange:Nt})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependents}),S.dependents.length>0?(0,z.jsx)(`div`,{className:`space-y-1.5`,children:S.dependents.map(e=>(0,z.jsx)(c,{to:an(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,z.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:d.noDependents})]})]})]})]})]})]}),(0,z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(at),tabIndex:0,onPointerDown:Mt,onKeyDown:jt,onDoubleClick:()=>At(Ue),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${st?`bg-surface-hover`:``}`,children:(0,z.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,z.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[qt?(0,z.jsx)(le,{agentId:qt,avatar:Jt?.avatar,size:28,className:`shrink-0`}):null,(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Jt?.name??qt??d.unassigned,` · `,Rt]})]})]})}),t===`modal`?un:null]}),Z?(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(F,{embedded:!0,sessionKey:Z,taskId:e})}):De?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(j,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):Oe?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(j,{className:`mx-auto size-8 text-danger`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:Oe instanceof Error?Oe.message:String(Oe)})]})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(j,{className:`mx-auto size-8 text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,z.jsx)(C,{open:bt,title:d.deleteTaskTitle,description:d.deleteTaskDescription.replace(`{{title}}`,S.task.title),confirmLabel:d.confirmDeleteTask,cancelLabel:d.keepTask,destructive:!0,onConfirm:()=>{xt(!1),Ft()},onCancel:()=>xt(!1)})]})}function Je(){let e=(0,R.c)(2),{taskId:t}=a(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,z.jsx)(qe,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ye(e){let t=(0,R.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=ie(G),{data:o}=ce(n),s=o?.conversation.activeSessionKey??null,h=E(nt),g=E(tt),_=E(et),ee=E(W),te=oe($e),ne=me(Qe),y=me(Ze),x=h?g:0,S;t[0]!==i||t[1]!==y?(S=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=S):S=t[2];let ae=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==y?(C=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=C):C=t[5];let w;t[6]!==ae||t[7]!==C?(w=(0,z.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":ae,onClick:C}),t[6]=ae,t[7]=C,t[8]=w):w=t[8];let se=h?`true`:`false`,le=`${x/2}px`,ue=`${x}px`,de;t[9]!==le||t[10]!==ue?(de={"--task-detail-workspace-offset":le,"--task-detail-workspace-width":ue},t[9]=le,t[10]=ue,t[11]=de):de=t[11];let fe=de,pe=a===`zh`?`任务详情`:`Task details`,D;t[12]===pe?D=t[13]:(D=(0,z.jsx)(p,{className:`font-medium text-fg`,children:pe}),t[12]=pe,t[13]=D);let he=a===`zh`?`查看并操作任务详情`:`View and manage task details`,O;t[14]===he?O=t[15]:(O=(0,z.jsx)(l,{className:`sr-only`,children:he}),t[14]=he,t[15]=O);let k;t[16]!==s||t[17]!==a||t[18]!==ee||t[19]!==te||t[20]!==n||t[21]!==h||t[22]!==_?(k=s?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:b(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,h&&_===s&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":h&&_===s,onClick:()=>{te(s,!1),ee(s)},children:(0,z.jsx)(ye,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(c,{to:ge(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,z.jsx)(v,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=s,t[17]=a,t[18]=ee,t[19]=te,t[20]=n,t[21]=h,t[22]=_,t[23]=k):k=t[23];let _e=a===`zh`?`关闭任务详情`:`Close task details`,ve;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,z.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[24]=ve):ve=t[24];let A;t[25]===_e?A=t[26]:(A=(0,z.jsx)(u,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":_e,children:ve}),t[25]=_e,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==D||t[31]!==O||t[32]!==j?(M=(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[D,O,j]}),t[30]=D,t[31]=O,t[32]=j,t[33]=M):M=t[33];let N;t[34]!==i||t[35]!==y?(N=()=>{y(null),i()},t[34]=i,t[35]=y,t[36]=N):N=t[36];let P;t[37]!==r||t[38]!==N||t[39]!==n?(P=(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,z.jsx)(qe,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:N})}),t[37]=r,t[38]=N,t[39]=n,t[40]=P):P=t[40];let F;t[41]!==M||t[42]!==P||t[43]!==se||t[44]!==fe?(F=(0,z.jsxs)(f,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":se,style:fe,onEscapeKeyDown:Xe,onInteractOutside:U,children:[M,P]}),t[41]=M,t[42]=P,t[43]=se,t[44]=fe,t[45]=F):F=t[45];let I;t[46]!==ne||t[47]!==h||t[48]!==g||t[49]!==_?(I=ne?(0,z.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:h?g:0},children:(0,z.jsx)(T,{allowOutsideChat:!0,sessionKey:_??void 0})}):null,t[46]=ne,t[47]=h,t[48]=g,t[49]=_,t[50]=I):I=t[50];let be;t[51]!==F||t[52]!==I||t[53]!==w?(be=(0,z.jsxs)(d,{children:[w,F,I]}),t[51]=F,t[52]=I,t[53]=w,t[54]=be):be=t[54];let xe;return t[55]!==S||t[56]!==be?(xe=(0,z.jsx)(m,{modal:!1,open:!0,onOpenChange:S,children:be}),t[55]=S,t[56]=be,t[57]=xe):xe=t[57],xe}function U(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Xe(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ze(e){return e.setPath}function Qe(e){return e.path}function $e(e){return e.setOpen}function W(e){return e.openForSession}function et(e){return e.sessionKeyOverride}function tt(e){return e.widthPx}function nt(e){return e.open}function G(e){return e.language}function rt(e){return(0,z.jsx)(g,{value:e.id,children:e.name||e.id},e.id)}function it(e){return e.id}export{Ye as TaskDetailModal,Je as TaskDetailPage};
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./dist-CpzYSoz7.js";import{t as d}from"./check-DUBLcKHA.js";import{n as f,r as p}from"./popover-select-C-Hj-nXR.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./x-B_N4OPjy.js";import{n as g}from"./locale-store-B2v8mNJw.js";import{i as _}from"./vendor-swr-BIWyz7Rc.js";import{t as v}from"./button-CtTvuElV.js";import{t as y}from"./skeleton-BwbyijEw.js";import{$ as b,$l as x,Al as S,Cs as C,Dl as w,Il as T,Mc as E,Nc as D,Q as ee,Ql as te,Us as ne,Va as re,X as O,Xc as ie,Y as ae,Yl as k,Z as oe,_c as A,ac as se,au as ce,ec as le,et as ue,hu as j,tt as de,ul as M,ws as fe}from"./index-BBlJYVxR.js";import{t as pe}from"./page-tabs-YeJKwV-7.js";var N=n(),P=e(t(),1),F=r(),I={en:{pageTitle:`You`,pageSubtitle:`A living portrait shaped by you and xopc.`,overview:`Your portrait`,understanding:`Shared understanding`,knowledge:`Work memory`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`Your explicit profile stays clear and editable. xopc builds a separate shared understanding through conversations and work.`,editProfile:`Edit basics`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: founder, designer, or engineer`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,useDeviceTimezone:`Use this device`,notProvided:`Not provided`,editProfileHint:`These are facts you provide directly. They remain separate from xopc’s observations and inferences.`,saveProfile:`Save`,saving:`Saving…`,explicit:`You told me`,explicitHint:`Facts and preferences you stated directly`,learned:`Learned together`,learnedHint:`Patterns formed from our work`,pending:`To confirm together`,pendingHint:`Items that need your judgment`,confirmTogether:`Confirm together`,confirmHint:`These may affect future behavior. Confirm them, correct the wording, or tell me not to use them.`,nothingToConfirm:`Nothing needs your confirmation right now.`,importantNow:`What matters now`,noPriority:`No current priority has been set.`,otherGoals:`Other active outcomes`,howWeWork:`How we work together`,howWeWorkHint:`Your standing instructions for how I should communicate and act.`,noRules:`No collaboration preferences yet.`,recent:`Recently formed understanding`,recentHint:`The most useful current facts, with their origin and time horizon.`,seeAll:`See all`,workMemory:`What I remember from the work`,workMemoryHint:`Project facts, decisions, lessons, and open questions stay separate from facts about you.`,items:`items`,maintenanceReady:`Memory upkeep is enabled and waiting for its first run.`,maintenanceComplete:`Memory was last organized`,maintenanceFailed:`The latest memory upkeep needs attention`,refresh:`Refresh`,aboutYouTitle:`A view you can correct`,aboutYouHint:`This is working context, not a fixed profile. Every item can be corrected or retired.`,identity:`Who you are`,preferences:`Preferences and working rhythm`,relationships:`People and relationships`,currentState:`Current context`,insights:`My current read`,emptyGroup:`No understanding has formed here yet.`,correct:`Correct`,stopUsing:`Stop using`,confirm:`Confirm`,notTrue:`Not true`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryLibraryHint:`Only distilled facts, decisions, lessons, commitments, and open questions appear here. Source records stay with their connector.`,noKnowledge:`No work memory has formed yet.`,noKnowledgeMatch:`No work memory matches this search.`,archive:`Archive`,showMore:`Show more`,expand:`Show details`,collapse:`Hide details`,disable:`Disable`,disabled:`Not in use`,enable:`Enable`,loadFailed:`Could not load your understanding.`,tryAgain:`Try again`,actionFailed:`The change could not be saved. Please try again.`},zh:{pageTitle:`你`,pageSubtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,overview:`你的画像`,understanding:`共同理解`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,pending:`等待一起确认`,pendingHint:`需要由你判断的内容`,confirmTogether:`一起确认`,confirmHint:`这些理解可能影响之后的行为。你可以确认、修正,或告诉我以后不要使用。`,nothingToConfirm:`目前没有需要你确认的理解。`,importantNow:`此刻重要`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最值得使用的当前认识,同时说明它来自哪里、适用多久。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`它是协作中的工作认知,不是给你定型的档案。每一条都能修正或停止使用。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,stopUsing:`不再使用`,confirm:`确认`,notTrue:`不是这样`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,archive:`归档`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},L=[`candidate`,`needs_review`,`conflicted`,`stale`],me=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),he=[`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`];function R(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function z(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function ge(e){return{callName:z(e.profile.callName)??``,role:z(e.profile.role)??``,pronouns:z(e.profile.pronouns)??``,timezone:z(e.profile.timezone)??``,locale:z(e.profile.locale)??``}}function _e(e,t){return{"zh-CN":{en:`Simplified Chinese`,zh:`简体中文`},"zh-TW":{en:`Traditional Chinese`,zh:`繁体中文`},"en-US":{en:`English (US)`,zh:`英语(美国)`},"en-GB":{en:`English (UK)`,zh:`英语(英国)`},"ja-JP":{en:`Japanese`,zh:`日语`}}[e]?.[t]??e}function ve(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function B(e,t){return(t===`zh`?{user_explicit:`你告诉我的`,user_observed:`从协作中观察到`,system_inferred:`我形成的判断`,external_untrusted:`来自连接的信息`}:{user_explicit:`You told me`,user_observed:`Observed while working together`,system_inferred:`My current read`,external_untrusted:`From connected information`})[e.authority]}function V(e,t){if(e.validTo){let n=R(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`长期有效`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Long-term`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function ye(e,t){let n=R(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function be(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`仍需确认`:`Needs confirmation`}function H(e,t){return(t===`zh`?{global:`所有协作`,agent:`当前智能体`,workspace:`当前工作区`,project:`当前项目`,session:`当前会话`}:{global:`All work`,agent:`This agent`,workspace:`This workspace`,project:`This project`,session:`This conversation`})[e.type]}function U(e,t){return(t===`zh`?{project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{project_fact:`Project facts`,workspace_fact:`Workspace facts`,decision:`Decisions`,task_lesson:`Lessons`,commitment:`Commitments`,open_question:`Open questions`,episode:`Episodes`,note:`Notes`})[e]}function xe(e,t,n){if(e)return e.targetType===`goal`?t.find(t=>t.id===e.targetId)?.title:/^[0-9a-f]{8}-[0-9a-f-]{20,}$/i.test(e.targetId)?(n===`zh`?{project:`当前项目`,task:`当前任务`,assertion:`一项待处理的理解`,topic:`当前主题`}:{project:`Current project`,task:`Current task`,assertion:`An understanding to address`,topic:`Current topic`})[e.targetType]:e.targetId}function W(e){let t=(0,N.c)(14),{title:n,hint:r,action:i,children:a,className:o}=e,s=`rounded-xl border border-edge bg-surface-panel shadow-surface ${o===void 0?``:o}`,c;t[0]===n?c=t[1]:(c=(0,F.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,F.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,F.jsxs)(`div`,{children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==i||t[8]!==u?(d=(0,F.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge-subtle px-5 py-4`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==s||t[12]!==d?(f=(0,F.jsxs)(`section`,{className:s,children:[d,a]}),t[10]=a,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function G(e){let t=(0,N.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,F.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,F.jsxs)(`div`,{className:`flex min-h-32 flex-col items-center justify-center gap-2 px-5 py-8 text-center text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Se({open:e,profile:t,language:n,saving:r,onOpenChange:d,onSave:g}){let _=I[n],[y,b]=(0,P.useState)(t);(0,P.useEffect)(()=>{e&&b(t)},[e,t]);let x=e=>{e.preventDefault(),g({callName:y.callName.trim(),role:y.role.trim(),pronouns:y.pronouns.trim(),timezone:y.timezone.trim(),locale:y.locale.trim()})},S=(e,t,n)=>(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,F.jsx)(`input`,{value:y[e],onChange:t=>b(n=>({...n,[e]:t.target.value})),placeholder:n,className:`h-10 w-full rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}),C=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];return y.locale&&!C.includes(y.locale)&&C.push(y.locale),(0,F.jsx)(u,{open:e,onOpenChange:d,children:(0,F.jsxs)(s,{children:[(0,F.jsx)(i,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,F.jsx)(c,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(40rem,calc(100vh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,F.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:x,children:[(0,F.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(l,{className:`font-semibold text-fg`,children:_.editProfile}),(0,F.jsx)(a,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_.editProfileHint})]}),(0,F.jsx)(o,{asChild:!0,children:(0,F.jsx)(v,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":_.cancel,children:(0,F.jsx)(h,{className:`size-4`})})})]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[S(`callName`,_.callName,_.callNamePlaceholder),S(`role`,_.role,_.rolePlaceholder),S(`pronouns`,_.pronouns,_.pronounsPlaceholder),(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:_.locale}),(0,F.jsxs)(f,{value:y.locale,onChange:e=>b(t=>({...t,locale:e.target.value})),children:[(0,F.jsx)(p,{value:``,children:_.notProvided}),C.map(e=>(0,F.jsx)(p,{value:e,children:_e(e,n)},e))]})]}),(0,F.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,F.jsx)(`span`,{className:`font-medium text-fg`,children:_.timezone}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{value:y.timezone,onChange:e=>b(t=>({...t,timezone:e.target.value})),placeholder:O(),className:`h-10 min-w-0 flex-1 rounded-xl border border-edge bg-surface-base px-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,F.jsx)(v,{className:`shrink-0 whitespace-nowrap`,onClick:()=>b(e=>({...e,timezone:O()})),children:_.useDeviceTimezone})]})]})]})}),(0,F.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,F.jsx)(o,{asChild:!0,children:(0,F.jsx)(v,{disabled:r,children:_.cancel})}),(0,F.jsxs)(v,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,F.jsx)(m,{className:`size-4 animate-spin`}):null,r?_.saving:_.saveProfile]})]})]})})]})})}function Ce(e){let t=(0,N.c)(28),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onAction:u,onCorrect:f}=e,p=I[r],m;t[0]===n.status?m=t[1]:(m=L.includes(n.status),t[0]=n.status,t[1]=m);let g=m,_;t[2]!==n||t[3]!==r?(_=be(n,r),t[2]=n,t[3]=r,t[4]=_):_=t[4];let y=_,b=`rounded-xl border p-4 ${g?`border-edge-strong bg-surface-base`:`border-edge bg-surface-panel`}`,x;t[5]!==i||t[6]!==y||t[7]!==o||t[8]!==a||t[9]!==n||t[10]!==r||t[11]!==g||t[12]!==u||t[13]!==l||t[14]!==f||t[15]!==s||t[16]!==c||t[17]!==p.cancel||t[18]!==p.confirm||t[19]!==p.correct||t[20]!==p.correctionPlaceholder||t[21]!==p.notTrue||t[22]!==p.save||t[23]!==p.stopUsing?(x=a?(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsx)(`label`,{className:`sr-only`,htmlFor:`assertion-${n.id}`,children:p.correctionPlaceholder}),(0,F.jsx)(`textarea`,{id:`assertion-${n.id}`,value:o,onChange:e=>s(e.target.value),placeholder:p.correctionPlaceholder,className:`min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm leading-6 text-fg outline-none transition focus:border-accent focus:ring-2 focus:ring-accent/20`,autoFocus:!0}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(v,{variant:`ghost`,className:`h-8`,onClick:l,children:p.cancel}),(0,F.jsx)(v,{variant:`primary`,className:`h-8`,disabled:!o.trim()||i,onClick:f,children:p.save})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,F.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-fg-subtle`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(E,{className:`size-3.5`}),B(n,r)]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(T,{className:`size-3.5`}),V(n,r)]}),n.scope.type===`global`?null:(0,F.jsx)(`span`,{children:H(n.scope,r)}),y?(0,F.jsx)(`span`,{children:y}):null]}),(0,F.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-1.5`,children:g?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(v,{variant:`secondary`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`active`),children:[(0,F.jsx)(d,{className:`size-3.5`}),p.confirm]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:c,children:[(0,F.jsx)(A,{className:`size-3.5`}),p.correct]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`rejected`),children:[(0,F.jsx)(h,{className:`size-3.5`}),p.notTrue]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:c,children:[(0,F.jsx)(A,{className:`size-3.5`}),p.correct]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,disabled:i,onClick:()=>u(`archived`),children:[(0,F.jsx)(j,{className:`size-3.5`}),p.stopUsing]})]})})]}),t[5]=i,t[6]=y,t[7]=o,t[8]=a,t[9]=n,t[10]=r,t[11]=g,t[12]=u,t[13]=l,t[14]=f,t[15]=s,t[16]=c,t[17]=p.cancel,t[18]=p.confirm,t[19]=p.correct,t[20]=p.correctionPlaceholder,t[21]=p.notTrue,t[22]=p.save,t[23]=p.stopUsing,t[24]=x):x=t[24];let S;return t[25]!==b||t[26]!==x?(S=(0,F.jsx)(`article`,{className:b,children:x}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function we(e){let t=(0,N.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=I[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,F.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l;t[3]!==n.status||t[4]!==o.disabled?(l=n.status===`disabled`?(0,F.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.disabled}):null,t[3]=n.status,t[4]=o.disabled,t[5]=l):l=t[5];let u=n.status===`active`?o.disable:o.enable,d;t[6]!==i||t[7]!==a||t[8]!==u?(d=(0,F.jsx)(v,{variant:`ghost`,className:`h-8`,disabled:i,onClick:a,children:u}),t[6]=i,t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==d?(f=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==f?(p=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,c,f]}),t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function Te(e){let t=(0,N.c)(39),{item:n,language:r,busy:i,expanded:a,onToggle:o,onArchive:s}=e,c=I[r],l=n.updatedAt??n.createdAt,u;t[0]!==r||t[1]!==l?(u=R(l,r),t[0]=r,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===n.content?f=t[4]:(f=n.content.length>96||n.content.includes(`
2
- `),t[3]=n.content,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,F.jsx)(ce,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),t[5]=m):m=t[5];let h=`whitespace-pre-wrap text-sm leading-6 text-fg ${a?``:`line-clamp-2`}`,g;t[6]!==n.content||t[7]!==h?(g=(0,F.jsx)(`p`,{className:h,children:n.content}),t[6]=n.content,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==n.scope||t[10]!==r?(_=H(n.scope,r),t[9]=n.scope,t[10]=r,t[11]=_):_=t[11];let y;t[12]===_?y=t[13]:(y=(0,F.jsx)(`span`,{children:_}),t[12]=_,t[13]=y);let b;t[14]===d?b=t[15]:(b=d?(0,F.jsx)(`span`,{children:d}):null,t[14]=d,t[15]=b);let x;t[16]!==y||t[17]!==b?(x=(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[y,b]}),t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]!==x||t[20]!==g?(S=(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[g,x]}),t[19]=x,t[20]=g,t[21]=S):S=t[21];let C;t[22]!==p||t[23]!==a||t[24]!==o||t[25]!==c.collapse||t[26]!==c.expand?(C=p?(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1 px-2`,onClick:o,children:[(0,F.jsx)(`span`,{className:`hidden sm:inline`,children:a?c.collapse:c.expand}),(0,F.jsx)(k,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})]}):null,t[22]=p,t[23]=a,t[24]=o,t[25]=c.collapse,t[26]=c.expand,t[27]=C):C=t[27];let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(j,{className:`size-3.5`}),t[28]=w):w=t[28];let T;t[29]!==i||t[30]!==s||t[31]!==c.archive?(T=(0,F.jsx)(v,{variant:`ghost`,className:`size-8 shrink-0 p-0`,disabled:i,onClick:s,"aria-label":c.archive,title:c.archive,children:w}),t[29]=i,t[30]=s,t[31]=c.archive,t[32]=T):T=t[32];let E;t[33]!==C||t[34]!==T?(E=(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[C,T]}),t[33]=C,t[34]=T,t[35]=E):E=t[35];let D;return t[36]!==S||t[37]!==E?(D=(0,F.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[m,S,E]})}),t[36]=S,t[37]=E,t[38]=D):D=t[38],D}function Ee(){let e=g(e=>e.language),t=I[e],n=re(e=>e.setPageHeader),r=re(e=>e.clearPageHeader),{data:i,error:a,isLoading:o,mutate:s}=_(`/api/user-model`,oe),[c,l]=(0,P.useState)(`overview`),[u,f]=(0,P.useState)(),[p,m]=(0,P.useState)(),[O,k]=(0,P.useState)(),[A,j]=(0,P.useState)(``),[N,z]=(0,P.useState)(``),[B,V]=(0,P.useState)(24),[be,H]=(0,P.useState)(),[Ee,K]=(0,P.useState)(!1);(0,P.useEffect)(()=>(n({startExtra:null,main:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,F.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:null}),r),[r,n,t]);let q=async(e,n)=>{f(e),m(void 0);try{await n(),await s()}catch{m(t.actionFailed)}finally{f(void 0)}},De=(e,t)=>{q(e.id,()=>ee(e.id,t))},Oe=e=>{q(e.id,async()=>{await ae(e.id,A.trim()),k(void 0),j(``)})},ke=async e=>{f(`profile`),m(void 0);try{await de(e),await s(),K(!1)}catch{m(t.actionFailed)}finally{f(void 0)}};if(o)return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,F.jsx)(y,{className:`h-10 w-72 rounded-xl`}),(0,F.jsx)(y,{className:`h-72 rounded-xl`}),(0,F.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,F.jsx)(y,{className:`h-80 rounded-xl`}),(0,F.jsx)(y,{className:`h-80 rounded-xl`})]})]});if(a||!i)return(0,F.jsxs)(`div`,{className:`mx-auto flex min-h-72 max-w-xl flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,F.jsx)(x,{className:`size-6 text-fg-subtle`}),(0,F.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,F.jsx)(v,{onClick:()=>void s(),children:t.tryAgain})]});let J=[...i.assertions].sort((e,t)=>{let n=Number(L.includes(t.status))-Number(L.includes(e.status));if(n)return n;let r=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-r||t.recordedAt-e.recordedAt}).filter(e=>!me.has(e.predicate)),Y=ge(i),Ae=Y.callName||(e===`zh`?`你`:`You`),je=J.filter(e=>L.includes(e.status)),Me=J.filter(e=>e.status===`active`),Ne=Me.filter(e=>e.authority===`user_explicit`).length,Pe=Me.length-Ne,Fe=i.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),X=Fe.find(e=>e.rank===`primary`)??Fe[0],Ie=xe(X,i.goals,e),Le=X?.targetType===`goal`?i.goals.find(e=>e.id===X.targetId):void 0,Re=i.goals.filter(e=>e.status===`active`||e.status===`paused`).filter(e=>X?.targetType!==`goal`||e.id!==X.targetId),ze=i.rules.filter(e=>e.status!==`archived`),Be=[...Me].sort((e,t)=>t.recordedAt-e.recordedAt),Z=i.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),Ve=N.trim().toLocaleLowerCase(),Q=Z.filter(t=>!Ve||t.content.toLocaleLowerCase().includes(Ve)||U(t.kind,e).toLocaleLowerCase().includes(Ve)),He=[{key:`identity`,title:t.identity,icon:C,items:J.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:S,items:J.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:M,items:J.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:T,items:J.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:ne,items:J.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),Ue=he.map(e=>({kind:e,count:Z.filter(t=>t.kind===e).length})).filter(e=>e.count>0),We=Q.slice(0,B),Ge=he.map(e=>({kind:e,items:We.filter(t=>t.kind===e),totalCount:Q.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),$=t=>(0,F.jsx)(Ce,{item:t,language:e,busy:u===t.id,editing:O===t.id,draft:O===t.id?A:``,onDraftChange:j,onEdit:()=>{k(t.id),j(t.statement)},onCancel:()=>{k(void 0),j(``)},onAction:e=>De(t,e),onCorrect:()=>Oe(t)},t.id),Ke=i.maintenance.lastRun?R(i.maintenance.lastRun.finishedAt??i.maintenance.lastRun.startedAt,e,!0):null,qe=i.maintenance.lastRun?i.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Ke}`:t.maintenanceFailed:t.maintenanceReady;return(0,F.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[(0,F.jsx)(pe,{items:[{id:`overview`,label:t.overview,icon:ne},{id:`understanding`,label:t.understanding,icon:C,count:J.length},{id:`knowledge`,label:t.knowledge,icon:ce,count:Z.length}],activeTab:c,onChange:l,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`}),p?(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,F.jsx)(`span`,{children:p}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>m(void 0),"aria-label":t.cancel,children:(0,F.jsx)(h,{className:`size-4`})})]}):null,c===`overview`?(0,F.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-5`,children:[(0,F.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,F.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_21rem] lg:gap-10`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,F.jsx)(ne,{className:`size-3.5`}),(0,F.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,F.jsxs)(`div`,{className:`mt-6 flex items-center gap-4`,children:[(0,F.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-active text-lg font-semibold text-fg sm:size-20 sm:text-xl`,children:ve(Ae)}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:Ae}),(0,F.jsx)(`p`,{className:`mt-1 truncate text-sm text-fg-muted`,children:Y.role||t.notProvided})]}),(0,F.jsxs)(v,{className:`shrink-0`,onClick:()=>K(!0),children:[(0,F.jsx)(fe,{className:`size-4`}),t.editProfile]})]}),(0,F.jsx)(`p`,{className:`mt-6 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.portraitIntro}),(0,F.jsx)(`div`,{className:`mt-6 overflow-hidden rounded-xl border border-edge bg-edge-subtle`,children:(0,F.jsx)(`div`,{className:`grid gap-px sm:grid-cols-3`,children:[{icon:ie,label:t.locale,value:Y.locale?_e(Y.locale,e):t.notProvided},{icon:D,label:t.timezone,value:Y.timezone||t.notProvided},{icon:C,label:t.pronouns,value:Y.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,F.jsxs)(`div`,{className:`bg-surface-panel px-4 py-3.5`,children:[(0,F.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,F.jsx)(e,{className:`size-3.5`}),t]}),(0,F.jsx)(`p`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})})]}),(0,F.jsxs)(`div`,{className:`flex min-h-52 flex-col rounded-xl border border-edge bg-surface-base p-5 sm:p-6`,children:[(0,F.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),Ie?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`mt-4 text-xl font-semibold leading-7 tracking-tight text-fg`,children:Ie}),Le?.desiredOutcome?(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Le.desiredOutcome}):null,X?(0,F.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:ye(X.validTo,e)}):null]}):(0,F.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-2 py-6 text-center text-sm text-fg-muted`,children:[(0,F.jsx)(te,{className:`size-5 text-fg-subtle`}),(0,F.jsx)(`span`,{children:t.noPriority})]}),Re.length?(0,F.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,F.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,F.jsx)(`div`,{className:`mt-2 space-y-2`,children:Re.slice(0,3).map(e=>(0,F.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),(0,F.jsx)(`div`,{className:`grid border-t border-edge-subtle sm:grid-cols-3`,children:[{icon:E,label:t.explicit,hint:t.explicitHint,count:Ne},{icon:x,label:t.learned,hint:t.learnedHint,count:Pe},{icon:d,label:t.pending,hint:t.pendingHint,count:je.length}].map(({icon:e,label:t,hint:n,count:r},i)=>(0,F.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`border-t border-edge-subtle sm:border-l sm:border-t-0`:``}`,children:[(0,F.jsx)(e,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[(0,F.jsx)(`span`,{className:`mr-1.5 text-lg tabular-nums`,children:r}),t]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:n})]})]},t))})]}),je.length?(0,F.jsx)(W,{title:t.confirmTogether,hint:t.confirmHint,children:(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:je.map($)})}):null,(0,F.jsx)(W,{title:t.howWeWork,hint:t.howWeWorkHint,children:ze.length?ze.map(t=>(0,F.jsx)(we,{rule:t,language:e,busy:u===t.id,onToggle:()=>void q(t.id,()=>ue(t.id,t.status===`active`?`disabled`:`active`))},t.id)):(0,F.jsx)(G,{icon:(0,F.jsx)(M,{className:`size-5`}),children:t.noRules})}),(0,F.jsx)(W,{title:t.recent,hint:t.recentHint,action:(0,F.jsx)(v,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>l(`understanding`),children:t.seeAll}),children:Be.length?(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:Be.slice(0,6).map($)}):(0,F.jsx)(G,{icon:(0,F.jsx)(x,{className:`size-5`}),children:t.emptyGroup})}),(0,F.jsx)(W,{title:t.workMemory,hint:t.workMemoryHint,action:(0,F.jsx)(v,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>l(`knowledge`),children:t.seeAll}),children:Ue.length?(0,F.jsx)(`div`,{className:`grid gap-px bg-edge-subtle sm:grid-cols-2 lg:grid-cols-4`,children:Ue.slice(0,4).map(({kind:t,count:n})=>(0,F.jsxs)(`div`,{className:`bg-surface-panel px-5 py-4`,children:[(0,F.jsx)(`p`,{className:`text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:U(t,e)})]},t))}):(0,F.jsx)(G,{icon:(0,F.jsx)(w,{className:`size-5`}),children:t.noKnowledge})}),(0,F.jsxs)(`footer`,{className:`flex items-center justify-between gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(se,{className:`size-3.5`}),qe]}),(0,F.jsxs)(v,{variant:`ghost`,className:`h-8 gap-1.5 px-2.5`,onClick:()=>void s(),children:[(0,F.jsx)(se,{className:`size-3.5`}),t.refresh]})]})]}):null,c===`understanding`?(0,F.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-5`,children:[(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-5 py-5 shadow-surface sm:px-6`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(x,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,F.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]})}),He.length?He.map(({key:e,title:t,icon:n,items:r})=>(0,F.jsx)(W,{title:t,action:(0,F.jsx)(n,{className:`size-4 text-fg-subtle`}),children:(0,F.jsx)(`div`,{className:`grid gap-3 p-4 lg:grid-cols-2`,children:r.map($)})},e)):(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,F.jsx)(G,{icon:(0,F.jsx)(x,{className:`size-5`}),children:t.emptyGroup})})]}):null,c===`knowledge`?(0,F.jsxs)(`div`,{id:`understanding-panel-knowledge`,role:`tabpanel`,"aria-labelledby":`understanding-tab-knowledge`,className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-edge bg-surface-panel p-4 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,F.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,F.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.allMemory}),(0,F.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[Z.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,F.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,F.jsx)(le,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,F.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,F.jsx)(`input`,{type:`search`,value:N,onChange:e=>{z(e.target.value),V(24)},placeholder:t.searchPlaceholder,className:`h-10 w-full rounded-xl border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none transition placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]})]}),Q.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`space-y-4`,children:Ge.map(({kind:t,items:n,totalCount:r})=>(0,F.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-surface`,children:[(0,F.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge-subtle px-5 py-3 sm:px-6`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:U(t,e)}),(0,F.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,F.jsx)(`div`,{children:n.map(t=>(0,F.jsx)(Te,{item:t,language:e,busy:u===t.id,expanded:be===t.id,onToggle:()=>H(e=>e===t.id?void 0:t.id),onArchive:()=>void q(t.id,()=>b(t.id,`archived`))},t.id))})]},t))}),Q.length>B?(0,F.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,F.jsx)(v,{onClick:()=>V(e=>e+24),children:t.showMore})}):null]}):(0,F.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel shadow-surface`,children:(0,F.jsx)(G,{icon:(0,F.jsx)(le,{className:`size-5`}),children:N.trim()?t.noKnowledgeMatch:t.noKnowledge})})]}):null,(0,F.jsx)(Se,{open:Ee,profile:Y,language:e,saving:u===`profile`,onOpenChange:K,onSave:e=>void ke(e)})]})}export{Ee as UserModelPage};
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,n as a,o,r as s,s as c,t as l}from"./dist-CpzYSoz7.js";import{n as u,r as d}from"./popover-select-C-Hj-nXR.js";import{t as f}from"./markdown-view-DBWu9d_n.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./messages-ChSTFZR5.js";import{i as h,r as g}from"./locale-store-B2v8mNJw.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-CtTvuElV.js";import{$n as y,Cl as b,Cr as x,Gs as S,Ns as C,Sr as w,Ss as T,Us as E,Vs as D,Yc as O,Yl as k,ac as A,ir as j,pr as M}from"./index-BBlJYVxR.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
2
- `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
- `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await h(g(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:u,fieldLabel:d,scenario:m,format:h,intent:g,locale:y,context:x,disabled:S,className:C,showLabel:w}=e,T=m===void 0?`generic.text`:m,O=h===void 0?`plain`:h,j=g===void 0?`improve`:g,M=w===void 0?!0:w,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===y?me=t[1]:(me=ne(y),t[0]=y,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==x||t[24]!==u||t[25]!==d||t[26]!==O||t[27]!==fe||t[28]!==j||t[29]!==y||t[30]!==T?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:j,scenario:T,input:e,locale:y,field:{id:u,label:d,format:O},context:x})},t[23]=x,t[24]=u,t[25]=d,t[26]=O,t[27]=fe,t[28]=j,t[29]=y,t[30]=T,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!M&&`size-7 p-0`,Ge;t[62]!==C||t[63]!==We?(Ge=_(`h-7 gap-1 px-2 text-xs`,We,C),t[62]=C,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=S||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(E,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=M?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=_(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(i,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(c,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(p,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(a,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=_(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=_(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(b,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==O||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:O===`markdown`?(0,z.jsx)(f,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=O,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=_(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=_(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(b,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=_(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=_(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(k,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=_(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==O||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):O===`markdown`?(0,z.jsx)(f,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=O,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(A,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(E,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(v,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(v,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(s,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(o,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(l,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:y(t.argValues)}function ae(e,t,n){let r=m(t).workflows;if(!e)return r.noInputSummary;let i=x(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(M[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=M[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:c,showGoal:l,inputClassName:u,aiAssist:d}=e,f;t[0]===c?f=t[1]:(f=c===void 0?[]:c,t[0]=c,t[1]=f);let p=f,h=l===void 0?!0:l,g,v,y,b,x,S,C;if(t[2]!==d||t[3]!==i||t[4]!==p||t[5]!==o||t[6]!==u||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==h||t[11]!==n){y=m(r).workflows;let e=M[n]??[];v=e.length>0;let c=_(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,u),l;t[19]!==i||t[20]!==a||t[21]!==s?(l=e=>{w(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=l):l=t[22],g=l,b=`flex flex-col gap-3`,x=e.map(e=>{let t=K(y.args,e.labelKey),o=K(y.args,e.placeholderKey),s=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&d?(0,z.jsx)(B,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:d.argScenario??`workflow.arg`,locale:r,context:{...d.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:d.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:_(c,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c})]},e.key)}),S=v&&p.length>0?(0,z.jsx)(se,{examples:p,labels:y,onSelect:g}):null,C=h?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),d?(0,z.jsx)(B,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:d.goalScenario??`cron.workflowGoal`,locale:r,context:{...d.context,workflowName:n,workflowArgs:i},disabled:d.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:y.goalPlaceholder,className:_(c,`min-h-20 resize-y`)})]}):null,t[2]=d,t[3]=i,t[4]=p,t[5]=o,t[6]=u,t[7]=r,t[8]=a,t[9]=s,t[10]=h,t[11]=n,t[12]=g,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else g=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let T;t[23]!==g||t[24]!==p||t[25]!==v||t[26]!==y?(T=!v&&p.length>0?(0,z.jsx)(se,{examples:p,labels:y,onSelect:g}):null,t[23]=g,t[24]=p,t[25]=v,t[26]=y,t[27]=T):T=t[27];let E;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==T?(E=(0,z.jsxs)(`div`,{className:b,children:[x,S,C,T]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=T,t[33]=E):E=t[33],E}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let o=(0,N.useMemo)(()=>H(e),[e]),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[d,f]=(0,N.useState)(null);if(o.length===0)return null;let p=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&u(JSON.stringify(i,null,2))},m=e=>{u(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){f(r.rawJsonInvalid),a?.(!1);return}f(null),n(t),a?.(!0,t)}catch{f(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;c(e),e&&(u(JSON.stringify(t,null,2)),f(null),a?.(!0))},children:r.rawJson})]}),s?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:l,onChange:e=>m(e.target.value),spellCheck:!1,className:_(q,`min-h-40 font-mono text-xs leading-5`)}),d?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:d}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>p(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:i,aiAssist:a,allValues:o,onChange:s}=e,c=n.schema.title||n.key,l=typeof n.schema.description==`string`?n.schema.description:void 0,f=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,p;t[0]===n.schema.enum?p=t[1]:(p=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=p);let m=p,h=!!a&&!m.length&&(f===`string`||!f),g=String(c),v=n.required?` *`:``,y;t[2]!==g||t[3]!==v?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,v]}),t[2]=g,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==a||t[6]!==o||t[7]!==n.key||t[8]!==n.schema||t[9]!==s||t[10]!==h||t[11]!==c||t[12]!==r?(b=h&&a?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:s,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(c),scenario:a.scenario??`workflow.arg`,locale:a.locale,context:{...a.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:o},disabled:a.disabled,showLabel:!1}):null,t[5]=a,t[6]=o,t[7]=n.key,t[8]=n.schema,t[9]=s,t[10]=h,t[11]=c,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===l?S=t[18]:(S=l?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:l}):null,t[17]=l,t[18]=S);let C;t[19]!==l||t[20]!==m||t[21]!==i||t[22]!==s||t[23]!==f||t[24]!==r?(C=m.length>0?(0,z.jsxs)(u,{value:r==null?``:String(r),onChange:e=>s(e.target.value),className:q,children:[(0,z.jsx)(d,{value:``}),m.map(de)]}):f===`boolean`?(0,z.jsxs)(u,{value:typeof r==`boolean`?String(r):``,onChange:e=>s(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(d,{value:``}),(0,z.jsx)(d,{value:`true`,children:i.booleanTrue}),(0,z.jsx)(d,{value:`false`,children:i.booleanFalse})]}):f===`number`||f===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>s(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>s(e.target.value),className:_(q,l&&l.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=l,t[20]=m,t[21]=i,t[22]=s,t[23]=f,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(d,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:c}=e,l;t[0]===r?l=t[1]:(l=m(r),t[0]=r,t[1]=l);let u=l.workflows,d;t[2]!==n||t[3]!==r?(d=x(n,r),t[2]=n,t[3]=r,t[4]=d):d=t[4];let f=d,[p,h]=(0,N.useState)(!0),g;t[5]===f.examplePrompts?g=t[6]:(g=f.examplePrompts??[],t[5]=f.examplePrompts,t[6]=g);let v=g,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,S,C,w,T,E,D,O,k,A,j;if(t[9]!==o||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==s||t[14]!==u||t[15]!==r||t[16]!==f.description||t[17]!==a||t[18]!==c||t[19]!==p||t[20]!==i){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=_(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,s),l;t[31]!==n||t[32]!==a||t[33]!==c||t[34]!==p?(l=(e,t)=>{let r=t===void 0?p:t;a(e),c?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=c,t[34]=p,t[35]=l):l=t[35];let d=l,m;t[36]!==d||t[37]!==i?(m=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=m):m=t[38];let g=m,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let x=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==g||t[46]!==x||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){g(e.text);return}x({...i.schemaInput,[e.field]:e.text})},t[45]=g,t[46]=x,t[47]=i.schemaInput,t[48]=P):P=t[48],S=P,!b){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==f.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=f.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==s||t[58]!==r||t[59]!==N||t[60]!==g||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:g,examplePrompts:v,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=s,t[58]=r,t[59]=N,t[60]=g,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],E=a;break bb0}w=`flex flex-col gap-3`,t[65]!==o||t[66]!==n||t[67]!==u.booleanFalse||t[68]!==u.booleanTrue||t[69]!==u.inputSchemaHeading||t[70]!==u.rawJson||t[71]!==u.rawJsonInvalid||t[72]!==r||t[73]!==f.description||t[74]!==c||t[75]!==x||t[76]!==i?(T=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:x,onValidChange:(e,t)=>{h(e),c?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description}}:void 0,labels:{inputSchemaHeading:u.inputSchemaHeading,rawJson:u.rawJson,rawJsonInvalid:u.rawJsonInvalid,booleanTrue:u.booleanTrue,booleanFalse:u.booleanFalse}}):null,t[65]=o,t[66]=n,t[67]=u.booleanFalse,t[68]=u.booleanTrue,t[69]=u.inputSchemaHeading,t[70]=u.rawJson,t[71]=u.rawJsonInvalid,t[72]=r,t[73]=f.description,t[74]=c,t[75]=x,t[76]=i,t[77]=T):T=t[77],j=`flex flex-col gap-1`;let F;t[78]===u.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:u.goalLabel}),t[78]=u.goalLabel,t[79]=F);let I;t[80]!==o||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==u.goalLabel||t[85]!==r||t[86]!==f.description||t[87]!==g||t[88]!==i.goal||t[89]!==i.schemaInput?(I=o?(0,z.jsx)(B,{value:i.goal,onApply:g,fieldId:`workflow.goal`,fieldLabel:u.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:f.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=u.goalLabel,t[85]=r,t[86]=f.description,t[87]=g,t[88]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(C=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=C):C=t[93],D=i.goal,t[94]===g?O=t[95]:(O=e=>g(e.target.value),t[94]=g,t[95]=O),k=u.goalPlaceholder,A=_(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=v,t[12]=b,t[13]=s,t[14]=u,t[15]=r,t[16]=f.description,t[17]=a,t[18]=c,t[19]=p,t[20]=i,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==C||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[C,M]}),t[101]=C,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==S||t[106]!==v||t[107]!==u?(I=(0,z.jsx)(J,{examples:v,labels:u,onSelect:S}),t[105]=S,t[106]=v,t[107]=u,t[108]=I):I=t[108];let L;return t[109]!==w||t[110]!==T||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:w,children:[T,F,I]}),t[109]=w,t[110]=T,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?j(t.agentScaleExact,{count:n.min}):j(t.agentScaleRange,{min:n.min,max:n.max}):j(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:c,inputClassName:l,showTimeout:u,defaultAdvancedOpen:d,onValidityChange:f}=e,p=u===void 0?!1:u,h=d===void 0?!1:d,g=m(r).workflows,[v,y]=(0,N.useState)(h),b;t[0]!==n||t[1]!==r?(b=x(n,r),t[0]=n,t[1]=r,t[2]=b):b=t[2];let w=b,E;t[3]!==n.defaults||t[4]!==i.concurrency?(E=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=E):E=t[5];let D=E,A;t[6]!==n.defaults||t[7]!==i.maxSubagents?(A=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=A):A=t[8];let M=A,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=s??g.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=_(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||w.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(O,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(T,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(S,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===f?W=t[27]:(W=e=>{f?.(e)},t[26]=f,t[27]=W);let G;t[28]!==c||t[29]!==n||t[30]!==l||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:c,inputClassName:l}),t[28]=c,t[29]=n,t[30]=l,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>y(pe),t[36]=K):K=t[36];let oe=g.advancedSettings,se=v&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=_(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(k,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:g.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:j(g.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,g)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:j(g.runLimitsSummary,{concurrency:D,max:M})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),g.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),v?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:j(g.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:j(g.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),p?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:j(g.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};