@xopcai/xopc 0.0.196 → 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-B1oxPli_.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-vmuJ_Z6i.js → app-management-settings-panel-S8LhoD6G.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BMlEoe-G.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-BdE4Mati.js → archive-plugin-qL07mwnY.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CTzaQcLV.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-B25zTNxl.js → binary-plugins-DBRPyLYE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cdrf2awF.js → block-editor-6wG1LU7t.js} +46 -46
- package/dist/gateway/static/root/assets/{browser-settings-page-BMTmGMM6.js → browser-settings-page-CrYNMR4w.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BsmHy0ks.js → browser-workflow-inputs-Abil4puY.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Wx9FrbK-.js → browser-workflows-page-BEu3E0et.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CvMcDhGf.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-9T2KXAs1.js → capability-presets-settings-panel-CHJDY-Ih.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-settings-DquD4BPQ.js → channels-settings-Ds9BJbcY.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-BC-4ftOM.js → connectors-api-CgWjgPSI.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-NUs-Zf7F.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BycQlU8Q.js → cron-expression-ZdDBAoqA.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BvYqHRz0.js → dependency-picker-BGeB1jpn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BOb8sEhN.js → desktop-pet-CsLR4pWB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DStgPb82.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-p83TmZFd.js → extension-debug-page-CD73euAM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DMQ3ovxA.js → extension-page-DAKjpNwd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BcSKEU8s.js → extension-settings-page-BLSNdlgd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-C-MmtCc7.js → gateway-config-api-CQrf0k3D.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CuaRDWbg.js → gateway-settings-CvgH8IJI.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Dm8TrfGa.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-BQb06_jl.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-DQtsxjGs.js → local-apps-page-DIWkFa3g.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CDqIY72S.js → logs-page--6v8qq6y.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-D7itDEHl.js → management-settings-DtEuS-kR.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Db-KrpOQ.js → markdown-split-DvVBewS4.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CHN66qs0.js → media-plugins-YVj7NVzD.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CJtKZM0P.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-HXweXqYE.js → page-tabs-7bSEWfSX.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dob6Oe2l.js → preview-open-alternatives-tgLbHgcV.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page--RnCc9bb.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-Bg1W2__k.js → runtime-tools-settings-panel-Fe05Nus6.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BI4rVt3u.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-C7rzhi7x.js → settings-form-section-gEnEYT_3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BS36Mjzz.js → settings-loading-skeleton-BRE_-7Da.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BDSd7F9Y.js → settings-page-C1zxCpqB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CTMmZcwj.js → settings-page-layout-CRpXF_05.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BcHdpmFf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BeCxg6eb.js → share-preview-page-DU8L68A5.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CXL1EldF.js → shares-settings-kjTqH9yY.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-QAGpwzIM.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CyfjEM4D.js → skills-page-lE1-YRdK.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CnbJncdL.js → skills-page.utils-CYwFWTso.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CAv0Yk0Y.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-DomX3Szl.js → typed-models-lib-DelyYgoc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BLc4gfG0.js → use-autosave-C50Mq5yQ.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-C2kQENTK.js → user-context-page-D-VEOt2A.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BijmpPjb.js → voice-api-key-field-DYfgTe3Y.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D7w2JFFq.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-BEmugHfL.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/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/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/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/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-VoFNMGL3.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CsNB6mv_.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-CW1YWgiX.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C5l85__e.js +0 -7
- package/dist/gateway/static/root/assets/connectors-page-7zUxVHQg.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-DUUr9sq0.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BYhDbUvI.js +0 -3
- package/dist/gateway/static/root/assets/index-BzPwnXho.js +0 -150
- package/dist/gateway/static/root/assets/index-CFFYvilx.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CHk4x0kR.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-epHGeKd5.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-BxOD5-zj.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D-9AhrH5.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CSUNXLKM.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BxOUBMca.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DAvTIbgw.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D1v-2Ci-.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BxwkKgVw.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DGTVJs_N.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-XtoPgPUS.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-D_K2xOWq.js +0 -5
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./check-DUBLcKHA.js";import{n as c,r as l}from"./locale-store-Bjvw7jtg.js";import{a as u,i as d}from"./vendor-swr-BIWyz7Rc.js";import{Bo as f,Bs as p,Dl as m,Ds as h,Fo as g,Io as _,Kc as v,Ll as y,Lo as b,Mc as x,Na as S,Nl as C,Ro as ee,Ua as te,Uc as w,Va as ne,Vo as re,Vs as ie,Zl as T,_a as ae,ac as oe,at as E,bc as se,cu as ce,da as le,ec as ue,hc as de,hl as fe,ku as pe,mc as me,tu as he,ws as D,xc as ge,zo as _e}from"./index-BzPwnXho.js";import{a as ve,c as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te}from"./api-BM1hNzjw.js";var O=e(t(),1),Ee=`build-xopc-local-app`;function De(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function Oe(e){return e.find(e=>De(e)===`coder`)??null}function ke(e,t){let n=new URLSearchParams({skill:Ee}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var k=new Set([`document`,`content`,`interaction`,`criteria`]),Ae=new Set([`passed`,`failed`,`skipped`]);function je(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.source!==`xopc-local-app-preview`||t.version!==1)return null;if(t.type===`ready`)return{type:`ready`,detail:{}};if(t.type===`criteria`&&t.detail&&typeof t.detail==`object`){let e=t.detail;if(e.status!==`passed`&&e.status!==`failed`||!Array.isArray(e.scenarios)||e.scenarios.length>10)return null;let n=e.scenarios.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||!t.id.trim()||t.id.length>80||typeof t.name!=`string`||!t.name.trim()||t.name.length>120||t.status!==`passed`&&t.status!==`failed`||typeof t.message!=`string`||!t.message.trim()?null:{id:t.id,name:t.name,status:t.status,message:t.message.slice(0,500),failureKind:`scenario`}});if(n.some(e=>e===null))return null;let r=typeof e.scenarioCount==`number`&&Number.isInteger(e.scenarioCount)&&e.scenarioCount>=0&&e.scenarioCount<=10?e.scenarioCount:n.length;return{type:`criteria`,detail:{status:e.status,scenarioCount:r,scenarios:n}}}if(t.type===`acceptance`&&t.detail&&typeof t.detail==`object`){let e=t.detail;if(e.status!==`passed`&&e.status!==`failed`||!Array.isArray(e.checks))return null;let n=e.checks.slice(0,10).map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return!k.has(t.id)||!Ae.has(t.status)||typeof t.message!=`string`||!t.message.trim()?null:{id:t.id,status:t.status,message:t.message.slice(0,500)}});if(!n.length||n.some(e=>e===null))return null;let r=typeof e.interactiveCount==`number`&&Number.isFinite(e.interactiveCount)&&e.interactiveCount>=0?Math.min(Math.floor(e.interactiveCount),1e4):0;return{type:`acceptance`,detail:{status:e.status,checks:n,interactiveCount:r}}}if(t.type!==`error`||!t.detail||typeof t.detail!=`object`)return null;let n=t.detail;return n.kind!==`script_error`&&n.kind!==`unhandled_rejection`||typeof n.message!=`string`||!n.message.trim()?null:{type:`error`,detail:{kind:n.kind,message:n.message.slice(0,500),filename:typeof n.filename==`string`?n.filename.slice(0,500):void 0,line:typeof n.line==`number`?n.line:void 0,column:typeof n.column==`number`?n.column:void 0}}}function Me(e){return e?.checks.filter(e=>e.status===`failed`).map(e=>e.message)??[]}function Ne(e){let t=e.filename?` (${e.filename}${e.line?`:${e.line}${e.column?`:${e.column}`:``}`:``})`:``;return`${e.message}${t}`}var Pe=Object.freeze({source:`xopc-local-app-host`,version:1,type:`connect`});function Fe(e,t){let n=null,r=()=>{n?.close();let r=new MessageChannel;n=r.port1,n.onmessage=e=>t(e.data),n.start(),e.contentWindow?.postMessage(Pe,`*`,[r.port2])};return e.addEventListener(`load`,r),r(),()=>{e.removeEventListener(`load`,r),n?.close()}}var Ie=n(),A=r();function Le(e){let t=(0,Ie.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let l=a?`产品场景`:`Product scenarios`,u;t[0]===l?u=t[1]:(u=(0,A.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:l}),t[0]=l,t[1]=u);let d=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,f;t[2]===d?f=t[3]:(f=(0,A.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,A.jsxs)(`div`,{children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m=i!==null,h;t[7]===i?h=t[8]:(h=i===`all`?(0,A.jsx)(v,{className:`size-3 animate-spin`}):(0,A.jsx)(de,{className:`size-3`}),t[7]=i,t[8]=h);let g=a?`全部重跑`:`Run all`,_;t[9]!==o||t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:m,children:[h,g]}),t[9]=o,t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let y;t[14]!==p||t[15]!==_?(y=(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[p,_]}),t[14]=p,t[15]=_,t[16]=y):y=t[16];let b=a?`产品场景验收结果`:`Product scenario acceptance results`,x;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,A.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,A.jsx)(v,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,A.jsx)(ce,{className:`size-3.5 text-success`}):n===`failed`?(0,A.jsx)(he,{className:`size-3.5 text-danger`}):(0,A.jsx)(T,{className:`size-3.5 text-fg-subtle`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,A.jsx)(D,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,A.jsx)(de,{className:`size-3`})})]}),n===`running`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,A.jsxs)(`div`,{className:`mt-1.5`,children:[(0,A.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,A.jsx)(w,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],x=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=x}else x=t[23];let S;t[30]!==b||t[31]!==x?(S=(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":b,children:x}),t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;return t[33]!==y||t[34]!==S?(C=(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[y,S]}),t[33]=y,t[34]=S,t[35]=C):C=t[35],C}var Re=`allow-scripts allow-forms`;function ze(e,t){return E(e,t)}function Be(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function j(){let{appId:e}=i(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),T=a(),{mutate:E}=u(),he=ne(e=>e.moveToFront),Ee=te(e=>e.setPageHeader),De=te(e=>e.clearPageHeader),{data:k,isLoading:Ae,error:Pe,mutate:Ie}=d(!t&&e?[`local-app`,e]:null,()=>xe(e)),{data:j,isLoading:Ve,mutate:M}=d(!t&&e?[`local-app-validation`,e]:null,()=>be(e)),[He,Ue]=(0,O.useState)(``),[We,Ge]=(0,O.useState)(``),[N,P]=(0,O.useState)(!1),[Ke,F]=(0,O.useState)(null),[qe,Je]=(0,O.useState)(!1),[Ye,Xe]=(0,O.useState)(!1),[Ze,Qe]=(0,O.useState)(0),[$e,et]=(0,O.useState)(``),[I,tt]=(0,O.useState)(!1),[L,nt]=(0,O.useState)(!1),[R,z]=(0,O.useState)(`booting`),[rt,it]=(0,O.useState)(null),[B,at]=(0,O.useState)(null),[V,ot]=(0,O.useState)({}),[H,st]=(0,O.useState)(`all`),[U,W]=(0,O.useState)(0),[ct,lt]=(0,O.useState)(0),[ut,dt]=(0,O.useState)(null),[G,ft]=(0,O.useState)(null),[pt,mt]=(0,O.useState)([]),[ht,gt]=(0,O.useState)(!1),_t=(0,O.useRef)(new Set),K=(0,O.useRef)(null),vt=(0,O.useRef)(null),yt=(0,O.useRef)(null),q=(0,O.useRef)(null),J=(0,O.useRef)(``),Y=j?.acceptanceScenarios??[],X=(0,O.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>V[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,V]),Z=(0,O.useMemo)(()=>{if(!B)return null;if(!j?.acceptanceScenarioCount)return B;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...B.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:B.interactiveCount}},[B,X,j?.acceptanceScenarioCount]),bt=(0,O.useCallback)(async(e,t)=>{let n=Oe(await ae(e.projectId))??await le(e.projectId,`coder`);_t.current.add(n.key),T(ke(n.key,t))},[T]),xt=(0,O.useCallback)(async(e=!0)=>{if(!k)return null;nt(!0);try{let t=await be(k.id);return await M(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,st(`all`),W(0),Qe(e=>e+1)),t}catch(e){return F(e instanceof Error?e.message:String(e)),null}finally{nt(!1)}},[k,M]);(0,O.useEffect)(()=>{if(!k)return;let e=!1;ae(k.projectId).then(t=>{e||(_t.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!_t.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,xt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[k,xt]),(0,O.useEffect)(()=>{mt(k?.acceptanceRuns??[])},[k?.acceptanceRuns]),(0,O.useEffect)(()=>{q.current=null},[k?.id]),(0,O.useEffect)(()=>{!j?.sourceHash||q.current||(q.current=j.sourceHash,st(`all`),W(0),Qe(e=>e+1))},[j?.sourceHash]),(0,O.useLayoutEffect)(()=>{if(!k)return;z(`booting`),it(null),at(null),ft(null),gt(!1),J.current=``;let e=window.setTimeout(()=>z(e=>e===`failed`?e:`timeout`),7e3),t=vt.current?Fe(vt.current,t=>{let n=je(t);if(n){if(n.type===`ready`){z(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),at(n.detail),ft(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),it(n.detail),z(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[k,Ze]),(0,O.useLayoutEffect)(()=>{if(!k||j?.status!==`healthy`||!Y.length){dt(null);return}let e=H===`all`?Y[U]:Y.find(e=>e.id===H),t=e?[e]:[];if(!t.length)return;dt(H),ot(e=>{if(H===`all`&&U===0)return{};let t={...e};return delete t[H],t});let r=!1,i=e=>{ot(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),dt(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=yt.current?Fe(yt.current,e=>{let t=je(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),ot(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),H===`all`&&U+1<Y.length?(W(e=>e+1),lt(e=>e+1)):dt(null)):t.type===`error`&&(window.clearTimeout(a),i(Ne(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,k,ct,H,U,Ze,j?.status,n]),(0,O.useEffect)(()=>{if(!k||!Z||!G||G!==j?.sourceHash)return;let e=`${k.id}:${G}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,gt(!0),ve(k.id,G,Z).then(t=>{J.current===e&&mt(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,F(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&>(!1)}))},[Z,G,k,j?.sourceHash]);let Q=(0,O.useCallback)(async e=>{if(k){tt(!0),F(null);try{await bt(k,e)}catch(e){F(e instanceof Error?e.message:String(e)),tt(!1)}}},[k,bt]);(0,O.useLayoutEffect)(()=>(Ee({startExtra:(0,A.jsx)(o,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回本地应用`:`Back to local apps`,children:(0,A.jsx)(pe,{className:`size-4`})}),main:(0,A.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:k?.name||(n?`创建本地应用`:`Create local app`)}),end:k?(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,A.jsxs)(o,{to:`/projects/${encodeURIComponent(k.projectId)}`,children:[(0,A.jsx)(m,{className:`size-4`}),`Project`]})}),(0,A.jsxs)(D,{className:`h-9`,onClick:()=>void Q(),disabled:I,children:[I?(0,A.jsx)(v,{className:`size-4 animate-spin`}):(0,A.jsx)(w,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>De()),[k,I,De,Q,Ee,n]);async function St(e){e.preventDefault(),P(!0),F(null);try{let e=await Te({name:He,idea:We});await E(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await bt(e,t)}catch{T(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){F(e instanceof Error?e.message:String(e))}finally{P(!1)}}async function Ct(){if(k){P(!0),F(null);try{let e=await Ce(k.id);await Ie(e,{revalidate:!1}),await M(),await Promise.all([E(`local-apps-list`),E(`gateway-extensions-list`)]),he(`ext:${e.extensionId}:app`),Je(!1)}catch(e){F(e instanceof Error?e.message:String(e))}finally{P(!1)}}}async function wt(e,t=!1){P(!0),F(null);try{let n=await e();return await Ie(n,{revalidate:!1}),await M(),await Promise.all([E(`local-apps-list`),E(`gateway-extensions-list`)]),t&&he(`ext:${n.extensionId}:app`),!0}catch(e){return F(e instanceof Error?e.message:String(e)),!1}finally{P(!1)}}async function Tt(e){k&&await wt(()=>we(k.id,e),e)}async function Et(e){k&&await wt(()=>Se(k.id,e),!0)}async function Dt(){k&&await wt(()=>ye(k.id))&&Xe(!1)}function Ot(){let e=Array.from(new Set([...j?.issues.map(e=>e.message)??[],...rt?[Ne(rt)]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>e.message)??[],...Object.values(V).filter(e=>e.status===`failed`).map(e=>`${e.name}: ${e.failureKind===`runner`?`[验收执行器] `:``}${e.message}`),...R===`timeout`?[n?`预览在 7 秒内未完成启动,可能存在白屏或阻塞。`:`The preview did not finish booting within 7 seconds and may be blank or blocked.`]:[]]));if(!e.length)return;let t=e.map(e=>`- ${e}`).join(`
|
|
2
|
-
`);Q(n?`请修复当前本地应用草稿的校验问题,保持扩展 ID 和已安装版本不变。先复现并判断问题来自应用行为还是验收执行器,不要通过弱化断言绕过问题。修复后运行完整校验。\n\n${t}`:`Fix the current local-app draft validation issues without changing the extension id or installed release. Reproduce first and determine whether each issue comes from app behavior or the acceptance runner; do not weaken assertions to bypass it. Run the full validation afterward.\n\n${t}`)}function kt(){st(`all`),W(0),lt(e=>e+1)}function At(e){st(e),W(0),lt(e=>e+1)}function jt(e,t){let r=t.failureKind===`runner`?n?`验收执行器`:`acceptance runner`:n?`产品场景`:`product scenario`;Q(n?`请修复本地应用的${r}问题“${e.name}”。当前失败信息:${t.message}\n\n保持扩展 ID 和场景原意不变;先复现并判断问题来自应用行为还是验收执行器,不要通过弱化断言绕过问题。修复后运行完整校验。`:`Fix the local-app ${r} issue "${e.name}". Current failure: ${t.message}\n\nPreserve the extension id and scenario intent. Reproduce first and determine whether the issue comes from app behavior or the runner; do not weaken assertions to bypass it. Run the full validation afterward.`)}let Mt=pt.findIndex(e=>Be(e,G,Z)),$=Mt>=0?pt[Mt]:null,Nt=Mt>=0?pt[Mt+1]??null:pt[0]??null,Pt=Me(Z),Ft=Nt?Nt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],It=j?.status===`failed`||R===`failed`||R===`timeout`||Z?.status===`failed`||Object.values(V).some(e=>e.status===`failed`),Lt=Ft.filter(e=>!Pt.includes(e)).length;async function Rt(){let e=await xt(!1);if(e?.status===`healthy`&&e.sourceHash!==G){q.current=e.sourceHash??null,W(0),Qe(e=>e+1);return}e?.status===`healthy`&&R===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&Je(!0)}return t?(0,A.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,A.jsxs)(`div`,{className:`mx-auto grid w-full max-w-6xl overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,A.jsxs)(`form`,{onSubmit:St,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,A.jsx)(ue,{className:`size-4`}),n?`告诉 Coder 你的想法`:`Tell Coder your idea`]}),(0,A.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会建立一个 Coder Project,并把应用上下文和开发 Skill 带入对话。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,A.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,A.jsx)(`input`,{value:He,onChange:e=>Ue(e.target.value),required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,A.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,A.jsx)(`textarea`,{value:We,onChange:e=>Ge(e.target.value),required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),Ke?(0,A.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:Ke}):null,(0,A.jsxs)(D,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:N||!He.trim()||!We.trim(),children:[N?(0,A.jsx)(v,{className:`size-4 animate-spin`}):(0,A.jsx)(w,{className:`size-4`}),n?`进入 Coder 对话`:`Continue with Coder`]})]}),(0,A.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,A.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,A.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,A.jsx)(x,{className:`size-7`})}),(0,A.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,A.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):Ae?(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,A.jsx)(S,{className:`rounded-xl`}),(0,A.jsx)(S,{className:`rounded-xl`}),(0,A.jsx)(S,{className:`rounded-xl`})]}):Pe||!k?(0,A.jsx)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,children:Pe instanceof Error?Pe.message:n?`找不到应用`:`App not found`}):(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,A.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,A.jsx)(ue,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,A.jsx)(`div`,{className:`mt-4 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg`,children:k.idea}),(0,A.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,A.jsx)(ce,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续迭代会进入对应 Project,由 Coder 读取应用上下文和专属 skill。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,A.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q($e)},children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,A.jsx)(`textarea`,{id:`local-app-change-request`,value:$e,onChange:e=>et(e.target.value),rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,A.jsxs)(D,{type:`submit`,className:`mt-2 w-full`,disabled:I||!$e.trim(),children:[I?(0,A.jsx)(v,{className:`size-4 animate-spin`}):(0,A.jsx)(w,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,A.jsxs)(D,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:I,children:[(0,A.jsx)(m,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,A.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${j?.status===`failed`||R===`failed`||R===`timeout`||Z?.status===`failed`?`bg-danger`:j?.status===`healthy`&&R===`healthy`&&Z?.status===`passed`&&$?.sourceHash===j.sourceHash&&!ht?`bg-success`:`bg-fg-subtle`}`}),R===`failed`||R===`timeout`?n?`预览运行异常`:`Preview runtime issue`:j?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:R===`booting`||!Z?n?`自动验收中`:`Running acceptance`:ht||$?.sourceHash!==j?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,A.jsxs)(D,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void xt(!0),disabled:L,children:[L?(0,A.jsx)(v,{className:`size-3.5 animate-spin`}):(0,A.jsx)(de,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,A.jsx)(`iframe`,{ref:vt,title:`${k.name} preview`,src:l(k.previewUrl),sandbox:Re,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{it({kind:`script_error`,message:`Preview document failed to load`}),z(`failed`)}},Ze),j?.status===`healthy`&&j.acceptanceScenarioCount>0?(0,A.jsx)(`iframe`,{ref:yt,title:`${k.name} acceptance runner`,src:`${l(k.previewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(H===`all`?Y[U]?.id??``:H)}`,sandbox:Re,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${Ze}-${ct}-${U}`):null]}),(0,A.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.installationState===`not_installed`?n?`尚未安装`:`Not installed`:k.enabled?n?`版本 ${k.activeVersion} 正在使用`:`Version ${k.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,A.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${k.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,A.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,A.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,k.draftVersion]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:k.activeVersion?`v${k.activeVersion}`:`—`})]})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(C,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),Ve||L?(0,A.jsx)(v,{className:`size-3.5 animate-spin text-fg-muted`}):j?.status===`healthy`?(0,A.jsx)(ce,{className:`size-4 text-success`}):(0,A.jsx)(p,{className:`size-4 text-danger`})]}),j?(0,A.jsxs)(`div`,{className:`mt-2`,children:[(0,A.jsx)(`p`,{className:`text-xs leading-5 ${j.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:j.status===`healthy`?j.hasDraftChanges?n?`${j.changedFileCount} 个文件有改动,可以安装新版本。`:`${j.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:j.issues[0]?.message}),j.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1`,children:j.changedFiles.slice(0,4).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,j.changedFileCount>4?(0,A.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${j.changedFileCount-4} 个文件`:`${j.changedFileCount-4} more files`}):null,(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${R===`healthy`?`bg-success`:R===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${R===`failed`||R===`timeout`?`text-danger`:`text-fg-muted`}`,children:rt?Ne(rt):R===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:R===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,A.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,A.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,A.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,A.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,A.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,A.jsx)(`span`,{children:e.message})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:j?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${j.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${j.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),ht?(0,A.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(v,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,A.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Nt?n?`相比上次:已修复 ${Lt} 项,仍有 ${Pt.length} 项。`:`Since the previous run: ${Lt} fixed, ${Pt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,A.jsx)(Le,{scenarios:Y,results:V,runningTarget:ut,zh:n,onRunAll:kt,onRunScenario:At,onAskCoder:jt})]}),It?(0,A.jsxs)(D,{className:`mt-3 w-full`,onClick:Ot,disabled:I,children:[(0,A.jsx)(w,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,A.jsx)(S,{className:`mt-2 h-12 rounded-lg`})]}),(0,A.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(oe,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,A.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,A.jsx)(D,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Rt(),disabled:N||Ve||L||ht||j?.status===`failed`||R!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==j?.sourceHash||k.installationState===`installed`&&j?.hasDraftChanges===!1,children:k.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),k.installationState===`installed`?(0,A.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,A.jsxs)(D,{className:`min-w-0 flex-1`,onClick:()=>void Tt(!k.enabled),disabled:N,children:[k.enabled?(0,A.jsx)(ge,{className:`size-4`}):(0,A.jsx)(se,{className:`size-4`}),k.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,A.jsx)(D,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>Xe(!0),disabled:N,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,A.jsx)(ie,{className:`size-4`})})]}):null,(0,A.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,A.jsx)(fe,{className:`size-4`}),n?`版本历史`:`Release history`]}),k.releases.length?(0,A.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:k.releases.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,A.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:ze(e.createdAt,r)})]}),e.isActive?null:(0,A.jsxs)(D,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void Et(e.id),disabled:N,children:[(0,A.jsx)(me,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,A.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),Ke?(0,A.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:Ke}):null]}),(0,A.jsx)(g,{open:qe,onOpenChange:Je,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(_e,{className:`fixed inset-0 z-50 bg-black/45`}),(0,A.jsxs)(b,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(re,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,A.jsx)(ee,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,A.jsx)(_,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(h,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,A.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:k.extensionId})]}),(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,A.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,A.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:j?.changedFileCount??0})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,A.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,A.jsx)(ce,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),j?.changedFiles.length?(0,A.jsx)(`ul`,{className:`mt-3 space-y-1`,children:j.changedFiles.slice(0,5).map(e=>(0,A.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,A.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,A.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,A.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(j?.permissions??k.permissions).map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,A.jsx)(s,{className:`size-4 text-success`}),e,k.installationState===`installed`&&j?.permissionDelta.added.includes(e)?(0,A.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),k.installationState===`installed`&&j?.permissionDelta.added.length?(0,A.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,A.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(_,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`primary`,onClick:()=>void Ct(),disabled:N,children:[N?(0,A.jsx)(v,{className:`size-4 animate-spin`}):(0,A.jsx)(y,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,A.jsx)(g,{open:Ye,onOpenChange:Xe,children:(0,A.jsxs)(f,{children:[(0,A.jsx)(_e,{className:`fixed inset-0 z-50 bg-black/45`}),(0,A.jsxs)(b,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-2xl focus:outline-none`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(re,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,A.jsx)(ee,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但 Project、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,A.jsx)(_,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,A.jsx)(h,{className:`size-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,A.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,A.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:k.name}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,A.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,A.jsx)(_,{asChild:!0,children:(0,A.jsx)(D,{children:n?`取消`:`Cancel`})}),(0,A.jsxs)(D,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Dt(),disabled:N,children:[N?(0,A.jsx)(v,{className:`size-4 animate-spin`}):(0,A.jsx)(ie,{className:`size-4`}),n?`卸载但保留 Project`:`Uninstall and keep Project`]})]})]})]})})]})}export{j as LocalAppWorkbenchPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-Cdrf2awF.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BzPwnXho.js","assets/preload-helper-zJ_50EbN.js","assets/Combination-14nmIgxH.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-C230izr8.js","assets/chunk-KS7C4IRE-BMhrPKJC.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-Bjvw7jtg.js","assets/messages-DQ5X6cXp.js","assets/cn-JdwAhgNB.js","assets/schemas-zIBW3wiV.js","assets/product-delivery-tRr-7IxY.js","assets/config-reload-event-Bjh2zoKp.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/gateway-startup-retry--2njcDpC.js","assets/activity-store-BwmdJ5pv.js","assets/theme-store-DtxpMC5S.js","assets/index-CFFYvilx.css","assets/vendor-codemirror-DRr7hFaD.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-TWGaF7Xa.js","assets/code-editor-dFzqyDXS.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-DQ5X6cXp.js";import{l as c,n as l}from"./locale-store-Bjvw7jtg.js";import{i as u}from"./theme-store-DtxpMC5S.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,$r as p,$s as m,Ac as h,An as g,At as _,Bc as v,Bn as y,Bo as b,Bs as x,Dc as S,Ds as C,Ec as w,Fo as T,Fu as E,Gn as D,Hn as O,Hs as k,Ia as A,Il as j,Io as M,Jl as N,Jn as P,Js as F,Kc as ee,Kn as I,Lo as te,Mc as ne,Ml as L,Mu as re,Oc as R,Qn as z,Qo as ie,Qr as ae,Rn as B,Ro as V,Sc as H,Tu as U,Ua as oe,Un as W,Us as G,Vn as se,Vo as ce,Vs as le,Wc as ue,Wn as de,Xn as fe,Yn as pe,Zl as me,Zn as he,Zo as K,Zs as q,a as ge,bu as _e,c as ve,cu as ye,dc as be,dl as xe,ec as Se,ei as J,er as Ce,hc as we,hl as Te,ir as Y,jn as Ee,ju as De,k as Oe,kn as ke,ku as Ae,l as je,ni as Me,o as X,ol as Ne,or as Pe,pl as Fe,qn as Ie,ri as Le,rr as Re,s as ze,ti as Be,tl as Ve,tr as He,uc as Ue,ul as We,wc as Ge,ws as Ke,zl as qe,zn as Je,zo as Ye}from"./index-BzPwnXho.js";var Z=n(),Q=e(t(),1),$=r(),Xe=(0,Q.createContext)(null);function Ze(){let e=(0,Z.c)(1),t=(0,Q.useContext)(Xe);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Qe},e[0]=t):t=e[0],t}return t}function Qe(){}function $e(e){let t=(0,Z.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,s]=(0,Q.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t)=>{s({src:e,alt:t})},t[0]=c):c=t[0];let l=c,u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={openImage:l},t[1]=u):u=t[1];let d=u,f=a!==null,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||s(null)},t[2]=p):p=t[2];let m;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Ye,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=o(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=h):h=t[4];let g=a?.alt||`Image preview`,_;t[5]===g?_=t[6]:(_=(0,$.jsx)(ce,{className:`sr-only`,children:g}),t[5]=g,t[6]=_);let v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(C,{className:`size-5`,"aria-hidden":!0}),t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:v})}),t[8]=i,t[9]=y);let x;t[10]===a?x=t[11]:(x=a?(0,$.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=x);let S;t[12]!==y||t[13]!==x||t[14]!==_?(S=(0,$.jsxs)(b,{children:[m,(0,$.jsxs)(te,{className:h,"aria-describedby":void 0,children:[_,y,x]})]}),t[12]=y,t[13]=x,t[14]=_,t[15]=S):S=t[15];let w;t[16]!==S||t[17]!==f?(w=(0,$.jsx)(T,{open:f,onOpenChange:p,children:S}),t[16]=S,t[17]=f,t[18]=w):w=t[18];let E;return t[19]!==n||t[20]!==w?(E=(0,$.jsxs)(Xe.Provider,{value:d,children:[n,w]}),t[19]=n,t[20]=w,t[21]=E):E=t[21],E}function et(e){let t=(0,Z.c)(15),{noteId:n,attachmentId:r,className:i}=e,[a,s]=(0,Q.useState)(!1),c;t[0]!==r||t[1]!==n?(c=Pe(n,r),t[0]=r,t[1]=n,t[2]=c):c=t[2];let l=c;if(a){let e;t[3]===i?e=t[4]:(e=o(`flex size-12 shrink-0 items-center justify-center rounded-lg border border-edge-subtle bg-surface-hover text-fg-muted`,i),t[3]=i,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Fe,{className:`size-4`}),t[5]=n):n=t[5];let r;return t[6]===e?r=t[7]:(r=(0,$.jsx)(`div`,{className:e,"aria-hidden":!0,children:n}),t[6]=e,t[7]=r),r}let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!0),t[8]=u):u=t[8];let d;t[9]===i?d=t[10]:(d=o(`size-12 shrink-0 rounded-lg border border-edge-subtle bg-surface-hover object-cover`,i),t[9]=i,t[10]=d);let f;return t[11]!==n||t[12]!==l||t[13]!==d?(f=(0,$.jsx)(Y,{src:l,expectedNoteId:n,alt:``,loading:`lazy`,draggable:!1,onLoadFailed:u,className:d}),t[11]=n,t[12]=l,t[13]=d,t[14]=f):f=t[14],f}var tt=6e4,nt=36e5,rt=864e5;function it(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function at(e,t,n){let r=t-e;if(r<tt)return n.justNow;if(r<nt){let e=Math.floor(r/tt);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=it(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(e>=i-rt)return n.yesterday+` `+new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});if(r<7*rt){let e=Math.floor(r/rt);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ot(e,t,n){let r=it(t);if(e>=r)return n.today;if(e>=r-rt)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(void 0,{month:`long`,day:`numeric`}):i.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function st(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function ct(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,`0`)}`}function lt(e){let t=(0,Z.c)(38),{noteId:n,attachmentId:r,durationSec:i,className:a}=e,{playing:s,loading:c,currentTime:l,duration:u,noteId:d,attachmentId:f}=Ee(),p=Ee(dt),m=d===n&&f===r,g=m&&s,_=m&&c,v=m?l:0,y=m&&u>0?u:i??0,b=y>0?Math.min(v/y*100,100):0,x;t[0]!==r||t[1]!==i||t[2]!==n||t[3]!==p?(x=e=>{e.stopPropagation(),p(n,r,i)},t[0]=r,t[1]=i,t[2]=n,t[3]=p,t[4]=x):x=t[4];let S=x,C;t[5]!==r||t[6]!==i||t[7]!==n||t[8]!==p?(C=e=>{(e.key===`Enter`||e.key===` `)&&(e.stopPropagation(),e.preventDefault(),p(n,r,i))},t[5]=r,t[6]=i,t[7]=n,t[8]=p,t[9]=C):C=t[9];let w=C,T;t[10]===a?T=t[11]:(T=o(`flex items-center gap-2`,a),t[10]=a,t[11]=T);let E=g?`bg-accent text-white`:`bg-accent/10 text-accent hover:bg-accent/20`,D;t[12]===E?D=t[13]:(D=o(`flex size-7 shrink-0 items-center justify-center rounded-full transition-colors`,E),t[12]=E,t[13]=D);let O=g?`Pause`:`Play`,k;t[14]!==_||t[15]!==g?(k=_?(0,$.jsx)(ee,{className:`size-3.5 animate-spin`}):g?(0,$.jsx)(h,{className:`size-3.5`}):(0,$.jsx)(Ge,{className:`size-3.5 ml-0.5`}),t[14]=_,t[15]=g,t[16]=k):k=t[16];let A;t[17]!==S||t[18]!==w||t[19]!==D||t[20]!==O||t[21]!==k?(A=(0,$.jsx)(`button`,{type:`button`,onClick:S,onKeyDown:w,className:D,"aria-label":O,children:k}),t[17]=S,t[18]=w,t[19]=D,t[20]=O,t[21]=k,t[22]=A):A=t[22];let j=`${b}%`,M;t[23]===j?M=t[24]:(M=(0,$.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-accent/10`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-200 ease-linear`,style:{width:j}})}),t[23]=j,t[24]=M);let N;t[25]!==y||t[26]!==m||t[27]!==v?(N=ct(m&&v>0?v:y),t[25]=y,t[26]=m,t[27]=v,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,$.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-muted`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let I;return t[34]!==F||t[35]!==T||t[36]!==A?(I=(0,$.jsxs)(`div`,{className:T,onClick:ut,children:[A,F]}),t[34]=F,t[35]=T,t[36]=A,t[37]=I):I=t[37],I}function ut(e){return e.stopPropagation()}function dt(e){return e.toggle}function ft(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function pt(e){let t=(0,Z.c)(83),{note:n,selected:r,onPress:i,onPin:a,onArchive:s,onDelete:c,labels:l,timeLabels:u}=e,d=r===void 0?!1:r,f;t[0]!==l||t[1]!==n?(f=ft(n,l),t[0]=l,t[1]=n,t[2]=f):f=t[2];let m=f,h=!n.snippet?.trim(),[g]=(0,Q.useState)(_t),_;t[3]!==n.createdAt||t[4]!==g||t[5]!==u?(_=at(n.createdAt,g,u),t[3]=n.createdAt,t[4]=g,t[5]=u,t[6]=_):_=t[6];let v=_,y,b;t[7]!==n.id||t[8]!==i?(y=()=>i(n.id),b=e=>{(e.key===`Enter`||e.key===` `)&&i(n.id)},t[7]=n.id,t[8]=i,t[9]=y,t[10]=b):(y=t[9],b=t[10]);let x=d?`bg-surface-panel hover:bg-surface-panel`:`bg-transparent hover:bg-surface-panel/70`,C;t[11]===x?C=t[12]:(C=o(`group relative flex cursor-pointer flex-col gap-2 overflow-hidden rounded-lg px-3 py-2.5`,`transition-colors duration-150 ease-out`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-rail`,x),t[11]=x,t[12]=C);let T=d?`true`:void 0,E;t[13]===d?E=t[14]:(E=d?(0,$.jsx)(`span`,{className:`pointer-events-none absolute inset-y-2 left-0 w-0.5 rounded-r-pill bg-accent`,"aria-hidden":!0}):null,t[13]=d,t[14]=E);let D;t[15]!==n.coverAttachmentId||t[16]!==n.id||t[17]!==n.kind||t[18]!==n.voiceAttachmentId||t[19]!==n.voiceDurationSec?(D=n.coverAttachmentId?(0,$.jsx)(et,{noteId:n.id,attachmentId:n.coverAttachmentId}):n.kind===`voice`&&n.voiceAttachmentId?(0,$.jsx)(lt,{noteId:n.id,attachmentId:n.voiceAttachmentId,durationSec:n.voiceDurationSec,className:`mt-0.5 w-28 shrink-0`}):null,t[15]=n.coverAttachmentId,t[16]=n.id,t[17]=n.kind,t[18]=n.voiceAttachmentId,t[19]=n.voiceDurationSec,t[20]=D):D=t[20];let O;t[21]===n.title?O=t[22]:(O=n.title&&(0,$.jsx)(`h3`,{className:`mb-0.5 truncate text-sm font-semibold text-fg`,children:n.title}),t[21]=n.title,t[22]=O);let k=n.title?`text-fg-muted`:h?`italic text-fg-muted`:`text-fg`,A;t[23]===k?A=t[24]:(A=o(`truncate text-sm leading-5`,k),t[23]=k,t[24]=A);let j;t[25]!==m||t[26]!==A?(j=(0,$.jsx)(`p`,{className:A,children:m}),t[25]=m,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==O||t[29]!==j?(M=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[O,j]}),t[28]=O,t[29]=j,t[30]=M):M=t[30];let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(Le,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:gt,className:`shrink-0 rounded-md p-1 text-fg-muted opacity-0 transition-opacity group-hover:opacity-100 hover:bg-surface-panel focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,children:(0,$.jsx)(qe,{className:`size-4`})})}),t[31]=N):N=t[31];let P;t[32]!==n.id||t[33]!==n.pinned||t[34]!==a?(P=()=>a(n.id,!n.pinned),t[32]=n.id,t[33]=n.pinned,t[34]=a,t[35]=P):P=t[35];let F;t[36]===n.pinned?F=t[37]:(F=n.pinned?(0,$.jsx)(w,{className:`size-4`}):(0,$.jsx)(S,{className:`size-4`}),t[36]=n.pinned,t[37]=F);let ee=n.pinned?l.unpin:l.pin,I;t[38]!==P||t[39]!==F||t[40]!==ee?(I=(0,$.jsxs)(p,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:P,children:[F,ee]}),t[38]=P,t[39]=F,t[40]=ee,t[41]=I):I=t[41];let te;t[42]!==n.id||t[43]!==s?(te=()=>s(n.id),t[42]=n.id,t[43]=s,t[44]=te):te=t[44];let ne;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(re,{className:`size-4`}),t[45]=ne):ne=t[45];let L;t[46]!==l.archive||t[47]!==te?(L=(0,$.jsxs)(p,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:te,children:[ne,l.archive]}),t[46]=l.archive,t[47]=te,t[48]=L):L=t[48];let R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(Me,{className:`my-1 h-px bg-edge-subtle`}),t[49]=R):R=t[49];let z;t[50]!==n.id||t[51]!==c?(z=()=>c(n.id),t[50]=n.id,t[51]=c,t[52]=z):z=t[52];let ie;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(le,{className:`size-4`}),t[53]=ie):ie=t[53];let B;t[54]!==l.delete||t[55]!==z?(B=(0,$.jsxs)(p,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-500 outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:z,children:[ie,l.delete]}),t[54]=l.delete,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==I||t[58]!==L||t[59]!==B?(V=(0,$.jsxs)(Be,{children:[N,(0,$.jsx)(J,{children:(0,$.jsxs)(ae,{className:`z-50 min-w-[140px] rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,sideOffset:4,align:`end`,onClick:ht,children:[I,L,R,B]})})]}),t[57]=I,t[58]=L,t[59]=B,t[60]=V):V=t[60];let H;t[61]!==D||t[62]!==M||t[63]!==V?(H=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[D,M,V]}),t[61]=D,t[62]=M,t[63]=V,t[64]=H):H=t[64];let U;t[65]===n.pinned?U=t[66]:(U=n.pinned&&(0,$.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-xs font-medium text-accent`,children:(0,$.jsx)(S,{className:`size-3`})}),t[65]=n.pinned,t[66]=U);let oe;t[67]===n.tags?oe=t[68]:(oe=n.tags?.slice(0,2).map(mt),t[67]=n.tags,t[68]=oe);let W;t[69]===v?W=t[70]:(W=(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:v}),t[69]=v,t[70]=W);let G;t[71]!==U||t[72]!==oe||t[73]!==W?(G=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[U,oe,W]}),t[71]=U,t[72]=oe,t[73]=W,t[74]=G):G=t[74];let se;return t[75]!==H||t[76]!==G||t[77]!==y||t[78]!==b||t[79]!==C||t[80]!==T||t[81]!==E?(se=(0,$.jsxs)(`article`,{role:`button`,tabIndex:0,onClick:y,onKeyDown:b,className:C,"aria-current":T,children:[E,H,G]}),t[75]=H,t[76]=G,t[77]=y,t[78]=b,t[79]=C,t[80]=T,t[81]=E,t[82]=se):se=t[82],se}function mt(e){return(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e)}function ht(e){return e.stopPropagation()}function gt(e){return e.stopPropagation()}function _t(){return Date.now()}function vt(e){let t=(0,Z.c)(45),{title:n,description:r,prompt:i,coverage:c,className:u,variant:f}=e,p=f===void 0?`card`:f,m=l(xt),h=s(m).automations.suggestions,g=s(m).automations,_=a(),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=v):v=t[0];let{data:y}=d(c?`automation-suggestion-coverage`:null,bt,v),b=c?y?.automations.find(e=>ve(e,c)):void 0,x=b?X(b,g):[];if(p===`titleAction`){if(b){let e;t[1]===u?e=t[2]:(e=o(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,u),t[1]=u,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(ye,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===_?r=t[5]:(r=()=>_(`/automations`),t[4]=_,t[5]=r),(0,$.jsxs)(`section`,{className:e,children:[n,(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:h.coveredTitle}),(0,$.jsx)(Ke,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:h.manage})]})}let e;t[6]===u?e=t[7]:(e=o(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,u),t[6]=u,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Ve,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let s;t[9]!==r||t[10]!==n?(s=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=s):s=t[11];let c;t[12]!==_||t[13]!==i?(c=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=_,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,$.jsxs)(`section`,{className:e,children:[a,s,(0,$.jsxs)(Ke,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,h.create]})]})}if(b){let e;t[16]===u?e=t[17]:(e=o(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,u),t[16]=u,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===_?r=t[20]:(r=()=>_(`/automations`),t[19]=_,t[20]=r);let i;return t[21]!==h||t[22]!==r?(i=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(Ke,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:h.manage})}),t[21]=h,t[22]=r,t[23]=i):i=t[23],(0,$.jsxs)(`section`,{className:e,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:h.coveredTitle}),(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:ze(h.coveredDescription,{name:b.name})})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:g.explain.whyCovered}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:x.map(yt)})]}),i]})}let S;t[24]===u?S=t[25]:(S=o(`rounded-lg bg-surface-panel p-3 shadow-surface`,u),t[24]=u,t[25]=S);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(Ve,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===n?w=t[28]:(w=(0,$.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=w);let T;t[29]===r?T=t[30]:(T=(0,$.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=T);let E;t[31]!==w||t[32]!==T?(E=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[C,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]})]}),t[31]=w,t[32]=T,t[33]=E):E=t[33];let D;t[34]!==_||t[35]!==i?(D=()=>{_(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=_,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==h.create||t[39]!==D?(k=(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(Ke,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,h.create]})}),t[38]=h.create,t[39]=D,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==S||t[43]!==E?(A=(0,$.jsxs)(`section`,{className:S,children:[E,k]}),t[41]=k,t[42]=S,t[43]=E,t[44]=A):A=t[44],A}function yt(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function bt(){return je.list()}function xt(e){return e.language}function St(e){let t=(0,Z.c)(4),{values:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:r}),t[2]=r,t[3]=i),i}function Ct(e,t){return(0,$.jsx)(`li`,{children:e},`${t}:${e}`)}function wt(e){let t=(0,Z.c)(35),{noteId:n}=e,r=l(Dt),i;t[0]===r?i=t[1]:(i=s(r),t[0]=r,t[1]=i);let a=i.notes.discussionCapture,o,c;t[2]===n?(o=t[3],c=t[4]):(o=[`note-discussion-document`,n],c=()=>B(n),t[2]=n,t[3]=o,t[4]=c);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={revalidateOnFocus:!1},t[5]=u):u=t[5];let{data:f,mutate:p}=d(o,c,u),m,h;if(t[6]===p?(m=t[7],h=t[8]):(m=()=>{let e=e=>{let t=e.detail;t&&p(e=>{if(!e||e.discussion.id!==t.discussionId)return e;let n=e.transcript.segments.filter(e=>e.sequence!==t.segment.sequence).concat(t.segment).sort(Et);return{...e,discussion:{...e.discussion,transcriptRevision:t.transcriptRevision},transcript:{...e.transcript,revision:t.transcriptRevision,segments:n,text:t.text,stats:t.stats}}},{revalidate:!1})},t=()=>void p();return window.addEventListener(`discussion-segment-updated`,e),window.addEventListener(`discussion-updated`,t),()=>{window.removeEventListener(`discussion-segment-updated`,e),window.removeEventListener(`discussion-updated`,t)}},h=[p],t[6]=p,t[7]=m,t[8]=h),(0,Q.useEffect)(m,h),!f)return null;let{discussion:g,transcript:_}=f,y=f.organization?.organization,b=[`stopping`,`sealing`,`organizing`].includes(g.status),S;t[9]!==a.actionItems||t[10]!==a.decisions||t[11]!==a.openQuestions||t[12]!==a.organization||t[13]!==a.risks||t[14]!==y?(S=y?(0,$.jsxs)(`section`,{className:`border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-accent-fg`,children:[(0,$.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),a.organization]}),(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:y.summary}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 text-sm leading-6 text-fg sm:grid-cols-2`,children:[y.decisions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.decisions}),(0,$.jsx)(St,{values:y.decisions})]}):null,y.actionItems.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.actionItems}),(0,$.jsx)(St,{values:y.actionItems.map(Tt)})]}):null,y.risks.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.risks}),(0,$.jsx)(St,{values:y.risks})]}):null,y.openQuestions.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`font-medium`,children:a.openQuestions}),(0,$.jsx)(St,{values:y.openQuestions})]}):null]})]}):null,t[9]=a.actionItems,t[10]=a.decisions,t[11]=a.openQuestions,t[12]=a.organization,t[13]=a.risks,t[14]=y,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(v,{className:`size-4 text-accent`,"aria-hidden":!0}),t[16]=C):C=t[16];let w=g.status===`recording`?a.draftTranscript:a.fullTranscript,T;t[17]===w?T=t[18]:(T=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[C,w]}),t[17]=w,t[18]=T);let E;t[19]===g.status?E=t[20]:(E=g.status===`needs_attention`?(0,$.jsx)(x,{className:`size-3.5 text-danger`}):g.status===`completed`?(0,$.jsx)(ye,{className:`size-3.5 text-success`}):null,t[19]=g.status,t[20]=E);let D=b?a.finalizing:g.status===`needs_attention`?g.failureMessage:null,O;t[21]!==E||t[22]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,children:[E,D]}),t[21]=E,t[22]=D,t[23]=O):O=t[23];let k;t[24]!==T||t[25]!==O?(k=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[T,O]}),t[24]=T,t[25]=O,t[26]=k):k=t[26];let A=_.text||a.waitingTranscript,j;t[27]===A?j=t[28]:(j=(0,$.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:A}),t[27]=A,t[28]=j);let M;t[29]!==k||t[30]!==j?(M=(0,$.jsxs)(`section`,{className:`px-6 py-4`,children:[k,j]}),t[29]=k,t[30]=j,t[31]=M):M=t[31];let N;return t[32]!==M||t[33]!==S?(N=(0,$.jsxs)(`div`,{className:`max-h-[45%] shrink-0 overflow-y-auto border-b border-edge-subtle`,children:[S,M]}),t[32]=M,t[33]=S,t[34]=N):N=t[34],N}function Tt(e){return e.title}function Et(e,t){return e.sequence-t.sequence}function Dt(e){return e.language}var Ot={edit:R,ai_edit:Se,sync:we,restore:De};function kt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function At({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=s(l(e=>e.language)).notes,c=a,{data:u}=d(e?[`note-history`,e]:null,()=>D(e)),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),v=(0,Q.useCallback)(async t=>{p(!0),_(null);try{await Ce(e,t),h(null),i()}catch{_(a.restoreFailed)}finally{p(!1)}},[e,a.restoreSuccess,a.restoreFailed,i]),y=Date.now();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0}),a.history]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[g?(0,$.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:g}):null,u?.length?(0,$.jsx)(`ul`,{className:`divide-y divide-edge`,children:u.map(e=>{let r=Ot[e.trigger]??R,i=t===e.timestamp,s=m===e.timestamp;return(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:o(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:kt(e.trigger,a)}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:at(e.timestamp,y,c)})]}),e.snippet&&(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,$.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:s?(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:a.restoreConfirm}),(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),v(e.timestamp)},disabled:f,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:f?`...`:a.restore}),(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,$.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:a.restore})})]},e.timestamp)})}):(0,$.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:a.historyEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:a.historyEmptyDescription})]})]})]})}function jt(e){let t=(0,Z.c)(10),{noteId:n,note:r,catalyzing:i,onCatalyze:c,onClose:u,noteThreads:p,openingChat:m,onOpenChat:h,onOpenNewChat:g}=e,_=s(l(Rt)).notes,v=a(),y=r?.aiDeep?.catalysis,b=y?.report??null,x;t[0]===n?x=t[1]:(x=n?[`note-agent-context-status`,n]:null,t[0]=n,t[1]=x);let S;t[2]===n?S=t[3]:(S=()=>W(n),t[2]=n,t[3]=S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},t[4]=C):C=t[4];let{data:w,mutate:T,isLoading:E}=d(x,S,C),D;t[5]===n?D=t[6]:(D=async e=>{try{await f(n,e)}catch{}},t[5]=n,t[6]=D);let O=D,A;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(Se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[7]=A):A=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(Ae,{className:`size-4 rotate-180`,"aria-hidden":!0}),t[8]=j):j=t[8];let M;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(ue,{className:`size-4 text-accent`,"aria-hidden":!0}),t[9]=M):M=t[9],(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:_.catalysisSectionTitle})]}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":_.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:j})]}),(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,$.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:_.catalysisSectionDescription}),w?(0,$.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.contextStatusTitle}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void T(()=>z(n),{revalidate:!1}),disabled:E,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:_.contextRebuild}),(0,$.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[11px] font-medium`,w.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:w.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:w.status})]}),(0,$.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:_.contextStatusDetail.replace(`{{attachments}}`,String(w.attachments.length)).replace(`{{tokens}}`,String(w.tokenEstimate??0))}),w.attachments.length>0?(0,$.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:w.attachments.slice(0,5).map(Lt)}):null]}):null,(0,$.jsx)(`button`,{type:`button`,onClick:c,disabled:i,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:i?_.processing:b?_.recatalyze:_.catalyzeAction}),b?(0,$.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.valueHypothesis}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:b.valueHypothesis})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.targetUsers}),(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:b.targetUsers.slice(0,5).map(It)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.keyQuestions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.keyQuestions.slice(0,3).map(Ft)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.mvpPathLabel}),(0,$.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.mvpPath.slice(0,3).map(Pt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.risks}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.risks.slice(0,3).map(Nt)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:_.nextActions}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:b.nextActions.slice(0,4).map(Mt)})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:_.confidenceLabel.replace(`{{percent}}`,String(Math.round(b.confidence*100)))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackHelpfulAria,children:(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void O(`not_helpful`),className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,y?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":_.feedbackNotHelpfulAria,children:(0,$.jsx)(G,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:_.noCatalysisReportHint}),(0,$.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[M,_.relatedThreadsTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:_.relatedThreadsDescription})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:h,disabled:m,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:m?_.openingChat:_.openThread}),(0,$.jsx)(`button`,{type:`button`,onClick:g,disabled:m,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:_.newThread})]})]}),p.length>0?(0,$.jsx)(`div`,{className:`space-y-2`,children:p.slice(0,5).map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>v(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||_.noteDiscussionFallback}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:_.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,$.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:_.noThreads})]})]})]})}function Mt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,$.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`)}function Nt(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,$.jsx)(`span`,{children:e})]},e)}function Pt(e,t){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,$.jsx)(`span`,{children:e})]},e)}function Ft(e){return(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,$.jsx)(`span`,{children:e})]},e)}function It(e){return(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e)}function Lt(e){return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId)}function Rt(e){return e.language}var zt=()=>i(()=>import(`./block-editor-Cdrf2awF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])),Bt=()=>i(()=>import(`./markdown-editor-TWGaF7Xa.js`).then(e=>e.n),__vite__mapDeps([27,1,3,24,5,28])),Vt=(0,Q.lazy)(()=>zt().then(e=>({default:e.BlockEditor}))),Ht=(0,Q.lazy)(()=>Bt().then(e=>({default:e.MarkdownEditor})));function Ut(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,$.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,$.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Wt(e){let t=(0,Z.c)(14),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:L},t[0]=i.edit,t[1]=a);let s;t[2]===i.source?s=t[3]:(s={id:`source`,label:i.source,Icon:N},t[2]=i.source,t[3]=s);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:j},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=[a,s,c],t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=l,d;return t[10]!==n||t[11]!==u||t[12]!==r?(d=(0,$.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-edge p-0.5`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(t),onMouseEnter:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},onFocus:()=>{t===`wysiwyg`&&zt(),t===`source`&&Bt()},className:o(`inline-flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-medium transition-colors`,n===t?`bg-surface-hover text-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,$.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),i]},t)})}),t[10]=n,t[11]=u,t[12]=r,t[13]=d):d=t[13],d}function Gt(e){let t=(0,Z.c)(15),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:c,onOpenSearch:u,autoFocus:d,onAutoFocusConsumed:f}=e,p=a===void 0?!0:a,m=c===void 0?!0:c,h=d===void 0?!1:d,g=l(Kt),_;t[0]===g?_=t[1]:(_=s(g),t[0]=g,t[1]=_);let v=_.notes.lightboxClose,y;t[2]!==h||t[3]!==o||t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r||t[8]!==u||t[9]!==i||t[10]!==p?(y=(0,$.jsx)(qt,{noteId:n,onBack:r,onSaved:i,showBackButton:p,backButtonClassName:o,clearHeaderOnCleanup:m,onOpenSearch:u,autoFocus:h,onAutoFocusConsumed:f}),t[2]=h,t[3]=o,t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=u,t[9]=i,t[10]=p,t[11]=y):y=t[11];let b;return t[12]!==v||t[13]!==y?(b=(0,$.jsx)($e,{closeLabel:v,children:y}),t[12]=v,t[13]=y,t[14]=b):b=t[14],b}function Kt(e){return e.language}function qt({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:c=!0,onOpenSearch:f,autoFocus:p=!1,onAutoFocusConsumed:m}){let h=l(e=>e.language),_=s(h).notes,v=s(h).automations.suggestions,y=a(),b=u(e=>e.resolved)===`dark`,{openImage:x}=Ze(),[S,C]=(0,Q.useState)(`wysiwyg`),[w,T]=(0,Q.useState)(null),[D,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(``),[F,ee]=(0,Q.useState)(360),[te,ne]=(0,Q.useState)(!1),[L,re]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(null),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W=(0,Q.useRef)(null),G=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=oe(e=>e.setPageHeader),he=oe(e=>e.clearPageHeader),{data:K,mutate:q}=d(e?[`note-detail`,e]:null,()=>O(e)),{data:_e=[],mutate:ve}=d(e?[`note-threads`,e]:null,()=>I(e),{revalidateOnFocus:!1}),ye=D!==null;(0,Q.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&q()};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[q,e]),(0,Q.useEffect)(()=>{B.current=!1,N(``),k(null),T(null),V.current=!1,pe.current=null},[e]),(0,Q.useEffect)(()=>{!K||B.current||(N(K.title??``),B.current=!0)},[K]),(0,Q.useEffect)(()=>{if(!p||!K||ye||pe.current===e)return;let t=window.requestAnimationFrame(()=>{fe.current?.focus(),m?.()});return pe.current=e,()=>window.cancelAnimationFrame(t)},[p,ye,K,e,m]);let xe=K?new Date(K.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,J=(0,Q.useMemo)(()=>r?(0,$.jsx)(`button`,{type:`button`,onClick:t,"aria-label":_.back,className:o(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,E,i),children:(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})}):null,[i,_.back,t,r]),Ce=(0,Q.useCallback)(t=>{N(t),e&&(G.current=t,U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{let t=G.current;if(G.current=null,t!==null){j(!0);try{await He(e,{title:t}),await q(),n?.()}catch{}finally{j(!1)}}},600))},[e,q,n]),we=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,E),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:M||xe||void 0,children:M||xe}),A?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:_.saving}):null]}),[_.saving,A,xe,M]),Y=(0,Q.useCallback)(async(t=!1)=>{z(!0),ae(null);try{let n=await P(e,{forceNew:t});await q(),await ve(),y(`/chat/${encodeURIComponent(n.sessionKey)}`)}catch(e){ae(`${_.chatOpenFailedTitle}: ${e instanceof Error?e.message:_.chatOpenFailedMessage}`)}finally{z(!1)}},[q,ve,y,e,_.chatOpenFailedMessage,_.chatOpenFailedTitle]),Ee=(0,Q.useCallback)(async()=>{re(!0),ae(null);try{await Je(e),await q()}catch(e){ae(`${_.catalysisFailed}: ${e instanceof Error?e.message:_.chatOpenFailedMessage}`)}finally{re(!1)}},[q,e]),De=(0,Q.useCallback)(()=>{T(w===`breakdown`?null:`breakdown`),!K?.aiDeep?.catalysis?.report&&!L&&Ee()},[w,L,Ee,K?.aiDeep?.catalysis?.report]),je=(0,Q.useCallback)(()=>{let t=D?.markdown??W.current??K?.markdown??``,n=D?.title??M,r=ke([n,t].filter(Boolean).join(`
|
|
3
|
-
|
|
4
|
-
`));return{source:{type:`note`,id:e,title:n||_.titlePlaceholder},text:r,language:g(r,h)}},[h,_.titlePlaceholder,K?.markdown,e,D,M]),Me=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:o(`flex items-center gap-2`,E),children:[f?(0,$.jsx)(`button`,{type:`button`,onClick:f,"aria-label":_.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0})}):null,(0,$.jsx)(Oe,{input:je,labels:{read:_.readAloud,preparing:_.readAloudPreparing,pause:_.readAloudPause,resume:_.readAloudResume,retry:_.readAloudRetry},showLabel:!0}),(0,$.jsxs)(`button`,{type:`button`,onClick:De,disabled:L,"aria-label":_.catalysisSectionTitle,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,w===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),L?_.catalyzing:_.catalyzeButton]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>Y(!1),disabled:R,className:o(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,$.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),R?_.openingChat:_.openChatButton]}),(0,$.jsx)(Wt,{mode:S,onModeChange:C,labels:{edit:_.modeEdit,source:_.modeSource,preview:_.modePreview}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>T(w===`history`?null:`history`),"aria-label":_.history,className:o(`rounded-lg p-1.5 transition-colors`,w===`history`?`bg-accent/10 text-accent`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0})})]}),[L,De,Y,S,_.history,_.modeEdit,_.modePreview,_.modeSource,R,w,f,_.searchDialogTitle,_.readAloud,_.readAloudPause,_.readAloudPreparing,_.readAloudResume,_.readAloudRetry,je]);(0,Q.useLayoutEffect)(()=>(me({startExtra:J,main:K?we:null,end:K?Me:null}),()=>{c&&he()}),[c,he,Me,we,J,K,me]);let X=(0,Q.useCallback)(t=>{e&&(W.current=t,H.current&&clearTimeout(H.current),H.current=setTimeout(async()=>{let t=W.current;if(W.current=null,t!==null){j(!0),ae(null);try{await He(e,{markdown:t}),await q(),n?.()}catch(e){ae(`${_.saveFailed}: ${e instanceof Error?e.message:_.saveFailedHint}`)}finally{j(!1)}}},600))},[e,q,_.saveFailed,_.saveFailedHint,n]),Ne=(0,Q.useCallback)(t=>{de(e,t.timestamp).then(e=>{e&&k(e)})},[e]),Pe=(0,Q.useCallback)(()=>{T(null),k(null)},[]),Fe=(0,Q.useCallback)(()=>{T(null),k(null),q(),n?.()},[q,n]);if((0,Q.useEffect)(()=>()=>{H.current&&clearTimeout(H.current),U.current&&clearTimeout(U.current);let t=W.current,n=G.current;W.current=null,G.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&He(e,r)},[e]),K===void 0)return(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,$.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-accent border-t-transparent`})});if(K===null)return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:_.notFoundTitle}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_.notFoundDescription}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:_.back})]});let Ie=ye?D.title??``:M,Le=ye?D.markdown??``:K.markdown??``,ze=new Date(K.createdAt).getTime(),Be=Number.isFinite(ze)&&Date.now()-ze<3600*1e3?(0,$.jsx)(vt,{title:v.noteCreatedTitle,description:v.noteCreatedDescription,prompt:v.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[ie?(0,$.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ie}):null,(0,$.jsx)(ge,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsx)(ge,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,$.jsxs)(`div`,{ref:se,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:[(0,$.jsx)(wt,{noteId:e}),ye?(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,children:[Ie&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:Ie}),Le?(0,$.jsx)(Re,{noteId:e,content:Le,className:`opacity-80`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]}):(0,$.jsxs)($.Fragment,{children:[S===`wysiwyg`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Ce(e.target.value),onCompositionStart:()=>{V.current=!0},onCompositionEnd:()=>{V.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!V.current&&!t.isComposing&&(e.preventDefault(),(se.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Be]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Vt,{initialContent:K.markdown??``,onChange:X,noteId:e},`wysiwyg-${e}`)})})]}),S===`source`&&(0,$.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,$.jsx)(`input`,{ref:fe,type:`text`,value:M,onChange:e=>Ce(e.target.value),placeholder:_.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Be]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ut,{}),children:(0,$.jsx)(Ht,{initialContent:K.markdown??``,onChange:X,isDark:b},`source-${e}`)})})]}),S===`preview`&&(0,$.jsxs)(`div`,{className:`h-full overflow-y-auto px-6 py-4`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&x(t.currentSrc||t.src,t.alt)},children:[M&&(0,$.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:M}),K.markdown?(0,$.jsx)(Re,{noteId:e,content:K.markdown,className:`[&_img]:cursor-zoom-in`}):(0,$.jsx)(`p`,{className:`italic text-fg-muted`,children:_.emptyPreview})]})]})]})]}),(0,$.jsx)(`div`,{ref:ce,className:o(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!te&&`transition-[width] duration-300 ease-in-out`),style:{width:w?F:0},children:(0,$.jsxs)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col`,style:{width:F},children:[(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),ne(!0);let n=e.clientX,r=F,i=e.pointerId,a=0,o=F,s=F,c=()=>{a=0,s=o,w&&ce.current?.style.setProperty(`width`,`${s}px`),le.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}ne(!1),ee(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:o(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,te&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:w===`history`?(0,$.jsx)(At,{noteId:e,activeTimestamp:D?.timestamp??null,onSelect:Ne,onClose:Pe,onRestored:Fe}):w===`breakdown`?(0,$.jsx)(jt,{noteId:e,note:K??null,catalyzing:L,onCatalyze:Ee,onClose:()=>T(null),noteThreads:_e,openingChat:R,onOpenChat:()=>Y(!1),onOpenNewChat:()=>Y(!0)}):null})]})})]})}var Jt=3e4;function Yt(){if(!(typeof MediaRecorder>`u`))return[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Xt({placeholder:e,sendLabel:t,onCapture:n,onImagePick:r,onVoiceCapture:i,recordingLabel:a=`Recording…`,imageDisabled:s=!1,voiceDisabled:c=!1,onDiscussionCapture:l,discussionCaptureLabel:u=`Record discussion`}){let[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(null),C=(0,Q.useRef)(null),w=(0,Q.useRef)(null),T=(0,Q.useRef)([]),E=(0,Q.useRef)(0),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=(0,Q.useCallback)(()=>{D.current&&=(clearInterval(D.current),null),O.current&&=(clearTimeout(O.current),null),w.current?.getTracks().forEach(e=>e.stop()),w.current=null,C.current=null,T.current=[],g(!1),y(0)},[]);(0,Q.useEffect)(()=>()=>k(),[k]);let A=(0,Q.useCallback)(async()=>{let e=C.current;if(!e||e.state!==`recording`)return;x(!0),await new Promise(t=>{e.addEventListener(`stop`,()=>t(),{once:!0}),e.stop()});let t=Math.max(1,Math.round((Date.now()-E.current)/1e3)),n=e.mimeType||Yt()||`audio/webm`,r=new Blob(T.current,{type:n});if(k(),r.size>0&&i){let e=n.includes(`mp4`)?`m4a`:n.includes(`ogg`)?`ogg`:`webm`,a=new File([r],`voice-${Date.now()}.${e}`,{type:n});try{await i(a,t)}finally{x(!1)}return}x(!1)},[k,i]),j=(0,Q.useCallback)(async()=>{if(!(!i||b||h)&&!(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`))try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=Yt(),n=t?new MediaRecorder(e,{mimeType:t}):new MediaRecorder(e);w.current=e,C.current=n,T.current=[],E.current=Date.now(),n.ondataavailable=e=>{e.data.size>0&&T.current.push(e.data)},n.start(),g(!0),y(0),D.current=setInterval(()=>{y(Math.round((Date.now()-E.current)/1e3))},250),O.current=setTimeout(()=>{A()},Jt)}catch{k()}},[k,i,h,A,b]),M=(0,Q.useCallback)(()=>{if(h){A();return}j()},[h,j,A]),N=(0,Q.useCallback)(async e=>{let t=d.trim();if(!(!t||p)){m(!0),f(``);try{await n(t,e)}catch{f(t)}finally{m(!1),S.current?.focus()}}},[d,p,n]),P=(0,Q.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),N()),e.key===`Enter`&&e.shiftKey&&(e.preventDefault(),N({navigate:!1}))},[N]),F=p||b;return(0,$.jsxs)(`div`,{className:o(`flex items-center gap-1.5 rounded-2xl border border-edge bg-surface-panel p-2 shadow-float dark:shadow-elevated`,`focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,h&&`border-danger ring-1 ring-danger/40`),children:[r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,disabled:F||s||h,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Image`,children:(0,$.jsx)(xe,{className:`size-4`})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:M,disabled:F||c||p,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,h?`bg-danger-soft text-danger hover:bg-danger-soft`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-label":h?`Stop recording`:`Voice`,"aria-pressed":h,children:h?(0,$.jsx)(q,{className:`size-4 fill-current`}):(0,$.jsx)(v,{className:`size-4`})}),l&&!h?(0,$.jsx)(`button`,{type:`button`,onClick:l,disabled:F,className:`shrink-0 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":u,title:u,children:(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0})}):null,h?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate py-1.5 text-sm text-danger`,children:a.replace(`{{seconds}}`,String(_))}):(0,$.jsx)(`textarea`,{ref:S,value:d,onChange:e=>f(e.target.value),onKeyDown:P,placeholder:e,rows:1,disabled:F,className:`min-h-8 flex-1 resize-none bg-transparent py-1.5 text-sm leading-5 text-fg placeholder:text-fg-muted focus:outline-none disabled:opacity-60`,style:{fieldSizing:`content`}}),(0,$.jsx)(`button`,{type:`button`,disabled:!d.trim()||F||h,onClick:e=>void N({navigate:!e.shiftKey}),"aria-label":t,className:o(`shrink-0 rounded-lg p-2 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,d.trim()&&!F&&!h?`text-accent hover:bg-accent-soft`:`text-fg-disabled`),children:(0,$.jsx)(Ue,{className:`size-4`})})]})}var Zt={statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1},Qt=240,$t=320,en=520,tn=560;function nn(e){if(globalThis.localStorage===void 0)return $t;try{let t=globalThis.localStorage.getItem(e);if(!t)return $t;let n=Number(t);return Number.isFinite(n)?n:$t}catch{return $t}}function rn(e,t){if(globalThis.localStorage!==void 0)try{globalThis.localStorage.setItem(e,String(Math.round(t)))}catch{}}var an={thought:F,todo:m,voice:v,media:xe,bookmark:_e,mixed:F,task:m};function on(e,t){return e.snippet?.trim()?e.snippet:e.coverAttachmentId?t.imageNote:t.noText}function sn(e,t){return e.statusFilter===t.patch.statusFilter&&e.kindFilter===t.patch.kindFilter&&e.pinnedOnly===t.patch.pinnedOnly}function cn(e,t){return`${e.replace(/\/$/,``)}/${encodeURIComponent(t)}`}function ln({selectedNoteId:e,basePath:t,managePageHeader:n=!1,showLibrary:r=!0,allowMediaCapture:i=!0,projectId:u,listTitle:f,listDescription:p,emptyText:h,emptyDescription:g,listWidthStorageKey:x=`xopc.notes.listWidth`}){let w=s(l(e=>e.language)).notes,D=!!c(e=>e.token),[O,k]=(0,Q.useReducer)(_,Zt),[j,N]=(0,Q.useState)(!1),[P,ee]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(0),[R,z]=(0,Q.useState)(()=>nn(x)),[ae,B]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(!1),[G,le]=(0,Q.useState)(!1),[ue,de]=(0,Q.useState)(null),[q,ge]=(0,Q.useState)(null),ve=(0,Q.useRef)(null),ye=(0,Q.useRef)(null),[Se]=(0,Q.useState)(()=>Date.now()),J=a(),Ce=(0,Q.useCallback)(e=>{let t=ve.current?.clientWidth??window.innerWidth,n=Math.max(Qt,t-tn);return Math.max(Qt,Math.min(Math.min(en,n),e))},[]),we=(0,Q.useCallback)(e=>{let t=Ce(e);z(t),rn(x,t)},[Ce,x]);(0,Q.useLayoutEffect)(()=>{z(e=>Ce(e))},[Ce]);let{data:Te,mutate:Y,isLoading:Ee}=d((0,Q.useMemo)(()=>D?[`notes-list`,u,O.statusFilter,O.kindFilter,O.pinnedOnly]:null,[D,u,O.statusFilter,O.kindFilter,O.pinnedOnly]),()=>Ie({status:O.statusFilter===`all`?void 0:O.statusFilter,kind:O.kindFilter===`all`?void 0:O.kindFilter,projectId:u,pinned:O.pinnedOnly?!0:void 0,limit:100,sortBy:`createdAt`,sortOrder:`desc`}),{keepPreviousData:!0}),De=Ee&&!Te,Oe=Te?.items??[],ke=Te?.total??0,Ae=P.trim(),{data:je,isLoading:Me}=d(D&&j&&Ae?[`notes-search`,u,Ae]:null,()=>Ie({search:Ae,projectId:u,limit:30,sortBy:`updatedAt`,sortOrder:`desc`})),X=je?.items??[],Pe=e?Oe.some(t=>t.id===e):!0;(0,Q.useEffect)(()=>{L(0)},[Ae]),(0,Q.useEffect)(()=>{I>=X.length&&L(Math.max(0,X.length-1))},[I,X.length]),(0,Q.useEffect)(()=>{let e=()=>{Y()};return window.addEventListener(`note-updated`,e),()=>window.removeEventListener(`note-updated`,e)},[Y]);let Fe=oe(e=>e.setPageHeader),Le=oe(e=>e.clearPageHeader),Re=ke>0?w.noteCount.replace(`{{count}}`,String(ke)):null,ze=w.searchDialogTitle,Be=w.searchClose,Ve=w.searchClear,Ue=(0,Q.useMemo)(()=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:o(`inline-flex h-9 items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,E),"aria-label":ze,children:[(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:ze})]}),[ze]);(0,Q.useLayoutEffect)(()=>{if(n)return D?(Fe({startExtra:null,main:(0,$.jsxs)(`div`,{className:o(`flex min-w-0 items-center gap-2`,E),children:[(0,$.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,children:f??w.title}),Re?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:Re}):null]}),end:Ue}),()=>Le()):(Le(),()=>Le())},[Le,D,Ue,f,n,w.title,Re,e,Fe]);let Ge=(0,Q.useMemo)(()=>({justNow:w.justNow,minutesAgo:w.minutesAgo,today:w.today,yesterday:w.yesterday,daysAgo:w.daysAgo}),[w.justNow,w.minutesAgo,w.today,w.yesterday,w.daysAgo]),Ke=(0,Q.useMemo)(()=>[{id:`recent`,label:w.viewRecent,description:w.viewRecentDescription,icon:me,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!1}},{id:`inbox`,label:w.filterInbox,description:w.viewInboxDescription,icon:We,patch:{statusFilter:`inbox`,kindFilter:`all`,pinnedOnly:!1}},{id:`pinned`,label:w.pinned,description:w.viewPinnedDescription,icon:S,patch:{statusFilter:`all`,kindFilter:`all`,pinnedOnly:!0}},{id:`tasks`,label:w.viewTasks,description:w.viewTasksDescription,icon:m,patch:{statusFilter:`all`,kindFilter:`todo`,pinnedOnly:!1}},{id:`voice`,label:w.kindVoice,description:w.viewVoiceDescription,icon:v,patch:{statusFilter:`all`,kindFilter:`voice`,pinnedOnly:!1}},{id:`media`,label:w.kindMedia,description:w.viewMediaDescription,icon:xe,patch:{statusFilter:`all`,kindFilter:`media`,pinnedOnly:!1}},{id:`bookmarks`,label:w.kindBookmark,description:w.viewBookmarksDescription,icon:_e,patch:{statusFilter:`all`,kindFilter:`bookmark`,pinnedOnly:!1}},{id:`processed`,label:w.filterProcessed,description:w.viewProcessedDescription,icon:Ne,patch:{statusFilter:`processed`,kindFilter:`all`,pinnedOnly:!1}},{id:`archive`,label:w.filterArchived,description:w.viewArchiveDescription,icon:re,patch:{statusFilter:`archived`,kindFilter:`all`,pinnedOnly:!1}}],[w.filterArchived,w.filterInbox,w.filterProcessed,w.kindBookmark,w.kindMedia,w.kindVoice,w.pinned,w.viewArchiveDescription,w.viewBookmarksDescription,w.viewInboxDescription,w.viewMediaDescription,w.viewPinnedDescription,w.viewProcessedDescription,w.viewRecent,w.viewRecentDescription,w.viewTasks,w.viewTasksDescription,w.viewVoiceDescription]),qe=Ke.find(e=>sn(O,e))??Ke[0],Je=f??qe.label,Z=p??qe.description,Xe=(0,Q.useCallback)(async(e,n)=>{let r=u?await y({markdown:e,kind:`thought`,projectId:u,channel:`web`}):await pe(e,`web`);await Y(),n?.navigate!==!1&&J(cn(t,r.id))},[t,Y,J,u]),Ze=(0,Q.useCallback)(async()=>{if(!G){le(!0),de(null);try{let e=await y({markdown:``,kind:`thought`,projectId:u,channel:`web`});k({type:`patch`,patch:Zt}),await Y(),ge(e.id),J(cn(t,e.id))}catch(e){de(`${w.createBlankFailed}: ${e instanceof Error?e.message:w.createBlankFailedHint}`)}finally{le(!1)}}},[t,G,Y,w.createBlankFailed,w.createBlankFailedHint,J,u]),Qe=(0,Q.useCallback)(()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`image/*`,e.onchange=async()=>{let t=e.files?.[0];if(t)try{de(null),await fe(t,`web`),await Y()}catch(e){de(`${w.imageUploadFailed}: ${e instanceof Error?e.message:w.imageUploadFailedHint}`)}},e.click()},[Y,w.imageUploadFailed,w.imageUploadFailedHint]),$e=(0,Q.useCallback)(async(e,t)=>{try{de(null),await he(e,t,`web`),await Y()}catch(e){de(`${w.voiceUploadFailed}: ${e instanceof Error?e.message:w.voiceUploadFailedHint}`)}},[Y,w.voiceUploadFailed,w.voiceUploadFailedHint]),et=(0,Q.useCallback)(async(e,t)=>{await He(e,{pinned:t}),await Y()},[Y]),tt=(0,Q.useCallback)(async e=>{await He(e,{status:`archived`}),await Y()},[Y]),nt=(0,Q.useCallback)(async e=>{await se(e),await Y()},[Y]),rt=(0,Q.useCallback)(e=>{J(cn(t,e))},[t,J]),it=(0,Q.useCallback)(e=>{J(cn(t,e)),N(!1)},[t,J]),ct=(0,Q.useCallback)(e=>{if(X.length){if(e.key===`ArrowDown`)e.preventDefault(),L(e=>Math.min(X.length-1,e+1));else if(e.key===`ArrowUp`)e.preventDefault(),L(e=>Math.max(0,e-1));else if(e.key===`Enter`){e.preventDefault();let t=X[I]??X[0];t&&it(t.id)}}},[I,it,X]),lt=(0,Q.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=ye.current;t.setPointerCapture(e.pointerId),B(!0);let r=ve.current?.clientWidth??window.innerWidth,i=Math.max(Qt,r-tn),a=Math.min(en,i),o=e=>Math.max(Qt,Math.min(a,e)),s=e.clientX,c=o(R),l=e.pointerId,u=0,d=c,f=c;n&&(n.style.transition=`none`,n.style.width=`${c}px`);let p=()=>{u=0,f=d,n&&(n.style.width=`${f}px`)},m=e=>{d=o(c+e.clientX-s),u===0&&(u=window.requestAnimationFrame(p))},h=()=>{u!==0&&(window.cancelAnimationFrame(u),p());try{t.releasePointerCapture(l)}catch{}B(!1),ve.current?.style.setProperty(`--notes-list-width`,`${f}px`),n&&(n.style.removeProperty(`transition`),n.style.removeProperty(`width`)),z(f),rn(x,f),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,h),window.removeEventListener(`pointercancel`,h)};window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,h),window.addEventListener(`pointercancel`,h)},[x,R]);(0,Q.useEffect)(()=>{let e=e=>{e.defaultPrevented||e.repeat||e.key.toLowerCase()!==`n`||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||(e.preventDefault(),Ze())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ze]);let ut=(0,Q.useCallback)(e=>{e.key===`ArrowLeft`?(e.preventDefault(),we(R-16)):e.key===`ArrowRight`?(e.preventDefault(),we(R+16)):e.key===`Home`?(e.preventDefault(),we(Qt)):e.key===`End`&&(e.preventDefault(),we(en))},[we,R]);return D?(0,$.jsxs)(`div`,{ref:ve,className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-base`,style:{"--notes-list-width":`${R}px`},children:[(0,$.jsxs)(`section`,{ref:ye,className:o(`relative flex min-h-0 w-full shrink-0 flex-col overflow-hidden border-r border-edge bg-surface-rail`,!ae&&`lg:transition-[width] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`lg:w-0 lg:min-w-0 lg:max-w-0 lg:pointer-events-none`:`lg:w-[var(--notes-list-width)]`,e&&`hidden lg:flex`),"aria-hidden":U?!0:void 0,children:[(0,$.jsxs)(`div`,{className:`shrink-0 border-b border-edge-subtle p-3`,children:[ue?(0,$.jsx)(`p`,{className:`mb-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:ue}):null,(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[r?(0,$.jsx)(K,{value:qe.id,onChange:e=>{let t=Ke.find(t=>t.id===e.target.value);t&&k({type:`patch`,patch:t.patch})},className:`-ml-1 block max-w-44 truncate rounded-lg border border-transparent bg-transparent px-1 py-0.5 text-sm font-semibold text-fg transition-colors hover:border-edge hover:bg-surface-base focus:border-accent focus:bg-surface-base focus:outline-none focus:ring-1 focus:ring-accent`,"aria-label":w.libraryTitle,children:Ke.map(e=>(0,$.jsx)(ie,{value:e.id,children:e.label},e.id))}):(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:Je}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:Re??Z})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`hidden size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":w.collapseNotesList,title:w.collapseNotesList,children:(0,$.jsx)(ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:Ze,disabled:G,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":w.createBlankNote,title:w.createBlankShortcut,children:(0,$.jsx)(H,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":w.searchDialogTitle,children:(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0})})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 py-3 [scrollbar-gutter:stable]`,children:De?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3,4].map(e=>(0,$.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-hover`},e))}):Oe.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-[min(40vh,20rem)] flex-col items-center justify-center gap-2 px-6 py-16 text-center`,children:[(0,$.jsx)(F,{className:`size-8 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:e&&!Pe?w.noteOutsideCurrentView:h??w.noNotes}),e&&!Pe?null:(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:g??w.noNotesDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&!Pe?(0,$.jsx)(`div`,{className:`mb-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:w.noteOutsideCurrentView}):null,Oe.map((t,n)=>{let r=n>0?st(Oe[n-1].createdAt):null;return(0,$.jsxs)(`div`,{children:[st(t.createdAt)!==r&&(0,$.jsx)(`div`,{className:o(`px-3 pb-1.5 pt-2 text-xs font-medium text-fg-muted`,n===0&&`pt-0`),children:ot(t.createdAt,Se,Ge)}),(0,$.jsx)(pt,{note:t,selected:t.id===e,onPress:rt,onPin:et,onArchive:tt,onDelete:nt,timeLabels:Ge,labels:{pin:w.pin,unpin:w.unpin,archive:w.archive,delete:w.delete,imageNote:w.imageNote,noText:w.noText}})]},t.id)})]})}),(0,$.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,$.jsx)(Xt,{placeholder:w.quickCapturePlaceholder,sendLabel:w.send,onCapture:Xe,onImagePick:i?Qe:void 0,onVoiceCapture:i?$e:void 0,recordingLabel:w.recording,discussionCaptureLabel:w.discussionCapture.title,onDiscussionCapture:()=>A(u)})})]}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":w.resizeNotesList,"aria-valuemin":Qt,"aria-valuemax":en,"aria-valuenow":Math.round(R),tabIndex:0,onPointerDown:lt,onDoubleClick:()=>we($t),onKeyDown:ut,title:w.resizeNotesList,className:o(`group relative z-10 hidden shrink-0 cursor-col-resize touch-none select-none items-center justify-center bg-surface-base lg:flex`,`lg:transition-[width,opacity] lg:duration-[280ms] lg:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:lg:transition-none`,U?`lg:w-0 lg:opacity-0 lg:pointer-events-none`:`lg:w-2 lg:opacity-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-0`),children:(0,$.jsx)(`span`,{"aria-hidden":!0,className:o(`h-full w-px bg-edge transition-[background-color,transform] duration-150`,`group-hover:bg-accent/70 group-focus-visible:bg-accent`,ae&&`bg-accent scale-x-[2]`)})}),(0,$.jsxs)(`section`,{className:o(`relative min-w-0 flex-1 bg-surface-base`,!e&&`hidden lg:flex`),children:[U?(0,$.jsx)(`button`,{type:`button`,onClick:()=>W(!1),className:`absolute left-3 top-3 z-10 hidden size-8 items-center justify-center rounded-lg border border-edge bg-surface-base text-fg-muted shadow-surface transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent lg:inline-flex`,"aria-label":w.expandNotesList,title:w.expandNotesList,children:(0,$.jsx)(ne,{className:`size-4`,strokeWidth:1.5,"aria-hidden":!0})}):null,e?(0,$.jsx)(Gt,{noteId:e,onBack:()=>J(t),onSaved:()=>void Y(),backButtonClassName:`lg:hidden`,clearHeaderOnCleanup:!1,onOpenSearch:()=>N(!0),autoFocus:e===q,onAutoFocusConsumed:()=>ge(null)}):(0,$.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 items-center justify-center px-8 text-center`,children:(0,$.jsxs)(`div`,{className:`max-w-sm`,children:[(0,$.jsx)(F,{className:`mx-auto size-9 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-4 text-base font-semibold text-fg`,children:w.emptyEditorTitle}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:w.emptyEditorDescription}),(0,$.jsxs)(`button`,{type:`button`,onClick:Ze,disabled:G,className:`mt-5 inline-flex items-center gap-2 rounded-lg bg-accent px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,$.jsx)(H,{className:`size-4`,"aria-hidden":!0}),G?w.creatingBlankNote:w.createBlankNote]})]})})]}),(0,$.jsx)(T,{open:j,onOpenChange:N,children:(0,$.jsxs)(b,{children:[(0,$.jsx)(Ye,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(te,{className:`fixed left-1/2 top-24 z-[90] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(ce,{className:`text-sm font-semibold text-fg`,children:ze}),(0,$.jsx)(V,{className:`sr-only`,children:w.searchPlaceholder}),(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":Be,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`div`,{className:`p-4`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(be,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`input`,{type:`search`,value:P,onChange:e=>ee(e.target.value),onKeyDown:ct,placeholder:w.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-10 text-sm text-fg placeholder:text-fg-muted focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent`}),P?(0,$.jsx)(`button`,{type:`button`,onClick:()=>ee(``),className:`absolute right-2 top-1/2 inline-flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Ve,children:(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,$.jsx)(`div`,{className:`mt-4 max-h-[min(28rem,calc(100vh-14rem))] overflow-y-auto [scrollbar-gutter:stable]`,children:Ae?Me&&!je?(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:[1,2,3].map(e=>(0,$.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-surface-hover`},e))}):X.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(F,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:w.searchNoResults}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:w.searchNoResultsDescription})]}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`p`,{className:`px-2 pb-1 text-xs text-fg-muted`,children:w.searchResultsCount.replace(`{{count}}`,String(je?.total??X.length))}),X.map((e,t)=>{let n=an[e.kind]||F,r=on(e,{imageNote:w.imageNote,noText:w.noText});return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),onMouseEnter:()=>L(t),className:o(`flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors`,t===I?`bg-surface-active`:`hover:bg-surface-hover`),children:[(0,$.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title||r}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:at(e.updatedAt,Se,Ge)})]}),e.title?(0,$.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:r}):null,e.tags?.length?(0,$.jsx)(`span`,{className:`mt-1 flex min-w-0 flex-wrap gap-1`,children:e.tags.slice(0,3).map(e=>(0,$.jsx)(`span`,{className:`max-w-24 truncate rounded-md bg-surface-hover px-1.5 py-0.5 text-xs text-fg-muted`,children:e},e))}):null]})]},e.id)})]}):(0,$.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,$.jsx)(be,{className:`size-7 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:w.searchEmptyTitle}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:w.searchEmptyDescription})]})})]})]})]})})]}):(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(F,{className:`size-10 text-fg-muted`}),(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:w.needToken})]})}export{Ze as n,ln 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,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DQ5X6cXp.js";import{n as f,r as p,s as m}from"./locale-store-Bjvw7jtg.js";import{$c as h,Aa as g,Ac as _,Ai as v,Bi as y,Bo as b,Ca as x,Dc as S,Di as C,Ds as w,Ec as T,Ei as E,Es as D,Et as O,Fi as k,Fo as A,Fs as j,Hc as M,Ii as N,Io as ee,Kl as P,Li as F,Ll as te,Lo as I,Ls as L,Mu as R,Na as z,Ni as B,Nn as ne,On as re,Pi as ie,Pt as V,Qo as H,Ri as ae,Ro as U,Sa as oe,Sc as se,Sl as W,Tl as G,Ua as ce,Vl as K,Vo as le,Vs as ue,Wl as de,Xl as fe,Zo as pe,_a as me,_r as he,ai as ge,al as _e,ba as ve,ca as ye,cs as be,cu as xe,da as Se,dc as Ce,du as we,ec as Te,fa as Ee,fc as De,fu as Oe,ga as ke,gt as Ae,ha as je,hl as Me,ht as Ne,il as Pe,jc as Fe,ji as Ie,jl as Le,kl as Re,ku as ze,l as Be,la as Ve,ls as He,ma as Ue,mc as We,ml as Ge,mu as Ke,os as qe,pa as Je,pu as Ye,qs as Xe,rt as Ze,sc as Qe,ss as $e,su as et,ua as tt,us as nt,uu as rt,va as it,wa as at,wc as ot,wl as st,wr as ct,ws as q,xa as lt,ya as ut,yt as dt,zi as ft,zo as pt}from"./index-BzPwnXho.js";import{t as mt}from"./notes-workbench-epHGeKd5.js";import{n as ht,t as gt}from"./use-autosave-BLc4gfG0.js";import{t as _t}from"./page-tabs-HXweXqYE.js";import{t as vt}from"./directory-picker-path-field-DUUr9sq0.js";import{i as yt,p as bt,s as xt}from"./skills-page.utils-CnbJncdL.js";import{t as St}from"./dependency-picker-BvYqHRz0.js";import{c as Ct,l as wt,n as Tt,o as Et,r as Dt,t as Ot}from"./style-TIDOdKy0.js";var J=e(t(),1),kt=n();function At(e){return m(p(`/api/projects/${encodeURIComponent(e)}/skills`))}function jt(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Mt(e,t){let n=new FormData;return n.set(`file`,t),m(p(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Nt(e,t,n={}){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Pt(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function Ft(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var Y=r();function It({projectId:e,copy:t}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!0),[c,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(1),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(!1),[k,j]=(0,J.useState)(``),[M,N]=(0,J.useState)(``),P=(0,J.useRef)(null),F=(0,J.useCallback)(async()=>{s(!0),m(``);try{let t=await At(e);r(t.items),a(t.skillsRoot)}catch(e){m(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,J.useEffect)(()=>{F()},[F]),(0,J.useEffect)(()=>{if(h!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{O(!0),j(``),bt({q:y,page:S,pageSize:8,sort:`downloads`,signal:e.signal}).then(E).catch(t=>{e.signal.aborted||j(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||O(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[h,S,y]);async function B(e,t){u(!0),f(t??null),m(``);try{await e(),g(null),N(``),await F()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1),f(null)}}async function ne(t){m(``);try{v((await jt(e,t)).skill)}catch(e){m(e instanceof Error?e.message:String(e))}}async function re(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await Ft(e,n.id),await F()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,Y.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,Y.jsxs)(He,{children:[(0,Y.jsx)(nt,{asChild:!0,children:(0,Y.jsxs)(q,{type:`button`,children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),t.add,(0,Y.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,Y.jsx)(be,{children:(0,Y.jsxs)($e,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,Y.jsx)(Lt,{icon:Xe,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>g(`marketplace`)}),(0,Y.jsx)(Lt,{icon:W,title:t.source,hint:t.sourceHint,onClick:()=>g(`source`)}),(0,Y.jsx)(Lt,{icon:L,title:t.upload,hint:t.uploadHint,onClick:()=>P.current?.click()})]})})]}),(0,Y.jsx)(`input`,{ref:P,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&B(()=>Mt(e,n)),t.target.value=``}})]}),i?(0,Y.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),p?(0,Y.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:p}):null,o?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,Y.jsx)(z,{className:`h-36 rounded-lg`},e))}):n.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,Y.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(R,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void ne(e.id),children:[(0,Y.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void re(e),children:[(0,Y.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,Y.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,Y.jsx)(A,{open:h!==null,onOpenChange:e=>{e||g(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(I,{className:l(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,h===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:h===`marketplace`?t.marketplace:t.source}),(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(w,{className:`size-4`})})})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:h===`marketplace`?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,Y.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Y.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:y,onChange:e=>{x(e.target.value),C(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),k?(0,Y.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:k}):null,D&&!T?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,Y.jsx)(z,{className:`h-32 rounded-lg`},e))}):T?.items.length?(0,Y.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:T.items.map(r=>{let i=r.providerId??T.provider,a=yt(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=d===a;return(0,Y.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(xt,{name:r.name,className:`size-10`}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,Y.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,Y.jsx)(q,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void B(()=>Nt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):D?null:(0,Y.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),T&&T.meta.totalPages>1?(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(T.meta.page)).replace(`{{total}}`,String(T.meta.totalPages))}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:D||S<=1,onClick:()=>C(e=>Math.max(1,e-1)),children:[(0,Y.jsx)(Oe,{className:`size-4`}),t.marketplacePrevious]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:D||S>=T.meta.totalPages,onClick:()=>C(e=>e+1),children:[t.marketplaceNext,(0,Y.jsx)(we,{className:`size-4`})]})]})]}):null]}):(0,Y.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,Y.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:M,onChange:e=>N(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,Y.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`secondary`,children:t.close})}),(0,Y.jsx)(q,{type:`button`,disabled:c||!M.trim(),onClick:()=>void B(()=>Pt(e,M.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,Y.jsx)(A,{open:!!_,onOpenChange:e=>{e||v(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-50 bg-black/45`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:_?.name}),(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,Y.jsx)(w,{className:`size-4`})})})]}),(0,Y.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:_?.bodyMarkdown})]})]})})]})}function Lt(e){let t=(0,kt.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,Y.jsx)(qe,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var Rt=[`ready`,`moving`,`waiting`,`needs_user`,`done`];function zt(e){return{ready:e.filter(e=>e.lane===`ready`),moving:e.filter(e=>e.lane===`moving`),waiting:e.filter(e=>e.lane===`waiting`),needs_user:e.filter(e=>e.lane===`needs_user`),done:e.filter(e=>e.lane===`done`)}}function Bt(e,t){if(t===`ready`&&e.allowedCommands.includes(`add_wait`))return`pause`;if(t===`moving`&&e.allowedCommands.includes(`start`))return`run`;if(t===`moving`&&e.allowedCommands.includes(`resolve_wait`))return`resume`;if(t===`done`&&e.allowedCommands.includes(`request_review`))return`verify`}function Vt(e){if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`request_review`))return`verify`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Ht(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Ut(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Ht(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Wt(e,t){let{incoming:n}=Ht(t),r=new Set(e.filter(e=>e.lane===`waiting`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Gt(e,t){let{incoming:n,outgoing:r}=Ht(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var Kt={ready:`border-edge`,moving:`border-accent ring-2 ring-accent/15`,waiting:`border-violet-400/70`,needs_user:`border-amber-400/80`,done:`border-emerald-400/60`};function qt(e){let t=(0,kt.c)(25),{data:n,selected:r}=e,i=n.task,a=i.lane===`waiting`,o=Kt[i.lane],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,u;t[0]!==o||t[1]!==s||t[2]!==c?(u=l(`w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(Dt,{type:`target`,position:wt.Left,className:`!invisible`}),t[4]=d):d=t[4];let f;t[5]===i.title?f=t[6]:(f=(0,Y.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=f);let p;t[7]===a?p=t[8]:(p=a?(0,Y.jsx)(Ge,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.laneLabel?h=t[13]:(h=(0,Y.jsx)(`span`,{children:n.laneLabel}),t[12]=n.laneLabel,t[13]=h);let g;t[14]!==a||t[15]!==i.blockedBy?(g=a&&i.blockedBy.length>0?(0,Y.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=g):g=t[16];let _;t[17]!==g||t[18]!==h?(_=(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[h,g]}),t[17]=g,t[18]=h,t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(Dt,{type:`source`,position:wt.Right,className:`!invisible`}),t[20]=v):v=t[20];let y;return t[21]!==_||t[22]!==u||t[23]!==m?(y=(0,Y.jsxs)(`div`,{className:u,children:[d,m,_,v]}),t[21]=_,t[22]=u,t[23]=m,t[24]=y):y=t[24],y}var Jt={taskNode:qt};function Yt(e){let t=(0,kt.c)(74),{tasks:n,dependencyEdges:r,returnTo:i,copy:a}=e,[o,c]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),m=(0,J.useRef)(null),h;t[0]!==r||t[1]!==n?(h=Wt(n,r),t[0]=r,t[1]=n,t[2]=h):h=t[2];let g=h,_;t[3]!==g||t[4]!==u||t[5]!==o||t[6]!==n?(_=u?n.filter(e=>g.has(e.id)):o?n:n.filter(tn),t[3]=g,t[4]=u,t[5]=o,t[6]=n,t[7]=_):_=t[7];let v=_,y;t[8]===v?y=t[9]:(y=new Set(v.map(en)),t[8]=v,t[9]=y);let b=y,x;if(t[10]!==r||t[11]!==b){let e;t[13]===b?e=t[14]:(e=e=>b.has(e.dependencyTaskId)&&b.has(e.dependentTaskId),t[13]=b,t[14]=e),x=r.filter(e),t[10]=r,t[11]=b,t[12]=x}else x=t[12];let S=x,C;t[15]!==S||t[16]!==v?(C=Ut(v,S),t[15]=S,t[16]=v,t[17]=C):C=t[17];let w=C,T;t[18]!==f||t[19]!==S?(T=f?Gt(f,S):void 0,t[18]=f,t[19]=S,t[20]=T):T=t[20];let E=T,D;t[21]===f?D=t[22]:(D=e=>e.id===f,t[21]=f,t[22]=D);let O=v.find(D),k;t[23]===v?k=t[24]:(k=new Map(v.map($t)),t[23]=v,t[24]=k);let A=k,j;if(t[25]!==a.lanes||t[26]!==w||t[27]!==E||t[28]!==v){let e;t[30]!==a.lanes||t[31]!==w||t[32]!==E?(e=e=>({id:e.id,type:`taskNode`,position:w.get(e.id)??{x:0,y:0},data:{task:e,laneLabel:a.lanes[e.lane],dimmed:!!(E&&!E.has(e.id))}}),t[30]=a.lanes,t[31]=w,t[32]=E,t[33]=e):e=t[33],j=v.map(e),t[25]=a.lanes,t[26]=w,t[27]=E,t[28]=v,t[29]=j}else j=t[29];let M=j,N;if(t[34]!==E||t[35]!==A||t[36]!==S){let e;t[38]!==E||t[39]!==A?(e=e=>{let t=A.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(E&&(!E.has(e.dependencyTaskId)||!E.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:Ct.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=E,t[39]=A,t[40]=e):e=t[40],N=S.map(e),t[34]=E,t[35]=A,t[36]=S,t[37]=N}else N=t[37];let ee=N,P,F;t[41]!==f||t[42]!==b?(P=()=>{f&&!b.has(f)&&p(void 0)},F=[f,b],t[41]=f,t[42]=b,t[43]=P,t[44]=F):(P=t[43],F=t[44]),(0,J.useEffect)(P,F);let I;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=window.requestAnimationFrame(()=>{m.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[45]=I):I=t[45];let L;t[46]!==u||t[47]!==o||t[48]!==v.length?(L=[u,o,v.length],t[46]=u,t[47]=o,t[48]=v.length,t[49]=L):L=t[49],(0,J.useEffect)(I,L);let R;t[50]===f?R=t[51]:(R=()=>{f&&m.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[50]=f,t[51]=R);let z=R,B;t[52]===a.hint?B=t[53]:(B=(0,Y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.hint}),t[52]=a.hint,t[53]=B);let ne=u?`secondary`:`ghost`,ie;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>d(Qt),t[54]=ie):ie=t[54];let V=u?a.allTasks:a.blockedChains,H;t[55]!==u||t[56]!==ne||t[57]!==V?(H=(0,Y.jsx)(q,{type:`button`,variant:ne,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:ie,children:V}),t[55]=u,t[56]=ne,t[57]=V,t[58]=H):H=t[58];let ae;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>c(Zt),t[59]=ae):ae=t[59];let U=o?a.hideCompleted:a.showCompleted,oe;t[60]!==u||t[61]!==o||t[62]!==U?(oe=(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":o,onClick:ae,disabled:u,children:U}),t[60]=u,t[61]=o,t[62]=U,t[63]=oe):oe=t[63];let se=O?(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:z,children:[(0,Y.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,W;t[64]!==H||t[65]!==oe||t[66]!==se?(W=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[H,oe,se]}),t[64]=H,t[65]=oe,t[66]=se,t[67]=W):W=t[67];let G;t[68]!==B||t[69]!==W?(G=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[B,W]}),t[68]=B,t[69]=W,t[70]=G):G=t[70];let ce=v.length>0?(0,Y.jsxs)(`div`,{className:l(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,O&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,Y.jsxs)(Et,{nodes:M,edges:ee,nodeTypes:Jt,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onPaneClick:()=>p(void 0),onInit:e=>{m.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(Ot,{color:`var(--color-edge)`,gap:22,size:1}),(0,Y.jsx)(Tt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),O?(0,Y.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.lanes[O.lane]}),(0,Y.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:O.title}),O.lane===`waiting`&&O.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(O.blockedBy.length))}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:O.blockedBy.map(Xt)})]}):null,(0,Y.jsxs)(s,{to:re(i,O.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,Y.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,Y.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),K;return t[71]!==G||t[72]!==ce?(K=(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[G,ce]}),t[71]=G,t[72]=ce,t[73]=K):K=t[73],K}function Xt(e){return(0,Y.jsx)(`li`,{children:e.title},e.id)}function Zt(e){return!e}function Qt(e){return!e}function $t(e){return[e.id,e]}function en(e){return e.id}function tn(e){return e.phase!==`closed`}var nn={ready:et,moving:h,waiting:Ge,needs_user:j,done:xe},rn={ready:`text-fg-muted`,moving:`text-accent-fg`,waiting:`text-violet-700 dark:text-violet-300`,needs_user:`text-amber-700 dark:text-amber-300`,done:`text-emerald-700 dark:text-emerald-300`};function an(e){let t=(0,kt.c)(57),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c}=e,u;t[0]===n?u=t[1]:(u=Vt(n),t[0]=n,t[1]=u);let d=u,f=!!d,p;t[2]!==c||t[3]!==n.id?(p=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=p):p=t[4];let m;t[5]===c?m=t[6]:(m=()=>c(``),t[5]=c,t[6]=m);let h;t[7]!==r||t[8]!==n.id?(h=re(r,n.id),t[7]=r,t[8]=n.id,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,Y.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==i||t[13]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[12]=i,t[13]=n.priority,t[14]=_):_=t[14];let v;t[15]!==g||t[16]!==_?(v=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.attention[0]?y=t[19]:(y=n.attention[0]?(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[18]=n.attention[0],t[19]=y);let b;t[20]!==i||t[21]!==n.blockedBy||t[22]!==n.lane?(b=n.lane===`waiting`&&n.blockedBy.length>0?(0,Y.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,Y.jsx)(Ge,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(X).join(`、`)})]}):null,t[20]=i,t[21]=n.blockedBy,t[22]=n.lane,t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==n.latestVerification?(x=n.latestVerification?(0,Y.jsx)(`span`,{className:l(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[24]=i,t[25]=n.latestVerification,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.acceptanceCriteriaCount?(S=n.acceptanceCriteriaCount>0?(0,Y.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[27]=i,t[28]=n.acceptanceCriteriaCount,t[29]=S):S=t[29];let C;t[30]===n.dueAt?C=t[31]:(C=n.dueAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(Ke,{className:`size-3`,"aria-hidden":!0}),Ze(new Date(n.dueAt))]}):null,t[30]=n.dueAt,t[31]=C);let w;t[32]===n.nextCheckAt?w=t[33]:(w=n.nextCheckAt?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,Y.jsx)(Ke,{className:`size-3`,"aria-hidden":!0}),Ze(new Date(n.nextCheckAt))]}):null,t[32]=n.nextCheckAt,t[33]=w);let T;t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[x,S,C,w]}),t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;t[39]!==b||t[40]!==T||t[41]!==h||t[42]!==v||t[43]!==y?(E=(0,Y.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[v,y,b,T]}),t[39]=b,t[40]=T,t[41]=h,t[42]=v,t[43]=y,t[44]=E):E=t[44];let D;t[45]!==a||t[46]!==i||t[47]!==o||t[48]!==d||t[49]!==n?(D=d?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`verify`&&n.allowedCommands.includes(`request_review`)?(0,Y.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`verify`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.verify}):null]}):null,t[45]=a,t[46]=i,t[47]=o,t[48]=d,t[49]=n,t[50]=D):D=t[50];let O;return t[51]!==E||t[52]!==D||t[53]!==f||t[54]!==p||t[55]!==m?(O=(0,Y.jsxs)(`article`,{draggable:f,onDragStart:p,onDragEnd:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[E,D]}),t[51]=E,t[52]=D,t[53]=f,t[54]=p,t[55]=m,t[56]=O):O=t[56],O}function X(e){return e.title}function on({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onCreate:a,actionBusyId:o,ref:s}){let[c,u]=(0,J.useState)(null),[p,m]=(0,J.useState)(`board`),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(()=>crypto.randomUUID()),[y,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(`normal`),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)([]),[k,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(null),P=O({chat:d(f(e=>e.language)).chat}),F=zt(e),te=e.filter(e=>e.phase!==`closed`),L=(e,t)=>{i(e,t)},R=async e=>{e.preventDefault();let t=y.trim();if(!(!t||k)){j(!0),N(null);try{let e=w?new Date(`${w}T23:59:59.999`).getTime():void 0;await a({requestId:_,objective:t,priority:S,dependsOnTaskIds:E,attachments:P.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),x(``),C(`normal`),T(``),D([]),P.clearAttachments(),v(crypto.randomUUID()),g(!1)}catch(e){N(e instanceof Error?e.message:r.createFailed)}finally{j(!1)}}},z=()=>{v(crypto.randomUUID()),x(``),C(`normal`),T(``),D([]),P.clearAttachments(),N(null),g(!0)};return(0,J.useImperativeHandle)(s,()=>({openCreate:z})),(0,Y.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":p===`board`,onClick:()=>m(`board`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":p===`graph`,onClick:()=>m(`graph`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,Y.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})]}),p===`board`?(0,Y.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:Rt.map(t=>{let i=nn[t],a=F[t];return(0,Y.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===c);r&&Bt(r,t)&&n.preventDefault()},onDrop:n=>{n.preventDefault();let r=e.find(e=>e.id===c),i=r?Bt(r,t):void 0;u(null),r&&i&&L(r,i)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,Y.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,Y.jsxs)(`div`,{className:l(`flex items-center gap-2`,rn[t]),children:[(0,Y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.lanes[t]})]}),(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,Y.jsx)(an,{task:e,returnTo:n,copy:r,busy:o===e.id,onAction:L,onDragStart:u},e.id)):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:r.empty})})})]},t)})})}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(Yt,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,lanes:r.lanes}})}),(0,Y.jsx)(A,{open:h,onOpenChange:e=>{k||g(e)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,Y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void R(e),children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,Y.jsxs)(`div`,{className:l(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,P.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),k||P.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||P.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),P.setIsDragging(!1),k||P.processFiles(Array.from(e.dataTransfer.files))},children:[(0,Y.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:y,onChange:e=>{x(e.target.value),N(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:k}),(0,Y.jsx)(V,{attachments:P.attachments,topPadded:!1,onRemove:e=>{k||P.removeAttachment(e)}}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:k,onClick:()=>P.fileInputRef.current?.click(),children:[(0,Y.jsx)(Fe,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,Y.jsx)(`input`,{ref:P.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{P.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,Y.jsx)(pe,{value:S,onChange:e=>C(e.target.value),disabled:k,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,Y.jsx)(H,{value:e,children:r.priorityOptions[e]},e))})]}),(0,Y.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Y.jsx)(`input`,{type:`date`,className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:e=>T(e.target.value),disabled:k})]})]}),(0,Y.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,Y.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,Y.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,Y.jsx)(St,{candidates:te,selectedIds:E,disabled:k,onChange:D,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),M?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:M}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:k,children:r.cancel})}),(0,Y.jsx)(q,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:k||!y.trim(),children:k?r.creating:r.create})]})]})]})]})})]})}var sn=new Set([{id:`overview`,icon:_e},{id:`tasks`,icon:P},{id:`automations`,icon:D},{id:`files`,icon:st},{id:`notes`,icon:Le},{id:`skills`,icon:Te},{id:`sessions`,icon:M},{id:`progress`,icon:Me},{id:`settings`,icon:Qe}].map(e=>e.id)),cn=`xopc.projectFiles.panelWidthPx`,ln=320,un=220,dn=560;function fn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function pn(e){return Math.min(dn,Math.max(un,Math.round(e)))}function mn(){try{let e=window.localStorage.getItem(cn);if(e==null)return ln;let t=Number.parseInt(e,10);return Number.isFinite(t)?pn(t):ln}catch{return ln}}function hn(e){try{window.localStorage.setItem(cn,String(pn(e)))}catch{}}function gn(e){return!!(e&&sn.has(e))}function _n(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ze(n)}function yn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function bn(e){let t=(0,kt.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Y.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function xn(e=!1){return l(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Sn(e){let t=(0,kt.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,Y.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,Y.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Cn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function wn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Tn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function En(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Dn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function On(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function kn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function An(e){let t=e.sourceChannel?.trim();if(t)return jn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return jn(r||``)}function jn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Mn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Nn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Pn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Pn(e.children,t,n)}:e)}function Fn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,J.useState)(!1),[u,d]=(0,J.useState)([e]),[f,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),[x,S]=(0,J.useState)(`new`),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(``),[D,O]=(0,J.useState)(!1),[k,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(null),P=(0,J.useCallback)(async()=>{h(!0),_(null);try{let t=await it({limit:100});d(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,J.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,J.useEffect)(()=>{a&&P()},[P,a]);let F=(0,J.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Cn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>wn(t)-wn(e))},[e.id,u,f]),te=e=>t.statuses[e.status]??e.status,L=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,R=e=>{S(e),w(``),E(``),j(null),y(!0),s(!1)},z=(0,J.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?Tn(t):``);if(n){O(!0),j(null),N(null);try{let r=await Ve({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),E(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=En(e);t?(N(t),y(!1)):j(e instanceof Error?e.message:String(e))}finally{O(!1)}}},[x,C,i,T]),B=(0,J.useCallback)(e=>{e.preventDefault(),z()},[z]),ne=(0,J.useCallback)(()=>{z({createWorkspaceRoot:!0})},[z]),re=(0,J.useCallback)(()=>{N(null),y(!0)},[]),ie=e=>{E(e),x===`directory`&&!C.trim()&&w(Tn(e))},V=(e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:l(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,Y.jsx)(c,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:L(e)})]}),(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:te(e)})]},e.id);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(He,{open:a,onOpenChange:s,children:[(0,Y.jsx)(nt,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:te(e)})]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:L(e)})]}),(0,Y.jsx)(Ye,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,Y.jsx)(be,{children:(0,Y.jsxs)($e,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,Y.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),V(e,!0),(0,Y.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,Y.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&F.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&F.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,F.map(e=>V(e,!1))]}),(0,Y.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>R(`new`),children:[(0,Y.jsx)(se,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>R(`directory`),children:[(0,Y.jsx)(st,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,Y.jsx)(Qe,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,Y.jsx)(A,{open:v,onOpenChange:e=>!D&&y(e),children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,Y.jsxs)(`form`,{onSubmit:B,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[k?(0,Y.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:k}):null,(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,Y.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,Y.jsx)(vt,{value:T,onChange:ie,disabled:D,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,Y.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:D,children:n.cancel})}),(0,Y.jsxs)(q,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:D||!(C.trim()||x===`directory`&&Tn(T)),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,Y.jsx)(A,{open:!!M,onOpenChange:e=>{e||N(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?_n(n.workspaceMissingDescription,{workspace:M}):null})]}),M?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:M})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:D,children:n.workspaceMissingBack}),(0,Y.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:D,children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function In(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),p=f(e=>e.language),m=d(p),h=m.chat.workingDirectory,O=m.projectDetailPage,j=m.projectsPage,te=ce(e=>e.setPageHeader),L=ce(e=>e.clearPageHeader),[V,W]=(0,J.useState)(null),[K,be]=(0,J.useState)(null),[xe,we]=(0,J.useState)([]),[Oe,Pe]=(0,J.useState)(``),[Fe,Re]=(0,J.useState)([]),[Ve,He]=(0,J.useState)(!1),[Ge,Ke]=(0,J.useState)(null),[qe,Ye]=(0,J.useState)([]),[Xe,Ze]=(0,J.useState)(0),[$e,et]=(0,J.useState)(!1),[nt,it]=(0,J.useState)(!1),[yt,bt]=(0,J.useState)(!1),[xt,St]=(0,J.useState)([]),Ct=(0,J.useRef)(new Set),[wt,Tt]=(0,J.useState)(null),[Et,Dt]=(0,J.useState)(mn),[Ot,kt]=(0,J.useState)(!1),[At,jt]=(0,J.useState)(!1),[Mt,Nt]=(0,J.useState)(``),[Pt,Ft]=(0,J.useState)([]),[Lt,Rt]=(0,J.useState)(!1),[zt,Bt]=(0,J.useState)(null),[Vt,Ht]=(0,J.useState)(!1),[Ut,Wt]=(0,J.useState)(null),[Gt,Kt]=(0,J.useState)([]),[qt,Jt]=(0,J.useState)(``),[Yt,Xt]=(0,J.useState)(!0),[Zt,Qt]=(0,J.useState)(!1),[$t,en]=(0,J.useState)(!1),[tn,nn]=(0,J.useState)(null),[rn,an]=(0,J.useState)(!1),[X,sn]=(0,J.useState)(`fixed`),[cn,ln]=(0,J.useState)(``),[un,dn]=(0,J.useState)(null),[Cn,wn]=(0,J.useState)(!1),[Tn,jn]=(0,J.useState)(!1),[In,Ln]=(0,J.useState)(!1),[Rn,zn]=(0,J.useState)(null),Bn=(0,J.useRef)(null),Vn=(0,J.useRef)(!1),[Hn,Z]=(0,J.useState)(null),[Un,Wn]=(0,J.useState)({title:``,reason:``}),[Q,Gn]=(0,J.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Kn=(0,J.useRef)(Q),qn=`overview`,$=n?`notes`:gn(t)?t:qn,Jn=(0,J.useMemo)(()=>E(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Yn=(0,J.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Jn===`/projects`?n:C(n,Jn)},[Jn,e]),Xn=(0,J.useCallback)(t=>{e&&r(Yn(t))},[r,e,Yn]),Zn=(0,J.useCallback)(()=>{if($===`tasks`&&Bn.current){Bn.current.openCreate();return}Vn.current=!0,Xn(`tasks`)},[Xn,$]);(0,J.useEffect)(()=>{$!==`tasks`||!Vn.current||(Vn.current=!1,Bn.current?.openCreate())},[$]);let Qn=(0,J.useCallback)(t=>{e&&r(Yn(t),{replace:!0})},[r,e,Yn]),$n=(0,J.useCallback)((e,t)=>{Qn(e),r(t)},[r,Qn]),er=(0,J.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Qn(e)},[Qn]),tr=(0,J.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,J.useEffect)(()=>{!e||!t||gn(t)||r(Yn(qn),{replace:!0})},[qn,r,e,Yn,t]),(0,J.useEffect)(()=>{if(!e)return;let t=!1;return Xt(!0),Z(null),Promise.all([Je(e),ke(e),me(e),ct().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;W(e),be(n),we(r),Kt(i?.agents??[]),Jt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Kn.current=a,Gn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Xt(!1)}),()=>{t=!0}},[e]);let nr=(0,J.useCallback)(async()=>{e&&be(await ke(e))},[e]);(0,J.useEffect)(()=>{let t=t=>{t.detail?.projectId===e&&nr()};return window.addEventListener(`task-created-v2`,t),window.addEventListener(`task-commanded-v2`,t),window.addEventListener(`task-phase-changed-v2`,t),()=>{window.removeEventListener(`task-created-v2`,t),window.removeEventListener(`task-commanded-v2`,t),window.removeEventListener(`task-phase-changed-v2`,t)}},[e,nr]);let rr=(0,J.useCallback)(async(e,t)=>{zn(e.id),Z(null);try{let n=await dt(e.id),r=t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??`main`}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`verify`?{type:`request_review`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);await Ne(e.id,r,n.task.version),await nr()}catch(e){Z(e instanceof Error?e.message:O.board.actionFailed)}finally{zn(null)}},[K,O.board.actionFailed,nr]),ir=(0,J.useCallback)(async t=>{e&&(Z(null),await Ae({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:p,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await nr())},[p,e,nr]),ar=(0,J.useCallback)(async()=>{if(V){He(!0),Z(null);try{Re((await Be.list({projectId:V.id})).automations)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{He(!1)}}},[V]);(0,J.useEffect)(()=>{$===`automations`&&ar()},[ar,$]);let or=(0,J.useCallback)(async()=>{if(V){et(!0),Z(null);try{let e=await Ue(V.id,{includeRelated:nt,limit:100});Ye(e.items),Ze(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{et(!1)}}},[V,nt]);(0,J.useEffect)(()=>{$===`progress`&&or()},[or,$]);let sr=(0,J.useCallback)(async e=>{Ke(`toggle:${e.id}`),Z(null);try{e.enabled?await Be.pause(e.id):await Be.resume(e.id),await ar()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ke(null)}},[ar]),cr=(0,J.useCallback)(async()=>{if(!V?.effectiveWorkspaceRoot?.trim()){St([]),Ct.current.clear(),Wt(null);return}Ht(!0),Wt(null),Ct.current.clear();try{St(Nn((await je(V.id,``)).entries)),Ct.current.add(``)}catch(e){St([]),Ct.current.clear(),Wt(e instanceof Error?e.message:String(e))}finally{Ht(!1)}},[V]),lr=(0,J.useCallback)(async e=>{if(!(!V?.effectiveWorkspaceRoot?.trim()||Ct.current.has(e))){Ct.current.add(e),Wt(null);try{let t=await je(V.id,e);St(n=>Pn(n,e,Nn(t.entries)))}catch(t){Ct.current.delete(e),Wt(t instanceof Error?t.message:String(t))}}},[V]);(0,J.useEffect)(()=>{$===`files`&&cr()},[cr,$]);let ur=Mt.trim();(0,J.useEffect)(()=>{if($!==`files`||!V||!At||!ur){Ft([]),Rt(!1),Bt(null);return}let e=!1;Rt(!0),Bt(null),Ft([]);let t=window.setTimeout(()=>{oe(V.id,ur,50).then(t=>{e||Ft(t)}).catch(t=>{e||Bt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Rt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[ur,V,At,$]);let dr=(0,J.useCallback)(async()=>{if(V){jn(!0),Z(null);try{let e=await Se(V.id);$n(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{jn(!1)}}},[$n,V]),fr=(0,J.useCallback)(async()=>{if(!V)return;let[e,t]=await Promise.all([Je(V.id),ke(V.id)]);be(t),W(e)},[V]),pr=(0,J.useCallback)(async e=>{if(e.preventDefault(),!(!V||!Un.title.trim())){Ln(!0),Z(null);try{await tt(V.id,{title:Un.title.trim(),reason:Un.reason.trim()||void 0}),Wn({title:``,reason:``}),await fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ln(!1)}}},[Un.reason,Un.title,V,fr]),mr=(0,J.useMemo)(()=>(0,Y.jsx)(s,{to:Jn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Jn===`/projects`?O.backToProjects:m.sidebar.back,children:(0,Y.jsx)(ze,{className:`size-4`,"aria-hidden":!0})}),[Jn,m.sidebar.back,O.backToProjects]),hr=(0,J.useMemo)(()=>V?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(q,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Zn,children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),O.board.create]}),(0,Y.jsxs)(q,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void dr(),disabled:Tn,children:[(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0}),O.common.newChat]})]}):null,[Zn,O.board.create,O.common.newChat,V,dr,Tn]);(0,J.useLayoutEffect)(()=>(te({startExtra:mr,main:V?(0,Y.jsx)(Fn,{currentProject:V,pm:O,projectsText:j,wd:h}):(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:O.fallbackTitle}),(0,Y.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:O.fallbackContext})]}),end:hr}),()=>L()),[L,hr,mr,O,V,j,te,h]);function gr(e){W(t=>t?{...t,...e}:null),Jt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function _r(e=Kn.current){if(!(!V||!fn(e,V))){Z(null),nn(null);try{let t=await at(V.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});gr(t);let n=Kn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Kn.current=r,Gn(r)}catch(e){let t=En(e);throw t?nn(t):Z(e instanceof Error?e.message:String(e)),e}}}function vr(e){e.preventDefault(),jr.flush()}function yr(e,t=!1){let n={...Kn.current,...e};Kn.current=n,Gn(n),t&&jr.saveNow(n)}let br=(0,J.useCallback)(()=>{if(!V)return;let e=V.workspaceRoot?.trim()??``;sn(e?`fixed`:`follow`),ln(e||V.effectiveWorkspaceRoot||``),an(!0)},[V]);async function xr(e={}){if(!V)return;let t=X===`fixed`?cn.trim():``;if(!(X===`fixed`&&!t)){Qt(!0),Z(null),nn(null);try{let n=await at(V.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});gr(n),yr({workspaceRoot:n.workspaceRoot??``}),an(!1),nn(null)}catch(e){let t=En(e);t?(nn(t),an(!1)):Z(e instanceof Error?e.message:String(e))}finally{Qt(!1)}}}async function Sr(){if(!(!V||un)){dn(`pin`),Z(null);try{gr(V.pinnedAt?await x(V.id):await ut(V.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function Cr(){if(!(!V||un)){dn(`archive`),Z(null);try{let e=V.status===`archived`?await ve(V.id):await ye(V.id);gr(e),yr({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function wr(){if(V){wn(!0),Z(null);try{await Ee(V.id),en(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{wn(!1)}}}async function Tr(){if(!(!V||yt)){bt(!0),Z(null);try{await lt(V.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{bt(!1)}}}let Er=(0,J.useCallback)(e=>{Tt(e)},[]),Dr=(0,J.useCallback)((e,t)=>{t||Tt(e)},[]),Or=(0,J.useCallback)(async(e,t,n)=>{let r=V?.id;if(r)switch(e){case`preview`:t.isDirectory||Tt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Ie(t.path);if(B(v(e))!==`text`){let n=await N(t.path,{projectId:r}),i=g(e)??`application/octet-stream`;ie(e,await n.arrayBuffer(),i)}else{let{content:n}=await F(t.path,{projectId:r});k(e,n)}}catch(e){y(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&y(`success`,m.workspace.pathCopied,void 0,{duration:2500})}catch{y(`warning`,m.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[m.clipboard.copyFailed,m.workspace.pathCopied,V?.id]),kr=(0,J.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),kt(!0);let r=e.clientX,i=Et,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=pn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}kt(!1),Dt(c),hn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Et]);(0,J.useEffect)(()=>{$!==`files`&&Tt(null)},[e,$]);let Ar=!!(V&&fn(Q,V)),jr=gt({value:V?Q:null,dirty:Ar,onSave:_r,validate:e=>e.name.trim()?null:O.settings.nameRequired});if(Yt)return(0,Y.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:O.loading});if(!V)return(0,Y.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(s,{to:Jn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,Y.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),Jn===`/projects`?O.backToProjects:m.sidebar.back]}),(0,Y.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Hn||O.notFound})]});let Mr=xe.slice(0,6),Nr=K?.blockers??[],Pr=K?.tasks.filter(e=>e.lane!==`done`)??[],Fr=e=>O.statuses[e]??e,Ir=e=>_n(O.common.messages,{count:e}),Lr=Oe.trim().toLowerCase(),Rr=Lr?xe.filter(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||O.common.agent,r=e.name?.trim()||O.sessions.fallbackTitle,i=Ir(e.messageCount??0),a=An(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Lr)}):xe,zr=xe.length>0&&Rr.length===0,Br=Gt.find(e=>e.id===V.defaultAgentId)?.name||V.defaultAgentId||O.settings.globalDefaultAgent,Vr=Gt.find(e=>e.id===Q.defaultAgentId),Hr=V.workspaceRoot?.trim()||``,Ur=V.status===`archived`,Wr=!!V.pinnedAt,Gr=!Hr,Kr=Hr||Vr?.workspace||V.effectiveWorkspaceRoot||O.common.defaultWorkspace,qr=X===`fixed`?cn.trim()||O.settings.workspacePlaceholder:Vr?.workspace||V.effectiveWorkspaceRoot||O.common.defaultWorkspace,Jr=(X===`fixed`?cn.trim():``)!==Hr&&(X===`follow`||!!cn.trim()),Yr=[{id:`overview`,icon:_e,label:O.tabs.overview},{id:`tasks`,icon:P,label:O.tabs.tasks},{id:`automations`,icon:D,label:O.tabs.automations},{id:`files`,icon:st,label:O.tabs.files},{id:`notes`,icon:Le,label:O.tabs.notes},{id:`skills`,icon:Te,label:O.tabs.skills},{id:`sessions`,icon:M,label:O.tabs.sessions},{id:`progress`,icon:Me,label:O.tabs.progress}];async function Xr(){if(!Kr)return;let e=await u(Kr);y(e?`success`:`warning`,e?m.workspace.pathCopied:m.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Zr(){nn(null),an(!0)}return(0,Y.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(_t,{items:Yr,activeTab:$,onChange:Xn,ariaLabel:O.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,Y.jsxs)(q,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Xn(`settings`),children:[(0,Y.jsx)(Qe,{className:`size-4`,"aria-hidden":!0}),O.tabs.settings,Ar?(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":O.settings.unsavedChanges}):null]})]}),Hn?(0,Y.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Hn}):null,(0,Y.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,Y.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,Y.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.directionTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:V.outcome||K?.digest.summary||V.description||V.brief||O.overview.directionFallback}),K?.digest.recommendedAction?(0,Y.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:_n(O.overview.recommendedNext,{action:K.digest.recommendedAction})}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,onClick:()=>void Tr(),disabled:yt,children:[(0,Y.jsx)(De,{className:`size-4`,"aria-hidden":!0}),yt?O.overview.savingDigest:O.overview.saveDigest]})})]})}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.nextActions})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Pr.length?Pr.map(e=>(0,Y.jsxs)(s,{to:re(Yn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:O.overview.noNextActions})})]}),K?.recentReceipts.length?(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.recentResults})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:K.recentReceipts.slice(0,5).map(e=>(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.summary}),(0,Y.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]})},e.runId))})]}):null,(0,Y.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.milestones})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:V.milestones.length?V.milestones.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:O.overview.noMilestones})})]}),(0,Y.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.projectUpdates})}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:V.recentUpdates.length?V.recentUpdates.slice(0,3).map(e=>(0,Y.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,Y.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:O.overview.noProjectUpdates})})]})]})]}),(0,Y.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.overview.attention}),Nr.length?(0,Y.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Nr.map(e=>{let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(rt,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,Y.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[O.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Fr(e.status)}`:``]})]});return e.href?(0,Y.jsx)(s,{to:e.href,onClick:er(tr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,Y.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,Y.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:O.overview.noBlockedTasks}),(0,Y.jsxs)(`form`,{onSubmit:pr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,Y.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Un.title,onChange:e=>Wn(t=>({...t,title:e.target.value})),placeholder:O.overview.blockerTitlePlaceholder}),(0,Y.jsx)(q,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:In||!Un.title.trim(),"aria-label":In?O.overview.addingBlocker:O.overview.addBlocker,title:In?O.overview.addingBlocker:O.overview.addBlocker,children:(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(fe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:O.overview.recentSessions})]}),(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Xn(`sessions`),children:O.common.viewAll})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:Mr.length?Mr.map(e=>(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:vn(e.updatedAt)})]}),(0,Y.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||O.common.agent})]},e.key)):(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:O.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,Y.jsx)(on,{ref:Bn,tasks:K?.tasks??[],dependencyEdges:K?.dependencyEdges??[],returnTo:Yn(`tasks`),copy:O.board,onAction:rr,onCreate:ir,actionBusyId:Rn}):null,$===`automations`?(0,Y.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,Y.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(D,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.automations.title})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.automations.hint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ar(),disabled:Ve,children:[(0,Y.jsx)(We,{className:l(`size-4`,Ve&&`animate-spin`),"aria-hidden":!0}),O.common.refresh]}),(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>$n(`automations`,`/automations?projectId=${encodeURIComponent(V.id)}&action=create`),children:[(0,Y.jsx)(se,{className:`size-4`,"aria-hidden":!0}),O.automations.create]})]})]}),Ve&&Fe.length===0?(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,Y.jsx)(z,{className:`h-24 rounded-lg`}),(0,Y.jsx)(z,{className:`h-24 rounded-lg`})]}):Fe.length?(0,Y.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Fe.map(e=>(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,Y.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?O.automations.enabled:O.automations.paused})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:O.common.open}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Ge===`toggle:${e.id}`,onClick:()=>void sr(e),children:[e.enabled?(0,Y.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}):(0,Y.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?O.automations.pause:O.automations.resume]})]})]},e.id))}):(0,Y.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:O.automations.empty})]})}):null,$===`notes`?(0,Y.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,Y.jsx)(mt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(V.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:V.id,listTitle:O.notes.title,listDescription:O.notes.hint,emptyText:O.notes.emptyTitle,emptyDescription:O.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${V.id}`})}):null,$===`skills`?(0,Y.jsx)(It,{projectId:V.id,copy:O.skills}):null,$===`files`?(0,Y.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:V.effectiveWorkspaceRoot?(0,Y.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ot&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Et}px`},children:[(0,Y.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,Y.jsx)(ge,{workspacePath:Kr}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,At&&`bg-surface-hover text-fg`),onClick:()=>jt(!0),"aria-label":O.files.search,title:O.files.search,"aria-pressed":At,children:(0,Y.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(ft,{className:`size-7 shrink-0 rounded-md p-0`,loading:Vt,label:m.cron.refresh,onClick:()=>void cr()})]})]}),At?(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,Y.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,Y.jsx)(Ce,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`text`,role:`searchbox`,value:Mt,onChange:e=>Nt(e.target.value),placeholder:O.files.searchPlaceholder,"aria-label":O.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,Y.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":O.files.clearSearch,title:O.files.clearSearch,onClick:()=>{Nt(``),jt(!1)},children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Ut?(0,Y.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Ut}):null,ur?(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Lt?(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,Y.jsx)(z,{className:`h-11 w-full`}),(0,Y.jsx)(z,{className:`h-11 w-full`}),(0,Y.jsx)(z,{className:`h-11 w-full`})]}):zt?(0,Y.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[m.workspace.loadError,`: `,zt]}):Pt.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:O.files.noSearchResults}):Pt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,wt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Tt(e.path),title:e.path,children:[(0,Y.jsx)(Le,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Vt&&xt.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:O.files.loading}):(0,Y.jsx)(ae,{tree:xt,selectedPath:wt,onSelectFile:Er,onSelectEntry:Dr,onExpandDir:e=>void lr(e),onAction:Or,actionLabels:{preview:m.workspace.preview,download:m.workspace.download,copyPath:m.workspace.copyPath,openDefault:m.workspace.openSystemApp,openWith:m.workspace.openWith,revealInFolder:m.workspace.revealInFolder,recommendedApps:m.workspace.recommendedApps},emptyHint:O.files.emptyDirectory})]}),(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":O.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ot&&`bg-surface-hover`),onPointerDown:kr,children:(0,Y.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,Y.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:wt?(0,Y.jsx)(ne,{filePath:wt,projectId:V.id,agentId:V.defaultAgentId||qt||void 0,onClose:()=>Tt(null)}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(st,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:O.files.previewEmptyTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.files.previewEmptyDescription})]})})})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:O.files.needWorkspace}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Xn(`settings`),children:O.files.openSettings})})]})})}):null,$===`sessions`?(0,Y.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[xe.length?(0,Y.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,Y.jsx)(Ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:Oe,onChange:e=>Pe(e.currentTarget.value),placeholder:O.sessions.searchPlaceholder,"aria-label":O.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),Oe?(0,Y.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":O.sessions.clearSearch,onClick:()=>Pe(``),children:(0,Y.jsx)(w,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Rr.length?(0,Y.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Rr.map(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||O.common.agent,r=An(e),i=e.name?.trim()||O.sessions.fallbackTitle,a=Ir(e.messageCount??0);return(0,Y.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,Y.jsx)(M,{className:`size-4`,"aria-hidden":!0})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,Y.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[O.sessions.agent,`: `,n]}),(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,Y.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[O.sessions.updated,`: `,t]}):null]})]},e.key)})}):zr?(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:O.sessions.noMatches})}):(0,Y.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:O.sessions.emptyTitle}),(0,Y.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:O.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,Y.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.progress.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_n(O.progress.count,{count:Xe})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:nt,onChange:e=>it(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),O.progress.includeRelated]}),(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void or(),disabled:$e,children:[(0,Y.jsx)(We,{className:l(`size-4`,$e&&`animate-spin`),"aria-hidden":!0}),O.common.refresh]})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:$e&&qe.length===0?(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:O.progress.loading}):qe.length?(0,Y.jsx)(`div`,{className:`divide-y divide-edge`,children:qe.map(e=>{let t=O.progress.types[e.type]??e.type,n=O.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Mn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===V.id);return(0,Y.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,Y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:O.progress.related}):null]}),(0,Y.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,On(e)]})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:vn(e.createdAt)})]}),r?(0,Y.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,Y.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[O.progress.actor,`: `,Dn(e)]}),(0,Y.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[O.progress.source,`: `,kn(e)]})]})]},e.id)})}):(0,Y.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:O.progress.empty})})]}):null,$===`settings`?(0,Y.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:vr,onBlurCapture:jr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.summaryTitle}),(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:O.settings.summaryHint})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,Y.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs font-medium`,yn(Q.status)),children:O.settings.statuses[Q.status]}),(0,Y.jsx)(ht,{status:jr.status,error:jr.error})]})]}),(0,Y.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.detailsTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.settings.detailsHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Y.jsx)(bn,{label:O.settings.name,children:(0,Y.jsx)(`input`,{className:xn(),value:Q.name,onChange:e=>yr({name:e.target.value})})}),(0,Y.jsx)(bn,{label:O.settings.defaultAgent,children:(0,Y.jsxs)(pe,{className:xn(),value:Q.defaultAgentId,onChange:e=>yr({defaultAgentId:e.target.value},!0),children:[(0,Y.jsx)(H,{value:``,children:O.settings.globalDefaultAgent}),Gt.map(e=>(0,Y.jsx)(H,{value:e.id,children:he(e,m.agentsSettings)},e.id))]})}),(0,Y.jsx)(bn,{label:O.settings.status,children:Ur?(0,Y.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:O.settings.statuses.archived}):(0,Y.jsxs)(pe,{className:xn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>yr({status:e.target.value},!0),children:[(0,Y.jsx)(H,{value:`active`,children:O.settings.statuses.active}),(0,Y.jsx)(H,{value:`paused`,children:O.settings.statuses.paused})]})}),(0,Y.jsx)(bn,{label:O.settings.description,hint:O.settings.descriptionHint,children:(0,Y.jsx)(`textarea`,{className:xn(!0),value:Q.description,onChange:e=>yr({description:e.target.value})})})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.projectGuidanceTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.settings.projectGuidanceHint})]}),(0,Y.jsx)(bn,{label:O.settings.brief,hint:O.settings.briefHint,children:(0,Y.jsx)(`textarea`,{className:xn(!0),value:Q.brief,onChange:e=>yr({brief:e.target.value})})}),(0,Y.jsx)(bn,{label:O.settings.instructions,hint:O.settings.instructionsHint,children:(0,Y.jsx)(`textarea`,{className:xn(!0),value:Q.instructions,onChange:e=>yr({instructions:e.target.value})})})]})]}),(0,Y.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.workspaceRoot}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:O.settings.workspaceIndependentHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Gr?O.settings.workspaceModeFollow:O.settings.workspaceModeFixed}),(0,Y.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Kr,children:Kr}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Xr(),children:[(0,Y.jsx)(de,{className:`size-4`,"aria-hidden":!0}),O.settings.copyWorkspacePath]}),(0,Y.jsx)(ge,{workspacePath:Kr}),(0,Y.jsxs)(q,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:br,children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),O.settings.migrateWorkspace]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.currentProjectTitle}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(Sn,{label:O.settings.defaultAgent,value:Br}),(0,Y.jsx)(Sn,{label:O.settings.pinState,value:Wr?O.settings.pinned:O.settings.notPinned}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,Y.jsx)(Sn,{label:O.settings.createdAt,value:vn(V.createdAt)||O.common.never}),(0,Y.jsx)(Sn,{label:O.settings.updatedAt,value:vn(V.updatedAt)||O.common.never})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:O.settings.managementTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:O.settings.managementHint})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?O.settings.pinnedTitle:O.settings.pinTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:O.settings.pinHint})]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:un===`pin`,onClick:()=>void Sr(),children:[Wr?(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0}),Wr?O.settings.unpinProject:O.settings.pinProject]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?O.settings.restoreTitle:O.settings.archiveTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Ur?O.settings.restoreHint:O.settings.archiveHint})]}),(0,Y.jsxs)(q,{type:`button`,variant:Ur?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:un===`archive`,onClick:()=>void Cr(),children:[Ur?(0,Y.jsx)(We,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(R,{className:`size-4`,"aria-hidden":!0}),Ur?O.settings.restoreProject:O.settings.archiveProject]})]})]})]}),(0,Y.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:O.settings.dangerTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:O.settings.dangerHint})]}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>en(!0),children:[(0,Y.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),O.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,Y.jsx)(A,{open:$t,onOpenChange:e=>{Cn||en(e)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,Y.jsx)(rt,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:O.settings.deleteConfirmTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V?_n(O.settings.deleteConfirm,{name:V.name}):O.settings.deleteConfirmFallback})]})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Cn,children:O.common.cancel})}),(0,Y.jsxs)(q,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Cn||!V,onClick:()=>void wr(),children:[(0,Y.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),O.settings.deleteConfirmAction]})]})]})]})}),(0,Y.jsx)(A,{open:rn,onOpenChange:e=>{Zt||an(e)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:O.settings.workspaceMigrationTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:O.settings.workspaceMigrationDescription})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-fg-muted`,children:O.settings.workspaceMode}),(0,Y.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,Y.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>sn(`fixed`),disabled:Zt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:O.settings.workspaceModeFixed}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:O.settings.workspaceMigrationFixedHint})]})]}),(0,Y.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,Y.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>sn(`follow`),disabled:Zt}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:O.settings.workspaceModeFollow}),(0,Y.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:O.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,Y.jsx)(vt,{value:cn,onChange:ln,disabled:Zt,wd:h,placeholder:O.settings.workspacePlaceholder,inputClassName:xn(),autoFocus:!0}):null,(0,Y.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:O.settings.workspaceMigrationImpact}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:_n(O.settings.workspaceCurrent,{workspace:qr})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(ee,{asChild:!0,children:(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Zt,children:O.common.cancel})}),(0,Y.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Zt||!Jr,onClick:()=>void xr(),children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),O.settings.workspaceMigrationConfirm]})]})]})]})}),(0,Y.jsx)(A,{open:!!tn,onOpenChange:e=>{e||nn(null)},children:(0,Y.jsxs)(b,{children:[(0,Y.jsx)(pt,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,Y.jsx)(le,{className:`text-base font-semibold text-fg`,children:O.settings.workspaceMissingTitle}),(0,Y.jsx)(U,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:tn?_n(O.settings.workspaceMissingDescription,{workspace:tn}):null})]}),tn?(0,Y.jsx)(`div`,{className:`px-5 py-4`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,Y.jsx)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:tn})]})}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Y.jsx)(q,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Zr,disabled:Zt,children:O.settings.workspaceMissingBack}),(0,Y.jsxs)(q,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void xr({createWorkspaceRoot:!0}),disabled:Zt,children:[(0,Y.jsx)(G,{className:`size-4`,"aria-hidden":!0}),O.settings.workspaceMissingCreate]})]})]})]})})]})}export{In as ProjectDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-DQ5X6cXp.js";import{n as s}from"./locale-store-Bjvw7jtg.js";import{Bo as c,Ca as l,Dc as u,Dl as d,Dt as f,Ec as p,El as m,Fo as h,Io as g,Kc as _,Lo as v,Mu as y,Na as b,Ou as x,Ro as S,Sc as C,Ua as w,Vo as T,ba as E,ca as D,dc as O,jt as k,la as A,mc as j,nt as M,va as N,ws as P,ya as F,zo as I}from"./index-BzPwnXho.js";var L=n(),R=e(t(),1),z=r();function B(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:M(n)}function ee(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function te(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},V)}),e[0]=t):t=e[0],t}function V(e,t){return(0,z.jsx)(b,{className:`h-40 rounded-xl`},t)}function ne(e){let t=(0,L.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:c}=e,l=s(re),f,m,h,g,_,v,b,S;if(t[0]!==l||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=o(l).projectsPage;f=e.management,b=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,z.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let s=(0,z.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),c;t[20]===s?c=t[21]:(c=(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,s]}),t[20]=s,t[21]=c);let u;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,z.jsx)(x,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=u):u=t[22];let p;t[23]===c?p=t[24]:(p=(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,u]}),t[23]=c,t[24]=p),S=(0,z.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[p,(0,z.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),v=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,g=`min-w-0 text-[11px] text-fg-subtle`,_=(0,z.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),m=`mt-1`,h=B(n.lastActiveAt??n.updatedAt,e.never),t[0]=l,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=f,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=b,t[16]=S}else f=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],b=t[15],S=t[16];let C;t[25]!==m||t[26]!==h?(C=(0,z.jsx)(`p`,{className:m,children:h}),t[25]=m,t[26]=h,t[27]=C):C=t[27];let w;t[28]!==g||t[29]!==_||t[30]!==C?(w=(0,z.jsxs)(`div`,{className:g,children:[_,C]}),t[28]=g,t[29]=_,t[30]=C,t[31]=w):w=t[31];let T=n.pinnedAt?f.unpin:f.pin,E=n.pinnedAt?f.unpin:f.pin,D;t[32]===n.pinnedAt?D=t[33]:(D=n.pinnedAt?(0,z.jsx)(p,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=D);let O;t[34]!==r||t[35]!==a||t[36]!==T||t[37]!==E||t[38]!==D?(O=(0,z.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":T,title:E,children:D}),t[34]=r,t[35]=a,t[36]=T,t[37]=E,t[38]=D,t[39]=O):O=t[39];let k=n.status===`archived`?f.restore:f.archive,A=n.status===`archived`?f.restore:f.archive,M;t[40]===n.status?M=t[41]:(M=n.status===`archived`?(0,z.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,z.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=M);let N;t[42]!==r||t[43]!==c||t[44]!==k||t[45]!==A||t[46]!==M?(N=(0,z.jsx)(P,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:c,"aria-label":k,title:A,children:M}),t[42]=r,t[43]=c,t[44]=k,t[45]=A,t[46]=M,t[47]=N):N=t[47];let F;t[48]!==O||t[49]!==N?(F=(0,z.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[O,N]}),t[48]=O,t[49]=N,t[50]=F):F=t[50];let I;t[51]!==F||t[52]!==v||t[53]!==w?(I=(0,z.jsxs)(`div`,{className:v,children:[w,F]}),t[51]=F,t[52]=v,t[53]=w,t[54]=I):I=t[54];let R;return t[55]!==I||t[56]!==b||t[57]!==S?(R=(0,z.jsxs)(`article`,{className:b,children:[S,I]}),t[55]=I,t[56]=b,t[57]=S,t[58]=R):R=t[58],R}function re(e){return e.language}function ie(){let e=o(s(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=w(e=>e.setPageHeader),u=w(e=>e.clearPageHeader),[p,y]=(0,R.useState)([]),[b,x]=(0,R.useState)(!0),[j,M]=(0,R.useState)(null),[L,B]=(0,R.useState)(``),[V,re]=(0,R.useState)(`active`),[ie,ae]=(0,R.useState)(null),[oe,H]=(0,R.useState)(!1),[U,W]=(0,R.useState)(null),[G,K]=(0,R.useState)(!1),[q,J]=(0,R.useState)(``),[Y,X]=(0,R.useState)(``),[Z,se]=(0,R.useState)(``),Q=k({initialPath:Z,onPicked:se}),$=(0,R.useCallback)(async()=>{x(!0),M(null);try{y(ee((await N({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){M(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,R.useEffect)(()=>{$()},[$]);let ce=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase();return p.filter(e=>V===`all`||e.status===V).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[V,p,L]),le=(0,R.useMemo)(()=>(0,z.jsxs)(P,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,z.jsx)(C,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,R.useLayoutEffect)(()=>(i({startExtra:null,main:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:le}),()=>u()),[u,le,n.subtitle,n.title,i]);let ue=(0,R.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Z.trim();if(!(!t||!n||G)){K(!0),W(null);try{let e=await A({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});y(t=>[e,...t.filter(t=>t.id!==e.id)]),J(``),X(``),se(``),H(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[G,Y,q,Z]),de=(0,R.useCallback)(async(e,t)=>{ae(e.id),M(null);try{let n;n=t===`pin`?e.pinnedAt?await l(e.id):await F(e.id):e.status===`archived`?await E(e.id):await D(e.id),y(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){M(e instanceof Error?e.message:String(e))}finally{ae(null)}},[]),fe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}];return(0,z.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,z.jsx)(h,{open:oe,onOpenChange:e=>{H(e),e||W(null)},children:(0,z.jsxs)(c,{children:[(0,z.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,z.jsx)(T,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,z.jsx)(S,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,z.jsxs)(`form`,{onSubmit:ue,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,z.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>J(e.target.value),maxLength:160})]}),(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,z.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>X(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,z.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,z.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Q.pick,disabled:G||Q.picking,children:[Q.picking?(0,z.jsx)(_,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,z.jsx)(m,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Z?r.chooseFolder:r.selectWorkingDirectory}),(0,z.jsx)(`span`,{className:a(`mt-0.5 block truncate font-mono text-xs font-normal`,Z?`text-fg-muted`:`text-fg-subtle`),title:Z||void 0,children:Z||t.workspaceSelectionPlaceholder})]})]}),(0,z.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),U?(0,z.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:U}):null]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,z.jsx)(g,{asChild:!0,children:(0,z.jsx)(P,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,z.jsx)(P,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Z.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),Q.hasNativePicker?null:(0,z.jsx)(f,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:Z||void 0,onConfirm:Q.confirmPick,wd:r}),(0,z.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n.filterLabel,children:fe.map(e=>(0,z.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,V===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>re(e.id),children:e.label},e.id))}),(0,z.jsxs)(`label`,{className:`relative block min-w-0 sm:w-64`,children:[(0,z.jsx)(O,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`input`,{className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>B(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder})]})]}),j?(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,z.jsx)(`span`,{children:j}),(0,z.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:t.home.retry})]}):null,b?(0,z.jsx)(te,{}):ce.length?(0,z.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ce.map(e=>(0,z.jsx)(ne,{project:e,busy:ie===e.id,onTogglePin:()=>void de(e,`pin`),onToggleArchive:()=>void de(e,`archive`)},e.id))}):(0,z.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,z.jsx)(d,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{ie as ProjectsPage};
|