@xopcai/xopc 0.0.133 → 0.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ab81VpCx.js → agent-avatar-dicebear-mQ4lbZRf.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-HCGFJG8I.js → agents-BP0iRtiu.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-DMI_sbnc.js → app-management-settings-panel-Bj2YJiQe.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-oQiCWQIQ.js → appearance-settings-B93olV5Z.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-CRYuPIdb.js → apps-page-12_2SDFq.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-BaKuWJws.js → archive-plugin-D_yymKFJ.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-DYCFtbAA.js → attachment-load-kfyH3HV-.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automation-suggestion-card-C6ZIz_B1.js → automation-suggestion-card-DyGBB2WH.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-DjbtV2VP.js → automations-page-V-tw6y1o.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-Bdg1hfhV.js → binary-plugins-BX1AXf98.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-CEgvbzpG.js → block-editor-D-WEVNHU.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-KcwlS_iE.js → browser-settings-page-aMPnxWXi.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capability-presets-api-CC3vmrm5.js → capability-presets-api-CsaY2Z8B.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Di4uiKbv.js → capability-presets-settings-panel-CHExb90z.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-DMa0BEWf.js → channels-settings-N8NujD--.js} +1 -1
  18. package/dist/gateway/static/root/assets/{connectors-page-DIZKYaMj.js → connectors-page-zBJbFgnK.js} +1 -1
  19. package/dist/gateway/static/root/assets/{desktop-pet-CNnlqbkx.js → desktop-pet-DfA-hVlt.js} +1 -1
  20. package/dist/gateway/static/root/assets/{desktop-pet-settings-ukJCc0LA.js → desktop-pet-settings-C3JDiXSu.js} +1 -1
  21. package/dist/gateway/static/root/assets/{directory-picker-path-field-8hoieEyt.js → directory-picker-path-field-MT71cjgl.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dreaming-settings-BOrBSNLL.js → dreaming-settings-Cfx_Qg4R.js} +1 -1
  23. package/dist/gateway/static/root/assets/{extension-debug-page-D6Jc0hYZ.js → extension-debug-page-Wp23cLkf.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-page-CJMhBASX.js → extension-page-B5HRNtVY.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-settings-page-Dt-FWyMN.js → extension-settings-page-zPfMpsYi.js} +1 -1
  26. package/dist/gateway/static/root/assets/{gateway-config-api-CyYi-a3k.js → gateway-config-api-CsS_3Ii6.js} +1 -1
  27. package/dist/gateway/static/root/assets/{gateway-settings-yJvCmOBC.js → gateway-settings-DOxh0hei.js} +1 -1
  28. package/dist/gateway/static/root/assets/{goal-create-dialog-B3PLFUAl.js → goal-create-dialog-BOWSTGB-.js} +1 -1
  29. package/dist/gateway/static/root/assets/{goal-detail-page-BQXW29kk.js → goal-detail-page-CCLgkqj1.js} +1 -1
  30. package/dist/gateway/static/root/assets/{goals-config-api-FU_bdYvR.js → goals-config-api--3Vzceq-.js} +1 -1
  31. package/dist/gateway/static/root/assets/{goals-page-BmppU6mC.js → goals-page-CsfIp8Vl.js} +1 -1
  32. package/dist/gateway/static/root/assets/{goals-settings-BsXWV6CN.js → goals-settings-Dg_hQNVC.js} +1 -1
  33. package/dist/gateway/static/root/assets/{heartbeat-settings-BqwSCZLD.js → heartbeat-settings-CecoDTZJ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{index-DqFBdoK-.js → index-BOme955B.js} +29 -29
  35. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D8J0hkTt.js → keyboard-shortcuts-settings-BWMLAFxf.js} +1 -1
  36. package/dist/gateway/static/root/assets/{logs-page-Cr5ptDtc.js → logs-page-CW7AMYhN.js} +1 -1
  37. package/dist/gateway/static/root/assets/{markdown-split-w-hIAZ9S.js → markdown-split-5tvDwUMS.js} +1 -1
  38. package/dist/gateway/static/root/assets/{media-plugins-DjFnDy3R.js → media-plugins-RSjPG4B0.js} +1 -1
  39. package/dist/gateway/static/root/assets/{models-hub-panel-DEsMnITi.js → models-hub-panel-mKfeyGVq.js} +1 -1
  40. package/dist/gateway/static/root/assets/{notes-page-D7bHXaeR.js → notes-page-DYw5zPeJ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-workbench-DiuG4Ov7.js → notes-workbench-SPdKpvSN.js} +2 -2
  42. package/dist/gateway/static/root/assets/{page-tabs-smjfSAwc.js → page-tabs-DYNWfN6S.js} +1 -1
  43. package/dist/gateway/static/root/assets/{preview-open-alternatives-v02THugE.js → preview-open-alternatives-B50PdIc8.js} +1 -1
  44. package/dist/gateway/static/root/assets/{project-detail-page-Us3zDRE6.js → project-detail-page-D3yP4K3k.js} +1 -1
  45. package/dist/gateway/static/root/assets/{projects-page-BcvW8R0Z.js → projects-page-B6EV45NR.js} +1 -1
  46. package/dist/gateway/static/root/assets/{remote-access-hub-Bun2k0V-.js → remote-access-hub-9foX60FQ.js} +1 -1
  47. package/dist/gateway/static/root/assets/{save-bar-controls-CD7LPbLU.js → save-bar-controls-DggNb0SF.js} +1 -1
  48. package/dist/gateway/static/root/assets/{schedule-field-Cf3p_M0z.js → schedule-field-T4ti2C8S.js} +1 -1
  49. package/dist/gateway/static/root/assets/{schema-form-D8XdvcNH.js → schema-form-D6wGEfEa.js} +1 -1
  50. package/dist/gateway/static/root/assets/{sessions-page-Bh44TVld.js → sessions-page-BReBhxWd.js} +1 -1
  51. package/dist/gateway/static/root/assets/settings-advanced-gate-DNDBN4nT.js +1 -0
  52. package/dist/gateway/static/root/assets/{settings-collapsible-section-BVpPSgMs.js → settings-collapsible-section-Cgd_aLBV.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-form-section-GAwBG9Vp.js → settings-form-section-DnDrLMWZ.js} +1 -1
  54. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CGxa3aCb.js → settings-loading-skeleton-A2OshMK8.js} +1 -1
  55. package/dist/gateway/static/root/assets/{settings-page-bZKl6uRR.js → settings-page-CXMK9Vb3.js} +1 -1
  56. package/dist/gateway/static/root/assets/{settings-page-layout-DfbMLJgN.js → settings-page-layout-Da_LNPDS.js} +1 -1
  57. package/dist/gateway/static/root/assets/{setup-status-panel-DBIruh16.js → setup-status-panel-C8UtBMJ_.js} +1 -1
  58. package/dist/gateway/static/root/assets/{share-preview-page-BglBMvA0.js → share-preview-page-BGZV-PCJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/{shares-settings-C0fR-Oto.js → shares-settings-xXAMKlc7.js} +1 -1
  60. package/dist/gateway/static/root/assets/skill-reload-api-CurjHfEM.js +1 -0
  61. package/dist/gateway/static/root/assets/{skills-page-CwwZOoCH.js → skills-page-BRR7NQkL.js} +1 -1
  62. package/dist/gateway/static/root/assets/{system-settings-panel-CTT0BkbS.js → system-settings-panel-D8uzXP0Y.js} +1 -1
  63. package/dist/gateway/static/root/assets/{typed-models-lib-Fa9PjI0-.js → typed-models-lib-DQxv2BHa.js} +1 -1
  64. package/dist/gateway/static/root/assets/{user-profile-settings-panel-pCK-aMqu.js → user-profile-settings-panel-DkZSHsIs.js} +1 -1
  65. package/dist/gateway/static/root/assets/{utils-aleluS3U.js → utils-ivGpUrZi.js} +1 -1
  66. package/dist/gateway/static/root/assets/{voice-api-key-field-Fh4mqUIK.js → voice-api-key-field-DCiECZN1.js} +1 -1
  67. package/dist/gateway/static/root/assets/{work-item-detail-page-C0_3nId3.js → work-item-detail-page-DAel5CHH.js} +1 -1
  68. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-r969H1r2.js → workflow-run-setup-panel-2w0zj9eJ.js} +1 -1
  69. package/dist/gateway/static/root/assets/{workflow-start-dialog-C1GbcWN0.js → workflow-start-dialog-B5xdDFV-.js} +1 -1
  70. package/dist/gateway/static/root/assets/{workflows-page-DsPM3HEI.js → workflows-page-DRhiSwuU.js} +1 -1
  71. package/dist/gateway/static/root/index.html +1 -1
  72. package/dist/package.js +1 -1
  73. package/package.json +1 -1
  74. package/dist/gateway/static/root/assets/settings-advanced-gate-BhyLZ0IW.js +0 -1
  75. package/dist/gateway/static/root/assets/skill-reload-api-BG-FEo9B.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{a as o,t as s}from"./fetch-6HXXdO77.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{$a as l,Ac as u,Ba as d,Bi as f,Cc as p,Dc as m,Do as h,Eo as g,Ga as _,Gi as v,Ha as y,Hi as b,Ji as x,L as S,Nc as C,Oc as w,Os as T,Qc as E,Qi as D,Ra as O,Sc as k,Ss as A,Tl as j,Ts as M,Ua as N,Ui as P,Uo as F,Va as I,Vi as L,Wa as R,Wi as z,Xc as B,Xi as V,Yi as H,Yo as ee,Ys as te,Zi as ne,_i as re,_n as ie,_t as ae,a as oe,aa as se,at as ce,bs as le,bt as ue,ca as de,ci as fe,co as pe,cs as me,d as he,di as ge,ds as _e,ea as ve,ec as ye,er as be,f as xe,fa as Se,fi as Ce,gi as we,ha as Te,hi as Ee,hl as De,ht as Oe,i as ke,ia as Ae,is as je,ks as Me,l as U,la as Ne,lc as Pe,li as Fe,lo as Ie,mi as Le,mo as Re,mt as ze,na as Be,nl as Ve,o as He,oo as Ue,p as We,pi as Ge,ps as W,qi as Ke,qn as qe,r as Je,ra as Ye,s as Xe,so as Ze,st as Qe,ta as $e,tl as et,to as tt,u as nt,ui as rt,vc as it,vi as at,vl as ot,vn as st,wl as ct,wo as G,ws as lt,xl as ut,y as dt,yc as ft,za as pt,zc as mt,zo as ht,zr as gt,zs as _t}from"./index-DqFBdoK-.js";import{t as vt}from"./notes-workbench-DiuG4Ov7.js";import{t as yt}from"./page-tabs-smjfSAwc.js";import{t as bt}from"./directory-picker-path-field-8hoieEyt.js";import{t as xt}from"./goals-config-api-FU_bdYvR.js";import{n as St,t as Ct}from"./goal-create-dialog-B3PLFUAl.js";import{t as wt}from"./workflow-start-dialog-C1GbcWN0.js";var K=n(),q=e(t(),1),J=r(),Tt=`application/x-xopc-work-item`,Et=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Dt=[`low`,`normal`,`high`,`urgent`];function Ot(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function kt(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function At(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Y(e){return`${e.name}:${e.size}:${e.lastModified}`}function jt(e,t){return fe(e,t)!==`unsupported`}function Mt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Nt(e,t){return{id:e.id,name:e.fileName,type:Mt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Pt(e,t){let n=rt(e.name||`upload`,e.type||`application/octet-stream`),r=de(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Mt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Ft(e){let t=(0,K.c)(3),[n,r]=(0,q.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,q.useEffect)(i,a),n}function It(e,t){let n=(0,K.c)(5),[r,i]=(0,q.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await s(We(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,q.useEffect)(a,o),r}function Lt(e){let t=(0,K.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(p,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Rt(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function zt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Bt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Vt(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:a,onToggleDone:o,onDragStart:s,onDragEnd:c,t:l}=e,u=n.status===`done`,d;t[0]!==n||t[1]!==s?(d=e=>s(n,e),t[0]=n,t[1]=s,t[2]=d):d=t[2];let f=l.dragToUpdate,p=r&&`opacity-50`,h;t[3]===p?h=t[4]:(h=i(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel px-3 py-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,p),t[3]=p,t[4]=h);let g=u?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=i(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=u?l.markTodo:l.markDone,y=u?l.markTodo:l.markDone,b;t[7]!==n||t[8]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u?(0,J.jsx)(B,{className:`size-3`,"aria-hidden":!0}):null,t[10]=u,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==a?(C=()=>a(n),t[18]=n,t[19]=a,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==l?(T=Bt(n,l),t[23]=n,t[24]=l,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ot(n.status)),t[35]=n.status,t[36]=k);let A=l.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=l.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Me,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(m,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==l.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(ut,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[l.detail.openItem,L]}),t[47]=l.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let V;return t[56]!==c||t[57]!==l.dragToUpdate||t[58]!==d||t[59]!==O||t[60]!==z||t[61]!==h?(V=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:d,onDragEnd:c,title:f,className:h,children:[O,z]}),t[56]=c,t[57]=l.dragToUpdate,t[58]=d,t[59]=O,t[60]=z,t[61]=h,t[62]=V):V=t[62],V}function Ht(){let e=(0,K.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function Ut(e){let t=(0,K.c)(44),{file:n,index:r,busy:a,previewBusy:o,t:s,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=rt(n.name||`upload`,n.type||`application/octet-stream`),d=jt(n.name||`upload`,u),f=Ft,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),g=n.name||`upload`,_=a||o,v;t[5]!==n||t[6]!==c?(v=()=>c(n),t[5]=n,t[6]=c,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(Lt,{name:g,mimeType:u,thumbnailUrl:m,previewable:d,disabled:_,onOpen:v}),t[8]=u,t[9]=d,t[10]=g,t[11]=_,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=i(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||a||o,C;t[17]!==n||t[18]!==c?(C=()=>c(n),t[17]=n,t[18]=c,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=At(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==a||t[37]!==s.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:k,children:A}),t[36]=a,t[37]=s.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function Wt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:a,previewBusy:o,t:s,onOpen:c,onDownload:l,onRemove:d}=e,f;t[0]!==r.fileName||t[1]!==r.mimeType?(f=jt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=f):f=t[2];let p=f,m=It(n.id,r),h=a||o,g;t[3]!==r||t[4]!==n||t[5]!==c?(g=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=g):g=t[6];let _;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==p||t[10]!==h||t[11]!==g||t[12]!==m?(_=(0,J.jsx)(Lt,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:m,previewable:p,disabled:h,onOpen:g}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=p,t[10]=h,t[11]=g,t[12]=m,t[13]=_):_=t[13];let v=p?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,y;t[14]===v?y=t[15]:(y=i(`min-w-0 flex-1 text-left`,v),t[14]=v,t[15]=y);let b=!p||a||o,x;t[16]!==r||t[17]!==n||t[18]!==c?(x=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,t[19]=x):x=t[19];let S;t[20]===r.fileName?S=t[21]:(S=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=S);let C=r.mimeType,w;t[22]===r.size?w=t[23]:(w=At(r.size),t[22]=r.size,t[23]=w);let T;t[24]!==r.mimeType||t[25]!==w?(T=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[C,` · `,w]}),t[24]=r.mimeType,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==T||t[28]!==y||t[29]!==b||t[30]!==x||t[31]!==S?(E=(0,J.jsxs)(`button`,{type:`button`,className:y,disabled:b,onClick:x,children:[S,T]}),t[27]=T,t[28]=y,t[29]=b,t[30]=x,t[31]=S,t[32]=E):E=t[32];let D;t[33]!==r||t[34]!==n||t[35]!==l?(D=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==a||t[39]!==s.attachments.download||t[40]!==D?(k=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.download,"aria-label":s.attachments.download,disabled:a,onClick:D,children:O}),t[38]=a,t[39]=s.attachments.download,t[40]=D,t[41]=k):k=t[41];let A;t[42]!==r||t[43]!==n||t[44]!==d?(A=()=>d(n,r),t[42]=r,t[43]=n,t[44]=d,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(ht,{className:`size-3.5`,"aria-hidden":!0}),t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s.attachments.remove||t[49]!==A?(M=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:A,children:j}),t[47]=a,t[48]=s.attachments.remove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==E||t[52]!==k||t[53]!==M||t[54]!==_?(N=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[_,E,k,M]}),t[51]=E,t[52]=k,t[53]=M,t[54]=_,t[55]=N):N=t[55],N}function Gt({mode:e,item:t,pendingFiles:n,busy:r,t:a,onPendingFilesChange:c,onUpload:l,onRemove:u,onDownload:d,onPreviewError:f}){let p=(0,q.useRef)(null),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=o(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){l(t,r);return}let i=new Set(n.map(Y)),a=[...n];for(let e of r){let t=Y(e);i.has(t)||(i.add(t),a.push(e))}c(a)}function T(e){c(n.filter((t,n)=>n!==e))}async function E(e){let t=Y(e);x(`pending:${t}`);try{y(await Pt(e,`pending:${t}`)),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await s(We(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Nt(t,de(await n.arrayBuffer()))),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:i(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,m&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),w(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Me,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:a.attachments.title})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>p.current?.click(),children:[(0,J.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),a.attachments.add]}),(0,J.jsx)(`input`,{ref:p,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(Ut,{file:e,index:t,busy:r,previewBusy:b===`pending:${Y(e)}`,t:a,onOpen:e=>void E(e),onRemove:T},Y(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Wt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:a,onOpen:(e,t)=>void D(e,t),onDownload:d,onRemove:u},e.id))}):null,!n.length&&!C.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.attachments.empty}):null]}),(0,J.jsx)(ce,{open:g,attachment:v,authToken:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function Kt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:a,events:o,busy:s,error:c,notice:u,t:f,onClose:p,onCreate:g,onSave:_,onStartChat:v,onCreateGoal:b,onAddAttachments:x,onRemoveAttachment:S,onDownloadAttachment:C,onPreviewError:w}=e,T=n!==null,[E,D]=(0,q.useState)(``),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(`todo`),[P,L]=(0,q.useState)(`normal`),[z,V]=(0,q.useState)(``),[H,ee]=(0,q.useState)(``),te;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[0]=te):te=t[0];let[ne,re]=(0,q.useState)(te),ie,ae;t[1]!==a||t[2]!==r||t[3]!==n?(ie=()=>{if(n===`create`){D(``),A(``),M(a),L(`normal`),V(``),ee(``),re([]);return}n===`detail`&&r&&(D(r.title),A(r.description??``),M(r.status),L(r.priority),V(r.nextAction??``),ee(r.blockedReason??``),re([]))},ae=[a,r,n],t[1]=a,t[2]=r,t[3]=n,t[4]=ie,t[5]=ae):(ie=t[4],ae=t[5]),(0,q.useEffect)(ie,ae);let oe;t[6]!==H||t[7]!==k||t[8]!==r||t[9]!==n||t[10]!==z||t[11]!==g||t[12]!==_||t[13]!==ne||t[14]!==P||t[15]!==j||t[16]!==E?(oe=function(e){e.preventDefault();let t=E.trim();if(t){if(n===`create`){g({title:t,description:k.trim()||void 0,priority:P,status:j,nextAction:z.trim()||void 0,blockedReason:H.trim()||void 0,attachments:ne});return}r&&_(r,{title:t,description:k.trim()||null,status:j,priority:P,nextAction:z.trim()||null,blockedReason:H.trim()||null})}},t[6]=H,t[7]=k,t[8]=r,t[9]=n,t[10]=z,t[11]=g,t[12]=_,t[13]=ne,t[14]=P,t[15]=j,t[16]=E,t[17]=oe):oe=t[17];let se=oe,ce;t[18]===p?ce=t[19]:(ce=e=>!e&&p(),t[18]=p,t[19]=ce);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ue):ue=t[20];let de=n===`create`?f.create.title:r?.title||f.title,fe;t[21]===de?fe=t[22]:(fe=(0,J.jsx)(R,{className:`truncate text-base font-semibold text-fg`,children:de}),t[21]=de,t[22]=fe);let pe;t[23]===f.detail.description?pe=t[24]:(pe=(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:f.detail.description}),t[23]=f.detail.description,t[24]=pe);let me;t[25]!==fe||t[26]!==pe?(me=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[fe,pe]}),t[25]=fe,t[26]=pe,t[27]=me):me=t[27];let he;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,J.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[28]=he):he=t[28];let ge;t[29]===s?ge=t[30]:(ge=(0,J.jsx)(O,{asChild:!0,children:(0,J.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`,disabled:s,children:he})}),t[29]=s,t[30]=ge);let _e;t[31]!==me||t[32]!==ge?(_e=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[me,ge]}),t[31]=me,t[32]=ge,t[33]=_e):_e=t[33];let ve;t[34]===c?ve=t[35]:(ve=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ve);let ye;t[36]!==c||t[37]!==u?(ye=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=ye):ye=t[38];let be;t[39]===f.create.titleLabel?be=t[40]:(be=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.titleLabel}),t[39]=f.create.titleLabel,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>D(e.target.value),t[41]=xe):xe=t[41];let Se=n===`create`,Ce;t[42]!==Se||t[43]!==E?(Ce=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:E,onChange:xe,autoFocus:Se}),t[42]=Se,t[43]=E,t[44]=Ce):Ce=t[44];let we;t[45]!==be||t[46]!==Ce?(we=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[be,Ce]}),t[45]=be,t[46]=Ce,t[47]=we):we=t[47];let Te;t[48]===f.detail.status?Te=t[49]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.detail.status}),t[48]=f.detail.status,t[49]=Te);let Ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>M(e.target.value),t[50]=Ee):Ee=t[50];let De;t[51]===f.statuses?De=t[52]:(De=Et.map(e=>(0,J.jsx)(tt,{value:e,children:f.statuses[e]},e)),t[51]=f.statuses,t[52]=De);let Oe;t[53]!==j||t[54]!==De?(Oe=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Ee,children:De}),t[53]=j,t[54]=De,t[55]=Oe):Oe=t[55];let ke;t[56]!==Te||t[57]!==Oe?(ke=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Oe]}),t[56]=Te,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===f.create.priorityLabel?Ae=t[60]:(Ae=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.priorityLabel}),t[59]=f.create.priorityLabel,t[60]=Ae);let je;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>L(e.target.value),t[61]=je):je=t[61];let Me;t[62]===f.priorities?Me=t[63]:(Me=Dt.map(e=>(0,J.jsx)(tt,{value:e,children:f.priorities[e]},e)),t[62]=f.priorities,t[63]=Me);let U;t[64]!==P||t[65]!==Me?(U=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:je,children:Me}),t[64]=P,t[65]=Me,t[66]=U):U=t[66];let Ne;t[67]!==Ae||t[68]!==U?(Ne=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ae,U]}),t[67]=Ae,t[68]=U,t[69]=Ne):Ne=t[69];let Pe;t[70]!==ke||t[71]!==Ne?(Pe=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Ne]}),t[70]=ke,t[71]=Ne,t[72]=Pe):Pe=t[72];let Fe;t[73]===f.create.descriptionLabel?Fe=t[74]:(Fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.descriptionLabel}),t[73]=f.create.descriptionLabel,t[74]=Fe);let Ie;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>A(e.target.value),t[75]=Ie):Ie=t[75];let Le;t[76]===k?Le=t[77]:(Le=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:Ie}),t[76]=k,t[77]=Le);let Re;t[78]!==Fe||t[79]!==Le?(Re=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Fe,Le]}),t[78]=Fe,t[79]=Le,t[80]=Re):Re=t[80];let ze;t[81]!==s||t[82]!==r||t[83]!==n||t[84]!==x||t[85]!==C||t[86]!==w||t[87]!==S||t[88]!==ne||t[89]!==f?(ze=(0,J.jsx)(Gt,{mode:n,item:r,pendingFiles:ne,busy:s,t:f,onPendingFilesChange:re,onUpload:x,onRemove:S,onDownload:C,onPreviewError:w}),t[81]=s,t[82]=r,t[83]=n,t[84]=x,t[85]=C,t[86]=w,t[87]=S,t[88]=ne,t[89]=f,t[90]=ze):ze=t[90];let Be;t[91]!==H||t[92]!==n||t[93]!==z||t[94]!==j||t[95]!==f.blockedReason||t[96]!==f.nextAction?(Be=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:z,onChange:e=>V(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:i(`font-medium`,j===`blocked`||j===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:f.blockedReason}),(0,J.jsx)(`textarea`,{className:i(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,j===`blocked`||j===`needs_input`?`border-red-500/40`:`border-edge`),value:H,onChange:e=>ee(e.target.value)})]})]}):null,t[91]=H,t[92]=n,t[93]=z,t[94]=j,t[95]=f.blockedReason,t[96]=f.nextAction,t[97]=Be):Be=t[97];let Ve;t[98]!==ve||t[99]!==ye||t[100]!==we||t[101]!==Pe||t[102]!==Re||t[103]!==ze||t[104]!==Be?(Ve=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ve,ye,we,Pe,Re,ze,Be]}),t[98]=ve,t[99]=ye,t[100]=we,t[101]=Pe,t[102]=Re,t[103]=ze,t[104]=Be,t[105]=Ve):Ve=t[105];let He;t[106]!==s||t[107]!==r||t[108]!==n||t[109]!==b||t[110]!==v||t[111]!==f.detail.actions||t[112]!==f.detail.createGoal||t[113]!==f.detail.openItem||t[114]!==f.detail.startChat?(He=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>v(r),children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),f.detail.startChat]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>b(r),children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),f.detail.createGoal]}),(0,J.jsx)(G,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(ut,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),f.detail.openItem]})})]})]}):null,t[106]=s,t[107]=r,t[108]=n,t[109]=b,t[110]=v,t[111]=f.detail.actions,t[112]=f.detail.createGoal,t[113]=f.detail.openItem,t[114]=f.detail.startChat,t[115]=He):He=t[115];let Ue;t[116]===f.detail.links?Ue=t[117]:(Ue=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.links}),t[116]=f.detail.links,t[117]=Ue);let We;t[118]!==r||t[119]!==f.detail.noLinks||t[120]!==f.linkKinds?(We=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(ut,{to:Rt(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[f.linkKinds[e.kind],(0,J.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noLinks}),t[118]=r,t[119]=f.detail.noLinks,t[120]=f.linkKinds,t[121]=We):We=t[121];let Ge;t[122]===We?Ge=t[123]:(Ge=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:We}),t[122]=We,t[123]=Ge);let W;t[124]!==Ue||t[125]!==Ge?(W=(0,J.jsxs)(`section`,{children:[Ue,Ge]}),t[124]=Ue,t[125]=Ge,t[126]=W):W=t[126];let Ke;t[127]===f.detail.activity?Ke=t[128]:(Ke=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.activity}),t[127]=f.detail.activity,t[128]=Ke);let qe;t[129]!==o||t[130]!==f.detail.noActivity||t[131]!==f.eventTypes?(qe=o.length?o.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:f.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:kt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noActivity}),t[129]=o,t[130]=f.detail.noActivity,t[131]=f.eventTypes,t[132]=qe):qe=t[132];let Je;t[133]===qe?Je=t[134]:(Je=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:qe}),t[133]=qe,t[134]=Je);let Ye;t[135]!==Ke||t[136]!==Je?(Ye=(0,J.jsxs)(`section`,{children:[Ke,Je]}),t[135]=Ke,t[136]=Je,t[137]=Ye):Ye=t[137];let Xe;t[138]!==He||t[139]!==W||t[140]!==Ye?(Xe=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[He,W,Ye]}),t[138]=He,t[139]=W,t[140]=Ye,t[141]=Xe):Xe=t[141];let Ze;t[142]!==Ve||t[143]!==Xe?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[Ve,Xe]}),t[142]=Ve,t[143]=Xe,t[144]=Ze):Ze=t[144];let Qe;t[145]!==s||t[146]!==p||t[147]!==f.create.cancel?(Qe=(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:p,disabled:s,children:f.create.cancel}),t[145]=s,t[146]=p,t[147]=f.create.cancel,t[148]=Qe):Qe=t[148];let $e;t[149]!==s||t[150]!==E?($e=s||!E.trim(),t[149]=s,t[150]=E,t[151]=$e):$e=t[151];let et;t[152]===n?et=t[153]:(et=n===`create`?(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=et);let nt=n===`create`?f.create.submit:f.detail.save,rt;t[154]!==$e||t[155]!==et||t[156]!==nt?(rt=(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[et,nt]}),t[154]=$e,t[155]=et,t[156]=nt,t[157]=rt):rt=t[157];let it;t[158]!==Qe||t[159]!==rt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,rt]}),t[158]=Qe,t[159]=rt,t[160]=it):it=t[160];let at;t[161]!==se||t[162]!==_e||t[163]!==Ze||t[164]!==it?(at=(0,J.jsxs)(y,{children:[ue,(0,J.jsx)(pt,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,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,J.jsxs)(`form`,{onSubmit:se,className:`flex min-h-0 flex-1 flex-col`,children:[_e,Ze,it]})})]}),t[161]=se,t[162]=_e,t[163]=Ze,t[164]=it,t[165]=at):at=t[165];let ot;return t[166]!==T||t[167]!==ce||t[168]!==at?(ot=(0,J.jsx)(N,{open:T,onOpenChange:ce,children:at}),t[166]=T,t[167]=ce,t[168]=at,t[169]=ot):ot=t[169],ot}function qt({projectId:e,createRequestKey:t=0}){let n=ct(),r=a(c(e=>e.language)).projectDetailPage.workItems,o=(0,q.useRef)(null),s=(0,q.useRef)(null),[l,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!0),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),[C,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{f(!0),m(null);try{let r=await Xe(e,{limit:100,offset:n});u(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),m(null),g(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Et.map(e=>({status:e,title:r.statuses[e],items:l.filter(t=>t.status===e)})),[l,r.statuses]),R=(0,q.useCallback)(e=>{u(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),z=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await nt(e.id,t);n.item.archivedAt?(u(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(n.item),g({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,R]),B=(0,q.useCallback)(async e=>{N(e),F([]),m(null),g(null);let t=await U(e.id).catch(()=>null);t&&F(t.events)},[]),V=(0,q.useCallback)(async t=>{v(!0),m(null),g(null);try{let n=await Je(e,t);u(e=>[n.item,...e]),k(!1),N(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events),g({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),H=(0,q.useCallback)(async(e,t)=>{if(t.length){v(!0),m(null),g(null);try{let n=await xe(e.id,t);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}}},[R]),ee=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await oe(e.id,t.id);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[R]),te=(0,q.useCallback)(async(e,t)=>{m(null),g(null);try{await He(e.id,t)}catch(e){m(e instanceof Error?e.message:String(e))}},[]),ne=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await he(e.id);R(t.item),await B(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),re=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await ke(e.id);R(t.item),await B(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),ie=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Tt,e.id),b(e.id)},[]),ae=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Tt)||y;S(null),b(null);let r=l.find(e=>e.id===n);!r||r.status===e||z(r,{status:e})},[y,l,z]),se=(0,q.useCallback)(e=>{z(e,{status:e.status===`done`?`todo`:`done`})},[z]),ce=(0,q.useCallback)(e=>{N(null),F([]),m(null),g(null),j(e),k(!0)},[]),ue=(0,q.useCallback)(e=>{let t=s.current;!t||t.pointerId!==e.pointerId||(s.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=(0,q.useCallback)(e=>{if(e.button!==0||y||zt(e.target))return;let t=o.current;t&&(s.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[y]),fe=(0,q.useCallback)(e=>{let t=s.current,n=o.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,T(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[p?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:p}):null,(0,J.jsx)(`section`,{ref:o,className:i(`min-h-0 flex-1 overflow-x-auto rounded-lg px-2 py-2 transition-opacity`,d&&`opacity-60`,C?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":d,onPointerDown:de,onPointerMove:fe,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{s.current?.pointerId===e.pointerId&&(s.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:i(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,x===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{y&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,S(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||S(null)},onDrop:t=>ae(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(Vt,{item:e,dragging:y===e.id,onOpen:B,onToggleDone:se,onDragStart:ie,onDragEnd:()=>{b(null),S(null)},t:r},e.id)):d?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ht,{}),(0,J.jsx)(Ht,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),d?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!d&&E?(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,l.length),children:r.loadMore}):null,(0,J.jsx)(Kt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:_,error:p,notice:h,t:r,onClose:()=>{k(!1),N(null),F([]),m(null),g(null)},onCreate:V,onSave:(e,t)=>void z(e,t),onStartChat:ne,onCreateGoal:re,onAddAttachments:(e,t)=>void H(e,t),onRemoveAttachment:(e,t)=>void ee(e,t),onDownloadAttachment:(e,t)=>void te(e,t),onPreviewError:e=>{g(null),m(e)}})]})}var Jt=[{id:`overview`,icon:ye},{id:`work-items`,icon:te},{id:`sessions`,icon:_t},{id:`goals`,icon:F},{id:`workflows`,icon:A},{id:`files`,icon:it},{id:`activity`,icon:Pe},{id:`automations`,icon:g},{id:`notes`,icon:k},{id:`settings`,icon:je}],Yt=Jt.map(e=>e.id),Xt=new Set(Jt.map(e=>e.id)),Zt=`xopc.projectTabs.`,Qt=`xopc.projectFiles.panelWidthPx`,$t=320,en=220,tn=560;function nn(e){return Math.min(tn,Math.max(en,Math.round(e)))}function rn(){try{let e=window.localStorage.getItem(Qt);if(e==null)return $t;let t=Number.parseInt(e,10);return Number.isFinite(t)?nn(t):$t}catch{return $t}}function an(e){try{window.localStorage.setItem(Qt,String(nn(e)))}catch{}}function on(e){return!!(e&&Xt.has(e))}function sn(e){return`${Zt}${e}`}function cn(e){let t=Array.isArray(e)?e:[],n=new Set,r=[];for(let e of t)!on(e)||n.has(e)||(n.add(e),r.push(e));for(let e of Yt)n.has(e)||r.push(e);return r}function ln(e){if(!e)return Yt;try{let t=window.localStorage.getItem(sn(e));return cn(t?JSON.parse(t):null)}catch{return Yt}}function un(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function dn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function fn(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 pn(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function mn(e){let t=(0,K.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.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,J.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,J.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 hn(e=!1){return i(`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 gn(e){let t=(0,K.c)(10),{label:n,value:r,mono:a}=e,o=a===void 0?!1:a,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=s);let c=o&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=i(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==s||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function X(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function _n(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bn(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 xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Sn(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 Cn(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 wn(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 Tn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Tn(e.children,t,n)}:e)}function En({currentProject:e,pm:t,projectsText:n,wd:r}){let a=ct(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)([e]),[u,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`new`),[S,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[E,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(null),[M,P]=(0,q.useState)(null),F=(0,q.useCallback)(async()=>{m(!0),g(null);try{let t=await D({limit:100});l(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){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,q.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&F()},[F,o]);let z=(0,q.useMemo)(()=>{let t=u.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=X(e);return t.every(e=>n.includes(e))}).sort((e,t)=>_n(t)-_n(e))},[e.id,c,u]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{x(e),C(``),T(``),j(null),v(!0),s(!1)},ee=(0,q.useCallback)(async(e={})=>{let t=w.trim(),n=S.trim()||(b===`directory`?vn(t):``);if(n){k(!0),j(null),P(null);try{let r=await L({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),C(``),T(``),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yn(e);t?(P(t),v(!1)):j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[b,S,a,w]),te=(0,q.useCallback)(e=>{e.preventDefault(),ee()},[ee]),ne=(0,q.useCallback)(()=>{ee({createWorkspaceRoot:!0})},[ee]),re=(0,q.useCallback)(()=>{P(null),v(!0)},[]),ie=e=>{T(e),b===`directory`&&!S.trim()&&C(vn(e))},ae=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:i(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(Ve,{className:i(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(pe,{open:o,onOpenChange:s,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group -ml-2 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,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(et,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(Ze,{children:(0,J.jsxs)(Ue,{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,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.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:u,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ae(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ae(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.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:()=>H(`new`),children:[(0,J.jsx)(le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.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:()=>H(`directory`),children:[(0,J.jsx)(it,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.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),a(`/projects`)},children:[(0,J.jsx)(je,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(N,{open:_,onOpenChange:e=>!E&&v(e),children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:b===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:b===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[A?(0,J.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:A}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.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:S,onChange:e=>C(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(bt,{value:w,onChange:ie,disabled:E,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,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:E,children:n.cancel})}),(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:E||!(S.trim()||b===`directory`&&vn(w)),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(N,{open:!!M,onOpenChange:e=>{e||P(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?un(n.workspaceMissingDescription,{workspace:M}):null})]}),M?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:M})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:E,children:n.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:E,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Dn(){let{projectId:e=``,tabId:t,noteId:n}=j(),r=ct(),o=c(e=>e.language),s=a(o),u=s.chat.workingDirectory,p=s.projectDetailPage,m=s.projectsPage,w=_(e=>e.setPageHeader),D=_(e=>e.clearPageHeader),[F,L]=(0,q.useState)(null),[B,te]=(0,q.useState)(null),[oe,ce]=(0,q.useState)([]),[de,pe]=(0,q.useState)(``),[he,ye]=(0,q.useState)([]),[xe,ke]=(0,q.useState)([]),[je,Me]=(0,q.useState)([]),[U,Pe]=(0,q.useState)([]),[Ie,Ve]=(0,q.useState)([]),[He,Ue]=(0,q.useState)(!1),[We,Je]=(0,q.useState)(null),[Xe,Ze]=(0,q.useState)([]),[et,nt]=(0,q.useState)(0),[rt,K]=(0,q.useState)(!1),[Tt,Et]=(0,q.useState)(!1),[Dt,Ot]=(0,q.useState)(!1),[kt,At]=(0,q.useState)([]),Y=(0,q.useRef)(new Set),[jt,Mt]=(0,q.useState)(null),[Nt,Pt]=(0,q.useState)(rn),[Ft,It]=(0,q.useState)(!1),[Lt,Rt]=(0,q.useState)(!1),[zt,Bt]=(0,q.useState)(``),[Vt,Ht]=(0,q.useState)([]),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(null),[Xt,Zt]=(0,q.useState)(!1),[Qt,$t]=(0,q.useState)(null),[en,tn]=(0,q.useState)([]),[X,_n]=(0,q.useState)(``),[vn,Dn]=(0,q.useState)(!0),[On,kn]=(0,q.useState)(!1),[An,jn]=(0,q.useState)(!1),[Mn,Nn]=(0,q.useState)(null),[Pn,Fn]=(0,q.useState)(!1),[In,Ln]=(0,q.useState)(`fixed`),[Rn,zn]=(0,q.useState)(``),[Bn,Vn]=(0,q.useState)(null),[Hn,Un]=(0,q.useState)(!1),[Wn,Gn]=(0,q.useState)(!1),[Kn,qn]=(0,q.useState)(0),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(!1),[Qn,$n]=(0,q.useState)(null),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[pr,mr]=(0,q.useState)(()=>ln(e)),[Q,hr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),gr=pr[0]??Yt[0],$=n?`notes`:on(t)?t:gr,_r=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),vr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),yr=(0,q.useCallback)(e=>{let t=vr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[vr]),br=(0,q.useCallback)(t=>{e&&r(vr(t),{replace:!0})},[r,e,vr]),xr=(0,q.useCallback)((e,t)=>{br(e),r(t)},[r,br]),Sr=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||br(e)},[br]),Cr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||on(t)||r(`/projects/${encodeURIComponent(e)}/${gr}`,{replace:!0})},[gr,r,e,t]),(0,q.useEffect)(()=>{mr(ln(e))},[e]);let wr=(0,q.useCallback)((t,n,r=`before`)=>{t!==n&&mr(i=>{let a=cn(i),o=a.indexOf(t),s=a.indexOf(n);if(o<0||s<0)return a;let[c]=a.splice(o,1),l=a.indexOf(n);return l<0?cn(i):(a.splice(r===`after`?l+1:l,0,c),e&&window.localStorage.setItem(sn(e),JSON.stringify(a)),a)})},[e]);(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Dn(!0),Z(null),Promise.all([V(e),ne(e),H(e),be().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;L(a),te(e),ce(n),ye(r),tn(i?.agents??[]),_n(a.defaultAgentId??``),hr({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Dn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([be(),ie(),Se()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=F?.defaultAgentId||X||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?xt(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[F?.defaultAgentId,X]);let Tr=(0,q.useCallback)(async()=>{if(F){Yn(!0),Z(null);try{let[e,t]=await Promise.all([ze(),Oe(100,{ownerAgentId:X||void 0,projectId:F.id})]);ke(e),Me(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[F,X]);(0,q.useEffect)(()=>{F&&Tr()},[F,Tr]);let Er=(0,q.useCallback)(async()=>{if(F){Ue(!0),Z(null);try{let[e,t]=await Promise.all([dt.list({projectId:F.id}),dt.runs(50,void 0,{projectId:F.id})]);Pe(e.automations),Ve(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}},[F]);(0,q.useEffect)(()=>{$===`automations`&&Er()},[Er,$]);let Dr=(0,q.useCallback)(async()=>{if(F){K(!0),Z(null);try{let e=await Ke(F.id,{includeRelated:Tt,limit:100});Ze(e.items),nt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[F,Tt]);(0,q.useEffect)(()=>{$===`activity`&&Dr()},[Dr,$]);let Or=(0,q.useCallback)(async e=>{Je(`run:${e.id}`),Z(null);try{await dt.runNow(e.id),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Je(null)}},[Er]),kr=(0,q.useCallback)(async e=>{Je(`toggle:${e.id}`),Z(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Je(null)}},[Er]),Ar=(0,q.useCallback)(async()=>{if(!F?.effectiveWorkspaceRoot?.trim()){At([]),Y.current.clear(),$t(null);return}Zt(!0),$t(null),Y.current.clear();try{At(wn((await x(F.id,``)).entries)),Y.current.add(``)}catch(e){At([]),Y.current.clear(),$t(e instanceof Error?e.message:String(e))}finally{Zt(!1)}},[F]),jr=(0,q.useCallback)(async e=>{if(!(!F?.effectiveWorkspaceRoot?.trim()||Y.current.has(e))){Y.current.add(e),$t(null);try{let t=await x(F.id,e);At(n=>Tn(n,e,wn(t.entries)))}catch(t){Y.current.delete(e),$t(t instanceof Error?t.message:String(t))}}},[F]);(0,q.useEffect)(()=>{$===`files`&&Ar()},[Ar,$]);let Mr=zt.trim();(0,q.useEffect)(()=>{if($!==`files`||!F||!Lt||!Mr){Ht([]),Wt(!1),Kt(null);return}let e=!1;Wt(!0),Kt(null),Ht([]);let t=window.setTimeout(()=>{Ye(F.id,Mr,50).then(t=>{e||Ht(t)}).catch(t=>{e||Kt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Wt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Mr,F,Lt,$]);let Nr=(0,q.useCallback)(async()=>{if(F){Gn(!0),Z(null);try{let e=await z(F.id);xr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(!1)}}},[xr,F]),Pr=(0,q.useCallback)(()=>{_r(`work-items`),qn(e=>e+1)},[_r]),Fr=(0,q.useCallback)(async()=>{if(!F)return;let[e,t]=await Promise.all([V(F.id),H(F.id)]);te(e),L(e.project),ye(t)},[F]),Ir=(0,q.useCallback)(async e=>{if(!F||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await P(F.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:St(e.evidencePlan),criteria:St(e.checklist)}}),sr(!1),_r(`goals`),await Fr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[_r,F,Fr]),Lr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!F||!dr.title.trim())){ar(!0),Z(null);try{await b(F.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,F,Fr]),Rr=(0,q.useCallback)(async e=>{if(!(!F||!er)){Zn(!0),Z(null);try{let t=X||F.defaultAgentId||void 0,n=await ue({definitionId:er.id,projectId:F.id,agentId:t,goal:e.goal,input:e.input,concurrency:e.concurrency,maxSubagents:e.maxSubagents});tr(null),await Tr(),xr(`workflows`,S(n.runId,{ownerAgentId:t}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Zn(!1)}}},[xr,F,Tr,X,er]),zr=(0,q.useCallback)(async e=>{if(F){$n(`retry:${e.id}`),Z(null);try{let t=await ae(e.id,{ownerAgentId:X||e.metadata?.agentId,projectId:e.metadata?.projectId||F.id});await Tr(),xr(`workflows`,S(t.runId,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(null)}}},[xr,F,Tr,X]),Br=(0,q.useCallback)(async e=>{$n(`cancel:${e.id}`),Z(null);try{await Qe(e.id,{ownerAgentId:X||e.metadata?.agentId}),await Tr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(null)}},[Tr,X]),Vr=(0,q.useMemo)(()=>(0,J.jsx)(ut,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.backToProjects,children:(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0})}),[p.backToProjects]),Hr=(0,q.useMemo)(()=>F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Pr,children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.workItems.create.header]}),(0,J.jsxs)(G,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Nr(),disabled:Wn,children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[Pr,p.common.newChat,p.workItems.create.header,F,Nr,Wn]);(0,q.useLayoutEffect)(()=>(w({startExtra:Vr,main:F?(0,J.jsx)(En,{currentProject:F,pm:p,projectsText:m,wd:u}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:Hr}),()=>D()),[D,Hr,Vr,p,F,m,w,u]);function Ur(e){L(t=>t?{...t,...e}:null),te(t=>t?{...t,project:{...t.project,...e}}:null),_n(e.defaultAgentId??``),hr(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Wr(){if(!(!F||!Q.name.trim())){kn(!0),Z(null),Nn(null);try{Ur(await se(F.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=yn(e);t?Nn(t):Z(e instanceof Error?e.message:String(e))}finally{kn(!1)}}}function Gr(e){e.preventDefault(),Wr()}let Kr=(0,q.useCallback)(()=>{if(!F)return;let e=F.workspaceRoot?.trim()??``;Ln(e?`fixed`:`follow`),zn(e||F.effectiveWorkspaceRoot||``),Fn(!0)},[F]);async function qr(e={}){if(!F)return;let t=In===`fixed`?Rn.trim():``;if(!(In===`fixed`&&!t)){kn(!0),Z(null),Nn(null);try{Ur(await se(F.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Fn(!1),Nn(null)}catch(e){let t=yn(e);t?(Nn(t),Fn(!1)):Z(e instanceof Error?e.message:String(e))}finally{kn(!1)}}}async function Jr(){if(!(!F||Bn)){Vn(`pin`),Z(null);try{Ur(F.pinnedAt?await Ae(F.id):await ve(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Vn(null)}}}async function Yr(){if(!(!F||Bn)){Vn(`archive`),Z(null);try{Ur(F.status===`archived`?await $e(F.id):await f(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Vn(null)}}}async function Xr(){if(F){Un(!0),Z(null);try{await v(F.id),jn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Un(!1)}}}async function Zr(){if(!(!F||Dt)){Ot(!0),Z(null);try{await Be(F.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ot(!1)}}}let Qr=(0,q.useCallback)(e=>{Mt(e)},[]),$r=(0,q.useCallback)((e,t)=>{t||Mt(e)},[]),ei=(0,q.useCallback)(async(e,t,n)=>{let r=F?.id;if(r)switch(e){case`preview`:t.isDirectory||Mt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Fe(t.path);if(ge(fe(e))!==`text`){let n=await Le(t.path,{projectId:r}),i=Ne(e)??`application/octet-stream`;Ce(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ee(t.path,{projectId:r});Ge(e,n)}}catch(e){at(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await Re(t.absolutePath??t.path)&&at(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{at(`warning`,s.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}},[s.clipboard.copyFailed,s.workspace.pathCopied,F?.id]),ti=(0,q.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),It(!0);let r=e.clientX,i=Nt,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=nn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}It(!1),Pt(c),an(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)},[Nt]);if((0,q.useEffect)(()=>{$!==`files`&&Mt(null)},[e,$]),vn)return(0,J.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!F)return(0,J.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(ut,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),p.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:cr||p.notFound})]});let ni=B?.recentSessions.length?B.recentSessions:F.recentSessions,ri=B?.attentionItems??[],ii=e=>p.statuses[e]??e,ai=e=>un(p.common.messages,{count:e}),oi=de.trim().toLowerCase(),si=oi?oe.filter(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ai(e.messageCount??0);return[r,e.key,n,t,i].filter(Boolean).join(` `).toLowerCase().includes(oi)}):oe,ci=oe.length>0&&si.length===0,li=en.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||p.settings.globalDefaultAgent,ui=en.find(e=>e.id===Q.defaultAgentId),di=F.workspaceRoot?.trim()||``,fi=F.status===`archived`,pi=!!F.pinnedAt,mi=!di,hi=di||ui?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,gi=In===`fixed`?Rn.trim()||p.settings.workspacePlaceholder:ui?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,_i=(In===`fixed`?Rn.trim():``)!==di&&(In===`follow`||!!Rn.trim()),vi=pr.map(e=>{let t=Jt.find(t=>t.id===e);return{...t,label:t.id===`work-items`?p.workItems.tab:p.tabs[t.id]}});async function yi(){if(!hi)return;let e=await Re(hi);at(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function bi(){Nn(null),Fn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsx)(yt,{items:vi,activeTab:$,onChange:_r,onReorder:wr,ariaLabel:p.navAria,tabIdPrefix:`project-tab`,panelIdPrefix:`project-panel`,className:`shrink-0`}),cr?(0,J.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:cr}):null,(0,J.jsxs)(`div`,{className:i(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-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,J.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,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:B?.digest?.summary||B?.recommendedAction||F.description||F.brief||p.overview.directionFallback}),B?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:un(p.overview.recommendedNext,{action:B.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,onClick:()=>void Zr(),disabled:Dt,children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),Dt?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:B?.nextActions.length?B.nextActions.map(e=>(0,J.jsxs)(ut,{to:yr(e.goalId),onClick:Sr(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]})]}),(0,J.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,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),ri.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:ri.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(E,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${ii(e.status)}`:``]})]});return e.href?(0,J.jsx)(ut,{to:e.href,onClick:Sr(Cr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:Lr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,J.jsx)(G,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?p.overview.addingBlocker:p.overview.addBlocker,title:ir?p.overview.addingBlocker:p.overview.addBlocker,children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(mt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>_r(`sessions`),children:p.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:ni.length?ni.map(e=>(0,J.jsxs)(ut,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Sr(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:dn(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(qt,{projectId:F.id,createRequestKey:Kn}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.workflows.runsHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Tr(),disabled:Jn,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Jn&&je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.loadingRuns}):je.length?je.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>xr(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pn(e.status)),children:ii(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:un(p.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:dn(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>xr(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:p.common.open}),n?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Qn===`retry:${e.id}`,onClick:()=>void zr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),p.common.retry]}):null,t?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Qn===`cancel:${e.id}`,onClick:()=>void Br(e),children:[(0,J.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),p.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:xe.length?xe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>tr(e),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(A,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:p.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Er(),disabled:He,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>xr(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:He&&U.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.loading}):U.length?U.map(e=>{let t=Ie.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ie.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>xr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:i(`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?p.automations.enabled:p.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:un(p.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?dn(t.createdAtMs):p.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`run:${e.id}`||!!n,onClick:()=>void Or(e),children:[(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p.automations.run]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`toggle:${e.id}`,onClick:()=>void kr(e),children:[e.enabled?(0,J.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>xr(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ie.length?Ie.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:dn(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:F.workspaceRoot||F.effectiveWorkspaceRoot||p.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(vt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(F.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${F.id}`,captureTags:[`project:${F.id}`,F.slug],listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${F.id}`})}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-tab-files`,className:`h-full min-h-[28rem]`,children:(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:F.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:i(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ft&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Nt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(gt,{workspacePath:hi}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:i(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Lt&&`bg-surface-hover text-fg`),onClick:()=>Rt(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":Lt,children:(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(re,{className:`size-7 shrink-0 rounded-md p-0`,loading:Xt,label:s.cron.refresh,onClick:()=>void Ar()})]})]}),Lt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.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,J.jsx)(me,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:zt,onChange:e=>Bt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,autoFocus:!0,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.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":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{Bt(``),Rt(!1)},children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Qt?(0,J.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:Qt}):null,Mr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Ut?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`})]}):Gt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Gt]}):Vt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Vt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:i(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,jt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Mt(e.path),title:e.path,children:[(0,J.jsx)(k,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Xt&&kt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,J.jsx)(we,{tree:kt,selectedPath:jt,onSelectFile:Qr,onSelectEntry:$r,onExpandDir:e=>void jr(e),onAction:ei,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:i(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ft&&`bg-surface-hover`),onPointerDown:ti,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:jt?(0,J.jsx)(st,{filePath:jt,projectId:F.id,onClose:()=>Mt(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(it,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>_r(`settings`),children:p.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[oe.length?(0,J.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,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:de,onChange:e=>pe(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.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`}),de?(0,J.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":p.sessions.clearSearch,onClick:()=>pe(``),children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,si.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:si.map(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ai(e.messageCount??0);return(0,J.jsxs)(ut,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Sr(`sessions`),className:`group flex min-h-[11rem] 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,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.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,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:r}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-muted`,title:e.key,children:e.key})]})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:i})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):ci?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.goals.title})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:he.length?he.map(e=>(0,J.jsxs)(ut,{to:yr(e.id),onClick:Sr(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||p.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:p.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:un(p.activity.count,{count:et})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(`input`,{type:`checkbox`,checked:Tt,onChange:e=>Et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.activity.includeRelated]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Dr(),disabled:rt,children:[(0,J.jsx)(W,{className:i(`size-4`,rt&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:rt&&Xe.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.loading}):Xe.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Xe.map(e=>{let t=p.activity.types[e.type]??e.type,n=p.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Cn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===F.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:dn(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.activity.actor,`: `,bn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.activity.source,`: `,Sn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-tab-settings`,onSubmit:Gr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.contextHint})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(Q.status)),children:p.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(gn,{label:p.settings.workspaceRoot,value:hi,mono:!0}),(0,J.jsx)(gn,{label:p.settings.defaultAgent,value:li}),(0,J.jsx)(gn,{label:p.settings.pinState,value:pi?p.settings.pinned:p.settings.notPinned}),(0,J.jsx)(gn,{label:p.settings.createdAt,value:dn(F.createdAt)||p.common.never}),(0,J.jsx)(gn,{label:p.settings.updatedAt,value:dn(F.updatedAt)||p.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(mn,{label:p.settings.name,children:(0,J.jsx)(`input`,{className:hn(),value:Q.name,onChange:e=>hr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(mn,{label:p.settings.defaultAgent,children:(0,J.jsxs)(l,{className:hn(),value:Q.defaultAgentId,onChange:e=>hr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(tt,{value:``,children:p.settings.globalDefaultAgent}),en.map(e=>(0,J.jsx)(tt,{value:e.id,children:qe(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(mn,{label:p.settings.status,children:fi?(0,J.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:p.settings.statuses.archived}):(0,J.jsxs)(l,{className:hn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>hr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(tt,{value:`active`,children:p.settings.statuses.active}),(0,J.jsx)(tt,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,J.jsx)(mn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.description,onChange:e=>hr(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:mi?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:hi,children:hi})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void yi(),children:[(0,J.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,J.jsx)(gt,{workspacePath:hi}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Kr,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.agentContextHint})]}),(0,J.jsx)(mn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.brief,onChange:e=>hr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(mn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.instructions,onChange:e=>hr(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:pi?p.settings.pinnedTitle:p.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Bn===`pin`,onClick:()=>void Jr(),children:[pi?(0,J.jsx)(lt,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(M,{className:`size-4`,"aria-hidden":!0}),pi?p.settings.unpinProject:p.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:fi?p.settings.restoreTitle:p.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:fi?p.settings.restoreHint:p.settings.archiveHint})]}),(0,J.jsxs)(G,{type:`button`,variant:fi?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Bn===`archive`,onClick:()=>void Yr(),children:[fi?(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),fi?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,J.jsxs)(G,{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:()=>jn(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(G,{type:`submit`,variant:`primary`,disabled:On||!Q.name.trim(),children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),p.common.save]})})]}):null]}),(0,J.jsx)(N,{open:An,onOpenChange:e=>{Hn||jn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.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,J.jsx)(E,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:F?un(p.settings.deleteConfirm,{name:F.name}):p.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Hn,children:p.common.cancel})}),(0,J.jsxs)(G,{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:Hn||!F,onClick:()=>void Xr(),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(N,{open:Pn,onOpenChange:e=>{On||Fn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,In===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:In===`fixed`,onChange:()=>Ln(`fixed`),disabled:On}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,In===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:In===`follow`,onChange:()=>Ln(`follow`),disabled:On}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),In===`fixed`?(0,J.jsx)(bt,{value:Rn,onChange:zn,disabled:On,wd:u,placeholder:p.settings.workspacePlaceholder,inputClassName:hn(),autoFocus:!0}):null,(0,J.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:p.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:un(p.settings.workspaceCurrent,{workspace:gi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:On,children:p.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:On||!_i,onClick:()=>void qr(),children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(N,{open:!!Mn,onOpenChange:e=>{e||Nn(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Mn?un(p.settings.workspaceMissingDescription,{workspace:Mn}):null})]}),Mn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Mn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:bi,disabled:On,children:p.settings.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void qr({createWorkspaceRoot:!0}),disabled:On,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Ct,{open:or,t:s.goalsPage,chat:s.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Ir}),(0,J.jsx)(wt,{open:!!er,definition:er,language:o,starting:Xn,onClose:()=>!Xn&&tr(null),onStart:e=>void Rr(e)})]})}export{Dn as ProjectDetailPage};
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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{a as o,t as s}from"./fetch-6HXXdO77.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{$a as l,Ac as u,Ba as d,Bi as f,Cc as p,Dc as m,Do as h,Eo as g,Ga as _,Gi as v,Ha as y,Hi as b,Ji as x,L as S,Nc as C,Oc as w,Os as T,Qc as E,Qi as D,Ra as O,Sc as k,Ss as A,Tl as j,Ts as M,Ua as N,Ui as P,Uo as F,Va as I,Vi as L,Wa as R,Wi as z,Xc as B,Xi as V,Yi as H,Yo as ee,Ys as te,Zi as ne,_i as re,_n as ie,_t as ae,a as oe,aa as se,at as ce,bs as le,bt as ue,ca as de,ci as fe,co as pe,cs as me,d as he,di as ge,ds as _e,ea as ve,ec as ye,er as be,f as xe,fa as Se,fi as Ce,gi as we,ha as Te,hi as Ee,hl as De,ht as Oe,i as ke,ia as Ae,is as je,ks as Me,l as U,la as Ne,lc as Pe,li as Fe,lo as Ie,mi as Le,mo as Re,mt as ze,na as Be,nl as Ve,o as He,oo as Ue,p as We,pi as Ge,ps as W,qi as Ke,qn as qe,r as Je,ra as Ye,s as Xe,so as Ze,st as Qe,ta as $e,tl as et,to as tt,u as nt,ui as rt,vc as it,vi as at,vl as ot,vn as st,wl as ct,wo as G,ws as lt,xl as ut,y as dt,yc as ft,za as pt,zc as mt,zo as ht,zr as gt,zs as _t}from"./index-BOme955B.js";import{t as vt}from"./notes-workbench-SPdKpvSN.js";import{t as yt}from"./page-tabs-DYNWfN6S.js";import{t as bt}from"./directory-picker-path-field-MT71cjgl.js";import{t as xt}from"./goals-config-api--3Vzceq-.js";import{n as St,t as Ct}from"./goal-create-dialog-BOWSTGB-.js";import{t as wt}from"./workflow-start-dialog-B5xdDFV-.js";var K=n(),q=e(t(),1),J=r(),Tt=`application/x-xopc-work-item`,Et=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Dt=[`low`,`normal`,`high`,`urgent`];function Ot(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function kt(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function At(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Y(e){return`${e.name}:${e.size}:${e.lastModified}`}function jt(e,t){return fe(e,t)!==`unsupported`}function Mt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Nt(e,t){return{id:e.id,name:e.fileName,type:Mt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Pt(e,t){let n=rt(e.name||`upload`,e.type||`application/octet-stream`),r=de(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Mt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Ft(e){let t=(0,K.c)(3),[n,r]=(0,q.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,q.useEffect)(i,a),n}function It(e,t){let n=(0,K.c)(5),[r,i]=(0,q.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await s(We(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,q.useEffect)(a,o),r}function Lt(e){let t=(0,K.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(p,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Rt(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function zt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Bt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Vt(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:a,onToggleDone:o,onDragStart:s,onDragEnd:c,t:l}=e,u=n.status===`done`,d;t[0]!==n||t[1]!==s?(d=e=>s(n,e),t[0]=n,t[1]=s,t[2]=d):d=t[2];let f=l.dragToUpdate,p=r&&`opacity-50`,h;t[3]===p?h=t[4]:(h=i(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel px-3 py-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,p),t[3]=p,t[4]=h);let g=u?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=i(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=u?l.markTodo:l.markDone,y=u?l.markTodo:l.markDone,b;t[7]!==n||t[8]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u?(0,J.jsx)(B,{className:`size-3`,"aria-hidden":!0}):null,t[10]=u,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==a?(C=()=>a(n),t[18]=n,t[19]=a,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==l?(T=Bt(n,l),t[23]=n,t[24]=l,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ot(n.status)),t[35]=n.status,t[36]=k);let A=l.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=l.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Me,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(m,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==l.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(ut,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[l.detail.openItem,L]}),t[47]=l.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let V;return t[56]!==c||t[57]!==l.dragToUpdate||t[58]!==d||t[59]!==O||t[60]!==z||t[61]!==h?(V=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:d,onDragEnd:c,title:f,className:h,children:[O,z]}),t[56]=c,t[57]=l.dragToUpdate,t[58]=d,t[59]=O,t[60]=z,t[61]=h,t[62]=V):V=t[62],V}function Ht(){let e=(0,K.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function Ut(e){let t=(0,K.c)(44),{file:n,index:r,busy:a,previewBusy:o,t:s,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=rt(n.name||`upload`,n.type||`application/octet-stream`),d=jt(n.name||`upload`,u),f=Ft,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),g=n.name||`upload`,_=a||o,v;t[5]!==n||t[6]!==c?(v=()=>c(n),t[5]=n,t[6]=c,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(Lt,{name:g,mimeType:u,thumbnailUrl:m,previewable:d,disabled:_,onOpen:v}),t[8]=u,t[9]=d,t[10]=g,t[11]=_,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=i(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||a||o,C;t[17]!==n||t[18]!==c?(C=()=>c(n),t[17]=n,t[18]=c,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=At(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==a||t[37]!==s.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:k,children:A}),t[36]=a,t[37]=s.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function Wt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:a,previewBusy:o,t:s,onOpen:c,onDownload:l,onRemove:d}=e,f;t[0]!==r.fileName||t[1]!==r.mimeType?(f=jt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=f):f=t[2];let p=f,m=It(n.id,r),h=a||o,g;t[3]!==r||t[4]!==n||t[5]!==c?(g=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=g):g=t[6];let _;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==p||t[10]!==h||t[11]!==g||t[12]!==m?(_=(0,J.jsx)(Lt,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:m,previewable:p,disabled:h,onOpen:g}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=p,t[10]=h,t[11]=g,t[12]=m,t[13]=_):_=t[13];let v=p?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,y;t[14]===v?y=t[15]:(y=i(`min-w-0 flex-1 text-left`,v),t[14]=v,t[15]=y);let b=!p||a||o,x;t[16]!==r||t[17]!==n||t[18]!==c?(x=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,t[19]=x):x=t[19];let S;t[20]===r.fileName?S=t[21]:(S=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=S);let C=r.mimeType,w;t[22]===r.size?w=t[23]:(w=At(r.size),t[22]=r.size,t[23]=w);let T;t[24]!==r.mimeType||t[25]!==w?(T=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[C,` · `,w]}),t[24]=r.mimeType,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==T||t[28]!==y||t[29]!==b||t[30]!==x||t[31]!==S?(E=(0,J.jsxs)(`button`,{type:`button`,className:y,disabled:b,onClick:x,children:[S,T]}),t[27]=T,t[28]=y,t[29]=b,t[30]=x,t[31]=S,t[32]=E):E=t[32];let D;t[33]!==r||t[34]!==n||t[35]!==l?(D=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==a||t[39]!==s.attachments.download||t[40]!==D?(k=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.download,"aria-label":s.attachments.download,disabled:a,onClick:D,children:O}),t[38]=a,t[39]=s.attachments.download,t[40]=D,t[41]=k):k=t[41];let A;t[42]!==r||t[43]!==n||t[44]!==d?(A=()=>d(n,r),t[42]=r,t[43]=n,t[44]=d,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(ht,{className:`size-3.5`,"aria-hidden":!0}),t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s.attachments.remove||t[49]!==A?(M=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:A,children:j}),t[47]=a,t[48]=s.attachments.remove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==E||t[52]!==k||t[53]!==M||t[54]!==_?(N=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[_,E,k,M]}),t[51]=E,t[52]=k,t[53]=M,t[54]=_,t[55]=N):N=t[55],N}function Gt({mode:e,item:t,pendingFiles:n,busy:r,t:a,onPendingFilesChange:c,onUpload:l,onRemove:u,onDownload:d,onPreviewError:f}){let p=(0,q.useRef)(null),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=o(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){l(t,r);return}let i=new Set(n.map(Y)),a=[...n];for(let e of r){let t=Y(e);i.has(t)||(i.add(t),a.push(e))}c(a)}function T(e){c(n.filter((t,n)=>n!==e))}async function E(e){let t=Y(e);x(`pending:${t}`);try{y(await Pt(e,`pending:${t}`)),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await s(We(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Nt(t,de(await n.arrayBuffer()))),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:i(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,m&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),w(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Me,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:a.attachments.title})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>p.current?.click(),children:[(0,J.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),a.attachments.add]}),(0,J.jsx)(`input`,{ref:p,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(Ut,{file:e,index:t,busy:r,previewBusy:b===`pending:${Y(e)}`,t:a,onOpen:e=>void E(e),onRemove:T},Y(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Wt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:a,onOpen:(e,t)=>void D(e,t),onDownload:d,onRemove:u},e.id))}):null,!n.length&&!C.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.attachments.empty}):null]}),(0,J.jsx)(ce,{open:g,attachment:v,authToken:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function Kt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:a,events:o,busy:s,error:c,notice:u,t:f,onClose:p,onCreate:g,onSave:_,onStartChat:v,onCreateGoal:b,onAddAttachments:x,onRemoveAttachment:S,onDownloadAttachment:C,onPreviewError:w}=e,T=n!==null,[E,D]=(0,q.useState)(``),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(`todo`),[P,L]=(0,q.useState)(`normal`),[z,V]=(0,q.useState)(``),[H,ee]=(0,q.useState)(``),te;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[0]=te):te=t[0];let[ne,re]=(0,q.useState)(te),ie,ae;t[1]!==a||t[2]!==r||t[3]!==n?(ie=()=>{if(n===`create`){D(``),A(``),M(a),L(`normal`),V(``),ee(``),re([]);return}n===`detail`&&r&&(D(r.title),A(r.description??``),M(r.status),L(r.priority),V(r.nextAction??``),ee(r.blockedReason??``),re([]))},ae=[a,r,n],t[1]=a,t[2]=r,t[3]=n,t[4]=ie,t[5]=ae):(ie=t[4],ae=t[5]),(0,q.useEffect)(ie,ae);let oe;t[6]!==H||t[7]!==k||t[8]!==r||t[9]!==n||t[10]!==z||t[11]!==g||t[12]!==_||t[13]!==ne||t[14]!==P||t[15]!==j||t[16]!==E?(oe=function(e){e.preventDefault();let t=E.trim();if(t){if(n===`create`){g({title:t,description:k.trim()||void 0,priority:P,status:j,nextAction:z.trim()||void 0,blockedReason:H.trim()||void 0,attachments:ne});return}r&&_(r,{title:t,description:k.trim()||null,status:j,priority:P,nextAction:z.trim()||null,blockedReason:H.trim()||null})}},t[6]=H,t[7]=k,t[8]=r,t[9]=n,t[10]=z,t[11]=g,t[12]=_,t[13]=ne,t[14]=P,t[15]=j,t[16]=E,t[17]=oe):oe=t[17];let se=oe,ce;t[18]===p?ce=t[19]:(ce=e=>!e&&p(),t[18]=p,t[19]=ce);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ue):ue=t[20];let de=n===`create`?f.create.title:r?.title||f.title,fe;t[21]===de?fe=t[22]:(fe=(0,J.jsx)(R,{className:`truncate text-base font-semibold text-fg`,children:de}),t[21]=de,t[22]=fe);let pe;t[23]===f.detail.description?pe=t[24]:(pe=(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:f.detail.description}),t[23]=f.detail.description,t[24]=pe);let me;t[25]!==fe||t[26]!==pe?(me=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[fe,pe]}),t[25]=fe,t[26]=pe,t[27]=me):me=t[27];let he;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,J.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[28]=he):he=t[28];let ge;t[29]===s?ge=t[30]:(ge=(0,J.jsx)(O,{asChild:!0,children:(0,J.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`,disabled:s,children:he})}),t[29]=s,t[30]=ge);let _e;t[31]!==me||t[32]!==ge?(_e=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[me,ge]}),t[31]=me,t[32]=ge,t[33]=_e):_e=t[33];let ve;t[34]===c?ve=t[35]:(ve=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ve);let ye;t[36]!==c||t[37]!==u?(ye=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=ye):ye=t[38];let be;t[39]===f.create.titleLabel?be=t[40]:(be=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.titleLabel}),t[39]=f.create.titleLabel,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>D(e.target.value),t[41]=xe):xe=t[41];let Se=n===`create`,Ce;t[42]!==Se||t[43]!==E?(Ce=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:E,onChange:xe,autoFocus:Se}),t[42]=Se,t[43]=E,t[44]=Ce):Ce=t[44];let we;t[45]!==be||t[46]!==Ce?(we=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[be,Ce]}),t[45]=be,t[46]=Ce,t[47]=we):we=t[47];let Te;t[48]===f.detail.status?Te=t[49]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.detail.status}),t[48]=f.detail.status,t[49]=Te);let Ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>M(e.target.value),t[50]=Ee):Ee=t[50];let De;t[51]===f.statuses?De=t[52]:(De=Et.map(e=>(0,J.jsx)(tt,{value:e,children:f.statuses[e]},e)),t[51]=f.statuses,t[52]=De);let Oe;t[53]!==j||t[54]!==De?(Oe=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Ee,children:De}),t[53]=j,t[54]=De,t[55]=Oe):Oe=t[55];let ke;t[56]!==Te||t[57]!==Oe?(ke=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Oe]}),t[56]=Te,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===f.create.priorityLabel?Ae=t[60]:(Ae=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.priorityLabel}),t[59]=f.create.priorityLabel,t[60]=Ae);let je;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>L(e.target.value),t[61]=je):je=t[61];let Me;t[62]===f.priorities?Me=t[63]:(Me=Dt.map(e=>(0,J.jsx)(tt,{value:e,children:f.priorities[e]},e)),t[62]=f.priorities,t[63]=Me);let U;t[64]!==P||t[65]!==Me?(U=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:je,children:Me}),t[64]=P,t[65]=Me,t[66]=U):U=t[66];let Ne;t[67]!==Ae||t[68]!==U?(Ne=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ae,U]}),t[67]=Ae,t[68]=U,t[69]=Ne):Ne=t[69];let Pe;t[70]!==ke||t[71]!==Ne?(Pe=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Ne]}),t[70]=ke,t[71]=Ne,t[72]=Pe):Pe=t[72];let Fe;t[73]===f.create.descriptionLabel?Fe=t[74]:(Fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.descriptionLabel}),t[73]=f.create.descriptionLabel,t[74]=Fe);let Ie;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>A(e.target.value),t[75]=Ie):Ie=t[75];let Le;t[76]===k?Le=t[77]:(Le=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:Ie}),t[76]=k,t[77]=Le);let Re;t[78]!==Fe||t[79]!==Le?(Re=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Fe,Le]}),t[78]=Fe,t[79]=Le,t[80]=Re):Re=t[80];let ze;t[81]!==s||t[82]!==r||t[83]!==n||t[84]!==x||t[85]!==C||t[86]!==w||t[87]!==S||t[88]!==ne||t[89]!==f?(ze=(0,J.jsx)(Gt,{mode:n,item:r,pendingFiles:ne,busy:s,t:f,onPendingFilesChange:re,onUpload:x,onRemove:S,onDownload:C,onPreviewError:w}),t[81]=s,t[82]=r,t[83]=n,t[84]=x,t[85]=C,t[86]=w,t[87]=S,t[88]=ne,t[89]=f,t[90]=ze):ze=t[90];let Be;t[91]!==H||t[92]!==n||t[93]!==z||t[94]!==j||t[95]!==f.blockedReason||t[96]!==f.nextAction?(Be=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:z,onChange:e=>V(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:i(`font-medium`,j===`blocked`||j===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:f.blockedReason}),(0,J.jsx)(`textarea`,{className:i(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,j===`blocked`||j===`needs_input`?`border-red-500/40`:`border-edge`),value:H,onChange:e=>ee(e.target.value)})]})]}):null,t[91]=H,t[92]=n,t[93]=z,t[94]=j,t[95]=f.blockedReason,t[96]=f.nextAction,t[97]=Be):Be=t[97];let Ve;t[98]!==ve||t[99]!==ye||t[100]!==we||t[101]!==Pe||t[102]!==Re||t[103]!==ze||t[104]!==Be?(Ve=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ve,ye,we,Pe,Re,ze,Be]}),t[98]=ve,t[99]=ye,t[100]=we,t[101]=Pe,t[102]=Re,t[103]=ze,t[104]=Be,t[105]=Ve):Ve=t[105];let He;t[106]!==s||t[107]!==r||t[108]!==n||t[109]!==b||t[110]!==v||t[111]!==f.detail.actions||t[112]!==f.detail.createGoal||t[113]!==f.detail.openItem||t[114]!==f.detail.startChat?(He=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>v(r),children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),f.detail.startChat]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>b(r),children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),f.detail.createGoal]}),(0,J.jsx)(G,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(ut,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),f.detail.openItem]})})]})]}):null,t[106]=s,t[107]=r,t[108]=n,t[109]=b,t[110]=v,t[111]=f.detail.actions,t[112]=f.detail.createGoal,t[113]=f.detail.openItem,t[114]=f.detail.startChat,t[115]=He):He=t[115];let Ue;t[116]===f.detail.links?Ue=t[117]:(Ue=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.links}),t[116]=f.detail.links,t[117]=Ue);let We;t[118]!==r||t[119]!==f.detail.noLinks||t[120]!==f.linkKinds?(We=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(ut,{to:Rt(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[f.linkKinds[e.kind],(0,J.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noLinks}),t[118]=r,t[119]=f.detail.noLinks,t[120]=f.linkKinds,t[121]=We):We=t[121];let Ge;t[122]===We?Ge=t[123]:(Ge=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:We}),t[122]=We,t[123]=Ge);let W;t[124]!==Ue||t[125]!==Ge?(W=(0,J.jsxs)(`section`,{children:[Ue,Ge]}),t[124]=Ue,t[125]=Ge,t[126]=W):W=t[126];let Ke;t[127]===f.detail.activity?Ke=t[128]:(Ke=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.activity}),t[127]=f.detail.activity,t[128]=Ke);let qe;t[129]!==o||t[130]!==f.detail.noActivity||t[131]!==f.eventTypes?(qe=o.length?o.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:f.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:kt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noActivity}),t[129]=o,t[130]=f.detail.noActivity,t[131]=f.eventTypes,t[132]=qe):qe=t[132];let Je;t[133]===qe?Je=t[134]:(Je=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:qe}),t[133]=qe,t[134]=Je);let Ye;t[135]!==Ke||t[136]!==Je?(Ye=(0,J.jsxs)(`section`,{children:[Ke,Je]}),t[135]=Ke,t[136]=Je,t[137]=Ye):Ye=t[137];let Xe;t[138]!==He||t[139]!==W||t[140]!==Ye?(Xe=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[He,W,Ye]}),t[138]=He,t[139]=W,t[140]=Ye,t[141]=Xe):Xe=t[141];let Ze;t[142]!==Ve||t[143]!==Xe?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[Ve,Xe]}),t[142]=Ve,t[143]=Xe,t[144]=Ze):Ze=t[144];let Qe;t[145]!==s||t[146]!==p||t[147]!==f.create.cancel?(Qe=(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:p,disabled:s,children:f.create.cancel}),t[145]=s,t[146]=p,t[147]=f.create.cancel,t[148]=Qe):Qe=t[148];let $e;t[149]!==s||t[150]!==E?($e=s||!E.trim(),t[149]=s,t[150]=E,t[151]=$e):$e=t[151];let et;t[152]===n?et=t[153]:(et=n===`create`?(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=et);let nt=n===`create`?f.create.submit:f.detail.save,rt;t[154]!==$e||t[155]!==et||t[156]!==nt?(rt=(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[et,nt]}),t[154]=$e,t[155]=et,t[156]=nt,t[157]=rt):rt=t[157];let it;t[158]!==Qe||t[159]!==rt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,rt]}),t[158]=Qe,t[159]=rt,t[160]=it):it=t[160];let at;t[161]!==se||t[162]!==_e||t[163]!==Ze||t[164]!==it?(at=(0,J.jsxs)(y,{children:[ue,(0,J.jsx)(pt,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,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,J.jsxs)(`form`,{onSubmit:se,className:`flex min-h-0 flex-1 flex-col`,children:[_e,Ze,it]})})]}),t[161]=se,t[162]=_e,t[163]=Ze,t[164]=it,t[165]=at):at=t[165];let ot;return t[166]!==T||t[167]!==ce||t[168]!==at?(ot=(0,J.jsx)(N,{open:T,onOpenChange:ce,children:at}),t[166]=T,t[167]=ce,t[168]=at,t[169]=ot):ot=t[169],ot}function qt({projectId:e,createRequestKey:t=0}){let n=ct(),r=a(c(e=>e.language)).projectDetailPage.workItems,o=(0,q.useRef)(null),s=(0,q.useRef)(null),[l,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!0),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),[C,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{f(!0),m(null);try{let r=await Xe(e,{limit:100,offset:n});u(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),m(null),g(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Et.map(e=>({status:e,title:r.statuses[e],items:l.filter(t=>t.status===e)})),[l,r.statuses]),R=(0,q.useCallback)(e=>{u(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),z=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await nt(e.id,t);n.item.archivedAt?(u(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(n.item),g({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,R]),B=(0,q.useCallback)(async e=>{N(e),F([]),m(null),g(null);let t=await U(e.id).catch(()=>null);t&&F(t.events)},[]),V=(0,q.useCallback)(async t=>{v(!0),m(null),g(null);try{let n=await Je(e,t);u(e=>[n.item,...e]),k(!1),N(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events),g({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),H=(0,q.useCallback)(async(e,t)=>{if(t.length){v(!0),m(null),g(null);try{let n=await xe(e.id,t);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}}},[R]),ee=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await oe(e.id,t.id);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[R]),te=(0,q.useCallback)(async(e,t)=>{m(null),g(null);try{await He(e.id,t)}catch(e){m(e instanceof Error?e.message:String(e))}},[]),ne=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await he(e.id);R(t.item),await B(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),re=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await ke(e.id);R(t.item),await B(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),ie=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Tt,e.id),b(e.id)},[]),ae=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Tt)||y;S(null),b(null);let r=l.find(e=>e.id===n);!r||r.status===e||z(r,{status:e})},[y,l,z]),se=(0,q.useCallback)(e=>{z(e,{status:e.status===`done`?`todo`:`done`})},[z]),ce=(0,q.useCallback)(e=>{N(null),F([]),m(null),g(null),j(e),k(!0)},[]),ue=(0,q.useCallback)(e=>{let t=s.current;!t||t.pointerId!==e.pointerId||(s.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=(0,q.useCallback)(e=>{if(e.button!==0||y||zt(e.target))return;let t=o.current;t&&(s.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[y]),fe=(0,q.useCallback)(e=>{let t=s.current,n=o.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,T(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[p?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:p}):null,(0,J.jsx)(`section`,{ref:o,className:i(`min-h-0 flex-1 overflow-x-auto rounded-lg px-2 py-2 transition-opacity`,d&&`opacity-60`,C?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":d,onPointerDown:de,onPointerMove:fe,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{s.current?.pointerId===e.pointerId&&(s.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:i(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,x===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{y&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,S(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||S(null)},onDrop:t=>ae(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(Vt,{item:e,dragging:y===e.id,onOpen:B,onToggleDone:se,onDragStart:ie,onDragEnd:()=>{b(null),S(null)},t:r},e.id)):d?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ht,{}),(0,J.jsx)(Ht,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),d?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!d&&E?(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,l.length),children:r.loadMore}):null,(0,J.jsx)(Kt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:_,error:p,notice:h,t:r,onClose:()=>{k(!1),N(null),F([]),m(null),g(null)},onCreate:V,onSave:(e,t)=>void z(e,t),onStartChat:ne,onCreateGoal:re,onAddAttachments:(e,t)=>void H(e,t),onRemoveAttachment:(e,t)=>void ee(e,t),onDownloadAttachment:(e,t)=>void te(e,t),onPreviewError:e=>{g(null),m(e)}})]})}var Jt=[{id:`overview`,icon:ye},{id:`work-items`,icon:te},{id:`sessions`,icon:_t},{id:`goals`,icon:F},{id:`workflows`,icon:A},{id:`files`,icon:it},{id:`activity`,icon:Pe},{id:`automations`,icon:g},{id:`notes`,icon:k},{id:`settings`,icon:je}],Yt=Jt.map(e=>e.id),Xt=new Set(Jt.map(e=>e.id)),Zt=`xopc.projectTabs.`,Qt=`xopc.projectFiles.panelWidthPx`,$t=320,en=220,tn=560;function nn(e){return Math.min(tn,Math.max(en,Math.round(e)))}function rn(){try{let e=window.localStorage.getItem(Qt);if(e==null)return $t;let t=Number.parseInt(e,10);return Number.isFinite(t)?nn(t):$t}catch{return $t}}function an(e){try{window.localStorage.setItem(Qt,String(nn(e)))}catch{}}function on(e){return!!(e&&Xt.has(e))}function sn(e){return`${Zt}${e}`}function cn(e){let t=Array.isArray(e)?e:[],n=new Set,r=[];for(let e of t)!on(e)||n.has(e)||(n.add(e),r.push(e));for(let e of Yt)n.has(e)||r.push(e);return r}function ln(e){if(!e)return Yt;try{let t=window.localStorage.getItem(sn(e));return cn(t?JSON.parse(t):null)}catch{return Yt}}function un(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function dn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function fn(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 pn(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function mn(e){let t=(0,K.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.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,J.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,J.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 hn(e=!1){return i(`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 gn(e){let t=(0,K.c)(10),{label:n,value:r,mono:a}=e,o=a===void 0?!1:a,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=s);let c=o&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=i(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==s||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function X(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function _n(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bn(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 xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Sn(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 Cn(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 wn(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 Tn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Tn(e.children,t,n)}:e)}function En({currentProject:e,pm:t,projectsText:n,wd:r}){let a=ct(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)([e]),[u,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`new`),[S,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[E,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(null),[M,P]=(0,q.useState)(null),F=(0,q.useCallback)(async()=>{m(!0),g(null);try{let t=await D({limit:100});l(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){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,q.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&F()},[F,o]);let z=(0,q.useMemo)(()=>{let t=u.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=X(e);return t.every(e=>n.includes(e))}).sort((e,t)=>_n(t)-_n(e))},[e.id,c,u]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{x(e),C(``),T(``),j(null),v(!0),s(!1)},ee=(0,q.useCallback)(async(e={})=>{let t=w.trim(),n=S.trim()||(b===`directory`?vn(t):``);if(n){k(!0),j(null),P(null);try{let r=await L({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),C(``),T(``),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yn(e);t?(P(t),v(!1)):j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[b,S,a,w]),te=(0,q.useCallback)(e=>{e.preventDefault(),ee()},[ee]),ne=(0,q.useCallback)(()=>{ee({createWorkspaceRoot:!0})},[ee]),re=(0,q.useCallback)(()=>{P(null),v(!0)},[]),ie=e=>{T(e),b===`directory`&&!S.trim()&&C(vn(e))},ae=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:i(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-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||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(Ve,{className:i(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(pe,{open:o,onOpenChange:s,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group -ml-2 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,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(et,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(Ze,{children:(0,J.jsxs)(Ue,{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,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.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:u,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ae(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ae(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.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:()=>H(`new`),children:[(0,J.jsx)(le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.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:()=>H(`directory`),children:[(0,J.jsx)(it,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.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),a(`/projects`)},children:[(0,J.jsx)(je,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(N,{open:_,onOpenChange:e=>!E&&v(e),children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:b===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:b===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[A?(0,J.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:A}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.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:S,onChange:e=>C(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(bt,{value:w,onChange:ie,disabled:E,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,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:E,children:n.cancel})}),(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:E||!(S.trim()||b===`directory`&&vn(w)),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(N,{open:!!M,onOpenChange:e=>{e||P(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?un(n.workspaceMissingDescription,{workspace:M}):null})]}),M?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:M})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:E,children:n.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:E,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function Dn(){let{projectId:e=``,tabId:t,noteId:n}=j(),r=ct(),o=c(e=>e.language),s=a(o),u=s.chat.workingDirectory,p=s.projectDetailPage,m=s.projectsPage,w=_(e=>e.setPageHeader),D=_(e=>e.clearPageHeader),[F,L]=(0,q.useState)(null),[B,te]=(0,q.useState)(null),[oe,ce]=(0,q.useState)([]),[de,pe]=(0,q.useState)(``),[he,ye]=(0,q.useState)([]),[xe,ke]=(0,q.useState)([]),[je,Me]=(0,q.useState)([]),[U,Pe]=(0,q.useState)([]),[Ie,Ve]=(0,q.useState)([]),[He,Ue]=(0,q.useState)(!1),[We,Je]=(0,q.useState)(null),[Xe,Ze]=(0,q.useState)([]),[et,nt]=(0,q.useState)(0),[rt,K]=(0,q.useState)(!1),[Tt,Et]=(0,q.useState)(!1),[Dt,Ot]=(0,q.useState)(!1),[kt,At]=(0,q.useState)([]),Y=(0,q.useRef)(new Set),[jt,Mt]=(0,q.useState)(null),[Nt,Pt]=(0,q.useState)(rn),[Ft,It]=(0,q.useState)(!1),[Lt,Rt]=(0,q.useState)(!1),[zt,Bt]=(0,q.useState)(``),[Vt,Ht]=(0,q.useState)([]),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(null),[Xt,Zt]=(0,q.useState)(!1),[Qt,$t]=(0,q.useState)(null),[en,tn]=(0,q.useState)([]),[X,_n]=(0,q.useState)(``),[vn,Dn]=(0,q.useState)(!0),[On,kn]=(0,q.useState)(!1),[An,jn]=(0,q.useState)(!1),[Mn,Nn]=(0,q.useState)(null),[Pn,Fn]=(0,q.useState)(!1),[In,Ln]=(0,q.useState)(`fixed`),[Rn,zn]=(0,q.useState)(``),[Bn,Vn]=(0,q.useState)(null),[Hn,Un]=(0,q.useState)(!1),[Wn,Gn]=(0,q.useState)(!1),[Kn,qn]=(0,q.useState)(0),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(!1),[Qn,$n]=(0,q.useState)(null),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[pr,mr]=(0,q.useState)(()=>ln(e)),[Q,hr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),gr=pr[0]??Yt[0],$=n?`notes`:on(t)?t:gr,_r=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),vr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),yr=(0,q.useCallback)(e=>{let t=vr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[vr]),br=(0,q.useCallback)(t=>{e&&r(vr(t),{replace:!0})},[r,e,vr]),xr=(0,q.useCallback)((e,t)=>{br(e),r(t)},[r,br]),Sr=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||br(e)},[br]),Cr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||on(t)||r(`/projects/${encodeURIComponent(e)}/${gr}`,{replace:!0})},[gr,r,e,t]),(0,q.useEffect)(()=>{mr(ln(e))},[e]);let wr=(0,q.useCallback)((t,n,r=`before`)=>{t!==n&&mr(i=>{let a=cn(i),o=a.indexOf(t),s=a.indexOf(n);if(o<0||s<0)return a;let[c]=a.splice(o,1),l=a.indexOf(n);return l<0?cn(i):(a.splice(r===`after`?l+1:l,0,c),e&&window.localStorage.setItem(sn(e),JSON.stringify(a)),a)})},[e]);(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Dn(!0),Z(null),Promise.all([V(e),ne(e),H(e),be().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;L(a),te(e),ce(n),ye(r),tn(i?.agents??[]),_n(a.defaultAgentId??``),hr({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Dn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([be(),ie(),Se()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=F?.defaultAgentId||X||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?xt(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[F?.defaultAgentId,X]);let Tr=(0,q.useCallback)(async()=>{if(F){Yn(!0),Z(null);try{let[e,t]=await Promise.all([ze(),Oe(100,{ownerAgentId:X||void 0,projectId:F.id})]);ke(e),Me(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[F,X]);(0,q.useEffect)(()=>{F&&Tr()},[F,Tr]);let Er=(0,q.useCallback)(async()=>{if(F){Ue(!0),Z(null);try{let[e,t]=await Promise.all([dt.list({projectId:F.id}),dt.runs(50,void 0,{projectId:F.id})]);Pe(e.automations),Ve(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}},[F]);(0,q.useEffect)(()=>{$===`automations`&&Er()},[Er,$]);let Dr=(0,q.useCallback)(async()=>{if(F){K(!0),Z(null);try{let e=await Ke(F.id,{includeRelated:Tt,limit:100});Ze(e.items),nt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[F,Tt]);(0,q.useEffect)(()=>{$===`activity`&&Dr()},[Dr,$]);let Or=(0,q.useCallback)(async e=>{Je(`run:${e.id}`),Z(null);try{await dt.runNow(e.id),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Je(null)}},[Er]),kr=(0,q.useCallback)(async e=>{Je(`toggle:${e.id}`),Z(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Je(null)}},[Er]),Ar=(0,q.useCallback)(async()=>{if(!F?.effectiveWorkspaceRoot?.trim()){At([]),Y.current.clear(),$t(null);return}Zt(!0),$t(null),Y.current.clear();try{At(wn((await x(F.id,``)).entries)),Y.current.add(``)}catch(e){At([]),Y.current.clear(),$t(e instanceof Error?e.message:String(e))}finally{Zt(!1)}},[F]),jr=(0,q.useCallback)(async e=>{if(!(!F?.effectiveWorkspaceRoot?.trim()||Y.current.has(e))){Y.current.add(e),$t(null);try{let t=await x(F.id,e);At(n=>Tn(n,e,wn(t.entries)))}catch(t){Y.current.delete(e),$t(t instanceof Error?t.message:String(t))}}},[F]);(0,q.useEffect)(()=>{$===`files`&&Ar()},[Ar,$]);let Mr=zt.trim();(0,q.useEffect)(()=>{if($!==`files`||!F||!Lt||!Mr){Ht([]),Wt(!1),Kt(null);return}let e=!1;Wt(!0),Kt(null),Ht([]);let t=window.setTimeout(()=>{Ye(F.id,Mr,50).then(t=>{e||Ht(t)}).catch(t=>{e||Kt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Wt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Mr,F,Lt,$]);let Nr=(0,q.useCallback)(async()=>{if(F){Gn(!0),Z(null);try{let e=await z(F.id);xr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(!1)}}},[xr,F]),Pr=(0,q.useCallback)(()=>{_r(`work-items`),qn(e=>e+1)},[_r]),Fr=(0,q.useCallback)(async()=>{if(!F)return;let[e,t]=await Promise.all([V(F.id),H(F.id)]);te(e),L(e.project),ye(t)},[F]),Ir=(0,q.useCallback)(async e=>{if(!F||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await P(F.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:St(e.evidencePlan),criteria:St(e.checklist)}}),sr(!1),_r(`goals`),await Fr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[_r,F,Fr]),Lr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!F||!dr.title.trim())){ar(!0),Z(null);try{await b(F.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,F,Fr]),Rr=(0,q.useCallback)(async e=>{if(!(!F||!er)){Zn(!0),Z(null);try{let t=X||F.defaultAgentId||void 0,n=await ue({definitionId:er.id,projectId:F.id,agentId:t,goal:e.goal,input:e.input,concurrency:e.concurrency,maxSubagents:e.maxSubagents});tr(null),await Tr(),xr(`workflows`,S(n.runId,{ownerAgentId:t}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Zn(!1)}}},[xr,F,Tr,X,er]),zr=(0,q.useCallback)(async e=>{if(F){$n(`retry:${e.id}`),Z(null);try{let t=await ae(e.id,{ownerAgentId:X||e.metadata?.agentId,projectId:e.metadata?.projectId||F.id});await Tr(),xr(`workflows`,S(t.runId,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(null)}}},[xr,F,Tr,X]),Br=(0,q.useCallback)(async e=>{$n(`cancel:${e.id}`),Z(null);try{await Qe(e.id,{ownerAgentId:X||e.metadata?.agentId}),await Tr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(null)}},[Tr,X]),Vr=(0,q.useMemo)(()=>(0,J.jsx)(ut,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.backToProjects,children:(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0})}),[p.backToProjects]),Hr=(0,q.useMemo)(()=>F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Pr,children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.workItems.create.header]}),(0,J.jsxs)(G,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Nr(),disabled:Wn,children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[Pr,p.common.newChat,p.workItems.create.header,F,Nr,Wn]);(0,q.useLayoutEffect)(()=>(w({startExtra:Vr,main:F?(0,J.jsx)(En,{currentProject:F,pm:p,projectsText:m,wd:u}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:Hr}),()=>D()),[D,Hr,Vr,p,F,m,w,u]);function Ur(e){L(t=>t?{...t,...e}:null),te(t=>t?{...t,project:{...t.project,...e}}:null),_n(e.defaultAgentId??``),hr(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Wr(){if(!(!F||!Q.name.trim())){kn(!0),Z(null),Nn(null);try{Ur(await se(F.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=yn(e);t?Nn(t):Z(e instanceof Error?e.message:String(e))}finally{kn(!1)}}}function Gr(e){e.preventDefault(),Wr()}let Kr=(0,q.useCallback)(()=>{if(!F)return;let e=F.workspaceRoot?.trim()??``;Ln(e?`fixed`:`follow`),zn(e||F.effectiveWorkspaceRoot||``),Fn(!0)},[F]);async function qr(e={}){if(!F)return;let t=In===`fixed`?Rn.trim():``;if(!(In===`fixed`&&!t)){kn(!0),Z(null),Nn(null);try{Ur(await se(F.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Fn(!1),Nn(null)}catch(e){let t=yn(e);t?(Nn(t),Fn(!1)):Z(e instanceof Error?e.message:String(e))}finally{kn(!1)}}}async function Jr(){if(!(!F||Bn)){Vn(`pin`),Z(null);try{Ur(F.pinnedAt?await Ae(F.id):await ve(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Vn(null)}}}async function Yr(){if(!(!F||Bn)){Vn(`archive`),Z(null);try{Ur(F.status===`archived`?await $e(F.id):await f(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Vn(null)}}}async function Xr(){if(F){Un(!0),Z(null);try{await v(F.id),jn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Un(!1)}}}async function Zr(){if(!(!F||Dt)){Ot(!0),Z(null);try{await Be(F.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ot(!1)}}}let Qr=(0,q.useCallback)(e=>{Mt(e)},[]),$r=(0,q.useCallback)((e,t)=>{t||Mt(e)},[]),ei=(0,q.useCallback)(async(e,t,n)=>{let r=F?.id;if(r)switch(e){case`preview`:t.isDirectory||Mt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Fe(t.path);if(ge(fe(e))!==`text`){let n=await Le(t.path,{projectId:r}),i=Ne(e)??`application/octet-stream`;Ce(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ee(t.path,{projectId:r});Ge(e,n)}}catch(e){at(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await Re(t.absolutePath??t.path)&&at(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{at(`warning`,s.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}},[s.clipboard.copyFailed,s.workspace.pathCopied,F?.id]),ti=(0,q.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),It(!0);let r=e.clientX,i=Nt,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=nn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}It(!1),Pt(c),an(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)},[Nt]);if((0,q.useEffect)(()=>{$!==`files`&&Mt(null)},[e,$]),vn)return(0,J.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!F)return(0,J.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(ut,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),p.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:cr||p.notFound})]});let ni=B?.recentSessions.length?B.recentSessions:F.recentSessions,ri=B?.attentionItems??[],ii=e=>p.statuses[e]??e,ai=e=>un(p.common.messages,{count:e}),oi=de.trim().toLowerCase(),si=oi?oe.filter(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ai(e.messageCount??0);return[r,e.key,n,t,i].filter(Boolean).join(` `).toLowerCase().includes(oi)}):oe,ci=oe.length>0&&si.length===0,li=en.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||p.settings.globalDefaultAgent,ui=en.find(e=>e.id===Q.defaultAgentId),di=F.workspaceRoot?.trim()||``,fi=F.status===`archived`,pi=!!F.pinnedAt,mi=!di,hi=di||ui?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,gi=In===`fixed`?Rn.trim()||p.settings.workspacePlaceholder:ui?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,_i=(In===`fixed`?Rn.trim():``)!==di&&(In===`follow`||!!Rn.trim()),vi=pr.map(e=>{let t=Jt.find(t=>t.id===e);return{...t,label:t.id===`work-items`?p.workItems.tab:p.tabs[t.id]}});async function yi(){if(!hi)return;let e=await Re(hi);at(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function bi(){Nn(null),Fn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsx)(yt,{items:vi,activeTab:$,onChange:_r,onReorder:wr,ariaLabel:p.navAria,tabIdPrefix:`project-tab`,panelIdPrefix:`project-panel`,className:`shrink-0`}),cr?(0,J.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:cr}):null,(0,J.jsxs)(`div`,{className:i(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-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,J.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,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:B?.digest?.summary||B?.recommendedAction||F.description||F.brief||p.overview.directionFallback}),B?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:un(p.overview.recommendedNext,{action:B.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,onClick:()=>void Zr(),disabled:Dt,children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),Dt?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:B?.nextActions.length?B.nextActions.map(e=>(0,J.jsxs)(ut,{to:yr(e.goalId),onClick:Sr(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]})]}),(0,J.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,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),ri.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:ri.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(E,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${ii(e.status)}`:``]})]});return e.href?(0,J.jsx)(ut,{to:e.href,onClick:Sr(Cr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:Lr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,J.jsx)(G,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?p.overview.addingBlocker:p.overview.addBlocker,title:ir?p.overview.addingBlocker:p.overview.addBlocker,children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(mt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>_r(`sessions`),children:p.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:ni.length?ni.map(e=>(0,J.jsxs)(ut,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Sr(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:dn(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(qt,{projectId:F.id,createRequestKey:Kn}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.workflows.runsHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Tr(),disabled:Jn,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Jn&&je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.loadingRuns}):je.length?je.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>xr(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pn(e.status)),children:ii(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:un(p.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:dn(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>xr(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:p.common.open}),n?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Qn===`retry:${e.id}`,onClick:()=>void zr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),p.common.retry]}):null,t?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Qn===`cancel:${e.id}`,onClick:()=>void Br(e),children:[(0,J.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),p.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:xe.length?xe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>tr(e),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(A,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:p.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Er(),disabled:He,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>xr(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:He&&U.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.loading}):U.length?U.map(e=>{let t=Ie.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ie.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>xr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:i(`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?p.automations.enabled:p.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:un(p.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?dn(t.createdAtMs):p.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`run:${e.id}`||!!n,onClick:()=>void Or(e),children:[(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p.automations.run]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`toggle:${e.id}`,onClick:()=>void kr(e),children:[e.enabled?(0,J.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>xr(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ie.length?Ie.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,pn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:dn(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:F.workspaceRoot||F.effectiveWorkspaceRoot||p.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(vt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(F.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${F.id}`,captureTags:[`project:${F.id}`,F.slug],listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${F.id}`})}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-tab-files`,className:`h-full min-h-[28rem]`,children:(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:F.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:i(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Ft&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Nt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(gt,{workspacePath:hi}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:i(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Lt&&`bg-surface-hover text-fg`),onClick:()=>Rt(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":Lt,children:(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(re,{className:`size-7 shrink-0 rounded-md p-0`,loading:Xt,label:s.cron.refresh,onClick:()=>void Ar()})]})]}),Lt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.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,J.jsx)(me,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:zt,onChange:e=>Bt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,autoFocus:!0,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.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":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{Bt(``),Rt(!1)},children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Qt?(0,J.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:Qt}):null,Mr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Ut?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`})]}):Gt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Gt]}):Vt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Vt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:i(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,jt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Mt(e.path),title:e.path,children:[(0,J.jsx)(k,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Xt&&kt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,J.jsx)(we,{tree:kt,selectedPath:jt,onSelectFile:Qr,onSelectEntry:$r,onExpandDir:e=>void jr(e),onAction:ei,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:i(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Ft&&`bg-surface-hover`),onPointerDown:ti,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:jt?(0,J.jsx)(st,{filePath:jt,projectId:F.id,onClose:()=>Mt(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(it,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>_r(`settings`),children:p.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[oe.length?(0,J.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,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:de,onChange:e=>pe(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.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`}),de?(0,J.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":p.sessions.clearSearch,onClick:()=>pe(``),children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,si.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:si.map(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ai(e.messageCount??0);return(0,J.jsxs)(ut,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Sr(`sessions`),className:`group flex min-h-[11rem] 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,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.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,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:r}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-muted`,title:e.key,children:e.key})]})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:i})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):ci?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.goals.title})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:he.length?he.map(e=>(0,J.jsxs)(ut,{to:yr(e.id),onClick:Sr(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ii(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||p.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:p.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:un(p.activity.count,{count:et})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(`input`,{type:`checkbox`,checked:Tt,onChange:e=>Et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.activity.includeRelated]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Dr(),disabled:rt,children:[(0,J.jsx)(W,{className:i(`size-4`,rt&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:rt&&Xe.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.loading}):Xe.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Xe.map(e=>{let t=p.activity.types[e.type]??e.type,n=p.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Cn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===F.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:dn(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.activity.actor,`: `,bn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.activity.source,`: `,Sn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-tab-settings`,onSubmit:Gr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.contextHint})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(Q.status)),children:p.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(gn,{label:p.settings.workspaceRoot,value:hi,mono:!0}),(0,J.jsx)(gn,{label:p.settings.defaultAgent,value:li}),(0,J.jsx)(gn,{label:p.settings.pinState,value:pi?p.settings.pinned:p.settings.notPinned}),(0,J.jsx)(gn,{label:p.settings.createdAt,value:dn(F.createdAt)||p.common.never}),(0,J.jsx)(gn,{label:p.settings.updatedAt,value:dn(F.updatedAt)||p.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(mn,{label:p.settings.name,children:(0,J.jsx)(`input`,{className:hn(),value:Q.name,onChange:e=>hr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(mn,{label:p.settings.defaultAgent,children:(0,J.jsxs)(l,{className:hn(),value:Q.defaultAgentId,onChange:e=>hr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(tt,{value:``,children:p.settings.globalDefaultAgent}),en.map(e=>(0,J.jsx)(tt,{value:e.id,children:qe(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(mn,{label:p.settings.status,children:fi?(0,J.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:p.settings.statuses.archived}):(0,J.jsxs)(l,{className:hn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>hr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(tt,{value:`active`,children:p.settings.statuses.active}),(0,J.jsx)(tt,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,J.jsx)(mn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.description,onChange:e=>hr(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:mi?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:hi,children:hi})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void yi(),children:[(0,J.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,J.jsx)(gt,{workspacePath:hi}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Kr,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.agentContextHint})]}),(0,J.jsx)(mn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.brief,onChange:e=>hr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(mn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.instructions,onChange:e=>hr(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:pi?p.settings.pinnedTitle:p.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Bn===`pin`,onClick:()=>void Jr(),children:[pi?(0,J.jsx)(lt,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(M,{className:`size-4`,"aria-hidden":!0}),pi?p.settings.unpinProject:p.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:fi?p.settings.restoreTitle:p.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:fi?p.settings.restoreHint:p.settings.archiveHint})]}),(0,J.jsxs)(G,{type:`button`,variant:fi?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Bn===`archive`,onClick:()=>void Yr(),children:[fi?(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),fi?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,J.jsxs)(G,{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:()=>jn(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(G,{type:`submit`,variant:`primary`,disabled:On||!Q.name.trim(),children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),p.common.save]})})]}):null]}),(0,J.jsx)(N,{open:An,onOpenChange:e=>{Hn||jn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.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,J.jsx)(E,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:F?un(p.settings.deleteConfirm,{name:F.name}):p.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Hn,children:p.common.cancel})}),(0,J.jsxs)(G,{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:Hn||!F,onClick:()=>void Xr(),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(N,{open:Pn,onOpenChange:e=>{On||Fn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,In===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:In===`fixed`,onChange:()=>Ln(`fixed`),disabled:On}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,In===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:In===`follow`,onChange:()=>Ln(`follow`),disabled:On}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),In===`fixed`?(0,J.jsx)(bt,{value:Rn,onChange:zn,disabled:On,wd:u,placeholder:p.settings.workspacePlaceholder,inputClassName:hn(),autoFocus:!0}):null,(0,J.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:p.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:un(p.settings.workspaceCurrent,{workspace:gi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:On,children:p.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:On||!_i,onClick:()=>void qr(),children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(N,{open:!!Mn,onOpenChange:e=>{e||Nn(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(pt,{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,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Mn?un(p.settings.workspaceMissingDescription,{workspace:Mn}):null})]}),Mn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(it,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Mn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:bi,disabled:On,children:p.settings.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void qr({createWorkspaceRoot:!0}),disabled:On,children:[(0,J.jsx)(ft,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Ct,{open:or,t:s.goalsPage,chat:s.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Ir}),(0,J.jsx)(wt,{open:!!er,definition:er,language:o,starting:Xn,onClose:()=>!Xn&&tr(null),onStart:e=>void Rr(e)})]})}export{Dn as ProjectDetailPage};