@xopcai/xopc 0.0.195 → 0.0.197
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-DkYgzssq.js → agent-avatar-dicebear-C5st7lt5.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Baxfj44y.js +68 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DVXLietl.js → app-management-settings-panel-S8LhoD6G.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-D7oohrYf.js → appearance-settings-D8Cd5vDP.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-0uCxKyE5.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CpBzHKzI.js → archive-plugin-qL07mwnY.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DMWXe12h.js → attachment-load-CqSobpdi.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-XyDat125.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BM0MgsHB.js → binary-plugins-DBRPyLYE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C2MT7mG3.js → block-editor-6wG1LU7t.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-CrYNMR4w.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-V01qhcZc.js → browser-workflow-inputs-Abil4puY.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DPmSKVWx.js → browser-workflows-page-BEu3E0et.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CvMcDhGf.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CHJDY-Ih.js +3 -0
- package/dist/gateway/static/root/assets/channels-settings-Ds9BJbcY.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-CgWjgPSI.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-NUs-Zf7F.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-5SqAw4UD.js → cron-expression-ZdDBAoqA.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-eiaYMDYI.js → dependency-picker-BGeB1jpn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BtfzkmnU.js → desktop-pet-CsLR4pWB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Dn3hnBOU.js → desktop-pet-settings-CCjT1bdo.js} +1 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-C-Te1QN3.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-EWu0uOpw.js → extension-debug-page-CD73euAM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-2qZ7ngqL.js → extension-page-DAKjpNwd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-4MOAwYPT.js → extension-settings-page-BLSNdlgd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-aqPj1HAI.js → gateway-config-api-CQrf0k3D.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BbQBgKWH.js → gateway-settings-CvgH8IJI.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DXtG-Sy0.js → heartbeat-settings-SPpnqbjl.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BFoD6047.js +3 -0
- package/dist/gateway/static/root/assets/index-84ys9u-K.js +152 -0
- package/dist/gateway/static/root/assets/index-D-srnucP.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-WKmsr5WD.js → keyboard-shortcuts-settings-HMhxgOuD.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D5uL2_Fd.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-3-aNfJwB.js → local-apps-page-DIWkFa3g.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page--6v8qq6y.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D8vbsfLm.js → management-settings-DtEuS-kR.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-DRFl6Vfw.js → markdown-split-DvVBewS4.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C5J46ROp.js → media-plugins-YVj7NVzD.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-Z0lEBC-X.js → notes-page-BDzuL2I9.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-IdjuNXvH.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-Dyj6Snbu.js → page-tabs-7bSEWfSX.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CPDM4F7n.js → preview-open-alternatives-tgLbHgcV.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-8RFhWmcU.js → product-open-page-Bwx_CQht.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DnJXSuM4.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DckZKlBI.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CfbUHBUH.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BBgWkYk0.js → runtime-tools-settings-panel-Fe05Nus6.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BJqF0l7i.js → schema-form-CFfyC4CB.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BCfCh4My.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cbi4FvzO.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CYL5uBzc.js → settings-form-section-gEnEYT_3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BabbixC0.js → settings-loading-skeleton-BRE_-7Da.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B7OH9I8A.js → settings-page-C1zxCpqB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D9X3eVDo.js → settings-page-layout-CRpXF_05.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BHdz-BO7.js → setup-status-panel-BcHdpmFf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CMuJZ5Qq.js → share-preview-page-DU8L68A5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-kjTqH9yY.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-QAGpwzIM.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C9U1pIT-.js → skills-page-lE1-YRdK.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-C3iaLgk9.js → skills-page.utils-CYwFWTso.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CAN01aY0.js → system-settings-panel-CVDsiPKn.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DsM13-cy.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-C9FMLeH2.js → typed-models-lib-DelyYgoc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-AAZNoD6t.js → use-autosave-C50Mq5yQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-D-VEOt2A.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-yLXEYgwV.js → voice-api-key-field-DYfgTe3Y.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-tbkbg-8l.js → work-discovery-overlay-DPbujsp3.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-D77opady.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BJHOxj4Z.js → workflow-run-setup-panel-DqIb1oBB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B9-PLmlX.js +5 -0
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +2 -0
- package/dist/src/agent/embedded/execution-context.js +11 -0
- package/dist/src/agent/embedded/index.d.ts +3 -1
- package/dist/src/agent/embedded/index.js +5 -3
- package/dist/src/agent/embedded/run-turn.js +15 -9
- package/dist/src/agent/embedded/session-runner.d.ts +6 -11
- package/dist/src/agent/embedded/session-runner.js +25 -36
- package/dist/src/agent/embedded/transcript-runtime.d.ts +35 -0
- package/dist/src/agent/embedded/transcript-runtime.js +66 -0
- package/dist/src/agent/embedded/types.d.ts +3 -1
- package/dist/src/agent/service.d.ts +15 -0
- package/dist/src/agent/service.js +30 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +1 -1
- package/dist/src/gateway/hono/routes/home.js +2 -2
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/projects.js +12 -1
- package/dist/src/gateway/hono/routes/side-chats.d.ts +3 -0
- package/dist/src/gateway/hono/routes/side-chats.js +173 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +5 -1
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +15 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -0
- package/dist/src/gateway/service.js +33 -7
- package/dist/src/gateway/side-chat/context-snapshot.d.ts +11 -0
- package/dist/src/gateway/side-chat/context-snapshot.js +108 -0
- package/dist/src/gateway/side-chat/index.d.ts +5 -0
- package/dist/src/gateway/side-chat/index.js +4 -0
- package/dist/src/gateway/side-chat/manager.d.ts +45 -0
- package/dist/src/gateway/side-chat/manager.js +198 -0
- package/dist/src/gateway/side-chat/run-service.d.ts +22 -0
- package/dist/src/gateway/side-chat/run-service.js +110 -0
- package/dist/src/gateway/side-chat/types.d.ts +61 -0
- package/dist/src/gateway/side-chat/types.js +1 -0
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/routing/session-key-utils.d.ts +0 -1
- package/dist/src/routing/session-key-utils.js +1 -6
- package/dist/src/routing/session-key.js +2 -2
- package/dist/src/tasks/home-query-service.d.ts +24 -0
- package/dist/src/tasks/home-query-service.js +284 -5
- package/dist/src/tasks/index.js +3 -3
- package/dist/src/tasks/project-operating-view-service.d.ts +2 -1
- package/dist/src/tasks/project-operating-view-service.js +27 -4
- package/dist/src/user-context/sources/activity-clustering.js +1 -1
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +1 -0
- package/dist/src/user-context/sources/repository.js +4 -1
- package/dist/src/work-discovery/analyzer.js +8 -8
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-COX-ZLtY.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-S52mdBX_.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DGGJQO9B.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C_tkW-L_.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CPu6MIHF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-ttuWLoiJ.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DrWWVQjj.js +0 -1
- package/dist/gateway/static/root/assets/connectors-api-CG0UqhPN.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CyfIrY2l.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-Wa5zFvbb.js +0 -1
- package/dist/gateway/static/root/assets/home-page-k21J7B1q.js +0 -3
- package/dist/gateway/static/root/assets/index-DtEVsSU1.css +0 -1
- package/dist/gateway/static/root/assets/index-peR_-O6U.js +0 -150
- package/dist/gateway/static/root/assets/local-app-workbench-page-r8wlEj3A.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-OU3uRCoz.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-B74ylIVP.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-3ugVthse.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-VVAyOeRA.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C6XqOPzA.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BMj-t4hX.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B7WvJXGJ.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B0F1jbhj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Dnpq03tO.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bs5oS-wN.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CRY8IE-7.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-Dtqgvs_0.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BBjCNaXn.js +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages-DQ5X6cXp.js";import{l,n as u,r as d,s as f}from"./locale-store-Bjvw7jtg.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{At as m,Bo as h,Bs as g,Cs as _,Es as v,Fo as y,Gc as b,Io as x,Mn as S,Na as C,Po as w,Ri as T,Ro as E,Ss as D,Tl as O,Ul as k,Xo as A,Yl as j,Zo as M,_r as N,bo as P,ci as F,di as I,fi as L,fu as R,ii as ee,jl as te,li as z,mc as ne,mi as re,oi as ie,pi as B,si as ae,ui as V,wr as oe,xc as se,yo as H,zo as ce}from"./index-peR_-O6U.js";import{n as U,r as W,t as G}from"./settings-page-layout-D9X3eVDo.js";import{t as K}from"./settings-loading-skeleton-BabbixC0.js";import{t as q}from"./settings-form-section-CYL5uBzc.js";import{t as le}from"./page-tabs-Dyj6Snbu.js";var J=e(t(),1),ue=n(),Y={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function de(){return structuredClone(Y)}var fe=36e5,X=864e5,Z=1048576;function pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function me(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function he(e){let t=pe(e)?e:{},n=pe(t.gateway)?t.gateway:{},r=pe(n.share)?n.share:{},i=pe(r.directory)?r.directory:{},a=pe(n.siteShare)?n.siteShare:{},o=pe(a.static)?a.static:{},s=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):Y.defaultTtlHours*fe,c=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):Y.maxTtlDays*X,l=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):Y.maxFileSizeMb*Z,u=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):Y.directoryMaxFolderSizeMb*Z,d=typeof a.defaultTtlMs==`number`&&Number.isFinite(a.defaultTtlMs)?Math.floor(a.defaultTtlMs):Y.siteDefaultTtlHours*fe,f=typeof a.maxTtlMs==`number`&&Number.isFinite(a.maxTtlMs)?Math.floor(a.maxTtlMs):Y.siteMaxTtlDays*X,p=typeof o.maxRootDirSize==`number`&&Number.isFinite(o.maxRootDirSize)?Math.floor(o.maxRootDirSize):Y.siteMaxRootDirSizeMb*Z;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(s/fe)),maxTtlDays:Math.max(1,Math.round(c/X)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):Y.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(l/Z)),directoryMaxFolderSizeMb:Math.max(1,Math.round(u/Z)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):Y.directoryMaxFileCount,inlinePreviewMimes:me(r.inlinePreviewMimes,32).length?me(r.inlinePreviewMimes,32):[...Y.inlinePreviewMimes],siteEnabled:a.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(d/fe)),siteMaxTtlDays:Math.max(1,Math.round(f/X)),maxActiveSites:typeof a.maxActiveSites==`number`&&Number.isFinite(a.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(a.maxActiveSites))):Y.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(p/Z)),siteMaxFileCount:typeof o.maxFileCount==`number`&&Number.isFinite(o.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(o.maxFileCount))):Y.siteMaxFileCount}}function ge(e){let t=e.defaultTtlHours*fe,n=e.maxTtlDays*X,r=e.siteDefaultTtlHours*fe,i=e.siteMaxTtlDays*X;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function _e(e){let t=ge(e);if(t)throw Error(t);await f(d(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*fe,maxTtlMs:e.maxTtlDays*X,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Z,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Z,maxFileCount:e.directoryMaxFileCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*fe,maxTtlMs:e.siteMaxTtlDays*X,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Z,maxFileCount:e.siteMaxFileCount}}}})}),H()}var Q=r();function ve(){return o(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,D,`dark:border-edge`)}function ye({hasToken:e}){let t=c(u(e=>e.language)).sharesSettings,{data:n,isLoading:r}=P(e),i=(0,J.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(he(n.payload.config)),[n]),a=(0,J.useRef)(!1),[o,s]=(0,J.useState)(null),[l,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=o??i,v=i,y=(0,J.useMemo)(()=>!g||!v?!1:JSON.stringify(g)!==JSON.stringify(v),[g,v]),b=(0,J.useCallback)(e=>{a.current=!0,s(t=>{let n=t??v;return n?{...n,...e}:null})},[v]),x=(0,J.useCallback)(async()=>{if(!(!g||l)){d(!0),p(null),h(!1);try{await _e(g),a.current=!1,s(null),h(!0),window.setTimeout(()=>h(!1),2500)}catch(e){p(e instanceof Error?e.message:t.policySaveError)}finally{d(!1)}}},[g,l,t.policySaveError]),S=(0,J.useCallback)(()=>{a.current=!1,s(null),p(null),h(!1)},[]);return!e||!g?r?(0,Q.jsx)(q,{children:(0,Q.jsx)(K,{rows:2})}):null:(0,Q.jsxs)(q,{children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[m?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Q.jsx)(_,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>b(de()),children:t.policyUseRecommended}),(0,Q.jsx)(_,{type:`button`,variant:`secondary`,disabled:!y||l,onClick:S,children:t.policyDiscard}),(0,Q.jsx)(_,{type:`button`,variant:`primary`,disabled:!y||l,onClick:()=>void x(),children:l?t.policySaving:t.policySave})]})]}),y?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,f?(0,Q.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Q.jsx)(be,{t,form:g,onChange:b})]})}function be(e){let t=(0,ue.c)(150),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Q.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Q.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Q.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Q.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let T;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(T=(0,Q.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=T):T=t[54];let E=!r.enabled,D;t[55]===i?D=t[56]:(D=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=D);let O;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==E||t[61]!==D?(O=(0,Q.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:E,onChange:D}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=E,t[61]=D,t[62]=O):O=t[62];let k;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==T||t[67]!==O||t[68]!==p?(k=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,T,O]}),t[63]=g,t[64]=y,t[65]=S,t[66]=T,t[67]=O,t[68]=p,t[69]=k):k=t[69];let A=!r.enabled,j;t[70]===i?j=t[71]:(j=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=j);let M;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==A||t[75]!==j?(M=(0,Q.jsx)(xe,{t:n,values:r.inlinePreviewMimes,disabled:A,onChange:j}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=A,t[75]=j,t[76]=M):M=t[76];let N;t[77]!==k||t[78]!==M||t[79]!==s||t[80]!==u?(N=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,k,M]}),t[77]=k,t[78]=M,t[79]=s,t[80]=u,t[81]=N):N=t[81];let P;t[82]===n.policySiteSection?P=t[83]:(P=(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[82]=n.policySiteSection,t[83]=P);let F;t[84]===n.policySiteSectionHint?F=t[85]:(F=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[84]=n.policySiteSectionHint,t[85]=F);let I;t[86]!==P||t[87]!==F?(I=(0,Q.jsxs)(`div`,{className:`mb-4`,children:[P,F]}),t[86]=P,t[87]=F,t[88]=I):I=t[88];let L;t[89]===i?L=t[90]:(L=e=>i({siteEnabled:e.target.checked}),t[89]=i,t[90]=L);let R;t[91]!==r.siteEnabled||t[92]!==L?(R=(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:L}),t[91]=r.siteEnabled,t[92]=L,t[93]=R):R=t[93];let ee;t[94]!==n.policySiteEnabled||t[95]!==R?(ee=(0,Q.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[R,n.policySiteEnabled]}),t[94]=n.policySiteEnabled,t[95]=R,t[96]=ee):ee=t[96];let te=!r.siteEnabled,z;t[97]===i?z=t[98]:(z=e=>i({siteDefaultTtlHours:e}),t[97]=i,t[98]=z);let ne;t[99]!==r.siteDefaultTtlHours||t[100]!==n.policySiteDefaultTtlHint||t[101]!==n.policySiteDefaultTtlHours||t[102]!==te||t[103]!==z?(ne=(0,Q.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:te,onChange:z}),t[99]=r.siteDefaultTtlHours,t[100]=n.policySiteDefaultTtlHint,t[101]=n.policySiteDefaultTtlHours,t[102]=te,t[103]=z,t[104]=ne):ne=t[104];let re=!r.siteEnabled,ie;t[105]===i?ie=t[106]:(ie=e=>i({siteMaxTtlDays:e}),t[105]=i,t[106]=ie);let B;t[107]!==r.siteMaxTtlDays||t[108]!==n.policySiteMaxTtlDays||t[109]!==n.policySiteMaxTtlHint||t[110]!==re||t[111]!==ie?(B=(0,Q.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:re,onChange:ie}),t[107]=r.siteMaxTtlDays,t[108]=n.policySiteMaxTtlDays,t[109]=n.policySiteMaxTtlHint,t[110]=re,t[111]=ie,t[112]=B):B=t[112];let ae=!r.siteEnabled,V;t[113]===i?V=t[114]:(V=e=>i({maxActiveSites:e}),t[113]=i,t[114]=V);let oe;t[115]!==r.maxActiveSites||t[116]!==n.policyMaxActiveSites||t[117]!==n.policyMaxActiveSitesHint||t[118]!==ae||t[119]!==V?(oe=(0,Q.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:ae,onChange:V}),t[115]=r.maxActiveSites,t[116]=n.policyMaxActiveSites,t[117]=n.policyMaxActiveSitesHint,t[118]=ae,t[119]=V,t[120]=oe):oe=t[120];let se=!r.siteEnabled,H;t[121]===i?H=t[122]:(H=e=>i({siteMaxRootDirSizeMb:e}),t[121]=i,t[122]=H);let ce;t[123]!==r.siteMaxRootDirSizeMb||t[124]!==n.policySiteMaxRootDirSizeHint||t[125]!==n.policySiteMaxRootDirSizeMb||t[126]!==se||t[127]!==H?(ce=(0,Q.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:se,onChange:H}),t[123]=r.siteMaxRootDirSizeMb,t[124]=n.policySiteMaxRootDirSizeHint,t[125]=n.policySiteMaxRootDirSizeMb,t[126]=se,t[127]=H,t[128]=ce):ce=t[128];let U=!r.siteEnabled,W;t[129]===i?W=t[130]:(W=e=>i({siteMaxFileCount:e}),t[129]=i,t[130]=W);let G;t[131]!==r.siteMaxFileCount||t[132]!==n.policySiteMaxFileCount||t[133]!==n.policySiteMaxFileCountHint||t[134]!==U||t[135]!==W?(G=(0,Q.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:U,onChange:W}),t[131]=r.siteMaxFileCount,t[132]=n.policySiteMaxFileCount,t[133]=n.policySiteMaxFileCountHint,t[134]=U,t[135]=W,t[136]=G):G=t[136];let K;t[137]!==ne||t[138]!==B||t[139]!==oe||t[140]!==ce||t[141]!==G?(K=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ne,B,oe,ce,G]}),t[137]=ne,t[138]=B,t[139]=oe,t[140]=ce,t[141]=G,t[142]=K):K=t[142];let q;t[143]!==I||t[144]!==ee||t[145]!==K?(q=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[I,ee,K]}),t[143]=I,t[144]=ee,t[145]=K,t[146]=q):q=t[146];let le;return t[147]!==N||t[148]!==q?(le=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[N,q]}),t[147]=N,t[148]=q,t[149]=le):le=t[149],le}function $(e){let t=(0,ue.c)(21),{id:n,label:r,hint:i,value:a,min:s,max:c,disabled:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,Q.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=o(ve(),`max-w-xs font-mono text-xs`),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==u?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&u(Math.max(s,Math.min(c,Math.floor(t))))},t[4]=c,t[5]=s,t[6]=u,t[7]=p):p=t[7];let m;t[8]!==l||t[9]!==n||t[10]!==c||t[11]!==s||t[12]!==p||t[13]!==a?(m=(0,Q.jsx)(`input`,{id:n,type:`number`,min:s,max:c,disabled:l,className:f,value:a,onChange:p}),t[8]=l,t[9]=n,t[10]=c,t[11]=s,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,Q.jsxs)(`div`,{children:[d,m,h]}),t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function xe(e){let t=(0,ue.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,s;t[0]!==a||t[1]!==r?(s=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]===n.policyInlinePreviewMimes?l=t[4]:(l=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=l);let u;t[5]===n.policyInlinePreviewMimesHint?u=t[6]:(u=(0,Q.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=u);let d;t[7]!==i||t[8]!==a||t[9]!==r?(d=r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Q.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d}),t[11]=d,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=o(ve(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===c?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),c(e.target.value),e.target.value=``)},t[14]=c,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Q.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==l||t[21]!==u||t[22]!==f||t[23]!==g?(_=(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[l,u,f,g]}),t[20]=l,t[21]=u,t[22]=f,t[23]=g,t[24]=_):_=t[24],_}function Se(e){let t=(0,ue.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:s,sessionKey:d,agentId:f}=e,m=s===void 0?`any`:s,g=c(u(Te)),S=g.workspace,C=g.sharesSettings,D=ee(we),{data:k}=p(l(Ce)?`picker-agents-list`:null,oe),j;bb0:{let e;t[0]===f?e=t[1]:(e=f?.trim(),t[0]=f,t[1]=e);let n=e;if(n){j=n;break bb0}let r;t[2]===D?r=t[3]:(r=D.trim(),t[2]=D,t[3]=r);let i=r;if(i){j=i;break bb0}if(k?.defaultId){j=k.defaultId;break bb0}if(k?.agents?.[0]?.id){j=k.agents[0].id;break bb0}j=``}let P=j,[F,I]=(0,J.useState)(P),L,R;t[4]===P?(L=t[5],R=t[6]):(L=()=>{I(P)},R=[P],t[4]=P,t[5]=L,t[6]=R),(0,J.useEffect)(L,R);let{tree:te,loading:z,error:re,loadRoot:B,loadChildren:ae,reset:V}=ie(F,d??null),se;t[7]===a?se=t[8]:(se=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=se);let[H,U]=(0,J.useState)(se),W;t[9]!==a||t[10]!==B||t[11]!==n||t[12]!==V||t[13]!==U?(W=()=>{if(!n){V(),U(a?{path:a,isDirectory:!1}:null);return}B()},t[9]=a,t[10]=B,t[11]=n,t[12]=V,t[13]=U,t[14]=W):W=t[14];let G;t[15]!==a||t[16]!==B||t[17]!==n||t[18]!==F||t[19]!==V||t[20]!==d?(G=[n,F,d,B,V,a],t[15]=a,t[16]=B,t[17]=n,t[18]=F,t[19]=V,t[20]=d,t[21]=G):G=t[21],(0,J.useEffect)(W,G);let K;t[22]===ae?K=t[23]:(K=e=>{ae(e)},t[22]=ae,t[23]=K);let q=K,le=H!==null&&(m===`any`||m===`file`&&!H.isDirectory||m===`directory`&&H.isDirectory),Y;bb1:{if(!H){Y=C.pickerHintNone;break bb1}if(m===`file`&&H.isDirectory){Y=C.pickerHintNeedsFile;break bb1}if(m===`directory`&&!H.isDirectory){Y=C.pickerHintNeedsDirectory;break bb1}Y=`${H.isDirectory?`📁`:`📄`} ${H.path}`}let de=Y,fe=k?.agents??[],X;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(E,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=X):X=t[24];let Z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Z=o(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=Z):Z=t[25];let pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Q.jsx)(O,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=pe):pe=t[26];let me=g.cron.refresh,he=g.cron.refresh,ge;t[27]===B?ge=t[28]:(ge=()=>void B(),t[27]=B,t[28]=ge);let _e=z&&`animate-spin`,ve;t[29]===_e?ve=t[30]:(ve=o(`size-4`,_e),t[29]=_e,t[30]=ve);let ye;t[31]===ve?ye=t[32]:(ye=(0,Q.jsx)(ne,{className:ve,"aria-hidden":!0}),t[31]=ve,t[32]=ye);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Q.jsx)(v,{className:`size-4`}),t[33]=be):be=t[33];let $;t[34]!==re||t[35]!==S.loadError?($=re?(0,Q.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[S.loadError,`: `,re]}):null,t[34]=re,t[35]=S.loadError,t[36]=$):$=t[36];let xe;t[37]!==q||t[38]!==z||t[39]!==H?.path||t[40]!==U||t[41]!==S.emptyDir||t[42]!==S.title||t[43]!==te?(xe=z&&te.length===0?(0,Q.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(b,{className:`size-4 animate-spin`}),S.title,`…`]}):(0,Q.jsx)(T,{tree:te,selectedPath:H?.path??null,onSelectFile:e=>U({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>U({path:e,isDirectory:t}),onExpandDir:q,onAction:void 0,emptyHint:S.emptyDir}),t[37]=q,t[38]=z,t[39]=H?.path,t[40]=U,t[41]=S.emptyDir,t[42]=S.title,t[43]=te,t[44]=xe):xe=t[44];let Se;t[45]!==$||t[46]!==xe?(Se=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[$,xe]}),t[45]=$,t[46]=xe,t[47]=Se):Se=t[47];let Ee;t[48]===de?Ee=t[49]:(Ee=(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:de}),t[48]=de,t[49]=Ee);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==C.cancel||t[53]!==De?(Oe=(0,Q.jsx)(_,{type:`button`,variant:`ghost`,onClick:De,children:C.cancel}),t[52]=C.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!le,Ae;t[55]!==i||t[56]!==r||t[57]!==F||t[58]!==H?(Ae=()=>{H&&(i({...H,agentId:F}),r(!1))},t[55]=i,t[56]=r,t[57]=F,t[58]=H,t[59]=Ae):Ae=t[59];let je;t[60]!==C.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Q.jsx)(_,{type:`button`,disabled:ke,onClick:Ae,children:C.pickerConfirm}),t[60]=C.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ee||t[68]!==Me?(Ne=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ee,Me]}),t[67]=Ee,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Q.jsx)(w,{open:n,onOpenChange:r,children:(0,Q.jsxs)(ce,{children:[X,(0,Q.jsxs)(x,{className:Z,children:[(0,Q.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[pe,(0,Q.jsx)(h,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:C.pickerTitle}),(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:me,"aria-label":he,disabled:z,onClick:ge,children:ye}),(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":S.close,children:be})})]}),fe.length>0?(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Q.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:C.pickerAgentLabel}),(0,Q.jsx)(A,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:F,onChange:e=>{I(e.target.value),U(null)},children:fe.map(e=>(0,Q.jsxs)(M,{value:e.id,children:[N(e,g.agentsSettings),e.id===k?.defaultId?` ★`:``]},e.id))})]}):null,Se,Ne]})]})})}function Ce(e){return e.token}function we(e){return e.agentId}function Te(e){return e.language}var Ee=[`shares`,`policy`];function De(e){let t=(e??``).trim();return Ee.includes(t)?t:`shares`}function Oe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function ke(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var Ae=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function je(){let e=(0,ue.c)(24),t=u(Ne),n=c(t).sharesSettings,r=!!l(Me),[a,o]=i(),s;e[0]===a?s=e[1]:(s=De(a.get(`tab`)),e[0]=a,e[1]=s);let d=s,f;e[2]===o?f=e[3]:(f=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=f);let p=f;if(!r)return(0,Q.jsx)(W,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let m={shares:n.tabShares,policy:n.tabPolicy},h=Ee.map(e=>({id:e,label:m[e]})),g;e[4]!==n.subtitle||e[5]!==n.title?(g=(0,Q.jsx)(U,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=g):g=e[6];let _;e[7]!==d||e[8]!==p||e[9]!==n.tabsAria||e[10]!==h?(_=(0,Q.jsx)(le,{items:h,activeTab:d,onChange:p,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=d,e[8]=p,e[9]=n.tabsAria,e[10]=h,e[11]=_):_=e[11];let v;e[12]!==d||e[13]!==r||e[14]!==t||e[15]!==n?(v=d===`shares`?(0,Q.jsx)(Pe,{t:n,language:t}):(0,Q.jsx)(ye,{hasToken:r}),e[12]=d,e[13]=r,e[14]=t,e[15]=n,e[16]=v):v=e[16];let y;e[17]!==d||e[18]!==v?(y=(0,Q.jsx)(G,{id:d,activeTab:d,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:v}),e[17]=d,e[18]=v,e[19]=y):y=e[19];let b;return e[20]!==g||e[21]!==_||e[22]!==y?(b=(0,Q.jsxs)(W,{children:[g,_,y]}),e[20]=g,e[21]=_,e[22]=y,e[23]=b):b=e[23],b}function Me(e){return e.token}function Ne(e){return e.language}function Pe(e){let t=(0,ue.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:s,isLoading:c,mutate:l}=p(`shares-list`,V,i),u;t[1]===a?.payload?.shares?u=t[2]:(u=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=u);let d=u,[f,m]=(0,J.useState)(!1),h;bb0:{if(f){h=d;break bb0}let e;t[3]===d?e=t[4]:(e=d.filter(ze),t[3]=d,t[4]=e),h=e}let g=h,v;t[5]===d?v=t[6]:(v=d.filter(Re),t[5]=d,t[6]=v);let y=v.length,b;t[7]===d?b=t[8]:(b=d.filter(Le),t[7]=d,t[8]=b);let x=b.length,S;t[9]===l?S=t[10]:(S=()=>void l(),t[9]=l,t[10]=S);let C;t[11]!==n||t[12]!==S?(C=(0,Q.jsx)(Ve,{t:n,onCreated:S}),t[11]=n,t[12]=S,t[13]=C):C=t[13];let w=f?n.allSharesTitle:n.listTitle,T;t[14]===y?T=t[15]:(T=y>0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,y,`)`]}),t[14]=y,t[15]=T);let E;t[16]!==w||t[17]!==T?(E=(0,Q.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[w,T]}),t[16]=w,t[17]=T,t[18]=E):E=t[18];let D;t[19]===l?D=t[20]:(D=()=>void l(),t[19]=l,t[20]=D);let O=c&&`animate-spin`,k;t[21]===O?k=t[22]:(k=o(`size-3.5`,O),t[21]=O,t[22]=k);let A;t[23]===k?A=t[24]:(A=(0,Q.jsx)(ne,{className:k}),t[23]=k,t[24]=A);let j;t[25]!==c||t[26]!==D||t[27]!==A?(j=(0,Q.jsx)(_,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:D,disabled:c,children:A}),t[25]=c,t[26]=D,t[27]=A,t[28]=j):j=t[28];let M;t[29]!==x||t[30]!==f||t[31]!==n.hideExpired||t[32]!==n.showExpired?(M=x>0&&(0,Q.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Ie),children:f?n.hideExpired:n.showExpired}),t[29]=x,t[30]=f,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=M):M=t[33];let N;t[34]!==j||t[35]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,M]}),t[34]=j,t[35]=M,t[36]=N):N=t[36];let P;t[37]!==E||t[38]!==N?(P=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[E,N]}),t[37]=E,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==a||t[41]!==s||t[42]!==g||t[43]!==c||t[44]!==r||t[45]!==l||t[46]!==n?(F=c&&!a?(0,Q.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Fe)}):s?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Q.jsx)(`span`,{children:n.error}),(0,Q.jsx)(_,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void l(),children:n.retry})]}):g.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Q.jsx)(Ue,{share:e,t:n,language:r,onRevoked:()=>void l(),onExtended:()=>void l()},e.id))}),t[40]=a,t[41]=s,t[42]=g,t[43]=c,t[44]=r,t[45]=l,t[46]=n,t[47]=F):F=t[47];let I;t[48]!==x||t[49]!==l||t[50]!==f||t[51]!==n?(I=x>0&&f&&(0,Q.jsx)(We,{t:n,onCleaned:()=>void l()}),t[48]=x,t[49]=l,t[50]=f,t[51]=n,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,Q.jsxs)(q,{children:[P,F,I]}),t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;return t[57]!==L||t[58]!==C?(R=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[C,L]}),t[57]=L,t[58]=C,t[59]=R):R=t[59],R}function Fe(e,t){return(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(C,{className:`h-4 w-2/3`}),(0,Q.jsx)(C,{className:`mt-2 h-3 w-1/2`})]}),(0,Q.jsx)(C,{className:`h-7 w-20 rounded-md`})]})},t)}function Ie(e){return!e}function Le(e){return e.expired||e.revoked}function Re(e){return!e.expired&&!e.revoked}function ze(e){return!e.expired&&!e.revoked}var Be={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function Ve({t:e,onCreated:t}){let[n,r]=(0,J.useReducer)(m,Be),{expanded:i,path:a,isDirectory:s,agentId:c,ttlMs:l,maxViews:u,description:d,directoryMode:f,creating:p,result:h,errorMsg:g,resultDialogOpen:v,pickerOpen:y}=n,x=(0,J.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await F({path:a.trim(),ttlMs:l,maxViews:u,description:d.trim()||void 0,...c?{agentId:c}:{},...s?{kind:`directory`,directoryMode:f}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,s,c,l,u,d,f,t]),S=(0,J.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Q.jsxs)(q,{children:[(0,Q.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{className:o(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,children:s?`📁`:`📄`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Q.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Q.jsxs)(_,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Q.jsx)(te,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),s?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Q.jsxs)(A,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:f,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Q.jsx)(M,{value:`browse`,children:e.directoryModeBrowse}),(0,Q.jsx)(M,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Q.jsx)(A,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:l,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:Ae.map(t=>(0,Q.jsx)(M,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Q.jsxs)(A,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:u??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Q.jsx)(M,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Q.jsx)(M,{value:`1`,children:`1`}),(0,Q.jsx)(M,{value:`5`,children:`5`}),(0,Q.jsx)(M,{value:`10`,children:`10`}),(0,Q.jsx)(M,{value:`50`,children:`50`}),(0,Q.jsx)(M,{value:`100`,children:`100`})]})]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Q.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:d,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Q.jsxs)(_,{type:`button`,disabled:p||!a.trim(),onClick:()=>void x(),children:[p?(0,Q.jsx)(b,{className:`size-4 animate-spin`}):(0,Q.jsx)(se,{className:`size-4`}),p?e.creating:e.createButton]}),(0,Q.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>{S(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),g&&(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:g})]}),(0,Q.jsx)(B,{open:v,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:h}),(0,Q.jsx)(Se,{open:y,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Q.jsxs)(_,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Q.jsx)(se,{className:`size-4`}),e.createTitle]})}var He={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function Ue({share:e,t,language:n,onRevoked:r,onExtended:i}){let[c,l]=(0,J.useReducer)(m,He),{revokeOpen:u,revoking:d,linksOpen:f,urlCopied:p,copyFailed:h,extending:v}=c,y=!e.expired&&!e.revoked,x=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,C=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,w=(0,J.useCallback)(async()=>{l({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await I(e.id),r()}catch{}finally{l({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),T=(0,J.useCallback)(async()=>{if(l({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await s(e.shareUrl)){l({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>l({type:`patch`,patch:{copyFailed:!1}}),2500);return}l({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>l({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),E=(0,J.useCallback)(async()=>{l({type:`patch`,patch:{extending:!0}});try{await z(e.id,864e5),i()}catch{}finally{l({type:`patch`,patch:{extending:!1}})}},[e.id,i]),D=`share-links-${e.id}`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:o(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":f,"aria-controls":D,onClick:()=>l({type:`patch`,patch:{linksOpen:!f}}),children:[(0,Q.jsx)(R,{className:o(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,f?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),(0,Q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:o(`text-xs font-medium`,C),children:x})]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.workspaceRelativePath}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:Oe(e.fileSize)}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(j,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:ke(e.expiresAt,n)]}),(0,Q.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Q.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:y&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void T(),children:p?(0,Q.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,Q.jsx)(k,{className:`size-3.5`})}),(0,Q.jsx)(_,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void E(),disabled:v,title:t.extend,children:v?(0,Q.jsx)(b,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(j,{className:`size-3.5`})}),(0,Q.jsx)(_,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>l({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Q.jsx)(b,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(g,{className:`size-3.5`})})]})})]}),y&&f?(0,Q.jsxs)(`div`,{id:D,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Q.jsx)(re,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),h?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(L,{reachability:e.reachability})})]}):null]}),(0,Q.jsx)(S,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void w(),onCancel:()=>l({type:`patch`,patch:{revokeOpen:!1}})})]})}function We({t:e,onCleaned:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),o=(0,J.useCallback)(async()=>{r(!1),a(!0);try{await ae(),t()}catch{}finally{a(!1)}},[t]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(_,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Q.jsx)(b,{className:`size-3.5 animate-spin`}):(0,Q.jsx)(g,{className:`size-3.5`}),e.cleanExpired]})}),(0,Q.jsx)(S,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{je as SharesSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./locale-store-Bjvw7jtg.js";import{Nr as r}from"./index-peR_-O6U.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{l as s,n as c}from"./locale-store-Bjvw7jtg.js";import{$l as l,$r as u,Bo as d,Cc as f,Cs as p,Ct as m,Dc as h,Di as g,Ei as _,El as v,Es as y,Fo as b,Il as x,Io as S,Ll as C,Lo as w,Na as T,On as ee,Ou as te,Po as E,Qr as ne,Ro as D,Tt as re,Ua as O,ei as ie,eu as k,ga as ae,ht as oe,kc as se,kl as ce,pt as le,pu as ue,ri as de,rt as A,su as j,ti as fe,vu as pe,yt as me,zo as M}from"./index-peR_-O6U.js";import{t as he}from"./dependency-picker-eiaYMDYI.js";var N=n(),P=e(t(),1),F=r();function I(e,t){return(t===`zh`?{backlog:`收集箱`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function ge(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,F.jsx)(T,{className:`h-32 rounded-2xl`}),(0,F.jsx)(T,{className:`h-52 rounded-2xl`}),(0,F.jsx)(T,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function L(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function R(e){let t=(0,N.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,F.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,F.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,F.jsx)(t===`passed`?j:t===`failed`?k:l,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,F.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,F.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function z({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=c(e=>e.language),l=s(e=>e.token),d=(0,P.useMemo)(()=>le(i),[i]),y=O(e=>e.setPageHeader),b=O(e=>e.clearPageHeader),[S,w]=(0,P.useState)(null),[T,E]=(0,P.useState)(null),[D,k]=(0,P.useState)(!1),[M,N]=(0,P.useState)([]),[z,B]=(0,P.useState)(null),[V,H]=(0,P.useState)(!1),[U,W]=(0,P.useState)([]),G=(0,P.useMemo)(()=>_(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);(0,P.useEffect)(()=>{let t=!0;return w(null),E(null),me(e).then(e=>{t&&w(e)}).catch(()=>{t&&E(d.taskNotFound)}),()=>{t=!1}},[d.taskNotFound,e,l]),(0,P.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){B(null),N(n);return}B(null);let r=!0;return ae(t).then(t=>{if(!r)return;B(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});N([...i.values()])}).catch(()=>{r&&(B(null),N(n))}),()=>{r=!1}},[S?.dependencies,S?.task.projectId,e]);let K=async t=>{if(S){k(!0),E(null);try{w(await oe(e,t,S.task.version))}catch{E(d.actionFailed)}finally{k(!1)}}},_e=async()=>{if(S){k(!0),E(null);try{w(await re(e,U,S.task.version)),H(!1)}catch{E(d.dependencyUpdateFailed)}finally{k(!1)}}};if((0,P.useLayoutEffect)(()=>{if(t!==`modal`)return y({startExtra:(0,F.jsx)(o,{to:G,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":d.backToWork,children:(0,F.jsx)(te,{className:`size-4`})}),main:S?(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:z?`${z} / ${d.taskLabel}`:d.taskLabel}),(0,F.jsx)(`p`,{className:`text-xs text-fg-muted`,children:d.detailStatuses[L(S)]})]}):null,end:null}),b},[b,d.backToWork,d.detailStatuses,d.taskLabel,S,t,z,G,y]),T&&!S)return(0,F.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:T});if(!S)return(0,F.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,F.jsx)(ge,{})});let q=S.waits[0],J=q?.kind===`paused`?q:void 0,Y=S.receipts[0],ve=d.detailStatuses[L(S)],ye=d.detailStatusDescriptions[L(S)],X=S.task.body?.trim()||S.task.contract?.objective.trim(),be=S.task.delegateAgentId??S.task.ownerId,Z=new Map(Y?.verification.checks.map(e=>[e.criterion,e.status])),xe=S.allowedCommands.includes(`mark_ready`),Se=S.allowedCommands.includes(`start`),Ce=S.allowedCommands.includes(`add_wait`),we=S.task.phase===`review`&&S.allowedCommands.includes(`close`),Te=S.allowedCommands.includes(`reopen`),Ee=S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Q=S.task.contract?.acceptanceCriteria??[],De=Q.filter(e=>Z.get(e)===`passed`).length,$=S.task.contract?.expectedOutputs??[],Oe=S.task.contract?.constraints??[],ke=S.task.contract?.approvalRequired??[],Ae=S.task.contract?.assumptions??[],je=S.task.contract?.risks??[],Me=e=>t===`modal`&&n?ee(n,e):g(`/tasks/${e}`,G);return(0,F.jsxs)(`div`,{className:t===`modal`?`space-y-4 p-5`:`mx-auto max-w-4xl space-y-4 p-4 pb-16 sm:p-6`,children:[(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`inline-flex rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:ve}),(0,F.jsx)(`h1`,{className:`mt-3 text-xl font-semibold leading-7 text-fg`,children:S.task.title}),X&&X!==S.task.title?(0,F.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:X}):null,(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[z?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),z]}):null,(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),d.priorityLabels[S.task.priority]]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(pe,{className:`size-3.5`,"aria-hidden":!0}),be??d.unassigned]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),S.task.dueAt?A(S.task.dueAt,i):d.noDueDate]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[xe?(0,F.jsxs)(p,{disabled:D,onClick:()=>void K({type:`mark_ready`}),children:[(0,F.jsx)(f,{className:`size-4`}),d.scheduleTask]}):null,J?(0,F.jsxs)(p,{disabled:D,onClick:()=>void K({type:`resolve_wait`,waitId:J.id}),children:[(0,F.jsx)(f,{className:`size-4`}),d.resumeTask]}):null,!q&&Se?(0,F.jsxs)(p,{disabled:D,onClick:()=>void K({type:`start`,executor:{kind:`agent`,agentId:S.task.delegateAgentId??`main`}}),children:[(0,F.jsx)(f,{className:`size-4`}),d.runTask]}):null,we?(0,F.jsxs)(p,{disabled:D,onClick:()=>void K({type:`close`,resolution:`done`}),children:[(0,F.jsx)(j,{className:`size-4`}),d.approveTask]}):null,Te?(0,F.jsxs)(p,{disabled:D,onClick:()=>void K({type:`reopen`,phase:`ready`}),children:[(0,F.jsx)(f,{className:`size-4`}),d.reopenTask]}):null,!q&&Ce?(0,F.jsxs)(p,{variant:`secondary`,disabled:D,onClick:()=>void K({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,F.jsx)(se,{className:`size-4`}),d.pauseTask]}):null,S.task.phase===`closed`?null:(0,F.jsxs)(fe,{children:[(0,F.jsx)(de,{asChild:!0,children:(0,F.jsx)(p,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:D,"aria-label":d.moreActions,children:(0,F.jsx)(C,{className:`size-4`,"aria-hidden":!0})})}),(0,F.jsx)(ie,{children:(0,F.jsx)(ne,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-lg`,children:(0,F.jsx)(u,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void K({type:`close`,resolution:`cancelled`}),children:d.cancelTask})})})]})]})]}),T?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:T}):null]}),(0,F.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/40 p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:d.statusSummary}),(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:ye}),(0,F.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:d.updatedAt.replace(`{{date}}`,A(S.task.updatedAt,i))})]}),S.attention.length>0?(0,F.jsxs)(`section`,{className:`rounded-2xl border border-warning/40 bg-warning/5 p-5`,children:[(0,F.jsx)(`h3`,{className:`font-medium text-fg`,children:Ee?d.needsAttention:d.waitingStatus}),(0,F.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:S.attention.map((e,t)=>(0,F.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,Y?(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:d.latestResult}),(0,F.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg`,children:Y.summary})]}),(0,F.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[d.receiptStatuses[Y.status],` · `,d.verificationStatuses[Y.verification.status]]})]}),Y.remainingWork.length>0?(0,F.jsxs)(`div`,{className:`mt-4`,children:[(0,F.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:d.remainingWork}),(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsx)(R,{items:Y.remainingWork,empty:d.noRemainingWork})})]}):null,Y.nextAction?(0,F.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.nextAction}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Y.nextAction})]}):null,(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(p,{className:`px-2 py-1 text-xs`,variant:`secondary`,onClick:()=>void m(Y.runId,`helpful`),children:d.doneWell}),(0,F.jsx)(p,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void m(Y.runId,`not_helpful`),children:d.needsFix}),Y.evidence.filter(e=>e.uri).map(e=>(0,F.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,F.jsx)(x,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),S.receipts.length>1?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:d.executionHistory.replace(`{{count}}`,String(S.receipts.length-1))}),(0,F.jsx)(`div`,{className:`mt-3 space-y-3`,children:S.receipts.slice(1).map(e=>(0,F.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:d.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,(0,F.jsxs)(`div`,{className:`grid items-start gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(16rem,1fr)]`,children:[(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskDefinition}),(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.successDefinition}),Q.length>0?(0,F.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:d.criteriaProgress.replace(`{{verified}}`,String(De)).replace(`{{total}}`,String(Q.length))}):null]}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Q,empty:d.noDefinition,verificationByCriterion:Z})})]}),$.length>0?(0,F.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-5`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:d.expectedOutputs}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:$,empty:d.noDefinition})})]}):null,Oe.length>0?(0,F.jsxs)(`details`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.constraints}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Oe,empty:d.noDefinition})})]}):null,ke.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.approvalRequired}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:ke,empty:d.noDefinition})})]}):null,Ae.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextAssumptions}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:Ae,empty:d.noDefinition})})]}):null,je.length>0?(0,F.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-4`,children:[(0,F.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:d.contextRisks}),(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(R,{items:je,empty:d.noDefinition})})]}):null]}),(0,F.jsxs)(`div`,{className:`grid min-w-0 gap-4`,children:[(0,F.jsxs)(`section`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:d.taskRelations}),V?null:(0,F.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>{W(S.dependencies.map(e=>e.id)),H(!0)},children:[(0,F.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),d.editDependencies]})]}),V?(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3`,children:[(0,F.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:d.dependenciesDescription}),(0,F.jsx)(he,{candidates:M,selectedIds:U,disabled:D,onChange:W,labels:{link:d.linkDependencies,linked:d.linkedDependencies,searchPlaceholder:d.dependencySearchPlaceholder,noMatches:d.noDependencyMatches,noCandidates:d.noDependencyCandidates,remove:d.removeDependency}}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(p,{type:`button`,variant:`ghost`,disabled:D,onClick:()=>H(!1),children:d.cancelDependencyEdit}),(0,F.jsx)(p,{type:`button`,variant:`primary`,disabled:D,onClick:()=>void _e(),children:d.saveDependencies})]})]}):(0,F.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependencies}),S.dependencies.length>0?(0,F.jsx)(`div`,{className:`space-y-2`,children:S.dependencies.map(e=>(0,F.jsxs)(o,{to:Me(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:[(0,F.jsx)(`span`,{className:`break-words`,children:e.title}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:I(e.phase,i)})]},e.id))}):(0,F.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:d.noDependencies})]}),(0,F.jsxs)(`div`,{className:`rounded-lg border border-accent/25 bg-accent-soft/40 p-3`,children:[(0,F.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:d.currentTask}),(0,F.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:S.task.title})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:d.dependents}),S.dependents.length>0?(0,F.jsx)(`div`,{className:`space-y-2`,children:S.dependents.map(e=>(0,F.jsxs)(o,{to:Me(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:[(0,F.jsx)(`span`,{className:`break-words`,children:e.title}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:I(e.phase,i)})]},e.id))}):(0,F.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:d.noDependents})]})]})]}),S.context.length>0?(0,F.jsxs)(`section`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,F.jsx)(`h2`,{className:`font-medium text-fg`,children:d.contextUsed}),(0,F.jsx)(`ul`,{className:`mt-4 space-y-2`,children:S.context.map(e=>(0,F.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,F.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[d.contextRoleLabels[e.role],` · `,d.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,F.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,F.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]})]})]})}function B(){let e=(0,N.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,F.jsx)(z,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function V(e){let t=(0,N.c)(23),{taskId:n,backgroundPath:r,onClose:i}=e,a=c(H),o;t[0]===i?o=t[1]:(o=e=>{e||i()},t[0]=i,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(D,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=s):s=t[2];let l=a===`zh`?`任务详情`:`Task details`,u;t[3]===l?u=t[4]:(u=(0,F.jsx)(d,{className:`font-medium text-fg`,children:l}),t[3]=l,t[4]=u);let f=a===`zh`?`查看并操作任务详情`:`View and manage task details`,p;t[5]===f?p=t[6]:(p=(0,F.jsx)(w,{className:`sr-only`,children:f}),t[5]=f,t[6]=p);let m=a===`zh`?`关闭任务详情`:`Close task details`,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,F.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[7]=h):h=t[7];let g;t[8]===m?g=t[9]:(g=(0,F.jsx)(b,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m,children:h}),t[8]=m,t[9]=g);let _;t[10]!==u||t[11]!==p||t[12]!==g?(_=(0,F.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-5 py-3.5`,children:[u,p,g]}),t[10]=u,t[11]=p,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r||t[15]!==n?(v=(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,F.jsx)(z,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[14]=r,t[15]=n,t[16]=v):v=t[16];let x;t[17]!==_||t[18]!==v?(x=(0,F.jsxs)(M,{children:[s,(0,F.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(52rem,calc(100dvh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float focus:outline-none`,children:[_,v]})]}),t[17]=_,t[18]=v,t[19]=x):x=t[19];let C;return t[20]!==o||t[21]!==x?(C=(0,F.jsx)(E,{open:!0,onOpenChange:o,children:x}),t[20]=o,t[21]=x,t[22]=C):C=t[22],C}function H(e){return e.language}export{V as TaskDetailModal,B as TaskDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{Bs as c,Cs as l,Dc as u,Fc as d,Il as f,Na as p,Ua as m,Xo as h,Zo as g,_o as _,ao as v,co as y,do as b,fo as x,go as S,ho as C,hu as w,ic as T,io as E,lo as D,mo as O,mu as k,oo as A,po as j,ro as M,so as N,tu as P,uo as F,vo as I,xc as L,yl as R}from"./index-peR_-O6U.js";import{n as z,t as B}from"./use-autosave-AAZNoD6t.js";import{t as V}from"./page-tabs-Dyj6Snbu.js";import{a as H}from"./connectors-api-CG0UqhPN.js";var U=n(),W=e(t(),1),G=r(),K=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),q=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ee={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,noSources:`No sources are authorized.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke & remove derived`,refresh:`Refresh`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`关于你`,subtitle:`清楚查看 xopc 知道什么、为什么知道,以及应该如何与你协作。`,profile:`个人资料`,understanding:`对你的理解`,collaboration:`协作约定`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,noSources:`尚未授权任何来源。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销并删除派生理解`,refresh:`立即更新`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},J={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},Y={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function X(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function Z(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function te(e){return JSON.stringify(e)}function ne(e){let t=(0,U.c)(10),[n,r]=(0,W.useState)(e),i;t[0]===e?i=t[1]:(i=te(e),t[0]=e,t[1]=i);let a=(0,W.useRef)(i),o;t[2]===e?o=t[3]:(o=te(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>te(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,W.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function re(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function ie(){let e=(0,U.c)(87),t=o(ce),n=ee[t],[r,a]=i(),c;if(e[0]!==r){let t=r.get(`tab`);c=t&&K.has(t)?t:`profile`,e[0]=r,e[1]=c}else c=e[1];let l=c,u=m(se),f=m(oe),{data:h,error:g,isLoading:_,mutate:v}=s(`/api/you`,D),y;e[2]!==f||e[3]!==u||e[4]!==n.subtitle||e[5]!==n.title?(y=()=>(u({startExtra:null,main:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,G.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),f),e[2]=f,e[3]=u,e[4]=n.subtitle,e[5]=n.title,e[6]=y):y=e[6];let b;if(e[7]!==f||e[8]!==u||e[9]!==n?(b=[f,u,n],e[7]=f,e[8]=u,e[9]=n,e[10]=b):b=e[10],(0,W.useEffect)(y,b),_){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,G.jsx)(p,{className:`h-10 w-96 max-w-full`}),(0,G.jsx)(p,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(g||!h){let t;e[12]===v?t=e[13]:(t=()=>void v(),e[12]=v,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,G.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,G.jsx)(`div`,{className:`p-6`,children:(0,G.jsxs)(Z,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let x=n.title,S;e[20]===a?S=e[21]:(S=e=>a({tab:e}),e[20]=a,e[21]=S);let C;e[22]===n.profile?C=e[23]:(C={id:`profile`,label:n.profile,icon:P},e[22]=n.profile,e[23]=C);let E;e[24]!==h.understandings.length||e[25]!==n.understanding?(E={id:`understanding`,label:n.understanding,icon:w,count:h.understandings.length},e[24]=h.understandings.length,e[25]=n.understanding,e[26]=E):E=e[26];let O=n.collaboration,A;e[27]===h.rules?A=e[28]:(A=h.rules.filter(ae),e[27]=h.rules,e[28]=A);let j;e[29]!==n.collaboration||e[30]!==A.length?(j={id:`collaboration`,label:O,icon:R,count:A.length},e[29]=n.collaboration,e[30]=A.length,e[31]=j):j=e[31];let M;e[32]===n.sources?M=e[33]:(M={id:`sources`,label:n.sources,icon:k},e[32]=n.sources,e[33]=M);let N;e[34]===n.dreaming?N=e[35]:(N={id:`dreaming`,label:n.dreaming,icon:d},e[34]=n.dreaming,e[35]=N);let F;e[36]===n.privacy?F=e[37]:(F={id:`privacy`,label:n.privacy,icon:T},e[36]=n.privacy,e[37]=F);let I;e[38]!==M||e[39]!==N||e[40]!==F||e[41]!==C||e[42]!==E||e[43]!==j?(I=[C,E,j,M,N,F],e[38]=M,e[39]=N,e[40]=F,e[41]=C,e[42]=E,e[43]=j,e[44]=I):I=e[44];let L;e[45]!==n.title||e[46]!==I||e[47]!==S||e[48]!==l?(L=(0,G.jsx)(V,{ariaLabel:x,activeTab:l,onChange:S,items:I}),e[45]=n.title,e[46]=I,e[47]=S,e[48]=l,e[49]=L):L=e[49];let z;e[50]!==h.profile||e[51]!==t||e[52]!==v||e[53]!==n||e[54]!==l?(z=l===`profile`?(0,G.jsx)(Q,{profile:h.profile,language:t,t:n,onChanged:e=>v(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=h.profile,e[51]=t,e[52]=v,e[53]=n,e[54]=l,e[55]=z):z=e[55];let B;e[56]!==h.quality||e[57]!==h.understandings||e[58]!==t||e[59]!==v||e[60]!==n||e[61]!==l?(B=l===`understanding`?(0,G.jsx)(ue,{items:h.understandings,quality:h.quality,language:t,t:n,onChanged:e=>e?v(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):v()}):null,e[56]=h.quality,e[57]=h.understandings,e[58]=t,e[59]=v,e[60]=n,e[61]=l,e[62]=B):B=e[62];let H;e[63]!==h.rules||e[64]!==t||e[65]!==v||e[66]!==n||e[67]!==l?(H=l===`collaboration`?(0,G.jsx)(_e,{rules:h.rules,language:t,t:n,onChanged:()=>v()}):null,e[63]=h.rules,e[64]=t,e[65]=v,e[66]=n,e[67]=l,e[68]=H):H=e[68];let q;e[69]!==n||e[70]!==l?(q=l===`sources`?(0,G.jsx)(be,{t:n}):null,e[69]=n,e[70]=l,e[71]=q):q=e[71];let J;e[72]!==h.consolidation?.lastRun||e[73]!==n||e[74]!==l?(J=l===`dreaming`?(0,G.jsx)(xe,{lastRun:h.consolidation?.lastRun??null,t:n}):null,e[72]=h.consolidation?.lastRun,e[73]=n,e[74]=l,e[75]=J):J=e[75];let Y;e[76]!==n||e[77]!==l?(Y=l===`privacy`?(0,G.jsx)(Ce,{t:n}):null,e[76]=n,e[77]=l,e[78]=Y):Y=e[78];let X;return e[79]!==L||e[80]!==z||e[81]!==B||e[82]!==H||e[83]!==q||e[84]!==J||e[85]!==Y?(X=(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[L,z,B,H,q,J,Y]}),e[79]=L,e[80]=z,e[81]=B,e[82]=H,e[83]=q,e[84]=J,e[85]=Y,e[86]=X):X=e[86],X}function ae(e){return e.status===`active`}function oe(e){return e.clearPageHeader}function se(e){return e.setPageHeader}function ce(e){return e.language}function Q(e){let t=(0,U.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=re(n),t[0]=n,t[1]=o);let s=o,[c,u]=ne(s),d;t[2]===c?d=t[3]:(d=te(c),t[2]=c,t[3]=d);let f;t[4]===s?f=t[5]:(f=te(s),t[4]=s,t[5]=f);let p=d!==f,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await I({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==p||t[11]!==m?(h={value:c,dirty:p,delayMs:500,onSave:m},t[9]=c,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g=B(h),_;t[13]!==c||t[14]!==u?(_=(e,t,n)=>(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,G.jsx)(`input`,{className:q,placeholder:n,value:c[e],onChange:t=>u(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=u,t[15]=_):_=t[15];let v=_,y=g.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,G.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[16]=i.profileHint,t[17]=b);let x;t[18]!==v||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=v(`callName`,i.callName,i.callNamePlaceholder),t[18]=v,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==v||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=v(`role`,i.role,i.rolePlaceholder),t[22]=v,t[23]=i.role,t[24]=i.rolePlaceholder,t[25]=S):S=t[25];let C;t[26]===i.primaryGoal?C=t[27]:(C=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===u?w=t[29]:(w=e=>u(t=>({...t,primaryGoal:e.target.value})),t[28]=u,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(0,G.jsx)(`textarea`,{className:q,rows:3,placeholder:i.primaryGoalPlaceholder,value:c.primaryGoal,onChange:w}),t[30]=c.primaryGoal,t[31]=i.primaryGoalPlaceholder,t[32]=w,t[33]=T):T=t[33];let E;t[34]!==C||t[35]!==T?(E=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,T]}),t[34]=C,t[35]=T,t[36]=E):E=t[36];let D;t[37]!==v||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(D=r===`en`?v(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=v,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=D):D=t[41];let O;t[42]===i.timezone?O=t[43]:(O=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let k;t[44]===u?k=t[45]:(k=e=>u(t=>({...t,timezone:e.target.value})),t[44]=u,t[45]=k);let A;t[46]!==c.timezone||t[47]!==k?(A=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:c.timezone,onChange:k}),t[46]=c.timezone,t[47]=k,t[48]=A):A=t[48];let j;t[49]===u?j=t[50]:(j=()=>u(le),t[49]=u,t[50]=j);let M;t[51]!==i.detect||t[52]!==j?(M=(0,G.jsx)(l,{className:`shrink-0 whitespace-nowrap`,onClick:j,children:i.detect}),t[51]=i.detect,t[52]=j,t[53]=M):M=t[53];let N;t[54]!==A||t[55]!==M?(N=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[A,M]}),t[54]=A,t[55]=M,t[56]=N):N=t[56];let P;t[57]!==O||t[58]!==N?(P=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[O,N]}),t[57]=O,t[58]=N,t[59]=P):P=t[59];let F;t[60]!==v||t[61]!==i.locale?(F=v(`locale`,i.locale),t[60]=v,t[61]=i.locale,t[62]=F):F=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==E||t[66]!==D||t[67]!==P||t[68]!==F?(L=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,E,D,P,F]}),t[63]=x,t[64]=S,t[65]=E,t[66]=D,t[67]=P,t[68]=F,t[69]=L):L=t[69];let R;t[70]!==g.error||t[71]!==g.status?(R=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let V;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(V=(0,G.jsx)(X,{children:(0,G.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=V):V=t[77],V}function le(e){return{...e,timezone:N()}}function ue(e){let t=(0,U.c)(54),{items:n,quality:r,language:i,t:a,onChanged:o}=e,[s,c]=(0,W.useState)(!1),[u,d]=(0,W.useState)(``),[f,p]=(0,W.useState)(`preference`),m;t[0]===n?m=t[1]:(m=n.filter(fe),t[0]=n,t[1]=m);let _=m,v;t[2]===n?v=t[3]:(v=n.filter(de),t[2]=n,t[3]=v);let y=v,b;t[4]!==f||t[5]!==o||t[6]!==u?(b=async e=>{e.preventDefault(),u.trim()&&(await E({statement:u,kind:f}),d(``),c(!1),await o())},t[4]=f,t[5]=o,t[6]=u,t[7]=b):b=t[7];let x=b,S;t[8]===a.understoodHint?S=t[9]:(S=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=S);let C,w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>c(!0),w=(0,G.jsx)(L,{className:`size-4`}),t[10]=C,t[11]=w):(C=t[10],w=t[11]);let T;t[12]===a.addUnderstanding?T=t[13]:(T=(0,G.jsxs)(l,{variant:`primary`,onClick:C,children:[w,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=T);let D;t[14]!==S||t[15]!==T?(D=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[S,T]}),t[14]=S,t[15]=T,t[16]=D):D=t[16];let O;t[17]!==r||t[18]!==a?(O=(0,G.jsx)(pe,{quality:r,t:a}),t[17]=r,t[18]=a,t[19]=O):O=t[19];let k;t[20]===a?k=t[21]:(k=(0,G.jsx)(he,{t:a}),t[20]=a,t[21]=k);let A;t[22]!==s||t[23]!==f||t[24]!==i||t[25]!==u||t[26]!==x||t[27]!==a.add||t[28]!==a.cancel||t[29]!==a.statement?(A=s?(0,G.jsx)(X,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:x,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:a.statement,value:u,onChange:e=>d(e.target.value)}),(0,G.jsx)(h,{value:f,onChange:e=>p(e.target.value),children:Object.entries(J).map(e=>{let[t,n]=e;return(0,G.jsx)(g,{value:t,children:n[i]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(l,{type:`submit`,variant:`primary`,children:a.add}),(0,G.jsx)(l,{onClick:()=>c(!1),children:a.cancel})]})]})}):null,t[22]=s,t[23]=f,t[24]=i,t[25]=u,t[26]=x,t[27]=a.add,t[28]=a.cancel,t[29]=a.statement,t[30]=A):A=t[30];let j;t[31]!==i||t[32]!==o||t[33]!==y||t[34]!==a?(j=y.length?(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,y.length]}),y.map(e=>(0,G.jsx)($,{item:e,language:i,t:a,onChanged:o},e.id))]}):null,t[31]=i,t[32]=o,t[33]=y,t[34]=a,t[35]=j):j=t[35];let M;t[36]!==_.length||t[37]!==a.active?(M=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,_.length]}),t[36]=_.length,t[37]=a.active,t[38]=M):M=t[38];let N;t[39]!==_||t[40]!==i||t[41]!==o||t[42]!==a?(N=_.length?_.map(e=>(0,G.jsx)($,{item:e,language:i,t:a,onChanged:o},e.id)):(0,G.jsx)(Z,{children:a.emptyUnderstanding}),t[39]=_,t[40]=i,t[41]=o,t[42]=a,t[43]=N):N=t[43];let P;t[44]!==M||t[45]!==N?(P=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[M,N]}),t[44]=M,t[45]=N,t[46]=P):P=t[46];let F;return t[47]!==k||t[48]!==A||t[49]!==j||t[50]!==P||t[51]!==D||t[52]!==O?(F=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[D,O,k,A,j,P]}),t[47]=k,t[48]=A,t[49]=j,t[50]=P,t[51]=D,t[52]=O,t[53]=F):F=t[53],F}function de(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function fe(e){return e.status===`active`}function pe(e){let t=(0,U.c)(32),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==m||t[21]!==_||t[22]!==c||t[23]!==d?(v=[c,d,m,_],t[20]=m,t[21]=_,t[22]=c,t[23]=d,t[24]=v):v=t[24];let y=v,b;t[25]===r.qualityTitle?b=t[26]:(b=(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:r.qualityTitle}),t[25]=r.qualityTitle,t[26]=b);let x;t[27]===y?x=t[28]:(x=(0,G.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:y.map(me)}),t[27]=y,t[28]=x);let S;return t[29]!==b||t[30]!==x?(S=(0,G.jsxs)(X,{children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function me(e){let[t,n]=e;return(0,G.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:t}),(0,G.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-fg`,children:n})]},t)}function $(e){let t=(0,U.c)(57),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),[p,m]=ne(n.statement),h=p!==n.statement,g;t[0]===i.required?g=t[1]:(g=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=g);let _;t[2]!==n.id||t[3]!==a?(_=async e=>{await a((await C(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=_):_=t[4];let v;t[5]!==p||t[6]!==o||t[7]!==h||t[8]!==g||t[9]!==_?(v={value:p,dirty:h,enabled:o,delayMs:500,validate:g,onSave:_},t[5]=p,t[6]=o,t[7]=h,t[8]=g,t[9]=_,t[10]=v):v=t[10];let y=B(v),b=J[n.kind][r],x;t[11]===b?x=t[12]:(x=(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:b}),t[11]=b,t[12]=x);let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,w;t[13]===S?w=t[14]:(w=(0,G.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:S}),t[13]=S,t[14]=w);let T;t[15]!==x||t[16]!==w?(T=(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[x,w]}),t[15]=x,t[16]=w,t[17]=T):T=t[17];let E;t[18]!==p||t[19]!==o||t[20]!==m?(E=o?(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,value:p,onChange:e=>m(e.target.value),rows:3}):(0,G.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:p}),t[18]=p,t[19]=o,t[20]=m,t[21]=E):E=t[21];let D;t[22]!==E||t[23]!==T?(D=(0,G.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[T,E]})}),t[22]=E,t[23]=T,t[24]=D):D=t[24];let O;t[25]!==y||t[26]!==o||t[27]!==i.done||t[28]!==i.edit?(O=o?(0,G.jsx)(l,{variant:`ghost`,onClick:()=>{y.flush(),s(!1)},children:i.done}):(0,G.jsxs)(l,{variant:`ghost`,onClick:()=>s(!0),children:[(0,G.jsx)(u,{className:`size-3.5`}),i.edit]}),t[25]=y,t[26]=o,t[27]=i.done,t[28]=i.edit,t[29]=O):O=t[29];let k;t[30]!==n.id||t[31]!==n.status||t[32]!==a||t[33]!==i.confirm||t[34]!==i.reject?(k=n.status===`active`?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(l,{variant:`primary`,onClick:async()=>{await a((await C(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,G.jsx)(l,{onClick:async()=>{await a((await C(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[30]=n.id,t[31]=n.status,t[32]=a,t[33]=i.confirm,t[34]=i.reject,t[35]=k):k=t[35];let j;t[36]!==d||t[37]!==n.id||t[38]!==a?(j=async()=>{if(!d){f(!0);return}await A(n.id),f(!1),await a()},t[36]=d,t[37]=n.id,t[38]=a,t[39]=j):j=t[39];let M;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,G.jsx)(c,{className:`size-3.5`}),t[40]=M):M=t[40];let N=d?i.confirmDelete:i.delete,P;t[41]!==j||t[42]!==N?(P=(0,G.jsxs)(l,{variant:`ghost`,className:`text-danger`,onClick:j,children:[M,N]}),t[41]=j,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==y.error||t[45]!==y.status||t[46]!==o?(F=o||y.status!==`idle`?(0,G.jsx)(z,{className:`ml-auto`,status:y.status,error:y.error}):null,t[44]=y.error,t[45]=y.status,t[46]=o,t[47]=F):F=t[47];let I;t[48]!==O||t[49]!==k||t[50]!==P||t[51]!==F?(I=(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[O,k,P,F]}),t[48]=O,t[49]=k,t[50]=P,t[51]=F,t[52]=I):I=t[52];let L;return t[53]!==y.onBlurCapture||t[54]!==D||t[55]!==I?(L=(0,G.jsx)(X,{children:(0,G.jsxs)(`div`,{onBlurCapture:y.onBlurCapture,children:[D,I]})}),t[53]=y.onBlurCapture,t[54]=D,t[55]=I,t[56]=L):L=t[56],L}function he(e){let t=(0,U.c)(20),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-focuses`,b);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(p,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,G.jsx)(Z,{children:n.error}),t[1]=n.error,t[2]=e),e}let c;if(t[3]!==r||t[4]!==o||t[5]!==n.activate||t[6]!==n.complete||t[7]!==n.focusHint||t[8]!==n.focuses||t[9]!==n.noFocuses||t[10]!==n.pause||t[11]!==n.reject){let e=(r??[]).filter(ge),i;t[13]===n.focuses?i=t[14]:(i=(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.focuses}),t[13]=n.focuses,t[14]=i);let a;t[15]===n.focusHint?a=t[16]:(a=(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[15]=n.focusHint,t[16]=a);let s;t[17]!==i||t[18]!==a?(s=(0,G.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=s):s=t[19],c=(0,G.jsxs)(`section`,{className:`space-y-3`,children:[s,e.length?e.map(e=>(0,G.jsxs)(X,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:e.status})]}),(0,G.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary})]}),(0,G.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:[Math.round(e.confidence*100),`%`]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[e.status===`active`?(0,G.jsx)(l,{onClick:async()=>{await _(e.id,`paused`),await o()},children:n.pause}):(0,G.jsx)(l,{variant:`primary`,onClick:async()=>{await _(e.id,`active`),await o()},children:n.activate}),(0,G.jsx)(l,{variant:`ghost`,onClick:async()=>{await _(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,G.jsx)(l,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await _(e.id,`rejected`),await o()},children:n.reject}):null]})]},e.id)):(0,G.jsx)(Z,{children:n.noFocuses})]}),t[3]=r,t[4]=o,t[5]=n.activate,t[6]=n.complete,t[7]=n.focusHint,t[8]=n.focuses,t[9]=n.noFocuses,t[10]=n.pause,t[11]=n.reject,t[12]=c}else c=t[12];return c}function ge(e){return e.status!==`rejected`}function _e(e){let t=(0,U.c)(36),{rules:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,W.useState)(!1),[u,d]=(0,W.useState)(``),[f,p]=(0,W.useState)(`communication`),[m,_]=(0,W.useState)(null),y;t[0]!==f||t[1]!==a||t[2]!==u?(y=async e=>{e.preventDefault(),u.trim()&&(await M({statement:u,category:f}),d(``),s(!1),await a())},t[0]=f,t[1]=a,t[2]=u,t[3]=y):y=t[3];let b=y,x;t[4]===i.rulesHint?x=t[5]:(x=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[4]=i.rulesHint,t[5]=x);let S,C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>s(!0),C=(0,G.jsx)(L,{className:`size-4`}),t[6]=S,t[7]=C):(S=t[6],C=t[7]);let w;t[8]===i.addRule?w=t[9]:(w=(0,G.jsxs)(l,{variant:`primary`,onClick:S,children:[C,i.addRule]}),t[8]=i.addRule,t[9]=w);let T;t[10]!==x||t[11]!==w?(T=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[x,w]}),t[10]=x,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==o||t[14]!==f||t[15]!==r||t[16]!==u||t[17]!==b||t[18]!==i.add||t[19]!==i.cancel||t[20]!==i.ruleStatement?(E=o?(0,G.jsx)(X,{children:(0,G.jsxs)(`form`,{className:`space-y-3`,onSubmit:b,children:[(0,G.jsx)(`textarea`,{autoFocus:!0,className:q,rows:3,placeholder:i.ruleStatement,value:u,onChange:e=>d(e.target.value)}),(0,G.jsx)(h,{value:f,onChange:e=>p(e.target.value),children:Object.entries(Y).map(e=>{let[t,n]=e;return(0,G.jsx)(g,{value:t,children:n[r]},t)})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(l,{type:`submit`,variant:`primary`,children:i.add}),(0,G.jsx)(l,{onClick:()=>s(!1),children:i.cancel})]})]})}):null,t[13]=o,t[14]=f,t[15]=r,t[16]=u,t[17]=b,t[18]=i.add,t[19]=i.cancel,t[20]=i.ruleStatement,t[21]=E):E=t[21];let D;t[22]!==m||t[23]!==r||t[24]!==a||t[25]!==n||t[26]!==i.confirmDelete||t[27]!==i.delete||t[28]!==i.disable||t[29]!==i.emptyRules||t[30]!==i.enable?(D=n.length?n.filter(ve).map(e=>(0,G.jsxs)(X,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:Y[e.category][r]}),(0,G.jsx)(`p`,{className:`mt-3 text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement})]}),(0,G.jsxs)(`span`,{className:`text-xs tabular-nums text-fg-subtle`,children:[`P`,e.priority]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,G.jsx)(l,{variant:`ghost`,onClick:async()=>{await O(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,G.jsxs)(l,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(m!==e.id){_(e.id);return}await v(e.id),_(null),await a()},children:[(0,G.jsx)(c,{className:`size-3.5`}),m===e.id?i.confirmDelete:i.delete]})]})]},e.id)):(0,G.jsx)(Z,{children:i.emptyRules}),t[22]=m,t[23]=r,t[24]=a,t[25]=n,t[26]=i.confirmDelete,t[27]=i.delete,t[28]=i.disable,t[29]=i.emptyRules,t[30]=i.enable,t[31]=D):D=t[31];let k;return t[32]!==T||t[33]!==E||t[34]!==D?(k=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[T,E,D]}),t[32]=T,t[33]=E,t[34]=D,t[35]=k):k=t[35],k}function ve(e){return e.status!==`archived`}async function ye(){let[e,t]=await Promise.all([y(),H()]);return{grants:e,connectors:t}}function be(e){let t=(0,U.c)(39),{t:n}=e,{data:r,error:i,isLoading:o,mutate:c}=s(`you-understanding-sources`,ye);if(o){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(p,{className:`h-64 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;t[1]===c?e=t[2]:(e=()=>void c(),t[1]=c,t[2]=e);let r;t[3]!==n.retry||t[4]!==e?(r=(0,G.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[3]=n.retry,t[4]=e,t[5]=r):r=t[5];let i;return t[6]!==n.error||t[7]!==r?(i=(0,G.jsxs)(Z,{children:[n.error,` `,r]}),t[6]=n.error,t[7]=r,t[8]=i):i=t[8],i}let u;t[9]===r?.grants?u=t[10]:(u=r?.grants??[],t[9]=r?.grants,t[10]=u);let d=u,m;t[11]===r?.connectors?m=t[12]:(m=r?.connectors??[],t[11]=r?.connectors,t[12]=m);let h=m,g;t[13]===n.sourcesHint?g=t[14]:(g=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.sourcesHint}),t[13]=n.sourcesHint,t[14]=g);let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,G.jsx)(f,{className:`size-4`}),t[15]=_):_=t[15];let v;t[16]===n.manageSources?v=t[17]:(v=(0,G.jsx)(l,{asChild:!0,variant:`primary`,children:(0,G.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[n.manageSources,_]})}),t[16]=n.manageSources,t[17]=v);let y;t[18]!==g||t[19]!==v?(y=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[g,v]}),t[18]=g,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==d||t[22]!==c||t[23]!==n.continuous||t[24]!==n.derivedOnly||t[25]!==n.localOnly||t[26]!==n.noSources||t[27]!==n.once||t[28]!==n.refresh||t[29]!==n.revoke?(b=d.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:d.map(e=>(0,G.jsx)(X,{children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[e.accessMode===`continuous`?n.continuous:n.once,` · `,e.processingPolicy===`local_only`?n.localOnly:e.retentionPolicy===`derived_only`?n.derivedOnly:e.retentionPolicy]}),e.lastCollectedAt?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(e.lastCollectedAt).toLocaleString()}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[e.accessMode===`continuous`?(0,G.jsx)(l,{variant:`ghost`,onClick:async()=>{await x(e.id),await c()},children:n.refresh}):null,(0,G.jsx)(l,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await j(e.id),await c()},children:n.revoke})]})]})},e.id))}):(0,G.jsx)(Z,{children:n.noSources}),t[21]=d,t[22]=c,t[23]=n.continuous,t[24]=n.derivedOnly,t[25]=n.localOnly,t[26]=n.noSources,t[27]=n.once,t[28]=n.refresh,t[29]=n.revoke,t[30]=b):b=t[30];let S;t[31]!==h||t[32]!==n.connected||t[33]!==n.unavailable?(S=h.length?(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:h.map(e=>{let t=e.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`);return(0,G.jsx)(X,{children:(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:e.connectorId})]}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${t?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:t?n.connected:n.unavailable})]})},e.instanceId)})}):null,t[31]=h,t[32]=n.connected,t[33]=n.unavailable,t[34]=S):S=t[34];let C;return t[35]!==y||t[36]!==b||t[37]!==S?(C=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[y,b,S]}),t[35]=y,t[36]=b,t[37]=S,t[38]=C):C=t[38],C}function xe(e){let t=(0,U.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:c}=s(`you-context-settings`,F),u=i?.dreaming??null,[d,f]=ne(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&te(d)!==te(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let _=!!m,v;t[3]===c?v=t[4]:(v=async e=>{await S({dreaming:e}),await c()},t[3]=c,t[4]=v);let y;t[5]!==d||t[6]!==_||t[7]!==v?(y={value:d,dirty:_,delayMs:500,onSave:v},t[5]=d,t[6]=_,t[7]=v,t[8]=y):y=t[8];let b=B(y);if(a){let e;t[9]===c?e=t[10]:(e=()=>void c(),t[9]=c,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,G.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,G.jsxs)(Z,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(o||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(p,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let x=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,C;t[18]===r.dreamingHint?C=t[19]:(C=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=C);let w=b.onBlurCapture,T;t[20]===r.mode?T=t[21]:(T=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=T);let E;t[22]===f?E=t[23]:(E=e=>f(t=>t&&{...t,mode:e.target.value}),t[22]=f,t[23]=E);let D;t[24]===r.on?D=t[25]:(D=(0,G.jsx)(g,{value:`review`,children:r.on}),t[24]=r.on,t[25]=D);let O;t[26]===r.off?O=t[27]:(O=(0,G.jsx)(g,{value:`off`,children:r.off}),t[26]=r.off,t[27]=O);let k;t[28]!==d.mode||t[29]!==O||t[30]!==E||t[31]!==D?(k=(0,G.jsxs)(h,{value:d.mode,onChange:E,children:[D,O]}),t[28]=d.mode,t[29]=O,t[30]=E,t[31]=D,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==T?(A=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[T,k]}),t[33]=k,t[34]=T,t[35]=A):A=t[35];let j;t[36]===r.reviewTime?j=t[37]:(j=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=j);let M;t[38]===f?M=t[39]:(M=e=>f(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=f,t[39]=M);let P;t[40]!==d.schedule.time||t[41]!==M?(P=(0,G.jsx)(`input`,{type:`time`,className:q,value:d.schedule.time,onChange:M}),t[40]=d.schedule.time,t[41]=M,t[42]=P):P=t[42];let I;t[43]!==j||t[44]!==P?(I=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[j,P]}),t[43]=j,t[44]=P,t[45]=I):I=t[45];let L;t[46]===r.timezone?L=t[47]:(L=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=L);let R=d.timezone??``,V;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(V=N(),t[48]=V):V=t[48];let H;t[49]===f?H=t[50]:(H=e=>f(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=f,t[50]=H);let W;t[51]!==R||t[52]!==H?(W=(0,G.jsx)(`input`,{className:`${q} min-w-0 flex-1`,value:R,placeholder:V,onChange:H}),t[51]=R,t[52]=H,t[53]=W):W=t[53];let K;t[54]===f?K=t[55]:(K=()=>f(Se),t[54]=f,t[55]=K);let ee;t[56]!==r.detect||t[57]!==K?(ee=(0,G.jsx)(l,{className:`shrink-0 whitespace-nowrap`,onClick:K,children:r.detect}),t[56]=r.detect,t[57]=K,t[58]=ee):ee=t[58];let J;t[59]!==W||t[60]!==ee?(J=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[W,ee]}),t[59]=W,t[60]=ee,t[61]=J):J=t[61];let Y;t[62]!==L||t[63]!==J?(Y=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[L,J]}),t[62]=L,t[63]=J,t[64]=Y):Y=t[64];let re;t[65]===r.evidenceThreshold?re=t[66]:(re=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=re);let ie;t[67]===f?ie=t[68]:(ie=e=>f(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=f,t[68]=ie);let ae;t[69]!==d.minEvidenceSources||t[70]!==ie?(ae=(0,G.jsx)(`input`,{type:`number`,min:2,max:10,className:q,value:d.minEvidenceSources,onChange:ie}),t[69]=d.minEvidenceSources,t[70]=ie,t[71]=ae):ae=t[71];let oe;t[72]!==re||t[73]!==ae?(oe=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[re,ae]}),t[72]=re,t[73]=ae,t[74]=oe):oe=t[74];let se;t[75]===r.scanLimit?se=t[76]:(se=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=se);let ce;t[77]===f?ce=t[78]:(ce=e=>f(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=f,t[78]=ce);let Q;t[79]!==d.limit||t[80]!==ce?(Q=(0,G.jsx)(`input`,{type:`number`,min:1,max:2e3,className:q,value:d.limit,onChange:ce}),t[79]=d.limit,t[80]=ce,t[81]=Q):Q=t[81];let le;t[82]!==se||t[83]!==Q?(le=(0,G.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[se,Q]}),t[82]=se,t[83]=Q,t[84]=le):le=t[84];let ue;t[85]!==A||t[86]!==I||t[87]!==Y||t[88]!==oe||t[89]!==le?(ue=(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[A,I,Y,oe,le]}),t[85]=A,t[86]=I,t[87]=Y,t[88]=oe,t[89]=le,t[90]=ue):ue=t[90];let de;t[91]!==b.error||t[92]!==b.status?(de=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:b.status,error:b.error})}),t[91]=b.error,t[92]=b.status,t[93]=de):de=t[93];let fe;t[94]!==b.onBlurCapture||t[95]!==ue||t[96]!==de?(fe=(0,G.jsx)(X,{children:(0,G.jsxs)(`div`,{onBlurCapture:w,children:[ue,de]})}),t[94]=b.onBlurCapture,t[95]=ue,t[96]=de,t[97]=fe):fe=t[97];let pe;t[98]===r.lastRun?pe=t[99]:(pe=(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=pe);let me;t[100]!==n||t[101]!==x||t[102]!==r.neverRun||t[103]!==r.runItems?(me=n?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,G.jsx)(`span`,{children:x}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=x,t[102]=r.neverRun,t[103]=r.runItems,t[104]=me):me=t[104];let $;t[105]!==pe||t[106]!==me?($=(0,G.jsxs)(X,{children:[pe,me]}),t[105]=pe,t[106]=me,t[107]=$):$=t[107];let he;return t[108]!==fe||t[109]!==$||t[110]!==C?(he=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[C,fe,$]}),t[108]=fe,t[109]=$,t[110]=C,t[111]=he):he=t[111],he}function Se(e){return e&&{...e,timezone:N()}}function Ce(e){let t=(0,U.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=s(`you-context-settings`,F),c=r?.privacy.sensitiveWritePolicy??null,[l,u]=ne(c),d=!!(l&&c&&l!==c),f;t[0]===o?f=t[1]:(f=async e=>{await S({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=f);let m;t[2]!==l||t[3]!==d||t[4]!==f?(m={value:l,dirty:d,delayMs:350,onSave:f},t[2]=l,t[3]=d,t[4]=f,t[5]=m):m=t[5];let _=B(m);if(i){let e;t[6]===o?e=t[7]:(e=()=>void o(),t[6]=o,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,G.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,G.jsxs)(Z,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!l){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(p,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let v;t[15]===n.privacyHint?v=t[16]:(v=(0,G.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=v);let y;t[17]===n.sensitivePolicy?y=t[18]:(y=(0,G.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=y);let b;t[19]===u?b=t[20]:(b=e=>u(e.target.value),t[19]=u,t[20]=b);let x;t[21]===n.policyDeny?x=t[22]:(x=(0,G.jsx)(g,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=x);let C;t[23]===n.policyConfirm?C=t[24]:(C=(0,G.jsx)(g,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=C);let w;t[25]===n.policyAllow?w=t[26]:(w=(0,G.jsx)(g,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=w);let T;t[27]!==l||t[28]!==b||t[29]!==x||t[30]!==C||t[31]!==w?(T=(0,G.jsxs)(h,{value:l,onChange:b,children:[x,C,w]}),t[27]=l,t[28]=b,t[29]=x,t[30]=C,t[31]=w,t[32]=T):T=t[32];let E;t[33]!==T||t[34]!==y?(E=(0,G.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[y,T]}),t[33]=T,t[34]=y,t[35]=E):E=t[35];let D;t[36]===n.privacyWarning?D=t[37]:(D=(0,G.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=D);let O;t[38]!==_.error||t[39]!==_.status?(O=(0,G.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,G.jsx)(z,{status:_.status,error:_.error})}),t[38]=_.error,t[39]=_.status,t[40]=O):O=t[40];let k;t[41]!==_.onBlurCapture||t[42]!==E||t[43]!==D||t[44]!==O?(k=(0,G.jsx)(X,{children:(0,G.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[E,D,O]})}),t[41]=_.onBlurCapture,t[42]=E,t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;return t[46]!==k||t[47]!==v?(A=(0,G.jsxs)(`div`,{className:`space-y-5`,children:[v,k]}),t[46]=k,t[47]=v,t[48]=A):A=t[48],A}export{ie as UserContextPage};
|
|
@@ -1 +0,0 @@
|
|
|
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,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as ee}from"./messages-DQ5X6cXp.js";import{n as te}from"./locale-store-Bjvw7jtg.js";import{$a as ne,Cs as s,Dt as re,Es as c,Ga as ie,Gc as l,Ja as ae,Ka as oe,Na as u,Qa as se,Tl as d,Wa as f,Xa as ce,Xl as le,Ya as p,Za as ue,eo as m,fu as de,ic as h,jl as fe,jt as pe,no as me,qa as he,to as g,uu as ge,ws as _e,xl as ve}from"./index-peR_-O6U.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function ye(){return new Promise(e=>window.setTimeout(e,1200))}async function be(e,t){let n=[],r=t.wait??ye;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var y=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function xe(e){return new Set(e.filter(e=>e.availability===`available`&&y.has(e.id)).map(e=>e.id))}var b=n(),Se=[`folder_structure`,`recent_progress`,`next_steps`];function x(e){return e instanceof Error?e.message:String(e)}function Ce({embedded:e=!1,onRequestClose:t}={}){let n=te(e=>e.language),v=ee(n).onboarding.workDiscovery,ye=ee(n).chat.workingDirectory,y=i(),[Ce]=r(),we=e||Ce.get(`new`)===`1`,[S,C]=(0,_.useState)(`loading`),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[Te,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>new Set),[z,Ee]=(0,_.useState)([]),[B,V]=(0,_.useState)(()=>new Set),[De,H]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[U,W]=(0,_.useState)({current:0,total:0}),[Ae,je]=(0,_.useState)([]),[G,Me]=(0,_.useState)(()=>new Set),K=(0,_.useRef)(!1),Ne=e=>{Me(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,_.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(je(t),Me(xe(t)))}),()=>{e=!0}},[]);let q=(0,_.useCallback)(e=>{f.getState().updateDirectoryRun(e),D(e),e.status===`completed`?(R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},[]),Pe=async()=>{k(!0),j(null);try{let e=await oe();if(!e.length){j(v.noCandidates);return}Ee(e),V(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(x(e))}finally{k(!1)}},Fe=e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ie=(0,_.useCallback)((e,t,n)=>{f.getState().updateDirectoryRun(e),D(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Le=(0,_.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Re=async()=>{let e=z.filter(e=>B.has(e.rootPath));if(!e.length)return;k(!0),j(null),H([]),W({current:1,total:e.length}),ke(!0),K.current=!1;let t=!1;try{let n=await be(e,{grantDirectory:ce,startRun:m,fetchRun:p,shouldStop:()=>K.current,onRun:(e,n,r)=>{Ie(e,n,r),t||(t=!0,f.getState().collectSources(e.id,[...G]))},onError:(t,n,r)=>{W({current:r+1,total:e.length}),j(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,x(t)))}});if(K.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?q(r):C(`candidates`)}catch(e){j(x(e)),C(`candidates`)}finally{ke(!1),k(!1)}},J=pe({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await ue(e)),C(`consent`)}catch(e){j(x(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ae().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():y(`/chat`,{replace:!0});return}if(!we&&r.activeRunId)try{let t=await p(r.activeRunId);e||q(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(x(t)),C(`intro`))}),()=>{e=!0}},[q,y,t,we]),(0,_.useEffect)(()=>{if(!E||S!==`running`||Oe)return;let e=!1,t=async()=>{try{let t=await p(E.id);e||q(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===E.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[q,Oe,S,E]);let ze=async()=>{k(!0);try{await he()}finally{t?t():y(`/chat`,{replace:!0})}},Be=async()=>{if(w){k(!0),j(null),H([]),W({current:0,total:0});try{await ce(w.canonicalRootPath);let e=await m(w.canonicalRootPath);q(e),f.getState().collectSources(e.id,[...G])}catch(e){j(x(e)),C(`consent`)}finally{k(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;y(`/chat/${encodeURIComponent(e)}${n}`)},Ve=e=>{D(e),M(!1),I(!1),R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},He=async()=>{E&&(K.current=!0,q(await ie(E.id)))},X=async(e,t)=>{if(!E)return;await ne(E.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;Y(E.sessionKey,r)},Ue=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await g((e.length>0?await me(E.id,e.map(e=>({id:e.id,status:L.has(e.id)?`accepted`:`rejected`}))):E).id,`confirmed`);D(t),Le(t),C(`recommendation`)}catch(e){j(x(e))}finally{k(!1)}}},Z=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await g(E.id,e,N.trim());D(t),Y(t.sessionKey,N.trim())}catch(e){j(x(e)),k(!1)}}},We=async()=>{if(E){k(!0);try{Y((await g(E.id,`dismissed`)).sessionKey)}catch(e){j(x(e)),k(!1)}}},Q=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],Ge=E?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ke=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,qe=De.filter(e=>e?.status===`completed`),Je=e&&S===`candidates`,$=qe.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:qe.map(e=>{let t=z.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===E?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Ve(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Je?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(_e,{className:`size-11`})}),S===`loading`?(0,b.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,b.jsx)(u,{className:`h-8 w-64 max-w-full`}),(0,b.jsx)(u,{className:`mt-4 h-4 w-full max-w-sm`}),(0,b.jsx)(u,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,b.jsx)(u,{className:`mt-10 h-12 w-full rounded-xl`}),(0,b.jsx)(u,{className:`mt-3 h-11 w-full rounded-xl`}),(0,b.jsx)(u,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,S===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[Ae.length?(0,b.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.localSourcesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.localSourcesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Ae.map(e=>{let t=G.has(e.id);return(0,b.jsxs)(`button`,{type:`button`,className:o(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Ne(e.id),children:[(0,b.jsx)(`span`,{className:o(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,b.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,b.jsxs)(s,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Pe(),disabled:O||J.picking,children:[O?(0,b.jsx)(l,{className:`size-4 animate-spin`}):(0,b.jsx)(h,{className:`size-4`}),v.quickScan]}),(0,b.jsxs)(s,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:J.pick,disabled:O||J.picking,children:[J.picking?(0,b.jsx)(l,{className:`size-4 animate-spin`}):(0,b.jsx)(d,{className:`size-4`}),v.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.quickScanNote})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>y(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),A?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),disabled:O,children:v.skip})]}):null,S===`candidates`?(0,b.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:z.map((e,t)=>{let n=B.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Fe(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(d,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:v.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,b.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),A?(0,b.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:A}):null,(0,b.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(s,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O||B.size===0,onClick:()=>void Re(),children:[O?(0,b.jsx)(l,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(B.size))]}),(0,b.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:J.pick,children:v.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>C(`intro`),children:v.back})]})]}):null,S===`consent`&&w?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(d,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:w.projectKind===`coding`?v.codingProject:w.projectKind===`general`?v.generalProject:v.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?v.branchValue.replace(`{{branch}}`,w.fingerprint.branch):v.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(c,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?v.providerDisclosure.replace(`{{provider}}`,w.provider):v.localDisclosure})]})]})]}),A?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(s,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void Be(),children:[O?(0,b.jsx)(l,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,b.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:J.pick,children:v.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ze(),children:v.skip})]}):null,S===`running`&&E?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),U.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Se.map((e,t)=>{let n=Math.max(0,Se.indexOf(E.stage??`folder_structure`)),r=t<n,i=t===n;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,b.jsx)(a,{className:`size-4`}):i?(0,b.jsx)(l,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>y(`/chat`),children:v.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void He(),children:v.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:E.result.lowConfidence?v.lowConfidenceTitle:v.recognitionTitle})]}),$,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&Q?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(ve,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?v.workThreadCurrent:e.horizon===`ongoing`?v.workThreadOngoing:v.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:L.has(e.id),onChange:()=>R(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(s,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:v.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void Ue(),children:[O?(0,b.jsx)(l,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,b.jsx)(s,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:v.notQuiteRight})]}),Te?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:N,onChange:e=>P(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(s,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:v.differentGoal}),(0,b.jsx)(s,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Z(`corrected`),children:v.useCorrection})]})]}):null]}),A?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,b.jsx)(`button`,{type:`button`,disabled:O,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void We(),children:v.openConversation})]}):null,S===`recommendation`&&E?.result&&Q?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),$,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(ge,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(le,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ke(Q.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedTask})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(s,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:v.startRecommendedAction}),(0,b.jsx)(s,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:v.explainFirst})]})]})]})}),Ge.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>I(e=>!e),children:[v.otherDirections,(0,b.jsx)(de,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Ge.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,b.jsx)(ge,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:v.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{M(!0),C(`recognition`)},children:v.correctUnderstanding})]})]}):null,S===`error`&&E?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(c,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void se(E.id).then(q),children:v.retry}),(0,b.jsx)(s,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:v.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:v.openConversation})]}):null]}),J.hasNativePicker?null:(0,b.jsx)(re,{open:J.modalOpen,onOpenChange:J.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:J.confirmPick,wd:ye})]})}export{Ce as WorkDiscoveryPage};
|