@pi-chamber/web 0.3.2 → 0.3.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 (39) hide show
  1. package/dist/assets/{CommitSection-DLIvjYbM.js → CommitSection-BAYzLtBf.js} +1 -1
  2. package/dist/assets/{DiagramEditor-Tw3ZWHML.js → DiagramEditor-D1yc4joK.js} +1 -1
  3. package/dist/assets/{DiagramView-CK6R7taL.js → DiagramView-CAlJiG11.js} +1 -1
  4. package/dist/assets/{DiffView-vrxi5oWp.js → DiffView-DGD9DMS7.js} +1 -1
  5. package/dist/assets/{FilesView-BD_h3EVr.js → FilesView-DB5VI7EN.js} +1 -1
  6. package/dist/assets/{GitView-BwNKqK0K.js → GitView-CFlPcSn9.js} +3 -3
  7. package/dist/assets/{JsonTreeView-CmY7QgEX.js → JsonTreeView-CoX1ZscV.js} +1 -1
  8. package/dist/assets/{MarkdownRendererImpl-CpI-25Xk.js → MarkdownRendererImpl-V1HMFCjr.js} +1 -1
  9. package/dist/assets/{PatchDiff-CrIWbYj7.js → PatchDiff-D6Gs7K5B.js} +1 -1
  10. package/dist/assets/{PierreDiffViewer-B410mdbq.js → PierreDiffViewer-COYd5Qr-.js} +1 -1
  11. package/dist/assets/{SessionSwitcherDropdown-DROjbyIu.js → SessionSwitcherDropdown-o1RjhCfF.js} +8 -8
  12. package/dist/assets/{SettingsView-CsJItYZh.js → SettingsView-BYqvfMTS.js} +3 -3
  13. package/dist/assets/{SettingsWindow-C9s4AX72.js → SettingsWindow-CtNS0tQn.js} +1 -1
  14. package/dist/assets/{ToolOutputDialog-b_R4tAZu.js → ToolOutputDialog-2zKUdGYL.js} +1 -1
  15. package/dist/assets/{ToolPartDiffPreview-CfnliaE9.js → ToolPartDiffPreview-CBFC9min.js} +1 -1
  16. package/dist/assets/{VirtualizedFileDiff-CQz2fSZI.js → VirtualizedFileDiff-UMgLcO4Q.js} +1 -1
  17. package/dist/assets/{collapsible-CR4U9tjw.js → collapsible-Kx4bmsQM.js} +1 -1
  18. package/dist/assets/{computeVirtualFileMetrics-C7vXPUYT.js → computeVirtualFileMetrics-DdOCbMyK.js} +1 -1
  19. package/dist/assets/{contextFileOpenGuard-DtTHRnq1.js → contextFileOpenGuard-BRldMp0d.js} +1 -1
  20. package/dist/assets/{index-DZG82DE1.js → index-CuSNEV7s.js} +1 -1
  21. package/dist/assets/{isDiffPlainText-zTq-4A04.js → isDiffPlainText-CGIf0q8p.js} +1 -1
  22. package/dist/assets/{isFilePlainText-CLgIdzE5.js → isFilePlainText-D4hgTRxT.js} +1 -1
  23. package/dist/assets/{main-BVWtJYSk.js → main-By_pvk90.js} +2 -2
  24. package/dist/assets/{main-DXYHsqzA.js → main-CmkRaMOR.js} +4 -4
  25. package/dist/assets/{markdownCore-CN0pApQE.js → markdownCore-CAVCyFnI.js} +1 -1
  26. package/dist/assets/{miniChat-BrbRq5NQ.js → miniChat-_XK2gGZE.js} +2 -2
  27. package/dist/assets/{mobile-DTPtCn5N.js → mobile-B4E4JqAf.js} +2 -2
  28. package/dist/assets/{renderElectronMiniChatApp-CM8qBaye.js → renderElectronMiniChatApp-Ca4hZgIz.js} +1 -1
  29. package/dist/assets/{renderMobileApp-KS_pt-qc.js → renderMobileApp-ClA5Cnmw.js} +4 -4
  30. package/dist/assets/{useInlineCommentController-CwNNjgc7.js → useInlineCommentController-DD31jQNC.js} +1 -1
  31. package/dist/assets/{usePanelSlide-DkorgQJ5.js → usePanelSlide-a4c67FIY.js} +2 -2
  32. package/dist/assets/{useWindowTitle-B9wt_3ZQ.js → useWindowTitle-DoHrUC5r.js} +1 -1
  33. package/dist/assets/{vendor-codemirror-language-data-x89A7Wy0.js → vendor-codemirror-language-data-Dp_Z-0GD.js} +2 -2
  34. package/dist/assets/{web-components-BEPfE4kU.js → web-components-Cct1r-wn.js} +1 -1
  35. package/dist/index.html +1 -1
  36. package/dist/mini-chat.html +1 -1
  37. package/dist/mobile.html +1 -1
  38. package/package.json +1 -1
  39. package/server/lib/pi/session-daemon/session-daemon.js +1 -1
