@pi-chamber/web 0.9.1 → 0.9.4

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 (57) hide show
  1. package/README.md +2 -2
  2. package/bin/lib/cli-paths.js +22 -6
  3. package/dist/assets/{DiagramEditor-DoEOH0hY.js → DiagramEditor-DuGmiPZ5.js} +1 -1
  4. package/dist/assets/{DiagramView-y9Ystuhv.js → DiagramView-CHy1Glsl.js} +1 -1
  5. package/dist/assets/{DiffView-ScM4XoqZ.js → DiffView-CBOrV4hS.js} +1 -1
  6. package/dist/assets/{FilesView-CjkhMFqJ.js → FilesView-CK2YVs_W.js} +1 -1
  7. package/dist/assets/{GitView-Bqi6H8I-.js → GitView-BEFLOv_7.js} +3 -3
  8. package/dist/assets/{JsonTreeView-DWhlH6NK.js → JsonTreeView-CKWGm5MS.js} +1 -1
  9. package/dist/assets/{MarkdownRendererImpl-CEOKZ1qH.js → MarkdownRendererImpl-hE_nmSqe.js} +1 -1
  10. package/dist/assets/{PatchDiff-ClnfJJ2J.js → PatchDiff-BagRxMON.js} +1 -1
  11. package/dist/assets/{SessionSwitcherContent-e6JzUXD_.js → SessionSwitcherContent-z9VYCXrT.js} +1 -1
  12. package/dist/assets/{SessionSwitcherDropdown-C4etG8dv.js → SessionSwitcherDropdown-icxJk_lT.js} +2 -2
  13. package/dist/assets/{SessionUnreadDot-BVTSwRiG.js → SessionUnreadDot-Bv-5KguB.js} +1 -1
  14. package/dist/assets/SettingsView-Ck0qxtKP.js +2 -0
  15. package/dist/assets/{SettingsWindow-Cy9tmnMg.js → SettingsWindow-GQRL2CdD.js} +1 -1
  16. package/dist/assets/{ToolOutputDialog-Csrc0Uk2.js → ToolOutputDialog-CxJUXVZW.js} +1 -1
  17. package/dist/assets/{ToolPartDiffPreview-6oH6KD44.js → ToolPartDiffPreview-BXuLRWHT.js} +1 -1
  18. package/dist/assets/{VirtualizedFileDiff-DJNcTQNp.js → VirtualizedFileDiff-DfaXovGB.js} +1 -1
  19. package/dist/assets/{collapsible-DxgVLhi9.js → collapsible-szfZ0Syc.js} +1 -1
  20. package/dist/assets/{computeVirtualFileMetrics-B-WoeBMW.js → computeVirtualFileMetrics-DG_E6iaN.js} +1 -1
  21. package/dist/assets/{contextFileOpenGuard-DQ4U9xRH.js → contextFileOpenGuard-DPBE3ELv.js} +1 -1
  22. package/dist/assets/{gitStatusPredicates-CIFSGjJs.js → gitStatusPredicates-OljV4Bb2.js} +1 -1
  23. package/dist/assets/{index-DmNPBaSo.js → index-DmexVlTQ.js} +1 -1
  24. package/dist/assets/{index-D2C3q2xD.js → index-KIdiBFJs.js} +1 -1
  25. package/dist/assets/{isDiffPlainText-CrvpUauF.js → isDiffPlainText-aikgiqLb.js} +1 -1
  26. package/dist/assets/{isFilePlainText-CKvhS32g.js → isFilePlainText-D-Dl6LqX.js} +1 -1
  27. package/dist/assets/{main-CjM7g4Gq.js → main-BXdraZTZ.js} +3 -3
  28. package/dist/assets/{main-BFv8slLp.js → main-DG1oZ0Wj.js} +2 -2
  29. package/dist/assets/{markdownCore-DKrraAqT.js → markdownCore-DUjQU2i0.js} +1 -1
  30. package/dist/assets/{miniChat-hQnLS5mt.js → miniChat-BEAtOkr9.js} +2 -2
  31. package/dist/assets/{mobile-DuXOBGs_.js → mobile-DOFBBQg2.js} +2 -2
  32. package/dist/assets/{renderElectronMiniChatApp-ClJBZVGy.js → renderElectronMiniChatApp-B0K72YnS.js} +2 -2
  33. package/dist/assets/{renderMobileApp-DofX2wjB.js → renderMobileApp-Ca_BO_s4.js} +3 -3
  34. package/dist/assets/{runtimeEndpointReset-BZeYg6eN.js → runtimeEndpointReset-Cx2tsgTo.js} +15 -15
  35. package/dist/assets/{runtimeSurface-C7CBxDbh.js → runtimeSurface-CySRuLbN.js} +1 -1
  36. package/dist/assets/{useAppFontEffects-Cs0f1dKn.js → useAppFontEffects-C4JL1x7k.js} +85 -85
  37. package/dist/assets/{useFilesViewSearch-D1hcbBEc.js → useFilesViewSearch-Du0DnmKs.js} +1 -1
  38. package/dist/assets/{usePushVisibilityBeacon-DqHkuVS5.js → usePushVisibilityBeacon-BnHxIv4r.js} +1 -1
  39. package/dist/assets/{useSwitcherItems-BEoW7LlC.js → useSwitcherItems-C91mwPJD.js} +1 -1
  40. package/dist/assets/{vendor-codemirror-language-data-B8Ac62S_.js → vendor-codemirror-language-data-C493X_9w.js} +2 -2
  41. package/dist/assets/{web-components-Dy-Tz_LJ.js → web-components-B2Rw__yK.js} +1 -1
  42. package/dist/index.html +3 -3
  43. package/dist/mini-chat.html +2 -2
  44. package/dist/mobile.html +2 -2
  45. package/package.json +1 -1
  46. package/server/lib/pi/routes.js +48 -4
  47. package/server/lib/pi/routes.test.js +108 -1
  48. package/server/lib/pi/session-daemon/DOCUMENTATION.md +4 -5
  49. package/server/lib/pi/session-daemon/ipc-client.js +20 -9
  50. package/server/lib/pi/session-daemon/ipc-client.test.js +88 -0
  51. package/server/lib/pi/session-daemon/ipc-protocol.js +9 -0
  52. package/server/lib/pi/session-daemon/prompt-operations.test.js +51 -0
  53. package/server/lib/pi/session-daemon/session-daemon.js +316 -80
  54. package/server/lib/pi/session-daemon/session-daemon.test.js +327 -0
  55. package/server/lib/pi/ui-settings-store.js +130 -25
  56. package/server/lib/pi/ui-settings-store.test.js +58 -7
  57. package/dist/assets/SettingsView-C0S0Sx-S.js +0 -2
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-DofX2wjB.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css","assets/index-D2C3q2xD.js","assets/vendor-zustand-GVb4H8HE.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/usePushVisibilityBeacon-DqHkuVS5.js","assets/useAppFontEffects-Cs0f1dKn.js","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-C7CBxDbh.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-B8Ac62S_.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js","assets/runtimeEndpointReset-BZeYg6eN.js","assets/SessionUnreadDot-BVTSwRiG.js","assets/vendor-xterm-xterm-CrXqRur4.js","assets/vendor-xterm-xterm-DDGTF8rc.css","assets/permissionStore-iKN1K2_x.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-capacitor-core-B4EWRrHz.js","assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js","assets/SettingsView-C0S0Sx-S.js","assets/vendor-qrcode-B0KNSajT.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/collapsible-DxgVLhi9.js","assets/useSwitcherItems-BEoW7LlC.js","assets/main-CjM7g4Gq.js","assets/contextFileOpenGuard-DQ4U9xRH.js","assets/useFilesViewSearch-D1hcbBEc.js"])))=>i.map(i=>d[i]);
2
- import{_ as a}from"./vendor-vite-runtime-DD1OZmLC.js";import{a as m,e as f}from"./index-D2C3q2xD.js";import{r as w}from"./runtimeSurface-C7CBxDbh.js";import"./vendor-katex-CNckGUMB.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";function _(t={}){const{immediate:r=!1,onNeedRefresh:i,onOfflineReady:n,onRegistered:s,onRegisteredSW:c,onRegisterError:d}=t;let o,u;const l=async(e=!0)=>{await u};async function p(){if("serviceWorker"in navigator){if(o=await a(async()=>{const{Workbox:e}=await import("./vendor-workbox-window-BIl4cyR9.js");return{Workbox:e}},[]).then(({Workbox:e})=>new e("/sw.js",{scope:"/",type:"classic"})).catch(e=>{d?.(e)}),!o)return;o.addEventListener("activated",e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),o.addEventListener("installed",e=>{e.isUpdate||n?.()}),o.register({immediate:r}).then(e=>{c?c("/sw.js",e):s?.(e)}).catch(e=>{d?.(e)})}}return u=p(),l}const v=w(),g=()=>!(!("serviceWorker"in navigator)||!window.isSecureContext||window.location.protocol!=="http:"&&window.location.protocol!=="https:"||document.prerendering||String(document.visibilityState)==="prerender"),S=t=>{let r=!1;const i=()=>{r||g()&&(r=!0,t())},n=()=>{setTimeout(i,0)};document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0}),(document.prerendering||String(document.visibilityState)==="prerender")&&document.addEventListener("visibilitychange",i,{once:!0})},E=()=>{S(()=>{try{_({onRegisterError(t){console.warn("[PWA] service worker registration skipped:",t)}})}catch(t){console.warn("[PWA] service worker registration skipped:",t)}})},R=async()=>{if(window.__PICHAMBER_RUNTIME_APIS__=m(),v==="mobile"){const{renderMobileApp:t}=await a(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-DofX2wjB.js").then(i=>i.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]));t();return}await f(),await a(()=>import("./main-CjM7g4Gq.js"),__vite__mapDeps([96,1,2,3,4,5,6,7,8,9,10,27,83,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,84,85,86,87,88,97,98]))};R();E();
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-Ca_BO_s4.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css","assets/index-KIdiBFJs.js","assets/vendor-zustand-GVb4H8HE.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/usePushVisibilityBeacon-BnHxIv4r.js","assets/useAppFontEffects-C4JL1x7k.js","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-CySRuLbN.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-C493X_9w.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js","assets/runtimeEndpointReset-Cx2tsgTo.js","assets/SessionUnreadDot-Bv-5KguB.js","assets/vendor-xterm-xterm-CrXqRur4.js","assets/vendor-xterm-xterm-DDGTF8rc.css","assets/permissionStore-iKN1K2_x.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-capacitor-core-B4EWRrHz.js","assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js","assets/SettingsView-Ck0qxtKP.js","assets/vendor-qrcode-B0KNSajT.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/collapsible-szfZ0Syc.js","assets/useSwitcherItems-C91mwPJD.js","assets/main-BXdraZTZ.js","assets/contextFileOpenGuard-DPBE3ELv.js","assets/useFilesViewSearch-Du0DnmKs.js"])))=>i.map(i=>d[i]);
2
+ import{_ as a}from"./vendor-vite-runtime-DD1OZmLC.js";import{a as m,e as f}from"./index-KIdiBFJs.js";import{r as w}from"./runtimeSurface-CySRuLbN.js";import"./vendor-katex-CNckGUMB.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";function _(t={}){const{immediate:r=!1,onNeedRefresh:i,onOfflineReady:n,onRegistered:s,onRegisteredSW:c,onRegisterError:d}=t;let o,u;const l=async(e=!0)=>{await u};async function p(){if("serviceWorker"in navigator){if(o=await a(async()=>{const{Workbox:e}=await import("./vendor-workbox-window-BIl4cyR9.js");return{Workbox:e}},[]).then(({Workbox:e})=>new e("/sw.js",{scope:"/",type:"classic"})).catch(e=>{d?.(e)}),!o)return;o.addEventListener("activated",e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),o.addEventListener("installed",e=>{e.isUpdate||n?.()}),o.register({immediate:r}).then(e=>{c?c("/sw.js",e):s?.(e)}).catch(e=>{d?.(e)})}}return u=p(),l}const v=w(),g=()=>!(!("serviceWorker"in navigator)||!window.isSecureContext||window.location.protocol!=="http:"&&window.location.protocol!=="https:"||document.prerendering||String(document.visibilityState)==="prerender"),S=t=>{let r=!1;const i=()=>{r||g()&&(r=!0,t())},n=()=>{setTimeout(i,0)};document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0}),(document.prerendering||String(document.visibilityState)==="prerender")&&document.addEventListener("visibilitychange",i,{once:!0})},E=()=>{S(()=>{try{_({onRegisterError(t){console.warn("[PWA] service worker registration skipped:",t)}})}catch(t){console.warn("[PWA] service worker registration skipped:",t)}})},R=async()=>{if(window.__PICHAMBER_RUNTIME_APIS__=m(),v==="mobile"){const{renderMobileApp:t}=await a(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-Ca_BO_s4.js").then(i=>i.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]));t();return}await f(),await a(()=>import("./main-BXdraZTZ.js"),__vite__mapDeps([96,1,2,3,4,5,6,7,8,9,10,27,83,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,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,84,85,86,87,88,97,98]))};R();E();
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css"])))=>i.map(i=>d[i]);
2
- import{_ as E}from"./vendor-vite-runtime-DD1OZmLC.js";import{g as M,B as $}from"./vendor-marked-CX41MkDF.js";import{p}from"./vendor-dompurify-r8glNMJW.js";import{v as C,w as O,x as I}from"./useAppFontEffects-Cs0f1dKn.js";import{p as P}from"./vendor-remend-BWYYytN3.js";const R=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),x=["script","style"],A=e=>M.lexer(e),H=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),D=e=>{const t=e.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!t)return!1;const n=t[1];if(!n)return!1;const r=n[0],s=n.length,a=e.trimEnd().split(`
2
+ import{_ as E}from"./vendor-vite-runtime-DD1OZmLC.js";import{g as M,B as $}from"./vendor-marked-CX41MkDF.js";import{p}from"./vendor-dompurify-r8glNMJW.js";import{v as C,w as O,x as I}from"./useAppFontEffects-C4JL1x7k.js";import{p as P}from"./vendor-remend-BWYYytN3.js";const R=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),x=["script","style"],A=e=>M.lexer(e),H=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),D=e=>{const t=e.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!t)return!1;const n=t[1];if(!n)return!1;const r=n[0],s=n.length,a=e.trimEnd().split(`
3
3
  `).at(-1)?.trim()??"";return!new RegExp(`^[\\t ]{0,3}${r}{${s},}[\\t ]*$`).test(a)},pe=e=>{const t=e.replace(/^\n+/,"");return!!(/^[ \t]{0,3}(`{3,}|~{3,})/.test(t)||/^[ \t]{0,3}(?:> |[-*+] |\d+[.)] )/.test(t))},N=e=>{try{return P(e,{linkMode:"text-only"})}catch{return e}},g=(e,t)=>[{raw:e,src:e,mode:t?"live":"full",highlight:!t}],y=(e,t)=>{let n=-1;for(let s=e.length-1;s>=0;s-=1)if(e[s]?.type!=="space"){n=s;break}if(n<0)return[];const r=[];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===n,o=a.type==="code"&&D(i);r.push({raw:i,src:o||c?i:N(i),mode:c?"live":"full",highlight:!t.cheap&&!o})}return r},b=(e,t,n=A)=>[{raw:e,src:e,mode:"full",highlight:!0}],F=2;class G{constructor(t=A){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 n=t.slice(this.frozenSrc.length);let r;try{r=this.lex(n)}catch{return this.cached=g(t,!0),this.cached}const s=[];for(let o=0;o<r.length;o+=1)r[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=r.slice(0,o),d=y(l,{markLastLive:!1,cheap:!0});this.frozenBlocks=[...this.frozenBlocks,...d],this.frozenSrc+=l.map(m=>m.raw??"").join(""),r=r.slice(o)}const i=y(r,{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 j=32,h=new Map,q=e=>{const t=h.get(e);if(t)return h.delete(e),h.set(e,t),t;const n=new G;for(h.set(e,n);h.size>j;){const r=h.keys().next().value;if(typeof r!="string")break;h.delete(r)}return n},_=e=>{h.delete(e)},me=(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 r=0;r<t.length-1;r+=1){const s=e[r],a=t[r];if(!s||!a||s.mode!=="full"||a.mode!=="full"||s.raw!==a.raw)return!1}return!0},u=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");let k=null;const W=()=>(k||(k=E(()=>import("./vendor-katex-CNckGUMB.js"),__vite__mapDeps([0,1])).then(e=>e.default??e)),k),w=async(e,t,n)=>{try{return(await W()).renderToString(e,{displayMode:n,throwOnError:!1})}catch{return t}},B={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]??""}},async renderer(e){const t=e;return w(t.text,t.raw,!1)}},T={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]??""}},async renderer(e){const t=e;return w(t.text,t.raw,!0)}},U={html({text:e}){return R(e)},link({href:e,title:t,text:n}){const r=e??"";if(C(r))return`<span data-pichamber-agent-mention="true" class="text-primary">${n}</span>`;const a=O(r);if(a)return`<a href="${u(r)}" data-skill-name="${u(a)}" class="text-primary hover:underline">${n}</a>`;const i=t?` title="${u(t)}"`:"";return`<a href="${u(r)}"${i} class="external-link" target="_blank" rel="noopener noreferrer">${n}</a>`}},S={gfm:!0,breaks:!1,renderer:U},X=new $(S),V=new $({...S,async:!0,extensions:[B,T]});M.use({...S,extensions:[B,T]});const Z=async e=>{const t=e.split(/(\$\$[\s\S]*?\$\$)/g);return(await Promise.all(t.map(async r=>{const s=/^\$\$([\s\S]*?)\$\$$/.exec(r)?.[1];return s===void 0?r:w(s,r,!0)}))).join("")},J=async e=>{if(e.indexOf("$")===-1)return e;const t=/(<(?:pre|code|kbd)[^>]*>[\s\S]*?<\/(?:pre|code|kbd)>)/gi,n=e.split(t);return(await Promise.all(n.map(async(s,a)=>a%2===1?s:Z(s)))).join("")},Q=/<pre><code(?:\s+class="language-([^"]*)")?>([\s\S]*?)<\/code><\/pre>/g,Y=1200,K=(e,t)=>{let n=1;for(let r=0;r<e.length;r+=1)if(e.charCodeAt(r)===10&&++n>t)return!0;return!1},ee=e=>e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&"),te=async e=>{const t=[...e.matchAll(Q)];if(t.length===0)return e;const n=Y;let r=e;for(const s of t){const[a,i,c]=s,o=(i||"text").toLowerCase();if(o==="mermaid")continue;const l=ee(c??"");if(K(l,n)){r=r.replace(a,()=>a.replace("<pre",`<pre data-md-lang="${o}"`));continue}const d=await I(l,o);if(d){const m=d.replace(/^<pre/,`<pre data-md-lang="${o}"`);r=r.replace(a,()=>m)}}return r},re={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:[...x],FORBID_CONTENTS:[...x]};let v=!1;const ne=()=>{v||typeof window>"u"||!p.isSupported||(v=!0,p.addHook("afterSanitizeAttributes",e=>{e instanceof HTMLAnchorElement&&e.target==="_blank"&&e.setAttribute("rel","noopener noreferrer")}))},L=e=>p.isSupported?(ne(),p.sanitize(e,re)):"",se=240,f=new Map,ae=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},z=(e,t)=>{if(f.delete(e),f.set(e,t),f.size<=se)return;const n=f.keys().next().value;n&&f.delete(n)},oe=async e=>{const t=await V.parse(e.src),n=e.highlight?await J(t):t,r=e.highlight?await te(n):n;return L(r)},ie=e=>{if(!e)return"";const t=X.parse(e);return L(t)},ce=async(e,t,n)=>{if(!e)return n&&_(n),[];let r;return t?r=q(n).update(e):(_(n),r=b(e)),Promise.all(r.map(async(s,a)=>{if(s.mode==="live")return{id:`live:${a}`,html:"",mode:"live",raw:s.raw};const i=ae(s.raw),c=`${i}:${s.mode}:${s.highlight?1:0}`,o=`${n}:${a}:${s.mode}`,l=f.get(o);if(l&&l.hash===i)return z(o,l),{id:c,html:l.html,mode:s.mode,raw:s.raw};const d=await oe(s);return z(o,{hash:i,html:d}),{id:c,html:d,mode:s.mode,raw:s.raw}}))},ge=Object.freeze(Object.defineProperty({__proto__:null,renderMarkdownBlocks:ce,renderMarkdownSync:ie},Symbol.toStringTag,{value:"Module"}));export{ce as a,pe as b,me as i,ge as m,ie as r,q as s};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-ClJBZVGy.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css","assets/index-D2C3q2xD.js","assets/vendor-zustand-GVb4H8HE.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/usePushVisibilityBeacon-DqHkuVS5.js","assets/useAppFontEffects-Cs0f1dKn.js","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-C7CBxDbh.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-B8Ac62S_.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js"])))=>i.map(i=>d[i]);
