@xopcai/xopc 0.0.348 → 0.0.350
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B48Ub-fy.js → agent-avatar-dicebear-GAs9LrbD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-q6mFje6y.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-B8D_L023.js → agent-plugin-dialog-vR-3YU8w.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DZXa_QVc.js +70 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-DZsBZ9R6.js → agents-admin-api-yUALtmym.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D4huEKxu.js → app-management-settings-panel-5GU28Q-V.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-lbeb_mOb.js → appearance-settings-uxEo59iJ.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-06LrJSYf.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DvPF9mbR.js → archive-plugin-B4z8_4sq.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CM6ANOfj.js → automations-page-Cap0FMSp.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DEsdkcup.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DYxZ2L01.js → binary-plugins-PKMXJixJ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DPsS76ci.js → block-editor-Dv83e7vb.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BgK2Ma4E.js → browser-automation-inputs-B0TlAcoB.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-C1mBYS2x.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-Co2D8mug.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-C2vyJC-B.js → capabilities-e-fO70DK.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-Cfk_8vgn.js → capabilities-page-nIIqZJuL.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BrXWQIs7.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-BR4YfU1r.js → capability-header-actions-C6d_GsqD.js} +1 -1
- package/dist/gateway/static/root/assets/channels-EUbBfvHY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DVL0pNfw.js → chat-terminal-dock-CZTrJ5Do.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-B6bMn9_o.js → computer-settings-page-CWBZwtYT.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DTf0AE08.js → connector-service-page-B5pF87fY.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-9ztbuGCI.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-BvUz7Jmo.js → date-picker-xb5w8iAa.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BS9PH0_F.js → dependency-picker-D7B6s4d4.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CdD76KQc.js → desktop-pet-Bt5JatKm.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DV8cAkA-.js → desktop-pet-settings-BdgUJk-e.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DQ7LNTKz.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-6GF0kAvg.js → directory-picker-path-field-_PcWmfRH.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DUkakgyK.js → extension-debug-page-BhXwxHMP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BP4yNpNV.js → extension-page-CIXPBzGU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-IknmkkwV.js → extension-settings-page-DE4UUMD-.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-COCA8geG.js → gateway-config-swr-CmjHbMj7.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-Blcloycq.js → gateway-realtime-DzyR6LYb.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-KyhksZSM.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CI2oGZEg.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CradGmBo.js → gateway-startup-retry-CbOUnKv5.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DfJvuWC-.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CCe_-wBX.js → image-generation-api-BmLpVntI.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-M8CMzgwX.js → imports-page-DRG-aahH.js} +1 -1
- package/dist/gateway/static/root/assets/index-CPi50n0l.css +1 -0
- package/dist/gateway/static/root/assets/index-Z6i4GDcT.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CTExu4KJ.js → keyboard-shortcuts-settings-CSwc_Olv.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DIkqWLTJ.js → local-app-workbench-page-DsSCCThS.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Cev794Mq.js → local-apps-page-C4psaPz5.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-CIcrQnQp.js → local-session-drafts-CxXjQ5Du.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-K7mHrs6W.js → locale-store-WMaCMm3_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Dj7n8b3d.js → logs-page-kx7ama7K.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-BqcrFVsF.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-BNVvybMV.js → markdown-view-Oe4rXk1N.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B6fa5xON.js → media-plugins-BCMV9heb.js} +1 -1
- package/dist/gateway/static/root/assets/messages-sXePe3LQ.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Bvjc5JNM.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dak5PuTq.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-2DW_Izyo.js → page-context-capture-button-BYQnvTni.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-Cjglz5aP.js → page-tabs--d3GEnvY.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-2lyQ_MmL.js → preview-open-alternatives-ByuWaDEv.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BKAv2MFW.js → product-open-page-CMvjGjTz.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-m8ybJpJ_.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-i00ns68r.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DKxVZeHC.js → registry-api-DEePN1Rc.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CY4kQa1Z.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-iAbOoncf.js → runtime-tools-settings-panel-D-gA6BW9.js} +2 -2
- package/dist/gateway/static/root/assets/{scenes-page-BN6zUrwp.js → scenes-page--sExi9Fz.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DI21ybo-.js → schema-form-B8Zns_Se.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DoE_8MbN.js → session-api-Bv-hCMKS.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-B6_KNduD.js → session-manager-BcDptzCN.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BzW33zp4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CVnn1f7J.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B_r52FLh.js → settings-form-section-Lpep8yx-.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BNT9fll3.js → settings-page-Cl_KOVsG.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-mWQaql5h.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-ByxaJBO7.js → share-preview-page-ZZ6qg3xL.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DhQRwYYL.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-D3Qzxo6w.js → skill-api-DC3EXeUS.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C-Dn5hSx.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ThkBmKew.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DPasmTr-.js → system-settings-panel-C93mkvML.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DWqYIP_j.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DshPpr1H.js → tunnel-api-DI4NcRc8.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-YXuop6gX.js → usage-page-C--1ibDb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CyQzBYru.js → use-autosave-83u3Kf_7.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DasK0_MY.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DUv7pxEZ.js → voice-api-key-field-D4SxKV47.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-C9HKTnnD.js → voice-config-api-DbjjZkIg.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DWbprlt4.js → work-discovery-overlay-RSWjSoEp.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BofmD9MZ.js → workflow-run-setup-panel-BINT9Shl.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bj3K-lxR.js +6 -0
- package/dist/gateway/static/root/index.html +15 -15
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +4 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/ai-assist.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +3 -3
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DrNeejJd.js +0 -1
- package/dist/gateway/static/root/assets/agents-DRU5Cc7r.js +0 -70
- package/dist/gateway/static/root/assets/apps-page-B-UzNCWD.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-7wnqz-B1.js +0 -7
- package/dist/gateway/static/root/assets/browser-automations-page-CT20Kt5U.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CB39uOH-.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Boiv7dpU.js +0 -8
- package/dist/gateway/static/root/assets/channels-BAu_NG0v.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BrBTuiQu.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-4wD8Pb-g.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B87bp5kF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-bpaxXMOz.js +0 -1
- package/dist/gateway/static/root/assets/home-page-ZqLG2X-z.js +0 -1
- package/dist/gateway/static/root/assets/index-0fDWYKsQ.js +0 -106
- package/dist/gateway/static/root/assets/index-s6fKtM4y.css +0 -1
- package/dist/gateway/static/root/assets/management-settings-CfgGWl3l.js +0 -1
- package/dist/gateway/static/root/assets/messages-CY3XVeek.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DWd8h1MC.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C6x2cjau.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-Bz_1bF6c.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DW7FI96H.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-zL2Mi5oM.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CjfA7rah.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DqCD-vFm.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-QAG-Gj3Y.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B-H0tqRz.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DtZy-0cc.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-gCSDewRg.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-4zD1dJY8.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BLCVHuv3.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Ce28ZKPq.js +0 -6
|
@@ -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{f as i,g as a,m as o,t as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as c,r as l}from"./popover-select-0p9PIHRy.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./external-link-DjqjBmc3.js";import{f as p,m,t as h}from"./markdown-view-BNVvybMV.js";import{t as g}from"./folder-open-CyzJ19I9.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./cn-JdwAhgNB.js";import{a as y,c as ee,n as te,r as b}from"./locale-store-K7mHrs6W.js";import{i as ne,n as x,o as re,r as ie,s as ae,t as S}from"./dist-BGTk37IG.js";import{u as oe}from"./tasks-BH8_WMUF.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-CS04eWY9.js";import{t as T}from"./skeleton-BwbyijEw.js";import{$s as se,$t as ce,Bn as le,Hi as ue,Hn as de,Is as fe,L as pe,Ls as E,Mu as D,Ns as me,Pa as O,Ta as k,Ui as he,Un as ge,Vn as _e,Wn as ve,Ws as A,Wu as j,Ys as M,Zi as N,Zs as P,ad as F,au as I,ju as L,lu as R,n as ye,na as be,nc as xe,ol as Se,pi as Ce,qa as we,qo as Te,rc as Ee,tc as De,tl as Oe,xo as ke,yl as Ae,yr as je,zn as Me,zs as Ne}from"./index-0fDWYKsQ.js";import{t as Pe}from"./page-context-capture-button-2DW_Izyo.js";import{t as Fe}from"./date-picker-BvUz7Jmo.js";import{t as z}from"./dependency-picker-BS9PH0_F.js";var B=n(),V=e(t(),1),H=r();function Ie({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function h(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await E(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),Te({tone:`success`,title:p?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,H.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),h()},children:[p?(0,H.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,H.jsx)(`p`,{children:e.reason}),(0,H.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,H.jsx)(w,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void h(`approve`),children:n?`批准`:`Approve`}),(0,H.jsx)(w,{type:`button`,disabled:o||u,onClick:()=>void h(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,H.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),m.length>0&&(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,H.jsx)(w,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,H.jsx)(w,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function Le(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function Re({uri:e,zh:t}){let[n,r]=(0,V.useState)(),[i,a]=(0,V.useState)(!1),[o,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(``);async function p(){a(!0),u(``);try{let n=Le(e,(await be()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{a(!1)}}async function m(){if(!(!n||i)){a(!0),u(``);try{let e=await N(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{a(!1)}}}return(0,H.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(w,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),o&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,H.jsx)(w,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,H.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,H.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),o&&(0,H.jsx)(s,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function ze(e){let t=(0,B.c)(14),{evidence:n,projectId:r,conversationId:i,language:a}=e,o=ue(Be);if(!n.length)return null;let s=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,c;if(t[0]!==i||t[1]!==n||t[2]!==a||t[3]!==r||t[4]!==o){let e;t[6]!==i||t[7]!==a||t[8]!==r||t[9]!==o?(e=(e,t)=>{let n=e.uri?.trim(),s=n&&/^https?:\/\//i.test(n),c=n&&!s&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),l=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[s?(0,H.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,H.jsx)(f,{className:`size-4 shrink-0`}),l]}):c&&(r||i)?(0,H.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline`,onClick:()=>o(n,null,r,i),children:[(0,H.jsx)(R,{className:`size-4 shrink-0`}),l]}):(0,H.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:l}),s&&e.kind===`artifact`&&(0,H.jsx)(Re,{uri:n,zh:a===`zh`},n),e.summary?(0,H.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:e.summary}):null,(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[6]=i,t[7]=a,t[8]=r,t[9]=o,t[10]=e):e=t[10],c=n.map(e),t[0]=i,t[1]=n,t[2]=a,t[3]=r,t[4]=o,t[5]=c}else c=t[5];let l;return t[11]!==s||t[12]!==c?(l=(0,H.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":s,children:c}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Be(e){return e.setPath}function Ve({taskId:e}){let t=ee(e=>e.conversationId),n=te(e=>e.language),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)([]),[p,m]=(0,V.useState)(null),g=b(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:_,error:v,mutate:ne}=C([`task-collaboration`,e,t],()=>y(`${g}?recent=1`),{revalidateOnFocus:!0}),x=[...new Map([...d,..._?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),re=async()=>{let e=x[0];if(!(!e||l)){u(!0);try{let t=await y(`${g}?recent=1&beforeSequence=${e.sequence}`);f(e=>[...t.items,...e])}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}};(0,V.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&ne()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[ne,e]);let ie=async()=>{if(!(!r.trim()||s)){c(!0),m(null);try{await y(g,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await ne()}catch(e){m(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,H.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,H.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!_&&!v?(0,H.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,H.jsx)(T,{className:`h-14 w-full`}),(0,H.jsx)(T,{className:`h-14 w-4/5`})]}):null,v?(0,H.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,x[0]&&x[0].sequence>1?(0,H.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>void re(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,x.map(e=>(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,H.jsx)(`span`,{children:e.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:e.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:e.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,H.jsxs)(`span`,{children:[`· `,e.kind]}),e.deliveryStatus?(0,H.jsxs)(`span`,{children:[`· `,e.deliveryStatus]}):null]}),(0,H.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,H.jsx)(h,{content:e.body,compact:!0,breaks:!0})}),e.kind===`question`&&e.authorKind===`worker_agent`?(0,H.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(e.id),children:n===`zh`?`回复问题`:`Reply`}):null]},e.id)),_&&!x.length?(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,H.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,H.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,H.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),p?(0,H.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:p}):null,(0,H.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void ie(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function He(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ue(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}}function U(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function We(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,H.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,H.jsx)(T,{className:`h-32 rounded-2xl`}),(0,H.jsx)(T,{className:`h-52 rounded-2xl`}),(0,H.jsx)(T,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ge(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ke(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var qe=[`backlog`,`ready`,`active`,`review`,`closed`],Je=[`low`,`normal`,`high`,`critical`],Ye=(0,V.memo)(function(e){let t=(0,B.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,H.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=qe.map(e=>(0,H.jsx)(l,{value:e,disabled:p(e),children:U(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,H.jsx)(c,{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:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,H.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Xe=(0,V.memo)(function(e){let t=(0,B.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,H.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=Je.map(e=>(0,H.jsx)(l,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,H.jsx)(c,{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:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,H.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Ze=(0,V.memo)(function(e){let t=(0,B.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,H.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,H.jsx)(Fe,{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,H.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}),Qe=(0,V.memo)(function(e){let t=(0,B.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,u;t[0]===i?u=t[1]:(u=(0,H.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,H.jsx)(l,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(_t),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,H.jsxs)(c,{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:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,H.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),$e=(0,V.memo)(function(e){let t=(0,B.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(vt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,H.jsx)(z,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&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)),et=`xopc.taskDetail.chatPanelPercent`,tt=42;function nt(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?tt:Math.min(r,Math.max(n,e))}function rt(){try{let e=Number(window.localStorage.getItem(et));return Number.isFinite(e)&&e>=30&&e<=60?e:tt}catch{return tt}}function it(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.waits.some(e=>e.kind===`paused`)?`paused`: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`:`ready`:e.operationalState}function at(e){return e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function W(e){let t=(0,B.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,H.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,H.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,H.jsx)(t===`passed`?u:t===`failed`?D:L,{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,H.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,H.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function ot({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[o]=a(),c=i(),l=te(e=>e.language),_=ee(e=>e.conversationId),y=(0,V.useMemo)(()=>Ee(l),[l]),b=ke(e=>e.setPageHeader),ne=ke(e=>e.clearPageHeader),x=he(e=>e.open),re=he(e=>e.conversationIdOverride),ie=he(e=>e.openForSession),ae=je(e=>e.setOpen),{data:S,error:C,mutate:T,lastChange:ce,conversationLoading:ue,conversationError:D}=me(e),[N,L]=(0,V.useState)(null),[R,be]=(0,V.useState)(()=>new Set),[Te,Fe]=(0,V.useState)([]),[z,B]=(0,V.useState)(null),[Le,Re]=(0,V.useState)([]),[Be,U]=(0,V.useState)(!1),[qe,Je]=(0,V.useState)(``),[ot,G]=(0,V.useState)(!1),[st,ct]=(0,V.useState)(``),[K,lt]=(0,V.useState)(rt),[ut,dt]=(0,V.useState)(!1),ft=(0,V.useRef)(null),pt=(0,V.useRef)(!1),mt=(0,V.useRef)(!1),ht=(0,V.useRef)(``),gt=(0,V.useRef)(null),_t=(0,V.useRef)(null),vt=(0,V.useRef)(null),yt=(0,V.useRef)(S),[bt,q]=(0,V.useState)(null),[xt,St]=(0,V.useState)(null),[Ct,wt]=(0,V.useState)(!1),Tt=(0,V.useMemo)(()=>({link:y.linkDependencies,linked:y.linkedDependencies,searchPlaceholder:y.dependencySearchPlaceholder,noMatches:y.noDependencyMatches,noCandidates:y.noDependencyCandidates,remove:y.removeDependency}),[y.dependencySearchPlaceholder,y.linkDependencies,y.linkedDependencies,y.noDependencyCandidates,y.noDependencyMatches,y.removeDependency]),Et=S?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,Dt=(0,V.useMemo)(()=>p(o.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[o]),Ot=(0,V.useCallback)(e=>t===`modal`&&n?xe(n,e):m(`/tasks/${encodeURIComponent(e)}`,Dt),[n,t,Dt]);yt.current=S;let J=(0,V.useCallback)((e,t)=>{be(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,V.useEffect)(()=>{L(null),q(null),U(!1),G(!1),St(null),wt(!1)},[e]),(0,V.useEffect)(()=>{let e=!0;return O().then(t=>{e&&Re(t.items)}).catch(()=>void 0),()=>{e=!1}},[_]),(0,V.useEffect)(()=>{if(!ce||ce.source===`user`)return;St(ce);let e=window.setTimeout(()=>St(null),3500);return()=>window.clearTimeout(e)},[ce]),(0,V.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){vt.current=null,B(null),Fe(n);return}vt.current!==t&&(vt.current=t,B(null));let r=!0;return we(t).then(t=>{if(!r)return;B(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});Fe([...i.values()])}).catch(()=>{r&&Fe(n)}),()=>{r=!1}},[Et,S?.task.projectId,e]);let Y=(0,V.useCallback)(async(t,n=`command`)=>{let r=yt.current;if(r){J(n,!0),L(null);try{await T(await E(e,t,r.task.version),{revalidate:!1})}catch{L(y.actionFailed)}finally{J(n,!1)}}},[y.actionFailed,T,J,e]),X=(0,V.useCallback)(async(t,n)=>{let r=yt.current;if(!r)return!1;n&&J(n,!0),L(null);try{return await T(P(e,t,r.task.version),{optimisticData:Ue(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(y.actionFailed),!1}finally{n&&J(n,!1)}},[y.actionFailed,T,J,e]),kt=async()=>{if(!S)return;if(pt.current){pt.current=!1;return}let e=qe.trim(),t=gt.current;if(He(t,S.task.version,S.task.title,e)){q(`title`);return}if(!e||e===S.task.title){Je(S.task.title),U(!1);return}await X({title:e})&&(q(null),U(!1))},At=async()=>{if(!S)return;if(mt.current){mt.current=!1;return}let e=st.trim(),t=_t.current;if(He(t,S.task.version,S.task.body??``,e)){q(`description`);return}if(st===ht.current||e===(S.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},jt=(0,V.useCallback)(async e=>{let t=yt.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),Mt=(0,V.useCallback)(e=>{X({priority:e},`priority`)},[X]),Nt=(0,V.useCallback)(e=>{X({dueAt:Ke(e)},`dueAt`)},[X]),Pt=(0,V.useCallback)(e=>{lt(e);try{window.localStorage.setItem(et,String(e))}catch{}},[]),Ft=(0,V.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=ft.current?.clientWidth??0;Pt(nt(e.key===`Home`?tt:K+(e.key===`ArrowLeft`?2:-2),t))},[K,Pt]),It=(0,V.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=ft.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),dt(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=nt((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{}dt(!1),Pt(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)},[K,Pt]),Lt=(0,V.useCallback)(async t=>{let n=yt.current;if(n){J(`dependencies`,!0),L(null);try{await T(await se(e,t,n.task.version),{revalidate:!1})}catch{L(y.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[y.dependencyUpdateFailed,T,J,e]),Rt=(0,V.useCallback)(async t=>{let n=yt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),L(null);try{await T(await A(e,t,n.task.version),{revalidate:!1})}catch{L(y.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[y.actionFailed,T,J,e]),zt=(0,V.useCallback)(async()=>{J(`delete`,!0),L(null);try{await Ne(e),r?r():c(Dt,{replace:!0})}catch(e){L(e instanceof Error?e.message:y.actionFailed)}finally{J(`delete`,!1)}},[y.actionFailed,c,r,Dt,J,e]);if((0,V.useLayoutEffect)(()=>{if(t!==`modal`)return b({startExtra:(0,H.jsx)(s,{to:Dt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":y.backToWork,children:(0,H.jsx)(F,{className:`size-4`})}),main:S?(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:z?`${z} / ${y.taskLabel}`:y.taskLabel}):null,end:null}),ne},[ne,y.backToWork,y.taskLabel,S,t,z,Dt,b]),C&&!S)return(0,H.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:y.taskNotFound});if(!S)return(0,H.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,H.jsx)(We,{})});let Bt=S.waits[0],Vt=S.waits.find(e=>e.kind===`paused`),Z=S.receipts[0],Ht=it(S),Ut=y.detailStatuses[Ht],Wt=S.task.body?.trim()||S.task.contract?.objective.trim(),Gt=S.runs.find(e=>e.id===Z?.runId)?.contractVersion===S.task.latestContractVersion?Z:void 0,Kt=oe(Gt),qt=new Map(Gt?.verification.checks.map(e=>[e.criterion,e.status===`passed`&&!Kt.has(e.criterion)?`unverified`:e.status])),Jt=S.allowedCommands.includes(`mark_ready`),Yt=S.allowedCommands.includes(`start`),Xt=S.allowedCommands.includes(`add_wait`),Zt=!Bt&&S.task.phase===`review`&&S.allowedCommands.includes(`close`),Qt=S.allowedCommands.includes(`reopen`),Q=S.conversation.activeConversationId,$t=S.conversation.currentExecutorAgentId??S.task.delegateAgentId??S.task.ownerId,en=Le.find(e=>e.id===$t),tn=!!(Q&&x&&re===Q),nn=S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),rn=S.task.contract?.acceptanceCriteria??[],an=rn.filter(e=>qt.get(e)===`passed`).length,on=S.task.contract?.expectedOutputs??[],sn=S.task.contract?.constraints??[],cn=S.task.contract?.approvalRequired??[],ln=S.task.contract?.assumptions??[],un=S.task.contract?.risks??[],$=(...e)=>!!xt?.changedFields.some(t=>e.includes(t)),dn=S.allowedCommands.includes(`move`),fn=R.has(`command`),pn=R.has(`delete`),mn=S.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),hn=mn!==void 0,gn=`/automations?action=create&taskId=${encodeURIComponent(S.task.id)}${S.task.projectId?`&projectId=${encodeURIComponent(S.task.projectId)}`:``}`,_n=(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Jt?(0,H.jsxs)(w,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:fn,onClick:()=>void Y({type:`mark_ready`}),children:[(0,H.jsx)(Oe,{className:`size-4`}),y.scheduleTask]}):null,Vt&&S.allowedCommands.includes(`resolve_wait`)?(0,H.jsxs)(w,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:fn,onClick:()=>void Y({type:`resolve_wait`,waitId:Vt.id}),children:[(0,H.jsx)(Oe,{className:`size-4`}),y.resumeTask]}):null,!Bt&&Yt&&$t?(0,H.jsxs)(w,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:fn,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:$t}}),children:[(0,H.jsx)(Oe,{className:`size-4`}),y.runTask]}):null,Zt?(0,H.jsxs)(w,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:fn,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,H.jsx)(u,{className:`size-4`}),y.approveTask]}):null,Qt?(0,H.jsxs)(w,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:fn,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,H.jsx)(Oe,{className:`size-4`}),y.reopenTask]}):null,!Vt&&Xt?(0,H.jsxs)(w,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:fn,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,H.jsx)(Se,{className:`size-4`}),y.pauseTask]}):null,S.task.phase===`closed`?null:(0,H.jsx)(w,{asChild:!0,variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,children:(0,H.jsxs)(s,{to:gn,children:[(0,H.jsx)(j,{className:`size-4`}),y.scheduleRecurringTask]})}),(0,H.jsxs)(de,{children:[(0,H.jsx)(ve,{asChild:!0,children:(0,H.jsx)(w,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:fn||pn,"aria-label":y.moreActions,children:(0,H.jsx)(d,{className:`size-4`,"aria-hidden":!0})})}),(0,H.jsx)(_e,{children:(0,H.jsxs)(Me,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[mn?(0,H.jsx)(le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),L(null),T(fe(e,mn.id,mn.version),{revalidate:!1}).catch(()=>L(y.actionFailed)).finally(()=>J(`command`,!1))},children:y.cancelActiveRun}):null,mn?(0,H.jsx)(ge,{className:`my-1 h-px bg-edge`}):null,S.task.phase===`closed`?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(le,{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 Y({type:`close`,resolution:`cancelled`}),children:y.cancelTask}),(0,H.jsx)(ge,{className:`my-1 h-px bg-edge`})]}),(0,H.jsx)(le,{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(hn){L(y.deleteActiveTaskBlocked);return}wt(!0)},children:y.deleteTask})]})})]})]}),(0,H.jsx)(Pe,{resource:{kind:`task`,id:S.task.id,revision:String(S.task.version)},disabled:Be||ot||R.size>0}),Q&&t!==`modal`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(w,{type:`button`,variant:`ghost`,className:v(`h-8 shrink-0 px-2 text-xs`,tn&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":tn,onClick:()=>{ae(Q,!1),ie(Q)},children:[(0,H.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,H.jsx)(w,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,H.jsxs)(s,{to:De(e),children:[(0,H.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]});return(0,H.jsxs)(`div`,{ref:ft,className:`${t===`modal`?`flex h-full min-h-0 flex-col`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden`} ${ut?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,H.jsxs)(`header`,{className:v(`shrink-0 border-b border-edge-subtle bg-surface-panel px-5 py-4 sm:px-6`,$(`title`)&&`task-detail-live-update`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[z?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),z]}):null,z?(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,H.jsx)(`span`,{children:y.taskLabel}),xt?(0,H.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:xt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Be?(0,H.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:qe,onChange:e=>Je(e.target.value),onBlur:()=>void kt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),pt.current=!0,Je(S.task.title),U(!1),queueMicrotask(()=>{pt.current=!1}))},className:`mt-2 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-xl font-semibold leading-7 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,H.jsx)(`button`,{type:`button`,className:`mt-2 block max-w-full rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{gt.current={value:S.task.title,version:S.task.version},q(null),Je(S.task.title),U(!0)},children:(0,H.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 text-fg`,children:S.task.title})}),bt===`title`?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,H.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Je(S.task.title),q(null),U(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:qe.trim()}).then(e=>{e&&(q(null),U(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,H.jsx)(`span`,{className:v(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,at(Ht)),children:Ut})]}),(0,H.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,H.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[$t?(0,H.jsx)(pe,{agentId:$t,avatar:en?.avatar,size:20,className:`shrink-0`}):null,(0,H.jsxs)(`span`,{className:`truncate`,children:[y.executorLabel,` · `,en?.name??$t??y.unassigned]})]}),(0,H.jsx)(`span`,{className:`text-fg-subtle`,children:y.updatedAt.replace(`{{date}}`,Ce(S.task.updatedAt,l))})]}),(0,H.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:_n}),N?(0,H.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:N}):null]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[(0,H.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[S.attention.length>0?(0,H.jsxs)(`section`,{className:v(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,$(`attention`)&&`task-detail-live-update`),children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:nn?y.needsAttention:y.waitingStatus}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:S.attention.map((t,n)=>(0,H.jsxs)(`li`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:t.summary}),t.kind===`input_required`||t.kind===`approval_required`?(0,H.jsx)(s,{className:`inline-flex min-h-11 items-center rounded-lg bg-surface-panel px-3 text-sm font-medium text-accent`,to:De(e),children:l===`zh`?t.kind===`approval_required`?`查看并决定`:`补充信息`:t.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${t.kind}-${n}`))})]}):null,S.task.phase!==`closed`&&!Vt&&S.waits.filter(e=>(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`).map(e=>(0,H.jsx)(Ie,{wait:e,detail:S,zh:l===`zh`,onUpdated:e=>{T(e,{revalidate:!1})}},e.id)),(0,H.jsx)(`div`,{className:`mb-4`,children:(0,H.jsx)(Ve,{taskId:e},e)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,H.jsxs)(`section`,{className:v(`p-5`,$(`body`)&&`task-detail-live-update`),children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.taskDescription}),ot?(0,H.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:st,onChange:e=>ct(e.target.value),onBlur:()=>void At(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),mt.current=!0,ct(S.task.body??S.task.contract?.objective??``),G(!1),queueMicrotask(()=>{mt.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,H.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??``;ht.current=e,_t.current={value:S.task.body??``,version:S.task.version},q(null),ct(e),G(!0)},children:(0,H.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Wt&&Wt!==S.task.title?Wt:y.noTaskDescription})}),bt===`description`?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,H.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{ct(S.task.body??``),q(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:st.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,H.jsxs)(`section`,{className:v(`p-5`,$(`contract`)&&`task-detail-live-update`),children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.taskDefinition}),(0,H.jsxs)(`div`,{className:`mt-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.successDefinition}),rn.length>0?(0,H.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:y.criteriaProgress.replace(`{{verified}}`,String(an)).replace(`{{total}}`,String(rn.length))}):null]}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{items:rn,empty:y.noDefinition,verificationByCriterion:qt})})]}),on.length>0?(0,H.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-5`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.expectedOutputs}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{items:on,empty:y.noDefinition})})]}):null,sn.length>0?(0,H.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:y.constraints}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{items:sn,empty:y.noDefinition})})]}):null,cn.length>0?(0,H.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:y.approvalRequired}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{items:cn,empty:y.noDefinition})})]}):null,ln.length>0?(0,H.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:y.contextAssumptions}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{items:ln,empty:y.noDefinition})})]}):null,un.length>0?(0,H.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:y.contextRisks}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{items:un,empty:y.noDefinition})})]}):null]}),Z?(0,H.jsxs)(`section`,{className:v(`p-5`,$(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.latestResult}),(0,H.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?Z.completionVerdict===`achieved`?`本次执行报告目标已达成,请结合下方验证依据验收。`:`这是阶段性结果,尚不能代表任务全部完成。`:Z.completionVerdict===`achieved`?`The run reports the goal achieved. Review the evidence below.`:`This is a partial result; the task is not yet fully complete.`}),(0,H.jsx)(h,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[y.receiptStatuses[Z.status],` · `,y.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,H.jsxs)(`div`,{className:`mt-4`,children:[(0,H.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:y.remainingWork}),(0,H.jsx)(`div`,{className:`mt-2`,children:(0,H.jsx)(W,{items:Z.remainingWork,empty:y.noRemainingWork})})]}):null,Z.nextAction?(0,H.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:y.nextAction}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(w,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void M(Z.runId,`helpful`),children:y.doneWell}),(0,H.jsx)(w,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void M(Z.runId,`not_helpful`),children:y.needsFix})]}),(0,H.jsx)(ze,{evidence:Z.evidence,projectId:S.task.projectId,conversationId:Q??void 0,language:l}),S.receipts.length>1?(0,H.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,H.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:y.executionHistory.replace(`{{count}}`,String(S.receipts.length-1))}),(0,H.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.receipts.slice(1).map(e=>(0,H.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:y.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,S.context.length>0?(0,H.jsxs)(`section`,{className:v(`p-5`,$(`context`)&&`task-detail-live-update`),children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.contextUsed}),(0,H.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:S.context.map(e=>(0,H.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,H.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[y.contextRoleLabels[e.role],` · `,y.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,H.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,H.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,H.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,H.jsxs)(`section`,{className:v(`p-5`,$(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.taskProperties}),(0,H.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,H.jsx)(Ye,{value:S.task.phase,disabled:R.has(`phase`),canMove:dn,canApprove:Zt,canReopen:Qt,language:l,label:y.taskPhase,onChange:jt}),(0,H.jsx)(Xe,{value:S.task.priority,disabled:R.has(`priority`),label:y.priority,labels:y.priorityLabels,onChange:Mt}),(0,H.jsx)(Ze,{value:Ge(S.task.dueAt),disabled:R.has(`dueAt`),label:y.dueDate,onChange:Nt}),(0,H.jsx)(Qe,{value:S.conversation.currentExecutorAgentId??``,disabled:R.has(`delegateAgentId`),label:y.executorLabel,unassignedLabel:y.unassigned,agents:Le,onChange:Rt})]})]}),(0,H.jsxs)(`section`,{className:v(`p-5`,$(`dependencies`)&&`task-detail-live-update`),children:[(0,H.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:y.taskRelations}),(0,H.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependencies}),(0,H.jsx)($e,{candidates:Te,selected:S.dependencies,disabled:R.has(`dependencies`),labels:Tt,getTaskHref:Ot,onChange:Lt})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependents}),S.dependents.length>0?(0,H.jsx)(`div`,{className:`space-y-1.5`,children:S.dependents.map(e=>(0,H.jsx)(s,{to:Ot(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-fg-muted transition-colors hover:text-fg`,children:e.title},e.id))}):(0,H.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:y.noDependents})]})]})]})]})]})]}),(0,H.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(K),tabIndex:0,onPointerDown:It,onKeyDown:Ft,onDoubleClick:()=>Pt(tt),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 ${ut?`bg-surface-hover`:``}`,children:(0,H.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,H.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,H.jsx)(`div`,{className:`flex shrink-0 items-center border-b border-edge-subtle px-4 py-3`,children:(0,H.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:l===`zh`?`执行对话`:`Execution chat`})}),Q?(0,H.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,H.jsx)(ye,{embedded:!0,conversationId:Q,taskId:e})}):ue?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,H.jsxs)(`div`,{className:`max-w-xs`,children:[(0,H.jsx)(Ae,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):D?(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,H.jsxs)(`div`,{className:`max-w-xs`,children:[(0,H.jsx)(Ae,{className:`mx-auto size-8 text-danger`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,H.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:D instanceof Error?D.message:String(D)})]})}):(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,H.jsxs)(`div`,{className:`max-w-xs`,children:[(0,H.jsx)(Ae,{className:`mx-auto size-8 text-fg-subtle`}),(0,H.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,H.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,H.jsx)(k,{open:Ct,title:y.deleteTaskTitle,description:y.deleteTaskDescription.replace(`{{title}}`,S.task.title),confirmLabel:y.confirmDeleteTask,cancelLabel:y.keepTask,destructive:!0,onConfirm:()=>{wt(!1),zt()},onCancel:()=>wt(!1)})]})}function G(){let e=(0,B.c)(2),{taskId:t}=o(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,H.jsx)(ot,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function st(e){let t=(0,B.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(gt),{data:o}=me(n),c=o?.conversation.activeConversationId??null,l=he(ht),u=he(mt),d=he(pt),p=he(ft),m=je(dt),h=ue(ut),y=ue(lt),ee=l?u:0,b;t[0]!==i||t[1]!==y?(b=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=b):b=t[2];let oe=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]!==oe||t[7]!==C?(w=(0,H.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":oe,onClick:C}),t[6]=oe,t[7]=C,t[8]=w):w=t[8];let T=l?`true`:`false`,se=`${ee/2}px`,le=`${ee}px`,de;t[9]!==se||t[10]!==le?(de={"--task-detail-workspace-offset":se,"--task-detail-workspace-width":le},t[9]=se,t[10]=le,t[11]=de):de=t[11];let fe=de,pe=a===`zh`?`任务详情`:`Task details`,E;t[12]===pe?E=t[13]:(E=(0,H.jsx)(ae,{className:`font-medium text-fg`,children:pe}),t[12]=pe,t[13]=E);let D=a===`zh`?`查看并操作任务详情`:`View and manage task details`,O;t[14]===D?O=t[15]:(O=(0,H.jsx)(ne,{className:`sr-only`,children:D}),t[14]=D,t[15]=O);let k;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==d||t[22]!==l?(k=c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,className:v(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===c,onClick:()=>{m(c,!1),p(c)},children:(0,H.jsx)(g,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(s,{to:De(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,H.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=d,t[22]=l,t[23]=k):k=t[23];let ge=a===`zh`?`关闭任务详情`:`Close task details`,_e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,H.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[24]=_e):_e=t[24];let ve;t[25]===ge?ve=t[26]:(ve=(0,H.jsx)(x,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ge,children:_e}),t[25]=ge,t[26]=ve);let A;t[27]!==k||t[28]!==ve?(A=(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k,ve]}),t[27]=k,t[28]=ve,t[29]=A):A=t[29];let j;t[30]!==E||t[31]!==O||t[32]!==A?(j=(0,H.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[E,O,A]}),t[30]=E,t[31]=O,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==i||t[35]!==y?(M=()=>{y(null),i()},t[34]=i,t[35]=y,t[36]=M):M=t[36];let N;t[37]!==r||t[38]!==M||t[39]!==n?(N=(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,H.jsx)(ot,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:M})}),t[37]=r,t[38]=M,t[39]=n,t[40]=N):N=t[40];let P;t[41]!==j||t[42]!==N||t[43]!==T||t[44]!==fe?(P=(0,H.jsxs)(ie,{className:`xopc-dialog-content 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 border border-edge bg-surface-overlay focus:outline-none`,"data-workspace-panel-open":T,style:fe,onEscapeKeyDown:K,onInteractOutside:ct,children:[j,N]}),t[41]=j,t[42]=N,t[43]=T,t[44]=fe,t[45]=P):P=t[45];let F;t[46]!==h||t[47]!==d||t[48]!==l||t[49]!==u?(F=h?(0,H.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:l?u:0},children:(0,H.jsx)(ce,{allowOutsideChat:!0,conversationId:d??void 0})}):null,t[46]=h,t[47]=d,t[48]=l,t[49]=u,t[50]=F):F=t[50];let I;t[51]!==P||t[52]!==F||t[53]!==w?(I=(0,H.jsxs)(re,{children:[w,P,F]}),t[51]=P,t[52]=F,t[53]=w,t[54]=I):I=t[54];let L;return t[55]!==b||t[56]!==I?(L=(0,H.jsx)(S,{modal:!1,open:!0,onOpenChange:b,children:I}),t[55]=b,t[56]=I,t[57]=L):L=t[57],L}function ct(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function K(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function lt(e){return e.setPath}function ut(e){return e.path}function dt(e){return e.setOpen}function ft(e){return e.openForSession}function pt(e){return e.conversationIdOverride}function mt(e){return e.widthPx}function ht(e){return e.open}function gt(e){return e.language}function _t(e){return(0,H.jsx)(l,{value:e.id,children:e.name||e.id},e.id)}function vt(e){return e.id}export{st as TaskDetailModal,G 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{g as i,t as a,u as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./check-DUBLcKHA.js";import{n as c,r as l,t as u}from"./popover-select-0p9PIHRy.js";import{t as d}from"./circle-check-C23XjkUj.js";import{t as f}from"./download-Dk-ZjtO6.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as m}from"./folder-open-CyzJ19I9.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./pencil-DmIY3Oa-.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./search-DA7gz22f.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./cn-JdwAhgNB.js";import{n as x}from"./locale-store-K7mHrs6W.js";import{a as S,c as C,i as w,n as T,o as E,r as D,s as ee,t as O}from"./dist-BGTk37IG.js";import{i as k}from"./vendor-swr-BIWyz7Rc.js";import{t as A}from"./button-CS04eWY9.js";import{t as j}from"./skeleton-BwbyijEw.js";import{Bl as M,Bn as N,Bu as P,Cl as F,Du as I,Gu as L,Hn as R,Hu as z,J as B,Ku as V,Lc as H,Mc as U,Ol as W,Pc as G,Qu as K,Ro as q,Sl as te,Tc as ne,Tl as re,Uu as J,Vn as ie,Wn as ae,Yu as oe,_c as se,_t as Y,_u as ce,at as le,bu as ue,ct as de,dc as fe,dt as pe,eu as me,fc as he,ft as ge,fu as _e,gt as ve,gu as ye,ht as be,it as xe,lt as Se,mt as Ce,ot as we,pc as Te,pt as Ee,qc as De,rt as Oe,st as ke,tu as Ae,ut as je,vt as Me,xl as Ne,xo as Pe,zn as Fe,zu as Ie}from"./index-0fDWYKsQ.js";import{t as Le}from"./page-tabs-Cjglz5aP.js";import{t as Re}from"./date-picker-BvUz7Jmo.js";var X=e(t(),1),Z=n(),Q=r();function ze(e){let t=(0,Z.c)(15),{sourceId:n,disabled:r}=e,i=r===void 0?!1:r,a=x(He)===`zh`,{sources:o,starting:s,start:c}=B(),l;t[0]!==n||t[1]!==o?(l=n?o.filter(e=>e.grantId===n):o,t[0]=n,t[1]=o,t[2]=l):l=t[2];let u=l,d;t[3]===u?d=t[4]:(d=u.some(Ve),t[3]=u,t[4]=d);let f=d,p=n&&u.some(Be),m=f?a?`更新中`:`Updating`:p?a?`重试`:`Retry`:n?a?`更新理解`:`Update understanding`:a?`更新全部`:`Update all`,g=i||s||f,_;t[5]!==n||t[6]!==c?(_=()=>void c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]===f?v=t[9]:(v=f?(0,Q.jsx)(h,{className:`size-3.5 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(De,{className:`size-3.5`}),t[8]=f,t[9]=v);let y;return t[10]!==m||t[11]!==g||t[12]!==_||t[13]!==v?(y=(0,Q.jsxs)(A,{variant:`ghost`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs`,disabled:g,onClick:_,children:[v,m]}),t[10]=m,t[11]=g,t[12]=_,t[13]=v,t[14]=y):y=t[14],y}function Be(e){return e.status===`failed`||e.status===`partial`||e.status===`canceled`}function Ve(e){return e.status===`queued`||e.status===`running`}function He(e){return e.language}function Ue(e){let t=(0,Z.c)(22),{sourceId:n,lastCollectedAt:r}=e,i=x(We),a=i===`zh`,o;t[0]===n?o=t[1]:(o=e=>e.sources.find(e=>e.grantId===n),t[0]=n,t[1]=o);let s=B(o);if(!s){let e;t[2]!==i||t[3]!==r||t[4]!==a?(e=r?`${a?`上次更新:`:`Last updated: `}${new Date(r).toLocaleString(i)}`:a?`尚未分析`:`Not analyzed yet`,t[2]=i,t[3]=r,t[4]=a,t[5]=e):e=t[5];let n;return t[6]===e?n=t[7]:(n=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e}),t[6]=e,t[7]=n),n}let c;t[8]===a?c=t[9]:(c=a?{queued:`等待更新`,waiting_desktop:`等待桌面端读取资料`,reading:`正在读取资料`,analyzing:`正在更新理解`}:{queued:`Queued`,waiting_desktop:`Waiting for desktop collection`,reading:`Reading source`,analyzing:`Updating understanding`},t[8]=a,t[9]=c);let l=c,u=s.status===`running`||s.status===`queued`,d=s.status===`failed`||s.status===`partial`||s.status===`canceled`,f=s.metadata.added,p=u?l[s.metadata.phase??`queued`]??l.queued:d?a?`更新未完成,可重试`:`Update incomplete; retry available`:f===0?a?`更新完成,暂无新增理解`:`Updated; no new understanding`:f===void 0?a?`更新完成`:`Updated`:a?`更新完成,新增 ${f} 条`:`Updated; ${f} added`,m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`p`,{children:p}),t[10]=p,t[11]=m);let h;t[12]!==i||t[13]!==s.completedAt?(h=s.completedAt?(0,Q.jsx)(`p`,{children:new Date(s.completedAt).toLocaleString(i)}):null,t[12]=i,t[13]=s.completedAt,t[14]=h):h=t[14];let g;t[15]!==d||t[16]!==s.errorMessage?(g=d&&s.errorMessage?(0,Q.jsx)(`p`,{className:`text-danger`,children:s.errorMessage}):null,t[15]=d,t[16]=s.errorMessage,t[17]=g):g=t[17];let _;return t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,Q.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,"aria-live":`polite`,children:[m,h,g]}),t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function We(e){return e.language}function Ge(e){let t=(0,Z.c)(64),{language:n,busy:r,statement:i,scope:a,onEdit:o,onDelete:s,onScopeChange:c}=e,[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),m=n===`zh`,h=m?`修改或删除这条内容`:`Edit or delete this item`,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":`true`}),t[0]=_):_=t[0];let v;t[1]!==r||t[2]!==h?(v=(0,Q.jsx)(ae,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,className:`size-11 shrink-0 p-0`,disabled:r,"aria-label":h,children:_})}),t[1]=r,t[2]=h,t[3]=v):v=t[3];let y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":`true`}),t[4]=y):y=t[4];let b=m?`修改`:`Edit`,x;t[5]!==r||t[6]!==o||t[7]!==b?(x=(0,Q.jsxs)(N,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:o,children:[y,b]}),t[5]=r,t[6]=o,t[7]=b,t[8]=x):x=t[8];let C;t[9]!==r||t[10]!==c||t[11]!==a||t[12]!==m?(C=a&&c?(0,Q.jsxs)(N,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:()=>f(!0),children:[(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":`true`}),m?`作用范围`:`Where it applies`]}):null,t[9]=r,t[10]=c,t[11]=a,t[12]=m,t[13]=C):C=t[13];let k,j;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>u(!0),j=(0,Q.jsx)(se,{className:`size-4`,"aria-hidden":`true`}),t[14]=k,t[15]=j):(k=t[14],j=t[15]);let M=m?`删除`:`Delete`,P;t[16]!==r||t[17]!==M?(P=(0,Q.jsxs)(N,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded-lg px-3 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,disabled:r,onSelect:k,children:[j,M]}),t[16]=r,t[17]=M,t[18]=P):P=t[18];let F;t[19]!==P||t[20]!==x||t[21]!==C?(F=(0,Q.jsx)(ie,{children:(0,Q.jsxs)(Fe,{align:`end`,sideOffset:4,className:`z-[100] min-w-36 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[x,C,P]})}),t[19]=P,t[20]=x,t[21]=C,t[22]=F):F=t[22];let I;t[23]!==F||t[24]!==v?(I=(0,Q.jsxs)(R,{modal:!1,children:[v,F]}),t[23]=F,t[24]=v,t[25]=I):I=t[25];let L;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(S,{className:`fixed inset-0 z-[110] bg-scrim`}),t[26]=L):L=t[26];let z=m?`删除这条内容?`:`Delete this item?`,B;t[27]===z?B=t[28]:(B=(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:z}),t[27]=z,t[28]=B);let V=m?`删除后将不再使用这条记忆,原始对话和文件会保留。`:`This memory will no longer be used. Original conversations and files are kept.`,H;t[29]===V?H=t[30]:(H=(0,Q.jsx)(w,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V}),t[29]=V,t[30]=H);let U;t[31]!==B||t[32]!==H?(U=(0,Q.jsxs)(`header`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[B,H]}),t[31]=B,t[32]=H,t[33]=U):U=t[33];let W;t[34]===i?W=t[35]:(W=(0,Q.jsx)(`p`,{className:`min-h-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words px-5 py-4 text-sm leading-6 text-fg`,children:i}),t[34]=i,t[35]=W);let K=m?`取消`:`Cancel`,q;t[36]===K?q=t[37]:(q=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,children:K})}),t[36]=K,t[37]=q);let te;t[38]===s?te=t[39]:(te=()=>{u(!1),s()},t[38]=s,t[39]=te);let ne=m?`删除`:`Delete`,re;t[40]!==r||t[41]!==te||t[42]!==ne?(re=(0,Q.jsx)(A,{disabled:r,onClick:te,children:ne}),t[40]=r,t[41]=te,t[42]=ne,t[43]=re):re=t[43];let J;t[44]!==q||t[45]!==re?(J=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[q,re]}),t[44]=q,t[45]=re,t[46]=J):J=t[46];let Y;t[47]!==U||t[48]!==W||t[49]!==J?(Y=(0,Q.jsxs)(E,{children:[L,(0,Q.jsxs)(D,{className:`fixed left-1/2 top-1/2 z-[120] flex h-[min(22rem,calc(100dvh-2rem))] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[U,W,J]})]}),t[47]=U,t[48]=W,t[49]=J,t[50]=Y):Y=t[50];let ce;t[51]!==l||t[52]!==I||t[53]!==Y?(ce=(0,Q.jsxs)(O,{open:l,onOpenChange:u,children:[I,Y]}),t[51]=l,t[52]=I,t[53]=Y,t[54]=ce):ce=t[54];let le;t[55]!==r||t[56]!==c||t[57]!==a||t[58]!==d||t[59]!==m?(le=a&&c?(0,Q.jsx)(O,{open:d,onOpenChange:f,children:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(S,{className:`fixed inset-0 z-[110] bg-scrim`}),(0,Q.jsxs)(D,{className:`fixed left-1/2 top-1/2 z-[120] flex h-[min(25rem,calc(100dvh-2rem))] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,Q.jsxs)(`header`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:m?`这条记忆在哪里生效?`:`Where should this memory apply?`}),(0,Q.jsx)(w,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m?`你可以让它用于所有协作,或只用于当前助手。`:`Use it across all work, or keep it only for this assistant.`})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-4`,children:[{value:{type:`global`},icon:ye,title:m?`所有协作`:`All work`,detail:m?`任何助手和对话都可按需使用`:`Available when relevant in any assistant or conversation`},{value:{type:`agent`,id:a.type===`agent`?a.id??`main`:`main`},icon:oe,title:m?`仅当前助手`:`This assistant only`,detail:m?`不会分享给其他助手`:`Not shared with other assistants`}].map(e=>{let{value:t,icon:n,title:i,detail:o}=e,s=a.type===t.type&&(a.id??``)===(t.id??``);return(0,Q.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full items-center gap-3 rounded-xl px-4 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${s?`bg-surface-active`:`hover:bg-surface-hover`}`,disabled:r,onClick:()=>{f(!1),c(t)},children:[(0,Q.jsx)(n,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:o})]}),s?(0,Q.jsx)(`span`,{className:`text-xs font-medium text-accent-fg`,children:m?`当前`:`Current`}):null]},t.type)})}),(0,Q.jsx)(`footer`,{className:`flex shrink-0 justify-end border-t border-edge px-5 py-3`,children:(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,children:m?`取消`:`Cancel`})})})]})]})}):null,t[55]=r,t[56]=c,t[57]=a,t[58]=d,t[59]=m,t[60]=le):le=t[60];let ue;return t[61]!==ce||t[62]!==le?(ue=(0,Q.jsxs)(Q.Fragment,{children:[ce,le]}),t[61]=ce,t[62]=le,t[63]=ue):ue=t[63],ue}function Ke(e,t){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}).format(e):null}function qe(e,t,n=new Date){let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(r);i.setDate(r.getDate()-1);let a=new Map;for(let n of[...e].sort((e,t)=>t.recordedAt-e.recordedAt)){let e=n.recordedAt>=r.getTime()?t===`zh`?`今天`:`Today`:n.recordedAt>=i.getTime()?t===`zh`?`昨天`:`Yesterday`:Ke(n.recordedAt,t)??(t===`zh`?`更早`:`Earlier`),o=a.get(e)??[];o.push(n),a.set(e,o)}return[...a].map(([e,t])=>({label:e,items:t}))}function Je(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 Ye(e,t){if(e.validTo){let n=Ke(e.validTo,t);return t===`zh`?`适用至 ${n}`:`Applies until ${n}`}return(t===`zh`?{stable:`相对稳定`,slow:`会随时间复核`,dynamic:`近期状态`,event:`特定阶段`}:{stable:`Relatively stable`,slow:`Reviewed over time`,dynamic:`Current context`,event:`Specific period`})[e.volatility]}function Xe(e,t){return e.authority===`user_explicit`?null:e.confidence>=.85?t===`zh`?`把握较高`:`High confidence`:e.confidence>=.65?t===`zh`?`把握中等`:`Medium confidence`:t===`zh`?`证据较少`:`Limited evidence`}function Ze(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 Qe(e){let t=(0,Z.c)(24),{item:n,language:r,busy:i,editing:a,draft:o,onDraftChange:s,onEdit:c,onCancel:l,onDelete:u,onCorrect:d,onScopeChange:f}=e,p=(0,X.useId)(),m=r===`zh`,h;t[0]!==n||t[1]!==r?(h=Xe(n,r),t[0]=n,t[1]=r,t[2]=h):h=t[2];let g=h,_;t[3]===n.sources?_=t[4]:(_=new Set(n.sources?.map(et).filter(Boolean)),t[3]=n.sources,t[4]=_);let v;t[5]===_?v=t[6]:(v=[..._],t[5]=_,t[6]=v);let y=v,b=m?`修改`:`Edit`,x;return t[7]!==i||t[8]!==g||t[9]!==o||t[10]!==b||t[11]!==a||t[12]!==p||t[13]!==n||t[14]!==r||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==c||t[20]!==f||t[21]!==y||t[22]!==m?(x=(0,Q.jsx)(`article`,{className:`border-t border-edge-subtle px-4 py-3 first:border-t-0 sm:px-5 [content-visibility:auto] [contain-intrinsic-size:auto_100px]`,children:a?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:p,children:m?`修改这条理解`:`Edit this understanding`}),(0,Q.jsx)(`textarea`,{id:p,value:o,disabled:i,onChange:e=>s(e.target.value),className:`mt-2 min-h-28 w-full resize-y rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-base leading-7 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(A,{variant:`ghost`,disabled:i,onClick:l,children:m?`取消`:`Cancel`}),(0,Q.jsx)(A,{variant:`primary`,disabled:!o.trim()||i,onClick:d,children:i?m?`保存中…`:`Saving…`:m?`保存修改`:`Save changes`})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 sm:gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-1.5`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg`,children:n.statement}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Je(n,r)}),n.usable===!1?(0,Q.jsx)(`span`,{children:m?`暂不使用`:`Not in use`}):null,n.validTo?(0,Q.jsx)(`span`,{children:Ye(n,r)}):null,n.authority!==`user_explicit`&&n.confidence<.65?(0,Q.jsx)(`span`,{children:g}):null,(0,Q.jsxs)(`details`,{className:`open:basis-full`,children:[(0,Q.jsx)(`summary`,{className:`w-fit cursor-pointer rounded-md py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m?`查看依据`:`View sources`}),(0,Q.jsxs)(`div`,{className:`my-2 space-y-1 border-l-2 border-edge pl-3 text-sm leading-6`,children:[(0,Q.jsx)(`p`,{children:n.usable?m?`按需用于当前协作`:`Used when relevant`:m?`暂不使用,后台继续复核`:`Not in use; reviewed automatically`}),(0,Q.jsxs)(`p`,{children:[Ye(n,r),` · `,Ze(n.scope,r),g?` · ${g}`:``]}),(0,Q.jsxs)(`p`,{children:[m?`最近观察:`:`Last observed: `,Ke(n.observedAt,r)]}),(0,Q.jsxs)(`p`,{children:[m?`模型层:`:`Model layer: `,m?{fact:`事实`,pattern:`模式`,interpretation:`解释`}[n.layer]:n.layer,` · `,m?`${n.independentSourceCount} 个独立来源`:`${n.independentSourceCount} independent sources`]}),y.length?y.map($e):(0,Q.jsx)(`p`,{children:m?`暂无更详细的来源记录`:`No further source details available`}),(0,Q.jsx)(A,{variant:`ghost`,className:`-ml-2 px-2`,disabled:i,onClick:c,children:b})]})]})]})]}),(0,Q.jsx)(Ge,{language:r,busy:i,statement:n.statement,scope:n.scope,onEdit:c,onDelete:u,onScopeChange:f})]})}),t[7]=i,t[8]=g,t[9]=o,t[10]=b,t[11]=a,t[12]=p,t[13]=n,t[14]=r,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=c,t[20]=f,t[21]=y,t[22]=m,t[23]=x):x=t[23],x}function $e(e){return(0,Q.jsx)(`p`,{className:`break-words`,children:e},e)}function et(e){return e.label}var tt={zh:{eyebrow:`全局用户理解`,title:`xopc 如何形成对你的理解`,subtitle:`这里汇总跨项目、跨对话形成的认识,并说明它们来自哪些渠道。项目事实不会混入你的个人画像。`,channels:`理解渠道`,channelHint:`查看来源及其最近更新。`,noChannels:`尚未通过任何渠道形成可展示的全局理解。`,activeCount:`{{count}} 条已在使用`,pendingCount:`{{count}} 条暂不使用`,noUnderstanding:`暂无来自此渠道的全局理解`,pending:`最近更新`,pendingHint:`自动整理并按需使用,你可以随时修改或删除。`,nothingPending:`尚未形成全局理解。`,showAll:`查看全部 {{count}} 条`,showLess:`收起`,done:`完成`,updating:`正在从已授权渠道更新理解;你可以先查看已有内容。`,sourceKinds:{user:`你明确告诉我的`,conversation:`对话与协作`,connector:`连接的服务`,work_folder:`工作目录`,local_source:`本机来源`,inference:`综合整理`}},en:{eyebrow:`Global user understanding`,title:`How xopc forms its understanding of you`,subtitle:`This brings together understanding formed across projects and conversations, with the channel behind each item. Project facts stay out of your personal portrait.`,channels:`Understanding channels`,channelHint:`View sources and their latest updates.`,noChannels:`No channel has formed displayable global understanding yet.`,activeCount:`{{count}} in use`,pendingCount:`{{count}} not in use`,noUnderstanding:`No usable global understanding has formed from this channel yet`,pending:`Recent updates`,pendingHint:`Organized automatically and used when relevant. Edit or delete anytime.`,nothingPending:`No understanding has formed yet.`,showAll:`View all {{count}}`,showLess:`Show less`,done:`Done`,updating:`Updating from authorized channels. You can review existing understanding now.`,sourceKinds:{user:`You told me`,conversation:`Conversations and work`,connector:`Connected services`,work_folder:`Work folders`,local_source:`On-device sources`,inference:`Synthesized understanding`}}},nt={"local-recent-files":{en:`Recent files`,zh:`最近文件`},"chromium-bookmarks":{en:`Recent bookmarks`,zh:`最近书签`},"apple-notes":{en:`Apple Notes`,zh:`Apple 备忘录`},"apple-mail":{en:`Apple Mail`,zh:`Apple 邮件`},"apple-calendar":{en:`Apple Calendar`,zh:`Apple 日历`},"apple-reminders":{en:`Apple Reminders`,zh:`Apple 提醒事项`},"windows-recent-documents":{en:`Recent documents`,zh:`最近文档`},"linux-recent-documents":{en:`Recent documents`,zh:`最近文档`}},rt={user:fe,conversation:Ne,connector:ce,work_folder:m,local_source:_e,inference:ce},it={files:m,recent_documents:_e,calendar:J,tasks:W,notes:ne,mail:F,messages:Ne,code_activity:Ae};function $(e){let t=e.authority===`user_explicit`?`user`:e.authority===`user_observed`?`conversation`:e.authority===`external_untrusted`?`connector`:`inference`;return{id:t,kind:t,observedAt:e.observedAt}}function at(e,t){return e.kind===`local_source`&&e.label?nt[e.label]?.[t]??e.label:e.kind===`work_folder`&&e.label?t===`zh`?`工作目录 · ${e.label}`:`Work folder · ${e.label}`:e.label?e.label:tt[t].sourceKinds[e.kind]}function ot(e){return`${e.kind}:${e.adapterId}:${e.displayName}`}function st(e){let t=(0,Z.c)(91),{assertions:n,configuredSources:r,activityRunning:i,language:a,busy:o,error:c,onReviewAssertion:l,onCompleted:u}=e,f=tt[a],[p,m]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(``),x;t[0]===n?x=t[1]:(x=n.filter(mt),t[0]=n,t[1]=x);let S=x,C;t[2]===S?C=t[3]:(C=[...S].sort(pt),t[2]=S,t[3]=C);let w=C,T;if(t[4]!==r||t[5]!==S||t[6]!==a){let e=new Map;for(let t of r){let n=t.kind===`local_source`?nt[t.adapterId]?.[a]??t.displayName:t.displayName,r=ot(t);e.set(r,{key:r,grantId:t.id,kind:t.kind,category:t.category,label:t.kind===`work_folder`?a===`zh`?`工作目录 · ${n}`:`Work folder · ${n}`:n,assertions:[],lastObservedAt:t.lastCollectedAt})}for(let t of S)for(let n of t.sources?.length?t.sources:[$(t)]){let r=at(n,a),i=[...e.values()].find(e=>e.kind===n.kind&&e.label===r),o=i?.key??`${n.kind}:${r}`,s=i??e.get(o)??{key:o,kind:n.kind,category:n.category,label:r,assertions:[],lastObservedAt:n.observedAt};s.assertions.some(e=>e.id===t.id)||s.assertions.push(t),s.lastObservedAt=Math.max(s.lastObservedAt??0,n.observedAt),e.set(o,s)}T=[...e.values()].sort(ft),t[4]=r,t[5]=S,t[6]=a,t[7]=T}else T=t[7];let E=T,D;t[8]===l?D=t[9]:(D=async(e,t,n)=>{await l(e,t,n)&&_(null)},t[8]=l,t[9]=D);let ee=D,O,k,j,M,N,P,F,I,L;if(t[10]!==i||t[11]!==o||t[12]!==v||t[13]!==g||t[14]!==a||t[15]!==w||t[16]!==ee||t[17]!==p||t[18]!==f.eyebrow||t[19]!==f.nothingPending||t[20]!==f.pending||t[21]!==f.pendingHint||t[22]!==f.showAll||t[23]!==f.showLess||t[24]!==f.subtitle||t[25]!==f.title||t[26]!==f.updating){let e=p?w:w.slice(0,5);O=`mx-auto w-full max-w-[42rem] pb-2`,k=`polite`;let n;t[36]===f.eyebrow?n=t[37]:(n=(0,Q.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.18em] text-accent-fg`,children:f.eyebrow}),t[36]=f.eyebrow,t[37]=n);let r;t[38]===f.title?r=t[39]:(r=(0,Q.jsx)(`h2`,{className:`mt-3 text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:f.title}),t[38]=f.title,t[39]=r);let s;t[40]===f.subtitle?s=t[41]:(s=(0,Q.jsx)(`p`,{className:`mx-auto mt-3 max-w-[38rem] text-sm leading-6 text-fg-muted`,children:f.subtitle}),t[40]=f.subtitle,t[41]=s),t[42]!==n||t[43]!==r||t[44]!==s?(j=(0,Q.jsxs)(`div`,{className:`text-center`,children:[n,r,s]}),t[42]=n,t[43]=r,t[44]=s,t[45]=j):j=t[45],t[46]!==i||t[47]!==f.updating?(M=i?(0,Q.jsxs)(`div`,{className:`mt-6 flex items-center gap-3 rounded-xl border border-accent/20 bg-accent-soft/55 px-4 py-3 text-sm text-accent-fg`,children:[(0,Q.jsx)(h,{className:`size-4 shrink-0 animate-spin motion-reduce:animate-none`}),(0,Q.jsx)(`p`,{children:f.updating})]}):null,t[46]=i,t[47]=f.updating,t[48]=M):M=t[48],N=`mt-8`,P=`understanding-updates-title`;let c=w.length?` · ${w.length}`:``;t[49]!==f.pending||t[50]!==c?(F=(0,Q.jsxs)(`h3`,{id:`understanding-updates-title`,className:`text-sm font-semibold text-fg`,children:[f.pending,c]}),t[49]=f.pending,t[50]=c,t[51]=F):F=t[51],t[52]===f.pendingHint?I=t[53]:(I=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.pendingHint}),t[52]=f.pendingHint,t[53]=I),L=w.length?(0,Q.jsxs)(`div`,{className:`mt-3`,children:[qe(e,a).map(e=>{let{label:t,items:n}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`border-b border-edge-subtle px-4 pb-2 pt-3 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{children:n.map(e=>(0,Q.jsx)(Qe,{item:e,language:a,busy:o,editing:g===e.id,draft:v,onDraftChange:y,onEdit:()=>{_(e.id),y(e.statement)},onCancel:()=>_(null),onCorrect:()=>void ee(e,`edited`,v.trim()),onDelete:()=>void ee(e,`deleted`)},e.id))})]},t)}),w.length>5?(0,Q.jsxs)(`button`,{type:`button`,className:`mx-auto flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>m(dt),children:[p?f.showLess:f.showAll.replace(`{{count}}`,String(w.length)),(0,Q.jsx)(z,{className:b(`size-3.5 transition-transform`,p&&`rotate-180`)})]}):null]}):(0,Q.jsxs)(`div`,{className:`mt-3 flex items-start gap-3 rounded-xl border border-edge bg-surface-base/55 p-4`,children:[(0,Q.jsx)(d,{className:`mt-0.5 size-5 shrink-0 text-success`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:f.nothingPending})]}),t[10]=i,t[11]=o,t[12]=v,t[13]=g,t[14]=a,t[15]=w,t[16]=ee,t[17]=p,t[18]=f.eyebrow,t[19]=f.nothingPending,t[20]=f.pending,t[21]=f.pendingHint,t[22]=f.showAll,t[23]=f.showLess,t[24]=f.subtitle,t[25]=f.title,t[26]=f.updating,t[27]=O,t[28]=k,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L}else O=t[27],k=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35];let R;t[54]!==N||t[55]!==P||t[56]!==F||t[57]!==I||t[58]!==L?(R=(0,Q.jsxs)(`section`,{className:N,"aria-labelledby":P,children:[F,I,L]}),t[54]=N,t[55]=P,t[56]=F,t[57]=I,t[58]=L,t[59]=R):R=t[59];let B;t[60]!==E.length||t[61]!==f.channels?(B=(0,Q.jsxs)(`summary`,{className:`w-fit cursor-pointer rounded-md py-2 text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f.channels,` · `,E.length]}),t[60]=E.length,t[61]=f.channels,t[62]=B):B=t[62];let V;t[63]===f.channelHint?V=t[64]:(V=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.channelHint}),t[63]=f.channelHint,t[64]=V);let H;t[65]!==E||t[66]!==f.activeCount||t[67]!==f.noChannels||t[68]!==f.noUnderstanding||t[69]!==f.pendingCount?(H=E.length?(0,Q.jsx)(`div`,{className:`mt-3 space-y-3`,children:E.map(e=>{let t=e.category?it[e.category]??rt[e.kind]:rt[e.kind],n=e.assertions.filter(ut).length,r=e.assertions.filter(lt).length;return(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge bg-surface-base/55 px-4 py-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h4`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),e.grantId?(0,Q.jsx)(Ue,{sourceId:e.grantId,lastCollectedAt:e.lastObservedAt}):null,e.assertions.length?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[n?f.activeCount.replace(`{{count}}`,String(n)):``,r?f.pendingCount.replace(`{{count}}`,String(r)):``].filter(Boolean).join(` · `)}):(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:f.noUnderstanding})]}),e.grantId?(0,Q.jsx)(ze,{sourceId:e.grantId}):null]}),e.assertions.length?(0,Q.jsx)(`ul`,{className:`ml-12 mt-3 space-y-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.assertions.slice(0,5).map(ct)}):null]},e.key)})}):(0,Q.jsx)(`p`,{className:`mt-3 rounded-xl border border-edge bg-surface-base/55 p-4 text-sm text-fg-muted`,children:f.noChannels}),t[65]=E,t[66]=f.activeCount,t[67]=f.noChannels,t[68]=f.noUnderstanding,t[69]=f.pendingCount,t[70]=H):H=t[70];let U;t[71]!==B||t[72]!==V||t[73]!==H?(U=(0,Q.jsxs)(`details`,{className:`mt-6 border-t border-edge pt-4`,children:[B,V,H]}),t[71]=B,t[72]=V,t[73]=H,t[74]=U):U=t[74];let W;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(s,{className:`size-4`}),t[75]=W):W=t[75];let G;t[76]!==o||t[77]!==u||t[78]!==f.done?(G=(0,Q.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,Q.jsxs)(A,{variant:`primary`,disabled:o,onClick:u,children:[W,f.done]})}),t[76]=o,t[77]=u,t[78]=f.done,t[79]=G):G=t[79];let K;t[80]===c?K=t[81]:(K=c?(0,Q.jsx)(`p`,{className:`mt-5 text-sm text-danger`,role:`alert`,children:c}):null,t[80]=c,t[81]=K);let q;return t[82]!==O||t[83]!==k||t[84]!==j||t[85]!==M||t[86]!==R||t[87]!==U||t[88]!==G||t[89]!==K?(q=(0,Q.jsxs)(`section`,{className:O,"aria-live":k,children:[j,M,R,U,G,K]}),t[82]=O,t[83]=k,t[84]=j,t[85]=M,t[86]=R,t[87]=U,t[88]=G,t[89]=K,t[90]=q):q=t[90],q}function ct(e){return(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent/60`}),(0,Q.jsx)(`span`,{children:e.statement})]},e.id)}function lt(e){return!e.usable}function ut(e){return e.usable}function dt(e){return!e}function ft(e,t){return t.assertions.length-e.assertions.length||(t.lastObservedAt??0)-(e.lastObservedAt??0)}function pt(e,t){return t.recordedAt-e.recordedAt}function mt(e){return e.scope.type===`global`&&e.status!==`archived`&&e.status!==`rejected`}function ht(){let{pathname:e,search:t}=o(),n=x(e=>e.language),r=Oe(),[i,a]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),l=e===`/user-model`,{data:u,mutate:d}=k(l?`/api/user-model`:null,pe),f=B(e=>e.error),p=B(e=>e.sources.some(e=>e.status===`running`||e.status===`queued`)),m=n===`zh`;if((0,X.useEffect)(()=>{l&&new URLSearchParams(t).get(`workDiscovery`)===`review`&&Oe.getState().setDrawerOpen(!0)},[l,t]),(0,X.useEffect)(()=>{l&&r.status!==`running`&&d()},[d,l,r.directoryRun?.id,r.status]),!l)return null;let g=r.status===`running`||p,_=async(e,t,n)=>{a(!0),c(null);try{return t===`edited`&&n?await xe(e.id,n):t===`deleted`&&await ke(e.id),await d(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}finally{a(!1)}},v=e=>{if(!e&&u&&r.status!==`running`){r.finish();return}r.setDrawerOpen(e)};return(0,Q.jsxs)(O,{open:r.drawerOpen,onOpenChange:v,children:[(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(A,{type:`button`,variant:`ghost`,className:b(`relative size-8 rounded-xl p-0`,q),title:m?`查看 xopc 对你的理解`:`Review what xopc understands`,"aria-label":m?`查看 xopc 对你的理解`:`Review what xopc understands`,children:g?(0,Q.jsx)(h,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,Q.jsx)(U,{className:`size-4 text-accent-fg`})})}),(0,Q.jsxs)(E,{children:[(0,Q.jsx)(S,{className:`fixed inset-0 z-[60] bg-scrim backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:backdrop-blur-none`}),(0,Q.jsx)(`div`,{className:`pointer-events-none fixed inset-0 z-[61] flex items-center justify-center p-3 sm:p-6`,children:(0,Q.jsxs)(D,{className:`xopc-understanding-center pointer-events-auto flex h-[min(42rem,calc(100dvh-1.5rem))] w-[min(44rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float outline-none sm:h-[min(42rem,calc(100dvh-3rem))] sm:w-[min(44rem,calc(100vw-3rem))]`,children:[(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center justify-between border-b border-edge-subtle px-5 sm:px-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ee,{className:`text-sm font-semibold text-fg`,children:g?m?`正在更新用户理解`:`Updating user understanding`:m?`用户理解`:`User understanding`}),(0,Q.jsx)(w,{className:`mt-0.5 text-xs text-fg-muted`,children:g?m?`关闭窗口也会在后台继续`:`You can close this window; work continues in the background`:m?`自动更新,可随时修改或删除`:`Updated automatically. Edit or delete anytime`})]}),(0,Q.jsx)(ze,{disabled:!u?.sources?.length}),(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,className:`size-8 rounded-xl p-0`,"aria-label":m?`关闭`:`Close`,children:(0,Q.jsx)(y,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-7 sm:px-9 sm:py-9`,children:u?(0,Q.jsx)(st,{assertions:u.assertions,configuredSources:u.sources??[],activityRunning:g,language:n,busy:i,error:s??f??null,onReviewAssertion:_,onCompleted:()=>{v(!1)}}):(0,Q.jsxs)(`section`,{className:`space-y-4`,"aria-label":m?`正在加载用户理解`:`Loading user understanding`,children:[(0,Q.jsx)(j,{className:`h-8 w-2/3`}),(0,Q.jsx)(j,{className:`h-32 w-full`}),(0,Q.jsx)(j,{className:`h-32 w-full`})]})})]})})]})]})}function gt(e){let t=e.get(`tab`);return t===`understanding`||t===`privacy`?t:`overview`}var _t={en:{pageTitle:`Me`,pageSubtitle:`Your information and how xopc understands you.`,overview:`Overview`,understanding:`What xopc knows`,privacy:`Data & privacy`,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`,timezoneSearch:`Search timezones…`,timezoneNoMatch:`No matching 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`,allUnderstanding:`All understanding`,understandingFilterHint:`Filter this view by how each item was formed.`,importantNow:`What matters now`,prioritySourceGoal:`From a goal you confirmed`,prioritySourceWork:`From your current work`,editPriority:`Edit focus`,addPriority:`Set current focus`,priorityTitle:`Current focus`,priorityTitlePlaceholder:`What matters most right now?`,priorityOutcome:`What a good outcome looks like`,priorityOutcomePlaceholder:`Describe the result you want…`,priorityUntil:`Focus through`,savePriority:`Save focus`,endPriority:`End focus`,endingPriority:`Ending…`,priorityHint:`This is used to keep xopc aligned with what deserves attention 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:`Recent understanding from our work. You can edit any item.`,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`,refreshing:`Refreshing…`,refreshComplete:`Refreshed`,refreshFailed:`Refresh failed`,aboutYouTitle:`A view you can correct`,aboutYouHint:`xopc quietly maintains this working context from collaboration. You can edit or retire any item.`,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`,save:`Save correction`,cancel:`Cancel`,correctionPlaceholder:`Write the accurate version…`,searchPlaceholder:`Search work memory…`,allMemory:`All work memory`,memoryFilterHint:`Filter by memory type`,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.`,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:`对我的了解`,privacy:`数据与隐私`,knowledge:`工作记忆`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`你明确提供的基本信息会被清晰呈现并由你直接编辑;xopc 在对话与共事中形成的理解则单独维护。`,editProfile:`编辑基本信息`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:创业者、产品设计师、工程师`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,timezoneSearch:`搜索时区…`,timezoneNoMatch:`没有匹配的时区`,locale:`语言 / 地区`,useDeviceTimezone:`使用本机时区`,notProvided:`未填写`,editProfileHint:`这些是由你直接提供的事实,与 xopc 的观察和推断分开维护。`,saveProfile:`保存`,saving:`正在保存…`,explicit:`你告诉我的`,explicitHint:`你明确表达的事实与偏好`,learned:`协作中学到的`,learnedHint:`从实际协作中形成的认识`,allUnderstanding:`全部理解`,understandingFilterHint:`按内容来源筛选这份理解。`,importantNow:`此刻重要`,prioritySourceGoal:`来自你确认的当前目标`,prioritySourceWork:`来自当前工作上下文`,editPriority:`编辑`,addPriority:`设置当前关注`,priorityTitle:`当前关注`,priorityTitlePlaceholder:`现在最重要的是什么?`,priorityOutcome:`期待结果`,priorityOutcomePlaceholder:`描述你希望达成的结果…`,priorityUntil:`关注至`,savePriority:`保存关注`,endPriority:`结束关注`,endingPriority:`正在结束…`,priorityHint:`这项内容会帮助 xopc 在协作中优先关注当前最重要的事情。`,noPriority:`还没有设置当前优先事项。`,otherGoals:`其他进行中的目标`,howWeWork:`我们怎样协作`,howWeWorkHint:`你对沟通方式和执行行为的长期约定。`,noRules:`还没有形成协作偏好。`,recent:`最近形成的理解`,recentHint:`最近在协作中形成的认识,你可以随时修改。`,seeAll:`查看全部`,workMemory:`我在工作中记住的`,workMemoryHint:`项目事实、决定、经验和待解问题,与“关于你”的理解分别管理。`,items:`条`,maintenanceReady:`记忆整理已经启用,正在等待首次运行。`,maintenanceComplete:`最近一次记忆整理于`,maintenanceFailed:`最近一次记忆整理需要处理`,refresh:`刷新`,refreshing:`正在刷新…`,refreshComplete:`已刷新`,refreshFailed:`刷新失败`,aboutYouTitle:`一份可以共同修正的理解`,aboutYouHint:`xopc 会在协作中安静地维护这份工作认知。你仍可随时修改或停止使用任何一条。`,identity:`关于你是谁`,preferences:`偏好与工作节奏`,relationships:`重要的人与关系`,currentState:`当前状态`,insights:`我形成的判断`,emptyGroup:`这里还没有形成理解。`,correct:`修正`,save:`保存修正`,cancel:`取消`,correctionPlaceholder:`写下更准确的说法…`,searchPlaceholder:`搜索工作记忆…`,allMemory:`全部工作记忆`,memoryFilterHint:`按记忆类型筛选`,memoryLibraryHint:`这里只显示提炼后的事实、决定、经验、承诺和待解问题;邮件、日历与文档原文保留在对应来源中。`,noKnowledge:`还没有形成工作记忆。`,noKnowledgeMatch:`没有符合搜索条件的工作记忆。`,showMore:`显示更多`,expand:`查看详情`,collapse:`收起详情`,disable:`停用`,disabled:`已停用`,enable:`启用`,loadFailed:`无法载入对你的理解。`,tryAgain:`重试`,actionFailed:`修改没有保存,请重试。`}},vt=new Set([`identity.call_name`,`identity.role`,`identity.pronouns`,`preference.timezone`,`preference.locale`]),yt=[`work_thread`,`project_fact`,`workspace_fact`,`decision`,`task_lesson`,`commitment`,`open_question`,`episode`,`note`],bt=`UTC.Africa/Cairo.Africa/Johannesburg.America/Chicago.America/Denver.America/Los_Angeles.America/Mexico_City.America/New_York.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Kolkata.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Berlin.Europe/London.Europe/Madrid.Europe/Paris.Europe/Rome.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function xt(){try{let e=Intl.supportedValuesOf(`timeZone`);return[...new Set([`UTC`,...e])]}catch{return[...bt]}}var St=xt();function Ct(e){return e.map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.includes(`/`)?e.split(`/`)[0]:`UTC`}))}function wt(e,t,n=!1){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,...n?{timeStyle:`short`}:{}}).format(e):null}function Tt(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Et(e){return{callName:Tt(e.profile.callName)??``,role:Tt(e.profile.role)??``,pronouns:Tt(e.profile.pronouns)??``,timezone:Tt(e.profile.timezone)??``,locale:Tt(e.profile.locale)??``}}function Dt(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 Ot(e){return Array.from(e.trim()).slice(0,2).join(``).toLocaleUpperCase()}function kt(e,t){let n=wt(e,t);return t===`zh`?`当前安排至 ${n}`:`Current plan through ${n}`}function At(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function jt(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function Mt(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 Nt(e,t){return(t===`zh`?{work_thread:`工作主线`,project_fact:`项目事实`,workspace_fact:`工作区事实`,decision:`已经决定`,task_lesson:`工作经验`,commitment:`承诺与约定`,open_question:`待解问题`,episode:`重要经历`,note:`其他记录`}:{work_thread:`Work threads`,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 Pt(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 Ft(e){let t=(0,Z.c)(16),{title:n,hint:r,action:i,children:a,className:o}=e,s=o===void 0?``:o,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,Q.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,Q.jsxs)(`header`,{className:`flex items-end justify-between gap-4 px-1 pb-3`,children:[u,i]}),t[7]=i,t[8]=u,t[9]=d):d=t[9];let f;t[10]===a?f=t[11]:(f=(0,Q.jsx)(`div`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:a}),t[10]=a,t[11]=f);let p;return t[12]!==s||t[13]!==d||t[14]!==f?(p=(0,Q.jsxs)(`section`,{className:s,children:[d,f]}),t[12]=s,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function It(e){let t=(0,Z.c)(7),{icon:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`p`,{children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-5 text-sm text-fg-muted`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Lt({open:e,profile:t,language:n,saving:r,onOpenChange:i,onSave:a}){let o=_t[n],[s,d]=(0,X.useState)(t),[f,p]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(t),p(``))},[e,t]);let m=e=>{e.preventDefault(),a({callName:s.callName.trim(),role:s.role.trim(),pronouns:s.pronouns.trim(),timezone:s.timezone.trim(),locale:s.locale.trim()})},g=(e,t,n)=>(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,Q.jsx)(`input`,{value:s[e],onChange:t=>d(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`})]}),_=[`zh-CN`,`zh-TW`,`en-US`,`en-GB`,`ja-JP`];s.locale&&!_.includes(s.locale)&&_.push(s.locale);let v=Se(),b=(0,X.useMemo)(()=>[...new Set([...St,v,s.timezone].filter(Boolean))].sort(),[v,s.timezone]),x=f.trim().toLocaleLowerCase(),C=(0,X.useMemo)(()=>Ct(b.filter(e=>!x||e.toLocaleLowerCase().includes(x)||e.replaceAll(`_`,` `).toLocaleLowerCase().includes(x))),[b,x]);return(0,Q.jsx)(O,{open:e,onOpenChange:i,children:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(S,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsx)(D,{className:`xopc-dialog-content 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 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:m,children:[(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:o.editProfile}),(0,Q.jsx)(w,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.editProfileHint})]}),(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:(0,Q.jsx)(y,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,Q.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[g(`callName`,o.callName,o.callNamePlaceholder),g(`role`,o.role,o.rolePlaceholder),g(`pronouns`,o.pronouns,o.pronounsPlaceholder),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:o.locale}),(0,Q.jsxs)(c,{value:s.locale,onChange:e=>d(t=>({...t,locale:e.target.value})),children:[(0,Q.jsx)(l,{value:``,children:o.notProvided}),_.map(e=>(0,Q.jsx)(l,{value:e,children:Dt(e,n)},e))]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:col-span-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:o.timezone}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(u,{value:s.timezone,options:C,placeholder:Se(),emptyLabel:o.notProvided,ariaLabel:o.timezone,selectedLabel:s.timezone||o.notProvided,searchPlaceholder:o.timezoneSearch,searchValue:f,onSearchChange:p,statusMessage:C.length?void 0:o.timezoneNoMatch,triggerClassName:`min-w-0 flex-1 rounded-xl bg-surface-base`,onChange:e=>{d(t=>({...t,timezone:e})),p(``)}}),(0,Q.jsx)(A,{className:`shrink-0 whitespace-nowrap`,onClick:()=>d(e=>({...e,timezone:v})),children:o.useDeviceTimezone})]})]})]})}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{disabled:r,children:o.cancel})}),(0,Q.jsxs)(A,{type:`submit`,variant:`primary`,disabled:r,children:[r?(0,Q.jsx)(h,{className:`size-4 animate-spin`}):null,r?o.saving:o.saveProfile]})]})]})})]})})}function Rt(e){let t=(0,Z.c)(94),{open:n,priority:r,title:i,outcome:a,language:o,saving:s,onOpenChange:c,onSave:l,onEnd:u}=e,d=_t[o],[f,p]=(0,X.useState)(i),[m,g]=(0,X.useState)(a??``),_=r?.validTo??Date.now()+6048e5,v;t[0]===_?v=t[1]:(v=At(_),t[0]=_,t[1]=v);let b=v,[x,C]=(0,X.useState)(b),k,j;t[2]!==b||t[3]!==n||t[4]!==a||t[5]!==i?(k=()=>{n&&(p(i),g(a??``),C(b))},j=[b,n,a,i],t[2]=b,t[3]=n,t[4]=a,t[5]=i,t[6]=k,t[7]=j):(k=t[6],j=t[7]),(0,X.useEffect)(k,j);let M;t[8]!==m||t[9]!==f||t[10]!==x||t[11]!==l||t[12]!==r?.targetType?(M=e=>{e.preventDefault(),l({title:f.trim(),...r?.targetType===`goal`?{desiredOutcome:m.trim()}:{},validTo:jt(x)})},t[8]=m,t[9]=f,t[10]=x,t[11]=l,t[12]=r?.targetType,t[13]=M):M=t[13];let N=M,P;t[14]!==m||t[15]!==f||t[16]!==x||t[17]!==r?.targetType?(P=f.trim()&&x&&(r?.targetType!==`goal`||m.trim()),t[14]=m,t[15]=f,t[16]=x,t[17]=r?.targetType,t[18]=P):P=t[18];let F=!!P,I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(S,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[19]=I):I=t[19];let L=r?d.editPriority:d.addPriority,R;t[20]===L?R=t[21]:(R=(0,Q.jsx)(ee,{className:`font-semibold text-fg`,children:L}),t[20]=L,t[21]=R);let z;t[22]===d.priorityHint?z=t[23]:(z=(0,Q.jsx)(w,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.priorityHint}),t[22]=d.priorityHint,t[23]=z);let B;t[24]!==z||t[25]!==R?(B=(0,Q.jsxs)(`div`,{children:[R,z]}),t[24]=z,t[25]=R,t[26]=B):B=t[26];let V;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(y,{className:`size-4`}),t[27]=V):V=t[27];let H;t[28]===d.cancel?H=t[29]:(H=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":d.cancel,children:V})}),t[28]=d.cancel,t[29]=H);let U;t[30]!==B||t[31]!==H?(U=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4 sm:px-6`,children:[B,H]}),t[30]=B,t[31]=H,t[32]=U):U=t[32];let W;t[33]===d.priorityTitle?W=t[34]:(W=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityTitle}),t[33]=d.priorityTitle,t[34]=W);let G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>p(e.target.value),t[35]=G):G=t[35];let K;t[36]!==f||t[37]!==d.priorityTitlePlaceholder?(K=(0,Q.jsx)(`input`,{autoFocus:!0,value:f,onChange:G,placeholder:d.priorityTitlePlaceholder,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`}),t[36]=f,t[37]=d.priorityTitlePlaceholder,t[38]=K):K=t[38];let q;t[39]!==W||t[40]!==K?(q=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[W,K]}),t[39]=W,t[40]=K,t[41]=q):q=t[41];let te;t[42]!==m||t[43]!==r?.targetType||t[44]!==d.priorityOutcome||t[45]!==d.priorityOutcomePlaceholder?(te=r?.targetType===`goal`?(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityOutcome}),(0,Q.jsx)(`textarea`,{value:m,onChange:e=>g(e.target.value),placeholder:d.priorityOutcomePlaceholder,className:`min-h-28 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 placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`})]}):null,t[42]=m,t[43]=r?.targetType,t[44]=d.priorityOutcome,t[45]=d.priorityOutcomePlaceholder,t[46]=te):te=t[46];let ne;t[47]===d.priorityUntil?ne=t[48]:(ne=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:d.priorityUntil}),t[47]=d.priorityUntil,t[48]=ne);let re;t[49]===r?.validFrom?re=t[50]:(re=r?.validFrom??Date.now(),t[49]=r?.validFrom,t[50]=re);let J;t[51]===re?J=t[52]:(J=At(re),t[51]=re,t[52]=J);let ie;t[53]!==x||t[54]!==d.priorityUntil||t[55]!==J?(ie=(0,Q.jsx)(Re,{min:J,value:x,onChange:C,ariaLabel:d.priorityUntil,className:`rounded-xl border border-edge bg-surface-base hover:border-edge-strong hover:bg-surface-base`}),t[53]=x,t[54]=d.priorityUntil,t[55]=J,t[56]=ie):ie=t[56];let ae;t[57]!==ne||t[58]!==ie?(ae=(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[ne,ie]}),t[57]=ne,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]!==q||t[61]!==te||t[62]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5 sm:p-6`,children:[q,te,ae]}),t[60]=q,t[61]=te,t[62]=ae,t[63]=oe):oe=t[63];let se;t[64]!==u||t[65]!==r||t[66]!==s||t[67]!==d.endPriority||t[68]!==d.endingPriority?(se=r&&u?(0,Q.jsxs)(A,{variant:`ghost`,className:`text-danger hover:text-danger`,disabled:s,onClick:u,children:[s?(0,Q.jsx)(h,{className:`size-4 animate-spin`}):null,s?d.endingPriority:d.endPriority]}):(0,Q.jsx)(`span`,{}),t[64]=u,t[65]=r,t[66]=s,t[67]=d.endPriority,t[68]=d.endingPriority,t[69]=se):se=t[69];let Y;t[70]!==s||t[71]!==d.cancel?(Y=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(A,{disabled:s,children:d.cancel})}),t[70]=s,t[71]=d.cancel,t[72]=Y):Y=t[72];let ce=!F||s,le;t[73]===s?le=t[74]:(le=s?(0,Q.jsx)(h,{className:`size-4 animate-spin`}):null,t[73]=s,t[74]=le);let ue;t[75]!==d.savePriority||t[76]!==ce||t[77]!==le?(ue=(0,Q.jsxs)(A,{type:`submit`,variant:`primary`,disabled:ce,children:[le,d.savePriority]}),t[75]=d.savePriority,t[76]=ce,t[77]=le,t[78]=ue):ue=t[78];let de;t[79]!==Y||t[80]!==ue?(de=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[Y,ue]}),t[79]=Y,t[80]=ue,t[81]=de):de=t[81];let fe;t[82]!==se||t[83]!==de?(fe=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-t border-edge px-5 py-3 sm:px-6`,children:[se,de]}),t[82]=se,t[83]=de,t[84]=fe):fe=t[84];let pe;t[85]!==N||t[86]!==U||t[87]!==oe||t[88]!==fe?(pe=(0,Q.jsxs)(E,{children:[I,(0,Q.jsx)(D,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:(0,Q.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col overflow-hidden [border-radius:inherit]`,onSubmit:N,children:[U,oe,fe]})})]}),t[85]=N,t[86]=U,t[87]=oe,t[88]=fe,t[89]=pe):pe=t[89];let me;return t[90]!==c||t[91]!==n||t[92]!==pe?(me=(0,Q.jsx)(O,{open:n,onOpenChange:c,children:pe}),t[90]=c,t[91]=n,t[92]=pe,t[93]=me):me=t[93],me}function zt(e){let t=(0,Z.c)(16),{rule:n,language:r,busy:i,onToggle:a}=e,o=_t[r],s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(me,{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,Q.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,Q.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,Q.jsx)(A,{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,Q.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,Q.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 Bt(e){let t=(0,Z.c)(15),{suggestion:n,language:r,busy:i,onConfirm:a}=e,o=r===`zh`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(U,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),t[0]=s):s=t[0];let c;t[1]===n.statement?c=t[2]:(c=(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),t[1]=n.statement,t[2]=c);let l=o?`根据你已确认的模式生成;确认前不会生效`:`Suggested from a pattern you confirmed; inactive until you approve`,u;t[3]===l?u=t[4]:(u=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:l}),t[3]=l,t[4]=u);let d;t[5]!==c||t[6]!==u?(d=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,u]}),t[5]=c,t[6]=u,t[7]=d):d=t[7];let f=i?o?`启用中…`:`Enabling…`:o?`确认启用`:`Approve`,p;t[8]!==i||t[9]!==a||t[10]!==f?(p=(0,Q.jsx)(A,{variant:`secondary`,className:`h-8 shrink-0`,disabled:i,onClick:a,children:f}),t[8]=i,t[9]=a,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 border-t border-edge-subtle px-5 py-3 first:border-t-0`,children:[s,d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m}function Vt(e){let t=(0,Z.c)(22),{item:n,language:r,busy:i,expanded:a,onToggle:o,editing:s,draft:c,onDraftChange:l,onEdit:u,onCancel:d,onReview:f,onDelete:p}=e,m=_t[r],h=n.updatedAt??n.createdAt,g;t[0]!==r||t[1]!==h?(g=wt(h,r),t[0]=r,t[1]=h,t[2]=g):g=t[2];let _=g,v;t[3]===n.content?v=t[4]:(v=n.content.length>96||n.content.includes(`
|
|
2
|
-
`),t[3]=n.content,t[4]=v);let y=v,b;return t[5]!==i||t[6]!==y||t[7]!==_||t[8]!==c||t[9]!==s||t[10]!==a||t[11]!==n.content||t[12]!==n.scope||t[13]!==r||t[14]!==d||t[15]!==p||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==o||t[20]!==m?(b=(0,Q.jsx)(`article`,{className:`group border-t border-edge-subtle px-5 py-4 first:border-t-0 sm:px-6`,children:s?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`textarea`,{"aria-label":m.correctionPlaceholder,disabled:i,value:c,onChange:e=>l(e.target.value),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`}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(A,{variant:`ghost`,className:`h-8`,onClick:d,children:m.cancel}),(0,Q.jsx)(A,{variant:`primary`,className:`h-8`,disabled:!c.trim()||i,onClick:()=>f(`edit_and_approve`,c.trim()),children:m.save})]})]}):(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(K,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-base leading-7 text-fg ${a?``:`line-clamp-2`}`,children:n.content}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:Mt(n.scope,r)}),_?(0,Q.jsx)(`span`,{children:_}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[y?(0,Q.jsx)(A,{variant:`ghost`,className:`size-11 p-0`,"aria-expanded":a,"aria-label":a?m.collapse:m.expand,onClick:o,children:(0,Q.jsx)(z,{className:`size-3.5 transition-transform ${a?`rotate-180`:``}`})}):null,(0,Q.jsx)(Ge,{language:r,busy:i,statement:n.content,onEdit:u,onDelete:p})]})]})}),t[5]=i,t[6]=y,t[7]=_,t[8]=c,t[9]=s,t[10]=a,t[11]=n.content,t[12]=n.scope,t[13]=r,t[14]=d,t[15]=p,t[16]=l,t[17]=u,t[18]=f,t[19]=o,t[20]=m,t[21]=b):b=t[21],b}function Ht(){let e=x(e=>e.language),t=_t[e],n=Pe(e=>e.setPageHeader),r=Pe(e=>e.clearPageHeader),[o,u]=i(),{data:d,error:p,isLoading:m,isValidating:b,mutate:S}=k(`/api/user-model`,pe),C=gt(o),[w,T]=(0,X.useState)(),[E,D]=(0,X.useState)(),[ee,O]=(0,X.useState)(``),[N,F]=(0,X.useState)(),[R,z]=(0,X.useState)(``),[B,W]=(0,X.useState)(``),[G,K]=(0,X.useState)(24),[q,ne]=(0,X.useState)(),[ie,ae]=(0,X.useState)(!1),[oe,se]=(0,X.useState)(!1),[_e,ye]=(0,X.useState)(`all`),[Se,Oe]=(0,X.useState)(`personal`),[Ae,Ne]=(0,X.useState)(`all`),[Fe,Re]=(0,X.useState)(`idle`),Z=(0,X.useRef)(void 0),ze=e=>{if(e===C)return;let t=document.getElementById(`app-main-content`);typeof t?.scrollTo==`function`&&t.scrollTo({top:0,behavior:`auto`}),u(t=>{let n=new URLSearchParams(t);return e===`overview`?n.delete(`tab`):n.set(`tab`,e),n})},Be=(0,X.useCallback)(async()=>{if(!(Fe===`refreshing`||b)){Z.current&&window.clearTimeout(Z.current),Re(`refreshing`),D(void 0),O(t.refreshing);try{await S(),Re(`success`),O(t.refreshComplete)}catch{Re(`error`),O(``),D(t.refreshFailed)}finally{Z.current=window.setTimeout(()=>Re(`idle`),1600)}}},[b,S,Fe,t]);(0,X.useEffect)(()=>()=>{Z.current&&window.clearTimeout(Z.current)},[]);let Ve=b||Fe===`refreshing`,He=Ve?t.refreshing:Fe===`success`?t.refreshComplete:Fe===`error`?t.refreshFailed:t.refresh;(0,X.useEffect)(()=>(n({startExtra:null,main:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:t.pageTitle}),(0,Q.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:t.pageSubtitle})]}),end:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(ht,{}),(0,Q.jsx)(A,{variant:`secondary`,className:`size-9 p-0 ${Fe===`success`?`text-success`:Fe===`error`?`text-danger`:``}`,disabled:Ve,"aria-label":He,title:He,onClick:()=>void Be(),children:Ve?(0,Q.jsx)(h,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}):Fe===`success`?(0,Q.jsx)(s,{className:`size-4`,"aria-hidden":`true`}):Fe===`error`?(0,Q.jsx)(Ie,{className:`size-4`,"aria-hidden":`true`}):(0,Q.jsx)(De,{className:`size-4`,"aria-hidden":`true`})})]})}),r),[r,Ve,Fe,He,Be,n,t]);let Ue=async(n,r)=>{T(n),D(void 0),O(``);try{await r(),await S(),O(e===`zh`?`已更新`:`Updated`)}catch{D(t.actionFailed)}finally{T(void 0)}},We=e=>{Ue(e.id,async()=>{await xe(e.id,R.trim()),F(void 0),z(``)})},Ge=async e=>{T(`profile`),D(void 0),O(``);try{await Me(e),await S(),ae(!1)}catch{D(t.actionFailed)}finally{T(void 0)}},Ke=async(n,r)=>{T(`priority:${n.id}`),D(void 0),O(``);try{await Y(n.id,r),await S(),se(!1),O(e===`zh`?`当前关注已更新`:`Current focus updated`)}catch{D(t.actionFailed)}finally{T(void 0)}},Je=async n=>{T(`priority:create`),D(void 0),O(``);try{await le(n),await S(),se(!1),O(e===`zh`?`当前关注已设置`:`Current focus set`)}catch{D(t.actionFailed)}finally{T(void 0)}},Ye=async n=>{T(`priority:${n.id}`),D(void 0),O(``);try{await Y(n.id,{status:`completed`}),await S(),se(!1),O(e===`zh`?`当前关注已结束`:`Current focus ended`)}catch{D(t.actionFailed)}finally{T(void 0)}};if(m)return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-5 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Q.jsx)(j,{className:`h-10 w-72 rounded-xl`}),(0,Q.jsx)(j,{className:`h-72 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-2`,children:[(0,Q.jsx)(j,{className:`h-80 rounded-xl`}),(0,Q.jsx)(j,{className:`h-80 rounded-xl`})]})]});if(p||!d)return(0,Q.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,Q.jsx)(V,{className:`size-6 text-fg-subtle`}),(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:t.loadFailed}),(0,Q.jsx)(A,{onClick:()=>void S(),children:t.tryAgain})]});let Xe=d.assertions.filter(e=>e.usable&&!vt.has(e.predicate)).sort((e,t)=>{let n=e.declaredImportance??e.inferredImportance;return(t.declaredImportance??t.inferredImportance)-n||t.recordedAt-e.recordedAt}),Ze=d.assertions.filter(e=>[`candidate`,`needs_review`,`conflicted`].includes(e.status)).sort((e,t)=>t.recordedAt-e.recordedAt),$e=Et(d),et=$e.callName||(e===`zh`?`你`:`You`),tt=Xe.filter(e=>e.authority===`user_explicit`).length,nt=Xe.length-tt,rt=Xe.filter(e=>_e===`explicit`?e.authority===`user_explicit`:_e===`learned`?e.authority!==`user_explicit`:!0),it=d.priorities.filter(e=>e.status===`active`&&e.validTo>Date.now()),$=it.find(e=>e.rank===`primary`)??it[0],at=Pt($,d.goals,e),ot=$?.targetType===`goal`?d.goals.find(e=>e.id===$.targetId):void 0,st=d.goals.filter(e=>e.status===`active`||e.status===`paused`),ct=st.filter(e=>$?.targetType!==`goal`||e.id!==$.targetId),lt=d.rules.filter(e=>e.status!==`archived`),ut=d.ruleSuggestions??[],dt=[...Xe].sort((e,t)=>t.recordedAt-e.recordedAt),ft=d.knowledge.filter(e=>e.status!==`archived`&&e.status!==`rejected`),pt=B.trim().toLocaleLowerCase(),mt=ft.filter(e=>Ae===`all`||e.kind===Ae),bt=mt.filter(t=>!pt||t.content.toLocaleLowerCase().includes(pt)||Nt(t.kind,e).toLocaleLowerCase().includes(pt)),xt=[{key:`identity`,title:t.identity,icon:fe,items:rt.filter(e=>e.kind===`identity`)},{key:`preferences`,title:t.preferences,icon:ue,items:rt.filter(e=>[`preference`,`value`,`routine`,`capability`].includes(e.kind))},{key:`relationships`,title:t.relationships,icon:me,items:rt.filter(e=>e.kind===`relationship`)},{key:`current`,title:t.currentState,icon:I,items:rt.filter(e=>e.kind===`current_state`)},{key:`insights`,title:t.insights,icon:U,items:rt.filter(e=>e.kind===`derived_insight`)}].filter(e=>e.items.length>0),St=[{key:`about`,icon:fe,label:e===`zh`?`关于我`:`About me`,hint:e===`zh`?`身份、背景与能力`:`Identity, background, and capabilities`,count:Xe.filter(e=>[`identity`,`capability`].includes(e.kind)).length},{key:`preferences`,icon:ue,label:e===`zh`?`偏好与习惯`:`Preferences & habits`,hint:e===`zh`?`沟通方式与日常习惯`:`Communication and routines`,count:Xe.filter(e=>[`preference`,`value`,`routine`].includes(e.kind)).length},{key:`people`,icon:me,label:e===`zh`?`重要的人`:`Important people`,hint:e===`zh`?`与你有关的人和关系`:`People and relationships`,count:Xe.filter(e=>e.kind===`relationship`).length},{key:`goals`,icon:U,label:e===`zh`?`目标与计划`:`Goals & plans`,hint:e===`zh`?`正在推进的长期目标`:`Long-term outcomes in progress`,count:st.length}],Ct=yt.map(e=>({kind:e,count:ft.filter(t=>t.kind===e).length})).filter(e=>e.count>0),Tt=Ct.slice(0,4),At=Tt.length===1?`grid-cols-1`:Tt.length===2?`sm:grid-cols-2`:Tt.length===3?`sm:grid-cols-3`:`sm:grid-cols-2 lg:grid-cols-4`,jt=bt.slice(0,G),Mt=yt.map(e=>({kind:e,items:jt.filter(t=>t.kind===e),totalCount:bt.filter(t=>t.kind===e).length})).filter(e=>e.items.length>0),Ht=[{id:`all`,label:t.allUnderstanding,count:Xe.length},{id:`explicit`,label:t.explicit,count:tt},{id:`learned`,label:t.learned,count:nt}],Ut=e=>{ye(e),Oe(`personal`),ze(`understanding`)},Wt=e=>{Ne(e),W(``),K(24),Oe(`work`),ze(`understanding`)},Gt=t=>(0,Q.jsx)(Qe,{item:t,language:e,busy:!!w,editing:N===t.id,draft:N===t.id?R:``,onDraftChange:z,onEdit:()=>{F(t.id),z(t.statement)},onCancel:()=>{F(void 0),z(``)},onDelete:()=>void Ue(t.id,()=>ke(t.id)),onCorrect:()=>We(t),onScopeChange:e=>void Ue(t.id,()=>Ee(t.id,e))},t.id),Kt=d.maintenance.lastRun?wt(d.maintenance.lastRun.finishedAt??d.maintenance.lastRun.startedAt,e,!0):null,qt=d.maintenance.lastRun?d.maintenance.lastRun.status===`completed`?`${t.maintenanceComplete} ${Kt}`:t.maintenanceFailed:t.maintenanceReady;return(0,Q.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-6 px-4 py-4 sm:space-y-8 sm:px-6 sm:py-7 lg:px-8 lg:py-10`,children:[(0,Q.jsx)(Le,{items:[{id:`overview`,label:t.overview,icon:U},{id:`understanding`,label:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`sm:hidden`,children:e===`zh`?`记忆`:`Memory`}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:t.understanding})]}),icon:fe,count:Xe.length},{id:`privacy`,label:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`sm:hidden`,children:e===`zh`?`隐私`:`Privacy`}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:t.privacy})]}),icon:H}],activeTab:C,onChange:ze,ariaLabel:t.pageTitle,tabIdPrefix:`understanding-tab`,panelIdPrefix:`understanding-panel`,className:`w-full max-w-full gap-1 rounded-full bg-surface-panel p-1 shadow-surface sm:w-fit`,buttonClassName:`min-w-0 flex-1 justify-center rounded-full px-2 py-2 sm:flex-none sm:px-3.5`,selectedClassName:`bg-surface-active text-fg`,unselectedClassName:`text-fg-muted hover:bg-surface-hover hover:text-fg`}),(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:ee}),E?(0,Q.jsxs)(`div`,{role:`alert`,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,Q.jsx)(`span`,{children:E}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>D(void 0),"aria-label":t.cancel,children:(0,Q.jsx)(y,{className:`size-4`})})]}):null,C===`overview`?(0,Q.jsxs)(`div`,{id:`understanding-panel-overview`,role:`tabpanel`,"aria-labelledby":`understanding-tab-overview`,className:`space-y-8 sm:space-y-10`,children:[(0,Q.jsxs)(`section`,{"data-testid":`overview-hero`,className:`grid gap-5 sm:gap-8 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,24rem)] lg:gap-12`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 px-1 sm:py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-accent-fg`,children:[(0,Q.jsx)(U,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:t.portraitEyebrow})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 sm:mt-5 sm:flex-wrap sm:gap-5`,children:[(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center rounded-2xl bg-surface-active text-base font-semibold text-fg sm:size-20 sm:rounded-[1.4rem] sm:text-xl`,children:Ot(et)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight text-fg sm:text-3xl`,children:et}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg-muted`,children:$e.role||t.notProvided})]}),(0,Q.jsxs)(A,{variant:`ghost`,className:`size-11 shrink-0 px-0 sm:h-9 sm:w-auto sm:px-3`,onClick:()=>ae(!0),children:[(0,Q.jsx)(he,{className:`size-4`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:t.editProfile})]})]}),(0,Q.jsx)(`p`,{className:`mt-5 hidden max-w-2xl text-sm leading-6 text-fg-muted sm:block`,children:t.portraitIntro}),(0,Q.jsx)(`dl`,{className:`mt-7 hidden gap-x-8 gap-y-5 sm:grid sm:grid-cols-3`,children:[{icon:M,label:t.locale,value:$e.locale?Dt($e.locale,e):t.notProvided},{icon:te,label:t.timezone,value:$e.timezone||t.notProvided},{icon:fe,label:t.pronouns,value:$e.pronouns||t.notProvided}].map(({icon:e,label:t,value:n})=>(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-1.5 text-xs text-fg-subtle`,children:[(0,Q.jsx)(e,{className:`size-3.5`,"aria-hidden":`true`}),t]}),(0,Q.jsx)(`dd`,{className:`mt-1.5 truncate text-sm font-medium text-fg`,children:n})]},t))})]}),(0,Q.jsxs)(`aside`,{"data-testid":`priority-panel`,className:`flex min-h-0 flex-col rounded-[1.4rem] bg-surface-panel p-5 shadow-surface sm:min-h-64 sm:p-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-fg-subtle`,children:t.importantNow}),$?(0,Q.jsxs)(`p`,{className:`mt-1.5 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Q.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`}),$.targetType===`goal`?t.prioritySourceGoal:t.prioritySourceWork]}):null]}),$&&at?(0,Q.jsxs)(A,{variant:`ghost`,className:`h-8 shrink-0 px-2.5`,onClick:()=>se(!0),children:[(0,Q.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}),t.editPriority]}):null]}),at?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`mt-3 text-lg font-semibold leading-7 tracking-tight text-fg`,children:at}),ot?.desiredOutcome?(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:ot.desiredOutcome}):null,$?(0,Q.jsxs)(`p`,{className:`mt-auto flex items-center gap-1.5 pt-4 text-xs text-fg-subtle`,children:[(0,Q.jsx)(J,{className:`size-3.5`,"aria-hidden":`true`}),kt($.validTo,e)]}):null]}):(0,Q.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,Q.jsx)(L,{className:`size-5 text-fg-subtle`}),(0,Q.jsx)(`span`,{children:t.noPriority}),(0,Q.jsxs)(A,{variant:`primary`,className:`mt-2`,onClick:()=>se(!0),children:[(0,Q.jsx)(_,{className:`size-4`,"aria-hidden":`true`}),t.addPriority]})]}),ct.length?(0,Q.jsxs)(`div`,{className:`mt-5 hidden border-t border-edge-subtle pt-4 sm:block`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.otherGoals}),(0,Q.jsx)(`div`,{className:`mt-2 space-y-2`,children:ct.slice(0,3).map(e=>(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:e.title},e.id))})]}):null]})]}),Ze.length?(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl bg-accent-soft/70 shadow-surface`,"aria-label":e===`zh`?`需要你确认`:`Needs your review`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-5 py-4 sm:px-6`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-panel text-accent-fg`,children:(0,Q.jsx)(U,{className:`size-4`,"aria-hidden":`true`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e===`zh`?`需要你确认`:`Needs your review`}),(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:e===`zh`?`还有 ${Ze.length} 条理解需要确认`:`${Ze.length} understanding items to review`})]})]}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 text-xs font-medium tabular-nums text-accent-fg`,children:Ze.length})]}),(0,Q.jsxs)(`div`,{className:`border-t border-accent/10 bg-surface-panel px-5 py-4 sm:flex sm:items-center sm:gap-4 sm:px-6`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 text-sm leading-6 text-fg`,children:Ze[0].statement}),(0,Q.jsxs)(`div`,{className:`mt-3 flex shrink-0 gap-2 sm:mt-0`,children:[(0,Q.jsx)(A,{variant:`ghost`,className:`min-h-11 flex-1 sm:flex-none`,disabled:w===Ze[0].id,onClick:()=>void Ue(Ze[0].id,()=>Ce(Ze[0].id,`rejected`)),children:e===`zh`?`不是`:`No`}),(0,Q.jsx)(A,{variant:`primary`,className:`min-h-11 flex-1 sm:flex-none`,disabled:w===Ze[0].id,onClick:()=>void Ue(Ze[0].id,()=>Ce(Ze[0].id,`active`)),children:e===`zh`?`是的`:`That’s right`})]})]})]}):null,(0,Q.jsx)(Ft,{title:e===`zh`?`xopc 对我的了解`:`What xopc knows about me`,hint:e===`zh`?`你可以随时查看、修正或停止使用任何一条。`:`Review, correct, or stop using anything at any time.`,action:(0,Q.jsx)(A,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>ze(`understanding`),children:t.seeAll}),children:(0,Q.jsx)(`div`,{className:`grid sm:grid-cols-2`,children:St.map(({key:e,icon:t,label:n,hint:r,count:i})=>(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-24 w-full items-center gap-4 border-t border-edge-subtle px-5 py-4 text-left first:border-t-0 hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:[&:nth-child(-n+2)]:border-t-0 sm:[&:nth-child(even)]:border-l`,onClick:()=>Ut(`all`),"aria-label":`${n}: ${i}`,children:[(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-base text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4.5`,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,Q.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-subtle`,children:r})]}),(0,Q.jsx)(`span`,{className:`text-sm tabular-nums text-fg-muted`,children:i}),(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":`true`})]},e))})}),(0,Q.jsxs)(`div`,{className:`grid items-start gap-10 lg:grid-cols-2 lg:gap-8`,children:[(0,Q.jsx)(Ft,{title:t.recent,hint:t.recentHint,action:(0,Q.jsx)(A,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>ze(`understanding`),children:t.seeAll}),children:dt.length?(0,Q.jsx)(`div`,{children:qe(dt.slice(0,3),e).map(({label:e,items:t})=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`px-5 pb-1 pt-4 text-xs font-medium text-fg-muted`,children:e}),(0,Q.jsx)(`div`,{children:t.map(Gt)})]},e))}):(0,Q.jsx)(It,{icon:(0,Q.jsx)(V,{className:`size-5`}),children:t.emptyGroup})}),(0,Q.jsx)(Ft,{title:t.howWeWork,hint:t.howWeWorkHint,children:lt.length||ut.length?(0,Q.jsxs)(Q.Fragment,{children:[lt.slice(0,3).map(t=>(0,Q.jsx)(zt,{rule:t,language:e,busy:w===t.id,onToggle:()=>void Ue(t.id,()=>be(t.id,t.status===`active`?`disabled`:`active`))},t.id)),ut.slice(0,2).map(t=>(0,Q.jsx)(Bt,{suggestion:t,language:e,busy:w===t.id,onConfirm:()=>void Ue(t.id,()=>we(t))},t.id))]}):(0,Q.jsx)(It,{icon:(0,Q.jsx)(me,{className:`size-5`}),children:t.noRules})})]}),(0,Q.jsx)(Ft,{title:t.workMemory,hint:t.workMemoryHint,action:(0,Q.jsx)(A,{variant:`ghost`,className:`h-8 shrink-0`,onClick:()=>Wt(`all`),children:t.seeAll}),children:Ct.length?(0,Q.jsx)(`div`,{"data-testid":`memory-summary-grid`,className:`grid gap-3 bg-surface-base ${At}`,children:Tt.map(({kind:t,count:n})=>(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-28 cursor-pointer items-start justify-between rounded-2xl bg-surface-panel px-5 py-5 text-left transition-colors hover:bg-surface-hover focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>Wt(t),"aria-label":`${Nt(t,e)}: ${n}`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-2xl font-semibold tabular-nums text-fg`,children:n}),(0,Q.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:Nt(t,e)})]}),(0,Q.jsx)(P,{className:`mt-1 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted motion-reduce:transform-none`,"aria-hidden":`true`})]},t))}):(0,Q.jsx)(It,{icon:(0,Q.jsx)(ce,{className:`size-5`}),children:t.noKnowledge})}),(0,Q.jsx)(`footer`,{className:`flex items-center gap-4 px-1 pb-2 text-xs text-fg-subtle`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(De,{className:`size-3.5`,"aria-hidden":`true`}),qt]})})]}):null,C===`understanding`?(0,Q.jsxs)(`div`,{id:`understanding-panel-understanding`,role:`tabpanel`,"aria-labelledby":`understanding-tab-understanding`,className:`space-y-10`,children:[(0,Q.jsx)(`div`,{className:`flex w-full gap-1 rounded-xl bg-surface-panel p-1 sm:w-fit`,role:`group`,"aria-label":e===`zh`?`记忆分类`:`Memory category`,children:[{id:`personal`,label:e===`zh`?`关于我`:`About me`,icon:fe,count:Xe.length},{id:`work`,label:e===`zh`?`工作记忆`:`Work memory`,icon:L,count:ft.length}].map(({id:e,label:t,icon:n,count:r})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":Se===e,className:`touch-target flex min-h-10 flex-1 items-center justify-center gap-2 rounded-lg px-3 text-sm font-medium transition-colors sm:flex-none ${Se===e?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>Oe(e),children:[(0,Q.jsx)(n,{className:`size-4`,"aria-hidden":`true`}),t,(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]},e))}),Se===`personal`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`px-1 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(V,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:t.aboutYouTitle}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:t.aboutYouHint})]})]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":t.understandingFilterHint,children:Ht.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":_e===e.id,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${_e===e.id?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>ye(e.id),children:[e.label,(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:e.count})]},e.id))})]}),xt.length?xt.map(({key:e,title:t,icon:n,items:r})=>(0,Q.jsx)(Ft,{title:t,action:(0,Q.jsx)(n,{className:`size-4 text-fg-subtle`,"aria-hidden":`true`}),children:(0,Q.jsx)(`div`,{children:r.map(Gt)})},e)):(0,Q.jsx)(`div`,{className:`rounded-2xl bg-surface-panel`,children:(0,Q.jsx)(It,{icon:(0,Q.jsx)(V,{className:`size-5`}),children:t.emptyGroup})})]}):(0,Q.jsxs)(`div`,{className:`space-y-8`,children:[(0,Q.jsxs)(`div`,{className:`px-1 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:Ae===`all`?t.allMemory:Nt(Ae,e)}),(0,Q.jsxs)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:[mt.length,` `,t.items,` · `,t.memoryLibraryHint]})]}),(0,Q.jsxs)(`label`,{className:`relative block sm:w-80`,children:[(0,Q.jsx)(v,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:t.searchPlaceholder}),(0,Q.jsx)(`input`,{type:`search`,value:B,onChange:e=>{W(e.target.value),K(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`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,role:`group`,"aria-label":t.memoryFilterHint,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":Ae===`all`,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${Ae===`all`?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>Ne(`all`),children:[t.allMemory,(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:ft.length})]}),Ct.map(({kind:t,count:n})=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":Ae===t,className:`touch-target inline-flex min-h-9 cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${Ae===t?`bg-surface-active text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`}`,onClick:()=>Ne(t),children:[Nt(t,e),(0,Q.jsx)(`span`,{className:`tabular-nums text-fg-subtle`,children:n})]},t))]})]}),bt.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`space-y-8`,children:Mt.map(({kind:t,items:n,totalCount:r})=>(0,Q.jsxs)(`section`,{className:`overflow-hidden rounded-2xl bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between px-5 pb-1 pt-4 sm:px-6`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:Nt(t,e)}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:r})]}),(0,Q.jsx)(`div`,{children:n.map(t=>(0,Q.jsx)(Vt,{item:t,language:e,busy:!!w,expanded:q===t.id,onToggle:()=>ne(e=>e===t.id?void 0:t.id),editing:N===`knowledge:${t.id}`,draft:R,onDraftChange:z,onEdit:()=>{F(`knowledge:${t.id}`),z(t.content)},onCancel:()=>{F(void 0),z(``)},onDelete:()=>void Ue(t.id,()=>de(t.id)),onReview:(e,n)=>void Ue(t.id,async()=>{await ge(t,e,n),F(void 0),z(``)})},t.id))})]},t))}),bt.length>G?(0,Q.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Q.jsx)(A,{onClick:()=>K(e=>e+24),children:t.showMore})}):null]}):(0,Q.jsx)(`div`,{className:`rounded-2xl bg-surface-panel`,children:(0,Q.jsx)(It,{icon:(0,Q.jsx)(v,{className:`size-5`}),children:B.trim()?t.noKnowledgeMatch:t.noKnowledge})})]})]}):null,C===`privacy`?(0,Q.jsxs)(`div`,{id:`understanding-panel-privacy`,role:`tabpanel`,"aria-labelledby":`understanding-tab-privacy`,className:`space-y-8`,children:[(0,Q.jsx)(`div`,{className:`px-1 pt-1`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(H,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:e===`zh`?`你的信息,由你掌控`:`Your information, under your control`}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:e===`zh`?`决定 xopc 可以记住什么、从哪里了解你,以及如何迁移你的数据。`:`Decide what xopc can remember, where it learns from, and how your data moves.`})]})]})}),(0,Q.jsx)(Ft,{title:e===`zh`?`记忆与使用`:`Memory & use`,children:(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle`,children:[[{key:`memory`,icon:V,title:e===`zh`?`长期记忆`:`Long-term memory`,detail:e===`zh`?`记住长期有用的信息,减少重复说明。`:`Remember useful information so you do not have to repeat yourself.`,enabled:d.settings.memoryEnabled},{key:`references`,icon:U,title:e===`zh`?`回答中的记忆引用`:`Memory references in answers`,detail:e===`zh`?`当个人信息影响回答时,显示本次参考内容。`:`Show what personal context was referenced when it shapes an answer.`,enabled:d.settings.showMemoryReferences}].map(({key:e,icon:t,title:n,detail:r,enabled:i})=>(0,Q.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":i,disabled:!!w,className:`flex min-h-20 w-full items-center gap-4 px-5 py-4 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent disabled:opacity-60 sm:px-6`,onClick:()=>void Ue(`setting:${e}`,()=>ve(e===`memory`?{memoryEnabled:!i}:{showMemoryReferences:!i})),children:[(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-base text-fg-muted`,children:(0,Q.jsx)(t,{className:`size-4.5`,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:r})]}),(0,Q.jsx)(`span`,{className:`relative h-6 w-11 shrink-0 rounded-full transition-colors ${i?`bg-accent`:`bg-surface-active`}`,"aria-hidden":`true`,children:(0,Q.jsx)(`span`,{className:`absolute top-0.5 size-5 rounded-full bg-white shadow-sm transition-transform ${i?`translate-x-5`:`translate-x-0.5`}`})})]},e)),(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center gap-4 px-5 py-4 sm:px-6`,children:[(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-base text-fg-muted`,children:(0,Q.jsx)(re,{className:`size-4.5`,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e===`zh`?`敏感信息`:`Sensitive information`}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e===`zh`?`控制健康、财务等信息是否可以保存。`:`Control whether health, financial, and similar information can be saved.`})]}),(0,Q.jsxs)(c,{"aria-label":e===`zh`?`敏感信息策略`:`Sensitive information policy`,value:d.settings.sensitiveWritePolicy,disabled:!!w,onChange:e=>void Ue(`setting:sensitive`,()=>ve({sensitiveWritePolicy:e.target.value})),children:[(0,Q.jsx)(l,{value:`confirm`,children:e===`zh`?`先询问`:`Ask first`}),(0,Q.jsx)(l,{value:`deny`,children:e===`zh`?`不保存`:`Never save`}),(0,Q.jsx)(l,{value:`allow`,children:e===`zh`?`允许`:`Allow`})]})]})]})}),(0,Q.jsx)(Ft,{title:e===`zh`?`数据管理`:`Data management`,children:(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle`,children:[(0,Q.jsxs)(a,{to:`/settings/imports`,className:`flex min-h-20 items-center gap-4 px-5 py-4 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:px-6`,children:[(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-base text-fg-muted`,children:(0,Q.jsx)(Te,{className:`size-4.5`,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e===`zh`?`从其他 AI 导入`:`Import from another AI`}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e===`zh`?`导入前预览新增、重复和冲突内容。`:`Preview new, duplicate, and conflicting items before import.`})]}),(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]}),(0,Q.jsxs)(`button`,{type:`button`,disabled:!!w,className:`flex min-h-20 w-full items-center gap-4 px-5 py-4 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent disabled:opacity-60 sm:px-6`,onClick:()=>void Ue(`export`,je),children:[(0,Q.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-base text-fg-muted`,children:(0,Q.jsx)(f,{className:`size-4.5`,"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e===`zh`?`下载我的记忆`:`Download my memory`}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e===`zh`?`导出为可阅读、可迁移的数据包。`:`Export a readable, portable archive.`})]}),(0,Q.jsx)(P,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})]})}),(0,Q.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel px-5 py-5 sm:px-6`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e===`zh`?`纠正与忘记`:`Correct and forget`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e===`zh`?`在“记忆”中打开任意一条内容的菜单,即可修改、调整作用范围或彻底删除。`:`Open any item in Memory to edit it, change where it applies, or delete it permanently.`}),(0,Q.jsx)(A,{variant:`ghost`,className:`mt-3`,onClick:()=>{Oe(`personal`),ze(`understanding`)},children:e===`zh`?`管理记忆`:`Manage memory`})]})]}):null,(0,Q.jsx)(Lt,{open:ie,profile:$e,language:e,saving:w===`profile`,onOpenChange:ae,onSave:e=>void Ge(e)}),(0,Q.jsx)(Rt,{open:oe,priority:$,title:at??``,outcome:ot?.desiredOutcome,language:e,saving:w===($?`priority:${$.id}`:`priority:create`),onOpenChange:se,onSave:e=>$?void Ke($,e):void Je(e),onEnd:$?()=>void Ye($):void 0})]})}export{Ht as UserModelPage};
|