cogpit 2.6.6 → 3.0.0

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 (44) hide show
  1. package/dist/cli.js +40523 -32276
  2. package/dist/web/assets/CommandPaletteHost-fa5vgo7-.js +1 -0
  3. package/dist/web/assets/ConfigBrowser-CXvr5BFb.js +1 -0
  4. package/dist/web/assets/HighlightedEditor-DWc-xoSc.js +2 -0
  5. package/dist/web/assets/{KeyboardShortcutsDialog-C7QHuM2e.js → KeyboardShortcutsDialog-C1of2PBc.js} +1 -1
  6. package/dist/web/assets/{MobileFileChanges-qnY-uxZ_.js → MobileFileChanges-BAEIKapA.js} +1 -1
  7. package/dist/web/assets/PluginsDialog-BgnTB0-z.js +1 -0
  8. package/dist/web/assets/PreviewPanel-DgbgRibz.js +1 -0
  9. package/dist/web/assets/ProjectFilesPanel-BGpyS_aw.js +4 -0
  10. package/dist/web/assets/ProjectSwitcherModal-CEypvUNm.js +1 -0
  11. package/dist/web/assets/{TerminalOutput-DnTT9ONj.js → TerminalOutput-Dq6QP83Y.js} +13 -13
  12. package/dist/web/assets/ThemeSelectorModal-DeYABHF9.js +1 -0
  13. package/dist/web/assets/WorkflowsPanel-CNxUSC9Q.js +1 -0
  14. package/dist/web/assets/WorktreePanel-DJYEUobs.js +1 -0
  15. package/dist/web/assets/edition-ui-CFlDe2_U.js +2 -0
  16. package/dist/web/assets/index-Bm91RnFy.js +1 -0
  17. package/dist/web/assets/index-Ch-IpPaH.js +1 -0
  18. package/dist/web/assets/index-DVp2Xjmx.js +1 -0
  19. package/dist/web/assets/{index-7fgSFumo.js → index-DYugSKH5.js} +4 -4
  20. package/dist/web/assets/index-DsnL-sXV.js +472 -0
  21. package/dist/web/assets/index-TCQKag8a.css +1 -0
  22. package/dist/web/assets/password-BV9mqUzz.js +1 -0
  23. package/dist/web/assets/session-parser.worker-CXlsiJzz.js +29 -0
  24. package/dist/web/assets/vendor-ui-Br3ZTAXZ.js +957 -0
  25. package/dist/web/index.html +6 -6
  26. package/dist/web/theme-bootstrap.js +1 -25
  27. package/package.json +8 -2
  28. package/dist/web/assets/CommandPaletteHost-iiTEkWGR.js +0 -1
  29. package/dist/web/assets/ConfigBrowser-CV_FDTPG.js +0 -1
  30. package/dist/web/assets/HighlightedEditor-7K1IXoMd.js +0 -2
  31. package/dist/web/assets/PreviewPanel-DBIaGXu0.js +0 -1
  32. package/dist/web/assets/ProjectFilesPanel-DdllBXuv.js +0 -4
  33. package/dist/web/assets/ProjectSwitcherModal-BhevYH6F.js +0 -1
  34. package/dist/web/assets/TerminalOutput-6GBZ9nXN.css +0 -32
  35. package/dist/web/assets/ThemeSelectorModal-GimQk0yY.js +0 -1
  36. package/dist/web/assets/WorkflowsPanel-BTeZdY1F.js +0 -1
  37. package/dist/web/assets/WorktreePanel-DbSH2Fyv.js +0 -1
  38. package/dist/web/assets/index-Bl7YHn3e.js +0 -1
  39. package/dist/web/assets/index-C640apmk.css +0 -1
  40. package/dist/web/assets/index-CVF75nuK.js +0 -153
  41. package/dist/web/assets/index-CmAiGDkv.js +0 -1
  42. package/dist/web/assets/index-j1RyyaFQ.js +0 -1
  43. package/dist/web/assets/session-parser.worker-DlF00ZHH.js +0 -29
  44. package/dist/web/assets/vendor-ui-C4lFQWec.js +0 -937
