@pi-chamber/web 1.0.5 → 1.0.6-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{DiagramView-CrKjR8CR.js → DiagramView-DUxXEKjQ.js} +1 -1
- package/dist/assets/DiffView-DEd3rdnu.js +18 -0
- package/dist/assets/FileSaveConflictDialog-C6o4fYIn.js +3 -0
- package/dist/assets/{FilesView-BRR3N7UA.js → FilesView-Ccl4CxjR.js} +3 -3
- package/dist/assets/{GitHubDetailScaffold-C1UHuETI.js → GitHubDetailScaffold-DlgVm5uD.js} +3 -3
- package/dist/assets/{GitHubLinkPicker-B0O3Vapu.js → GitHubLinkPicker-BgDZR-3K.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-DvQDU--z.js → GitHubListPrimitives-BTeI3B3C.js} +1 -1
- package/dist/assets/{GitView-wAscrRhO.js → GitView-BkrH0HFQ.js} +4 -4
- package/dist/assets/{IssuesSurface-mh50UUQ8.js → IssuesSurface-CD1m8BHP.js} +3 -3
- package/dist/assets/{JsonTreeView-BfErTllU.js → JsonTreeView-RLgBKik9.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-SXAK4uOu.js → MarkdownRendererImpl-BkfhE9NN.js} +2 -2
- package/dist/assets/{PatchDiff-CHr79sJ6.js → PatchDiff-BLNLrGYa.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CGpKcLro.js → PierreDiffViewer-iLnLAFeL.js} +3 -3
- package/dist/assets/PullRequestsSurface-_kgJMFTh.js +2 -0
- package/dist/assets/{SessionSwitcherContent-DEAw6v12.js → SessionSwitcherContent-BCOUKRch.js} +1 -1
- package/dist/assets/SessionSwitcherDropdown-CA64t2xd.js +2 -0
- package/dist/assets/SessionUnreadDot-BZy2DM6H.js +1 -0
- package/dist/assets/SettingsView-TwUy1kXV.js +6 -0
- package/dist/assets/{SettingsWindow-BiY5FmhZ.js → SettingsWindow-BXE4JP-T.js} +1 -1
- package/dist/assets/{StickyHorizontalScrollbar-BMITjK4e.js → StickyHorizontalScrollbar-p7EbL2-E.js} +2 -2
- package/dist/assets/{ToolOutputDialog-B3RRLhR3.js → ToolOutputDialog-tiXT-Xts.js} +4 -4
- package/dist/assets/{ToolPartDiffPreview-D9m_vrht.js → ToolPartDiffPreview-CylbiIKd.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-B8lhZGLu.js → VirtualizedFileDiff-Cccy1L8L.js} +4 -4
- package/dist/assets/{Virtualizer-DP6HbEeC.js → Virtualizer-DNJrJKVb.js} +1 -1
- package/dist/assets/{appThemeRegistry-gegrE2dq.js → appThemeRegistry-Ca8eGRB9.js} +1 -1
- package/dist/assets/{collapsible-9MJx4VhA.js → collapsible-0yfy07W2.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-Bjhk2CQS.js → computeVirtualFileMetrics-ydVGT2RY.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-CsF5Boky.js → contextFileOpenGuard--7BLkncT.js} +1 -1
- package/dist/assets/{document-attachments-BslE4Ns7.js → document-attachments-CZl9rK1z.js} +5 -5
- package/dist/assets/{gitStatusPredicates-B3Zxud6E.js → gitStatusPredicates-BzR54iPh.js} +1 -1
- package/dist/assets/{githubLink-CbGYxsIq.js → githubLink-WO5BkC0U.js} +5 -5
- package/dist/assets/{index-D4n3TVp2.js → index-C2ISrmRR.js} +10 -10
- package/dist/assets/index-DgwThEwf.css +1 -0
- package/dist/assets/index-nOAE6UDy.js +1 -0
- package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
- package/dist/assets/main-B4UP1bOp.js +2 -0
- package/dist/assets/main-DxYfmK5D.js +137 -0
- package/dist/assets/{markdown-shiki.worker-DnvH1S1x.js → markdown-shiki.worker-BVA5NZBT.js} +5 -5
- package/dist/assets/markdownCore-DIn2dwA6.js +2 -0
- package/dist/assets/miniChat-CMGH4R_p.js +2 -0
- package/dist/assets/mobile-BJz0lBjK.js +2 -0
- package/dist/assets/{nativeFileSave-BJsGPh58.js → nativeFileSave-Bhafll_7.js} +1 -1
- package/dist/assets/nsis-LY0VT_u5.js +1 -0
- package/dist/assets/permissionStore-zIpxq9Pq.js +1 -0
- package/dist/assets/pi-session-focus-preference-D6vrJGbH.js +9 -0
- package/dist/assets/{registerCustomTheme-DmolaWWZ.js → registerCustomTheme-C-h6lsYW.js} +1 -1
- package/dist/assets/{renderDiffWithHighlighter-BhMEWmHn.js → renderDiffWithHighlighter-JwKOWdBN.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-DYdkuv5N.js +2 -0
- package/dist/assets/{renderFileWithHighlighter-DUGluXlw.js → renderFileWithHighlighter-RJTrDxFH.js} +1 -1
- package/dist/assets/renderMobileApp-x1P9U65-.js +11 -0
- package/dist/assets/ruby-BK5aLJev.js +1 -0
- package/dist/assets/runtimeEndpointReset-OqTh3bbO.js +62 -0
- package/dist/assets/runtimeSurface-CJN1oo_1.js +1 -0
- package/dist/assets/themeResolver-DrfmQi8i.js +1 -0
- package/dist/assets/useAppFontEffects-CHnpTOtc.js +215 -0
- package/dist/assets/useFilesViewSearch-DeVixiGZ.js +7 -0
- package/dist/assets/{useGitHubRemoteSearch-DYoLQ4ro.js → useGitHubRemoteSearch-GjQca1iD.js} +1 -1
- package/dist/assets/{useSwitcherItems-BS6E199F.js → useSwitcherItems-DYtnl0T2.js} +1 -1
- package/dist/assets/vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js +1 -0
- package/dist/assets/vendor-base-ui-C7vVMZTg.js +1 -0
- package/dist/assets/{vendor-beautiful-mermaid-DApbjBp2.js → vendor-beautiful-mermaid-b48gT2g0.js} +1 -1
- package/dist/assets/vendor-boot-CoTxysn6.js +65 -0
- package/dist/assets/{vendor-capacitor-app-BaupizkW.js → vendor-capacitor-app-NX6DULfp.js} +1 -1
- package/dist/assets/{vendor-capacitor-keyboard-9BVxykO7.js → vendor-capacitor-keyboard-DJD81I9f.js} +1 -1
- package/dist/assets/{vendor-capacitor-status-bar-BsrUwiaA.js → vendor-capacitor-status-bar-DV24OoQV.js} +1 -1
- package/dist/assets/vendor-codemirror-autocomplete-qsuH4Dh-.js +1 -0
- package/dist/assets/vendor-codemirror-lang-angular-ZHWyBf7j.js +1 -0
- package/dist/assets/vendor-codemirror-lang-cpp-pCTOmv-k.js +1 -0
- package/dist/assets/vendor-codemirror-lang-css-2bFuyM70.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-go-Crwca_X7.js → vendor-codemirror-lang-go-DrG_c7D7.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-html-BV8lrR8v.js +1 -0
- package/dist/assets/vendor-codemirror-lang-java-DrsvH6T2.js +1 -0
- package/dist/assets/vendor-codemirror-lang-javascript-Dkzl3s07.js +13 -0
- package/dist/assets/vendor-codemirror-lang-jinja-8Nn3bnoP.js +1 -0
- package/dist/assets/vendor-codemirror-lang-json-CsdmtHhi.js +1 -0
- package/dist/assets/vendor-codemirror-lang-less-DJuZ4cZe.js +1 -0
- package/dist/assets/vendor-codemirror-lang-liquid-D2RO-Pzr.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-C0Zu3b3n.js +1 -0
- package/dist/assets/vendor-codemirror-lang-php-CuDtt2Zj.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-Cv2exx_M.js +3 -0
- package/dist/assets/vendor-codemirror-lang-rust-C4TxJ6Rg.js +1 -0
- package/dist/assets/vendor-codemirror-lang-sass-BmtPz8kf.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-B0f-qCZo.js → vendor-codemirror-lang-sql-BF1ZaXqJ.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-vue-DZgXrP2k.js +1 -0
- package/dist/assets/vendor-codemirror-lang-wast-DsnaGtL_.js +1 -0
- package/dist/assets/vendor-codemirror-lang-xml-D8DzzFat.js +1 -0
- package/dist/assets/vendor-codemirror-lang-yaml-D5hBv7m6.js +1 -0
- package/dist/assets/{vendor-codemirror-language-data-CqU7kHmg.js → vendor-codemirror-language-data-vn2RyN9T.js} +2 -2
- package/dist/assets/vendor-codemirror-search-BVCYIV0D.js +2 -0
- package/dist/assets/vendor-dompurify-BGCr_sdL.js +3 -0
- package/dist/assets/vendor-elkjs-D1S1RCAO.js +24 -0
- package/dist/assets/vendor-fuse.js-t_7AcMTv.js +1 -0
- package/dist/assets/{vendor-hast-util-to-html-BKBhbTDb.js → vendor-hast-util-to-html-O3stl53j.js} +1 -1
- package/dist/assets/{vendor-heic2any-pq-UTQQR.js → vendor-heic2any-sztndhZI.js} +1 -1
- package/dist/assets/vendor-lezer-cpp-vqXSn3lv.js +1 -0
- package/dist/assets/vendor-lezer-css-JnEzSyZR.js +1 -0
- package/dist/assets/{vendor-lezer-go-CHIhCNY6.js → vendor-lezer-go-dD2gQMIL.js} +1 -1
- package/dist/assets/{vendor-lezer-html-B3h0MOrG.js → vendor-lezer-html-Cr3U-1pu.js} +1 -1
- package/dist/assets/vendor-lezer-java-CRM0IMCo.js +1 -0
- package/dist/assets/vendor-lezer-javascript-B3s21DIS.js +1 -0
- package/dist/assets/{vendor-lezer-json-BP_UAzLL.js → vendor-lezer-json-DPFM6EBV.js} +1 -1
- package/dist/assets/vendor-lezer-lr-Bllrq8hY.js +1 -0
- package/dist/assets/vendor-lezer-markdown-6-3PLvXG.js +6 -0
- package/dist/assets/vendor-lezer-php-DOyzfHRl.js +1 -0
- package/dist/assets/{vendor-lezer-python-EJ4Im4y2.js → vendor-lezer-python-CdHdN5qt.js} +1 -1
- package/dist/assets/vendor-lezer-rust-CqnW8EMH.js +1 -0
- package/dist/assets/{vendor-lezer-sass-CMi6zfXI.js → vendor-lezer-sass-BbcF4y6A.js} +1 -1
- package/dist/assets/{vendor-lezer-xml-0MHMeZDp.js → vendor-lezer-xml-C31AyWoo.js} +1 -1
- package/dist/assets/{vendor-lezer-yaml-BE2EFjpA.js → vendor-lezer-yaml-Cv908yC2.js} +1 -1
- package/dist/assets/{vendor-lru_map-DOPmc7GU.js → vendor-lru_map-BbiDqlyL.js} +1 -1
- package/dist/assets/vendor-marked-Be78pDn1.js +59 -0
- package/dist/assets/{vendor-oniguruma-parser-C0D4_9rT.js → vendor-oniguruma-parser-BrbMHgHx.js} +1 -1
- package/dist/assets/vendor-oniguruma-to-es-DgwFOwdE.js +94 -0
- package/dist/assets/{vendor-pierre-theming-Dgp7B_O4.js → vendor-pierre-theming-BO6EPniU.js} +1 -1
- package/dist/assets/vendor-property-information-C40bX6nM.js +1 -0
- package/dist/assets/{vendor-qrcode-Dv4uniC1.js → vendor-qrcode-gzL9QFkg.js} +5 -5
- package/dist/assets/vendor-react-Bz1tRBxM.js +1 -0
- package/dist/assets/{vendor-react-drawio-Duu5LgQA.js → vendor-react-drawio-IYnLUY5N.js} +1 -1
- package/dist/assets/vendor-remend-DcBOpbSu.js +24 -0
- package/dist/assets/vendor-replit-codemirror-vim-Cwhyn_5f.js +6 -0
- package/dist/assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js +34 -0
- package/dist/assets/vendor-shiki-BEwTOAFg.js +1 -0
- package/dist/assets/{vendor-shikijs-core-CGM_jqPK.js → vendor-shikijs-core-Ck_OPM_T.js} +1 -1
- package/dist/assets/{vendor-shikijs-engine-javascript-Cme4830A.js → vendor-shikijs-engine-javascript-DL394yyj.js} +1 -1
- package/dist/assets/vendor-shikijs-vscode-textmate-DPFxvYtK.js +3 -0
- package/dist/assets/vendor-tailwind-merge-BKkUfl9q.js +1 -0
- package/dist/assets/vendor-workbox-window-BBnX5xw4.js +2 -0
- package/dist/assets/vendor-zumer-snapdom-SJzqoCHV.js +8 -0
- package/dist/assets/vendor-zustand-CXhN0IMY.js +6 -0
- package/dist/assets/{web-components-DzQ9ybbb.js → web-components-CIPJC1JE.js} +1 -1
- package/dist/assets/worker-CKCfxIfO.js +153 -0
- package/dist/assets/workerFactory-DlGfNFqf.js +1 -0
- package/dist/assets/zig-BB16gwVL.js +1 -0
- package/dist/index.html +8 -8
- package/dist/mini-chat.html +7 -7
- package/dist/mobile.html +7 -7
- package/package.json +54 -53
- package/server/index.js +18 -1
- package/server/lib/client-auth/live-revocation.test.js +4 -0
- package/server/lib/fs/DOCUMENTATION.md +10 -0
- package/server/lib/fs/project-icon.js +243 -0
- package/server/lib/fs/project-icon.test.js +114 -0
- package/server/lib/fs/routes.js +35 -0
- package/server/lib/fs/routes.test.js +74 -0
- package/server/lib/git/DOCUMENTATION.md +2 -1
- package/server/lib/git/routes.js +11 -3
- package/server/lib/git/routes.test.js +80 -0
- package/server/lib/git/service.js +38 -3
- package/server/lib/git/service.test.js +93 -0
- package/server/lib/open-url/DOCUMENTATION.md +35 -0
- package/server/lib/open-url/browser-env.js +199 -0
- package/server/lib/open-url/browser-env.test.js +147 -0
- package/server/lib/open-url/browser-handler.mjs +154 -0
- package/server/lib/open-url/browser-handler.test.js +69 -0
- package/server/lib/open-url/intake.js +187 -0
- package/server/lib/open-url/intake.test.js +75 -0
- package/server/lib/pi/extension-protocol.js +149 -0
- package/server/lib/pi/extension-protocol.test.js +20 -1
- package/server/lib/pi/routes.js +195 -1
- package/server/lib/pi/routes.test.js +129 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +38 -10
- package/server/lib/pi/session-daemon/builtin-extensions.js +14 -4
- package/server/lib/pi/session-daemon/daemon-process.js +13 -0
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +6 -1
- package/server/lib/pi/session-daemon/extension-bridge.js +40 -6
- package/server/lib/pi/session-daemon/extension-custom-host.js +1259 -0
- package/server/lib/pi/session-daemon/extension-custom-host.test.js +759 -0
- package/server/lib/pi/session-daemon/extension-keybindings.js +21 -0
- package/server/lib/pi/session-daemon/extension-keybindings.test.js +37 -0
- package/server/lib/pi/session-daemon/extension-message-render.js +7 -4
- package/server/lib/pi/session-daemon/extension-message-render.test.js +14 -2
- package/server/lib/pi/session-daemon/extension-tool-render.js +7 -0
- package/server/lib/pi/session-daemon/extension-tool-render.test.js +26 -0
- package/server/lib/pi/session-daemon/open-request.js +60 -0
- package/server/lib/pi/session-daemon/open-request.test.js +54 -0
- package/server/lib/pi/session-daemon/prompt-preflight.test.js +134 -0
- package/server/lib/pi/session-daemon/sdk-upgrade.test.js +21 -4
- package/server/lib/pi/session-daemon/session-daemon-bash.e2e.test.js +225 -0
- package/server/lib/pi/session-daemon/session-daemon-directory-catalog.e2e.test.js +156 -0
- package/server/lib/pi/session-daemon/session-daemon-directory-catalog.test.js +381 -0
- package/server/lib/pi/session-daemon/session-daemon-engines.test.js +11 -2
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +30 -4
- package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +20 -0
- package/server/lib/pi/session-daemon/session-daemon-mcp.e2e.test.js +16 -4
- package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +7 -2
- package/server/lib/pi/session-daemon/session-daemon.js +448 -49
- package/server/lib/pi/session-daemon/session-daemon.test.js +91 -4
- package/server/lib/pi/session-daemon/session-engine-router.js +9 -3
- package/server/lib/pi/session-daemon/session-engine-router.test.js +12 -2
- package/server/lib/pi/session-daemon/session-engines.js +7 -2
- package/server/lib/pi/session-daemon/session-jsonl.js +170 -75
- package/server/lib/pi/session-daemon/session-jsonl.test.js +106 -2
- package/server/lib/pi/session-daemon/supervisor.js +4 -0
- package/server/lib/pi/session-daemon/user-bash.js +326 -0
- package/server/lib/pi/session-daemon/user-bash.test.js +371 -0
- package/server/lib/preview/proxy-runtime.js +140 -45
- package/server/lib/preview/proxy-runtime.test.js +174 -3
- package/server/lib/preview/proxy-runtime.websocket.test.js +89 -0
- package/server/lib/relay/tunnel-host.js +1 -0
- package/server/lib/security/request-security.js +37 -0
- package/server/lib/security/request-security.test.js +54 -0
- package/server/lib/security/server-network-host.js +107 -0
- package/server/lib/security/server-network-host.test.js +70 -0
- package/server/lib/server-browser/DOCUMENTATION.md +243 -0
- package/server/lib/server-browser/browser-tab.js +524 -0
- package/server/lib/server-browser/chrome-executable.js +138 -0
- package/server/lib/server-browser/chrome-launch.js +138 -0
- package/server/lib/server-browser/dev-servers.js +288 -0
- package/server/lib/server-browser/dev-servers.test.js +152 -0
- package/server/lib/server-browser/downloads.js +75 -0
- package/server/lib/server-browser/frame-policy.js +183 -0
- package/server/lib/server-browser/frame-policy.test.js +98 -0
- package/server/lib/server-browser/network-guard.js +235 -0
- package/server/lib/server-browser/page-scripts.js +209 -0
- package/server/lib/server-browser/runtime.integration.test.js +474 -0
- package/server/lib/server-browser/runtime.js +300 -0
- package/server/lib/server-browser/runtime.test.js +50 -0
- package/server/lib/server-browser/server-browser.js +431 -0
- package/server/lib/server-browser/server-browser.test.js +975 -0
- package/server/lib/server-browser/tab-input.js +241 -0
- package/server/lib/server-browser/tab-prompts.js +125 -0
- package/server/lib/server-browser/tab-stream.js +252 -0
- package/server/lib/server-browser/uploads.js +98 -0
- package/server/lib/stt/runtime.js +4 -1
- package/server/lib/stt/runtime.test.js +43 -0
- package/server/lib/terminal/runtime.js +4 -1
- package/server/lib/terminal/runtime.test.js +41 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +29 -1
- package/server/lib/ui-auth/ui-auth.js +1 -0
- package/server/lib/ui-auth/ui-auth.test.js +9 -1
- package/server/lib/workspace/host.js +20 -3
- package/dist/assets/DiffView-CSonR3pr.js +0 -18
- package/dist/assets/FileSaveConflictDialog-Cun0LIbj.js +0 -3
- package/dist/assets/PullRequestsSurface-CfaOpeZn.js +0 -2
- package/dist/assets/SessionSwitcherDropdown-BSutduo7.js +0 -2
- package/dist/assets/SessionUnreadDot-Dav_rix1.js +0 -1
- package/dist/assets/SettingsView-CQJkOPJh.js +0 -6
- package/dist/assets/abap-BdImnpbu.js +0 -1
- package/dist/assets/actionscript-3-CoDkCxhg.js +0 -1
- package/dist/assets/ada-bCR0ucgS.js +0 -1
- package/dist/assets/angular-html-CU67Zn6k.js +0 -1
- package/dist/assets/angular-ts-BwZT4LLn.js +0 -1
- package/dist/assets/apache-Pmp26Uib.js +0 -1
- package/dist/assets/apex-D8_7TLub.js +0 -1
- package/dist/assets/apl-dKokRX4l.js +0 -1
- package/dist/assets/applescript-Co6uUVPk.js +0 -1
- package/dist/assets/ara-BRHolxvo.js +0 -1
- package/dist/assets/asciidoc-Ve4PFQV2.js +0 -1
- package/dist/assets/asm-D_Q5rh1f.js +0 -1
- package/dist/assets/astro-CbQHKStN.js +0 -1
- package/dist/assets/awk-DMzUqQB5.js +0 -1
- package/dist/assets/ballerina-BFfxhgS-.js +0 -1
- package/dist/assets/bat-BkioyH1T.js +0 -1
- package/dist/assets/beancount-k_qm7-4y.js +0 -1
- package/dist/assets/berry-uYugtg8r.js +0 -1
- package/dist/assets/bibtex-CHM0blh-.js +0 -1
- package/dist/assets/bicep-Bmn6On1c.js +0 -1
- package/dist/assets/bird2-DPOp833l.js +0 -1
- package/dist/assets/blade-D4QpJJKB.js +0 -1
- package/dist/assets/bsl-BO_Y6i37.js +0 -1
- package/dist/assets/c-BIGW1oBm.js +0 -1
- package/dist/assets/c3-eo99z4R2.js +0 -1
- package/dist/assets/cadence-Bv_4Rxtq.js +0 -1
- package/dist/assets/cairo-KRGpt6FW.js +0 -1
- package/dist/assets/clarity-D53aC0YG.js +0 -1
- package/dist/assets/clojure-P80f7IUj.js +0 -1
- package/dist/assets/cmake-D1j8_8rp.js +0 -1
- package/dist/assets/cobol-nwyudZeR.js +0 -1
- package/dist/assets/codeowners-Bp6g37R7.js +0 -1
- package/dist/assets/codeql-DsOJ9woJ.js +0 -1
- package/dist/assets/coffee-Ch7k5sss.js +0 -1
- package/dist/assets/common-lisp-Cg-RD9OK.js +0 -1
- package/dist/assets/coq-DkFqJrB1.js +0 -1
- package/dist/assets/cpp-CofmeUqb.js +0 -1
- package/dist/assets/crystal-tKQVLTB8.js +0 -1
- package/dist/assets/csharp-COcwbKMJ.js +0 -1
- package/dist/assets/css-DPfMkruS.js +0 -1
- package/dist/assets/csv-fuZLfV_i.js +0 -1
- package/dist/assets/cue-D82EKSYY.js +0 -1
- package/dist/assets/cypher-COkxafJQ.js +0 -1
- package/dist/assets/d-85-TOEBH.js +0 -1
- package/dist/assets/dart-CF10PKvl.js +0 -1
- package/dist/assets/dax-CEL-wOlO.js +0 -1
- package/dist/assets/desktop-BmXAJ9_W.js +0 -1
- package/dist/assets/diff-D97Zzqfu.js +0 -1
- package/dist/assets/docker-BcOcwvcX.js +0 -1
- package/dist/assets/dotenv-Da5cRb03.js +0 -1
- package/dist/assets/dream-maker-BtqSS_iP.js +0 -1
- package/dist/assets/edge-BkV0erSs.js +0 -1
- package/dist/assets/elixir-CDX3lj18.js +0 -1
- package/dist/assets/elm-DbKCFpqz.js +0 -1
- package/dist/assets/emacs-lisp-C9XAeP06.js +0 -1
- package/dist/assets/erb-B12qg9BL.js +0 -1
- package/dist/assets/erlang-DsQrWhSR.js +0 -1
- package/dist/assets/fennel-BYunw83y.js +0 -1
- package/dist/assets/fish-BvzEVeQv.js +0 -1
- package/dist/assets/fluent-C4IJs8-o.js +0 -1
- package/dist/assets/fortran-fixed-form-CkoXwp7k.js +0 -1
- package/dist/assets/fortran-free-form-BxgE0vQu.js +0 -1
- package/dist/assets/fsharp-CXgrBDvD.js +0 -1
- package/dist/assets/gdresource-BOOCDP_w.js +0 -1
- package/dist/assets/gdscript-C5YyOfLZ.js +0 -1
- package/dist/assets/gdshader-DkwncUOv.js +0 -1
- package/dist/assets/genie-D0YGMca9.js +0 -1
- package/dist/assets/gherkin-DyxjwDmM.js +0 -1
- package/dist/assets/git-commit-F4YmCXRG.js +0 -1
- package/dist/assets/git-rebase-r7XF79zn.js +0 -1
- package/dist/assets/gleam-BspZqrRM.js +0 -1
- package/dist/assets/glimmer-js-Rg0-pVw9.js +0 -1
- package/dist/assets/glimmer-ts-U6CK756n.js +0 -1
- package/dist/assets/glsl-DplSGwfg.js +0 -1
- package/dist/assets/gn-n2N0HUVH.js +0 -1
- package/dist/assets/gnuplot-DdkO51Og.js +0 -1
- package/dist/assets/go-CxLEBnE3.js +0 -1
- package/dist/assets/graphql-ChdNCCLP.js +0 -1
- package/dist/assets/groovy-gcz8RCvz.js +0 -1
- package/dist/assets/hack-CaT9iCJl.js +0 -1
- package/dist/assets/haml-B8DHNrY2.js +0 -1
- package/dist/assets/handlebars-BL8al0AC.js +0 -1
- package/dist/assets/haskell-Df6bDoY_.js +0 -1
- package/dist/assets/haxe-CzTSHFRz.js +0 -1
- package/dist/assets/hcl-BWvSN4gD.js +0 -1
- package/dist/assets/hjson-D5-asLiD.js +0 -1
- package/dist/assets/hlsl-D3lLCCz7.js +0 -1
- package/dist/assets/html-GMplVEZG.js +0 -1
- package/dist/assets/html-derivative-BFtXZ54Q.js +0 -1
- package/dist/assets/http-jrhK8wxY.js +0 -1
- package/dist/assets/hurl-irOxFIW8.js +0 -1
- package/dist/assets/hxml-Bvhsp5Yf.js +0 -1
- package/dist/assets/hy-DFXneXwc.js +0 -1
- package/dist/assets/imba-DGztddWO.js +0 -1
- package/dist/assets/index-B0h6_x5N.js +0 -1
- package/dist/assets/index-BwoW_-vk.css +0 -1
- package/dist/assets/ini-BEwlwnbL.js +0 -1
- package/dist/assets/java-CylS5w8V.js +0 -1
- package/dist/assets/javascript-wDzz0qaB.js +0 -1
- package/dist/assets/jinja-4LBKfQ-Z.js +0 -1
- package/dist/assets/jison-wvAkD_A8.js +0 -1
- package/dist/assets/json-Cp-IABpG.js +0 -1
- package/dist/assets/json5-C9tS-k6U.js +0 -1
- package/dist/assets/jsonc-Des-eS-w.js +0 -1
- package/dist/assets/jsonl-DcaNXYhu.js +0 -1
- package/dist/assets/jsonnet-DFQXde-d.js +0 -1
- package/dist/assets/jssm-C2t-YnRu.js +0 -1
- package/dist/assets/jsx-g9-lgVsj.js +0 -1
- package/dist/assets/julia-CxzCAyBv.js +0 -1
- package/dist/assets/just-Cw27pwNe.js +0 -1
- package/dist/assets/kdl-DV7GczEv.js +0 -1
- package/dist/assets/kotlin-BdnUsdx6.js +0 -1
- package/dist/assets/kusto-DZf3V79B.js +0 -1
- package/dist/assets/latex-CWtU0Tv5.js +0 -1
- package/dist/assets/lean-BZvkOJ9d.js +0 -1
- package/dist/assets/less-B1dDrJ26.js +0 -1
- package/dist/assets/liquid-DYVedYrR.js +0 -1
- package/dist/assets/llvm-DjAJT7YJ.js +0 -1
- package/dist/assets/log-2UxHyX5q.js +0 -1
- package/dist/assets/logo-BtOb2qkB.js +0 -1
- package/dist/assets/lua-BaeVxFsk.js +0 -1
- package/dist/assets/luau-C-HG3fhB.js +0 -1
- package/dist/assets/main-C6i4ph9N.js +0 -2
- package/dist/assets/main-r5elIPBi.js +0 -136
- package/dist/assets/make-CHLpvVh8.js +0 -1
- package/dist/assets/markdown-Cvjx9yec.js +0 -1
- package/dist/assets/markdownCore-C2YQ3Z0q.js +0 -2
- package/dist/assets/marko-CnJfTvn9.js +0 -1
- package/dist/assets/matlab-D7o27uSR.js +0 -1
- package/dist/assets/mdc-BMNejdWA.js +0 -1
- package/dist/assets/mdx-Cmh6b_Ma.js +0 -1
- package/dist/assets/mermaid-mWjccvbQ.js +0 -1
- package/dist/assets/miniChat-d_GCHoIf.js +0 -2
- package/dist/assets/mipsasm-CKIfxQSi.js +0 -1
- package/dist/assets/mobile-BJ3tgyKd.js +0 -2
- package/dist/assets/mojo-rZm6bMo-.js +0 -1
- package/dist/assets/moonbit-_H4v1dQx.js +0 -1
- package/dist/assets/move-IF9eRakj.js +0 -1
- package/dist/assets/narrat-DRg8JJMk.js +0 -1
- package/dist/assets/nextflow-Zz6hmt5N.js +0 -1
- package/dist/assets/nextflow-groovy-BeH2EWoN.js +0 -1
- package/dist/assets/nginx-BpAMiNFr.js +0 -1
- package/dist/assets/nim-CVrawwO9.js +0 -1
- package/dist/assets/nix-CwoSXNpI.js +0 -1
- package/dist/assets/nsis-LdVXkNf5.js +0 -1
- package/dist/assets/nushell-Cz2AlsmD.js +0 -1
- package/dist/assets/objective-c-DXmwc3jG.js +0 -1
- package/dist/assets/objective-cpp-CLxacb5B.js +0 -1
- package/dist/assets/ocaml-C0hk2d4L.js +0 -1
- package/dist/assets/odin-BBf5iR-q.js +0 -1
- package/dist/assets/openscad-C4EeE6gA.js +0 -1
- package/dist/assets/pascal-D93ZcfNL.js +0 -1
- package/dist/assets/perl-C0TMdlhV.js +0 -1
- package/dist/assets/permissionStore-B9Hkrqny.js +0 -1
- package/dist/assets/php-Dhbhpdrm.js +0 -1
- package/dist/assets/pi-session-focus-preference-BFnGFuvP.js +0 -9
- package/dist/assets/pkl-u5AG7uiY.js +0 -1
- package/dist/assets/plsql-ChMvpjG-.js +0 -1
- package/dist/assets/po-BTJTHyun.js +0 -1
- package/dist/assets/polar-C0HS_06l.js +0 -1
- package/dist/assets/postcss-CXtECtnM.js +0 -1
- package/dist/assets/powerquery-CEu0bR-o.js +0 -1
- package/dist/assets/powershell-Dpen1YoG.js +0 -1
- package/dist/assets/prisma-Dd19v3D-.js +0 -1
- package/dist/assets/prolog-CbFg5uaA.js +0 -1
- package/dist/assets/proto-C7zT0LnQ.js +0 -1
- package/dist/assets/pug-CGlum2m_.js +0 -1
- package/dist/assets/puppet-BMWR74SV.js +0 -1
- package/dist/assets/purescript-CklMAg4u.js +0 -1
- package/dist/assets/python-B6aJPvgy.js +0 -1
- package/dist/assets/qml-3beO22l8.js +0 -1
- package/dist/assets/qmldir-C8lEn-DE.js +0 -1
- package/dist/assets/qss-IeuSbFQv.js +0 -1
- package/dist/assets/r-Dspwwk_N.js +0 -1
- package/dist/assets/racket-BqYA7rlc.js +0 -1
- package/dist/assets/raku-DXvB9xmW.js +0 -1
- package/dist/assets/razor-Uh8Bk_45.js +0 -1
- package/dist/assets/reg-C-SQnVFl.js +0 -1
- package/dist/assets/regexp-CDVJQ6XC.js +0 -1
- package/dist/assets/rel-C3B-1QV4.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-Bap5OwgB.js +0 -2
- package/dist/assets/renderMobileApp-DJbslvby.js +0 -11
- package/dist/assets/riscv-BM1_JUlF.js +0 -1
- package/dist/assets/ron-D8l8udqQ.js +0 -1
- package/dist/assets/rosmsg-BJDFO7_C.js +0 -1
- package/dist/assets/rst-BrH8l1NY.js +0 -1
- package/dist/assets/ruby-B2Rjki9n.js +0 -1
- package/dist/assets/ruby-Dw2BHqvy.js +0 -1
- package/dist/assets/runtimeEndpointReset-D22U_Vjs.js +0 -62
- package/dist/assets/runtimeSurface-k1Eit61v.js +0 -1
- package/dist/assets/rust-B1yitclQ.js +0 -1
- package/dist/assets/sas-cz2c8ADy.js +0 -1
- package/dist/assets/sass-Cj5Yp3dK.js +0 -1
- package/dist/assets/scala-C151Ov-r.js +0 -1
- package/dist/assets/scheme-C98Dy4si.js +0 -1
- package/dist/assets/scss-OYdSNvt2.js +0 -1
- package/dist/assets/sdbl-DVxCFoDh.js +0 -1
- package/dist/assets/shaderlab-Dg9Lc6iA.js +0 -1
- package/dist/assets/shellscript-Yzrsuije.js +0 -1
- package/dist/assets/shellsession-BADoaaVG.js +0 -1
- package/dist/assets/smalltalk-BERRCDM3.js +0 -1
- package/dist/assets/solidity-rGO070M0.js +0 -1
- package/dist/assets/soy-Brmx7dQM.js +0 -1
- package/dist/assets/sparql-rVzFXLq3.js +0 -1
- package/dist/assets/splunk-BtCnVYZw.js +0 -1
- package/dist/assets/sql-BLtJtn59.js +0 -1
- package/dist/assets/ssh-config-_ykCGR6B.js +0 -1
- package/dist/assets/stata-BH5u7GGu.js +0 -1
- package/dist/assets/stylus-BEDo0Tqx.js +0 -1
- package/dist/assets/surrealql-Bq5Q-fJD.js +0 -1
- package/dist/assets/svelte-C_ipcX3V.js +0 -1
- package/dist/assets/swift-D82vCrfD.js +0 -1
- package/dist/assets/system-verilog-CnnmHF94.js +0 -1
- package/dist/assets/systemd-4A_iFExJ.js +0 -1
- package/dist/assets/talonscript-CkByrt1z.js +0 -1
- package/dist/assets/tasl-QIJgUcNo.js +0 -1
- package/dist/assets/tcl-dwOrl1Do.js +0 -1
- package/dist/assets/templ-P3uqSqPl.js +0 -1
- package/dist/assets/terraform-BETggiCN.js +0 -1
- package/dist/assets/tex-idrVyKtj.js +0 -1
- package/dist/assets/themeResolver-yJ9XpNMI.js +0 -1
- package/dist/assets/toml-vGWfd6FD.js +0 -1
- package/dist/assets/ts-tags-zn1MmPIZ.js +0 -1
- package/dist/assets/tsv-B_m7g4N7.js +0 -1
- package/dist/assets/tsx-COt5Ahok.js +0 -1
- package/dist/assets/turtle-BsS91CYL.js +0 -1
- package/dist/assets/twig-DNn4PbVi.js +0 -1
- package/dist/assets/typescript-BPQ3VLAy.js +0 -1
- package/dist/assets/typespec-BGHnOYBU.js +0 -1
- package/dist/assets/typst-DHCkPAjA.js +0 -1
- package/dist/assets/useAppFontEffects-CqHhRKmN.js +0 -212
- package/dist/assets/useFilesViewSearch-CqoYEK0U.js +0 -7
- package/dist/assets/v-BcVCzyr7.js +0 -1
- package/dist/assets/vala-CsfeWuGM.js +0 -1
- package/dist/assets/vb-D17OF-Vu.js +0 -1
- package/dist/assets/vendor-aparajita-capacitor-secure-storage-BDrMx_CE.js +0 -1
- package/dist/assets/vendor-base-ui-CKRUCG-f.js +0 -1
- package/dist/assets/vendor-boot-EC6IyLt1.js +0 -69
- package/dist/assets/vendor-codemirror-autocomplete-CGpAsPWp.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-CDJoHJSY.js +0 -1
- package/dist/assets/vendor-codemirror-lang-cpp-BmHofQls.js +0 -1
- package/dist/assets/vendor-codemirror-lang-css-RM2HqXZ0.js +0 -1
- package/dist/assets/vendor-codemirror-lang-html-CHSHUpwq.js +0 -1
- package/dist/assets/vendor-codemirror-lang-java-lhQXgWu0.js +0 -1
- package/dist/assets/vendor-codemirror-lang-javascript-Dw4kFO4e.js +0 -13
- package/dist/assets/vendor-codemirror-lang-jinja-_pAC3UTN.js +0 -1
- package/dist/assets/vendor-codemirror-lang-json-B-b1vAv-.js +0 -1
- package/dist/assets/vendor-codemirror-lang-less-xIgOi1ze.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-CP49m5dB.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-BTht2ATe.js +0 -1
- package/dist/assets/vendor-codemirror-lang-php-BguZDhaO.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-CH6_em9L.js +0 -3
- package/dist/assets/vendor-codemirror-lang-rust-EG_DtGyi.js +0 -1
- package/dist/assets/vendor-codemirror-lang-sass-BknY5Qpo.js +0 -1
- package/dist/assets/vendor-codemirror-lang-vue-CyGn9snv.js +0 -1
- package/dist/assets/vendor-codemirror-lang-wast-CsFfSyyB.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-Cdan_Jp1.js +0 -1
- package/dist/assets/vendor-codemirror-lang-yaml-COI5hck8.js +0 -1
- package/dist/assets/vendor-codemirror-search-DUfSCF9S.js +0 -2
- package/dist/assets/vendor-dompurify-r8glNMJW.js +0 -2
- package/dist/assets/vendor-elkjs-D27273Ms.js +0 -24
- package/dist/assets/vendor-fuse.js-Dw8P0qyA.js +0 -1
- package/dist/assets/vendor-lezer-cpp-DMZOJzBa.js +0 -1
- package/dist/assets/vendor-lezer-css-DUkkbMp7.js +0 -1
- package/dist/assets/vendor-lezer-java-tMazV_6X.js +0 -1
- package/dist/assets/vendor-lezer-javascript-ctwLWf4v.js +0 -1
- package/dist/assets/vendor-lezer-lr-B8TQctNw.js +0 -1
- package/dist/assets/vendor-lezer-markdown-aGLZf_3h.js +0 -6
- package/dist/assets/vendor-lezer-php-D5zCNzlt.js +0 -1
- package/dist/assets/vendor-lezer-rust-DO5c7OtA.js +0 -1
- package/dist/assets/vendor-marked-CX41MkDF.js +0 -59
- package/dist/assets/vendor-oniguruma-to-es-DLBnFDCE.js +0 -94
- package/dist/assets/vendor-property-information-rJCbAzvX.js +0 -1
- package/dist/assets/vendor-react-DASdDPIk.js +0 -1
- package/dist/assets/vendor-remend-BWYYytN3.js +0 -22
- package/dist/assets/vendor-replit-codemirror-vim-AnOuN8yJ.js +0 -39
- package/dist/assets/vendor-shiki-Bbf2GEcE.js +0 -2
- package/dist/assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js +0 -3
- package/dist/assets/vendor-tailwind-merge-CPcsbTWB.js +0 -1
- package/dist/assets/vendor-workbox-window-BIl4cyR9.js +0 -2
- package/dist/assets/vendor-zumer-snapdom-Btyu_Xi2.js +0 -8
- package/dist/assets/vendor-zustand-CUi8eEds.js +0 -6
- package/dist/assets/verilog-BQ8w6xss.js +0 -1
- package/dist/assets/vhdl-CeAyd5Ju.js +0 -1
- package/dist/assets/viml-CJc9bBzg.js +0 -1
- package/dist/assets/vue-DN_0RTcg.js +0 -1
- package/dist/assets/vue-html-AaS7Mt5G.js +0 -1
- package/dist/assets/vue-vine-CQOfvN7w.js +0 -1
- package/dist/assets/vyper-CDx5xZoG.js +0 -1
- package/dist/assets/wasm-MzD3tlZU.js +0 -1
- package/dist/assets/wenyan-BV7otONQ.js +0 -1
- package/dist/assets/wgsl-Dx-B1_4e.js +0 -1
- package/dist/assets/wikitext-BhOHFoWU.js +0 -1
- package/dist/assets/wit-5i3qLPDT.js +0 -1
- package/dist/assets/wolfram-lXgVvXCa.js +0 -1
- package/dist/assets/worker-BBk7yuNN.js +0 -153
- package/dist/assets/workerFactory-tw7cIdmV.js +0 -1
- package/dist/assets/xml-sdJ4AIDG.js +0 -1
- package/dist/assets/xsl-CtQFsRM5.js +0 -1
- package/dist/assets/yaml-Buea-lGh.js +0 -1
- package/dist/assets/zenscript-DVFEvuxE.js +0 -1
- package/dist/assets/zig-VOosw3JB.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as E}from"./vendor-vite-runtime-DD1OZmLC.js";import{g as v,D as $}from"./vendor-marked-Be78pDn1.js";import{p}from"./vendor-dompurify-BGCr_sdL.js";import{dp as O,dq as C,dr as I}from"./useAppFontEffects-CHnpTOtc.js";import{O as P}from"./vendor-remend-DcBOpbSu.js";const R=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),x=["script","style"],A=e=>v.lexer(e),D=e=>/^\[[^\]]+\]:\s+\S+/m.test(e)||/^\[\^[^\]]+\]:\s+/m.test(e),H=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
|
+
`).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"&&H(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}lex;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,D(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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");let k=null;const W=()=>(k||(k=E(()=>import("./vendor-katex-DZG0Ov6p.js"),[]).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(O(r))return`<span data-pichamber-agent-mention="true" class="text-primary">${n}</span>`;const a=C(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]});v.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(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/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 z=!1;const ne=()=>{z||typeof window>"u"||!p.isSupported||(z=!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)},M=(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 M(o,l),{id:c,html:l.html,mode:s.mode,raw:s.raw};const d=await oe(s);return M(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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderElectronMiniChatApp-DYdkuv5N.js","assets/vendor-boot-CoTxysn6.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/index-C2ISrmRR.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-DgwThEwf.css","assets/pi-session-focus-preference-D6vrJGbH.js","assets/useAppFontEffects-CHnpTOtc.js","assets/runtimeSurface-CJN1oo_1.js","assets/nativeFileSave-Bhafll_7.js","assets/vendor-katex-css-Cp579UoJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as o}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as t}from"./index-C2ISrmRR.js";/* empty css */import"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";window.__PICHAMBER_RUNTIME_APIS__=t();o(async()=>{const{renderElectronMiniChatApp:r}=await import("./renderElectronMiniChatApp-DYdkuv5N.js");return{renderElectronMiniChatApp:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(({renderElectronMiniChatApp:r})=>{r()});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-x1P9U65-.js","assets/vendor-boot-CoTxysn6.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/index-C2ISrmRR.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-DgwThEwf.css","assets/pi-session-focus-preference-D6vrJGbH.js","assets/useAppFontEffects-CHnpTOtc.js","assets/runtimeSurface-CJN1oo_1.js","assets/nativeFileSave-Bhafll_7.js","assets/runtimeEndpointReset-OqTh3bbO.js","assets/SessionUnreadDot-BZy2DM6H.js","assets/permissionStore-zIpxq9Pq.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-xterm-xterm-css-DDGTF8rc.css","assets/SettingsView-TwUy1kXV.js","assets/vendor-qrcode-gzL9QFkg.js","assets/vendor-dijkstrajs-COg3n3zL.js","assets/vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js","assets/collapsible-0yfy07W2.js","assets/vendor-base-ui-C7vVMZTg.js","assets/useSwitcherItems-DYtnl0T2.js","assets/vendor-katex-css-Cp579UoJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as o}from"./vendor-vite-runtime-DD1OZmLC.js";import{c as i}from"./index-C2ISrmRR.js";/* empty css */import"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";window.__PICHAMBER_RUNTIME_APIS__=i();o(async()=>{const{renderMobileApp:r}=await import("./renderMobileApp-x1P9U65-.js");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])).then(({renderMobileApp:r})=>{r()});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l}from"./vendor-boot-
|
|
1
|
+
import{r as l}from"./vendor-boot-CoTxysn6.js";import{d as a}from"./index-C2ISrmRR.js";import"./vendor-react-Bz1tRBxM.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";const c=l("PiChamberFiles");function f(t){return t instanceof Error&&(t.name==="AbortError"||t.message.includes("AbortError")||t.message.toLowerCase().includes("cancel"))}const s=async t=>{const e=new Uint8Array(await t.arrayBuffer()),n=32768;let r="";for(let o=0;o<e.length;o+=n)r+=String.fromCharCode(...e.subarray(o,o+n));return btoa(r)},u=async(t,e)=>{if(typeof t=="string"){if(t.startsWith("data:")){const r=t.indexOf(",");if(r!==-1&&t.slice(0,r).includes(";base64"))return t.slice(r+1)}const n=new Blob([t],{type:e??"text/plain;charset=utf-8"});return s(n)}return s(t)},p=async(t,e,n)=>{if(t instanceof File)return t;if(t instanceof Blob)return new File([t],e,{type:n||t.type||"application/octet-stream"});if(typeof t=="string"&&t.startsWith("data:")){const r=await(await fetch(t)).blob();return new File([r],e,{type:n||r.type||"application/octet-stream"})}return new File([t],e,{type:n??"text/plain;charset=utf-8"})},b=(t,e,n)=>{if(typeof document>"u")return;const r=typeof e=="string"&&e.startsWith("data:"),o=r?e:URL.createObjectURL(e instanceof Blob?e:new Blob([e],{type:n||"application/octet-stream"})),i=document.createElement("a");i.href=o,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),r||URL.revokeObjectURL(o)};async function C({filename:t,mimeType:e,data:n}){const r=a();if(r==="android"){const o=await u(n,e);return await c.share({filename:t,mimeType:e,base64:o}),"shared"}if(r==="ios"&&typeof navigator<"u"&&typeof navigator.share=="function"){const o=await p(n,t,e);if(typeof navigator.canShare=="function"&&navigator.canShare({files:[o]}))try{return await navigator.share({files:[o]}),"shared"}catch(i){if(f(i))return"cancelled";throw i}}return b(t,n,e),"downloaded"}async function F(t){if(a()==="android")try{await c.setWebViewBackground({color:t})}catch{}}export{f as isShareCancelledError,C as saveOrShareFile,F as setNativeWebViewBackground};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e}from"./simple-mode-GW_nhZxv.js";const n=e({start:[{regex:/(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/,token:"number"},{regex:/"(?:[^\\"]|\\.)*"?/,token:"string"},{regex:/'(?:[^\\']|\\.)*'?/,token:"string"},{regex:/`(?:[^\\`]|\\.)*`?/,token:"string"},{regex:/^\s*(?:\!(addincludedir|addplugindir|appendfile|appendmemfile|assert|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|macroundef|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i,token:"keyword"},{regex:/^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i,token:"keyword",indent:!0},{regex:/^\s*(?:\!(else|endif|macroend))\b/i,token:"keyword",dedent:!0},{regex:/^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetRegView|GetShellVarContext|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfAltRegView|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestAppendCustomString|ManifestDisableWindowFiltering|ManifestDPIAware|ManifestDPIAwareness|ManifestGdiScaling|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadMemory|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionInstType|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressionLevel|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UnsafeStrCpy|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/i,token:"keyword"},{regex:/^\s*(?:Function|PageEx|Section(?:Group)?)\b/i,token:"keyword",indent:!0},{regex:/^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/i,token:"keyword",dedent:!0},{regex:/\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOW|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/i,token:"atom"},{regex:/\b(?:admin|all|amd64-unicode|auto|both|bottom|bzip2|components|current|custom|default|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|Win8\.1|WinVista|x86-(ansi|unicode)|zlib)\b/i,token:"builtin"},{regex:/\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:2|3|4|5|Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i,token:"variable-2",indent:!0},{regex:/\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i,token:"variable-2",dedent:!0},{regex:/\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/i,token:"variable-2",dedent:!0},{regex:/\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/i,token:"variable-2",dedent:!0},{regex:/\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|8\.1|10|11|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/i,token:"variable",dedent:!0},{regex:/\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/i,token:"keyword",dedent:!0},{regex:/\$\{(?:RunningX64)\}/i,token:"variable",dedent:!0},{regex:/\$\{(?:Disable|Enable)X64FSRedirection\}/i,token:"keyword",dedent:!0},{regex:/(#|;).*/,token:"comment"},{regex:/\/\*/,token:"comment",next:"comment"},{regex:/[-+\/*=<>!]+/,token:"operator"},{regex:/\$\w[\w\.]*/,token:"variable"},{regex:/\${[\!\w\.:-]+}/,token:"variableName.constant"},{regex:/\$\([\!\w\.:-]+\)/,token:"atom"}],comment:[{regex:/.*?\*\//,token:"comment",next:"start"},{regex:/.*/,token:"comment"}],languageData:{name:"nsis",indentOnInput:/^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/i,commentTokens:{line:"#",block:{open:"/*",close:"*/"}}}});export{n as nsis};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./vendor-zustand-CXhN0IMY.js";import"./vendor-react-Bz1tRBxM.js";const n=e(()=>({requests:[],reply:async()=>{},isSessionAutoAccepting:s=>!1,setSessionAutoAccept:async(s,o)=>{},reset:()=>{}}));export{n as usePermissionStore};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{h as R,af as D,ag as O,g as M,ah as j,ai as U,aj as H,ak as Y,al as W,a as z,am as K,an as b,ao as J,ap as q}from"./useAppFontEffects-CHnpTOtc.js";import{w as V,u as A,x as Z,b as Q,v as k,y as X,z as ee,S as se,q as B}from"./index-C2ISrmRR.js";const te=[];function L(){return[...te].reverse()}const oe={getLastAssistantMessage(){if(!R.getState().currentSessionId)return console.log("[ERROR] No active session"),null;const s=b();if(!s||s.length===0)return console.log("[ERROR] No messages in current session"),null;for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.role==="assistant"){const c=(D(n.id)||[]).map(i=>{const u={id:i.id,type:i.type};return i.type==="text"?(u.text=i.text,u.textLength=i.text?.length||0):i.type==="tool"?(u.tool=i.tool,u.state=i.state?.status):(i.type==="step-start"||i.type==="step-finish")&&(u.isStepMarker=!0),u}),m=c.some(i=>i.type==="text"&&i.text&&i.text.trim().length>0),a=c.some(i=>i.type==="tool"),g=c.some(i=>i.type==="step-start"||i.type==="step-finish"),p=c.length===0,S=!m&&!a&&(!p||g),r={messageId:n.id,role:n.role,timestamp:n.time?.created||0,partsCount:c.length,parts:c,isEmpty:p,isEmptyResponse:S,raw:n};return console.log("[INSPECT] Last Assistant Message:",r),console.log("[SUMMARY] Summary:",{messageId:r.messageId,partsCount:r.partsCount,isEmpty:r.isEmpty,isEmptyResponse:r.isEmptyResponse,hasText:m,hasTools:a,hasStepMarkers:g,onlyStepMarkers:g&&!m&&!a}),r.isEmpty&&console.warn("[WARNING] Message has NO parts!"),r.isEmptyResponse&&(console.warn("[WARNING] Message has parts but NO meaningful content (empty text, no tools)!"),g&&!m&&!a&&(console.warn("[CRITICAL] CLAUDE EMPTY RESPONSE BUG: Only step-start/step-finish markers, no actual content!"),console.log("This is a known issue with Claude models (anthropic provider)"),console.log("Recommendation: Send a follow-up message or try a different model"))),r}}return console.log("[ERROR] No assistant messages found in current session"),null},truncateString(e,o=80){return!e||typeof e!="string"||e.length<=o?e:e.substring(0,o)+"…"},truncateMessages(e){return e.map(o=>({...o,parts:(D(o.id)||[]).map(s=>{const t={...s};return"text"in s&&(t.text=this.truncateString(s.text)),"textPreview"in s&&(t.textPreview=this.truncateString(s.textPreview)),s.state&&(t.state={...s.state},"output"in s.state&&(t.state.output=this.truncateString(s.state.output)),"error"in s.state&&(t.state.error=this.truncateString(s.state.error)),s.state.metadata&&"preview"in s.state.metadata&&(t.state.metadata={...s.state.metadata,preview:this.truncateString(s.state.metadata.preview)})),t})}))},getAllMessages(e=!1){if(!R.getState().currentSessionId)return console.log("[ERROR] No active session"),[];const t=b();return console.log(`[MESSAGES] Total messages in session: ${t.length}`),t.forEach((n,d)=>{const c=D(n.id)||[];console.log(`[${d}] ${n.role} - ${n.id} - ${c.length} parts`)}),e?this.truncateMessages(t):t},async getAppStatus(){const e=A.getState(),o=R.getState(),s=z.getState(),t=e.currentDirectory||null,n=M().getState(),d=n.directory??null,c=K(),m=new Set,a={};c.forEach(l=>{const y=l.directory;typeof y=="string"&&y.trim().length>0?(m.add(y),a[y]=(a[y]??0)+1):a["(none)"]=(a["(none)"]??0)+1});const g=(()=>{if(typeof window>"u")return{available:!1};try{return{available:!0,lastDirectory:window.localStorage.getItem("lastDirectory"),homeDirectory:window.localStorage.getItem("homeDirectory")}}catch(l){return{available:!1,error:l instanceof Error?l.message:String(l)}}})(),p=k(),S=typeof window<"u"&&!!window.__PICHAMBER_ELECTRON__,r=async l=>{try{return await l.json()}catch{return null}},u=await(async l=>{try{const y=await ee(l);return y.ok?await r(y):{status:y.status}}catch(y){return{error:y instanceof Error?y.message:String(y)}}})("/api/pi/ui-settings");let I=null;try{I=await Z.health({runtimeKey:Q()})}catch(l){I={error:l instanceof Error?l.message:String(l)}}let w={isGitRepo:null};if(t)try{const l=k()?.git.checkIsGitRepository??X;w.isGitRepo=await l(t)}catch(l){w={isGitRepo:null,error:l instanceof Error?l.message:String(l)}}const E=s.projects.map(l=>({id:l.id,path:l.path,label:l.label})),h={runtime:{platform:p?.runtime?.platform??null,isDesktop:S,hasRuntimeApis:!!p,desktopServerOrigin:null},location:typeof window<"u"?{href:window.location?.href??null,origin:window.location?.origin??null}:null,directories:{currentDirectory:t,piDirectory:d,homeDirectory:e.homeDirectory||null,isHomeReady:e.isHomeReady,hasPersistedDirectory:e.hasPersistedDirectory,isSwitchingDirectory:e.isSwitchingDirectory},projects:{total:s.projects.length,activeProjectId:s.activeProjectId,samples:E},sessions:{total:c.length,currentSessionId:o.currentSessionId,uniqueDirectories:m.size,directorySamples:Array.from(m).slice(0,5),directoryCounts:a},git:w,localStorage:g,pi:{health:I,connection:n.connection},pichamber:{settingsInfo:u},recentSendFailures:L(),currentSessionDirectoryResolution:o.currentSessionId?this.diagnoseSessionDirectory(o.currentSessionId):null};return console.log("[DEBUG] App status snapshot:",h),h},getRecentSendFailures(){const e=L();return e.length===0?console.log("[OK] No prompt sends were rejected in this session."):(console.warn(`[ALERT] ${e.length} rejected prompt send(s):`),console.table(e)),e},diagnoseSessionDirectory(e){const o=R.getState(),s=e??o.currentSessionId;if(!s)return console.log("[ERROR] No session selected and no session id passed"),null;const t=U(s),n=H().find(u=>u.id===s),d=n?.directory??null,c=s===o.currentSessionId?o.currentSessionDirectory:null,a=Y({session:n??null,currentDirectory:c}),g=o.getDirectoryForSession(s),p=W(s),S=[["owning child store",t],["session record",d],["current selection",c],["runtime memory",p.runtime],["persisted memory",p.persisted]],r=g?S.find(([,u])=>u&&u!==g):void 0,i={sessionId:s,isCurrentSession:s===o.currentSessionId,routedDirectory:g,resolvedFrom:a.source,conflict:r?{source:r[0],directory:r[1]}:null,sources:J(),details:{owningChildStore:t,sessionRecordDirectory:d,sessionIndexed:!!n,currentSessionDirectory:o.currentSessionDirectory,rememberedForRuntime:p.runtime,persistedAcrossRestarts:p.persisted,activeDirectory:A.getState().currentDirectory??null,piSessionDirectory:M().getState().directory??null}};return console.log("[DEBUG] Session directory resolution:",i),r?console.warn(`[ALERT] Directory sources disagree: routing to "${g}" while "${r[1]}" came from ${r[0]}.`):g?console.log("[OK] All known sources agree on the session directory."):console.warn("[ALERT] No directory resolved for this session — sends fall back to the active directory."),i},async buildDiagnosticsReport(){const e=await this.getAppStatus();return JSON.stringify(e,null,2)},async copyTextToClipboard(e){return j(e)},async copyDiagnosticsReport(){const e=await this.buildDiagnosticsReport();return{...await this.copyTextToClipboard(e),report:e}},checkLastMessage(){const e=this.getLastAssistantMessage();if(!e)return!1;const o=e.isEmpty||e.isEmptyResponse;return o?(console.error("[ALERT] PROBLEMATIC MESSAGE DETECTED!"),console.log("Details:",{messageId:e.messageId,isEmpty:e.isEmpty,isEmptyResponse:e.isEmptyResponse,partsCount:e.partsCount}),e.parts.length>0&&console.log("Parts:",e.parts)):console.log("[OK] Last message looks good!"),o},getStreamingState(){const e=R.getState(),o=M().getState().reducer.bySession,s=new Map;for(const[n,d]of o)s.set(n,O(d));const t=e.currentSessionId?s.get(e.currentSessionId)??null:null;return console.log("[STREAM] Streaming State:",{streamingMessageId:t,streamingMessageIds:Array.from(s.entries())}),{streamingMessageId:t,streamingMessageIds:s}},findEmptyMessages(){if(!R.getState().currentSessionId)return console.log("[ERROR] No active session"),[];const t=b().filter(n=>n.role==="assistant").filter(n=>{const d=D(n.id)||[],c=d.some(a=>a.type==="text"&&a.text&&a.text.trim().length>0),m=d.some(a=>a.type==="tool");return d.length===0||!c&&!m});return console.log(`[INSPECT] Found ${t.length} empty assistant messages`),t.forEach((n,d)=>{const c=D(n.id)||[];console.log(`[${d}] Empty message:`,{messageId:n.id,partsCount:c.length,provider:n.providerID,model:n.modelID,timestamp:n.time?.created})}),t},showRetryHelp(){console.log(`[DEBUG] How to handle empty Claude responses:
|
|
2
|
+
`),console.log("1. Check the last message:"),console.log(` __piDebug.getLastAssistantMessage()
|
|
3
|
+
`),console.log("2. Find all empty messages in session:"),console.log(` __piDebug.findEmptyMessages()
|
|
4
|
+
`),console.log("3. To retry, you can:"),console.log(" - Edit your last user message and resend"),console.log(' - Send a follow-up message like "Please provide the response"'),console.log(` - Try a different model (OpenAI models tend to be more reliable)
|
|
5
|
+
`),console.log("[TIP] Empty responses are usually due to:"),console.log(" - Model rate limits"),console.log(" - Context length issues"),console.log(" - Model refusing to respond to certain prompts"),console.log(" - API errors from provider")},analyzeMessageCompletionConsistency(e={}){const{includeNonAssistant:o=!1,verbose:s=!0,maxTableRows:t=25}=e;if(!R.getState().currentSessionId)return console.log("[ERROR] No active session"),{summary:null,rows:[]};const c=b(),m=o?c:c.filter(r=>r.role==="assistant"),a={totalMessages:c.length,analyzedMessages:m.length,completedMissing:0,completedBeforeTool:0,completedBeforeReasoning:0,runningToolsWhenCompleted:0,reasoningOpenWhenCompleted:0,withTools:0,withReasoning:0},g=r=>typeof r=="number"&&Number.isFinite(r)?r:null,p=r=>{const i=r.filter(u=>typeof u=="number");return i.length>0?Math.max(...i):null},S=m.map((r,i)=>{const u=r,I=D(r.id)||[],w=u.time??{},E=g(w.completed),h=E!==null,l=I.filter(f=>f.type==="tool"),y=I.filter(f=>f.type==="reasoning"),C=p(l.map(f=>g(f.state?.time?.end??f.state?.time?.start))),_=p(y.map(f=>g(f.time?.end??f.time?.start))),$=p([C,_].filter(f=>f!==null)),P=l.some(f=>["pending","running","started"].includes(f.state?.status)),x=y.some(f=>typeof f.time?.end!="number");l.length>0&&(a.withTools+=1),y.length>0&&(a.withReasoning+=1),h||(a.completedMissing+=1);const v=!!(h&&typeof C=="number"&&E<C);v&&(a.completedBeforeTool+=1);const N=!!(h&&typeof _=="number"&&E<_);return N&&(a.completedBeforeReasoning+=1),h&&P&&(a.runningToolsWhenCompleted+=1),h&&x&&(a.reasoningOpenWhenCompleted+=1),{index:i,messageId:u.id,role:u.role,completedAt:E,latestToolTimestamp:C,latestReasoningTimestamp:_,latestPartTimestamp:$,completed_missing:!h,completed_before_tool:v,completed_before_reasoning:N,running_tools_when_completed:!!(h&&P),reasoning_open_when_completed:!!(h&&x),has_tools:l.length>0,has_reasoning:y.length>0}});return s&&(console.table(S.slice(0,t)),S.length>t&&console.log(`Displayed first ${t} rows out of ${S.length}.`),console.log("[SUMMARY] Message completion timing:",a)),{summary:a,rows:S}},checkCompletionStatus(){if(!R.getState().currentSessionId)return console.log("[ERROR] No active session"),null;const t=b().filter(w=>w.role==="assistant");if(t.length===0)return console.log("[ERROR] No assistant messages"),null;const n=t[t.length-1],c=(D(n.id)||[]).filter(w=>w.type==="step-finish"),m=n.finish==="stop",g=n.time?.completed,p=n.status,S=typeof g=="number"&&g>0||p==="completed",r=!!(S&&m),i=n.sessionID,u=i?O(M().getState().reducer.bySession.get(i)??null):null,I=n.id===u;return console.log("[SUMMARY] Completion Status:"),console.log("Message ID:",n.id),console.log("time.completed:",g,"(type:",typeof g,")"),console.log("status:",p),console.log("hasCompletedFlag:",S),console.log("hasStopReason:",m),console.log("messageIsComplete:",r),console.log("isStreamingCandidate:",I),console.log("streamingMessageId:",u),console.log("Step-finish parts:",c),{messageId:n.id,completed:g,status:p,hasCompletedFlag:S,hasStopReason:m,messageIsComplete:r,stepFinishParts:c,raw:n}}};typeof window<"u"&&(window.__piDebug=oe,V()&&(console.log("[DEBUG] Pi debug utilities loaded. Use window.__piDebug in the console."),console.log("Available commands:"),console.log(" __piDebug.getLastAssistantMessage() - Get last assistant message details"),console.log(" __piDebug.getAllMessages(truncate?) - List all messages (truncate=true for short preview)"),console.log(" __piDebug.truncateMessages(messages) - Truncate long fields in messages array"),console.log(" __piDebug.getAppStatus() - Show app status snapshot"),console.log(" __piDebug.diagnoseSessionDirectory(sessionId?) - Show how the session directory is resolved"),console.log(" __piDebug.getRecentSendFailures() - List prompt sends that were rejected and rolled back"),console.log(" __piDebug.checkLastMessage() - Check if last message is problematic"),console.log(" __piDebug.findEmptyMessages() - Find all empty assistant messages"),console.log(" __piDebug.showRetryHelp() - Show instructions for handling empty responses"),console.log(" __piDebug.getStreamingState() - Get streaming state info"),console.log(" __piDebug.analyzeMessageCompletionConsistency(opts?) - Compare time.completed vs part timings"),console.log(" __piDebug.checkCompletionStatus() - Check completion status of last message")),window.addEventListener("error",e=>{try{const o=e.message||"",s=e.filename||"";typeof o=="string"&&o.includes("this._renderer.value.dimensions")&&/xterm/i.test(String(s))&&e.preventDefault()}catch{}}));const ae=async()=>{if(typeof window>"u")return;let e=null;try{e=window.localStorage.getItem("lastDirectory")}catch(o){console.warn("Failed to read saved directory preferences:",o)}e&&A.getState().setDirectory(e,{showOverlay:!1})};let F=!1;const G="pichamber-typography-base",ne=()=>{if(typeof document>"u")return;const o=`:root {
|
|
6
|
+
${Object.entries(se).map(([n,d])=>` --text-${n.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${d};`).join(`
|
|
7
|
+
`)}
|
|
8
|
+
}
|
|
9
|
+
`,s=document.getElementById(G);if(s){s.textContent=o;return}const t=document.createElement("style");t.id=G,t.textContent=o,document.head.appendChild(t)},le=()=>{F||typeof window>"u"||(F=!0,ne())},T=(e,o)=>!!(e&&o)&&B(e??null)===B(o??null);function ce(e,o){if(!e)return null;const s=M();if(T(s.getState().directory,e))return null;const t=R.getState();return q(t.newSessionDraft,t.currentSessionId)?null:t.currentSessionId&&T(t.currentSessionDirectory,e)?t.currentSessionId:o?.sessionId&&T(o.directory,e)?o.sessionId:s.lastSelectedSessionForDirectory(e)}export{ae as a,ce as f,le as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as o}from"./themeResolver-
|
|
1
|
+
import{t as o}from"./themeResolver-DrfmQi8i.js";import{a,D as s}from"./vendor-pierre-theming-BO6EPniU.js";function h(r,t){try{const e=a({name:r,load:t});o.registerTheme(e.name,e.load)}catch(e){if(e instanceof s){console.error("SharedHighlight.registerCustomTheme: theme name already registered",r);return}throw e}}export{h as r};
|
package/dist/assets/{renderDiffWithHighlighter-BhMEWmHn.js → renderDiffWithHighlighter-JwKOWdBN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as q,i as M,n as K,k as j,j as G,m as W,l as A}from"./computeVirtualFileMetrics-Bjhk2CQS.js";import{ci as J,dA as z}from"./useAppFontEffects-CqHhRKmN.js";import{d as X,a as Q}from"./vendor-diff-C3JhlQdm.js";function gn(n,e){return n===e||n?.cacheKey!=null&&n.cacheKey===e?.cacheKey}function mn(n,e){return q(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function pn(n){const e=n.lang??M(n.name),r=n.lang??(n.prevName!=null?M(n.prevName):"text");return e==="text"&&r==="text"}function B({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:l,collapsedContextThreshold:f}){const t=Math.max(e,0);if(t===0||n)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:t,renderAll:!1};if(r===!0||t<=f)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(l),d=Math.min(Math.max(h?.fromStart??0,0),t),i=Math.min(Math.max(h?.fromEnd??0,0),t),u=d+i,o=u>=t;return{fromStart:o?t:d,fromEnd:o?0:i,rangeSize:t,collapsedLines:Math.max(t-u,0),renderAll:o}}function In(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-(e.additionLineIndex+e.additionCount),l=n.deletionLines.length-(e.deletionLineIndex+e.deletionCount);return r<=0&&l<=0?!1:r!==l}function Y({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const l=n.additionLines.length-(r.additionLineIndex+r.additionCount),f=n.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(l<=0&&f<=0)return 0;if(l!==f)throw new Error(`${e}: trailing context mismatch (additions=${l}, deletions=${f}) for ${n.name}`);return Math.min(l,f)}function V({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:l,errorPrefix:f}){if(e!==n.hunks.length-1)return;const t=Y({fileDiff:n,errorPrefix:f});if(t<=0)return;if(r===!0||t<=l)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(n.hunks.length),d=Math.min(Math.max(h?.fromStart??0,0),t);return{fromStart:d,fromEnd:0,rangeSize:t,collapsedLines:t-d,renderAll:d>=t}}function $({type:n,metrics:e}){return e.hunkSeparatorHeight??K(n)}function U({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function Z({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function y(n){return n!=="simple"&&n!=="metadata"}function Cn({type:n,metrics:e,hunkIndex:r,hunkSpecs:l}){if(!Z({type:n,hunkIndex:r,hunkSpecs:l}))return;const f=$({type:n,metrics:e}),t=U({type:n,metrics:e}),h=r>0?t:0,d=t;return{height:f,gapBefore:h,gapAfter:d,totalHeight:h+f+d}}function Ln({type:n,metrics:e}){if(!y(n))return;const r=$({type:n,metrics:e}),l=U({type:n,metrics:e});return{height:r,gapBefore:l,gapAfter:0,totalHeight:l+r}}function nn({diff:n,diffStyle:e,startingLine:r=0,totalLines:l=1/0,expandedHunks:f,collapsedContextThreshold:t=1,callback:h}){const d=en({diff:n,diffStyle:e,startingLine:r,expandedHunks:f,collapsedContextThreshold:t}),i={viewportStart:r,viewportEnd:r+l,isWindowedHighlight:r>0||l<1/0,splitCount:d.splitCount,unifiedCount:d.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!i.isWindowedHighlight)return!1;const u=i.unifiedCount>=r+l,o=i.splitCount>=r+l;return e==="unified"?u:(e==="split"||u)&&o},shouldSkip(u,o){if(!i.isWindowedHighlight)return!1;const s=i.unifiedCount+u<r,a=i.splitCount+o<r;return e==="unified"?s:(e==="split"||s)&&a},incrementCounts(u,o){(e==="unified"||e==="both")&&(i.unifiedCount+=u),(e==="split"||e==="both")&&(i.splitCount+=o)},isInWindow(u,o){if(!i.isWindowedHighlight)return!0;const s=i.isInUnifiedWindow(u),a=i.isInSplitWindow(o);return e==="unified"?s:e==="split"?a:s||a},isInUnifiedWindow(u){return!i.isWindowedHighlight||i.unifiedCount>=r-u&&i.unifiedCount<r+l},isInSplitWindow(u){return!i.isWindowedHighlight||i.splitCount>=r-u&&i.splitCount<r+l},emit(u,o=!1){return o||(e==="unified"?i.incrementCounts(1,0):e==="split"?i.incrementCounts(0,1):i.incrementCounts(1,1)),h(u)??!1}};n:for(let u=d.hunkIndex;u<n.hunks.length;u++){let g=function(c,p){return a==null||a.collapsedLines<=0||a.fromStart+a.fromEnd>0?0:e==="unified"?c===o.unifiedLineStart+o.unifiedLineCount-1?a.collapsedLines:0:p===o.splitLineStart+o.splitLineCount-1?a.collapsedLines:0},b=function(){return O?0:(O=!0,s.collapsedLines)};const o=n.hunks[u];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(i.shouldBreak())break;const s=B({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:f,hunkIndex:u,collapsedContextThreshold:t}),a=u===i.finalHunkIndex?V({fileDiff:n,hunkIndex:u,expandedHunks:f,collapsedContextThreshold:t,errorPrefix:"iterateOverDiff"}):void 0,m=s.fromStart+s.fromEnd;let O=s.collapsedLines===0;if(i.shouldSkip(m,m))i.incrementCounts(m,m),b();else{let c=o.unifiedLineStart-s.rangeSize,p=o.splitLineStart-s.rangeSize,k=o.deletionLineIndex-s.rangeSize,R=o.additionLineIndex-s.rangeSize,S=o.deletionStart-s.rangeSize,H=o.additionStart-s.rangeSize;if(T(i,s.fromStart,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}))||(c=o.unifiedLineStart-s.fromEnd,p=o.splitLineStart-s.fromEnd,k=o.deletionLineIndex-s.fromEnd,R=o.additionLineIndex-s.fromEnd,S=o.deletionStart-s.fromEnd,H=o.additionStart-s.fromEnd,T(i,s.fromEnd,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}),()=>{b()})))break n}let N=o.unifiedLineStart,w=o.splitLineStart,I=o.deletionLineIndex,C=o.additionLineIndex,L=o.deletionStart,v=o.additionStart;const x=o.hunkContent.at(-1);for(const c of o.hunkContent){if(i.shouldBreak())break n;const p=c===x;if(c.type==="context"){if(i.shouldSkip(c.lines,c.lines))i.incrementCounts(c.lines,c.lines),b();else if(T(i,c.lines,e,k=>{const R=p&&k===c.lines-1,S=N+k,H=w+k;return i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:g(S,H),type:"context",deletionLine:{lineNumber:L+k,lineIndex:I+k,noEOFCR:R&&o.noEOFCRDeletions,unifiedLineIndex:S,splitLineIndex:H},additionLine:{unifiedLineIndex:S,splitLineIndex:H,lineIndex:C+k,lineNumber:v+k,noEOFCR:R&&o.noEOFCRAdditions}})},()=>{b()}))break n;N+=c.lines,w+=c.lines,I+=c.lines,C+=c.lines,L+=c.lines,v+=c.lines}else{const k=Math.max(c.deletions,c.additions),R=c.deletions+c.additions;if(!i.shouldSkip(R,k)){const S=rn(i,c,e);(S[0]?.[0]??0)>0&&b();for(const[H,E]of S)for(let D=H;D<E;D++){const _=g(N+D,e==="unified"?w+(D<c.deletions?D:D-c.deletions):w+D);if(i.emit(sn({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:_,diffStyle:e,index:D,unifiedLineIndex:N,splitLineIndex:w,additionLineIndex:C,deletionLineIndex:I,additionLineNumber:v,deletionLineNumber:L,content:c,isLastContent:p,unifiedCount:R,splitCount:k}),!0))break n}}b(),i.incrementCounts(R,k),N+=R,w+=k,I+=c.deletions,C+=c.additions,L+=c.deletions,v+=c.additions}}if(a!=null){const{collapsedLines:c,fromStart:p,fromEnd:k}=a,R=p+k;if(T(i,R,e,S=>{const H=S===R-1;return i.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:H?c:0,type:"context-expanded",deletionLine:{lineNumber:L+S,lineIndex:I+S,noEOFCR:!1,unifiedLineIndex:N+S,splitLineIndex:w+S},additionLine:{unifiedLineIndex:N+S,splitLineIndex:w+S,lineIndex:C+S,lineNumber:v+S,noEOFCR:!1}})},void 0,()=>i.shouldBreak()))break n}}}function en({diff:n,diffStyle:e,startingLine:r,expandedHunks:l,collapsedContextThreshold:f}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const t=tn({diff:n,expandedHunks:l,collapsedContextThreshold:f});let h=0,d=n.hunks.length-1,i=n.hunks.length;for(;h<=d;){const o=h+d>>1,s=t[o+1];if(s==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?s.unifiedCount:s.splitCount)>r?(i=o,d=o-1):h=o+1}if(i>=n.hunks.length){const o=t[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const u=t[i];if(u==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:i,splitCount:u.splitCount,unifiedCount:u.unifiedCount}}function tn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let l=0,f=0;const t=n.hunks.length-1,h=[{splitCount:0,unifiedCount:0}];for(let d=0;d<n.hunks.length;d++){const i=n.hunks[d];if(i==null)throw new Error("iterateOverDiff: invalid hunk summary index");const u=B({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:e,hunkIndex:d,collapsedContextThreshold:r}),o=u.fromStart+u.fromEnd;l+=o+i.splitLineCount,f+=o+i.unifiedLineCount;const s=d===t?V({fileDiff:n,hunkIndex:d,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(s!=null){const a=s.fromStart+s.fromEnd;l+=a,f+=a}h.push({splitCount:l,unifiedCount:f})}return h}function on(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const l=[];function f(d){const i=Math.max(0,n.viewportStart-d),u=Math.min(e,n.viewportEnd-d);u>i&&l.push([i,u])}if(r!=="split"&&f(n.unifiedCount),r!=="unified"&&f(n.splitCount),l.length===0)return[0,0];let t=l[0][0],h=l[0][1];for(let d=1;d<l.length;d++){const i=l[d];t=Math.min(t,i[0]),h=Math.max(h,i[1])}return[t,h]}function T(n,e,r,l,f,t){const[h,d]=on(n,e,r);h>0&&(n.incrementCounts(h,h),f?.());let i=h;for(;i<e;){if(t?.()===!0)return!0;if(i>=d){n.incrementCounts(e-i,e-i);break}if(n.isInWindow(0,0)){if(l(i)===!0)return!0}else n.incrementCounts(1,1);i++}return!1}function rn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const l=r!=="split",f=r!=="unified",t=r==="unified"?"unified":"split",h=[];function d(s,a){if(s+a<=n.viewportStart||s>=n.viewportEnd)return;const m=Math.max(0,n.viewportStart-s),g=Math.min(a,n.viewportEnd-s);return g>m?[m,g]:void 0}function i(s,a){return t==="split"?s:a==="additions"?[s[0]+e.deletions,s[1]+e.deletions]:s}function u(s,a){if(s==null)return;const[m,g]=i(s,a);g>m&&h.push([m,g])}if(l&&(u(d(n.unifiedCount,e.deletions),"deletions"),u(d(n.unifiedCount+e.deletions,e.additions),"additions")),f&&(u(d(n.splitCount,e.deletions),"deletions"),u(d(n.splitCount,e.additions),"additions")),h.length===0)return h;h.sort((s,a)=>s[0]-a[0]);const o=[h[0]];for(const[s,a]of h.slice(1)){const m=o[o.length-1];s<=m[1]?m[1]=Math.max(m[1],a):o.push([s,a])}return o}function sn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,diffStyle:f,index:t,unifiedLineIndex:h,splitLineIndex:d,additionLineIndex:i,deletionLineIndex:u,additionLineNumber:o,deletionLineNumber:s,content:a,isLastContent:m,unifiedCount:g,splitCount:O}){const b=t<a.deletions?h+t:void 0,N=f==="unified"?t>=a.deletions?h+t:void 0:t<a.additions?h+a.deletions+t:void 0,w=f==="unified"?d+(t<a.deletions?t:t-a.deletions):d+t,I=t<a.deletions?u+t:void 0,C=t<a.deletions?s+t:void 0,L=f==="unified"?t>=a.deletions?i+(t-a.deletions):void 0:t<a.additions?i+t:void 0,v=f==="unified"?t>=a.deletions?o+(t-a.deletions):void 0:t<a.additions?o+t:void 0,x=f==="unified"?m&&t===a.deletions-1&&e.noEOFCRDeletions:m&&t===O-1&&e.noEOFCRDeletions,c=f==="unified"?m&&t===g-1&&e.noEOFCRAdditions:m&&t===O-1&&e.noEOFCRAdditions,p=I!=null&&C!=null&&b!=null?{lineNumber:C,lineIndex:I,noEOFCR:x,unifiedLineIndex:b,splitLineIndex:w}:void 0,k=L!=null&&v!=null&&N!=null?{unifiedLineIndex:N,splitLineIndex:w,lineIndex:L,lineNumber:v,noEOFCR:c}:void 0;if(p==null&&k!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:void 0,additionLine:k};if(p!=null&&k==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:void 0};if(p==null||k==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:k}}function P({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function F({item:n,arr:e,enableJoin:r,isNeutral:l=!1,isLastItem:f=!1}){const t=e[e.length-1];if(t==null||f||!r){e.push([l?0:1,n.value]);return}const h=t[0]===0;if(l===h||l&&n.value.length===1&&!h){t[1]+=n.value;return}e.push([l?0:1,n.value])}const ln={forcePlainText:!1};function xn(n,e,r,{forcePlainText:l,startingLine:f,totalLines:t,expandedHunks:h,collapsedContextThreshold:d=1}=ln){l?(f??=0,t??=1/0):(f=0,t=1/0);const i=f>0||t<1/0,u=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,o=j({theme:r.theme,highlighter:e}),s=l&&!i&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,a={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,g=!l&&!n.isPartial,O=l?h:void 0,b=new Map;function N(I){const C=g?0:I,L=b.get(C)??un();return b.set(C,L),L}function w(I,C,L,v){if(i){let x=L.at(-1);(x==null||x.targetIndex+x.count!==C)&&(x={targetIndex:C,originalOffset:v.length,count:0},L.push(x)),x.count++}v.push(I)}nn({diff:n,diffStyle:"both",startingLine:f,totalLines:t,expandedHunks:i?O:!0,collapsedContextThreshold:d,callback:({hunkIndex:I,additionLine:C,deletionLine:L,type:v})=>{const x=N(I),c=C!=null?C.splitLineIndex:L.splitLineIndex;v==="change"&&C!=null&&L!=null&&an({additionLine:n.additionLines[C.lineIndex],deletionLine:n.deletionLines[L.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:s,maxLineDiffLength:m}),L!=null&&(w(n.deletionLines[L.lineIndex],L.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:L.lineNumber,altLineNumber:v==="change"?void 0:C.lineNumber??void 0,lineIndex:`${L.unifiedLineIndex},${c}`})),C!=null&&(w(n.additionLines[C.lineIndex],C.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:C.lineNumber,altLineNumber:v==="change"?void 0:L.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${c}`}))}});for(const I of b.values()){if(I.deletionContent.length===0&&I.additionContent.length===0)continue;const C={name:n.prevName??n.name,contents:I.deletionContent.value},L={name:n.name,contents:I.additionContent.value},{deletionLines:v,additionLines:x}=dn({deletionFile:C,deletionInfo:I.deletionInfo,deletionDecorations:I.deletionDecorations,additionFile:L,additionInfo:I.additionInfo,additionDecorations:I.additionDecorations,highlighter:e,options:r,languageOverride:l?"text":n.lang});if(g){a.deletionLines=v,a.additionLines=x;continue}if(I.deletionSegments.length>0)for(const c of I.deletionSegments)for(let p=0;p<c.count;p++)a.deletionLines[c.targetIndex+p]=v[c.originalOffset+p];else a.deletionLines.push(...v);if(I.additionSegments.length>0)for(const c of I.additionSegments)for(let p=0;p<c.count;p++)a.additionLines[c.targetIndex+p]=x[c.originalOffset+p];else a.additionLines.push(...x)}return{code:a,themeStyles:o,baseThemeType:u}}function an({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:l,deletionDecorations:f,additionDecorations:t,lineDiffType:h,maxLineDiffLength:d}){if(n==null||e==null||h==="none"||(n=z(n),e=z(e),n.length>d||e.length>d))return;const i=h==="char"?X(n,e):Q(n,e),u=[],o=[],s=h==="word-alt",a=i.at(-1);for(const g of i){const O=g===a;!g.added&&!g.removed?(F({item:g,arr:u,enableJoin:s,isNeutral:!0,isLastItem:O}),F({item:g,arr:o,enableJoin:s,isNeutral:!0,isLastItem:O})):g.removed?F({item:g,arr:u,enableJoin:s,isLastItem:O}):F({item:g,arr:o,enableJoin:s,isLastItem:O})}let m=0;for(const g of u)g[0]===1&&f.push(P({line:r,spanStart:m,spanLength:g[1].length})),m+=g[1].length;m=0;for(const g of o)g[0]===1&&t.push(P({line:l,spanStart:m,spanLength:g[1].length})),m+=g[1].length}function un(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function dn({deletionFile:n,additionFile:e,deletionInfo:r,additionInfo:l,highlighter:f,deletionDecorations:t,additionDecorations:h,languageOverride:d,options:{theme:i=J,...u}}){const o=d??M(n.name),s=d??M(e.name),{state:a,transformers:m}=G(u.useTokenTransformer),g=typeof i=="string"?{...u,lang:"text",theme:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0}:{...u,lang:"text",themes:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0};return{deletionLines:n.contents===""?[]:(g.lang=o,a.lineInfo=r,g.decorations=t,A(f.codeToHast(z(n.contents),g))),additionLines:e.contents===""?[]:(g.lang=s,g.decorations=h,a.lineInfo=l,A(f.codeToHast(z(e.contents),g)))}}export{mn as a,gn as b,nn as c,B as d,Cn as e,V as f,Y as g,In as h,pn as i,Ln as j,xn as r};
|
|
1
|
+
import{b as q,i as M,n as K,k as j,j as G,m as W,l as P}from"./computeVirtualFileMetrics-ydVGT2RY.js";import{d9 as J,db as z}from"./useAppFontEffects-CHnpTOtc.js";import{d as X,a as Q}from"./vendor-diff-C3JhlQdm.js";function gn(n,e){return n===e||n?.cacheKey!=null&&n.cacheKey===e?.cacheKey}function mn(n,e){return q(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function pn(n){const e=n.lang??M(n.name),r=n.lang??(n.prevName!=null?M(n.prevName):"text");return e==="text"&&r==="text"}function B({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:l,collapsedContextThreshold:f}){const t=Math.max(e,0);if(t===0||n)return{fromStart:0,fromEnd:0,rangeSize:t,collapsedLines:t,renderAll:!1};if(r===!0||t<=f)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(l),d=Math.min(Math.max(h?.fromStart??0,0),t),i=Math.min(Math.max(h?.fromEnd??0,0),t),u=d+i,o=u>=t;return{fromStart:o?t:d,fromEnd:o?0:i,rangeSize:t,collapsedLines:Math.max(t-u,0),renderAll:o}}function In(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-(e.additionLineIndex+e.additionCount),l=n.deletionLines.length-(e.deletionLineIndex+e.deletionCount);return r<=0&&l<=0?!1:r!==l}function Y({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const l=n.additionLines.length-(r.additionLineIndex+r.additionCount),f=n.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(l<=0&&f<=0)return 0;if(l!==f)throw new Error(`${e}: trailing context mismatch (additions=${l}, deletions=${f}) for ${n.name}`);return Math.min(l,f)}function V({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:l,errorPrefix:f}){if(e!==n.hunks.length-1)return;const t=Y({fileDiff:n,errorPrefix:f});if(t<=0)return;if(r===!0||t<=l)return{fromStart:t,fromEnd:0,rangeSize:t,collapsedLines:0,renderAll:!0};const h=r?.get(n.hunks.length),d=Math.min(Math.max(h?.fromStart??0,0),t);return{fromStart:d,fromEnd:0,rangeSize:t,collapsedLines:t-d,renderAll:d>=t}}function $({type:n,metrics:e}){return e.hunkSeparatorHeight??K(n)}function U({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function Z({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function y(n){return n!=="simple"&&n!=="metadata"}function Cn({type:n,metrics:e,hunkIndex:r,hunkSpecs:l}){if(!Z({type:n,hunkIndex:r,hunkSpecs:l}))return;const f=$({type:n,metrics:e}),t=U({type:n,metrics:e}),h=r>0?t:0,d=t;return{height:f,gapBefore:h,gapAfter:d,totalHeight:h+f+d}}function Ln({type:n,metrics:e}){if(!y(n))return;const r=$({type:n,metrics:e}),l=U({type:n,metrics:e});return{height:r,gapBefore:l,gapAfter:0,totalHeight:l+r}}function nn({diff:n,diffStyle:e,startingLine:r=0,totalLines:l=1/0,expandedHunks:f,collapsedContextThreshold:t=1,callback:h}){const d=en({diff:n,diffStyle:e,startingLine:r,expandedHunks:f,collapsedContextThreshold:t}),i={viewportStart:r,viewportEnd:r+l,isWindowedHighlight:r>0||l<1/0,splitCount:d.splitCount,unifiedCount:d.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!i.isWindowedHighlight)return!1;const u=i.unifiedCount>=r+l,o=i.splitCount>=r+l;return e==="unified"?u:(e==="split"||u)&&o},shouldSkip(u,o){if(!i.isWindowedHighlight)return!1;const s=i.unifiedCount+u<r,a=i.splitCount+o<r;return e==="unified"?s:(e==="split"||s)&&a},incrementCounts(u,o){(e==="unified"||e==="both")&&(i.unifiedCount+=u),(e==="split"||e==="both")&&(i.splitCount+=o)},isInWindow(u,o){if(!i.isWindowedHighlight)return!0;const s=i.isInUnifiedWindow(u),a=i.isInSplitWindow(o);return e==="unified"?s:e==="split"?a:s||a},isInUnifiedWindow(u){return!i.isWindowedHighlight||i.unifiedCount>=r-u&&i.unifiedCount<r+l},isInSplitWindow(u){return!i.isWindowedHighlight||i.splitCount>=r-u&&i.splitCount<r+l},emit(u,o=!1){return o||(e==="unified"?i.incrementCounts(1,0):e==="split"?i.incrementCounts(0,1):i.incrementCounts(1,1)),h(u)??!1}};n:for(let u=d.hunkIndex;u<n.hunks.length;u++){let g=function(c,p){return a==null||a.collapsedLines<=0||a.fromStart+a.fromEnd>0?0:e==="unified"?c===o.unifiedLineStart+o.unifiedLineCount-1?a.collapsedLines:0:p===o.splitLineStart+o.splitLineCount-1?a.collapsedLines:0},b=function(){return O?0:(O=!0,s.collapsedLines)};const o=n.hunks[u];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(i.shouldBreak())break;const s=B({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:f,hunkIndex:u,collapsedContextThreshold:t}),a=u===i.finalHunkIndex?V({fileDiff:n,hunkIndex:u,expandedHunks:f,collapsedContextThreshold:t,errorPrefix:"iterateOverDiff"}):void 0,m=s.fromStart+s.fromEnd;let O=s.collapsedLines===0;if(i.shouldSkip(m,m))i.incrementCounts(m,m),b();else{let c=o.unifiedLineStart-s.rangeSize,p=o.splitLineStart-s.rangeSize,k=o.deletionLineIndex-s.rangeSize,R=o.additionLineIndex-s.rangeSize,S=o.deletionStart-s.rangeSize,H=o.additionStart-s.rangeSize;if(T(i,s.fromStart,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}))||(c=o.unifiedLineStart-s.fromEnd,p=o.splitLineStart-s.fromEnd,k=o.deletionLineIndex-s.fromEnd,R=o.additionLineIndex-s.fromEnd,S=o.deletionStart-s.fromEnd,H=o.additionStart-s.fromEnd,T(i,s.fromEnd,e,E=>i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:S+E,lineIndex:k+E,noEOFCR:!1,unifiedLineIndex:c+E,splitLineIndex:p+E},additionLine:{unifiedLineIndex:c+E,splitLineIndex:p+E,lineIndex:R+E,lineNumber:H+E,noEOFCR:!1}}),()=>{b()})))break n}let N=o.unifiedLineStart,w=o.splitLineStart,I=o.deletionLineIndex,C=o.additionLineIndex,L=o.deletionStart,v=o.additionStart;const x=o.hunkContent.at(-1);for(const c of o.hunkContent){if(i.shouldBreak())break n;const p=c===x;if(c.type==="context"){if(i.shouldSkip(c.lines,c.lines))i.incrementCounts(c.lines,c.lines),b();else if(T(i,c.lines,e,k=>{const R=p&&k===c.lines-1,S=N+k,H=w+k;return i.emit({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:g(S,H),type:"context",deletionLine:{lineNumber:L+k,lineIndex:I+k,noEOFCR:R&&o.noEOFCRDeletions,unifiedLineIndex:S,splitLineIndex:H},additionLine:{unifiedLineIndex:S,splitLineIndex:H,lineIndex:C+k,lineNumber:v+k,noEOFCR:R&&o.noEOFCRAdditions}})},()=>{b()}))break n;N+=c.lines,w+=c.lines,I+=c.lines,C+=c.lines,L+=c.lines,v+=c.lines}else{const k=Math.max(c.deletions,c.additions),R=c.deletions+c.additions;if(!i.shouldSkip(R,k)){const S=rn(i,c,e);(S[0]?.[0]??0)>0&&b();for(const[H,E]of S)for(let D=H;D<E;D++){const _=g(N+D,e==="unified"?w+(D<c.deletions?D:D-c.deletions):w+D);if(i.emit(sn({hunkIndex:u,hunk:o,collapsedBefore:b(),collapsedAfter:_,diffStyle:e,index:D,unifiedLineIndex:N,splitLineIndex:w,additionLineIndex:C,deletionLineIndex:I,additionLineNumber:v,deletionLineNumber:L,content:c,isLastContent:p,unifiedCount:R,splitCount:k}),!0))break n}}b(),i.incrementCounts(R,k),N+=R,w+=k,I+=c.deletions,C+=c.additions,L+=c.deletions,v+=c.additions}}if(a!=null){const{collapsedLines:c,fromStart:p,fromEnd:k}=a,R=p+k;if(T(i,R,e,S=>{const H=S===R-1;return i.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:H?c:0,type:"context-expanded",deletionLine:{lineNumber:L+S,lineIndex:I+S,noEOFCR:!1,unifiedLineIndex:N+S,splitLineIndex:w+S},additionLine:{unifiedLineIndex:N+S,splitLineIndex:w+S,lineIndex:C+S,lineNumber:v+S,noEOFCR:!1}})},void 0,()=>i.shouldBreak()))break n}}}function en({diff:n,diffStyle:e,startingLine:r,expandedHunks:l,collapsedContextThreshold:f}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const t=tn({diff:n,expandedHunks:l,collapsedContextThreshold:f});let h=0,d=n.hunks.length-1,i=n.hunks.length;for(;h<=d;){const o=h+d>>1,s=t[o+1];if(s==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?s.unifiedCount:s.splitCount)>r?(i=o,d=o-1):h=o+1}if(i>=n.hunks.length){const o=t[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const u=t[i];if(u==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:i,splitCount:u.splitCount,unifiedCount:u.unifiedCount}}function tn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let l=0,f=0;const t=n.hunks.length-1,h=[{splitCount:0,unifiedCount:0}];for(let d=0;d<n.hunks.length;d++){const i=n.hunks[d];if(i==null)throw new Error("iterateOverDiff: invalid hunk summary index");const u=B({isPartial:n.isPartial,rangeSize:i.collapsedBefore,expandedHunks:e,hunkIndex:d,collapsedContextThreshold:r}),o=u.fromStart+u.fromEnd;l+=o+i.splitLineCount,f+=o+i.unifiedLineCount;const s=d===t?V({fileDiff:n,hunkIndex:d,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(s!=null){const a=s.fromStart+s.fromEnd;l+=a,f+=a}h.push({splitCount:l,unifiedCount:f})}return h}function on(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const l=[];function f(d){const i=Math.max(0,n.viewportStart-d),u=Math.min(e,n.viewportEnd-d);u>i&&l.push([i,u])}if(r!=="split"&&f(n.unifiedCount),r!=="unified"&&f(n.splitCount),l.length===0)return[0,0];let t=l[0][0],h=l[0][1];for(let d=1;d<l.length;d++){const i=l[d];t=Math.min(t,i[0]),h=Math.max(h,i[1])}return[t,h]}function T(n,e,r,l,f,t){const[h,d]=on(n,e,r);h>0&&(n.incrementCounts(h,h),f?.());let i=h;for(;i<e;){if(t?.()===!0)return!0;if(i>=d){n.incrementCounts(e-i,e-i);break}if(n.isInWindow(0,0)){if(l(i)===!0)return!0}else n.incrementCounts(1,1);i++}return!1}function rn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const l=r!=="split",f=r!=="unified",t=r==="unified"?"unified":"split",h=[];function d(s,a){if(s+a<=n.viewportStart||s>=n.viewportEnd)return;const m=Math.max(0,n.viewportStart-s),g=Math.min(a,n.viewportEnd-s);return g>m?[m,g]:void 0}function i(s,a){return t==="split"?s:a==="additions"?[s[0]+e.deletions,s[1]+e.deletions]:s}function u(s,a){if(s==null)return;const[m,g]=i(s,a);g>m&&h.push([m,g])}if(l&&(u(d(n.unifiedCount,e.deletions),"deletions"),u(d(n.unifiedCount+e.deletions,e.additions),"additions")),f&&(u(d(n.splitCount,e.deletions),"deletions"),u(d(n.splitCount,e.additions),"additions")),h.length===0)return h;h.sort((s,a)=>s[0]-a[0]);const o=[h[0]];for(const[s,a]of h.slice(1)){const m=o[o.length-1];s<=m[1]?m[1]=Math.max(m[1],a):o.push([s,a])}return o}function sn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,diffStyle:f,index:t,unifiedLineIndex:h,splitLineIndex:d,additionLineIndex:i,deletionLineIndex:u,additionLineNumber:o,deletionLineNumber:s,content:a,isLastContent:m,unifiedCount:g,splitCount:O}){const b=t<a.deletions?h+t:void 0,N=f==="unified"?t>=a.deletions?h+t:void 0:t<a.additions?h+a.deletions+t:void 0,w=f==="unified"?d+(t<a.deletions?t:t-a.deletions):d+t,I=t<a.deletions?u+t:void 0,C=t<a.deletions?s+t:void 0,L=f==="unified"?t>=a.deletions?i+(t-a.deletions):void 0:t<a.additions?i+t:void 0,v=f==="unified"?t>=a.deletions?o+(t-a.deletions):void 0:t<a.additions?o+t:void 0,x=f==="unified"?m&&t===a.deletions-1&&e.noEOFCRDeletions:m&&t===O-1&&e.noEOFCRDeletions,c=f==="unified"?m&&t===g-1&&e.noEOFCRAdditions:m&&t===O-1&&e.noEOFCRAdditions,p=I!=null&&C!=null&&b!=null?{lineNumber:C,lineIndex:I,noEOFCR:x,unifiedLineIndex:b,splitLineIndex:w}:void 0,k=L!=null&&v!=null&&N!=null?{unifiedLineIndex:N,splitLineIndex:w,lineIndex:L,lineNumber:v,noEOFCR:c}:void 0;if(p==null&&k!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:void 0,additionLine:k};if(p!=null&&k==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:void 0};if(p==null||k==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:l,deletionLine:p,additionLine:k}}function A({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function F({item:n,arr:e,enableJoin:r,isNeutral:l=!1,isLastItem:f=!1}){const t=e[e.length-1];if(t==null||f||!r){e.push([l?0:1,n.value]);return}const h=t[0]===0;if(l===h||l&&n.value.length===1&&!h){t[1]+=n.value;return}e.push([l?0:1,n.value])}const ln={forcePlainText:!1};function xn(n,e,r,{forcePlainText:l,startingLine:f,totalLines:t,expandedHunks:h,collapsedContextThreshold:d=1}=ln){l?(f??=0,t??=1/0):(f=0,t=1/0);const i=f>0||t<1/0,u=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,o=j({theme:r.theme,highlighter:e}),s=l&&!i&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,a={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,g=!l&&!n.isPartial,O=l?h:void 0,b=new Map;function N(I){const C=g?0:I,L=b.get(C)??un();return b.set(C,L),L}function w(I,C,L,v){if(i){let x=L.at(-1);(x==null||x.targetIndex+x.count!==C)&&(x={targetIndex:C,originalOffset:v.length,count:0},L.push(x)),x.count++}v.push(I)}nn({diff:n,diffStyle:"both",startingLine:f,totalLines:t,expandedHunks:i?O:!0,collapsedContextThreshold:d,callback:({hunkIndex:I,additionLine:C,deletionLine:L,type:v})=>{const x=N(I),c=C!=null?C.splitLineIndex:L.splitLineIndex;v==="change"&&C!=null&&L!=null&&an({additionLine:n.additionLines[C.lineIndex],deletionLine:n.deletionLines[L.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:s,maxLineDiffLength:m}),L!=null&&(w(n.deletionLines[L.lineIndex],L.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:v==="change"?"change-deletion":v,lineNumber:L.lineNumber,altLineNumber:v==="change"?void 0:C.lineNumber??void 0,lineIndex:`${L.unifiedLineIndex},${c}`})),C!=null&&(w(n.additionLines[C.lineIndex],C.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:v==="change"?"change-addition":v,lineNumber:C.lineNumber,altLineNumber:v==="change"?void 0:L.lineNumber??void 0,lineIndex:`${C.unifiedLineIndex},${c}`}))}});for(const I of b.values()){if(I.deletionContent.length===0&&I.additionContent.length===0)continue;const C={name:n.prevName??n.name,contents:I.deletionContent.value},L={name:n.name,contents:I.additionContent.value},{deletionLines:v,additionLines:x}=dn({deletionFile:C,deletionInfo:I.deletionInfo,deletionDecorations:I.deletionDecorations,additionFile:L,additionInfo:I.additionInfo,additionDecorations:I.additionDecorations,highlighter:e,options:r,languageOverride:l?"text":n.lang});if(g){a.deletionLines=v,a.additionLines=x;continue}if(I.deletionSegments.length>0)for(const c of I.deletionSegments)for(let p=0;p<c.count;p++)a.deletionLines[c.targetIndex+p]=v[c.originalOffset+p];else a.deletionLines.push(...v);if(I.additionSegments.length>0)for(const c of I.additionSegments)for(let p=0;p<c.count;p++)a.additionLines[c.targetIndex+p]=x[c.originalOffset+p];else a.additionLines.push(...x)}return{code:a,themeStyles:o,baseThemeType:u}}function an({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:l,deletionDecorations:f,additionDecorations:t,lineDiffType:h,maxLineDiffLength:d}){if(n==null||e==null||h==="none"||(n=z(n),e=z(e),n.length>d||e.length>d))return;const i=h==="char"?X(n,e):Q(n,e),u=[],o=[],s=h==="word-alt",a=i.at(-1);for(const g of i){const O=g===a;!g.added&&!g.removed?(F({item:g,arr:u,enableJoin:s,isNeutral:!0,isLastItem:O}),F({item:g,arr:o,enableJoin:s,isNeutral:!0,isLastItem:O})):g.removed?F({item:g,arr:u,enableJoin:s,isLastItem:O}):F({item:g,arr:o,enableJoin:s,isLastItem:O})}let m=0;for(const g of u)g[0]===1&&f.push(A({line:r,spanStart:m,spanLength:g[1].length})),m+=g[1].length;m=0;for(const g of o)g[0]===1&&t.push(A({line:l,spanStart:m,spanLength:g[1].length})),m+=g[1].length}function un(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function dn({deletionFile:n,additionFile:e,deletionInfo:r,additionInfo:l,highlighter:f,deletionDecorations:t,additionDecorations:h,languageOverride:d,options:{theme:i=J,...u}}){const o=d??M(n.name),s=d??M(e.name),{state:a,transformers:m}=G(u.useTokenTransformer),g=typeof i=="string"?{...u,lang:"text",theme:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0}:{...u,lang:"text",themes:i,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:W("token"),tokenizeTimeLimit:0};return{deletionLines:n.contents===""?[]:(g.lang=o,a.lineInfo=r,g.decorations=t,P(f.codeToHast(z(n.contents),g))),additionLines:e.contents===""?[]:(g.lang=s,g.decorations=h,a.lineInfo=l,P(f.codeToHast(z(e.contents),g)))}}export{mn as a,gn as b,nn as c,B as d,Cn as e,V as f,Y as g,In as h,pn as i,Ln as j,xn as r};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherDropdown-CA64t2xd.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-boot-CoTxysn6.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/useAppFontEffects-CHnpTOtc.js","assets/index-C2ISrmRR.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-DgwThEwf.css","assets/runtimeSurface-CJN1oo_1.js","assets/nativeFileSave-Bhafll_7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,aR as ye}from"./vendor-boot-CoTxysn6.js";import{R as c,a as me}from"./vendor-react-Bz1tRBxM.js";/* empty css */import{f as K,u as V,au as ge,a0 as X,h as ie,an as U,$ as we,W as ve,m as le,v as je,p as be}from"./index-C2ISrmRR.js";import{f as Se,a as Ie,s as Ce}from"./pi-session-focus-preference-D6vrJGbH.js";import{d2 as Ne,I as J,au as De,aQ as Pe,aR as Me,aS as ke,d3 as Ee,d4 as _e,h as j,aY as Oe,a as ae,O as P,cJ as ce,d5 as Le,z as Re,bh as Te,bO as Ae,bv as Be,B as de,bR as Fe,d6 as ue,d7 as ze,t as Ue,g as $e,Y as We,E as He,_ as Ge,$ as Ke,a0 as Je,a4 as Ve,a6 as Ye,a7 as Qe,d8 as qe,bP as Xe,aa as Ze,ab as et,ac as tt,ad as st,ae as rt}from"./useAppFontEffects-CHnpTOtc.js";import{_ as nt}from"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./runtimeSurface-CJN1oo_1.js";import"./nativeFileSave-Bhafll_7.js";const ot=({mode:t,children:r})=>e.jsx(Ne.Provider,{value:t,children:r}),it=Ee,at=_e,ct=({totalTokens:t,percentage:r,colorPercentage:n,contextLimit:a,outputLimit:o,size:u="default",isMobile:l=!1,hideIcon:D=!1,showPercentIcon:E=!1,className:p,valueClassName:f,percentIconClassName:_,onClick:M,pressed:L=!1,cacheRead:x,cacheWrite:C,cacheHitPercent:h})=>{const[b,i]=c.useState(!1),g=typeof n=="number"?n:r,m=it(r)??0,y=at(g),Y=y==="critical"?"var(--status-error)":y==="warn"?"var(--status-warning)":"var(--status-success)",w=I=>I>=1e6?`${(I/1e6).toFixed(1)}M`:I>=1e3?`${(I/1e3).toFixed(1)}K`:I.toFixed(1).replace(/\.0$/,""),N=I=>I>=90?"text-status-error":I>=75?"text-status-warning":"text-status-success",k=20,$=3,W=(k-$)/2,re=2*Math.PI*W,Q=re*(1-m/100),T=typeof o=="number"?Math.max(o,0):0,A=typeof x=="number"&&typeof C=="number",Z=A?Math.max(0,x):0,B=A?Math.max(0,C):0,O=typeof h=="number"&&Number.isFinite(h),R=[`Used tokens: ${w(t)}`,`Context limit: ${w(a)}`,`Output limit: ${w(T)}`,...A?[`Cache read: ${w(Z)}`,`Cache write: ${w(B)}`]:[],...O?[`Cache hit: ${h.toFixed(1)}%`]:[],`${Math.min(r,999).toFixed(1)}% used`],F=!l&&typeof M=="function",v=e.jsxs(e.Fragment,{children:[!l&&!D&&e.jsx(J,{name:"donut-chart",className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:K("font-medium inline-flex items-center gap-1.5",f),children:E?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{viewBox:`0 0 ${k} ${k}`,className:K("h-3.5 w-3.5 -rotate-90",_),role:"progressbar","aria-valuenow":Math.round(m),"aria-valuemin":0,"aria-valuemax":100,children:[e.jsx("circle",{cx:k/2,cy:k/2,r:W,fill:"none",stroke:"var(--interactive-border)",strokeWidth:$}),e.jsx("circle",{cx:k/2,cy:k/2,r:W,fill:"none",stroke:Y,strokeWidth:$,strokeLinecap:"round",strokeDasharray:re,strokeDashoffset:Q,className:"transition-[stroke-dashoffset,stroke] duration-300"})]}),e.jsxs("span",{className:"text-foreground",children:[Math.min(r,999).toFixed(1),"%"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:N(g),children:Math.min(r,999).toFixed(1)}),"%"]})})]}),S=K("app-region-no-drag flex items-center gap-1.5 select-none",u==="compact"?"typography-micro":"typography-meta",F?K("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",p),H=F?e.jsx("button",{type:"button",className:S,"aria-label":"Context usage","aria-pressed":L,onClick:M,children:v}):e.jsx("div",{className:S,"aria-label":"Context usage",onClick:l?()=>i(!0):void 0,children:v});return l?e.jsxs(e.Fragment,{children:[H,e.jsx(De,{open:b,onClose:()=>i(!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:w(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:w(a)})]}),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:w(T)})]}),A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"typography-meta text-muted-foreground",children:"Cache read"}),e.jsx("span",{className:"typography-meta text-foreground font-medium",children:w(Z)})]}),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:w(B)})]})]}):null,O?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:[h.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:K("typography-meta font-semibold",N(g)),children:[Math.min(r,999).toFixed(1),"%"]})]})]})})})]}):e.jsxs(Pe,{children:[e.jsx(Me,{asChild:!0,children:H}),e.jsx(ke,{children:e.jsx("div",{className:"space-y-0.5",children:R.map(I=>e.jsx("p",{className:"typography-micro leading-tight",children:I},I))})})]})},lt=c.lazy(()=>nt(()=>import("./SessionSwitcherDropdown-CA64t2xd.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.SessionSwitcherDropdown}))),dt=t=>{const r=typeof t=="string"?t.trim():"";if(!r)return"";const n=typeof window<"u"?window.__PICHAMBER_HOME__:"";if(n&&r===n)return"~";if(n&&r.startsWith(`${n}/`))return`~/${r.slice(n.length+1)}`;const a=r.split("/").filter(Boolean);return a.length<=3?r:`.../${a.slice(-3).join("/")}`},se=t=>{const r=typeof t=="string"?t.trim():"";if(!r)return"";const n=r.replace(/\\/g,"/");return n==="/"?"/":n.replace(/\/+$/,"")},ut=({mode:t})=>{const r=j(s=>s.currentSessionId),n=j(s=>!!s.newSessionDraft?.open),a=j(s=>s.newSessionDraft?.selectedProjectId??null),o=V(s=>s.currentDirectory),u=ae(s=>s.projects),l=ae(s=>s.getActiveProject()),D=P(s=>s.getCurrentModel),E=P(s=>s.providers),p=ce(),f=Le(r??""),_=Re(),M=Te(s=>s.ensureStatus),L=j(s=>s.newSessionDraft?.open?se(s.newSessionDraft.directoryOverride??""):""),[x,C]=c.useState(!1),h=typeof window<"u"?window.__PICHAMBER_MACOS_MAJOR__??0:0,b=Number.isFinite(h)&&h>0,i=Ae(),g=b?h>=26?"h-12":h<=15?"h-14":"":"",m=c.useMemo(()=>r?p.find(s=>s.id===r)??null:null,[r,p]);c.useEffect(()=>{ge()&&X("desktop_get_window_pinned").then(s=>{typeof s?.pinned=="boolean"&&C(s.pinned)})},[]);const y=m?.title?.trim()||(n||t==="draft"?"New session":"Session"),Y=se(m?.directory??null),w=se(o),N=Y||L||w,k=dt(N);c.useEffect(()=>{N&&M(N,_.git).catch(()=>{})},[M,N,_.git]);const $=c.useMemo(()=>{const s=N;return s?u.map(d=>({...d,normalizedPath:se(d.path)})).filter(d=>d.normalizedPath&&(d.normalizedPath===s||s.startsWith(`${d.normalizedPath}/`))).sort((d,G)=>G.path.length-d.path.length)[0]??null:null},[N,u]),W=c.useMemo(()=>{const s=$??l;if(!s)return k||"PiChamber";const d=s.label?.trim();return d||(s.path.split(/[\\/]/).filter(Boolean).at(-1)??s.path)},[l,k,$]),Q=Be(N||null),T=Q&&Q!=="HEAD"?Q:null,A=D(),Z=c.useMemo(()=>{for(let s=f.length-1;s>=0;s-=1){const d=f[s];if(d.role!=="assistant"||typeof d.providerID!="string"||typeof d.modelID!="string")continue;const te=E.find(q=>q.id===d.providerID)?.models.find(q=>q.id===d.modelID);if(te)return te}},[f,E]),B=A?.limit?A:Z,O=B&&typeof B.limit=="object"&&B.limit!==null?B.limit:null,R=O&&typeof O.context=="number"?O.context:0,F=O&&typeof O.output=="number"?O.output:0,v=c.useMemo(()=>{if(!r||f.length===0)return null;let s,d;for(let ne=f.length-1;ne>=0;ne-=1){const oe=f[ne];if(oe.role!=="assistant")continue;const z=oe.tokens;if(!z)continue;if(z.input+z.output+z.reasoning+(z.cache?.read??0)+(z.cache?.write??0)>0){s=z,d=oe.id;break}}if(!s)return null;const G=s.input+s.output+s.reasoning+(s.cache?.read??0)+(s.cache?.write??0),te=R>0?R:2e5,q=R>0?Math.round(G/R*100):0,xe=F>0?Math.round(s.output/F*100):void 0;return{totalTokens:G,percentage:q,contextLimit:R||0,outputLimit:F||void 0,normalizedOutput:xe,thresholdLimit:te,lastMessageId:d}},[R,r,f,F]),[S,H]=c.useState(null),I={WebkitAppRegion:"drag"},ee={WebkitAppRegion:"no-drag"};c.useEffect(()=>{if(!r){H(s=>s===null?s:null);return}if(v&&v.totalTokens>0){H(s=>s&&s.totalTokens===v.totalTokens&&s.percentage===v.percentage&&s.contextLimit===v.contextLimit&&(s.outputLimit??0)===(v.outputLimit??0)&&(s.normalizedOutput??0)===(v.normalizedOutput??0)&&s.thresholdLimit===v.thresholdLimit&&s.lastMessageId===v.lastMessageId?s:v);return}H(s=>s===null?s:null)},[v,r]);const fe=S&&S.contextLimit>0?Math.min(999,S.totalTokens/S.contextLimit*100):0,pe=c.useCallback(()=>{const s=!x;C(s),X("desktop_set_window_pinned",{pinned:s}).catch(()=>{C(!s)})},[x]),he=c.useCallback(()=>{const s=r?{sessionId:r,directory:m?.directory??o??""}:{mode:"draft",directory:N||o||"",projectId:a};X("desktop_focus_main_window",s).then(d=>d?.focused===!0?X("desktop_close_current_window"):null)},[o,r,a,N,m]);return e.jsxs("header",{className:K("flex items-center gap-3 bg-background pr-3",b?"pl-[5.5rem]":"pl-3",i?"h-12":g||"min-h-14"),style:I,children:[e.jsx(me.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:y}),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:W}),T?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(J,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:T})]}):null]})]}),children:e.jsx(lt,{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:y}),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:W}),T?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(J,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:T})]}):null]})]})})}),e.jsx("div",{className:"min-w-0 flex-1"}),S&&S.totalTokens>0?e.jsx(ct,{totalTokens:S.totalTokens,percentage:fe,colorPercentage:S.percentage,contextLimit:S.contextLimit,outputLimit:S.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(de,{type:"button",variant:"ghost",size:"icon",onClick:pe,"aria-label":x?"Unpin Mini Chat window":"Pin Mini Chat window",title:x?"Unpin window":"Pin above other windows",style:ee,children:x?e.jsx(J,{name:"pushpin-2-fill",className:"h-4 w-4"}):e.jsx(J,{name:"pushpin-2",className:"h-4 w-4"})}),e.jsx(de,{type:"button",variant:"ghost",size:"icon",onClick:he,"aria-label":"Open session in main window",title:"Open in main window",style:ee,children:e.jsx(J,{name:"external-link",className:"h-4 w-4"})}),e.jsx(Fe,{visible:i})]})},mt=({mode:t,autoOpenDraft:r=!1,unavailable:n=!1})=>{const a=j(o=>o.currentSessionId);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:[e.jsx(ut,{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(ot,{mode:"mini-chat",children:e.jsx(Oe,{autoOpenDraft:r},a??"no-session")})})]})},ft=()=>{const t=ie(o=>o.shortcutOverrides),r=V(o=>o.currentDirectory),n=ae(o=>o.getActiveProject()),a=j(o=>o.openNewSessionDraft);c.useEffect(()=>{const o=l=>ve(l,t),u=l=>{if(U(l,o("focus_input"))){l.preventDefault(),ue();return}if(we()&&U(l,o("new_mini_chat"))){l.preventDefault(),X("desktop_open_draft_mini_chat_window",{directory:r||n?.path||"",projectId:n?.id??null})?.catch(p=>{console.warn("[mini-chat-shortcuts] failed to open draft mini chat window",p)});return}if(U(l,o("new_chat"))){l.preventDefault(),a({selectedProjectId:n?.id??null,directoryOverride:r||n?.path||null,preserveDirectoryOverride:!!(r||n?.path)}),ue();return}if(U(l,o("open_model_selector"))){l.preventDefault();const{isModelSelectorOpen:p,setModelSelectorOpen:f}=ie.getState();f(!p);return}if(U(l,o("cycle_thinking_variant"))){if(P.getState().getCurrentModelVariants().length===0)return;l.preventDefault(),ze(1).catch(()=>{Ue.error("Couldn't update thinking")});return}const D=U(l,o("cycle_favorite_model_forward")),E=U(l,o("cycle_favorite_model_backward"));if(D||E){const{favoriteModels:p,addRecentModel:f}=ie.getState();if(p.length===0)return;l.preventDefault();const{currentProviderId:_,currentModelId:M,setProvider:L,setModel:x}=P.getState(),C=p.findIndex(i=>i.providerID===_&&i.modelID===M),b=p[(C+(D?1:-1)+p.length)%p.length];L(b.providerID),x(b.modelID),f(b.providerID,b.modelID)}};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n?.id,n?.path,r,a,t])},pt="pichamber:mini-chat-presence",ht=()=>{const t=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=t.get("mode")==="session"?"session":"draft",n=t.get("sessionId")?.trim()||null,a=t.get("directory")?.trim()||null,o=t.get("projectId")?.trim()||null;return{mode:r,sessionId:n,directory:a,projectId:o}},xt=({config:t})=>{const r=ce(),n=V(i=>i.currentDirectory),a=V(i=>i.setDirectory),o=j(i=>i.currentSessionId),u=j(i=>!!i.newSessionDraft?.open),l=j(i=>i.newSessionDraft?.open?i.newSessionDraft.bootstrapPendingDirectory??i.newSessionDraft.directoryOverride??"":""),D=j(i=>i.setCurrentSession),E=j(i=>i.openNewSessionDraft),p=P(i=>i.initializeApp),f=P(i=>i.isInitialized),_=P(i=>i.isConnected),M=P(i=>i.loadProviders),L=P(i=>i.providers.length),x=Xe();c.useEffect(()=>{p()},[p]),c.useEffect(()=>{if(f)return;let i=!0,g=0;const m=window.setInterval(()=>{if(i){if(g+=1,g>10){window.clearInterval(m);return}P.getState().isInitialized||P.getState().initializeApp()}},1e3);return()=>{i=!1,window.clearInterval(m)}},[f]);const C=c.useRef(!1);c.useEffect(()=>{if(!C.current&&t.mode==="session"&&t.directory){if(n===t.directory){C.current=!0;return}a(t.directory,{showOverlay:!1}),C.current=!0}},[t.directory,t.mode,n,a]),c.useEffect(()=>{t.mode!=="draft"||!u||o||!l||n===l||a(l,{showOverlay:!1})},[t.mode,n,o,l,u,a]),c.useEffect(()=>{_&&L===0&&M({source:"electronMiniChat:recovery"})},[_,M,L]);const h=c.useRef(!1);c.useEffect(()=>{if(h.current||t.mode!=="session"||!t.sessionId)return;if(o===t.sessionId){h.current=!0;return}if(o){h.current=!0;return}const i=r.find(m=>m.id===t.sessionId);if(!i){x.ensureSessionRenderable(t.sessionId);return}const g=i.directory??t.directory;D(t.sessionId,g),h.current=!0},[t,o,r,D,x]),c.useEffect(()=>{const i=g=>{const m=g.detail,y=typeof m?.sessionId=="string"?m.sessionId.trim():"";if(!y||j.getState().currentSessionId===y)return;const Y=typeof m?.directory=="string"&&m.directory.trim().length>0?m.directory.trim():r.find(w=>w.id===y)?.directory??null;x.ensureSessionRenderable(y),D(y,Y),h.current=!0};return window.addEventListener("pichamber:open-session",i),()=>window.removeEventListener("pichamber:open-session",i)},[r,D,x]),c.useEffect(()=>{t.mode!=="draft"||u||o||E({selectedProjectId:t.projectId,directoryOverride:t.directory,preserveDirectoryOverride:!!t.directory})},[t,o,u,E]);const b=c.useRef(!1);return c.useEffect(()=>{if(b.current||!f)return;const i=()=>{if(b.current)return;b.current=!0;const y=typeof document<"u"?document.getElementById("initial-loading"):null;y&&(y.classList.add("fade-out"),window.setTimeout(()=>y.remove(),300))},g=t.mode==="session"?o===t.sessionId:u,m=window.setTimeout(i,g?100:1500);return()=>window.clearTimeout(m)},[f,t.mode,t.sessionId,o,u]),null},yt=()=>{const t=j(n=>n.currentSessionId),r=V(n=>n.currentDirectory);return c.useEffect(()=>{if(!t||!r||typeof BroadcastChannel>"u")return;const n=new BroadcastChannel(pt),a=l=>{n.postMessage({type:"mini-chat-session-presence",sessionId:t,directory:r,viewed:l})};a(!0);const o=window.setInterval(()=>a(!0),5e3),u=()=>a(!1);return window.addEventListener("beforeunload",u),()=>{window.clearInterval(o),window.removeEventListener("beforeunload",u),a(!1),n.close()}},[r,t]),null},gt=t=>{const r=ce(),n=j(u=>u.currentSessionId),[a,o]=c.useState(!1);return c.useEffect(()=>{if(t.mode!=="session"||!t.sessionId||n===t.sessionId){o(!1);return}if(r.some(l=>l.id===t.sessionId)){o(!1);return}const u=window.setTimeout(()=>o(!0),5e3);return()=>window.clearTimeout(u)},[t.mode,t.sessionId,n,r]),a};function wt({apis:t}){const r=c.useMemo(()=>ht(),[]),n=V(a=>a.currentDirectory);return c.useEffect(()=>{const a=n||r.directory;if(!a)return;const o=r.mode==="session"?{sessionId:r.sessionId,directory:r.directory}:null;$e().focusProject(a,Se(a,o))},[r.directory,r.mode,r.sessionId,n]),c.useEffect(()=>(le(t),()=>le(null)),[t]),We(),ft(),e.jsx(He,{children:e.jsx(Ge,{directory:n||r.directory,children:e.jsxs(Ke,{apis:t,children:[e.jsx(Je,{}),e.jsx(Ve,{delayDuration:300,skipDelayDuration:150,children:e.jsxs("div",{className:"h-full text-foreground bg-background",children:[e.jsx(vt,{config:r}),e.jsx(Ye,{}),e.jsx(Qe,{})]})})]})})})}const vt=({config:t})=>{const r=gt(t);return e.jsxs(e.Fragment,{children:[e.jsx(xt,{config:t}),e.jsx(yt,{}),e.jsx(qe,{embeddedBackgroundWorkEnabled:!0}),e.jsx(mt,{mode:t.mode,autoOpenDraft:t.mode==="draft",unavailable:r})]})},jt=()=>{(async()=>{try{await Promise.all([be(),Ie()])}catch(t){console.error("[mini-chat-main] settings init failed:",t)}tt(),st(),rt(),Ce()})()};function Tt(t){const r=t??je();if(!r)throw new Error("Runtime APIs not registered");jt();const n=document.getElementById("root");if(!n)throw new Error("Root element not found");ye.createRoot(n).render(e.jsx(me.StrictMode,{children:e.jsx(Ze,{children:e.jsx(et,{children:e.jsx(wt,{apis:r})})})}))}export{Tt as renderElectronMiniChatApp};
|
package/dist/assets/{renderFileWithHighlighter-DUGluXlw.js → renderFileWithHighlighter-RJTrDxFH.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as I}from"./themeResolver-
|
|
1
|
+
import{t as I}from"./themeResolver-DrfmQi8i.js";import{b as R,i as y,j as k,k as A,l as S,m as T}from"./computeVirtualFileMetrics-ydVGT2RY.js";import{d9 as _}from"./useAppFontEffects-CHnpTOtc.js";function w(e){return I.hasResolvedThemes(e)}function z(e,t){return R(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function D(e){return(e.lang??y(e.name))==="text"}const d=10,g=13;function N(e){const t=[0];for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);(r===d||r===g)&&(r===g&&n+1<e.length&&e.charCodeAt(n+1)===d&&n++,t.push(n+1))}return t}function P(e){const t=N(e);return Array.from({length:t.length},(n,r)=>{const i=t[r],s=t[r+1]??e.length;return e.slice(i,s)})}const b={forcePlainText:!1};function M(e,t,{theme:n=_,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:s,startingLine:o,totalLines:a,lines:E}=b){s?(o??=0,a??=1/0):(o=0,a=1/0);const f=o>0||a<1/0,{state:F,transformers:l}=k(i),c=s?"text":e.lang??y(e.name),x=typeof n=="string"?t.getTheme(n).type:void 0,p=A({theme:n,highlighter:t});F.lineInfo=u=>({type:"context",lineIndex:u-1+o,lineNumber:u+o});const C=typeof n=="string"?{lang:c,theme:n,transformers:l,defaultColor:!1,cssVariablePrefix:T("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:c,themes:n,transformers:l,defaultColor:!1,cssVariablePrefix:T("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},m=S(t.codeToHast(f?H(E??P(e.contents),o,a):e.contents,C)),h=f?new Array(o):m;return f&&h.push(...m),{code:h,themeStyles:p,baseThemeType:x}}function H(e,t,n){if(e.length===0)return"";const r=Math.min(t+n,e.length);return e.slice(t,r).join("")}export{z as a,w as h,D as i,P as l,M as r};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-Ccl4CxjR.js","assets/vendor-boot-CoTxysn6.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/index-C2ISrmRR.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-DgwThEwf.css","assets/useAppFontEffects-CHnpTOtc.js","assets/runtimeSurface-CJN1oo_1.js","assets/nativeFileSave-Bhafll_7.js","assets/vendor-codemirror-lang-javascript-Dkzl3s07.js","assets/vendor-lezer-javascript-B3s21DIS.js","assets/vendor-lezer-lr-Bllrq8hY.js","assets/vendor-codemirror-autocomplete-qsuH4Dh-.js","assets/vendor-codemirror-lang-json-CsdmtHhi.js","assets/vendor-lezer-json-DPFM6EBV.js","assets/vendor-codemirror-lang-css-2bFuyM70.js","assets/vendor-lezer-css-JnEzSyZR.js","assets/vendor-codemirror-lang-html-BV8lrR8v.js","assets/vendor-lezer-html-Cr3U-1pu.js","assets/vendor-codemirror-lang-markdown-C0Zu3b3n.js","assets/vendor-lezer-markdown-6-3PLvXG.js","assets/vendor-codemirror-language-data-vn2RyN9T.js","assets/vendor-codemirror-lang-python-Cv2exx_M.js","assets/vendor-lezer-python-CdHdN5qt.js","assets/shell-CjFT_Tl9.js","assets/appThemeRegistry-Ca8eGRB9.js","assets/registerCustomTheme-C-h6lsYW.js","assets/themeResolver-DrfmQi8i.js","assets/vendor-pierre-theming-BO6EPniU.js","assets/vendor-shikijs-core-Ck_OPM_T.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-DPFxvYtK.js","assets/vendor-hast-util-to-html-O3stl53j.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-C40bX6nM.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-comma-separated-tokens-D8TqSuIK.js","assets/vendor-space-separated-tokens-DD3iYX1K.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/FileSaveConflictDialog-C6o4fYIn.js","assets/vendor-react-drawio-IYnLUY5N.js","assets/runtimeEndpointReset-OqTh3bbO.js","assets/SessionUnreadDot-BZy2DM6H.js","assets/permissionStore-zIpxq9Pq.js","assets/runtimeEndpointReset-BV3KOtdA.css","assets/vendor-xterm-xterm-css-DDGTF8rc.css","assets/useFilesViewSearch-DeVixiGZ.js","assets/JsonTreeView-RLgBKik9.js","assets/web-components-CIPJC1JE.js","assets/computeVirtualFileMetrics-ydVGT2RY.js","assets/vendor-shiki-BEwTOAFg.js","assets/vendor-shikijs-engine-oniguruma-DPWuIF1G.js","assets/vendor-shikijs-engine-javascript-DL394yyj.js","assets/vendor-oniguruma-to-es-DgwFOwdE.js","assets/vendor-oniguruma-parser-BrbMHgHx.js","assets/vendor-regex-BBWcyTkg.js","assets/vendor-regex-utilities-2BQyy0xI.js","assets/vendor-regex-recursion-JU4mF-dD.js","assets/vendor-shikijs-transformers-CZWsLLKm.js","assets/Virtualizer-DNJrJKVb.js","assets/renderFileWithHighlighter-RJTrDxFH.js","assets/vendor-codemirror-search-BVCYIV0D.js","assets/vendor-replit-codemirror-vim-Cwhyn_5f.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/StickyHorizontalScrollbar-p7EbL2-E.js","assets/GitView-BkrH0HFQ.js","assets/gitStatusPredicates-BzR54iPh.js","assets/GitHubDetailScaffold-DlgVm5uD.js","assets/vendor-dompurify-BGCr_sdL.js","assets/collapsible-0yfy07W2.js","assets/vendor-base-ui-C7vVMZTg.js","assets/PierreDiffViewer-iLnLAFeL.js","assets/VirtualizedFileDiff-Cccy1L8L.js","assets/renderDiffWithHighlighter-JwKOWdBN.js","assets/vendor-diff-C3JhlQdm.js","assets/PullRequestsSurface-_kgJMFTh.js","assets/useGitHubRemoteSearch-GjQca1iD.js","assets/GitHubListPrimitives-BTeI3B3C.js","assets/IssuesSurface-CD1m8BHP.js","assets/githubLink-WO5BkC0U.js","assets/vendor-capacitor-app-NX6DULfp.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,aP as ze,aQ as Be,aR as Vt}from"./vendor-boot-CoTxysn6.js";import{a as qe,R as t}from"./vendor-react-Bz1tRBxM.js";/* empty css */import{b as Te,d as Gt,e as tt,f as M,u as Ct,i as Xt,h as je,n as Kt,r as he,j as ue,s as Ne,k as qt,l as Yt,m as nt,o as Qt,p as Nt,q as Jt,t as Zt,v as en}from"./index-C2ISrmRR.js";import{f as tn,a as nn,s as sn}from"./pi-session-focus-preference-D6vrJGbH.js";import{u as rn,M as an,a as on,i as ln,D as st,b as rt,c as it,g as cn,d as at,e as un,s as dn,S as fn,f as hn,T as pn,h as ot,j as lt,k as mn,r as bn,l as xn,m as gn,n as yn,H as vn,A as wn,C as Sn,o as jn,p as Rn,q as kn,O as En,F as Cn,t as Nn,v as Tn,W as In,w as Pn}from"./runtimeEndpointReset-OqTh3bbO.js";import{g as Ie,l as An,u as Dn,a as Tt,b as _n,c as Mn,r as It,d as Ln,e as ke,t as He,o as On,I as ie,s as zn,f as Pt,P as ve,B as Pe,S as Wn,h as ae,i as Un,j as Bn,k as Hn,m as $n,n as Fn,p as Vn,q as Gn,v as At,w as Xn,E as ee,C as Me,x as Dt,y as Kn,z as qn,A as ct,D as Yn,F as Qn,G as Jn,H as Zn,J as es,K as ts,L as ns,M as ss,N as rs,O as me,Q as is,R as ye,T as as,U as os,V as ls,W as cs,X as us,Y as ds,Z as fs,_ as hs,$ as ps,a0 as ms,a1 as bs,a2 as xs,a3 as gs,a4 as ys,a5 as vs,a6 as ws,a7 as Ss,a8 as js,a9 as Rs,aa as ks,ab as Es,ac as Cs,ad as Ns,ae as Ts}from"./useAppFontEffects-CHnpTOtc.js";import{u as Is,i as ut,p as Ps,s as As,m as Ds,M as _s,a as Ms,c as Ls,b as Le,d as $e,e as Os,g as Re,S as zs,A as Ws,f as Fe,r as Us}from"./SettingsView-TwUy1kXV.js";import{f as Bs,S as Hs,a as $s}from"./SessionUnreadDot-BZy2DM6H.js";import{u as Fs}from"./useSwitcherItems-DYtnl0T2.js";import{_ as De}from"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";/* empty css */import"./nativeFileSave-Bhafll_7.js";import"./permissionStore-zIpxq9Pq.js";import"./runtimeSurface-CJN1oo_1.js";import"./vendor-qrcode-gzL9QFkg.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./collapsible-0yfy07W2.js";import"./vendor-base-ui-C7vVMZTg.js";let _t=null,dt=!1;const Vs=new Promise(s=>{_t=s});function Gs(){dt||(dt=!0,_t?.())}const Xs=6,Ks=s=>s.parentID??null,ft=s=>{const n=s.replace(/\/+$/,"");return n.slice(n.lastIndexOf("/")+1)||n},qs=s=>s.replace(/\\/g,"/").replace(/\/+$/,""),Ys=(s,n)=>{if(!s)return"";let r=null,i=-1;for(const l of n){const a=qs(l.path);(s===a||s.startsWith(`${a}/`))&&a.length>i&&(r=l,i=a.length)}return r?r.label?.trim()||ft(r.path):ft(s)},Qs=()=>{const s=Ie().getState().catalog,n=[];for(const d of s.byId.values())d.archived||n.push(An(d));const r=Dn.getState().index.session.unseenCount,i=Tt.getState().projects,l=_n.getState().ids,a=Mn.getState().rankById;let o=0;const w=[];for(const d of n){const y=Ks(d)!==null,S=(r[d.id]??0)>0;S&&(o+=1),y||w.push({session:d,unread:S,project:Ys(It(d),i)})}w.sort(Ln(l,a,d=>d.session));const m=w.slice(0,Xs).map(({session:d,unread:y,project:j})=>({id:d.id,title:d.title??"",unread:y,project:j}));return{runtimeKey:Te(),attentionCount:o,recentSessions:m}},Js="__PICHAMBER_WIDGET_SNAPSHOT__",Zs=()=>{typeof window>"u"||(window[Js]=()=>{try{return JSON.stringify(Qs())}catch{return null}})},Ve="mobile-app-update-available",ht="mobile-app-update-toast-dismissed-version",er=()=>{const s=ke(a=>a.available),n=ke(a=>a.runtimeType),r=ke(a=>a.info?.version),i=ke(a=>a.info?.downloadUrl),l=qe.useRef(new Set);return qe.useEffect(()=>{if(Gt()!=="android"||n!=="mobile"||!s||!r||!i){He.dismiss(Ve);return}tt().getItem(ht)!==r&&(l.current.has(r)||(l.current.add(r),He.info("PiChamber update available",{id:Ve,description:`Version ${r} is ready for Android.`,duration:1/0,icon:e.jsx(ie,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:"Download",onClick:()=>{On(i)}},cancel:{label:"Dismiss",onClick:()=>{tt().setItem(ht,r),He.dismiss(Ve)}}})))},[s,i,n,r]),null},tr=s=>{const{persisted:n,persistedDirectory:r,stale:i,ready:l,catalog:a,runtimeKey:o,capturedRuntimeKey:w,storeIdentityMatches:m,generationMatches:d}=s;if(!n||!r)return{action:"wait"};if(i||o!==w||!m||!d)return{action:"wait"};if(!l||!a)return{action:"wait"};const y=a.byId.get(n.sessionId);return!y||y.archived?{action:"clear"}:{action:"select",sessionId:y.id,directory:y.directory??r}},nr=({onConnected:s,notice:n=null})=>{const r=Is(s),{connections:i,isBusy:l,isPasswordBusy:a,error:o,pendingConnection:w}=r,[m,d]=t.useState(""),[y,j]=t.useState(""),[S,N]=t.useState(""),[v,T]=t.useState(!1),[k,E]=t.useState(!1),C=t.useRef(null),p=t.useMemo(()=>ut(),[]),[f,I]=t.useState(()=>!ut()),[P,H]=t.useState(null),[$,_]=t.useState(""),A=t.useCallback(g=>{g.preventDefault(),r.connect({url:m,clientToken:S,label:y})},[S,r,y,m]),L=t.useCallback(g=>{if(/^pichamber:\/\//i.test(g.trim())){const R=Ps(g);if(R){if("pairing"in R){r.redeemPairingConnection(R.pairing);return}d(R.url),R.label&&j(R.label),R.clientToken&&N(R.clientToken);return}}d(g)},[r]),h=t.useCallback(async()=>{if(C.current||l)return;r.setError(null),T(!0);const g=new AbortController;C.current=g;try{const R=await As({signal:g.signal});switch(C.current===g&&(C.current=null,T(!1)),R.status){case"ok":E(!0),d(R.url),R.label&&j(R.label),R.clientToken&&N(R.clientToken),await r.connect({url:R.url,clientToken:R.clientToken,label:R.label});break;case"pairing":E(!0),await r.redeemPairingConnection(R.pairing);break;case"permission-denied":r.setError("Camera access is off. Enable it in Settings to scan a QR code.");break;case"invalid":r.setError("That QR code is not an PiChamber connection code.");break;case"unsupported":r.setError("QR scanning is only available in the installed mobile app.");break;case"failed":r.setError("Could not scan that QR code. Try again or enter the URL manually.");break;default:break}}finally{E(!1),C.current===g&&(C.current=null,T(!1))}},[r,l]);t.useEffect(()=>()=>C.current?.abort(),[]);const D=t.useCallback(g=>{g.preventDefault(),r.submitPassword($)},[r,$]),z=t.useMemo(()=>zn(i.map(g=>Ds(g,{isCurrent:!1,status:P===g.id?{kind:"connecting"}:{kind:"unknown"},probing:P===g.id}))),[i,P]),B=t.useCallback(g=>{const R=i.find(V=>V.id===g)??null;R&&(H(g),r.connect({id:R.id,candidates:R.candidates,clientToken:R.clientToken,label:R.label}).finally(()=>H(null)))},[r,i]),W=t.useCallback(()=>{_(""),r.cancelPassword()},[r]),q=t.useCallback(()=>v?(C.current?.abort(),T(!1),!0):w?(W(),!0):f&&p?(I(!1),!0):!1,[W,v,f,w,p]);return Pt(q),e.jsxs(e.Fragment,{children:[v?e.jsx(_s,{onCancel:()=>C.current?.abort()}):null,k?e.jsx(Ms,{}):null,e.jsx("main",{className:"oc-keyboard-fill-screen flex min-h-dvh flex-col overflow-y-auto bg-background px-6 pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+28px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+28px)] text-foreground",children:e.jsxs("div",{className:"m-auto flex w-full max-w-[360px] shrink-0 flex-col items-center gap-9 py-8",children:[e.jsxs("div",{className:"flex flex-col items-center gap-5 text-center",children:[e.jsx(ve,{width:72,height:72,className:"size-[72px]"}),e.jsx("h1",{className:"typography-h2 text-foreground",children:"Connect to PiChamber"})]}),n?e.jsxs("div",{role:"status",className:"flex w-full items-center gap-3 rounded-[18px] border border-[color-mix(in_srgb,var(--status-warning)_35%,transparent)] bg-[color-mix(in_srgb,var(--status-warning)_10%,transparent)] px-3.5 py-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-[color-mix(in_srgb,var(--status-warning)_16%,transparent)] text-[var(--status-warning)]",children:e.jsx(ie,{name:n.kind==="auth-expired"?"lock":"cloud-off",className:"size-[18px]"})}),e.jsx("p",{className:"min-w-0 flex-1 typography-small text-foreground",children:n.kind==="auth-expired"?`Access to ${n.label} has expired or was revoked. Sign in again.`:`Couldn't reach ${n.label}. Check that the server is running.`})]}):null,w?e.jsxs("form",{className:"flex w-full flex-col gap-3",onSubmit:D,children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-border/70 bg-surface-elevated px-3.5 py-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:e.jsx(ie,{name:"lock",className:"size-[18px]"})}),e.jsxs("div",{className:"min-w-0 text-left",children:[e.jsx("p",{className:"truncate typography-ui-label text-foreground",children:w.label}),e.jsx("p",{className:"truncate typography-small text-muted-foreground",children:w.candidates.some(g=>g.kind==="direct")?Ls(w):"via PiChamber Relay"})]})]}),e.jsx("input",{...$e,value:$,onChange:g=>_(g.target.value),placeholder:"PiChamber password","aria-label":"Password",type:"password",autoFocus:!0,className:Le}),o?e.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:o}):null,e.jsx(Pe,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",disabled:a||!$.trim(),children:a?"Connecting...":"Unlock and connect"}),e.jsx(Pe,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:W,children:"Use another server"})]}):e.jsxs("div",{className:"flex w-full flex-col gap-6",children:[p?e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsxs(Pe,{type:"button",size:"lg",className:"h-12 w-full",onClick:()=>{h()},disabled:v||l,children:[e.jsx(ie,{name:"scan-2",className:M("size-[18px]",v&&"animate-pulse")}),l?"Connecting...":"Scan QR code"]}),e.jsx("p",{className:"px-2 text-center typography-small text-muted-foreground",children:"On your computer, open «Add a device» to show a QR code, then scan it here."})]}):null,o&&!f?e.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:o}):null,i.length>0?e.jsxs("section",{className:"flex w-full flex-col gap-2.5",children:[e.jsx("h2",{className:"text-center typography-micro uppercase tracking-[0.14em] text-muted-foreground",children:"Saved servers"}),e.jsx(Wn,{items:z,layout:"touch",switchLabel:"Connect",pendingId:P,actionsDisabled:l,onSwitch:g=>B(g.id),emptyMessage:"No saved servers yet."})]}):null,e.jsxs("div",{className:"flex w-full flex-col",children:[p?e.jsxs("button",{type:"button",onClick:()=>I(g=>!g),"aria-expanded":f,className:"mx-auto flex items-center gap-1 rounded-full px-2 py-1 typography-small text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[e.jsx("span",{children:"Connect by address"}),e.jsx(ie,{name:"arrow-down-s",className:M("size-4 transition-transform duration-200",f&&"rotate-180")})]}):null,e.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:f?"1fr":"0fr"},children:e.jsx("div",{className:"min-h-0 overflow-hidden",children:e.jsxs("form",{className:"flex w-full flex-col gap-3 pt-3",onSubmit:A,children:[e.jsx("input",{...$e,value:m,onChange:g=>L(g.target.value),placeholder:"http://192.168.1.74:2606","aria-label":"Server URL",type:"url",inputMode:"url",autoCapitalize:"none",tabIndex:f?void 0:-1,className:M(Le,"text-center")}),e.jsx("input",{value:y,onChange:g=>j(g.target.value),placeholder:"Optional display name","aria-label":"Name",autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,tabIndex:f?void 0:-1,className:M(Le,"text-center")}),e.jsx("input",{...$e,value:S,onChange:g=>N(g.target.value),placeholder:"Paste access token","aria-label":"Client token",tabIndex:f?void 0:-1,autoCapitalize:"none",className:M(Le,"text-center")}),e.jsx("p",{className:"px-1 text-center typography-micro text-muted-foreground",children:"Only needed if your server requires a token instead of a password."}),o?e.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:o}):null,e.jsx(Pe,{type:"submit",variant:p?"outline":"default",size:"lg",className:"h-12 w-full",disabled:l||v||!m.trim(),children:l?"Connecting...":"Connect"})]})})})]})]})]})})]})},sr=10,rr=(s,n)=>At(s,n),ir=({session:s,meta:n,active:r,onSelect:i})=>{const l=Un(s.id),a=Bn(s.id),o=Hn(s.id),w=l?.type??"idle",m=w==="busy"||w==="retry",d=$n({pendingInput:o,isStreaming:m,unseenCount:a,isActive:r}),y=d==="needs-input",j=y&&o?Fn(o.kind,o.count):null,S=d==="unread",N=Vn(s.id,m),v=m&&N,T=Bs(s.time?.updated??s.time?.created??0);return e.jsxs("button",{type:"button",className:M("flex w-full items-center gap-3 rounded-xl px-2.5 py-2 text-left transition-colors active:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",r&&"bg-[color-mix(in_srgb,var(--primary)_10%,transparent)]"),onClick:i,style:{touchAction:"manipulation"},children:[e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:M("block truncate typography-ui-label",r?"text-primary":"text-foreground"),children:rr(s,"Untitled session")}),n?e.jsx("span",{className:"block truncate typography-micro text-muted-foreground",children:n}):null]}),y?e.jsx(Gn,{label:j??"Needs input"}):m?e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-primary","aria-hidden":!0}):S?e.jsx(Hs,{label:"Session complete"}):null,v?e.jsx($s,{sessionId:s.id,running:m,className:"typography-micro"}):S||y?null:T?e.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:T}):null]})},ar=({open:s,onClose:n,anchorRef:r})=>{const{panelRef:i,wrapperRef:l,shouldRender:a,isExiting:o,anchorLeft:w,isPopover:m}=rn({open:s,onClose:n,anchorRef:r}),d=ae(v=>v.currentSessionId),y=ae(v=>v.setCurrentSession),j=Tt(v=>v.setActiveProjectIdOnly),S=Fs(s||a,{maxParents:sr}),N=t.useCallback(v=>{y(v.id,It(v)),n()},[n,y]);return a?e.jsxs("div",{ref:l,className:"fixed inset-x-0 bottom-0 top-[calc(var(--oc-safe-area-top,0px)+var(--oc-header-height,56px))] z-20 pointer-events-none",children:[e.jsx("div",{ref:i,role:"dialog","aria-label":"Open session switcher",className:M("flex flex-col overflow-hidden rounded-[20px] border border-border/70 bg-[var(--surface-elevated)] p-2 shadow-[0_12px_32px_rgb(0_0_0_/_0.2)] will-change-transform",m?"absolute origin-top-left":"mx-3 mt-2",o?"pointer-events-none":"pointer-events-auto"),style:{animation:`${o?"session-switcher-out":"session-switcher-in"} ${o?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...m?{top:8,left:w??8,width:`min(${an}px, calc(100% - 16px))`}:null},children:e.jsx("div",{className:"oc-hide-scrollbar min-h-0 flex-1 space-y-0.5 overflow-y-auto overscroll-contain",children:S.length===0?e.jsx("p",{className:"px-3 py-6 text-center typography-small text-muted-foreground",children:"No recent sessions"}):S.map(v=>{const T=v.node.session,k=[v.secondaryMeta?.projectLabel,v.secondaryMeta?.branchLabel].filter(Boolean).join(" · ");return e.jsx(ir,{session:T,meta:k,active:T.id===d,onSelect:()=>{v.projectId&&j(v.projectId),N(T)}},T.id)})})}),e.jsx("style",{children:`
|
|
3
|
+
@keyframes session-switcher-in {
|
|
4
|
+
from { opacity: 0; transform: translateY(-8px) scale(0.985); }
|
|
5
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
6
|
+
}
|
|
7
|
+
@keyframes session-switcher-out {
|
|
8
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
9
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.985); }
|
|
10
|
+
}
|
|
11
|
+
`})]}):null},or=({onOpenSessions:s,onOpenWorkspace:n,compactTitle:r=!1})=>{const[i,l]=t.useState(!1),[a,o]=t.useState(!1),w=t.useRef(null),m=Ct(p=>p.currentDirectory),d=ae(p=>p.currentSessionId),j=ae(t.useCallback(p=>d?p.getDirectoryForSession(d):null,[d]))||m,S=Xn(d),N=ae(p=>!!p.newSessionDraft?.open),T=S?.title?.trim()||(d?At(S,"Untitled session"):"New session");t.useEffect(()=>{l(!1),o(!1)},[d,j]);const k=t.useCallback(()=>{l(!1),o(!1),s()},[s]),E=t.useCallback(p=>{l(f=>{const I=typeof p=="function"?p(f):p;return I&&o(!1),I})},[]),C=t.useCallback(()=>{o(p=>{const f=!p;return f&&l(!1),f})},[]);return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"oc-mobile-header relative z-30 flex shrink-0 items-center gap-1 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",style:{paddingTop:"var(--oc-safe-area-top, 0px)"},children:e.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] w-full items-center gap-1 px-2",children:[e.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary","aria-label":"Open sessions and projects",onClick:k,style:{touchAction:"manipulation"},children:e.jsx(ie,{name:"list-unordered",className:"size-5"})}),e.jsx("button",{ref:w,type:"button",className:M("flex h-10 min-w-0 items-center rounded-lg px-2 py-1.5 text-left transition-colors active:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",r?"shrink":"flex-1"),"aria-label":"Open session switcher","aria-haspopup":"dialog","aria-expanded":a,onClick:C,style:{touchAction:"manipulation"},children:e.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("span",{className:"block min-w-0 truncate typography-ui-label text-foreground",children:T}),e.jsx(ie,{name:"arrow-down-s",className:M("size-4 shrink-0 text-muted-foreground transition-transform duration-150",a&&"rotate-180")})]})}),r?e.jsx("div",{className:"min-w-0 flex-1"}):null,e.jsx(on,{open:i,onOpenChange:E,currentSessionId:d,effectiveDirectory:j,isNewSessionDraftOpen:N}),e.jsx("button",{type:"button",className:"flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary","aria-label":"Open workspace panel",onClick:()=>{l(!1),o(!1),n()},style:{touchAction:"manipulation"},children:e.jsx(ie,{name:"layout-right",className:"size-5"})})]})}),e.jsx(ar,{open:a,onClose:()=>o(!1),anchorRef:w})]})},lr=({onActiveConnectionDeleted:s,onConnect:n})=>e.jsx(Os,{onConnect:n,onActiveConnectionDeleted:s,showDiagnostics:!0}),Ee=320,be="cubic-bezier(0.22, 1, 0.36, 1)",Mt=({side:s,enabled:n,open:r,drawerRef:i,scrimRef:l,onClose:a,widthRatio:o,prefersReducedMotion:w})=>{t.useEffect(()=>{if(!n||!r)return;const m=i.current,d=l.current;if(!m||!d)return;let y=!1,j=!1,S=!1,N=0,v=0,T=0,k=0;const E=w?0:Ee,C=s==="left"?"translateX(-100%)":"translateX(100%)",p=()=>({drawer:E?`transform ${E}ms ${be}`:"none",scrim:E?`opacity ${E}ms ${be}`:"none"}),f=()=>{const h=p();m.style.transition=h.drawer,d.style.transition=h.scrim,m.style.transform="none",d.style.opacity="1",d.style.pointerEvents="auto"},I=()=>{y=!1,j=!1,S=!1},P=()=>{if(!(y||j)){I();return}f(),I()},H=h=>{if(h.touches.length!==1){(y||j)&&P();return}if(ln(h.target,m,{excludeInteractive:!1}))return;m.style.transition&&m.style.transition!=="none"&&(m.style.transition="none",d.style.transition="none");const D=h.touches[0];N=D.clientX,v=D.clientY,T=Date.now(),k=m.offsetWidth||window.innerWidth*o,k<10&&(k=window.innerWidth*o),y=!0,j=!1,S=!1},$=h=>{if(!y)return;if(h.touches.length!==1){P();return}const D=h.touches[0],z=D.clientX-N,B=D.clientY-v;if(!S){if(Math.abs(z)<st&&Math.abs(B)<st)return;if(Math.abs(B)>Math.abs(z)*rt||!it(s,z)){y=!1;return}S=!0,j=!0,m.style.transition="none",d.style.transition="none"}if(!j)return;h.cancelable&&h.preventDefault();const W=at(s,z,k);m.style.transform=cn(s,W),d.style.opacity=String(W)},_=(h,D,z)=>{if(!y)return;const B=h-N,W=D-v,q=Math.max(1,Date.now()-T),g=at(s,B,k),R=dn({side:s,dx:B,dy:W,dt:q,progress:g,isDragging:j}),V=p();m.style.transition=V.drawer,d.style.transition=V.scrim,m.style.transform=R?C:"none",d.style.opacity=R?"0":"1",d.style.pointerEvents=R?"none":"auto",I(),R&&a()},A=h=>{const D=h.changedTouches[0];if(!D){P();return}const z=D.clientX-N,B=D.clientY-v,W=Math.abs(z)>=un&&Math.abs(B)<=Math.abs(z)*rt&&it(s,z);y&&(j||W)&&h.cancelable&&h.preventDefault(),_(D.clientX,D.clientY)},L=()=>{P()};return m.addEventListener("touchstart",H,{passive:!0}),m.addEventListener("touchmove",$,{passive:!1}),m.addEventListener("touchend",A,{passive:!1}),m.addEventListener("touchcancel",L,{passive:!0}),()=>{try{P()}catch{}m.removeEventListener("touchstart",H),m.removeEventListener("touchmove",$),m.removeEventListener("touchend",A),m.removeEventListener("touchcancel",L)}},[i,n,a,r,w,l,s,o])},cr=16,pt=t.memo(function({open:n,onOpenChange:r,variant:i="drawer",drawerRefExternal:l,scrimRefExternal:a,rootRefExternal:o}){const w=t.useRef(null),m=t.useCallback(()=>{const f=typeof document<"u"?document.activeElement:null;f instanceof HTMLElement&&w.current?.contains(f)&&f.blur(),r(!1)},[r]),[d,y]=t.useState(!1),j=t.useRef(null),S=t.useRef(null),N=l??j,v=a??S,T=t.useCallback(f=>{w.current=f,o&&(o.current=f)},[o]),k=t.useMemo(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[]);t.useEffect(()=>{const f=w.current;if(!f||n)return;const I=document.activeElement;I&&f.contains(I)&&I.blur()},[n]),t.useEffect(()=>{if(i!=="sidebar"){if(n){const f=window.setTimeout(()=>y(!0),k?0:cr);return()=>window.clearTimeout(f)}y(!1)}},[n,k,i]),t.useEffect(()=>{if(i==="sidebar"||!n)return;const f=document.body.style.overflow;document.body.style.overflow="hidden";const I=P=>{P.key==="Escape"&&m()};return document.addEventListener("keydown",I),()=>{document.body.style.overflow=f,document.removeEventListener("keydown",I)}},[m,n,i]);const E=i==="sidebar",C=e.jsx(fn,{mobileVariant:!E,isVisible:n,allowReselect:!0,onSessionSelected:E?void 0:m,onNavigateAway:E?void 0:m});if(Mt({side:"left",enabled:i==="drawer",open:n,drawerRef:N,scrimRef:v,onClose:m,widthRatio:.72,prefersReducedMotion:k}),i==="sidebar")return e.jsx("aside",{className:"relative flex h-full w-full flex-col bg-sidebar",children:C});if(typeof document>"u")return null;const p=k?0:Ee;return ze.createPortal(e.jsxs("div",{ref:T,className:"fixed inset-0 z-50",inert:!n,style:{pointerEvents:n?"auto":"none"},"data-mobile-sessions-root":"true",children:[e.jsx("button",{ref:v,type:"button",className:"absolute inset-0 cursor-default bg-black/70","aria-label":"Close sessions",onClick:m,tabIndex:n?0:-1,style:{opacity:d?1:0,transition:`opacity ${p}ms ${be}`},"data-mobile-sessions-scrim":"true"}),e.jsx("div",{ref:N,className:M("relative z-10 flex h-full w-[72%] max-w-[72%] flex-col bg-sidebar"),style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:d?"none":"translateX(-100%)",transition:p?`transform ${p}ms ${be}`:"none",touchAction:"pan-x pan-y"},"data-mobile-sessions-drawer":"true",children:C})]}),document.body)}),mt="mobile-surface-root",Ge=16,Oe=200,ur=()=>{if(typeof document>"u")return null;let s=document.getElementById(mt);return s||(s=document.createElement("div"),s.id=mt,document.body.appendChild(s)),s},Xe=({open:s,onClose:n,title:r,subtitle:i,trailing:l,disableEscapeDismiss:a=!1,headerless:o=!1,noHeaderBorder:w=!1,ariaLabel:m,variant:d="fullscreen",dialogAlign:y="chat",children:j})=>{const S=t.useRef(null),[N,v]=t.useState(!1),[T,k]=t.useState(!1),E=t.useRef(null),C=t.useRef(null),p=t.useRef(n);if(t.useEffect(()=>{p.current=n},[n]),typeof document<"u"&&!S.current&&(S.current=ur()),t.useEffect(()=>{if(!s){v(!1);return}const P=window.setTimeout(()=>v(!0),Ge);return()=>window.clearTimeout(P)},[s]),t.useEffect(()=>{if(!s){k(!1);return}const P=window.setTimeout(()=>k(!0),Ge+Oe+80);return()=>window.clearTimeout(P)},[s]),t.useEffect(()=>{if(!s)return;const P=document.body.style.overflow;C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,document.body.style.overflow="hidden";const H=()=>{const A=E.current;if(!A)return;(A.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??A).focus({preventScroll:!0})},$=window.setTimeout(H,Ge),_=A=>{if(A.key==="Escape"&&!a){p.current();return}if(A.key!=="Tab")return;const L=E.current;if(!L)return;const h=Array.from(L.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(W=>!W.hasAttribute("disabled")&&W.getAttribute("aria-hidden")!=="true");if(h.length===0){A.preventDefault(),L.focus({preventScroll:!0});return}const D=h[0],z=h[h.length-1],B=document.activeElement;A.shiftKey&&B===D?(A.preventDefault(),z.focus({preventScroll:!0})):!A.shiftKey&&B===z&&(A.preventDefault(),D.focus({preventScroll:!0}))};return document.addEventListener("keydown",_),()=>{window.clearTimeout($),document.body.style.overflow=P,document.removeEventListener("keydown",_),C.current?.focus?.({preventScroll:!0}),C.current=null}},[a,s]),!s||!S.current)return null;const f=d==="dialog",I=e.jsxs("section",{ref:E,role:"dialog","aria-modal":"true","aria-label":m,tabIndex:-1,className:M("flex flex-col bg-background text-foreground",f?"h-[min(88dvh,860px)] w-full max-w-[720px] overflow-hidden rounded-2xl border border-border/70 shadow-[0_24px_64px_rgb(0_0_0_/_0.32)]":"oc-keyboard-inset-surface fixed inset-0 z-50"),style:f?{opacity:N?1:0,transform:N?"none":"scale(0.97)",transition:`opacity ${Oe}ms ease-out, transform ${Oe}ms cubic-bezier(0.32, 0.72, 0, 1)`}:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:N?"none":"translateX(100%)",transition:`transform ${Oe}ms cubic-bezier(0.32, 0.72, 0, 1)`},onTransitionEnd:P=>{N&&P.target===P.currentTarget&&P.propertyName==="transform"&&k(!0)},children:[o?null:e.jsxs("header",{className:M("flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",!w&&"border-b border-border/70"),children:[e.jsx("button",{type:"button",className:"-ml-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary","aria-label":"Close",onClick:n,style:{touchAction:"manipulation"},children:e.jsx(ie,{name:"close",className:"size-5"})}),e.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[r?typeof r=="string"?e.jsx("h2",{className:"truncate typography-ui-label text-foreground",children:r}):r:null,i?typeof i=="string"?e.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:i}):i:null]}),l?e.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:l}):null]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:T?e.jsx("div",{className:"h-full",style:{animation:"oc-surface-content-in 200ms ease-out"},children:j}):null}),e.jsx("style",{children:"@keyframes oc-surface-content-in { from { opacity: 0 } to { opacity: 1 } }"})]});return f?ze.createPortal(e.jsx("div",{className:"oc-keyboard-inset-surface fixed inset-0 z-50 flex items-center justify-center p-4 transition-opacity duration-200 ease-out",style:{background:"rgb(0 0 0 / 0.45)",opacity:N?1:0,paddingLeft:y==="chat"?"max(1rem, var(--oc-chat-inset-left, 0px))":"1rem",paddingRight:y==="chat"?"max(1rem, var(--oc-chat-inset-right, 0px))":"1rem",paddingTop:"max(1rem, var(--oc-safe-area-top, 0px))"},onClick:n,children:e.jsx("div",{className:"flex w-full max-w-[720px] justify-center",onClick:P=>P.stopPropagation(),children:I})}),S.current):ze.createPortal(I,S.current)},dr=t.lazy(()=>De(()=>import("./FilesView-Ccl4CxjR.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])).then(s=>({default:s.FilesView}))),fr=t.lazy(()=>De(()=>import("./GitView-BkrH0HFQ.js"),__vite__mapDeps([73,6,1,2,3,10,4,5,7,8,9,11,12,49,50,51,52,53,74,75,76,77,78,79,56,57,58,33,34,35,36,37,38,39,40,41,42,43,44,45,46,59,31,32,60,61,62,63,64,65,66,80,81,82,72,29,30])).then(s=>({default:s.GitView}))),hr=t.lazy(()=>De(()=>import("./PullRequestsSurface-_kgJMFTh.js"),__vite__mapDeps([83,6,1,2,3,84,4,5,7,8,9,10,11,12,49,50,51,52,53,85,75,76,79,56,57,58,33,34,35,36,37,38,39,40,41,42,43,44,45,46,59,31,32,60,61,62,63,64,65,66,80,81,82,72,29,30])).then(s=>({default:s.PullRequestsSurface}))),pr=t.lazy(()=>De(()=>import("./IssuesSurface-CD1m8BHP.js"),__vite__mapDeps([86,1,2,3,84,4,5,6,7,8,9,10,11,12,49,50,51,52,53,85,75,76,87])).then(s=>({default:s.IssuesSurface}))),bt="mobile-surface-root",mr=16,xt=t.memo(function({open:n,onClose:r,tab:i,onTabChange:l,pendingChangesDiff:a,variant:o="drawer",drawerRefExternal:w,scrimRefExternal:m,rootRefExternal:d,githubTabsAvailable:y=!1}){const j=t.useRef(null),S=t.useRef(null),N=t.useRef(null),v=t.useRef(null),T=w??S,k=m??N,E=d??v,C=t.useCallback(x=>{v.current=x,d&&(d.current=x)},[d]),p=t.useCallback(()=>{const x=typeof document<"u"?document.activeElement:null;x instanceof HTMLElement&&E.current?.contains(x)&&x.blur(),r()},[r]),[f,I]=t.useState(!1),[P,H]=t.useState(n),$=`mobile-workspace-tab-${t.useId()}`,_=t.useMemo(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[]),[A,L]=t.useState(()=>new Set),[h,D]=t.useState(null),[z,B]=t.useState(null);if(t.useEffect(()=>{n&&L(x=>{if(x.has(i))return x;const O=new Set(x);return O.add(i),O})},[n,i]),typeof document<"u"&&!j.current){let x=document.getElementById(bt);x||(x=document.createElement("div"),x.id=bt,document.body.appendChild(x)),j.current=x}if(t.useEffect(()=>{if(n){H(!0);const O=window.setTimeout(()=>I(!0),_?0:mr);return()=>window.clearTimeout(O)}I(!1);const x=window.setTimeout(()=>H(!1),Ee+40);return()=>window.clearTimeout(x)},[n,_]),t.useEffect(()=>{if(!n)return;const x=document.body.style.overflow;o==="drawer"&&(document.body.style.overflow="hidden");const O=oe=>{oe.key==="Escape"&&i!=="terminal"&&p()};return document.addEventListener("keydown",O),()=>{o==="drawer"&&(document.body.style.overflow=x),document.removeEventListener("keydown",O)}},[p,n,i,o]),t.useEffect(()=>{const x=E.current;if(!x||n||o!=="drawer")return;const O=document.activeElement;O&&x.contains(O)&&O.blur()},[n,o]),Mt({side:"right",enabled:o==="drawer",open:n,drawerRef:T,scrimRef:k,onClose:p,widthRatio:1,prefersReducedMotion:_}),o==="drawer"&&!j.current)return null;const W=_?0:Ee,q=hn(y),g=_?{duration:0}:{type:"spring",stiffness:520,damping:40,mass:.8},R=e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 py-1 overflow-x-auto overflow-y-hidden scrollbar-none",role:"tablist","aria-label":"Workspace","data-no-drawer-swipe":"true",children:q.map(x=>{const O=i===x.id;return e.jsxs(Be.button,{layout:"position",transition:g,type:"button",role:"tab","aria-selected":O,"aria-label":x.label,onClick:()=>l(x.id),className:M("relative flex min-h-[44px] items-center justify-center gap-1 rounded-lg py-2 typography-ui-label transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",O?"min-w-0 shrink px-2.5 text-foreground":"size-11 shrink-0 text-muted-foreground hover:bg-interactive-hover hover:text-foreground"),children:[O?e.jsx(Be.span,{layoutId:$,transition:g,className:"absolute inset-0 bg-interactive-selection",style:{borderRadius:8},"aria-hidden":"true"}):null,e.jsx(ie,{name:x.icon,className:"relative size-5 shrink-0"}),O?e.jsx(Be.span,{initial:_?!1:{opacity:0,x:-4},animate:{opacity:1,x:0},transition:g,className:"relative truncate",children:x.label},x.id):null]},x.id)})}),V=e.jsxs(e.Fragment,{children:[o==="panel"?null:e.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-1 px-2",children:[R,e.jsx("button",{type:"button",onClick:p,"aria-label":"Close workspace panel",className:"flex size-11 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",children:e.jsx(ie,{name:"close",className:"size-5"})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[A.has("changes")?e.jsx("div",{className:M("h-full",i!=="changes"&&"hidden"),children:e.jsx(ee,{children:e.jsx(t.Suspense,{fallback:null,children:e.jsx(fr,{isActive:n&&i==="changes",chrome:"mobile",initialDiffPath:a?.path??null,initialDiffStaged:a?.staged===!0})})})},a?`changes:${a.path}:${a.staged}`:"changes"):null,A.has("files")?e.jsx("div",{className:M("h-full",i!=="files"&&"hidden"),children:e.jsx(ee,{children:e.jsx(t.Suspense,{fallback:null,children:e.jsx(dr,{chrome:"mobile",mode:"editor-only",isVisible:n&&i==="files"})})})}):null,A.has("terminal")?e.jsx("div",{className:M("h-full",i!=="terminal"&&"hidden"),children:e.jsx(ee,{children:e.jsx(pn,{visible:n&&i==="terminal"})})}):null,A.has("pull-requests")?e.jsx("div",{className:M("h-full",i!=="pull-requests"&&"hidden"),children:e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[e.jsx(ot,{icon:Me.find(x=>x.id==="pull-requests")?.icon,title:Me.find(x=>x.id==="pull-requests")?.label??"Pull requests",actions:e.jsx("div",{ref:x=>{D(x)},className:"flex items-center gap-1"})}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(ee,{children:e.jsx(t.Suspense,{fallback:null,children:e.jsx(hr,{hideFilesTab:!0,headerActionsSlot:n&&i==="pull-requests"?h:null,headerActionsPresentation:"drawer"})})})})]})}):null,A.has("issues")?e.jsx("div",{className:M("h-full",i!=="issues"&&"hidden"),children:e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[e.jsx(ot,{icon:Me.find(x=>x.id==="issues")?.icon,title:Me.find(x=>x.id==="issues")?.label??"Issues",actions:e.jsx("div",{ref:x=>{B(x)},className:"flex items-center gap-1"})}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(ee,{children:e.jsx(t.Suspense,{fallback:null,children:e.jsx(pr,{headerActionsSlot:n&&i==="issues"?z:null,headerActionsPresentation:"drawer"})})})})]})}):null]})]});return o==="panel"?e.jsx("div",{className:"flex h-full min-h-0 flex-col bg-sidebar",children:V}):ze.createPortal(e.jsxs("div",{ref:C,className:"fixed inset-0 z-50",inert:!n,style:{pointerEvents:n?"auto":"none",visibility:P?"visible":"hidden"},"data-mobile-workspace-root":"true",children:[e.jsx("button",{ref:k,type:"button",className:"absolute inset-0 cursor-default bg-black/70","aria-label":"Close workspace panel",onClick:p,tabIndex:n?0:-1,style:{opacity:f?1:0,transition:W?`opacity ${W}ms ${be}`:"none"},"data-mobile-workspace-scrim":"true"}),e.jsx("section",{ref:T,role:"dialog","aria-modal":"true","aria-label":"Open workspace panel",className:"oc-keyboard-inset-surface absolute inset-y-0 right-0 z-10 flex h-full w-full flex-col bg-sidebar",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:f?"none":"translateX(100%)",transition:W?`transform ${W}ms ${be}`:"none",touchAction:"pan-x pan-y"},"data-mobile-workspace-drawer":"true",children:V})]}),j.current)}),br="pichamber",xr=s=>s.replace(/^\/+|\/+$/g,""),gr=s=>{const n=xr(s.pathname).split("/").filter(Boolean);return s.host?[s.host,...n]:n};function yr(s){if(typeof s!="string"||s.length===0)return null;let n;try{n=new URL(s)}catch{return null}if(n.protocol!==`${br}:`)return null;const r=gr(n),i=(r[0]??"").toLowerCase(),l=r.slice(1),a=n.searchParams;switch(i){case"session":{const o=l[0]||a.get("id")||"";return o?{type:"session",sessionId:o,directory:a.get("dir")??void 0}:null}case"new":case"new-session":return{type:"new-session",directory:a.get("dir")??void 0,projectId:a.get("project")??void 0,agent:a.get("agent")??void 0,model:a.get("model")??void 0};case"sessions":{const o=a.get("filter");return{type:"sessions",filter:o==="attention"||o==="recent"||o==="all"?o:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:l[0]||a.get("section")||void 0};case"changes":return{type:"changes",path:l.join("/")||a.get("path")||void 0,staged:a.get("staged")==="true"};case"view":{const o=(l[0]||"").toLowerCase();return o==="changes"?{type:"changes"}:o==="files"||o==="mcp"||o==="instances"||o==="update"?{type:"view",target:o}:null}default:return null}}let Q={},Lt=!1,Ae=null;const vr=s=>{switch(s.type){case"session":return ae.getState().setCurrentSession(s.sessionId,s.directory??null),!0;case"new-session":{const n=ae.getState();return n.openNewSessionDraft(),(s.directory||s.projectId)&&n.setNewSessionDraftTarget({directoryOverride:s.directory??null,projectId:s.projectId??null,selectedProjectId:s.projectId??null}),!0}case"sessions":return Q.openSessions?(Q.openSessions(s.filter),!0):!1;case"status":return Q.openSessions?(Q.openSessions(),!0):!1;case"view":return Q.openView?(Q.openView(s.target),!0):!1;case"changes":return Q.openChanges?(Q.openChanges({path:s.path,staged:s.staged}),!0):!1;case"settings":return Q.openSettings?(Q.openSettings(s.section),!0):!1}},Ye=()=>{if(!Lt||!Ae)return;const s=Ae;Ae=null,vr(s)||(Ae=s)},wr=s=>{Ae=s,Ye()},Sr=s=>{const n=yr(s);n&&wr(n)},jr=s=>{Lt=s,Ye()},Rr=s=>{t.useEffect(()=>(Q=s,Ye(),()=>{Q===s&&(Q={})}),[s])},kr=s=>{const{ready:n}=s;t.useEffect(()=>{jr(n)},[n]),t.useEffect(()=>{if(!Xt())return;let r=!1;const i=[];return De(()=>import("./vendor-capacitor-app-NX6DULfp.js"),__vite__mapDeps([88,6,1,2,3])).then(async({App:l})=>{if(r)return;const a=await l.addListener("appUrlOpen",o=>{Sr(o?.url)});if(r){a.remove();return}i.push(()=>{a.remove()})}).catch(()=>{}),()=>{r=!0,i.forEach(l=>l())}},[])},gt=s=>{const n=s.drawer.current,r=s.scrim.current,i=s.root.current;i&&(i.style.pointerEvents="auto",i.style.visibility="visible"),n&&(n.style.transition="none"),r&&(r.style.transition="none")},yt=(s,n,r)=>{const i=s.drawer.current,l=s.scrim.current;if(i&&(i.style.transform=r>=.999?"none":`translateX(${(n==="left"?r-1:1-r)*100}%)`),l){l.style.opacity=String(r);const a=r>.01?"auto":"none";l.style.pointerEvents!==a&&(l.style.pointerEvents=a)}},vt=(s,n,r)=>{const i=r.drawer.current,l=r.scrim.current,a=r.root.current;i&&(i.style.transition=`transform ${Ee}ms ${be}`,i.style.transform=n?"none":s==="left"?"translateX(-100%)":"translateX(100%)"),l&&(l.style.transition=`opacity ${Ee}ms ${be}`,l.style.opacity=n?"1":"0",l.style.pointerEvents=n?"auto":"none"),a&&(a.style.pointerEvents=n?"auto":"none",a.style.visibility=n?"visible":"")},wt=s=>{const n=s.shell.current,r=s.inner.current;n&&(n.style.overflow="visible"),r&&(r.style.transition="none")},St=(s,n,r,i)=>{const l=s.inner.current;if(!l)return;const a=i==="left"?(n-1)*r:(1-n)*r;l.style.transform=n>=.999?"translateX(0)":`translateX(${a}px)`},jt=(s,n,r,i,l)=>{const a=s.shell.current,o=s.inner.current;return!a||!o?void 0:(o.style.transition="transform 200ms cubic-bezier(0.22, 1, 0.36, 1)",o.style.transform=n?"translateX(0)":`translateX(${i==="left"?-r:r}px)`,window.setTimeout(()=>{o.style.transition="",o.style.transform="",a.style.overflow=""},220))},Rt=({side:s,isResizing:n,ariaLabel:r,handleProps:i})=>e.jsx("div",{className:M("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",s==="left"?"right-0":"left-0"),role:"separator","aria-orientation":"vertical","aria-label":r,...i,children:e.jsx("div",{className:M("absolute inset-y-0 w-[3px] transition-colors",s==="left"?"right-0":"left-0",n&&"bg-[var(--interactive-border)]")})}),Er=320,Cr=380,kt=280,Nr=560,Tr=900;function Et(s,n,r,i=Nr){const l=t.useRef(null),[a,o]=t.useState(()=>{if(typeof window>"u")return r;const p=Number.parseInt(window.localStorage.getItem(n)??"",10);return Number.isFinite(p)?Math.min(i,Math.max(kt,p)):r}),[w,m]=t.useState(!1),d=t.useRef(0),y=t.useRef(a),j=t.useRef(null),S=t.useRef(null),N=t.useCallback(p=>Math.min(i,Math.max(kt,Math.round(p))),[i]),v=t.useCallback(p=>{const f=l.current;f&&(f.style.width=`${p}px`,f.style.minWidth=`${p}px`,f.style.maxWidth=`${p}px`,f.style.setProperty("--oc-ipad-sidebar-width",`${p}px`))},[]),T=t.useCallback(p=>{try{p.currentTarget.setPointerCapture(p.pointerId)}catch{}S.current=p.pointerId,d.current=p.clientX,y.current=a,j.current=a,m(!0),p.preventDefault()},[a]),k=t.useCallback(p=>{if(S.current!==p.pointerId)return;const f=p.clientX-d.current,I=N(y.current+(s==="left"?f:-f));j.current!==I&&(j.current=I,v(I))},[v,N,s]),E=t.useCallback(p=>{if(S.current!==p.pointerId)return;try{p.currentTarget.releasePointerCapture(p.pointerId)}catch{}const f=N(j.current??y.current);S.current=null,j.current=null,m(!1),o(f);try{window.localStorage.setItem(n,String(f))}catch{}},[N,n]),C=t.useMemo(()=>({onPointerDown:T,onPointerMove:k,onPointerUp:E,onPointerCancel:E}),[T,E,k]);return{asideRef:l,width:a,isResizing:w,handleProps:C}}const Ir=t.memo(Sn),Pr=({onActiveConnectionDeleted:s})=>{const[n,r]=t.useState(!1),[i,l]=t.useState(null),[a,o]=t.useState(!1),[w,m]=t.useState("changes"),d=t.useCallback(c=>{m(lt(c))},[]),y=w,[j,S]=t.useState("nav"),[N,v]=t.useState(null),T=t.useRef([]),k=t.useCallback(()=>{T.current.forEach(c=>window.clearTimeout(c)),T.current=[]},[]);t.useEffect(()=>()=>k(),[k]);const E=t.useRef(null),C=t.useRef(null),p=t.useRef(null),f=t.useRef(null),I=t.useRef(null),P=t.useRef(null),H=t.useRef(null),$=t.useRef(null),_=t.useRef(0),A=t.useRef(0),L=t.useCallback(c=>{k(),r(c)},[k]),h=t.useCallback(c=>{k(),o(c)},[k]),D=je(c=>c.setSettingsPage),z=je(c=>c.isArchivePageOpen),B=je(c=>c.setArchivePageOpen),W=ke(c=>c.available),q=ke(c=>c.runtimeType),g=t.useMemo(()=>Dt(),[]),R=!g&&W&&(q==="desktop"||q==="web"),V=Kn()??"",x=V?Kt(V):"",O=qn().github??null,oe=ct(c=>c.ensureScope);t.useEffect(()=>{!x||!O||oe(x,O)},[x,O,oe]);const _e=ct(c=>x?c.entriesByDirectory[x]??null:null),te=t.useMemo(()=>Yn(_e),[_e]),xe=Qn(te);t.useEffect(()=>{!xe&&mn(w)&&m(bn(w))},[xe,w]);const le=t.useCallback(()=>{l(null)},[]),ne=t.useCallback(c=>{l(c)},[]),ge=t.useCallback(()=>{h(!1)},[h]),u=t.useCallback(c=>{S(c),ne("settings")},[ne]),{enabled:b,roomyForPanels:U}=Jn(),F=Zn()==="portrait",J=es(),se=je(c=>c.setSidebarOpen),X=je(c=>c.isSidebarOpen),we=t.useRef(!1);t.useLayoutEffect(()=>{b&&!we.current&&se(ts().roomyForPanels),!b&&we.current&&se(!1),we.current=b},[b,se]);const pe=t.useCallback(()=>{v(null),d("files"),h(!0)},[d,h]),fe=t.useCallback((c=null)=>{v(c),d("changes"),h(!0)},[d,h]),K=Et("left","pichamber.ipad.leftSidebarWidth",Er),Z=Et("right","pichamber.ipad.rightSidebarWidth",Cr,Tr),Qe=U,ce=Qe&&a?Z.width:0,zt=xn(b&&X),Ce=b&&X?K.width:0,Wt=t.useCallback(c=>{const Y=lt(c);a&&y===Y?h(!1):(d(Y),h(!0))},[a,y,d,h]),Ut=t.useCallback(()=>{h(!a)},[a,h]),Bt=t.useCallback(c=>{!c&&!U&&se(!1)},[U,se]);t.useEffect(()=>{if(typeof document>"u")return;const c=document.documentElement;return c.style.setProperty("--oc-chat-inset-left",`${Ce}px`),c.style.setProperty("--oc-chat-inset-right",`${ce}px`),()=>{c.style.removeProperty("--oc-chat-inset-left"),c.style.removeProperty("--oc-chat-inset-right")}},[Ce,ce]),t.useEffect(()=>{if(typeof document>"u")return;const c=b&&(F||J),Y=document.documentElement;return Y.classList.toggle("oc-keep-draft-starters",c),()=>Y.classList.remove("oc-keep-draft-starters")},[J,b,F]);const Je=t.useCallback(()=>{L(!1),h(!1)},[L,h]),Ht=t.useMemo(()=>({openChanges:({diffPath:c,staged:Y}={})=>{fe(c?{path:c,staged:Y===!0}:null)},openFiles:()=>pe(),openSettings:c=>{c&&D(c),u(c?"page-content":"nav")},openInstances:g?()=>ne("instances"):void 0,instanceLabel:g?Re():null,openUpdate:R?()=>ne("update"):void 0,closeDrawers:Je}),[Je,fe,pe,u,ne,D,g,R]),$t=t.useMemo(()=>({openSessions:()=>{b?se(!0):L(!0)},openView:c=>{if(c==="files"){pe();return}(c==="instances"||c==="update"||c==="mcp")&&ne(c)},openChanges:({path:c,staged:Y}={})=>{fe(c?{path:c,staged:Y===!0}:null)},openSettings:c=>{c&&D(c),u(c?"page-content":"nav")}}),[b,fe,pe,u,ne,D,L,se]);Rr($t);const Ze=t.useRef(null);gn(Ze,{leftOpen:b?X:n,rightOpen:a,leftWidth:()=>b?K.width:E.current?.offsetWidth||window.innerWidth*.72,rightWidth:()=>b?Z.width:f.current?.offsetWidth||window.innerWidth,onLeftProgress:c=>{if(_.current=c,b){St({inner:H},c,K.width,"left");return}yt({drawer:E,scrim:C},"left",c)},onRightProgress:c=>{if(A.current=c,b&&U){St({inner:$},c,Z.width,"right");return}yt({drawer:f,scrim:I},"right",c)},onLeftOpen:()=>{b?se(!0):L(!0)},onLeftClose:()=>{b?se(!1):L(!1)},onRightOpen:()=>h(!0),onRightClose:()=>h(!1),onDragStart:c=>{if(k(),c==="left"){_.current=b?X?1:0:n?1:0,b?wt({shell:K.asideRef,inner:H}):gt({drawer:E,scrim:C,root:p});return}A.current=a?1:0,b&&U?wt({shell:Z.asideRef,inner:$}):gt({drawer:f,scrim:I,root:P})},onDragEnd:(c,Y)=>{if(c==="left"){const Se=typeof Y=="boolean"?Y:_.current>.5;if(_.current=Se?1:0,b){const et=jt({shell:K.asideRef,inner:H},Se,K.width,"left");et!==void 0&&T.current.push(et)}else vt("left",Se,{drawer:E,scrim:C,root:p});return}const Ue=typeof Y=="boolean"?Y:A.current>.5;if(A.current=Ue?1:0,b&&U){const Se=jt({shell:Z.asideRef,inner:$},Ue,Z.width,"right");Se!==void 0&&T.current.push(Se)}else vt("right",Ue,{drawer:f,scrim:I,root:P})}});const Ft=t.useCallback(()=>z?(B(!1),!0):i?(le(),!0):a?(ge(),!0):n?(L(!1),!0):!1,[i,le,ge,z,n,B,L,a]);Pt(Ft);const We=b?"dialog":"fullscreen";return e.jsx(ns,{actions:Ht,children:e.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area relative flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[b?e.jsxs("aside",{ref:K.asideRef,className:M("relative flex h-full shrink-0 flex-col overflow-hidden border-r border-border/70 bg-sidebar motion-reduce:transition-none",!X&&"border-r-0"),style:{width:Ce,minWidth:Ce,maxWidth:Ce,"--oc-ipad-sidebar-width":`${K.width}px`,overflowX:"clip",paddingTop:"var(--oc-safe-area-top, 0px)"},inert:!X,"data-page-scroll-lock":"true",children:[e.jsx("div",{ref:H,className:M("flex h-full shrink-0 flex-col",K.isResizing&&"pointer-events-none",!X&&"pointer-events-none select-none"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",transform:K.isResizing||zt.slidIn?"translateX(0)":"translateX(-100%)",transition:K.isResizing?"none":"transform 200ms cubic-bezier(0.22, 1, 0.36, 1)"},children:e.jsx(ee,{children:e.jsx(pt,{open:X,variant:"sidebar",onOpenChange:Bt})})}),X?e.jsx(Rt,{side:"left",isResizing:K.isResizing,ariaLabel:"Resize left panel",handleProps:K.handleProps}):null]}):null,e.jsxs("div",{className:"relative flex h-full min-w-0 flex-1 flex-col","data-page-scroll-lock":"true",children:[b?e.jsxs(e.Fragment,{children:[e.jsx(yn,{}),e.jsx(vn,{onToggleRightDrawer:Ut,rightDrawerOpen:a,tabletWorkspaceTab:y,onSelectTabletWorkspaceTab:Wt,tabletGitHubTabsAvailable:xe})]}):e.jsx(or,{onOpenSessions:()=>L(!0),onOpenWorkspace:()=>h(!0)}),e.jsx("main",{ref:Ze,className:"relative min-h-0 flex-1 overflow-hidden","data-page-scroll-lock":"true",style:{touchAction:"pan-x pan-y"},children:e.jsx("div",{className:"h-full w-full",children:e.jsx(ee,{children:e.jsx(Ir,{})})})})]}),b?null:e.jsx(pt,{open:n,onOpenChange:L,drawerRefExternal:E,scrimRefExternal:C,rootRefExternal:p}),b?e.jsxs("aside",{ref:Z.asideRef,className:M("relative flex h-full shrink-0 flex-col overflow-hidden border-l border-border/70 bg-background motion-reduce:transition-none",!ce&&"border-l-0"),style:{width:ce,minWidth:ce,maxWidth:ce,"--oc-ipad-sidebar-width":`${Z.width}px`,overflowX:"clip",paddingTop:"var(--oc-safe-area-top, 0px)"},inert:!ce,"data-page-scroll-lock":"true",children:[e.jsx("div",{ref:$,className:M("flex h-full min-h-0 shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",Z.isResizing&&"pointer-events-none",!ce&&"pointer-events-none select-none opacity-0"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden",transform:ce?"translateX(0)":"translateX(100%)",transition:Z.isResizing?"none":"transform 200ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms cubic-bezier(0.22, 1, 0.36, 1)"},children:e.jsx(ee,{children:e.jsx(xt,{open:a,onClose:ge,tab:y,onTabChange:d,pendingChangesDiff:N,variant:Qe?"panel":"drawer",githubTabsAvailable:xe,drawerRefExternal:f,scrimRefExternal:I,rootRefExternal:P})})}),ce?e.jsx(Rt,{side:"right",isResizing:Z.isResizing,ariaLabel:"Resize right panel",handleProps:Z.handleProps}):null]}):e.jsx(xt,{open:a,onClose:ge,tab:y,onTabChange:d,pendingChangesDiff:N,githubTabsAvailable:xe,drawerRefExternal:f,scrimRefExternal:I,rootRefExternal:P}),i==="instances"&&g?e.jsx(Xe,{open:!0,variant:We,dialogAlign:"app",onClose:le,ariaLabel:"Servers",title:"Servers",children:e.jsx(lr,{onConnect:le,onActiveConnectionDeleted:s})}):null,i==="settings"?e.jsx(Xe,{open:!0,variant:We,dialogAlign:"app",onClose:le,ariaLabel:"Settings",headerless:!0,children:e.jsx(ee,{children:e.jsx(zs,{forceMobile:!b,isWindowed:!0,initialMobileStage:j,onClose:le,onActiveConnectionDeleted:s})})}):null,i==="update"?e.jsx(Xe,{open:!0,variant:We,dialogAlign:"app",onClose:le,ariaLabel:"Update",title:"Update",children:e.jsx(ee,{children:e.jsx("div",{className:"h-full overflow-auto px-5 py-4",children:e.jsx(Ws,{initialUpdateDialogOpen:!0})})})}):null,e.jsx(ee,{children:e.jsx(wn,{})})]})})},Ar=8,Ot=6e4,Dr=6e4,Ke=[1e3,2e3,4e3,8e3,15e3,3e4,3e4,3e4],_r=(s,n)=>{if(n?.offline||n?.hidden)return Ot;if(s<=0)return Ke[0];const r=Math.min(s-1,Ke.length-1);return Ke[r]??3e4},de=()=>typeof navigator<"u"&&typeof navigator.onLine=="boolean"?!navigator.onLine:!1,re=()=>typeof document<"u"&&typeof document.visibilityState=="string"?document.visibilityState==="hidden":!1;class Mr{constructor(n,r,i=()=>""){this.probe=n,this.callbacks=r,this.getRuntimeIdentity=i}probe;callbacks;getRuntimeIdentity;generation=0;attempt=0;timer=null;wakeCleanup=null;running=!1;exhausted=!1;probingGeneration=null;get currentGeneration(){return this.generation}get currentAttempt(){return this.attempt}get isRunning(){return this.running&&!this.exhausted}start(){he("recovery",{code:"start"}),this.startCycle(!1)}startCycle(n){this.clearTimer(),this.generation+=1,this.attempt=0,this.exhausted=!1,this.running=!0,n?this.runAttempt(this.generation):this.scheduleNext(this.generation)}retryNow(){if(this.exhausted){if(de()||re())return;this.startCycle(!0);return}this.running&&(this.clearTimer(),this.runAttempt(this.generation))}cancel(){he("recovery",{code:"cancel"}),this.generation+=1,this.running=!1,this.exhausted=!1,this.attempt=0,this.probingGeneration=null,this.clearTimer()}async probeOnce(){return this.running||this.exhausted||this.probingGeneration!==null||de()||re()?null:this.runGuardedProbe(this.generation)}async runGuardedProbe(n){this.probingGeneration=n;const r=this.getRuntimeIdentity();let i;try{i=await this.probe()}catch{i="unreachable"}finally{this.probingGeneration===n&&(this.probingGeneration=null)}return n!==this.generation||this.getRuntimeIdentity()!==r?null:i}settleTerminalOutcome(n){return n==="unreachable"?!1:(this.running=!1,this.exhausted=!1,this.clearTimer(),n==="needs-login"?this.callbacks.onAuthExpired():n==="no-connection"?this.callbacks.onNoConnection():this.callbacks.onHealthy(n),!0)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.wakeCleanup&&(this.wakeCleanup(),this.wakeCleanup=null)}scheduleNext(n){if(n!==this.generation||!this.running||this.exhausted)return;if(this.attempt>=Ar){this.exhausted=!0,this.running=!1,this.callbacks.onExhausted(),this.scheduleExhaustedPoll(n);return}const r=this.attempt+1,i=_r(r,{offline:de(),hidden:re()});this.callbacks.onAttempt?.(r,i);const l=()=>{de()||re()||n===this.generation&&(this.clearTimer(),this.runAttempt(n))},a=()=>l(),o=()=>{typeof document<"u"&&document.visibilityState==="visible"&&l()};typeof window<"u"&&window.addEventListener("online",a),typeof document<"u"&&document.addEventListener("visibilitychange",o),this.wakeCleanup=()=>{typeof window<"u"&&window.removeEventListener("online",a),typeof document<"u"&&document.removeEventListener("visibilitychange",o)},this.timer=setTimeout(()=>{if(this.timer=null,this.wakeCleanup?.(),this.wakeCleanup=null,!(n!==this.generation||!this.running||this.exhausted)){if(de()||re()){this.scheduleNext(n);return}this.runAttempt(n)}},i)}async runAttempt(n){if(n!==this.generation||!this.running||this.exhausted||this.probingGeneration===n)return;if(de()||re()){this.scheduleNext(n);return}const r=await this.runGuardedProbe(n);r===null||this.settleTerminalOutcome(r)||(this.attempt+=1,this.scheduleNext(n))}scheduleExhaustedPoll(n){if(n!==this.generation||!this.exhausted)return;this.clearTimer();const r=de()||re()?Ot:Dr;this.timer=setTimeout(()=>{this.timer=null,this.runExhaustedPoll(n)},r)}async runExhaustedPoll(n){if(n!==this.generation||!this.exhausted)return;if(this.probingGeneration!==null||de()||re()){this.scheduleExhaustedPoll(n);return}const r=await this.runGuardedProbe(n);r===null||!this.exhausted||this.settleTerminalOutcome(r)||this.scheduleExhaustedPoll(n)}}function Lr(s=2500){const{uiFont:n}=ss(),[r,i]=t.useState(!1);return t.useEffect(()=>{let l=!1;const a=()=>{l||i(!0)},o=()=>{requestAnimationFrame(()=>requestAnimationFrame(a))},w=Promise.all([rs(n).catch(()=>{}),document.fonts?.ready?.then(()=>{}).catch(()=>{})??Promise.resolve(),Vs.catch(()=>{})]).then(()=>{}),m=new Promise(d=>{window.setTimeout(d,s)});return Promise.race([w,m]).then(o),()=>{l=!0}},[n,s]),r}const Or=1e3;function zr({apis:s}){const n=me(u=>u.initializeApp),r=me(u=>u.isInitialized),i=me(u=>u.isConnected),l=me(u=>u.connectionPhase),a=me(u=>u.providers.length),o=me(u=>u.loadProviders),w=Ct(u=>u.currentDirectory),m=ae(u=>u.error),d=ae(u=>u.clearError),y=je(u=>u.setIsMobile),[j,S]=t.useState(0),[N,v]=t.useState(0),[T,k]=t.useState(!1),[E,C]=t.useState("idle"),p=is(),f=t.useRef(null),I=t.useRef(E);I.current=E;const[P,H]=t.useState("pending"),[$,_]=t.useState(null),A=t.useMemo(()=>Re(),[]),[,L]=t.useReducer(u=>u+1,0),h=t.useMemo(()=>Dt(),[]),D=t.useRef(0),z=t.useRef(0),B=t.useRef(!1),[W,q]=t.useState(()=>h&&!!ue());t.useEffect(()=>{const u=new Mr(()=>Us(),{onHealthy:b=>{if(he("recovery",{code:"success"}),C("idle"),ye(!1),b==="unchanged"){Zt(),me.getState().initializeApp();const U=me.getState();U.providers.length===0&&U.loadProviders({source:"mobileApp:recovery"})}},onAuthExpired:()=>{he("recovery",{code:"auth-expired"}),C("idle"),ye(!1),_({kind:"auth-expired",label:Re()??""}),Ne({apiBaseUrl:"",clientToken:null,runtimeKey:"mobile-disconnected"}),S(b=>b+1)},onNoConnection:()=>{he("recovery",{code:"no-connection"}),C("idle"),ye(!1),Ne({apiBaseUrl:"",clientToken:null,runtimeKey:"mobile-disconnected"}),S(b=>b+1)},onExhausted:()=>{he("recovery",{code:"exhausted"}),C("exhausted")},onAttempt:b=>{he("recovery",{code:"attempt",detail:String(b)})}},()=>`${Te()}|${ue()}`);return f.current=u,()=>{u.cancel(),f.current=null}},[]);const g=t.useCallback(()=>{if(!h||!ue())return;const u=f.current;if(u){if(u.isRunning){u.retryNow();return}C("recovering"),ye(!0),u.start()}},[h]),R=t.useCallback(()=>{f.current?.cancel(),C("idle"),ye(!1),q(!1)},[]),V=t.useCallback(u=>{R(),u&&_(u),Ne({apiBaseUrl:"",clientToken:null,runtimeKey:"mobile-disconnected"}),S(b=>b+1)},[R]),x=t.useCallback(()=>{const u=Date.now();u-D.current>=Or&&(D.current=u,window.dispatchEvent(new Event("pichamber:system-resume")))},[]),O=t.useCallback(()=>{const u=ue(),b=z.current+1;if(z.current=b,!u){if(B.current)return;B.current=!0,Fe().catch(()=>{}).finally(()=>{B.current=!1});return}if(f.current?.isRunning){f.current.retryNow(),x();return}if(I.current==="exhausted"){if(de()||re())return;C("recovering"),ye(!0),f.current?.start(),x();return}if(de()||re()){g();return}const U=()=>{n(),a===0&&o({source:"mobileApp:nativeResume"})},G=f.current;G&&(G.probeOnce().then(F=>{if(F!==null&&z.current===b){if(F==="no-connection"){V(null);return}if(F==="needs-login"){V({kind:"auth-expired",label:Re()??""});return}if(F==="unreachable"){g();return}F!=="switched"&&U()}}),x())},[V,x,n,o,a,g]);as(),os(O),t.useEffect(()=>qt(),[]),t.useEffect(()=>{if(!h)return;let u;const b=()=>{if(f.current?.isRunning){f.current.retryNow();return}if(I.current==="exhausted"){if(re())return;C("recovering"),ye(!0),f.current?.start();return}window.clearTimeout(u),u=window.setTimeout(()=>O(),1500)};return window.addEventListener("online",b),()=>{window.removeEventListener("online",b),window.clearTimeout(u)}},[h,O]),t.useEffect(()=>{if(h)return Yt(()=>{ue()&&V({kind:"auth-expired",label:Re()??""})})},[V,h]),t.useEffect(()=>(nt(s),()=>nt(null)),[s]),t.useEffect(()=>Qt(u=>{if(!!u.runtimeKey&&u.runtimeKey===u.previousRuntimeKey){jn(),L();return}R(),Rn(u),v(U=>U+1),S(U=>U+1)}),[R]),t.useEffect(()=>{Nt()},[N]),t.useEffect(()=>{if(!h||i||ue()){H("done");return}let u=!1;return H("attempting"),Fe().catch(()=>({status:"no-candidate"})).then(b=>{u||(he("auto-connect",{code:b.status}),b.status==="unreachable"?_({kind:"unreachable",label:b.label}):b.status==="needs-login"&&_({kind:"auth-expired",label:b.label}),H("done"))}),()=>{u=!0}},[]),t.useEffect(()=>{if(!h||!ue()){q(!1);return}let u=!1;const b=G=>{G&&_(G),Ne({apiBaseUrl:"",clientToken:null,runtimeKey:"mobile-disconnected"}),S(F=>F+1)},U=f.current;if(!U){q(!1);return}return(async()=>{try{const G=await U.probeOnce();if(u||G===null||G==="switched"||G==="unchanged")return;const F=Re();if(G==="needs-login"){b({kind:"auth-expired",label:F??""});return}if(G==="unreachable"){g();return}const J=await Fe().catch(()=>({status:"no-candidate"}));if(u||(he("auto-connect",{code:J.status}),J.status==="connected"))return;J.status==="needs-login"?b({kind:"auth-expired",label:J.label}):J.status==="unreachable"?b({kind:"unreachable",label:J.label}):b(null)}finally{u||q(!1)}})(),()=>{u=!0,q(!1)}},[g]),t.useEffect(()=>{y(!0)},[y]),t.useEffect(()=>{h&&!ue()||n()},[j,n,h]),t.useEffect(()=>{i&&a===0&&o({source:"mobileApp:recovery"})},[i,o,a]);const oe=t.useRef(!1),[_e,te]=t.useState(h);t.useEffect(()=>{if(!h||!i||oe.current)return;if(ae.getState().currentSessionId){oe.current=!0,te(!1);return}const u=Te(),b=ls(u);if(!b){oe.current=!0,te(!1);return}const U=Jt(b.directory??null);if(!U){oe.current=!0,te(!1);return}const G=Ie();let F=0;try{F=G.getRuntimeGeneration()}catch{F=0}let J=!1;const se=window.setTimeout(()=>te(!1),6e3);return(async()=>{let X=null;try{X=await cs([U])}catch{X=null}if(J)return;if(!X){te(!1);return}const we=Ie();let pe=F;try{pe=we.getRuntimeGeneration()}catch{pe=F}const fe=tr({persisted:b,persistedDirectory:U,stale:X.stale,ready:X.readyDirectories.has(U),catalog:X.catalog,runtimeKey:Te(),capturedRuntimeKey:u,storeIdentityMatches:we===G,generationMatches:pe===F});if(fe.action==="wait"){te(!1);return}if(oe.current=!0,fe.action==="clear"){us(u),te(!1);return}const K=ae.getState();if(Te()!==u||Ie()!==G){te(!1);return}K.currentSessionId||K.setCurrentSession(fe.sessionId,fe.directory),te(!1)})(),()=>{J=!0,window.clearTimeout(se)}},[j,i,h]),t.useEffect(()=>{i&&Ie().focusProject(w,tn(w))},[w,i]),t.useEffect(()=>{if(!m)return;const u=window.setTimeout(()=>d(),5e3);return()=>window.clearTimeout(u)},[d,m]),t.useEffect(()=>{if(h&&E!=="idle"){k(!1);return}if(h&&W){k(!1);return}if(!(!i&&(h?!!ue():!0))){k(!1);return}const b=window.setTimeout(()=>{k(!0)},h?4e3:8e3);return()=>window.clearTimeout(b)},[i,h,j,E,N,W]),ds(),kn(),kr({ready:h&&i&&r});const xe=Lr(),le=!i&&l==="reconnecting",ne=!!ue(),ge=h&&ne&&E!=="idle";return xe?h&&!ge&&(!ne||!i&&!le)?ne?e.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground",children:e.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-4",children:[e.jsx(ve,{width:120,height:120,isAnimated:!T}),T?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"typography-h3 text-foreground",children:"Unable to reach server"}),e.jsx("p",{className:"typography-body text-muted-foreground",children:"Could not connect to the saved server. Check that it is running, or pick another server."})]}),e.jsx(Pe,{type:"button",variant:"outline",onClick:()=>{V(null)},children:"Use another server"})]}):null]})}):P!=="done"?e.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-background text-foreground",children:[e.jsx(ve,{width:120,height:120,isAnimated:!0}),A?e.jsxs("div",{className:"absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center",children:[e.jsx("p",{className:"typography-small text-muted-foreground",children:"Connecting to device:"}),e.jsx("div",{className:"flex justify-center",children:e.jsx(fs,{text:A,showElapsed:!1})})]}):null]}):e.jsx(e.Fragment,{children:e.jsx(nr,{onConnected:()=>S(u=>u+1),notice:$})}):!h&&!i&&!le?T?e.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground",children:e.jsxs("div",{className:"max-w-sm space-y-3",children:[e.jsx("h1",{className:"typography-h3 text-foreground",children:"Unable to reach server"}),e.jsx("p",{className:"typography-body text-muted-foreground",children:"We could not verify the UI session. If you're opening PiChamber from another device on your local network, make sure Desktop Network Access is enabled on the desktop app and use the LAN address shown in Settings."})]})}):e.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background text-foreground",children:e.jsx(ve,{width:120,height:120,isAnimated:!0})}):e.jsx(ee,{children:e.jsx(hs,{children:e.jsxs(ps,{apis:s,children:[e.jsx(ms,{}),e.jsx(bs,{}),e.jsx(En,{}),e.jsx(xs,{}),e.jsx(gs,{}),e.jsx(ys,{delayDuration:300,skipDelayDuration:150,children:e.jsxs(Cn,{children:[e.jsx(Nn,{}),e.jsxs("div",{className:"h-full bg-background text-foreground",children:[h&&_e?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background",children:e.jsx(ve,{width:120,height:120,isAnimated:!0})}):null,e.jsx(vs,{embeddedBackgroundWorkEnabled:r&&!p}),ge?e.jsxs("div",{role:"status","aria-live":"polite",className:"pointer-events-none fixed inset-x-0 top-[calc(var(--oc-safe-area-top,0px)+var(--oc-header-height,56px)+10px)] z-40 flex justify-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-full border border-border/70 bg-[var(--surface-elevated)] text-[var(--surface-elevated-foreground)] shadow-sm",children:e.jsx(ve,{width:24,height:24,isAnimated:!0})}),e.jsx("span",{className:"sr-only",children:E==="exhausted"?"Server unreachable":"Reconnecting…"})]}):null,e.jsx(er,{}),e.jsx(Pr,{onActiveConnectionDeleted:()=>{R(),Ne({apiBaseUrl:"",clientToken:null,runtimeKey:"mobile-disconnected"}),S(u=>u+1)}}),e.jsx(Tn,{}),e.jsx(In,{}),e.jsx(ws,{position:"top-center",offset:"calc(var(--oc-safe-area-top, 0px) + 16px)"}),e.jsx(Ss,{})]})]})})]})},N)}):e.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background text-foreground",children:e.jsx(ve,{width:120,height:120,isAnimated:!0})})}const Wr=()=>{(async()=>{try{await Promise.all([Nt(),nn()])}catch(s){console.error("[mobile-main] settings init failed:",s)}Cs(),Ns(),Ts(),sn()})().finally(()=>{Gs()})};function ui(s){window.__PICHAMBER_SURFACE__="mobile",js(),Wr(),Zs(),Rs();const n=document.getElementById("root");if(!n)throw new Error("Root element not found");const i=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",l=s??en();if(!l)throw new Error("Runtime APIs not registered");const a=i?{...l,notifications:{notify:async()=>!1,canNotify:()=>!1}}:l,o=e.jsx(zr,{apis:a});Vt.createRoot(n).render(e.jsx(qe.StrictMode,{children:e.jsx(ks,{children:e.jsx(Pn,{children:i?o:e.jsx(Es,{children:o})})})}))}export{ui as renderMobileApp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function k(e){for(var i={},n=0,r=e.length;n<r;++n)i[e[n]]=!0;return i}var v=["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"],x=k(v),z=k(["def","class","case","for","while","until","module","catch","loop","proc","begin"]),_=k(["end","until"]),h={"[":"]","{":"}","(":")"},b={"]":"[","}":"{",")":"("},f;function c(e,i,n){return n.tokenize.push(e),e(i,n)}function p(e,i){if(e.sol()&&e.match("=begin")&&e.eol())return i.tokenize.push(w),"comment";if(e.eatSpace())return null;var n=e.next(),r;if(n=="`"||n=="'"||n=='"')return c(d(n,"string",n=='"'||n=="`"),e,i);if(n=="/")return g(e)?c(d(n,"string.special",!0),e,i):"operator";if(n=="%"){var l="string",o=!0;e.eat("s")?l="atom":e.eat(/[WQ]/)?l="string":e.eat(/[r]/)?l="string.special":e.eat(/[wxq]/)&&(l="string",o=!1);var u=e.eat(/[^\w\s=]/);return u?(h.propertyIsEnumerable(u)&&(u=h[u]),c(d(u,l,o,!0),e,i)):"operator"}else{if(n=="#")return e.skipToEnd(),"comment";if(n=="<"&&(r=e.match(/^<([-~])[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return c(s(r[2],r[1]),e,i);if(n=="0")return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eat(".")?e.eat(/[\d_]*(?:[eE][+\-]?[\d_]+)?/):e.eatWhile(/[0-7]/),"number";if(/\d/.test(n))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if(n=="?"){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}else{if(n==":")return e.eat("'")?c(d("'","atom",!1),e,i):e.eat('"')?c(d('"',"atom",!0),e,i):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if(n=="@"&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"propertyName";if(n=="$")return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variableName.special";if(/[a-zA-Z_\xa1-\uffff]/.test(n))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"variable";if(n=="|"&&(i.varList||i.lastTok=="{"||i.lastTok=="do"))return f="|",null;if(/[\(\)\[\]{}\\;]/.test(n))return f=n,null;if(n=="-"&&e.eat(">"))return"operator";if(/[=+\-\/*:\.^%<>~|]/.test(n)){var t=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return n=="."&&!t&&(f="."),"operator"}else return null}}}function g(e){for(var i=e.pos,n=0,r,l=!1,o=!1;(r=e.next())!=null;)if(o)o=!1;else{if("[{(".indexOf(r)>-1)n++;else if("]})".indexOf(r)>-1){if(n--,n<0)break}else if(r=="/"&&n==0){l=!0;break}o=r=="\\"}return e.backUp(e.pos-i),l}function a(e){return e||(e=1),function(i,n){if(i.peek()=="}"){if(e==1)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](i,n);n.tokenize[n.tokenize.length-1]=a(e-1)}else i.peek()=="{"&&(n.tokenize[n.tokenize.length-1]=a(e+1));return p(i,n)}}function y(){var e=!1;return function(i,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](i,n)):(e=!0,p(i,n))}}function d(e,i,n,r){return function(l,o){var u=!1,t;for(o.context.type==="read-quoted-paused"&&(o.context=o.context.prev,l.eat("}"));(t=l.next())!=null;){if(t==e&&(r||!u)){o.tokenize.pop();break}if(n&&t=="#"&&!u){if(l.eat("{")){e=="}"&&(o.context={prev:o.context,type:"read-quoted-paused"}),o.tokenize.push(a());break}else if(/[@\$]/.test(l.peek())){o.tokenize.push(y());break}}u=!u&&t=="\\"}return i}}function s(e,i){return function(n,r){return i&&n.eatSpace(),n.match(e)?r.tokenize.pop():n.skipToEnd(),"string"}}function w(e,i){return e.sol()&&e.match("=end")&&e.eol()&&i.tokenize.pop(),e.skipToEnd(),"comment"}const E={name:"ruby",startState:function(e){return{tokenize:[p],indented:0,context:{type:"top",indented:-e},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,i){f=null,e.sol()&&(i.indented=e.indentation());var n=i.tokenize[i.tokenize.length-1](e,i),r,l=f;if(n=="variable"){var o=e.current();n=i.lastTok=="."?"property":x.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":i.lastTok=="def"||i.lastTok=="class"||i.varList?"def":"variable",n=="keyword"&&(l=o,z.propertyIsEnumerable(o)?r="indent":_.propertyIsEnumerable(o)?r="dedent":((o=="if"||o=="unless")&&e.column()==e.indentation()||o=="do"&&i.context.indented<i.indented)&&(r="indent"))}return(f||n&&n!="comment")&&(i.lastTok=l),f=="|"&&(i.varList=!i.varList),r=="indent"||/[\(\[\{]/.test(f)?i.context={prev:i.context,type:f||n,indented:i.indented}:(r=="dedent"||/[\)\]\}]/.test(f))&&i.context.prev&&(i.context=i.context.prev),e.eol()&&(i.continuedLine=f=="\\"||n=="operator"),n},indent:function(e,i,n){if(e.tokenize[e.tokenize.length-1]!=p)return null;var r=i&&i.charAt(0),l=e.context,o=l.type==b[r]||l.type=="keyword"&&/^(?:end|until|else|elsif|when|rescue)\b/.test(i);return l.indented+(o?0:n.unit)+(e.continuedLine?n.unit:0)},languageData:{indentOnInput:/^\s*(?:end|rescue|elsif|else|\})$/,commentTokens:{line:"#"},autocomplete:v}};export{E as ruby};
|