2
- import{_ as o}from"./vendor-vite-runtime-DD1OZmLC.js";import{a as t}from"./index-D2C3q2xD.js";import"./vendor-katex-CNckGUMB.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";window.__PICHAMBER_RUNTIME_APIS__=t();o(async()=>{const{renderElectronMiniChatApp:r}=await import("./renderElectronMiniChatApp-ClJBZVGy.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-B0K72YnS.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css","assets/index-KIdiBFJs.js","assets/vendor-zustand-GVb4H8HE.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/usePushVisibilityBeacon-BnHxIv4r.js","assets/useAppFontEffects-C4JL1x7k.js","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-CySRuLbN.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-C493X_9w.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js"])))=>i.map(i=>d[i]);
2
+ import{_ as o}from"./vendor-vite-runtime-DD1OZmLC.js";import{a as t}from"./index-KIdiBFJs.js";import"./vendor-katex-CNckGUMB.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";window.__PICHAMBER_RUNTIME_APIS__=t();o(async()=>{const{renderElectronMiniChatApp:r}=await import("./renderElectronMiniChatApp-B0K72YnS.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-DofX2wjB.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css","assets/index-D2C3q2xD.js","assets/vendor-zustand-GVb4H8HE.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/usePushVisibilityBeacon-DqHkuVS5.js","assets/useAppFontEffects-Cs0f1dKn.js","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-C7CBxDbh.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-B8Ac62S_.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js","assets/runtimeEndpointReset-BZeYg6eN.js","assets/SessionUnreadDot-BVTSwRiG.js","assets/vendor-xterm-xterm-CrXqRur4.js","assets/vendor-xterm-xterm-DDGTF8rc.css","assets/permissionStore-iKN1K2_x.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-capacitor-core-B4EWRrHz.js","assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js","assets/SettingsView-C0S0Sx-S.js","assets/vendor-qrcode-B0KNSajT.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/collapsible-DxgVLhi9.js","assets/useSwitcherItems-BEoW7LlC.js"])))=>i.map(i=>d[i]);
2
- import{_ as t}from"./vendor-vite-runtime-DD1OZmLC.js";import{a as i}from"./index-D2C3q2xD.js";import"./vendor-katex-CNckGUMB.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";window.__PICHAMBER_RUNTIME_APIS__=i();t(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-DofX2wjB.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])).then(({renderMobileApp:r})=>{r()});
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-Ca_BO_s4.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/vendor-katex-CNckGUMB.js","assets/vendor-katex-Cp579UoJ.css","assets/index-KIdiBFJs.js","assets/vendor-zustand-GVb4H8HE.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/usePushVisibilityBeacon-BnHxIv4r.js","assets/useAppFontEffects-C4JL1x7k.js","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-CySRuLbN.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-C493X_9w.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js","assets/runtimeEndpointReset-Cx2tsgTo.js","assets/SessionUnreadDot-Bv-5KguB.js","assets/vendor-xterm-xterm-CrXqRur4.js","assets/vendor-xterm-xterm-DDGTF8rc.css","assets/permissionStore-iKN1K2_x.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-capacitor-core-B4EWRrHz.js","assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js","assets/SettingsView-Ck0qxtKP.js","assets/vendor-qrcode-B0KNSajT.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/collapsible-szfZ0Syc.js","assets/useSwitcherItems-C91mwPJD.js"])))=>i.map(i=>d[i]);
2
+ import{_ as t}from"./vendor-vite-runtime-DD1OZmLC.js";import{a as i}from"./index-KIdiBFJs.js";import"./vendor-katex-CNckGUMB.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-react-B5Z1Mdn3.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";window.__PICHAMBER_RUNTIME_APIS__=i();t(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-Ca_BO_s4.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])).then(({renderMobileApp:r})=>{r()});
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherDropdown-C4etG8dv.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-Cs0f1dKn.js","assets/vendor-zustand-GVb4H8HE.js","assets/index-D2C3q2xD.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-C7CBxDbh.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-B8Ac62S_.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js"])))=>i.map(i=>d[i]);
2
- import{j as e,R as a,r as pe,e as we}from"./vendor-react-B5Z1Mdn3.js";import"./vendor-katex-CNckGUMB.js";import{c as V,f as q,o as ve,q as Y,u as oe,t as F,v as je,w as be,x as le,j as Se,y as Ie,z as Ce}from"./index-D2C3q2xD.js";import{u as Ne,a as Pe,s as De}from"./usePushVisibilityBeacon-DqHkuVS5.js";import{Q as Me,I as K,R as ke,S as _e,U as Ee,V as Le,W as Oe,X as Ae,k as S,Y as Te,c as ie,Z as w,_ as ae,$ as Re,j as Be,a0 as ze,a1 as Fe,a2 as Ue,a3 as de,a4 as ue,a5 as me,a6 as $e,a7 as We,t as He,G as Ge,a8 as Ve,a9 as Ke,aa as qe,ab as Je,ac as Qe,ad as Xe,ae as Ye,af as Ze,ag as et,ah as tt,ai as rt,aj as st,ak as nt,al as ot}from"./useAppFontEffects-Cs0f1dKn.js";import{_ as it}from"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-base-ui-vkqQ2P9o.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-BZOGXAGe.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-D0AXkdQC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-sonner-BDtm25td.js";import"./vendor-codemirror-view-Ct4T37Ue.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./runtimeSurface-C7CBxDbh.js";import"./vendor-dnd-kit-core-C9qcAm_1.js";import"./vendor-dnd-kit-utilities-DTY1C6ST.js";import"./vendor-dnd-kit-accessibility-DZKKhs9S.js";import"./vendor-dnd-kit-sortable-D8ozj8M-.js";import"./vendor-cmdk-zXx6sGnS.js";import"./vendor-radix-ui-react-dialog-D2yhEu2p.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-8xy6TJML.js";import"./vendor-radix-ui-react-context-CFsX-AUC.js";import"./vendor-radix-ui-react-id-D2kS9K1j.js";import"./vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js";import"./vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js";import"./vendor-radix-ui-react-dismissable-layer-DrorBNg9.js";import"./vendor-radix-ui-react-primitive-DkH8dMOR.js";import"./vendor-radix-ui-react-slot-BIDFZX0-.js";import"./vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js";import"./vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js";import"./vendor-radix-ui-react-focus-scope-D2BkImwt.js";import"./vendor-radix-ui-react-portal-YgCRIyi7.js";import"./vendor-radix-ui-react-presence-D432pCMB.js";import"./vendor-radix-ui-react-focus-guards-BfdFmL7c.js";import"./vendor-react-remove-scroll-vR1dy1aP.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-CSAHp1YF.js";import"./vendor-react-style-singleton-Ctw6HnYx.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-Vv4V8Nd1.js";import"./vendor-use-callback-ref-CVVuCyLj.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BByA_dGF.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-DuOEwJ3f.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-wd6iRebq.js";import"./vendor-codemirror-lang-json-CZ07HmNC.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-djiuoTi8.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CKHqhW5R.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-DtcZDGqe.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-B8Ac62S_.js";import"./vendor-codemirror-lang-python-DzzokVau.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-DYppkHEk.js";import"./vendor-tanstack-react-virtual-2skouoFw.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-CfplGuM0.js";import"./vendor-motion-dom-DhJ-sYS5.js";import"./vendor-motion-utils-CKEGc_YG.js";const at=({mode:t,children:s})=>e.jsx(Me.Provider,{value:t,children:s}),ct=Oe,lt=Ae,dt=({totalTokens:t,percentage:s,colorPercentage:n,contextLimit:c,outputLimit:i,size:m="default",isMobile:l=!1,hideIcon:M=!1,showPercentIcon:L=!1,className:h,valueClassName:p,percentIconClassName:k,onClick:N,pressed:_=!1,cacheRead:y,cacheWrite:I,cacheHitPercent:v})=>{const[P,j]=a.useState(!1),E=typeof n=="number"?n:s,o=ct(s)??0,g=lt(E),x=g==="critical"?"var(--status-error)":g==="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,J=2*Math.PI*W,ce=J*(1-o/100),H=typeof i=="number"?Math.max(i,0):0,O=typeof y=="number"&&typeof I=="number",Q=O?Math.max(0,y):0,Z=O?Math.max(0,I):0,R=typeof v=="number"&&Number.isFinite(v),T=[`Used tokens: ${d(t)}`,`Context limit: ${d(c)}`,`Output limit: ${d(H)}`,...O?[`Cache read: ${d(Q)}`,`Cache write: ${d(Z)}`]:[],...R?[`Cache hit: ${v.toFixed(1)}%`]:[],`${Math.min(s,999).toFixed(1)}% used`],A=!l&&typeof N=="function",B=e.jsxs(e.Fragment,{children:[!l&&!M&&e.jsx(K,{name:"donut-chart",className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:V("font-medium inline-flex items-center gap-1.5",p),children:L?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${f}`,className:V("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:x,strokeWidth:$,strokeLinecap:"round",strokeDasharray:J,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(E),children:Math.min(s,999).toFixed(1)}),"%"]})})]}),C=V("app-region-no-drag flex items-center gap-1.5 select-none",m==="compact"?"typography-micro":"typography-meta",A?V("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),D=A?e.jsx("button",{type:"button",className:C,"aria-label":"Context usage","aria-pressed":_,onClick:N,children:B}):e.jsx("div",{className:C,"aria-label":"Context usage",onClick:l?()=>j(!0):void 0,children:B});return l?e.jsxs(e.Fragment,{children:[D,e.jsx(ke,{open:P,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(c)})]}),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)})]}),O?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(Q)})]}),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(Z)})]})]}):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:V("typography-meta font-semibold",U(E)),children:[Math.min(s,999).toFixed(1),"%"]})]})]})})})]}):e.jsxs(_e,{children:[e.jsx(Ee,{asChild:!0,children:D}),e.jsx(Le,{children:e.jsx("div",{className:"space-y-0.5",children:T.map(b=>e.jsx("p",{className:"typography-micro leading-tight",children:b},b))})})]})},ut=a.lazy(()=>it(()=>import("./SessionSwitcherDropdown-C4etG8dv.js"),__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])).then(t=>({default:t.SessionSwitcherDropdown}))),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 c=s.split("/").filter(Boolean);return c.length<=3?s:`.../${c.slice(-3).join("/")}`},re=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),c=S(r=>r.newSessionDraft?.selectedProjectId??null),i=q(r=>r.currentDirectory),m=ie(r=>r.projects),l=ie(r=>r.getActiveProject()),M=w(r=>r.getCurrentModel),L=w(r=>r.providers),h=ae(),p=Re(s??""),k=Be(),N=ze(r=>r.ensureStatus),_=S(r=>r.newSessionDraft?.open?re(r.newSessionDraft.directoryOverride??""):""),[y,I]=a.useState(!1),v=typeof window<"u"?window.__PICHAMBER_MACOS_MAJOR__??0:0,P=Number.isFinite(v)&&v>0,{usesFramelessChrome:j,side:E}=Fe(),o=P?v>=26?"h-12":v<=15?"h-14":"":"",g=a.useMemo(()=>s?h.find(r=>r.id===s)??null:null,[s,h]);a.useEffect(()=>{ve()&&Y("desktop_get_window_pinned").then(r=>{typeof r?.pinned=="boolean"&&I(r.pinned)})},[]);const x=g?.title?.trim()||(n||t==="draft"?"New session":"Session"),d=re(g?.directory??null),U=re(i),f=d||_||U,$=mt(f);a.useEffect(()=>{f&&N(f,k.git).catch(()=>{})},[N,f,k.git]);const W=a.useMemo(()=>{const r=f;return r?m.map(u=>({...u,normalizedPath:re(u.path)})).filter(u=>u.normalizedPath&&(u.normalizedPath===r||r.startsWith(`${u.normalizedPath}/`))).sort((u,G)=>G.path.length-u.path.length)[0]??null:null},[f,m]),J=a.useMemo(()=>{const r=W??l;if(!r)return $||"PiChamber";const u=r.label?.trim();return u||(r.path.split(/[\\/]/).filter(Boolean).at(-1)??r.path)},[l,$,W]),H=Ue(f||null),O=H&&H!=="HEAD"?H:null,Q=M(),Z=a.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 te=L.find(X=>X.id===u.providerID)?.models.find(X=>X.id===u.modelID);if(te)return te}},[p,L]),R=Q?.limit?Q:Z,T=R&&typeof R.limit=="object"&&R.limit!==null?R.limit:null,A=T&&typeof T.context=="number"?T.context:0,B=T&&typeof T.output=="number"?T.output:0,C=a.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 z=ne.tokens;if(!z)continue;if(z.input+z.output+z.reasoning+(z.cache?.read??0)+(z.cache?.write??0)>0){r=z,u=ne.id;break}}if(!r)return null;const G=r.input+r.output+r.reasoning+(r.cache?.read??0)+(r.cache?.write??0),te=A>0?A:2e5,X=A>0?Math.round(G/A*100):0,ge=B>0?Math.round(r.output/B*100):void 0;return{totalTokens:G,percentage:X,contextLimit:A||0,outputLimit:B||void 0,normalizedOutput:ge,thresholdLimit:te,lastMessageId:u}},[A,s,p,B]),[D,b]=a.useState(null),fe={WebkitAppRegion:"drag"},ee={WebkitAppRegion:"no-drag"};a.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 he=D&&D.contextLimit>0?Math.min(999,D.totalTokens/D.contextLimit*100):0,xe=a.useCallback(()=>{const r=!y;I(r),Y("desktop_set_window_pinned",{pinned:r}).catch(()=>{I(!r)})},[y]),ye=a.useCallback(()=>{const r=s?{sessionId:s,directory:g?.directory??i??""}:{mode:"draft",directory:f||i||"",projectId:c};Y("desktop_focus_main_window",r).then(u=>u?.focused===!0?Y("desktop_close_current_window"):null)},[i,s,c,f,g]);return e.jsxs("header",{className:V("flex items-center gap-3 bg-background pr-3",P?"pl-[5.5rem]":"pl-3",j?"h-12":o||"min-h-14"),style:fe,children:[j&&E==="left"?e.jsx(de,{visible:!0,position:"left"}):null,e.jsx(pe.Suspense,{fallback:e.jsxs("button",{type:"button","aria-label":"Open session switcher",style:ee,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:x}),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:J}),O?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(K,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:O})]}):null]})]}),children:e.jsx(ut,{children:e.jsxs("button",{type:"button","aria-label":"Open session switcher",style:ee,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:x}),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:J}),O?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(K,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:O})]}):null]})]})})}),e.jsx("div",{className:"min-w-0 flex-1"}),D&&D.totalTokens>0?e.jsx(dt,{totalTokens:D.totalTokens,percentage:he,colorPercentage:D.percentage,contextLimit:D.contextLimit,outputLimit:D.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:xe,"aria-label":y?"Unpin Mini Chat window":"Pin Mini Chat window",title:y?"Unpin window":"Pin above other windows",style:ee,children:y?e.jsx(K,{name:"pushpin-2-fill",className:"h-4 w-4"}):e.jsx(K,{name:"pushpin-2",className:"h-4 w-4"})}),e.jsx(ue,{type:"button",variant:"ghost",size:"icon",onClick:ye,"aria-label":"Open session in main window",title:"Open in main window",style:ee,children:e.jsx(K,{name:"external-link",className:"h-4 w-4"})}),e.jsx(de,{visible:j&&E==="right",position:"right"})]})},ft=({mode:t,autoOpenDraft:s=!1,unavailable:n=!1})=>{const c=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(at,{mode:"mini-chat",children:e.jsx(Te,{autoOpenDraft:s},c??"no-session")})})]})},ht=()=>{const t=oe(i=>i.shortcutOverrides),s=q(i=>i.currentDirectory),n=ie(i=>i.getActiveProject()),c=S(i=>i.openNewSessionDraft);a.useEffect(()=>{const i=l=>be(l,t),m=l=>{if(F(l,i("focus_input"))){l.preventDefault(),me();return}if(je()&&F(l,i("new_mini_chat"))){l.preventDefault(),Y("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(F(l,i("new_chat"))){l.preventDefault(),c({selectedProjectId:n?.id??null,directoryOverride:s||n?.path||null,preserveDirectoryOverride:!!(s||n?.path)}),me();return}if(F(l,i("open_model_selector"))){l.preventDefault();const{isModelSelectorOpen:h,setModelSelectorOpen:p}=oe.getState();p(!h);return}if(F(l,i("cycle_thinking_variant"))){if(w.getState().getCurrentModelVariants().length===0)return;l.preventDefault(),$e(1).then(k=>{const N=S.getState().currentSessionId,_=w.getState().currentAgentName,y=w.getState().currentProviderId,I=w.getState().currentModelId;N&&_&&y&&I&&We.getState().saveAgentModelVariantForSession(N,_,y,I,k)}).catch(()=>{He.error("Couldn't update thinking")});return}const M=F(l,i("cycle_favorite_model_forward")),L=F(l,i("cycle_favorite_model_backward"));if(M||L){const{favoriteModels:h,addRecentModel:p}=oe.getState();if(h.length===0)return;l.preventDefault();const{currentProviderId:k,currentModelId:N,setProvider:_,setModel:y}=w.getState(),I=h.findIndex(j=>j.providerID===k&&j.modelID===N),P=h[(I+(M?1:-1)+h.length)%h.length];_(P.providerID),y(P.modelID),p(P.providerID,P.modelID)}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n?.id,n?.path,s,c,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,c=t.get("directory")?.trim()||null,i=t.get("projectId")?.trim()||null;return{mode:s,sessionId:n,directory:c,projectId:i}},gt=({config:t})=>{const s=ae(),n=q(o=>o.currentDirectory),c=q(o=>o.setDirectory),i=S(o=>o.currentSessionId),m=S(o=>!!o.newSessionDraft?.open),l=S(o=>o.newSessionDraft?.open?o.newSessionDraft.bootstrapPendingDirectory??o.newSessionDraft.directoryOverride??"":""),M=S(o=>o.setCurrentSession),L=S(o=>o.openNewSessionDraft),h=w(o=>o.initializeApp),p=w(o=>o.isInitialized),k=w(o=>o.isConnected),N=w(o=>o.loadProviders),_=w(o=>o.loadAgents),y=w(o=>o.providers.length),I=w(o=>o.agents.length),v=tt();a.useEffect(()=>{h()},[h]),a.useEffect(()=>{if(p)return;let o=!0,g=0;const x=window.setInterval(()=>{if(o){if(g+=1,g>10){window.clearInterval(x);return}w.getState().isInitialized||w.getState().initializeApp()}},1e3);return()=>{o=!1,window.clearInterval(x)}},[p]);const P=a.useRef(!1);a.useEffect(()=>{if(!P.current&&t.mode==="session"&&t.directory){if(n===t.directory){P.current=!0;return}c(t.directory,{showOverlay:!1}),P.current=!0}},[t.directory,t.mode,n,c]),a.useEffect(()=>{t.mode!=="draft"||!m||i||!l||n===l||c(l,{showOverlay:!1})},[t.mode,n,i,l,m,c]),a.useEffect(()=>{k&&(y===0&&N({source:"electronMiniChat:recovery"}),I===0&&_({source:"electronMiniChat:recovery"}))},[I,k,_,N,y]);const j=a.useRef(!1);a.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(x=>x.id===t.sessionId);if(!o){v.ensureSessionRenderable(t.sessionId);return}const g=o.directory??t.directory;M(t.sessionId,g),j.current=!0},[t,i,s,M,v]),a.useEffect(()=>{const o=g=>{const x=g.detail,d=typeof x?.sessionId=="string"?x.sessionId.trim():"";if(!d||S.getState().currentSessionId===d)return;const U=typeof x?.directory=="string"&&x.directory.trim().length>0?x.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]),a.useEffect(()=>{t.mode!=="draft"||m||i||L({selectedProjectId:t.projectId,directoryOverride:t.directory,preserveDirectoryOverride:!!t.directory})},[t,i,m,L]);const E=a.useRef(!1);return a.useEffect(()=>{if(E.current||!p)return;const o=()=>{if(E.current)return;E.current=!0;const d=typeof document<"u"?document.getElementById("initial-loading"):null;d&&(d.classList.add("fade-out"),window.setTimeout(()=>d.remove(),300))},g=t.mode==="session"?i===t.sessionId:m,x=window.setTimeout(o,g?100:1500);return()=>window.clearTimeout(x)},[p,t.mode,t.sessionId,i,m]),null},wt=()=>{const t=S(n=>n.currentSessionId),s=q(n=>n.currentDirectory);return a.useEffect(()=>{if(!t||!s||typeof BroadcastChannel>"u")return;const n=new BroadcastChannel(xt),c=l=>{n.postMessage({type:"mini-chat-session-presence",sessionId:t,directory:s,viewed:l})};c(!0);const i=window.setInterval(()=>c(!0),5e3),m=()=>c(!1);return window.addEventListener("beforeunload",m),()=>{window.clearInterval(i),window.removeEventListener("beforeunload",m),c(!1),n.close()}},[s,t]),null},vt=t=>{const s=ae(),n=S(m=>m.currentSessionId),[c,i]=a.useState(!1);return a.useEffect(()=>{if(t.mode!=="session"||!t.sessionId||n===t.sessionId){i(!1);return}if(s.some(l=>l.id===t.sessionId)){i(!1);return}const m=window.setTimeout(()=>i(!0),5e3);return()=>window.clearTimeout(m)},[t.mode,t.sessionId,n,s]),c};function jt({apis:t}){const s=a.useMemo(()=>yt(),[]),n=q(c=>c.currentDirectory);return a.useEffect(()=>{const c=n||s.directory;c&&Ge().focusProject(c,null)},[s.directory,n]),a.useEffect(()=>(le(t),()=>le(null)),[t]),Ve(),ht(),Ne({enabled:!0}),e.jsx(Ke,{children:e.jsx(qe,{directory:n||s.directory,children:e.jsxs(Je,{apis:t,children:[e.jsx(Qe,{}),e.jsx(Xe,{delayDuration:300,skipDelayDuration:150,children:e.jsxs("div",{className:"h-full text-foreground bg-background",children:[e.jsx(bt,{config:s}),e.jsx(Ye,{}),e.jsx(Ze,{})]})})]})})})}const bt=({config:t})=>{const s=vt(t);return e.jsxs(e.Fragment,{children:[e.jsx(gt,{config:t}),e.jsx(wt,{}),e.jsx(et,{embeddedBackgroundWorkEnabled:!0}),e.jsx(ft,{mode:t.mode,autoOpenDraft:t.mode==="draft",unavailable:s})]})},St=()=>{Ie().then(async()=>{try{await Promise.all([Ce(),Pe()])}catch(t){console.error("[mini-chat-main] settings init failed:",t)}nt(),ot(),De()}).catch(t=>{console.error("[mini-chat-main] appearance init failed:",t)})};function Xr(t){const s=t??Se();if(!s)throw new Error("Runtime APIs not registered");St();const n=document.getElementById("root");if(!n)throw new Error("Root element not found");we.createRoot(n).render(e.jsx(pe.StrictMode,{children:e.jsx(rt,{children:e.jsx(st,{children:e.jsx(jt,{apis:s})})})}))}export{Xr as renderElectronMiniChatApp};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherDropdown-icxJk_lT.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-react-B5Z1Mdn3.js","assets/vendor-scheduler-7OC5HNn7.js","assets/useAppFontEffects-C4JL1x7k.js","assets/vendor-zustand-GVb4H8HE.js","assets/index-KIdiBFJs.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-DNoEeZ2U.css","assets/vendor-base-ui-vkqQ2P9o.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-BZOGXAGe.js","assets/vendor-floating-ui-dom-WyXykhNi.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-D0AXkdQC.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-sonner-BDtm25td.js","assets/vendor-codemirror-view-Ct4T37Ue.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/runtimeSurface-CySRuLbN.js","assets/vendor-dnd-kit-core-C9qcAm_1.js","assets/vendor-dnd-kit-utilities-DTY1C6ST.js","assets/vendor-dnd-kit-accessibility-DZKKhs9S.js","assets/vendor-dnd-kit-sortable-D8ozj8M-.js","assets/vendor-cmdk-zXx6sGnS.js","assets/vendor-radix-ui-react-dialog-D2yhEu2p.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-8xy6TJML.js","assets/vendor-radix-ui-react-context-CFsX-AUC.js","assets/vendor-radix-ui-react-id-D2kS9K1j.js","assets/vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js","assets/vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js","assets/vendor-radix-ui-react-dismissable-layer-DrorBNg9.js","assets/vendor-radix-ui-react-primitive-DkH8dMOR.js","assets/vendor-radix-ui-react-slot-BIDFZX0-.js","assets/vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js","assets/vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js","assets/vendor-radix-ui-react-focus-scope-D2BkImwt.js","assets/vendor-radix-ui-react-portal-YgCRIyi7.js","assets/vendor-radix-ui-react-presence-D432pCMB.js","assets/vendor-radix-ui-react-focus-guards-BfdFmL7c.js","assets/vendor-react-remove-scroll-vR1dy1aP.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-CSAHp1YF.js","assets/vendor-react-style-singleton-Ctw6HnYx.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-Vv4V8Nd1.js","assets/vendor-use-callback-ref-CVVuCyLj.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BByA_dGF.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-DuOEwJ3f.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-wd6iRebq.js","assets/vendor-codemirror-lang-json-CZ07HmNC.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-djiuoTi8.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CKHqhW5R.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-DtcZDGqe.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-C493X_9w.js","assets/vendor-codemirror-lang-python-DzzokVau.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-DYppkHEk.js","assets/vendor-tanstack-react-virtual-2skouoFw.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-CfplGuM0.js","assets/vendor-motion-dom-DhJ-sYS5.js","assets/vendor-motion-utils-CKEGc_YG.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,R as a,r as pe,e as we}from"./vendor-react-B5Z1Mdn3.js";import"./vendor-katex-CNckGUMB.js";import{c as V,f as q,o as ve,q as Y,u as oe,t as F,v as je,w as be,x as le,j as Se,y as Ie,z as Ce}from"./index-KIdiBFJs.js";import{u as Ne,a as Pe,s as De}from"./usePushVisibilityBeacon-BnHxIv4r.js";import{Q as Me,I as K,R as ke,S as _e,U as Ee,V as Le,W as Oe,X as Ae,k as S,Y as Te,c as ie,Z as w,_ as ae,$ as Re,j as Be,a0 as ze,a1 as Fe,a2 as Ue,a3 as de,a4 as ue,a5 as me,a6 as $e,a7 as We,t as He,G as Ge,a8 as Ve,a9 as Ke,aa as qe,ab as Je,ac as Qe,ad as Xe,ae as Ye,af as Ze,ag as et,ah as tt,ai as rt,aj as st,ak as nt,al as ot}from"./useAppFontEffects-C4JL1x7k.js";import{_ as it}from"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-GVb4H8HE.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-base-ui-vkqQ2P9o.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-BZOGXAGe.js";import"./vendor-floating-ui-dom-WyXykhNi.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-D0AXkdQC.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-sonner-BDtm25td.js";import"./vendor-codemirror-view-Ct4T37Ue.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./runtimeSurface-CySRuLbN.js";import"./vendor-dnd-kit-core-C9qcAm_1.js";import"./vendor-dnd-kit-utilities-DTY1C6ST.js";import"./vendor-dnd-kit-accessibility-DZKKhs9S.js";import"./vendor-dnd-kit-sortable-D8ozj8M-.js";import"./vendor-cmdk-zXx6sGnS.js";import"./vendor-radix-ui-react-dialog-D2yhEu2p.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-8xy6TJML.js";import"./vendor-radix-ui-react-context-CFsX-AUC.js";import"./vendor-radix-ui-react-id-D2kS9K1j.js";import"./vendor-radix-ui-react-use-layout-effect-C8Yrsaph.js";import"./vendor-radix-ui-react-use-controllable-state-LiqmKSXO.js";import"./vendor-radix-ui-react-dismissable-layer-DrorBNg9.js";import"./vendor-radix-ui-react-primitive-DkH8dMOR.js";import"./vendor-radix-ui-react-slot-BIDFZX0-.js";import"./vendor-radix-ui-react-use-callback-ref-BwDcSoGV.js";import"./vendor-radix-ui-react-use-escape-keydown-DTkqjenV.js";import"./vendor-radix-ui-react-focus-scope-D2BkImwt.js";import"./vendor-radix-ui-react-portal-YgCRIyi7.js";import"./vendor-radix-ui-react-presence-D432pCMB.js";import"./vendor-radix-ui-react-focus-guards-BfdFmL7c.js";import"./vendor-react-remove-scroll-vR1dy1aP.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-CSAHp1YF.js";import"./vendor-react-style-singleton-Ctw6HnYx.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-Vv4V8Nd1.js";import"./vendor-use-callback-ref-CVVuCyLj.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BByA_dGF.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-DuOEwJ3f.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-wd6iRebq.js";import"./vendor-codemirror-lang-json-CZ07HmNC.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-djiuoTi8.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CKHqhW5R.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-DtcZDGqe.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-C493X_9w.js";import"./vendor-codemirror-lang-python-DzzokVau.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-DYppkHEk.js";import"./vendor-tanstack-react-virtual-2skouoFw.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-CfplGuM0.js";import"./vendor-motion-dom-DhJ-sYS5.js";import"./vendor-motion-utils-CKEGc_YG.js";const at=({mode:t,children:s})=>e.jsx(Me.Provider,{value:t,children:s}),ct=Oe,lt=Ae,dt=({totalTokens:t,percentage:s,colorPercentage:n,contextLimit:c,outputLimit:i,size:m="default",isMobile:l=!1,hideIcon:M=!1,showPercentIcon:L=!1,className:h,valueClassName:p,percentIconClassName:k,onClick:N,pressed:_=!1,cacheRead:y,cacheWrite:I,cacheHitPercent:v})=>{const[P,j]=a.useState(!1),E=typeof n=="number"?n:s,o=ct(s)??0,g=lt(E),x=g==="critical"?"var(--status-error)":g==="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,J=2*Math.PI*W,ce=J*(1-o/100),H=typeof i=="number"?Math.max(i,0):0,O=typeof y=="number"&&typeof I=="number",Q=O?Math.max(0,y):0,Z=O?Math.max(0,I):0,R=typeof v=="number"&&Number.isFinite(v),T=[`Used tokens: ${d(t)}`,`Context limit: ${d(c)}`,`Output limit: ${d(H)}`,...O?[`Cache read: ${d(Q)}`,`Cache write: ${d(Z)}`]:[],...R?[`Cache hit: ${v.toFixed(1)}%`]:[],`${Math.min(s,999).toFixed(1)}% used`],A=!l&&typeof N=="function",B=e.jsxs(e.Fragment,{children:[!l&&!M&&e.jsx(K,{name:"donut-chart",className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:V("font-medium inline-flex items-center gap-1.5",p),children:L?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${f}`,className:V("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:x,strokeWidth:$,strokeLinecap:"round",strokeDasharray:J,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(E),children:Math.min(s,999).toFixed(1)}),"%"]})})]}),C=V("app-region-no-drag flex items-center gap-1.5 select-none",m==="compact"?"typography-micro":"typography-meta",A?V("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),D=A?e.jsx("button",{type:"button",className:C,"aria-label":"Context usage","aria-pressed":_,onClick:N,children:B}):e.jsx("div",{className:C,"aria-label":"Context usage",onClick:l?()=>j(!0):void 0,children:B});return l?e.jsxs(e.Fragment,{children:[D,e.jsx(ke,{open:P,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(c)})]}),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)})]}),O?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(Q)})]}),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(Z)})]})]}):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:V("typography-meta font-semibold",U(E)),children:[Math.min(s,999).toFixed(1),"%"]})]})]})})})]}):e.jsxs(_e,{children:[e.jsx(Ee,{asChild:!0,children:D}),e.jsx(Le,{children:e.jsx("div",{className:"space-y-0.5",children:T.map(b=>e.jsx("p",{className:"typography-micro leading-tight",children:b},b))})})]})},ut=a.lazy(()=>it(()=>import("./SessionSwitcherDropdown-icxJk_lT.js"),__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])).then(t=>({default:t.SessionSwitcherDropdown}))),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 c=s.split("/").filter(Boolean);return c.length<=3?s:`.../${c.slice(-3).join("/")}`},re=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),c=S(r=>r.newSessionDraft?.selectedProjectId??null),i=q(r=>r.currentDirectory),m=ie(r=>r.projects),l=ie(r=>r.getActiveProject()),M=w(r=>r.getCurrentModel),L=w(r=>r.providers),h=ae(),p=Re(s??""),k=Be(),N=ze(r=>r.ensureStatus),_=S(r=>r.newSessionDraft?.open?re(r.newSessionDraft.directoryOverride??""):""),[y,I]=a.useState(!1),v=typeof window<"u"?window.__PICHAMBER_MACOS_MAJOR__??0:0,P=Number.isFinite(v)&&v>0,{usesFramelessChrome:j,side:E}=Fe(),o=P?v>=26?"h-12":v<=15?"h-14":"":"",g=a.useMemo(()=>s?h.find(r=>r.id===s)??null:null,[s,h]);a.useEffect(()=>{ve()&&Y("desktop_get_window_pinned").then(r=>{typeof r?.pinned=="boolean"&&I(r.pinned)})},[]);const x=g?.title?.trim()||(n||t==="draft"?"New session":"Session"),d=re(g?.directory??null),U=re(i),f=d||_||U,$=mt(f);a.useEffect(()=>{f&&N(f,k.git).catch(()=>{})},[N,f,k.git]);const W=a.useMemo(()=>{const r=f;return r?m.map(u=>({...u,normalizedPath:re(u.path)})).filter(u=>u.normalizedPath&&(u.normalizedPath===r||r.startsWith(`${u.normalizedPath}/`))).sort((u,G)=>G.path.length-u.path.length)[0]??null:null},[f,m]),J=a.useMemo(()=>{const r=W??l;if(!r)return $||"PiChamber";const u=r.label?.trim();return u||(r.path.split(/[\\/]/).filter(Boolean).at(-1)??r.path)},[l,$,W]),H=Ue(f||null),O=H&&H!=="HEAD"?H:null,Q=M(),Z=a.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 te=L.find(X=>X.id===u.providerID)?.models.find(X=>X.id===u.modelID);if(te)return te}},[p,L]),R=Q?.limit?Q:Z,T=R&&typeof R.limit=="object"&&R.limit!==null?R.limit:null,A=T&&typeof T.context=="number"?T.context:0,B=T&&typeof T.output=="number"?T.output:0,C=a.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 z=ne.tokens;if(!z)continue;if(z.input+z.output+z.reasoning+(z.cache?.read??0)+(z.cache?.write??0)>0){r=z,u=ne.id;break}}if(!r)return null;const G=r.input+r.output+r.reasoning+(r.cache?.read??0)+(r.cache?.write??0),te=A>0?A:2e5,X=A>0?Math.round(G/A*100):0,ge=B>0?Math.round(r.output/B*100):void 0;return{totalTokens:G,percentage:X,contextLimit:A||0,outputLimit:B||void 0,normalizedOutput:ge,thresholdLimit:te,lastMessageId:u}},[A,s,p,B]),[D,b]=a.useState(null),fe={WebkitAppRegion:"drag"},ee={WebkitAppRegion:"no-drag"};a.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 he=D&&D.contextLimit>0?Math.min(999,D.totalTokens/D.contextLimit*100):0,xe=a.useCallback(()=>{const r=!y;I(r),Y("desktop_set_window_pinned",{pinned:r}).catch(()=>{I(!r)})},[y]),ye=a.useCallback(()=>{const r=s?{sessionId:s,directory:g?.directory??i??""}:{mode:"draft",directory:f||i||"",projectId:c};Y("desktop_focus_main_window",r).then(u=>u?.focused===!0?Y("desktop_close_current_window"):null)},[i,s,c,f,g]);return e.jsxs("header",{className:V("flex items-center gap-3 bg-background pr-3",P?"pl-[5.5rem]":"pl-3",j?"h-12":o||"min-h-14"),style:fe,children:[j&&E==="left"?e.jsx(de,{visible:!0,position:"left"}):null,e.jsx(pe.Suspense,{fallback:e.jsxs("button",{type:"button","aria-label":"Open session switcher",style:ee,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:x}),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:J}),O?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(K,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:O})]}):null]})]}),children:e.jsx(ut,{children:e.jsxs("button",{type:"button","aria-label":"Open session switcher",style:ee,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:x}),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:J}),O?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(K,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:O})]}):null]})]})})}),e.jsx("div",{className:"min-w-0 flex-1"}),D&&D.totalTokens>0?e.jsx(dt,{totalTokens:D.totalTokens,percentage:he,colorPercentage:D.percentage,contextLimit:D.contextLimit,outputLimit:D.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:xe,"aria-label":y?"Unpin Mini Chat window":"Pin Mini Chat window",title:y?"Unpin window":"Pin above other windows",style:ee,children:y?e.jsx(K,{name:"pushpin-2-fill",className:"h-4 w-4"}):e.jsx(K,{name:"pushpin-2",className:"h-4 w-4"})}),e.jsx(ue,{type:"button",variant:"ghost",size:"icon",onClick:ye,"aria-label":"Open session in main window",title:"Open in main window",style:ee,children:e.jsx(K,{name:"external-link",className:"h-4 w-4"})}),e.jsx(de,{visible:j&&E==="right",position:"right"})]})},ft=({mode:t,autoOpenDraft:s=!1,unavailable:n=!1})=>{const c=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(at,{mode:"mini-chat",children:e.jsx(Te,{autoOpenDraft:s},c??"no-session")})})]})},ht=()=>{const t=oe(i=>i.shortcutOverrides),s=q(i=>i.currentDirectory),n=ie(i=>i.getActiveProject()),c=S(i=>i.openNewSessionDraft);a.useEffect(()=>{const i=l=>be(l,t),m=l=>{if(F(l,i("focus_input"))){l.preventDefault(),me();return}if(je()&&F(l,i("new_mini_chat"))){l.preventDefault(),Y("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(F(l,i("new_chat"))){l.preventDefault(),c({selectedProjectId:n?.id??null,directoryOverride:s||n?.path||null,preserveDirectoryOverride:!!(s||n?.path)}),me();return}if(F(l,i("open_model_selector"))){l.preventDefault();const{isModelSelectorOpen:h,setModelSelectorOpen:p}=oe.getState();p(!h);return}if(F(l,i("cycle_thinking_variant"))){if(w.getState().getCurrentModelVariants().length===0)return;l.preventDefault(),$e(1).then(k=>{const N=S.getState().currentSessionId,_=w.getState().currentAgentName,y=w.getState().currentProviderId,I=w.getState().currentModelId;N&&_&&y&&I&&We.getState().saveAgentModelVariantForSession(N,_,y,I,k)}).catch(()=>{He.error("Couldn't update thinking")});return}const M=F(l,i("cycle_favorite_model_forward")),L=F(l,i("cycle_favorite_model_backward"));if(M||L){const{favoriteModels:h,addRecentModel:p}=oe.getState();if(h.length===0)return;l.preventDefault();const{currentProviderId:k,currentModelId:N,setProvider:_,setModel:y}=w.getState(),I=h.findIndex(j=>j.providerID===k&&j.modelID===N),P=h[(I+(M?1:-1)+h.length)%h.length];_(P.providerID),y(P.modelID),p(P.providerID,P.modelID)}};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n?.id,n?.path,s,c,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,c=t.get("directory")?.trim()||null,i=t.get("projectId")?.trim()||null;return{mode:s,sessionId:n,directory:c,projectId:i}},gt=({config:t})=>{const s=ae(),n=q(o=>o.currentDirectory),c=q(o=>o.setDirectory),i=S(o=>o.currentSessionId),m=S(o=>!!o.newSessionDraft?.open),l=S(o=>o.newSessionDraft?.open?o.newSessionDraft.bootstrapPendingDirectory??o.newSessionDraft.directoryOverride??"":""),M=S(o=>o.setCurrentSession),L=S(o=>o.openNewSessionDraft),h=w(o=>o.initializeApp),p=w(o=>o.isInitialized),k=w(o=>o.isConnected),N=w(o=>o.loadProviders),_=w(o=>o.loadAgents),y=w(o=>o.providers.length),I=w(o=>o.agents.length),v=tt();a.useEffect(()=>{h()},[h]),a.useEffect(()=>{if(p)return;let o=!0,g=0;const x=window.setInterval(()=>{if(o){if(g+=1,g>10){window.clearInterval(x);return}w.getState().isInitialized||w.getState().initializeApp()}},1e3);return()=>{o=!1,window.clearInterval(x)}},[p]);const P=a.useRef(!1);a.useEffect(()=>{if(!P.current&&t.mode==="session"&&t.directory){if(n===t.directory){P.current=!0;return}c(t.directory,{showOverlay:!1}),P.current=!0}},[t.directory,t.mode,n,c]),a.useEffect(()=>{t.mode!=="draft"||!m||i||!l||n===l||c(l,{showOverlay:!1})},[t.mode,n,i,l,m,c]),a.useEffect(()=>{k&&(y===0&&N({source:"electronMiniChat:recovery"}),I===0&&_({source:"electronMiniChat:recovery"}))},[I,k,_,N,y]);const j=a.useRef(!1);a.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(x=>x.id===t.sessionId);if(!o){v.ensureSessionRenderable(t.sessionId);return}const g=o.directory??t.directory;M(t.sessionId,g),j.current=!0},[t,i,s,M,v]),a.useEffect(()=>{const o=g=>{const x=g.detail,d=typeof x?.sessionId=="string"?x.sessionId.trim():"";if(!d||S.getState().currentSessionId===d)return;const U=typeof x?.directory=="string"&&x.directory.trim().length>0?x.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]),a.useEffect(()=>{t.mode!=="draft"||m||i||L({selectedProjectId:t.projectId,directoryOverride:t.directory,preserveDirectoryOverride:!!t.directory})},[t,i,m,L]);const E=a.useRef(!1);return a.useEffect(()=>{if(E.current||!p)return;const o=()=>{if(E.current)return;E.current=!0;const d=typeof document<"u"?document.getElementById("initial-loading"):null;d&&(d.classList.add("fade-out"),window.setTimeout(()=>d.remove(),300))},g=t.mode==="session"?i===t.sessionId:m,x=window.setTimeout(o,g?100:1500);return()=>window.clearTimeout(x)},[p,t.mode,t.sessionId,i,m]),null},wt=()=>{const t=S(n=>n.currentSessionId),s=q(n=>n.currentDirectory);return a.useEffect(()=>{if(!t||!s||typeof BroadcastChannel>"u")return;const n=new BroadcastChannel(xt),c=l=>{n.postMessage({type:"mini-chat-session-presence",sessionId:t,directory:s,viewed:l})};c(!0);const i=window.setInterval(()=>c(!0),5e3),m=()=>c(!1);return window.addEventListener("beforeunload",m),()=>{window.clearInterval(i),window.removeEventListener("beforeunload",m),c(!1),n.close()}},[s,t]),null},vt=t=>{const s=ae(),n=S(m=>m.currentSessionId),[c,i]=a.useState(!1);return a.useEffect(()=>{if(t.mode!=="session"||!t.sessionId||n===t.sessionId){i(!1);return}if(s.some(l=>l.id===t.sessionId)){i(!1);return}const m=window.setTimeout(()=>i(!0),5e3);return()=>window.clearTimeout(m)},[t.mode,t.sessionId,n,s]),c};function jt({apis:t}){const s=a.useMemo(()=>yt(),[]),n=q(c=>c.currentDirectory);return a.useEffect(()=>{const c=n||s.directory;c&&Ge().focusProject(c,null)},[s.directory,n]),a.useEffect(()=>(le(t),()=>le(null)),[t]),Ve(),ht(),Ne({enabled:!0}),e.jsx(Ke,{children:e.jsx(qe,{directory:n||s.directory,children:e.jsxs(Je,{apis:t,children:[e.jsx(Qe,{}),e.jsx(Xe,{delayDuration:300,skipDelayDuration:150,children:e.jsxs("div",{className:"h-full text-foreground bg-background",children:[e.jsx(bt,{config:s}),e.jsx(Ye,{}),e.jsx(Ze,{})]})})]})})})}const bt=({config:t})=>{const s=vt(t);return e.jsxs(e.Fragment,{children:[e.jsx(gt,{config:t}),e.jsx(wt,{}),e.jsx(et,{embeddedBackgroundWorkEnabled:!0}),e.jsx(ft,{mode:t.mode,autoOpenDraft:t.mode==="draft",unavailable:s})]})},St=()=>{Ie().then(async()=>{try{await Promise.all([Ce(),Pe()])}catch(t){console.error("[mini-chat-main] settings init failed:",t)}nt(),ot(),De()}).catch(t=>{console.error("[mini-chat-main] appearance init failed:",t)})};function Xr(t){const s=t??Se();if(!s)throw new Error("Runtime APIs not registered");St();const n=document.getElementById("root");if(!n)throw new Error("Root element not found");we.createRoot(n).render(e.jsx(pe.StrictMode,{children:e.jsx(rt,{children:e.jsx(st,{children:e.jsx(jt,{apis:s})})})}))}export{Xr as renderElectronMiniChatApp};