@@ -0,0 +1 @@
1
+ import{c as se,j as u,r as M}from"./vendor-react-gGw_S5I_.js";import{ad as h,ae as Y,af as de,ag as me,ah as ue,ai as he,aj as ge,ak as fe,al as ve,am as we,an as Ce,ao as Se,ap as je,aq as Z,ar as _,as as be,at as ye,au as xe,av as Pe,aw as Te,ax as Oe,ay as ke,U as Ne}from"./index-DsnL-sXV.js";import{P as Fe,j as Ee,k as ee,S as Ie,L as $e,H as Re,l as Ae,m as De,c as te,G as Le,F as He,n as Me,o as Be,p as qe,q as Ge,r as Ke,s as Ue,t as ne,u as ze,v as We,w as _e,K as pe,E as Ve,x as Xe,y as Je,z as ae,A as Qe,B as Ye,D as Ze}from"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function a(t,e,s,c,l,m,d){return{id:t,label:e,icon:c,run:l,shortcut:m,description:d,value:`${e} ${s}`}}function p(...t){return t.filter(e=>e!==!1&&e!==void 0)}function et(t){const e=se.c(40);let s,c,l,m,d,v,w,r,C,g,j,f,b,k,y;if(e[0]!==t){const $=p(a("home","Go to dashboard","home overview",Re,t.onGoHome),a("mission-control",t.showMission?"Exit Mission Control":"Open Mission Control","live sessions blocked waiting answer everything at once",$e,t.onToggleMissionControl,h("missionControl")),...(t.extraActions??[]).map(tt),a("new-session","Start a new session","project agent chat create",Fe,t.onNewSession,h("newSession")),t.onDuplicateSession&&a("duplicate-session","Duplicate this session","copy fork clone branch thread",Ee,t.onDuplicateSession),t.canFocusComposer&&a("focus-composer","Focus message composer","chat prompt input",ee,t.onFocusComposer,h("focusComposer")),t.onFindInConversation&&a("find-in-conversation","Find in conversation","search text transcript turns matches",Ie,t.onFindInConversation,h("findInConversation"))),F=(t.projects??[]).slice(0,8).map(n=>a(`project-${n.dirName}`,n.shortName,`${n.path} ${n.dirName} project workspace`,Ae,()=>{var i;return(i=t.onOpenProject)==null?void 0:i.call(t,n.dirName)},void 0,`${n.path} · ${n.sessionCount} session${n.sessionCount===1?"":"s"}`)),E=(t.recentSessions??[]).slice(0,10).map(n=>{const N=(n.aiTitle||n.name||n.slug||n.lastUserMessage||n.firstUserMessage||n.sessionId).replace(/\s+/g," ").trim().slice(0,160)||n.sessionId,L=[n.projectShortName,n.gitBranch].filter(Boolean).join(" · ");return a(`session-${n.dirName}-${n.fileName}`,N,`${n.projectShortName} ${n.cwd??""} ${n.gitBranch??""} ${n.sessionId} recent thread conversation`,ee,()=>{var q;return(q=t.onOpenSession)==null?void 0:q.call(t,n.dirName,n.fileName)},void 0,L)}),o=t.devices??[],I=o.length>1&&t.onSwitchDevice?o.slice(0,Y.length).map((n,i)=>a(`device-${n.id}`,n.isActive?`${n.name} (current)`:`Switch to ${n.name}`,`device machine host remote ${n.id}`,n.isLocal?De:te,()=>{var N;return(N=t.onSwitchDevice)==null?void 0:N.call(t,n.id)},h(Y[i]))):[],O=p(a("toggle-sidebar",t.showSidebar?"Hide session sidebar":"Show session sidebar","projects navigation panel",Ge,t.onToggleSidebar,h("toggleSidebar")),t.hasSession&&a("toggle-stats",t.showStats?"Hide session details":"Show session details","stats tokens usage panel",qe,t.onToggleStats,h("toggleStats")),t.onToggleProjectFiles&&a("project-files",t.showProjectFiles?"Close project files":"Open project files","browse edit save workspace source code",Be,t.onToggleProjectFiles,h("projectFiles")),t.onToggleBrowser&&a("toggle-browser",t.showBrowser?"Hide browser":"Show browser","web page live view browse panel",Me,t.onToggleBrowser),t.hasFileChanges&&a("toggle-file-changes",t.showFileChanges?"Hide file changes":"Show file changes","diff edits review panel",He,t.onToggleFileChanges),t.supportsWorktrees&&t.canOpenTerminal&&a("toggle-worktrees",t.showWorktrees?"Hide worktrees":"Show worktrees","git branches panel",Le,t.onToggleWorktrees)),R=p(t.onOpenProjectInEditor&&a("open-project-editor","Open project in editor","code cursor vscode zed workspace",Ye,t.onOpenProjectInEditor),t.onRevealProject&&a("reveal-project","Reveal project in file manager","finder explorer folder directory",Qe,t.onRevealProject),t.onCopyResumeCommand&&a("copy-resume-command","Copy resume command","cli claude codex copilot terminal clipboard continue session",ae,t.onCopyResumeCommand),t.onCopyProjectPath&&a("copy-project-path","Copy project path","workspace directory clipboard",ae,t.onCopyProjectPath),t.onOpenIntegratedTerminal&&a("integrated-terminal","New integrated terminal","embedded shell command line process panel",Je,t.onOpenIntegratedTerminal,h("newIntegratedTerminal")),t.canOpenTerminal&&a("terminal","Open in system terminal","external shell command line app",Xe,t.onOpenTerminal,h("systemTerminal")),t.onTogglePreview&&a("preview","Toggle development preview","browser localhost dev server website",Ve,t.onTogglePreview,h("preview")),t.onOpenKeyboardShortcuts&&a("keyboard-shortcuts","Customize keyboard shortcuts","keybindings hotkeys settings",pe,t.onOpenKeyboardShortcuts),t.onOpenConfig&&a("config",t.showConfig?"Close agent configuration":"Open agent configuration","skills commands claude settings files",_e,t.onOpenConfig),a("settings","Open Cogpit settings","preferences network",We,t.onOpenSettings),a("theme","Change theme & chat width","appearance light dark oled width narrow wide",ze,t.onOpenTheme,h("themeSelector")),a("expand","Expand all groups","conversation details",ne,t.onExpandAll,h("expandAll")),a("expand-payloads","Expand all tool payloads","raw input result diff conversation details",ne,t.onExpandToolPayloads,h("expandToolPayloads")),a("collapse","Collapse all","conversation groups payloads details",Ue,t.onCollapseAll),t.onKillAll&&a("kill-all","Kill all agent processes","stop terminate halt everything runaway",Ke,t.onKillAll),t.onOpenDevices&&a("manage-devices","Manage devices…","remote machines hub hosts edit rename remove switch",Ze,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"manage")}),t.onOpenDevices&&a("add-device","Add device…","remote machine hub host connect pair new",te,()=>{var n;return(n=t.onOpenDevices)==null?void 0:n.call(t,"add")})),A=[{value:"Navigation",items:$},...E.length>0?[{value:"Recent sessions",items:E}]:[],...F.length>0?[{value:"Projects",items:F}]:[],...I.length>0?[{value:"Devices",items:I}]:[],{value:"View",items:O},{value:"Tools",items:R}],D=function(i){t.onOpenChange(!1),i.run()};l=ge,b=t.open,k=t.onOpenChange,y="Command palette",v="Search for a Cogpit action to run.",w="max-w-xl",c=fe,C="Search commands",g=!0,e[16]===Symbol.for("react.memo_cache_sentinel")?(j=u.jsx(ve,{"aria-label":"Search commands",autoFocus:!0,placeholder:"Search commands..."}),e[16]=j):j=e[16],e[17]!==t.loadingNavigation?(f=t.loadingNavigation&&u.jsxs("div",{className:"motion-enter flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",role:"status",children:[u.jsx(de,{className:"size-3.5"}),"Loading projects and sessions..."]}),e[17]=t.loadingNavigation,e[18]=f):f=e[18],s=we,m="max-h-[min(26rem,60vh)]",e[19]===Symbol.for("react.memo_cache_sentinel")?(d=u.jsx(Ce,{children:"No matching actions."}),e[19]=d):d=e[19],r=A.map(n=>u.jsx(me,{heading:n.value,children:n.items.map(i=>{const N=i.icon;return u.jsxs(ue,{value:i.value,onSelect:()=>D(i),children:[u.jsx(N,{"aria-hidden":"true"}),u.jsxs("span",{className:"min-w-0 flex-1",children:[u.jsx("span",{className:"block truncate",children:i.label}),i.description&&u.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:i.description})]}),i.shortcut&&u.jsx(he,{children:i.shortcut})]},i.id)})},n.value)),e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=v,e[7]=w,e[8]=r,e[9]=C,e[10]=g,e[11]=j,e[12]=f,e[13]=b,e[14]=k,e[15]=y}else s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],v=e[6],w=e[7],r=e[8],C=e[9],g=e[10],j=e[11],f=e[12],b=e[13],k=e[14],y=e[15];let x;e[20]!==s||e[21]!==m||e[22]!==d||e[23]!==r?(x=u.jsxs(s,{className:m,children:[d,r]}),e[20]=s,e[21]=m,e[22]=d,e[23]=r,e[24]=x):x=e[24];let P;e[25]!==c||e[26]!==x||e[27]!==C||e[28]!==g||e[29]!==j||e[30]!==f?(P=u.jsxs(c,{label:C,loop:g,children:[j,f,x]}),e[25]=c,e[26]=x,e[27]=C,e[28]=g,e[29]=j,e[30]=f,e[31]=P):P=e[31];let T;return e[32]!==l||e[33]!==v||e[34]!==w||e[35]!==P||e[36]!==b||e[37]!==k||e[38]!==y?(T=u.jsx(l,{open:b,onOpenChange:k,title:y,description:v,className:w,children:P}),e[32]=l,e[33]=v,e[34]=w,e[35]=P,e[36]=b,e[37]=k,e[38]=y,e[39]=T):T=e[39],T}function tt(t){return a(t.id,t.label,t.keywords,t.icon,t.onSelect)}async function oe(t,e){const s=await Ne(t,{signal:e});if(!s.ok)throw new Error(`Request failed (${s.status})`);const c=await s.json();return Array.isArray(c)?c:[]}function lt(t){var V;const e=se.c(49);let s,c,l,m,d,v;e[0]!==t?({open:l,currentProjectDirName:s,projectCwd:d,onProcessStarted:c,launchTerminalRequest:v,...m}=t,e[0]=t,e[1]=s,e[2]=c,e[3]=l,e[4]=m,e[5]=d,e[6]=v):(s=e[1],c=e[2],l=e[3],m=e[4],d=e[5],v=e[6]);const w=v===void 0?0:v,r=Se();let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[7]=C):C=e[7];const[g,j]=M.useState(C);let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[8]=f):f=e[8];const[b,k]=M.useState(f),[y,x]=M.useState(!1),P=M.useRef(0),T=je();let $,F;e[9]!==T||e[10]!==l?($=()=>{if(!l)return;const S=new AbortController,B=ye();return x(!0),Promise.allSettled([oe("/api/projects",S.signal),oe(xe({limit:"12",perProject:"3"},T),S.signal)]).then(re=>{const[X,J]=re;if(S.signal.aborted)return;const Q=J.status==="fulfilled"?J.value:[];Pe(Q,B),j(X.status==="fulfilled"?X.value:[]),k(Q),x(!1)}),()=>S.abort()},F=[l,T],e[9]=T,e[10]=l,e[11]=$,e[12]=F):($=e[11],F=e[12]),M.useEffect($,F);let E;e:{if(d){E=d;break e}if(!s){E=null;break e}let S;e[13]!==s||e[14]!==g?(S=((V=g.find(B=>B.dirName===s))==null?void 0:V.path)??null,e[13]=s,e[14]=g,e[15]=S):S=e[15],E=S}const o=E;let I;e[16]!==c||e[17]!==r||e[18]!==o?(I=()=>{if(!o)return;const S=r.spawnTerminal({cwd:o}),B=o.replace(/\/+$/,"").split("/").at(-1)||"Terminal";c({id:S,name:B,type:"terminal",status:"running",source:o})},e[16]=c,e[17]=r,e[18]=o,e[19]=I):I=e[19];const O=I;let R,A;e[20]!==O||e[21]!==w||e[22]!==r.status||e[23]!==o?(R=()=>{w<=P.current||!o||r.status!=="connected"||(P.current=w,O())},A=[O,w,r.status,o],e[20]=O,e[21]=w,e[22]=r.status,e[23]=o,e[24]=R,e[25]=A):(R=e[24],A=e[25]),M.useEffect(R,A);let D;e[26]!==s||e[27]!==o?(D={path:o,dirName:s},e[26]=s,e[27]=o,e[28]=D):D=e[28];const n=D;let i;e[29]!==n?(i=()=>Te(n),e[29]=n,e[30]=i):i=e[30];const N=i;let L;e[31]!==n?(L=()=>Oe(n),e[31]=n,e[32]=L):L=e[32];const q=L,ie=!Z()&&_("hostFiles"),le=_("hostFiles")&&(!Z()||be());let G;e[33]!==o?(G=()=>{o&&ke(o)},e[33]=o,e[34]=G):G=e[34];const ce=G;let H;e[35]!==O||e[36]!==r.status||e[37]!==o?(H=o&&r.status==="connected"&&_("terminal")?O:void 0,e[35]=O,e[36]=r.status,e[37]=o,e[38]=H):H=e[38];const U=o&&le?N:void 0,z=o&&ie?q:void 0,W=o?ce:void 0;let K;return e[39]!==y||e[40]!==l||e[41]!==m||e[42]!==g||e[43]!==b||e[44]!==H||e[45]!==U||e[46]!==z||e[47]!==W?(K=u.jsx(et,{...m,open:l,projects:g,recentSessions:b,loadingNavigation:y,onOpenIntegratedTerminal:H,onOpenProjectInEditor:U,onRevealProject:z,onCopyProjectPath:W}),e[39]=y,e[40]=l,e[41]=m,e[42]=g,e[43]=b,e[44]=H,e[45]=U,e[46]=z,e[47]=W,e[48]=K):K=e[48],K}export{lt as CommandPaletteHost};
@@ -0,0 +1 @@
1
+ import{c as G,j as t,r as o}from"./vendor-react-gGw_S5I_.js";import{b7 as ye,bs as Ce,J as F,z as ke,C as W,a$ as X,T as ve,H as Z,b4 as ae,B as I,U as A,bt as Ne,bu as Se,bv as we,bw as De,bx as Te,by as Ee,bz as V,bA as Re,bB as ee,bC as Oe,Z as te,a3 as le,bD as Ie,a4 as ie,a5 as re,a7 as oe,a8 as ce,a9 as de,aa as ue,ab as me,af as ze,L as Ae,M as Le,N as Be,O as $e,Q as Fe,Y as Ge,m as Me,I as ne,n as Pe,E as Ue,q as _e,bE as Ve}from"./index-DsnL-sXV.js";import{ak as He,y as Ke,g as Je,a4 as Qe,al as Ye,am as qe,an as xe,n as fe,ao as We,ap as Xe,U as H,X as K,P as Ze,aq as he,ar as et,i as tt,a1 as nt,S as st,O as at}from"./vendor-ui-Br3ZTAXZ.js";import{H as lt}from"./HighlightedEditor-DWc-xoSc.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const it={agent:"bg-muted text-muted-foreground",skill:"bg-muted text-muted-foreground",command:"bg-muted text-muted-foreground",instructions:"bg-muted text-muted-foreground",settings:"bg-muted text-muted-foreground"},rt={agents:{subdir:"agents",fileType:"agent"},skills:{subdir:"skills",fileType:"skill"},commands:{subdir:"commands",fileType:"command"}},se=["instructions","agents","skills","commands","settings"],ot={instructions:{label:"Instructions",icon:Ye,color:"text-muted-foreground"},agents:{label:"Agents",icon:Qe,color:"text-muted-foreground"},skills:{label:"Skills",icon:Je,color:"text-muted-foreground"},commands:{label:"Commands",icon:Ke,color:"text-muted-foreground"},settings:{label:"Settings",icon:He,color:"text-muted-foreground"}};function J(l,e,i){const n=[];for(const s of l)s.type==="directory"&&s.children?n.push(...J(s.children,e,i)):s.type==="file"&&n.push({name:s.name,path:s.path,fileType:s.fileType||"unknown",description:s.description||"",scope:e,pluginName:i,readOnly:s.readOnly??e==="plugin",cli:s.cli,linkTarget:s.linkTarget});return n}function ct(l){const e={instructions:[],agents:[],skills:[],commands:[],settings:[]};for(const i of l){const n=J(i.items,i.scope,i.pluginName);for(const s of n)switch(s.fileType){case"instructions":e.instructions.push(s);break;case"agent":e.agents.push(s);break;case"skill":e.skills.push(s);break;case"command":e.commands.push(s);break;case"settings":default:e.settings.push(s)}}return e}function ge(l){const e=G.c(5),{scope:i,pluginName:n}=l;if(i==="plugin"&&n){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(qe,{"data-icon":"inline-start",className:"size-3"}),e[0]=r):r=e[0];let u;return e[1]!==n?(u=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r,n]}),e[1]=n,e[2]=u):u=e[2],u}if(i==="project"){let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(xe,{"data-icon":"inline-start",className:"size-3"}),"project"]}),e[3]=r):r=e[3],r}let s;return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(fe,{"data-icon":"inline-start",className:"size-3"}),"global"]}),e[4]=s):s=e[4],s}const dt=Object.fromEntries(ye().map(l=>[l.kind,Ce(l.kind)]));function pe(l){const e=G.c(10),{cli:i,variant:n}=l,s=n===void 0?"compact":n;if(!i)return null;if(i.length===0){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(We,{"data-icon":"inline-start",className:"size-3"}),e[0]=m):m=e[0];const c=s==="full"&&"unlinked";let d;return e[1]!==c?(d=t.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-warning",title:"Present in the shared source directory but not linked into any CLI",children:[m,c]}),e[1]=c,e[2]=d):d=e[2],d}let r;if(e[3]!==i||e[4]!==s){let m;e[6]!==s?(m=c=>{const d=dt[c];return t.jsx("span",{title:d.label,className:s==="full"?"flex h-5 items-center justify-center rounded border bg-muted px-1.5 text-xs font-medium text-muted-foreground":"flex size-5 items-center justify-center rounded border bg-muted text-xs font-medium text-muted-foreground",children:s==="full"?c:d.letter},c)},e[6]=s,e[7]=m):m=e[7],r=i.map(m),e[3]=i,e[4]=s,e[5]=r}else r=e[5];let u;return e[8]!==r?(u=t.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:r}),e[8]=r,e[9]=u):u=e[9],u}function je(l){const e=G.c(10),{linkTarget:i,variant:n,className:s}=l,r=n===void 0?"compact":n;if(!i)return null;let u;e[0]!==s?(u=F("flex min-w-0 shrink-0 items-center gap-1 text-info",s),e[0]=s,e[1]=u):u=e[1];const m=`Symlink → ${i}`;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Xe,{"data-icon":"inline-start",className:"size-3 shrink-0"}),e[2]=c):c=e[2];let d;e[3]!==i||e[4]!==r?(d=r==="full"&&t.jsxs("span",{className:"truncate font-mono text-xs",children:["→ ",i]}),e[3]=i,e[4]=r,e[5]=d):d=e[5];let p;return e[6]!==u||e[7]!==m||e[8]!==d?(p=t.jsxs("span",{className:u,title:m,children:[c,d]}),e[6]=u,e[7]=m,e[8]=d,e[9]=p):p=e[9],p}function ut({globalDir:l,projectDir:e,fileType:i,onCreated:n,onCancel:s}){const[r,u]=o.useState(""),[m,c]=o.useState(e?"project":"global"),[d,p]=o.useState(!1),w=o.useRef(null),y=o.useId();o.useEffect(()=>{var x;(x=w.current)==null||x.focus()},[]);const k=m==="project"&&e?e:l,b=!!l&&!!e;async function S(){if(!(!r.trim()||!k)){p(!0);try{const x=await A("/api/config-browser/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:k,fileType:i,name:r.trim()})});if(x.ok){const g=await x.json();n(g.path,i,m)}}finally{p(!1)}}}return t.jsxs(ke,{className:"gap-3 px-3 py-2",children:[b&&t.jsxs(W,{children:[t.jsx(X,{children:"Scope"}),t.jsxs(ve,{"aria-label":"File scope",value:[m],onValueChange:x=>{const g=x[0];(g==="global"||g==="project")&&c(g)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsxs(Z,{value:"global",className:"flex-1",children:[t.jsx(fe,{"data-icon":"inline-start"}),"Global"]}),t.jsxs(Z,{value:"project",className:"flex-1",children:[t.jsx(xe,{"data-icon":"inline-start"}),"Project"]})]})]}),t.jsxs(W,{children:[t.jsxs(X,{htmlFor:y,children:[i.charAt(0).toUpperCase()+i.slice(1)," name"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{id:y,ref:w,type:"text",value:r,onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="Enter"&&S(),x.key==="Escape"&&s()},placeholder:`${i} name...`,className:"h-7 min-w-0 flex-1 text-xs",disabled:d}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":`Create ${i}`,onClick:()=>void S(),disabled:d||!r.trim()||!k,children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel create",onClick:s,children:t.jsx(K,{"data-icon":"inline-start"})})]})]})]})}function mt(l){const e=G.c(50),{category:i,items:n,selectedPath:s,onSelect:r,onNewFile:u,onDeleteItem:m,onRenameItem:c,renamingPath:d,renameValue:p,onRenameValueChange:w,onRenameSubmit:y,onRenameCancel:k,creatingInCategory:b,onCreated:S,onCancelCreate:x}=l,g=ot[i],C=g.icon;if(n.length===0&&!u)return null;let N;e[0]!==g.color?(N=F("size-3.5",g.color),e[0]=g.color,e[1]=N):N=e[1];let v;e[2]!==C||e[3]!==N?(v=t.jsx(C,{"data-icon":"inline-start",className:N}),e[2]=C,e[3]=N,e[4]=v):v=e[4];let T;e[5]!==g.label?(T=t.jsx("span",{className:"flex-1 text-xs font-medium text-muted-foreground",children:g.label}),e[5]=g.label,e[6]=T):T=e[6];let E;e[7]!==n.length?(E=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n.length}),e[7]=n.length,e[8]=E):E=e[8];let f;e[9]!==i||e[10]!==u?(f=u&&t.jsxs(Ne,{children:[t.jsx(Se,{render:t.jsx(I,{variant:"ghost",size:"icon-xs",className:"opacity-0 transition-opacity group-hover:opacity-100","aria-label":`New ${i.slice(0,-1)}`,onClick:u}),children:t.jsx(Ze,{"data-icon":"inline-start"})}),t.jsxs(we,{children:["New ",i.slice(0,-1)]})]}),e[9]=i,e[10]=u,e[11]=f):f=e[11];let D;e[12]!==v||e[13]!==T||e[14]!==E||e[15]!==f?(D=t.jsxs("div",{className:"group flex h-8 items-center gap-1.5 px-3",children:[v,T,E,f]}),e[12]=v,e[13]=T,e[14]=E,e[15]=f,e[16]=D):D=e[16];let z;if(e[17]!==n||e[18]!==m||e[19]!==k||e[20]!==c||e[21]!==y||e[22]!==w||e[23]!==r||e[24]!==p||e[25]!==d||e[26]!==s){let B;e[28]!==m||e[29]!==k||e[30]!==c||e[31]!==y||e[32]!==w||e[33]!==r||e[34]!==p||e[35]!==d||e[36]!==s?(B=j=>{const U=s===j.path;if(d===j.path)return t.jsxs("div",{className:"flex items-center gap-1 border-l-2 border-foreground/30 bg-accent px-3 py-1",children:[t.jsx(ae,{value:p,onChange:$=>w($.target.value),onKeyDown:$=>{$.key==="Enter"&&y(),$.key==="Escape"&&k()},autoFocus:!0,className:"h-7 min-w-0 flex-1 text-xs"}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Save name",onClick:y,disabled:!p.trim(),children:t.jsx(H,{"data-icon":"inline-start"})}),t.jsx(I,{variant:"ghost",size:"icon-xs","aria-label":"Cancel rename",onClick:k,children:t.jsx(K,{"data-icon":"inline-start"})})]},j.path);const M=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-sm",children:j.name}),t.jsx(je,{linkTarget:j.linkTarget}),j.readOnly&&t.jsx(he,{className:"size-2.5 shrink-0 text-muted-foreground/40"})]}),j.description&&t.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:j.description})]}),t.jsx(pe,{cli:j.cli}),t.jsx(ge,{scope:j.scope,pluginName:j.pluginName})]}),P=F("flex w-full items-center gap-2 border-l-2 px-3 py-2 text-left text-sm transition-colors",U?"border-foreground/30 bg-accent text-accent-foreground":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground");return!m||!c?t.jsx("button",{type:"button",className:P,onClick:()=>r(j),children:M},j.path):t.jsxs(De,{children:[t.jsx(Te,{render:t.jsx("button",{type:"button",className:P,onClick:()=>r(j)}),children:M}),t.jsx(Ee,{className:"min-w-36",children:j.readOnly?t.jsx(V,{children:t.jsx(Re,{children:"Read-only file"})}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(ee,{onClick:()=>c(j),children:"Rename"})}),t.jsx(Oe,{}),t.jsx(V,{children:t.jsx(ee,{variant:"destructive",onClick:()=>m(j),children:"Delete"})})]})})]},j.path)},e[28]=m,e[29]=k,e[30]=c,e[31]=y,e[32]=w,e[33]=r,e[34]=p,e[35]=d,e[36]=s,e[37]=B):B=e[37],z=n.map(B),e[17]=n,e[18]=m,e[19]=k,e[20]=c,e[21]=y,e[22]=w,e[23]=r,e[24]=p,e[25]=d,e[26]=s,e[27]=z}else z=e[27];let R;e[38]!==b||e[39]!==n.length?(R=n.length===0&&!b&&t.jsx("p",{className:"px-3 py-1 text-xs text-muted-foreground",children:"None configured"}),e[38]=b,e[39]=n.length,e[40]=R):R=e[40];let O;e[41]!==b||e[42]!==x||e[43]!==S?(O=b&&t.jsx(ut,{globalDir:b.globalDir,projectDir:b.projectDir,fileType:b.fileType,onCreated:S,onCancel:x}),e[41]=b,e[42]=x,e[43]=S,e[44]=O):O=e[44];let L;return e[45]!==D||e[46]!==z||e[47]!==R||e[48]!==O?(L=t.jsxs("section",{children:[D,z,R,O]}),e[45]=D,e[46]=z,e[47]=R,e[48]=O,e[49]=L):L=e[49],L}function xt({file:l,onDeleted:e,readOnly:i=!1}){const[n,s]=o.useState(null),[r,u]=o.useState(null),[m,c]=o.useState(!0),[d,p]=o.useState(!1),[w,y]=o.useState(!1),[k,b]=o.useState(!1),[S,x]=o.useState(!1),g=n!==null&&n!==r,C=i||l.readOnly;o.useEffect(()=>{c(!0),s(null),u(null),y(!1),b(!1),A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`).then(f=>f.json()).then(f=>{s(f.content??""),u(f.content??"")}).catch(()=>{s(""),u("")}).finally(()=>c(!1))},[l.path]);const N=o.useCallback(async()=>{if(!(!g||C)){p(!0);try{(await A("/api/config-browser/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:l.path,content:n})})).ok&&(u(n),y(!0),setTimeout(()=>y(!1),2e3))}finally{p(!1)}}},[n,l.path,g,C]),v=o.useCallback(()=>{s(r)},[r]),T=o.useCallback(async()=>{if(!C){x(!0);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(l.path)}`,{method:"DELETE"})).ok&&(b(!1),e())}catch{}finally{x(!1)}}},[l.path,C,e]);o.useEffect(()=>{function f(D){!C&&(D.metaKey||D.ctrlKey)&&D.key==="s"&&(D.preventDefault(),N())}return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[N,C]);function E(){return w?"Saved!":d?"Saving...":"Save"}return t.jsxs("div",{className:"flex flex-1 flex-col min-h-0 min-w-0",children:[t.jsxs("div",{className:"flex min-h-11 shrink-0 items-center gap-2 border-b bg-card px-4 py-2",children:[t.jsx(te,{variant:"outline",className:F("h-5 text-xs",it[l.fileType]||"bg-muted text-muted-foreground"),children:l.fileType}),t.jsx(ge,{scope:l.scope,pluginName:l.pluginName}),t.jsx(pe,{cli:l.cli,variant:"full"}),C&&t.jsxs(te,{variant:"outline",className:"h-5 bg-muted text-xs text-muted-foreground",children:[t.jsx(he,{"data-icon":"inline-start",className:"size-3"})," read-only"]}),g&&t.jsx("span",{className:"size-2 shrink-0 rounded-full bg-warning",title:"Unsaved changes"}),t.jsxs("div",{className:"flex items-center gap-2 ml-auto min-w-0",children:[t.jsx(je,{linkTarget:l.linkTarget,variant:"full"}),t.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",title:l.path,children:l.path})]})]}),m?t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:"Loading..."}):t.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[t.jsx(lt,{value:n??"",onChange:s,readOnly:C,filePath:l.path}),!C&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t bg-card px-4 py-2",children:[t.jsxs(I,{size:"xs",onClick:N,disabled:!g||d,children:[t.jsx(H,{"data-icon":"inline-start"}),E()]}),t.jsxs(I,{variant:"outline",size:"xs",onClick:v,disabled:!g,children:[t.jsx(et,{"data-icon":"inline-start"}),"Discard"]}),t.jsx("div",{className:"flex-1"}),t.jsxs(le,{open:k,onOpenChange:b,children:[t.jsxs(Ie,{render:t.jsx(I,{variant:"outline",size:"xs"}),children:[t.jsx(tt,{"data-icon":"inline-start"}),"Delete"]}),t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',l.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",disabled:S,children:"Cancel"}),t.jsxs(me,{variant:"destructive",size:"sm",disabled:S,onClick:()=>void T(),children:[S&&t.jsx(ze,{"data-icon":"inline-start"}),S?"Deleting...":"Delete file"]})]})]})]})]})]})]})}function ft(){const l=G.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ae,{className:"border-0",children:t.jsxs(Le,{children:[t.jsx(Be,{variant:"icon",children:t.jsx(nt,{})}),t.jsx($e,{children:"Select a configuration file"}),t.jsx(Fe,{children:"Browse instructions, agents, skills, commands, and settings from the sidebar."})]})}),l[0]=e):e=l[0],e}function ht(l){return l.cli?l.cli.length>0?l.cli.join(" "):"unlinked":""}function gt(l,e){if(!e)return l;const i=e.toLowerCase();return l.filter(n=>[n.name,n.description,n.path,n.linkTarget??"",ht(n)].some(r=>r.toLowerCase().includes(i)))}const vt=o.memo(function({projectPath:e,initialFilePath:i}){var Y,q;const n=Ge("configWrite"),[s,r]=o.useState([]),[u,m]=o.useState(!0),[c,d]=o.useState(null),[p,w]=o.useState(!1),[y,k]=o.useState(null),[b,S]=o.useState(""),[x,g]=o.useState(null),[C,N]=o.useState(""),[v,T]=o.useState(null),E=o.useRef(!1),f=o.useCallback(async()=>{if(!n){r([]),d(null),m(!1);return}m(!0);try{const a=e?`/api/config-browser/tree?cwd=${encodeURIComponent(e)}`:"/api/config-browser/tree",h=await A(a);if(h.ok){const _=await h.json();r(_.sections||[])}}finally{m(!1)}},[n,e]);o.useEffect(()=>{f()},[f]),o.useEffect(()=>{if(!i||u||E.current)return;const a=s.flatMap(h=>J(h.items,h.scope,h.pluginName)).find(h=>h.path===i);a&&(d(a),E.current=!0)},[i,u,s]);const D=ct(s),z=Object.fromEntries(se.map(a=>[a,gt(D[a],b)])),R=(Y=s.find(a=>a.scope==="global"))==null?void 0:Y.baseDir,O=(q=s.find(a=>a.scope==="project"))==null?void 0:q.baseDir,L=o.useCallback(a=>{d(a),w(!1),k(null)},[]),B=o.useCallback((a,h,_)=>{k(null),f(),d({path:a,name:a.split("/").pop()||"",fileType:h,readOnly:!1,scope:_,description:""})},[f]),j=o.useCallback(()=>{d(null),f()},[f]),U=o.useCallback(a=>{if(!n||!R&&!O)return;const h=rt[a];h&&k({category:a,globalDir:R?`${R}/${h.subdir}`:null,projectDir:O?`${O}/${h.subdir}`:null,fileType:h.fileType})},[n,R,O]),Q=o.useCallback(a=>{!n||a.readOnly||T(a)},[n]),M=o.useCallback(async()=>{if(!n||!v||v.readOnly)return;const a=v;T(null);try{(await A(`/api/config-browser/file?path=${encodeURIComponent(a.path)}`,{method:"DELETE"})).ok&&((c==null?void 0:c.path)===a.path&&d(null),f())}catch{}},[n,f,v,c]),P=o.useCallback(a=>{if(!n||a.readOnly)return;const h=a.name==="SKILL.md"?a.path.split("/").slice(-2,-1)[0]||a.name:a.name.replace(/\.[^.]+$/,"");g(a),N(h)},[n]),$=o.useCallback(async()=>{if(!(!n||!x||!C.trim()))try{const a=await A("/api/config-browser/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:x.path,newName:C.trim()})});if(a.ok){const h=await a.json();g(null),N(""),await f(),h.newPath&&d({...x,path:h.newPath,name:h.newPath.split("/").pop()||x.name})}}catch{}},[n,x,C,f]),be=o.useCallback(()=>{g(null),N("")},[]);return n?t.jsxs("div",{className:"flex flex-1 min-h-0 min-w-0",children:[t.jsxs("div",{className:F("min-h-0 shrink-0 flex-col border-r bg-sidebar md:flex md:w-80",c&&!p?"hidden":"flex w-full"),children:[t.jsxs("div",{className:"flex h-11 items-center gap-2 border-b px-3",children:[t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Configuration"}),e&&t.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",title:e,children:e.split("/").pop()})]}),t.jsx("div",{className:"border-b p-2",children:t.jsxs(Me,{children:[t.jsx(ne,{children:t.jsx(st,{"data-icon":"inline-start"})}),t.jsx(Pe,{value:b,onChange:a=>S(a.target.value),placeholder:"Search configuration"}),b&&t.jsx(ne,{align:"inline-end",children:t.jsx(Ue,{size:"icon-xs","aria-label":"Clear search",onClick:()=>S(""),children:t.jsx(K,{"data-icon":"inline-start"})})})]})}),t.jsx(_e,{className:"flex-1",children:t.jsx("div",{className:"flex flex-col gap-1 py-2",children:u?t.jsx("div",{className:"flex flex-col gap-2 px-3 py-2","aria-label":"Loading configuration",children:Array.from({length:6},(a,h)=>t.jsx(Ve,{className:"h-8 w-full"},h))}):se.map(a=>{const h=a==="agents"||a==="skills"||a==="commands";return t.jsx(mt,{category:a,items:z[a],selectedPath:(c==null?void 0:c.path)??null,onSelect:L,onNewFile:n&&h?()=>U(a):void 0,onDeleteItem:n?Q:void 0,onRenameItem:n?P:void 0,renamingPath:(x==null?void 0:x.path)??null,renameValue:C,onRenameValueChange:N,onRenameSubmit:$,onRenameCancel:be,creatingInCategory:n&&(y==null?void 0:y.category)===a?y:null,onCreated:B,onCancelCreate:()=>k(null)},a)})})})]}),t.jsx("div",{className:F("min-h-0 min-w-0 flex-1 flex-col md:flex",c&&!p?"flex":"hidden"),children:c?t.jsxs(t.Fragment,{children:[t.jsxs(I,{variant:"ghost",className:"min-h-11 shrink-0 justify-start md:hidden",onClick:()=>w(!0),children:[t.jsx(at,{"data-icon":"inline-start"}),"All configuration files"]}),t.jsx(xt,{file:c,onDeleted:j,readOnly:!n})]}):t.jsx(ft,{})}),t.jsx(le,{open:v!==null,onOpenChange:a=>{a||T(null)},children:t.jsxs(ie,{size:"sm",children:[t.jsxs(re,{children:[t.jsx(oe,{children:"Delete configuration file?"}),t.jsxs(ce,{children:['Delete "',v==null?void 0:v.name,'" permanently? This action cannot be undone.']})]}),t.jsxs(de,{children:[t.jsx(ue,{size:"sm",children:"Cancel"}),t.jsx(me,{variant:"destructive",size:"sm",onClick:()=>void M(),children:"Delete file"})]})]})})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Server configuration is available to administrators only."})});export{vt as ConfigBrowser};
@@ -0,0 +1,2 @@
1
+ import{c as G,r as H,j as i}from"./vendor-react-gGw_S5I_.js";import{V as M,W as P,J as X,X as z}from"./index-DsnL-sXV.js";const F=2e5;function W(l){const e=G.c(32),{value:t,onChange:v,readOnly:f,filePath:E,ariaLabel:L,textareaRef:u,onKeyDown:S,onSelect:_}=l,p=M(),[h,N]=H.useState(null),d=H.useRef(null),m=H.useRef(null);let x;e[0]!==E?(x=P(E)??"markdown",e[0]=E,e[1]=x):x=e[1];const g=x,b=t.length>F;let j,k;e[2]!==p||e[3]!==g||e[4]!==b||e[5]!==t?(j=()=>{if(b){N(null);return}let r=!1;const I=setTimeout(()=>{z(t,g,p).then(A=>{r||N(A)})},80);return()=>{r=!0,clearTimeout(I)}},k=[t,g,p,b],e[2]=p,e[3]=g,e[4]=b,e[5]=t,e[6]=j,e[7]=k):(j=e[6],k=e[7]),H.useEffect(j,k);let R;e[8]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{d.current&&m.current&&(m.current.scrollTop=d.current.scrollTop,m.current.scrollLeft=d.current.scrollLeft)},e[8]=R):R=e[8];const D=R;let T;e[9]!==u?(T=r=>{d.current=r,u&&(u.current=r)},e[9]=u,e[10]=T):T=e[10];const y=T;let n;e[11]!==h||e[12]!==t?(n=h?h.map(J):i.jsx("code",{className:"text-foreground",children:t}),e[11]=h,e[12]=t,e[13]=n):n=e[13];let s;e[14]!==n?(s=i.jsx("pre",{ref:m,"aria-hidden":!0,className:"absolute inset-0 overflow-hidden font-mono text-[13px] leading-relaxed p-4 m-0 pointer-events-none whitespace-pre-wrap break-words",children:n}),e[14]=n,e[15]=s):s=e[15];let o;e[16]!==v?(o=r=>v(r.target.value),e[16]=v,e[17]=o):o=e[17];const C=f&&"cursor-default";let a;e[18]!==C?(a=X("absolute inset-0 w-full h-full resize-none bg-transparent font-mono text-[13px] leading-relaxed p-4 outline-none","text-transparent caret-foreground selection:bg-selection","scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border",C),e[18]=C,e[19]=a):a=e[19];let c;e[20]!==L||e[21]!==y||e[22]!==S||e[23]!==_||e[24]!==f||e[25]!==a||e[26]!==o||e[27]!==t?(c=i.jsx("textarea",{ref:y,"aria-label":L,value:t,onChange:o,onScroll:D,onKeyDown:S,onSelect:_,readOnly:f,spellCheck:!1,className:a,placeholder:"Empty file"}),e[20]=L,e[21]=y,e[22]=S,e[23]=_,e[24]=f,e[25]=a,e[26]=o,e[27]=t,e[28]=c):c=e[28];let w;return e[29]!==c||e[30]!==s?(w=i.jsxs("div",{className:"relative min-h-0 flex-1 bg-background",children:[s,c]}),e[29]=c,e[30]=s,e[31]=w):w=e[31],w}function J(l,e){return i.jsxs("span",{children:[l.map(K),`
2
+ `]},e)}function K(l,e){return i.jsx("span",{style:{color:l.color},children:l.content},e)}export{W as H};
@@ -1 +1 @@
1
- import{c as q,j as t,r as k}from"./vendor-react-gGw_S5I_.js";import{D as F,g as $,K as T,e as Q,B as P,f as Y,r as _,h as H,i as M,j as U,k as J,l as V,I as W,m as X,n as Z,o as ee,A as te,p as se,q as ae,s as le,t as ne,u as re}from"./index-CVF75nuK.js";import{R as O,K as oe,S as ce}from"./vendor-ui-C4lFQWec.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function fe(e){const s=q.c(6),{open:f,onOpenChange:l}=e,x=f?"open":"closed";let a;s[0]!==x?(a=t.jsx(de,{},x),s[0]=x,s[1]=a):a=s[1];let r;return s[2]!==l||s[3]!==f||s[4]!==a?(r=t.jsx(F,{open:f,onOpenChange:l,children:a}),s[2]=l,s[3]=f,s[4]=a,s[5]=r):r=s[5],r}function de(){const e=q.c(45),[s,f]=k.useState(""),[l,x]=k.useState(null),[a,r]=k.useState(null),[B,G]=k.useState($);let E,I;e[0]!==l?(E=()=>{if(!l)return;const D=l,A=function(n){if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),x(null),r(null);return}if(ie.has(n.key))return;n.preventDefault(),n.stopPropagation();const c=le(n),p=ne(c,D);if(p){r(`Already assigned to “${p.label}”.`);return}re(D,c),G($()),x(null),r(null)};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},I=[l],e[0]=l,e[1]=E,e[2]=I):(E=e[1],I=e[2]),k.useEffect(E,I);let g,j,d,y,b,N,S,w,m,u,h;if(e[3]!==B||e[4]!==a||e[5]!==s||e[6]!==l){const D=s.trim().toLowerCase(),A=D?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(D)):T;j=H,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(M,{className:"p-4 pb-3",children:[t.jsxs(U,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(J,{children:"Click a shortcut, then press a new key combination. Changes are saved on this device."})]}),u=t.jsx(V,{}),e[18]=m,e[19]=u):(m=e[18],u=e[19]);let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(W,{children:t.jsx(ce,{"data-icon":"inline-start","aria-hidden":"true"})}),e[20]=K):K=e[20];let n;e[21]===Symbol.for("react.memo_cache_sentinel")?(n=i=>f(i.target.value),e[21]=n):n=e[21];let c;e[22]!==s?(c=t.jsxs(X,{className:"flex-1",children:[K,t.jsx(Z,{"aria-label":"Search keyboard shortcuts",value:s,onChange:n,placeholder:"Search shortcuts…"})]}),e[22]=s,e[23]=c):c=e[23];let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(P,{variant:"outline",size:"sm",onClick:()=>{ee(),G($()),r(null)},children:[t.jsx(O,{"data-icon":"inline-start"}),"Reset all"]}),e[24]=p):p=e[24],e[25]!==c?(h=t.jsxs("div",{className:"flex items-center gap-2 p-3",children:[c,p]}),e[25]=c,e[26]=h):h=e[26],e[27]!==a?(d=a&&t.jsx(te,{variant:"destructive",className:"mx-3 mb-2 w-auto",children:t.jsxs(se,{children:[a," Press another shortcut or Esc to cancel."]})}),e[27]=a,e[28]=d):d=e[28],g=ae,N="h-[min(28rem,60vh)]",y="flex flex-col gap-4 px-3 pb-4",b=Q.map(i=>{const L=A.filter(o=>o.group===i);return L.length===0?null:t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:i}),L.map(o=>{const z=l===o.command;return t.jsxs("div",{className:"flex min-h-12 items-center gap-3 rounded-md px-2 py-1.5 hover:bg-accent",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm",children:o.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.description})]}),t.jsx(P,{variant:z?"secondary":"outline",size:"sm",className:"min-w-28 font-mono text-xs",onClick:()=>{r(null),x(z?null:o.command)},"aria-label":`Change shortcut for ${o.label}`,children:z?"Press keys…":Y(B[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{_(o.command),G($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(O,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=B,e[4]=a,e[5]=s,e[6]=l,e[7]=g,e[8]=j,e[9]=d,e[10]=y,e[11]=b,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else g=e[7],j=e[8],d=e[9],y=e[10],b=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==y||e[30]!==b?(C=t.jsx("div",{className:y,children:b}),e[29]=y,e[30]=b,e[31]=C):C=e[31];let v;e[32]!==g||e[33]!==C||e[34]!==N?(v=t.jsx(g,{className:N,children:C}),e[32]=g,e[33]=C,e[34]=N,e[35]=v):v=e[35];let R;return e[36]!==j||e[37]!==d||e[38]!==v||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(j,{className:S,showCloseButton:w,children:[m,u,h,d,v]}),e[36]=j,e[37]=d,e[38]=v,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{fe as KeyboardShortcutsDialog};
1
+ import{c as q,j as t,r as k}from"./vendor-react-gGw_S5I_.js";import{D as F,g as $,K as T,e as Q,B as P,f as Y,r as _,h as H,i as M,j as U,k as J,l as V,I as W,m as X,n as Z,o as ee,A as te,p as se,q as ae,s as le,t as ne,u as re}from"./index-DsnL-sXV.js";import{R as O,K as oe,S as ce}from"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const ie=new Set(["Alt","Control","Meta","Shift"]);function fe(e){const s=q.c(6),{open:f,onOpenChange:l}=e,x=f?"open":"closed";let a;s[0]!==x?(a=t.jsx(de,{},x),s[0]=x,s[1]=a):a=s[1];let r;return s[2]!==l||s[3]!==f||s[4]!==a?(r=t.jsx(F,{open:f,onOpenChange:l,children:a}),s[2]=l,s[3]=f,s[4]=a,s[5]=r):r=s[5],r}function de(){const e=q.c(45),[s,f]=k.useState(""),[l,x]=k.useState(null),[a,r]=k.useState(null),[B,G]=k.useState($);let E,I;e[0]!==l?(E=()=>{if(!l)return;const D=l,A=function(n){if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),x(null),r(null);return}if(ie.has(n.key))return;n.preventDefault(),n.stopPropagation();const c=le(n),p=ne(c,D);if(p){r(`Already assigned to “${p.label}”.`);return}re(D,c),G($()),x(null),r(null)};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},I=[l],e[0]=l,e[1]=E,e[2]=I):(E=e[1],I=e[2]),k.useEffect(E,I);let g,j,d,y,b,N,S,w,m,u,h;if(e[3]!==B||e[4]!==a||e[5]!==s||e[6]!==l){const D=s.trim().toLowerCase(),A=D?T.filter(i=>`${i.label} ${i.description} ${i.group}`.toLowerCase().includes(D)):T;j=H,S="max-w-2xl gap-0 overflow-hidden p-0",w=!1,e[18]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(M,{className:"p-4 pb-3",children:[t.jsxs(U,{className:"flex items-center gap-2",children:[t.jsx(oe,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4"}),"Keyboard shortcuts"]}),t.jsx(J,{children:"Click a shortcut, then press a new key combination. Changes are saved on this device."})]}),u=t.jsx(V,{}),e[18]=m,e[19]=u):(m=e[18],u=e[19]);let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(W,{children:t.jsx(ce,{"data-icon":"inline-start","aria-hidden":"true"})}),e[20]=K):K=e[20];let n;e[21]===Symbol.for("react.memo_cache_sentinel")?(n=i=>f(i.target.value),e[21]=n):n=e[21];let c;e[22]!==s?(c=t.jsxs(X,{className:"flex-1",children:[K,t.jsx(Z,{"aria-label":"Search keyboard shortcuts",value:s,onChange:n,placeholder:"Search shortcuts…"})]}),e[22]=s,e[23]=c):c=e[23];let p;e[24]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(P,{variant:"outline",size:"sm",onClick:()=>{ee(),G($()),r(null)},children:[t.jsx(O,{"data-icon":"inline-start"}),"Reset all"]}),e[24]=p):p=e[24],e[25]!==c?(h=t.jsxs("div",{className:"flex items-center gap-2 p-3",children:[c,p]}),e[25]=c,e[26]=h):h=e[26],e[27]!==a?(d=a&&t.jsx(te,{variant:"destructive",className:"mx-3 mb-2 w-auto",children:t.jsxs(se,{children:[a," Press another shortcut or Esc to cancel."]})}),e[27]=a,e[28]=d):d=e[28],g=ae,N="h-[min(28rem,60vh)]",y="flex flex-col gap-4 px-3 pb-4",b=Q.map(i=>{const L=A.filter(o=>o.group===i);return L.length===0?null:t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:i}),L.map(o=>{const z=l===o.command;return t.jsxs("div",{className:"flex min-h-12 items-center gap-3 rounded-md px-2 py-1.5 hover:bg-accent",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm",children:o.label}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.description})]}),t.jsx(P,{variant:z?"secondary":"outline",size:"sm",className:"min-w-28 font-mono text-xs",onClick:()=>{r(null),x(z?null:o.command)},"aria-label":`Change shortcut for ${o.label}`,children:z?"Press keys…":Y(B[o.command])}),t.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>{_(o.command),G($()),r(null)},"aria-label":`Reset shortcut for ${o.label}`,children:t.jsx(O,{"data-icon":"inline-start"})})]},o.command)})]},i)}),e[3]=B,e[4]=a,e[5]=s,e[6]=l,e[7]=g,e[8]=j,e[9]=d,e[10]=y,e[11]=b,e[12]=N,e[13]=S,e[14]=w,e[15]=m,e[16]=u,e[17]=h}else g=e[7],j=e[8],d=e[9],y=e[10],b=e[11],N=e[12],S=e[13],w=e[14],m=e[15],u=e[16],h=e[17];let C;e[29]!==y||e[30]!==b?(C=t.jsx("div",{className:y,children:b}),e[29]=y,e[30]=b,e[31]=C):C=e[31];let v;e[32]!==g||e[33]!==C||e[34]!==N?(v=t.jsx(g,{className:N,children:C}),e[32]=g,e[33]=C,e[34]=N,e[35]=v):v=e[35];let R;return e[36]!==j||e[37]!==d||e[38]!==v||e[39]!==S||e[40]!==w||e[41]!==m||e[42]!==u||e[43]!==h?(R=t.jsxs(j,{className:S,showCloseButton:w,children:[m,u,h,d,v]}),e[36]=j,e[37]=d,e[38]=v,e[39]=S,e[40]=w,e[41]=m,e[42]=u,e[43]=h,e[44]=R):R=e[44],R}export{fe as KeyboardShortcutsDialog};
@@ -1 +1 @@
1
- import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{S as p,a as f,b as j,c as g,F as C,d as S}from"./index-CVF75nuK.js";import"./vendor-ui-C4lFQWec.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const E=x.memo(function(c){const e=d.c(10),{open:l,onClose:a,session:r,sessionChangeKey:h}=c;let i;e[0]!==a?(i=m=>{m||a()},e[0]=a,e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs(p,{className:"shrink-0 px-4 py-3",children:[s.jsx(f,{children:"File changes"}),s.jsx(j,{className:"sr-only",children:"Review files changed in this session."})]}),e[2]=t):t=e[2];let n;e[3]!==r||e[4]!==h?(n=s.jsxs(g,{side:"bottom",className:"h-[72svh] max-h-[92svh] rounded-t-xl",children:[t,s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(C,{session:r,sessionChangeKey:h})})]}),e[3]=r,e[4]=h,e[5]=n):n=e[5];let o;return e[6]!==l||e[7]!==i||e[8]!==n?(o=s.jsx(S,{open:l,onOpenChange:i,children:n}),e[6]=l,e[7]=i,e[8]=n,e[9]=o):o=e[9],o});export{E as MobileFileChanges};
1
+ import{r as x,c as d,j as s}from"./vendor-react-gGw_S5I_.js";import{S as p,a as f,b as j,c as g,F as C,d as S}from"./index-DsnL-sXV.js";import"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const E=x.memo(function(c){const e=d.c(10),{open:l,onClose:a,session:r,sessionChangeKey:h}=c;let i;e[0]!==a?(i=m=>{m||a()},e[0]=a,e[1]=i):i=e[1];let t;e[2]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs(p,{className:"shrink-0 px-4 py-3",children:[s.jsx(f,{children:"File changes"}),s.jsx(j,{className:"sr-only",children:"Review files changed in this session."})]}),e[2]=t):t=e[2];let n;e[3]!==r||e[4]!==h?(n=s.jsxs(g,{side:"bottom",className:"h-[72svh] max-h-[92svh] rounded-t-xl",children:[t,s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(C,{session:r,sessionChangeKey:h})})]}),e[3]=r,e[4]=h,e[5]=n):n=e[5];let o;return e[6]!==l||e[7]!==i||e[8]!==n?(o=s.jsx(S,{open:l,onOpenChange:i,children:n}),e[6]=l,e[7]=i,e[8]=n,e[9]=o):o=e[9],o});export{E as MobileFileChanges};
@@ -0,0 +1 @@
1
+ import{c as ue,r as C,j as t}from"./vendor-react-gGw_S5I_.js";import{C as Q,b8 as Ie,a$ as X,b9 as Qe,b0 as Re,ba as Xe,b4 as de,B as E,z as Fe,bb as et,bc as Ge,bd as Ke,be as Je,bf as We,bg as Ye,bh as Ze,A as se,p as ne,bi as tt,Z as $e,bj as st,bk as Me,a7 as nt,a8 as it,ab as lt,a5 as at,aa as ot,a9 as rt,a4 as ct,a3 as dt,aV as De,bl as ut,bm as ft,D as ht,h as mt,i as pt,j as xt,k as gt,bn as jt,bo as bt,bp as vt,bq as Ae,br as Oe,L as yt,M as Ct,N as wt,O as Nt,Q as St}from"./index-DsnL-sXV.js";import{a as kt,aj as $t}from"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function Be(l){const e=l.trim().replace(/^v/i,"").match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/);return e?{parts:[Number(e[1]),Number(e[2]),Number(e[3])],prerelease:e[4]?e[4].split("."):[]}:null}function Dt(l,e){if(l.length===0&&e.length===0)return 0;if(l.length===0)return 1;if(e.length===0)return-1;for(let s=0;s<Math.max(l.length,e.length);s+=1){const i=l[s],r=e[s];if(i===void 0)return-1;if(r===void 0)return 1;const a=/^\d+$/.test(i),n=/^\d+$/.test(r);if(a&&n){if(Number(i)!==Number(r))return Number(i)<Number(r)?-1:1;continue}if(a!==n)return a?-1:1;if(i!==r)return i<r?-1:1}return 0}function It(l,e){const s=Be(l),i=Be(e);if(!s||!i)return null;for(let r=0;r<3;r+=1)if(s.parts[r]!==i.parts[r])return s.parts[r]<i.parts[r]?-1:1;return Dt(s.prerelease,i.prerelease)}function Ue(l){const e=ue.c(33),{value:s,onChange:i,projects:r,disabled:a}=l,n=a===void 0?!1:a,d=C.useId();let o;e[0]!==s.projectIds||e[1]!==s.type?(o=s.type==="projects"?s.projectIds:[],e[0]=s.projectIds,e[1]=s.type,e[2]=o):o=e[2];let v;e[3]!==o?(v=new Set(o),e[3]=o,e[4]=v):v=e[4];const y=v;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Qe,{children:"Available in"}),e[5]=h):h=e[5];const w=`${d}-all`,j=s.type==="all";let c;e[6]!==i?(c=N=>i(N?{type:"all"}:{type:"projects",projectIds:[]}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==n||e[9]!==w||e[10]!==j||e[11]!==c?(p=t.jsx(Ie,{id:w,checked:j,disabled:n,onCheckedChange:c}),e[8]=n,e[9]=w,e[10]=j,e[11]=c,e[12]=p):p=e[12];const m=`${d}-all`;let x;e[13]!==m?(x=t.jsx(X,{htmlFor:m,children:"All projects on this host, including new projects"}),e[13]=m,e[14]=x):x=e[14];let g;e[15]!==x||e[16]!==p?(g=t.jsxs(Q,{orientation:"horizontal",children:[p,x]}),e[15]=x,e[16]=p,e[17]=g):g=e[17];let b;e[18]!==n||e[19]!==d||e[20]!==i||e[21]!==r||e[22]!==y||e[23]!==s.projectIds||e[24]!==s.type?(b=s.type==="projects"&&t.jsx("div",{className:"flex max-h-40 flex-col gap-3 overflow-y-auto",children:r.map(N=>t.jsxs(Q,{orientation:"horizontal",children:[t.jsx(Ie,{id:`${d}-${N.id}`,checked:y.has(N.id),disabled:n,onCheckedChange:D=>i({type:"projects",projectIds:D?[...s.projectIds,N.id]:s.projectIds.filter(R=>R!==N.id)})}),t.jsx(X,{htmlFor:`${d}-${N.id}`,children:N.name})]},N.id))}),e[18]=n,e[19]=d,e[20]=i,e[21]=r,e[22]=y,e[23]=s.projectIds,e[24]=s.type,e[25]=b):b=e[25];const k=s.type==="projects"&&s.projectIds.length===0?"Installed but hidden until you choose a project.":"This setting is shared by every client connected to this host.";let S;e[26]!==k?(S=t.jsx(Re,{children:k}),e[26]=k,e[27]=S):S=e[27];let u;return e[28]!==n||e[29]!==g||e[30]!==b||e[31]!==S?(u=t.jsxs(Xe,{disabled:n,children:[h,g,b,S]}),e[28]=n,e[29]=g,e[30]=b,e[31]=S,e[32]=u):u=e[32],u}function Rt(l){const e=ue.c(69),{client:s,run:i,busy:r}=l,a=C.useId(),[n,d]=C.useState(""),[o,v]=C.useState(""),[y,h]=C.useState(null),[w,j]=C.useState(""),[c,p]=C.useState(!1);let m;e[0]!==s||e[1]!==w||e[2]!==o||e[3]!==n||e[4]!==y||e[5]!==i?(m=Y=>{Y.preventDefault(),i(async()=>{var ce;if(!y||y.size>262144)throw new Error("Choose a root metadata file smaller than 256 KiB");if(!((ce=globalThis.crypto)!=null&&ce.subtle))throw new Error("Publisher enrollment requires HTTPS or localhost");const B=await y.arrayBuffer(),re=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",B)),Et).join("");if(re!==w.trim().toLowerCase())throw new Error("The root file does not match the fingerprint you entered");await s.enrollDeveloper({publisher:n,label:o,root:new TextDecoder("utf-8",{fatal:!0}).decode(B),fingerprint:re}),p(!1),d(""),v(""),j("")})},e[0]=s,e[1]=w,e[2]=o,e[3]=n,e[4]=y,e[5]=i,e[6]=m):m=e[6];const x=`${a}-name`;let g;e[7]!==x?(g=t.jsx(X,{htmlFor:x,children:"Development publisher"}),e[7]=x,e[8]=g):g=e[8];const b=`${a}-name`;let k;e[9]===Symbol.for("react.memo_cache_sentinel")?(k=Y=>d(Y.target.value),e[9]=k):k=e[9];let S;e[10]!==r||e[11]!==n||e[12]!==b?(S=t.jsx(de,{id:b,value:n,onChange:k,placeholder:"dev-your-name",pattern:"dev-[a-z0-9-]+",maxLength:64,required:!0,disabled:r}),e[10]=r,e[11]=n,e[12]=b,e[13]=S):S=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Re,{children:"Development publishers have a separate namespace from official plugins."}),e[14]=u):u=e[14];let N;e[15]!==g||e[16]!==S?(N=t.jsxs(Q,{children:[g,S,u]}),e[15]=g,e[16]=S,e[17]=N):N=e[17];const D=`${a}-label`;let R;e[18]!==D?(R=t.jsx(X,{htmlFor:D,children:"Display name"}),e[18]=D,e[19]=R):R=e[19];const A=`${a}-label`;let O;e[20]===Symbol.for("react.memo_cache_sentinel")?(O=Y=>v(Y.target.value),e[20]=O):O=e[20];let I;e[21]!==r||e[22]!==o||e[23]!==A?(I=t.jsx(de,{id:A,value:o,onChange:O,maxLength:100,required:!0,disabled:r}),e[21]=r,e[22]=o,e[23]=A,e[24]=I):I=e[24];let q;e[25]!==R||e[26]!==I?(q=t.jsxs(Q,{children:[R,I]}),e[25]=R,e[26]=I,e[27]=q):q=e[27];const H=`${a}-root`;let z;e[28]!==H?(z=t.jsx(X,{htmlFor:H,children:"Publisher root file"}),e[28]=H,e[29]=z):z=e[29];const ee=`${a}-root`;let G;e[30]===Symbol.for("react.memo_cache_sentinel")?(G=Y=>{var B;h(((B=Y.target.files)==null?void 0:B[0])??null),p(!1)},e[30]=G):G=e[30];let F;e[31]!==r||e[32]!==ee?(F=t.jsx(de,{id:ee,type:"file",accept:".json,application/json",onChange:G,required:!0,disabled:r}),e[31]=r,e[32]=ee,e[33]=F):F=e[33];let K;e[34]!==z||e[35]!==F?(K=t.jsxs(Q,{children:[z,F]}),e[34]=z,e[35]=F,e[36]=K):K=e[36];const te=`${a}-fingerprint`;let _;e[37]!==te?(_=t.jsx(X,{htmlFor:te,children:"Verified SHA-256 fingerprint"}),e[37]=te,e[38]=_):_=e[38];const J=`${a}-fingerprint`;let L;e[39]===Symbol.for("react.memo_cache_sentinel")?(L=Y=>{j(Y.target.value),p(!1)},e[39]=L):L=e[39];let U;e[40]!==r||e[41]!==w||e[42]!==J?(U=t.jsx(de,{id:J,value:w,onChange:L,placeholder:"64 hexadecimal characters",pattern:"[a-fA-F0-9]{64}",required:!0,disabled:r}),e[40]=r,e[41]=w,e[42]=J,e[43]=U):U=e[43];let T;e[44]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(Re,{children:"Get this fingerprint from the publisher through a source you trust."}),e[44]=T):T=e[44];let V;e[45]!==_||e[46]!==U?(V=t.jsxs(Q,{children:[_,U,T]}),e[45]=_,e[46]=U,e[47]=V):V=e[47];const f=`${a}-trust`;let $;e[48]!==r||e[49]!==f||e[50]!==c?($=t.jsx(Ie,{id:f,checked:c,onCheckedChange:p,disabled:r}),e[48]=r,e[49]=f,e[50]=c,e[51]=$):$=e[51];const W=`${a}-trust`;let M;e[52]!==W?(M=t.jsx(X,{htmlFor:W,children:"I verified the publisher and trust packages signed by this root."}),e[52]=W,e[53]=M):M=e[53];let Z;e[54]!==$||e[55]!==M?(Z=t.jsxs(Q,{orientation:"horizontal",children:[$,M]}),e[54]=$,e[55]=M,e[56]=Z):Z=e[56];const ae=r||!c||!y;let ie;e[57]!==ae?(ie=t.jsx(E,{type:"submit",disabled:ae,children:"Trust development publisher"}),e[57]=ae,e[58]=ie):ie=e[58];let le;e[59]!==q||e[60]!==K||e[61]!==V||e[62]!==Z||e[63]!==ie||e[64]!==N?(le=t.jsxs(Fe,{children:[N,q,K,V,Z,ie]}),e[59]=q,e[60]=K,e[61]=V,e[62]=Z,e[63]=ie,e[64]=N,e[65]=le):le=e[65];let oe;return e[66]!==m||e[67]!==le?(oe=t.jsx("form",{onSubmit:m,children:le}),e[66]=m,e[67]=le,e[68]=oe):oe=e[68],oe}function Et(l){return l.toString(16).padStart(2,"0")}const Pt={project:null,theme:{mode:"light",tokens:{}},locale:"en",reducedMotion:!0,visible:!1};function Tt({client:l,preview:e,activation:s,key:i,onFrame:r,onComplete:a,onError:n}){const d=new AbortController;let o="loading",v,y=0;const h=()=>new Error("The installation check expired. Review the package again to retry.");function w(m){o==="canceled"||o==="finished"||(o="canceled",clearTimeout(v),d.abort(),r(null),n(m))}function j(){o==="canceled"||o==="finished"||(o="finished",clearTimeout(v),a())}async function c(m){if(o==="committing"){o="recovering",clearTimeout(v);try{const x=await l.transactionOutcome(e);if(o!=="recovering")return;x.status==="committed"?(await l.refresh(),o==="recovering"&&j()):w(m)}catch{o==="recovering"&&w(new Error("The host did not confirm the installation result. Check Installed after reconnecting before trying again."))}}}async function p(){if(o==="trial"){if(Date.now()>y){w(h());return}o="committing";try{await l.commit(e,d.signal),o==="committing"&&j()}catch(m){await c(m instanceof Error?m:new Error("Plugin installation failed"))}}}return s&&(async()=>{try{const m=await l.payload(e.transactionId,d.signal);if(d.signal.aborted||(y=await l.beginTrial(e,d.signal),d.signal.aborted))return;const x=y-Date.now();if(x<=0){w(h());return}o="trial",v=setTimeout(()=>{o==="committing"?(d.abort(),c(h())):o==="trial"&&w(h())},x),r({key:i,client:l,props:{payload:m,digest:e.digest,activationKey:i,context:Pt,active:!1,title:"Plugin installation check",execute:async(g,b)=>{if(d.signal.throwIfAborted(),b.throwIfAborted(),g.method!=="lifecycle.ready")throw new Error("This action is unavailable during installation");return null},onReady:()=>{p()},onError:w}})}catch(m){w(m instanceof Error?m:new Error("Plugin trial failed"))}})(),()=>{o="canceled",clearTimeout(v),d.abort()}}function At(l){const e=ue.c(22),{client:s,preview:i,activation:r,onComplete:a,onError:n}=l,d=`${r}:trial:${i.transactionId}:${i.digest}:${i.registryRevision}`,[o,v]=C.useState(null);let y;e[0]!==a||e[1]!==n?(y={onComplete:a,onError:n},e[0]=a,e[1]=n,e[2]=y):y=e[2];const h=C.useRef(y);let w;e[3]!==a||e[4]!==n?(w=()=>{h.current={onComplete:a,onError:n}},e[3]=a,e[4]=n,e[5]=w):w=e[5],C.useLayoutEffect(w);let j,c;e[6]!==r||e[7]!==s||e[8]!==d||e[9]!==i?(j=()=>Tt({client:s,preview:i,activation:r,key:d,onFrame:v,onComplete:()=>h.current.onComplete(),onError:g=>h.current.onError(g)}),c=[s,i,r,d],e[6]=r,e[7]=s,e[8]=d,e[9]=i,e[10]=j,e[11]=c):(j=e[10],c=e[11]),C.useLayoutEffect(j,c);let p;e[12]!==i.manifest.name?(p=t.jsxs("p",{children:["Checking that ",i.manifest.name," starts correctly…"]}),e[12]=i.manifest.name,e[13]=p):p=e[13];let m;e[14]!==r||e[15]!==s||e[16]!==o||e[17]!==d?(m=r&&(o==null?void 0:o.key)===d&&o.client===s&&t.jsx(et,{...o.props}),e[14]=r,e[15]=s,e[16]=o,e[17]=d,e[18]=m):m=e[18];let x;return e[19]!==p||e[20]!==m?(x=t.jsxs("div",{role:"status",className:"flex flex-col gap-2",children:[p,m]}),e[19]=p,e[20]=m,e[21]=x):x=e[21],x}function Ot({connection:l,resourceId:e,target:s,client:i,disabled:r,save:a}){const n=C.useId(),d=l.definition.resources[e],o=l.selected[e],[v,y]=C.useState(""),[h,w]=C.useState(null),[j,c]=C.useState(!1),[p,m]=C.useState(null),x=C.useRef(null);C.useEffect(()=>()=>{var u;return(u=x.current)==null?void 0:u.abort()},[]);const g=tt(l.definition,e).find(u=>!l.selected[u]),b=r||!!g||d.scope==="project"&&!s.projectId;async function k(){var N;(N=x.current)==null||N.abort();const u=new AbortController;x.current=u,c(!0),m(null);try{const D=await i.connectionOptions(s,l.id,e,u.signal);u.signal.aborted||w(D)}catch(D){u.signal.aborted||m(D instanceof Error?D.message:"Unable to load choices")}finally{u.signal.aborted||c(!1)}}const S=o&&!(h!=null&&h.some(u=>u.id===o.id))?[o,...h??[]]:h??[];return t.jsxs(Q,{"data-disabled":b,"data-invalid":!!p,children:[t.jsx(X,{htmlFor:`${n}-resource`,children:d.label}),t.jsx(Re,{children:d.scope==="project"?"Applies to the selected project.":"Applies to all projects using this connection."}),o&&t.jsxs("p",{className:"text-sm",children:["Selected: ",o.label]}),g&&t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Choose ",l.definition.resources[g].label," first."]}),d.scope==="project"&&!s.projectId&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a Cogpit project above."}),d.options&&t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(E,{type:"button",variant:"outline",size:"sm",disabled:b||j,onClick:()=>{k()},children:j?"Loading choices…":h?"Refresh choices":"Browse choices"}),h&&t.jsxs(Ze,{items:S.map(u=>({value:u.id,label:u.label})),value:(o==null?void 0:o.id)??null,disabled:b||j,onValueChange:u=>{u&&u!==(o==null?void 0:o.id)&&a(l.id,"select",{resourceId:e,value:u})},children:[t.jsx(Ye,{id:`${n}-resource`,"aria-invalid":!!p,children:t.jsx(We,{placeholder:`Choose ${d.label}`})}),t.jsx(Ge,{children:t.jsx(Ke,{children:S.map(u=>t.jsx(Je,{value:u.id,children:u.label},u.id))})})]}),(h==null?void 0:h.length)===0&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"No choices were returned."})]}),d.input&&t.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:u=>{u.preventDefault(),a(l.id,"select",{resourceId:e,value:v.trim()})},children:[t.jsx(de,{id:d.options?`${n}-input`:`${n}-resource`,"aria-label":`${d.label} ${d.input.urls?"URL or ID":"ID"}`,value:v,onChange:u=>y(u.target.value),maxLength:2048,disabled:b,autoComplete:"off",spellCheck:!1,placeholder:d.input.urls?"Paste a URL or ID":"Enter an ID"}),t.jsx(E,{type:"submit",size:"sm",variant:"outline",disabled:b||!v.trim(),children:"Validate and select"})]}),o&&t.jsxs(E,{type:"button",size:"sm",variant:"ghost",disabled:b,onClick:()=>{a(l.id,"select",{resourceId:e,value:null})},children:["Clear ",d.label]}),p&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:p})]})}function Ft(l){const e=ue.c(45),{connection:s,target:i,client:r,disabled:a,save:n}=l,d=C.useId(),[o,v]=C.useState(""),[y,h]=C.useState(!1),w=s.label;let j;e[0]!==s.label?(j=t.jsx("h3",{className:"font-medium",children:s.label}),e[0]=s.label,e[1]=j):j=e[1];const c=s.status==="disconnected"?"Needs connection":s.readOnly?"Configured by host":"Connected";let p;e[2]!==c?(p=t.jsx($e,{variant:"outline",children:c}),e[2]=c,e[3]=p):p=e[3];let m;e[4]!==j||e[5]!==p?(m=t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[j,p]}),e[4]=j,e[5]=p,e[6]=m):m=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Cogpit keeps this credential on the selected host. Plugin code cannot read it."}),e[7]=x):x=e[7];let g;e[8]!==s.definition.operations?(g=new Set(Object.values(s.definition.operations).map(_t)),e[8]=s.definition.operations,e[9]=g):g=e[9];let b;e[10]!==g?(b=[...g],e[10]=g,e[11]=b):b=e[11];const k=b.join(", ");let S;e[12]!==k?(S=t.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:["Credential destinations: ",k]}),e[12]=k,e[13]=S):S=e[13];let u;e[14]!==s.id||e[15]!==s.legacyImportAvailable||e[16]!==s.readOnly||e[17]!==s.status||e[18]!==a||e[19]!==d||e[20]!==y||e[21]!==n?(u=s.legacyImportAvailable&&t.jsxs("div",{className:"flex flex-col gap-3 rounded-md bg-muted p-3",children:[t.jsx("p",{className:"text-sm",children:"An existing host connection has saved settings available to import."}),s.status==="connected"&&!s.readOnly&&t.jsxs(Q,{orientation:"horizontal",children:[t.jsx(Ie,{id:`${d}-replace`,checked:y,onCheckedChange:h,disabled:a}),t.jsx(X,{htmlFor:`${d}-replace`,children:"Allow replacing my current connection with these saved settings"})]}),t.jsx(E,{type:"button",size:"sm",variant:"outline",disabled:a,onClick:()=>{n(s.id,"import-legacy",{replaceExisting:y})},children:"Import saved host settings"})]}),e[14]=s.id,e[15]=s.legacyImportAvailable,e[16]=s.readOnly,e[17]=s.status,e[18]=a,e[19]=d,e[20]=y,e[21]=n,e[22]=u):u=e[22];let N;e[23]!==s.definition.secret||e[24]!==s.id||e[25]!==s.readOnly||e[26]!==s.status||e[27]!==a||e[28]!==d||e[29]!==n||e[30]!==o?(N=s.readOnly?t.jsx("p",{className:"text-sm",children:"The host environment supplies this credential. Change it on the host."}):t.jsx("form",{onSubmit:A=>{A.preventDefault();const O=o.trim();v(""),n(s.id,"credential",{secret:O})},children:t.jsxs(Fe,{children:[t.jsxs(Q,{"data-disabled":a,children:[t.jsx(X,{htmlFor:`${d}-secret`,children:s.definition.secret.label}),t.jsx(de,{id:`${d}-secret`,type:"password",autoComplete:"off",spellCheck:!1,maxLength:4096,disabled:a,value:o,onChange:A=>v(A.target.value)})]}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(E,{type:"submit",size:"sm",disabled:a||!o.trim(),children:s.status==="disconnected"?"Validate and connect":"Replace credential"}),s.status!=="disconnected"&&t.jsx(E,{type:"button",size:"sm",variant:"outline",disabled:a,onClick:()=>{n(s.id,"disconnect",{})},children:"Disconnect"})]})]})}),e[23]=s.definition.secret,e[24]=s.id,e[25]=s.readOnly,e[26]=s.status,e[27]=a,e[28]=d,e[29]=n,e[30]=o,e[31]=N):N=e[31];let D;e[32]!==r||e[33]!==s||e[34]!==a||e[35]!==n||e[36]!==i?(D=s.status!=="disconnected"&&t.jsx(Fe,{children:Object.keys(s.definition.resources).map(A=>t.jsx(Ot,{connection:s,resourceId:A,target:i,client:r,disabled:a,save:n},A))}),e[32]=r,e[33]=s,e[34]=a,e[35]=n,e[36]=i,e[37]=D):D=e[37];let R;return e[38]!==s.label||e[39]!==S||e[40]!==u||e[41]!==N||e[42]!==D||e[43]!==m?(R=t.jsxs("section",{className:"flex flex-col gap-4 rounded-lg border p-4","aria-label":w,children:[m,x,S,u,N,D]}),e[38]=s.label,e[39]=S,e[40]=u,e[41]=N,e[42]=D,e[43]=m,e[44]=R):R=e[44],R}function _t(l){return l.origin}function zt({client:l,target:e}){const[s,i]=C.useState(null),[r,a]=C.useState(null),[n,d]=C.useState(!1),o=C.useRef(null),v=C.useRef(!1),y=e.pluginId,h=e.projectId;C.useEffect(()=>{const j=new AbortController;return o.current=j,l.connections({pluginId:y,projectId:h},j.signal).then(c=>{j.signal.aborted||i(c)}).catch(c=>{j.signal.aborted||a(c instanceof Error?c.message:"Unable to load connections")}),()=>{j.abort(),o.current=null}},[l,y,h]);async function w(j,c,p){if(!s||v.current||!o.current||o.current.signal.aborted)return;v.current=!0;const m=o.current.signal;d(!0),a(null);try{const x=await l.changeConnection(e,j,c,p,s.revision,m);m.aborted||i(x)}catch(x){m.aborted||a(x instanceof Error?x.message:"Connection change failed")}finally{v.current=!1,m.aborted||d(!1)}}return t.jsxs("div",{className:"flex flex-col gap-4",children:[r&&t.jsx(se,{variant:"destructive",children:t.jsx(ne,{children:r})}),!s&&!r&&t.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading connections…"}),s==null?void 0:s.connections.map(j=>t.jsx(Ft,{connection:j,target:e,client:l,disabled:n,save:w},`${j.id}:${s.revision}`)),(s==null?void 0:s.connections.length)===0&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"This plugin does not use provider connections."})]})}function Lt(l){const e=ue.c(32),{client:s,status:i,pluginId:r,initialProjectId:a}=l,[n,d]=C.useState(a),o=C.useId();let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={value:"",label:"Host connections only"},e[0]=v):v=e[0];let y;e[1]!==i.projects?(y=[v,...i.projects.map(qt)],e[1]=i.projects,e[2]=y):y=e[2];const h=y;let w;e[3]!==o?(w=t.jsx(X,{htmlFor:o,children:"Project settings"}),e[3]=o,e[4]=w):w=e[4];const j=n??"";let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=R=>d(R||null),e[5]=c):c=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(We,{}),e[6]=p):p=e[6];let m;e[7]!==o?(m=t.jsx(Ye,{id:o,children:p}),e[7]=o,e[8]=m):m=e[8];let x;e[9]!==h?(x=t.jsx(Ge,{children:t.jsx(Ke,{children:h.map(Vt)})}),e[9]=h,e[10]=x):x=e[10];let g;e[11]!==h||e[12]!==j||e[13]!==m||e[14]!==x?(g=t.jsxs(Ze,{items:h,value:j,onValueChange:c,children:[m,x]}),e[11]=h,e[12]=j,e[13]=m,e[14]=x,e[15]=g):g=e[15];let b;e[16]!==i.host.name?(b=t.jsxs(Re,{children:["Connection credentials belong to ",i.host.name,". Project resources stay within the project you choose."]}),e[16]=i.host.name,e[17]=b):b=e[17];let k;e[18]!==b||e[19]!==w||e[20]!==g?(k=t.jsxs(Q,{children:[w,g,b]}),e[18]=b,e[19]=w,e[20]=g,e[21]=k):k=e[21];const S=`${r}:${n??"host"}:${i.connectionRevision??0}`;let u;e[22]!==r||e[23]!==n?(u={pluginId:r,projectId:n},e[22]=r,e[23]=n,e[24]=u):u=e[24];let N;e[25]!==s||e[26]!==S||e[27]!==u?(N=t.jsx(zt,{client:s,target:u},S),e[25]=s,e[26]=S,e[27]=u,e[28]=N):N=e[28];let D;return e[29]!==k||e[30]!==N?(D=t.jsxs("div",{className:"flex flex-col gap-4",children:[k,N]}),e[29]=k,e[30]=N,e[31]=D):D=e[31],D}function Vt(l){return t.jsx(Je,{value:l.value,children:l.label},l.value)}function qt(l){return{value:l.id,label:l.name}}function Ut(l){var ie;const e=ue.c(174),{plugin:s,status:i,client:r,busy:a,run:n,onPreview:d,onConnections:o,onUpdate:v}=l,y=C.useId(),[h,w]=C.useState(s.scope),[j,c]=C.useState(!1),[p,m]=C.useState(!1);let x,g,b,k,S,u,N,D,R,A,O,I;if(e[0]!==a||e[1]!==r||e[2]!==o||e[3]!==d||e[4]!==v||e[5]!==s||e[6]!==n||e[7]!==h||e[8]!==i.host.name||e[9]!==i.projects||e[10]!==i.runtime||e[11]!==i.store){const le=st(),oe=Me(s.manifest,le,i.runtime,{allowPrerelease:s.manifest.publisher.startsWith("dev-")});let Y;e[24]!==r||e[25]!==s.id||e[26]!==n||e[27]!==i.store?(Y=(P,Te)=>n(()=>r.changeInstalled(s.id,P,Te,i.store.revision)),e[24]=r,e[25]=s.id,e[26]=n,e[27]=i.store,e[28]=Y):Y=e[28];const B=Y,re=s.lastError?"Needs recovery":oe.compatible?s.enabled?"Enabled":"Disabled":"Incompatible";let ce;e[29]!==s.id||e[30]!==s.lastError||e[31]!==s.selectedDigest||e[32]!==i.store?(ce=s.lastError&&((ie=i.store.availableSeeds)==null?void 0:ie.find(P=>P.manifest.id===s.id&&P.digest===s.selectedDigest)),e[29]=s.id,e[30]=s.lastError,e[31]=s.selectedDigest,e[32]=i.store,e[33]=ce):ce=e[33];const _e=ce;A="flex flex-col gap-3 rounded-lg border p-4";let fe;e[34]!==s.manifest.name?(fe=t.jsx("h3",{className:"font-medium",children:s.manifest.name}),e[34]=s.manifest.name,e[35]=fe):fe=e[35];let he;e[36]!==s.id||e[37]!==s.manifest.version?(he=t.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:[s.id," · ",s.manifest.version]}),e[36]=s.id,e[37]=s.manifest.version,e[38]=he):he=e[38];let me;e[39]!==fe||e[40]!==he?(me=t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[fe,he]}),e[39]=fe,e[40]=he,e[41]=me):me=e[41];const ze=re==="Enabled"?"secondary":"outline";let pe;e[42]!==re||e[43]!==ze?(pe=t.jsx($e,{variant:ze,children:re}),e[42]=re,e[43]=ze,e[44]=pe):pe=e[44],e[45]!==me||e[46]!==pe?(O=t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[me,pe]}),e[45]=me,e[46]=pe,e[47]=O):O=e[47],e[48]!==s.lastError?(I=s.lastError&&t.jsx(se,{variant:"destructive",children:t.jsx(ne,{children:s.lastError})}),e[48]=s.lastError,e[49]=I):I=e[49],g=!oe.compatible&&t.jsx(se,{variant:"destructive",children:t.jsxs(ne,{children:[oe.issues.map(P=>t.jsxs("p",{children:[P.side==="client"?"This client":P.side==="host"?i.host.name:"This package",": ",P.name," requires ",P.required,"; available ",P.actual??"none","."]},`${P.side}:${P.code}:${P.name}`)),t.jsx("p",{children:"Keep the saved data and update the affected app, or choose a compatible retained version below."})]})});let xe;e[50]!==B||e[51]!==s.enabled?(xe=()=>B("enabled",{enabled:!s.enabled}),e[50]=B,e[51]=s.enabled,e[52]=xe):xe=e[52];const Le=s.enabled?"Disable":"Enable";let ge;e[53]!==a||e[54]!==xe||e[55]!==Le?(ge=t.jsx(E,{size:"sm",variant:"outline",disabled:a,onClick:xe,children:Le}),e[53]=a,e[54]=xe,e[55]=Le,e[56]=ge):ge=e[56];let je;e[57]!==a||e[58]!==o||e[59]!==s.id||e[60]!==s.manifest.permissions.connections.length?(je=s.manifest.permissions.connections.length>0&&t.jsx(E,{size:"sm",variant:"outline",disabled:a,onClick:()=>o(s.id),children:"Connections"}),e[57]=a,e[58]=o,e[59]=s.id,e[60]=s.manifest.permissions.connections.length,e[61]=je):je=e[61];const Ve=a||s.pinned;let be;e[62]!==v||e[63]!==s?(be=()=>v(s),e[62]=v,e[63]=s,e[64]=be):be=e[64];let ve;e[65]!==Ve||e[66]!==be?(ve=t.jsx(E,{size:"sm",variant:"outline",disabled:Ve,onClick:be,children:"Update from file"}),e[65]=Ve,e[66]=be,e[67]=ve):ve=e[67];let ye;e[68]!==a||e[69]!==r||e[70]!==d||e[71]!==s.id||e[72]!==s.scope||e[73]!==_e||e[74]!==n?(ye=_e&&t.jsx(E,{size:"sm",variant:"outline",disabled:a,onClick:()=>n(async()=>d(await r.stageSeed(s.id,s.scope))),children:"Review bundled repair"}),e[68]=a,e[69]=r,e[70]=d,e[71]=s.id,e[72]=s.scope,e[73]=_e,e[74]=n,e[75]=ye):ye=e[75];let Ce;e[76]!==B||e[77]!==s.pinned?(Ce=()=>B("pin",{pinned:!s.pinned}),e[76]=B,e[77]=s.pinned,e[78]=Ce):Ce=e[78];const qe=s.pinned?"Unpin version":"Pin version";let we;e[79]!==a||e[80]!==Ce||e[81]!==qe?(we=t.jsx(E,{size:"sm",variant:"outline",disabled:a,onClick:Ce,children:qe}),e[79]=a,e[80]=Ce,e[81]=qe,e[82]=we):we=e[82];let Ee;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ee=()=>{m(!1),c(!0)},e[83]=Ee):Ee=e[83];let Ne;e[84]!==a?(Ne=t.jsx(E,{size:"sm",variant:"ghost",disabled:a,onClick:Ee,children:"Uninstall"}),e[84]=a,e[85]=Ne):Ne=e[85],e[86]!==ge||e[87]!==je||e[88]!==ve||e[89]!==ye||e[90]!==we||e[91]!==Ne?(b=t.jsxs("div",{className:"flex flex-wrap gap-2",children:[ge,je,ve,ye,we,Ne]}),e[86]=ge,e[87]=je,e[88]=ve,e[89]=ye,e[90]=we,e[91]=Ne,e[92]=b):b=e[92],e[93]!==s.pinned?(k=s.pinned&&t.jsx("p",{className:"text-xs text-muted-foreground",children:"Unpin this version before updating or rolling back. Revoked packages remain blocked."}),e[93]=s.pinned,e[94]=k):k=e[94],D="text-sm",e[95]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("summary",{className:"cursor-pointer",children:"Projects and previous versions"}),e[95]=R):R=e[95],x="flex flex-col gap-4 pt-4",e[96]!==a||e[97]!==h||e[98]!==i.projects?(S=t.jsx(Ue,{value:h,onChange:w,projects:i.projects,disabled:a}),e[96]=a,e[97]=h,e[98]=i.projects,e[99]=S):S=e[99];let Se;e[100]!==a||e[101]!==s.scope||e[102]!==h?(Se=a||JSON.stringify(h)===JSON.stringify(s.scope),e[100]=a,e[101]=s.scope,e[102]=h,e[103]=Se):Se=e[103];let ke;e[104]!==B||e[105]!==h?(ke=()=>B("scope",{scope:h}),e[104]=B,e[105]=h,e[106]=ke):ke=e[106],e[107]!==i.host.name||e[108]!==Se||e[109]!==ke?(u=t.jsxs(E,{size:"sm",variant:"outline",disabled:Se,onClick:ke,children:["Save projects on ",i.host.name]}),e[107]=i.host.name,e[108]=Se,e[109]=ke,e[110]=u):u=e[110];let Pe;e[111]!==s.selectedDigest?(Pe=P=>P.digest!==s.selectedDigest,e[111]=s.selectedDigest,e[112]=Pe):Pe=e[112],N=s.versions.filter(Pe).map(P=>{const Te=!P.unavailableReason&&Me(P.manifest,le,i.runtime,{allowPrerelease:P.manifest.publisher.startsWith("dev-")}).compatible;return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs(E,{size:"sm",variant:"outline",disabled:a||s.pinned||!Te,onClick:()=>n(async()=>d({...await r.rollback(s.id,P.digest,s.scope),operation:"rollback"})),children:["Review rollback to ",P.manifest.version]}),!Te&&t.jsx("p",{className:"text-xs text-muted-foreground",children:P.unavailableReason??"This version is incompatible with the connected host or client."})]},P.digest)}),e[0]=a,e[1]=r,e[2]=o,e[3]=d,e[4]=v,e[5]=s,e[6]=n,e[7]=h,e[8]=i.host.name,e[9]=i.projects,e[10]=i.runtime,e[11]=i.store,e[12]=x,e[13]=g,e[14]=b,e[15]=k,e[16]=S,e[17]=u,e[18]=N,e[19]=D,e[20]=R,e[21]=A,e[22]=O,e[23]=I}else x=e[12],g=e[13],b=e[14],k=e[15],S=e[16],u=e[17],N=e[18],D=e[19],R=e[20],A=e[21],O=e[22],I=e[23];let q;e[113]===Symbol.for("react.memo_cache_sentinel")?(q=t.jsx("p",{className:"text-xs text-muted-foreground",children:"Rollback keeps current settings. Disabling keeps the installation and its saved data."}),e[113]=q):q=e[113];let H;e[114]!==x||e[115]!==S||e[116]!==u||e[117]!==N?(H=t.jsxs("div",{className:x,children:[S,u,N,q]}),e[114]=x,e[115]=S,e[116]=u,e[117]=N,e[118]=H):H=e[118];let z;e[119]!==H||e[120]!==D||e[121]!==R?(z=t.jsxs("details",{className:D,children:[R,H]}),e[119]=H,e[120]=D,e[121]=R,e[122]=z):z=e[122];let ee;e[123]!==s.manifest.name?(ee=t.jsxs(nt,{children:["Uninstall ",s.manifest.name,"?"]}),e[123]=s.manifest.name,e[124]=ee):ee=e[124];let G;e[125]!==i.host.name?(G=t.jsxs(it,{children:["This removes the plugin from ",i.host.name," for every connected client and project. Saved data is retained unless you choose deletion."]}),e[125]=i.host.name,e[126]=G):G=e[126];let F;e[127]!==ee||e[128]!==G?(F=t.jsxs(at,{children:[ee,G]}),e[127]=ee,e[128]=G,e[129]=F):F=e[129];const K=`${y}-delete`,te=a||i.connectionRevision===void 0;let _;e[130]!==p||e[131]!==K||e[132]!==te?(_=t.jsx(Ie,{id:K,checked:p,onCheckedChange:m,disabled:te}),e[130]=p,e[131]=K,e[132]=te,e[133]=_):_=e[133];const J=`${y}-delete`;let L;e[134]!==J?(L=t.jsx(X,{htmlFor:J,children:"Delete my saved settings and connections on this host"}),e[134]=J,e[135]=L):L=e[135];let U;e[136]!==_||e[137]!==L?(U=t.jsxs(Q,{orientation:"horizontal",children:[_,L]}),e[136]=_,e[137]=L,e[138]=U):U=e[138];let T;e[139]!==p?(T=p&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"This cannot be undone. Other administrators' saved data is retained. Provider tokens and legacy backup files are not removed."}),e[139]=p,e[140]=T):T=e[140];let V;e[141]!==a?(V=t.jsx(ot,{disabled:a,children:"Cancel"}),e[141]=a,e[142]=V):V=e[142];let f;e[143]!==r||e[144]!==p||e[145]!==s.id||e[146]!==n||e[147]!==i.connectionRevision||e[148]!==i.store?(f=()=>{c(!1),n(()=>r.changeInstalled(s.id,"uninstall",p?{deleteData:!0,expectedConnectionRevision:i.connectionRevision}:{deleteData:!1},i.store.revision))},e[143]=r,e[144]=p,e[145]=s.id,e[146]=n,e[147]=i.connectionRevision,e[148]=i.store,e[149]=f):f=e[149];let $;e[150]!==a||e[151]!==i.host.name||e[152]!==f?($=t.jsxs(lt,{variant:"destructive",disabled:a,onClick:f,children:["Uninstall from ",i.host.name]}),e[150]=a,e[151]=i.host.name,e[152]=f,e[153]=$):$=e[153];let W;e[154]!==V||e[155]!==$?(W=t.jsxs(rt,{children:[V,$]}),e[154]=V,e[155]=$,e[156]=W):W=e[156];let M;e[157]!==F||e[158]!==U||e[159]!==T||e[160]!==W?(M=t.jsxs(ct,{children:[F,U,T,W]}),e[157]=F,e[158]=U,e[159]=T,e[160]=W,e[161]=M):M=e[161];let Z;e[162]!==j||e[163]!==M?(Z=t.jsx(dt,{open:j,onOpenChange:c,children:M}),e[162]=j,e[163]=M,e[164]=Z):Z=e[164];let ae;return e[165]!==g||e[166]!==b||e[167]!==k||e[168]!==z||e[169]!==Z||e[170]!==A||e[171]!==O||e[172]!==I?(ae=t.jsxs("article",{className:A,children:[O,I,g,b,k,z,Z]}),e[165]=g,e[166]=b,e[167]=k,e[168]=z,e[169]=Z,e[170]=A,e[171]=O,e[172]=I,e[173]=ae):ae=e[173],ae}const Mt={github:"GitHub",vercel:"Vercel",cloudflare:"Cloudflare"},Bt={actions:"workflow runs",actionJobs:"workflow jobs and steps",pulls:"pull requests",pullFiles:"pull request files",issues:"issues",deployments:"deployments",buildLogs:"build logs",workspace:"Worker configuration and account",version:"version details"};function Ht(l,e){return e==="pullSessions"?"Read related Cogpit sessions for the selected GitHub repository":e==="mergePull"?"Merge pull requests in the selected GitHub repository when you confirm, using this host's signed-in CLI":`Read ${Mt[l]} ${Bt[e]} using this host's signed-in CLI`}function He(l){const e=l.permissions;return[...e.context.map(s=>s==="session.identity"?"Recognise the open session among related sessions, by handle only":"Read the selected project's name and plugin identifier"),...e.composer.map(()=>"Append text to your draft message"),...e.navigation.map(s=>s==="external"?"Ask Cogpit to open HTTPS links":"Open permitted sessions"),...e.storage?[`Store up to ${e.storage.quotaKiB} KiB of ${e.storage.scope} settings`]:[],...e.connections.flatMap(s=>s.operations.map(i=>`Use connection ${s.id}: ${i}`)),...e.integrations.flatMap(s=>s.operations.map(i=>Ht(s.id,i)))]}function Gt(l){var j;const e=ue.c(32),{preview:s}=l;let i,r,a,n,d,o;if(e[0]!==s.connectionDefinitions||e[1]!==s.manifest||e[2]!==s.oldVersion||e[3]!==s.operation||e[4]!==s.previousConnectionDefinitions||e[5]!==s.previousManifest){const c=He(s.manifest),p=s.previousManifest?He(s.previousManifest):null,m=p?c.filter(b=>!p.includes(b)):[],x=p?p.filter(b=>!c.includes(b)):[],g=s.previousConnectionDefinitions?s.connectionDefinitions.filter(b=>{var S;const k=(S=s.previousConnectionDefinitions)==null?void 0:S.find(u=>u.id===b.id);return!k||JSON.stringify(k)!==JSON.stringify(b)}):[];i="flex flex-col gap-3 text-sm",e[12]!==s.oldVersion||e[13]!==s.operation?(r=s.oldVersion&&t.jsxs(se,{children:[t.jsx(De,{children:s.operation==="rollback"?"Rollback keeps current settings":"Update on this host"}),t.jsxs(ne,{children:["Saved settings and connections are retained. This version replaces ",s.oldVersion," in every enabled project and connected client. A failed trial leaves the current version selected."]})]}),e[12]=s.oldVersion,e[13]=s.operation,e[14]=r):r=e[14],a=p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"font-medium",children:"Access changes"}),m.length===0&&x.length===0&&g.length===0&&t.jsx("p",{children:"No changes to requested access or connection definitions."}),m.map(Xt),x.map(Qt),g.map(Zt)]}),n=s.oldVersion&&!p&&t.jsx(se,{children:t.jsx(ne,{children:"This host does not report previous permissions. Review all requested access before continuing."})}),e[15]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("h3",{className:"font-medium",children:"Requested access"}),e[15]=d):d=e[15],o=c.length?t.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:c.map(Yt)}):t.jsx("p",{className:"text-muted-foreground",children:"No project, connection, storage, or composer access requested."}),e[0]=s.connectionDefinitions,e[1]=s.manifest,e[2]=s.oldVersion,e[3]=s.operation,e[4]=s.previousConnectionDefinitions,e[5]=s.previousManifest,e[6]=i,e[7]=r,e[8]=a,e[9]=n,e[10]=d,e[11]=o}else i=e[6],r=e[7],a=e[8],n=e[9],d=e[10],o=e[11];let v;e[16]!==s.connectionDefinitions?(v=s.connectionDefinitions.map(Kt),e[16]=s.connectionDefinitions,e[17]=v):v=e[17];let y;e[18]!==s.incompatibleClients?(y=!!((j=s.incompatibleClients)!=null&&j.length)&&t.jsxs(se,{children:[t.jsx(De,{children:"Some connected clients cannot run this version"}),t.jsxs(ne,{children:[s.incompatibleClients.join(", "),". Their plugin panels will be unavailable until those clients are updated. Offline clients are checked when they reconnect."]})]}),e[18]=s.incompatibleClients,e[19]=y):y=e[19];let h;e[20]!==s.digest?(h=t.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:["SHA-256: ",s.digest]}),e[20]=s.digest,e[21]=h):h=e[21];let w;return e[22]!==i||e[23]!==r||e[24]!==a||e[25]!==n||e[26]!==d||e[27]!==o||e[28]!==v||e[29]!==y||e[30]!==h?(w=t.jsxs("div",{className:i,children:[r,a,n,d,o,v,y,h]}),e[22]=i,e[23]=r,e[24]=a,e[25]=n,e[26]=d,e[27]=o,e[28]=v,e[29]=y,e[30]=h,e[31]=w):w=e[31],w}function Kt(l){return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("p",{className:"font-medium",children:l.label}),t.jsxs("p",{children:["Access to ",Object.values(l.resources).map(Wt).join(", ")||"the connected account","."]}),t.jsxs("p",{className:"break-all text-muted-foreground",children:["Credential destinations: ",[...new Set(Object.values(l.operations).map(Jt))].join(", ")]})]},l.id)}function Jt(l){return l.origin}function Wt(l){return l.label}function Yt(l){return t.jsx("li",{children:l},l)}function Zt(l){return t.jsxs("p",{children:["Changed connection: ",l.label,". Review its destinations and access below."]},l.id)}function Qt(l){return t.jsxs("p",{children:["Removed: ",l]},`remove:${l}`)}function Xt(l){return t.jsxs("p",{children:["Added: ",l]},`add:${l}`)}function ls({client:l,state:e,currentPath:s,onClose:i,initialPluginId:r}){var V;const a=C.useId(),n=e.status,d=ut(),o=(n==null?void 0:n.safeMode)||d,{project:v,resolving:y}=ft({client:l,status:n,activation:e.activation,projectPath:s}),[h,w]=C.useState(null),j=h??{type:"projects",projectIds:v?[v.id]:[]},[c,p]=C.useState(null),[m,x]=C.useState({activation:"",hostName:""}),[g,b]=C.useState(!1),[k,S]=C.useState(!1),[u,N]=C.useState(null),[D,R]=C.useState(null),[A,O]=C.useState("installed"),[I,q]=C.useState(null),[H,z]=C.useState(null),[ee,G]=C.useState(r),F=n==null?void 0:n.store.plugins.find(f=>f.id===ee),K=C.useRef(!1),te=!!(n!=null&&n.store.available)&&m.activation===e.activation;function _(f){x({activation:e.activation,hostName:(n==null?void 0:n.host.name)??"the selected host"}),p(f)}C.useEffect(()=>{!c||te&&!(o&&g)||(b(!1),p(null),N("The host connection or plugin execution state changed. Review the package again before installing."),l.cancel(c).catch(()=>{}))},[l,c,te,o,g]),C.useEffect(()=>()=>{c&&l.cancel(c).catch(()=>{})},[l,c]);async function J(f){if(!K.current){K.current=!0,S(!0),N(null),R(null);try{await f()}catch($){N($ instanceof Error?$.message:"Plugin action failed")}finally{K.current=!1,S(!1)}}}function L(){const f=c;b(!1),p(null),f&&l.cancel(f).catch(()=>{})}async function U(){if(!H||!I&&!h&&y)return;const f=await l.stage(H,(I==null?void 0:I.scope)??j);if(I&&f.manifest.id!==I.id)throw await l.cancel(f),new Error(`Choose a package for ${I.manifest.name} (${I.id}).`);_(f)}const T=k||g||!(n!=null&&n.store.available);return t.jsx(ht,{open:!0,onOpenChange:f=>{!f&&!k&&!g&&(L(),i())},children:t.jsxs(mt,{className:"flex max-h-[85dvh] flex-col sm:max-w-2xl",showCloseButton:!k&&!g,children:[t.jsxs(pt,{children:[t.jsx(xt,{children:"Plugins"}),t.jsx(gt,{children:n?`Installed on ${n.host.name}. Changes apply to every client connected to this host.`:"Connecting to the selected host…"})]}),t.jsxs("div",{className:"flex min-h-0 flex-col gap-4 overflow-y-auto",children:[(e.error||u||(n==null?void 0:n.store.error))&&t.jsxs(se,{variant:"destructive",children:[t.jsx(De,{children:n!=null&&n.store.available&&!u&&!e.error?"Plugin setup needs attention":"Plugin action unavailable"}),t.jsx(ne,{children:u??e.error??(n==null?void 0:n.store.error)})]}),D&&t.jsx(se,{children:t.jsx(ne,{children:D})}),o&&t.jsxs(se,{children:[t.jsx(De,{children:"Plugin safe mode"}),t.jsxs(ne,{children:["Plugin panels are stopped. You can disable or uninstall plugins here.",(n==null?void 0:n.safeMode)&&" The host owner must restart Cogpit without COGPIT_DISABLE_PLUGINS=1 to resume plugins on this host."]})]}),t.jsx(E,{size:"sm",variant:"outline",disabled:k||g||(n==null?void 0:n.safeMode),onClick:()=>jt(!d),children:d?"Resume plugins in this browser":"Pause plugins in this browser"}),(n==null?void 0:n.store.recoveryCode)&&t.jsx("p",{className:"text-sm text-muted-foreground",children:n.store.recoveryCode==="STORE_LOCKED"?"Close the other Cogpit process using this data directory, then restart this host.":n.store.recoveryCode==="STORE_VERSION"?"Open this host with the Cogpit version that last used its plugin store, or a newer compatible version.":"Keep the plugin data directory intact. Restart with plugin safe mode enabled and check the host log before restoring a verified backup."}),!n&&t.jsxs(E,{variant:"outline",disabled:k,onClick:()=>{J(()=>l.refresh())},children:[t.jsx(kt,{"data-icon":"inline-start"}),"Retry connection"]}),n&&F&&!c&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("h2",{className:"font-medium",children:[F.manifest.name," connections"]}),t.jsx(E,{variant:"outline",size:"sm",onClick:()=>G(void 0),children:"Back to installed"})]}),t.jsx(Lt,{client:l,status:n,pluginId:F.id,initialProjectId:(v==null?void 0:v.id)??null},`${F.id}:${n.store.revision}`)]}),n&&!F&&!c&&t.jsxs(bt,{value:A,onValueChange:f=>{O(String(f)),q(null),z(null)},children:[t.jsxs(vt,{className:"h-auto flex-wrap",children:[t.jsx(Ae,{value:"installed",children:"Installed"}),t.jsx(Ae,{value:"browse",children:"Browse"}),t.jsx(Ae,{value:"install",children:"Install from file"}),t.jsx(Ae,{value:"publishers",children:"Publishers"})]}),t.jsx(Oe,{value:"installed",children:t.jsx("div",{className:"flex flex-col gap-3 pt-4",children:n.store.plugins.length?n.store.plugins.map(f=>t.jsx(Ut,{plugin:f,status:n,client:l,busy:T,run:$=>{J($)},onPreview:_,onConnections:G,onUpdate:$=>{q($),z(null),O("install")}},`${f.id}:${n.store.revision}`)):t.jsx(yt,{children:t.jsxs(Ct,{children:[t.jsx(wt,{variant:"icon",children:t.jsx($t,{})}),t.jsx(Nt,{children:"No installed plugins"}),t.jsx(St,{children:"Browse available plugins or install a signed package to add panels to this host."})]})})})}),t.jsx(Oe,{value:"browse",children:t.jsxs("div",{className:"flex flex-col gap-4 pt-4",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["These optional plugins are available with this Cogpit release. Choose which ones to install on ",n.host.name,"."]}),t.jsx(Ue,{value:j,onChange:w,projects:n.projects,disabled:T}),(n.store.availableSeeds??[]).map(f=>{const $=n.store.plugins.find(M=>M.id===f.manifest.id),W=$&&It(f.manifest.version,$.manifest.version)===1;return t.jsxs("article",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border p-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium",children:f.manifest.name}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.manifest.version," · ",f.manifest.publisher]})]}),W?t.jsx(E,{size:"sm",disabled:T||$.pinned,onClick:()=>{J(async()=>_(await l.stageSeed(f.manifest.id,$.scope)))},children:$.pinned?"Pinned to installed version":"Review update"}):$?t.jsx($e,{variant:"outline",children:"Installed"}):t.jsx(E,{size:"sm",disabled:T||!h&&y,onClick:()=>{J(async()=>_(await l.stageSeed(f.manifest.id,j)))},children:"Review installation"})]},f.manifest.id)}),!((V=n.store.availableSeeds)!=null&&V.length)&&t.jsx("p",{className:"text-sm text-muted-foreground",children:"This host has no bundled plugin packages. You can install a signed package from a file."})]})}),t.jsx(Oe,{value:"install",children:t.jsx("form",{className:"pt-4",onSubmit:f=>{f.preventDefault(),J(U)},children:t.jsxs(Fe,{children:[I&&t.jsxs("p",{className:"text-sm",children:["Update ",I.manifest.name," from ",I.manifest.version,". Existing project access is retained."]}),t.jsxs(Q,{children:[t.jsx(X,{htmlFor:`${a}-package`,children:"Signed plugin package"}),t.jsx(de,{id:`${a}-package`,type:"file",accept:".cogpit-plugin",disabled:T,required:!0,onChange:f=>{var $;return z((($=f.target.files)==null?void 0:$[0])??null)}})]}),!I&&t.jsx(Ue,{value:j,onChange:w,projects:n.projects,disabled:T}),t.jsxs(E,{type:"submit",disabled:T||!H||!I&&!h&&y,children:["Review ",I?"update":"installation"," on ",n.host.name]})]})})}),t.jsx(Oe,{value:"publishers",children:t.jsxs("div",{className:"flex flex-col gap-4 pt-4",children:[n.store.publishers.map(f=>t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("p",{className:"text-sm font-medium",children:[f.label," ",t.jsx($e,{variant:"outline",children:f.kind})]}),t.jsxs("p",{className:"break-all text-xs text-muted-foreground",children:[f.id," · ",f.fingerprint]})]},f.id)),t.jsxs("details",{children:[t.jsx("summary",{className:"cursor-pointer text-sm",children:"Trust a development publisher"}),t.jsx("div",{className:"pt-4",children:t.jsx(Rt,{client:l,busy:T,run:f=>{J(f)}})})]})]})})]}),c&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("h2",{className:"text-lg font-medium",children:[c.manifest.name," ",c.manifest.version]}),t.jsxs("p",{className:"text-sm text-muted-foreground",children:[c.oldVersion?`Replaces ${c.oldVersion}`:"New installation"," on ",m.hostName]}),t.jsx($e,{variant:"outline",children:c.publisherKind==="development"?"Development publisher":"Official publisher"})]}),t.jsx(Gt,{preview:c}),t.jsxs("p",{className:"text-sm",children:["Available in: ",c.scope.type==="all"?"all projects on this host, including new projects":c.scope.projectIds.length?c.scope.projectIds.map(f=>{var $;return(($=n==null?void 0:n.projects.find(W=>W.id===f))==null?void 0:$.name)??"unavailable project"}).join(", "):"no projects until you choose one","."]}),!c.compatibility.compatible&&t.jsxs(se,{variant:"destructive",children:[t.jsx(De,{children:"Incompatible version"}),t.jsx(ne,{children:t.jsx("ul",{className:"flex flex-col gap-1",children:c.compatibility.issues.map(f=>t.jsxs("li",{children:[f.side,": ",f.name," requires ",f.required,"; available ",f.actual??"none","."]},`${f.side}:${f.code}:${f.name}`))})})]}),c.compatibility.unavailableOptional.length>0&&t.jsx(se,{children:t.jsxs(ne,{children:["Some optional features are unavailable: ",c.compatibility.unavailableOptional.map(f=>f.name).join(", "),"."]})}),g&&te&&!o?t.jsxs(t.Fragment,{children:[t.jsx(At,{client:l,preview:c,activation:e.activation,onComplete:()=>{b(!1),p(null),R(`${c.manifest.name} ${c.manifest.version} is ${c.operation==="rollback"?"restored":c.oldVersion?"updated":"installed"} on ${m.hostName}.`),O("installed"),q(null)},onError:f=>{N(f.message),L()}}),t.jsxs(E,{variant:"outline",onClick:L,children:["Cancel ",c.operation==="rollback"?"rollback":c.oldVersion?"update":"installation"]})]}):t.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[t.jsx(E,{variant:"outline",disabled:k,onClick:L,children:"Cancel"}),t.jsxs(E,{disabled:T||!te||!c.compatibility.compatible||o,onClick:()=>{N(null),b(!0)},children:[c.operation==="rollback"?"Roll back":c.oldVersion?"Update":"Install"," on ",m.hostName]})]})]})]})]})})}export{ls as PluginsDialog};
@@ -0,0 +1 @@
1
+ import{r as a,j as t}from"./vendor-react-gGw_S5I_.js";import{y as ne,B as g,l as K,z as ie,C as oe,m as le,n as ce,I as de,E as G,G as ue,T as he,H as pe,J as me,L as fe,M as xe,N as we,O as ve,Q as ge,R as be,U as je,w as b}from"./index-DsnL-sXV.js";import{E as H,X as ye,a as Se,b as Ne,c as Ie,M as Ee,T as ke,d as Me,e as Pe,Z as ze,f as Re}from"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";const O=360,Ce=560,V="cogpit-preview-width",Y="cogpit-preview-viewport",_="cogpit-preview-zoom",E=.5,k=1.5,I=.1,h={responsive:{label:"Responsive",width:null,height:null,icon:Pe},phone:{label:"Phone",width:390,height:844,icon:Me},tablet:{label:"Tablet",width:768,height:1024,icon:ke},desktop:{label:"Desktop",width:1280,height:800,icon:Ee}};function Te(){try{const s=Number(localStorage.getItem(V));if(Number.isFinite(s)&&s>=O)return s}catch{}return Ce}function De(){try{const s=localStorage.getItem(Y);if(s&&s in h)return s}catch{}return"responsive"}function Oe(){try{const s=localStorage.getItem(_);if(s===null)return 1;const i=Number(s);if(Number.isFinite(i))return Math.min(k,Math.max(E,i))}catch{}return 1}function X(s){return be(`cogpit-preview-url:${s}`)}function A(s){const i=s.trim();if(!i||/^[a-z][a-z\d+.-]*:/i.test(i)&&!/^https?:\/\//i.test(i)&&!/^[^/]+:\d+(?:\/|$)/.test(i))return null;const j=/^https?:\/\//i.test(i)?i:`http://${i}`;try{const n=new URL(j);return n.protocol!=="http:"&&n.protocol!=="https:"?null:n.href}catch{return null}}function B(s,i){return`http://${i||"localhost"}:${s}/`}function Le({cwd:s,onClose:i}){const[M,j]=a.useState([]),[n,P]=a.useState(""),[W,y]=a.useState(""),[z,R]=a.useState(null),[J,Q]=a.useState(0),[q,C]=a.useState(!1),[S,ee]=a.useState(Te),[l,te]=a.useState(De),[o,p]=a.useState(Oe),c=a.useRef(null),$=a.useRef(null),T=a.useRef(null),{activeDevice:m}=ne(),N=(m==null?void 0:m.host)??(window.location.hostname||"localhost"),re=m==null?void 0:m.id;a.useEffect(()=>{let e="";try{e=localStorage.getItem(X(s))??""}catch{}const r=e?A(e)??"":"";P(r),y(r),R(null)},[s,re]),a.useEffect(()=>{let e=!1;async function r(){try{const u=await je(`/api/background-tasks?cwd=${encodeURIComponent(s)}`);if(e||!u.ok)return;const x=await u.json(),f=Array.isArray(x)?x:[];j(f);const L=f.flatMap(w=>w.ports.filter(v=>w.portStatus[v])).at(0);if(L){const w=B(L,N);P(v=>v||w),y(v=>v||w)}}catch{e||j([])}}r();const d=window.setInterval(r,1e4);return()=>{e=!0,window.clearInterval(d)}},[s,N]),a.useEffect(()=>{if(n)try{localStorage.setItem(X(s),n)}catch{}},[s,n]),a.useEffect(()=>{try{localStorage.setItem(Y,l),localStorage.setItem(_,String(o))}catch{}},[l,o]);const Z=a.useMemo(()=>[...new Set(M.flatMap(e=>e.ports.filter(r=>e.portStatus[r])))].sort((e,r)=>e-r),[M]),U=a.useCallback(e=>{const r=A(e);if(!r){R("Enter a valid HTTP or HTTPS URL.");return}R(null),P(r),y(r),C(!0)},[]),D=a.useCallback(()=>{n&&(C(!0),Q(e=>e+1))},[n]);a.useEffect(()=>{function e(r){var d,u,x;if((d=$.current)!=null&&d.contains(document.activeElement)){if(b("previewRefresh",r)){r.preventDefault(),D();return}if(b("previewFocusUrl",r)){r.preventDefault(),(u=T.current)==null||u.focus(),(x=T.current)==null||x.select();return}if(b("previewZoomIn",r)){r.preventDefault(),p(f=>Math.min(k,Number((f+I).toFixed(1))));return}if(b("previewZoomOut",r)){r.preventDefault(),p(f=>Math.max(E,Number((f-I).toFixed(1))));return}b("previewResetZoom",r)&&(r.preventDefault(),p(1))}}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D]);const se=a.useCallback(e=>{e.preventDefault(),c.current={startX:e.clientX,startWidth:S,currentWidth:S},e.currentTarget.setPointerCapture(e.pointerId)},[S]),ae=a.useCallback(e=>{if(!c.current)return;const r=Math.max(O,window.innerWidth*.7),d=c.current.startWidth+(c.current.startX-e.clientX),u=Math.min(r,Math.max(O,d));c.current.currentWidth=u,ee(u)},[]),F=a.useCallback(()=>{if(!c.current)return;const e=c.current.currentWidth;c.current=null;try{localStorage.setItem(V,String(e))}catch{}},[]);return t.jsxs("aside",{ref:$,"aria-label":"Development preview",className:"view-transition-right-panel panel-enter-right relative flex min-h-0 shrink-0 flex-col border-l bg-canvas",style:{width:S},children:[t.jsx("div",{"aria-hidden":"true",className:"absolute inset-y-0 left-0 w-1 cursor-col-resize hover:bg-primary/30",onPointerDown:se,onPointerMove:ae,onPointerUp:F,onPointerCancel:F}),t.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[t.jsx(H,{"aria-hidden":"true",className:"size-4 text-muted-foreground"}),t.jsx("h2",{className:"text-sm font-medium",children:"Preview"}),t.jsx("span",{className:"flex-1"}),t.jsx(g,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":"Close preview",children:t.jsx(ye,{"data-icon":"inline-start"})})]}),t.jsx(K,{}),t.jsx("form",{className:"p-2",onSubmit:e=>{e.preventDefault(),U(W)},children:t.jsx(ie,{className:"gap-2",children:t.jsxs(oe,{"data-invalid":!!z,children:[t.jsxs(le,{children:[t.jsx(ce,{ref:T,"aria-label":"Preview URL","aria-invalid":!!z,value:W,onChange:e=>y(e.target.value),placeholder:"localhost:3000",spellCheck:!1}),t.jsxs(de,{align:"inline-end",children:[t.jsx(G,{size:"icon-xs",disabled:!n,onClick:D,"aria-label":"Refresh preview",children:t.jsx(Se,{"data-icon":"inline-start",className:q?"animate-spin":void 0})}),t.jsx(G,{size:"icon-xs",disabled:!n,onClick:()=>window.open(n,"_blank","noopener,noreferrer"),"aria-label":"Open preview in browser",children:t.jsx(Ne,{"data-icon":"inline-start"})})]})]}),t.jsx(ue,{children:z})]})})}),Z.length>0&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto px-2 pb-2",children:[t.jsx(Ie,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),Z.map(e=>t.jsxs(g,{variant:"outline",size:"xs",className:"font-mono text-xs",onClick:()=>U(B(e,N)),"aria-label":`Open ${N}:${e} preview`,children:[":",e]},e))]}),t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-2 pb-2",children:[t.jsx(he,{"aria-label":"Preview viewport",value:[l],onValueChange:e=>{const r=e[0];r&&r in h&&te(r)},variant:"outline",size:"sm",spacing:0,children:Object.entries(h).map(([e,r])=>{const d=r.icon;return t.jsx(pe,{value:e,"aria-label":`${r.label} viewport`,title:r.width?`${r.label} · ${r.width}×${r.height}`:r.label,children:t.jsx(d,{})},e)})}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(g,{variant:"ghost",size:"icon-sm",disabled:o<=E,onClick:()=>p(e=>Math.max(E,Number((e-I).toFixed(1)))),"aria-label":"Zoom preview out",title:"Zoom out",children:t.jsx(ze,{"data-icon":"inline-start"})}),t.jsxs(g,{variant:"ghost",size:"sm",onClick:()=>p(1),"aria-label":"Reset preview zoom",children:[Math.round(o*100),"%"]}),t.jsx(g,{variant:"ghost",size:"icon-sm",disabled:o>=k,onClick:()=>p(e=>Math.min(k,Number((e+I).toFixed(1)))),"aria-label":"Zoom preview in",title:"Zoom in",children:t.jsx(Re,{"data-icon":"inline-start"})})]})]}),t.jsx(K,{}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-muted/30 p-3",children:n?t.jsx("div",{className:me("relative mx-auto overflow-hidden bg-white ring-1 ring-border",l==="responsive"&&"size-full"),style:l==="responsive"?void 0:{width:h[l].width*o,height:h[l].height*o},children:t.jsx("iframe",{title:"Development preview",src:n,className:"block border-0 bg-white",style:l==="responsive"?{width:`${100/o}%`,height:`${100/o}%`,transform:`scale(${o})`,transformOrigin:"top left"}:{width:h[l].width,height:h[l].height,transform:`scale(${o})`,transformOrigin:"top left"},sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-same-origin allow-scripts",referrerPolicy:"no-referrer",onLoad:()=>C(!1)},`${n}-${J}`)}):t.jsx(fe,{className:"size-full",children:t.jsxs(xe,{children:[t.jsx(we,{variant:"icon",children:t.jsx(H,{})}),t.jsx(ve,{children:"No preview selected"}),t.jsx(ge,{children:"Start a local development server or enter its URL above. Detected ports appear automatically."})]})})})]})}export{Le as PreviewPanel,A as normalizePreviewUrl};
@@ -0,0 +1,4 @@
1
+ import{r as l,j as t,c as Ae}from"./vendor-react-gGw_S5I_.js";import{L as Q,M as J,N as X,O as Y,Q as q,U as ae,J as ie,aA as ot,af as je,B as A,aB as Ct,aC as kt,aD as Et,aE as Rt,l as xe,Z as le,m as Dt,I as Ft,n as Lt,T as nt,H as he,q as Tt,a1 as Mt,aF as It,aG as $t,D as zt,h as At,i as Ut,j as Ot,k as Pt,aH as Gt,aI as Bt,a3 as Ht,a4 as Kt,a5 as Vt,a7 as Qt,a8 as Jt,a9 as Xt,aa as Yt,ab as qt,w as Wt}from"./index-DsnL-sXV.js";import{H as Zt}from"./HighlightedEditor-DWc-xoSc.js";import{J as ge,o as ze,l as _t,N as es,C as ts,X as ss,G as ns,S as ls,a as lt,O as as,Q as at,U as is,F as Ie}from"./vendor-ui-Br3ZTAXZ.js";import{M as rs}from"./vendor-markdown-BE1gYnO9.js";import"./vendor-shiki-DOn6sF-i.js";const os=12,ct="h-6 w-full justify-start gap-1 rounded-none px-2 text-left font-normal";function Se(n,e){return{paddingLeft:8+n*os+(e?0:16)}}function cs(n){const e=n;return typeof e=="object"&&e!==null&&typeof e.name=="string"&&(e.type==="file"||e.type==="directory")}function ds(n){const e=n==null?void 0:n.entries;return Array.isArray(e)?e.filter(cs):[]}async function it(n,e,r){try{const o=await ae(`/api/project-files/tree?cwd=${encodeURIComponent(n)}&dir=${encodeURIComponent(e)}${r?"&refresh=1":""}`);if(!o.ok){const u=await o.json().catch(()=>null),f=u==null?void 0:u.error;throw new Error(typeof f=="string"?f:"Unable to list directory")}const c=await o.json();return{status:"ready",entries:ds(c),scanLimited:c.scanLimited===!0}}catch(o){return{status:"error",message:o instanceof Error?o.message:"Unable to list directory"}}}function fs(n){const e=n.split("/");return e.slice(0,-1).map((r,o)=>e.slice(0,o+1).join("/"))}function us({cwd:n,selectedPath:e,onSelect:r,fileStatus:o,reloadToken:c}){const[u,f]=l.useState(()=>new Map),[g,S]=l.useState(()=>new Set),b=l.useRef(new Set),R=l.useRef(n);R.current=n;const m=l.useCallback(async x=>{if(b.current.has(x))return;b.current.add(x),f(y=>new Map(y).set(x,{status:"loading"}));const w=await it(n,x,!1);b.current.delete(x),R.current===n&&f(y=>new Map(y).set(x,w))},[n]),h=l.useRef(null);l.useEffect(()=>{const x=h.current===n;h.current=n,x||S(new Set),f(new Map([["",{status:"loading"}]]));let w=!1;return it(n,"",x).then(y=>{w||f(new Map([["",y]]))}),()=>{w=!0}},[n,c]),l.useEffect(()=>{if(!e)return;const x=fs(e);x.length!==0&&S(w=>{if(x.every(D=>w.has(D)))return w;const y=new Set(w);for(const D of x)y.add(D);return y})},[e]);const N=l.useCallback(x=>{S(w=>{const y=new Set(w);return y.has(x)?y.delete(x):y.add(x),y})},[]),j=u.get(""),k=ms(j);return t.jsxs("div",{"aria-label":"Project file tree",className:"flex flex-col py-1",children:[k?t.jsx(Q,{className:"min-h-48 rounded-none p-4",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(k.Icon,{})}),t.jsx(Y,{children:k.title}),t.jsx(q,{children:k.description})]})}):t.jsx(dt,{directory:"",depth:0,state:j,directories:u,expanded:g,selectedPath:e,onSelect:r,onToggle:N,onLoad:m,fileStatus:o}),(j==null?void 0:j.status)==="ready"&&j.scanLimited&&t.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"This project is too large to scan completely."})]})}function ms(n){return(n==null?void 0:n.status)==="error"?{Icon:ge,title:"Could not load files",description:n.message}:(n==null?void 0:n.status)==="ready"&&n.entries.length===0?{Icon:ze,title:"No files",description:"This project has no files to show."}:null}function dt(n){const e=Ae.c(22),{directory:r,depth:o,state:c,onLoad:u,...f}=n;let g,S;if(e[0]!==r||e[1]!==u||e[2]!==c?(g=()=>{c===void 0&&r!==""&&u(r)},S=[r,u,c],e[0]=r,e[1]=u,e[2]=c,e[3]=g,e[4]=S):(g=e[3],S=e[4]),l.useEffect(g,S),!c||c.status==="loading"){let m;e[5]!==o?(m=Se(o,!1),e[5]=o,e[6]=m):m=e[6];let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(je,{className:"size-3"}),e[7]=h):h=e[7];const N=r===""&&"Loading files…";let j;return e[8]!==m||e[9]!==N?(j=t.jsxs("div",{role:"status",className:"flex h-6 items-center gap-2 text-xs text-muted-foreground",style:m,children:[h,N]}),e[8]=m,e[9]=N,e[10]=j):j=e[10],j}if(c.status==="error"){let m;e[11]!==o?(m=Se(o,!1),e[11]=o,e[12]=m):m=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ge,{"aria-hidden":"true",className:"size-3 shrink-0"}),e[13]=h):h=e[13];let N;e[14]!==c.message?(N=t.jsx("span",{className:"truncate",children:c.message}),e[14]=c.message,e[15]=N):N=e[15];let j;return e[16]!==c.message||e[17]!==m||e[18]!==N?(j=t.jsxs("div",{role:"alert",className:"flex h-6 items-center gap-1.5 truncate text-xs text-destructive",style:m,title:c.message,children:[h,N]}),e[16]=c.message,e[17]=m,e[18]=N,e[19]=j):j=e[19],j}const b=c.entries.map(m=>{const h=r?`${r}/${m.name}`:m.name;return m.type==="directory"?t.jsx(xs,{path:h,name:m.name,depth:o,onLoad:u,...f},h):t.jsx(hs,{path:h,name:m.name,depth:o,selected:f.selectedPath===h,status:f.fileStatus(h),onSelect:f.onSelect},h)});let R;return e[20]!==b?(R=t.jsx(t.Fragment,{children:b}),e[20]=b,e[21]=R):R=e[21],R}function xs(n){const e=Ae.c(48);let r,o,c,u,f,g,S,b,R,m,h,N,j,k,x,w,y;e[0]!==n?({path:S,name:f,depth:u,...b}=n,g=b.expanded.has(S),r=g?_t:es,c=A,h="ghost",N="sm",j=g,k=ct,e[18]!==u?(x=Se(u,!0),e[18]=u,e[19]=x):x=e[19],w=()=>b.onToggle(S),y=S,o=ts,R="true",m=ie("size-3 shrink-0 text-muted-foreground transition-transform",g&&"rotate-90"),e[0]=n,e[1]=r,e[2]=o,e[3]=c,e[4]=u,e[5]=f,e[6]=g,e[7]=S,e[8]=b,e[9]=R,e[10]=m,e[11]=h,e[12]=N,e[13]=j,e[14]=k,e[15]=x,e[16]=w,e[17]=y):(r=e[1],o=e[2],c=e[3],u=e[4],f=e[5],g=e[6],S=e[7],b=e[8],R=e[9],m=e[10],h=e[11],N=e[12],j=e[13],k=e[14],x=e[15],w=e[16],y=e[17]);let D;e[20]!==o||e[21]!==R||e[22]!==m?(D=t.jsx(o,{"aria-hidden":R,className:m}),e[20]=o,e[21]=R,e[22]=m,e[23]=D):D=e[23];let L;e[24]!==r?(L=t.jsx(r,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),e[24]=r,e[25]=L):L=e[25];let F;e[26]!==f?(F=t.jsx("span",{className:"min-w-0 flex-1 truncate text-xs",children:f}),e[26]=f,e[27]=F):F=e[27];let i;e[28]!==c||e[29]!==D||e[30]!==L||e[31]!==F||e[32]!==h||e[33]!==N||e[34]!==j||e[35]!==k||e[36]!==x||e[37]!==w||e[38]!==y?(i=t.jsxs(c,{variant:h,size:N,"aria-expanded":j,className:k,style:x,onClick:w,title:y,children:[D,L,F]}),e[28]=c,e[29]=D,e[30]=L,e[31]=F,e[32]=h,e[33]=N,e[34]=j,e[35]=k,e[36]=x,e[37]=w,e[38]=y,e[39]=i):i=e[39];let T;e[40]!==u||e[41]!==g||e[42]!==S||e[43]!==b?(T=g&&t.jsx("div",{children:t.jsx(dt,{directory:S,depth:u+1,state:b.directories.get(S),...b})}),e[40]=u,e[41]=g,e[42]=S,e[43]=b,e[44]=T):T=e[44];let U;return e[45]!==i||e[46]!==T?(U=t.jsxs("div",{children:[i,T]}),e[45]=i,e[46]=T,e[47]=U):U=e[47],U}function hs(n){const e=Ae.c(28),{path:r,name:o,depth:c,selected:u,status:f,onSelect:g}=n,S=l.useRef(null);let b;e[0]!==r?(b=ot(r),e[0]=r,e[1]=b):b=e[1];const R=b;let m,h;e[2]!==u?(m=()=>{var T,U;u&&((U=(T=S.current)==null?void 0:T.scrollIntoView)==null||U.call(T,{block:"nearest"}))},h=[u],e[2]=u,e[3]=m,e[4]=h):(m=e[3],h=e[4]),l.useEffect(m,h);const N=u||void 0,j=u?"secondary":"ghost";let k;e[5]!==c?(k=Se(c,!1),e[5]=c,e[6]=k):k=e[6];let x;e[7]!==g||e[8]!==r?(x=()=>g(r),e[7]=g,e[8]=r,e[9]=x):x=e[9];let w;e[10]!==R?(w=t.jsx(R,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),e[10]=R,e[11]=w):w=e[11];const y=f&&f.className;let D;e[12]!==y?(D=ie("min-w-0 flex-1 truncate text-xs",y),e[12]=y,e[13]=D):D=e[13];let L;e[14]!==o||e[15]!==D?(L=t.jsx("span",{className:D,children:o}),e[14]=o,e[15]=D,e[16]=L):L=e[16];let F;e[17]!==f?(F=f&&t.jsx("span",{className:ie("shrink-0 font-mono text-[10px]",f.className),title:f.label,children:f.code}),e[17]=f,e[18]=F):F=e[18];let i;return e[19]!==r||e[20]!==L||e[21]!==F||e[22]!==N||e[23]!==j||e[24]!==k||e[25]!==x||e[26]!==w?(i=t.jsxs(A,{ref:S,"aria-current":N,variant:j,size:"sm",className:ct,style:k,onClick:x,title:r,children:[w,L,F]}),e[19]=r,e[20]=L,e[21]=F,e[22]=N,e[23]=j,e[24]=k,e[25]=x,e[26]=w,e[27]=i):i=e[27],i}const ps={"?":{label:"Untracked",className:"text-info"},A:{label:"Added",className:"text-success"},M:{label:"Modified",className:"text-warning"},D:{label:"Deleted",className:"text-destructive"},R:{label:"Renamed",className:"text-info"},C:{label:"Copied",className:"text-info"},U:{label:"Conflicted",className:"text-destructive"}};function $e(n){const e=n.workTreeStatus.trim()||n.indexStatus.trim();return ps[e]??{label:"Changed",className:"text-muted-foreground"}}function js(n){return`${n.indexStatus}${n.workTreeStatus}`.trim()||"?"}const gs=new Set([".md",".mdx",".markdown"]);function rt(n){const e=n.lastIndexOf(".");return e!==-1&&gs.has(n.slice(e).toLowerCase())}function ws(n,e,r){if(!n||/^(?:[a-z]+:|\/|#)/i.test(n))return n;const o=r.includes("/")?r.slice(0,r.lastIndexOf("/")):"",c=[];for(const f of[...o.split("/"),...n.split("/")])f===".."?c.pop():f&&f!=="."&&c.push(f);const u=e.includes("\\")?"\\":"/";return[e.replace(/[\\/]+$/,""),...c].join(u)}async function pe(n,e){try{const r=await n.json();if(r&&typeof r=="object"&&typeof r.error=="string")return r.error}catch{}return e}function vs(n){return n<1024?`${n} B`:`${(n/1024).toFixed(n<10*1024?1:0)} KB`}function ys(n,e){let r=0;for(let o=1;o<e;o+=1){const c=n.indexOf(`
2
+ `,r);if(c<0)return r;r=c+1}return r}function Rs({cwd:n,onClose:e,onAddToPrompt:r,openRequest:o}){const c=l.useRef(null),u=l.useRef(null),f=l.useRef(null),[g,S]=l.useState(""),[b,R]=l.useState([]),[m,h]=l.useState(!0),[N,j]=l.useState(null),[k,x]=l.useState(0),[w,y]=l.useState(!1),[D,L]=l.useState(0),F=l.useRef(!1),[i,T]=l.useState(null),[U,Ce]=l.useState(!0),[M,W]=l.useState(""),[ft,re]=l.useState(""),[O,oe]=l.useState(null),[ut,Ue]=l.useState(0),[H,Oe]=l.useState(!1),[Z,Pe]=l.useState(!1),[Ge,_]=l.useState(null),[mt,ee]=l.useState(!1),[I,ke]=l.useState("all"),[v,Be]=l.useState(null),[He,Ke]=l.useState(!1),[xt,Ve]=l.useState(null),[C,ce]=l.useState("edit"),[E,we]=l.useState(null),[de,Qe]=l.useState(!1),[Je,Ee]=l.useState(null),[fe,K]=l.useState(null),[P,ve]=l.useState(null),[ye,Re]=l.useState(""),[B,ue]=l.useState(null),$=i!==null&&M!==ft,z=l.useMemo(()=>new Map(((v==null?void 0:v.files)??[]).flatMap(s=>[[s.path,s],...s.originalPath?[[s.originalPath,s]]:[]])),[v==null?void 0:v.files]),te=l.useCallback(async()=>{Ke(!0),Ve(null);try{const s=await ae(`/api/git-status?cwd=${encodeURIComponent(n)}`);if(!s.ok)throw new Error(await pe(s,"Unable to read git status"));const a=await s.json();Be(a),a.isRepository||ke("all")}catch(s){Be(null),ke("all"),Ve(s instanceof Error?s.message:"Unable to read git status")}finally{Ke(!1)}},[n]);l.useEffect(()=>{te()},[te]);const De=I==="all"&&g.trim()==="";l.useEffect(()=>{if(De)return;const s=new AbortController,a=window.setTimeout(async()=>{h(!0),j(null);const d=F.current;F.current=!1;try{const p=await ae(`/api/project-files?cwd=${encodeURIComponent(n)}&q=${encodeURIComponent(g)}&limit=100${d?"&refresh=1":""}`,{signal:s.signal});if(!p.ok)throw new Error(await pe(p,"Unable to list project files"));const G=await p.json();if(s.signal.aborted)return;const tt=Ct(G),st=G.totalMatches;R(tt),x(typeof st=="number"?st:tt.length),y(G.scanLimited===!0)}catch(p){s.signal.aborted||(R([]),j(p instanceof Error?p.message:"Unable to list project files"))}finally{s.signal.aborted||h(!1)}},120);return()=>{window.clearTimeout(a),s.abort()}},[n,g,D,De]),l.useEffect(()=>{T(null),W(""),re(""),oe(null),_(null),K(null),ce("edit"),we(null),Ee(null),ue(null)},[n]),l.useEffect(()=>{if(!$)return;const s=a=>a.preventDefault();return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[$]);const ht=l.useCallback((s,a)=>{const d=u.current;if(!d)return;if(!a||a<1){d.focus();return}const p=ys(s,a);d.blur(),d.setSelectionRange(p,p),d.focus()},[]);l.useEffect(()=>{const s=f.current;!s||!u.current||(f.current=null,ht(s.text,s.line))});const se=l.useCallback(async(s,a)=>{Oe(!0),_(null),ee(!1),K(null);try{const d=await ae(`/api/project-file?cwd=${encodeURIComponent(n)}&path=${encodeURIComponent(s)}`);if(!d.ok)throw new Error(await pe(d,"Unable to open file"));const p=await d.json();W(p.content),re(p.content),oe(p.mtimeMs),Ue(p.size),f.current={text:p.content,line:a}}catch(d){W(""),re(""),oe(null),_(d instanceof Error?d.message:"Unable to open file")}finally{Oe(!1)}},[n]),ne=l.useCallback(async(s,a)=>{Qe(!0),Ee(null),we(null);try{const d=a?`&originalPath=${encodeURIComponent(a)}`:"",p=await ae(`/api/git-diff?cwd=${encodeURIComponent(n)}&path=${encodeURIComponent(s)}${d}`);if(!p.ok)throw new Error(await pe(p,"Unable to diff file"));we(await p.json())}catch(d){Ee(d instanceof Error?d.message:"Unable to diff file")}finally{Qe(!1)}},[n]),be=l.useCallback(({path:s,mode:a,line:d})=>{var p;if(T(s),Ce(!1),a==="edit"){ce(rt(s)&&!d?"preview":"edit"),se(s,d);return}ce(a),W(""),re(""),oe(null),_(null),ee(!1),K(null),ne(s,(p=z.get(s))==null?void 0:p.originalPath)},[z,ne,se]),Ne=l.useCallback(s=>{if($){ue({type:"file",target:s});return}be(s)},[$,be]),Xe=l.useCallback(s=>{if(s===i){Ce(!1);return}const a=I==="changes"&&z.has(s)?"diff":"edit";Ne({path:s,mode:a})},[z,I,Ne,i]),Ye=l.useRef(0);l.useEffect(()=>{!o||o.token===Ye.current||(Ye.current=o.token,Ne({path:o.file,mode:o.mode,line:o.line}))},[o,Ne]);const pt=l.useCallback(()=>{var s;!i||C==="diff"||(ce("diff"),(E==null?void 0:E.path)!==i&&!de&&ne(i,(s=z.get(i))==null?void 0:s.originalPath))},[z,E==null?void 0:E.path,de,ne,i,C]),jt=l.useCallback(s=>{!i||C===s||(ce(s),O===null&&!H&&se(i))},[H,se,O,i,C]),Fe=l.useCallback(()=>{var s;if(i){if(C==="diff"){ne(i,(s=z.get(i))==null?void 0:s.originalPath);return}se(i)}},[z,ne,se,i,C]),gt=l.useCallback(()=>{F.current=!0,L(s=>s+1),te(),C==="diff"&&Fe()},[te,Fe,C]),Le=l.useCallback(async()=>{if(!(!i||O===null||!$||Z)){Pe(!0),_(null),ee(!1);try{const s=await ae("/api/project-file",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:n,path:i,content:M,expectedMtimeMs:O})});if(!s.ok)throw new Error(await pe(s,"Unable to save file"));const a=await s.json();re(M),oe(a.mtimeMs),Ue(a.size),ee(!0),we(null),te()}catch(s){_(s instanceof Error?s.message:"Unable to save file")}finally{Pe(!1)}}},[M,n,$,te,O,Z,i]);l.useEffect(()=>{function s(a){var d;(d=c.current)!=null&&d.contains(document.activeElement)&&Wt("projectFileSave",a)&&(a.preventDefault(),Le())}return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[Le]);const wt=l.useCallback(()=>{if($){ue({type:"close"});return}e()},[$,e]),vt=l.useCallback(()=>{if(!B)return;const s=B;if(ue(null),s.type==="file"){be(s.target);return}e()},[e,be,B]),yt=l.useCallback(s=>{if(s.key!=="Tab")return;s.preventDefault();const a=s.currentTarget,d=a.selectionStart,p=a.selectionEnd,G=`${M.slice(0,d)} ${M.slice(p)}`;W(G),ee(!1),K(null),requestAnimationFrame(()=>{a.selectionStart=d+2,a.selectionEnd=d+2})},[M]),bt=l.useCallback(s=>{const a=s.currentTarget;if(a.selectionStart===a.selectionEnd){K(null);return}const d=M.slice(a.selectionStart,a.selectionEnd),p=M.slice(0,a.selectionStart).split(`
3
+ `).length,G=p+d.split(`
4
+ `).length-1;K({text:d,startLine:p,endLine:G})},[M]),Te=l.useMemo(()=>(i==null?void 0:i.split("/").at(-1))??null,[i]),me=i?z.get(i):void 0,qe=i!==null&&rt(i),We=l.useCallback(s=>{const a=z.get(s);return a?{code:js(a),...$e(a)}:null},[z]),Nt=l.useMemo(()=>({...kt,img:s=>t.jsx(Et,{src:ws(s.src,n,i??""),alt:s.alt})}),[n,i]),Me=l.useMemo(()=>E&&!E.binary&&!E.tooLarge?Rt(E.original??"",E.current??""):null,[E]),V=l.useMemo(()=>{if(I==="all")return b;const s=g.trim().toLowerCase();return((v==null?void 0:v.files)??[]).map(a=>a.path).filter((a,d,p)=>p.indexOf(a)===d).filter(a=>!s||a.toLowerCase().includes(s)).sort((a,d)=>a.localeCompare(d))},[I,b,v==null?void 0:v.files,g]),Ze=l.useMemo(()=>i&&!V.includes(i)?[i,...V]:V,[V,i]),St=I==="changes"?He:m,_e=I==="changes"?xt:N,et=He;return t.jsxs("aside",{ref:c,"aria-label":"Project files",className:"relative flex size-full min-h-0 flex-col bg-canvas",children:[t.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-2 px-3",children:[t.jsx(ze,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4 text-muted-foreground"}),t.jsx("h2",{className:"text-sm font-medium",children:"Project files"}),t.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:n,children:n}),t.jsx(A,{variant:"ghost",size:"icon-sm",onClick:wt,"aria-label":"Close project files",children:t.jsx(ss,{"data-icon":"inline-start"})})]}),t.jsx(xe,{}),(v==null?void 0:v.isRepository)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-2 px-3 text-xs text-muted-foreground",children:[t.jsx(ns,{"data-icon":"inline-start","aria-hidden":"true",className:"size-3.5"}),t.jsx("span",{className:"max-w-40 truncate font-mono text-foreground",title:v.branch??"Detached HEAD",children:v.branch??"detached HEAD"}),v.upstream&&t.jsxs("span",{className:"truncate",children:["tracks ",v.upstream]}),(v.ahead??0)>0&&t.jsxs(le,{variant:"outline",children:["↑ ",v.ahead]}),(v.behind??0)>0&&t.jsxs(le,{variant:"outline",children:["↓ ",v.behind]}),t.jsx("span",{className:"flex-1"}),t.jsxs("span",{children:[v.files.length," changed"]})]}),t.jsx(xe,{})]}),t.jsxs("div",{className:"flex min-h-0 flex-1",children:[t.jsxs("section",{"aria-label":"File browser",className:ie("min-h-0 shrink-0 flex-col md:flex md:w-56",i&&!U?"hidden":"flex w-full"),children:[t.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Dt,{className:"min-w-0 flex-1",children:[t.jsx(Ft,{children:t.jsx(ls,{"data-icon":"inline-start"})}),t.jsx(Lt,{"aria-label":"Search project files",value:g,onChange:s=>S(s.target.value),placeholder:"Filter files…",spellCheck:!1})]}),t.jsx(A,{variant:"ghost",size:"icon-sm",disabled:et,onClick:gt,"aria-label":"Refresh files and git status",title:"Refresh files and git status",children:t.jsx(lt,{"data-icon":"inline-start",className:et?"animate-spin":void 0})})]}),(v==null?void 0:v.isRepository)&&t.jsxs(nt,{"aria-label":"File scope",value:[I],onValueChange:s=>{const a=s[0];(a==="all"||a==="changes")&&ke(a)},variant:"outline",size:"sm",spacing:0,className:"w-full",children:[t.jsx(he,{value:"all",className:"flex-1",children:"All files"}),t.jsx(he,{value:"changes",className:"flex-1",children:"Changes"})]})]}),t.jsx(xe,{}),t.jsx(Tt,{className:"min-h-0 flex-1",children:De?t.jsx(us,{cwd:n,selectedPath:i,onSelect:Xe,fileStatus:We,reloadToken:D}):St?t.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 text-xs text-muted-foreground",role:"status",children:[t.jsx(je,{}),"Loading files…"]}):_e?t.jsx(Q,{className:"min-h-48 rounded-none p-4",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(ge,{})}),t.jsx(Y,{children:"Could not load files"}),t.jsx(q,{children:_e})]})}):Ze.length===0?t.jsx(Q,{className:"min-h-48 rounded-none p-4",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(ze,{})}),t.jsx(Y,{children:I==="changes"?"No working-tree changes":"No matching files"}),t.jsx(q,{children:I==="changes"?"This project has no changed files matching the filter.":"Try a different path or filename."})]})}):t.jsxs("div",{className:"flex flex-col py-1",children:[Ze.map(s=>{const a=s.split("/").at(-1)??s,d=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",p=We(s),G=ot(s);return t.jsxs(A,{variant:i===s?"secondary":"ghost",size:"sm",className:"h-auto w-full justify-start rounded-none px-2 py-1.5 text-left",onClick:()=>Xe(s),title:s,children:[t.jsx(G,{"data-icon":"inline-start",className:"text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-xs",children:a}),d&&t.jsx("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:d})]}),p&&t.jsx(le,{variant:"outline",className:ie("font-mono",p.className),title:p.label,children:p.code})]},s)}),I==="all"&&(k>V.length||w)&&t.jsxs("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:[k>V.length&&`Showing ${V.length} of ${k} matches. Type to narrow the list. `,w&&"This project is too large to scan completely."]})]})})]}),t.jsx(xe,{orientation:"vertical",className:"hidden md:block"}),t.jsx("section",{"aria-label":"File editor",className:ie("min-h-0 min-w-0 flex-1 flex-col md:flex",i&&!U?"flex":"hidden"),children:i?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex min-h-10 shrink-0 flex-wrap items-center gap-2 px-3 py-1 md:flex-nowrap",children:[t.jsx(A,{variant:"ghost",size:"icon-lg",className:"md:hidden",onClick:()=>Ce(!0),"aria-label":"Back to file browser",children:t.jsx(as,{"data-icon":"inline-start"})}),t.jsxs("div",{className:"min-w-0 flex-1 basis-[calc(100%-3.25rem)] md:basis-auto",children:[t.jsx("p",{className:"truncate text-xs font-medium",title:i,children:Te}),t.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:i})]}),(me||C==="diff"||qe)&&t.jsxs(nt,{"aria-label":"File view",value:[C],onValueChange:s=>{s[0]==="diff"?pt():(s[0]==="edit"||s[0]==="preview")&&jt(s[0])},variant:"outline",size:"sm",spacing:0,children:[(me||C==="diff")&&t.jsx(he,{value:"diff",children:"Diff"}),qe&&t.jsx(he,{value:"preview",children:"Preview"}),t.jsx(he,{value:"edit",children:"Edit"})]}),C==="diff"&&me&&t.jsx(le,{variant:"outline",className:$e(me).className,children:$e(me).label}),C==="diff"&&Me&&t.jsx(Mt,{add:Me.add,del:Me.del}),C!=="diff"&&$&&t.jsx(le,{variant:"outline",children:"Unsaved"}),C!=="diff"&&!$&&mt&&t.jsx(le,{variant:"secondary",children:"Saved"}),C!=="diff"&&O!==null&&t.jsx("span",{className:"hidden text-xs text-muted-foreground md:inline",children:vs(ut)}),r&&t.jsxs(A,{variant:"outline",size:"sm",disabled:C==="diff"?de||E===null:H||O===null,onClick:()=>{fe?(Re(""),ve(fe)):r({path:i})},"aria-label":fe?"Add selected lines to prompt":"Reference file in prompt",title:fe?"Add selected lines to prompt":"Reference file in prompt",children:[t.jsx(at,{"data-icon":"inline-start"}),fe?"Add selection":"Reference"]}),t.jsx(A,{variant:"ghost",size:"icon-sm",disabled:C==="diff"?de:H||Z,onClick:Fe,"aria-label":C==="diff"?"Reload diff":"Reload file",title:C==="diff"?"Reload diff":"Reload file",children:t.jsx(lt,{"data-icon":"inline-start"})}),C!=="diff"&&t.jsxs(A,{size:"sm",disabled:!$||H||Z||O===null,onClick:()=>void Le(),children:[Z?t.jsx(je,{"data-icon":"inline-start"}):t.jsx(is,{"data-icon":"inline-start"}),Z?"Saving…":"Save"]})]}),t.jsx(xe,{}),C!=="diff"&&Ge&&t.jsxs("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-xs text-destructive",children:[t.jsx(ge,{"data-icon":"inline-start","aria-hidden":"true",className:"size-4 shrink-0"}),t.jsx("span",{children:Ge})]}),C==="diff"?t.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:de?t.jsxs("div",{className:"flex size-full items-center justify-center gap-2 text-xs text-muted-foreground",role:"status",children:[t.jsx(je,{}),"Loading diff…"]}):Je?t.jsx(Q,{className:"rounded-none",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(ge,{})}),t.jsx(Y,{children:"Could not diff this file"}),t.jsx(q,{children:Je})]})}):E===null?null:E.binary||E.tooLarge?t.jsx(Q,{className:"rounded-none",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(Ie,{})}),t.jsx(Y,{children:E.binary?"Binary file":"File is too large to diff"}),t.jsx(q,{children:E.binary?"Git tracks this change, but there is no text diff to show.":"Review this change in your editor instead."})]})}):E.original===E.current?t.jsx(Q,{className:"rounded-none",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(Ie,{})}),t.jsx(Y,{children:"No content changes"}),t.jsx(q,{children:"This file matches the last commit — only its mode or index entry differs."})]})}):t.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t.jsx(It,{oldString:E.original??"",newString:E.current??"",filePath:i,compact:!1,hideHeader:!0})})}):t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[H&&t.jsxs("div",{className:"flex size-full items-center justify-center gap-2 text-xs text-muted-foreground",role:"status",children:[t.jsx(je,{}),"Opening file…"]}),!H&&O!==null&&(C==="preview"?t.jsx("div",{"aria-label":`Preview of ${i}`,className:"min-h-0 flex-1 overflow-auto break-words px-6 py-4 text-sm",children:t.jsx(rs,{components:Nt,remarkPlugins:$t,children:M})}):t.jsx(Zt,{textareaRef:u,ariaLabel:`Editing ${i}`,filePath:i,value:M,readOnly:!1,onChange:s=>{W(s),ee(!1),K(null)},onKeyDown:yt,onSelect:bt}))]})]}):t.jsx(Q,{className:"rounded-none",children:t.jsxs(J,{children:[t.jsx(X,{variant:"icon",children:t.jsx(Ie,{})}),t.jsx(Y,{children:"Select a file"}),t.jsx(q,{children:"Browse or filter project files, then open one to inspect and edit it."})]})})})]}),t.jsx(zt,{open:P!==null,onOpenChange:s=>{s||ve(null)},children:t.jsxs(At,{children:[t.jsxs(Ut,{children:[t.jsx(Ot,{children:"Comment on selected lines"}),t.jsxs(Pt,{children:["Add a review instruction for ",i," lines ",P==null?void 0:P.startLine,"-",P==null?void 0:P.endLine,"."]})]}),t.jsxs("form",{className:"flex flex-col gap-4",onSubmit:s=>{s.preventDefault();const a=ye.trim();!i||!P||!a||!r||(r({path:i,...P,comment:a}),ve(null),Re(""))},children:[t.jsx(Gt,{autoFocus:!0,"aria-label":"Review comment",value:ye,onChange:s=>Re(s.target.value),placeholder:"Describe the change you want…",onKeyDown:s=>{var a;(s.metaKey||s.ctrlKey)&&s.key==="Enter"&&ye.trim()&&(s.preventDefault(),(a=s.currentTarget.form)==null||a.requestSubmit())}}),t.jsxs(Bt,{children:[t.jsx(A,{type:"button",variant:"outline",onClick:()=>ve(null),children:"Cancel"}),t.jsxs(A,{type:"submit",disabled:!ye.trim(),children:[t.jsx(at,{"data-icon":"inline-start"}),"Add to prompt"]})]})]})]})}),t.jsx(Ht,{open:B!==null,onOpenChange:s=>{s||ue(null)},children:t.jsxs(Kt,{size:"sm",children:[t.jsxs(Vt,{children:[t.jsx(Qt,{children:"Discard unsaved changes?"}),t.jsx(Jt,{children:(B==null?void 0:B.type)==="file"?`Your edits to ${Te??"this file"} will be lost when you open ${B.target.path}.`:`Your edits to ${Te??"this file"} will be lost when you close the file workspace.`})]}),t.jsxs(Xt,{children:[t.jsx(Yt,{size:"sm",children:"Keep editing"}),t.jsx(qt,{variant:"destructive",size:"sm",onClick:vt,children:"Discard changes"})]})]})})]})}export{Rs as ProjectFilesPanel};
@@ -0,0 +1 @@
1
+ import{c as E,r as y,j as m}from"./vendor-react-gGw_S5I_.js";import{v as b,i as L,j as k,k as F,h as K,P as R,D as _,w as A,x as H}from"./index-DsnL-sXV.js";import"./vendor-ui-Br3ZTAXZ.js";import"./vendor-shiki-DOn6sF-i.js";import"./vendor-markdown-BE1gYnO9.js";function q(v){const e=E.c(28),{open:r,onClose:t,onNewSession:i,onNewFolder:j,defaultAgentKind:x,currentProjectDirName:a,currentProjectCwd:o,initialView:D}=v,s=b(r);let h,p;e[0]!==o||e[1]!==a||e[2]!==t||e[3]!==i||e[4]!==r||e[5]!==s?(h=()=>{if(!r)return;const n=function(g){var S;if(A("newSession",g)&&a){g.preventDefault();const P=o?H(s,o,"claude")??((S=s.find(C=>C.path===o))==null?void 0:S.dirName)??a:a;i(P,o??void 0),t()}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},p=[r,s,a,o,i,t],e[0]=o,e[1]=a,e[2]=t,e[3]=i,e[4]=r,e[5]=s,e[6]=h,e[7]=p):(h=e[6],p=e[7]),y.useEffect(h,p);let l;e[8]!==t?(l=n=>{n||t()},e[8]=t,e[9]=l):l=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=m.jsxs(L,{className:"sr-only",children:[m.jsx(k,{children:"Start a session"}),m.jsx(F,{children:"Choose a project, enter an absolute folder path, or browse the folders."})]}),e[10]=w):w=e[10];let c;e[11]!==t||e[12]!==i?(c=(n,N)=>{i(n,N),t()},e[11]=t,e[12]=i,e[13]=c):c=e[13];let d;e[14]!==t||e[15]!==j?(d=n=>{j(n),t()},e[14]=t,e[15]=j,e[16]=d):d=e[16];let f;e[17]!==o||e[18]!==x||e[19]!==D||e[20]!==s||e[21]!==c||e[22]!==d?(f=m.jsxs(K,{className:"max-w-md gap-0 overflow-hidden p-0",children:[w,m.jsx(R,{projects:s,currentPath:o,onNewSession:c,onNewFolder:d,defaultAgentKind:x,initialView:D})]}),e[17]=o,e[18]=x,e[19]=D,e[20]=s,e[21]=c,e[22]=d,e[23]=f):f=e[23];let u;return e[24]!==r||e[25]!==l||e[26]!==f?(u=m.jsx(_,{open:r,onOpenChange:l,children:f}),e[24]=r,e[25]=l,e[26]=f,e[27]=u):u=e[27],u}export{q as ProjectSwitcherModal};