@@ -1,2 +1,2 @@
1
- import{g as z}from"./vendor-marked-i_gIkIP3.js";import{k as $}from"./vendor-katex-CHD9BdDO.js";import{p}from"./vendor-dompurify-r8glNMJW.js";import{eC as T,eD as E,eE as L,eF as C}from"./SessionSwitcherDropdown-DROjbyIu.js";import{p as O}from"./vendor-remend-BWYYytN3.js";const I=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),k=["script","style"],v=e=>z.lexer(e),H=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),R=e=>{const t=e.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!t)return!1;const r=t[1];if(!r)return!1;const n=r[0],s=r.length,a=e.trimEnd().split(`
1
+ import{g as z}from"./vendor-marked-i_gIkIP3.js";import{k as $}from"./vendor-katex-CHD9BdDO.js";import{p}from"./vendor-dompurify-r8glNMJW.js";import{eC as T,eD as E,eE as L,eF as C}from"./SessionSwitcherDropdown-o1RjhCfF.js";import{p as O}from"./vendor-remend-BWYYytN3.js";const I=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),k=["script","style"],v=e=>z.lexer(e),H=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),R=e=>{const t=e.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!t)return!1;const r=t[1];if(!r)return!1;const n=r[0],s=r.length,a=e.trimEnd().split(`
2
2
  `).at(-1)?.trim()??"";return!new RegExp(`^[\\t ]{0,3}${n}{${s},}[\\t ]*$`).test(a)},le=e=>{const t=e.replace(/^\n+/,"");return!!(/^[ \t]{0,3}(`{3,}|~{3,})/.test(t)||/^[ \t]{0,3}(?:> |[-*+] |\d+[.)] )/.test(t))},D=e=>{try{return O(e,{linkMode:"text-only"})}catch{return e}},g=(e,t)=>[{raw:e,src:e,mode:t?"live":"full",highlight:!t}],w=(e,t)=>{let r=-1;for(let s=e.length-1;s>=0;s-=1)if(e[s]?.type!=="space"){r=s;break}if(r<0)return[];const n=[];for(let s=0;s<e.length;s+=1){const a=e[s];if(!a||a.type==="space")continue;const i=a.raw??"",c=t.markLastLive&&s===r,o=a.type==="code"&&R(i);n.push({raw:i,src:o||c?i:D(i),mode:c?"live":"full",highlight:!t.cheap&&!o})}return n},b=(e,t,r=v)=>[{raw:e,src:e,mode:"full",highlight:!0}],F=2;class N{constructor(t=v){this.lex=t}prevText="";frozenSrc="";frozenBlocks=[];cached=null;update(t){if(this.cached&&t===this.prevText)return this.cached;if(this.prevText&&!t.startsWith(this.prevText)&&(this.frozenSrc="",this.frozenBlocks=[]),this.prevText=t,H(t))return this.frozenSrc="",this.frozenBlocks=[],this.cached=g(t,!0),this.cached;this.frozenSrc&&!t.startsWith(this.frozenSrc)&&(this.frozenSrc="",this.frozenBlocks=[]);const r=t.slice(this.frozenSrc.length);let n;try{n=this.lex(r)}catch{return this.cached=g(t,!0),this.cached}const s=[];for(let o=0;o<n.length;o+=1)n[o]?.type!=="space"&&s.push(o);const a=Math.max(0,s.length-F);if(a>0){const o=(s[a-1]??-1)+1,l=n.slice(0,o),f=w(l,{markLastLive:!1,cheap:!0});this.frozenBlocks=[...this.frozenBlocks,...f],this.frozenSrc+=l.map(m=>m.raw??"").join(""),n=n.slice(o)}const i=w(n,{markLastLive:!0,cheap:!0}),c=i.length>0?[...this.frozenBlocks,...i]:this.frozenBlocks.length>0?this.frozenBlocks:g(t,!0);return this.cached=c,c}}const P=32,h=new Map,G=e=>{const t=h.get(e);if(t)return h.delete(e),h.set(e,t),t;const r=new N;for(h.set(e,r);h.size>P;){const n=h.keys().next().value;if(typeof n!="string")break;h.delete(n)}return r},S=e=>{h.delete(e)},he=(e,t)=>{if(!e||e.length===0||e.length!==t.length||t[t.length-1]?.mode!=="live"||e[e.length-1]?.mode!=="live")return!1;for(let n=0;n<t.length-1;n+=1){const s=e[n],a=t[n];if(!s||!a||s.mode!=="full"||a.mode!=="full"||s.raw!==a.raw)return!1}return!0},d=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),y=(e,t,r)=>{try{return $.renderToString(e,{displayMode:r,throwOnError:!1})}catch{return t}},j={name:"inlineMath",level:"inline",start(e){const t=e.indexOf("\\(");return t<0?void 0:t},tokenizer(e){const t=/^\\\(([\s\S]+?)\\\)/.exec(e);if(t)return{type:"inlineMath",raw:t[0],text:t[1]??""}},renderer(e){const t=e;return y(t.text,t.raw,!1)}},q={name:"blockMath",level:"block",start(e){const t=e.indexOf("\\[");return t<0?void 0:t},tokenizer(e){const t=/^\\\[([\s\S]+?)\\\]/.exec(e);if(t)return{type:"blockMath",raw:t[0],text:t[1]??""}},renderer(e){const t=e;return y(t.text,t.raw,!0)}},A=z.use({gfm:!0,breaks:!1,extensions:[j,q],renderer:{html({text:e}){return I(e)},link({href:e,title:t,text:r}){const n=e??"",s=T(n);if(s)return`<a href="${d(C(s))}" data-pichamber-agent-mention="true" class="text-primary hover:underline" target="_blank" rel="noopener noreferrer">${r}</a>`;const a=E(n);if(a)return`<a href="${d(n)}" data-skill-name="${d(a)}" class="text-primary hover:underline">${r}</a>`;const i=t?` title="${d(t)}"`:"";return`<a href="${d(n)}"${i} class="external-link" target="_blank" rel="noopener noreferrer">${r}</a>`}}}),W=e=>e.replace(/\$\$([\s\S]*?)\$\$/g,(t,r)=>{try{return $.renderToString(r,{displayMode:!0,throwOnError:!1})}catch{return`$$${r}$$`}}),_=e=>{if(e.indexOf("$")===-1)return e;const t=/(<(?:pre|code|kbd)[^>]*>[\s\S]*?<\/(?:pre|code|kbd)>)/gi;return e.split(t).map((r,n)=>n%2===1?r:W(r)).join("")},U=/<pre><code(?:\s+class="language-([^"]*)")?>([\s\S]*?)<\/code><\/pre>/g,X=1200,Z=(e,t)=>{let r=1;for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===10&&++r>t)return!0;return!1},J=e=>e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&"),Q=async e=>{const t=[...e.matchAll(U)];if(t.length===0)return e;const r=X;let n=e;for(const s of t){const[a,i,c]=s,o=(i||"text").toLowerCase();if(o==="mermaid")continue;const l=J(c??"");if(Z(l,r)){n=n.replace(a,()=>a.replace("<pre",`<pre data-md-lang="${o}"`));continue}const f=await L(l,o);if(f){const m=f.replace(/^<pre/,`<pre data-md-lang="${o}"`);n=n.replace(a,()=>m)}}return n},V={USE_PROFILES:{html:!0,mathMl:!0,svg:!0},ADD_TAGS:["svg","path","g","rect","line","polygon","polyline","circle","ellipse","text","tspan","defs","marker"],ADD_ATTR:["d","viewBox","preserveAspectRatio","xmlns","target","fill","stroke","stroke-width","transform","points","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","style"],FORBID_TAGS:[...k],FORBID_CONTENTS:[...k]};let M=!1;const Y=()=>{M||typeof window>"u"||!p.isSupported||(M=!0,p.addHook("afterSanitizeAttributes",e=>{e instanceof HTMLAnchorElement&&e.target==="_blank"&&e.setAttribute("rel","noopener noreferrer")}))},B=e=>p.isSupported?(Y(),p.sanitize(e,V)):"",K=240,u=new Map,ee=e=>{let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)},x=(e,t)=>{if(u.delete(e),u.set(e,t),u.size<=K)return;const r=u.keys().next().value;r&&u.delete(r)},te=async e=>{const t=await Promise.resolve(A.parse(e.src)),r=e.highlight?_(t):t,n=e.highlight?await Q(r):r;return B(n)},re=e=>{if(!e)return"";const t=A.parse(e),r=_(t);return B(r)},ne=async(e,t,r)=>{if(!e)return r&&S(r),[];let n;return t?n=G(r).update(e):(S(r),n=b(e)),Promise.all(n.map(async(s,a)=>{if(s.mode==="live")return{id:`live:${a}`,html:"",mode:"live",raw:s.raw};const i=ee(s.raw),c=`${i}:${s.mode}:${s.highlight?1:0}`,o=`${r}:${a}:${s.mode}`,l=u.get(o);if(l&&l.hash===i)return x(o,l),{id:c,html:l.html,mode:s.mode,raw:s.raw};const f=await te(s);return x(o,{hash:i,html:f}),{id:c,html:f,mode:s.mode,raw:s.raw}}))},fe=Object.freeze(Object.defineProperty({__proto__:null,renderMarkdownBlocks:ne,renderMarkdownSync:re},Symbol.toStringTag,{value:"Module"}));export{ne as a,le as b,he as i,fe as m,re as r,G as s};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-CM8qBaye.js","assets/vendor-react-DYyjh7Q0.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CHD9BdDO.js","assets/vendor-katex-Cp579UoJ.css","assets/index-BAqpUCjs.js","assets/vendor-zustand-CnsBKjP5.js","assets/index-riABQmQ_.css","assets/useWindowTitle-B9wt_3ZQ.js","assets/SessionSwitcherDropdown-DROjbyIu.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-base-ui-DL8r2fgQ.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-sVFnuruh.js","assets/vendor-floating-ui-dom-Bkw82kL9.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-B7OScDIw.js","assets/runtimeSurface-CkHYYg0E.js","assets/vendor-dnd-kit-core-GipZW2tY.js","assets/vendor-dnd-kit-utilities-CrOcp0Bp.js","assets/vendor-dnd-kit-accessibility-Cv52zwWT.js","assets/vendor-dnd-kit-sortable-Ct2QxIHb.js","assets/vendor-cmdk-BCEUzcHE.js","assets/vendor-radix-ui-react-dialog-jX3Dld8c.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D1GnwnP9.js","assets/vendor-radix-ui-react-context-CM4yFQ2I.js","assets/vendor-radix-ui-react-id-BcxRjnbX.js","assets/vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js","assets/vendor-radix-ui-react-use-controllable-state-C_ecoh35.js","assets/vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js","assets/vendor-radix-ui-react-primitive-CfpW6_IT.js","assets/vendor-radix-ui-react-slot-BxUc3Pvz.js","assets/vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js","assets/vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js","assets/vendor-radix-ui-react-focus-scope-C2K7lNPv.js","assets/vendor-radix-ui-react-portal-xlJWBfDg.js","assets/vendor-radix-ui-react-presence-Btn-Dp7L.js","assets/vendor-radix-ui-react-focus-guards-D5MZ0nQs.js","assets/vendor-react-remove-scroll-CfeMe0DL.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-C9YRs2nU.js","assets/vendor-react-style-singleton-B1H4bWSG.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-C-AuTczP.js","assets/vendor-use-callback-ref-CJB0R85I.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-E2vgV9K3.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-DSzLbZiS.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-BUlYhQ3o.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BS2SpSAZ.js","assets/vendor-codemirror-lang-json-CqayksDf.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-Ba8JZ6fp.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-DK27qQri.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-CvO36Y1p.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-x89A7Wy0.js","assets/vendor-codemirror-lang-python-_2bIYTiJ.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-RrgJ8H_6.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tanstack-react-virtual-IrbCBGJ4.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-DJASDzNt.js","assets/vendor-motion-dom-DJLgZh4Q.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-sonner-CW8w438f.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js"])))=>i.map(i=>d[i]);
