@pi-chamber/web 1.0.4-rc.1 → 1.0.4-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{DiagramView-DfZMQkXY.js → DiagramView-GKGxPczP.js} +1 -1
- package/dist/assets/{DiffView-BjWUdbL5.js → DiffView-Cay8VAqL.js} +1 -1
- package/dist/assets/{FileSaveConflictDialog-u5L4k_5k.js → FileSaveConflictDialog-BRM9TJo0.js} +1 -1
- package/dist/assets/{FilesView-qP1ypN9J.js → FilesView-CEeQzjc6.js} +1 -1
- package/dist/assets/{GitHubDetailScaffold-zCKCy5OJ.js → GitHubDetailScaffold-q4YP8iyJ.js} +1 -1
- package/dist/assets/{GitHubLinkPicker-CwxKY3lN.js → GitHubLinkPicker-B9xgIW8y.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-Ck3zllel.js → GitHubListPrimitives-XkALat1v.js} +1 -1
- package/dist/assets/{GitView-y2k2i4gR.js → GitView-DV3d0oSJ.js} +3 -3
- package/dist/assets/{IssuesSurface-HWgR87N3.js → IssuesSurface-OTyt9f3A.js} +3 -3
- package/dist/assets/{JsonTreeView-DSuC4naV.js → JsonTreeView-X2Auiy_q.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-CT5ln9em.js → MarkdownRendererImpl-1HameF6j.js} +12 -12
- package/dist/assets/{PatchDiff-DArTeWeK.js → PatchDiff-GMQAv4en.js} +1 -1
- package/dist/assets/{PierreDiffViewer-DQKujzLb.js → PierreDiffViewer-0X__nypk.js} +2 -2
- package/dist/assets/PullRequestsSurface-Dec20SIg.js +2 -0
- package/dist/assets/{SessionSwitcherContent-DEGJyZBl.js → SessionSwitcherContent-DEw4nz7K.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-cC9wVBH7.js → SessionSwitcherDropdown-DmLhbRzE.js} +2 -2
- package/dist/assets/SessionUnreadDot-CJFawQpo.js +1 -0
- package/dist/assets/SettingsView-CwSspvq-.js +6 -0
- package/dist/assets/{SettingsWindow-CZM1dmVb.js → SettingsWindow-DkPv9MaU.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DClOSbJc.js → ToolOutputDialog-DDwbOpTO.js} +3 -3
- package/dist/assets/{ToolPartDiffPreview-BaFiGUDE.js → ToolPartDiffPreview-DZRP7p-Q.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-D6KbvKc6.js → VirtualizedFileDiff-CUWx7JVZ.js} +1 -1
- package/dist/assets/{collapsible-DhV9d4dT.js → collapsible-Ce85nuXX.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-CeMpF2xC.js → computeVirtualFileMetrics-3PpRLd5B.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-Ck5u_kAP.js → contextFileOpenGuard-PoBklHMz.js} +1 -1
- package/dist/assets/{gitStatusPredicates-DEBSqUNE.js → gitStatusPredicates-BvzxqidP.js} +1 -1
- package/dist/assets/{githubLink-DT7i2NlH.js → githubLink-iQ51wqRa.js} +1 -1
- package/dist/assets/{index-eDf4LKLY.js → index-CkMnC_GK.js} +1 -1
- package/dist/assets/{index-6IO1AcJI.js → index-Dd2OcIUY.js} +9 -9
- package/dist/assets/index-DvN8zlLT.css +1 -0
- package/dist/assets/{main-BczEScAA.js → main-FasHq7Ck.js} +2 -2
- package/dist/assets/{main-CHLNMYeJ.js → main-PSCt716b.js} +8 -8
- package/dist/assets/{markdownCore-C4Gk5Zht.js → markdownCore-BH56o6Wu.js} +1 -1
- package/dist/assets/{miniChat-Do3hE87Z.js → miniChat-BzfobBDq.js} +2 -2
- package/dist/assets/{mobile-CTnihwfa.js → mobile-DAzZE2EL.js} +2 -2
- package/dist/assets/{pi-session-focus-preference-LDVCJ_YR.js → pi-session-focus-preference-D2-1HWmY.js} +3 -3
- package/dist/assets/{renderDiffWithHighlighter-CDsgOnkH.js → renderDiffWithHighlighter-l8hZWWBO.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-DSa3gYqR.js → renderElectronMiniChatApp-DGYSIihR.js} +2 -2
- package/dist/assets/{renderFileWithHighlighter-TpKRyfCY.js → renderFileWithHighlighter-BvDoP7ob.js} +1 -1
- package/dist/assets/renderMobileApp-CwgWG0lU.js +11 -0
- package/dist/assets/runtimeEndpointReset-CmI6dBKM.js +62 -0
- package/dist/assets/{runtimeSurface-DW_Ia4q3.js → runtimeSurface-B1GRkkKC.js} +1 -1
- package/dist/assets/{useAppFontEffects-CG3_yteE.js → useAppFontEffects--lKKtKVo.js} +62 -62
- package/dist/assets/{useFilesViewSearch-C_LzYIgD.js → useFilesViewSearch-D1jsGQrN.js} +3 -3
- package/dist/assets/{useGitHubRemoteSearch-DsxWOzKZ.js → useGitHubRemoteSearch-zNgy2bSt.js} +1 -1
- package/dist/assets/{useSwitcherItems-BmoCnS9W.js → useSwitcherItems-OCRYcHeu.js} +1 -1
- package/dist/assets/{web-components-CH3-XV-n.js → web-components-v9fuidaX.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +2 -2
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +21 -8
- package/server/lib/pi/session-daemon/builtin-extensions.js +37 -0
- package/server/lib/pi/session-daemon/daemon-process.js +6 -0
- package/server/lib/pi/session-daemon/extension-theme.js +75 -0
- package/server/lib/pi/session-daemon/extension-theme.test.js +47 -0
- package/server/lib/pi/session-daemon/prompt-operations.test.js +3 -3
- package/server/lib/pi/session-daemon/prompt-preflight.test.js +12 -14
- package/server/lib/pi/session-daemon/sdk-upgrade.test.js +118 -2
- package/server/lib/pi/session-daemon/send-operation-dedup.test.js +1 -1
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +1 -1
- package/server/lib/pi/session-daemon/session-daemon-mcp.e2e.test.js +638 -0
- package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +437 -0
- package/server/lib/pi/session-daemon/session-daemon.js +61 -42
- package/server/lib/pi/session-daemon/session-daemon.test.js +53 -5
- package/server/lib/pi/session-daemon/session-idle-residency.test.js +1 -1
- package/server/lib/pi/session-daemon/session-replay.test.js +1 -1
- package/server/lib/pi/session-persistence-gap.test.js +2 -3
- package/server/lib/pi/ui-settings-store.js +1 -0
- package/server/lib/pi/ui-settings-store.test.js +27 -0
- package/dist/assets/PullRequestsSurface-Cfb1wSvC.js +0 -2
- package/dist/assets/SessionUnreadDot-CELKNVIM.js +0 -1
- package/dist/assets/SettingsView-CZvRRgJe.js +0 -6
- package/dist/assets/index-BAmzAlNx.css +0 -1
- package/dist/assets/renderMobileApp-CPE-3uMl.js +0 -11
- package/dist/assets/runtimeEndpointReset-CzJfovWI.js +0 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./vendor-boot-DyL2td56.js";import{R as t}from"./vendor-react-DASdDPIk.js";import{p as $,t as d,I as
|
|
1
|
+
import{j as c}from"./vendor-boot-DyL2td56.js";import{R as t}from"./vendor-react-DASdDPIk.js";import{p as $,t as d,I as A}from"./useAppFontEffects--lKKtKVo.js";import{t as V,a as G,A as ee,bX as W}from"./index-Dd2OcIUY.js";import{b as te,D as re,F as ne}from"./FileSaveConflictDialog-BRM9TJo0.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-B1GRkkKC.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-react-drawio-Duu5LgQA.js";const se=l=>l.split("/").pop()||l;function ye(){const{files:l}=$(),[x,k]=t.useState(null),[L,R]=t.useState(""),[M,E]=t.useState(!0),[b,h]=t.useState(null),[m,F]=t.useState(!1),[U,p]=t.useState(!1),[j,P]=t.useState(!1),[q,H]=t.useState(0),g=t.useRef(void 0),C=t.useRef(""),v=t.useRef(0),S=t.useRef(0),y=t.useRef(0),D=t.useRef(null),I=t.useRef(!0),w=t.useRef(null),T=V(e=>e.pendingDiagramFile);t.useEffect(()=>(I.current=!0,()=>{I.current=!1}),[]);const i=t.useCallback((e,n,s)=>I.current&&v.current===e&&G()===n&&w.current===s,[]),K=t.useCallback(async e=>{const n=v.current+1;v.current=n;const s=G(),u=l?.readFile;S.current+=1,y.current+=1,E(!0),k(e),w.current=e,h(null),p(!1),P(!1),F(!1);try{const r=await u?.(e);if(!i(n,s,e))return;if(!r){d.error("Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}C.current=r.content,R(r.content),g.current=r.revision}catch(r){if(!i(n,s,e))return;d.error(r instanceof Error?r.message:"Failed to read file"),k(null),w.current=null,C.current="",R(""),g.current=void 0,E(!1);return}finally{i(n,s,e)&&E(!1)}},[l,i]);t.useEffect(()=>ee(()=>{if(v.current+=1,g.current=void 0,S.current+=1,y.current+=1,!I.current)return;h(null),p(!1),P(!1),F(!1);const e=w.current;e&&K(e)}),[K]),t.useEffect(()=>{if(!T)return;const e=V.getState().consumePendingDiagramFile();e&&K(e)},[K,T]);const X=t.useCallback(async(e,n,s,u,r,o)=>{let a=null,f=s,B=u;try{if(B){const N=await l?.readFile?.(e);if(!i(r,o,e))return;N&&(a=N.content??null,typeof N.revision=="string"&&(f=N.revision),B=N.exists!==!1)}}catch{if(!i(r,o,e))return}i(r,o,e)&&(h({path:e,displayPath:se(e),exists:B,currentRevision:f,currentContent:a,dirtyContent:n,runtimeKey:o}),p(!1))},[l,i]),z=t.useCallback(async(e,n,s,u,r)=>{const o=await l?.writeFile?.(e,n,te(g.current,s?!0:void 0));return i(u,r,e)?{stale:!1,success:!!o?.success,revision:o?.revision}:{stale:!0}},[l,i]),O=t.useCallback((e,n)=>{C.current=e,typeof n<"u"&&(g.current=n),D.current?.getXml()===e&&R(e)},[]),J=t.useCallback(async()=>{const e=D.current?.getXml();if(!x||!l?.writeFile||!e||e===C.current||j||m)return;const n=v.current,s=G(),u=x,r=e,o=S.current+1;S.current=o,P(!0);try{const a=await z(u,r,!1,n,s);if(a.stale)return;if(!a.success){d.error("Failed to write file");return}O(r,a.revision)}catch(a){if(!i(n,s,u))return;if(W(a)){await X(u,r,a.currentRevision??null,a.exists,n,s);return}d.error(a instanceof Error?a.message:"Save failed")}finally{S.current===o&&P(!1)}},[O,x,l,i,m,j,X,z]),Q=t.useCallback(async()=>{const e=b;if(!e||m||!i(v.current,e.runtimeKey,e.path))return;const n=v.current,s=e.runtimeKey;if(!e.exists){k(null),w.current=null,C.current="",R(""),g.current=void 0,h(null),p(!1);return}const u=y.current+1;y.current=u,F(!0);try{const r=await l?.readFile?.(e.path);if(!i(n,s,e.path))return;if(!r){d.error("Failed to read file");return}C.current=r.content??"",R(r.content??""),g.current=r.revision,H(o=>o+1),h(null),p(!1)}catch(r){if(!i(n,s,e.path))return;d.error(r instanceof Error?r.message:"Failed to read file")}finally{y.current===u&&F(!1)}},[l,i,m,b]),Y=t.useCallback(async()=>{const e=b;if(!e||m||!i(v.current,e.runtimeKey,e.path))return;const n=v.current,s=e.runtimeKey;if(!l?.writeFile){d.error("Saving not supported");return}const o=D.current?.getXml()??e.dirtyContent;if(!o){d.error("Failed to write file");return}const a=y.current+1;y.current=a,F(!0);try{const f=await z(e.path,o,!0,n,s);if(f.stale)return;if(!f.success){d.error("Failed to write file");return}O(o,f.revision),h(null),p(!1)}catch(f){if(!i(n,s,e.path))return;if(W(f)){await X(e.path,o,f.currentRevision??e.currentRevision,f.exists,n,s);return}d.error(f instanceof Error?f.message:"Save failed")}finally{y.current===a&&F(!1)}},[O,l,i,m,X,z,b]),Z=t.useCallback(()=>{m||j||(h(null),p(!1))},[m,j]),_=x?x.split("/").pop()||x:"";return x?M?c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx(A,{name:"loader-4",className:"size-4 animate-spin"})}):c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 px-3 py-1.5",children:[c.jsx(A,{name:"file",className:"size-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"typography-ui text-muted-foreground truncate flex-1",children:_}),c.jsx("button",{type:"button",onClick:()=>{J()},className:"size-6 flex items-center justify-center rounded-md text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Save diagram",children:c.jsx(A,{name:"save-3",className:"size-4"})}),c.jsx("button",{type:"button",onClick:()=>V.getState().setActiveMainTab("chat"),className:"size-6 flex items-center justify-center rounded-md text-muted-foreground hover:bg-interactive-hover/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",title:"Close diagram view",children:c.jsx(A,{name:"close",className:"size-4"})})]}),c.jsx("div",{className:"flex-1 min-h-0",children:c.jsx(re,{ref:D,xml:L,className:"h-full"},q)}),c.jsx(ne,{open:!!b,conflict:b,isResolving:m||j,showCompare:U,onToggleCompare:()=>p(e=>!e),onReload:()=>{Q()},onOverwrite:()=>{Y()},onClose:Z})]}):c.jsx("div",{className:"flex h-full items-center justify-center p-3",children:c.jsx("div",{className:"typography-ui text-muted-foreground",children:"Pick a file from the tree."})})}export{ye as DiagramView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n,aH as St}from"./vendor-boot-DyL2td56.js";import{R as r}from"./vendor-react-DASdDPIk.js";import{o as se,t as Q,a as Ze,C as ze}from"./index-
|
|
1
|
+
import{j as n,aH as St}from"./vendor-boot-DyL2td56.js";import{R as r}from"./vendor-react-DASdDPIk.js";import{o as se,t as Q,a as Ze,C as ze}from"./index-Dd2OcIUY.js";import{dN as vt,dv as Ct,dL as jt,aj as et,a7 as tt,ck as Nt,cl as Ne,B as Le,I as J,p as nt,aD as oe,t as st,dD as it,ce as Lt,dO as Dt,dP as kt,n as Rt,a4 as Et,ay as At,ah as Tt,cF as Mt,f as It,at as $t,aM as Pt,a9 as _t,aa as Wt,ac as Bt}from"./useAppFontEffects--lKKtKVo.js";import{d as rt,i as Ge,a as He,b as Ot,C as zt}from"./gitStatusPredicates-BvzxqidP.js";import{p as Gt}from"./VirtualizedFileDiff-CUWx7JVZ.js";import{P as Ht}from"./PierreDiffViewer-0X__nypk.js";import{v as Ut,g as Vt}from"./contextFileOpenGuard-PoBklHMz.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-B1GRkkKC.js";import"./web-components-v9fuidaX.js";import"./computeVirtualFileMetrics-3PpRLd5B.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./themeResolver-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./renderDiffWithHighlighter-l8hZWWBO.js";import"./vendor-diff-C3JhlQdm.js";import"./runtimeEndpointReset-CmI6dBKM.js";import"./SessionUnreadDot-CJFawQpo.js";/* empty css */import"./permissionStore-B9Hkrqny.js";import"./appThemeRegistry-gegrE2dq.js";import"./registerCustomTheme-DmolaWWZ.js";function Kt(t,s=10){const e=[];let i;for(const l of t.split(`
|
|
2
2
|
`)){const p=l.match(vt);if(p!=null){i!=null&&(i.hunkLines.length>0&&(Re(i,s,"trailing"),Ie(i,e)),i=void 0);const u=parseInt(p[3]),b=parseInt(p[1]),g=parseInt(p[4]??"1"),c=parseInt(p[2]??"1");isNaN(u)||isNaN(b)||isNaN(g)||isNaN(c)?e.push(l):i={additionStart:u,deletionStart:b,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(i==null){e.push(l);continue}if(l.startsWith(" "))i.contextLines.push(l);else if(l!==""){if(i.hunkLines.length>0&&i.contextLines.length>s*2){const u=i.contextLines.length-s*2,b=i.contextLines.slice(-s);Re(i,s,"trailing");const{additionCount:g,deletionCount:c}=i;Ie(i,e),i={additionStart:i.additionStart+g+u,deletionStart:i.deletionStart+c+u,deletionCount:0,additionCount:0,contextLines:b,hunkLines:[]}}Re(i,s,i.hunkLines.length===0?"leading":"before-change"),i.hunkLines.push(l),l.startsWith("+")?i.additionCount+=1:l.startsWith("-")&&(i.deletionCount+=1)}}i!=null&&i.hunkLines.length>0&&(Re(i,s,"trailing"),Ie(i,e));const a=e.join(`
|
|
3
3
|
`);return t.endsWith(`
|
|
4
4
|
`)?`${a}
|
package/dist/assets/{FileSaveConflictDialog-u5L4k_5k.js → FileSaveConflictDialog-BRM9TJo0.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as r}from"./vendor-boot-DyL2td56.js";import{R as a}from"./vendor-react-DASdDPIk.js";import{D}from"./vendor-react-drawio-Duu5LgQA.js";import{o as C}from"./index-
|
|
1
|
+
import{j as r}from"./vendor-boot-DyL2td56.js";import{R as a}from"./vendor-react-DASdDPIk.js";import{D}from"./vendor-react-drawio-Duu5LgQA.js";import{o as C}from"./index-Dd2OcIUY.js";import{ak as E,al as S,am as N,an as B,ao as F,ap as H,B as p}from"./useAppFontEffects--lKKtKVo.js";const A='<mxfile><diagram id="new" name="Page-1"><mxGraphModel dx="0" dy="0" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel></diagram></mxfile>';function w(){if(typeof document>"u")return!1;const t=document.documentElement.getAttribute("data-theme");return t==="dark"||!t&&window.matchMedia("(prefers-color-scheme: dark)").matches}const T=a.forwardRef(function({xml:e,readOnly:o,className:d,onChange:u},m){const l=a.useRef(e),c=a.useRef(null),i=a.useRef(!1),[s,y]=a.useState(w),f=a.useRef(e),h=a.useRef(e);h.current!==e&&(h.current=e,f.current=e,l.current=e);const v=a.useRef(s);v.current!==s&&(v.current=s,f.current=l.current);const g=a.useRef(null);a.useEffect(()=>{const n=()=>y(w());n();const x=new MutationObserver(n);return x.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>x.disconnect()},[]),a.useEffect(()=>{const n=setTimeout(()=>{g.current?.querySelector(".diagrams-iframe")?.focus()},600);return()=>clearTimeout(n)},[]),a.useImperativeHandle(m,()=>({getXml:()=>l.current}));const R=a.useCallback(()=>{!e&&!i.current&&(i.current=!0,setTimeout(()=>{c.current?.template({})},500))},[e]),j=a.useCallback(n=>{l.current=n.xml,u?.(n.xml)},[u]);return r.jsx("div",{ref:g,className:C("h-full w-full",d),children:r.jsx(D,{ref:c,xml:f.current||A,autosave:!0,urlParameters:{ui:o?"simple":s?"dark":"kennedy",spin:!0,libraries:!o,chrome:o,nav:o,layers:o,noSaveBtn:!0,noExitBtn:!0,saveAndExit:!1},onLoad:R,onAutoSave:j},s?"dark":"light")})}),X=(t,e)=>!t||t.runtimeKey!==e.runtimeKey||t.root!==e.root||t.path!==e.path||t.generation!==e.generation,b=t=>{if(typeof t=="string")return t;if(t===null)return null},G=(t,e)=>{if(e===!0)return t!==void 0?{expectedRevision:b(t),overwrite:!0}:{overwrite:!0};if(t!==void 0)return{expectedRevision:b(t)}},W=(t,e)=>!!(t&&e&&t.runtimeKey===e.runtimeKey&&t.root===e.root&&t.path===e.path&&t.generation===e.generation),k=(t,e=4e3)=>t.length>e?`${t.slice(0,e)}
|
|
2
2
|
|
|
3
3
|
… truncated …`:t,Y=({open:t,conflict:e,isResolving:o,showCompare:d,onToggleCompare:u,onReload:m,onOverwrite:l,onClose:c})=>{if(!e)return null;const i=!e.exists;return r.jsx(E,{open:t,onOpenChange:s=>{s||c()},children:r.jsxs(S,{showCloseButton:!1,className:"max-w-lg",children:[r.jsxs(N,{children:[r.jsx(B,{children:i?"File deleted on disk":"File changed on disk"}),r.jsx(F,{children:i?`“${e.displayPath}” was deleted since you opened it. Your edits are preserved. Reload to discard them, or overwrite to recreate the file.`:`“${e.displayPath}” changed since you opened it. Your edits are preserved. Reload to discard them and load the current version, or overwrite to keep your edits.`})]}),d&&!i?r.jsxs("div",{className:"grid max-h-64 grid-cols-1 gap-2 overflow-auto py-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"typography-meta text-muted-foreground",children:"Current version on disk"}),r.jsx("pre",{className:"mt-1 max-h-28 overflow-auto rounded-md bg-[var(--surface-subtle)] p-2 text-xs whitespace-pre-wrap break-words",children:k(e.currentContent??"")})]}),r.jsxs("div",{children:[r.jsx("div",{className:"typography-meta text-muted-foreground",children:"Your edits"}),r.jsx("pre",{className:"mt-1 max-h-28 overflow-auto rounded-md bg-[var(--surface-subtle)] p-2 text-xs whitespace-pre-wrap break-words",children:k(e.dirtyContent)})]})]}):null,r.jsxs(H,{className:"flex flex-wrap gap-2",children:[i?null:r.jsx(p,{variant:"outline",onClick:u,disabled:o,"aria-label":d?"Hide version comparison":"Compare versions",title:d?"Hide version comparison":"Compare versions",children:d?"Hide compare":"Compare"}),r.jsx(p,{variant:"outline",onClick:m,disabled:o,"aria-label":i?"Discard edits and close":"Reload current version",title:i?"Discard edits and close":"Reload current version",children:i?"Discard edits":"Reload"}),r.jsx(p,{variant:"destructive",onClick:l,disabled:o,"aria-label":i?"Recreate file with my edits":"Overwrite with my edits",title:i?"Recreate file with my edits":"Overwrite with my edits",children:o?"Working…":"Overwrite"})]})]})})};export{T as D,Y as F,G as b,W as i,X as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ad as bo,c6 as Nt,c7 as Mn,x as c,ab as pa,J as me,c8 as wo,c9 as yo,H as ha,G as nn,ai as ga,S as ko,aj as Pn,j as t,ae as jo,c0 as Co,a9 as No,ca as So,c3 as st,cb as Er,b$ as Ro,C as Fo,L as kn,cc as Eo,cd as zo,c2 as Mo,aH as To,ce as Do,W as Ao,F as Oo}from"./vendor-boot-DyL2td56.js";import{R as s,a as y}from"./vendor-react-DASdDPIk.js";import{o as J,G as Po,h as Lo,bT as Io,E as Bo,bU as $o,t as Fe,bV as xa,J as Re,a as Vo,A as Wo,K as _o,bW as Ct,H as Ko,I as qo,Z as zr,bX as Ho,ad as Mr,m as Tr,F as jn,ay as Go}from"./index-6IO1AcJI.js";import{ch as Uo,a7 as xt,B as q,I as F,ai as Et,ci as Jo,ak as va,al as ba,am as wa,an as ya,ao as ka,ap as ja,a8 as Ln,ab as In,ad as Bn,ae as Zt,t as pe,af as Qt,ag as Xo,cj as en,aj as Ca,E as Dr,b2 as Yo,ck as Na,cl as Sa,cm as Ra,cn as Fa,co as Tn,cp as Zo,a9 as Xe,aa as Ye,ac as Ze,p as Qo,aq as ei,a4 as ti,n as ni,ah as ri,cq as Ar,ar as Or,aM as ai,cr as Pr}from"./useAppFontEffects-CG3_yteE.js";import{javascript as ht}from"./vendor-codemirror-lang-javascript-DpTUrvx8.js";import{json as Ea}from"./vendor-codemirror-lang-json-CLGxdOCz.js";import{css as za}from"./vendor-codemirror-lang-css-Dwf2XpnZ.js";import{html as Dn}from"./vendor-codemirror-lang-html-DcKqyeGk.js";import{markdown as Ma}from"./vendor-codemirror-lang-markdown-DmFP9s6x.js";import{l as Ta}from"./vendor-codemirror-language-data-DglcKYWT.js";import{python as Da}from"./vendor-codemirror-lang-python-yuxIkjit.js";import{shell as si}from"./shell-CjFT_Tl9.js";import{ensurePierreThemeRegistered as Lr,getResolvedShikiTheme as oi}from"./appThemeRegistry-gegrE2dq.js";import{D as ii,i as Aa,b as Oa,s as ci,F as li}from"./FileSaveConflictDialog-u5L4k_5k.js";import{h as Ir,x as ui,y as di,z as fi,B as mi,E as pi,O as Xt}from"./runtimeEndpointReset-CzJfovWI.js";import{h as An,i as Pa,j as La}from"./SessionUnreadDot-CELKNVIM.js";import{g as St,c as Ia,d as Ba,e as $n,n as hi,f as gi,M as Rt,h as oe,j as xi,s as vi,i as bi,a as wi,t as Yt,k as Cn,b as yi,l as ki,u as ji,m as Br,o as Ci,p as $r}from"./useFilesViewSearch-C_LzYIgD.js";import{J as Ni,F as Si}from"./JsonTreeView-DSuC4naV.js";import{a as Vr,g as tn,b as Wr,c as _r,o as Ri,d as Fi}from"./vendor-codemirror-search-DaE6R5gH.js";import{v as Ei,g as zi}from"./vendor-replit-codemirror-vim-CZy3BUVv.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-DW_Ia4q3.js";import"./vendor-lezer-javascript-oje4tdp_.js";import"./vendor-lezer-lr-BU2qmu_5.js";import"./vendor-codemirror-autocomplete-DsFn4GLp.js";import"./vendor-lezer-json-BRXb_bDX.js";import"./vendor-lezer-css-DNU_fzPI.js";import"./vendor-lezer-html-DDGRhRUz.js";import"./vendor-lezer-markdown-CicYv7V9.js";import"./vendor-lezer-python-Cuvm9X9Y.js";import"./registerCustomTheme-DmolaWWZ.js";import"./themeResolver-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-react-drawio-Duu5LgQA.js";/* empty css */import"./permissionStore-B9Hkrqny.js";import"./web-components-CH3-XV-n.js";import"./computeVirtualFileMetrics-CeMpF2xC.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./Virtualizer-wpC51ZBQ.js";import"./renderFileWithHighlighter-TpKRyfCY.js";const On=bo.define(si);function Mi(e){const n=e.trim().toLowerCase();switch(n){case"bash":case"sh":case"zsh":case"shell":case"shellsession":case"console":return On;case"json":case"jsonc":case"json5":return Ea().language;case"js":case"javascript":return ht().language;case"jsx":return ht({jsx:!0}).language;case"ts":case"typescript":return ht({typescript:!0}).language;case"tsx":return ht({typescript:!0,jsx:!0}).language;case"html":return Dn().language;case"css":return za().language;case"py":case"python":return Da().language;case"md":case"markdown":case"mdown":case"mkd":return Ma().language;case"heex":case"eex":case"leex":return Dn().language;default:return pa.matchLanguageName(Ta,n,!0)}}const $a=e=>e.split("/").pop()?.toLowerCase()??"",Ti=e=>{const n=$a(e);return n?pa.matchFilename(Ta,n):null},Di=()=>Nt(Mn.define([{tag:[c.heading1,c.heading2,c.heading3,c.heading4,c.heading5,c.heading6],fontWeight:"600"},{tag:c.strong,fontWeight:"600"},{tag:c.emphasis,fontStyle:"italic"},{tag:c.strikethrough,textDecoration:"line-through"},{tag:[c.link,c.url],color:"var(--markdown-link, currentColor)",textDecoration:"underline"},{tag:c.monospace,color:"var(--markdown-inline-code, currentColor)",backgroundColor:"var(--markdown-inline-code-bg, transparent)"},{tag:c.quote,color:"var(--markdown-blockquote, currentColor)",fontStyle:"italic"},{tag:c.list,color:"color-mix(in srgb, var(--muted-foreground) 40%, var(--foreground) 60%)"},{tag:c.heading,color:"var(--markdown-heading1, currentColor)"}]));function Ai(e){const n=e.toLowerCase();switch($a(n)){case"makefile":case"gnumakefile":return On}const i=n.lastIndexOf("."),o=i>=0?n.slice(i+1):"";switch(o){case"ts":case"tsx":case"mts":case"cts":return ht({typescript:!0,jsx:o==="tsx"});case"js":case"jsx":case"mjs":case"cjs":return ht({typescript:!1,jsx:o==="jsx"});case"json":case"jsonc":case"json5":case"jsonl":case"ndjson":case"geojson":return Ea();case"css":case"scss":case"sass":case"less":return za();case"html":case"htm":case"xml":case"drawio":case"dio":return Dn();case"md":case"mdx":case"markdown":case"mdown":case"mkd":return[Ma({codeLanguages:Mi}),Di()];case"sh":case"bash":case"zsh":case"fish":case"env":return On;case"py":case"pyw":case"pyi":return Da();default:return null}}async function Oi(e){const n=Ti(e);if(!n)return null;if(n.support)return n.support;try{return await n.load()}catch{return null}}function Kr(e,n){const a=e.metadata.variant==="dark",i=e.config?.fonts?.mono||"monospace",o=e.colors.syntax.highlights||{},u=e.colors.syntax.tokens||{},f=n?.fontSize?`${n.fontSize}px`:"var(--text-code)",m=me.theme({"&":{backgroundColor:"var(--background)",color:e.colors.syntax.base.foreground,fontSize:f,lineHeight:"1.5",position:"relative"},".cm-scroller":{fontFamily:i,backgroundColor:"var(--background)"},".cm-comment":{color:e.colors.syntax.base.comment},".cm-keyword":{color:e.colors.syntax.base.keyword},".cm-string":{color:e.colors.syntax.base.string},".cm-string-2":{color:u.stringEscape||e.colors.syntax.base.string},".cm-number":{color:e.colors.syntax.base.number},".cm-operator":{color:e.colors.syntax.base.operator},".cm-punctuation":{color:u.punctuation||e.colors.syntax.base.comment},".cm-atom":{color:u.boolean||e.colors.syntax.base.number},".cm-builtin":{color:u.functionCall||e.colors.syntax.base.function},".cm-def":{color:u.variableGlobal||e.colors.syntax.base.variable},".cm-attribute":{color:u.variableOther||u.variableProperty||e.colors.syntax.base.operator},".cm-meta":{color:e.colors.syntax.base.comment},".cm-property":{color:u.variableProperty||e.colors.syntax.base.keyword},".cm-variable":{color:e.colors.syntax.base.variable},".cm-variable-2":{color:u.variableOther||e.colors.syntax.base.function},".cm-variable-3":{color:u.variableGlobal||e.colors.syntax.base.type},".cm-tag":{color:u.tag||e.colors.syntax.base.keyword},".cm-link":{color:u.url||e.colors.syntax.base.keyword,textDecoration:"underline"},".cm-content":{caretColor:e.colors.interactive.cursor},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.colors.interactive.cursor},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:e.colors.interactive.selection},".cm-gutters":{backgroundColor:"var(--background)",color:o.lineNumber||e.colors.syntax.base.comment,borderRight:`1px solid ${e.colors.interactive.border}`,position:"sticky",paddingRight:"8px",left:0,zIndex:2,boxShadow:"0 0 0 var(--background)"},".cm-gutter":{backgroundColor:"var(--background)"},".cm-gutterElement":{backgroundColor:"var(--background)"},".cm-lineNumbers":{backgroundColor:"var(--background)"},".cm-lineNumbers .cm-gutterElement":{paddingLeft:"8px",paddingRight:"8px",minWidth:"42px"},".cm-activeLineGutter":{color:o.lineNumberActive||e.colors.syntax.base.foreground},".cm-activeLine":{backgroundColor:e.colors.surface.overlay},".cm-panels":{backgroundColor:"transparent",color:e.colors.surface.foreground,position:"absolute",top:"0",right:"0",left:"auto",width:"auto",zIndex:10,pointerEvents:"none"},".cm-panels-top":{borderBottom:"none",position:"absolute",top:"6px",right:"14px",left:"auto",width:"auto"},".cm-panels-bottom":{position:"static",width:"100%",pointerEvents:"auto"},".cm-panels-bottom .cm-vim-panel":{borderTop:`1px solid ${e.colors.interactive.border}`,backgroundColor:e.colors.surface.elevated,color:e.colors.surface.mutedForeground,fontFamily:"var(--font-mono)",fontSize:"12px",minHeight:"22px",padding:"2px 8px"},".cm-panel.cm-search":{pointerEvents:"auto",padding:"4px",backgroundColor:`color-mix(in srgb, ${e.colors.surface.elevated} 85%, transparent)`,border:`1px solid ${e.colors.interactive.border}`,borderRadius:"10px",boxShadow:`0 2px 8px color-mix(in srgb, ${e.colors.surface.background} 60%, transparent)`,width:"auto",minWidth:"360px",maxWidth:"480px"},".cm-search":{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0",width:"100%",color:e.colors.surface.foreground,fontFamily:"inherit",fontSize:"13px",lineHeight:"1"},".cm-search br":{display:"none"},".cm-search .cm-textfield":{appearance:"none",height:"26px",margin:0,padding:"0 8px",borderRadius:"6px !important",border:`1px solid ${e.colors.interactive.border}`,backgroundColor:e.colors.surface.background,color:e.colors.surface.foreground,fontFamily:"inherit",fontSize:"12px",lineHeight:"1",outline:"none",transition:"border-color 150ms ease"},".cm-search .cm-textfield::placeholder":{color:e.colors.surface.mutedForeground,opacity:1},".cm-search .cm-textfield:focus":{borderColor:e.colors.primary.base},'.cm-search .cm-textfield[name="search"]':{order:1,flex:"1 1 120px",maxWidth:"calc(100% - 142px)",minWidth:"100px"},".cm-search label":{order:2,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",minWidth:"26px",flexShrink:"0",margin:0,marginLeft:"1px",padding:0,borderRadius:"4px",border:"1px solid transparent",backgroundColor:"transparent",color:"transparent",cursor:"pointer",userSelect:"none",fontSize:"1px",lineHeight:"0",overflow:"hidden",position:"relative",transition:"background-color 120ms ease, border-color 120ms ease"},".cm-search label:hover":{backgroundColor:e.colors.interactive.hover},'.cm-search label:has(input[type="checkbox"]:checked)':{backgroundColor:e.colors.interactive.hover,borderColor:e.colors.interactive.border},'.cm-search [type="checkbox"]':{appearance:"none",WebkitAppearance:"none",width:"0",height:"0",margin:"0",padding:"0",border:"none",position:"absolute",opacity:"0",pointerEvents:"none"},".cm-search label::after":{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"13px",fontWeight:"600",lineHeight:"1",fontFamily:"inherit",color:e.colors.surface.mutedForeground,pointerEvents:"none"},".cm-search label:hover::after":{color:e.colors.surface.foreground},'.cm-search label:has(input[type="checkbox"]:checked)::after':{color:e.colors.surface.foreground},'.cm-search label:has(input[name="case"])::after':{content:'"Aa"',fontSize:"12px",letterSpacing:"-0.5px"},'.cm-search label:has(input[name="re"])::after':{content:'".*"',fontSize:"13px",fontFamily:"monospace"},'.cm-search label:has(input[name="word"])::after':{content:'"ab"',fontSize:"12px",textDecoration:"underline",textUnderlineOffset:"2px"},".cm-search .cm-search-message":{order:3,color:e.colors.surface.mutedForeground,backgroundColor:"transparent",border:"none",borderRadius:"0",padding:"0 6px",fontSize:"11px",whiteSpace:"nowrap",lineHeight:"26px"},".cm-search .cm-button":{appearance:"none",WebkitAppearance:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",minWidth:"26px",flexShrink:"0",margin:0,marginLeft:"1px",padding:0,borderRadius:"4px",border:"none",backgroundColor:"transparent",backgroundImage:"none",color:"transparent",cursor:"pointer",fontSize:"1px",fontWeight:"400",lineHeight:"0",overflow:"hidden",position:"relative",boxShadow:"none",transition:"background-color 120ms ease"},".cm-search .cm-button::after":{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"15px",lineHeight:"1",color:e.colors.surface.mutedForeground,pointerEvents:"none"},".cm-search .cm-button:hover":{backgroundColor:e.colors.interactive.hover},".cm-search .cm-button:hover::after":{color:e.colors.surface.foreground},".cm-search .cm-button:active":{backgroundColor:e.colors.interactive.active},".cm-search .cm-button:focus-visible":{outline:"none",boxShadow:`0 0 0 1px ${e.colors.interactive.focusRing}`},".cm-search .cm-button:disabled":{opacity:.4,cursor:"default",pointerEvents:"none"},'.cm-search .cm-button[name="prev"]':{order:21,marginTop:"2px"},'.cm-search .cm-button[name="prev"]::after':{content:'"↑"'},'.cm-search .cm-button[name="next"]':{order:22,marginTop:"2px"},'.cm-search .cm-button[name="next"]::after':{content:'"↓"'},'.cm-search .cm-button[name="select"]':{order:23,marginTop:"2px"},'.cm-search .cm-button[name="select"]::after':{content:'"≡"',fontSize:"17px"},'.cm-panel.cm-search button[name="close"]':{order:5,appearance:"none",WebkitAppearance:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",minWidth:"26px",flexShrink:"0",margin:"0 0 0 auto",padding:"0",borderRadius:"4px",border:"none",backgroundColor:"transparent",backgroundImage:"none",color:e.colors.surface.mutedForeground,cursor:"pointer",fontSize:"16px",lineHeight:"1",boxShadow:"none",position:"relative",overflow:"visible",transition:"background-color 120ms ease, color 120ms ease"},'.cm-panel.cm-search button[name="close"]:hover':{backgroundColor:e.colors.interactive.hover,color:e.colors.surface.foreground},'.cm-search .cm-button[name="replace"]':{order:24,marginTop:"2px"},'.cm-search .cm-button[name="replace"]::after':{content:'"⇄"'},'.cm-search .cm-button[name="replaceAll"], .cm-search .cm-button[name="replace-all"]':{order:25,marginTop:"2px"},'.cm-search .cm-button[name="replaceAll"]::after, .cm-search .cm-button[name="replace-all"]::after':{content:'"⇉"'},'.cm-search .cm-textfield[name="replace"]':{order:20,flex:"1 1 100%",maxWidth:"calc(100% - 142px)",minWidth:"80px",marginTop:"2px"},".cm-searchMatch":{backgroundColor:e.colors.status.infoBackground,boxShadow:`inset 0 0 0 1px ${e.colors.status.infoBorder}`,borderRadius:"2px"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:e.colors.interactive.selection,color:e.colors.interactive.selectionForeground,boxShadow:`inset 0 0 0 1px ${e.colors.interactive.borderFocus}`},"&.cm-focused":{outline:"none"}},{dark:a}),g=Mn.define([{tag:[c.comment,c.docComment,c.meta,c.documentMeta],class:"cm-comment"},{tag:[c.keyword,c.controlKeyword,c.moduleKeyword,c.definitionKeyword,c.modifier],class:"cm-keyword"},{tag:[c.operatorKeyword,c.operator,c.derefOperator,c.updateOperator,c.definitionOperator,c.typeOperator,c.controlOperator,c.logicOperator,c.bitwiseOperator,c.arithmeticOperator,c.compareOperator],class:"cm-operator"},{tag:[c.punctuation,c.separator,c.bracket,c.paren,c.brace,c.squareBracket,c.angleBracket],class:"cm-punctuation"},{tag:[c.string,c.regexp,c.attributeValue,c.special(c.string),c.monospace],class:"cm-string"},{tag:c.escape,class:"cm-string-2"},{tag:[c.number,c.bool,c.atom,c.null,c.self],class:"cm-number"},{tag:[c.function(c.variableName),c.function(c.definition(c.variableName)),c.function(c.propertyName),c.standard(c.variableName),c.special(c.variableName)],class:"cm-builtin"},{tag:c.definition(c.variableName),class:"cm-def"},{tag:[c.variableName,c.local(c.variableName),c.constant(c.variableName),c.literal],class:"cm-variable"},{tag:c.propertyName,class:"cm-property"},{tag:c.attributeName,class:"cm-attribute"},{tag:[c.className,c.typeName,c.namespace],class:"cm-variable-3"},{tag:[c.tagName,c.labelName,c.annotation,c.macroName],class:"cm-tag"},{tag:c.link,class:"cm-link"},{tag:[c.heading,c.heading1,c.heading2,c.heading3,c.heading4,c.heading5,c.heading6],class:"cm-keyword"}]),w=Mn.define([{tag:[c.comment,c.docComment,c.meta,c.documentMeta],color:e.colors.syntax.base.comment},{tag:[c.keyword,c.controlKeyword,c.moduleKeyword,c.definitionKeyword,c.modifier],color:e.colors.syntax.base.keyword},{tag:[c.operatorKeyword,c.operator,c.derefOperator,c.updateOperator,c.definitionOperator,c.typeOperator,c.controlOperator,c.logicOperator,c.bitwiseOperator,c.arithmeticOperator,c.compareOperator],color:e.colors.syntax.base.operator},{tag:[c.string,c.regexp,c.attributeValue,c.special(c.string),c.monospace],color:e.colors.syntax.base.string},{tag:c.escape,color:u.stringEscape||e.colors.syntax.base.string},{tag:[c.number,c.bool,c.atom,c.null,c.self],color:e.colors.syntax.base.number},{tag:[c.function(c.variableName),c.function(c.definition(c.variableName)),c.function(c.propertyName),c.standard(c.variableName),c.special(c.variableName)],color:e.colors.syntax.base.function},{tag:c.definition(c.variableName),color:u.variableGlobal||e.colors.syntax.base.variable},{tag:[c.variableName,c.local(c.variableName),c.constant(c.variableName),c.literal],color:e.colors.syntax.base.variable},{tag:c.propertyName,color:u.variableProperty||e.colors.syntax.base.variable},{tag:c.attributeName,color:u.variableOther||e.colors.syntax.base.variable},{tag:[c.className,c.typeName,c.namespace],color:e.colors.syntax.base.type},{tag:[c.tagName,c.labelName,c.annotation,c.macroName],color:u.tag||e.colors.syntax.base.keyword},{tag:c.link,color:u.url||e.colors.syntax.base.function,textDecoration:"underline"},{tag:[c.punctuation,c.separator,c.bracket,c.paren,c.brace,c.squareBracket,c.angleBracket],color:u.punctuation||e.colors.syntax.base.comment}]);return n?.syntaxColors===!1?[m]:[m,Nt(wo,{fallback:!0}),Nt(yo),Nt(g),Nt(w)]}const Pi=180,Va=ko.define(),Li=1,Ii=2,Bi=4,qr=new Map,$i=(e,n)=>{const a=`${e}|${n}`,i=qr.get(a);if(i)return i;let o="";e&&(o+=`color:${e};`),n&Li&&(o+="font-style:italic;"),n&Ii&&(o+="font-weight:bold;"),n&Bi&&(o+="text-decoration:underline;");const u=nn.mark({attributes:{style:o}});return qr.set(a,u),u},Vi=(e,n)=>{const a=new Pn,i=e.state.doc,o=Math.min(n.length,i.lines);for(let u=0;u<o;u+=1){const f=n[u];if(!f||f.length===0)continue;const m=i.line(u+1);let g=m.from;for(const[w,N,x]of f){if(w<=0)continue;const b=g,j=Math.min(g+w,m.to);g+=w,!(j<=b)&&(!N&&!x||a.add(b,j,$i(N,x)))}}return a.finish()},Wi=ha.define({create(){return nn.none},update(e,n){let a=e.map(n.changes);for(const i of n.effects)i.is(Va)&&(a=i.value);return a},provide:e=>me.decorations.from(e)}),_i=e=>ga.fromClass(class{timer;generation=0;constructor(n){this.tokenize(n)}update(n){n.docChanged&&this.schedule(n.view)}schedule(n){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.tokenize(n)},Pi)}async tokenize(n){const a=++this.generation,i=n.state.doc.toString(),o=await Uo(i,e.language,e.themeName,e.theme);o&&a===this.generation&&n.state.doc.length===i.length&&n.dispatch({effects:Va.of(Vi(n,o))})}destroy(){this.timer&&clearTimeout(this.timer)}}),Ki=e=>[Wi,_i(e)],Ke=e=>(e||"").replace(/\\/g,"/").replace(/\/+$/g,""),gt=e=>{const n=Ke(e);return!n||n==="/"?n||"/":n.split("/").filter(Boolean).at(-1)??n},Wa=e=>{const n=Ke(e);if(!n||n==="/")return null;const a=n.lastIndexOf("/");if(a<0)return null;if(a===0)return"/";const i=n.slice(0,a);return/^[A-Za-z]:$/.test(i)?`${i}/`:i},Hr=(e,n)=>{const a=Ke(e),i=Ke(n);return!a||!i?!1:a===i||a.startsWith(`${i}/`)},Gr=(e,n)=>{const a=Ke(e);if(!a)return Ke(n);if(a.startsWith("/")||/^[A-Za-z]:(\/|$)/.test(a))return a;const i=Ke(n);return i?`${i}/${a}`:a},qi=(e,n)=>{const a=Ke(e),i=Ke(n);if(!a||a===i)return!1;const o=Wa(a);return o?i&&Hr(a,i)?Hr(o,i):!0:!1},Hi=e=>{if(typeof e!="number"||!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;const n=["KB","MB","GB"];let a=e/1024;for(const i of n){if(a<1024||i===n[n.length-1])return`${a.toFixed(a>=10?0:1)} ${i}`;a/=1024}return""},Gi=(e,n)=>!n||e===n?gt(e):e.startsWith(`${n}/`)?e.slice(n.length+1):e,Ui=({root:e,directory:n,entries:a,query:i,searchResults:o,isSearching:u,directoryError:f,refreshing:m,editorPath:g,editor:w,onClose:N,onQueryChange:x,onOpenDirectory:b,onOpenFile:j,onBackFromEditor:C,onRefresh:v})=>{if(!e)return t.jsx(Ft,{message:"Select a project to browse files."});if(g)return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsx(Ir,{leading:t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":"Back",onClick:C,style:{touchAction:"manipulation"},children:t.jsx(F,{name:"arrow-left",className:"size-4"})}),icon:t.jsx(xt,{filePath:g,className:"size-4 shrink-0"}),title:gt(g)}),t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:w})]});const L=n===e?"Project files":gt(n),I=qi(n,e)?Wa(n):null,l=!!I&&!i.trim(),B=I===e?"Project files":gt(I??""),H=N||l&&I?t.jsxs(t.Fragment,{children:[N?t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":"Close",onClick:N,style:{touchAction:"manipulation"},children:t.jsx(F,{name:"close",className:"size-4"})}):null,l&&I?t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":`Back to ${gt(I)}`,onClick:()=>b(I),style:{touchAction:"manipulation"},children:t.jsx(F,{name:"arrow-left",className:"size-4"})}):null]}):void 0;return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsx(Ir,{leading:H,icon:n===e?"file-text":"folder",title:L,actions:t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":"Refresh files",onClick:v,style:{touchAction:"manipulation"},children:t.jsx(F,{name:"refresh",className:J("size-4",m&&"animate-spin")})})}),t.jsx("div",{className:"shrink-0 px-3 py-2",children:t.jsxs("div",{className:"relative",children:[t.jsx(F,{name:"search",className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),t.jsx(Et,{value:i,onChange:D=>x(D.target.value),placeholder:"Search files",className:"h-8 pl-7"})]})}),t.jsx(Jo,{className:"min-h-0 w-full flex-1 overflow-y-auto pb-3",children:f?t.jsx(Ft,{message:f}):i.trim()?t.jsx(Ji,{root:e,results:o,isSearching:u,onOpenFile:j}):a===void 0?t.jsx(Ft,{loading:!0,message:"Loading..."}):t.jsxs("div",{className:"flex w-full min-w-0 flex-col px-1",children:[l&&I?t.jsxs("button",{type:"button",className:J(La,"px-2"),"aria-label":`Up one level to ${B}`,onClick:()=>b(I),style:{touchAction:"manipulation"},children:[t.jsx(F,{name:"arrow-left",className:J(An(!0),"text-muted-foreground")}),t.jsx("span",{className:J(Pa(!0),"flex-1 text-muted-foreground"),children:"Up one level"})]}):null,a.length===0?t.jsx("div",{className:"px-3 py-8 text-center typography-ui-label text-muted-foreground",children:"This directory is empty."}):null,a.map(D=>t.jsx(_a,{name:D.name,path:D.path,directory:D.type==="directory",meta:D.type==="directory"?void 0:Hi(D.size),onClick:()=>D.type==="directory"?b(Gr(D.path,n||e)):j(Gr(D.path,n||e))},D.path))]})})]})},_a=({name:e,path:n,directory:a,meta:i,onClick:o})=>t.jsxs("button",{type:"button",className:J(La,"px-2"),onClick:o,style:{touchAction:"manipulation"},children:[a?t.jsx(F,{name:"folder-3-fill",className:J(An(!0),"text-primary/80")}):t.jsx(xt,{filePath:n,className:An(!0)}),t.jsx("span",{className:J(Pa(!0),"flex-1 text-foreground"),children:e}),i?t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground",children:i}):null,a?t.jsx(F,{name:"arrow-right-s",className:"size-4 shrink-0 text-muted-foreground/60"}):null]}),Ji=({root:e,results:n,isSearching:a,onOpenFile:i})=>a?t.jsx(Ft,{loading:!0,message:"Loading..."}):n.length===0?t.jsx(Ft,{message:"No files found."}):t.jsx("div",{className:"flex w-full min-w-0 flex-col px-1",children:n.map(o=>t.jsx(_a,{name:gt(o.path),path:o.path,directory:!1,meta:o.relativePath??Gi(o.path,e),onClick:()=>i(o.path)},o.path))}),Ft=({message:e,loading:n=!1})=>t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[n?t.jsx(F,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):t.jsx(F,{name:"folder-open-fill",className:"size-6 text-muted-foreground"}),t.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:e})]})}),Xi=({activeDialog:e,dialogData:n,dialogInputValue:a,onDialogInputChange:i,isDialogSubmitting:o,onDialogSubmit:u,onClose:f,inputRef:m})=>t.jsx(va,{open:!!e,onOpenChange:g=>!g&&f(),children:t.jsxs(ba,{initialFocus:m,children:[t.jsxs(wa,{children:[t.jsxs(ya,{children:[e==="createFile"&&"Create File",e==="createFolder"&&"Create Folder",e==="rename"&&"Rename",e==="delete"&&"Delete"]}),t.jsxs(ka,{children:[e==="createFile"&&`Create a new file in ${n?.path??"root"}`,e==="createFolder"&&`Create a new folder in ${n?.path??"root"}`,e==="rename"&&`Rename ${n?.name??""}`,e==="delete"&&`Are you sure you want to delete ${n?.name??""}? This action cannot be undone.`]})]}),e!=="delete"&&t.jsx("div",{className:"py-4",children:t.jsx(Et,{value:a,onChange:g=>i(g.target.value),placeholder:e==="rename"?"New name":"Name",onKeyDown:g=>{g.key==="Enter"&&u()},ref:m})}),t.jsxs(ja,{children:[t.jsx(q,{variant:"outline",onClick:f,disabled:o,children:"Cancel"}),t.jsx(q,{variant:e==="delete"?"destructive":"default",onClick:()=>{u()},disabled:o||e!=="delete"&&!a.trim(),children:o?t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}):e==="delete"?"Delete":"Confirm"})]})]})}),Yi=({label:e,iconDataUrl:n})=>{const[a,i]=s.useState(!1),o=e.trim().slice(0,1).toUpperCase()||"?";return n&&!a?t.jsx("img",{src:n,alt:"",className:"size-4 rounded-sm",onError:()=>i(!0)}):t.jsx("span",{className:J("size-4 rounded-sm flex items-center justify-center","bg-[var(--surface-muted)] text-[9px] font-medium text-muted-foreground"),children:o})},Ka=({filePath:e,extension:n})=>t.jsx(xt,{filePath:e,extension:n}),Zi=({status:e})=>{const n={open:"var(--status-info)",modified:"var(--status-warning)","git-modified":"var(--status-warning)","git-added":"var(--status-success)","git-deleted":"var(--status-error)"}[e];return t.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:n}})},Ur=({name:e})=>{const n=s.useRef(null),a=s.useRef(null),[i,o]=s.useState(!1);return s.useLayoutEffect(()=>{const u=n.current,f=a.current;if(!u||!f)return;const m=()=>{o(f.scrollWidth>u.clientWidth+1)};m();const g=new ResizeObserver(m);return g.observe(u),g.observe(f),()=>{g.disconnect()}},[e]),t.jsxs("span",{ref:n,className:"relative block min-w-0 flex-1 overflow-hidden whitespace-nowrap",children:[t.jsx("span",{ref:a,"aria-hidden":"true",className:"invisible absolute whitespace-nowrap",children:e}),i?t.jsxs("span",{className:"open-file-name-marquee-track",children:[t.jsx("span",{className:"open-file-name-marquee-item",children:e}),t.jsx("span",{className:"open-file-name-marquee-item","aria-hidden":"true",children:e})]}):t.jsx("span",{className:"block min-w-0 truncate",children:e})]})},Qi=({node:e,root:n,isExpanded:a,isActive:i,isMobile:o,isBrowserClient:u,alwaysShowActions:f,status:m,badge:g,permissions:w,downloadFile:N,contextMenuPath:x,setContextMenuPath:b,rightClickMenuPath:j,setRightClickMenuPath:C,onSelect:v,onToggle:L,onRevealPath:I,onOpenDialog:l})=>{const B=e.type==="directory",{canRename:H,canCreateFile:D,canCreateFolder:$,canDelete:G,canReveal:_}=w,X=!B&&!!N,A=_&&!u,T=H||D||$||G||X||A,k=s.useCallback(d=>{T&&(d?.preventDefault(),C(e.path))},[T,e.path,C]),V=s.useCallback(()=>{B?L(e.path):v(e)},[B,e,v,L]),E=s.useCallback(d=>{d.stopPropagation(),C(null),b(e.path)},[e.path,b,C]),R=({Item:d,Separator:O})=>t.jsxs(t.Fragment,{children:[H&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("rename",e)},children:[t.jsx(F,{name:"edit",className:"mr-2 size-4"})," ","Rename"]}),t.jsxs(d,{onClick:S=>{S.stopPropagation(),Zt(e.path).then(P=>{if(P.ok){pe.success("Path copied");return}pe.error("Copy failed")})},children:[t.jsx(F,{name:"file-copy",className:"mr-2 size-4"})," ","Copy Path"]}),t.jsxs(d,{onClick:S=>{S.stopPropagation();const P=St(n,e.path)||e.path;Zt(P).then(Y=>{if(Y.ok){pe.success("Relative path copied");return}pe.error("Copy failed")})},children:[t.jsx(F,{name:"file-copy-2",className:"mr-2 size-4"})," ","Copy Relative Path"]}),!B&&N&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),N(e.path).catch(P=>{console.error("Download failed:",P),pe.error("Operation failed")})},children:[t.jsx(F,{name:"download",className:"mr-2 size-4"})," ",u?"Download":"Save"]}),A&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),I(e.path)},children:[t.jsx(F,{name:"folder-received",className:"mr-2 size-4"})," ",Po()]}),B&&(D||$)&&t.jsxs(t.Fragment,{children:[t.jsx(O,{}),D&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("createFile",e)},children:[t.jsx(F,{name:"file-add",className:"mr-2 size-4"})," ","New File"]}),$&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("createFolder",e)},children:[t.jsx(F,{name:"folder-add",className:"mr-2 size-4"})," ","New Folder"]})]}),G&&t.jsxs(t.Fragment,{children:[t.jsx(O,{}),t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("delete",e)},className:"text-destructive focus:text-destructive",children:[t.jsx(F,{name:"delete-bin",className:"mr-2 size-4"})," ","Delete"]})]})]});return t.jsxs(ui,{open:j===e.path,onOpenChange:d=>C(d?e.path:null),children:[t.jsxs(di,{render:t.jsx("div",{className:"group relative flex items-center",onContextMenu:o?void 0:k}),children:[t.jsxs("button",{type:"button",onClick:V,onContextMenu:o?void 0:k,className:J("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left text-foreground transition-colors pr-8 select-none",i?"bg-interactive-selection/70":"hover:bg-interactive-hover/40"),children:[B?a?t.jsx(F,{name:"folder-open",className:"size-4 flex-shrink-0 text-muted-foreground"}):t.jsx(F,{name:"folder-3",className:"size-4 flex-shrink-0 text-muted-foreground"}):t.jsx(Ka,{filePath:e.path,extension:e.extension}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-meta",title:e.path,children:e.name}),!B&&m&&t.jsx(Zi,{status:m}),B&&g&&t.jsxs("span",{className:"text-xs flex items-center gap-1 ml-auto mr-1",children:[g.modified>0&&t.jsxs("span",{className:"text-[var(--status-warning)]",children:["M",g.modified]}),g.added>0&&t.jsxs("span",{className:"text-[var(--status-success)]",children:["+",g.added]})]})]}),T&&t.jsx("div",{className:J("absolute right-1 top-1/2 -translate-y-1/2",f?"opacity-100":"opacity-0 focus-within:opacity-100 group-hover:opacity-100"),children:t.jsxs(Ln,{open:x===e.path,onOpenChange:d=>b(d?e.path:null),children:[t.jsx(In,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"icon",className:"size-6",onClick:E,children:t.jsx(F,{name:"more-2-fill",className:"size-4"})})}),t.jsx(Bn,{align:"end",side:"bottom",onCloseAutoFocus:()=>b(null),children:R({Item:Qt,Separator:Xo})})]})})]}),t.jsx(fi,{className:"min-w-[180px]",children:R({Item:mi,Separator:pi})})]})},Nn=(e,n,a)=>{const[i,o]=s.useState(""),[u,f]=s.useState(0);return s.useEffect(()=>{if(!e){o("");return}let m=!1;o("");const g=Lo(),w=Io(g);Bo(g).then(x=>{m||!x||(o(e),n(null))}).catch(x=>{m||(n(x instanceof Error?x.message:a),o(e))});const N=$o(()=>{m||(o(e),f(x=>x+1),n(null))});return()=>{m=!0,w(),N()}},[e,n,a]),{readyKey:i,nonce:u}},ec=e=>e!==null&&typeof e=="object"&&"updateStatus"in e&&typeof e.updateStatus=="function",tc=e=>{const n=document.createElement("div");n.className="cm-vim-panel";const a=zi(e);if(!a)return{top:!1,dom:n};a.state.statusbar=n;const i=a.state.vimPlugin;return ec(i)&&i.updateStatus(),{top:!1,dom:n,destroy(){a.state.statusbar===n&&(a.state.statusbar=null)}}};function Jr(e){return e?[Ei(),jo.of(tc),Co()]:[]}const nc={next:"Next match",prev:"Previous match",select:"Select all matches",replace:"Replace",replaceAll:"Replace all",close:"Close"},rc={case:"Match case",re:"Regular expression",word:"Match whole word"};function ac(e){const n=e.querySelector(".cm-search");if(n){for(const[a,i]of Object.entries(nc)){const o=n.querySelector(`button[name="${a}"]`);o&&!o.title&&(o.title=i)}for(const[a,i]of Object.entries(rc)){const u=n.querySelector(`input[name="${a}"]`)?.parentElement;u&&!u.title&&(u.title=i)}}}const Sn=new WeakMap;function sc(e,n){const a=tn(e.state);if(!a.valid)return Sn.delete(e),0;const i=Sn.get(e);if(!n&&i?.doc===e.state.doc&&i.query.eq(a))return i.total;const o=a.getCursor(e.state);let u=0;for(let f=o.next();!f.done;f=o.next())u+=1;return Sn.set(e,{query:a,doc:e.state.doc,total:u}),u}function oc(e){const n=tn(e.state);if(!n.valid)return 0;const a=e.state.selection.main,i=n.getCursor(e.state);let o=0,u=0;for(let f=i.next();!f.done;f=i.next()){const m=f.value;if(o+=1,u===0&&(u=o),a.from===m.from&&a.to===m.to||a.from<m.to&&a.to>m.from||m.from>=a.head)return o}return u}function Xr(e,n,a=!1){const i=e.querySelector(".cm-search");if(!i)return;let o=i.querySelector(".cm-search-message");if(!o){o=document.createElement("span"),o.className="cm-search-message",o.setAttribute("aria-live","polite");const m=i.querySelector('button[name="next"]'),g=m?.parentNode===i?m:i.firstChild;i.insertBefore(o,g)}const u=sc(n,a),f=u===0?0:oc(n);o.textContent=u===0?"":`${f}/${u}`}const Yr=new st,Zr=new st,Qr=new st,ea=new st,ta=new st,na=new st,ra=new st,aa=e=>e,Rn=Do,ic=Ri,cc=Fi;class lc extends Ao{constructor(n,a){super(),this.id=n,this.containerMap=a}toDOM(){let n=this.containerMap.get(this.id);return n||(n=document.createElement("div"),n.className="oc-block-widget",n.dataset.widgetId=this.id,this.containerMap.set(this.id,n)),n}eq(n){return n.id===this.id}destroy(){}}const sa=(e,n)=>!e||e.length===0?[]:ha.define({create(a){const i=new Pn,o=[...e].sort((u,f)=>u.afterLine-f.afterLine);for(const u of o){const f=a.doc.lines;if(u.afterLine>f)continue;const m=a.doc.line(u.afterLine);i.add(m.to,m.to,nn.widget({widget:new lc(u.id,n),block:!0,side:1}))}return i.finish()},update(a,i){return a.map(i.changes)},provide:a=>me.decorations.from(a)}),oa=e=>{if(!e)return[];const n=Math.max(1,e.start),a=Math.max(n,e.end);return ga.fromClass(class{decorations;constructor(i){this.decorations=this.build(i)}update(i){(i.docChanged||i.viewportChanged)&&(this.decorations=this.build(i.view))}build(i){const o=new Pn;for(let u=n;u<=a&&u<=i.state.doc.lines;u+=1){const f=i.state.doc.line(u);o.add(f.from,f.from,nn.line({class:"oc-cm-selected-line"}))}return o.finish()}},{decorations:i=>i.decorations})};function uc({value:e,onChange:n,extensions:a,className:i,readOnly:o,lineNumbersConfig:u,highlightLines:f,onViewReady:m,onViewDestroy:g,blockWidgets:w,enableSearch:N,searchOpen:x,onSearchOpenChange:b,vimMode:j}){const C=s.useRef(null),v=s.useRef(null),L=s.useRef(e),I=s.useRef(n),l=s.useRef(m),B=s.useRef(g),H=s.useRef(b),D=s.useRef(w),$=s.useRef(j),G=s.useRef(new Map),[_,X]=s.useState([]),A=s.useCallback(k=>{const V=(k??[]).map(E=>{const R=G.current.get(E.id);return R?{id:E.id,content:E.content,container:R}:null}).filter(E=>E!==null);X(E=>E.length===V.length&&E.every((R,d)=>{const O=V[d];return R.id===O.id&&R.content===O.content&&R.container===O.container})?E:V)},[]),T=s.useCallback(k=>{const V=C.current,E=k??v.current;if(!V||!E)return;const R=E.dom.querySelector(".cm-gutters"),d=R instanceof HTMLElement?R.getBoundingClientRect().width:0;V.style.setProperty("--oc-editor-gutter-width",`${d}px`)},[]);return s.useEffect(()=>{L.current=e},[e]),s.useEffect(()=>{I.current=n},[n]),s.useEffect(()=>{l.current=m,B.current=g},[m,g]),s.useEffect(()=>{H.current=b},[b]),s.useEffect(()=>{D.current=w,A(w)},[w,A]),s.useEffect(()=>{if(!C.current)return;const k=(()=>{if(typeof document>"u")return null;const E=document.querySelector('meta[name="csp-nonce"]')?.getAttribute("content");if(E)return E;const R=window.__PICHAMBER_CSP_NONCE__;return typeof R=="string"&&R.length>0?R:null})(),V=No.create({doc:L.current,extensions:[...k?[me.cspNonce.of(k)]:[],So({fixed:!0}),Yr.of(Er(u)),Ro(),Fo.of(" "),ra.of(Jr(j)),kn.of([Eo,...zo,...Mo]),me.updateListener.of(E=>{T(E.view),(E.viewportChanged||E.geometryChanged)&&A(D.current);const R=Vr(E.startState),d=Vr(E.state);R!==d&&H.current?.(d);const O=!tn(E.startState).eq(tn(E.state));if(d&&(R!==d||O||E.docChanged||E.selectionSet)&&Xr(E.view.dom,E.view,R!==d||O||E.docChanged),!E.docChanged)return;const S=E.state.doc.toString();L.current=S,I.current(S),A(D.current)}),Zr.of(me.editable.of(!o)),Qr.of(a??[]),ea.of(oa(f)),ta.of(sa(w,G.current)),na.of(N?[Wr({top:!0}),kn.of(aa(_r))]:[])]});return v.current=new me({state:V,parent:C.current}),Rn(v.current,v.current.state.doc.length,200),v.current.requestMeasure(),requestAnimationFrame(()=>{T(v.current),A(D.current)}),v.current&&l.current?.(v.current),()=>{B.current?.(),v.current?.destroy(),v.current=null,X([])}},[D,T,A]),s.useEffect(()=>{const k=v.current;k&&(k.dispatch({effects:[Yr.reconfigure(Er(u)),Zr.reconfigure(me.editable.of(!o)),Qr.reconfigure(a??[]),ea.reconfigure(oa(f)),ta.reconfigure(sa(w,G.current)),na.reconfigure(N?[Wr({top:!0}),kn.of(aa(_r))]:[])]}),Rn(k,k.state.doc.length,200),k.requestMeasure(),requestAnimationFrame(()=>{T(k),A(D.current)}))},[a,f,u,o,w,N,T,A]),s.useEffect(()=>{const k=v.current;if(!k){$.current=j;return}$.current!==j&&($.current=j,k.dispatch({effects:ra.reconfigure(Jr(j))}))},[j]),s.useEffect(()=>{const k=v.current;!k||N===!1||(x?(ic(k),requestAnimationFrame(()=>{ac(k.dom),Xr(k.dom,k,!0)})):cc(k))},[x,N]),s.useEffect(()=>{const k=v.current;if(!k)return;const V=k.state.doc.toString();V!==e&&(k.dispatch({changes:{from:0,to:V.length,insert:e}}),Rn(k,k.state.doc.length,300),k.requestMeasure(),requestAnimationFrame(()=>T(k)))},[e,T]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:C,className:J("h-full w-full","[&_.cm-editor]:h-full [&_.cm-editor]:w-full","[&_.cm-scroller]:font-mono [&_.cm-scroller]:text-[var(--text-code)] [&_.cm-scroller]:leading-6","[&_.cm-lineNumbers]:text-[var(--tools-edit-line-number)]",i)}),_.map(k=>To.createPortal(k.content,k.container,k.id))]})}const ia=({variant:e,selectedFile:n,loading:a,suppressLoadingIndicator:i,fileError:o,isSelectedImage:u,imageSrc:f,imagePreviewNonce:m,isSelectedPdf:g,pdfSrc:w,pdfPreviewNonce:N,isUnsupportedBinary:x,onDownload:b,enableRichPreviews:j,drawioViewMode:C,drawioRemountNonce:v,diagramEditorRef:L,diagramEditorXml:I,onDiagramChange:l,jsonViewMode:B,markdownViewMode:H,htmlViewMode:D,htmlLoading:$,htmlPreviewNonce:G,htmlPreviewSrc:_,fileContent:X,canUseShikiFileView:A,textViewMode:T,draftContent:k,onDraftChange:V,canEdit:E,vimMode:R,editorExtensions:d,editorWrapperRef:O,shouldMaskEditorForPendingNavigation:S,onEditorViewReady:P,onEditorViewDestroy:Y,enableSearch:ee=!1,searchOpen:re,onSearchOpenChange:te,pierreTheme:K,shikiThemeType:Q,wrapLines:Qe})=>{const Oe=e==="fullscreen",le=Oe?"p-4":"p-3",Pe=!!(n?.path&&en(n.path)),Le=!!(n?.path&&Ia(n.path)),ae=!!(n?.path&&Ba(n.path)),ue=!!(n?.path&&$n(n.path)),ye=()=>n?t.jsx("div",{className:"h-full",children:t.jsx(Si,{file:{name:n.name,contents:k,lang:Na(n.path)||void 0},options:{disableFileHeader:!0,overflow:Qe?"wrap":"scroll",theme:K,themeType:Q},className:"block h-full w-full",style:{height:"100%"}})}):null;return t.jsx(Ca,{outerClassName:"h-full min-w-0",className:"h-full min-w-0",children:n?a?i?t.jsx("div",{className:le}):t.jsxs("div",{className:`${le} flex items-center gap-2 typography-ui text-muted-foreground`,children:[t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}),Oe?"Loading…":"Loading..."]}):o?t.jsx("div",{className:`${le} typography-ui text-[color:var(--status-error)]`,children:o}):u?t.jsx("div",{className:J("flex h-full items-center justify-center",le),children:t.jsx("img",{src:f,alt:n.name||"Image",className:J("max-w-full object-contain rounded-md border border-border/30 bg-primary/10",Oe?"max-h-full":"max-h-[70vh]")},m)}):g?t.jsx("div",{className:"h-full overflow-hidden bg-[var(--surface-background)]",children:t.jsx("iframe",{src:w,className:"h-full w-full border-0",title:n.name},N)}):x?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[t.jsx("div",{className:"typography-ui-header text-foreground",children:"Cannot preview binary file"}),t.jsx("div",{className:"max-w-md typography-ui text-muted-foreground",children:"This file is binary and cannot be edited in PiChamber. Download it to open with another app."}),b?t.jsxs(q,{type:"button",variant:"outline",size:"sm",onClick:b,children:[t.jsx(F,{name:"download",className:"mr-2 size-4"}),"Save file"]}):null]}):j&&Pe&&C==="preview"?t.jsx("div",{className:"h-full overflow-hidden",style:{minHeight:"400px"},children:t.jsx(ii,{ref:L,xml:I,onChange:l},`${n.path}:${v}`)}):j&&Le&&B==="tree"?t.jsx(Dr,{fallback:t.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[t.jsx("div",{className:"mb-1 font-medium text-destructive",children:"JSON viewer unavailable"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Switch to text mode to view raw content."})]}),children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(Ni,{jsonString:X,maxHeight:"100%",initiallyExpandedDepth:2})})}):ae&&H==="preview"?t.jsxs("div",{className:J("h-full overflow-auto",le),children:[X.length>500*1024?t.jsx("div",{className:"mb-3 rounded-md border border-status-warning/20 bg-status-warning/10 px-3 py-2 text-sm text-status-warning",children:`This file is large (${Math.round(X.length/1024)}KB). Preview may be limited.`}):null,t.jsx(Dr,{fallback:t.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[t.jsx("div",{className:"mb-1 font-medium text-destructive",children:"Preview unavailable"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Switch to edit mode to fix the issue."})]}),children:t.jsx(Yo,{content:X,className:"typography-markdown-body",stripFrontmatter:!0,enableFileReferences:!1})})]}):j&&ue&&D==="preview"?$?t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground typography-ui-label",children:"Loading..."}):t.jsx("div",{className:"h-full overflow-hidden",children:t.jsx("iframe",{src:_,className:"w-full h-full border-none",sandbox:"allow-scripts allow-same-origin allow-forms",title:"HTML Preview"},G)}):A&&T==="view"?ye():t.jsxs("div",{className:J("relative h-full",S&&"overflow-hidden"),ref:O,children:[t.jsx("div",{className:J("h-full",S&&"invisible"),children:t.jsx(uc,{value:k,onChange:V,readOnly:!E,vimMode:R,extensions:d,className:"h-full",onViewReady:P,onViewDestroy:Y,...ee?{enableSearch:!0,searchOpen:re,onSearchOpenChange:te}:{}})}),S?t.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-background",children:t.jsxs("div",{className:"flex items-center gap-2 typography-ui text-muted-foreground",children:[t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}),"Opening file at change..."]})}):null]}):t.jsx("div",{className:`${le} typography-ui text-muted-foreground`,children:"Pick a file from the tree."})})};async function dc(e,n,a){if(Sa(e)&&!Ra(e))return{kind:n?"desktop-image":"asset-image"};if(Fa(e))return{kind:"pdf"};if(Tn(e))return{kind:"binary",detectedFromContent:!1};const o=await a(e);if(Zo(o))return{kind:"binary",detectedFromContent:!0};const u=hi(o);return{kind:"text",content:u,draft:u.length>Rt?`${u.slice(0,Rt)}
|
|
1
|
+
import{ad as bo,c6 as Nt,c7 as Mn,x as c,ab as pa,J as me,c8 as wo,c9 as yo,H as ha,G as nn,ai as ga,S as ko,aj as Pn,j as t,ae as jo,c0 as Co,a9 as No,ca as So,c3 as st,cb as Er,b$ as Ro,C as Fo,L as kn,cc as Eo,cd as zo,c2 as Mo,aH as To,ce as Do,W as Ao,F as Oo}from"./vendor-boot-DyL2td56.js";import{R as s,a as y}from"./vendor-react-DASdDPIk.js";import{o as J,H as Po,h as Lo,bV as Io,F as Bo,bW as $o,t as Fe,bX as xa,K as Re,a as Vo,A as Wo,L as _o,bY as Ct,I as Ko,J as qo,_ as zr,bZ as Ho,ae as Mr,m as Tr,G as jn,aA as Go}from"./index-Dd2OcIUY.js";import{ch as Uo,a7 as xt,B as q,I as F,ai as Et,ci as Jo,ak as va,al as ba,am as wa,an as ya,ao as ka,ap as ja,a8 as Ln,ab as In,ad as Bn,ae as Zt,t as pe,af as Qt,ag as Xo,cj as en,aj as Ca,E as Dr,b2 as Yo,ck as Na,cl as Sa,cm as Ra,cn as Fa,co as Tn,cp as Zo,a9 as Xe,aa as Ye,ac as Ze,p as Qo,aq as ei,a4 as ti,n as ni,ah as ri,cq as Ar,ar as Or,aM as ai,cr as Pr}from"./useAppFontEffects--lKKtKVo.js";import{javascript as ht}from"./vendor-codemirror-lang-javascript-DpTUrvx8.js";import{json as Ea}from"./vendor-codemirror-lang-json-CLGxdOCz.js";import{css as za}from"./vendor-codemirror-lang-css-Dwf2XpnZ.js";import{html as Dn}from"./vendor-codemirror-lang-html-DcKqyeGk.js";import{markdown as Ma}from"./vendor-codemirror-lang-markdown-DmFP9s6x.js";import{l as Ta}from"./vendor-codemirror-language-data-DglcKYWT.js";import{python as Da}from"./vendor-codemirror-lang-python-yuxIkjit.js";import{shell as si}from"./shell-CjFT_Tl9.js";import{ensurePierreThemeRegistered as Lr,getResolvedShikiTheme as oi}from"./appThemeRegistry-gegrE2dq.js";import{D as ii,i as Aa,b as Oa,s as ci,F as li}from"./FileSaveConflictDialog-BRM9TJo0.js";import{h as Ir,y as ui,z as di,B as fi,E as mi,G as pi,P as Xt}from"./runtimeEndpointReset-CmI6dBKM.js";import{h as An,i as Pa,j as La}from"./SessionUnreadDot-CJFawQpo.js";import{g as St,c as Ia,d as Ba,e as $n,n as hi,f as gi,M as Rt,h as oe,j as xi,s as vi,i as bi,a as wi,t as Yt,k as Cn,b as yi,l as ki,u as ji,m as Br,o as Ci,p as $r}from"./useFilesViewSearch-D1jsGQrN.js";import{J as Ni,F as Si}from"./JsonTreeView-X2Auiy_q.js";import{a as Vr,g as tn,b as Wr,c as _r,o as Ri,d as Fi}from"./vendor-codemirror-search-DaE6R5gH.js";import{v as Ei,g as zi}from"./vendor-replit-codemirror-vim-CZy3BUVv.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-B1GRkkKC.js";import"./vendor-lezer-javascript-oje4tdp_.js";import"./vendor-lezer-lr-BU2qmu_5.js";import"./vendor-codemirror-autocomplete-DsFn4GLp.js";import"./vendor-lezer-json-BRXb_bDX.js";import"./vendor-lezer-css-DNU_fzPI.js";import"./vendor-lezer-html-DDGRhRUz.js";import"./vendor-lezer-markdown-CicYv7V9.js";import"./vendor-lezer-python-Cuvm9X9Y.js";import"./registerCustomTheme-DmolaWWZ.js";import"./themeResolver-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-react-drawio-Duu5LgQA.js";/* empty css */import"./permissionStore-B9Hkrqny.js";import"./web-components-v9fuidaX.js";import"./computeVirtualFileMetrics-3PpRLd5B.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./Virtualizer-wpC51ZBQ.js";import"./renderFileWithHighlighter-BvDoP7ob.js";const On=bo.define(si);function Mi(e){const n=e.trim().toLowerCase();switch(n){case"bash":case"sh":case"zsh":case"shell":case"shellsession":case"console":return On;case"json":case"jsonc":case"json5":return Ea().language;case"js":case"javascript":return ht().language;case"jsx":return ht({jsx:!0}).language;case"ts":case"typescript":return ht({typescript:!0}).language;case"tsx":return ht({typescript:!0,jsx:!0}).language;case"html":return Dn().language;case"css":return za().language;case"py":case"python":return Da().language;case"md":case"markdown":case"mdown":case"mkd":return Ma().language;case"heex":case"eex":case"leex":return Dn().language;default:return pa.matchLanguageName(Ta,n,!0)}}const $a=e=>e.split("/").pop()?.toLowerCase()??"",Ti=e=>{const n=$a(e);return n?pa.matchFilename(Ta,n):null},Di=()=>Nt(Mn.define([{tag:[c.heading1,c.heading2,c.heading3,c.heading4,c.heading5,c.heading6],fontWeight:"600"},{tag:c.strong,fontWeight:"600"},{tag:c.emphasis,fontStyle:"italic"},{tag:c.strikethrough,textDecoration:"line-through"},{tag:[c.link,c.url],color:"var(--markdown-link, currentColor)",textDecoration:"underline"},{tag:c.monospace,color:"var(--markdown-inline-code, currentColor)",backgroundColor:"var(--markdown-inline-code-bg, transparent)"},{tag:c.quote,color:"var(--markdown-blockquote, currentColor)",fontStyle:"italic"},{tag:c.list,color:"color-mix(in srgb, var(--muted-foreground) 40%, var(--foreground) 60%)"},{tag:c.heading,color:"var(--markdown-heading1, currentColor)"}]));function Ai(e){const n=e.toLowerCase();switch($a(n)){case"makefile":case"gnumakefile":return On}const i=n.lastIndexOf("."),o=i>=0?n.slice(i+1):"";switch(o){case"ts":case"tsx":case"mts":case"cts":return ht({typescript:!0,jsx:o==="tsx"});case"js":case"jsx":case"mjs":case"cjs":return ht({typescript:!1,jsx:o==="jsx"});case"json":case"jsonc":case"json5":case"jsonl":case"ndjson":case"geojson":return Ea();case"css":case"scss":case"sass":case"less":return za();case"html":case"htm":case"xml":case"drawio":case"dio":return Dn();case"md":case"mdx":case"markdown":case"mdown":case"mkd":return[Ma({codeLanguages:Mi}),Di()];case"sh":case"bash":case"zsh":case"fish":case"env":return On;case"py":case"pyw":case"pyi":return Da();default:return null}}async function Oi(e){const n=Ti(e);if(!n)return null;if(n.support)return n.support;try{return await n.load()}catch{return null}}function Kr(e,n){const a=e.metadata.variant==="dark",i=e.config?.fonts?.mono||"monospace",o=e.colors.syntax.highlights||{},u=e.colors.syntax.tokens||{},f=n?.fontSize?`${n.fontSize}px`:"var(--text-code)",m=me.theme({"&":{backgroundColor:"var(--background)",color:e.colors.syntax.base.foreground,fontSize:f,lineHeight:"1.5",position:"relative"},".cm-scroller":{fontFamily:i,backgroundColor:"var(--background)"},".cm-comment":{color:e.colors.syntax.base.comment},".cm-keyword":{color:e.colors.syntax.base.keyword},".cm-string":{color:e.colors.syntax.base.string},".cm-string-2":{color:u.stringEscape||e.colors.syntax.base.string},".cm-number":{color:e.colors.syntax.base.number},".cm-operator":{color:e.colors.syntax.base.operator},".cm-punctuation":{color:u.punctuation||e.colors.syntax.base.comment},".cm-atom":{color:u.boolean||e.colors.syntax.base.number},".cm-builtin":{color:u.functionCall||e.colors.syntax.base.function},".cm-def":{color:u.variableGlobal||e.colors.syntax.base.variable},".cm-attribute":{color:u.variableOther||u.variableProperty||e.colors.syntax.base.operator},".cm-meta":{color:e.colors.syntax.base.comment},".cm-property":{color:u.variableProperty||e.colors.syntax.base.keyword},".cm-variable":{color:e.colors.syntax.base.variable},".cm-variable-2":{color:u.variableOther||e.colors.syntax.base.function},".cm-variable-3":{color:u.variableGlobal||e.colors.syntax.base.type},".cm-tag":{color:u.tag||e.colors.syntax.base.keyword},".cm-link":{color:u.url||e.colors.syntax.base.keyword,textDecoration:"underline"},".cm-content":{caretColor:e.colors.interactive.cursor},".cm-cursor, .cm-dropCursor":{borderLeftColor:e.colors.interactive.cursor},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:e.colors.interactive.selection},".cm-gutters":{backgroundColor:"var(--background)",color:o.lineNumber||e.colors.syntax.base.comment,borderRight:`1px solid ${e.colors.interactive.border}`,position:"sticky",paddingRight:"8px",left:0,zIndex:2,boxShadow:"0 0 0 var(--background)"},".cm-gutter":{backgroundColor:"var(--background)"},".cm-gutterElement":{backgroundColor:"var(--background)"},".cm-lineNumbers":{backgroundColor:"var(--background)"},".cm-lineNumbers .cm-gutterElement":{paddingLeft:"8px",paddingRight:"8px",minWidth:"42px"},".cm-activeLineGutter":{color:o.lineNumberActive||e.colors.syntax.base.foreground},".cm-activeLine":{backgroundColor:e.colors.surface.overlay},".cm-panels":{backgroundColor:"transparent",color:e.colors.surface.foreground,position:"absolute",top:"0",right:"0",left:"auto",width:"auto",zIndex:10,pointerEvents:"none"},".cm-panels-top":{borderBottom:"none",position:"absolute",top:"6px",right:"14px",left:"auto",width:"auto"},".cm-panels-bottom":{position:"static",width:"100%",pointerEvents:"auto"},".cm-panels-bottom .cm-vim-panel":{borderTop:`1px solid ${e.colors.interactive.border}`,backgroundColor:e.colors.surface.elevated,color:e.colors.surface.mutedForeground,fontFamily:"var(--font-mono)",fontSize:"12px",minHeight:"22px",padding:"2px 8px"},".cm-panel.cm-search":{pointerEvents:"auto",padding:"4px",backgroundColor:`color-mix(in srgb, ${e.colors.surface.elevated} 85%, transparent)`,border:`1px solid ${e.colors.interactive.border}`,borderRadius:"10px",boxShadow:`0 2px 8px color-mix(in srgb, ${e.colors.surface.background} 60%, transparent)`,width:"auto",minWidth:"360px",maxWidth:"480px"},".cm-search":{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0",width:"100%",color:e.colors.surface.foreground,fontFamily:"inherit",fontSize:"13px",lineHeight:"1"},".cm-search br":{display:"none"},".cm-search .cm-textfield":{appearance:"none",height:"26px",margin:0,padding:"0 8px",borderRadius:"6px !important",border:`1px solid ${e.colors.interactive.border}`,backgroundColor:e.colors.surface.background,color:e.colors.surface.foreground,fontFamily:"inherit",fontSize:"12px",lineHeight:"1",outline:"none",transition:"border-color 150ms ease"},".cm-search .cm-textfield::placeholder":{color:e.colors.surface.mutedForeground,opacity:1},".cm-search .cm-textfield:focus":{borderColor:e.colors.primary.base},'.cm-search .cm-textfield[name="search"]':{order:1,flex:"1 1 120px",maxWidth:"calc(100% - 142px)",minWidth:"100px"},".cm-search label":{order:2,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",minWidth:"26px",flexShrink:"0",margin:0,marginLeft:"1px",padding:0,borderRadius:"4px",border:"1px solid transparent",backgroundColor:"transparent",color:"transparent",cursor:"pointer",userSelect:"none",fontSize:"1px",lineHeight:"0",overflow:"hidden",position:"relative",transition:"background-color 120ms ease, border-color 120ms ease"},".cm-search label:hover":{backgroundColor:e.colors.interactive.hover},'.cm-search label:has(input[type="checkbox"]:checked)':{backgroundColor:e.colors.interactive.hover,borderColor:e.colors.interactive.border},'.cm-search [type="checkbox"]':{appearance:"none",WebkitAppearance:"none",width:"0",height:"0",margin:"0",padding:"0",border:"none",position:"absolute",opacity:"0",pointerEvents:"none"},".cm-search label::after":{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"13px",fontWeight:"600",lineHeight:"1",fontFamily:"inherit",color:e.colors.surface.mutedForeground,pointerEvents:"none"},".cm-search label:hover::after":{color:e.colors.surface.foreground},'.cm-search label:has(input[type="checkbox"]:checked)::after':{color:e.colors.surface.foreground},'.cm-search label:has(input[name="case"])::after':{content:'"Aa"',fontSize:"12px",letterSpacing:"-0.5px"},'.cm-search label:has(input[name="re"])::after':{content:'".*"',fontSize:"13px",fontFamily:"monospace"},'.cm-search label:has(input[name="word"])::after':{content:'"ab"',fontSize:"12px",textDecoration:"underline",textUnderlineOffset:"2px"},".cm-search .cm-search-message":{order:3,color:e.colors.surface.mutedForeground,backgroundColor:"transparent",border:"none",borderRadius:"0",padding:"0 6px",fontSize:"11px",whiteSpace:"nowrap",lineHeight:"26px"},".cm-search .cm-button":{appearance:"none",WebkitAppearance:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",minWidth:"26px",flexShrink:"0",margin:0,marginLeft:"1px",padding:0,borderRadius:"4px",border:"none",backgroundColor:"transparent",backgroundImage:"none",color:"transparent",cursor:"pointer",fontSize:"1px",fontWeight:"400",lineHeight:"0",overflow:"hidden",position:"relative",boxShadow:"none",transition:"background-color 120ms ease"},".cm-search .cm-button::after":{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"15px",lineHeight:"1",color:e.colors.surface.mutedForeground,pointerEvents:"none"},".cm-search .cm-button:hover":{backgroundColor:e.colors.interactive.hover},".cm-search .cm-button:hover::after":{color:e.colors.surface.foreground},".cm-search .cm-button:active":{backgroundColor:e.colors.interactive.active},".cm-search .cm-button:focus-visible":{outline:"none",boxShadow:`0 0 0 1px ${e.colors.interactive.focusRing}`},".cm-search .cm-button:disabled":{opacity:.4,cursor:"default",pointerEvents:"none"},'.cm-search .cm-button[name="prev"]':{order:21,marginTop:"2px"},'.cm-search .cm-button[name="prev"]::after':{content:'"↑"'},'.cm-search .cm-button[name="next"]':{order:22,marginTop:"2px"},'.cm-search .cm-button[name="next"]::after':{content:'"↓"'},'.cm-search .cm-button[name="select"]':{order:23,marginTop:"2px"},'.cm-search .cm-button[name="select"]::after':{content:'"≡"',fontSize:"17px"},'.cm-panel.cm-search button[name="close"]':{order:5,appearance:"none",WebkitAppearance:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"26px",height:"26px",minWidth:"26px",flexShrink:"0",margin:"0 0 0 auto",padding:"0",borderRadius:"4px",border:"none",backgroundColor:"transparent",backgroundImage:"none",color:e.colors.surface.mutedForeground,cursor:"pointer",fontSize:"16px",lineHeight:"1",boxShadow:"none",position:"relative",overflow:"visible",transition:"background-color 120ms ease, color 120ms ease"},'.cm-panel.cm-search button[name="close"]:hover':{backgroundColor:e.colors.interactive.hover,color:e.colors.surface.foreground},'.cm-search .cm-button[name="replace"]':{order:24,marginTop:"2px"},'.cm-search .cm-button[name="replace"]::after':{content:'"⇄"'},'.cm-search .cm-button[name="replaceAll"], .cm-search .cm-button[name="replace-all"]':{order:25,marginTop:"2px"},'.cm-search .cm-button[name="replaceAll"]::after, .cm-search .cm-button[name="replace-all"]::after':{content:'"⇉"'},'.cm-search .cm-textfield[name="replace"]':{order:20,flex:"1 1 100%",maxWidth:"calc(100% - 142px)",minWidth:"80px",marginTop:"2px"},".cm-searchMatch":{backgroundColor:e.colors.status.infoBackground,boxShadow:`inset 0 0 0 1px ${e.colors.status.infoBorder}`,borderRadius:"2px"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:e.colors.interactive.selection,color:e.colors.interactive.selectionForeground,boxShadow:`inset 0 0 0 1px ${e.colors.interactive.borderFocus}`},"&.cm-focused":{outline:"none"}},{dark:a}),g=Mn.define([{tag:[c.comment,c.docComment,c.meta,c.documentMeta],class:"cm-comment"},{tag:[c.keyword,c.controlKeyword,c.moduleKeyword,c.definitionKeyword,c.modifier],class:"cm-keyword"},{tag:[c.operatorKeyword,c.operator,c.derefOperator,c.updateOperator,c.definitionOperator,c.typeOperator,c.controlOperator,c.logicOperator,c.bitwiseOperator,c.arithmeticOperator,c.compareOperator],class:"cm-operator"},{tag:[c.punctuation,c.separator,c.bracket,c.paren,c.brace,c.squareBracket,c.angleBracket],class:"cm-punctuation"},{tag:[c.string,c.regexp,c.attributeValue,c.special(c.string),c.monospace],class:"cm-string"},{tag:c.escape,class:"cm-string-2"},{tag:[c.number,c.bool,c.atom,c.null,c.self],class:"cm-number"},{tag:[c.function(c.variableName),c.function(c.definition(c.variableName)),c.function(c.propertyName),c.standard(c.variableName),c.special(c.variableName)],class:"cm-builtin"},{tag:c.definition(c.variableName),class:"cm-def"},{tag:[c.variableName,c.local(c.variableName),c.constant(c.variableName),c.literal],class:"cm-variable"},{tag:c.propertyName,class:"cm-property"},{tag:c.attributeName,class:"cm-attribute"},{tag:[c.className,c.typeName,c.namespace],class:"cm-variable-3"},{tag:[c.tagName,c.labelName,c.annotation,c.macroName],class:"cm-tag"},{tag:c.link,class:"cm-link"},{tag:[c.heading,c.heading1,c.heading2,c.heading3,c.heading4,c.heading5,c.heading6],class:"cm-keyword"}]),w=Mn.define([{tag:[c.comment,c.docComment,c.meta,c.documentMeta],color:e.colors.syntax.base.comment},{tag:[c.keyword,c.controlKeyword,c.moduleKeyword,c.definitionKeyword,c.modifier],color:e.colors.syntax.base.keyword},{tag:[c.operatorKeyword,c.operator,c.derefOperator,c.updateOperator,c.definitionOperator,c.typeOperator,c.controlOperator,c.logicOperator,c.bitwiseOperator,c.arithmeticOperator,c.compareOperator],color:e.colors.syntax.base.operator},{tag:[c.string,c.regexp,c.attributeValue,c.special(c.string),c.monospace],color:e.colors.syntax.base.string},{tag:c.escape,color:u.stringEscape||e.colors.syntax.base.string},{tag:[c.number,c.bool,c.atom,c.null,c.self],color:e.colors.syntax.base.number},{tag:[c.function(c.variableName),c.function(c.definition(c.variableName)),c.function(c.propertyName),c.standard(c.variableName),c.special(c.variableName)],color:e.colors.syntax.base.function},{tag:c.definition(c.variableName),color:u.variableGlobal||e.colors.syntax.base.variable},{tag:[c.variableName,c.local(c.variableName),c.constant(c.variableName),c.literal],color:e.colors.syntax.base.variable},{tag:c.propertyName,color:u.variableProperty||e.colors.syntax.base.variable},{tag:c.attributeName,color:u.variableOther||e.colors.syntax.base.variable},{tag:[c.className,c.typeName,c.namespace],color:e.colors.syntax.base.type},{tag:[c.tagName,c.labelName,c.annotation,c.macroName],color:u.tag||e.colors.syntax.base.keyword},{tag:c.link,color:u.url||e.colors.syntax.base.function,textDecoration:"underline"},{tag:[c.punctuation,c.separator,c.bracket,c.paren,c.brace,c.squareBracket,c.angleBracket],color:u.punctuation||e.colors.syntax.base.comment}]);return n?.syntaxColors===!1?[m]:[m,Nt(wo,{fallback:!0}),Nt(yo),Nt(g),Nt(w)]}const Pi=180,Va=ko.define(),Li=1,Ii=2,Bi=4,qr=new Map,$i=(e,n)=>{const a=`${e}|${n}`,i=qr.get(a);if(i)return i;let o="";e&&(o+=`color:${e};`),n&Li&&(o+="font-style:italic;"),n&Ii&&(o+="font-weight:bold;"),n&Bi&&(o+="text-decoration:underline;");const u=nn.mark({attributes:{style:o}});return qr.set(a,u),u},Vi=(e,n)=>{const a=new Pn,i=e.state.doc,o=Math.min(n.length,i.lines);for(let u=0;u<o;u+=1){const f=n[u];if(!f||f.length===0)continue;const m=i.line(u+1);let g=m.from;for(const[w,N,x]of f){if(w<=0)continue;const b=g,j=Math.min(g+w,m.to);g+=w,!(j<=b)&&(!N&&!x||a.add(b,j,$i(N,x)))}}return a.finish()},Wi=ha.define({create(){return nn.none},update(e,n){let a=e.map(n.changes);for(const i of n.effects)i.is(Va)&&(a=i.value);return a},provide:e=>me.decorations.from(e)}),_i=e=>ga.fromClass(class{timer;generation=0;constructor(n){this.tokenize(n)}update(n){n.docChanged&&this.schedule(n.view)}schedule(n){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.tokenize(n)},Pi)}async tokenize(n){const a=++this.generation,i=n.state.doc.toString(),o=await Uo(i,e.language,e.themeName,e.theme);o&&a===this.generation&&n.state.doc.length===i.length&&n.dispatch({effects:Va.of(Vi(n,o))})}destroy(){this.timer&&clearTimeout(this.timer)}}),Ki=e=>[Wi,_i(e)],Ke=e=>(e||"").replace(/\\/g,"/").replace(/\/+$/g,""),gt=e=>{const n=Ke(e);return!n||n==="/"?n||"/":n.split("/").filter(Boolean).at(-1)??n},Wa=e=>{const n=Ke(e);if(!n||n==="/")return null;const a=n.lastIndexOf("/");if(a<0)return null;if(a===0)return"/";const i=n.slice(0,a);return/^[A-Za-z]:$/.test(i)?`${i}/`:i},Hr=(e,n)=>{const a=Ke(e),i=Ke(n);return!a||!i?!1:a===i||a.startsWith(`${i}/`)},Gr=(e,n)=>{const a=Ke(e);if(!a)return Ke(n);if(a.startsWith("/")||/^[A-Za-z]:(\/|$)/.test(a))return a;const i=Ke(n);return i?`${i}/${a}`:a},qi=(e,n)=>{const a=Ke(e),i=Ke(n);if(!a||a===i)return!1;const o=Wa(a);return o?i&&Hr(a,i)?Hr(o,i):!0:!1},Hi=e=>{if(typeof e!="number"||!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;const n=["KB","MB","GB"];let a=e/1024;for(const i of n){if(a<1024||i===n[n.length-1])return`${a.toFixed(a>=10?0:1)} ${i}`;a/=1024}return""},Gi=(e,n)=>!n||e===n?gt(e):e.startsWith(`${n}/`)?e.slice(n.length+1):e,Ui=({root:e,directory:n,entries:a,query:i,searchResults:o,isSearching:u,directoryError:f,refreshing:m,editorPath:g,editor:w,onClose:N,onQueryChange:x,onOpenDirectory:b,onOpenFile:j,onBackFromEditor:C,onRefresh:v})=>{if(!e)return t.jsx(Ft,{message:"Select a project to browse files."});if(g)return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsx(Ir,{leading:t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":"Back",onClick:C,style:{touchAction:"manipulation"},children:t.jsx(F,{name:"arrow-left",className:"size-4"})}),icon:t.jsx(xt,{filePath:g,className:"size-4 shrink-0"}),title:gt(g)}),t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:w})]});const L=n===e?"Project files":gt(n),I=qi(n,e)?Wa(n):null,l=!!I&&!i.trim(),B=I===e?"Project files":gt(I??""),H=N||l&&I?t.jsxs(t.Fragment,{children:[N?t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":"Close",onClick:N,style:{touchAction:"manipulation"},children:t.jsx(F,{name:"close",className:"size-4"})}):null,l&&I?t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":`Back to ${gt(I)}`,onClick:()=>b(I),style:{touchAction:"manipulation"},children:t.jsx(F,{name:"arrow-left",className:"size-4"})}):null]}):void 0;return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsx(Ir,{leading:H,icon:n===e?"file-text":"folder",title:L,actions:t.jsx(q,{type:"button",variant:"ghost",size:"icon","aria-label":"Refresh files",onClick:v,style:{touchAction:"manipulation"},children:t.jsx(F,{name:"refresh",className:J("size-4",m&&"animate-spin")})})}),t.jsx("div",{className:"shrink-0 px-3 py-2",children:t.jsxs("div",{className:"relative",children:[t.jsx(F,{name:"search",className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),t.jsx(Et,{value:i,onChange:D=>x(D.target.value),placeholder:"Search files",className:"h-8 pl-7"})]})}),t.jsx(Jo,{className:"min-h-0 w-full flex-1 overflow-y-auto pb-3",children:f?t.jsx(Ft,{message:f}):i.trim()?t.jsx(Ji,{root:e,results:o,isSearching:u,onOpenFile:j}):a===void 0?t.jsx(Ft,{loading:!0,message:"Loading..."}):t.jsxs("div",{className:"flex w-full min-w-0 flex-col px-1",children:[l&&I?t.jsxs("button",{type:"button",className:J(La,"px-2"),"aria-label":`Up one level to ${B}`,onClick:()=>b(I),style:{touchAction:"manipulation"},children:[t.jsx(F,{name:"arrow-left",className:J(An(!0),"text-muted-foreground")}),t.jsx("span",{className:J(Pa(!0),"flex-1 text-muted-foreground"),children:"Up one level"})]}):null,a.length===0?t.jsx("div",{className:"px-3 py-8 text-center typography-ui-label text-muted-foreground",children:"This directory is empty."}):null,a.map(D=>t.jsx(_a,{name:D.name,path:D.path,directory:D.type==="directory",meta:D.type==="directory"?void 0:Hi(D.size),onClick:()=>D.type==="directory"?b(Gr(D.path,n||e)):j(Gr(D.path,n||e))},D.path))]})})]})},_a=({name:e,path:n,directory:a,meta:i,onClick:o})=>t.jsxs("button",{type:"button",className:J(La,"px-2"),onClick:o,style:{touchAction:"manipulation"},children:[a?t.jsx(F,{name:"folder-3-fill",className:J(An(!0),"text-primary/80")}):t.jsx(xt,{filePath:n,className:An(!0)}),t.jsx("span",{className:J(Pa(!0),"flex-1 text-foreground"),children:e}),i?t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground",children:i}):null,a?t.jsx(F,{name:"arrow-right-s",className:"size-4 shrink-0 text-muted-foreground/60"}):null]}),Ji=({root:e,results:n,isSearching:a,onOpenFile:i})=>a?t.jsx(Ft,{loading:!0,message:"Loading..."}):n.length===0?t.jsx(Ft,{message:"No files found."}):t.jsx("div",{className:"flex w-full min-w-0 flex-col px-1",children:n.map(o=>t.jsx(_a,{name:gt(o.path),path:o.path,directory:!1,meta:o.relativePath??Gi(o.path,e),onClick:()=>i(o.path)},o.path))}),Ft=({message:e,loading:n=!1})=>t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[n?t.jsx(F,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):t.jsx(F,{name:"folder-open-fill",className:"size-6 text-muted-foreground"}),t.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:e})]})}),Xi=({activeDialog:e,dialogData:n,dialogInputValue:a,onDialogInputChange:i,isDialogSubmitting:o,onDialogSubmit:u,onClose:f,inputRef:m})=>t.jsx(va,{open:!!e,onOpenChange:g=>!g&&f(),children:t.jsxs(ba,{initialFocus:m,children:[t.jsxs(wa,{children:[t.jsxs(ya,{children:[e==="createFile"&&"Create File",e==="createFolder"&&"Create Folder",e==="rename"&&"Rename",e==="delete"&&"Delete"]}),t.jsxs(ka,{children:[e==="createFile"&&`Create a new file in ${n?.path??"root"}`,e==="createFolder"&&`Create a new folder in ${n?.path??"root"}`,e==="rename"&&`Rename ${n?.name??""}`,e==="delete"&&`Are you sure you want to delete ${n?.name??""}? This action cannot be undone.`]})]}),e!=="delete"&&t.jsx("div",{className:"py-4",children:t.jsx(Et,{value:a,onChange:g=>i(g.target.value),placeholder:e==="rename"?"New name":"Name",onKeyDown:g=>{g.key==="Enter"&&u()},ref:m})}),t.jsxs(ja,{children:[t.jsx(q,{variant:"outline",onClick:f,disabled:o,children:"Cancel"}),t.jsx(q,{variant:e==="delete"?"destructive":"default",onClick:()=>{u()},disabled:o||e!=="delete"&&!a.trim(),children:o?t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}):e==="delete"?"Delete":"Confirm"})]})]})}),Yi=({label:e,iconDataUrl:n})=>{const[a,i]=s.useState(!1),o=e.trim().slice(0,1).toUpperCase()||"?";return n&&!a?t.jsx("img",{src:n,alt:"",className:"size-4 rounded-sm",onError:()=>i(!0)}):t.jsx("span",{className:J("size-4 rounded-sm flex items-center justify-center","bg-[var(--surface-muted)] text-[9px] font-medium text-muted-foreground"),children:o})},Ka=({filePath:e,extension:n})=>t.jsx(xt,{filePath:e,extension:n}),Zi=({status:e})=>{const n={open:"var(--status-info)",modified:"var(--status-warning)","git-modified":"var(--status-warning)","git-added":"var(--status-success)","git-deleted":"var(--status-error)"}[e];return t.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:n}})},Ur=({name:e})=>{const n=s.useRef(null),a=s.useRef(null),[i,o]=s.useState(!1);return s.useLayoutEffect(()=>{const u=n.current,f=a.current;if(!u||!f)return;const m=()=>{o(f.scrollWidth>u.clientWidth+1)};m();const g=new ResizeObserver(m);return g.observe(u),g.observe(f),()=>{g.disconnect()}},[e]),t.jsxs("span",{ref:n,className:"relative block min-w-0 flex-1 overflow-hidden whitespace-nowrap",children:[t.jsx("span",{ref:a,"aria-hidden":"true",className:"invisible absolute whitespace-nowrap",children:e}),i?t.jsxs("span",{className:"open-file-name-marquee-track",children:[t.jsx("span",{className:"open-file-name-marquee-item",children:e}),t.jsx("span",{className:"open-file-name-marquee-item","aria-hidden":"true",children:e})]}):t.jsx("span",{className:"block min-w-0 truncate",children:e})]})},Qi=({node:e,root:n,isExpanded:a,isActive:i,isMobile:o,isBrowserClient:u,alwaysShowActions:f,status:m,badge:g,permissions:w,downloadFile:N,contextMenuPath:x,setContextMenuPath:b,rightClickMenuPath:j,setRightClickMenuPath:C,onSelect:v,onToggle:L,onRevealPath:I,onOpenDialog:l})=>{const B=e.type==="directory",{canRename:H,canCreateFile:D,canCreateFolder:$,canDelete:G,canReveal:_}=w,X=!B&&!!N,A=_&&!u,T=H||D||$||G||X||A,k=s.useCallback(d=>{T&&(d?.preventDefault(),C(e.path))},[T,e.path,C]),V=s.useCallback(()=>{B?L(e.path):v(e)},[B,e,v,L]),E=s.useCallback(d=>{d.stopPropagation(),C(null),b(e.path)},[e.path,b,C]),R=({Item:d,Separator:O})=>t.jsxs(t.Fragment,{children:[H&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("rename",e)},children:[t.jsx(F,{name:"edit",className:"mr-2 size-4"})," ","Rename"]}),t.jsxs(d,{onClick:S=>{S.stopPropagation(),Zt(e.path).then(P=>{if(P.ok){pe.success("Path copied");return}pe.error("Copy failed")})},children:[t.jsx(F,{name:"file-copy",className:"mr-2 size-4"})," ","Copy Path"]}),t.jsxs(d,{onClick:S=>{S.stopPropagation();const P=St(n,e.path)||e.path;Zt(P).then(Y=>{if(Y.ok){pe.success("Relative path copied");return}pe.error("Copy failed")})},children:[t.jsx(F,{name:"file-copy-2",className:"mr-2 size-4"})," ","Copy Relative Path"]}),!B&&N&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),N(e.path).catch(P=>{console.error("Download failed:",P),pe.error("Operation failed")})},children:[t.jsx(F,{name:"download",className:"mr-2 size-4"})," ",u?"Download":"Save"]}),A&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),I(e.path)},children:[t.jsx(F,{name:"folder-received",className:"mr-2 size-4"})," ",Po()]}),B&&(D||$)&&t.jsxs(t.Fragment,{children:[t.jsx(O,{}),D&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("createFile",e)},children:[t.jsx(F,{name:"file-add",className:"mr-2 size-4"})," ","New File"]}),$&&t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("createFolder",e)},children:[t.jsx(F,{name:"folder-add",className:"mr-2 size-4"})," ","New Folder"]})]}),G&&t.jsxs(t.Fragment,{children:[t.jsx(O,{}),t.jsxs(d,{onClick:S=>{S.stopPropagation(),l("delete",e)},className:"text-destructive focus:text-destructive",children:[t.jsx(F,{name:"delete-bin",className:"mr-2 size-4"})," ","Delete"]})]})]});return t.jsxs(ui,{open:j===e.path,onOpenChange:d=>C(d?e.path:null),children:[t.jsxs(di,{render:t.jsx("div",{className:"group relative flex items-center",onContextMenu:o?void 0:k}),children:[t.jsxs("button",{type:"button",onClick:V,onContextMenu:o?void 0:k,className:J("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left text-foreground transition-colors pr-8 select-none",i?"bg-interactive-selection/70":"hover:bg-interactive-hover/40"),children:[B?a?t.jsx(F,{name:"folder-open",className:"size-4 flex-shrink-0 text-muted-foreground"}):t.jsx(F,{name:"folder-3",className:"size-4 flex-shrink-0 text-muted-foreground"}):t.jsx(Ka,{filePath:e.path,extension:e.extension}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-meta",title:e.path,children:e.name}),!B&&m&&t.jsx(Zi,{status:m}),B&&g&&t.jsxs("span",{className:"text-xs flex items-center gap-1 ml-auto mr-1",children:[g.modified>0&&t.jsxs("span",{className:"text-[var(--status-warning)]",children:["M",g.modified]}),g.added>0&&t.jsxs("span",{className:"text-[var(--status-success)]",children:["+",g.added]})]})]}),T&&t.jsx("div",{className:J("absolute right-1 top-1/2 -translate-y-1/2",f?"opacity-100":"opacity-0 focus-within:opacity-100 group-hover:opacity-100"),children:t.jsxs(Ln,{open:x===e.path,onOpenChange:d=>b(d?e.path:null),children:[t.jsx(In,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"icon",className:"size-6",onClick:E,children:t.jsx(F,{name:"more-2-fill",className:"size-4"})})}),t.jsx(Bn,{align:"end",side:"bottom",onCloseAutoFocus:()=>b(null),children:R({Item:Qt,Separator:Xo})})]})})]}),t.jsx(fi,{className:"min-w-[180px]",children:R({Item:mi,Separator:pi})})]})},Nn=(e,n,a)=>{const[i,o]=s.useState(""),[u,f]=s.useState(0);return s.useEffect(()=>{if(!e){o("");return}let m=!1;o("");const g=Lo(),w=Io(g);Bo(g).then(x=>{m||!x||(o(e),n(null))}).catch(x=>{m||(n(x instanceof Error?x.message:a),o(e))});const N=$o(()=>{m||(o(e),f(x=>x+1),n(null))});return()=>{m=!0,w(),N()}},[e,n,a]),{readyKey:i,nonce:u}},ec=e=>e!==null&&typeof e=="object"&&"updateStatus"in e&&typeof e.updateStatus=="function",tc=e=>{const n=document.createElement("div");n.className="cm-vim-panel";const a=zi(e);if(!a)return{top:!1,dom:n};a.state.statusbar=n;const i=a.state.vimPlugin;return ec(i)&&i.updateStatus(),{top:!1,dom:n,destroy(){a.state.statusbar===n&&(a.state.statusbar=null)}}};function Jr(e){return e?[Ei(),jo.of(tc),Co()]:[]}const nc={next:"Next match",prev:"Previous match",select:"Select all matches",replace:"Replace",replaceAll:"Replace all",close:"Close"},rc={case:"Match case",re:"Regular expression",word:"Match whole word"};function ac(e){const n=e.querySelector(".cm-search");if(n){for(const[a,i]of Object.entries(nc)){const o=n.querySelector(`button[name="${a}"]`);o&&!o.title&&(o.title=i)}for(const[a,i]of Object.entries(rc)){const u=n.querySelector(`input[name="${a}"]`)?.parentElement;u&&!u.title&&(u.title=i)}}}const Sn=new WeakMap;function sc(e,n){const a=tn(e.state);if(!a.valid)return Sn.delete(e),0;const i=Sn.get(e);if(!n&&i?.doc===e.state.doc&&i.query.eq(a))return i.total;const o=a.getCursor(e.state);let u=0;for(let f=o.next();!f.done;f=o.next())u+=1;return Sn.set(e,{query:a,doc:e.state.doc,total:u}),u}function oc(e){const n=tn(e.state);if(!n.valid)return 0;const a=e.state.selection.main,i=n.getCursor(e.state);let o=0,u=0;for(let f=i.next();!f.done;f=i.next()){const m=f.value;if(o+=1,u===0&&(u=o),a.from===m.from&&a.to===m.to||a.from<m.to&&a.to>m.from||m.from>=a.head)return o}return u}function Xr(e,n,a=!1){const i=e.querySelector(".cm-search");if(!i)return;let o=i.querySelector(".cm-search-message");if(!o){o=document.createElement("span"),o.className="cm-search-message",o.setAttribute("aria-live","polite");const m=i.querySelector('button[name="next"]'),g=m?.parentNode===i?m:i.firstChild;i.insertBefore(o,g)}const u=sc(n,a),f=u===0?0:oc(n);o.textContent=u===0?"":`${f}/${u}`}const Yr=new st,Zr=new st,Qr=new st,ea=new st,ta=new st,na=new st,ra=new st,aa=e=>e,Rn=Do,ic=Ri,cc=Fi;class lc extends Ao{constructor(n,a){super(),this.id=n,this.containerMap=a}toDOM(){let n=this.containerMap.get(this.id);return n||(n=document.createElement("div"),n.className="oc-block-widget",n.dataset.widgetId=this.id,this.containerMap.set(this.id,n)),n}eq(n){return n.id===this.id}destroy(){}}const sa=(e,n)=>!e||e.length===0?[]:ha.define({create(a){const i=new Pn,o=[...e].sort((u,f)=>u.afterLine-f.afterLine);for(const u of o){const f=a.doc.lines;if(u.afterLine>f)continue;const m=a.doc.line(u.afterLine);i.add(m.to,m.to,nn.widget({widget:new lc(u.id,n),block:!0,side:1}))}return i.finish()},update(a,i){return a.map(i.changes)},provide:a=>me.decorations.from(a)}),oa=e=>{if(!e)return[];const n=Math.max(1,e.start),a=Math.max(n,e.end);return ga.fromClass(class{decorations;constructor(i){this.decorations=this.build(i)}update(i){(i.docChanged||i.viewportChanged)&&(this.decorations=this.build(i.view))}build(i){const o=new Pn;for(let u=n;u<=a&&u<=i.state.doc.lines;u+=1){const f=i.state.doc.line(u);o.add(f.from,f.from,nn.line({class:"oc-cm-selected-line"}))}return o.finish()}},{decorations:i=>i.decorations})};function uc({value:e,onChange:n,extensions:a,className:i,readOnly:o,lineNumbersConfig:u,highlightLines:f,onViewReady:m,onViewDestroy:g,blockWidgets:w,enableSearch:N,searchOpen:x,onSearchOpenChange:b,vimMode:j}){const C=s.useRef(null),v=s.useRef(null),L=s.useRef(e),I=s.useRef(n),l=s.useRef(m),B=s.useRef(g),H=s.useRef(b),D=s.useRef(w),$=s.useRef(j),G=s.useRef(new Map),[_,X]=s.useState([]),A=s.useCallback(k=>{const V=(k??[]).map(E=>{const R=G.current.get(E.id);return R?{id:E.id,content:E.content,container:R}:null}).filter(E=>E!==null);X(E=>E.length===V.length&&E.every((R,d)=>{const O=V[d];return R.id===O.id&&R.content===O.content&&R.container===O.container})?E:V)},[]),T=s.useCallback(k=>{const V=C.current,E=k??v.current;if(!V||!E)return;const R=E.dom.querySelector(".cm-gutters"),d=R instanceof HTMLElement?R.getBoundingClientRect().width:0;V.style.setProperty("--oc-editor-gutter-width",`${d}px`)},[]);return s.useEffect(()=>{L.current=e},[e]),s.useEffect(()=>{I.current=n},[n]),s.useEffect(()=>{l.current=m,B.current=g},[m,g]),s.useEffect(()=>{H.current=b},[b]),s.useEffect(()=>{D.current=w,A(w)},[w,A]),s.useEffect(()=>{if(!C.current)return;const k=(()=>{if(typeof document>"u")return null;const E=document.querySelector('meta[name="csp-nonce"]')?.getAttribute("content");if(E)return E;const R=window.__PICHAMBER_CSP_NONCE__;return typeof R=="string"&&R.length>0?R:null})(),V=No.create({doc:L.current,extensions:[...k?[me.cspNonce.of(k)]:[],So({fixed:!0}),Yr.of(Er(u)),Ro(),Fo.of(" "),ra.of(Jr(j)),kn.of([Eo,...zo,...Mo]),me.updateListener.of(E=>{T(E.view),(E.viewportChanged||E.geometryChanged)&&A(D.current);const R=Vr(E.startState),d=Vr(E.state);R!==d&&H.current?.(d);const O=!tn(E.startState).eq(tn(E.state));if(d&&(R!==d||O||E.docChanged||E.selectionSet)&&Xr(E.view.dom,E.view,R!==d||O||E.docChanged),!E.docChanged)return;const S=E.state.doc.toString();L.current=S,I.current(S),A(D.current)}),Zr.of(me.editable.of(!o)),Qr.of(a??[]),ea.of(oa(f)),ta.of(sa(w,G.current)),na.of(N?[Wr({top:!0}),kn.of(aa(_r))]:[])]});return v.current=new me({state:V,parent:C.current}),Rn(v.current,v.current.state.doc.length,200),v.current.requestMeasure(),requestAnimationFrame(()=>{T(v.current),A(D.current)}),v.current&&l.current?.(v.current),()=>{B.current?.(),v.current?.destroy(),v.current=null,X([])}},[D,T,A]),s.useEffect(()=>{const k=v.current;k&&(k.dispatch({effects:[Yr.reconfigure(Er(u)),Zr.reconfigure(me.editable.of(!o)),Qr.reconfigure(a??[]),ea.reconfigure(oa(f)),ta.reconfigure(sa(w,G.current)),na.reconfigure(N?[Wr({top:!0}),kn.of(aa(_r))]:[])]}),Rn(k,k.state.doc.length,200),k.requestMeasure(),requestAnimationFrame(()=>{T(k),A(D.current)}))},[a,f,u,o,w,N,T,A]),s.useEffect(()=>{const k=v.current;if(!k){$.current=j;return}$.current!==j&&($.current=j,k.dispatch({effects:ra.reconfigure(Jr(j))}))},[j]),s.useEffect(()=>{const k=v.current;!k||N===!1||(x?(ic(k),requestAnimationFrame(()=>{ac(k.dom),Xr(k.dom,k,!0)})):cc(k))},[x,N]),s.useEffect(()=>{const k=v.current;if(!k)return;const V=k.state.doc.toString();V!==e&&(k.dispatch({changes:{from:0,to:V.length,insert:e}}),Rn(k,k.state.doc.length,300),k.requestMeasure(),requestAnimationFrame(()=>T(k)))},[e,T]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:C,className:J("h-full w-full","[&_.cm-editor]:h-full [&_.cm-editor]:w-full","[&_.cm-scroller]:font-mono [&_.cm-scroller]:text-[var(--text-code)] [&_.cm-scroller]:leading-6","[&_.cm-lineNumbers]:text-[var(--tools-edit-line-number)]",i)}),_.map(k=>To.createPortal(k.content,k.container,k.id))]})}const ia=({variant:e,selectedFile:n,loading:a,suppressLoadingIndicator:i,fileError:o,isSelectedImage:u,imageSrc:f,imagePreviewNonce:m,isSelectedPdf:g,pdfSrc:w,pdfPreviewNonce:N,isUnsupportedBinary:x,onDownload:b,enableRichPreviews:j,drawioViewMode:C,drawioRemountNonce:v,diagramEditorRef:L,diagramEditorXml:I,onDiagramChange:l,jsonViewMode:B,markdownViewMode:H,htmlViewMode:D,htmlLoading:$,htmlPreviewNonce:G,htmlPreviewSrc:_,fileContent:X,canUseShikiFileView:A,textViewMode:T,draftContent:k,onDraftChange:V,canEdit:E,vimMode:R,editorExtensions:d,editorWrapperRef:O,shouldMaskEditorForPendingNavigation:S,onEditorViewReady:P,onEditorViewDestroy:Y,enableSearch:ee=!1,searchOpen:re,onSearchOpenChange:te,pierreTheme:K,shikiThemeType:Q,wrapLines:Qe})=>{const Oe=e==="fullscreen",le=Oe?"p-4":"p-3",Pe=!!(n?.path&&en(n.path)),Le=!!(n?.path&&Ia(n.path)),ae=!!(n?.path&&Ba(n.path)),ue=!!(n?.path&&$n(n.path)),ye=()=>n?t.jsx("div",{className:"h-full",children:t.jsx(Si,{file:{name:n.name,contents:k,lang:Na(n.path)||void 0},options:{disableFileHeader:!0,overflow:Qe?"wrap":"scroll",theme:K,themeType:Q},className:"block h-full w-full",style:{height:"100%"}})}):null;return t.jsx(Ca,{outerClassName:"h-full min-w-0",className:"h-full min-w-0",children:n?a?i?t.jsx("div",{className:le}):t.jsxs("div",{className:`${le} flex items-center gap-2 typography-ui text-muted-foreground`,children:[t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}),Oe?"Loading…":"Loading..."]}):o?t.jsx("div",{className:`${le} typography-ui text-[color:var(--status-error)]`,children:o}):u?t.jsx("div",{className:J("flex h-full items-center justify-center",le),children:t.jsx("img",{src:f,alt:n.name||"Image",className:J("max-w-full object-contain rounded-md border border-border/30 bg-primary/10",Oe?"max-h-full":"max-h-[70vh]")},m)}):g?t.jsx("div",{className:"h-full overflow-hidden bg-[var(--surface-background)]",children:t.jsx("iframe",{src:w,className:"h-full w-full border-0",title:n.name},N)}):x?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[t.jsx("div",{className:"typography-ui-header text-foreground",children:"Cannot preview binary file"}),t.jsx("div",{className:"max-w-md typography-ui text-muted-foreground",children:"This file is binary and cannot be edited in PiChamber. Download it to open with another app."}),b?t.jsxs(q,{type:"button",variant:"outline",size:"sm",onClick:b,children:[t.jsx(F,{name:"download",className:"mr-2 size-4"}),"Save file"]}):null]}):j&&Pe&&C==="preview"?t.jsx("div",{className:"h-full overflow-hidden",style:{minHeight:"400px"},children:t.jsx(ii,{ref:L,xml:I,onChange:l},`${n.path}:${v}`)}):j&&Le&&B==="tree"?t.jsx(Dr,{fallback:t.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[t.jsx("div",{className:"mb-1 font-medium text-destructive",children:"JSON viewer unavailable"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Switch to text mode to view raw content."})]}),children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(Ni,{jsonString:X,maxHeight:"100%",initiallyExpandedDepth:2})})}):ae&&H==="preview"?t.jsxs("div",{className:J("h-full overflow-auto",le),children:[X.length>500*1024?t.jsx("div",{className:"mb-3 rounded-md border border-status-warning/20 bg-status-warning/10 px-3 py-2 text-sm text-status-warning",children:`This file is large (${Math.round(X.length/1024)}KB). Preview may be limited.`}):null,t.jsx(Dr,{fallback:t.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 px-3 py-2",children:[t.jsx("div",{className:"mb-1 font-medium text-destructive",children:"Preview unavailable"}),t.jsx("div",{className:"text-sm text-muted-foreground",children:"Switch to edit mode to fix the issue."})]}),children:t.jsx(Yo,{content:X,className:"typography-markdown-body",stripFrontmatter:!0,enableFileReferences:!1})})]}):j&&ue&&D==="preview"?$?t.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground typography-ui-label",children:"Loading..."}):t.jsx("div",{className:"h-full overflow-hidden",children:t.jsx("iframe",{src:_,className:"w-full h-full border-none",sandbox:"allow-scripts allow-same-origin allow-forms",title:"HTML Preview"},G)}):A&&T==="view"?ye():t.jsxs("div",{className:J("relative h-full",S&&"overflow-hidden"),ref:O,children:[t.jsx("div",{className:J("h-full",S&&"invisible"),children:t.jsx(uc,{value:k,onChange:V,readOnly:!E,vimMode:R,extensions:d,className:"h-full",onViewReady:P,onViewDestroy:Y,...ee?{enableSearch:!0,searchOpen:re,onSearchOpenChange:te}:{}})}),S?t.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-background",children:t.jsxs("div",{className:"flex items-center gap-2 typography-ui text-muted-foreground",children:[t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}),"Opening file at change..."]})}):null]}):t.jsx("div",{className:`${le} typography-ui text-muted-foreground`,children:"Pick a file from the tree."})})};async function dc(e,n,a){if(Sa(e)&&!Ra(e))return{kind:n?"desktop-image":"asset-image"};if(Fa(e))return{kind:"pdf"};if(Tn(e))return{kind:"binary",detectedFromContent:!1};const o=await a(e);if(Zo(o))return{kind:"binary",detectedFromContent:!0};const u=hi(o);return{kind:"text",content:u,draft:u.length>Rt?`${u.slice(0,Rt)}
|
|
2
2
|
|
|
3
3
|
… truncated …`:u,lineEnding:gi(o)}}function fc({isDirty:e,saveDraft:n}){const a=Fe(b=>b.setMainTabGuard),[i,o]=y.useState(!1),u=y.useRef(null),f=y.useRef(!1),m=y.useCallback(b=>f.current?(f.current=!1,!1):e?(u.current=b,o(!0),!0):!1,[e]);y.useEffect(()=>{if(!e){a(null);return}const b=j=>!m({kind:"tab",tab:j});return a(b),()=>{Fe.getState().mainTabGuard===b&&a(null)}},[e,m,a]);const g=y.useCallback(()=>{const b=u.current;return u.current=null,f.current=!0,o(!1),b?.kind==="tab"&&a(null),b},[a]),w=y.useCallback(()=>g(),[g]),N=y.useCallback(async()=>await n()?g():(f.current=!1,null),[n,g]),x=y.useCallback(b=>{b||o(!0)},[]);return{confirmOpen:i,discardAndTakeIntent:w,keepModalOpen:x,requestNavigation:m,saveAndTakeIntent:N}}function mc(e,n){if(e.state.doc.length!==n.length)return!1;if(n.length===0)return!0;const a=Math.min(128,n.length);if(e.state.sliceDoc(0,a)!==n.slice(0,a))return!1;const i=Math.max(0,n.length-a);return e.state.sliceDoc(i,n.length)===n.slice(i)}function pc({root:e,selectedPath:n,loadedPath:a,fileLoading:i,fileError:o,isImage:u,isPdf:f,isUnsupportedBinary:m,canEdit:g,textViewMode:w,setTextViewMode:N,draftContent:x,confirmDiscardOpen:b,selectFilePath:j}){const C=Fe(A=>A.pendingFileNavigation),v=Fe(A=>A.setPendingFileNavigation),L=Fe(A=>A.pendingFileFocusPath),I=Fe(A=>A.setPendingFileFocusPath),l=y.useRef(null),[B,H]=y.useState(0),D=y.useRef(null),$=y.useRef({key:"",attempts:0}),G=y.useCallback(()=>{H(A=>A+1)},[]);y.useEffect(()=>()=>{D.current!==null&&window.cancelAnimationFrame(D.current)},[]),y.useEffect(()=>{if(!C||!e)return;const A=()=>{D.current===null&&(D.current=window.requestAnimationFrame(()=>{D.current=null,G()}))},T=()=>{v(null),$.current={key:"",attempts:0}},k=oe(C.path);if(!k){T();return}const V=`${k}:${C.line}:${C.column??1}`;if($.current.key!==V&&($.current={key:V,attempts:0}),n!==k){b||j(k);return}if(i||a!==k)return;if(o||u||f||m){T();return}if(!g)return;if(w!=="edit"){N("edit");return}const E=l.current;if(!E||!mc(E,x)){A();return}const R=Math.max(1,Math.min(C.line,E.state.doc.lines)),d=E.state.doc.line(R),O=Math.max(1,C.column||1),S=d.from+Math.min(Math.max(0,d.to-d.from),O-1);if(!(E.state.selection.main.head===S)||$.current.attempts===0){$.current.attempts+=1,E.dispatch({selection:{anchor:S},effects:me.scrollIntoView(S,{y:"center"})}),E.focus(),A();return}window.requestAnimationFrame(()=>{const Y=l.current;Y&&(Y.dispatch({selection:{anchor:S},effects:me.scrollIntoView(S,{y:"center"})}),Y.focus())}),T()},[g,b,x,B,o,i,u,f,m,a,G,C,e,n,j,v,N,w]),y.useEffect(()=>{if(!L||!e)return;const A=oe(L);if(!A){I(null);return}n!==A||i||a!==A||(!o&&!u&&!f&&!m&&g&&w==="edit"&&l.current?.focus(),I(null))},[g,o,i,u,f,m,a,L,e,n,I,w]);const _=oe(C?.path??"");return{editorViewRef:l,notifyEditorViewChanged:G,shouldMaskEditor:!!(C&&_&&n===_&&!i&&!o&&!u&&!f&&!m)}}function hc(e){return!(!e.autoSaveEnabled||!e.isDirty||!e.canWrite||e.isSaving||e.fileLoading||e.isNonEditableBinary||!e.selectedFilePath||e.loadedFilePath!==e.selectedFilePath)}function gc(e){return e.selectedFilePath?e.isDirty?!(e.fileLoading||e.loadedFilePath!==e.selectedFilePath||e.isNonEditableBinary||e.draftContent===""&&e.fileContent!==""&&e.loadedFilePath!==e.selectedFilePath):!0:!1}const xc=1500,vc=2e3;function bc({autoSaveEnabled:e,selectedPath:n,loadedPath:a,fileLoading:i,isDirty:o,draftContent:u,fileContent:f,lineEnding:m,isNonEditableBinary:g,writeFile:w,expectedRevision:N,onSaved:x,captureSaveScope:b,currentSaveScope:j,onConflict:C}){const[v,L]=y.useState(!1),[I,l]=y.useState("idle"),[B,H]=y.useState(null),D=y.useRef(null),$=y.useRef(null),G=y.useRef(C);G.current=C;const _=y.useRef(b);_.current=b;const X=y.useRef(j);X.current=j;const A=y.useCallback(R=>R?Aa(R,X.current?.()??null):!0,[]),T=y.useCallback(()=>{D.current&&(clearTimeout(D.current),D.current=null)},[]),k=y.useCallback(()=>{l("saved"),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,l("idle")},vc)},[]),V=y.useCallback(async R=>{if(!n||!w)return pe.error("Saving not supported"),!1;if(!gc({selectedFilePath:n,loadedFilePath:a,fileLoading:i,isDirty:o,draftContent:u,fileContent:f,isNonEditableBinary:g}))return g?console.warn(`[saveDraft] refusing to save binary file "${n}".`):u===""&&f!==""&&a!==n&&console.warn(`[saveDraft] refusing to save empty draft for "${n}" (${f.length} bytes were expected). The file may have been read during a concurrent write (O_TRUNC race). Try again after content finishes loading if the save was intentional.`),!1;if(!o)return!0;L(!0);const d=_.current?.()??null;try{const O=xi(u,m),S=Oa(N,R?.overwrite),P=await w(n,O,S);return P?.success?A(d)?(H(null),x(n,u,P?.revision,d),!0):!1:(pe.error("Failed to write file"),!1)}catch(O){if(xa(O)){if(!A(d))return!1;const S={path:n,currentRevision:O.currentRevision??null,exists:O.exists};return H(S),G.current?.(S),!1}return pe.error(O instanceof Error?O.message:"Save failed"),!1}finally{L(!1)}},[u,N,f,i,o,g,A,m,a,x,n,w]),E=y.useCallback(async R=>{if(T(),v)return!1;const d=await V(R);return d&&k(),d},[T,v,V,k]);return y.useEffect(()=>{e||(l("idle"),T())},[e,T]),y.useEffect(()=>{if(hc({autoSaveEnabled:e,isDirty:o,canWrite:!!(n&&w),isSaving:v,fileLoading:i,selectedFilePath:n,loadedFilePath:a,isNonEditableBinary:g}))return D.current=setTimeout(()=>{D.current=null,V().then(R=>{R&&k()})},xc),T},[e,T,u,i,o,g,v,a,V,n,k,w]),y.useEffect(()=>{l("idle"),L(!1),H(null)},[n]),y.useEffect(()=>()=>{T(),$.current&&clearTimeout($.current)},[T]),{autoSaveStatus:I,cancelPendingAutosave:T,isSaving:v,saveConflict:B,clearSaveConflict:()=>H(null),saveDraft:V,saveNow:E}}function wc(e,n){return typeof e.revision=="string"&&typeof n.revision=="string"&&e.revision!==n.revision?!0:n.mtimeMs!==void 0&&e.mtimeMs!==void 0&&n.mtimeMs!==e.mtimeMs||n.size!==e.size}function yc({selectedPath:e,loadedPath:n,isDirty:a,readStat:i,onExternalChange:o,pollIntervalMs:u=2e3}){const f=y.useRef(null),m=y.useRef(a);m.current=a;const g=y.useCallback(w=>{f.current=w},[]);return y.useEffect(()=>{if(!e||n!==e)return;let w=!1;const N=window.setInterval(()=>{if(document.hidden)return;const x=f.current,b=x&&x.path===e&&typeof x.revision=="string"?x.revision:null;i(e,{knownRevision:b}).then(j=>{if(w||!j)return;const C=f.current;if(!C||C.path!==e){f.current=j;return}!wc(C,j)||m.current||(f.current=j,o())}).catch(()=>{})},u);return()=>{w=!0,window.clearInterval(N)}},[n,o,u,i,e]),{recordStat:g}}const ca="pichamber:files:md-viewer-mode",la="pichamber:files:html-viewer-mode",ua="pichamber:files:json-viewer-mode",kc=1500,jc=1500;function Fn(e,n,a){try{const i=localStorage.getItem(e);if(i&&n.includes(i))return i}catch{}return a}function En(e,n){try{localStorage.setItem(e,n)}catch{}}function Cc({root:e,selectedPath:n,fileContent:a,draftContent:i,setDraftContent:o,autoSaveEnabled:u,writeFile:f,expectedRevision:m,captureSaveScope:g,currentSaveScope:w,onSaved:N,onConflict:x}){const[b,j]=y.useState("edit"),[C,v]=y.useState("edit"),[L,I]=y.useState("text"),[l,B]=y.useState("edit"),[H,D]=y.useState("edit"),[$,G]=y.useState(0),[_,X]=y.useState(!1),A=y.useRef({}),T=y.useRef({}),k=y.useRef({}),V=y.useRef({}),E=y.useRef(""),R=y.useRef(""),d=y.useRef(null),O=y.useRef(null),S=y.useRef(null),P=y.useRef(m);P.current=m;const Y=y.useRef(g);Y.current=g;const ee=y.useRef(w);ee.current=w;const re=y.useRef(N);re.current=N;const te=y.useRef(x);te.current=x;const K=y.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),S.current!==null&&(cancelAnimationFrame(S.current),S.current=null)},[]),Q=y.useCallback(W=>{E.current=W,R.current=W},[]),Qe=y.useCallback(()=>Q(""),[Q]);y.useEffect(()=>{n&&(j(A.current[n]??"edit"),v(T.current[n]??Fn(ca,["preview","edit"],"edit")),B(k.current[n]??Fn(la,["preview","edit"],"edit")),D(V.current[n]??"edit"),I(Fn(ua,["tree","text"],"text")))},[n]);const Oe=y.useCallback(W=>{n&&(A.current[n]=W),j(W)},[n]),le=y.useCallback(W=>{n&&(T.current[n]=W),v(W),En(ca,W)},[n]),Pe=y.useCallback(W=>{n&&(k.current[n]=W),B(W),En(la,W)},[n]),Le=y.useCallback(W=>{I(W),En(ua,W)},[]),ae=y.useCallback(W=>{if(n&&(V.current[n]=W),K(),W==="edit"){o(E.current||a),D(W);return}E.current=i;const U=n;D("edit"),S.current=requestAnimationFrame(()=>{S.current=requestAnimationFrame(()=>{S.current=null,!(e&&U&&Re.getState().byRoot[e]?.selectedPath!==U)&&(G(se=>se+1),D("preview"))})})},[K,i,a,e,n,o]),ue=y.useCallback(W=>W?Aa(W,ee.current?.()??null):!0,[]),ye=y.useCallback(async(W,U,se)=>{if(!f||U===R.current)return!1;const ge=Y.current?.()??null;if(ge&&ge.path!==W)return!1;try{const de=await f(W,U,Oa(P.current,se?.overwrite));return de?.success?ue(ge)?(Q(U),o(U),re.current?.(W,U,de?.revision,ge),!0):!1:(pe.error("Failed to write file"),!1)}catch(de){return xa(de)?(ue(ge)&&te.current?.({path:W,currentRevision:de.currentRevision??null,exists:de.exists,xml:U}),!1):(pe.error(de instanceof Error?de.message:"Save failed"),!1)}},[ue,Q,o,f]),he=y.useCallback(()=>{X(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>X(!1),jc)},[]),Ie=y.useCallback(async(W,U,se)=>{d.current&&(clearTimeout(d.current),d.current=null);const ge=await ye(W,U,se);return ge&&he(),ge},[ye,he]),vt=y.useCallback(W=>{E.current=W,!(!u||!n||H!=="preview"||!f)&&(d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{d.current=null,ye(n,W).then(U=>{U&&he()})},kc))},[u,H,ye,n,he,f]);y.useEffect(()=>K,[K,H,n]),y.useEffect(()=>()=>{O.current&&clearTimeout(O.current)},[]);const Ee=en(n??"")&&(E.current||i)||a;return{clearDiagramContent:Qe,diagramEditorXml:Ee,diagramSaved:_,drawioRemountNonce:$,drawioViewMode:H,handleDiagramChange:vt,htmlViewMode:l,jsonViewMode:L,mdViewMode:C,recordDiagramContent:Q,saveDiagramNow:Ie,saveDiagramXml:ye,saveDrawioViewMode:ae,saveHtmlViewMode:Pe,saveJsonViewMode:Le,saveMdViewMode:le,saveTextViewMode:Oe,setTextViewMode:j,textViewMode:b}}function Nc(e,n){return e==="mobile"?!0:n==="full"}function Sc(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let a=0;a<e.length;a+=1){const i=e[a],o=n[a];if(i.name!==o.name||i.path!==o.path||i.type!==o.type||i.extension!==o.extension||i.relativePath!==o.relativePath||i.size!==o.size)return!1}return!0}function Rc({files:e,root:n,activeDirectory:a,expandedPaths:i,chrome:o,showGitignored:u,removeExpandedPathsByPrefix:f,enabled:m=!0,visible:g=!0}){const[w,N]=s.useState({}),[x,b]=s.useState({}),j=s.useRef(new Set),C=s.useRef(new Set),v=s.useRef(new Map),L=s.useRef(new Map),I=s.useRef(0),l=s.useRef(!1),[B,H]=s.useState(()=>Vo());s.useEffect(()=>Wo(R=>{H(R.runtimeKey)}),[]),s.useEffect(()=>(l.current=!1,()=>{l.current=!0,L.current=new Map,C.current=new Set,v.current=new Map}),[]);const D=s.useCallback((R,d)=>{const O=[];for(const S of d){if(!S?.name||o==="desktop"&&!u&&vi(S.name))continue;const P=oe(S.path||""),Y=P?bi(P)?P:oe(`${R}/${P}`):oe(`${R}/${S.name}`),ee=S.isDirectory?"directory":"file";O.push({name:S.name,path:Y,type:ee,extension:ee==="file"&&S.name.includes(".")?S.name.split(".").pop()?.toLowerCase():void 0,size:S.size})}return wi(O)},[o,u]),$=`${B}|${n}|g${u?"1":"0"}|${o}`,G=s.useRef($);G.current=$;const _=s.useCallback(async R=>{if(!m)return;const d=oe(R.trim());if(!d||j.current.has(d))return;const O=v.current.get(d);if(O){await O;return}const S=G.current,P=I.current+1;I.current=P,L.current=new Map(L.current).set(d,P),C.current=new Set(C.current).add(d);const Y=()=>!l.current&&G.current===S&&L.current.get(d)===P,ee=(async()=>{try{const re=e.listDirectory?(await e.listDirectory(d)).entries.map(K=>({name:K.name,path:K.path,isDirectory:K.isDirectory,size:K.size})):(await _o(d)).map(K=>({name:K.name,path:K.path,isDirectory:K.isDirectory}));if(!Y())return;j.current=new Set(j.current).add(d),b(K=>{if(!K[d])return K;const Q={...K};return delete Q[d],Q});const te=D(d,re);N(K=>{const Q=K[d];return Q&&Sc(Q,te)?K:{...K,[d]:te}})}catch(re){if(!Y())return;const te=re instanceof Error?re.message:String(re??"");te==="Directory not found"&&n&&d!==n?(f(n,d),b(K=>{if(!K[d])return K;const Q={...K};return delete Q[d],Q})):(console.error("Failed to load files directory:",re),b(K=>({...K,[d]:te})))}finally{L.current.get(d)===P&&(L.current=new Map(L.current),L.current.delete(d))}})();v.current.set(d,ee);try{await ee}finally{v.current.get(d)===ee&&(v.current.delete(d),C.current=new Set(C.current),C.current.delete(d))}},[m,e,D,f,n]),X=s.useCallback(()=>{j.current=new Set,C.current=new Set,v.current=new Map,L.current=new Map,b({}),N(R=>Object.keys(R).length===0?R:{})},[]),A=s.useCallback(async()=>{!m||!n||(X(),await _(n))},[m,_,X,n]),T=s.useCallback(async R=>{if(!m)return;if(!R){await A();return}const d=oe(R);j.current=new Set(j.current),j.current.delete(d),C.current=new Set(C.current),C.current.delete(d),v.current.delete(d),L.current=new Map(L.current),L.current.delete(d),await _(d)},[m,_,A]),k=s.useRef("");s.useEffect(()=>{k.current!==$&&(k.current=$,X())},[X,$]),s.useEffect(()=>{!m||!g||!n||j.current.has(oe(n))||_(n)},[m,_,n,$,g]),s.useEffect(()=>{!m||!g||!a||_(a)},[a,m,_,g]),s.useEffect(()=>{if(!m||!g||!e.listDirectory)return;const R=P=>{const Y=oe(P);return v.current.has(Y)||C.current.has(Y)},d=()=>{if(!(typeof document<"u"&&document.hidden))for(const P of i)R(P)||T(P)},O=()=>{typeof document<"u"&&document.hidden||d()};typeof document<"u"&&document.addEventListener("visibilitychange",O);const S=i.length>0?window.setInterval(d,8e3):null;return()=>{typeof document<"u"&&document.removeEventListener("visibilitychange",O),S!==null&&window.clearInterval(S)}},[m,i,e.listDirectory,T,g]);const V=s.useRef(m&&g);s.useEffect(()=>{const R=m&&g,d=V.current;if(V.current=R,!(!R||d)){if(!e.listDirectory){n&&!j.current.has(oe(n))&&_(n);return}if(i.length===0){n&&!j.current.has(oe(n))&&_(n);return}for(const O of i){const S=oe(O);v.current.has(S)||C.current.has(S)||T(O)}}},[m,i,e.listDirectory,_,T,n,g]);const E=s.useCallback(R=>j.current.has(oe(R)),[]);return{childrenByDir:w,loadErrorsByDir:x,isLoaded:E,loadDirectory:_,refreshDirectory:T,refreshRoot:A}}const Fc=({showEditorTabsRow:e,isMobile:n,showMobilePageContent:a,onBackMobile:i,selectedFile:o,openFiles:u,root:f,alwaysShowActions:m,editorTabsOverflow:g,editorTabsScrollRef:w,onSelectFile:N,onCloseFile:x})=>e?t.jsxs("div",{className:"flex min-w-0 items-center px-3 py-1.5",children:[n&&a&&t.jsx("button",{type:"button",onClick:i,"aria-label":"Back",className:"inline-flex size-7 flex-shrink-0 items-center justify-center mr-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:t.jsx(F,{name:"arrow-left-s",className:"size-5"})}),n?o?t.jsxs(Ln,{children:[t.jsx(In,{asChild:!0,children:t.jsxs("button",{type:"button",className:"inline-flex min-w-0 max-w-full items-center gap-1 text-left typography-ui-label font-medium","aria-label":"Open files",children:[t.jsx(xt,{filePath:o.path,extension:o.extension,className:"size-3.5 flex-shrink-0"}),t.jsx(Ur,{name:o.name}),t.jsx(F,{name:"arrow-down-s",className:"size-4 flex-shrink-0 text-muted-foreground"})]})}),t.jsx(Bn,{align:"start",className:"w-[min(24rem,calc(100vw-2rem))] max-w-[calc(100vw-2rem)]",children:u.map(b=>{const j=o?.path===b.path;return t.jsxs(Qt,{onSelect:C=>{if(C.target.closest("[data-close-open-file]")){C.preventDefault();return}j||N(b)},className:J("flex min-w-0 items-center justify-between gap-2 overflow-hidden",j&&"bg-[var(--interactive-selection)] text-[var(--interactive-selection-foreground)]"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[t.jsx(xt,{filePath:b.path,extension:b.extension,className:"size-3.5 flex-shrink-0"}),t.jsx(Ur,{name:b.name})]}),t.jsx("button",{type:"button","data-close-open-file":!0,onPointerDown:C=>{C.preventDefault(),C.stopPropagation()},onClick:C=>{C.preventDefault(),C.stopPropagation(),x(b.path)},className:"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-[var(--surface-muted-foreground)] hover:text-[var(--surface-foreground)]","aria-label":`Close ${b.name}`,children:t.jsx(F,{name:"close",className:"size-3.5"})})]},b.path)})})]}):t.jsx("div",{className:"typography-ui-label font-medium truncate",children:"Select a file"}):u.length>0?t.jsxs("div",{className:"relative min-w-0 flex-1",children:[g.left&&t.jsx("div",{className:"pointer-events-none absolute left-0 top-0 bottom-0 w-6 z-10 bg-gradient-to-r from-background to-transparent"}),g.right&&t.jsx("div",{className:"pointer-events-none absolute right-0 top-0 bottom-0 w-6 z-10 bg-gradient-to-l from-background to-transparent"}),t.jsx("div",{ref:w,className:"flex min-w-0 items-center gap-1 overflow-x-auto scrollbar-none",style:{scrollbarWidth:"none",msOverflowStyle:"none"},"data-no-drawer-swipe":"true",children:u.map(b=>{const j=o?.path===b.path;return t.jsxs("div",{title:St(f,b.path),className:J("group inline-flex items-center gap-1 rounded-md border px-2 py-1 typography-ui-label transition-colors whitespace-nowrap",j?"bg-[var(--interactive-selection)] border-[var(--primary-muted)] text-[var(--interactive-selection-foreground)]":"bg-transparent border-[var(--interactive-border)] text-[var(--surface-muted-foreground)] hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)]"),children:[t.jsx(xt,{filePath:b.path,extension:b.extension,className:"size-3.5 flex-shrink-0"}),t.jsx("button",{type:"button",onClick:()=>{j||N(b)},className:"max-w-[12rem] truncate text-left",children:b.name}),t.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),x(b.path)},className:J("rounded-sm p-0.5 text-[var(--surface-muted-foreground)] hover:text-[var(--surface-foreground)]",!j&&!m&&"opacity-0 group-hover:opacity-100"),"aria-label":`Close ${b.name}`,children:t.jsx(F,{name:"close",className:"size-3.5"})})]},b.path)})})]}):t.jsx("div",{className:"typography-ui-label font-medium truncate",children:"Select a file"})]}):null,Ec=(e,n)=>{if(!n)return null;const a=Number.parseInt(e.trim(),10);return!Number.isFinite(a)||a<1?null:Math.min(a,n.state.doc.lines)},da=(e,n)=>{const a=e.state.doc.lineAt(n.main.head);return{lineNumber:a.number,character:n.main.head-a.from+1,selection:n}},fa=(e,n,a)=>{const i=e.state.doc.line(n),o=Math.max(1,Math.min(a,i.length+1)),u=i.from+o-1;e.dispatch({selection:Oo.cursor(u),effects:me.scrollIntoView(u,{y:"center"})})};function zc({open:e,onOpenChange:n,view:a,variant:i="overlay"}){const[o,u]=s.useState(""),f=s.useRef(null),m=s.useRef(!1),g=s.useRef(null),w=s.useRef(null),N=s.useMemo(()=>Ec(o,a),[o,a]);s.useEffect(()=>{!e||!a||(m.current=!1,f.current=da(a,a.state.selection),u(""))},[e,a]),s.useEffect(()=>{e&&window.requestAnimationFrame(()=>{w.current?.focus(),w.current?.select()})},[e]),s.useEffect(()=>{if(!(!e||!a||!f.current)){if(N===null){const{selection:v}=f.current;a.dispatch({selection:v,effects:me.scrollIntoView(v.main.from,{y:"center"})});return}fa(a,N,f.current.character)}},[N,e,a]);const x=s.useCallback(()=>{if(!a||m.current||!f.current)return;const{selection:v}=f.current;a.dispatch({selection:v,effects:me.scrollIntoView(v.main.from,{y:"center"})})},[a]),b=s.useCallback(v=>{v||x(),n(v)},[n,x]),j=s.useCallback(()=>{!a||N===null||!f.current||(m.current=!0,fa(a,N,f.current.character),n(!1),a.focus())},[N,n,a]);s.useEffect(()=>{if(!e)return;const v=I=>{const l=g.current,B=I.target;!l||!(B instanceof Node)||l.contains(B)||b(!1)},L=I=>{I.key==="Escape"&&(I.preventDefault(),b(!1))};return document.addEventListener("pointerdown",v,!0),document.addEventListener("keydown",L,!0),()=>{document.removeEventListener("pointerdown",v,!0),document.removeEventListener("keydown",L,!0)}},[b,e,i]);const C=s.useMemo(()=>a?N===null?`Current Line: ${(f.current??da(a,a.state.selection)).lineNumber}. Type a line number between 1 and ${a.state.doc.lines} to navigate to.`:`Go to line ${N}`:"Editor unavailable.",[N,a]);return i==="inline"?e?t.jsxs("div",{ref:g,className:"ml-1 flex h-6 items-center gap-1",children:[t.jsx(Et,{ref:w,type:"number",min:1,step:1,inputMode:"numeric",value:o,onChange:v=>u(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),j())},placeholder:"Line",className:"h-6 w-20 rounded-md border-border/70 bg-transparent px-2 typography-meta"}),t.jsx(q,{variant:"outline",size:"xs",onClick:j,disabled:!a||N===null,className:"h-6 px-2",children:"Go"})]}):null:t.jsx("div",{ref:g,className:J("absolute left-3 top-3 z-40 w-[min(32rem,calc(100%-1.5rem))] rounded-xl border border-[var(--interactive-border)] bg-[color:color-mix(in_srgb,var(--surface-elevated)_94%,transparent)] p-2.5 shadow-lg backdrop-blur-sm transition-all",e?"pointer-events-auto translate-y-0 opacity-100":"pointer-events-none -translate-y-1 opacity-0"),children:t.jsxs("div",{className:"min-w-0",children:[t.jsx(Et,{ref:w,type:"number",min:1,step:1,inputMode:"numeric",value:o,onChange:v=>u(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),j())},placeholder:"Line number",className:"h-8 w-full rounded-md border-border/70 bg-background/60 typography-ui-label"}),t.jsx("div",{className:"mt-2 rounded-md bg-primary/15 px-3 py-1.5 typography-ui-label text-foreground/95",children:C})]})})}const zn=({currentMode:e,onToggle:n})=>{const a=e==="preview",i=a?"Switch to edit mode":"Switch to preview mode",o=a?"Edit":"Preview";return t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",onClick:n,"aria-label":i,className:"h-5 w-5 p-0",children:a?t.jsx(F,{name:"eye",className:"size-4","aria-hidden":"true"}):t.jsx(F,{name:"eye-off",className:"size-4","aria-hidden":"true"})})}),t.jsx(Ze,{sideOffset:8,children:o})]})},Mc=({selectedFile:e,displaySelectedPath:n,layout:a="floating",exitFullscreenOnly:i=!1,canEdit:o,isEditingFile:u,isSaving:f,autoSaveEnabled:m,autoSaveStatus:g,isDirty:w,onSaveDraft:N,onToggleAutoSave:x,openInApps:b,openInCacheStale:j,onOpenInApp:C,onRefreshOpenInApps:v,onToolbarDropdownOpenChange:L,isSelectedImage:I,isSelectedPdf:l,isUnsupportedBinary:B,wrapLines:H,onToggleWrapLines:D,textViewMode:$,onToggleSearch:G,isGoToLineOpen:_,onOpenGoToLineChange:X,editorView:A,canUseShikiFileView:T,isJson:k,isHtml:V,onToggleTextViewMode:E,isMarkdown:R,mdViewMode:d,onToggleMdViewMode:O,isDrawio:S,drawioViewMode:P,onToggleDrawioViewMode:Y,diagramSaved:ee,onSaveDiagram:re,jsonViewMode:te,onToggleJsonViewMode:K,canCopy:Q,copiedContent:Qe,onCopyContent:Oe,canCopyPath:le,copiedPath:Pe,onCopyPath:Le,onDownloadFile:ae,isMobile:ue,mode:ye,isFullscreen:he,onToggleFullscreen:Ie,onExitFullscreen:vt})=>{if(!e)return null;const W=a==="docked"?"pointer-events-auto flex flex-wrap items-center gap-1":"pointer-events-auto flex items-center gap-1 rounded-lg border border-[var(--interactive-border)] bg-[var(--surface-elevated)] p-1 shadow-sm",U=(se,ge)=>t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:ge})}),t.jsx(Ze,{side:"bottom",sideOffset:6,children:se})]});return t.jsxs("div",{className:W,children:[o&&u&&t.jsxs(t.Fragment,{children:[f?t.jsxs("span",{className:"flex items-center gap-1 px-1 text-muted-foreground typography-meta",children:[t.jsx(F,{name:"loader-4",className:"size-3.5 animate-spin"}),"Saving..."]}):m&&g==="saved"&&!w?t.jsxs("span",{className:"flex items-center gap-1 px-1 text-[color:var(--status-success)] typography-meta",children:[t.jsx(F,{name:"check",className:"size-3.5"}),"Saved"]}):w?U(m?`Save now (${Ct()}+S) - auto-saves after 1.5s`:`Save now (${Ct()}+S)`,t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>{N()},className:"h-6 gap-1 px-1 text-muted-foreground opacity-80 hover:bg-transparent hover:opacity-100 focus-visible:bg-transparent active:bg-transparent",title:m?`Save now (${Ct()}+S) - auto-saves after 1.5s`:`Save now (${Ct()}+S)`,"aria-label":`Save (${Ct()}+S)`,children:t.jsx(F,{name:"save-3",className:"size-4"})})):null,U(m?"Auto-save on":"Manual save",t.jsx(q,{variant:"ghost",size:"sm",onClick:x,className:J("size-6 p-0 transition-opacity hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",m?"text-foreground opacity-100":"text-muted-foreground opacity-65 hover:opacity-100"),title:m?"Auto-save on":"Manual save","aria-label":m?"Auto-save on":"Manual save",children:m?t.jsx(F,{name:"file-check-fill",className:"size-4"}):t.jsx(F,{name:"file-check",className:"size-4"})}))]}),t.jsxs(Ln,{onOpenChange:L,children:[t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(In,{asChild:!0,children:t.jsx(q,{variant:"ghost",size:"sm",className:"size-6 p-0 text-foreground opacity-100 hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Open in desktop app","aria-label":"Open in desktop app",children:t.jsx(F,{name:"file-transfer",className:"size-4"})})})})}),t.jsx(Ze,{side:"bottom",sideOffset:6,children:"Open in desktop app"})]}),t.jsxs(Bn,{align:"end",className:"w-56 max-h-[70vh] overflow-y-auto",children:[b.map(se=>t.jsxs(Qt,{className:"flex items-center gap-2",onClick:()=>{C(se)},children:[t.jsx(Yi,{label:se.label,iconDataUrl:se.iconDataUrl}),t.jsx("span",{className:"typography-ui-label text-foreground",children:se.label})]},se.id)),j?t.jsxs(Qt,{className:"flex items-center gap-2",onClick:()=>{v()},children:[t.jsx(F,{name:"refresh",className:"size-4"}),t.jsx("span",{className:"typography-ui-label text-foreground",children:"Refresh Apps"})]}):null]})]}),!I&&!l&&!B&&t.jsxs(t.Fragment,{children:[U(H?"Disable line wrap":"Enable line wrap",t.jsx(q,{variant:"ghost",size:"sm",onClick:D,className:J("size-6 p-0 transition-opacity hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",H?"text-foreground opacity-100":"text-muted-foreground opacity-65 hover:opacity-100"),title:H?"Disable line wrap":"Enable line wrap",children:t.jsx(F,{name:"text-wrap",className:"size-4"})})),$==="edit"&&t.jsxs(t.Fragment,{children:[U("Find in file",t.jsx(q,{variant:"ghost",size:"sm",onClick:se=>{G(),se.currentTarget.blur()},className:"size-6 p-0 text-foreground opacity-100 transition-opacity hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Find in file",children:t.jsx(F,{name:"search",className:"size-4"})})),U("Go to line",t.jsx(q,{variant:"ghost",size:"sm",onClick:se=>{X(!_),se.currentTarget.blur()},className:"size-6 p-0 text-foreground opacity-100 transition-opacity hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Go to line",children:t.jsx(F,{name:"menu-fold-2",className:"size-4"})})),t.jsx(zc,{open:_,onOpenChange:X,view:A,variant:"inline"})]})]}),T&&o&&!k&&!V&&t.jsx(zn,{currentMode:$==="view"?"preview":"edit",onToggle:E}),R&&U(d==="preview"?"Switch to edit mode":"Switch to preview mode",t.jsx(q,{variant:"ghost",size:"sm",onClick:O,className:J("size-6 p-0 transition-colors hover:bg-[var(--interactive-hover)] focus-visible:bg-[var(--interactive-hover)] active:bg-[var(--interactive-hover)]",d==="preview"?"bg-[var(--interactive-selection)] text-[var(--interactive-selection-foreground)] hover:bg-[var(--interactive-selection)] focus-visible:bg-[var(--interactive-selection)] active:bg-[var(--interactive-selection)]":"text-muted-foreground opacity-65 hover:opacity-100"),title:d==="preview"?"Switch to edit mode":"Switch to preview mode","aria-label":d==="preview"?"Switch to edit mode":"Switch to preview mode",children:t.jsx(F,{name:d==="preview"?"eye":"eye-off",className:"size-4"})})),$n(e?.path??"")&&t.jsx(zn,{currentMode:V?"preview":"edit",onToggle:E}),S&&t.jsxs(t.Fragment,{children:[t.jsx(zn,{currentMode:P,onToggle:Y}),P==="preview"&&t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>{re()},className:"size-6 p-0 text-foreground hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Save diagram",children:ee?t.jsx(F,{name:"check",className:"size-4 text-[color:var(--status-success)]"}):t.jsx(F,{name:"save-3",className:"size-4"})})]}),k&&U(te==="tree"?"Switch to Text View":"Switch to Tree View",t.jsx(q,{variant:"ghost",size:"sm",onClick:K,className:"size-6 p-0 text-muted-foreground opacity-65 hover:bg-transparent hover:opacity-100 focus-visible:bg-transparent active:bg-transparent",title:te==="tree"?"Switch to Text View":"Switch to Tree View",children:te==="tree"?t.jsx(F,{name:"code-sslash",className:"size-4"}):t.jsx(F,{name:"node-tree",className:"size-4"})})),Q&&U("Copy file contents",t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>{Oe()},className:"size-6 p-0 hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Copy file contents","aria-label":"Copy file contents",children:Qe?t.jsx(F,{name:"check",className:"size-4 text-[color:var(--status-success)]"}):t.jsx(F,{name:"clipboard",className:"size-4"})})),le&&U(`Copy file path (${n})`,t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>{Le()},className:"size-6 p-0 hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:`Copy file path (${n})`,"aria-label":`Copy file path (${n})`,children:Pe?t.jsx(F,{name:"check",className:"size-4 text-[color:var(--status-success)]"}):t.jsx(F,{name:"file-copy-2",className:"size-4"})})),ae&&U("Save file",t.jsx(q,{variant:"ghost",size:"sm",onClick:ae,className:"size-6 p-0 hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Save file","aria-label":"Save file",children:t.jsx(F,{name:"download",className:"size-4"})})),i?U("Exit fullscreen",t.jsx(q,{variant:"ghost",size:"sm",onClick:vt,className:"size-6 p-0 hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:"Exit fullscreen","aria-label":"Exit fullscreen",children:t.jsx(F,{name:"fullscreen-exit",className:"size-4"})})):!ue&&ye==="full"&&U(he?"Exit fullscreen":"Fullscreen",t.jsx(q,{variant:"ghost",size:"sm",onClick:Ie,className:"size-6 p-0 hover:bg-transparent focus-visible:bg-transparent active:bg-transparent",title:he?"Exit fullscreen":"Fullscreen","aria-label":he?"Exit fullscreen":"Fullscreen",children:he?t.jsx(F,{name:"fullscreen-exit",className:"size-4"}):t.jsx(F,{name:"fullscreen",className:"size-4"})}))]})},Tc=({open:e,onOpenChange:n,isSaving:a,onSaveAndContinue:i,onDiscardAndContinue:o})=>t.jsx(va,{open:e,onOpenChange:n,children:t.jsxs(ba,{showCloseButton:!1,className:"max-w-md",children:[t.jsxs(wa,{children:[t.jsx(ya,{children:"Unsaved changes"}),t.jsx(ka,{children:"Save your edits before continuing?"})]}),t.jsxs(ja,{children:[t.jsx(q,{variant:"outline",onClick:i,disabled:a,className:"border-[var(--status-success-border)] bg-[var(--status-success-background)] text-[var(--status-success)] hover:bg-[rgb(var(--status-success)/0.2)]",children:"Save changes"}),t.jsx(q,{variant:"destructive",onClick:o,children:"Discard"})]})]})}),ma=(e,n)=>e.startsWith(`${n}/`)?e.slice(n.length+1):e,Dc=e=>e.index==="A"||e.working_dir==="?"?"git-added":e.index==="D"?"git-deleted":e.index==="M"||e.working_dir==="M"?"git-modified":null,Ac=({root:e,openPaths:n,gitFiles:a})=>{const i=new Set(n),o=new Map,u=new Map,f={modified:0,added:0};for(const w of a??[]){o.has(w.path)||o.set(w.path,w);const N=+(w.index==="M"||w.working_dir==="M"),x=+(w.index==="A"||w.working_dir==="?");if(N===0&&x===0)continue;f.modified+=N,f.added+=x;const b=w.path.split("/");for(let j=1;j<b.length;j+=1){const C=b.slice(0,j).join("/");if(!C)continue;let v=u.get(C);v||(v={modified:0,added:0},u.set(C,v)),v.modified+=N,v.added+=x}}return{getFileStatus:w=>{if(i.has(w))return"open";if(o.size===0)return null;const N=ma(w,e),x=o.get(N);return x?Dc(x):null},getFolderBadge:w=>{if(!a)return null;const N=ma(w,e);if(!N)return f.modified+f.added>0?{...f}:null;const x=u.get(N);return x?{...x}:null}}},Oc=e=>new Set(e),Pc=({root:e,isMobile:n,searchQuery:a,onSearchQueryChange:i,searchInputRef:o,searching:u,searchResults:f,selectedFile:m,onSelectFile:g,onOpenDialog:w,currentDirectory:N,refreshRoot:x,childrenByDir:b,loadErrorsByDir:j,expandedPaths:C,isBrowserClient:v,alwaysShowActions:L,getFileStatus:I,getFolderBadge:l,fileRowPermissions:B,downloadFile:H,contextMenuPath:D,setContextMenuPath:$,rightClickMenuPath:G,setRightClickMenuPath:_,toggleDirectory:X,handleRevealPath:A,refreshDirectory:T})=>{const k=!!(e&&b[e]),V=e?j[e]:null,E=s.useMemo(()=>Oc(C),[C]);function R(d,O){const S=b[d]??[];return S.map((P,Y)=>{const ee=P.type==="directory",re=ee&&E.has(P.path),te=m?.path===P.path,K=Y===S.length-1;return t.jsxs("li",{className:"relative",children:[O>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"absolute top-3.5 left-[-12px] w-3 h-px bg-border/40"}),K&&t.jsx("span",{className:"absolute top-3.5 bottom-0 left-[-13px] w-[2px] bg-background"})]}),t.jsx(Qi,{node:P,root:e,isExpanded:re,isActive:te,isMobile:n,isBrowserClient:v,alwaysShowActions:L,status:ee?void 0:I(P.path),badge:ee?l(P.path):void 0,permissions:B,downloadFile:H,contextMenuPath:D,setContextMenuPath:$,rightClickMenuPath:G,setRightClickMenuPath:_,onSelect:g,onToggle:X,onRevealPath:A,onOpenDialog:w}),ee&&re&&t.jsxs("ul",{className:"flex flex-col gap-1 ml-3 pl-3 border-l border-border/40 relative",children:[j[P.path]?t.jsxs("li",{className:"flex items-center gap-2 px-2 py-1 typography-meta text-muted-foreground",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-[var(--status-error)]",title:j[P.path],children:j[P.path]}),t.jsxs(q,{variant:"ghost",size:"xs",className:"h-6 gap-1",onClick:()=>{T(P.path)},children:[t.jsx(F,{name:"refresh",className:"size-3.5"}),"Refresh"]})]}):null,R(P.path,O+1)]})]},P.path)})}return t.jsxs("section",{className:J("flex min-h-0 flex-col overflow-hidden",n?"h-full w-full bg-background":"h-full rounded-xl border border-border/60 bg-background/70"),children:[t.jsx("div",{className:J("flex flex-col gap-2 py-2",n?"px-3":"px-2"),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"relative flex-1 min-w-0",children:[t.jsx(F,{name:"search",className:"pointer-events-none absolute left-2 top-2 size-4 text-muted-foreground"}),t.jsx(Et,{ref:o,value:a,onChange:d=>i(d.target.value),placeholder:"Search files...",className:"h-8 pl-8 pr-8 typography-meta"}),a.trim().length>0&&t.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute right-2 top-2 inline-flex size-4 items-center justify-center text-muted-foreground hover:text-foreground",onClick:()=>{i(""),o.current?.focus()},children:t.jsx(F,{name:"close",className:"size-4"})})]}),t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex flex-shrink-0",children:t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>w("createFile",{path:N,type:"directory"}),className:"size-8 p-0 flex-shrink-0",title:"New File","aria-label":"New File",children:t.jsx(F,{name:"file-add",className:"size-4"})})})}),t.jsx(Ze,{side:"bottom",sideOffset:6,children:"New File"})]}),t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex flex-shrink-0",children:t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>w("createFolder",{path:N,type:"directory"}),className:"size-8 p-0 flex-shrink-0",title:"New Folder","aria-label":"New Folder",children:t.jsx(F,{name:"folder-add",className:"size-4"})})})}),t.jsx(Ze,{side:"bottom",sideOffset:6,children:"New Folder"})]}),t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex flex-shrink-0",children:t.jsx(q,{variant:"ghost",size:"sm",onClick:()=>{x()},className:"size-8 p-0 flex-shrink-0",title:"Refresh","aria-label":"Refresh",children:t.jsx(F,{name:"refresh",className:"size-4"})})})}),t.jsx(Ze,{side:"bottom",sideOffset:6,children:"Refresh"})]})]})}),t.jsx(Ca,{outerClassName:"flex-1 min-h-0",className:J("py-2",n?"px-3":"px-2"),children:t.jsx("ul",{className:"flex flex-col",children:u?t.jsxs("li",{className:"flex items-center gap-1.5 px-2 py-1 typography-meta text-muted-foreground",children:[t.jsx(F,{name:"loader-4",className:"size-4 animate-spin"}),"Searching..."]}):f.length>0?f.map(d=>{const O=m?.path===d.path;return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>{g(d)},className:J("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left text-foreground transition-colors",O?"bg-interactive-selection/70":"hover:bg-interactive-hover/40"),children:[t.jsx(Ka,{filePath:d.path,extension:d.extension}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-meta",style:{direction:"rtl",textAlign:"left"},title:d.path,children:d.relativePath??d.path})]})},d.path)}):V?t.jsxs("li",{className:"flex flex-col gap-2 px-2 py-1 typography-meta text-muted-foreground",children:[t.jsx("span",{className:"text-[var(--status-error)]",children:V}),t.jsxs(q,{variant:"outline",size:"xs",className:"w-fit gap-1.5",onClick:()=>{x()},children:[t.jsx(F,{name:"refresh",className:"size-3.5"}),"Refresh"]})]}):k?R(e,0):t.jsx("li",{className:"px-2 py-1 typography-meta text-muted-foreground",children:"Loading..."})})})]})},Xl=({mode:e="full",chrome:n="desktop",onClose:a,isVisible:i=!0})=>{const{files:o,runtime:u}=Qo(),f=n==="mobile",{currentTheme:m,availableThemes:g,lightThemeId:w,darkThemeId:N}=ei(),{isMobile:x,isTablet:b,screenWidth:j}=ti(),C=Ko(u.platform),v=x||b,L=qo(),I=ni()??"",l=oe(I.trim()),B=Nc(n,e),H=e!=="editor-only",D=e==="editor-only"&&!x,$=ri(I),[G,_]=s.useState(""),X=s.useRef(null),[A,T]=s.useState(!1),[k,V]=s.useState(l),[E,R]=s.useState(!1),[d,O]=s.useState(!0),[S,P]=s.useState(!1),[Y,ee]=s.useState(!1),[re,te]=s.useState(!1),K=s.useRef(null);s.useEffect(()=>{f&&(V(l),_(""),T(!1))},[f,l]);const Q=s.useRef(0),Qe=s.useCallback(r=>{Q.current=Math.max(0,Q.current+(r?1:-1))},[]),Oe=s.useCallback(r=>r instanceof Element?r.closest('[data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-item"]')!==null:!1,[]);s.useEffect(()=>{if(!re)return;const r=h=>{Q.current>0||Oe(h.target)||K.current&&!K.current.contains(h.target)&&te(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[Oe,re]);const le=s.useMemo(()=>g.find(r=>r.metadata.id===w)??zr(!1),[g,w]),Pe=s.useMemo(()=>g.find(r=>r.metadata.id===N)??zr(!0),[g,N]);s.useEffect(()=>{Lr(le),Lr(Pe)},[le,Pe]);const Le=s.useMemo(()=>[],[]),ae=Re(r=>l?r.byRoot[l]?.openPaths??Le:Le),ue=Re(r=>l?r.byRoot[l]?.selectedPath??null:null),ye=Re(r=>l?r.byRoot[l]?.expandedPaths??Le:Le),he=Re(r=>r.removeOpenPath),Ie=Re(r=>r.removeOpenPathsByPrefix),vt=Re(r=>r.removeExpandedPathsByPrefix),Ee=Re(r=>r.setSelectedPath),W=Re(r=>r.toggleExpandedPath),U=Re(r=>r.expandPaths),{childrenByDir:se,loadErrorsByDir:ge,isLoaded:de,loadDirectory:ot,refreshDirectory:zt,refreshRoot:qa}=Rc({files:o,root:l,activeDirectory:f?k:void 0,expandedPaths:ye,chrome:n,showGitignored:L,removeExpandedPathsByPrefix:vt,enabled:B,visible:i}),qe=s.useCallback(r=>{const h=oe(r),z=h.split("/"),M=z[z.length-1]||h,ne=M.includes(".")?M.split(".").pop()?.toLowerCase():void 0;return{name:M,path:h,type:"file",extension:ne}},[]),Mt=s.useMemo(()=>ae.map(qe),[ae,qe]),rn=s.useMemo(()=>{if(ue){const r=Yt(ue);if(ae.some(h=>Yt(h)===r))return ue}return ae[0]??null},[ae,ue]),p=s.useMemo(()=>rn?qe(rn):null,[rn,qe]),Ve=p?.path??"";s.useEffect(()=>{if(!l||!ue)return;const r=Yt(ue);ae.some(z=>Yt(z)===r)||Ee(l,ae[0]??null)},[ae,l,ue,Ee]);const Tt=!!(l&&Ve&&!Cn(Ve,l)),Vn=Tt?Ar(Ve):void 0,ce=s.useMemo(()=>({allowOutsideWorkspace:e==="editor-only"&&Tt,outsideFileGrant:Vn,directory:l||void 0}),[e,Tt,Vn,l]),an=s.useRef(null),[Ha,Ga]=s.useState({left:!1,right:!1}),Wn=s.useCallback(()=>{const r=an.current;r&&Ga({left:r.scrollLeft>2,right:r.scrollLeft+r.clientWidth<r.scrollWidth-2})},[]),_n=s.useRef(Wn);_n.current=Wn,s.useEffect(()=>{const r=an.current;if(!r)return;const h=()=>_n.current();h(),r.addEventListener("scroll",h,{passive:!0});const z=new ResizeObserver(h);return z.observe(r),()=>{r.removeEventListener("scroll",h),z.disconnect()}},[Mt.length]);const[ke,Be]=s.useState(""),[sn,it]=s.useState(!1),[Kn,xe]=s.useState(null),[Ua,He]=s.useState(""),ve=s.useRef(""),[et,je]=s.useState(null),[ct,Ce]=s.useState(void 0),[qn,Ne]=s.useState(null),be=Re(r=>r.activeRuntimeKey),[fe,$e]=s.useState(null),[on,Hn]=s.useState(!1),[Ja,ze]=s.useState(!1),[lt,Se]=s.useState(""),[Xa,Ya]=s.useState(`
|
|
4
4
|
`),Gn=s.useRef(null),Me=s.useRef(0),ut=s.useRef(null),[Un,cn]=s.useState(!1),Dt=Fe(r=>r.autoSaveEnabled),Za=Fe(r=>r.setAutoSaveEnabled),Qa=s.useRef(null),[es,ts]=s.useState(null),[ns,rs]=s.useState(null),{value:as,show:ss}=Or(!1,1200),{value:os,show:is}=Or(!1,1200),[cs,ls]=s.useState(!1),bt=s.useCallback(()=>{l&&Ee(l,null),Be(""),xe(null),He(""),je(null),Ce(void 0),Ne(null),$e(null),ze(!1),x&&T(!1)},[x,l,Ee]),{operation:us,target:ds,inputValue:fs,setInputValue:ms,submitting:ps,inputRef:hs,open:gs,close:xs,submit:vs,capabilities:{canCreateFile:Jn,canCreateFolder:Xn,canRename:Yn,canDelete:Zn}}=yi({files:o,root:l,selectedPath:p?.path??"",refreshDirectory:zt,removeOpenPathsByPrefix:Ie,clearSelectedPath:bt}),Qn=!!o.revealPath,bs=Xt(r=>r.availableApps),ws=Xt(r=>r.isCacheStale),er=Xt(r=>r.initialize),ys=Xt(r=>r.loadInstalledApps);s.useEffect(()=>{er()},[er]);const ks=s.useCallback(r=>{o.revealPath&&o.revealPath(r).catch(()=>{pe.error("Failed to reveal path")})},[o]),js=s.useCallback(async r=>{if(!p?.path||await Ho(p.path,r.id,r.appName)||await Mr(p.path,r.appName))return;const M=ki(p.path)||l;M&&await Mr(M,r.appName)||pe.error(`Failed to open in ${r.appName}`)},[l,p?.path]),Cs=Fe(r=>r.fileEditorKeymap),tr=Fe(r=>r.expandedEditorToolbar);s.useEffect(()=>{Se("")},[p?.path]);const nr=s.useRef("");s.useEffect(()=>{!l||nr.current===l||(nr.current=l,Be(""),xe(null),He(""),je(null),Ce(void 0),Ne(null),$e(null),ze(!1),T(!1))},[l]);const rr=s.useRef(be);s.useEffect(()=>{rr.current!==be&&(rr.current=be,Me.current+=1,ut.current=null,Be(""),Se(""),xe(null),it(!1),He(""),je(null),Ce(void 0),Ne(null),$e(null),ze(!1),cn(!1))},[be]);const Ns=f?k:I,{results:ar,searching:sr}=ji({directory:Ns,query:G,chrome:n,showGitignored:L}),At=s.useCallback(async(r,h)=>{if(o.readFile){const Ae=await o.readFile(r,{...h??{},directory:l||void 0});return{content:Ae.content??"",revision:Ae.revision,exists:Ae.exists}}const z=new URLSearchParams({path:r});h?.allowOutsideWorkspace&&z.set("allowOutsideWorkspace","true"),h?.outsideFileGrant&&z.set("outsideFileGrant",h.outsideFileGrant),h?.optional&&z.set("optional","true"),l&&z.set("directory",l);const M=await Tr(`/api/fs/read?${z.toString()}`,{cache:h?.optional?"no-store":"default"});if(!M.ok){const Ae=await M.json().catch(()=>({error:M.statusText}));throw new Error(Ae.error||"Failed to read file")}const ne=await M.text(),Z=M.headers?.get?.("x-pichamber-file-revision"),De=M.headers?.get?.("x-pichamber-file-exists")!=="false";return{content:ne,revision:typeof Z=="string"&&Z.length>0?Z:De?void 0:null,exists:De}},[o,l]),dt=s.useCallback(async(r,h)=>{if(o.statFile){const z=await o.statFile(r,{...h??{},directory:l||void 0});return{path:z.path,size:z.size,mtimeMs:z.mtimeMs,revision:z.revision}}return null},[o,l]);s.useEffect(()=>{if(!l||!o.statFile||ae.length===0)return;let r=!1;const h=[...ae];return Promise.all(h.map(async z=>{try{const M=await o.statFile?.(z,{directory:l||void 0});!r&&M&&!M.isFile&&Ie(l,z)}catch(M){!r&&Br(M)&&Ie(l,z)}})),()=>{r=!0}},[o,ae,Ie,l]);const ln=s.useMemo(()=>ke.length>Rt?`${ke.slice(0,Rt)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./vendor-boot-DyL2td56.js";import{R as h}from"./vendor-react-DASdDPIk.js";import{o as z,I as f,b2 as q,cH as O,ae as I,t as S,a4 as B,B as x}from"./useAppFontEffects
|
|
1
|
+
import{j as n}from"./vendor-boot-DyL2td56.js";import{R as h}from"./vendor-react-DASdDPIk.js";import{o as z,I as f,b2 as q,cH as O,ae as I,t as S,a4 as B,B as x}from"./useAppFontEffects--lKKtKVo.js";import{p as T}from"./vendor-dompurify-r8glNMJW.js";import{o as m}from"./index-Dd2OcIUY.js";const ve=(e,t)=>!e||!t?!1:e.toLowerCase()===t.toLowerCase(),v=e=>!e||e.permissionFallback?!1:e.capabilities?.canPush!==!0,j=e=>!e||e.permissionFallback||e.isAuthor?!1:e.capabilities?.canPush!==!0,D=e=>!e||e.permissionFallback?{allowed:!0,reason:null}:e.capabilities?.canComment!==!0?{allowed:!1,reason:"You need read access to comment"}:{allowed:!0,reason:null},F=(e,t)=>e.trim()?e.trim().length>t?`Title is too long (max ${t} characters)`:null:"Enter a title",Ne=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"merged",label:"Merged"},{id:"all",label:"All"}],ke=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"review",label:"Review requested"},{id:"assigned",label:"Assigned"}],je=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],U=e=>{const t=(e.conclusion??e.state??e.status??"").toLowerCase();return t.includes("fail")||t.includes("error")||t.includes("cancel")||t==="timed_out"||t==="action_required"},W=e=>{const t={failed:{runs:0,statuses:0},pending:{runs:0,statuses:0},passed:{runs:0,statuses:0},other:{runs:0,statuses:0}};if(!e)return t;for(const r of e.runs??[]){const s=(r.conclusion??r.state??r.status??"").toLowerCase();U(r)?t.failed.runs+=1:s.includes("success")||s==="neutral"||s==="skipped"?t.passed.runs+=1:t.pending.runs+=1}for(const r of e.statuses??[]){const s=(r.state??"").toLowerCase();s==="failure"||s==="error"?t.failed.statuses+=1:s==="success"?t.passed.statuses+=1:s==="pending"?t.pending.statuses+=1:t.other.statuses+=1}return t},Ce=[{id:"merge",label:"Merge commit",description:"Add all commits with a merge commit"},{id:"squash",label:"Squash and merge",description:"Combine commits into one commit"},{id:"rebase",label:"Rebase and merge",description:"Replay commits onto the base branch"}],$e=e=>!e||e.state!=="open"?null:e.mergeableState==="behind"?{tone:"warning",icon:"error-warning",title:"This branch is out of date with",detail:"Merge the latest changes from the base branch into this branch.",canUpdate:!0}:e.mergeableState==="dirty"?{tone:"error",icon:"alert",title:"This branch has conflicts with",detail:"Resolve conflicts locally or on GitHub before merging.",canUpdate:!1}:null,Ae=(e,t,r)=>{const s=r?`“${r}”`:"this branch",a=t?`“${t}”`:"the base branch";switch(e){case"merge":return{title:"Merge this pull request?",detail:`Every commit from ${s} will be added to ${a} with a merge commit.`,confirm:"Merge pull request",progress:"Merging…"};case"squash":return{title:"Squash and merge?",detail:`The commits from ${s} will be combined into one commit on ${a}.`,confirm:"Squash and merge",progress:"Merging…"};case"rebase":return{title:"Rebase and merge?",detail:`The commits from ${s} will be replayed onto ${a} without a merge commit.`,confirm:"Rebase and merge",progress:"Merging…"};case"draft":return{title:"Convert to draft?",detail:"Reviewers will see that this pull request is not ready to merge.",confirm:"Convert to draft",progress:"Converting…"};case"ready":return{title:"Mark as ready for review?",detail:"Reviewers will be asked to review this pull request.",confirm:"Ready for review",progress:"Updating…"};case"close":return{title:"Close this pull request?",detail:"The pull request will close without merging. You can reopen it later.",confirm:"Close pull request",progress:"Closing…"};case"reopen":return{title:"Reopen this pull request?",detail:"The pull request will return to its previous open state.",confirm:"Reopen pull request",progress:"Reopening…"};case"update-branch":return{title:"Update this branch?",detail:`This brings ${s} up to date with ${a}. History may be rewritten.`,confirm:"Update branch",progress:"Updating…"};default:return{title:"Continue?",detail:"This action cannot be undone from here.",confirm:"Confirm",progress:"Working…"}}},Se=e=>{if(!e)return null;const t=W(e),r=t.failed.runs+t.failed.statuses,s=t.pending.runs+t.pending.statuses,a=t.passed.runs+t.passed.statuses,i=e.runs.length+e.statuses.length;return{text:`${r} failing · ${s} pending · ${a} passed`,failed:r,pending:s,passed:a,total:i}},Te=(e,t,r)=>{if(!t)return{allowed:!1,reason:"Pull request is still loading"};const s=t.state==="merged",a=t.state==="open";switch(e){case"merge":case"squash":case"rebase":return a?t.draft?{allowed:!1,reason:"Marked as draft"}:t.mergeable===!1||t.mergeableState==="dirty"?{allowed:!1,reason:"Has merge conflicts"}:t.mergeableState==="blocked"?{allowed:!1,reason:"Blocked by required checks"}:v(r)?{allowed:!1,reason:"You need write access to merge"}:{allowed:!0,reason:null}:{allowed:!1,reason:s?"Already merged":"Pull request is closed"};case"ready":return a?t.draft?v(r)?{allowed:!1,reason:"You need write access to mark ready"}:{allowed:!0,reason:null}:{allowed:!1,reason:"Already ready for review"}:{allowed:!1,reason:"Pull request is not open"};case"draft":return a?t.draft?{allowed:!1,reason:"Already a draft"}:v(r)?{allowed:!1,reason:"You need write access to convert to draft"}:{allowed:!0,reason:null}:{allowed:!1,reason:"Pull request is not open"};case"close":return a?j(r)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null}:{allowed:!1,reason:s?"Already merged":"Already closed"};case"reopen":return a?{allowed:!1,reason:"Already open"}:s?{allowed:!1,reason:"Already merged"}:j(r)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"update-branch":return a?v(r)?{allowed:!1,reason:"You need write access to update the branch"}:{allowed:!0,reason:null}:{allowed:!1,reason:"Pull request is not open"};default:return{allowed:!0,reason:null}}},Re=e=>H(e).allowed!==!0?[]:e&&!e.permissionFallback&&e.isAuthor===!0?["comment"]:["comment","approve","request-changes"],He=e=>e.verdict==="approve"?!0:e.summary.trim().length>0||e.pendingCount>0,_e=e=>H(e),Me=e=>!e||e.permissionFallback?{allowed:!0,reason:null}:e.capabilities?.canPush!==!0?{allowed:!1,reason:"You need write access to resolve threads"}:{allowed:!0,reason:null},Y=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,Ge=e=>{if(!e)return{original:"",modified:""};const t=[],r=[];let s=!1;for(const a of e.split(`
|
|
2
2
|
`)){if(a.startsWith("@@")){s&&(t.push("…"),r.push("…")),s=!0;continue}if(!s||a.startsWith("\\"))continue;const i=a[0],l=a.slice(1);i===" "?(t.push(l),r.push(l)):i==="-"?t.push(l):i==="+"?r.push(l):(t.push(a),r.push(a))}return{original:t.join(`
|
|
3
3
|
`),modified:r.join(`
|
|
4
4
|
`)}},Le=e=>{switch(e.split(".").pop()?.toLowerCase()??""){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"py":return"python";case"rb":return"ruby";case"go":return"go";case"rs":return"rust";case"css":case"scss":return"css";case"html":return"html";case"yaml":case"yml":return"yaml";case"sh":return"shell";default:return"text"}},Pe=e=>{const t={newToSynthetic:new Map,oldToSynthetic:new Map,syntheticToNew:new Map,syntheticToOld:new Map};if(!e)return t;let r=!1,s=0,a=0,i=0,l=0;for(const o of e.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./vendor-boot-DyL2td56.js";import{R as r}from"./vendor-react-DASdDPIk.js";import{p as z,q as K,bo as F,t as L,ak as Q,al as W,am as J,an as V,ao as X,B as Y,I as Z}from"./useAppFontEffects
|
|
1
|
+
import{j as s}from"./vendor-boot-DyL2td56.js";import{R as r}from"./vendor-react-DASdDPIk.js";import{p as z,q as K,bo as F,t as L,ak as Q,al as W,am as J,an as V,ao as X,B as Y,I as Z}from"./useAppFontEffects--lKKtKVo.js";import{j as _,d as ee}from"./GitHubListPrimitives-XkALat1v.js";import{a as se}from"./GitHubDetailScaffold-q4YP8iyJ.js";import{p as P,e as te,f as re}from"./githubLink-iQ51wqRa.js";import"./vendor-clsx-B-dksMZM.js";import"./index-Dd2OcIUY.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-B1GRkkKC.js";import"./vendor-dompurify-r8glNMJW.js";const ge=({directory:n,open:p,onClose:j})=>{const i=z().github??null,R=K(e=>e.entriesByDirectory[n]??null),C=K(e=>e.ensureScope),G=F(n||null),[m,B]=r.useState("issue"),[h,q]=r.useState(null),[d,A]=r.useState(""),[H,k]=r.useState([]),[M,S]=r.useState(!1),[$,w]=r.useState(null),[D,E]=r.useState(!1),[g,I]=r.useState(null);r.useEffect(()=>{!p||!i||C(n,i)},[p,n,i,C]);const a=r.useMemo(()=>(R?.scope?.repositories??[]).filter(t=>t.host&&t.owner&&t.repo&&!t.disabledReason).map(t=>({owner:t.owner,repo:t.repo,ref:`${t.host}/${t.owner}/${t.repo}`})),[R]);r.useEffect(()=>{p&&q(G??a[0]?.ref??null)},[p,G,a]);const o=r.useMemo(()=>P(d,a),[d,a]),b=r.useRef(0),T=r.useCallback(async(e,t,c)=>{if(!i)return;const x=b.current+=1,u=e.trim(),v=P(u,a);if(!u||v.link||v.outOfScope){k([]),w(null),S(!1);return}S(!0),w(null);try{if(c==="issue"){const f=await i.issuesList(n,t,{state:"all",q:u});if(b.current!==x)return;k(f.items.slice(0,60).map(l=>({kind:"issue",number:l.number,title:l.title,url:l.url,repo:t})))}else{const f=await i.pullsList(n,t,{state:"all",q:u});if(b.current!==x)return;k(f.items.slice(0,60).map(l=>({kind:"pr",number:l.number,title:l.title,url:l.url,repo:t})))}}catch(f){if(b.current!==x)return;k([]),w(f instanceof Error?f.message:"Search failed")}finally{b.current===x&&S(!1)}},[i,n,a]);r.useEffect(()=>{if(!p||!h)return;const e=setTimeout(()=>{T(d,h,m)},250);return()=>clearTimeout(e)},[p,d,h,m,T]);const U=r.useCallback(async()=>{if(!i||!o.link)return null;const{kind:e,number:t,owner:c,repo:x}=o.link,u=c&&x?a.find(l=>l.owner?.toLowerCase()===c.toLowerCase()&&l.repo?.toLowerCase()===x.toLowerCase())?.ref??null:h;if(!u)return null;const f=/^https?:\/\//i.test(d.trim())?e:m;E(!0);try{if(f==="pr"){const N=await i.pullGet(n,u,t);return N.pr?{kind:"pr",number:t,title:N.pr.title,url:N.pr.url,repo:u}:null}const l=await i.issueGet(n,u,t);return l.issue?{kind:"issue",number:t,title:l.issue.title,url:l.issue.url,repo:u}:null}finally{E(!1)}},[i,o.link,n,m,d,h,a]),y=r.useCallback(async e=>{if(!i)return;const t=`${e.repo}#${e.number}`;I(t);try{const c=await i.agentContext(n,e.repo,e.kind==="pr"?"pr":"issue",e.number);te({kind:e.kind,number:e.number,title:e.title,url:e.url,contextText:c.text},re()),L.success(e.kind==="pr"?"Pull request linked":"Issue linked"),j()}catch(c){L.error(c instanceof Error?c.message:"Failed to link")}finally{I(null)}},[i,n,j]),O=r.useCallback(async()=>{const e=await U();if(!e){L.error("Not found in this repository");return}await y(e)},[U,y]);return p?s.jsx(Q,{open:p,onOpenChange:e=>{e||j()},children:s.jsxs(W,{className:"max-w-md w-[calc(100vw-2rem)]",children:[s.jsxs(J,{children:[s.jsx(V,{children:"Link issue or pull request"}),s.jsx(X,{children:"Search, type #123, or paste a GitHub URL for a repository in scope."})]}),i?s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(_,{ariaLabel:"Link kind",value:m,onChange:e=>B(e),options:[{id:"issue",label:"Issues"},{id:"pr",label:"Pull requests"}]}),a.length>1?s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"sr-only",children:"Repository"}),s.jsx("select",{"aria-label":"Repository",value:h??"",onChange:e=>q(e.target.value||null),className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-[var(--surface-elevated)] px-2 typography-micro text-foreground",children:a.map(e=>s.jsxs("option",{value:e.ref,children:[e.owner,"/",e.repo]},e.ref))})]}):null,s.jsx(ee,{value:d,onChange:A,placeholder:m==="issue"?"Search issues, #123, or paste a URL":"Search pull requests, #123, or paste a URL",ariaLabel:m==="issue"?"Search issues":"Search pull requests"}),o.outOfScope?s.jsx("p",{className:"typography-micro text-muted-foreground",role:"note",children:"That repository is outside this session's scope. Pick a repository listed above."}):null,o.link?s.jsx(Y,{type:"button",variant:"outline",size:"sm",onClick:O,disabled:D||g!==null||!h&&!(o.link.owner&&o.link.repo),"aria-label":`Link ${m==="pr"?"pull request":"issue"} number ${o.link.number}`,children:D||g?"Working…":`Link #${o.link.number}`}):null,$?s.jsx("p",{className:"typography-micro text-[var(--status-error)]",role:"alert",children:$}):null,s.jsx("div",{className:"max-h-64 min-h-0 overflow-y-auto",role:"list","aria-label":"Matches",children:M?s.jsxs("p",{className:"flex items-center gap-2 p-2 typography-ui text-muted-foreground",children:[s.jsx(Z,{name:"loader-4",className:"size-4 animate-spin"})," Searching…"]}):H.length===0&&d.trim()&&!o.link?s.jsx("p",{className:"p-2 typography-ui text-muted-foreground",children:"No matches. Try #123 or a GitHub URL."}):s.jsx("ul",{className:"flex flex-col gap-0.5",children:H.map(e=>{const t=`${e.repo}#${e.number}`;return s.jsx("li",{role:"listitem",children:s.jsxs("button",{type:"button",onClick:()=>{y(e)},disabled:g!==null,"aria-label":`Link ${e.kind==="pr"?"pull request":"issue"} #${e.number} ${e.title}`,className:"flex w-full items-start gap-2 rounded-md px-2 py-2 text-left hover:bg-interactive-hover disabled:opacity-60",children:[s.jsx("span",{className:"mt-0.5 shrink-0",children:s.jsx(se,{kind:e.kind,state:"open"})}),s.jsx("span",{className:"min-w-0 flex-1",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsxs("span",{className:"shrink-0 font-mono typography-micro text-muted-foreground",children:["#",e.number]}),s.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label text-foreground",title:e.title,children:g===t?"Linking…":e.title})]})})]})},t)})})})]}):s.jsx("p",{className:"typography-ui text-muted-foreground",children:"GitHub is not available in this runtime."})]})}):null};export{ge as GitHubLinkPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-boot-DyL2td56.js";import{R as u}from"./vendor-react-DASdDPIk.js";import{I as o,B as l,ai as f}from"./useAppFontEffects
|
|
1
|
+
import{j as e}from"./vendor-boot-DyL2td56.js";import{R as u}from"./vendor-react-DASdDPIk.js";import{I as o,B as l,ai as f}from"./useAppFontEffects--lKKtKVo.js";import{o as m}from"./index-Dd2OcIUY.js";import{W as b,X as g}from"./GitHubDetailScaffold-q4YP8iyJ.js";const G=({options:r,value:s,onChange:t,ariaLabel:a})=>e.jsx("div",{role:"tablist","aria-label":a,className:"flex flex-wrap gap-1",children:r.map(i=>{const n=i.id===s;return e.jsx(l,{type:"button",variant:"chip",size:"xs",role:"tab","aria-selected":n,"aria-pressed":n,onClick:()=>t(i.id),className:m(n&&"bg-interactive-selection text-interactive-selection-foreground"),children:i.label},i.id)})}),H=({value:r,onChange:s,placeholder:t,ariaLabel:a})=>{const[i,n]=u.useState(r);u.useEffect(()=>n(r),[r]);const c=u.useRef(s);return c.current=s,u.useEffect(()=>{if(i===r)return;const d=setTimeout(()=>c.current(i),80);return()=>clearTimeout(d)},[i,r]),e.jsxs("span",{className:"relative block min-w-0 flex-1",children:[e.jsx(o,{name:"search","aria-hidden":"true",className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(f,{value:i,onChange:d=>n(d.target.value),placeholder:t??"Search","aria-label":a??"Search",className:"h-8 pl-7"})]})},S=({rows:r=7,label:s})=>{const t=["w-3/5","w-2/5","w-1/2","w-2/3","w-2/5","w-3/5","w-1/2"],a=["w-2/5","w-1/3","w-2/5","w-1/4","w-1/3","w-2/5","w-1/3"];return e.jsx("div",{role:"status","aria-label":s,className:"flex animate-pulse flex-col p-1",children:Array.from({length:r},(i,n)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md px-2 py-2",children:[e.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0 rounded-full bg-muted-foreground/15"}),e.jsxs("span",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:m("block h-3.5 rounded bg-muted-foreground/15",t[n%t.length])}),e.jsx("span",{"aria-hidden":"true",className:m("block h-3 rounded bg-muted-foreground/15",a[n%a.length])})]}),e.jsxs("span",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:"block h-3 w-12 rounded bg-muted-foreground/15"}),e.jsx("span",{"aria-hidden":"true",className:"block h-3 w-10 rounded bg-muted-foreground/15"})]})]},n))})},p=({icon:r,title:s,description:t,action:a})=>e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1.5 p-6 text-center",children:[e.jsx(o,{name:r,"aria-hidden":"true",className:"size-6 text-muted-foreground/60"}),e.jsx("p",{className:"typography-ui-label font-medium text-foreground",children:s}),t?e.jsx("p",{className:"max-w-60 typography-micro text-muted-foreground",children:t}):null,a]}),j=({hasMore:r,isLoading:s,onLoadMore:t,label:a})=>r?e.jsx("div",{className:"flex justify-center px-2 py-2",children:e.jsx(l,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:s,children:s?"Loading…":a??"Load more"})}):null,z=({summary:r,summaryTitle:s})=>e.jsx("footer",{className:"flex shrink-0 items-center justify-between border-t border-border/60 px-2 py-1.5 typography-micro text-muted-foreground",children:e.jsx("span",{className:"min-w-0 truncate",title:s??r,children:r})}),C=({matchSummary:r,searching:s,onSearchAll:t})=>e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-border/60 px-2 py-1.5 typography-micro text-muted-foreground",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",title:r,children:r}),e.jsx(l,{type:"button",variant:"ghost",size:"xs",onClick:t,disabled:s,children:s?"Searching…":"Search all on GitHub"})]}),R=({title:r,isSearching:s,error:t,hasResults:a,hasMore:i,isLoadingMore:n,onRetry:c,onLoadMore:d,children:h})=>{const x=t?.kind==="rate-limited"?"GitHub rate limit reached — try again in a little while.":"Couldn't search GitHub.";return e.jsxs("section",{"aria-label":r,className:"border-t border-border/60",children:[e.jsx("p",{className:"px-3 pb-0.5 pt-1.5 typography-micro font-medium text-muted-foreground",children:r}),t&&!a?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 typography-micro text-muted-foreground",children:[e.jsx(o,{name:"error-warning",className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1",children:x}),e.jsx(l,{type:"button",variant:"outline",size:"xs",onClick:c,children:"Retry"})]}):null,t&&a?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-1 typography-micro text-muted-foreground",children:[e.jsx("span",{className:"min-w-0 flex-1",children:x}),e.jsx(l,{type:"button",variant:"ghost",size:"xs",onClick:c,children:"Retry"})]}):null,!t&&s&&!a?e.jsx("p",{className:"px-3 py-2 typography-micro text-muted-foreground",role:"status",children:"Searching GitHub…"}):null,a?e.jsx("div",{className:"flex flex-col p-1 pt-0.5",children:h}):null,!t&&a?e.jsx(j,{hasMore:i,isLoading:n,onLoadMore:d,label:"Load more results"}):null]})},E=({error:r,onRetry:s,label:t})=>{if(!b(r))return null;const a=g(r);return e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-[var(--status-error-border)] bg-[var(--status-error-background)] px-3 py-2 typography-micro text-foreground",role:"alert","aria-label":`${t} failed to load`,children:[e.jsx(o,{name:"error-warning",className:"size-4 shrink-0 text-[var(--status-error)]"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[t," failed to load",r?` — ${a}`:""]}),e.jsx(l,{type:"button",variant:"outline",size:"xs",onClick:s,children:"Retry"})]})},L=({number:r,kindLabel:s,onOpen:t})=>e.jsx("div",{className:"flex flex-col p-1",children:e.jsxs("button",{type:"button",onClick:t,"aria-label":`Open ${s} #${r}`,className:"group/github-row flex w-full items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-interactive-hover",children:[e.jsx("span",{className:"inline-flex w-4 shrink-0 items-center justify-center",children:e.jsx(o,{name:"external-link",className:"size-3.5 text-muted-foreground","aria-hidden":"true"})}),e.jsxs("span",{className:"min-w-0 flex-1 truncate typography-ui-label text-foreground",children:["Open #",r]}),e.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground",children:"Not in the loaded list"})]})}),I=({onRetry:r})=>e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-[var(--status-warning-border)] bg-[var(--status-warning-background)] px-3 py-1.5 typography-micro text-foreground",children:[e.jsx(o,{name:"error-warning",className:"size-3.5 shrink-0 text-[var(--status-warning)]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:"Showing saved results — last refresh failed"}),e.jsx("button",{type:"button",onClick:r,className:"shrink-0 underline","aria-label":"Retry GitHub refresh",children:"Retry"})]}),T=({kind:r,noItemsTitle:s,noItemsBody:t,noItemsIcon:a,noItemsAction:i,onClearFilters:n})=>r==="no-match"?e.jsx(p,{icon:"search",title:"Nothing matches these filters",description:"Try fewer words, or search by number, author, or label.",action:n?e.jsx(l,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Clear filters"}):void 0}):e.jsx(p,{icon:a??"git-pull-request",title:s,description:t,action:i});export{S as G,E as S,p as a,j as b,I as c,H as d,T as e,L as f,R as g,C as h,z as i,G as j};
|