@pi-chamber/web 1.0.6-rc.1 → 1.0.6-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/assets/{DiagramView-DUxXEKjQ.js → DiagramView-Dq5w8TCG.js} +1 -1
  2. package/dist/assets/{DiffView-DEd3rdnu.js → DiffView-CFIjN2zy.js} +1 -1
  3. package/dist/assets/{FileSaveConflictDialog-C6o4fYIn.js → FileSaveConflictDialog-dFqLbFzT.js} +1 -1
  4. package/dist/assets/{FilesView-Ccl4CxjR.js → FilesView-D0b2mEKA.js} +1 -1
  5. package/dist/assets/{GitHubDetailScaffold-DlgVm5uD.js → GitHubDetailScaffold-B2HRjT8V.js} +1 -1
  6. package/dist/assets/{GitHubLinkPicker-BgDZR-3K.js → GitHubLinkPicker-D7I3J9_O.js} +1 -1
  7. package/dist/assets/{GitHubListPrimitives-BTeI3B3C.js → GitHubListPrimitives-Dw5LAmzm.js} +1 -1
  8. package/dist/assets/{GitView-BkrH0HFQ.js → GitView-Dhr7qVeI.js} +3 -3
  9. package/dist/assets/{IssuesSurface-CD1m8BHP.js → IssuesSurface-Bya7OsRl.js} +1 -1
  10. package/dist/assets/{JsonTreeView-RLgBKik9.js → JsonTreeView-BJr5kBg4.js} +1 -1
  11. package/dist/assets/{MarkdownRendererImpl-BkfhE9NN.js → MarkdownRendererImpl-DadkFPCz.js} +1 -1
  12. package/dist/assets/{PatchDiff-BLNLrGYa.js → PatchDiff-B6RBZULC.js} +1 -1
  13. package/dist/assets/{PierreDiffViewer-iLnLAFeL.js → PierreDiffViewer-YJJQkE7t.js} +1 -1
  14. package/dist/assets/{PullRequestsSurface-_kgJMFTh.js → PullRequestsSurface-D8JpzP5l.js} +2 -2
  15. package/dist/assets/{SessionSwitcherContent-BCOUKRch.js → SessionSwitcherContent-CJ6C2ZKG.js} +1 -1
  16. package/dist/assets/{SessionSwitcherDropdown-CA64t2xd.js → SessionSwitcherDropdown-CEAid1Bd.js} +2 -2
  17. package/dist/assets/{SessionUnreadDot-BZy2DM6H.js → SessionUnreadDot-I1_tmqY9.js} +1 -1
  18. package/dist/assets/{SettingsView-TwUy1kXV.js → SettingsView-B-b76XDV.js} +3 -3
  19. package/dist/assets/{SettingsWindow-BXE4JP-T.js → SettingsWindow-5dK-buUn.js} +1 -1
  20. package/dist/assets/{ToolOutputDialog-tiXT-Xts.js → ToolOutputDialog-gITobhpo.js} +1 -1
  21. package/dist/assets/{ToolPartDiffPreview-CylbiIKd.js → ToolPartDiffPreview-nOJxBl-Y.js} +1 -1
  22. package/dist/assets/{VirtualizedFileDiff-Cccy1L8L.js → VirtualizedFileDiff-BmJk6XJm.js} +1 -1
  23. package/dist/assets/{computeVirtualFileMetrics-ydVGT2RY.js → computeVirtualFileMetrics-BCFpa-1q.js} +1 -1
  24. package/dist/assets/{contextFileOpenGuard--7BLkncT.js → contextFileOpenGuard-BCi5nTZp.js} +1 -1
  25. package/dist/assets/{gitStatusPredicates-BzR54iPh.js → gitStatusPredicates-BQOqDJU1.js} +1 -1
  26. package/dist/assets/{githubLink-WO5BkC0U.js → githubLink-CCmFsyTF.js} +1 -1
  27. package/dist/assets/{index-nOAE6UDy.js → index-BaeFf5Q8.js} +1 -1
  28. package/dist/assets/{main-B4UP1bOp.js → main-CgXs2e27.js} +2 -2
  29. package/dist/assets/{main-DxYfmK5D.js → main-DoVzQV56.js} +4 -4
  30. package/dist/assets/{markdownCore-DIn2dwA6.js → markdownCore-DTNVLpYS.js} +1 -1
  31. package/dist/assets/{miniChat-CMGH4R_p.js → miniChat-CrAin_em.js} +2 -2
  32. package/dist/assets/{mobile-BJz0lBjK.js → mobile-EK9oTupb.js} +2 -2
  33. package/dist/assets/{pi-session-focus-preference-D6vrJGbH.js → pi-session-focus-preference-BoN1cyoG.js} +1 -1
  34. package/dist/assets/{renderDiffWithHighlighter-JwKOWdBN.js → renderDiffWithHighlighter-DixZh5Zd.js} +1 -1
  35. package/dist/assets/{renderElectronMiniChatApp-DYdkuv5N.js → renderElectronMiniChatApp-0MqKeGfI.js} +2 -2
  36. package/dist/assets/{renderFileWithHighlighter-RJTrDxFH.js → renderFileWithHighlighter-s6fQq9eg.js} +1 -1
  37. package/dist/assets/{renderMobileApp-x1P9U65-.js → renderMobileApp-BLoXL_J8.js} +3 -3
  38. package/dist/assets/{runtimeEndpointReset-OqTh3bbO.js → runtimeEndpointReset-Bv2Y1fMm.js} +4 -4
  39. package/dist/assets/{useAppFontEffects-CHnpTOtc.js → useAppFontEffects-D2xXdmYC.js} +6 -6
  40. package/dist/assets/{useFilesViewSearch-DeVixiGZ.js → useFilesViewSearch-BKotcAUN.js} +1 -1
  41. package/dist/assets/{useGitHubRemoteSearch-GjQca1iD.js → useGitHubRemoteSearch-CZ92xKSw.js} +1 -1
  42. package/dist/assets/{useSwitcherItems-DYtnl0T2.js → useSwitcherItems-BfA4omGb.js} +1 -1
  43. package/dist/assets/{web-components-CIPJC1JE.js → web-components-Bz5oGa3p.js} +1 -1
  44. package/dist/index.html +1 -1
  45. package/dist/mini-chat.html +1 -1
  46. package/dist/mobile.html +1 -1
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e,aS as l,aT as d,aU as c,aV as p,aW as m,aX as g,aY as u}from"./vendor-boot-CoTxysn6.js";import{R as i}from"./vendor-react-Bz1tRBxM.js";import{f as s}from"./index-C2ISrmRR.js";import{I as b}from"./useAppFontEffects-CHnpTOtc.js";import{S as f}from"./SettingsView-TwUy1kXV.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./runtimeEndpointReset-OqTh3bbO.js";import"./SessionUnreadDot-BZy2DM6H.js";/* empty css */import"./permissionStore-zIpxq9Pq.js";import"./vendor-qrcode-gzL9QFkg.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js";import"./collapsible-0yfy07W2.js";import"./vendor-base-ui-C7vVMZTg.js";const F=({open:r,onOpenChange:t})=>{const a=i.useId(),n=i.useCallback(()=>typeof document>"u"?!1:!!document.querySelector('[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]'),[]);return e.jsx(l,{open:r,onOpenChange:o=>{!o&&n()||t(o)},children:e.jsxs(d,{children:[e.jsx(c,{className:s("oc-glass-backdrop fixed inset-0 z-50 bg-black/25 dark:bg-black/40","transition-opacity duration-150 ease-out","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0")}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center pointer-events-none",children:e.jsxs(p,{"aria-describedby":a,className:s("relative pointer-events-auto","w-[92vw] max-w-[1120px] h-[84vh] max-h-[900px]","rounded-2xl border border-border/80 shadow-2xl overflow-hidden origin-center","bg-sidebar","transition-all duration-150 ease-out","data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]","data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]","data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]"),children:[e.jsx(m,{className:"sr-only",children:"Settings"}),e.jsx(g,{id:a,className:"sr-only",children:"PiChamber settings window."}),e.jsx(u,{"aria-label":"Close settings",className:"absolute right-3 top-3 z-10 inline-flex size-8 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",children:e.jsx(b,{name:"close",className:"size-4"})}),e.jsx(f,{onClose:()=>t(!1),isWindowed:!0})]})})]})})};export{F as SettingsWindow};
1
+ import{j as e,aS as l,aT as d,aU as c,aV as p,aW as m,aX as g,aY as u}from"./vendor-boot-CoTxysn6.js";import{R as i}from"./vendor-react-Bz1tRBxM.js";import{f as s}from"./index-C2ISrmRR.js";import{I as b}from"./useAppFontEffects-D2xXdmYC.js";import{S as f}from"./SettingsView-B-b76XDV.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./runtimeEndpointReset-Bv2Y1fMm.js";import"./SessionUnreadDot-I1_tmqY9.js";/* empty css */import"./permissionStore-zIpxq9Pq.js";import"./vendor-qrcode-gzL9QFkg.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js";import"./collapsible-0yfy07W2.js";import"./vendor-base-ui-C7vVMZTg.js";const F=({open:r,onOpenChange:t})=>{const a=i.useId(),n=i.useCallback(()=>typeof document>"u"?!1:!!document.querySelector('[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]'),[]);return e.jsx(l,{open:r,onOpenChange:o=>{!o&&n()||t(o)},children:e.jsxs(d,{children:[e.jsx(c,{className:s("oc-glass-backdrop fixed inset-0 z-50 bg-black/25 dark:bg-black/40","transition-opacity duration-150 ease-out","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0")}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center pointer-events-none",children:e.jsxs(p,{"aria-describedby":a,className:s("relative pointer-events-auto","w-[92vw] max-w-[1120px] h-[84vh] max-h-[900px]","rounded-2xl border border-border/80 shadow-2xl overflow-hidden origin-center","bg-sidebar","transition-all duration-150 ease-out","data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]","data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]","data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]"),children:[e.jsx(m,{className:"sr-only",children:"Settings"}),e.jsx(g,{id:a,className:"sr-only",children:"PiChamber settings window."}),e.jsx(u,{"aria-label":"Close settings",className:"absolute right-3 top-3 z-10 inline-flex size-8 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",children:e.jsx(b,{name:"close",className:"size-4"})}),e.jsx(f,{onClose:()=>t(!1),isWindowed:!0})]})})]})})};export{F as SettingsWindow};
@@ -1,4 +1,4 @@
1
- import{j as r,aP as Y,b5 as ie}from"./vendor-boot-CoTxysn6.js";import{R as i}from"./vendor-react-Bz1tRBxM.js";import{I as x,aP as K,e3 as oe,bL as le,dm as de,e4 as ce,e5 as me,e6 as ue,dv as Q,ar as he,av as fe,aw as ge,e7 as xe,cL as A,e8 as we,e9 as ye,ea as be,eb as pe,ec as ve,ed as je,ee as Ne}from"./useAppFontEffects-CHnpTOtc.js";import{F as X,J as Me}from"./JsonTreeView-RLgBKik9.js";import{f as L,z as ke,A as U,bQ as C}from"./index-C2ISrmRR.js";import{P as Se}from"./PatchDiff-BLNLrGYa.js";import{ensurePierreThemeRegistered as $}from"./appThemeRegistry-Ca8eGRB9.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./web-components-CIPJC1JE.js";import"./computeVirtualFileMetrics-ydVGT2RY.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.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-DrfmQi8i.js";import"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.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-DNJrJKVb.js";import"./renderFileWithHighlighter-RJTrDxFH.js";import"./VirtualizedFileDiff-Cccy1L8L.js";import"./renderDiffWithHighlighter-JwKOWdBN.js";import"./vendor-diff-C3JhlQdm.js";import"./registerCustomTheme-C-h6lsYW.js";const Re=e=>{const n="h-3.5 w-3.5 flex-shrink-0",t=e.toLowerCase();return t==="reasoning"?r.jsx(x,{name:"brain-ai-3",className:n}):t==="image-preview"?r.jsx(x,{name:"file-image",className:n}):t==="mermaid-preview"?r.jsx(x,{name:"file-list-2",className:n}):t==="edit"||t==="multiedit"||t==="apply_patch"||t==="str_replace"||t==="str_replace_based_edit_tool"?r.jsx(x,{name:"pencil-ai",className:n}):t==="write"||t==="create"||t==="file_write"?r.jsx(x,{name:"file-pdf",className:n}):t==="read"||t==="view"||t==="file_read"||t==="cat"?r.jsx(x,{name:"file-pdf",className:n}):t==="bash"||t==="shell"||t==="cmd"||t==="terminal"?r.jsx(x,{name:"terminal-box",className:n}):t==="list"||t==="ls"||t==="dir"||t==="list_files"?r.jsx(x,{name:"folder-6",className:n}):t==="search"||t==="grep"||t==="find"||t==="ripgrep"?r.jsx(x,{name:"search",className:n}):t==="glob"?r.jsx(x,{name:"file-search",className:n}):t==="fetch"||t==="curl"||t==="wget"||t==="webfetch"?r.jsx(x,{name:"global",className:n}):t==="web-search"||t==="websearch"||t==="search_web"||t==="google"||t==="bing"||t==="duckduckgo"?r.jsx(x,{name:"search",className:n}):t==="todowrite"||t==="todoread"?r.jsx(x,{name:"list-check-3",className:n}):t==="plan_enter"?r.jsx(x,{name:"file-list-2",className:n}):t==="plan_exit"?r.jsx(x,{name:"task",className:n}):t.startsWith("git")?r.jsx(x,{name:"git-branch",className:n}):r.jsx(x,{name:"tools",className:n})};class H extends Error{constructor(n){super(n),this.name="MermaidLoadFailure"}}const Te=e=>new H(e),Ie=e=>e instanceof H,Pe=e=>e+1,q=(e,n)=>e===n,Le=e=>{const n=e.indexOf(",");if(n<0)throw Te("The Mermaid data URL is malformed.");const t=e.slice(0,n).toLowerCase(),s=e.slice(n+1);return t.includes(";base64")?atob(s):decodeURIComponent(s)},Ee=e=>Promise.resolve().then(()=>Le(e)),B=150,Ce=40,De=120,_e=3,Ae={download:!1,copy:!1,showPanZoomControls:!0},F=e=>new H(e),G=()=>({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}),J={mobile:{widthRatio:.94,heightRatio:.86,padding:10},desktop:{widthRatio:.8,heightRatio:.8,padding:16}},Fe=(e,n)=>{const t=n?J.mobile:J.desktop,s=Math.max(160,e.width-t.padding*2),o=Math.max(160,e.height-t.padding*2);return{maxWidth:Math.max(160,Math.min(s,e.width*t.widthRatio)),maxHeight:Math.max(160,Math.min(o,e.height*t.heightRatio))}},ze=e=>{try{const d=Array.from(e.querySelectorAll("g"));let a=0,c=null;for(const l of d){if(!(l instanceof SVGGraphicsElement))continue;const h=l.getBBox();if(!(h.width>0&&h.height>0))continue;const f=h.width*h.height;f>a&&(a=f,c=h.width/h.height)}if(c&&Number.isFinite(c)&&c>0)return c}catch{}const n=e.getAttribute("viewBox");if(n){const d=n.trim().split(/\s+/).map(Number);if(d.length===4){const a=d[2],c=d[3];if(Number.isFinite(a)&&Number.isFinite(c)&&a>0&&c>0)return a/c}}const t=Number(e.getAttribute("width")),s=Number(e.getAttribute("height"));if(Number.isFinite(t)&&Number.isFinite(s)&&t>0&&s>0)return t/s;const o=e.getBoundingClientRect();return o.width>0&&o.height>0?o.width/o.height:null},ee=e=>{const[n,t]=i.useState(e),[s,o]=i.useState(e),[d,a]=i.useState(!1);return i.useEffect(()=>{if(e){if(t(!0),a(!0),typeof window>"u"){o(!0);return}const l=window.requestAnimationFrame(()=>{o(!0)}),h=window.setTimeout(()=>{a(!1)},B);return()=>{window.cancelAnimationFrame(l),window.clearTimeout(h)}}if(o(!1),a(!0),typeof window>"u"){t(!1);return}const c=window.setTimeout(()=>{t(!1),a(!1)},B);return()=>{window.clearTimeout(c)}},[e]),{isRendered:n,isVisible:s,isTransitioning:d}},te=e=>{const[n,t]=i.useState(G);return i.useEffect(()=>{if(!e||typeof window>"u")return;const s=()=>{t(G())};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),n},Ve=({popup:e,onOpenChange:n,isMobile:t})=>{const s=i.useMemo(()=>{const u=e.image;if(!u)return[];const w=Array.isArray(u.gallery)?u.gallery.filter(S=>!!S?.url):[];return w.length>0?w:[{url:u.url,mimeType:u.mimeType,filename:u.filename,size:u.size}]},[e.image]),[o,d]=i.useState(0),[a,c]=i.useState(null),{isRendered:l,isVisible:h,isTransitioning:f}=ee(e.open),y=te(e.open);i.useEffect(()=>{if(!e.open||s.length===0)return;const u=typeof e.image?.index=="number"?e.image.index:-1;if(u>=0&&u<s.length){d(u);return}const w=e.image?.url?s.findIndex(S=>S.url===e.image?.url):-1;d(w>=0?w:0)},[s,e.image?.index,e.image?.url,e.open]);const j=s[o]??s[0]??e.image,N=j?.filename||e.title||"Image preview",T=s.length>1,M=i.useCallback(()=>{s.length<=1||d(u=>(u-1+s.length)%s.length)},[s.length]),I=i.useCallback(()=>{s.length<=1||d(u=>(u+1)%s.length)},[s.length]);i.useEffect(()=>{if(!e.open)return;const u=w=>{if(w.key==="Escape"){n(!1);return}if(w.key==="ArrowLeft"&&T){w.preventDefault(),M();return}w.key==="ArrowRight"&&T&&(w.preventDefault(),I())};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[T,n,e.open,I,M]),i.useEffect(()=>{c(null)},[j?.url]);const E=i.useMemo(()=>{const u=Math.max(160,y.width*(t?.86:.75)),w=Math.max(160,y.height*(t?.72:.75));if(!a)return{width:Math.round(u),height:Math.round(w)};const S=u/a.width,m=w/a.height,g=Math.min(S,m);return{width:Math.max(1,Math.round(a.width*g)),height:Math.max(1,Math.round(a.height*g))}},[a,t,y]);if(!l||typeof document>"u"||!j?.url)return null;const D=r.jsxs("div",{className:L("fixed inset-0 z-50",e.open?"pointer-events-auto":"pointer-events-none"),children:[r.jsx("div",{"aria-hidden":"true",className:L("absolute inset-0",f&&"transition-opacity duration-150 ease-out",h?"opacity-100":"opacity-0"),style:{backgroundColor:"color-mix(in srgb, var(--surface-background) 70%, transparent)"},onMouseDown:()=>n(!1)}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4 pointer-events-none",children:r.jsxs("div",{className:L("pointer-events-auto flex flex-col gap-2",f&&"transition-opacity duration-150 ease-out",h?"opacity-100":"opacity-0"),style:{width:`${E.width}px`},onMouseDown:u=>u.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground typography-meta",children:[r.jsx("span",{className:"truncate pr-2",children:N}),T&&r.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[r.jsx("button",{type:"button",className:"p-1 rounded hover:bg-[var(--interactive-hover)]",onClick:M,"aria-label":"Previous image",children:r.jsx(x,{name:"arrow-left-s",className:"h-3.5 w-3.5"})}),r.jsxs("span",{children:[o+1," / ",s.length]}),r.jsx("button",{type:"button",className:"p-1 rounded hover:bg-[var(--interactive-hover)]",onClick:I,"aria-label":"Next image",children:r.jsx(x,{name:"arrow-right-s",className:"h-3.5 w-3.5"})})]}),r.jsx("button",{type:"button",className:"h-8 w-8 flex items-center justify-center rounded-lg text-muted-foreground/80 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-primary/60",onClick:()=>n(!1),"aria-label":"Close image preview",children:r.jsx(x,{name:"close",className:"h-4 w-4"})})]}),r.jsx("img",{src:j.url,alt:N,className:"block object-contain",style:{width:`${E.width}px`,height:`${E.height}px`},loading:"lazy",onLoad:u=>{const w=u.currentTarget,S=w.naturalWidth,m=w.naturalHeight;S>0&&m>0&&c(g=>g&&g.width===S&&g.height===m?g:{width:S,height:m})}})]})})]});return Y.createPortal(D,document.body)},He=({popup:e,onOpenChange:n,isMobile:t})=>{const[s,o]=i.useState(e.mermaid?.source||""),[d,a]=i.useState(e.mermaid?.source?"ready":"idle"),[c,l]=i.useState(""),{isRendered:h,isVisible:f,isTransitioning:y}=ee(e.open),[j,N]=i.useState(null),T=te(e.open),M=i.useRef(0),I=i.useRef(null),E=i.useCallback(m=>{const g=m.trim();if(!g.toLowerCase().startsWith("file://"))return null;const v=p=>{if(!p||/[\0\r\n]/.test(p))return!1;const P=p.replace(/\\/g,"/");return P.split("/").filter(Boolean).includes("..")?!1:P.startsWith("/")?!0:/^[A-Za-z]:\//.test(P)},b=p=>p.replace(/%([0-9A-Fa-f]{2})/g,(P,V)=>{const O=Number.parseInt(V,16);return Number.isFinite(O)?String.fromCharCode(O):`%${V}`});if(typeof URL.canParse=="function"?URL.canParse(g):!1){let p=b(new URL(g).pathname||"");return/^\/[A-Za-z]:\//.test(p)&&(p=p.slice(1)),v(p)?p:null}const R=g.replace(/^file:\/\//i,""),_=b(R);return v(_)?_:v(R)?R:null},[]),D=i.useCallback(async()=>{const m=e.mermaid,g=Pe(M.current);if(M.current=g,!m?.url){a("error"),l("Missing Mermaid source URL.");return}if(m.source){o(m.source),a("ready"),l("");return}a("loading"),l("");let v;if(m.url.startsWith("data:"))v=Ee(m.url);else if(m.url.toLowerCase().startsWith("file://")){const b=E(m.url);b?v=ke("/api/fs/raw",{query:{path:b}}).then(k=>k.ok?k.text():Promise.reject(F(`Unable to read Mermaid file. Status: ${k.status}.`))):v=Promise.reject(F("The local Mermaid file path is invalid."))}else{const k=(typeof URL.canParse=="function"?URL.canParse(m.url,window.location.origin):!1)?new URL(m.url,window.location.origin):null;!k||k.protocol!=="http:"&&k.protocol!=="https:"?v=Promise.reject(F("The Mermaid URL protocol is unsupported.")):v=fetch(k.toString()).then(R=>R.ok?R.text():Promise.reject(F(`Unable to load Mermaid diagram. Status: ${R.status}.`)))}await v.then(b=>{q(M.current,g)&&(o(b),a("ready"))}).catch(b=>{q(M.current,g)&&(a("error"),l(Ie(b)?b.message:"Unable to load Mermaid diagram."))})},[E,e.mermaid]);i.useEffect(()=>{!e.open||!e.mermaid||D()},[D,e.mermaid,e.open]),i.useEffect(()=>{if(!e.open)return;const m=g=>{g.key==="Escape"&&n(!1)};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[n,e.open]),i.useEffect(()=>{if(!e.open||d!=="ready"){N(null);return}const m=()=>{const _=I.current?.querySelector("svg");if(!_)return!1;const p=ze(_);return!p||!Number.isFinite(p)||p<=0?!1:(N(P=>P&&Math.abs(P-p)<.001?P:p),!0)};let g=window.requestAnimationFrame(()=>{m()||(g=window.requestAnimationFrame(()=>{m()}))}),v=0,b;const k=()=>{v>=_e||(b=window.setTimeout(()=>{v+=1,m()||k()},De))};k();const R=new MutationObserver(()=>{m()});return I.current&&R.observe(I.current,{childList:!0,subtree:!0,attributes:!0}),()=>{window.cancelAnimationFrame(g),typeof b=="number"&&window.clearTimeout(b),R.disconnect()}},[e.open,s,d]);const u=`\`\`\`mermaid
1
+ import{j as r,aP as Y,b5 as ie}from"./vendor-boot-CoTxysn6.js";import{R as i}from"./vendor-react-Bz1tRBxM.js";import{I as x,aP as K,e3 as oe,bL as le,dm as de,e4 as ce,e5 as me,e6 as ue,dv as Q,ar as he,av as fe,aw as ge,e7 as xe,cL as A,e8 as we,e9 as ye,ea as be,eb as pe,ec as ve,ed as je,ee as Ne}from"./useAppFontEffects-D2xXdmYC.js";import{F as X,J as Me}from"./JsonTreeView-BJr5kBg4.js";import{f as L,z as ke,A as U,bQ as C}from"./index-C2ISrmRR.js";import{P as Se}from"./PatchDiff-B6RBZULC.js";import{ensurePierreThemeRegistered as $}from"./appThemeRegistry-Ca8eGRB9.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./web-components-Bz5oGa3p.js";import"./computeVirtualFileMetrics-BCFpa-1q.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.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-DrfmQi8i.js";import"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.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-DNJrJKVb.js";import"./renderFileWithHighlighter-s6fQq9eg.js";import"./VirtualizedFileDiff-BmJk6XJm.js";import"./renderDiffWithHighlighter-DixZh5Zd.js";import"./vendor-diff-C3JhlQdm.js";import"./registerCustomTheme-C-h6lsYW.js";const Re=e=>{const n="h-3.5 w-3.5 flex-shrink-0",t=e.toLowerCase();return t==="reasoning"?r.jsx(x,{name:"brain-ai-3",className:n}):t==="image-preview"?r.jsx(x,{name:"file-image",className:n}):t==="mermaid-preview"?r.jsx(x,{name:"file-list-2",className:n}):t==="edit"||t==="multiedit"||t==="apply_patch"||t==="str_replace"||t==="str_replace_based_edit_tool"?r.jsx(x,{name:"pencil-ai",className:n}):t==="write"||t==="create"||t==="file_write"?r.jsx(x,{name:"file-pdf",className:n}):t==="read"||t==="view"||t==="file_read"||t==="cat"?r.jsx(x,{name:"file-pdf",className:n}):t==="bash"||t==="shell"||t==="cmd"||t==="terminal"?r.jsx(x,{name:"terminal-box",className:n}):t==="list"||t==="ls"||t==="dir"||t==="list_files"?r.jsx(x,{name:"folder-6",className:n}):t==="search"||t==="grep"||t==="find"||t==="ripgrep"?r.jsx(x,{name:"search",className:n}):t==="glob"?r.jsx(x,{name:"file-search",className:n}):t==="fetch"||t==="curl"||t==="wget"||t==="webfetch"?r.jsx(x,{name:"global",className:n}):t==="web-search"||t==="websearch"||t==="search_web"||t==="google"||t==="bing"||t==="duckduckgo"?r.jsx(x,{name:"search",className:n}):t==="todowrite"||t==="todoread"?r.jsx(x,{name:"list-check-3",className:n}):t==="plan_enter"?r.jsx(x,{name:"file-list-2",className:n}):t==="plan_exit"?r.jsx(x,{name:"task",className:n}):t.startsWith("git")?r.jsx(x,{name:"git-branch",className:n}):r.jsx(x,{name:"tools",className:n})};class H extends Error{constructor(n){super(n),this.name="MermaidLoadFailure"}}const Te=e=>new H(e),Ie=e=>e instanceof H,Pe=e=>e+1,q=(e,n)=>e===n,Le=e=>{const n=e.indexOf(",");if(n<0)throw Te("The Mermaid data URL is malformed.");const t=e.slice(0,n).toLowerCase(),s=e.slice(n+1);return t.includes(";base64")?atob(s):decodeURIComponent(s)},Ee=e=>Promise.resolve().then(()=>Le(e)),B=150,Ce=40,De=120,_e=3,Ae={download:!1,copy:!1,showPanZoomControls:!0},F=e=>new H(e),G=()=>({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}),J={mobile:{widthRatio:.94,heightRatio:.86,padding:10},desktop:{widthRatio:.8,heightRatio:.8,padding:16}},Fe=(e,n)=>{const t=n?J.mobile:J.desktop,s=Math.max(160,e.width-t.padding*2),o=Math.max(160,e.height-t.padding*2);return{maxWidth:Math.max(160,Math.min(s,e.width*t.widthRatio)),maxHeight:Math.max(160,Math.min(o,e.height*t.heightRatio))}},ze=e=>{try{const d=Array.from(e.querySelectorAll("g"));let a=0,c=null;for(const l of d){if(!(l instanceof SVGGraphicsElement))continue;const h=l.getBBox();if(!(h.width>0&&h.height>0))continue;const f=h.width*h.height;f>a&&(a=f,c=h.width/h.height)}if(c&&Number.isFinite(c)&&c>0)return c}catch{}const n=e.getAttribute("viewBox");if(n){const d=n.trim().split(/\s+/).map(Number);if(d.length===4){const a=d[2],c=d[3];if(Number.isFinite(a)&&Number.isFinite(c)&&a>0&&c>0)return a/c}}const t=Number(e.getAttribute("width")),s=Number(e.getAttribute("height"));if(Number.isFinite(t)&&Number.isFinite(s)&&t>0&&s>0)return t/s;const o=e.getBoundingClientRect();return o.width>0&&o.height>0?o.width/o.height:null},ee=e=>{const[n,t]=i.useState(e),[s,o]=i.useState(e),[d,a]=i.useState(!1);return i.useEffect(()=>{if(e){if(t(!0),a(!0),typeof window>"u"){o(!0);return}const l=window.requestAnimationFrame(()=>{o(!0)}),h=window.setTimeout(()=>{a(!1)},B);return()=>{window.cancelAnimationFrame(l),window.clearTimeout(h)}}if(o(!1),a(!0),typeof window>"u"){t(!1);return}const c=window.setTimeout(()=>{t(!1),a(!1)},B);return()=>{window.clearTimeout(c)}},[e]),{isRendered:n,isVisible:s,isTransitioning:d}},te=e=>{const[n,t]=i.useState(G);return i.useEffect(()=>{if(!e||typeof window>"u")return;const s=()=>{t(G())};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),n},Ve=({popup:e,onOpenChange:n,isMobile:t})=>{const s=i.useMemo(()=>{const u=e.image;if(!u)return[];const w=Array.isArray(u.gallery)?u.gallery.filter(S=>!!S?.url):[];return w.length>0?w:[{url:u.url,mimeType:u.mimeType,filename:u.filename,size:u.size}]},[e.image]),[o,d]=i.useState(0),[a,c]=i.useState(null),{isRendered:l,isVisible:h,isTransitioning:f}=ee(e.open),y=te(e.open);i.useEffect(()=>{if(!e.open||s.length===0)return;const u=typeof e.image?.index=="number"?e.image.index:-1;if(u>=0&&u<s.length){d(u);return}const w=e.image?.url?s.findIndex(S=>S.url===e.image?.url):-1;d(w>=0?w:0)},[s,e.image?.index,e.image?.url,e.open]);const j=s[o]??s[0]??e.image,N=j?.filename||e.title||"Image preview",T=s.length>1,M=i.useCallback(()=>{s.length<=1||d(u=>(u-1+s.length)%s.length)},[s.length]),I=i.useCallback(()=>{s.length<=1||d(u=>(u+1)%s.length)},[s.length]);i.useEffect(()=>{if(!e.open)return;const u=w=>{if(w.key==="Escape"){n(!1);return}if(w.key==="ArrowLeft"&&T){w.preventDefault(),M();return}w.key==="ArrowRight"&&T&&(w.preventDefault(),I())};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[T,n,e.open,I,M]),i.useEffect(()=>{c(null)},[j?.url]);const E=i.useMemo(()=>{const u=Math.max(160,y.width*(t?.86:.75)),w=Math.max(160,y.height*(t?.72:.75));if(!a)return{width:Math.round(u),height:Math.round(w)};const S=u/a.width,m=w/a.height,g=Math.min(S,m);return{width:Math.max(1,Math.round(a.width*g)),height:Math.max(1,Math.round(a.height*g))}},[a,t,y]);if(!l||typeof document>"u"||!j?.url)return null;const D=r.jsxs("div",{className:L("fixed inset-0 z-50",e.open?"pointer-events-auto":"pointer-events-none"),children:[r.jsx("div",{"aria-hidden":"true",className:L("absolute inset-0",f&&"transition-opacity duration-150 ease-out",h?"opacity-100":"opacity-0"),style:{backgroundColor:"color-mix(in srgb, var(--surface-background) 70%, transparent)"},onMouseDown:()=>n(!1)}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4 pointer-events-none",children:r.jsxs("div",{className:L("pointer-events-auto flex flex-col gap-2",f&&"transition-opacity duration-150 ease-out",h?"opacity-100":"opacity-0"),style:{width:`${E.width}px`},onMouseDown:u=>u.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground typography-meta",children:[r.jsx("span",{className:"truncate pr-2",children:N}),T&&r.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0",children:[r.jsx("button",{type:"button",className:"p-1 rounded hover:bg-[var(--interactive-hover)]",onClick:M,"aria-label":"Previous image",children:r.jsx(x,{name:"arrow-left-s",className:"h-3.5 w-3.5"})}),r.jsxs("span",{children:[o+1," / ",s.length]}),r.jsx("button",{type:"button",className:"p-1 rounded hover:bg-[var(--interactive-hover)]",onClick:I,"aria-label":"Next image",children:r.jsx(x,{name:"arrow-right-s",className:"h-3.5 w-3.5"})})]}),r.jsx("button",{type:"button",className:"h-8 w-8 flex items-center justify-center rounded-lg text-muted-foreground/80 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-primary/60",onClick:()=>n(!1),"aria-label":"Close image preview",children:r.jsx(x,{name:"close",className:"h-4 w-4"})})]}),r.jsx("img",{src:j.url,alt:N,className:"block object-contain",style:{width:`${E.width}px`,height:`${E.height}px`},loading:"lazy",onLoad:u=>{const w=u.currentTarget,S=w.naturalWidth,m=w.naturalHeight;S>0&&m>0&&c(g=>g&&g.width===S&&g.height===m?g:{width:S,height:m})}})]})})]});return Y.createPortal(D,document.body)},He=({popup:e,onOpenChange:n,isMobile:t})=>{const[s,o]=i.useState(e.mermaid?.source||""),[d,a]=i.useState(e.mermaid?.source?"ready":"idle"),[c,l]=i.useState(""),{isRendered:h,isVisible:f,isTransitioning:y}=ee(e.open),[j,N]=i.useState(null),T=te(e.open),M=i.useRef(0),I=i.useRef(null),E=i.useCallback(m=>{const g=m.trim();if(!g.toLowerCase().startsWith("file://"))return null;const v=p=>{if(!p||/[\0\r\n]/.test(p))return!1;const P=p.replace(/\\/g,"/");return P.split("/").filter(Boolean).includes("..")?!1:P.startsWith("/")?!0:/^[A-Za-z]:\//.test(P)},b=p=>p.replace(/%([0-9A-Fa-f]{2})/g,(P,V)=>{const O=Number.parseInt(V,16);return Number.isFinite(O)?String.fromCharCode(O):`%${V}`});if(typeof URL.canParse=="function"?URL.canParse(g):!1){let p=b(new URL(g).pathname||"");return/^\/[A-Za-z]:\//.test(p)&&(p=p.slice(1)),v(p)?p:null}const R=g.replace(/^file:\/\//i,""),_=b(R);return v(_)?_:v(R)?R:null},[]),D=i.useCallback(async()=>{const m=e.mermaid,g=Pe(M.current);if(M.current=g,!m?.url){a("error"),l("Missing Mermaid source URL.");return}if(m.source){o(m.source),a("ready"),l("");return}a("loading"),l("");let v;if(m.url.startsWith("data:"))v=Ee(m.url);else if(m.url.toLowerCase().startsWith("file://")){const b=E(m.url);b?v=ke("/api/fs/raw",{query:{path:b}}).then(k=>k.ok?k.text():Promise.reject(F(`Unable to read Mermaid file. Status: ${k.status}.`))):v=Promise.reject(F("The local Mermaid file path is invalid."))}else{const k=(typeof URL.canParse=="function"?URL.canParse(m.url,window.location.origin):!1)?new URL(m.url,window.location.origin):null;!k||k.protocol!=="http:"&&k.protocol!=="https:"?v=Promise.reject(F("The Mermaid URL protocol is unsupported.")):v=fetch(k.toString()).then(R=>R.ok?R.text():Promise.reject(F(`Unable to load Mermaid diagram. Status: ${R.status}.`)))}await v.then(b=>{q(M.current,g)&&(o(b),a("ready"))}).catch(b=>{q(M.current,g)&&(a("error"),l(Ie(b)?b.message:"Unable to load Mermaid diagram."))})},[E,e.mermaid]);i.useEffect(()=>{!e.open||!e.mermaid||D()},[D,e.mermaid,e.open]),i.useEffect(()=>{if(!e.open)return;const m=g=>{g.key==="Escape"&&n(!1)};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[n,e.open]),i.useEffect(()=>{if(!e.open||d!=="ready"){N(null);return}const m=()=>{const _=I.current?.querySelector("svg");if(!_)return!1;const p=ze(_);return!p||!Number.isFinite(p)||p<=0?!1:(N(P=>P&&Math.abs(P-p)<.001?P:p),!0)};let g=window.requestAnimationFrame(()=>{m()||(g=window.requestAnimationFrame(()=>{m()}))}),v=0,b;const k=()=>{v>=_e||(b=window.setTimeout(()=>{v+=1,m()||k()},De))};k();const R=new MutationObserver(()=>{m()});return I.current&&R.observe(I.current,{childList:!0,subtree:!0,attributes:!0}),()=>{window.cancelAnimationFrame(g),typeof b=="number"&&window.clearTimeout(b),R.disconnect()}},[e.open,s,d]);const u=`\`\`\`mermaid
2
2
  ${s}
3
3
  \`\`\``,w=i.useMemo(()=>{const{maxWidth:m,maxHeight:g}=Fe(T,t),v=Math.max(160,g-Ce);if(j&&j<1){const b=Math.min(m,v);return{width:Math.round(b),height:Math.round(b)}}return{width:Math.round(m),height:Math.round(v)}},[j,t,T]);if(!h||typeof document>"u")return null;const S=r.jsxs("div",{className:L("fixed inset-0 z-50",e.open?"pointer-events-auto":"pointer-events-none"),children:[r.jsx("div",{"aria-hidden":"true",className:L("absolute inset-0",y&&"transition-opacity duration-150 ease-out",f?"opacity-100":"opacity-0"),style:{backgroundColor:"color-mix(in srgb, var(--surface-background) 70%, transparent)"},onMouseDown:()=>n(!1)}),r.jsx("div",{className:L("absolute inset-0 flex items-center justify-center pointer-events-none",t?"p-2.5":"p-4"),children:r.jsxs("div",{className:L("pointer-events-auto flex flex-col gap-2",y&&"transition-opacity duration-150 ease-out",f?"opacity-100":"opacity-0"),style:{width:`${w.width}px`},onMouseDown:m=>m.stopPropagation(),children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsx("button",{type:"button",className:"h-8 w-8 flex items-center justify-center rounded-lg text-muted-foreground/80 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-primary/60",onClick:()=>n(!1),"aria-label":"Close diagram preview",children:r.jsx(x,{name:"close",className:"h-4 w-4"})})}),r.jsx("div",{className:"relative overflow-hidden",style:{height:`${w.height}px`},children:r.jsxs("div",{className:"h-full overflow-hidden",children:[d==="loading"&&r.jsxs("div",{className:"h-full min-h-28 flex items-center justify-center gap-2 text-muted-foreground typography-meta",children:[r.jsx(x,{name:"loader-4",className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:"Loading diagram..."})]}),d==="error"&&r.jsxs("div",{className:"rounded-xl border p-3 space-y-3",style:{backgroundColor:"var(--status-error-background)",borderColor:"var(--status-error-border)"},children:[r.jsx("p",{className:"typography-markdown",style:{color:"var(--status-error)"},children:c||"Unable to render Mermaid diagram."}),r.jsx("button",{type:"button",onClick:()=>{D()},className:"px-3 py-1.5 rounded-lg typography-meta border transition-colors hover:bg-[var(--interactive-hover)]",style:{borderColor:"var(--interactive-border)",color:"var(--surface-foreground)"},children:"Retry"})]}),d==="ready"&&r.jsx("div",{ref:I,className:"h-full",children:r.jsx(K,{content:u,variant:"tool",allowMermaidWheelEvents:!0,className:"markdown-mermaid-fullscreen h-full",mermaidControls:Ae,enableFileReferences:!1})})]})})]})})]});return Y.createPortal(S,document.body)},We=(e,n)=>{const[t,s]=i.useState(null);return i.useEffect(()=>{let o=!0;return s(null),oe(e,(n||"text").toLowerCase()).then(d=>{o&&s(d)}),()=>{o=!1}},[e,n]),t},Oe=80,Z=20,re=i.memo(e=>{const{lines:n,language:t,maxHeight:s="60vh",showLineNumbers:o=!0,lineStyles:d}=e,{currentTheme:a}=le(),c=i.useMemo(()=>de(a),[a]),l=i.useMemo(()=>n.map(y=>y.text).join(`
4
4
  `),[n]),h=We(l,t);return n.length>Oe?r.jsx(ne,{lines:n,highlighted:h,syntaxVars:c,maxHeight:s,showLineNumbers:o,lineStyles:d}):r.jsx("div",{className:"typography-code font-mono w-full min-w-0",style:{...c,maxHeight:s,overflow:"auto"},children:n.map((y,j)=>r.jsx(W,{line:y,html:h?.[j],showLineNumbers:o,style:d?.(y)},j))})});re.displayName="VirtualizedCodeBlock";const ne=i.memo(({lines:e,highlighted:n,syntaxVars:t,maxHeight:s,showLineNumbers:o,lineStyles:d})=>{const a=i.useRef(null),c=`min(${e.length*Z}px, ${s})`,l=ie({count:e.length,getScrollElement:()=>a.current,estimateSize:()=>Z,overscan:20}),h=l.getVirtualItems();return r.jsx("div",{ref:a,className:"typography-code font-mono w-full min-w-0",style:{...t,height:c,maxHeight:s,overflow:"auto"},children:r.jsx("div",{style:{height:l.getTotalSize(),position:"relative"},children:h.map(f=>{const y=e[f.index];return y?r.jsx("div",{"data-index":f.index,ref:l.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${f.start}px)`},children:r.jsx(W,{line:y,html:n?.[f.index],showLineNumbers:o,style:d?.(y)})},f.index):null})})})});ne.displayName="VirtualizedRows";const W=i.memo(({line:e,html:n,showLineNumbers:t,style:s})=>r.jsxs("div",{className:"typography-code font-mono flex w-full min-w-0",style:s,children:[t&&r.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5",style:{color:"var(--tools-edit-line-number)",borderColor:"var(--tools-border)"},children:!e.isInfo&&e.lineNumber!=null?e.lineNumber:""}),r.jsx("div",{className:"flex-1 min-w-0",children:e.isInfo?r.jsx("div",{className:"whitespace-pre-wrap break-words text-muted-foreground/70 italic",children:e.text}):n!==void 0?r.jsx("div",{className:"whitespace-pre",dangerouslySetInnerHTML:{__html:n}}):r.jsx("div",{className:"whitespace-pre",children:e.text})})]}));W.displayName="VirtualizedCodeBlock.Row";const ae=i.memo(({popup:e,diffViewMode:n,pierreThemeConfig:t})=>{const s=e.content||"";return r.jsx("div",{className:"typography-code",children:r.jsx(Se,{patch:s,metrics:me,options:{diffStyle:n==="unified"?"unified":"split",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:"wrap",theme:t.theme,themeType:t.themeType,unsafeCSS:ce},className:"block w-full"})})});ae.displayName="DialogUnifiedDiff";const se=i.memo(({popup:e,pierreThemeConfig:n})=>{const t=i.useMemo(()=>ue(e.content),[e.content]),s=e.metadata?.input,o=typeof s=="object"&&s!==null?s:{},d=typeof o.offset=="number"?o.offset:0,a=typeof o.file_path=="string"?o.file_path:typeof o.filePath=="string"?o.filePath:typeof o.path=="string"?o.path:"read-output",c=i.useMemo(()=>t.lines.map(f=>f.text).join(`
@@ -1 +1 @@
1
- import{j as s}from"./vendor-boot-CoTxysn6.js";import{R as i}from"./vendor-react-Bz1tRBxM.js";import{P as f}from"./PatchDiff-BLNLrGYa.js";import{e4 as T,e5 as u,ar as y,eg as g}from"./useAppFontEffects-CHnpTOtc.js";import{ensurePierreThemeRegistered as l}from"./appThemeRegistry-Ca8eGRB9.js";import{A as d}from"./index-C2ISrmRR.js";import"./vendor-clsx-B-dksMZM.js";import"./web-components-CIPJC1JE.js";import"./computeVirtualFileMetrics-ydVGT2RY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.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-DrfmQi8i.js";import"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.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-DNJrJKVb.js";import"./VirtualizedFileDiff-Cccy1L8L.js";import"./renderDiffWithHighlighter-JwKOWdBN.js";import"./vendor-diff-C3JhlQdm.js";import"./vendor-zustand-CXhN0IMY.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./registerCustomTheme-C-h6lsYW.js";const k=()=>{const t=y(),e=i.useMemo(()=>d(!1),[]),r=i.useMemo(()=>d(!0),[]),o=i.useMemo(()=>t?.availableThemes??[e,r],[r,e,t?.availableThemes]),a=t?.lightThemeId??e.metadata.id,m=t?.darkThemeId??r.metadata.id,n=i.useMemo(()=>o.find(p=>p.metadata.id===a)??e,[o,e,a]),h=i.useMemo(()=>o.find(p=>p.metadata.id===m)??r,[o,m,r]);l(n),l(h);const c=t?.currentTheme.metadata.variant??"light";return{pierreTheme:{light:n.metadata.id,dark:h.metadata.id},pierreThemeType:c==="dark"?"dark":"light"}};class D extends i.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.hasError&&this.setState({hasError:!1})}componentDidCatch(e){}render(){return this.state.hasError?this.props.fallback:this.props.children}}const b=i.memo(({diff:t,diffViewMode:e})=>{const{pierreTheme:r,pierreThemeType:o}=k(),a=i.useMemo(()=>({diffStyle:e==="side-by-side"?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:"wrap",theme:r,themeType:o,unsafeCSS:T}),[e,r,o]),m=s.jsx(g,{diff:t});return s.jsx("div",{className:"typography-code px-1 pb-1 pt-0",children:s.jsx(D,{resetKey:t,fallback:m,children:s.jsx(f,{patch:t,metrics:u,options:a,className:"block w-full"})})})});b.displayName="ToolPartDiffPreview";export{b as default};
1
+ import{j as s}from"./vendor-boot-CoTxysn6.js";import{R as i}from"./vendor-react-Bz1tRBxM.js";import{P as f}from"./PatchDiff-B6RBZULC.js";import{e4 as T,e5 as u,ar as y,eg as g}from"./useAppFontEffects-D2xXdmYC.js";import{ensurePierreThemeRegistered as l}from"./appThemeRegistry-Ca8eGRB9.js";import{A as d}from"./index-C2ISrmRR.js";import"./vendor-clsx-B-dksMZM.js";import"./web-components-Bz5oGa3p.js";import"./computeVirtualFileMetrics-BCFpa-1q.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.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-DrfmQi8i.js";import"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.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-DNJrJKVb.js";import"./VirtualizedFileDiff-BmJk6XJm.js";import"./renderDiffWithHighlighter-DixZh5Zd.js";import"./vendor-diff-C3JhlQdm.js";import"./vendor-zustand-CXhN0IMY.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./registerCustomTheme-C-h6lsYW.js";const k=()=>{const t=y(),e=i.useMemo(()=>d(!1),[]),r=i.useMemo(()=>d(!0),[]),o=i.useMemo(()=>t?.availableThemes??[e,r],[r,e,t?.availableThemes]),a=t?.lightThemeId??e.metadata.id,m=t?.darkThemeId??r.metadata.id,n=i.useMemo(()=>o.find(p=>p.metadata.id===a)??e,[o,e,a]),h=i.useMemo(()=>o.find(p=>p.metadata.id===m)??r,[o,m,r]);l(n),l(h);const c=t?.currentTheme.metadata.variant??"light";return{pierreTheme:{light:n.metadata.id,dark:h.metadata.id},pierreThemeType:c==="dark"?"dark":"light"}};class D extends i.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.hasError&&this.setState({hasError:!1})}componentDidCatch(e){}render(){return this.state.hasError?this.props.fallback:this.props.children}}const b=i.memo(({diff:t,diffViewMode:e})=>{const{pierreTheme:r,pierreThemeType:o}=k(),a=i.useMemo(()=>({diffStyle:e==="side-by-side"?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:"wrap",theme:r,themeType:o,unsafeCSS:T}),[e,r,o]),m=s.jsx(g,{diff:t});return s.jsx("div",{className:"typography-code px-1 pb-1 pt-0",children:s.jsx(D,{resetKey:t,fallback:m,children:s.jsx(f,{patch:t,metrics:u,options:a,className:"block w-full"})})})});b.displayName="ToolPartDiffPreview";export{b as default};
@@ -1,4 +1,4 @@
1
- import{a as Te,e as Qe,j as et,s as tt,b as Xe,c as Fe,k as it,i as nt,d as Ye,g as Ne,f as he,h as st,R as rt,I as ot,p as Ue,l as at,m as lt,n as ht,x as Pe,S as dt,o as ut,w as ft,q as Oe,u as ct,t as pt,v as Ae,y as gt,z as mt,r as Ct,A as St,C as vt,B as yt,F as Ht}from"./web-components-CIPJC1JE.js";import{t as w,B as Se,y as Lt,o as Tt,d as At,i as ke,q as U,u as ce,s as kt,b as Rt,f as Be,w as Y,x as Ze,C as Re}from"./computeVirtualFileMetrics-ydVGT2RY.js";import{h as xt,a as se,i as be,b as re,r as Dt,g as Et,c as ve,d as we,e as oe,f as Me,j as ae}from"./renderDiffWithHighlighter-JwKOWdBN.js";import{dW as bt,dX as wt,db as Ie,d9 as _,dY as Mt,dZ as It,dz as Ve,dA as zt,dB as Ft,dC as Nt,dD as Ut,dE as Pt}from"./useAppFontEffects-CHnpTOtc.js";import{c as Ot}from"./vendor-diff-C3JhlQdm.js";import{t as le}from"./vendor-hast-util-to-html-O3stl53j.js";function Z(e,t,i,n=!1){const s=bt(Ot(e.name,t.name,e.contents,t.contents,e.header,t.header,i),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:n});if(s==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return t.lang!=null&&(s.lang=t.lang),s}var Bt=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,i){if(t==null||i==null)for(const n of e.children??[])n instanceof HTMLElement&&("deletions"in n.dataset?t=n:"additions"in n.dataset&&(i=n));if(i==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==i&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=i,i.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function pe(e){return w({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ge(e){return w({tagName:"div",children:[w({tagName:"span",children:[Se("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function xe(e){return w({tagName:"div",children:[Lt({name:e==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":e==="both"?"":void 0,"data-expand-up":e==="up"?"":void 0,"data-expand-down":e==="down"?"":void 0}})}function K({type:e,content:t,expandIndex:i,chunked:n=!1,slotName:s,isFirstHunk:r,isLastHunk:o}){let a=0;const l=[];if(e==="metadata"&&t!=null&&l.push(w({tagName:"div",children:[Se(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const u=[];i!=null&&(n?(r||(u.push(xe("up")),a++),o||(u.push(xe("down")),a++)):(u.push(xe(!r&&!o?"both":r?"down":"up")),a++)),u.push(w({tagName:"div",children:[w({tagName:"span",children:[Se(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),n&&i!=null&&u.push(w({tagName:"div",children:[Se("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),l.push(w({tagName:"div",children:u,properties:{"data-separator-wrapper":"","data-separator-multi-button":a>1?"":void 0}}))}return e==="custom"&&s!=null&&l.push(w({tagName:"slot",properties:{name:s}})),w({tagName:"div",children:l,properties:{"data-separator":l.length===0?"simple":e,"data-expand-index":i,"data-separator-first":r?"":void 0,"data-separator-last":o?"":void 0}})}function Vt(e,t){return`hunk-separator-${e}-${t}`}function Gt(e){const t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Wt(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function $t(e){return e!==""?e.split(wt):[]}function G(e,t){const i=Z({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:i.hunks,splitLineCount:i.splitLineCount,unifiedLineCount:i.unifiedLineCount,additionLines:i.additionLines,deletionLines:i.deletionLines,type:i.type}}function _t(e,t){const i=e.deletionLines.join(""),n=i===`
1
+ import{a as Te,e as Qe,j as et,s as tt,b as Xe,c as Fe,k as it,i as nt,d as Ye,g as Ne,f as he,h as st,R as rt,I as ot,p as Ue,l as at,m as lt,n as ht,x as Pe,S as dt,o as ut,w as ft,q as Oe,u as ct,t as pt,v as Ae,y as gt,z as mt,r as Ct,A as St,C as vt,B as yt,F as Ht}from"./web-components-Bz5oGa3p.js";import{t as w,B as Se,y as Lt,o as Tt,d as At,i as ke,q as U,u as ce,s as kt,b as Rt,f as Be,w as Y,x as Ze,C as Re}from"./computeVirtualFileMetrics-BCFpa-1q.js";import{h as xt,a as se,i as be,b as re,r as Dt,g as Et,c as ve,d as we,e as oe,f as Me,j as ae}from"./renderDiffWithHighlighter-DixZh5Zd.js";import{dW as bt,dX as wt,db as Ie,d9 as _,dY as Mt,dZ as It,dz as Ve,dA as zt,dB as Ft,dC as Nt,dD as Ut,dE as Pt}from"./useAppFontEffects-D2xXdmYC.js";import{c as Ot}from"./vendor-diff-C3JhlQdm.js";import{t as le}from"./vendor-hast-util-to-html-O3stl53j.js";function Z(e,t,i,n=!1){const s=bt(Ot(e.name,t.name,e.contents,t.contents,e.header,t.header,i),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:n});if(s==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return t.lang!=null&&(s.lang=t.lang),s}var Bt=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,i){if(t==null||i==null)for(const n of e.children??[])n instanceof HTMLElement&&("deletions"in n.dataset?t=n:"additions"in n.dataset&&(i=n));if(i==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==i&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=i,i.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function pe(e){return w({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ge(e){return w({tagName:"div",children:[w({tagName:"span",children:[Se("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function xe(e){return w({tagName:"div",children:[Lt({name:e==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":e==="both"?"":void 0,"data-expand-up":e==="up"?"":void 0,"data-expand-down":e==="down"?"":void 0}})}function K({type:e,content:t,expandIndex:i,chunked:n=!1,slotName:s,isFirstHunk:r,isLastHunk:o}){let a=0;const l=[];if(e==="metadata"&&t!=null&&l.push(w({tagName:"div",children:[Se(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const u=[];i!=null&&(n?(r||(u.push(xe("up")),a++),o||(u.push(xe("down")),a++)):(u.push(xe(!r&&!o?"both":r?"down":"up")),a++)),u.push(w({tagName:"div",children:[w({tagName:"span",children:[Se(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),n&&i!=null&&u.push(w({tagName:"div",children:[Se("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),l.push(w({tagName:"div",children:u,properties:{"data-separator-wrapper":"","data-separator-multi-button":a>1?"":void 0}}))}return e==="custom"&&s!=null&&l.push(w({tagName:"slot",properties:{name:s}})),w({tagName:"div",children:l,properties:{"data-separator":l.length===0?"simple":e,"data-expand-index":i,"data-separator-first":r?"":void 0,"data-separator-last":o?"":void 0}})}function Vt(e,t){return`hunk-separator-${e}-${t}`}function Gt(e){const t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Wt(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function $t(e){return e!==""?e.split(wt):[]}function G(e,t){const i=Z({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:i.hunks,splitLineCount:i.splitLineCount,unifiedLineCount:i.unifiedLineCount,additionLines:i.additionLines,deletionLines:i.deletionLines,type:i.type}}function _t(e,t){const i=e.deletionLines.join(""),n=i===`
2
2
  `?`
3
3
  `:`
4
4
  `,s=Z({name:e.prevName??e.name,contents:i},{name:e.name,contents:n,lang:e.lang},t);return{hunks:s.hunks,splitLineCount:s.splitLineCount,unifiedLineCount:s.unifiedLineCount,additionLines:[""],deletionLines:s.deletionLines,type:s.type}}function jt(e,t,i){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return B(e,G(e,i));const n=Array.from(t);if(n.length===0)return B(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(const r of n){const o=e.additionLines[r],a=e.deletionLines[r];if(o==null||a==null||Ie(o)===Ie(a))return B(e,G(e,i))}const s=qt(e,n);if(s.size===0)return B(e,G(e,i));for(const r of s)if(!Xt(e,r,i))return B(e,G(e,i));return Qt(e),xt(e)?B(e,G(e,i)):B(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function B(e,t){return Object.assign(e,t),t}function qt(e,t){const i=new Set;for(const n of t){const s=Kt(e,n);if(s==null)return new Set;i.add(s)}return i}function Kt(e,t){for(const[i,n]of e.hunks.entries()){const s=n.additionLineIndex+n.additionCount;if(t>=n.additionLineIndex&&t<s)return i}}function Xt(e,t,i){const n=e.hunks[t];if(n==null)return!1;const s=e.deletionLines.slice(n.deletionLineIndex,n.deletionLineIndex+n.deletionCount),r=e.additionLines.slice(n.additionLineIndex,n.additionLineIndex+n.additionCount),o=Z({name:e.prevName??e.name,contents:s.join("")},{name:e.name,contents:r.join(""),lang:e.lang},{...i,context:0}),a=o.hunks[0];return a==null||o.hunks.length!==1?!1:(Zt(n,a),Yt(e,t),!0)}function Yt(e,t){const i=e.hunks[t];if(i==null)return;if(t!==e.hunks.length-1){i.noEOFCRAdditions=!1,i.noEOFCRDeletions=!1;return}const n=e.additionLines.at(-1),s=e.deletionLines.at(-1);i.noEOFCRAdditions=n!=null&&n!==""&&!n.endsWith(`
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-shiki-BEwTOAFg.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-shikijs-core-Ck_OPM_T.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-DPFxvYtK.js","assets/vendor-hast-util-to-html-O3stl53j.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-C40bX6nM.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-comma-separated-tokens-D8TqSuIK.js","assets/vendor-space-separated-tokens-DD3iYX1K.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-shikijs-engine-oniguruma-DPWuIF1G.js"])))=>i.map(i=>d[i]);
2
- import{_ as I}from"./vendor-vite-runtime-DD1OZmLC.js";import{b as j,c as O}from"./vendor-shiki-BEwTOAFg.js";import{t as f}from"./themeResolver-DrfmQi8i.js";import{s as M,p as F,n as v}from"./vendor-pierre-theming-BO6EPniU.js";import{c as N}from"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import{c as z}from"./vendor-shikijs-engine-javascript-DL394yyj.js";import{d9 as L,da as G}from"./useAppFontEffects-CHnpTOtc.js";import{t as H}from"./vendor-shikijs-transformers-CZWsLLKm.js";function pe(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ue(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}const T=new Set;function E(e,t){e=Array.isArray(e)?e:[e];for(let r of e){let n;if(typeof r=="string"){if(n=f.getResolvedTheme(r),n==null)throw new Error(`loadResolvedThemes: ${r} is not resolved, you must resolve it before calling loadResolvedThemes`)}else n=r,r=r.name,f.getResolvedTheme(r)==null&&f.seedResolvedTheme(r,n);T.has(r)||(T.add(r),t.loadThemeSync(n))}}const g=new Map,k=new Map,V=new Map,$=new Set;function R(e,t){e=Array.isArray(e)?e:[e];for(const r of e){if($.has(r.name))continue;let n=g.get(r.name);n==null&&(n=r,g.set(r.name,n)),$.add(n.name),t.loadLanguageSync(n.data)}}function S(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function A(e){if(S())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=k.get(e);if(t!=null)return t;try{let r=V.get(e);if(r==null&&Object.prototype.hasOwnProperty.call(j,e)&&(r=j[e]),r==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const n=r().then(({default:o})=>{const s={name:e,data:o};return g.has(e)||g.set(e,s),s});return k.set(e,n),await n}finally{k.delete(e)}}function D(e){return g.get(e)??A(e)}function W(e){if(S())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(f.hasRegisteredTheme(e))return;const t=M.getTheme(e);if(t!=null){f.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function P(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function U(e){W(e);const t=await f.resolveTheme(e);return P(e,t),t}function K(e){return f.getResolvedTheme(e)??U(e)}let c;async function fe({themes:e,langs:t,preferredHighlighter:r="shiki-js"}){c??=O({themes:[],langs:["text"],engine:r==="shiki-wasm"?N(I(()=>import("./vendor-shiki-BEwTOAFg.js").then(a=>a.w),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))):z()});const n=X(c)?await c:c;c=n;const o=[];for(const a of t){if(a==="text"||a==="ansi")continue;const i=D(a);"then"in i?o.push(i):R(i,n)}const s=[];for(const a of e){const i=K(a);"then"in i?s.push(i):E(i,c)}return(o.length>0||s.length>0)&&await Promise.all([Promise.all(o).then(a=>{R(a,n)}),Promise.all(s).then(a=>{E(a,n)})]),n}function de(){if(c!=null&&!("then"in c))return c}function X(e=c){return e!=null&&"then"in e}for(const e of F.getThemes())f.registerThemeIfAbsent(e.name,e.load);function me(e=L){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}const d=new Map;let B=0;const h={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function he(e){if(d.has(e))return d.get(e)??"text";if(h[e]!=null)return h[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(d.has(t[1]))return d.get(t[1])??"text";if(h[t[1]]!=null)return h[t[1]]??"text"}const r=e.match(/\.([^.]+)$/)?.[1]??"";return d.has(r)?d.get(r)??"text":h[r]??"text"}function ge(){return B}function be(){return Object.fromEntries(d)}function q(e){return{type:"text",value:e}}function m({tagName:e,children:t=[],properties:r={}}){return{type:"element",tagName:e,properties:r,children:t}}function ye({name:e,width:t=16,height:r=16,properties:n}){return m({tagName:"svg",properties:{width:t,height:r,viewBox:"0 0 16 16",...n},children:[m({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function J(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function ve(e){return m({tagName:"div",properties:{"data-gutter":""},children:e})}function ke(e,t,r,n={}){return m({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":r,...n},children:t!=null?[m({tagName:"span",properties:{"data-line-number-content":""},children:[q(`${t}`)]})]:void 0})}function we(e,t,r){return m({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":r,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${r};`:`grid-row: span ${r};min-height:calc(${r} * 1lh);`}})}function Q(e,t,r){const n=typeof r.lineInfo=="function"?r.lineInfo(t):r.lineInfo[t-1];if(n==null){const o=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(o,{node:e,line:t,state:r}),new Error(o)}return e.tagName="div",e.properties["data-line"]=n.lineNumber,e.properties["data-alt-line"]=n.altLineNumber,e.properties["data-line-type"]=n.type,e.properties["data-line-index"]=n.lineIndex,e.children.length===0&&e.children.push(q(`
2
+ import{_ as I}from"./vendor-vite-runtime-DD1OZmLC.js";import{b as j,c as O}from"./vendor-shiki-BEwTOAFg.js";import{t as f}from"./themeResolver-DrfmQi8i.js";import{s as M,p as F,n as v}from"./vendor-pierre-theming-BO6EPniU.js";import{c as N}from"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import{c as z}from"./vendor-shikijs-engine-javascript-DL394yyj.js";import{d9 as L,da as G}from"./useAppFontEffects-D2xXdmYC.js";import{t as H}from"./vendor-shikijs-transformers-CZWsLLKm.js";function pe(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function ue(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}const T=new Set;function E(e,t){e=Array.isArray(e)?e:[e];for(let r of e){let n;if(typeof r=="string"){if(n=f.getResolvedTheme(r),n==null)throw new Error(`loadResolvedThemes: ${r} is not resolved, you must resolve it before calling loadResolvedThemes`)}else n=r,r=r.name,f.getResolvedTheme(r)==null&&f.seedResolvedTheme(r,n);T.has(r)||(T.add(r),t.loadThemeSync(n))}}const g=new Map,k=new Map,V=new Map,$=new Set;function R(e,t){e=Array.isArray(e)?e:[e];for(const r of e){if($.has(r.name))continue;let n=g.get(r.name);n==null&&(n=r,g.set(r.name,n)),$.add(n.name),t.loadLanguageSync(n.data)}}function S(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function A(e){if(S())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=k.get(e);if(t!=null)return t;try{let r=V.get(e);if(r==null&&Object.prototype.hasOwnProperty.call(j,e)&&(r=j[e]),r==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const n=r().then(({default:o})=>{const s={name:e,data:o};return g.has(e)||g.set(e,s),s});return k.set(e,n),await n}finally{k.delete(e)}}function D(e){return g.get(e)??A(e)}function W(e){if(S())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(f.hasRegisteredTheme(e))return;const t=M.getTheme(e);if(t!=null){f.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function P(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function U(e){W(e);const t=await f.resolveTheme(e);return P(e,t),t}function K(e){return f.getResolvedTheme(e)??U(e)}let c;async function fe({themes:e,langs:t,preferredHighlighter:r="shiki-js"}){c??=O({themes:[],langs:["text"],engine:r==="shiki-wasm"?N(I(()=>import("./vendor-shiki-BEwTOAFg.js").then(a=>a.w),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))):z()});const n=X(c)?await c:c;c=n;const o=[];for(const a of t){if(a==="text"||a==="ansi")continue;const i=D(a);"then"in i?o.push(i):R(i,n)}const s=[];for(const a of e){const i=K(a);"then"in i?s.push(i):E(i,c)}return(o.length>0||s.length>0)&&await Promise.all([Promise.all(o).then(a=>{R(a,n)}),Promise.all(s).then(a=>{E(a,n)})]),n}function de(){if(c!=null&&!("then"in c))return c}function X(e=c){return e!=null&&"then"in e}for(const e of F.getThemes())f.registerThemeIfAbsent(e.name,e.load);function me(e=L){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}const d=new Map;let B=0;const h={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function he(e){if(d.has(e))return d.get(e)??"text";if(h[e]!=null)return h[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(d.has(t[1]))return d.get(t[1])??"text";if(h[t[1]]!=null)return h[t[1]]??"text"}const r=e.match(/\.([^.]+)$/)?.[1]??"";return d.has(r)?d.get(r)??"text":h[r]??"text"}function ge(){return B}function be(){return Object.fromEntries(d)}function q(e){return{type:"text",value:e}}function m({tagName:e,children:t=[],properties:r={}}){return{type:"element",tagName:e,properties:r,children:t}}function ye({name:e,width:t=16,height:r=16,properties:n}){return m({tagName:"svg",properties:{width:t,height:r,viewBox:"0 0 16 16",...n},children:[m({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function J(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function ve(e){return m({tagName:"div",properties:{"data-gutter":""},children:e})}function ke(e,t,r,n={}){return m({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":r,...n},children:t!=null?[m({tagName:"span",properties:{"data-line-number-content":""},children:[q(`${t}`)]})]:void 0})}function we(e,t,r){return m({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":r,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${r};`:`grid-row: span ${r};min-height:calc(${r} * 1lh);`}})}function Q(e,t,r){const n=typeof r.lineInfo=="function"?r.lineInfo(t):r.lineInfo[t-1];if(n==null){const o=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(o,{node:e,line:t,state:r}),new Error(o)}return e.tagName="div",e.properties["data-line"]=n.lineNumber,e.properties["data-alt-line"]=n.altLineNumber,e.properties["data-line-type"]=n.type,e.properties["data-line-index"]=n.lineIndex,e.children.length===0&&e.children.push(q(`
3
3
  `)),e}const b=Symbol("no-token"),w=Symbol("multiple-tokens");function _(e){const t=Y(e);if(t!=null)return t;let r=b;const n=[];let o=[],s;const a=()=>{if(o.length===0||s==null){o=[],s=void 0;return}if(o.length===1){const l=o[0];if(l?.type==="element"){Z(l,s);for(const p of l.children)y(p)}else y(l);n.push(l),o=[],s=void 0;return}for(const l of o)y(l);n.push(m({tagName:"span",properties:{"data-char":s},children:o})),o=[],s=void 0},i=l=>{if(l!==b){if(l===w){r=w;return}if(r===b){r=l;return}r!==l&&(r=w)}};for(const l of e.children){const p=l.type==="element"?_(l):b;if(i(p),typeof p!="number"){a(),n.push(l);continue}s!=null&&s!==p&&a(),s??=p,o.push(l)}return a(),e.children=n,r}function Y(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function y(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)y(t)}}function Z(e,t){e.properties["data-char"]=t}function xe(e=!1,t=!1){const r={lineInfo:[]},n=[{line(o){return delete o.properties.class,o},pre(o){const s=J(o),a=[];if(s!=null){let i=1;for(const l of s.children)l.type==="element"&&(e&&_(l),a.push(Q(l,i,r)),i++);s.children=a}return o},...e?{tokens(o){for(const s of o){let a=0;for(const i of s){const l=i;l.__lineChar??=a,a+=i.content.length}}},preprocess(o,s){s.mergeWhitespaces="never"},span(o,s,a,i,l){if(l?.offset!=null&&l.content!=null){const p=l.__lineChar;return p!=null&&(o.properties["data-char"]=p),o}return o}}:null}];return t&&n.push(ee,C),e&&n.push({line:o=>(o.type==="element"&&o.children.length===0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]}),o)}),{state:r,transformers:n,toClass:C}}const C=H({classPrefix:"hl-"}),ee={name:"token-style-normalizer",tokens(e){for(const t of e)for(const r of t){if(r.htmlStyle!=null)continue;const n={};r.color!=null&&(n.color=r.color),r.bgColor!=null&&(n["background-color"]=r.bgColor),r.fontStyle!=null&&r.fontStyle!==0&&((r.fontStyle&1)!==0&&(n["font-style"]="italic"),(r.fontStyle&2)!==0&&(n["font-weight"]="bold"),(r.fontStyle&4)!==0&&(n["text-decoration"]="underline")),Object.keys(n).length>0&&(r.htmlStyle=n)}}};function u(e){return`--${e==="token"?"diffs-token":"diffs"}-`}function je({theme:e=L,highlighter:t,prefix:r}){let n="";if(typeof e=="string"){const o=t.getTheme(e),s=v(o);n+=`color:${s.fg};`,n+=`background-color:${s.bg};`,n+=`${u("global")}fg:${s.fg};`,n+=`${u("global")}bg:${s.bg};`,n+=x(o,r)}else{let o=t.getTheme(e.dark),s=v(o);n+=`${u("global")}dark:${s.fg};`,n+=`${u("global")}dark-bg:${s.bg};`,n+=x(o,"dark"),o=t.getTheme(e.light),s=v(o),n+=`${u("global")}light:${s.fg};`,n+=`${u("global")}light-bg:${s.bg};`,n+=x(o,"light")}return n}function x(e,t){t=t!=null?`${t}-`:"";let r="";const n=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];n!=null&&(r+=`${u("global")}${t}addition-color:${n};`);const o=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];o!=null&&(r+=`${u("global")}${t}deletion-color:${o};`);const s=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return s!=null&&(r+=`${u("global")}${t}modified-color:${s};`),r}function Te(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function Ee(e){return{...G,...e}}function $e(e,t){const r=te(e,t);return t?r:e.diffHeaderHeight+r}function te(e,t){return e.paddingTop??(t?e.spacing:0)}function Re(e){return e.paddingBottom??e.spacing}function Ce(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}export{$ as A,q as B,Ee as C,g as R,me as a,pe as b,E as c,fe as d,be as e,ue as f,D as g,ge as h,he as i,xe as j,je as k,Te as l,u as m,Ce as n,de as o,W as p,we as q,A as r,ke as s,m as t,ve as u,P as v,$e as w,Re as x,ye as y,T as z};
@@ -1 +1 @@
1
- import{z as a}from"./index-C2ISrmRR.js";import{c_ as l,c$ as c,d0 as u,d1 as d}from"./useAppFontEffects-CHnpTOtc.js";const o=5e3,f=(r,t)=>{if(!r)return 1;let e=1;for(let n=0;n<r.length;n+=1)if(r.charCodeAt(n)===10&&(e+=1,e>t))return e;return e},y=r=>{const e=(r instanceof Error?r.message:String(r??"")).toLowerCase();return e.includes("file not found")||e.includes("not found")||e.includes("enoent")||e.includes("no such file")||e.includes("does not exist")?"missing":"unreadable"},g=async(r,t,e)=>{if(r.readFile)return(await r.readFile(t,{optional:!0,directory:e?.directory})).content??"";const n=new URLSearchParams({path:t,optional:"true"});e?.directory&&n.set("directory",e.directory);const i=await a(`/api/fs/read?${n.toString()}`,{cache:"no-store",headers:e?.directory?{"x-pichamber-directory":e.directory}:void 0});if(!i.ok){const s=await i.json().catch(()=>({error:i.statusText}));throw new Error(s.error||"Failed to read file")}return i.text()},w=async(r,t,e)=>{if(l(t)||c(t)||u(t))return{ok:!0};try{const n=await g(r,t,e);return d(n)?{ok:!1,reason:"binary"}:f(n,o)>o?{ok:!1,reason:"too-large"}:{ok:!0}}catch(n){return{ok:!1,reason:y(n)}}},x=r=>r==="too-large"?`File is too large to open (>${o.toLocaleString("en-US")} lines)`:r==="missing"?"File not found":r==="binary"?"Cannot preview binary file":"Failed to open file";export{x as g,w as v};
1
+ import{z as a}from"./index-C2ISrmRR.js";import{c_ as l,c$ as c,d0 as u,d1 as d}from"./useAppFontEffects-D2xXdmYC.js";const o=5e3,f=(r,t)=>{if(!r)return 1;let e=1;for(let n=0;n<r.length;n+=1)if(r.charCodeAt(n)===10&&(e+=1,e>t))return e;return e},y=r=>{const e=(r instanceof Error?r.message:String(r??"")).toLowerCase();return e.includes("file not found")||e.includes("not found")||e.includes("enoent")||e.includes("no such file")||e.includes("does not exist")?"missing":"unreadable"},g=async(r,t,e)=>{if(r.readFile)return(await r.readFile(t,{optional:!0,directory:e?.directory})).content??"";const n=new URLSearchParams({path:t,optional:"true"});e?.directory&&n.set("directory",e.directory);const i=await a(`/api/fs/read?${n.toString()}`,{cache:"no-store",headers:e?.directory?{"x-pichamber-directory":e.directory}:void 0});if(!i.ok){const s=await i.json().catch(()=>({error:i.statusText}));throw new Error(s.error||"Failed to read file")}return i.text()},w=async(r,t,e)=>{if(l(t)||c(t)||u(t))return{ok:!0};try{const n=await g(r,t,e);return d(n)?{ok:!1,reason:"binary"}:f(n,o)>o?{ok:!1,reason:"too-large"}:{ok:!0}}catch(n){return{ok:!1,reason:y(n)}}},x=r=>r==="too-large"?`File is too large to open (>${o.toLocaleString("en-US")} lines)`:r==="missing"?"File not found":r==="binary"?"Cannot preview binary file":"Failed to open file";export{x as g,w as v};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-boot-CoTxysn6.js";import{R as x}from"./vendor-react-Bz1tRBxM.js";import{a$ as w,b0 as y,B as N,I as b,b1 as S,dN as C,dO as r}from"./useAppFontEffects-CHnpTOtc.js";const R=x.memo(function({scope:n,isGitRepo:a,branchAvailable:i,allCount:l,workingCount:o,stagedCount:c,turnCount:d,branchCount:m,onScopeChange:p}){const[f,u]=x.useState(!1),g=n==="all"?l:n==="staged"?c:n==="turn"?d:n==="branch"?m:o,j=n==="staged"?"Staged":n==="turn"?"Last turn":n==="branch"?"Branch":n==="all"?"All":"Changed";return e.jsxs(w,{open:f,onOpenChange:u,children:[e.jsx(y,{asChild:!0,children:e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-shrink-0 gap-1.5 px-2 py-1 normal-case","aria-label":"Select change mode",children:[e.jsxs("span",{className:"whitespace-nowrap font-medium",children:[j,e.jsxs("span",{className:"diff-toolbar__scope-count",children:[": ",g]})]}),e.jsx(b,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-60"})]})}),e.jsx(S,{align:"start",className:"w-40",children:e.jsxs(C,{value:n,onValueChange:t=>{(t==="all"||t==="working"||t==="staged"||t==="turn"||t==="branch")&&(p?.(t),u(!1))},children:[a!==!1?e.jsx(r,{value:"all",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"All"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:l})]})}):null,a!==!1?e.jsx(r,{value:"working",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Changed"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:o})]})}):null,a!==!1?e.jsx(r,{value:"staged",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Staged"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:c})]})}):null,e.jsx(r,{value:"turn",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Last turn"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}),i?e.jsx(r,{value:"branch",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Branch"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:m})]})}):null]})})]})}),h={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function B(s){const n=s.index?.trim(),a=s.working_dir?.trim(),i=n&&n!=="?"?n.charAt(0):a?.charAt(0)||n?.charAt(0)||"M";return h[i]??h.M}function k(s){const n=s.index?.trim();return!!(n&&n!=="?")}function A(s){return!!s.working_dir?.trim()||s.index?.trim()==="?"}function _(s){return k(s)&&!A(s)}function O(s){const n=s.index?.trim(),a=s.working_dir?.trim();return n==="A"||a==="A"||n==="?"||a==="?"}export{R as C,A as a,_ as b,O as c,B as d,k as i};
1
+ import{j as e}from"./vendor-boot-CoTxysn6.js";import{R as x}from"./vendor-react-Bz1tRBxM.js";import{a$ as w,b0 as y,B as N,I as b,b1 as S,dN as C,dO as r}from"./useAppFontEffects-D2xXdmYC.js";const R=x.memo(function({scope:n,isGitRepo:a,branchAvailable:i,allCount:l,workingCount:o,stagedCount:c,turnCount:d,branchCount:m,onScopeChange:p}){const[f,u]=x.useState(!1),g=n==="all"?l:n==="staged"?c:n==="turn"?d:n==="branch"?m:o,j=n==="staged"?"Staged":n==="turn"?"Last turn":n==="branch"?"Branch":n==="all"?"All":"Changed";return e.jsxs(w,{open:f,onOpenChange:u,children:[e.jsx(y,{asChild:!0,children:e.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-shrink-0 gap-1.5 px-2 py-1 normal-case","aria-label":"Select change mode",children:[e.jsxs("span",{className:"whitespace-nowrap font-medium",children:[j,e.jsxs("span",{className:"diff-toolbar__scope-count",children:[": ",g]})]}),e.jsx(b,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-60"})]})}),e.jsx(S,{align:"start",className:"w-40",children:e.jsxs(C,{value:n,onValueChange:t=>{(t==="all"||t==="working"||t==="staged"||t==="turn"||t==="branch")&&(p?.(t),u(!1))},children:[a!==!1?e.jsx(r,{value:"all",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"All"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:l})]})}):null,a!==!1?e.jsx(r,{value:"working",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Changed"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:o})]})}):null,a!==!1?e.jsx(r,{value:"staged",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Staged"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:c})]})}):null,e.jsx(r,{value:"turn",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Last turn"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}),i?e.jsx(r,{value:"branch",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Branch"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:m})]})}):null]})})]})}),h={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function B(s){const n=s.index?.trim(),a=s.working_dir?.trim(),i=n&&n!=="?"?n.charAt(0):a?.charAt(0)||n?.charAt(0)||"M";return h[i]??h.M}function k(s){const n=s.index?.trim();return!!(n&&n!=="?")}function A(s){return!!s.working_dir?.trim()||s.index?.trim()==="?"}function _(s){return k(s)&&!A(s)}function O(s){const n=s.index?.trim(),a=s.working_dir?.trim();return n==="A"||a==="A"||n==="?"||a==="?"}export{R as C,A as a,_ as b,O as c,B as d,k as i};
@@ -1,4 +1,4 @@
1
- import{U as m,V as p,W as u,X as w}from"./GitHubDetailScaffold-DlgVm5uD.js";import{bY as f}from"./useAppFontEffects-CHnpTOtc.js";const x=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"all",label:"All"}],k=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"assigned",label:"Assigned to me"},{id:"mentioned",label:"Mentioned"}],y=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],N=[{id:"completed",label:"Completed"},{id:"not_planned",label:"Not planned"}],_=(e,t,s)=>{if(!t&&e!=="comment")return{allowed:!1,reason:"Issue is still loading"};switch(e){case"close":return t?.state==="closed"?{allowed:!1,reason:"Already closed"}:u(s)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null};case"reopen":return t?.state!=="closed"?{allowed:!1,reason:"Already open"}:u(s)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"edit":return u(s)?{allowed:!1,reason:"You need write access or be the author to edit"}:{allowed:!0,reason:null};case"labels":return p(s)?{allowed:!1,reason:"You need write access to change labels"}:{allowed:!0,reason:null};case"assignees":return p(s)?{allowed:!1,reason:"You need write access to change assignees"}:{allowed:!0,reason:null};case"comment":return m(s);default:return{allowed:!0,reason:null}}},E=(e,t)=>{switch(e){case"close-not-planned":return{title:`Close issue #${t} as not planned?`,detail:"The issue will close without being completed. You can reopen it later.",confirm:"Close as not planned",progress:"Closing…"};case"reopen":return{title:`Reopen issue #${t}?`,detail:"The issue will return to its previous open state.",confirm:"Reopen issue",progress:"Reopening…"};default:return{title:`Close issue #${t} as completed?`,detail:"The issue will be recorded as completed. You can reopen it later.",confirm:"Close as completed",progress:"Closing…"}}},L=e=>e==="reopen"?{state:"open"}:{state:"closed",stateReason:e==="close-not-planned"?"not_planned":"completed"},P=e=>{const t={},s=w(e.title,300);return s&&(t.title=s),e.body!==void 0&&e.body.length>2e5&&(t.body="Body is too long"),{ok:Object.keys(t).length===0,errors:t}},A=(e,t)=>e.trim()?t.trim()?`${e.replace(/\s+$/,"")}
1
+ import{U as m,V as p,W as u,X as w}from"./GitHubDetailScaffold-B2HRjT8V.js";import{bY as f}from"./useAppFontEffects-D2xXdmYC.js";const x=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"all",label:"All"}],k=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"assigned",label:"Assigned to me"},{id:"mentioned",label:"Mentioned"}],y=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],N=[{id:"completed",label:"Completed"},{id:"not_planned",label:"Not planned"}],_=(e,t,s)=>{if(!t&&e!=="comment")return{allowed:!1,reason:"Issue is still loading"};switch(e){case"close":return t?.state==="closed"?{allowed:!1,reason:"Already closed"}:u(s)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null};case"reopen":return t?.state!=="closed"?{allowed:!1,reason:"Already open"}:u(s)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"edit":return u(s)?{allowed:!1,reason:"You need write access or be the author to edit"}:{allowed:!0,reason:null};case"labels":return p(s)?{allowed:!1,reason:"You need write access to change labels"}:{allowed:!0,reason:null};case"assignees":return p(s)?{allowed:!1,reason:"You need write access to change assignees"}:{allowed:!0,reason:null};case"comment":return m(s);default:return{allowed:!0,reason:null}}},E=(e,t)=>{switch(e){case"close-not-planned":return{title:`Close issue #${t} as not planned?`,detail:"The issue will close without being completed. You can reopen it later.",confirm:"Close as not planned",progress:"Closing…"};case"reopen":return{title:`Reopen issue #${t}?`,detail:"The issue will return to its previous open state.",confirm:"Reopen issue",progress:"Reopening…"};default:return{title:`Close issue #${t} as completed?`,detail:"The issue will be recorded as completed. You can reopen it later.",confirm:"Close as completed",progress:"Closing…"}}},L=e=>e==="reopen"?{state:"open"}:{state:"closed",stateReason:e==="close-not-planned"?"not_planned":"completed"},P=e=>{const t={},s=w(e.title,300);return s&&(t.title=s),e.body!==void 0&&e.body.length>2e5&&(t.body="Body is too long"),{ok:Object.keys(t).length===0,errors:t}},A=(e,t)=>e.trim()?t.trim()?`${e.replace(/\s+$/,"")}
2
2
 
3
3
  ${t}`:e:t,h=e=>e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"issue",R=(e,t)=>`issue-${e}-${h(t)}`,G=(e,t)=>{const s=e.trim();if(!s)return{link:null,outOfScope:!1};const c=s.match(/^#(\d{1,7})$/);if(c)return{link:{kind:"issue",number:Number(c[1]),owner:"",repo:""},outOfScope:!1};const r=s.match(/^([\w.-]+)\/([\w.-]+)#(\d{1,7})$/);if(r){const l=r[1].toLowerCase(),n=r[2].toLowerCase(),a=Number(r[3]);return t.some(i=>i.owner?.toLowerCase()===l&&i.repo?.toLowerCase()===n)?{link:{kind:"issue",number:a,owner:l,repo:n},outOfScope:!1}:{link:null,outOfScope:!0}}const o=s.match(/^https?:\/\/([^/]+)\/([\w.-]+)\/([\w.-]+)\/(issues|pull)\/(\d{1,7})(?:[/?#].*)?$/i);if(o){const l=o[1].toLowerCase(),n=o[2].toLowerCase(),a=o[3].toLowerCase().replace(/\.git$/,""),d=o[4].toLowerCase()==="pull"?"pr":"issue",i=Number(o[5]);return t.some(b=>b.ref.toLowerCase()===`${l}/${n}/${a}`)?{link:{kind:d,number:i,owner:n,repo:a},outOfScope:!1}:{link:null,outOfScope:!0}}return{link:null,outOfScope:!1}},H=e=>`Work on this GitHub issue. Read the quoted context below, then propose a plan and wait for confirmation before changing code.
4
4
 
@@ -1 +1 @@
1
- import{d9 as v}from"./useAppFontEffects-CHnpTOtc.js";import{R as L,g as W,r as A,p as M,v as V,a as R,b as P,c as _,d as w,e as C,f as Q,h as I,i as k}from"./computeVirtualFileMetrics-ydVGT2RY.js";import{h as S,i as B,a as T,r as N}from"./renderFileWithHighlighter-RJTrDxFH.js";import{a as p,i as O,r as $,b as j}from"./renderDiffWithHighlighter-JwKOWdBN.js";import{t as D}from"./themeResolver-DrfmQi8i.js";import{L as b}from"./vendor-lru_map-BbiDqlyL.js";import"./index-C2ISrmRR.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./vendor-boot-CoTxysn6.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.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"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.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"./vendor-diff-C3JhlQdm.js";function z(e){const t=[];for(const i of e){const s=L.get(i);if(s==null)throw new Error(`getResolvedLanguages: ${i} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(s)}return t}function E(e){for(const t of Array.isArray(e)?e:[e])if(!L.has(t))return!1;return!0}async function F(e){const t=[],i=[];for(const s of e){if(s==="text"||s==="ansi")continue;const r=W(s)??A(s);"then"in r?i.push(r):t.push(r)}return i.length>0&&await Promise.all(i).then(s=>{for(const r of s){if(r==null)throw new Error("resolvedLanguages: unable to resolve language");t.push(r)}}),t}function x(e){return D.getResolvedThemes(e)}async function K(e){for(const i of e)M(i);const t=await D.resolveThemes(e);for(let i=0;i<e.length;i++)V(e[i],t[i]);return t}const y=Symbol("IGNORE_RESPONSE");var q=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},G=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:i=v,useTokenTransformer:s=!1,lineDiffType:r="word-alt",maxLineDiffLength:n=1e3,tokenizeMaxLineLength:a=1e3,preferredHighlighter:o="shiki-js"}){this.options=e,this.preferredHighlighter=o,this.renderOptions={theme:i,useTokenTransformer:s,lineDiffType:r,maxLineDiffLength:n,tokenizeMaxLineLength:a},this.fileCache=new b.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new b.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey!=null?this.fileCache.get(e.cacheKey):void 0}getDiffResultCache(e){return e.cacheKey!=null?this.diffCache.get(e.cacheKey):void 0}inspectCaches(){const{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??v,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:i=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:s=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:r=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:n}=this,a=++this.renderOptionsRequestVersion,o=()=>this.isCurrentLifecycle(n)&&this.renderOptionsRequestVersion===a;try{const h={theme:e,useTokenTransformer:t,lineDiffType:i,maxLineDiffLength:s,tokenizeMaxLineLength:r};if(this.isInitialized()||await this.initialize(),!o()||p(h,this.renderOptions))return;const c=R(e);let l=[];if(P(h.theme,this.renderOptions.theme)||(S(c)?l=x(c):l=await K(c)),!o())return;if(this.highlighter!=null)_(l,this.highlighter);else{const m=await w({themes:c,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!o())return;this.highlighter=m}const g=this.setRenderOptionsOnWorkers(h,l);this.renderOptions=h,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const m of this.themeSubscribers)m.onThemeChange();await g}catch(h){if(h instanceof q||!o())return;throw h}}getFileRenderOptions(){const{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:i}=this.renderOptions;return{theme:t,useTokenTransformer:i,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();const i=[];for(const s of this.workers){if(!s.initialized)throw console.log({managedWorker:s}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");i.push(new Promise((r,n)=>{const a=this.generateRequestId(),o={type:"set-render-options",id:a,request:{type:"set-render-options",id:a,renderOptions:e,resolvedThemes:t},resolve:r,reject:n,requestStart:Date.now()};this.activeTaskById.set(a,o),s.pendingSetupRequestId=a,s.worker.postMessage(o.request)}))}await Promise.all(i)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast==null&&(this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges))}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);const e=this.getStats();for(const t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);const t=this.activeRequestByInstance.get(e);if(t!=null){const i=this.activeTaskById.get(t);u(i)?(this.detachInstanceFromRenderTask(i,e),!i.primeCache&&i.instances.size===0&&this.removeActiveTask(i)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0)if(this.initialized===!1){const{lifecycleGeneration:t}=this;this.initialized=new Promise((i,s)=>{(async()=>{try{const r=R(this.renderOptions.theme);let n=[];if(S(r)?n=x(r):n=await K(r),!this.isCurrentLifecycle(t)){i();return}let a=[];if(E(e)?a=z(e):a=await F(e),!this.isCurrentLifecycle(t)){i();return}const[o]=await Promise.all([w({themes:r,langs:["text",...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(n,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),i();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),i()}catch(r){if(r instanceof q||!this.isCurrentLifecycle(t)){i();return}this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),s(r)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(e,t){this.workersFailed=!1;const i=[],s=I(),r=s>0?C():void 0;this.workers.length>0&&this.terminateWorkers();for(let n=0;n<(this.options.poolSize??8);n++){const a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...t.map(({name:h})=>h)]),customExtensionsVersion:0};a.addEventListener("message",h=>{this.handleWorkerMessage(o,h.data)}),a.addEventListener("error",h=>console.error("Worker error:",h,o)),this.workers.push(o),i.push(new Promise((h,c)=>{const l=this.generateRequestId(),g={type:"initialize",id:l,request:{type:"initialize",id:l,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:r!=null?s:void 0,customExtensionMap:r},resolve(){o.initialized=!0,h()},reject:c,requestStart:Date.now()};this.activeTaskById.set(l,g),this.executeTask(o,g)}))}await Promise.all(i)}drainQueue=()=>{if(this._queuedDrain=void 0,!(this.initialized!==!0||this.queuedTasks.length===0)){for(let e=0;e<this.queuedTasks.length;){const t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}const i=H(t),s=this.getAvailableWorker(i);if(s==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,s),this.resolveLanguagesAndExecuteTask(s,t,i)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){const i=this.getFileResultCache(t);B(t)||i!=null&&T(i.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:"file",file:t})}primeFileHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}const t=this.getFileResultCache(e),i=this.getFileHighlightKey(e);if(i==null||B(e)||t!=null&&T(t.options,this.getFileRenderOptions()))return;const s=this.getTaskByHighlightKey(i);s!=null?s.primeCache=!0:this.submitCacheTask({type:"file",file:e},i)}getPlainFileAST(e,t,i,s){if(this.highlighter==null){this.queueInitialization();return}return N(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,lines:s})}highlightDiffAST(e,t){const i=this.getDiffResultCache(t);O(t)||i!=null&&p(i.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:"diff",diff:t})}primeDiffHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}const t=this.getDiffResultCache(e),i=this.getDiffHighlightKey(e);if(i==null||O(e)||t!=null&&p(t.options,this.getDiffRenderOptions()))return;const s=this.getTaskByHighlightKey(i);s!=null?s.primeCache=!0:this.submitCacheTask({type:"diff",diff:e},i)}getPlainDiffAST(e,t,i,s,r){return this.highlighter!=null?$(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,expandedHunks:s,collapsedContextThreshold:r}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(t=>{console.error(t)})}cancelActiveWorkerTasks(){const e=new q;for(const t of this.activeTaskById.values())"reject"in t&&t.reject(e)}terminateWorkers(){for(const e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?"waiting":this.initialized!==!0?"initializing":"initialized",totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.getHighlightKeyForRequest(t),s=i!=null?this.getTaskByHighlightKey(i):void 0;if(s!=null){this.detachInstanceFromQueuedTasks(e,s),this.addInstanceToTask(s,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);const r=this.generateRequestId(),n=Date.now(),{renderOptionsVersion:a}=this,o=(()=>{switch(t.type){case"file":return{type:"file",id:r,request:{...t,id:r},instances:new Set([e]),primeCache:!1,highlightKey:i,renderOptionsVersion:a,requestStart:n};case"diff":return{type:"diff",id:r,request:{...t,id:r},instances:new Set([e]),primeCache:!1,highlightKey:i,renderOptionsVersion:a,requestStart:n}}})();this.enqueueRenderTask(o,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.generateRequestId(),s=Date.now(),{renderOptionsVersion:r}=this,n=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:r,requestStart:s};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:r,requestStart:s}}})();this.enqueueRenderTask(n)}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,i){try{const s=i.filter(r=>!e.langs.has(r));if(s.length>0&&(E(s)?t.request.resolvedLanguages=z(s):t.request.resolvedLanguages=await F(s)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch{this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){const i=this.activeTaskById.get(t.id);try{if(i==null)throw y;if(t.type==="error"){const s=new Error(t.error);if(t.stack&&(s.stack=t.stack),"reject"in i)i.reject(s);else if(u(i))this.notifyHighlightError(i,s);else throw new Error("handleWorkerMessage: unknown task type");throw s}else switch(t.requestType){case"initialize":if(i.type!=="initialize")throw new Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(e,i.request),i.resolve();break;case"set-render-options":if(i.type!=="set-render-options")throw new Error("handleWorkerMessage: task/response dont match");i.resolve();break;case"file":{if(i.type!=="file")throw new Error("handleWorkerMessage: task/response dont match");const{result:s,options:r}=t;if(!this.isCurrentRenderTask(i)||!T(r,this.getFileRenderOptions()))throw y;const{request:n}=i;this.syncCustomExtensionVersion(e,n),n.file.cacheKey!=null&&this.fileCache.set(n.file.cacheKey,{result:s,options:r}),this.notifyFileInstances(i,s,r);break}case"diff":{if(i.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{result:s,options:r}=t;if(!this.isCurrentRenderTask(i)||!p(r,this.getDiffRenderOptions()))throw y;const{request:n}=i;this.syncCustomExtensionVersion(e,n),n.diff.cacheKey!=null&&this.diffCache.set(n.diff.cacheKey,{result:s,options:r}),this.notifyDiffInstances(i,s,r);break}}}catch(s){s!==y&&console.error(s,i,t)}this.cleanWorkerAndTask(e,i,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain==null&&(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,u(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,i=t?.id){e.requestId===i&&(e.requestId=void 0),e.pendingSetupRequestId===i&&(e.pendingSetupRequestId=void 0),t!=null&&(u(t)&&(this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){U(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(const i of H(t))e.langs.add(i);try{e.worker.postMessage(t.request)}catch(i){console.error("Failed to post message to worker:",i),u(t)?this.notifyHighlightError(t,i):"reject"in t&&t.reject(i),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;const i=I();e.customExtensionsVersion>=i||(t.customExtensionsVersion=i,t.customExtensionMap=C())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(const i of this.workers){if(i.requestId!=null||i.pendingSetupRequestId!=null||!i.initialized)continue;if(t=i,e.length===0)break;let s=!0;for(const r of e)if(!i.langs.has(r)){s=!1;break}if(s)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case"file":return this.getFileHighlightKey(e.file);case"diff":return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(const t of d(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){const i=this.queuedTaskByInstance.get(e);i==null||i===t||(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(i,e),!i.primeCache&&i.instances.size===0&&this.removeQueuedTask(i))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){const t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){const t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(const e of Array.from(this.activeTaskById.values()))u(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(const t of d(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(const t of d(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(const t of d(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,i){for(const s of e.instances)this.activeRequestByInstance.get(s)===e.id&&s.onHighlightSuccess(e.request.file,t,i)}notifyDiffInstances(e,t,i){for(const s of e.instances)this.activeRequestByInstance.get(s)===e.id&&s.onHighlightSuccess(e.request.diff,t,i)}notifyHighlightError(e,t){for(const i of d(e))this.activeRequestByInstance.get(i)===e.id&&i.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(const i of this.iterateRenderTasks())if(i.type==="file"&&this.isCurrentRenderTask(i)&&i.instances.has(e)&&Q(t,i.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(const i of this.iterateRenderTasks())if(i.type==="diff"&&this.isCurrentRenderTask(i)&&i.instances.has(e)&&j(i.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){const t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(const e of this.queuedTasks)yield e;for(const e of this.activeTaskById.values())u(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function U(e){return e.type==="initialize"||e.type==="file"||e.type==="diff"}function H(e){const t=new Set;if(e.type==="initialize"||e.type==="set-render-options")return[];switch(e.type){case"file":t.add(e.request.file.lang??k(e.request.file.name));break;case"diff":t.add(e.request.diff.lang??k(e.request.diff.name)),t.add(e.request.diff.lang??k(e.request.diff.prevName??"-"));break}return t.delete("text"),Array.from(t)}function u(e){return e?.type==="file"||e?.type==="diff"}function d(e){return e.instances}let f;function De({poolOptions:e,highlighterOptions:t}){return f??=new G(e,t),f}function We(){f!=null&&(f.terminate(),f=void 0)}export{G as WorkerPoolManager,De as getOrCreateWorkerPoolSingleton,We as terminateWorkerPoolSingleton};
1
+ import{d9 as v}from"./useAppFontEffects-D2xXdmYC.js";import{R as L,g as W,r as A,p as M,v as V,a as R,b as P,c as _,d as w,e as C,f as Q,h as I,i as k}from"./computeVirtualFileMetrics-BCFpa-1q.js";import{h as S,i as B,a as T,r as N}from"./renderFileWithHighlighter-s6fQq9eg.js";import{a as p,i as O,r as $,b as j}from"./renderDiffWithHighlighter-DixZh5Zd.js";import{t as D}from"./themeResolver-DrfmQi8i.js";import{L as b}from"./vendor-lru_map-BbiDqlyL.js";import"./index-C2ISrmRR.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./vendor-boot-CoTxysn6.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.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"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.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"./vendor-diff-C3JhlQdm.js";function z(e){const t=[];for(const i of e){const s=L.get(i);if(s==null)throw new Error(`getResolvedLanguages: ${i} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(s)}return t}function E(e){for(const t of Array.isArray(e)?e:[e])if(!L.has(t))return!1;return!0}async function F(e){const t=[],i=[];for(const s of e){if(s==="text"||s==="ansi")continue;const r=W(s)??A(s);"then"in r?i.push(r):t.push(r)}return i.length>0&&await Promise.all(i).then(s=>{for(const r of s){if(r==null)throw new Error("resolvedLanguages: unable to resolve language");t.push(r)}}),t}function x(e){return D.getResolvedThemes(e)}async function K(e){for(const i of e)M(i);const t=await D.resolveThemes(e);for(let i=0;i<e.length;i++)V(e[i],t[i]);return t}const y=Symbol("IGNORE_RESPONSE");var q=class extends Error{constructor(){super("WorkerPoolManager: operation canceled because the pool terminated")}},G=class{options;highlighter;preferredHighlighter;renderOptions;renderOptionsRequestVersion=0;renderOptionsVersion=0;initialized=!1;workers=[];queuedTasks=[];queuedTaskByInstance=new Map;taskByHighlightKey=new Map;activeTaskById=new Map;activeRequestByInstance=new Map;nextRequestId=0;themeSubscribers=new Set;workersFailed=!1;statSubscribers=new Set;fileCache;diffCache;_queuedBroadcast;lifecycleGeneration=0;constructor(e,{langs:t,theme:i=v,useTokenTransformer:s=!1,lineDiffType:r="word-alt",maxLineDiffLength:n=1e3,tokenizeMaxLineLength:a=1e3,preferredHighlighter:o="shiki-js"}){this.options=e,this.preferredHighlighter=o,this.renderOptions={theme:i,useTokenTransformer:s,lineDiffType:r,maxLineDiffLength:n,tokenizeMaxLineLength:a},this.fileCache=new b.LRUMap(e.totalASTLRUCacheSize??100),this.diffCache=new b.LRUMap(e.totalASTLRUCacheSize??100),this.queueInitialization(t)}isWorkingPool(){return!this.workersFailed}getFileResultCache(e){return e.cacheKey!=null?this.fileCache.get(e.cacheKey):void 0}getDiffResultCache(e){return e.cacheKey!=null?this.diffCache.get(e.cacheKey):void 0}inspectCaches(){const{fileCache:e,diffCache:t}=this;return{fileCache:e,diffCache:t}}evictFileFromCache(e){try{return this.fileCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}evictDiffFromCache(e){try{return this.diffCache.delete(e)!==void 0}finally{this.queueBroadcastStateChanges()}}async setRenderOptions({theme:e=this.renderOptions.theme??v,useTokenTransformer:t=this.renderOptions.useTokenTransformer??!1,lineDiffType:i=this.renderOptions.lineDiffType??"word-alt",maxLineDiffLength:s=this.renderOptions.maxLineDiffLength??1e3,tokenizeMaxLineLength:r=this.renderOptions.tokenizeMaxLineLength??1e3}){const{lifecycleGeneration:n}=this,a=++this.renderOptionsRequestVersion,o=()=>this.isCurrentLifecycle(n)&&this.renderOptionsRequestVersion===a;try{const h={theme:e,useTokenTransformer:t,lineDiffType:i,maxLineDiffLength:s,tokenizeMaxLineLength:r};if(this.isInitialized()||await this.initialize(),!o()||p(h,this.renderOptions))return;const c=R(e);let l=[];if(P(h.theme,this.renderOptions.theme)||(S(c)?l=x(c):l=await K(c)),!o())return;if(this.highlighter!=null)_(l,this.highlighter);else{const m=await w({themes:c,langs:["text"],preferredHighlighter:this.preferredHighlighter});if(!o())return;this.highlighter=m}const g=this.setRenderOptionsOnWorkers(h,l);this.renderOptions=h,this.renderOptionsVersion++,this.diffCache.clear(),this.fileCache.clear(),this.invalidateRenderTasks();for(const m of this.themeSubscribers)m.onThemeChange();await g}catch(h){if(h instanceof q||!o())return;throw h}}getFileRenderOptions(){const{tokenizeMaxLineLength:e,theme:t,useTokenTransformer:i}=this.renderOptions;return{theme:t,useTokenTransformer:i,tokenizeMaxLineLength:e}}getDiffRenderOptions(){return{...this.renderOptions}}async setRenderOptionsOnWorkers(e,t){if(this.workersFailed)return;this.isInitialized()||await this.initialize();const i=[];for(const s of this.workers){if(!s.initialized)throw console.log({managedWorker:s}),new Error("setRenderOptionsOnWorkers: Somehow we have an uninitialized worker");i.push(new Promise((r,n)=>{const a=this.generateRequestId(),o={type:"set-render-options",id:a,request:{type:"set-render-options",id:a,renderOptions:e,resolvedThemes:t},resolve:r,reject:n,requestStart:Date.now()};this.activeTaskById.set(a,o),s.pendingSetupRequestId=a,s.worker.postMessage(o.request)}))}await Promise.all(i)}subscribeToThemeChanges(e){return this.themeSubscribers.add(e),this.queueBroadcastStateChanges(),()=>{this.unsubscribeToThemeChanges(e),this.queueBroadcastStateChanges()}}unsubscribeToThemeChanges(e){this.themeSubscribers.delete(e),this.queueBroadcastStateChanges()}subscribeToStatChanges(e){return this.statSubscribers.add(e),e(this.getStats()),()=>{this.statSubscribers.delete(e)}}queueBroadcastStateChanges(){this._queuedBroadcast==null&&(this._queuedBroadcast=requestAnimationFrame(this._broadcastStateChanges))}_broadcastStateChanges=()=>{this._queuedBroadcast!=null&&(cancelAnimationFrame(this._queuedBroadcast),this._queuedBroadcast=void 0);const e=this.getStats();for(const t of this.statSubscribers)t(e)};cleanUpTasks(e){this.detachInstanceFromQueuedTasks(e);const t=this.activeRequestByInstance.get(e);if(t!=null){const i=this.activeTaskById.get(t);u(i)?(this.detachInstanceFromRenderTask(i,e),!i.primeCache&&i.instances.size===0&&this.removeActiveTask(i)):this.activeTaskById.delete(t)}this.activeRequestByInstance.delete(e),this.queueBroadcastStateChanges()}isInitialized(){return this.initialized===!0}async initialize(e=[]){if(this.initialized!==!0)if(this.initialized===!1){const{lifecycleGeneration:t}=this;this.initialized=new Promise((i,s)=>{(async()=>{try{const r=R(this.renderOptions.theme);let n=[];if(S(r)?n=x(r):n=await K(r),!this.isCurrentLifecycle(t)){i();return}let a=[];if(E(e)?a=z(e):a=await F(e),!this.isCurrentLifecycle(t)){i();return}const[o]=await Promise.all([w({themes:r,langs:["text",...e],preferredHighlighter:this.preferredHighlighter}),this.initializeWorkers(n,a)]);if(!this.isCurrentLifecycle(t)){this.terminateWorkers(),i();return}this.highlighter=o,this.initialized=!0,this.diffCache.clear(),this.fileCache.clear(),this.drainQueue(),this.queueBroadcastStateChanges(),i()}catch(r){if(r instanceof q||!this.isCurrentLifecycle(t)){i();return}this.initialized=!1,this.workersFailed=!0,this.queueBroadcastStateChanges(),s(r)}})()}),this.queueBroadcastStateChanges()}else return this.initialized}async initializeWorkers(e,t){this.workersFailed=!1;const i=[],s=I(),r=s>0?C():void 0;this.workers.length>0&&this.terminateWorkers();for(let n=0;n<(this.options.poolSize??8);n++){const a=this.options.workerFactory(),o={worker:a,requestId:void 0,pendingSetupRequestId:void 0,initialized:!1,langs:new Set(["text",...t.map(({name:h})=>h)]),customExtensionsVersion:0};a.addEventListener("message",h=>{this.handleWorkerMessage(o,h.data)}),a.addEventListener("error",h=>console.error("Worker error:",h,o)),this.workers.push(o),i.push(new Promise((h,c)=>{const l=this.generateRequestId(),g={type:"initialize",id:l,request:{type:"initialize",id:l,renderOptions:this.renderOptions,preferredHighlighter:this.preferredHighlighter,resolvedThemes:e,resolvedLanguages:t,customExtensionsVersion:r!=null?s:void 0,customExtensionMap:r},resolve(){o.initialized=!0,h()},reject:c,requestStart:Date.now()};this.activeTaskById.set(l,g),this.executeTask(o,g)}))}await Promise.all(i)}drainQueue=()=>{if(this._queuedDrain=void 0,!(this.initialized!==!0||this.queuedTasks.length===0)){for(let e=0;e<this.queuedTasks.length;){const t=this.queuedTasks[e];if(this.hasActiveRequest(t)){e++;continue}const i=H(t),s=this.getAvailableWorker(i);if(s==null)break;this.queuedTasks.splice(e,1),this.assignWorkerToTask(t,s),this.resolveLanguagesAndExecuteTask(s,t,i)}this.queueBroadcastStateChanges()}};highlightFileAST(e,t){const i=this.getFileResultCache(t);B(t)||i!=null&&T(i.options,this.getFileRenderOptions())||this.hasMatchingFileInstanceTask(e,t)||this.submitTask(e,{type:"file",file:t})}primeFileHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${e.name}".`);return}const t=this.getFileResultCache(e),i=this.getFileHighlightKey(e);if(i==null||B(e)||t!=null&&T(t.options,this.getFileRenderOptions()))return;const s=this.getTaskByHighlightKey(i);s!=null?s.primeCache=!0:this.submitCacheTask({type:"file",file:e},i)}getPlainFileAST(e,t,i,s){if(this.highlighter==null){this.queueInitialization();return}return N(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,lines:s})}highlightDiffAST(e,t){const i=this.getDiffResultCache(t);O(t)||i!=null&&p(i.options,this.getDiffRenderOptions())||this.hasMatchingDiffInstanceTask(e,t)||this.submitTask(e,{type:"diff",diff:t})}primeDiffHighlightCache(e){if(e.cacheKey==null){console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${e.prevName??e.name}" -> "${e.name}".`);return}const t=this.getDiffResultCache(e),i=this.getDiffHighlightKey(e);if(i==null||O(e)||t!=null&&p(t.options,this.getDiffRenderOptions()))return;const s=this.getTaskByHighlightKey(i);s!=null?s.primeCache=!0:this.submitCacheTask({type:"diff",diff:e},i)}getPlainDiffAST(e,t,i,s,r){return this.highlighter!=null?$(e,this.highlighter,this.renderOptions,{forcePlainText:!0,startingLine:t,totalLines:i,expandedHunks:s,collapsedContextThreshold:r}):void 0}terminate(){this.lifecycleGeneration++,this.cancelActiveWorkerTasks(),this.terminateWorkers(),this.fileCache.clear(),this.diffCache.clear(),this.activeRequestByInstance.clear(),this.queuedTasks.length=0,this.queuedTaskByInstance.clear(),this.taskByHighlightKey.clear(),this.activeTaskById.clear(),this.highlighter=void 0,this.initialized=!1,this.workersFailed=!1,this.queueBroadcastStateChanges()}isCurrentLifecycle(e){return this.lifecycleGeneration===e}queueInitialization(e){this.initialize(e).catch(t=>{console.error(t)})}cancelActiveWorkerTasks(){const e=new q;for(const t of this.activeTaskById.values())"reject"in t&&t.reject(e)}terminateWorkers(){for(const e of this.workers)e.worker.terminate();this.workers.length=0}getStats(){return{managerState:this.initialized===!1?"waiting":this.initialized!==!0?"initializing":"initialized",totalWorkers:this.workers.length,workersFailed:this.workersFailed,busyWorkers:this.workers.filter(e=>e.requestId!=null||e.pendingSetupRequestId!=null).length,queuedTasks:this.queuedTasks.length,activeTasks:this.activeTaskById.size,themeSubscribers:this.themeSubscribers.size,fileCacheSize:this.fileCache.size,diffCacheSize:this.diffCache.size}}submitTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.getHighlightKeyForRequest(t),s=i!=null?this.getTaskByHighlightKey(i):void 0;if(s!=null){this.detachInstanceFromQueuedTasks(e,s),this.addInstanceToTask(s,e),this.queueBroadcastStateChanges();return}this.detachInstanceFromQueuedTasks(e);const r=this.generateRequestId(),n=Date.now(),{renderOptionsVersion:a}=this,o=(()=>{switch(t.type){case"file":return{type:"file",id:r,request:{...t,id:r},instances:new Set([e]),primeCache:!1,highlightKey:i,renderOptionsVersion:a,requestStart:n};case"diff":return{type:"diff",id:r,request:{...t,id:r},instances:new Set([e]),primeCache:!1,highlightKey:i,renderOptionsVersion:a,requestStart:n}}})();this.enqueueRenderTask(o,e)}submitCacheTask(e,t){this.initialized===!1&&this.queueInitialization();const i=this.generateRequestId(),s=Date.now(),{renderOptionsVersion:r}=this,n=(()=>{switch(e.type){case"file":return{type:"file",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:r,requestStart:s};case"diff":return{type:"diff",id:i,request:{...e,id:i},instances:new Set,primeCache:!0,highlightKey:t,renderOptionsVersion:r,requestStart:s}}})();this.enqueueRenderTask(n)}enqueueRenderTask(e,t){this.queuedTasks.push(e),t!=null&&this.queuedTaskByInstance.set(t,e),e.highlightKey!=null&&this.taskByHighlightKey.set(e.highlightKey,e),this.queueDrain()}async resolveLanguagesAndExecuteTask(e,t,i){try{const s=i.filter(r=>!e.langs.has(r));if(s.length>0&&(E(s)?t.request.resolvedLanguages=z(s):t.request.resolvedLanguages=await F(s)),!this.activeTaskById.has(t.id)){e.requestId===t.id&&(this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain());return}this.executeTask(e,t)}catch{this.cleanWorkerAndTask(e,t),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}}handleWorkerMessage(e,t){const i=this.activeTaskById.get(t.id);try{if(i==null)throw y;if(t.type==="error"){const s=new Error(t.error);if(t.stack&&(s.stack=t.stack),"reject"in i)i.reject(s);else if(u(i))this.notifyHighlightError(i,s);else throw new Error("handleWorkerMessage: unknown task type");throw s}else switch(t.requestType){case"initialize":if(i.type!=="initialize")throw new Error("handleWorkerMessage: task/response dont match");this.syncCustomExtensionVersion(e,i.request),i.resolve();break;case"set-render-options":if(i.type!=="set-render-options")throw new Error("handleWorkerMessage: task/response dont match");i.resolve();break;case"file":{if(i.type!=="file")throw new Error("handleWorkerMessage: task/response dont match");const{result:s,options:r}=t;if(!this.isCurrentRenderTask(i)||!T(r,this.getFileRenderOptions()))throw y;const{request:n}=i;this.syncCustomExtensionVersion(e,n),n.file.cacheKey!=null&&this.fileCache.set(n.file.cacheKey,{result:s,options:r}),this.notifyFileInstances(i,s,r);break}case"diff":{if(i.type!=="diff")throw new Error("handleWorkerMessage: task/response dont match");const{result:s,options:r}=t;if(!this.isCurrentRenderTask(i)||!p(r,this.getDiffRenderOptions()))throw y;const{request:n}=i;this.syncCustomExtensionVersion(e,n),n.diff.cacheKey!=null&&this.diffCache.set(n.diff.cacheKey,{result:s,options:r}),this.notifyDiffInstances(i,s,r);break}}}catch(s){s!==y&&console.error(s,i,t)}this.cleanWorkerAndTask(e,i,t.id),this.queueBroadcastStateChanges(),this.queuedTasks.length>0&&this.queueDrain()}_queuedDrain;queueDrain(){this._queuedDrain==null&&(this._queuedDrain=Promise.resolve().then(this.drainQueue),this.queueBroadcastStateChanges())}assignWorkerToTask(e,t){t.requestId=e.id,u(e)&&(this.clearQueuedInstanceRequests(e),this.trackInstanceRequests(e)),this.activeTaskById.set(e.id,e)}cleanWorkerAndTask(e,t,i=t?.id){e.requestId===i&&(e.requestId=void 0),e.pendingSetupRequestId===i&&(e.pendingSetupRequestId=void 0),t!=null&&(u(t)&&(this.clearInstanceRequests(t),this.clearHighlightKey(t)),this.activeTaskById.delete(t.id))}executeTask(e,t){U(t.request)&&this.maybeAttachCustomExtensions(e,t.request),this.activeTaskById.has(t.id)||this.assignWorkerToTask(t,e);for(const i of H(t))e.langs.add(i);try{e.worker.postMessage(t.request)}catch(i){console.error("Failed to post message to worker:",i),u(t)?this.notifyHighlightError(t,i):"reject"in t&&t.reject(i),this.cleanWorkerAndTask(e,t),this.queuedTasks.length>0&&this.queueDrain()}this.queueBroadcastStateChanges()}maybeAttachCustomExtensions(e,t){if(t.customExtensionsVersion!=null)return;const i=I();e.customExtensionsVersion>=i||(t.customExtensionsVersion=i,t.customExtensionMap=C())}syncCustomExtensionVersion(e,t){t.customExtensionsVersion!=null&&(e.customExtensionsVersion=t.customExtensionsVersion)}getAvailableWorker(e){let t;for(const i of this.workers){if(i.requestId!=null||i.pendingSetupRequestId!=null||!i.initialized)continue;if(t=i,e.length===0)break;let s=!0;for(const r of e)if(!i.langs.has(r)){s=!1;break}if(s)break}return t}getFileHighlightKey(e){if(e.cacheKey!=null)return`file:${e.cacheKey}:${this.renderOptionsVersion}`}getDiffHighlightKey(e){if(e.cacheKey!=null)return`diff:${e.cacheKey}:${this.renderOptionsVersion}`}getHighlightKeyForRequest(e){switch(e.type){case"file":return this.getFileHighlightKey(e.file);case"diff":return this.getDiffHighlightKey(e.diff)}}hasActiveRequest(e){for(const t of d(e))if(this.activeRequestByInstance.has(t))return!0;return!1}addInstanceToTask(e,t){e.type,e.instances.add(t),this.activeTaskById.has(e.id)?this.activeRequestByInstance.set(t,e.id):this.queuedTaskByInstance.set(t,e)}detachInstanceFromQueuedTasks(e,t){const i=this.queuedTaskByInstance.get(e);i==null||i===t||(this.queuedTaskByInstance.delete(e),this.detachInstanceFromRenderTask(i,e),!i.primeCache&&i.instances.size===0&&this.removeQueuedTask(i))}detachInstanceFromRenderTask(e,t){e.type,e.instances.delete(t)}removeQueuedTask(e){const t=this.queuedTasks.indexOf(e);t!==-1&&this.queuedTasks.splice(t,1),this.clearQueuedInstanceRequests(e),this.clearHighlightKey(e)}removeActiveTask(e){this.clearInstanceRequests(e),this.clearHighlightKey(e),this.activeTaskById.delete(e.id)}invalidateRenderTasks(){for(let e=this.queuedTasks.length-1;e>=0;e--){const t=this.queuedTasks[e];t.renderOptionsVersion!==this.renderOptionsVersion&&this.removeQueuedTask(t)}for(const e of Array.from(this.activeTaskById.values()))u(e)&&e.renderOptionsVersion!==this.renderOptionsVersion&&this.removeActiveTask(e)}clearQueuedInstanceRequests(e){for(const t of d(e))this.queuedTaskByInstance.get(t)===e&&this.queuedTaskByInstance.delete(t)}clearHighlightKey(e){e.highlightKey!=null&&this.taskByHighlightKey.get(e.highlightKey)===e&&this.taskByHighlightKey.delete(e.highlightKey)}trackInstanceRequests(e){for(const t of d(e))this.activeRequestByInstance.set(t,e.id)}clearInstanceRequests(e){for(const t of d(e))this.activeRequestByInstance.get(t)===e.id&&this.activeRequestByInstance.delete(t)}notifyFileInstances(e,t,i){for(const s of e.instances)this.activeRequestByInstance.get(s)===e.id&&s.onHighlightSuccess(e.request.file,t,i)}notifyDiffInstances(e,t,i){for(const s of e.instances)this.activeRequestByInstance.get(s)===e.id&&s.onHighlightSuccess(e.request.diff,t,i)}notifyHighlightError(e,t){for(const i of d(e))this.activeRequestByInstance.get(i)===e.id&&i.onHighlightError(t)}hasMatchingFileInstanceTask(e,t){for(const i of this.iterateRenderTasks())if(i.type==="file"&&this.isCurrentRenderTask(i)&&i.instances.has(e)&&Q(t,i.request.file))return!0;return!1}hasMatchingDiffInstanceTask(e,t){for(const i of this.iterateRenderTasks())if(i.type==="diff"&&this.isCurrentRenderTask(i)&&i.instances.has(e)&&j(i.request.diff,t))return!0;return!1}getTaskByHighlightKey(e){const t=this.taskByHighlightKey.get(e);return t!=null&&this.isCurrentRenderTask(t)?t:void 0}isCurrentRenderTask(e){return e.renderOptionsVersion===this.renderOptionsVersion}*iterateRenderTasks(){for(const e of this.queuedTasks)yield e;for(const e of this.activeTaskById.values())u(e)&&(yield e)}generateRequestId(){return`req_${++this.nextRequestId}`}};function U(e){return e.type==="initialize"||e.type==="file"||e.type==="diff"}function H(e){const t=new Set;if(e.type==="initialize"||e.type==="set-render-options")return[];switch(e.type){case"file":t.add(e.request.file.lang??k(e.request.file.name));break;case"diff":t.add(e.request.diff.lang??k(e.request.diff.name)),t.add(e.request.diff.lang??k(e.request.diff.prevName??"-"));break}return t.delete("text"),Array.from(t)}function u(e){return e?.type==="file"||e?.type==="diff"}function d(e){return e.instances}let f;function De({poolOptions:e,highlighterOptions:t}){return f??=new G(e,t),f}function We(){f!=null&&(f.terminate(),f=void 0)}export{G as WorkerPoolManager,De as getOrCreateWorkerPoolSingleton,We as terminateWorkerPoolSingleton};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-x1P9U65-.js","assets/vendor-boot-CoTxysn6.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/index-C2ISrmRR.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-DgwThEwf.css","assets/pi-session-focus-preference-D6vrJGbH.js","assets/useAppFontEffects-CHnpTOtc.js","assets/runtimeSurface-CJN1oo_1.js","assets/nativeFileSave-Bhafll_7.js","assets/runtimeEndpointReset-OqTh3bbO.js","assets/SessionUnreadDot-BZy2DM6H.js","assets/permissionStore-zIpxq9Pq.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-xterm-xterm-css-DDGTF8rc.css","assets/SettingsView-TwUy1kXV.js","assets/vendor-qrcode-gzL9QFkg.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js","assets/collapsible-0yfy07W2.js","assets/vendor-base-ui-C7vVMZTg.js","assets/useSwitcherItems-DYtnl0T2.js","assets/vendor-katex-css-Cp579UoJ.css","assets/main-DxYfmK5D.js","assets/contextFileOpenGuard--7BLkncT.js","assets/useFilesViewSearch-DeVixiGZ.js"])))=>i.map(i=>d[i]);
2
- import{_ as m}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as f,g as v}from"./index-C2ISrmRR.js";import{r as h}from"./runtimeSurface-CJN1oo_1.js";/* empty css */import"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";function g(e={}){const{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:a,onRegisteredSW:d,onRegisterError:c}=e;let o,l;const p=async(n=!0)=>{await l};async function u(){if("serviceWorker"in navigator){if(o=await m(async()=>{const{Workbox:n}=await import("./vendor-workbox-window-BBnX5xw4.js");return{Workbox:n}},[]).then(({Workbox:n})=>new n("/sw.js",{scope:"/",type:"classic"})).catch(n=>{c?.(n)}),!o)return;o.addEventListener("activated",n=>{(n.isUpdate||n.isExternal)&&(r?r():window.location.reload())}),o.addEventListener("installed",n=>{n.isUpdate||s?.()}),o.register({immediate:t}).then(n=>{d?d("/sw.js",n):a?.(n)}).catch(n=>{c?.(n)})}}return l=u(),p}const w="--oc-viewport-bottom-strip";function y(e){const{innerWidth:t,innerHeight:r,screenWidth:i,screenHeight:s,safeAreaTop:a}=e;if(![t,r,i,s,a].every(Number.isFinite)||t<=0||r<=0||i<=0||s<=0)return null;if(a<=0)return 0;const d=r>=t,c=Math.max(i,s),o=Math.min(i,s),l=d?o:c,p=d?c:o;if(Math.abs(t-l)>1)return 0;const u=p-r;return u<=1?0:Math.abs(u-a)<=1?Math.round(u):null}const E=()=>{const e=document.createElement("div");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;top:0;left:0;width:0;height:0;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top,0px)",document.body.appendChild(e);try{return Number.parseFloat(window.getComputedStyle(e).paddingTop)||0}finally{e.remove()}},S=()=>document.documentElement.classList.contains("oc-capacitor-app")||!window.CSS?.supports?.("-webkit-touch-callout","none")?!1:navigator.standalone===!0||window.matchMedia?.("(display-mode: standalone)")?.matches===!0;function _(){if(typeof window>"u"||typeof document>"u")return()=>{};if(!S())return()=>{};const e=document.documentElement,t=()=>{if(!document.body)return;const r=y({innerWidth:window.innerWidth,innerHeight:window.innerHeight,screenWidth:window.screen.width,screenHeight:window.screen.height,safeAreaTop:E()});r!==null&&(r>0?e.style.setProperty(w,`${r}px`):e.style.removeProperty(w))};return t(),document.body||document.addEventListener("DOMContentLoaded",t,{once:!0}),window.addEventListener("resize",t),window.addEventListener("orientationchange",t),window.addEventListener("pageshow",t),window.visualViewport?.addEventListener("resize",t),()=>{document.removeEventListener("DOMContentLoaded",t),window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t),window.removeEventListener("pageshow",t),window.visualViewport?.removeEventListener("resize",t),e.style.removeProperty(w)}}const b=h();_();const L=()=>!(!("serviceWorker"in navigator)||!window.isSecureContext||window.location.protocol!=="http:"&&window.location.protocol!=="https:"||document.prerendering||String(document.visibilityState)==="prerender"),W=e=>{let t=!1;const r=()=>{t||L()&&(t=!0,e())},i=()=>{setTimeout(r,0)};document.readyState==="complete"?i():window.addEventListener("load",i,{once:!0}),(document.prerendering||String(document.visibilityState)==="prerender")&&document.addEventListener("visibilitychange",r,{once:!0})},R=()=>{W(()=>{try{g({onRegisterError(e){console.warn("[PWA] service worker registration skipped:",e)}})}catch(e){console.warn("[PWA] service worker registration skipped:",e)}})},P=async()=>{if(window.__PICHAMBER_RUNTIME_APIS__=f(),b==="mobile"){const{renderMobileApp:e}=await m(async()=>{const{renderMobileApp:t}=await import("./renderMobileApp-x1P9U65-.js");return{renderMobileApp:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]));e();return}await v(),await m(()=>import("./main-DxYfmK5D.js"),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,14,11,12,13,15,16,17,18,28,29,26]))};P();R();
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-BLoXL_J8.js","assets/vendor-boot-CoTxysn6.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/index-C2ISrmRR.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-DgwThEwf.css","assets/pi-session-focus-preference-BoN1cyoG.js","assets/useAppFontEffects-D2xXdmYC.js","assets/runtimeSurface-CJN1oo_1.js","assets/nativeFileSave-Bhafll_7.js","assets/runtimeEndpointReset-Bv2Y1fMm.js","assets/SessionUnreadDot-I1_tmqY9.js","assets/permissionStore-zIpxq9Pq.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-xterm-xterm-css-DDGTF8rc.css","assets/SettingsView-B-b76XDV.js","assets/vendor-qrcode-gzL9QFkg.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js","assets/collapsible-0yfy07W2.js","assets/vendor-base-ui-C7vVMZTg.js","assets/useSwitcherItems-BfA4omGb.js","assets/vendor-katex-css-Cp579UoJ.css","assets/main-DoVzQV56.js","assets/contextFileOpenGuard-BCi5nTZp.js","assets/useFilesViewSearch-BKotcAUN.js"])))=>i.map(i=>d[i]);
2
+ import{_ as m}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as f,g as v}from"./index-C2ISrmRR.js";import{r as h}from"./runtimeSurface-CJN1oo_1.js";/* empty css */import"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";function g(e={}){const{immediate:t=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:a,onRegisteredSW:d,onRegisterError:c}=e;let o,l;const p=async(n=!0)=>{await l};async function u(){if("serviceWorker"in navigator){if(o=await m(async()=>{const{Workbox:n}=await import("./vendor-workbox-window-BBnX5xw4.js");return{Workbox:n}},[]).then(({Workbox:n})=>new n("/sw.js",{scope:"/",type:"classic"})).catch(n=>{c?.(n)}),!o)return;o.addEventListener("activated",n=>{(n.isUpdate||n.isExternal)&&(r?r():window.location.reload())}),o.addEventListener("installed",n=>{n.isUpdate||s?.()}),o.register({immediate:t}).then(n=>{d?d("/sw.js",n):a?.(n)}).catch(n=>{c?.(n)})}}return l=u(),p}const w="--oc-viewport-bottom-strip";function y(e){const{innerWidth:t,innerHeight:r,screenWidth:i,screenHeight:s,safeAreaTop:a}=e;if(![t,r,i,s,a].every(Number.isFinite)||t<=0||r<=0||i<=0||s<=0)return null;if(a<=0)return 0;const d=r>=t,c=Math.max(i,s),o=Math.min(i,s),l=d?o:c,p=d?c:o;if(Math.abs(t-l)>1)return 0;const u=p-r;return u<=1?0:Math.abs(u-a)<=1?Math.round(u):null}const E=()=>{const e=document.createElement("div");e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;top:0;left:0;width:0;height:0;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top,0px)",document.body.appendChild(e);try{return Number.parseFloat(window.getComputedStyle(e).paddingTop)||0}finally{e.remove()}},S=()=>document.documentElement.classList.contains("oc-capacitor-app")||!window.CSS?.supports?.("-webkit-touch-callout","none")?!1:navigator.standalone===!0||window.matchMedia?.("(display-mode: standalone)")?.matches===!0;function _(){if(typeof window>"u"||typeof document>"u")return()=>{};if(!S())return()=>{};const e=document.documentElement,t=()=>{if(!document.body)return;const r=y({innerWidth:window.innerWidth,innerHeight:window.innerHeight,screenWidth:window.screen.width,screenHeight:window.screen.height,safeAreaTop:E()});r!==null&&(r>0?e.style.setProperty(w,`${r}px`):e.style.removeProperty(w))};return t(),document.body||document.addEventListener("DOMContentLoaded",t,{once:!0}),window.addEventListener("resize",t),window.addEventListener("orientationchange",t),window.addEventListener("pageshow",t),window.visualViewport?.addEventListener("resize",t),()=>{document.removeEventListener("DOMContentLoaded",t),window.removeEventListener("resize",t),window.removeEventListener("orientationchange",t),window.removeEventListener("pageshow",t),window.visualViewport?.removeEventListener("resize",t),e.style.removeProperty(w)}}const b=h();_();const L=()=>!(!("serviceWorker"in navigator)||!window.isSecureContext||window.location.protocol!=="http:"&&window.location.protocol!=="https:"||document.prerendering||String(document.visibilityState)==="prerender"),W=e=>{let t=!1;const r=()=>{t||L()&&(t=!0,e())},i=()=>{setTimeout(r,0)};document.readyState==="complete"?i():window.addEventListener("load",i,{once:!0}),(document.prerendering||String(document.visibilityState)==="prerender")&&document.addEventListener("visibilitychange",r,{once:!0})},R=()=>{W(()=>{try{g({onRegisterError(e){console.warn("[PWA] service worker registration skipped:",e)}})}catch(e){console.warn("[PWA] service worker registration skipped:",e)}})},P=async()=>{if(window.__PICHAMBER_RUNTIME_APIS__=f(),b==="mobile"){const{renderMobileApp:e}=await m(async()=>{const{renderMobileApp:t}=await import("./renderMobileApp-BLoXL_J8.js");return{renderMobileApp:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]));e();return}await v(),await m(()=>import("./main-DoVzQV56.js"),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,14,11,12,13,15,16,17,18,28,29,26]))};P();R();