2
- import{_ as o}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as t}from"./index-BAqpUCjs.js";import"./vendor-katex-CHD9BdDO.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-react-DYyjh7Q0.js";import"./vendor-scheduler-7OC5HNn7.js";window.__PICHAMBER_RUNTIME_APIS__=t();o(async()=>{const{renderElectronMiniChatApp:r}=await import("./renderElectronMiniChatApp-CM8qBaye.js");return{renderElectronMiniChatApp:r}},__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,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82])).then(({renderElectronMiniChatApp:r})=>{r()});
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-Ca4hZgIz.js","assets/vendor-react-DYyjh7Q0.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CHD9BdDO.js","assets/vendor-katex-Cp579UoJ.css","assets/index-BAqpUCjs.js","assets/vendor-zustand-CnsBKjP5.js","assets/index-riABQmQ_.css","assets/useWindowTitle-DoHrUC5r.js","assets/SessionSwitcherDropdown-o1RjhCfF.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-base-ui-DL8r2fgQ.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-sVFnuruh.js","assets/vendor-floating-ui-dom-Bkw82kL9.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-B7OScDIw.js","assets/runtimeSurface-CkHYYg0E.js","assets/vendor-dnd-kit-core-GipZW2tY.js","assets/vendor-dnd-kit-utilities-CrOcp0Bp.js","assets/vendor-dnd-kit-accessibility-Cv52zwWT.js","assets/vendor-dnd-kit-sortable-Ct2QxIHb.js","assets/vendor-cmdk-BCEUzcHE.js","assets/vendor-radix-ui-react-dialog-jX3Dld8c.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D1GnwnP9.js","assets/vendor-radix-ui-react-context-CM4yFQ2I.js","assets/vendor-radix-ui-react-id-BcxRjnbX.js","assets/vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js","assets/vendor-radix-ui-react-use-controllable-state-C_ecoh35.js","assets/vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js","assets/vendor-radix-ui-react-primitive-CfpW6_IT.js","assets/vendor-radix-ui-react-slot-BxUc3Pvz.js","assets/vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js","assets/vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js","assets/vendor-radix-ui-react-focus-scope-C2K7lNPv.js","assets/vendor-radix-ui-react-portal-xlJWBfDg.js","assets/vendor-radix-ui-react-presence-Btn-Dp7L.js","assets/vendor-radix-ui-react-focus-guards-D5MZ0nQs.js","assets/vendor-react-remove-scroll-CfeMe0DL.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-C9YRs2nU.js","assets/vendor-react-style-singleton-B1H4bWSG.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-C-AuTczP.js","assets/vendor-use-callback-ref-CJB0R85I.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-E2vgV9K3.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-DSzLbZiS.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-BUlYhQ3o.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BS2SpSAZ.js","assets/vendor-codemirror-lang-json-CqayksDf.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-Ba8JZ6fp.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-DK27qQri.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-CvO36Y1p.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-Dp_Z-0GD.js","assets/vendor-codemirror-lang-python-_2bIYTiJ.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-RrgJ8H_6.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tanstack-react-virtual-IrbCBGJ4.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-DJASDzNt.js","assets/vendor-motion-dom-DJLgZh4Q.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-sonner-CW8w438f.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js"])))=>i.map(i=>d[i]);
2
+ import{_ as o}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as t}from"./index-BAqpUCjs.js";import"./vendor-katex-CHD9BdDO.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-react-DYyjh7Q0.js";import"./vendor-scheduler-7OC5HNn7.js";window.__PICHAMBER_RUNTIME_APIS__=t();o(async()=>{const{renderElectronMiniChatApp:r}=await import("./renderElectronMiniChatApp-Ca4hZgIz.js");return{renderElectronMiniChatApp:r}},__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,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82])).then(({renderElectronMiniChatApp:r})=>{r()});
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-KS_pt-qc.js","assets/vendor-react-DYyjh7Q0.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CHD9BdDO.js","assets/vendor-katex-Cp579UoJ.css","assets/index-BAqpUCjs.js","assets/vendor-zustand-CnsBKjP5.js","assets/index-riABQmQ_.css","assets/useWindowTitle-B9wt_3ZQ.js","assets/SessionSwitcherDropdown-DROjbyIu.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-base-ui-DL8r2fgQ.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-sVFnuruh.js","assets/vendor-floating-ui-dom-Bkw82kL9.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-B7OScDIw.js","assets/runtimeSurface-CkHYYg0E.js","assets/vendor-dnd-kit-core-GipZW2tY.js","assets/vendor-dnd-kit-utilities-CrOcp0Bp.js","assets/vendor-dnd-kit-accessibility-Cv52zwWT.js","assets/vendor-dnd-kit-sortable-Ct2QxIHb.js","assets/vendor-cmdk-BCEUzcHE.js","assets/vendor-radix-ui-react-dialog-jX3Dld8c.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D1GnwnP9.js","assets/vendor-radix-ui-react-context-CM4yFQ2I.js","assets/vendor-radix-ui-react-id-BcxRjnbX.js","assets/vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js","assets/vendor-radix-ui-react-use-controllable-state-C_ecoh35.js","assets/vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js","assets/vendor-radix-ui-react-primitive-CfpW6_IT.js","assets/vendor-radix-ui-react-slot-BxUc3Pvz.js","assets/vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js","assets/vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js","assets/vendor-radix-ui-react-focus-scope-C2K7lNPv.js","assets/vendor-radix-ui-react-portal-xlJWBfDg.js","assets/vendor-radix-ui-react-presence-Btn-Dp7L.js","assets/vendor-radix-ui-react-focus-guards-D5MZ0nQs.js","assets/vendor-react-remove-scroll-CfeMe0DL.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-C9YRs2nU.js","assets/vendor-react-style-singleton-B1H4bWSG.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-C-AuTczP.js","assets/vendor-use-callback-ref-CJB0R85I.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-E2vgV9K3.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-DSzLbZiS.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-BUlYhQ3o.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BS2SpSAZ.js","assets/vendor-codemirror-lang-json-CqayksDf.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-Ba8JZ6fp.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-DK27qQri.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-CvO36Y1p.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-x89A7Wy0.js","assets/vendor-codemirror-lang-python-_2bIYTiJ.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-RrgJ8H_6.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tanstack-react-virtual-IrbCBGJ4.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-DJASDzNt.js","assets/vendor-motion-dom-DJLgZh4Q.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-sonner-CW8w438f.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/usePanelSlide-DkorgQJ5.js","assets/permissionStore-BRcQ9Jgt.js","assets/usePanelSlide-BV3KOtdA.css","assets/SettingsView-CsJItYZh.js","assets/vendor-qrcode-COsmt6jn.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/collapsible-CR4U9tjw.js","assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/CommitSection-DLIvjYbM.js","assets/PierreDiffViewer-B410mdbq.js","assets/web-components-BEPfE4kU.js","assets/computeVirtualFileMetrics-C7vXPUYT.js","assets/vendor-shiki-Bbf2GEcE.js","assets/vendor-shikijs-core-CGM_jqPK.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js","assets/vendor-hast-util-to-html-BKBhbTDb.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-rJCbAzvX.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","assets/themeResolver-BmJyTmjJ.js","assets/vendor-pierre-theming-C6Z4M5_u.js","assets/vendor-shikijs-engine-javascript-Cme4830A.js","assets/vendor-oniguruma-to-es-DLBnFDCE.js","assets/vendor-oniguruma-parser-C0D4_9rT.js","assets/vendor-regex-BBWcyTkg.js","assets/vendor-regex-utilities-2BQyy0xI.js","assets/vendor-regex-recursion-JU4mF-dD.js","assets/vendor-shikijs-transformers-CZWsLLKm.js","assets/VirtualizedFileDiff-CQz2fSZI.js","assets/isDiffPlainText-zTq-4A04.js","assets/vendor-diff-C3JhlQdm.js","assets/useInlineCommentController-CwNNjgc7.js","assets/appThemeRegistry-BK0dHKa6.js","assets/registerCustomTheme-BBXUCRnG.js","assets/vendor-remixicon-react-CzPq62YO.js"])))=>i.map(i=>d[i]);
2
- import{_ as t}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as i}from"./index-BAqpUCjs.js";import"./vendor-katex-CHD9BdDO.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-react-DYyjh7Q0.js";import"./vendor-scheduler-7OC5HNn7.js";window.__PICHAMBER_RUNTIME_APIS__=i();t(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-KS_pt-qc.js").then(o=>o.r);return{renderMobileApp:r}},__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,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127])).then(({renderMobileApp:r})=>{r()});
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-ClA5Cnmw.js","assets/vendor-react-DYyjh7Q0.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CHD9BdDO.js","assets/vendor-katex-Cp579UoJ.css","assets/index-BAqpUCjs.js","assets/vendor-zustand-CnsBKjP5.js","assets/index-riABQmQ_.css","assets/useWindowTitle-DoHrUC5r.js","assets/SessionSwitcherDropdown-o1RjhCfF.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-base-ui-DL8r2fgQ.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-sVFnuruh.js","assets/vendor-floating-ui-dom-Bkw82kL9.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-B7OScDIw.js","assets/runtimeSurface-CkHYYg0E.js","assets/vendor-dnd-kit-core-GipZW2tY.js","assets/vendor-dnd-kit-utilities-CrOcp0Bp.js","assets/vendor-dnd-kit-accessibility-Cv52zwWT.js","assets/vendor-dnd-kit-sortable-Ct2QxIHb.js","assets/vendor-cmdk-BCEUzcHE.js","assets/vendor-radix-ui-react-dialog-jX3Dld8c.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D1GnwnP9.js","assets/vendor-radix-ui-react-context-CM4yFQ2I.js","assets/vendor-radix-ui-react-id-BcxRjnbX.js","assets/vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js","assets/vendor-radix-ui-react-use-controllable-state-C_ecoh35.js","assets/vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js","assets/vendor-radix-ui-react-primitive-CfpW6_IT.js","assets/vendor-radix-ui-react-slot-BxUc3Pvz.js","assets/vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js","assets/vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js","assets/vendor-radix-ui-react-focus-scope-C2K7lNPv.js","assets/vendor-radix-ui-react-portal-xlJWBfDg.js","assets/vendor-radix-ui-react-presence-Btn-Dp7L.js","assets/vendor-radix-ui-react-focus-guards-D5MZ0nQs.js","assets/vendor-react-remove-scroll-CfeMe0DL.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-C9YRs2nU.js","assets/vendor-react-style-singleton-B1H4bWSG.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-C-AuTczP.js","assets/vendor-use-callback-ref-CJB0R85I.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-E2vgV9K3.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-DSzLbZiS.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-BUlYhQ3o.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BS2SpSAZ.js","assets/vendor-codemirror-lang-json-CqayksDf.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-Ba8JZ6fp.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-DK27qQri.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-CvO36Y1p.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-Dp_Z-0GD.js","assets/vendor-codemirror-lang-python-_2bIYTiJ.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-RrgJ8H_6.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tanstack-react-virtual-IrbCBGJ4.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-DJASDzNt.js","assets/vendor-motion-dom-DJLgZh4Q.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-sonner-CW8w438f.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/usePanelSlide-a4c67FIY.js","assets/permissionStore-BRcQ9Jgt.js","assets/usePanelSlide-BV3KOtdA.css","assets/SettingsView-BYqvfMTS.js","assets/vendor-qrcode-COsmt6jn.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/collapsible-Kx4bmsQM.js","assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/CommitSection-BAYzLtBf.js","assets/PierreDiffViewer-COYd5Qr-.js","assets/web-components-Cct1r-wn.js","assets/computeVirtualFileMetrics-DdOCbMyK.js","assets/vendor-shiki-Bbf2GEcE.js","assets/vendor-shikijs-core-CGM_jqPK.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js","assets/vendor-hast-util-to-html-BKBhbTDb.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-rJCbAzvX.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","assets/themeResolver-BmJyTmjJ.js","assets/vendor-pierre-theming-C6Z4M5_u.js","assets/vendor-shikijs-engine-javascript-Cme4830A.js","assets/vendor-oniguruma-to-es-DLBnFDCE.js","assets/vendor-oniguruma-parser-C0D4_9rT.js","assets/vendor-regex-BBWcyTkg.js","assets/vendor-regex-utilities-2BQyy0xI.js","assets/vendor-regex-recursion-JU4mF-dD.js","assets/vendor-shikijs-transformers-CZWsLLKm.js","assets/VirtualizedFileDiff-UMgLcO4Q.js","assets/isDiffPlainText-CGIf0q8p.js","assets/vendor-diff-C3JhlQdm.js","assets/useInlineCommentController-DD31jQNC.js","assets/appThemeRegistry-BK0dHKa6.js","assets/registerCustomTheme-BBXUCRnG.js","assets/vendor-remixicon-react-CzPq62YO.js"])))=>i.map(i=>d[i]);
2
+ import{_ as t}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as i}from"./index-BAqpUCjs.js";import"./vendor-katex-CHD9BdDO.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-react-DYyjh7Q0.js";import"./vendor-scheduler-7OC5HNn7.js";window.__PICHAMBER_RUNTIME_APIS__=i();t(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-ClA5Cnmw.js").then(o=>o.r);return{renderMobileApp:r}},__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,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127])).then(({renderMobileApp:r})=>{r()});
@@ -1 +1 @@
1
- import{j as e,R as c,e as ge,r as we}from"./vendor-react-DYyjh7Q0.js";import"./vendor-katex-CHD9BdDO.js";import{m as q,P as ve,E as J,u as oe,I as je,v as le,q as be,y as Se,x as Ie}from"./index-BAqpUCjs.js";import{u as Ce,a as De,b as Ne,s as Pe,c as Me,d as ke}from"./useWindowTitle-B9wt_3ZQ.js";import{cW as Ee,I as Y,f as G,bT as _e,T as Te,q as Le,s as Oe,cX as Ae,cY as Re,h as S,bl as Be,b as ie,a5 as w,aB as ae,cZ as Fe,C as ze,K as Ue,cK as $e,cg as We,cT as de,cS as He,B as ue,cR as z,c_ as me,c$ as Ke,aS as Ge,t as qe,b2 as Ve,aa as Xe,ab as Je,X as Ye,ad as Ze,ae as Qe,af as et,ah as tt,ai as rt,d0 as st,ch as nt,ap as ot,aq as it,ar as at}from"./SessionSwitcherDropdown-DROjbyIu.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-DL8r2fgQ.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-sVFnuruh.js";import"./vendor-floating-ui-dom-Bkw82kL9.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-B7OScDIw.js";import"./runtimeSurface-CkHYYg0E.js";import"./vendor-dnd-kit-core-GipZW2tY.js";import"./vendor-dnd-kit-utilities-CrOcp0Bp.js";import"./vendor-dnd-kit-accessibility-Cv52zwWT.js";import"./vendor-dnd-kit-sortable-Ct2QxIHb.js";import"./vendor-cmdk-BCEUzcHE.js";import"./vendor-radix-ui-react-dialog-jX3Dld8c.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D1GnwnP9.js";import"./vendor-radix-ui-react-context-CM4yFQ2I.js";import"./vendor-radix-ui-react-id-BcxRjnbX.js";import"./vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js";import"./vendor-radix-ui-react-use-controllable-state-C_ecoh35.js";import"./vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js";import"./vendor-radix-ui-react-primitive-CfpW6_IT.js";import"./vendor-radix-ui-react-slot-BxUc3Pvz.js";import"./vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js";import"./vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js";import"./vendor-radix-ui-react-focus-scope-C2K7lNPv.js";import"./vendor-radix-ui-react-portal-xlJWBfDg.js";import"./vendor-radix-ui-react-presence-Btn-Dp7L.js";import"./vendor-radix-ui-react-focus-guards-D5MZ0nQs.js";import"./vendor-react-remove-scroll-CfeMe0DL.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-C9YRs2nU.js";import"./vendor-react-style-singleton-B1H4bWSG.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-C-AuTczP.js";import"./vendor-use-callback-ref-CJB0R85I.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-E2vgV9K3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-DSzLbZiS.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-BUlYhQ3o.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BS2SpSAZ.js";import"./vendor-codemirror-lang-json-CqayksDf.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-Ba8JZ6fp.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-DK27qQri.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CvO36Y1p.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-x89A7Wy0.js";import"./vendor-codemirror-lang-python-_2bIYTiJ.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-RrgJ8H_6.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tanstack-react-virtual-IrbCBGJ4.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-DJASDzNt.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-sonner-CW8w438f.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";const ct=({mode:t,children:s})=>e.jsx(Ee.Provider,{value:t,children:s}),lt=Ae,dt=Re,ut=({totalTokens:t,percentage:s,colorPercentage:n,contextLimit:l,outputLimit:i,size:m="default",isMobile:a=!1,hideIcon:M=!1,showPercentIcon:T=!1,className:h,valueClassName:p,percentIconClassName:k,onClick:D,pressed:E=!1,cacheRead:x,cacheWrite:I,cacheHitPercent:v})=>{const[N,j]=c.useState(!1),_=typeof n=="number"?n:s,o=lt(s)??0,y=dt(_),g=y==="critical"?"var(--status-error)":y==="warn"?"var(--status-warning)":"var(--status-success)",d=b=>b>=1e6?`${(b/1e6).toFixed(1)}M`:b>=1e3?`${(b/1e3).toFixed(1)}K`:b.toFixed(1).replace(/\.0$/,""),U=b=>b>=90?"text-status-error":b>=75?"text-status-warning":"text-status-success",f=20,$=3,W=(f-$)/2,Z=2*Math.PI*W,ce=Z*(1-o/100),H=typeof i=="number"?Math.max(i,0):0,A=typeof x=="number"&&typeof I=="number",V=A?Math.max(0,x):0,Q=A?Math.max(0,I):0,R=typeof v=="number"&&Number.isFinite(v),O=[`Used tokens: ${d(t)}`,`Context limit: ${d(l)}`,`Output limit: ${d(H)}`,...A?[`Cache read: ${d(V)}`,`Cache write: ${d(Q)}`]:[],...R?[`Cache hit: ${v.toFixed(1)}%`]:[],`${Math.min(s,999).toFixed(1)}% used`],L=!a&&typeof D=="function",B=e.jsxs(e.Fragment,{children:[!a&&!M&&e.jsx(Y,{name:"donut-chart",className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:G("font-medium inline-flex items-center gap-1.5",p),children:T?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${f}`,className:G("h-3.5 w-3.5 -rotate-90",k),role:"progressbar","aria-valuenow":Math.round(o),"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("circle",{cx:f/2,cy:f/2,r:W,fill:"none",stroke:"var(--interactive-border)",strokeWidth:$}),e.jsx("circle",{cx:f/2,cy:f/2,r:W,fill:"none",stroke:g,strokeWidth:$,strokeLinecap:"round",strokeDasharray:Z,strokeDashoffset:ce,className:"transition-[stroke-dashoffset,stroke] duration-300"})]}),e.jsxs("span",{className:"text-foreground",children:[Math.min(s,999).toFixed(1),"%"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:U(_),children:Math.min(s,999).toFixed(1)}),"%"]})})]}),C=G("app-region-no-drag flex items-center gap-1.5 select-none",m==="compact"?"typography-micro":"typography-meta",L?G("rounded-md px-2 py-1.5 text-foreground transition-colors","hover:bg-interactive-hover","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"):"text-muted-foreground/60",h),P=L?e.jsx("button",{type:"button",className:C,"aria-label":"Context usage","aria-pressed":E,onClick:D,children:B}):e.jsx("div",{className:C,"aria-label":"Context usage",onClick:a?()=>j(!0):void 0,children:B});return a?e.jsxs(e.Fragment,{children:[P,e.jsx(_e,{open:N,onClose:()=>j(!1),title:"Context Usage",children:e.jsx("div",{className:"flex flex-col gap-1.5",children:e.jsxs("div",{className:"rounded-xl border border-border/40 bg-sidebar/30 px-3 py-2 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Used tokens"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(t)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Context limit"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(l)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Output limit"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(H)})]}),A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache read"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(V)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache write"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(Q)})]})]}):null,R?e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache hit"}),e.jsxs("span",{className:"typography-meta text-foreground font-medium",children:[v.toFixed(1),"%"]})]}):null,e.jsxs("div",{className:"flex justify-between items-center pt-1 border-t border-border/40",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Usage"}),e.jsxs("span",{className:G("typography-meta font-semibold",U(_)),children:[Math.min(s,999).toFixed(1),"%"]})]})]})})})]}):e.jsxs(Te,{children:[e.jsx(Le,{asChild:!0,children:P}),e.jsx(Oe,{children:e.jsx("div",{className:"space-y-0.5",children:O.map(b=>e.jsx("p",{className:"typography-micro leading-tight",children:b},b))})})]})},mt=t=>{const s=typeof t=="string"?t.trim():"";if(!s)return"";const n=typeof window<"u"?window.__PICHAMBER_HOME__:"";if(n&&s===n)return"~";if(n&&s.startsWith(`${n}/`))return`~/${s.slice(n.length+1)}`;const l=s.split("/").filter(Boolean);return l.length<=3?s:`.../${l.slice(-3).join("/")}`},te=t=>{const s=typeof t=="string"?t.trim():"";if(!s)return"";const n=s.replace(/\\/g,"/");return n==="/"?"/":n.replace(/\/+$/,"")},pt=({mode:t})=>{const s=S(r=>r.currentSessionId),n=S(r=>!!r.newSessionDraft?.open),l=S(r=>r.newSessionDraft?.selectedProjectId??null),i=q(r=>r.currentDirectory),m=ie(r=>r.projects),a=ie(r=>r.getActiveProject()),M=w(r=>r.getCurrentModel),T=w(r=>r.providers),h=ae(),p=Fe(s??""),k=ze(),D=Ue(r=>r.ensureStatus),E=S(r=>r.newSessionDraft?.open?te(r.newSessionDraft.directoryOverride??""):""),[x,I]=c.useState(!1),v=typeof window<"u"?window.__PICHAMBER_MACOS_MAJOR__??0:0,N=Number.isFinite(v)&&v>0,{usesFramelessChrome:j,side:_}=$e(),o=N?v>=26?"h-12":v<=15?"h-14":"":"",y=c.useMemo(()=>s?h.find(r=>r.id===s)??null:null,[s,h]);c.useEffect(()=>{ve()&&J("desktop_get_window_pinned").then(r=>{typeof r?.pinned=="boolean"&&I(r.pinned)})},[]);const g=y?.title?.trim()||(n||t==="draft"?"New session":"Session"),d=te(y?.directory??null),U=te(i),f=d||E||U,$=mt(f);c.useEffect(()=>{f&&D(f,k.git).catch(()=>{})},[D,f,k.git]);const W=c.useMemo(()=>{const r=f;return r?m.map(u=>({...u,normalizedPath:te(u.path)})).filter(u=>u.normalizedPath&&(u.normalizedPath===r||r.startsWith(`${u.normalizedPath}/`))).sort((u,K)=>K.path.length-u.path.length)[0]??null:null},[f,m]),Z=c.useMemo(()=>{const r=W??a;if(!r)return $||"PiChamber";const u=r.label?.trim();return u||(r.path.split(/[\\/]/).filter(Boolean).at(-1)??r.path)},[a,$,W]),H=We(f||null),A=H&&H!=="HEAD"?H:null,V=M(),Q=c.useMemo(()=>{for(let r=p.length-1;r>=0;r-=1){const u=p[r];if(u.role!=="assistant"||typeof u.providerID!="string"||typeof u.modelID!="string")continue;const ee=T.find(X=>X.id===u.providerID)?.models.find(X=>X.id===u.modelID);if(ee)return ee}},[p,T]),R=V?.limit?V:Q,O=R&&typeof R.limit=="object"&&R.limit!==null?R.limit:null,L=O&&typeof O.context=="number"?O.context:0,B=O&&typeof O.output=="number"?O.output:0,C=c.useMemo(()=>{if(!s||p.length===0)return null;let r,u;for(let se=p.length-1;se>=0;se-=1){const ne=p[se];if(ne.role!=="assistant")continue;const F=ne.tokens;if(!F)continue;if(F.input+F.output+F.reasoning+(F.cache?.read??0)+(F.cache?.write??0)>0){r=F,u=ne.id;break}}if(!r)return null;const K=r.input+r.output+r.reasoning+(r.cache?.read??0)+(r.cache?.write??0),ee=L>0?L:2e5,X=L>0?Math.round(K/L*100):0,ye=B>0?Math.round(r.output/B*100):void 0;return{totalTokens:K,percentage:X,contextLimit:L||0,outputLimit:B||void 0,normalizedOutput:ye,thresholdLimit:ee,lastMessageId:u}},[L,s,p,B]),[P,b]=c.useState(null),pe={WebkitAppRegion:"drag"},re={WebkitAppRegion:"no-drag"};c.useEffect(()=>{if(!s){b(r=>r===null?r:null);return}if(C&&C.totalTokens>0){b(r=>r&&r.totalTokens===C.totalTokens&&r.percentage===C.percentage&&r.contextLimit===C.contextLimit&&(r.outputLimit??0)===(C.outputLimit??0)&&(r.normalizedOutput??0)===(C.normalizedOutput??0)&&r.thresholdLimit===C.thresholdLimit&&r.lastMessageId===C.lastMessageId?r:C);return}b(r=>r===null?r:null)},[C,s]);const fe=P&&P.contextLimit>0?Math.min(999,P.totalTokens/P.contextLimit*100):0,he=c.useCallback(()=>{const r=!x;I(r),J("desktop_set_window_pinned",{pinned:r}).catch(()=>{I(!r)})},[x]),xe=c.useCallback(()=>{const r=s?{sessionId:s,directory:y?.directory??i??""}:{mode:"draft",directory:f||i||"",projectId:l};J("desktop_focus_main_window",r).then(u=>u?.focused===!0?J("desktop_close_current_window"):null)},[i,s,l,f,y]);return e.jsxs("header",{className:G("flex items-center gap-3 bg-background pr-3",N?"pl-[5.5rem]":"pl-3",j?"h-12":o||"min-h-14"),style:pe,children:[j&&_==="left"?e.jsx(de,{visible:!0,position:"left"}):null,e.jsx(He,{children:e.jsxs("button",{type:"button","aria-label":"Open session switcher",style:re,className:"flex min-w-0 max-w-full flex-col items-start rounded-md px-1 py-0.5 text-left transition-colors hover:bg-interactive-hover/60 focus-visible:outline-none focus-visible:bg-interactive-hover/60",children:[e.jsx("span",{className:"truncate typography-ui-label text-[14px] font-normal leading-tight text-foreground max-w-full",children:g}),e.jsxs("span",{className:"flex min-w-0 max-w-full items-center gap-1.5 truncate typography-micro text-[10.5px] font-normal leading-tight text-muted-foreground/75",children:[e.jsx("span",{className:"truncate",children:Z}),A?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(Y,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:A})]}):null]})]})}),e.jsx("div",{className:"min-w-0 flex-1"}),P&&P.totalTokens>0?e.jsx(ut,{totalTokens:P.totalTokens,percentage:fe,colorPercentage:P.percentage,contextLimit:P.contextLimit,outputLimit:P.outputLimit??0,className:"h-9 shrink-0 pl-1 pr-1 typography-ui-label",valueClassName:"font-semibold leading-none",hideIcon:!0,showPercentIcon:!0,percentIconClassName:"h-4.5 w-4.5"}):null,e.jsx(ue,{type:"button",variant:"ghost",size:"icon",onClick:he,"aria-label":x?"Unpin Mini Chat window":"Pin Mini Chat window",title:x?"Unpin window":"Pin above other windows",style:re,children:x?e.jsx(Y,{name:"pushpin-2-fill",className:"h-4 w-4"}):e.jsx(Y,{name:"pushpin-2",className:"h-4 w-4"})}),e.jsx(ue,{type:"button",variant:"ghost",size:"icon",onClick:xe,"aria-label":"Open session in main window",title:"Open in main window",style:re,children:e.jsx(Y,{name:"external-link",className:"h-4 w-4"})}),e.jsx(de,{visible:j&&_==="right",position:"right"})]})},ft=({mode:t,autoOpenDraft:s=!1,unavailable:n=!1})=>{const l=S(i=>i.currentSessionId);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:[e.jsx(pt,{mode:t}),e.jsx("main",{className:"min-h-0 flex-1",children:n?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center typography-ui-label text-muted-foreground",children:e.jsxs("div",{className:"max-w-sm rounded-lg border border-[var(--interactive-border)] bg-[var(--surface-elevated)] px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:"Session unavailable"}),e.jsx("div",{className:"mt-1 typography-small text-muted-foreground",children:"This session could not be loaded. It may have been deleted, archived, or opened from a different project context."})]})}):e.jsx(ct,{mode:"mini-chat",children:e.jsx(Be,{autoOpenDraft:s},l??"no-session")})})]})},ht=()=>{const t=oe(i=>i.shortcutOverrides),s=q(i=>i.currentDirectory),n=ie(i=>i.getActiveProject()),l=S(i=>i.openNewSessionDraft);c.useEffect(()=>{const i=a=>Ve(a,t),m=a=>{if(z(a,i("focus_input"))){a.preventDefault(),me();return}if(je()&&z(a,i("new_mini_chat"))){a.preventDefault(),J("desktop_open_draft_mini_chat_window",{directory:s||n?.path||"",projectId:n?.id??null})?.catch(h=>{console.warn("[mini-chat-shortcuts] failed to open draft mini chat window",h)});return}if(z(a,i("new_chat"))){a.preventDefault(),l({selectedProjectId:n?.id??null,directoryOverride:s||n?.path||null,preserveDirectoryOverride:!!(s||n?.path)}),me();return}if(z(a,i("open_model_selector"))){a.preventDefault();const{isModelSelectorOpen:h,setModelSelectorOpen:p}=oe.getState();p(!h);return}if(z(a,i("cycle_thinking_variant"))){if(w.getState().getCurrentModelVariants().length===0)return;a.preventDefault(),Ke(1).then(k=>{const D=S.getState().currentSessionId,E=w.getState().currentAgentName,x=w.getState().currentProviderId,I=w.getState().currentModelId;D&&E&&x&&I&&Ge.getState().saveAgentModelVariantForSession(D,E,x,I,k)}).catch(()=>{qe.error("Couldn't update thinking")});return}const M=z(a,i("cycle_favorite_model_forward")),T=z(a,i("cycle_favorite_model_backward"));if(M||T){const{favoriteModels:h,addRecentModel:p}=oe.getState();if(h.length===0)return;a.preventDefault();const{currentProviderId:k,currentModelId:D,setProvider:E,setModel:x}=w.getState(),I=h.findIndex(j=>j.providerID===k&&j.modelID===D),N=h[(I+(M?1:-1)+h.length)%h.length];E(N.providerID),x(N.modelID),p(N.providerID,N.modelID)}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n?.id,n?.path,s,l,t])},xt="pichamber:mini-chat-presence",yt=()=>{const t=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,s=t.get("mode")==="session"?"session":"draft",n=t.get("sessionId")?.trim()||null,l=t.get("directory")?.trim()||null,i=t.get("projectId")?.trim()||null;return{mode:s,sessionId:n,directory:l,projectId:i}},gt=({config:t})=>{const s=ae(),n=q(o=>o.currentDirectory),l=q(o=>o.setDirectory),i=S(o=>o.currentSessionId),m=S(o=>!!o.newSessionDraft?.open),a=S(o=>o.newSessionDraft?.open?o.newSessionDraft.bootstrapPendingDirectory??o.newSessionDraft.directoryOverride??"":""),M=S(o=>o.setCurrentSession),T=S(o=>o.openNewSessionDraft),h=w(o=>o.initializeApp),p=w(o=>o.isInitialized),k=w(o=>o.isConnected),D=w(o=>o.loadProviders),E=w(o=>o.loadAgents),x=w(o=>o.providers.length),I=w(o=>o.agents.length),v=nt();c.useEffect(()=>{h()},[h]),c.useEffect(()=>{if(p)return;let o=!0,y=0;const g=window.setInterval(()=>{if(o){if(y+=1,y>10){window.clearInterval(g);return}w.getState().isInitialized||w.getState().initializeApp()}},1e3);return()=>{o=!1,window.clearInterval(g)}},[p]);const N=c.useRef(!1);c.useEffect(()=>{if(!N.current&&t.mode==="session"&&t.directory){if(n===t.directory){N.current=!0;return}l(t.directory,{showOverlay:!1}),N.current=!0}},[t.directory,t.mode,n,l]),c.useEffect(()=>{t.mode!=="draft"||!m||i||!a||n===a||l(a,{showOverlay:!1})},[t.mode,n,i,a,m,l]),c.useEffect(()=>{k&&(x===0&&D({source:"electronMiniChat:recovery"}),I===0&&E({source:"electronMiniChat:recovery"}))},[I,k,E,D,x]);const j=c.useRef(!1);c.useEffect(()=>{if(j.current||t.mode!=="session"||!t.sessionId)return;if(i===t.sessionId){j.current=!0;return}if(i){j.current=!0;return}const o=s.find(g=>g.id===t.sessionId);if(!o){v.ensureSessionRenderable(t.sessionId);return}const y=o.directory??t.directory;M(t.sessionId,y),j.current=!0},[t,i,s,M,v]),c.useEffect(()=>{const o=y=>{const g=y.detail,d=typeof g?.sessionId=="string"?g.sessionId.trim():"";if(!d||S.getState().currentSessionId===d)return;const U=typeof g?.directory=="string"&&g.directory.trim().length>0?g.directory.trim():s.find(f=>f.id===d)?.directory??null;v.ensureSessionRenderable(d),M(d,U),j.current=!0};return window.addEventListener("pichamber:open-session",o),()=>window.removeEventListener("pichamber:open-session",o)},[s,M,v]),c.useEffect(()=>{t.mode!=="draft"||m||i||T({selectedProjectId:t.projectId,directoryOverride:t.directory,preserveDirectoryOverride:!!t.directory})},[t,i,m,T]);const _=c.useRef(!1);return c.useEffect(()=>{if(_.current||!p)return;const o=()=>{if(_.current)return;_.current=!0;const d=typeof document<"u"?document.getElementById("initial-loading"):null;d&&(d.classList.add("fade-out"),window.setTimeout(()=>d.remove(),300))},y=t.mode==="session"?i===t.sessionId:m,g=window.setTimeout(o,y?100:1500);return()=>window.clearTimeout(g)},[p,t.mode,t.sessionId,i,m]),null},wt=()=>{const t=S(n=>n.currentSessionId),s=q(n=>n.currentDirectory);return c.useEffect(()=>{if(!t||!s||typeof BroadcastChannel>"u")return;const n=new BroadcastChannel(xt),l=a=>{n.postMessage({type:"mini-chat-session-presence",sessionId:t,directory:s,viewed:a})};l(!0);const i=window.setInterval(()=>l(!0),5e3),m=()=>l(!1);return window.addEventListener("beforeunload",m),()=>{window.clearInterval(i),window.removeEventListener("beforeunload",m),l(!1),n.close()}},[s,t]),null},vt=t=>{const s=ae(),n=S(m=>m.currentSessionId),[l,i]=c.useState(!1);return c.useEffect(()=>{if(t.mode!=="session"||!t.sessionId||n===t.sessionId){i(!1);return}if(s.some(a=>a.id===t.sessionId)){i(!1);return}const m=window.setTimeout(()=>i(!0),5e3);return()=>window.clearTimeout(m)},[t.mode,t.sessionId,n,s]),l};function jt({apis:t}){const s=c.useMemo(()=>yt(),[]),n=q(l=>l.currentDirectory);return c.useEffect(()=>{Xe.setDirectory(n||s.directory||void 0)},[s.directory,n]),c.useEffect(()=>(le(t),()=>le(null)),[t]),Je(),ht(),Ce({enabled:!0}),De(),e.jsx(Ye,{children:e.jsx(Ze,{directory:n||s.directory,children:e.jsx(Qe,{apis:t,children:e.jsx(et,{delayDuration:300,skipDelayDuration:150,children:e.jsxs("div",{className:"h-full text-foreground bg-background",children:[e.jsx(bt,{config:s}),e.jsx(tt,{}),e.jsx(rt,{})]})})})})})}const bt=({config:t})=>{const s=vt(t);return e.jsxs(e.Fragment,{children:[e.jsx(gt,{config:t}),e.jsx(wt,{}),e.jsx(st,{embeddedBackgroundWorkEnabled:!0}),e.jsx(ft,{mode:t.mode,autoOpenDraft:t.mode==="draft",unavailable:s})]})},St=()=>{Se().then(()=>{Promise.all([Ie(),Ne()]).catch(t=>{console.error("[mini-chat-main] settings init failed:",t)}),Pe(),Me(),ke()}).catch(t=>{console.error("[mini-chat-main] appearance init failed:",t)})};function Yr(t){const s=t??be();if(!s)throw new Error("Runtime APIs not registered");St();const n=document.getElementById("root");if(!n)throw new Error("Root element not found");ge.createRoot(n).render(e.jsx(we.StrictMode,{children:e.jsx(ot,{children:e.jsx(it,{children:e.jsx(at,{children:e.jsx(jt,{apis:s})})})})}))}export{Yr as renderElectronMiniChatApp};
1
+ import{j as e,R as c,e as ge,r as we}from"./vendor-react-DYyjh7Q0.js";import"./vendor-katex-CHD9BdDO.js";import{m as q,P as ve,E as J,u as oe,I as je,v as le,q as be,y as Se,x as Ie}from"./index-BAqpUCjs.js";import{u as Ce,a as De,b as Ne,s as Pe,c as Me,d as ke}from"./useWindowTitle-DoHrUC5r.js";import{cW as Ee,I as Y,f as G,bT as _e,T as Te,q as Le,s as Oe,cX as Ae,cY as Re,h as S,bl as Be,b as ie,a5 as w,aB as ae,cZ as Fe,C as ze,K as Ue,cK as $e,cg as We,cT as de,cS as He,B as ue,cR as z,c_ as me,c$ as Ke,aS as Ge,t as qe,b2 as Ve,aa as Xe,ab as Je,X as Ye,ad as Ze,ae as Qe,af as et,ah as tt,ai as rt,d0 as st,ch as nt,ap as ot,aq as it,ar as at}from"./SessionSwitcherDropdown-o1RjhCfF.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-DL8r2fgQ.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-sVFnuruh.js";import"./vendor-floating-ui-dom-Bkw82kL9.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-B7OScDIw.js";import"./runtimeSurface-CkHYYg0E.js";import"./vendor-dnd-kit-core-GipZW2tY.js";import"./vendor-dnd-kit-utilities-CrOcp0Bp.js";import"./vendor-dnd-kit-accessibility-Cv52zwWT.js";import"./vendor-dnd-kit-sortable-Ct2QxIHb.js";import"./vendor-cmdk-BCEUzcHE.js";import"./vendor-radix-ui-react-dialog-jX3Dld8c.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D1GnwnP9.js";import"./vendor-radix-ui-react-context-CM4yFQ2I.js";import"./vendor-radix-ui-react-id-BcxRjnbX.js";import"./vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js";import"./vendor-radix-ui-react-use-controllable-state-C_ecoh35.js";import"./vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js";import"./vendor-radix-ui-react-primitive-CfpW6_IT.js";import"./vendor-radix-ui-react-slot-BxUc3Pvz.js";import"./vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js";import"./vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js";import"./vendor-radix-ui-react-focus-scope-C2K7lNPv.js";import"./vendor-radix-ui-react-portal-xlJWBfDg.js";import"./vendor-radix-ui-react-presence-Btn-Dp7L.js";import"./vendor-radix-ui-react-focus-guards-D5MZ0nQs.js";import"./vendor-react-remove-scroll-CfeMe0DL.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-C9YRs2nU.js";import"./vendor-react-style-singleton-B1H4bWSG.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-C-AuTczP.js";import"./vendor-use-callback-ref-CJB0R85I.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-E2vgV9K3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-DSzLbZiS.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-BUlYhQ3o.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BS2SpSAZ.js";import"./vendor-codemirror-lang-json-CqayksDf.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-Ba8JZ6fp.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-DK27qQri.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CvO36Y1p.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-Dp_Z-0GD.js";import"./vendor-codemirror-lang-python-_2bIYTiJ.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-RrgJ8H_6.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tanstack-react-virtual-IrbCBGJ4.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-DJASDzNt.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-sonner-CW8w438f.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";const ct=({mode:t,children:s})=>e.jsx(Ee.Provider,{value:t,children:s}),lt=Ae,dt=Re,ut=({totalTokens:t,percentage:s,colorPercentage:n,contextLimit:l,outputLimit:i,size:m="default",isMobile:a=!1,hideIcon:M=!1,showPercentIcon:T=!1,className:h,valueClassName:p,percentIconClassName:k,onClick:D,pressed:E=!1,cacheRead:x,cacheWrite:I,cacheHitPercent:v})=>{const[N,j]=c.useState(!1),_=typeof n=="number"?n:s,o=lt(s)??0,y=dt(_),g=y==="critical"?"var(--status-error)":y==="warn"?"var(--status-warning)":"var(--status-success)",d=b=>b>=1e6?`${(b/1e6).toFixed(1)}M`:b>=1e3?`${(b/1e3).toFixed(1)}K`:b.toFixed(1).replace(/\.0$/,""),U=b=>b>=90?"text-status-error":b>=75?"text-status-warning":"text-status-success",f=20,$=3,W=(f-$)/2,Z=2*Math.PI*W,ce=Z*(1-o/100),H=typeof i=="number"?Math.max(i,0):0,A=typeof x=="number"&&typeof I=="number",V=A?Math.max(0,x):0,Q=A?Math.max(0,I):0,R=typeof v=="number"&&Number.isFinite(v),O=[`Used tokens: ${d(t)}`,`Context limit: ${d(l)}`,`Output limit: ${d(H)}`,...A?[`Cache read: ${d(V)}`,`Cache write: ${d(Q)}`]:[],...R?[`Cache hit: ${v.toFixed(1)}%`]:[],`${Math.min(s,999).toFixed(1)}% used`],L=!a&&typeof D=="function",B=e.jsxs(e.Fragment,{children:[!a&&!M&&e.jsx(Y,{name:"donut-chart",className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:G("font-medium inline-flex items-center gap-1.5",p),children:T?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${f}`,className:G("h-3.5 w-3.5 -rotate-90",k),role:"progressbar","aria-valuenow":Math.round(o),"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("circle",{cx:f/2,cy:f/2,r:W,fill:"none",stroke:"var(--interactive-border)",strokeWidth:$}),e.jsx("circle",{cx:f/2,cy:f/2,r:W,fill:"none",stroke:g,strokeWidth:$,strokeLinecap:"round",strokeDasharray:Z,strokeDashoffset:ce,className:"transition-[stroke-dashoffset,stroke] duration-300"})]}),e.jsxs("span",{className:"text-foreground",children:[Math.min(s,999).toFixed(1),"%"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:U(_),children:Math.min(s,999).toFixed(1)}),"%"]})})]}),C=G("app-region-no-drag flex items-center gap-1.5 select-none",m==="compact"?"typography-micro":"typography-meta",L?G("rounded-md px-2 py-1.5 text-foreground transition-colors","hover:bg-interactive-hover","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"):"text-muted-foreground/60",h),P=L?e.jsx("button",{type:"button",className:C,"aria-label":"Context usage","aria-pressed":E,onClick:D,children:B}):e.jsx("div",{className:C,"aria-label":"Context usage",onClick:a?()=>j(!0):void 0,children:B});return a?e.jsxs(e.Fragment,{children:[P,e.jsx(_e,{open:N,onClose:()=>j(!1),title:"Context Usage",children:e.jsx("div",{className:"flex flex-col gap-1.5",children:e.jsxs("div",{className:"rounded-xl border border-border/40 bg-sidebar/30 px-3 py-2 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Used tokens"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(t)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Context limit"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(l)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Output limit"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(H)})]}),A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache read"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(V)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache write"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:d(Q)})]})]}):null,R?e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache hit"}),e.jsxs("span",{className:"typography-meta text-foreground font-medium",children:[v.toFixed(1),"%"]})]}):null,e.jsxs("div",{className:"flex justify-between items-center pt-1 border-t border-border/40",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Usage"}),e.jsxs("span",{className:G("typography-meta font-semibold",U(_)),children:[Math.min(s,999).toFixed(1),"%"]})]})]})})})]}):e.jsxs(Te,{children:[e.jsx(Le,{asChild:!0,children:P}),e.jsx(Oe,{children:e.jsx("div",{className:"space-y-0.5",children:O.map(b=>e.jsx("p",{className:"typography-micro leading-tight",children:b},b))})})]})},mt=t=>{const s=typeof t=="string"?t.trim():"";if(!s)return"";const n=typeof window<"u"?window.__PICHAMBER_HOME__:"";if(n&&s===n)return"~";if(n&&s.startsWith(`${n}/`))return`~/${s.slice(n.length+1)}`;const l=s.split("/").filter(Boolean);return l.length<=3?s:`.../${l.slice(-3).join("/")}`},te=t=>{const s=typeof t=="string"?t.trim():"";if(!s)return"";const n=s.replace(/\\/g,"/");return n==="/"?"/":n.replace(/\/+$/,"")},pt=({mode:t})=>{const s=S(r=>r.currentSessionId),n=S(r=>!!r.newSessionDraft?.open),l=S(r=>r.newSessionDraft?.selectedProjectId??null),i=q(r=>r.currentDirectory),m=ie(r=>r.projects),a=ie(r=>r.getActiveProject()),M=w(r=>r.getCurrentModel),T=w(r=>r.providers),h=ae(),p=Fe(s??""),k=ze(),D=Ue(r=>r.ensureStatus),E=S(r=>r.newSessionDraft?.open?te(r.newSessionDraft.directoryOverride??""):""),[x,I]=c.useState(!1),v=typeof window<"u"?window.__PICHAMBER_MACOS_MAJOR__??0:0,N=Number.isFinite(v)&&v>0,{usesFramelessChrome:j,side:_}=$e(),o=N?v>=26?"h-12":v<=15?"h-14":"":"",y=c.useMemo(()=>s?h.find(r=>r.id===s)??null:null,[s,h]);c.useEffect(()=>{ve()&&J("desktop_get_window_pinned").then(r=>{typeof r?.pinned=="boolean"&&I(r.pinned)})},[]);const g=y?.title?.trim()||(n||t==="draft"?"New session":"Session"),d=te(y?.directory??null),U=te(i),f=d||E||U,$=mt(f);c.useEffect(()=>{f&&D(f,k.git).catch(()=>{})},[D,f,k.git]);const W=c.useMemo(()=>{const r=f;return r?m.map(u=>({...u,normalizedPath:te(u.path)})).filter(u=>u.normalizedPath&&(u.normalizedPath===r||r.startsWith(`${u.normalizedPath}/`))).sort((u,K)=>K.path.length-u.path.length)[0]??null:null},[f,m]),Z=c.useMemo(()=>{const r=W??a;if(!r)return $||"PiChamber";const u=r.label?.trim();return u||(r.path.split(/[\\/]/).filter(Boolean).at(-1)??r.path)},[a,$,W]),H=We(f||null),A=H&&H!=="HEAD"?H:null,V=M(),Q=c.useMemo(()=>{for(let r=p.length-1;r>=0;r-=1){const u=p[r];if(u.role!=="assistant"||typeof u.providerID!="string"||typeof u.modelID!="string")continue;const ee=T.find(X=>X.id===u.providerID)?.models.find(X=>X.id===u.modelID);if(ee)return ee}},[p,T]),R=V?.limit?V:Q,O=R&&typeof R.limit=="object"&&R.limit!==null?R.limit:null,L=O&&typeof O.context=="number"?O.context:0,B=O&&typeof O.output=="number"?O.output:0,C=c.useMemo(()=>{if(!s||p.length===0)return null;let r,u;for(let se=p.length-1;se>=0;se-=1){const ne=p[se];if(ne.role!=="assistant")continue;const F=ne.tokens;if(!F)continue;if(F.input+F.output+F.reasoning+(F.cache?.read??0)+(F.cache?.write??0)>0){r=F,u=ne.id;break}}if(!r)return null;const K=r.input+r.output+r.reasoning+(r.cache?.read??0)+(r.cache?.write??0),ee=L>0?L:2e5,X=L>0?Math.round(K/L*100):0,ye=B>0?Math.round(r.output/B*100):void 0;return{totalTokens:K,percentage:X,contextLimit:L||0,outputLimit:B||void 0,normalizedOutput:ye,thresholdLimit:ee,lastMessageId:u}},[L,s,p,B]),[P,b]=c.useState(null),pe={WebkitAppRegion:"drag"},re={WebkitAppRegion:"no-drag"};c.useEffect(()=>{if(!s){b(r=>r===null?r:null);return}if(C&&C.totalTokens>0){b(r=>r&&r.totalTokens===C.totalTokens&&r.percentage===C.percentage&&r.contextLimit===C.contextLimit&&(r.outputLimit??0)===(C.outputLimit??0)&&(r.normalizedOutput??0)===(C.normalizedOutput??0)&&r.thresholdLimit===C.thresholdLimit&&r.lastMessageId===C.lastMessageId?r:C);return}b(r=>r===null?r:null)},[C,s]);const fe=P&&P.contextLimit>0?Math.min(999,P.totalTokens/P.contextLimit*100):0,he=c.useCallback(()=>{const r=!x;I(r),J("desktop_set_window_pinned",{pinned:r}).catch(()=>{I(!r)})},[x]),xe=c.useCallback(()=>{const r=s?{sessionId:s,directory:y?.directory??i??""}:{mode:"draft",directory:f||i||"",projectId:l};J("desktop_focus_main_window",r).then(u=>u?.focused===!0?J("desktop_close_current_window"):null)},[i,s,l,f,y]);return e.jsxs("header",{className:G("flex items-center gap-3 bg-background pr-3",N?"pl-[5.5rem]":"pl-3",j?"h-12":o||"min-h-14"),style:pe,children:[j&&_==="left"?e.jsx(de,{visible:!0,position:"left"}):null,e.jsx(He,{children:e.jsxs("button",{type:"button","aria-label":"Open session switcher",style:re,className:"flex min-w-0 max-w-full flex-col items-start rounded-md px-1 py-0.5 text-left transition-colors hover:bg-interactive-hover/60 focus-visible:outline-none focus-visible:bg-interactive-hover/60",children:[e.jsx("span",{className:"truncate typography-ui-label text-[14px] font-normal leading-tight text-foreground max-w-full",children:g}),e.jsxs("span",{className:"flex min-w-0 max-w-full items-center gap-1.5 truncate typography-micro text-[10.5px] font-normal leading-tight text-muted-foreground/75",children:[e.jsx("span",{className:"truncate",children:Z}),A?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(Y,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:A})]}):null]})]})}),e.jsx("div",{className:"min-w-0 flex-1"}),P&&P.totalTokens>0?e.jsx(ut,{totalTokens:P.totalTokens,percentage:fe,colorPercentage:P.percentage,contextLimit:P.contextLimit,outputLimit:P.outputLimit??0,className:"h-9 shrink-0 pl-1 pr-1 typography-ui-label",valueClassName:"font-semibold leading-none",hideIcon:!0,showPercentIcon:!0,percentIconClassName:"h-4.5 w-4.5"}):null,e.jsx(ue,{type:"button",variant:"ghost",size:"icon",onClick:he,"aria-label":x?"Unpin Mini Chat window":"Pin Mini Chat window",title:x?"Unpin window":"Pin above other windows",style:re,children:x?e.jsx(Y,{name:"pushpin-2-fill",className:"h-4 w-4"}):e.jsx(Y,{name:"pushpin-2",className:"h-4 w-4"})}),e.jsx(ue,{type:"button",variant:"ghost",size:"icon",onClick:xe,"aria-label":"Open session in main window",title:"Open in main window",style:re,children:e.jsx(Y,{name:"external-link",className:"h-4 w-4"})}),e.jsx(de,{visible:j&&_==="right",position:"right"})]})},ft=({mode:t,autoOpenDraft:s=!1,unavailable:n=!1})=>{const l=S(i=>i.currentSessionId);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:[e.jsx(pt,{mode:t}),e.jsx("main",{className:"min-h-0 flex-1",children:n?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center typography-ui-label text-muted-foreground",children:e.jsxs("div",{className:"max-w-sm rounded-lg border border-[var(--interactive-border)] bg-[var(--surface-elevated)] px-4 py-3",children:[e.jsx("div",{className:"font-medium text-foreground",children:"Session unavailable"}),e.jsx("div",{className:"mt-1 typography-small text-muted-foreground",children:"This session could not be loaded. It may have been deleted, archived, or opened from a different project context."})]})}):e.jsx(ct,{mode:"mini-chat",children:e.jsx(Be,{autoOpenDraft:s},l??"no-session")})})]})},ht=()=>{const t=oe(i=>i.shortcutOverrides),s=q(i=>i.currentDirectory),n=ie(i=>i.getActiveProject()),l=S(i=>i.openNewSessionDraft);c.useEffect(()=>{const i=a=>Ve(a,t),m=a=>{if(z(a,i("focus_input"))){a.preventDefault(),me();return}if(je()&&z(a,i("new_mini_chat"))){a.preventDefault(),J("desktop_open_draft_mini_chat_window",{directory:s||n?.path||"",projectId:n?.id??null})?.catch(h=>{console.warn("[mini-chat-shortcuts] failed to open draft mini chat window",h)});return}if(z(a,i("new_chat"))){a.preventDefault(),l({selectedProjectId:n?.id??null,directoryOverride:s||n?.path||null,preserveDirectoryOverride:!!(s||n?.path)}),me();return}if(z(a,i("open_model_selector"))){a.preventDefault();const{isModelSelectorOpen:h,setModelSelectorOpen:p}=oe.getState();p(!h);return}if(z(a,i("cycle_thinking_variant"))){if(w.getState().getCurrentModelVariants().length===0)return;a.preventDefault(),Ke(1).then(k=>{const D=S.getState().currentSessionId,E=w.getState().currentAgentName,x=w.getState().currentProviderId,I=w.getState().currentModelId;D&&E&&x&&I&&Ge.getState().saveAgentModelVariantForSession(D,E,x,I,k)}).catch(()=>{qe.error("Couldn't update thinking")});return}const M=z(a,i("cycle_favorite_model_forward")),T=z(a,i("cycle_favorite_model_backward"));if(M||T){const{favoriteModels:h,addRecentModel:p}=oe.getState();if(h.length===0)return;a.preventDefault();const{currentProviderId:k,currentModelId:D,setProvider:E,setModel:x}=w.getState(),I=h.findIndex(j=>j.providerID===k&&j.modelID===D),N=h[(I+(M?1:-1)+h.length)%h.length];E(N.providerID),x(N.modelID),p(N.providerID,N.modelID)}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n?.id,n?.path,s,l,t])},xt="pichamber:mini-chat-presence",yt=()=>{const t=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,s=t.get("mode")==="session"?"session":"draft",n=t.get("sessionId")?.trim()||null,l=t.get("directory")?.trim()||null,i=t.get("projectId")?.trim()||null;return{mode:s,sessionId:n,directory:l,projectId:i}},gt=({config:t})=>{const s=ae(),n=q(o=>o.currentDirectory),l=q(o=>o.setDirectory),i=S(o=>o.currentSessionId),m=S(o=>!!o.newSessionDraft?.open),a=S(o=>o.newSessionDraft?.open?o.newSessionDraft.bootstrapPendingDirectory??o.newSessionDraft.directoryOverride??"":""),M=S(o=>o.setCurrentSession),T=S(o=>o.openNewSessionDraft),h=w(o=>o.initializeApp),p=w(o=>o.isInitialized),k=w(o=>o.isConnected),D=w(o=>o.loadProviders),E=w(o=>o.loadAgents),x=w(o=>o.providers.length),I=w(o=>o.agents.length),v=nt();c.useEffect(()=>{h()},[h]),c.useEffect(()=>{if(p)return;let o=!0,y=0;const g=window.setInterval(()=>{if(o){if(y+=1,y>10){window.clearInterval(g);return}w.getState().isInitialized||w.getState().initializeApp()}},1e3);return()=>{o=!1,window.clearInterval(g)}},[p]);const N=c.useRef(!1);c.useEffect(()=>{if(!N.current&&t.mode==="session"&&t.directory){if(n===t.directory){N.current=!0;return}l(t.directory,{showOverlay:!1}),N.current=!0}},[t.directory,t.mode,n,l]),c.useEffect(()=>{t.mode!=="draft"||!m||i||!a||n===a||l(a,{showOverlay:!1})},[t.mode,n,i,a,m,l]),c.useEffect(()=>{k&&(x===0&&D({source:"electronMiniChat:recovery"}),I===0&&E({source:"electronMiniChat:recovery"}))},[I,k,E,D,x]);const j=c.useRef(!1);c.useEffect(()=>{if(j.current||t.mode!=="session"||!t.sessionId)return;if(i===t.sessionId){j.current=!0;return}if(i){j.current=!0;return}const o=s.find(g=>g.id===t.sessionId);if(!o){v.ensureSessionRenderable(t.sessionId);return}const y=o.directory??t.directory;M(t.sessionId,y),j.current=!0},[t,i,s,M,v]),c.useEffect(()=>{const o=y=>{const g=y.detail,d=typeof g?.sessionId=="string"?g.sessionId.trim():"";if(!d||S.getState().currentSessionId===d)return;const U=typeof g?.directory=="string"&&g.directory.trim().length>0?g.directory.trim():s.find(f=>f.id===d)?.directory??null;v.ensureSessionRenderable(d),M(d,U),j.current=!0};return window.addEventListener("pichamber:open-session",o),()=>window.removeEventListener("pichamber:open-session",o)},[s,M,v]),c.useEffect(()=>{t.mode!=="draft"||m||i||T({selectedProjectId:t.projectId,directoryOverride:t.directory,preserveDirectoryOverride:!!t.directory})},[t,i,m,T]);const _=c.useRef(!1);return c.useEffect(()=>{if(_.current||!p)return;const o=()=>{if(_.current)return;_.current=!0;const d=typeof document<"u"?document.getElementById("initial-loading"):null;d&&(d.classList.add("fade-out"),window.setTimeout(()=>d.remove(),300))},y=t.mode==="session"?i===t.sessionId:m,g=window.setTimeout(o,y?100:1500);return()=>window.clearTimeout(g)},[p,t.mode,t.sessionId,i,m]),null},wt=()=>{const t=S(n=>n.currentSessionId),s=q(n=>n.currentDirectory);return c.useEffect(()=>{if(!t||!s||typeof BroadcastChannel>"u")return;const n=new BroadcastChannel(xt),l=a=>{n.postMessage({type:"mini-chat-session-presence",sessionId:t,directory:s,viewed:a})};l(!0);const i=window.setInterval(()=>l(!0),5e3),m=()=>l(!1);return window.addEventListener("beforeunload",m),()=>{window.clearInterval(i),window.removeEventListener("beforeunload",m),l(!1),n.close()}},[s,t]),null},vt=t=>{const s=ae(),n=S(m=>m.currentSessionId),[l,i]=c.useState(!1);return c.useEffect(()=>{if(t.mode!=="session"||!t.sessionId||n===t.sessionId){i(!1);return}if(s.some(a=>a.id===t.sessionId)){i(!1);return}const m=window.setTimeout(()=>i(!0),5e3);return()=>window.clearTimeout(m)},[t.mode,t.sessionId,n,s]),l};function jt({apis:t}){const s=c.useMemo(()=>yt(),[]),n=q(l=>l.currentDirectory);return c.useEffect(()=>{Xe.setDirectory(n||s.directory||void 0)},[s.directory,n]),c.useEffect(()=>(le(t),()=>le(null)),[t]),Je(),ht(),Ce({enabled:!0}),De(),e.jsx(Ye,{children:e.jsx(Ze,{directory:n||s.directory,children:e.jsx(Qe,{apis:t,children:e.jsx(et,{delayDuration:300,skipDelayDuration:150,children:e.jsxs("div",{className:"h-full text-foreground bg-background",children:[e.jsx(bt,{config:s}),e.jsx(tt,{}),e.jsx(rt,{})]})})})})})}const bt=({config:t})=>{const s=vt(t);return e.jsxs(e.Fragment,{children:[e.jsx(gt,{config:t}),e.jsx(wt,{}),e.jsx(st,{embeddedBackgroundWorkEnabled:!0}),e.jsx(ft,{mode:t.mode,autoOpenDraft:t.mode==="draft",unavailable:s})]})},St=()=>{Se().then(()=>{Promise.all([Ie(),Ne()]).catch(t=>{console.error("[mini-chat-main] settings init failed:",t)}),Pe(),Me(),ke()}).catch(t=>{console.error("[mini-chat-main] appearance init failed:",t)})};function Yr(t){const s=t??be();if(!s)throw new Error("Runtime APIs not registered");St();const n=document.getElementById("root");if(!n)throw new Error("Root element not found");ge.createRoot(n).render(e.jsx(we.StrictMode,{children:e.jsx(ot,{children:e.jsx(it,{children:e.jsx(at,{children:e.jsx(jt,{apis:s})})})})}))}export{Yr as renderElectronMiniChatApp};