@xopcai/xopc 0.0.336 → 0.0.337
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-NNn5LiRh.js → agent-avatar-dicebear-CSHghJkF.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DNYmmcXR.js → agent-defaults-settings-panel-DcDz1HJb.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DfAd5ptC.js → agent-plugin-dialog-C7A9k86o.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DEgksLoh.js → agents-wih5cVy1.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BR-Ks3tk.js → app-management-settings-panel-LQ_zVJ9C.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DQn5060f.js → appearance-settings-C2gaax8U.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BghyAP7f.js → apps-page-CobrkzwB.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-DSyujAeW.js → archive-plugin-CK_qS4Ex.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-dl2URNWU.js → automations-page-DtuUM9W8.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-C_3pzyHa.js → automations-workspace-BNcU6ReT.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-Bi6hXKEs.js → binary-plugins-BN0iLzVY.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-aqBwqSqa.js → block-editor-CpLJmCV2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BxLzYDlU.js → browser-automations-page-DqKKZQNI.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-wiVToOs2.js → browser-settings-page-B0Vxlns8.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-9SxFc1Gk.js → capabilities-page-Bn72DIFn.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-6o3ePBVe.js → capabilities-settings-panel-n4g4t5LK.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-o7tnD40O.js → capability-header-actions-CIxZrN4w.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-BiDkmHQX.js → channels-D8P0Sbu1.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DgaRuyCk.js → chat-terminal-dock-BJzZ5vkP.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-BScTGz9r.js → computer-settings-page-WT8yMsKu.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-D19h4o3H.js → connector-service-page-71NVbenX.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-nb20ZtXB.js → connectors-page-DdBdSoYi.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-4XKcj75n.js → date-picker-WyLSk4_J.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BLLIIM2j.js → dependency-picker-BTdAiaBP.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-F-odgilG.js → desktop-pet-f0MgT5Um.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C1bi6P68.js → desktop-pet-settings-DKVITn3D.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-C8brKN1N.js → device-pairing-wizard-1Buarqmz.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BQROUAVR.js → directory-picker-path-field-BoGtoYn0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-j6UKcafs.js → extension-debug-page-DPwnz1-y.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B-MC_llQ.js → extension-page-CzioOhli.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-E7iPqGV_.js → extension-settings-page-Cqq5bdYp.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CxhocvFl.js → gateway-settings-CoXYbhk4.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-DKJTrzRz.js → home-page-z3Jiv5fF.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BH0bK4Fi.js → imports-page-DHiUg7PR.js} +1 -1
- package/dist/gateway/static/root/assets/index-Bd7mDZFV.css +1 -0
- package/dist/gateway/static/root/assets/{index-Z_w672TD.js → index-D3OtdgCs.js} +9 -9
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DqYlPK6e.js → keyboard-shortcuts-settings-CbcZK4S6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DJFEtiQ-.js → local-app-workbench-page-3HC00KSx.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-soLqlAnz.js → local-apps-page-etrJtvmm.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CG21jjyw.js → logs-page-BsSdbCw2.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-lZjA5aEo.js → management-settings-DODrHfBO.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bx67LlgO.js → media-plugins-C0JdlHpy.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-C-uwlkj6.js → note-detail-panel-fPUNv1PI.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-BvJNHWMx.js → notes-page-I9h6l38z.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-X1LphhT2.js → page-context-capture-button-BlcjlzGF.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-Bvuo9Cp9.js → page-tabs-_eLR6cpb.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CnosDbXg.js → preview-open-alternatives-BfJBJ4NU.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DH38UFyT.js → product-open-page-RdYBwQ_V.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-DzS67sf6.js → project-detail-page-DyAKlm_h.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D8tBTON4.js → projects-page-Bk51sbKy.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bwsg9beH.js → remote-access-hub-BbMbnizV.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BcTGjpqr.js → runtime-tools-settings-panel-yqbX-cYN.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-jbTHblQV.js → scenes-page-L69Imde_.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BtuMUmjZ.js → schema-form-BWlMiaNv.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Dm2qIlJZ.js → sessions-page-S-UqCz6P.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Q52AAHh_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-6QQu_bi3.js → settings-form-section-DqUsAh0K.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B000AkmV.js → settings-page-4eoaA_Hs.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Ogru9NdY.js → setup-status-panel-6BuwbANT.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BMO2ZoqU.js → share-preview-page-B-w3pIG5.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CtmBtL1f.js → shares-settings-Bn03bnYk.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DzFmRoGt.js → skill-api-BN7zgPjv.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DcyuV6CY.js → skill-reload-api-BsBfMvch.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DQBfVKZv.js → skills-page-CcYeAh5v.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CYr7jyqK.js → system-settings-panel-BV2zesop.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CwxfwNqK.js → task-detail-page-BqN3GUm7.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-COxKjwYF.js → tunnel-api-Dk3SmnSL.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-CJDBoCpM.js → usage-page-DStU1Zyn.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Tiykntd0.js → use-autosave-D3oLuZ7h.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BhGePvWd.js → user-model-page-BXMZoqpb.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bny9WMTa.js → voice-api-key-field-CzvudzG6.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B6FMtX3w.js → work-discovery-overlay-D6oUEOYn.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DoOMpqPg.js → workflow-run-setup-panel-CXxr4wmO.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-b2v3lMJ1.js → workflows-page-D9uPt_T2.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- 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 +1 -1
- 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/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/sessions.js +7 -0
- 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 +4 -4
- package/dist/gateway/static/root/assets/index-DbLEkdNg.css +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-9sku1sUP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./popover-select-0p9PIHRy.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-DsUnS7rn.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d,n as ee,r as f}from"./locale-store-7F4l6DRV.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-CS04eWY9.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Fa as C,Fu as w,Iu as T,Mc as te,Pl as ne,ba as E,fl as D,id as O,kc as k,xa as A}from"./index-Z_w672TD.js";import{t as j}from"./page-tabs-Bvuo9Cp9.js";import{n as M,r as N,t as P}from"./settings-page-layout-X1x-2Cp9.js";import{t as F}from"./device-pairing-wizard-C8brKN1N.js";import{n as I}from"./settings-loading-skeleton-CAmWMaOT.js";var L=e(t(),1),R=n(),z=720*60*60*1e3;function B(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function V(e){return B(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function re(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function ie(e,t=Date.now()){return V(e)===`offline`?(e.lastSeenAt??e.createdAt)<t-z:!1}function ae(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=V(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?ie(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function oe(e){return e.length>8?e.slice(-8):e}var H=r();function se(e){let t=(0,R.c)(59),{device:n,busy:r,onClose:i,onRevoke:a}=e,o=ee(U),s;t[0]===o?s=t[1]:(s=l(o),t[0]=o,t[1]=s);let d=s.endpointToolsSettings,f=o===`zh`?`zh-CN`:`en`,y;t[2]===f?y=t[3]:(y=new Intl.DateTimeFormat(f,{dateStyle:`medium`,timeStyle:`short`}),t[2]=f,t[3]=y);let C=y,w;t[4]===n?w=t[5]:(w=n?V(n):`offline`,t[4]=n,t[5]=w);let T=w,ne=n!==null,E;t[6]===i?E=t[7]:(E=e=>!e&&i(),t[6]=i,t[7]=E);let D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,H.jsx)(p,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=u(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,x),t[9]=O):O=t[9];let k=n?.displayName??d.deviceDetails,A;t[10]===k?A=t[11]:(A=(0,H.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:k}),t[10]=k,t[11]=A);let j;t[12]===n?j=t[13]:(j=n?(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,oe(n.id)]}):null,t[12]=n,t[13]=j);let M;t[14]!==A||t[15]!==j?(M=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[14]=A,t[15]=j,t[16]=M):M=t[16];let N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,H.jsx)(c,{className:`size-5`,"aria-hidden":!0}),t[17]=N):N=t[17];let P;t[18]===d.close?P=t[19]:(P=(0,H.jsx)(m,{asChild:!0,children:(0,H.jsx)(b,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":d.close,children:N})}),t[18]=d.close,t[19]=P);let F;t[20]!==M||t[21]!==P?(F=(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[M,P]}),t[20]=M,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==d.accessActive||t[24]!==d.accessRevoked||t[25]!==d.accessTitle||t[26]!==d.createdAt||t[27]!==d.endpointCount||t[28]!==d.endpointsTitle||t[29]!==d.identityId||t[30]!==d.identityTitle||t[31]!==d.lastSeen||t[32]!==d.never||t[33]!==d.noAccessIdentity||t[34]!==d.noOnlineEndpoints||t[35]!==d.noPermissions||t[36]!==d.permissions||t[37]!==d.status||t[38]!==d.statusLabel||t[39]!==d.toolCount||t[40]!==n||t[41]!==C||t[42]!==T?(I=n?(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,H.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,H.jsx)(W,{label:d.statusLabel,value:d.status[T]}),(0,H.jsx)(W,{label:d.lastSeen,value:n.lastSeenAt?C.format(n.lastSeenAt):d.never}),(0,H.jsx)(W,{label:d.endpointCount,value:String(n.endpoints.length)}),(0,H.jsx)(W,{label:d.toolCount,value:String(re(n))})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.accessTitle}),(0,H.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:n.access.revokedAt?d.accessRevoked:d.accessActive}),(0,H.jsxs)(`p`,{className:`mt-1 break-words`,children:[d.permissions,`: `,n.access.scopes.join(`, `)||d.noPermissions]})]}):(0,H.jsx)(`p`,{children:d.noAccessIdentity})})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.endpointsTitle}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,H.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,H.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[d.status[e.availability],` · v`,e.appVersion]})]}),(0,H.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.name}),(0,H.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:t.requiredPermissions.join(`, `)||d.noPermissions})]},t.name)})})]},e.connectionId))]})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.identityTitle}),(0,H.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,H.jsx)(W,{label:d.identityId,value:n.id,breakAll:!0}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{label:d.createdAt,value:C.format(n.createdAt)})})]})]})]}):null,t[23]=d.accessActive,t[24]=d.accessRevoked,t[25]=d.accessTitle,t[26]=d.createdAt,t[27]=d.endpointCount,t[28]=d.endpointsTitle,t[29]=d.identityId,t[30]=d.identityTitle,t[31]=d.lastSeen,t[32]=d.never,t[33]=d.noAccessIdentity,t[34]=d.noOnlineEndpoints,t[35]=d.noPermissions,t[36]=d.permissions,t[37]=d.status,t[38]=d.statusLabel,t[39]=d.toolCount,t[40]=n,t[41]=C,t[42]=T,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==d.removeDevice||t[46]!==d.revoking||t[47]!==n||t[48]!==a||t[49]!==T?(L=n&&T!==`revoked`?(0,H.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,H.jsxs)(b,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,H.jsx)(te,{className:`size-4`,"aria-hidden":!0}),r?d.revoking:d.removeDevice]})}):null,t[44]=r,t[45]=d.removeDevice,t[46]=d.revoking,t[47]=n,t[48]=a,t[49]=T,t[50]=L):L=t[50];let z;t[51]!==F||t[52]!==I||t[53]!==L?(z=(0,H.jsxs)(h,{children:[D,(0,H.jsxs)(g,{className:O,"aria-describedby":void 0,children:[F,I,L]})]}),t[51]=F,t[52]=I,t[53]=L,t[54]=z):z=t[54];let B;return t[55]!==z||t[56]!==ne||t[57]!==E?(B=(0,H.jsx)(v,{open:ne,onOpenChange:E,children:z}),t[55]=z,t[56]=ne,t[57]=E,t[58]=B):B=t[58],B}function U(e){return e.language}function W(e){let t=(0,R.c)(10),{label:n,value:r,breakAll:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,H.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,c;t[2]===s?c=t[3]:(c=u(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,H.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let d;return t[7]!==o||t[8]!==l?(d=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=d):d=t[9],d}function ce(e){let t=(0,R.c)(19),{onPaired:n}=e,[r,a]=i(),s=ee(le),c;t[0]===s?c=t[1]:(c=l(s),t[0]=s,t[1]=c);let u=c.endpointToolsSettings.deviceAccess,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={open:!1},t[2]=d):d=t[2];let[f,p]=(0,L.useState)(d),m,h;t[3]!==r||t[4]!==a?(m=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(p({open:!0,target:e}),a(G,{replace:!0}))},h=[r,a],t[3]=r,t[4]=a,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,L.useEffect)(m,h);let g,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p({open:!0}),_=(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[7]=g,t[8]=_):(g=t[7],_=t[8]);let v;t[9]===u.addDevice?v=t[10]:(v=(0,H.jsxs)(b,{variant:`primary`,onClick:g,children:[_,u.addDevice]}),t[9]=u.addDevice,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>p(t=>({...t,open:e})),t[11]=y):y=t[11];let x;t[12]!==f.open||t[13]!==f.target||t[14]!==n?(x=(0,H.jsx)(F,{open:f.open,onOpenChange:y,onPaired:n,targetKind:f.target}),t[12]=f.open,t[13]=f.target,t[14]=n,t[15]=x):x=t[15];let S;return t[16]!==v||t[17]!==x?(S=(0,H.jsxs)(H.Fragment,{children:[v,x]}),t[16]=v,t[17]=x,t[18]=S):S=t[18],S}function G(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function le(e){return e.language}async function ue(e){let t=await e.json().catch(()=>null);if(!e.ok||t?.payload===void 0)throw Error(t?.error?.message??`Endpoint management request failed: ${e.status}`);return t.payload}function de(){return f(`/api/endpoint-tools/devices`)}function fe(e){let t=new URLSearchParams({page:String(e.page),pageSize:String(e.pageSize)});return e.query.trim()&&t.set(`query`,e.query.trim()),e.principalId&&t.set(`principalId`,e.principalId),e.status&&t.set(`status`,e.status),e.effect&&t.set(`effect`,e.effect),f(`/api/endpoint-tools/invocations?${t}`)}async function pe(){return ue(await d(de()))}async function me(e){let t=Array.from({length:Math.ceil(e.length/100)},(t,n)=>e.slice(n*100,(n+1)*100));await Promise.all(t.map(async e=>{await ue(await d(f(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function he(e){return ue(await d(fe(e)))}var ge=5e3,K=20,_e=20;function ve(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function ye(e){let t=(0,R.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=u(`rounded-full px-2 py-0.5 text-xs font-medium`,ve(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,H.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function be(){let e=ee(e=>e.language),t=l(e).endpointToolsSettings,[n,r]=i(),o=n.get(`view`)===`activity`?`activity`:`devices`,[c,d]=(0,L.useState)(null),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1),[v,x]=(0,L.useState)(``),[S,F]=(0,L.useState)(`active`),[R,z]=(0,L.useState)(``),[B,U]=(0,L.useState)(1),[W,G]=(0,L.useState)(()=>new Set),[le,ue]=(0,L.useState)(``),[ve]=C(le,250),[be,xe]=(0,L.useState)(``),[Se,Ce]=(0,L.useState)(``),[we,Te]=(0,L.useState)(``),[Ee,q]=(0,L.useState)(1),De={page:Ee,pageSize:_e,query:ve,principalId:be,status:Se,effect:we},J=y(de(),pe,{refreshInterval:ge}),Y=y(o===`activity`?fe(De):null,()=>he(De),{refreshInterval:ge,keepPreviousData:!0}),Oe=(0,L.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(J.isLoading&&!J.data)return(0,H.jsx)(N,{children:(0,H.jsx)(I,{sections:2})});let X=J.data??[],ke=Y.data?.items??[],Ae=X.filter(e=>V(e)===`online`).length,je=X.filter(e=>V(e)!==`revoked`).length,Me=X.filter(e=>ie(e)).length,Ne=[...new Set(X.map(e=>e.platform))].toSorted(),Z=ae(X,{query:v,status:S,platform:R}),Pe=Math.max(1,Math.ceil(Z.length/K)),Q=Math.min(B,Pe),Fe=Z.slice((Q-1)*K,Q*K),$=Fe.reduce((e,t)=>(V(t)!==`revoked`&&e.push(t.id),e),[]),Ie=$.length>0&&$.every(e=>W.has(e)),Le=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Re=async()=>{await Promise.all([J.mutate(),o===`activity`?Y.mutate():Promise.resolve()])},ze=async()=>{if(!(f.length===0||m)){h(!0),_(!1);try{await me(f.map(e=>e.id)),p([]),G(new Set),await J.mutate()}catch{_(!0)}finally{h(!1)}}},Be=e=>{e(),U(1),G(new Set)};return(0,H.jsxs)(N,{children:[(0,H.jsx)(M,{title:t.title,subtitle:t.subtitle,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Re}),(0,H.jsx)(ce,{onPaired:()=>void J.mutate()})]})}),J.error||Y.error?(0,H.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:je,filter:`active`},{label:t.onlineDevices,value:Ae,filter:`online`},{label:t.staleDevices,value:Me,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,H.jsxs)(`button`,{type:`button`,className:u(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,S===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":S===n,onClick:()=>{Be(()=>F(n)),Le(`devices`)},children:[(0,H.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,H.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,H.jsx)(j,{items:[{id:`devices`,label:t.devicesTab,icon:D,count:je},{id:`activity`,label:t.activityTab,icon:O,count:Y.data?.total}],activeTab:o,onChange:Le,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,H.jsxs)(P,{id:`devices`,activeTab:o,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,H.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,H.jsxs)(`label`,{className:`relative block`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,H.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:v,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>Be(()=>x(e.target.value))})]}),(0,H.jsx)(a,{value:S,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>Be(()=>F(e))}),(0,H.jsx)(a,{value:R,options:Ne.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>Be(()=>z(e))})]}),W.size>0?(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(W.size))}),(0,H.jsxs)(b,{variant:`secondary`,className:`text-danger`,onClick:()=>{_(!1),p(X.filter(e=>W.has(e.id)))},children:[(0,H.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,X.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):Z.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,H.jsxs)(`label`,{className:u(`touch-target flex items-center gap-2 text-xs text-fg-muted`,$.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:Ie,disabled:$.length===0,className:`size-4 accent-accent`,onChange:e=>{G(t=>{let n=new Set(t);for(let t of $)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,H.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Fe.map(e=>{let n=V(e),r=e.kind===`mobile`?k:ne;return(0,H.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`label`,{className:u(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,H.jsx)(`input`,{type:`checkbox`,checked:W.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{G(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,H.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>d(e),children:[(0,H.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,H.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,H.jsx)(ye,{status:n,label:t.status[n]})]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,oe(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?Oe.format(e.lastSeenAt):t.never]})]}),(0,H.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(re(e)))}),(0,H.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Q-1)*K+1)).replace(`{{to}}`,String(Math.min(Q*K,Z.length))).replace(`{{total}}`,String(Z.length))}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Q<=1,onClick:()=>U(e=>Math.max(1,e-1)),children:(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Q>=Pe,onClick:()=>U(e=>Math.min(Pe,e+1)),children:(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,H.jsxs)(P,{id:`activity`,activeTab:o,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,H.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,H.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,H.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:le,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{ue(e.target.value),q(1)}})]}),(0,H.jsx)(a,{value:be,options:X.map(e=>({value:e.id,label:`${e.displayName} · ${oe(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{xe(e),q(1)}}),(0,H.jsx)(a,{value:Se,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{Ce(e),q(1)}}),(0,H.jsx)(a,{value:we,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{Te(e),q(1)}})]}),Y.isLoading&&!Y.data?(0,H.jsx)(I,{sections:1}):null,ke.length===0&&!Y.isLoading?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,H.jsx)(`div`,{className:`space-y-2`,children:ke.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[Oe.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,H.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,H.jsx)(ye,{status:e.status,label:t.status[e.status]})]},e.id))}),Y.data&&Y.data.total>0?(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Y.data.page-1)*Y.data.pageSize+1)).replace(`{{to}}`,String(Math.min(Y.data.page*Y.data.pageSize,Y.data.total))).replace(`{{total}}`,String(Y.data.total))}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Y.data.page<=1,onClick:()=>q(e=>Math.max(1,e-1)),children:(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Y.data.page>=Y.data.totalPages,onClick:()=>q(e=>Math.min(Y.data.totalPages,e+1)),children:(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,H.jsx)(se,{device:c,busy:m,onClose:()=>d(null),onRevoke:e=>{d(null),_(!1),p([e])}}),(0,H.jsx)(A,{open:f.length>0,title:f.length>1?t.removeManyTitle:t.removeTitle,description:`${f.length>1?t.removeManyDescription.replace(`{{count}}`,String(f.length)):t.removeDescription.replace(`{{name}}`,f[0]?.displayName??``)}${g?`\n\n${t.revokeError}`:``}`,confirmLabel:m?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void ze(),onCancel:()=>{m||p([])}})]})}export{be as EndpointToolsManagementSettings};
|
|
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}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./popover-select-0p9PIHRy.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./x-B_N4OPjy.js";import{t as l}from"./messages-DsUnS7rn.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d,n as ee,r as f}from"./locale-store-7F4l6DRV.js";import{a as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-CS04eWY9.js";import{i as x,o as S}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Fa as C,Fu as w,Iu as T,Mc as te,Pl as ne,ba as E,fl as D,id as O,kc as k,xa as A}from"./index-D3OtdgCs.js";import{t as j}from"./page-tabs-_eLR6cpb.js";import{n as M,r as N,t as P}from"./settings-page-layout-X1x-2Cp9.js";import{t as F}from"./device-pairing-wizard-1Buarqmz.js";import{n as I}from"./settings-loading-skeleton-CAmWMaOT.js";var L=e(t(),1),R=n(),z=720*60*60*1e3;function B(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function V(e){return B(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function re(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function ie(e,t=Date.now()){return V(e)===`offline`?(e.lastSeenAt??e.createdAt)<t-z:!1}function ae(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=V(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?ie(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function oe(e){return e.length>8?e.slice(-8):e}var H=r();function se(e){let t=(0,R.c)(59),{device:n,busy:r,onClose:i,onRevoke:a}=e,o=ee(U),s;t[0]===o?s=t[1]:(s=l(o),t[0]=o,t[1]=s);let d=s.endpointToolsSettings,f=o===`zh`?`zh-CN`:`en`,y;t[2]===f?y=t[3]:(y=new Intl.DateTimeFormat(f,{dateStyle:`medium`,timeStyle:`short`}),t[2]=f,t[3]=y);let C=y,w;t[4]===n?w=t[5]:(w=n?V(n):`offline`,t[4]=n,t[5]=w);let T=w,ne=n!==null,E;t[6]===i?E=t[7]:(E=e=>!e&&i(),t[6]=i,t[7]=E);let D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,H.jsx)(p,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,S)}),t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=u(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,x),t[9]=O):O=t[9];let k=n?.displayName??d.deviceDetails,A;t[10]===k?A=t[11]:(A=(0,H.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:k}),t[10]=k,t[11]=A);let j;t[12]===n?j=t[13]:(j=n?(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,oe(n.id)]}):null,t[12]=n,t[13]=j);let M;t[14]!==A||t[15]!==j?(M=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[14]=A,t[15]=j,t[16]=M):M=t[16];let N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,H.jsx)(c,{className:`size-5`,"aria-hidden":!0}),t[17]=N):N=t[17];let P;t[18]===d.close?P=t[19]:(P=(0,H.jsx)(m,{asChild:!0,children:(0,H.jsx)(b,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":d.close,children:N})}),t[18]=d.close,t[19]=P);let F;t[20]!==M||t[21]!==P?(F=(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[M,P]}),t[20]=M,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==d.accessActive||t[24]!==d.accessRevoked||t[25]!==d.accessTitle||t[26]!==d.createdAt||t[27]!==d.endpointCount||t[28]!==d.endpointsTitle||t[29]!==d.identityId||t[30]!==d.identityTitle||t[31]!==d.lastSeen||t[32]!==d.never||t[33]!==d.noAccessIdentity||t[34]!==d.noOnlineEndpoints||t[35]!==d.noPermissions||t[36]!==d.permissions||t[37]!==d.status||t[38]!==d.statusLabel||t[39]!==d.toolCount||t[40]!==n||t[41]!==C||t[42]!==T?(I=n?(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[(0,H.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,H.jsx)(W,{label:d.statusLabel,value:d.status[T]}),(0,H.jsx)(W,{label:d.lastSeen,value:n.lastSeenAt?C.format(n.lastSeenAt):d.never}),(0,H.jsx)(W,{label:d.endpointCount,value:String(n.endpoints.length)}),(0,H.jsx)(W,{label:d.toolCount,value:String(re(n))})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.accessTitle}),(0,H.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:n.access.revokedAt?d.accessRevoked:d.accessActive}),(0,H.jsxs)(`p`,{className:`mt-1 break-words`,children:[d.permissions,`: `,n.access.scopes.join(`, `)||d.noPermissions]})]}):(0,H.jsx)(`p`,{children:d.noAccessIdentity})})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.endpointsTitle}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,H.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,H.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[d.status[e.availability],` · v`,e.appVersion]})]}),(0,H.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,H.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.name}),(0,H.jsx)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:t.requiredPermissions.join(`, `)||d.noPermissions})]},t.name)})})]},e.connectionId))]})]}),(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.identityTitle}),(0,H.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,H.jsx)(W,{label:d.identityId,value:n.id,breakAll:!0}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(W,{label:d.createdAt,value:C.format(n.createdAt)})})]})]})]}):null,t[23]=d.accessActive,t[24]=d.accessRevoked,t[25]=d.accessTitle,t[26]=d.createdAt,t[27]=d.endpointCount,t[28]=d.endpointsTitle,t[29]=d.identityId,t[30]=d.identityTitle,t[31]=d.lastSeen,t[32]=d.never,t[33]=d.noAccessIdentity,t[34]=d.noOnlineEndpoints,t[35]=d.noPermissions,t[36]=d.permissions,t[37]=d.status,t[38]=d.statusLabel,t[39]=d.toolCount,t[40]=n,t[41]=C,t[42]=T,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==d.removeDevice||t[46]!==d.revoking||t[47]!==n||t[48]!==a||t[49]!==T?(L=n&&T!==`revoked`?(0,H.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,H.jsxs)(b,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,H.jsx)(te,{className:`size-4`,"aria-hidden":!0}),r?d.revoking:d.removeDevice]})}):null,t[44]=r,t[45]=d.removeDevice,t[46]=d.revoking,t[47]=n,t[48]=a,t[49]=T,t[50]=L):L=t[50];let z;t[51]!==F||t[52]!==I||t[53]!==L?(z=(0,H.jsxs)(h,{children:[D,(0,H.jsxs)(g,{className:O,"aria-describedby":void 0,children:[F,I,L]})]}),t[51]=F,t[52]=I,t[53]=L,t[54]=z):z=t[54];let B;return t[55]!==z||t[56]!==ne||t[57]!==E?(B=(0,H.jsx)(v,{open:ne,onOpenChange:E,children:z}),t[55]=z,t[56]=ne,t[57]=E,t[58]=B):B=t[58],B}function U(e){return e.language}function W(e){let t=(0,R.c)(10),{label:n,value:r,breakAll:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,H.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,c;t[2]===s?c=t[3]:(c=u(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,H.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let d;return t[7]!==o||t[8]!==l?(d=(0,H.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=d):d=t[9],d}function ce(e){let t=(0,R.c)(19),{onPaired:n}=e,[r,a]=i(),s=ee(le),c;t[0]===s?c=t[1]:(c=l(s),t[0]=s,t[1]=c);let u=c.endpointToolsSettings.deviceAccess,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={open:!1},t[2]=d):d=t[2];let[f,p]=(0,L.useState)(d),m,h;t[3]!==r||t[4]!==a?(m=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(p({open:!0,target:e}),a(G,{replace:!0}))},h=[r,a],t[3]=r,t[4]=a,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,L.useEffect)(m,h);let g,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p({open:!0}),_=(0,H.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[7]=g,t[8]=_):(g=t[7],_=t[8]);let v;t[9]===u.addDevice?v=t[10]:(v=(0,H.jsxs)(b,{variant:`primary`,onClick:g,children:[_,u.addDevice]}),t[9]=u.addDevice,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>p(t=>({...t,open:e})),t[11]=y):y=t[11];let x;t[12]!==f.open||t[13]!==f.target||t[14]!==n?(x=(0,H.jsx)(F,{open:f.open,onOpenChange:y,onPaired:n,targetKind:f.target}),t[12]=f.open,t[13]=f.target,t[14]=n,t[15]=x):x=t[15];let S;return t[16]!==v||t[17]!==x?(S=(0,H.jsxs)(H.Fragment,{children:[v,x]}),t[16]=v,t[17]=x,t[18]=S):S=t[18],S}function G(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function le(e){return e.language}async function ue(e){let t=await e.json().catch(()=>null);if(!e.ok||t?.payload===void 0)throw Error(t?.error?.message??`Endpoint management request failed: ${e.status}`);return t.payload}function de(){return f(`/api/endpoint-tools/devices`)}function fe(e){let t=new URLSearchParams({page:String(e.page),pageSize:String(e.pageSize)});return e.query.trim()&&t.set(`query`,e.query.trim()),e.principalId&&t.set(`principalId`,e.principalId),e.status&&t.set(`status`,e.status),e.effect&&t.set(`effect`,e.effect),f(`/api/endpoint-tools/invocations?${t}`)}async function pe(){return ue(await d(de()))}async function me(e){let t=Array.from({length:Math.ceil(e.length/100)},(t,n)=>e.slice(n*100,(n+1)*100));await Promise.all(t.map(async e=>{await ue(await d(f(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function he(e){return ue(await d(fe(e)))}var ge=5e3,K=20,_e=20;function ve(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function ye(e){let t=(0,R.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=u(`rounded-full px-2 py-0.5 text-xs font-medium`,ve(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,H.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function be(){let e=ee(e=>e.language),t=l(e).endpointToolsSettings,[n,r]=i(),o=n.get(`view`)===`activity`?`activity`:`devices`,[c,d]=(0,L.useState)(null),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1),[v,x]=(0,L.useState)(``),[S,F]=(0,L.useState)(`active`),[R,z]=(0,L.useState)(``),[B,U]=(0,L.useState)(1),[W,G]=(0,L.useState)(()=>new Set),[le,ue]=(0,L.useState)(``),[ve]=C(le,250),[be,xe]=(0,L.useState)(``),[Se,Ce]=(0,L.useState)(``),[we,Te]=(0,L.useState)(``),[Ee,q]=(0,L.useState)(1),De={page:Ee,pageSize:_e,query:ve,principalId:be,status:Se,effect:we},J=y(de(),pe,{refreshInterval:ge}),Y=y(o===`activity`?fe(De):null,()=>he(De),{refreshInterval:ge,keepPreviousData:!0}),Oe=(0,L.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(J.isLoading&&!J.data)return(0,H.jsx)(N,{children:(0,H.jsx)(I,{sections:2})});let X=J.data??[],ke=Y.data?.items??[],Ae=X.filter(e=>V(e)===`online`).length,je=X.filter(e=>V(e)!==`revoked`).length,Me=X.filter(e=>ie(e)).length,Ne=[...new Set(X.map(e=>e.platform))].toSorted(),Z=ae(X,{query:v,status:S,platform:R}),Pe=Math.max(1,Math.ceil(Z.length/K)),Q=Math.min(B,Pe),Fe=Z.slice((Q-1)*K,Q*K),$=Fe.reduce((e,t)=>(V(t)!==`revoked`&&e.push(t.id),e),[]),Ie=$.length>0&&$.every(e=>W.has(e)),Le=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Re=async()=>{await Promise.all([J.mutate(),o===`activity`?Y.mutate():Promise.resolve()])},ze=async()=>{if(!(f.length===0||m)){h(!0),_(!1);try{await me(f.map(e=>e.id)),p([]),G(new Set),await J.mutate()}catch{_(!0)}finally{h(!1)}}},Be=e=>{e(),U(1),G(new Set)};return(0,H.jsxs)(N,{children:[(0,H.jsx)(M,{title:t.title,subtitle:t.subtitle,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Re}),(0,H.jsx)(ce,{onPaired:()=>void J.mutate()})]})}),J.error||Y.error?(0,H.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:je,filter:`active`},{label:t.onlineDevices,value:Ae,filter:`online`},{label:t.staleDevices,value:Me,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,H.jsxs)(`button`,{type:`button`,className:u(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,S===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":S===n,onClick:()=>{Be(()=>F(n)),Le(`devices`)},children:[(0,H.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,H.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,H.jsx)(j,{items:[{id:`devices`,label:t.devicesTab,icon:D,count:je},{id:`activity`,label:t.activityTab,icon:O,count:Y.data?.total}],activeTab:o,onChange:Le,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,H.jsxs)(P,{id:`devices`,activeTab:o,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,H.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,H.jsxs)(`label`,{className:`relative block`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,H.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:v,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>Be(()=>x(e.target.value))})]}),(0,H.jsx)(a,{value:S,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>Be(()=>F(e))}),(0,H.jsx)(a,{value:R,options:Ne.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>Be(()=>z(e))})]}),W.size>0?(0,H.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(W.size))}),(0,H.jsxs)(b,{variant:`secondary`,className:`text-danger`,onClick:()=>{_(!1),p(X.filter(e=>W.has(e.id)))},children:[(0,H.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,X.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):Z.length===0?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,H.jsxs)(`label`,{className:u(`touch-target flex items-center gap-2 text-xs text-fg-muted`,$.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:Ie,disabled:$.length===0,className:`size-4 accent-accent`,onChange:e=>{G(t=>{let n=new Set(t);for(let t of $)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,H.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Fe.map(e=>{let n=V(e),r=e.kind===`mobile`?k:ne;return(0,H.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`label`,{className:u(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,H.jsx)(`input`,{type:`checkbox`,checked:W.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{G(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,H.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>d(e),children:[(0,H.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,H.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,H.jsx)(ye,{status:n,label:t.status[n]})]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,oe(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?Oe.format(e.lastSeenAt):t.never]})]}),(0,H.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(re(e)))}),(0,H.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Q-1)*K+1)).replace(`{{to}}`,String(Math.min(Q*K,Z.length))).replace(`{{total}}`,String(Z.length))}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Q<=1,onClick:()=>U(e=>Math.max(1,e-1)),children:(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Q>=Pe,onClick:()=>U(e=>Math.min(Pe,e+1)),children:(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,H.jsxs)(P,{id:`activity`,activeTab:o,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,H.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,H.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,H.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,H.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:le,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{ue(e.target.value),q(1)}})]}),(0,H.jsx)(a,{value:be,options:X.map(e=>({value:e.id,label:`${e.displayName} · ${oe(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{xe(e),q(1)}}),(0,H.jsx)(a,{value:Se,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{Ce(e),q(1)}}),(0,H.jsx)(a,{value:we,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{Te(e),q(1)}})]}),Y.isLoading&&!Y.data?(0,H.jsx)(I,{sections:1}):null,ke.length===0&&!Y.isLoading?(0,H.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,H.jsx)(`div`,{className:`space-y-2`,children:ke.map(e=>(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,H.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[Oe.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,H.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,H.jsx)(ye,{status:e.status,label:t.status[e.status]})]},e.id))}),Y.data&&Y.data.total>0?(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,H.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Y.data.page-1)*Y.data.pageSize+1)).replace(`{{to}}`,String(Math.min(Y.data.page*Y.data.pageSize,Y.data.total))).replace(`{{total}}`,String(Y.data.total))}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Y.data.page<=1,onClick:()=>q(e=>Math.max(1,e-1)),children:(0,H.jsx)(T,{className:`size-4`,"aria-hidden":!0})}),(0,H.jsx)(b,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Y.data.page>=Y.data.totalPages,onClick:()=>q(e=>Math.min(Y.data.totalPages,e+1)),children:(0,H.jsx)(w,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,H.jsx)(se,{device:c,busy:m,onClose:()=>d(null),onRevoke:e=>{d(null),_(!1),p([e])}}),(0,H.jsx)(A,{open:f.length>0,title:f.length>1?t.removeManyTitle:t.removeTitle,description:`${f.length>1?t.removeManyDescription.replace(`{{count}}`,String(f.length)):t.removeDescription.replace(`{{name}}`,f[0]?.displayName??``)}${g?`\n\n${t.revokeError}`:``}`,confirmLabel:m?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void ze(),onCancel:()=>{m||p([])}})]})}export{be as EndpointToolsManagementSettings};
|
package/dist/gateway/static/root/assets/{media-plugins-Bx67LlgO.js → media-plugins-C0JdlHpy.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-DsUnS7rn.js";import{a as i}from"./attachment-utils-core-BIOUBrpT.js";import{t as a}from"./preview-open-alternatives-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-DsUnS7rn.js";import{a as i}from"./attachment-utils-core-BIOUBrpT.js";import{t as a}from"./preview-open-alternatives-BfJBJ4NU.js";import{t as o}from"./use-blob-object-url-D4BFuzZB.js";var s=t();e();var c=n();function l(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`audio`}),t[0]=e,t[1]=n),n}function u(e){let t=(0,s.c)(2),n;return t[0]===e?n=t[1]:(n=(0,c.jsx)(d,{props:e,kind:`video`}),t[0]=e,t[1]=n),n}function d(e){let t=(0,s.c)(8),{props:n,kind:r}=e,a;bb0:{if(!n.binaryBuffer){a=null;break bb0}let e;if(t[0]!==r||t[1]!==n.binaryBuffer||t[2]!==n.descriptor.fileName||t[3]!==n.descriptor.mimeType){let a=i(n.descriptor.fileName)??n.descriptor.mimeType;e=new Blob([n.binaryBuffer],{type:a||`${r}/*`}),t[0]=r,t[1]=n.binaryBuffer,t[2]=n.descriptor.fileName,t[3]=n.descriptor.mimeType,t[4]=e}else e=t[4];a=e}let l=o(a);if(!l)return null;let u;return t[5]!==r||t[6]!==l?(u=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto bg-surface-base p-4 dark:bg-surface-hover/20`,children:r===`audio`?(0,c.jsx)(`audio`,{src:l,controls:!0,className:`w-full max-w-2xl`}):(0,c.jsx)(`video`,{src:l,controls:!0,playsInline:!0,className:`max-h-full max-w-full rounded-md bg-black`})}),t[5]=r,t[6]=l,t[7]=u):u=t[7],u}function f(e){let t=(0,s.c)(12),n;t[0]===e.language?n=t[1]:(n=r(e.language),t[0]=e.language,t[1]=n);let i=n,o=e.descriptor.context===`workspace`,l=o?`${i.workspace.cannotPreviewType} ${i.workspace.openElsewhereHint}`:i.chat.attachmentPreviewOpenElsewhereHint,u=o?i.workspace.openSystemApp:void 0,d=o?i.workspace.chooseApp:void 0,f;return t[2]!==i.chat.attachmentPreviewDownloadFull||t[3]!==e.actions.canChooseOpenWithApp||t[4]!==e.actions.canOpenWithSystemApp||t[5]!==e.actions.onChooseOpenWithApp||t[6]!==e.actions.onDownload||t[7]!==e.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,c.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,c.jsx)(a,{message:l,downloadLabel:i.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:e.actions.onOpenWithSystemApp,canOpenWithSystemApp:e.actions.canOpenWithSystemApp,chooseAppLabel:d,onChooseOpenWithApp:e.actions.onChooseOpenWithApp,canChooseOpenWithApp:e.actions.canChooseOpenWithApp})}),t[2]=i.chat.attachmentPreviewDownloadFull,t[3]=e.actions.canChooseOpenWithApp,t[4]=e.actions.canOpenWithSystemApp,t[5]=e.actions.onChooseOpenWithApp,t[6]=e.actions.onDownload,t[7]=e.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}export{l as AudioPreviewPluginView,f as UnsupportedPreviewPluginView,u as VideoPreviewPluginView};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./check-DUBLcKHA.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"./copy-Dv6d4Dvw.js";import{t as f}from"./download-Dk-ZjtO6.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as m}from"./external-link-DjqjBmc3.js";import{t as h}from"./eye-CABVeTq0.js";import{t as g}from"./loader-circle-CifKLtgG.js";import{t as _}from"./pencil-DmIY3Oa-.js";import{t as v}from"./search-DA7gz22f.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./messages-DsUnS7rn.js";import{t as x}from"./cn-JdwAhgNB.js";import{a as S,c as C,f as w,n as T,r as E}from"./locale-store-7F4l6DRV.js";import{a as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{t as P}from"./session-manager-g96pFnRm.js";import{t as F}from"./copy-to-clipboard-HOJ79TWv.js";import{i as I}from"./vendor-swr-BIWyz7Rc.js";import{t as L}from"./button-CS04eWY9.js";import{t as R}from"./skeleton-BwbyijEw.js";import{$n as z,Ar as ee,Bn as te,Co as ne,F as re,Fn as ie,Gn as B,Hc as ae,Hn as oe,I as se,In as ce,Ji as le,Jn as V,Kn as ue,Ln as de,Lu as fe,Mr as pe,Oc as H,Ol as me,Pc as U,Po as he,Qn as W,Rn as G,Vn as ge,Wl as _e,Wn as ve,Xc as ye,Xn as be,Yn as xe,Zi as Se,_o as Ce,a as we,ar as K,c as Te,cr as Ee,dn as De,ea as Oe,ed as ke,fr as Ae,gc as je,gl as Me,hc as Ne,iu as Pe,jr as Fe,jt as Ie,kr as Le,l as Re,lr as ze,o as Be,or as q,pc as Ve,qi as J,qn as He,s as Ue,sr as We,ta as Ge,td as Ke,tr as qe,un as Je,ur as Ye,wc as Xe,xa as Ze,yu as Qe,zn as $e}from"./index-Z_w672TD.js";import{n as et,t as Y}from"./note-image-lightbox-1qg2v-9j.js";import{t as X}from"./page-context-capture-button-X1LphhT2.js";var Z=e(t(),1),tt=n(),Q=r(),nt=6e4,rt=36e5,it=864e5;function at(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function ot(e,t,n){let r=t-e;if(r<nt)return n.justNow;if(r<rt){let e=Math.floor(r/nt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=at(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-it)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*it){let e=Math.floor(r/it);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function st(e,t,n){let r=at(t);if(e>=r)return n.today;if(e>=r-it)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function $(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){let t=(0,tt.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,d=T(dt),f=b(d).automations.suggestions,p=b(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=I(o?`automation-suggestion-coverage`:null,ut,h),_=o?g?.automations.find(e=>Te(e,o)):void 0,v=_?Be(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=x(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(L,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=x(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(me,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(L,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=x(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(L,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ue(f.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(lt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=x(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=S):S=t[26];let C;t[27]===n?C=t[28]:(C=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=C);let w;t[29]===r?w=t[30]:(w=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=w);let E;t[31]!==C||t[32]!==w?(E=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[S,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,w]})]}),t[31]=C,t[32]=w,t[33]=E):E=t[33];let D;t[34]!==m||t[35]!==i?(D=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==f.create||t[39]!==D?(k=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(L,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,f.create]})}),t[38]=f.create,t[39]=D,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==y||t[43]!==E?(A=(0,Q.jsxs)(`section`,{className:y,children:[E,k]}),t[41]=k,t[42]=y,t[43]=E,t[44]=A):A=t[44],A}function lt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ut(){return Re.list()}function dt(e){return e.language}function ft(e){let t=(0,tt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(M,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,Q.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=s.kind===`actionItems`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=s.kind===`summary`?null:(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,C;t[27]!==i||t[28]!==a||t[29]!==S?(C=(0,Q.jsx)(L,{disabled:i,onClick:a,children:S}),t[27]=i,t[28]=a,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==i||t[32]!==s.text?(w=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=w):w=t[33];let T;t[34]!==s||t[35]!==o?(T=()=>void o(s),t[34]=s,t[35]=o,t[36]=T):T=t[36];let E=r?`保存修改`:`Save changes`,O;t[37]!==w||t[38]!==T||t[39]!==E?(O=(0,Q.jsx)(L,{variant:`primary`,disabled:w,onClick:T,children:E}),t[37]=w,t[38]=T,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==C||t[42]!==O?(k=(0,Q.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,O]}),t[41]=C,t[42]=O,t[43]=k):k=t[43];let P;t[44]!==x||t[45]!==k||t[46]!==f?(P=(0,Q.jsxs)(A,{children:[u,(0,Q.jsxs)(j,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[f,x,k]})]}),t[44]=x,t[45]=k,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,Q.jsx)(N,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function pt(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var mt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function ht({noteId:e}){let t=T(e=>e.language)===`zh`,{data:n,mutate:r,isLoading:i}=I([`note-discussion-document`,e],()=>Je(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),a=n?.discussion.id,u=`/api/discussions/${encodeURIComponent(a??``)}`,{data:d=[],mutate:p}=I(a?`${u}/actions`:null,e=>S(E(e)),{refreshInterval:1e4}),[m,h]=(0,Z.useState)(`summary`),[g,_]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`general`),[C,w]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),[z,ee]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)([]),[re,ie]=(0,Z.useState)(null),[B,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(1),le=(0,Z.useRef)(null),V=(0,Z.useRef)(null),[ue,de]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{r(),p()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[r,p]),(0,Z.useEffect)(()=>{n?.discussion.template&&x(n.discussion.template)},[n?.discussion.template]);async function fe(e){if(!B){oe(!0),ie(null);try{await e(),await r(),await p()}catch(e){ie(e instanceof Error?e.message:String(e))}finally{oe(!1)}}}function pe(e){le.current&&(le.current.readyState===0?(V.current=e/1e3,le.current.load()):le.current.currentTime=e/1e3,le.current.play().catch(()=>void 0))}async function H(e,t){n?.organization&&await fe(async()=>{w((await S(E(`${u}/transcript?revision=${t??n.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let me=(e,n,r)=>n.some(e=>z||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),n.filter(e=>z||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:B,onClick:()=>F({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:t?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:B,className:`shrink-0 text-accent-fg`,onClick:()=>void H(e.evidenceSegmentIds,e.evidenceRevision),children:t?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t?`暂无定位`:`No source timing`})]},e.id))]}):null;if(i)return(0,Q.jsx)(R,{className:`h-48 w-full`});if(!n)return null;let{discussion:U,transcript:he,organization:W}=n,G=W?.organization,ge=[`stopping`,`sealing`,`organizing`].includes(U.status),_e=[`recording`,`completed`,`needs_attention`].includes(U.status),ve=he.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(g.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(g.toLocaleLowerCase())),be=pt(n,m,{query:g,page:se,showIgnored:z});return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(Pe,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[mt(U.durationMs??0),` · `,ge?t?`正在整理`:`Processing`:U.status===`completed`?t?`整理完成`:`Ready`:U.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(c,{value:b,"aria-label":t?`纪要模板`:`Summary template`,onChange:e=>x(e.target.value),children:[(0,Q.jsx)(l,{value:`general`,children:t?`通用会议`:`General`}),(0,Q.jsx)(l,{value:`project`,children:t?`项目例会`:`Project`}),(0,Q.jsx)(l,{value:`review`,children:t?`需求评审`:`Review`}),(0,Q.jsx)(l,{value:`interview`,children:t?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(L,{disabled:B||ge||!U.canonicalTranscript,onClick:()=>void fe(()=>S(E(`${u}/organize`),{method:`POST`,body:JSON.stringify({template:b})})),children:[(0,Q.jsx)(ae,{className:`size-3.5`}),t?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":t?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:m===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>h(e),children:e===`summary`?t?`纪要与行动`:`Summary & actions`:t?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(f,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:E(`${u}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(X,{resource:{kind:`note`,id:e,revision:String(n.note.remoteVersion??1)},selection:{text:be,draft:!1},label:t?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:B||ge||!!(P||O)||!be||be.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:be.length>16e3?t?`内容超过 16,000 字符,请筛选更少的逐字稿内容后重试。`:`Over 16,000 characters. Filter fewer transcript segments and try again.`:t?`仅附带当前纪要或已加载的筛选逐字稿,不含录音;作为用户提供的文本。`:`Includes this summary or loaded filtered transcript only, not audio; treated as user-provided text.`})]}),re?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:re}):null,n.recordingJob?.state===`queued`||n.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:t?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,U.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:U.failureMessage}),(0,Q.jsx)(`button`,{disabled:B,onClick:()=>void fe(()=>De(U.id)),children:t?`重试`:`Retry`})]}):null,W&&W.transcriptRevision!==he.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:t?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:m===`summary`?G?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:G.summaryEditedByUser?t?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:B||ge,onClick:()=>F({kind:`summary`,itemId:`summary`,text:G.summary}),children:t?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:G.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:z,onChange:e=>ee(e.target.checked)}),t?`显示已忽略项`:`Show ignored items`]}),te.length?(0,Q.jsx)(L,{disabled:B,onClick:()=>void fe(async()=>{for(let e of te)await S(E(`${u}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:W.revision})});ne([])}),children:t?`加入所选 ${te.length} 项任务`:`Add ${te.length} selected tasks`}):null,me(t?`已决定事项`:`Decisions`,G.decisions,`decisions`),G.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`下一步行动`:`Next actions`}),G.actionItems.filter(e=>z||!e.ignored).map(e=>{let n=d.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!n&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${t?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:te.includes(e.id),onChange:t=>ne(t.target.checked?[...te,e.id]:te.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:B||ge,onClick:()=>F({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:t?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(t?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(t?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:B,className:`text-accent-fg`,onClick:()=>void H(e.evidenceSegmentIds,e.evidenceRevision),children:t?`查看原话`:`Source`}):null,n?n.deleted?(0,Q.jsx)(`span`,{children:t?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:`/tasks/${encodeURIComponent(n.taskId)}`,children:n.resolution===`done`?t?`已完成 · 查看任务`:`Done · View task`:t?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(L,{disabled:B||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void fe(()=>S(E(`${u}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:W.revision})})),children:t?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,me(t?`风险`:`Risks`,G.risks,`risks`),me(t?`尚未确定`:`Open questions`,G.openQuestions,`openQuestions`),G.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`前后变更`:`Changes during the meeting`}),G.changes.map(e=>{let n=[...G.decisions,...G.actionItems,...G.risks,...G.openQuestions],r=n.find(t=>t.id===e.fromId),i=n.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?t?`后续撤销或替代`:`Later superseded`:t?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void H(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void H(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,G.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`章节回顾`:`Chapters`}),G.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>pe(e.startedAtMs),children:[mt(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ge?t?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:t?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),ge?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(R,{className:`h-6 w-3/4`}),(0,Q.jsx)(R,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(v,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:t?`查找原话或说话人`:`Search words or speaker`,value:g,onChange:e=>{_(e.target.value),ce(1)}})]}),ve.slice(0,se*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${ue>=e.startedAtMs&&ue<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>pe(e.startedAtMs),children:[(0,Q.jsx)(ye,{className:`size-3`}),mt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(t?`未区分说话人`:`Speaker unknown`)}),_e&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>k({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:t?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(t?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ve.length>se*50?(0,Q.jsx)(L,{onClick:()=>ce(se+1),children:t?`加载更多`:`More`}):null]})}),U.audioAttachmentId&&!U.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:le,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:E(`${u}/audio`),onTimeUpdate:()=>de((le.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{V.current!==null&&le.current&&(le.current.currentTime=V.current,V.current=null)},onError:()=>ie(t?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:E(`${u}/audio`),download:!0,children:t?`下载录音`:`Download recording`})]}):null,C?(0,Q.jsxs)(`aside`,{"aria-label":t?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:t?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭`:`Close`,onClick:()=>w(null),children:(0,Q.jsx)(y,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:C.length?C.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>pe(e.startedAtMs),children:[mt(e.startedAtMs),` · `,e.speakerLabel??(t?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:t?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,P&&W?(0,Q.jsx)(ft,{initial:P,zh:t,busy:B,onClose:()=>F(null),onSave:e=>fe(async()=>{await S(E(`${u}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:W.revision})}),F(null)})},`${P.kind}:${P.itemId}:${W.revision}`):null,O?(0,Q.jsx)(N,{open:!0,onOpenChange:e=>{e||k(null)},children:(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(j,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(M,{children:t?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭校对`:`Close editor`,onClick:()=>k(null),children:(0,Q.jsx)(y,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[t?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:O.speaker,onChange:e=>k({...O,speaker:e.target.value})})]}),O.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!O.applyToSpeakerGroup,onChange:e=>k({...O,applyToSpeakerGroup:e.target.checked})}),t?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:O.text,onChange:e=>k({...O,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(L,{variant:`primary`,disabled:B||!O.text.trim(),onClick:()=>void fe(async()=>{await S(E(`${u}/segments/${O.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:O.text,speakerLabel:O.speaker,expectedRevision:O.segment.revision,applyToSpeakerGroup:O.applyToSpeakerGroup,expectedTranscriptRevision:he.revision})}),k(null)}),children:[(0,Q.jsx)(s,{className:`size-4`}),t?`保存修订`:`Save revision`]})})]})]})}):null]})}var gt={edit:_,ai_edit:H,sync:ae,restore:Ke};function _t(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function vt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=T(e=>e.language),o=b(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:w(a)},{data:c}=I(e?[`note-history`,e]:null,()=>be(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await ze(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(y,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=gt[e.trigger]??_,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:x(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:_t(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:ot(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function yt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=b(T(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:S}=I(e?[`note-agent-context-status`,e]:null,()=>He(e),{revalidateOnFocus:!1}),C=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>K(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Z.useCallback)(async t=>{try{await q(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(ke,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||g,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g?u.processing:u.contextRebuild}),(0,Q.jsx)(`span`,{className:x(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,Q.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,Q.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Me,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var bt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function xt({open:e,onOpenChange:t,note:n}){let r=T(e=>e.language)===`zh`,i=r?Tt:Et,{data:a,mutate:o}=I(e?[`note-shares`,n.id]:null,()=>W(n.id)),u=I(e?`hosted-share-auth-status`:null,Se),f=u.data===!0,p=I(e&&f?`hosted-publication-capabilities`:null,le),h=p.data?.publishing.allowed===!0,_=I(e&&f?[`hosted-note-publications`,n.id]:null,()=>xe(n.id)),[v,b]=(0,Z.useState)(new Set),[x,S]=(0,Z.useState)(`86400000`),[C,w]=(0,Z.useState)(``),[E,P]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(`hosted`),[ee,te]=(0,Z.useState)(!1),[ne,re]=(0,Z.useState)(null),[ie,B]=(0,Z.useState)(null),[ae,se]=(0,Z.useState)(!1),[ce,V]=(0,Z.useState)(null),ue=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(b(new Set(ue.map(e=>e.id))),B(null),se(!1),V(null))},[e,ue]);let de=async()=>{te(!0),V(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...v],ttlMs:Number(x),maxViews:C.trim()?Number(C):null,description:E.trim()||void 0};R===`hosted`?(B((await oe(n.id,e)).shareUrl),await _.mutate()):(B((await ve(n.id,e)).payload.shareUrl),await o())}catch(e){V(e instanceof Error?e.message:String(e))}finally{te(!1)}},fe=async(e,t)=>{re(e.id),V(null);try{t===`refresh`?await We(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...v]}):await Oe(e.id),await _.mutate()}catch(e){V(e instanceof Error?e.message:String(e))}finally{re(null)}},pe=async(e,t)=>{re(e.id),V(null);try{t===`refresh`?await Ee(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...v]}):t===`extend`?await J(e.id,864e5):await Ge(e.id),await o()}catch(e){V(e instanceof Error?e.message:String(e))}finally{re(null)}},H=async e=>{V(null);try{if(!await F(e)){se(!1),V(i.copyFailed);return}se(!0),window.setTimeout(()=>se(!1),1500)}catch{se(!1),V(i.copyFailed)}};return(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(M,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(U,{className:`size-4`}),i.title]}),(0,Q.jsx)(O,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(y,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),ue.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:ue.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.has(e.id),onChange:()=>b(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:wt(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(c,{value:R,onChange:e=>z(e.target.value),children:[(0,Q.jsx)(l,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(l,{value:`local`,children:i.deliveryLocal})]})]}),R===`hosted`&&u.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(Ie,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void u.mutate(!0,{revalidate:!1})})}):null,R===`hosted`&&f&&p.data&&!h?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(c,{value:x,onChange:e=>S(e.target.value),children:bt.map(e=>(0,Q.jsx)(l,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:C,onChange:e=>w(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:E,onChange:e=>P(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),ie?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:ie,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(L,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void H(ie),children:[ae?(0,Q.jsx)(s,{className:`size-4`}):(0,Q.jsx)(d,{className:`size-4`}),ae?i.copied:i.copy]}),(0,Q.jsxs)(L,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(ie,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(m,{className:`size-4`}),i.open]})]})}):null,ce?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ce}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(Ct,{share:e,busy:ne===e.id,t:i,onCopy:H,onAction:pe},e.id))})]}):null,(_.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:_.data.map(e=>(0,Q.jsx)(St,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:ne===e.id,publishingAllowed:h,t:i,onCopy:H,onAction:fe},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(L,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(L,{type:`button`,onClick:()=>void de(),disabled:ee||R===`hosted`&&(!f||!h),children:[ee?(0,Q.jsx)(g,{className:`size-4 animate-spin`}):(0,Q.jsx)(U,{className:`size-4`}),ee?i.creating:i.create]})]})]})]})})}function St(e){let t=(0,tt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,f;t[0]===u?f=t[1]:(f=x(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=f);let p=r&&!l?o.stale:l?o.inactive:o.active,h;t[2]===p?h=t[3]:(h=(0,Q.jsx)(`span`,{children:p}),t[2]=p,t[3]=h);let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[4]=_):_=t[4];let v=n.maxViews===null?``:` / ${n.maxViews}`,y;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==v?(y=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,v]}),t[5]=n.viewCount,t[6]=o.views,t[7]=v,t[8]=y):y=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{children:`·`}),t[9]=b):b=t[9];let S;t[10]!==n.revision||t[11]!==o.revision?(S=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=S):S=t[12];let C;t[13]!==h||t[14]!==y||t[15]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[h,_,y,b,S]}),t[13]=h,t[14]=y,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.shareUrl?w=t[18]:(w=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=w);let T;t[19]!==C||t[20]!==w?(T=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;t[22]===i?E=t[23]:(E=i?(0,Q.jsx)(g,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=E);let D;t[24]!==T||t[25]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,E]}),t[24]=T,t[25]=E,t[26]=D):D=t[26];let O=!a,k;t[27]!==s||t[28]!==n.shareUrl?(k=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=k):k=t[29];let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(d,{className:`size-3.5`}),t[30]=A):A=t[30];let j;t[31]!==o.copy||t[32]!==O||t[33]!==k?(j=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.copy]}),t[31]=o.copy,t[32]=O,t[33]=k,t[34]=j):j=t[34];let M=!a,N;t[35]===n.shareUrl?N=t[36]:(N=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=N);let P;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(m,{className:`size-3.5`}),t[37]=P):P=t[37];let F;t[38]!==o.open||t[39]!==M||t[40]!==N?(F=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:M,onClick:N,children:[P,o.open]}),t[38]=o.open,t[39]=M,t[40]=N,t[41]=F):F=t[41];let I;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(I=r&&!l?(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(ae,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=I):I=t[49];let R;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(R=n.revoked?null:(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(Ve,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=R):R=t[54];let z;t[55]!==j||t[56]!==F||t[57]!==I||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[j,F,I,R]}),t[55]=j,t[56]=F,t[57]=I,t[58]=R,t[59]=z):z=t[59];let ee;return t[60]!==D||t[61]!==f||t[62]!==z?(ee=(0,Q.jsxs)(`div`,{className:f,children:[D,z]}),t[60]=D,t[61]=f,t[62]=z,t[63]=ee):ee=t[63],ee}function Ct(e){let t=(0,tt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=x(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,f;t[2]===u?f=t[3]:(f=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=f);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,_;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==h?(_=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=i.views,t[7]=h,t[8]=_):_=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`span`,{children:`·`}),t[9]=v):v=t[9];let y;t[10]===n.expiresAt?y=t[11]:(y=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=y);let b;t[12]===y?b=t[13]:(b=(0,Q.jsx)(`span`,{children:y}),t[12]=y,t[13]=b);let S;t[14]!==b||t[15]!==f||t[16]!==_?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_,v,b]}),t[14]=b,t[15]=f,t[16]=_,t[17]=S):S=t[17];let C;t[18]===n.shareUrl?C=t[19]:(C=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=C);let w;t[20]!==S||t[21]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22];let T;t[23]===r?T=t[24]:(T=r?(0,Q.jsx)(g,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=T);let E;t[25]!==w||t[26]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,T]}),t[25]=w,t[26]=T,t[27]=E):E=t[27];let D;t[28]!==a||t[29]!==n.shareUrl?(D=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(d,{className:`size-3.5`}),t[31]=O):O=t[31];let k;t[32]!==i.copy||t[33]!==D?(k=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:D,children:[O,i.copy]}),t[32]=i.copy,t[33]=D,t[34]=k):k=t[34];let A;t[35]===n.shareUrl?A=t[36]:(A=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=A);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(m,{className:`size-3.5`}),t[37]=j):j=t[37];let M;t[38]!==i.open||t[39]!==A?(M=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:A,children:[j,i.open]}),t[38]=i.open,t[39]=A,t[40]=M):M=t[40];let N;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(N=n.stale&&!s?(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(ae,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(P=s?null:(0,Q.jsx)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=P):P=t[52];let F;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(F=n.revoked?null:(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(Ve,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=F):F=t[57];let I;t[58]!==k||t[59]!==M||t[60]!==N||t[61]!==P||t[62]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,M,N,P,F]}),t[58]=k,t[59]=M,t[60]=N,t[61]=P,t[62]=F,t[63]=I):I=t[63];let R;return t[64]!==E||t[65]!==l||t[66]!==I?(R=(0,Q.jsxs)(`div`,{className:l,children:[E,I]}),t[64]=E,t[65]=l,t[66]=I,t[67]=R):R=t[67],R}function wt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Tt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Et={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Dt(e){let t=(0,tt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=ee(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=ee(u),f=ee(Ot),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Le,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Ot(e){return e.stop}function kt(e,t){let n=Fe(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Fe(e);return!r||n.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CpLJmCV2.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-D3OtdgCs.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-2.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-bxpOryax.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-BMYIfy9x.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-7F4l6DRV.js","assets/messages-DsUnS7rn.js","assets/cn-JdwAhgNB.js","assets/app-link-DRL0YnPs.js","assets/product-delivery-BAks11S4.js","assets/schemas-CObaziC7.js","assets/local-apps-yys1VChX.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-DSjfHfaW.css","assets/dist-CKkafhaS.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-0p9PIHRy.js","assets/dist-io9jFpN72.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-BTQUDoJ2.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/globe-DSSGFWFn.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/pencil-DmIY3Oa-.js","assets/rotate-cw-LIg3Am9S.js","assets/search-DA7gz22f.js","assets/middleware-Pd0e8Igk.js","assets/gateway-realtime-vOLum3RR.js","assets/gateway-realtime-store-DytaaEu8.js","assets/local-session-drafts-Byxxogdc.js","assets/capabilities-BfHgt4uk.js","assets/tasks-QQJXsiER.js","assets/session-api-C7i3UFhq.js","assets/gateway-startup-retry-CtTVgB7_.js","assets/files-Bw4SBGdM.js","assets/session-manager-g96pFnRm.js","assets/tool-activity-BtJkgjFf.js","assets/constants-Co2_smKQ.js","assets/registry-api-DU915Prn.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-C82B1W9Z.js","assets/gateway-config-swr-Hn1vj6uI.js","assets/button-CS04eWY9.js","assets/electron-env-Dit0bHgy.js","assets/index-Bd7mDZFV.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/note-image-lightbox-1qg2v-9j.js","assets/block-editor-BdOTO0Yo.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{f as a,t as o}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as s}from"./check-DUBLcKHA.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"./copy-Dv6d4Dvw.js";import{t as f}from"./download-Dk-ZjtO6.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as m}from"./external-link-DjqjBmc3.js";import{t as h}from"./eye-CABVeTq0.js";import{t as g}from"./loader-circle-CifKLtgG.js";import{t as _}from"./pencil-DmIY3Oa-.js";import{t as v}from"./search-DA7gz22f.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./messages-DsUnS7rn.js";import{t as x}from"./cn-JdwAhgNB.js";import{a as S,c as C,f as w,n as T,r as E}from"./locale-store-7F4l6DRV.js";import{a as D,i as O,n as k,o as A,r as j,s as M,t as N}from"./dist-BGTk37IG.js";import{t as P}from"./session-manager-g96pFnRm.js";import{t as F}from"./copy-to-clipboard-HOJ79TWv.js";import{i as I}from"./vendor-swr-BIWyz7Rc.js";import{t as L}from"./button-CS04eWY9.js";import{t as R}from"./skeleton-BwbyijEw.js";import{$n as z,Ar as ee,Bn as te,Co as ne,F as re,Fn as ie,Gn as B,Hc as ae,Hn as oe,I as se,In as ce,Ji as le,Jn as V,Kn as ue,Ln as de,Lu as fe,Mr as pe,Oc as H,Ol as me,Pc as U,Po as he,Qn as W,Rn as G,Vn as ge,Wl as _e,Wn as ve,Xc as ye,Xn as be,Yn as xe,Zi as Se,_o as Ce,a as we,ar as K,c as Te,cr as Ee,dn as De,ea as Oe,ed as ke,fr as Ae,gc as je,gl as Me,hc as Ne,iu as Pe,jr as Fe,jt as Ie,kr as Le,l as Re,lr as ze,o as Be,or as q,pc as Ve,qi as J,qn as He,s as Ue,sr as We,ta as Ge,td as Ke,tr as qe,un as Je,ur as Ye,wc as Xe,xa as Ze,yu as Qe,zn as $e}from"./index-D3OtdgCs.js";import{n as et,t as Y}from"./note-image-lightbox-1qg2v-9j.js";import{t as X}from"./page-context-capture-button-BlcjlzGF.js";var Z=e(t(),1),tt=n(),Q=r(),nt=6e4,rt=36e5,it=864e5;function at(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function ot(e,t,n){let r=t-e;if(r<nt)return n.justNow;if(r<rt){let e=Math.floor(r/nt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=at(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-it)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*it){let e=Math.floor(r/it);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function st(e,t,n){let r=at(t);if(e>=r)return n.today;if(e>=r-it)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function $(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){let t=(0,tt.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,d=T(dt),f=b(d).automations.suggestions,p=b(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=I(o?`automation-suggestion-coverage`:null,ut,h),_=o?g?.automations.find(e=>Te(e,o)):void 0,v=_?Be(_,p):[];if(l===`titleAction`){if(_){let e;t[1]===s?e=t[2]:(e=x(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(L,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=x(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(me,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(L,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(_){let e;t[16]===s?e=t[17]:(e=x(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(L,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Ue(f.coveredDescription,{name:_.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:v.map(lt)})]}),i]})}let y;t[24]===s?y=t[25]:(y=x(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=y);let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=S):S=t[26];let C;t[27]===n?C=t[28]:(C=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=C);let w;t[29]===r?w=t[30]:(w=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=w);let E;t[31]!==C||t[32]!==w?(E=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[S,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,w]})]}),t[31]=C,t[32]=w,t[33]=E):E=t[33];let D;t[34]!==m||t[35]!==i?(D=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==f.create||t[39]!==D?(k=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(L,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,f.create]})}),t[38]=f.create,t[39]=D,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==y||t[43]!==E?(A=(0,Q.jsxs)(`section`,{className:y,children:[E,k]}),t[41]=k,t[42]=y,t[43]=E,t[44]=A):A=t[44],A}function lt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function ut(){return Re.list()}function dt(e){return e.language}function ft(e){let t=(0,tt.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(M,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,Q.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=s.kind===`actionItems`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=s.kind===`summary`?null:(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,C;t[27]!==i||t[28]!==a||t[29]!==S?(C=(0,Q.jsx)(L,{disabled:i,onClick:a,children:S}),t[27]=i,t[28]=a,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==i||t[32]!==s.text?(w=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=w):w=t[33];let T;t[34]!==s||t[35]!==o?(T=()=>void o(s),t[34]=s,t[35]=o,t[36]=T):T=t[36];let E=r?`保存修改`:`Save changes`,O;t[37]!==w||t[38]!==T||t[39]!==E?(O=(0,Q.jsx)(L,{variant:`primary`,disabled:w,onClick:T,children:E}),t[37]=w,t[38]=T,t[39]=E,t[40]=O):O=t[40];let k;t[41]!==C||t[42]!==O?(k=(0,Q.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[C,O]}),t[41]=C,t[42]=O,t[43]=k):k=t[43];let P;t[44]!==x||t[45]!==k||t[46]!==f?(P=(0,Q.jsxs)(A,{children:[u,(0,Q.jsxs)(j,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[f,x,k]})]}),t[44]=x,t[45]=k,t[46]=f,t[47]=P):P=t[47];let F;return t[48]!==l||t[49]!==P?(F=(0,Q.jsx)(N,{open:!0,onOpenChange:l,children:P}),t[48]=l,t[49]=P,t[50]=F):F=t[50],F}function pt(e,t,n){if(t===`summary`){let r=e.organization;if(!r)return``;let i=r.organization;if(!i)return``;let a=e=>e.filter(e=>n.showIgnored||!e.ignored);return JSON.stringify({discussionId:e.discussion.id,view:t,revision:r.revision,transcriptRevision:r.transcriptRevision,summary:i.summary,decisions:a(i.decisions),actionItems:a(i.actionItems),risks:a(i.risks),openQuestions:a(i.openQuestions),chapters:i.chapters},null,2)}let r=n.query.toLocaleLowerCase(),i=e.transcript.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(r)||e.speakerLabel?.toLocaleLowerCase().includes(r)).slice(0,n.page*50);return i.length?JSON.stringify({discussionId:e.discussion.id,view:t,revision:e.transcript.revision,scope:`loaded filtered segments only`,segments:i.map(e=>({sequence:e.sequence,startedAtMs:e.startedAtMs,speaker:e.speakerLabel,text:e.displayText??e.rawText??``}))},null,2):``}var mt=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function ht({noteId:e}){let t=T(e=>e.language)===`zh`,{data:n,mutate:r,isLoading:i}=I([`note-discussion-document`,e],()=>Je(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),a=n?.discussion.id,u=`/api/discussions/${encodeURIComponent(a??``)}`,{data:d=[],mutate:p}=I(a?`${u}/actions`:null,e=>S(E(e)),{refreshInterval:1e4}),[m,h]=(0,Z.useState)(`summary`),[g,_]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`general`),[C,w]=(0,Z.useState)(null),[O,k]=(0,Z.useState)(null),[P,F]=(0,Z.useState)(null),[z,ee]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)([]),[re,ie]=(0,Z.useState)(null),[B,oe]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(1),le=(0,Z.useRef)(null),V=(0,Z.useRef)(null),[ue,de]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{r(),p()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[r,p]),(0,Z.useEffect)(()=>{n?.discussion.template&&x(n.discussion.template)},[n?.discussion.template]);async function fe(e){if(!B){oe(!0),ie(null);try{await e(),await r(),await p()}catch(e){ie(e instanceof Error?e.message:String(e))}finally{oe(!1)}}}function pe(e){le.current&&(le.current.readyState===0?(V.current=e/1e3,le.current.load()):le.current.currentTime=e/1e3,le.current.play().catch(()=>void 0))}async function H(e,t){n?.organization&&await fe(async()=>{w((await S(E(`${u}/transcript?revision=${t??n.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let me=(e,n,r)=>n.some(e=>z||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),n.filter(e=>z||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:B,onClick:()=>F({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:t?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:B,className:`shrink-0 text-accent-fg`,onClick:()=>void H(e.evidenceSegmentIds,e.evidenceRevision),children:t?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t?`暂无定位`:`No source timing`})]},e.id))]}):null;if(i)return(0,Q.jsx)(R,{className:`h-48 w-full`});if(!n)return null;let{discussion:U,transcript:he,organization:W}=n,G=W?.organization,ge=[`stopping`,`sealing`,`organizing`].includes(U.status),_e=[`recording`,`completed`,`needs_attention`].includes(U.status),ve=he.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(g.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(g.toLocaleLowerCase())),be=pt(n,m,{query:g,page:se,showIgnored:z});return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(Pe,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[mt(U.durationMs??0),` · `,ge?t?`正在整理`:`Processing`:U.status===`completed`?t?`整理完成`:`Ready`:U.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(c,{value:b,"aria-label":t?`纪要模板`:`Summary template`,onChange:e=>x(e.target.value),children:[(0,Q.jsx)(l,{value:`general`,children:t?`通用会议`:`General`}),(0,Q.jsx)(l,{value:`project`,children:t?`项目例会`:`Project`}),(0,Q.jsx)(l,{value:`review`,children:t?`需求评审`:`Review`}),(0,Q.jsx)(l,{value:`interview`,children:t?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(L,{disabled:B||ge||!U.canonicalTranscript,onClick:()=>void fe(()=>S(E(`${u}/organize`),{method:`POST`,body:JSON.stringify({template:b})})),children:[(0,Q.jsx)(ae,{className:`size-3.5`}),t?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":t?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:m===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>h(e),children:e===`summary`?t?`纪要与行动`:`Summary & actions`:t?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(f,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:E(`${u}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge-subtle px-4 py-2`,children:[(0,Q.jsx)(X,{resource:{kind:`note`,id:e,revision:String(n.note.remoteVersion??1)},selection:{text:be,draft:!1},label:t?`引用当前会议内容到新对话`:`Reference displayed meeting content`,disabled:B||ge||!!(P||O)||!be||be.length>16e3}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:be.length>16e3?t?`内容超过 16,000 字符,请筛选更少的逐字稿内容后重试。`:`Over 16,000 characters. Filter fewer transcript segments and try again.`:t?`仅附带当前纪要或已加载的筛选逐字稿,不含录音;作为用户提供的文本。`:`Includes this summary or loaded filtered transcript only, not audio; treated as user-provided text.`})]}),re?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:re}):null,n.recordingJob?.state===`queued`||n.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:t?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,U.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:U.failureMessage}),(0,Q.jsx)(`button`,{disabled:B,onClick:()=>void fe(()=>De(U.id)),children:t?`重试`:`Retry`})]}):null,W&&W.transcriptRevision!==he.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:t?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:m===`summary`?G?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:G.summaryEditedByUser?t?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:B||ge,onClick:()=>F({kind:`summary`,itemId:`summary`,text:G.summary}),children:t?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:G.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:z,onChange:e=>ee(e.target.checked)}),t?`显示已忽略项`:`Show ignored items`]}),te.length?(0,Q.jsx)(L,{disabled:B,onClick:()=>void fe(async()=>{for(let e of te)await S(E(`${u}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:W.revision})});ne([])}),children:t?`加入所选 ${te.length} 项任务`:`Add ${te.length} selected tasks`}):null,me(t?`已决定事项`:`Decisions`,G.decisions,`decisions`),G.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`下一步行动`:`Next actions`}),G.actionItems.filter(e=>z||!e.ignored).map(e=>{let n=d.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!n&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${t?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:te.includes(e.id),onChange:t=>ne(t.target.checked?[...te,e.id]:te.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:B||ge,onClick:()=>F({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:t?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(t?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(t?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:B,className:`text-accent-fg`,onClick:()=>void H(e.evidenceSegmentIds,e.evidenceRevision),children:t?`查看原话`:`Source`}):null,n?n.deleted?(0,Q.jsx)(`span`,{children:t?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:`/tasks/${encodeURIComponent(n.taskId)}`,children:n.resolution===`done`?t?`已完成 · 查看任务`:`Done · View task`:t?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(L,{disabled:B||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void fe(()=>S(E(`${u}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:W.revision})})),children:t?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,me(t?`风险`:`Risks`,G.risks,`risks`),me(t?`尚未确定`:`Open questions`,G.openQuestions,`openQuestions`),G.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`前后变更`:`Changes during the meeting`}),G.changes.map(e=>{let n=[...G.decisions,...G.actionItems,...G.risks,...G.openQuestions],r=n.find(t=>t.id===e.fromId),i=n.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?t?`后续撤销或替代`:`Later superseded`:t?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void H(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void H(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,G.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`章节回顾`:`Chapters`}),G.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>pe(e.startedAtMs),children:[mt(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:ge?t?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:t?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),ge?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(R,{className:`h-6 w-3/4`}),(0,Q.jsx)(R,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(v,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:t?`查找原话或说话人`:`Search words or speaker`,value:g,onChange:e=>{_(e.target.value),ce(1)}})]}),ve.slice(0,se*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${ue>=e.startedAtMs&&ue<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>pe(e.startedAtMs),children:[(0,Q.jsx)(ye,{className:`size-3`}),mt(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(t?`未区分说话人`:`Speaker unknown`)}),_e&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>k({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:t?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(t?`等待转写`:`Awaiting transcription`)})]},e.sequence)),ve.length>se*50?(0,Q.jsx)(L,{onClick:()=>ce(se+1),children:t?`加载更多`:`More`}):null]})}),U.audioAttachmentId&&!U.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:le,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:E(`${u}/audio`),onTimeUpdate:()=>de((le.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{V.current!==null&&le.current&&(le.current.currentTime=V.current,V.current=null)},onError:()=>ie(t?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:E(`${u}/audio`),download:!0,children:t?`下载录音`:`Download recording`})]}):null,C?(0,Q.jsxs)(`aside`,{"aria-label":t?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:t?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭`:`Close`,onClick:()=>w(null),children:(0,Q.jsx)(y,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:C.length?C.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>pe(e.startedAtMs),children:[mt(e.startedAtMs),` · `,e.speakerLabel??(t?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:t?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,P&&W?(0,Q.jsx)(ft,{initial:P,zh:t,busy:B,onClose:()=>F(null),onSave:e=>fe(async()=>{await S(E(`${u}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:W.revision})}),F(null)})},`${P.kind}:${P.itemId}:${W.revision}`):null,O?(0,Q.jsx)(N,{open:!0,onOpenChange:e=>{e||k(null)},children:(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(j,{"aria-describedby":void 0,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(M,{children:t?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭校对`:`Close editor`,onClick:()=>k(null),children:(0,Q.jsx)(y,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[t?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:O.speaker,onChange:e=>k({...O,speaker:e.target.value})})]}),O.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!O.applyToSpeakerGroup,onChange:e=>k({...O,applyToSpeakerGroup:e.target.checked})}),t?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-surface-inset p-2 text-sm`,value:O.text,onChange:e=>k({...O,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(L,{variant:`primary`,disabled:B||!O.text.trim(),onClick:()=>void fe(async()=>{await S(E(`${u}/segments/${O.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:O.text,speakerLabel:O.speaker,expectedRevision:O.segment.revision,applyToSpeakerGroup:O.applyToSpeakerGroup,expectedTranscriptRevision:he.revision})}),k(null)}),children:[(0,Q.jsx)(s,{className:`size-4`}),t?`保存修订`:`Save revision`]})})]})]})}):null]})}var gt={edit:_,ai_edit:H,sync:ae,restore:Ke};function _t(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function vt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=T(e=>e.language),o=b(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:w(a)},{data:c}=I(e?[`note-history`,e]:null,()=>be(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await ze(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),g=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(y,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=gt[e.trigger]??_,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:x(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:_t(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:ot(e.timestamp,g,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function yt({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=b(T(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),{data:v,mutate:y,isLoading:S}=I(e?[`note-agent-context-status`,e]:null,()=>He(e),{revalidateOnFocus:!1}),C=(0,Z.useCallback)(async()=>{if(!g){_(!0),h(null);try{await y(()=>K(e),{revalidate:!1})}catch(e){h(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{_(!1)}}},[g,y,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),w=(0,Z.useCallback)(async t=>{try{await q(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(ke,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),v?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:S||g,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:g?u.processing:u.contextRebuild}),(0,Q.jsx)(`span`,{className:x(`rounded-full px-2 py-0.5 text-[11px] font-medium`,v.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:v.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:v.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(v.attachments.length)).replace(`{{tokens}}`,String(v.tokenEstimate??0))}),m?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,v.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:v.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`helpful`),className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,Q.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void w(`not_helpful`),className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,Q.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(Me,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var bt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function xt({open:e,onOpenChange:t,note:n}){let r=T(e=>e.language)===`zh`,i=r?Tt:Et,{data:a,mutate:o}=I(e?[`note-shares`,n.id]:null,()=>W(n.id)),u=I(e?`hosted-share-auth-status`:null,Se),f=u.data===!0,p=I(e&&f?`hosted-publication-capabilities`:null,le),h=p.data?.publishing.allowed===!0,_=I(e&&f?[`hosted-note-publications`,n.id]:null,()=>xe(n.id)),[v,b]=(0,Z.useState)(new Set),[x,S]=(0,Z.useState)(`86400000`),[C,w]=(0,Z.useState)(``),[E,P]=(0,Z.useState)(``),[R,z]=(0,Z.useState)(`hosted`),[ee,te]=(0,Z.useState)(!1),[ne,re]=(0,Z.useState)(null),[ie,B]=(0,Z.useState)(null),[ae,se]=(0,Z.useState)(!1),[ce,V]=(0,Z.useState)(null),ue=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(b(new Set(ue.map(e=>e.id))),B(null),se(!1),V(null))},[e,ue]);let de=async()=>{te(!0),V(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...v],ttlMs:Number(x),maxViews:C.trim()?Number(C):null,description:E.trim()||void 0};R===`hosted`?(B((await oe(n.id,e)).shareUrl),await _.mutate()):(B((await ve(n.id,e)).payload.shareUrl),await o())}catch(e){V(e instanceof Error?e.message:String(e))}finally{te(!1)}},fe=async(e,t)=>{re(e.id),V(null);try{t===`refresh`?await We(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...v]}):await Oe(e.id),await _.mutate()}catch(e){V(e instanceof Error?e.message:String(e))}finally{re(null)}},pe=async(e,t)=>{re(e.id),V(null);try{t===`refresh`?await Ee(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...v]}):t===`extend`?await J(e.id,864e5):await Ge(e.id),await o()}catch(e){V(e instanceof Error?e.message:String(e))}finally{re(null)}},H=async e=>{V(null);try{if(!await F(e)){se(!1),V(i.copyFailed);return}se(!0),window.setTimeout(()=>se(!1),1500)}catch{se(!1),V(i.copyFailed)}};return(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(j,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(M,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(U,{className:`size-4`}),i.title]}),(0,Q.jsx)(O,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(y,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-inset p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),ue.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:ue.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.has(e.id),onChange:()=>b(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:wt(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(c,{value:R,onChange:e=>z(e.target.value),children:[(0,Q.jsx)(l,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(l,{value:`local`,children:i.deliveryLocal})]})]}),R===`hosted`&&u.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(Ie,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void u.mutate(!0,{revalidate:!1})})}):null,R===`hosted`&&f&&p.data&&!h?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(c,{value:x,onChange:e=>S(e.target.value),children:bt.map(e=>(0,Q.jsx)(l,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:C,onChange:e=>w(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:E,onChange:e=>P(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),ie?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:ie,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(L,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void H(ie),children:[ae?(0,Q.jsx)(s,{className:`size-4`}):(0,Q.jsx)(d,{className:`size-4`}),ae?i.copied:i.copy]}),(0,Q.jsxs)(L,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(ie,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(m,{className:`size-4`}),i.open]})]})}):null,ce?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:ce}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(Ct,{share:e,busy:ne===e.id,t:i,onCopy:H,onAction:pe},e.id))})]}):null,(_.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:_.data.map(e=>(0,Q.jsx)(St,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:ne===e.id,publishingAllowed:h,t:i,onCopy:H,onAction:fe},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(L,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(L,{type:`button`,onClick:()=>void de(),disabled:ee||R===`hosted`&&(!f||!h),children:[ee?(0,Q.jsx)(g,{className:`size-4 animate-spin`}):(0,Q.jsx)(U,{className:`size-4`}),ee?i.creating:i.create]})]})]})]})})}function St(e){let t=(0,tt.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,f;t[0]===u?f=t[1]:(f=x(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=f);let p=r&&!l?o.stale:l?o.inactive:o.active,h;t[2]===p?h=t[3]:(h=(0,Q.jsx)(`span`,{children:p}),t[2]=p,t[3]=h);let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`span`,{children:`·`}),t[4]=_):_=t[4];let v=n.maxViews===null?``:` / ${n.maxViews}`,y;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==v?(y=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,v]}),t[5]=n.viewCount,t[6]=o.views,t[7]=v,t[8]=y):y=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{children:`·`}),t[9]=b):b=t[9];let S;t[10]!==n.revision||t[11]!==o.revision?(S=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=S):S=t[12];let C;t[13]!==h||t[14]!==y||t[15]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[h,_,y,b,S]}),t[13]=h,t[14]=y,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.shareUrl?w=t[18]:(w=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=w);let T;t[19]!==C||t[20]!==w?(T=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;t[22]===i?E=t[23]:(E=i?(0,Q.jsx)(g,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=E);let D;t[24]!==T||t[25]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,E]}),t[24]=T,t[25]=E,t[26]=D):D=t[26];let O=!a,k;t[27]!==s||t[28]!==n.shareUrl?(k=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=k):k=t[29];let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(d,{className:`size-3.5`}),t[30]=A):A=t[30];let j;t[31]!==o.copy||t[32]!==O||t[33]!==k?(j=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.copy]}),t[31]=o.copy,t[32]=O,t[33]=k,t[34]=j):j=t[34];let M=!a,N;t[35]===n.shareUrl?N=t[36]:(N=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=N);let P;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(m,{className:`size-3.5`}),t[37]=P):P=t[37];let F;t[38]!==o.open||t[39]!==M||t[40]!==N?(F=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:M,onClick:N,children:[P,o.open]}),t[38]=o.open,t[39]=M,t[40]=N,t[41]=F):F=t[41];let I;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(I=r&&!l?(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(ae,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=I):I=t[49];let R;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(R=n.revoked?null:(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(Ve,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=R):R=t[54];let z;t[55]!==j||t[56]!==F||t[57]!==I||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[j,F,I,R]}),t[55]=j,t[56]=F,t[57]=I,t[58]=R,t[59]=z):z=t[59];let ee;return t[60]!==D||t[61]!==f||t[62]!==z?(ee=(0,Q.jsxs)(`div`,{className:f,children:[D,z]}),t[60]=D,t[61]=f,t[62]=z,t[63]=ee):ee=t[63],ee}function Ct(e){let t=(0,tt.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=x(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,f;t[2]===u?f=t[3]:(f=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=f);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`span`,{children:`·`}),t[4]=p):p=t[4];let h=n.maxViews===null?``:` / ${n.maxViews}`,_;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==h?(_=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,h]}),t[5]=n.viewCount,t[6]=i.views,t[7]=h,t[8]=_):_=t[8];let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`span`,{children:`·`}),t[9]=v):v=t[9];let y;t[10]===n.expiresAt?y=t[11]:(y=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=y);let b;t[12]===y?b=t[13]:(b=(0,Q.jsx)(`span`,{children:y}),t[12]=y,t[13]=b);let S;t[14]!==b||t[15]!==f||t[16]!==_?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_,v,b]}),t[14]=b,t[15]=f,t[16]=_,t[17]=S):S=t[17];let C;t[18]===n.shareUrl?C=t[19]:(C=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=C);let w;t[20]!==S||t[21]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22];let T;t[23]===r?T=t[24]:(T=r?(0,Q.jsx)(g,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=T);let E;t[25]!==w||t[26]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,T]}),t[25]=w,t[26]=T,t[27]=E):E=t[27];let D;t[28]!==a||t[29]!==n.shareUrl?(D=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(d,{className:`size-3.5`}),t[31]=O):O=t[31];let k;t[32]!==i.copy||t[33]!==D?(k=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:D,children:[O,i.copy]}),t[32]=i.copy,t[33]=D,t[34]=k):k=t[34];let A;t[35]===n.shareUrl?A=t[36]:(A=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=A);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(m,{className:`size-3.5`}),t[37]=j):j=t[37];let M;t[38]!==i.open||t[39]!==A?(M=(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:A,children:[j,i.open]}),t[38]=i.open,t[39]=A,t[40]=M):M=t[40];let N;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(N=n.stale&&!s?(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(ae,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(P=s?null:(0,Q.jsx)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=P):P=t[52];let F;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(F=n.revoked?null:(0,Q.jsxs)(L,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(Ve,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=F):F=t[57];let I;t[58]!==k||t[59]!==M||t[60]!==N||t[61]!==P||t[62]!==F?(I=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,M,N,P,F]}),t[58]=k,t[59]=M,t[60]=N,t[61]=P,t[62]=F,t[63]=I):I=t[63];let R;return t[64]!==E||t[65]!==l||t[66]!==I?(R=(0,Q.jsxs)(`div`,{className:l,children:[E,I]}),t[64]=E,t[65]=l,t[66]=I,t[67]=R):R=t[67],R}function wt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var Tt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},Et={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Dt(e){let t=(0,tt.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=ee(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=ee(u),f=ee(Ot),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Le,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Xe,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Ot(e){return e.stop}function kt(e,t){let n=Fe(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Fe(e);return!r||n.split(`
|
|
3
3
|
`)[0]===r?n:[r,n].filter(Boolean).join(`
|
|
4
4
|
|
|
5
|
-
`)}var At=()=>i(()=>import(`./block-editor-aqBwqSqa.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),jt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([70,1,66,5,71,72,3])),Mt=(0,Z.lazy)(()=>At().then(e=>({default:e.BlockEditor}))),Nt=(0,Z.lazy)(()=>jt().then(e=>({default:e.MarkdownEditor})));function Pt(){let e=(0,tt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Ft(e){let t=(0,tt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Pe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Qe},t[2]=i.source,t[3]=o);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:h},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==o||t[8]!==c?(l=[a,o,c],t[6]=a,t[7]=o,t[8]=c,t[9]=l):l=t[9];let u=l,d;t[10]!==n||t[11]!==u?(d=u.find(e=>e.id===n)??u[0],t[10]=n,t[11]=u,t[12]=d):d=t[12];let f=d,p=f.Icon,m=It,g;t[13]===p?g=t[14]:(g=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=g);let _;t[15]===f.label?_=t[16]:(_=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(fe,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==g||t[20]!==_?(y=(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":f.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[g,_,v]})}),t[18]=f.label,t[19]=g,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,Q.jsx)(de,{children:(0,Q.jsx)(ie,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(ce,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(s,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=u,t[24]=r,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==y?(x=(0,Q.jsxs)(G,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function It(e){e===`wysiwyg`&&At(),e===`source`&&jt()}function Lt(e){let t=(0,tt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=T(Rt),g;t[0]===h?g=t[1]:(g=b(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,Q.jsx)(zt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(Y,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Rt(e){return e.language}function zt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:c,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=T(e=>e.language),m=b(f).notes,h=b(f).chat.pageContext,g=b(f).automations.suggestions,{data:_}=I([`note-discussion-document`,e],()=>Je(e)),[y,S]=(0,Z.useState)(!0),w=a(),E=ne(e=>e.resolved)===`dark`,{openImage:D}=et(),[O,k]=(0,Z.useState)(u),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),[F,L]=(0,Z.useState)(!1),[R,ae]=(0,Z.useState)(``),[oe,le]=(0,Z.useState)(360),[fe,me]=(0,Z.useState)(!1),[W,ve]=(0,Z.useState)(!1),[ye,be]=(0,Z.useState)(!1),xe=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{xe.current+=1},[e]);let[Se,K]=(0,Z.useState)(null),[Te,Ee]=(0,Z.useState)(!1),[De,Oe]=(0,Z.useState)(null),[je,Ne]=(0,Z.useState)(!1),[Fe,Ie]=(0,Z.useState)(!1),Le=(0,Z.useRef)(!1),Re=(0,Z.useRef)(!1),ze=(0,Z.useRef)(null),Be=(0,Z.useRef)(null),q=(0,Z.useRef)(null),J=(0,Z.useRef)(null),He=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),Xe=Ce(e=>e.setPageHeader),Qe=Ce(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=I(e?[`note-detail`,e]:null,()=>ue(e)),{data:nt=[],mutate:rt}=I(e?[`note-threads`,e]:null,()=>z(e),{revalidateOnFocus:!1}),it=M!==null,at=(0,Z.useCallback)(e=>{K(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(at)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,at]),(0,Z.useEffect)(()=>{Le.current=!1,ae(``),N(null),j(null),Re.current=!1,Ke.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Le.current||(ae(Y.title??``),Le.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||Ke.current===e)return;let t=window.requestAnimationFrame(()=>{Ge.current?.focus(),d?.()});return Ke.current=e,()=>window.cancelAnimationFrame(t)},[l,it,Y,e,d]);let ot=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,st=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,he,i),children:(0,Q.jsx)(ke,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),$=(0,Z.useCallback)(()=>{let t=ee.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),lt=(0,Z.useCallback)(e=>{e!==`preview`&&$(),k(e)},[$]),ut=(0,Z.useCallback)(t=>{$(),ae(t),e&&(J.current=t,Be.current&&clearTimeout(Be.current),Be.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){L(!0);try{await Ye(e,{title:t}),await X(),n?.()}catch{}finally{L(!1)}}},600))},[$,e,X,n]),dt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:x(`flex min-w-0 items-center gap-2`,he),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:R||ot||void 0,children:R||ot}),F?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:m.saving}):null]}),[m.saving,F,ot,R]),ft=(0,Z.useCallback)(async(t=!1)=>{be(!0),K(null);try{let n=await qe(e,{forceNew:t});await X(),await rt(),w(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){K(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{be(!1)}},[X,rt,w,e,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{ve(!0),K(null);try{await ge(e),await X()}catch(e){K(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{ve(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{j(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!W&&pt()},[A,W,pt,Y?.aiDeep?.catalysis?.report]),gt=(0,Z.useCallback)(()=>{let t=M?M.markdown??``:q.current??Y?.markdown??``,n=M?M.title??``:R,r=kt(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:pe(r,f)}},[f,m.titlePlaceholder,Y?.markdown,e,M,R]),_t=(0,Z.useCallback)(async()=>{ze.current&&clearTimeout(ze.current),Be.current&&clearTimeout(Be.current),ze.current=null,Be.current=null;let t=q.current,r=J.current;q.current=null,J.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;L(!0);try{let t=await Ye(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return q.current===null&&(q.current=t),J.current===null&&(J.current=r),K(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`),null}finally{L(!1)}},[X,m.saveFailed,m.saveFailedHint,Y,e,n]),bt=(0,Z.useCallback)(async()=>{if(!Y||ye||F)return;be(!0),K(null);let e=C.getState(),t=++xe.current,n=()=>xe.current===t&&C.getState().baseUrl===e.baseUrl&&C.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&He.current?.contains(t.anchorNode)&&He.current.contains(t.focusNode)?t.toString():``,i=await _t();if(!i||!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let a=se.capture({title:i.title||i.id,text:i.markdown,resourceRefs:[{kind:`note`,id:i.id,revision:String(i.remoteVersion??1)}],selection:r?{text:r,draft:!1}:void 0}),o=await new P().createSession();if(!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let s=re(e.baseUrl,e.conversationId,o.key);if(!se.put(s,a))throw Error(h.unavailable);w(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&K(h.unavailable)}finally{xe.current===t&&be(!1)}},[Y,ye,F,_t,w,h.unavailable]),St=(0,Z.useCallback)(async()=>{K(null);let e=await _t();e&&(Oe(e),Ee(!0))},[_t]),Ct=(0,Z.useCallback)(async()=>{if(!(Fe||F)){Ne(!1),Ie(!0),K(null),$(),ze.current&&clearTimeout(ze.current),Be.current&&clearTimeout(Be.current),ze.current=null,Be.current=null,q.current=null,J.current=null;try{await B(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){K(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{Ie(!1)}}},[Fe,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,F,$]),wt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:x(`flex min-w-0 items-center gap-1 sm:gap-2`,he),children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":m.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Dt,{input:gt,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:mt,disabled:W,"aria-label":m.catalysisSectionTitle,className:x(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,A===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:W?m.catalyzing:m.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":m.openChatButton,disabled:ye,className:x(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:ye?m.openingChat:m.openChatButton})]}),(0,Q.jsx)(Ft,{mode:O,onModeChange:lt,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void bt(),disabled:ye||F||!Y||!!M,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,Q.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(G,{modal:!1,children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":m.noteActions,title:m.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(de,{children:(0,Q.jsxs)(ie,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(ce,{onSelect:()=>void St(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(U,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(ce,{onSelect:()=>j(A===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(_e,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,Q.jsx)(s,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)($e,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(ce,{disabled:Fe||F,onSelect:()=>Ne(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[W,mt,ft,bt,h.capture,Y,M,O,m.history,m.modeEdit,m.modePreview,m.modeSource,ye,A,c,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,lt,gt,St,Fe,F,f,m.delete,Ne]);(0,Z.useLayoutEffect)(()=>(Xe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&Qe()}),[o,Qe,wt,dt,st,Y,Xe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),q.current=t,ze.current&&clearTimeout(ze.current),ze.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){L(!0),K(null);try{await Ye(e,{markdown:t}),await X(),n?.()}catch(e){K(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`)}finally{L(!1)}}},600))},[$,e,X,m.saveFailed,m.saveFailedHint,n]),Et=(0,Z.useCallback)(t=>{V(e,t.timestamp).then(e=>{e&&($(),N(e))})},[e,$]),Ot=(0,Z.useCallback)(()=>{$(),j(null),N(null)},[$]),At=(0,Z.useCallback)(()=>{$(),j(null),N(null),X().catch(at),n?.()},[X,n,at,$]);if((0,Z.useEffect)(()=>()=>{ze.current&&clearTimeout(ze.current),Be.current&&clearTimeout(Be.current);let t=q.current,n=J.current;q.current=null,J.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Ye(e,r).catch(()=>void 0)},[e]),Y===void 0)return tt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(at),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,Q.jsx)(Pt,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let jt=it?M.title??``:R,It=it?M.markdown??``:q.current??Y.markdown??``,Lt=new Date(Y.createdAt).getTime(),Rt=Number.isFinite(Lt)&&Date.now()-Lt<3600*1e3?(0,Q.jsx)(ct,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[Se?(0,Q.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:Se}):null,(0,Q.jsx)(we,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(we,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),_?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:y?`text-accent-fg`:`text-fg-muted`,onClick:()=>S(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:y?`text-fg-muted`:`text-accent-fg`,onClick:()=>S(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:He,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[_&&y?(0,Q.jsx)(ht,{noteId:e}):null,(0,Q.jsx)(`div`,{className:_&&y?`hidden`:`min-h-0 min-w-0 flex-1`,children:it?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[jt&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:jt}),It?(0,Q.jsx)(Ae,{noteId:e,content:It,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[O===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ge,type:`text`,value:R,onChange:e=>ut(e.target.value),onCompositionStart:()=>{Re.current=!0},onCompositionEnd:()=>{Re.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Re.current&&!t.isComposing&&(e.preventDefault(),(He.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Pt,{}),children:(0,Q.jsx)(Mt,{initialContent:Y.markdown??``,onChange:Tt,noteId:e},`wysiwyg-${e}`)})})]}),O===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ge,type:`text`,value:R,onChange:e=>ut(e.target.value),placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Pt,{}),children:(0,Q.jsx)(Nt,{initialContent:Y.markdown??``,onChange:Tt,isDark:E},`source-${e}`)})})]}),O===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&D(t.currentSrc||t.src,t.alt)},children:[R&&!Y.markdown.trimStart().startsWith(`# ${R.trim()}\n`)&&Y.markdown.trim()!==`# ${R.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:R}),Y.markdown?(0,Q.jsx)(Ae,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:Ue,className:x(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!fe&&`transition-[width] duration-300 ease-in-out`),style:{width:A?oe:0},children:(0,Q.jsxs)(`div`,{ref:We,className:`flex min-h-0 flex-1 flex-col`,style:{width:oe},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),me(!0);let n=e.clientX,r=oe,i=e.pointerId,a=0,o=oe,s=oe,c=()=>{a=0,s=o,A&&Ue.current?.style.setProperty(`width`,`${s}px`),We.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}me(!1),le(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:x(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,fe&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(vt,{noteId:e,activeTimestamp:M?.timestamp??null,onSelect:Et,onClose:Ot,onRestored:At}):A===`breakdown`?(0,Q.jsx)(yt,{noteId:e,note:Y??null,catalyzing:W,onCatalyze:pt,onClose:()=>j(null),noteThreads:nt,openingChat:ye,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),De?(0,Q.jsx)(xt,{open:Te,onOpenChange:Ee,note:De}):null,(0,Q.jsx)(Ze,{open:je,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,Y.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void Ct(),onCancel:()=>Ne(!1)})]})}export{ot as i,$ as n,st as r,Lt as t};
|
|
5
|
+
`)}var At=()=>i(()=>import(`./block-editor-CpLJmCV2.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),jt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([70,1,66,5,71,72,3])),Mt=(0,Z.lazy)(()=>At().then(e=>({default:e.BlockEditor}))),Nt=(0,Z.lazy)(()=>jt().then(e=>({default:e.MarkdownEditor})));function Pt(){let e=(0,tt.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Ft(e){let t=(0,tt.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Pe},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:Qe},t[2]=i.source,t[3]=o);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:h},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==o||t[8]!==c?(l=[a,o,c],t[6]=a,t[7]=o,t[8]=c,t[9]=l):l=t[9];let u=l,d;t[10]!==n||t[11]!==u?(d=u.find(e=>e.id===n)??u[0],t[10]=n,t[11]=u,t[12]=d):d=t[12];let f=d,p=f.Icon,m=It,g;t[13]===p?g=t[14]:(g=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=g);let _;t[15]===f.label?_=t[16]:(_=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(fe,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=v):v=t[17];let y;t[18]!==f.label||t[19]!==g||t[20]!==_?(y=(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":f.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[g,_,v]})}),t[18]=f.label,t[19]=g,t[20]=_,t[21]=y):y=t[21];let b;t[22]!==n||t[23]!==u||t[24]!==r?(b=(0,Q.jsx)(de,{children:(0,Q.jsx)(ie,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(ce,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(s,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=u,t[24]=r,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==y?(x=(0,Q.jsxs)(G,{modal:!1,children:[y,b]}),t[26]=b,t[27]=y,t[28]=x):x=t[28],x}function It(e){e===`wysiwyg`&&At(),e===`source`&&jt()}function Lt(e){let t=(0,tt.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=T(Rt),g;t[0]===h?g=t[1]:(g=b(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,Q.jsx)(zt,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(Y,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Rt(e){return e.language}function zt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:c,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=T(e=>e.language),m=b(f).notes,h=b(f).chat.pageContext,g=b(f).automations.suggestions,{data:_}=I([`note-discussion-document`,e],()=>Je(e)),[y,S]=(0,Z.useState)(!0),w=a(),E=ne(e=>e.resolved)===`dark`,{openImage:D}=et(),[O,k]=(0,Z.useState)(u),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(null),[F,L]=(0,Z.useState)(!1),[R,ae]=(0,Z.useState)(``),[oe,le]=(0,Z.useState)(360),[fe,me]=(0,Z.useState)(!1),[W,ve]=(0,Z.useState)(!1),[ye,be]=(0,Z.useState)(!1),xe=(0,Z.useRef)(0);(0,Z.useEffect)(()=>()=>{xe.current+=1},[e]);let[Se,K]=(0,Z.useState)(null),[Te,Ee]=(0,Z.useState)(!1),[De,Oe]=(0,Z.useState)(null),[je,Ne]=(0,Z.useState)(!1),[Fe,Ie]=(0,Z.useState)(!1),Le=(0,Z.useRef)(!1),Re=(0,Z.useRef)(!1),ze=(0,Z.useRef)(null),Be=(0,Z.useRef)(null),q=(0,Z.useRef)(null),J=(0,Z.useRef)(null),He=(0,Z.useRef)(null),Ue=(0,Z.useRef)(null),We=(0,Z.useRef)(null),Ge=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),Xe=Ce(e=>e.setPageHeader),Qe=Ce(e=>e.clearPageHeader),{data:Y,mutate:X,error:tt}=I(e?[`note-detail`,e]:null,()=>ue(e)),{data:nt=[],mutate:rt}=I(e?[`note-threads`,e]:null,()=>z(e),{revalidateOnFocus:!1}),it=M!==null,at=(0,Z.useCallback)(e=>{K(`${m.refreshFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)},[m.quickCaptureFailedHint,m.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(at)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,at]),(0,Z.useEffect)(()=>{Le.current=!1,ae(``),N(null),j(null),Re.current=!1,Ke.current=null},[e]),(0,Z.useEffect)(()=>{!Y||Le.current||(ae(Y.title??``),Le.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||it||Ke.current===e)return;let t=window.requestAnimationFrame(()=>{Ge.current?.focus(),d?.()});return Ke.current=e,()=>window.cancelAnimationFrame(t)},[l,it,Y,e,d]);let ot=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,st=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":m.back,className:x(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,he,i),children:(0,Q.jsx)(ke,{className:`size-4`,"aria-hidden":!0})}):null,[i,m.back,t,r]),$=(0,Z.useCallback)(()=>{let t=ee.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),lt=(0,Z.useCallback)(e=>{e!==`preview`&&$(),k(e)},[$]),ut=(0,Z.useCallback)(t=>{$(),ae(t),e&&(J.current=t,Be.current&&clearTimeout(Be.current),Be.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){L(!0);try{await Ye(e,{title:t}),await X(),n?.()}catch{}finally{L(!1)}}},600))},[$,e,X,n]),dt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:x(`flex min-w-0 items-center gap-2`,he),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:R||ot||void 0,children:R||ot}),F?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:m.saving}):null]}),[m.saving,F,ot,R]),ft=(0,Z.useCallback)(async(t=!1)=>{be(!0),K(null);try{let n=await qe(e,{forceNew:t});await X(),await rt(),w(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){K(`${m.chatOpenFailedTitle}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{be(!1)}},[X,rt,w,e,m.chatOpenFailedMessage,m.chatOpenFailedTitle]),pt=(0,Z.useCallback)(async()=>{ve(!0),K(null);try{await ge(e),await X()}catch(e){K(`${m.catalysisFailed}: ${e instanceof Error?e.message:m.chatOpenFailedMessage}`)}finally{ve(!1)}},[X,e]),mt=(0,Z.useCallback)(()=>{j(A===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!W&&pt()},[A,W,pt,Y?.aiDeep?.catalysis?.report]),gt=(0,Z.useCallback)(()=>{let t=M?M.markdown??``:q.current??Y?.markdown??``,n=M?M.title??``:R,r=kt(n,t);return{source:{type:`note`,id:e,title:n||m.titlePlaceholder},text:r,language:pe(r,f)}},[f,m.titlePlaceholder,Y?.markdown,e,M,R]),_t=(0,Z.useCallback)(async()=>{ze.current&&clearTimeout(ze.current),Be.current&&clearTimeout(Be.current),ze.current=null,Be.current=null;let t=q.current,r=J.current;q.current=null,J.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;L(!0);try{let t=await Ye(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return q.current===null&&(q.current=t),J.current===null&&(J.current=r),K(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`),null}finally{L(!1)}},[X,m.saveFailed,m.saveFailedHint,Y,e,n]),bt=(0,Z.useCallback)(async()=>{if(!Y||ye||F)return;be(!0),K(null);let e=C.getState(),t=++xe.current,n=()=>xe.current===t&&C.getState().baseUrl===e.baseUrl&&C.getState().conversationId===e.conversationId;try{let t=window.getSelection(),r=t?.anchorNode&&t.focusNode&&He.current?.contains(t.anchorNode)&&He.current.contains(t.focusNode)?t.toString():``,i=await _t();if(!i||!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let a=se.capture({title:i.title||i.id,text:i.markdown,resourceRefs:[{kind:`note`,id:i.id,revision:String(i.remoteVersion??1)}],selection:r?{text:r,draft:!1}:void 0}),o=await new P().createSession();if(!n())return;if(q.current!==null||J.current!==null)throw Error(h.unavailable);let s=re(e.baseUrl,e.conversationId,o.key);if(!se.put(s,a))throw Error(h.unavailable);w(`/chat/${encodeURIComponent(o.key)}`)}catch{n()&&K(h.unavailable)}finally{xe.current===t&&be(!1)}},[Y,ye,F,_t,w,h.unavailable]),St=(0,Z.useCallback)(async()=>{K(null);let e=await _t();e&&(Oe(e),Ee(!0))},[_t]),Ct=(0,Z.useCallback)(async()=>{if(!(Fe||F)){Ne(!1),Ie(!0),K(null),$(),ze.current&&clearTimeout(ze.current),Be.current&&clearTimeout(Be.current),ze.current=null,Be.current=null,q.current=null,J.current=null;try{await B(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){K(`${m.deleteFailed}: ${e instanceof Error?e.message:m.quickCaptureFailedHint}`)}finally{Ie(!1)}}},[Fe,m.deleteFailed,m.quickCaptureFailedHint,e,t,n,F,$]),wt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:x(`flex min-w-0 items-center gap-1 sm:gap-2`,he),children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":m.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Dt,{input:gt,showLabel:!1,labels:{read:m.readAloud,preparing:m.readAloudPreparing,pause:m.readAloudPause,resume:m.readAloudResume,retry:m.readAloudRetry,stop:m.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:mt,disabled:W,"aria-label":m.catalysisSectionTitle,className:x(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,A===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:W?m.catalyzing:m.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ft(!1),"aria-label":m.openChatButton,disabled:ye,className:x(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:ye?m.openingChat:m.openChatButton})]}),(0,Q.jsx)(Ft,{mode:O,onModeChange:lt,labels:{edit:m.modeEdit,source:m.modeSource,preview:m.modePreview}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void bt(),disabled:ye||F||!Y||!!M,className:`inline-flex items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[(0,Q.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),h.capture]}),(0,Q.jsxs)(G,{modal:!1,children:[(0,Q.jsx)(te,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":m.noteActions,title:m.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(p,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(de,{children:(0,Q.jsxs)(ie,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(ce,{onSelect:()=>void St(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(U,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(ce,{onSelect:()=>j(A===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(_e,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:m.history}),A===`history`?(0,Q.jsx)(s,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)($e,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(ce,{disabled:Fe||F,onSelect:()=>Ne(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(Ve,{className:`size-4`,"aria-hidden":!0}),m.delete]})]})})]})]}),[W,mt,ft,bt,h.capture,Y,M,O,m.history,m.modeEdit,m.modePreview,m.modeSource,ye,A,c,m.searchDialogTitle,m.readAloud,m.readAloudPause,m.readAloudPreparing,m.readAloudResume,m.readAloudRetry,m.readAloudStop,lt,gt,St,Fe,F,f,m.delete,Ne]);(0,Z.useLayoutEffect)(()=>(Xe({startExtra:st,main:Y?dt:null,end:Y?wt:null}),()=>{o&&Qe()}),[o,Qe,wt,dt,st,Y,Xe]);let Tt=(0,Z.useCallback)(t=>{e&&($(),q.current=t,ze.current&&clearTimeout(ze.current),ze.current=setTimeout(async()=>{let t=q.current;if(q.current=null,t!==null){L(!0),K(null);try{await Ye(e,{markdown:t}),await X(),n?.()}catch(e){K(`${m.saveFailed}: ${e instanceof Error?e.message:m.saveFailedHint}`)}finally{L(!1)}}},600))},[$,e,X,m.saveFailed,m.saveFailedHint,n]),Et=(0,Z.useCallback)(t=>{V(e,t.timestamp).then(e=>{e&&($(),N(e))})},[e,$]),Ot=(0,Z.useCallback)(()=>{$(),j(null),N(null)},[$]),At=(0,Z.useCallback)(()=>{$(),j(null),N(null),X().catch(at),n?.()},[X,n,at,$]);if((0,Z.useEffect)(()=>()=>{ze.current&&clearTimeout(ze.current),Be.current&&clearTimeout(Be.current);let t=q.current,n=J.current;q.current=null,J.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&Ye(e,r).catch(()=>void 0)},[e]),Y===void 0)return tt?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:m.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(at),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:m.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:m.back})]}):(0,Q.jsx)(Pt,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:m.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:m.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:m.back})]});let jt=it?M.title??``:R,It=it?M.markdown??``:q.current??Y.markdown??``,Lt=new Date(Y.createdAt).getTime(),Rt=Number.isFinite(Lt)&&Date.now()-Lt<3600*1e3?(0,Q.jsx)(ct,{title:g.noteCreatedTitle,description:g.noteCreatedDescription,prompt:g.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[Se?(0,Q.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:Se}):null,(0,Q.jsx)(we,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(we,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),_?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:y?`text-accent-fg`:`text-fg-muted`,onClick:()=>S(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:y?`text-fg-muted`:`text-accent-fg`,onClick:()=>S(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:He,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[_&&y?(0,Q.jsx)(ht,{noteId:e}):null,(0,Q.jsx)(`div`,{className:_&&y?`hidden`:`min-h-0 min-w-0 flex-1`,children:it?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[jt&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:jt}),It?(0,Q.jsx)(Ae,{noteId:e,content:It,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[O===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ge,type:`text`,value:R,onChange:e=>ut(e.target.value),onCompositionStart:()=>{Re.current=!0},onCompositionEnd:()=>{Re.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Re.current&&!t.isComposing&&(e.preventDefault(),(He.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Pt,{}),children:(0,Q.jsx)(Mt,{initialContent:Y.markdown??``,onChange:Tt,noteId:e},`wysiwyg-${e}`)})})]}),O===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Ge,type:`text`,value:R,onChange:e=>ut(e.target.value),placeholder:m.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Rt]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Pt,{}),children:(0,Q.jsx)(Nt,{initialContent:Y.markdown??``,onChange:Tt,isDark:E},`source-${e}`)})})]}),O===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&D(t.currentSrc||t.src,t.alt)},children:[R&&!Y.markdown.trimStart().startsWith(`# ${R.trim()}\n`)&&Y.markdown.trim()!==`# ${R.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:R}),Y.markdown?(0,Q.jsx)(Ae,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:m.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:Ue,className:x(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!fe&&`transition-[width] duration-300 ease-in-out`),style:{width:A?oe:0},children:(0,Q.jsxs)(`div`,{ref:We,className:`flex min-h-0 flex-1 flex-col`,style:{width:oe},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),me(!0);let n=e.clientX,r=oe,i=e.pointerId,a=0,o=oe,s=oe,c=()=>{a=0,s=o,A&&Ue.current?.style.setProperty(`width`,`${s}px`),We.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}me(!1),le(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:x(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,fe&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:A===`history`?(0,Q.jsx)(vt,{noteId:e,activeTimestamp:M?.timestamp??null,onSelect:Et,onClose:Ot,onRestored:At}):A===`breakdown`?(0,Q.jsx)(yt,{noteId:e,note:Y??null,catalyzing:W,onCatalyze:pt,onClose:()=>j(null),noteThreads:nt,openingChat:ye,onOpenChat:()=>ft(!1),onOpenNewChat:()=>ft(!0)}):null})]})})]}),De?(0,Q.jsx)(xt,{open:Te,onOpenChange:Ee,note:De}):null,(0,Q.jsx)(Ze,{open:je,title:m.deleteConfirmTitle,description:m.deleteConfirmDescription.replace(`{{title}}`,Y.title||m.titlePlaceholder),confirmLabel:m.deleteConfirmLabel,cancelLabel:m.deleteCancelLabel,destructive:!0,onConfirm:()=>void Ct(),onCancel:()=>Ne(!1)})]})}export{ot as i,$ as n,st as r,Lt as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
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,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./popover-select-0p9PIHRy.js";import{t as l}from"./ellipsis-0k4rZLoy.js";import{f as u}from"./markdown-view-bxpOryax.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./search-DA7gz22f.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-DsUnS7rn.js";import{t as g}from"./cn-JdwAhgNB.js";import{c as _,f as v,n as y}from"./locale-store-7F4l6DRV.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{t as x}from"./skeleton-BwbyijEw.js";import{$u as S,Bn as C,Cc as ee,Fa as te,Fn as w,Gn as T,Gu as ne,In as E,Ln as re,Oc as ie,Pn as ae,Po as D,Ql as oe,Rn as se,Ru as O,Un as ce,Xu as le,Zn as ue,Zu as k,_o as de,an as A,cn as j,dr as M,ed as fe,er as pe,in as N,iu as me,lc as P,ln as he,mr as ge,nd as _e,nl as F,on as ve,pc as ye,pl as be,rn as xe,sl as Se,sn as I,tr as L,ur as Ce,xa as we,zc as Te,zl as Ee}from"./index-
|
|
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,u as s}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as c}from"./popover-select-0p9PIHRy.js";import{t as l}from"./ellipsis-0k4rZLoy.js";import{f as u}from"./markdown-view-bxpOryax.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./search-DA7gz22f.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./messages-DsUnS7rn.js";import{t as g}from"./cn-JdwAhgNB.js";import{c as _,f as v,n as y}from"./locale-store-7F4l6DRV.js";import{i as b}from"./vendor-swr-BIWyz7Rc.js";import{t as x}from"./skeleton-BwbyijEw.js";import{$u as S,Bn as C,Cc as ee,Fa as te,Fn as w,Gn as T,Gu as ne,In as E,Ln as re,Oc as ie,Pn as ae,Po as D,Ql as oe,Rn as se,Ru as O,Un as ce,Xu as le,Zn as ue,Zu as k,_o as de,an as A,cn as j,dr as M,ed as fe,er as pe,in as N,iu as me,lc as P,ln as he,mr as ge,nd as _e,nl as F,on as ve,pc as ye,pl as be,rn as xe,sl as Se,sn as I,tr as L,ur as Ce,xa as we,zc as Te,zl as Ee}from"./index-D3OtdgCs.js";import{i as De,t as Oe}from"./note-detail-panel-fPUNv1PI.js";var R=n(),z=e(t(),1),B=r();function V({projectId:e}){let t=y(e=>e.language)===`zh`,n=i(),r=(0,z.useRef)(null),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(null);async function f(){let t=a.current;if(!(!t||o!==null)){s(0),l(null);try{let r=await he();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let i=await xe(t.file,t.requestId),o=await j({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=o.discussion.id,await ve({...i,serverDiscussionId:o.discussion.id,projectId:e}),o.discussion.audioAttachmentId||await N(i,o.discussion.id,s),await A(t.requestId),a.current=null,n(`/notes/${encodeURIComponent(o.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(null)}}}return(0,B.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,B.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}a.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:o!==null,onClick:()=>c&&a.current?void f():r.current?.click(),children:[(0,B.jsx)(P,{className:`size-3.5`}),o===null?c&&a.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${o}%`]}),u===null?null:(0,B.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,B.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void I(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,B.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function H(e){e.note??=await ce({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await M(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${ge(t,e.id)})`);e.note=await Ce(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
2
|
|
|
3
3
|
`)}`})}return{noteId:t,conversationId:(await L(t,{projectId:e.projectId})).conversationId}}function U(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var W={meeting:le,requirements:me,research:Te,weekly:O};function ke({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:a,projectsLoading:o,projectsError:s}){let l=a.home,u=i(),[f,p]=(0,z.useState)(``),[h,_]=(0,z.useState)(null),[v,y]=(0,z.useState)([]),[b,x]=(0,z.useState)(!1),[S,C]=(0,z.useState)(null),[ee,te]=(0,z.useState)(``),w=(0,z.useRef)(null),T=(0,z.useRef)(!1),ne=(0,z.useRef)(null),E=(0,z.useRef)(null),re=b||!!w.current,D=h?l.templateOptions[h]:null,se=!!(f.trim()||v.length);async function O(){if(!(T.current||!se&&!w.current)){T.current=!0,x(!0),C(null),w.current??={requestId:crypto.randomUUID(),title:f.trim().split(`
|
|
4
4
|
`)[0]?.slice(0,80)||D?.label||a.titlePlaceholder,markdown:`## ${l.requestHeading}\n\n${D?`${D.prompt}\n`:``}${f.trim()}`,projectId:t||void 0,files:[...v],attachments:[],materialHeading:l.materialsHeading};try{let e=await H(w.current);r(),u(U(e.conversationId,e.noteId,l.agentPrompt))}catch(e){w.current.note&&r(),C(e instanceof Error?e.message:a.quickCaptureFailedHint)}finally{T.current=!1,x(!1)}}}function ce(){w.current=null,C(null),p(``),y([]),_(null),E.current?.focus()}return(0,B.jsxs)(`section`,{"aria-label":l.askLabel,children:[(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),O()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,B.jsxs)(`fieldset`,{disabled:re,className:`min-w-0`,children:[(0,B.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,B.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),l.askLabel]}),D?(0,B.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,B.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[D.label,` · `]}),D.prompt.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-DsUnS7rn.js";import{c as s,n as c}from"./locale-store-7F4l6DRV.js";import{t as l}from"./session-manager-g96pFnRm.js";import{F as u,I as d,Xs as f,iu as p}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,u as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-DsUnS7rn.js";import{c as s,n as c}from"./locale-store-7F4l6DRV.js";import{t as l}from"./session-manager-g96pFnRm.js";import{F as u,I as d,Xs as f,iu as p}from"./index-D3OtdgCs.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=o(c(e=>e.language)).chat.pageContext,v=r(),y=i().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=s(e=>e.baseUrl),D=s(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&s.getState().baseUrl===E&&s.getState().conversationId===D;try{let n=d.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await f(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new l().createSession();if(!r())return;if(!d.put(u(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[b?(0,h.jsx)(a,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
|