@vantran-se/openchamber-web 2.0.4 → 2.0.6
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/{CodeMirrorCommentWidgets-DZF8ntaq.js → CodeMirrorCommentWidgets-BlzB2e0C.js} +1 -1
- package/dist/assets/DiffView-D7JQzQVZ.js +4 -0
- package/dist/assets/FilesView-DC2gadXM.js +17 -0
- package/dist/assets/{GitView-DwQwqDvu.js → GitView-Gzl0wbdd.js} +4 -4
- package/dist/assets/{GuestAttachDialog-CoXM0gh_.js → GuestAttachDialog-CQdDIeco.js} +1 -1
- package/dist/assets/GuestSurfacePane-CrOhlIdt.js +1 -0
- package/dist/assets/{JsonTreeView-Cq_27v0y.js → JsonTreeView-C3QZifYe.js} +1 -1
- package/dist/assets/{LinearIssuesView-CsSSRMhn.js → LinearIssuesView-X27TCI3v.js} +1 -1
- package/dist/assets/MarkdownImageGallery-BlTWU9oH.js +1 -0
- package/dist/assets/MarkdownRendererImpl-Cno7QsJO.js +12 -0
- package/dist/assets/{OnboardingScreen-ClatMQAX.js → OnboardingScreen-Wr_UzNtt.js} +1 -1
- package/dist/assets/{PatchDiff-DOwlrIK9.js → PatchDiff-D6pWS7cD.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CrcGqqD_.js → PierreDiffViewer-DDljFbJJ.js} +3 -3
- package/dist/assets/{PlanView-BGLsMgQk.js → PlanView-LcfEbBPi.js} +4 -4
- package/dist/assets/PluginPane-DPWPLc2f.js +3 -0
- package/dist/assets/SettingsView-CFe9O3EM.js +30 -0
- package/dist/assets/{SettingsWindow-B0BAy-f9.js → SettingsWindow-DT1xhvgi.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-fcdDzCSW.js → SubmoduleDiffSummary-CBHXaIkB.js} +1 -1
- package/dist/assets/{ToolOutputDialog-B7xaUz2H.js → ToolOutputDialog-B_ZX8ZbZ.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-CkWCaUmZ.js → ToolPartDiffPreview-D_HQzkXU.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-DONC4eI2.js → VirtualizedFileDiff-BUK1ujXg.js} +1 -1
- package/dist/assets/{WalkthroughView-CXDImOXW.js → WalkthroughView-H-tYOvhO.js} +2 -2
- package/dist/assets/{appThemeRegistry-Br2TLSlb.js → appThemeRegistry-BoJGAwCP.js} +1 -1
- package/dist/assets/changesTree-CePHbFcj.js +1 -0
- package/dist/assets/commitAndPush-BzZrF8bK.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-_-20umCs.js → computeVirtualFileMetrics-kYyVjXLu.js} +2 -2
- package/dist/assets/de-ByfQDcPj.js +10 -0
- package/dist/assets/es-DzNbjsQS.js +16 -0
- package/dist/assets/fr-B8AVLrnX.js +14 -0
- package/dist/assets/{index-OKDYjcMF.js → index-0-ON1L7L.js} +1 -1
- package/dist/assets/index-DUke1nme.css +1 -0
- package/dist/assets/index-Di6zUe5h.js +41 -0
- package/dist/assets/{isDiffPlainText-D77M6q1f.js → isDiffPlainText-Bgm_aLpu.js} +1 -1
- package/dist/assets/{isFilePlainText-C54B4Mns.js → isFilePlainText-D5GMgURH.js} +1 -1
- package/dist/assets/ja-1g6S0G19.js +16 -0
- package/dist/assets/ko-CxplvYkJ.js +16 -0
- package/dist/assets/{main-CGEvLMd2.js → main--Y98ZLsD.js} +2 -2
- package/dist/assets/main-GjXmVNpD.js +896 -0
- package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
- package/dist/assets/markdownCore-CVdUcVCi.js +7 -0
- package/dist/assets/{miniChat-BSxkRQLj.js → miniChat-tTx5mpbd.js} +2 -2
- package/dist/assets/{mobile-C5KRTNOB.js → mobile-BmbiDWGb.js} +2 -2
- package/dist/assets/patchFileDiff-CV4iVQ8L.js +13 -0
- package/dist/assets/pl-f3QyqvIB.js +16 -0
- package/dist/assets/pt-BR-BsaoaiCK.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-CnkAQV6o.js → renderElectronMiniChatApp-BnCdnDhv.js} +2 -2
- package/dist/assets/renderMobileApp-CKn8nbSW.js +25 -0
- package/dist/assets/runtimeEndpointReset-sCi88eed.js +27 -0
- package/dist/assets/scheduledTasksApi-Dahv3ws0.js +1 -0
- package/dist/assets/{shikiHighlight-4O0ZM14D.js → shikiHighlight-O5_xLmWt.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-yNq7b0DZ.js → textMateThemeFromAppTheme-XM4VefqN.js} +1 -1
- package/dist/assets/tr-BNFsa6nz.js +7 -0
- package/dist/assets/uk-CJ9y5ULA.js +16 -0
- package/dist/assets/{useAppFontEffects-Bzyszv2N.js → useAppFontEffects-BN06mgHB.js} +160 -156
- package/dist/assets/{useInlineCommentController-zOf6ORAq.js → useInlineCommentController-Bb9Gjz1Q.js} +2 -2
- package/dist/assets/{useRootScrollLock-DCaZ4BWi.js → useRootScrollLock-Chk1cFUw.js} +2 -2
- package/dist/assets/{vendor-codemirror-language-data-6cEFPNUR.js → vendor-codemirror-language-data-C2qMZiA7.js} +2 -2
- package/dist/assets/vendor-opencode-client-DSZl7jSi.js +12 -0
- package/dist/assets/vendor-zod-BSoePkpP.js +39 -0
- package/dist/assets/{web-components-BEo4-ISu.js → web-components-BQWjCn_U.js} +1 -1
- package/dist/assets/zh-CN-U0QjVlAA.js +16 -0
- package/dist/assets/zh-TW-J9PTJQJi.js +16 -0
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +4 -4
- package/server/index.js +82 -0
- package/server/lib/agent-tool/DOCUMENTATION.md +132 -47
- package/server/lib/agent-tool/runtime.js +34 -15
- package/server/lib/agent-tool/runtime.test.js +15 -0
- package/server/lib/browser-control/DOCUMENTATION.md +14 -2
- package/server/lib/event-stream/global-hub.js +23 -1
- package/server/lib/event-stream/global-hub.test.js +35 -0
- package/server/lib/event-stream/global-ws-bridge.js +3 -1
- package/server/lib/event-stream/upstream-reader.js +3 -2
- package/server/lib/git/DOCUMENTATION.md +1 -1
- package/server/lib/git/service.js +22 -0
- package/server/lib/git/service.test.js +8 -0
- package/server/lib/guests/DOCUMENTATION.md +4 -3
- package/server/lib/guests/catalog.js +19 -1
- package/server/lib/guests/catalog.test.js +22 -0
- package/server/lib/guests/html-styles.js +5 -3
- package/server/lib/guests/html-styles.test.js +3 -1
- package/server/lib/guests/routes.js +11 -3
- package/server/lib/guests/service.js +5 -0
- package/server/lib/guests/surface.js +55 -9
- package/server/lib/guests/surface.test.js +56 -6
- package/server/lib/notifications/DOCUMENTATION.md +10 -0
- package/server/lib/notifications/emit-route.js +118 -0
- package/server/lib/notifications/emit-route.test.js +112 -0
- package/server/lib/openchamber-control/actions.js +16 -2
- package/server/lib/openchamber-control/service.js +23 -0
- package/server/lib/openchamber-control/service.test.js +31 -0
- package/server/lib/openchamber-sessions/fork-inheritance.js +103 -0
- package/server/lib/openchamber-sessions/fork-inheritance.test.js +69 -0
- package/server/lib/openchamber-sessions/routes.js +11 -0
- package/server/lib/openchamber-sessions/routes.test.js +18 -0
- package/server/lib/opencode/bootstrap-runtime.js +14 -1
- package/server/lib/opencode/compatibility.js +6 -3
- package/server/lib/opencode/compatibility.test.js +8 -0
- package/server/lib/opencode/config-entity-v2.test.js +27 -0
- package/server/lib/opencode/config-paths.test.js +12 -0
- package/server/lib/opencode/config-v2.d.ts +2 -0
- package/server/lib/opencode/config-v2.js +42 -0
- package/server/lib/opencode/config-v2.test.js +17 -0
- package/server/lib/opencode/core-routes.js +20 -4
- package/server/lib/opencode/core-routes.test.js +41 -0
- package/server/lib/opencode/env-runtime.js +1 -8
- package/server/lib/opencode/feature-routes-runtime.js +2 -1
- package/server/lib/opencode/lifecycle.js +30 -2
- package/server/lib/opencode/lifecycle.test.js +27 -0
- package/server/lib/opencode/managed-config-file.js +18 -6
- package/server/lib/opencode/managed-config-file.test.js +23 -7
- package/server/lib/opencode/mcp.js +7 -2
- package/server/lib/opencode/npm-registry-config.d.ts +1 -0
- package/server/lib/opencode/npm-registry-config.js +123 -0
- package/server/lib/opencode/npm-registry-config.test.js +167 -0
- package/server/lib/opencode/npm-registry.js +5 -6
- package/server/lib/opencode/npm-registry.test.js +30 -0
- package/server/lib/opencode/openchamber-routes.js +29 -11
- package/server/lib/opencode/openchamber-routes.test.js +18 -0
- package/server/lib/opencode/project-directory-runtime.js +8 -0
- package/server/lib/opencode/project-directory-runtime.test.js +13 -0
- package/server/lib/opencode/provider-source-route.test.js +59 -0
- package/server/lib/opencode/providers.js +3 -0
- package/server/lib/opencode/providers.test.js +62 -0
- package/server/lib/opencode/proxy.js +38 -2
- package/server/lib/opencode/routes-upgrade.test.js +1 -1
- package/server/lib/opencode/routes.js +36 -1
- package/server/lib/opencode/server-utils-runtime.js +5 -0
- package/server/lib/opencode/settings-helpers.js +10 -0
- package/server/lib/opencode/settings-helpers.test.js +2 -2
- package/server/lib/opencode/settings-registry.json +17 -0
- package/server/lib/opencode/settings-runtime.js +1 -0
- package/server/lib/opencode/shared.js +49 -4
- package/server/lib/opencode/shared.test.js +78 -1
- package/server/lib/opencode/shutdown-runtime.js +3 -0
- package/server/lib/opencode/skill-routes.js +28 -12
- package/server/lib/opencode/skill-routes.test.js +121 -1
- package/server/lib/opencode/upgrade-capability.js +0 -14
- package/server/lib/opencode/v1-migration-topup.js +21 -15
- package/server/lib/opencode/v1-migration-topup.test.js +14 -6
- package/server/lib/opencode/v2-install.d.ts +1 -0
- package/server/lib/opencode/v2-install.js +8 -7
- package/server/lib/opencode/v2-install.test.js +13 -4
- package/server/lib/opencode/watcher.js +3 -1
- package/server/lib/opencode/websearch-config.js +13 -1
- package/server/lib/quota/providers/kimi.js +1 -1
- package/server/lib/realtime-proxy.js +5 -1
- package/server/lib/realtime-proxy.test.js +29 -0
- package/server/lib/relay/tunnel-host.js +4 -1
- package/server/lib/relay/tunnel-host.test.js +11 -0
- package/server/lib/session-assist/DOCUMENTATION.md +17 -5
- package/server/lib/session-assist/runtime.js +19 -2
- package/server/lib/session-assist/runtime.test.js +8 -0
- package/server/lib/session-goal/DOCUMENTATION.md +11 -0
- package/server/lib/small-model/DOCUMENTATION.md +11 -10
- package/server/lib/small-model/index.js +27 -32
- package/server/lib/small-model/index.test.js +28 -16
- package/server/lib/spaces/DOCUMENTATION.md +404 -32
- package/server/lib/spaces/code-in-bait.js +145 -6
- package/server/lib/spaces/code-in.js +10 -150
- package/server/lib/spaces/code-in.test.js +7 -83
- package/server/lib/spaces/code-out.js +1819 -0
- package/server/lib/spaces/code-out.test.js +3945 -0
- package/server/lib/spaces/code-transfer.js +173 -0
- package/server/lib/spaces/command-stream.test.js +181 -0
- package/server/lib/spaces/dispatcher.js +670 -0
- package/server/lib/spaces/dispatcher.test.js +582 -0
- package/server/lib/spaces/gatekeeper-channel.js +61 -7
- package/server/lib/spaces/gatekeeper-channel.test.js +43 -7
- package/server/lib/spaces/gatekeeper-program.cjs +68 -14
- package/server/lib/spaces/gatekeeper-program.test.js +118 -3
- package/server/lib/spaces/hardening.js +20 -4
- package/server/lib/spaces/hardening.test.js +18 -3
- package/server/lib/spaces/host-git.js +7 -4
- package/server/lib/spaces/host-git.test.js +6 -2
- package/server/lib/spaces/host.js +310 -0
- package/server/lib/spaces/host.test.js +273 -0
- package/server/lib/spaces/journey.js +552 -0
- package/server/lib/spaces/journey.test.js +589 -0
- package/server/lib/spaces/layout.js +42 -8
- package/server/lib/spaces/manager.js +4 -3
- package/server/lib/spaces/manager.test.js +6 -0
- package/server/lib/spaces/places/code-out.docker.live.test.js +412 -0
- package/server/lib/spaces/places/contract-suite.js +36 -0
- package/server/lib/spaces/places/dispatcher.docker.live.test.js +296 -0
- package/server/lib/spaces/places/docker-live-support.js +27 -4
- package/server/lib/spaces/places/docker.js +33 -5
- package/server/lib/spaces/places/docker.test.js +42 -3
- package/server/lib/spaces/places/escape-suite.js +118 -14
- package/server/lib/spaces/places/fake-docker.js +3 -1
- package/server/lib/spaces/places/grants.docker.live.test.js +197 -0
- package/server/lib/spaces/places/memory-place.js +24 -1
- package/server/lib/spaces/places/registry.js +1 -1
- package/server/lib/spaces/places/server.docker.live.test.js +69 -33
- package/server/lib/spaces/places/sessions.docker.live.test.js +222 -0
- package/server/lib/spaces/routes.js +216 -0
- package/server/lib/spaces/routes.test.js +213 -0
- package/server/lib/spaces/run-command.js +261 -8
- package/server/lib/spaces/run-command.test.js +193 -3
- package/server/lib/spaces/space-events.js +153 -0
- package/server/lib/spaces/space-events.test.js +160 -0
- package/server/lib/spaces/space-opencode.js +52 -0
- package/server/lib/spaces/space-opencode.test.js +41 -0
- package/server/lib/spaces/space-records.js +150 -0
- package/server/lib/spaces/space-records.test.js +113 -0
- package/server/lib/spaces/space-sessions.js +210 -0
- package/server/lib/spaces/space-sessions.test.js +161 -0
- package/server/lib/spaces/websocket.js +329 -0
- package/server/lib/spaces/websocket.test.js +345 -0
- package/server/lib/ui-auth/ui-auth.js +8 -2
- package/server/lib/ui-auth/ui-auth.test.js +29 -0
- package/server/opencode-proxy.test.js +113 -0
- package/dist/assets/DiffView-D2p4Ar0H.js +0 -4
- package/dist/assets/FilesView-BeTtbsip.js +0 -17
- package/dist/assets/GuestSurfacePane-DIJvkkM-.js +0 -1
- package/dist/assets/MarkdownImageGallery-CY0dWTaE.js +0 -1
- package/dist/assets/MarkdownRendererImpl-ILdXzLrt.js +0 -12
- package/dist/assets/PluginPane-B39JEUL8.js +0 -3
- package/dist/assets/SettingsView-13B2_G-A.js +0 -29
- package/dist/assets/commitAndPush-CcI4ol7c.js +0 -1
- package/dist/assets/de-BtYnUgII.js +0 -10
- package/dist/assets/es-crP5qPye.js +0 -16
- package/dist/assets/fr-CLSRuALk.js +0 -14
- package/dist/assets/index-CLcM8HKx.css +0 -1
- package/dist/assets/index-CvLgnuNI.js +0 -41
- package/dist/assets/ja-SZ1-ucLV.js +0 -16
- package/dist/assets/ko-HthbT_Ve.js +0 -16
- package/dist/assets/main-BJklC7Cl.js +0 -896
- package/dist/assets/markdownCore-BzQuETm0.js +0 -5
- package/dist/assets/patchFileDiff-DGw2KryM.js +0 -13
- package/dist/assets/pl-C8eYfjL1.js +0 -16
- package/dist/assets/pt-BR-cYOrZdxS.js +0 -16
- package/dist/assets/renderMobileApp-CMxjwisj.js +0 -25
- package/dist/assets/runtimeEndpointReset-C45jrFq4.js +0 -27
- package/dist/assets/scheduledTasksApi-CkK1F9s2.js +0 -1
- package/dist/assets/tr-B4IQ5t-T.js +0 -7
- package/dist/assets/uk-DCoXG6ve.js +0 -16
- package/dist/assets/vendor-opencode-client-_BAHQo4R.js +0 -12
- package/dist/assets/vendor-zod-Gea9uBlY.js +0 -39
- package/dist/assets/zh-CN-BXBoxsFk.js +0 -16
- package/dist/assets/zh-TW-C6oelpnL.js +0 -16
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesView-DC2gadXM.js","assets/vendor-react-BUCujlKS.js","assets/vendor-scheduler-7OC5HNn7.js","assets/index-Di6zUe5h.js","assets/vendor-zod-BSoePkpP.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-zustand-BAGL70zf.js","assets/vendor-opencode-client-DSZl7jSi.js","assets/index-DUke1nme.css","assets/useAppFontEffects-BN06mgHB.js","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-base-ui-CsXYnR5c.js","assets/vendor-floating-ui-utils-D6FqdtJt.js","assets/vendor-floating-ui-react-dom-DxYCWdHj.js","assets/vendor-floating-ui-dom-BTvzWks8.js","assets/vendor-floating-ui-core-PuGzNPnN.js","assets/vendor-use-sync-external-store-D6wYuSt-.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-dnd-kit-core-BZknOX2w.js","assets/vendor-dnd-kit-utilities-B_MdXhJC.js","assets/vendor-dnd-kit-accessibility-BHxJPORy.js","assets/vendor-dnd-kit-sortable-CsEagZ81.js","assets/vendor-tanstack-react-virtual-ClYN8CzB.js","assets/vendor-tanstack-virtual-core-BewVQryB.js","assets/vendor-framer-motion-Bq3iTZ6r.js","assets/vendor-motion-dom-DcCgeG69.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/contextPanelEmbeddedChat-CirXEPJq.js","assets/vendor-sonner-DFyL3AvE.js","assets/vendor-cmdk-DgLInKvT.js","assets/vendor-radix-ui-react-dialog-B94Bt2qq.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-DcAh5WdT.js","assets/vendor-radix-ui-react-context-Czxm7Z62.js","assets/vendor-radix-ui-react-id-f5BLKEVw.js","assets/vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js","assets/vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js","assets/vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js","assets/vendor-radix-ui-react-primitive-DhVoX9SD.js","assets/vendor-radix-ui-react-slot-BQgQOasS.js","assets/vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js","assets/vendor-radix-ui-react-use-escape-keydown-oph88g-F.js","assets/vendor-radix-ui-react-focus-scope-CiaxW4dD.js","assets/vendor-radix-ui-react-portal-BMJYHWck.js","assets/vendor-radix-ui-react-presence-CNxf-uq4.js","assets/vendor-radix-ui-react-focus-guards-B6qJXYua.js","assets/vendor-react-remove-scroll-DO7dCTnK.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-BcFYyj3E.js","assets/vendor-react-style-singleton-q6EMHnwf.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-zDC0RhA3.js","assets/vendor-use-callback-ref-D3RC8gqK.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-BgPj_McA.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-codemirror-state-C9awkmn-.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-CiLROUVV.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-Cc2ZYbgX.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-DzPz9Wgq.js","assets/vendor-codemirror-lang-json-CMBS2tG9.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-O0cZX78y.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-CfgK872x.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-BPGOH9ye.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-C2qMZiA7.js","assets/vendor-codemirror-lang-python-HahnQaAS.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-B7H_j0iU.js","assets/vendor-legendapp-list-BuBPBC3R.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/runtimeEndpointReset-sCi88eed.js","assets/GuestAttachDialog-CQdDIeco.js","assets/PluginPane-DPWPLc2f.js","assets/shikiHighlight-O5_xLmWt.js","assets/vendor-codemirror-search-BmS-GmcX.js","assets/vendor-replit-codemirror-vim-B2DJlAhT.js","assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js","assets/JsonTreeView-C3QZifYe.js","assets/web-components-BQWjCn_U.js","assets/computeVirtualFileMetrics-kYyVjXLu.js","assets/vendor-shiki-Bbf2GEcE.js","assets/vendor-shikijs-core-CGM_jqPK.js","assets/vendor-shikijs-types-CPSbSeK6.js","assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js","assets/vendor-hast-util-to-html-BKBhbTDb.js","assets/vendor-html-void-elements-CkdplsNl.js","assets/vendor-property-information-rJCbAzvX.js","assets/vendor-zwitch-C2o2j-tx.js","assets/vendor-stringify-entities-CsH1VEn9.js","assets/vendor-character-entities-legacy-BpoLgcEt.js","assets/vendor-character-entities-html4-D7taRCQ7.js","assets/vendor-ccount-c2V3InAJ.js","assets/vendor-comma-separated-tokens-D8TqSuIK.js","assets/vendor-space-separated-tokens-DD3iYX1K.js","assets/vendor-hast-util-whitespace-D4Wp6AEg.js","assets/vendor-shikijs-engine-oniguruma-DPWuIF1G.js","assets/themeResolver-BmJyTmjJ.js","assets/vendor-pierre-theming-C6Z4M5_u.js","assets/vendor-shikijs-engine-javascript-Cme4830A.js","assets/vendor-oniguruma-to-es-DLBnFDCE.js","assets/vendor-oniguruma-parser-C0D4_9rT.js","assets/vendor-regex-BBWcyTkg.js","assets/vendor-regex-utilities-2BQyy0xI.js","assets/vendor-regex-recursion-JU4mF-dD.js","assets/vendor-shikijs-transformers-CZWsLLKm.js","assets/Virtualizer-CZlLSacm.js","assets/isFilePlainText-D5GMgURH.js","assets/appThemeRegistry-BoJGAwCP.js","assets/textMateThemeFromAppTheme-XM4VefqN.js","assets/Virtualizer-D_a8gKmg.js","assets/vendor-react-drawio-Ct3Q0DsD.js","assets/scheduledTasksApi-Dahv3ws0.js","assets/useInlineCommentController-Bb9Gjz1Q.js","assets/CodeMirrorCommentWidgets-BlzB2e0C.js","assets/vendor-capacitor-app-BrDJj9I_.js","assets/vendor-capacitor-core-B4EWRrHz.js","assets/vendor-capacitor-push-notifications-KNe1zSBF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{f as le,r as bn,j as t,R as c,c as $t,h as go}from"./vendor-react-BUCujlKS.js";import"./vendor-katex-CHD9BdDO.js";import{u as it,a as Kt,b as ri,d as mr,i as Te,e as st,s as _t,f as gs,h as Sn,j as bo,k as ii,l as xo,p as yo,m as vo,n as pt,o as wo,q as Ps,t as jo,v as pr,G as hr,x as ko,y as gr,z as oi,A as br,B as xr,C as yr,M as As,D as So,E as No}from"./index-Di6zUe5h.js";import{u as Nn,a as Co,b as We,c as ai,d as li,r as Cn,e as Ro,f as pe,t as me,o as Eo,I as Z,B as be,g as Po,O as Mt,h as Q,P as Ao,i as Io,j as To,k as Do,l as qe,m as _o,n as vt,p as Mo,q as vr,s as zo,v as Oo,w as Rn,x as Bo,y as Lo,z as Ne,A as $o,C as En,D as Pn,E as An,F as Fo,S as Ls,G as In,H as Wo,J as ci,K as Fe,L as ui,M as Vo,N as Uo,Q as Go,R as di,T as fi,U as mi,V as pi,W as hi,X as gi,Y as Ko,Z as Ho,_ as Tn,$ as qo,a0 as Jo,a1 as Yo,a2 as Qo,a3 as os,a4 as Is,a5 as Xo,a6 as bi,a7 as Zo,a8 as ea,a9 as qs,aa as xi,ab as yi,ac as cs,ad as Bt,ae as ta,af as sa,ag as na,ah as ra,ai as Dn,aj as ia,ak as oa,al as aa,am as la,an as ca,ao as ua,ap as da,aq as fa,ar as wr,as as ma,at as pa,au as ha,av as ga,aw as ba,ax as Ts,ay as xa,az as ya,aA as vi,aB as Ve,aC as va,aD as wa,aE as ja,aF as ka,aG as _n,aH as Sa,aI as Na,aJ as Ca,aK as Ra,aL as Ea,aM as Pa,aN as Aa,aO as wi,aP as Ia,aQ as Ta,aR as Da,aS as _a,aT as Ma,aU as za,aV as Oa,aW as Ba,aX as La,aY as $a,aZ as Fa,a_ as Wa,a$ as Va,b0 as Ua,b1 as Ga,b2 as Ka,b3 as Ha,b4 as qa,b5 as Ja,b6 as Ya,b7 as Qa,b8 as Xa,b9 as Za,ba as el,bb as tl,bc as sl,bd as nl,be as rl,bf as il,bg as ol}from"./useAppFontEffects-BN06mgHB.js";import{u as zt,S as Mn,h as al,a as ji,s as ll,p as cl,c as ul,r as dl,b as fl,D as ml,N as pl,d as hl,e as gl,g as bl,f as xl,B as yl,i as vl,j as wl,k as jl,l as kl,m as Sl,T as Nl,P as Cl,O as Rl,n as El,o as Pl,q as Al,t as Il,A as Tl,v as Dl,C as _l,w as Ml,x as zl,U as Ol,y as Bl}from"./runtimeEndpointReset-sCi88eed.js";import{_ as Ft}from"./vendor-vite-runtime-DD1OZmLC.js";import{S as Ll,A as $l}from"./SettingsView-CFe9O3EM.js";import{PlanView as Fl}from"./PlanView-LcfEbBPi.js";import{p as Wl}from"./vendor-aparajita-capacitor-secure-storage-5IShChL0.js";import{Capacitor as Vl}from"./vendor-capacitor-core-B4EWRrHz.js";import{k as xn,M as $s,d as Ul,J as yn,s as ki,a as zn,p as Gl,_ as jr,f as On,V as Kl,K as kr,P as Hl,b as ql,c as Jl,U as Yl,Z as Ql,Q as Xl,r as Zl}from"./vendor-remixicon-react-D6dZ0UwF.js";import{f as Bn,h as Wt,i as Ln,P as $n,D as Fn,j as Wn}from"./vendor-dnd-kit-core-BZknOX2w.js";import{s as Vn,S as Un,v as Gn,u as Kn}from"./vendor-dnd-kit-sortable-CsEagZ81.js";import{C as Hn}from"./vendor-dnd-kit-utilities-B_MdXhJC.js";import{c as qn,p as Si}from"./vendor-zustand-BAGL70zf.js";import{toast as ec}from"./vendor-sonner-DFyL3AvE.js";import{C as tc,a as sc,D as nc,p as Sr}from"./commitAndPush-BzZrF8bK.js";import{u as rc,a as ic,b as oc,c as ac,i as lc,f as cc,B as uc,C as dc,P as Nr}from"./patchFileDiff-CV4iVQ8L.js";import{u as fc,a as mc,i as pc,S as hc,b as gc}from"./SubmoduleDiffSummary-CBHXaIkB.js";import{P as bc}from"./PierreDiffViewer-DDljFbJJ.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zod-BSoePkpP.js";import"./vendor-opencode-client-DSZl7jSi.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-CsXYnR5c.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tanstack-react-virtual-ClYN8CzB.js";import"./vendor-tanstack-virtual-core-BewVQryB.js";import"./vendor-framer-motion-Bq3iTZ6r.js";import"./vendor-motion-dom-DcCgeG69.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./contextPanelEmbeddedChat-CirXEPJq.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BgPj_McA.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-C9awkmn-.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-CiLROUVV.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-Cc2ZYbgX.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-DzPz9Wgq.js";import"./vendor-codemirror-lang-json-CMBS2tG9.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-O0cZX78y.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CfgK872x.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-BPGOH9ye.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-C2qMZiA7.js";import"./vendor-codemirror-lang-python-HahnQaAS.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-B7H_j0iU.js";import"./vendor-legendapp-list-BuBPBC3R.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./GuestAttachDialog-CQdDIeco.js";import"./PluginPane-DPWPLc2f.js";import"./vendor-yaml-3778uTud.js";import"./shikiHighlight-O5_xLmWt.js";import"./vendor-codemirror-search-BmS-GmcX.js";import"./vendor-replit-codemirror-vim-B2DJlAhT.js";import"./vendor-replit-codemirror-vim-core-FHzKdNUS.js";import"./appThemeRegistry-BoJGAwCP.js";import"./textMateThemeFromAppTheme-XM4VefqN.js";import"./themeResolver-BmJyTmjJ.js";import"./vendor-pierre-theming-C6Z4M5_u.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-qrcode-DTJ12-WC.js";import"./vendor-dijkstrajs-COg3n3zL.js";import"./vendor-strip-json-comments-5dJlOkP1.js";import"./useInlineCommentController-Bb9Gjz1Q.js";import"./CodeMirrorCommentWidgets-BlzB2e0C.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./changesTree-CePHbFcj.js";import"./VirtualizedFileDiff-BUK1ujXg.js";import"./web-components-BQWjCn_U.js";import"./computeVirtualFileMetrics-kYyVjXLu.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./isDiffPlainText-Bgm_aLpu.js";import"./vendor-diff-C3JhlQdm.js";import"./Virtualizer-D_a8gKmg.js";let Ni=null,Cr=!1;const xc=new Promise(n=>{Ni=n});function yc(){Cr||(Cr=!0,Ni?.())}const vc=6,wc=n=>n.parentID??null,Rr=n=>{const e=n.replace(/\/+$/,"");return e.slice(e.lastIndexOf("/")+1)||e},jc=n=>n.replace(/\\/g,"/").replace(/\/+$/,""),kc=(n,e)=>{if(!n)return"";let s=null,i=-1;for(const r of e){const o=jc(r.path);(n===o||n.startsWith(`${o}/`))&&o.length>i&&(s=r,i=o.length)}return s?s.label?.trim()||Rr(s.path):Rr(n)},Sc=()=>{const n=Nn.getState().activeSessions,e=Co.getState().index.session.unseenCount,s=it.getState().notifyOnSubtasks,i=We.getState().projects,r=ai.getState().ids,o=li.getState().rankById;let a=0;const u=[];for(const d of n){const l=wc(d)!==null,g=(e[d.id]??0)>0&&(!l||s);g&&(a+=1),l||u.push({session:d,unread:g,project:kc(Cn(d),i)})}u.sort((d,l)=>Ro(d.session,l.session,r,o));const f=u.slice(0,vc).map(({session:d,unread:l,project:p})=>({id:d.id,title:d.title??"",unread:l,project:p}));return{runtimeKey:Kt(),attentionCount:a,recentSessions:f}},Nc="__OPENCHAMBER_WIDGET_SNAPSHOT__",Cc=()=>{typeof window>"u"||(window[Nc]=()=>{try{return JSON.stringify(Sc())}catch{return null}})},cn="mobile-app-update-available",Er="mobile-app-update-toast-dismissed-version",Rc=()=>{const n=le.c(8),{t:e}=pe(),s=zt(Ec),i=zt(Pc),r=zt(Ac),o=zt(Ic);let a;n[0]===Symbol.for("react.memo_cache_sentinel")?(a=new Set,n[0]=a):a=n[0];const u=bn.useRef(a);let f,d;return n[1]!==s||n[2]!==o||n[3]!==i||n[4]!==e||n[5]!==r?(f=()=>{if(ri()!=="android"||i!=="mobile"||!s||!r||!o){me.dismiss(cn);return}mr().getItem(Er)!==r&&(u.current.has(r)||(u.current.add(r),me.info(e("mobileUpdate.toast.available.title"),{id:cn,description:e("mobileUpdate.toast.available.description",{version:r}),duration:1/0,icon:t.jsx(Z,{name:"download",className:"h-4 w-4 text-muted-foreground"}),action:{label:e("mobileUpdate.toast.actions.download"),onClick:()=>{Eo(o)}},cancel:{label:e("mobileUpdate.toast.actions.dismiss"),onClick:()=>{mr().setItem(Er,r),me.dismiss(cn)}}})))},d=[s,o,i,e,r],n[1]=s,n[2]=o,n[3]=i,n[4]=e,n[5]=r,n[6]=f,n[7]=d):(f=n[6],d=n[7]),bn.useEffect(f,d),null};function Ec(n){return n.available}function Pc(n){return n.runtimeType}function Ac(n){return n.info?.version}function Ic(n){return n.info?.downloadUrl}const Pr=300,Tc="openchamber.mobile.connectLog.v1",Ot=[];if(typeof window<"u")try{window.localStorage.removeItem(Tc)}catch{}const Jn=(n,e)=>{Ot.push({at:Date.now(),step:n,detail:e}),Ot.length>Pr&&Ot.splice(0,Ot.length-Pr)};typeof window<"u"&&Jn("app:launch","{}");const Dc=()=>[...Ot],_c=n=>{const e=new Date(n),s=(i,r=2)=>String(i).padStart(r,"0");return`${s(e.getHours())}:${s(e.getMinutes())}:${s(e.getSeconds())}.${s(e.getMilliseconds(),3)}`},Ci=n=>`${_c(n.at)} ${n.step}${n.detail&&n.detail!=="{}"?` ${n.detail}`:""}`,Mc=()=>Ot.map(Ci).join(`
|
|
3
|
+
`),Ri=(n,e)=>{const s=le.c(10),i=700,r=c.useRef(null),o=c.useRef(null),a=c.useRef(!1);let u;s[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{r.current!==null&&window.clearTimeout(r.current),r.current=null,o.current=null},s[0]=u):u=s[0];const f=u;let d,l;s[1]===Symbol.for("react.memo_cache_sentinel")?(d=()=>f,l=[f],s[1]=d,s[2]=l):(d=s[1],l=s[2]),c.useEffect(d,l);let p;s[3]!==i||s[4]!==n?(p=v=>{a.current=!1,o.current={x:v.clientX,y:v.clientY},r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>{r.current=null,a.current=!0,n()},i)},s[3]=i,s[4]=n,s[5]=p):p=s[5];const g=p;let h;s[6]===Symbol.for("react.memo_cache_sentinel")?(h=v=>{const N=o.current;N&&(Math.abs(v.clientX-N.x)>10||Math.abs(v.clientY-N.y)>10)&&f()},s[6]=h):h=s[6];const b=h;let S;s[7]===Symbol.for("react.memo_cache_sentinel")?(S=v=>{a.current&&(a.current=!1,v.preventDefault(),v.stopPropagation())},s[7]=S):S=s[7];const x=S;let E;return s[8]!==g?(E={onPointerDown:g,onPointerMove:b,onPointerUp:f,onPointerCancel:f,onClickCapture:x},s[8]=g,s[9]=E):E=s[9],E},Fs="openchamber.mobile.connections.v1",zc="openchamber.mobile.",Ar="openchamber.mobile.deviceId",Oc=()=>{try{const n=window.localStorage.getItem(Ar);if(n&&n.trim())return n.trim();const e=crypto.randomUUID();return window.localStorage.setItem(Ar,e),e}catch{return crypto.randomUUID()}},Ir=()=>`mobile:${Oc()}`,Tr=()=>{try{const n=Vl.getPlatform();return n==="ios"||n==="android"?n:void 0}catch{return}},Ei=12,Pi=8e3,Bc=2500,Lc=3e3,Ws=2500,$c=()=>{let n=0;return{begin:()=>(n+=1,n),cancel:()=>{n+=1},isCurrent:e=>e===n}},Ht=n=>{const e=n.trim();if(!e)return"";const s=/^https?:\/\//i.test(e)?e:`http://${e}`,i=new URL(s);return i.hash="",i.search="",i.pathname=i.pathname.replace(/\/+$/,""),i.toString().replace(/\/+$/,"")},zs=n=>{try{return new URL(n).host}catch{return n}},Vt=n=>{try{return Ht(n)}catch{return n.trim().replace(/\/+$/g,"")}},Ai=(n,e)=>Vt(n)===Vt(e),Ii=n=>`relay:${n.serverId}@${n.relayUrl.trim()}`,Fc=n=>`relay://${n.serverId}`,Js=n=>n.candidates.filter(e=>e.kind==="direct"),kt=n=>{const e=n.candidates.find(s=>s.kind==="relay");return e&&e.kind==="relay"?e.relay:null},lt=n=>{const e=Js(n)[0];if(e)return e.url;const s=kt(n);return s?Fc(s):""},Ae=n=>{const e=kt(n);if(e)return Ii(e);const s=Js(n)[0];return s?Vt(s.url):""},Vs=(n,e)=>{const s=n.find(o=>o.kind==="relay"),i=s&&s.kind==="relay"?s.relay.serverId:null,r=new Set(n.filter(o=>o.kind==="direct").map(o=>Vt(o.url)));return e.some(o=>o.kind==="relay"?i!==null&&o.relay.serverId===i:r.has(Vt(o.url)))},Yn=n=>{const e=(()=>{try{return Ht(n)}catch{return""}})();return e?[{kind:"direct",url:e}]:[]},Dr=n=>{if(n.candidates&&n.candidates.length>0)return n.candidates;const e=[];return typeof n.url=="string"&&n.url.trim()&&!/^relay:\/\//i.test(n.url.trim())&&e.push(...Yn(n.url)),n.relay&&e.push({kind:"relay",relay:n.relay}),e},Qn=n=>{if(!n||typeof n!="object"||Array.isArray(n))return null;const e=n;if(typeof e.relayUrl!="string"||!e.relayUrl.trim()||typeof e.serverId!="string"||!e.serverId.trim())return null;const s=e.hostEncPubJwk;if(!s||typeof s!="object"||Array.isArray(s))return null;const i=s;return i.kty!=="EC"||i.crv!=="P-256"||typeof i.x!="string"||!i.x||typeof i.y!="string"||!i.y?null:{relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:{kty:"EC",crv:"P-256",x:i.x,y:i.y}}},Ti=n=>{try{return JSON.stringify(n)}catch{return String(n)}},xe=(n,e={})=>{const s=Ti(e);console.info("[mobile-connect]",n,s),Jn(n,s)},as=(n,e={})=>{xe(n,e)},Ut=(n,e={})=>{const s=Ti(e);console.info("[mobile-storage]",n,s),Jn(n,s)},Wc=n=>{if(typeof n!="string")return n;try{return JSON.parse(n)}catch{return n}},Vc=n=>{if(typeof n!="string")return n??void 0;try{return JSON.parse(n)}catch{return n}},Uc=async(n,e)=>{if(!Te())return null;try{const{CapacitorHttp:s}=await Ft(async()=>{const{CapacitorHttp:o}=await import("./vendor-capacitor-core-B4EWRrHz.js");return{CapacitorHttp:o}},[]),i=xo(n,new Headers(e?.headers)),r=await s.request({url:n,method:e?.method||"GET",headers:Object.fromEntries(i.entries()),data:Vc(e?.body)});return{ok:r.status>=200&&r.status<300,status:r.status,source:"native-http",json:async()=>Wc(r.data)}}catch(s){return xe("native-http:failed",{url:n,error:s instanceof Error?s.message:String(s)}),null}},Gc=async(n,e)=>{const s=await fetch(n,e).catch(i=>(xe("browser-fetch:failed",{url:n,error:i instanceof Error?i.message:String(i)}),null));return s?{ok:s.ok,status:s.status,source:"browser-fetch",json:()=>s.json()}:null},ht=async(n,e,s)=>{let i;const r=new Promise(o=>{i=window.setTimeout(()=>{s?.(),o(null)},n)});try{return await Promise.race([e,r])}catch{return null}finally{i!==void 0&&window.clearTimeout(i)}},St=async(n,e,s)=>{const i=s?.totalTimeoutMs??Pi,r=Date.now(),o=await ht(Math.min(Bc,i),Uc(n,e));if(o)return o;const a=new AbortController,u=Math.max(500,i-(Date.now()-r));return ht(u,Gc(n,{...e,signal:a.signal}),()=>a.abort())},Ys=async n=>{if(!n)return null;const e=await n.json().catch(()=>null);if(!e||typeof e!="object")return null;const s=e;return{authenticated:typeof s.authenticated=="boolean"?s.authenticated:void 0,disabled:typeof s.disabled=="boolean"?s.disabled:void 0,scope:typeof s.scope=="string"?s.scope:void 0}},Gt=15e3,Kc=async(n,e,s,i=Gt,r)=>{const o=ii({relayUrl:n.relayUrl,serverId:n.serverId,hostEncPubJwk:n.hostEncPubJwk}),a=u=>u==="ok"&&r?.keepTunnel?{outcome:u,tunnel:o}:(o.close(),{outcome:u});try{const u=e?{Authorization:`Bearer ${e}`}:void 0,f=await ht(i,o.fetch("/auth/session",{headers:u}).catch(()=>null));if(xe("relay:session",{ok:f?.ok===!0,status:f?.status??null,hasToken:!!e}),!f)return a("unreachable");if(f.status===401)return a(e?"auth-failed":"needs-login");if(!f.ok&&f.status!==404)return a("auth-failed");const d=await Ys(f);return d&&d.disabled!==!0&&d.authenticated===!1?a(e?"auth-failed":"needs-login"):a("ok")}catch(u){throw o.close(),u}},Hc=(n,e,s,i,r)=>{const o=typeof window<"u"?window.location.origin:"",a={relayUrl:n.relayUrl,serverId:n.serverId,hostEncPubJwk:n.hostEncPubJwk,...s?{grant:s}:{}};r&&bo(a,r),_t({apiBaseUrl:o,clientToken:e,runtimeKey:i??Ii(n),relay:a})},qc=n=>{if(!n||typeof n!="object")return null;const e=n;if(e.kind==="direct")return typeof e.url=="string"&&e.url.trim()?{kind:"direct",url:e.url}:null;if(e.kind==="relay"){const s=Qn(e.relay);return s?{kind:"relay",relay:s}:null}return null},Jc=n=>{if(n.mode==="relay"){const e=Qn(n.relay);return e?[{kind:"relay",relay:e}]:[]}return typeof n.url=="string"?Yn(n.url):[]},Nt=()=>{if(typeof window>"u")return[];let n;try{n=JSON.parse(window.localStorage.getItem(Fs)||"[]")}catch{return[]}if(!Array.isArray(n))return[];const e=Te();return n.flatMap(s=>{if(!s||typeof s!="object")return[];const i=s;if(typeof i.id!="string")return[];const r=Array.isArray(i.candidates)?i.candidates.map(qc).filter(f=>!!f):Jc(i);if(r.length===0)return[];const o=typeof i.clientToken=="string"&&i.clientToken.trim()?i.clientToken:void 0,a=typeof i.label=="string"&&i.label.trim()?i.label:zs(lt({candidates:r})),u={id:i.id,label:a,candidates:r,lastUsedAt:typeof i.lastUsedAt=="number"?i.lastUsedAt:0};return e?[{...u,hasToken:!!i.hasToken||!!o}]:[{...u,clientToken:o,hasToken:!!o}]}).sort((s,i)=>i.lastUsedAt-s.lastUsedAt)},vn=n=>n.kind==="relay"?{kind:"relay",relay:{relayUrl:n.relay.relayUrl,serverId:n.relay.serverId,hostEncPubJwk:n.relay.hostEncPubJwk}}:{kind:"direct",url:n.url},Xn=n=>{if(typeof window>"u")return;const e=Te(),s=n.slice(0,Ei).map(i=>{const r={id:i.id,label:i.label,candidates:i.candidates.map(vn),lastUsedAt:i.lastUsedAt};return e?{...r,hasToken:!!(i.hasToken||i.clientToken)}:{...r,clientToken:i.clientToken}});try{window.localStorage.setItem(Fs,JSON.stringify(s))}catch(i){console.warn("[mobile-storage] failed to persist connection metadata",i)}},Di=(n,e)=>{const s=n.find(o=>e.id&&o.id===e.id||Vs(o.candidates,e.candidates)),i=Te(),r={id:e.id||s?.id||crypto.randomUUID(),label:e.label,candidates:e.candidates,lastUsedAt:Date.now(),...i?{hasToken:e.hasToken??(!!e.clientToken||s?.hasToken||!1)}:{clientToken:e.clientToken??s?.clientToken,hasToken:!!(e.clientToken??s?.clientToken)}};return[r,...n.filter(o=>o.id!==r.id&&!Vs(o.candidates,e.candidates))].slice(0,Ei)},Zn=Wl,Yc=0,er=n=>`${zc}token.${encodeURIComponent(n)}`,Qc=async(n,e)=>{let s;const i=new Promise(r=>{s=window.setTimeout(()=>r(e),Lc)});try{return await Promise.race([n.catch(()=>e),i])}finally{s!==void 0&&window.clearTimeout(s)}},tr=async(n,e,s)=>Te()?Qc(e().catch(i=>(console.warn(`[mobile-storage] ${n} failed`,i),s)),s):s,bs=async n=>{Ut("secure:read-start",{key:n});const e=await tr("secure:read",async()=>(await Zn.internalGetItem({prefixedKey:er(n),sync:!1})).data,null),s=typeof e=="string"&&e.trim()?e:void 0;return Ut("secure:read",{key:n,hasToken:!!s}),s},wt=async(n,e)=>{Ut("secure:write-start",{key:n});const s=await tr("secure:write",async()=>(await Zn.internalSetItem({prefixedKey:er(n),data:e,sync:!1,access:Yc}),!0),!1);return Ut("secure:write",{key:n,ok:s}),s},Xc=async n=>{await tr("secure:delete",async()=>(await Zn.internalRemoveItem({prefixedKey:er(n),sync:!1}),!0),!1)},Zc=async(n,e)=>{let s=0,i=0;return{records:await Promise.all(n.map(async o=>{if(!o||typeof o!="object")return o;const a=o,u=typeof a.url=="string"?a.url:null,f=typeof a.clientToken=="string"?a.clientToken.trim():"";if(!u||!f)return o;if(!await e(u,f))return i+=1,o;s+=1;const{clientToken:d,...l}=a;return{...l,hasToken:!0}})),migrated:s,failed:i}},_i=async()=>{if(typeof window>"u"||!Te())return;let n;try{n=JSON.parse(window.localStorage.getItem(Fs)||"[]")}catch{return}if(!Array.isArray(n))return;const e=n.filter(i=>!!i&&typeof i=="object"&&typeof i.url=="string"&&typeof i.clientToken=="string"&&!!i.clientToken.trim());if(e.length===0)return;Ut("secure:migrate-start",{count:e.length});const s=await Zc(n,async(i,r)=>{const o=Vt(i);return await wt(o,r)?await bs(o)===r:!1});if(s.migrated>0)try{window.localStorage.setItem(Fs,JSON.stringify(s.records))}catch(i){console.warn("[mobile-storage] failed to finalize secure token migration",i);return}Ut("secure:migrate-done",{migrated:s.migrated,failed:s.failed})},eu=async()=>(await _i(),Nt()),Us=async n=>{const e=Di(Nt(),n);return Xn(e),Te()&&n.clientToken&&await wt(Ae({candidates:n.candidates}),n.clientToken),e},tu=async n=>{const e=Nt(),s=e.find(r=>r.id===n)??null,i=e.filter(r=>r.id!==n);return Xn(i),s&&Te()&&await Xc(Ae(s)),i},su=1500,Gs=async(n,e,s)=>{const i=s?.fast?{totalTimeoutMs:Ws}:void 0,r=kt({candidates:n})?.serverId??null,o=n.find(d=>d.kind==="relay")??null,a=n.filter(d=>d.kind==="direct"),u=async()=>{for(const d of a){const l=Ht(d.url)||d.url,p=e?{Authorization:`Bearer ${e}`}:void 0,g=await St(`${l}/health`,{method:"GET"},i);if(xe("probe:direct:health",{url:l,ok:g?.ok===!0,status:g?.status??null,source:g?.source??null}),!g?.ok)continue;if(r){const x=await g.json().catch(()=>null),E=x&&typeof x=="object"?x.serverId:null;if(typeof E=="string"&&E&&E!==r){xe("probe:server-id-mismatch",{url:l});continue}}const h=await St(`${l}/auth/session`,{method:"GET",credentials:e?"omit":"include",headers:p},i);if(xe("probe:direct:session",{url:l,ok:h?.ok===!0,status:h?.status??null,source:h?.source??null,hasToken:!!e}),h?.status===401)return{status:"needs-login"};if(!h||!h.ok&&h.status!==404)continue;const b=await Ys(h);if(b&&b.disabled!==!0&&b.authenticated===!1)return{status:"needs-login"};const S=b?.disabled===!0;return!e&&Te()&&!S&&b?.scope!=="client"?{status:"needs-login"}:{status:"ok",transport:{kind:"direct",url:l}}}return{status:"unreachable"}},f=async()=>{if(!o)return{status:"unreachable"};const{outcome:d,tunnel:l}=await Kc(o.relay,e,void 0,s?.fast?Ws:Pi,{keepTunnel:!0});return d==="ok"?{status:"ok",transport:{kind:"relay",relay:o.relay,tunnel:l}}:d==="needs-login"||d==="auth-failed"?{status:"needs-login"}:{status:"unreachable"}};return o?a.length===0?f():new Promise(d=>{let l=!1,p=!1,g,h=null,b=null;const S=v=>{v?.status==="ok"&&v.transport.kind==="relay"&&v.transport.tunnel?.close()},x=v=>{l||(l=!0,d(v))},E=()=>{p||l||(g!==void 0&&(window.clearTimeout(g),g=void 0),f().then(v=>{if(b=v,l||p){S(v);return}if(v.status==="ok"||v.status==="needs-login"){x(v);return}h&&x(h)}))};u().then(v=>{if(h=v,!l){if(v.status==="ok"||v.status==="needs-login"){p=!0,g!==void 0&&window.clearTimeout(g),S(b),x(v);return}if(b){x(b);return}E()}}),g=window.setTimeout(E,su)}):u()},jt=(n,e,s)=>{n.kind==="relay"?Hc(n.relay,e,s?.grant,s?.runtimeKey,n.tunnel):_t({apiBaseUrl:n.url,clientToken:e,runtimeKey:s?.runtimeKey}),zi()},us=()=>{const n=Nt()[0];return n?.label?.trim()?n.label:null},ls=async n=>{const e=n?.fast!==!1;await _i();const s=Nt()[0];if(xe("auto-connect:start",{hasCandidate:!!s,fast:e}),!s)return{status:"no-candidate"};let i;if(Te()){if(s.hasToken&&(i=await bs(Ae(s)),!i))return{status:"no-candidate"}}else if(i=s.clientToken,!i&&s.hasToken)return{status:"no-candidate"};const r=await Gs(s.candidates,i,{fast:e});return xe("auto-connect:probe",{status:r.status,candidates:s.candidates.map(o=>o.kind)}),r.status==="needs-login"?{status:"needs-login",label:s.label}:r.status!=="ok"?{status:"unreachable",label:s.label}:n?.skipIfConnected&&st()?(r.transport.kind==="relay"&&r.transport.tunnel?.close(),xe("auto-connect:superseded",{}),{status:"no-candidate"}):(await Us({id:s.id,label:s.label,candidates:s.candidates}),jt(r.transport,i??null,{runtimeKey:Ae(s)}),{status:"connected"})},nu=async(n,e)=>{let s="";try{s=Ht(n.url)}catch{return!1}if(!s)return!1;const i=n.clientToken?.trim()||void 0,r=i?{Authorization:`Bearer ${i}`}:void 0,o=e?.fast?{totalTimeoutMs:Ws}:void 0;if(!(await St(`${s}/health`,{method:"GET",headers:r},o))?.ok)return!1;const u=await St(`${s}/auth/session`,{method:"GET",credentials:i?"omit":"include",headers:r},o);if(!u||!u.ok&&u.status!==404)return!1;const f=await Ys(u);return!(f&&f.disabled!==!0&&f.authenticated===!1)},ru=n=>[...n].sort((e,s)=>{const i=(e.priority??100)-(s.priority??100);if(i!==0)return i;const r=o=>o.type==="relay"?2:o.url.startsWith("https://")?0:1;return r(e)-r(s)}).flatMap(e=>{if(e.type==="relay"){const s=Qn({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk});return s?[{kind:"relay",relay:s}]:[]}return Yn(e.url)}),_r=async n=>{const e=kt({candidates:n})?.serverId??null;for(const s of n){if(s.kind==="relay"){const o=ii(s.relay),a=await ht(Gt,o.fetch("/health").catch(()=>null));if(xe("establish:relay:health",{ok:a?.ok===!0,status:a?.status??null}),a?.ok)return{kind:"relay",relay:s.relay,tunnel:o};o.close();continue}const i=Ht(s.url)||s.url,r=await St(`${i}/health`,{method:"GET"});if(xe("establish:direct:health",{ok:r?.ok===!0,status:r?.status??null}),!!r?.ok){if(e){const o=await r.json().catch(()=>null),a=o&&typeof o=="object"?o.serverId:null;if(typeof a=="string"&&a&&a!==e){xe("establish:server-id-mismatch",{url:i});continue}}return{kind:"direct",url:i}}}return null},iu=async(n,e)=>{if(!gs())return nu(n,e);const s=await ht(e?.fast?Ws:Gt,Sn("/auth/session").then(r=>r).catch(()=>null));if(!s)return!0;if(s.status===401)return!1;if(!s.ok&&s.status!==404)return!0;const i=await Ys(s);return!(i&&i.disabled!==!0&&i.authenticated===!1)},ou=n=>n.kind==="relay"?gs():!gs()&&Ai(n.url,st()),Mi=()=>{const n=Kt();return n?Nt().find(e=>Ae(e)===n)??null:null},Mr=n=>{const e=Kt();return!!e&&Ae(n)===e},Os=async n=>{const e=n?.fast!==!1,s=Mi();if(!s)return xe("reprobe:no-connection",{runtimeKey:!!Kt()}),"no-connection";let i;if(Te()?i=s.hasToken?await bs(Ae(s)):void 0:i=s.clientToken,!i&&s.hasToken)return xe("reprobe:no-token",{hasToken:!0}),"unreachable";xe("reprobe:start",{candidates:s.candidates.map(d=>d.kind),fast:e,hasToken:!!i});const r=s.candidates.findIndex(d=>ou(d.kind==="relay"?{kind:"relay",relay:d.relay}:{kind:"direct",url:d.url})),o=r>=0?s.candidates.slice(0,r):s.candidates,a=await Gs(o,i,{fast:e});if(xe("reprobe:better",{status:a.status,probed:o.length}),a.status==="ok")return await Us({id:s.id,label:s.label,candidates:s.candidates}),jt(a.transport,i??null,{runtimeKey:Ae(s)}),"switched";if(a.status==="needs-login")return"needs-login";if(r>=0){const d=await iu({url:st(),clientToken:i},{fast:e});if(xe("reprobe:current",{stillValid:d}),d)return zi(),"unchanged"}const u=r>=0?s.candidates.slice(r+1):[],f=await Gs(u,i,{fast:e});return xe("reprobe:fallback",{status:f.status,probed:u.length}),f.status==="ok"?(await Us({id:s.id,label:s.label,candidates:s.candidates}),jt(f.transport,i??null,{runtimeKey:Ae(s)}),"switched"):f.status==="needs-login"?"needs-login":"unreachable"},au=5e3;let un=!1;const lu=async()=>{if(un)return"skipped";const n=Mi();if(!n)return xe("candidates:refresh-skip",{reason:"no-active-connection"}),"skipped";const e=kt(n);if(!e)return xe("candidates:refresh-skip",{reason:"no-relay-candidate"}),"skipped";un=!0;try{const s=await ht(Gt,Sn("/api/client-auth/connection/candidates").then(d=>d).catch(()=>null));if(!s?.ok)return xe("candidates:refresh-skip",{reason:"fetch-failed",status:s?.status??null}),"skipped";const i=await s.json().catch(()=>null);if(!i||i.serverId!==e.serverId)return xe("candidates:refresh-skip",{reason:"server-id-mismatch"}),"skipped";const r=Array.isArray(i.candidates)?i.candidates:[],o=[];for(const d of r){if(!d||typeof d!="object")continue;const l=d;if(!(l.type!=="lan"||typeof l.url!="string"))try{const p=Ht(l.url);p&&!o.includes(p)&&o.push(p)}catch{}}if(o.length===0)return xe("candidates:refresh-skip",{reason:"no-lan-reported"}),"skipped";const a=Js(n).filter(d=>d.url.startsWith("https://")),u=[...o.map(d=>({kind:"direct",url:d})),...a,{kind:"relay",relay:e}];return JSON.stringify(n.candidates.map(vn))===JSON.stringify(u.map(vn))?"unchanged":(xe("candidates:refreshed",{lanCount:o.length}),await Us({id:n.id,label:n.label,candidates:u}),"updated")}finally{un=!1}},zi=()=>{typeof window>"u"||window.setTimeout(()=>{(async()=>{const n=await lu().catch(()=>"skipped");xe("candidates:refresh-result",{result:n}),n==="updated"&&gs()&&await Os().catch(()=>null)})()},au)},Oi=n=>{const{t:e}=pe(),[s,i]=c.useState(()=>Nt()),[r,o]=c.useState(null),[a,u]=c.useState(null),[f,d]=c.useState(null),l=c.useRef(s),p=c.useRef(null),g=c.useRef($c()),h=c.useCallback(C=>{l.current=C,i(C)},[]),b=c.useCallback(C=>{p.current=C,o(C)},[]),S=c.useCallback(C=>{p.current===C&&(p.current=null,o(null))},[]);c.useEffect(()=>{let C=!1;return eu().then(R=>{C||h(R)}),()=>{C=!0}},[h]);const x=c.useCallback(C=>{const R=Di(l.current,C);return h(R),Xn(R),R},[h]),E=c.useCallback(async C=>{u(null),b("connect");try{const R=Dr(C);if(R.length===0){u(e("mobile.connect.error.urlRequired"));return}const k=C.id?l.current.find($=>$.id===C.id):l.current.find($=>Vs($.candidates,R)),z=C.label?.trim()||k?.label||zs(lt({candidates:R})),D=C.relayGrant;let M=C.clientToken?.trim()||void 0;const j=!!M;M||(Te()?k?.hasToken&&(M=await bs(Ae({candidates:R}))):M=k?.clientToken),xe("connect:start",{candidates:R.map($=>$.kind),hasToken:!!M});const I=await Gs(R,M);if(xe("connect:probe",{status:I.status}),I.status==="unreachable"){u(e("mobile.connect.error.unreachable"));return}if(I.status==="needs-login"){x({id:k?.id,label:z,candidates:R}),d({id:k?.id??crypto.randomUUID(),label:z,candidates:R,relay:kt({candidates:R})??void 0,relayGrant:D});return}M&&j&&Te()&&await wt(Ae({candidates:R}),M),x({id:k?.id,label:z,candidates:R,clientToken:M}),jt(I.transport,M??null,{runtimeKey:Ae({candidates:R}),grant:D}),n()}catch(R){console.warn("[mobile-connect] connect threw",R),u(e("mobile.connect.error.invalidUrl"))}finally{S("connect")}},[b,S,n,x,e]),v=c.useCallback(async C=>{if(p.current==="pairing")return;u(null),b("pairing");const R=ru(C.candidates);let k=null,z=!1;try{if(k=await _r(R),!k){u(e("mobile.connect.error.unreachable"));return}const D=JSON.stringify({pairingId:C.pairingId,secret:C.secret,clientLabel:"OpenChamber Mobile",clientKind:"mobile",deviceName:"OpenChamber Mobile",devicePlatform:Tr(),dedupeKey:Ir()}),M={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:D},j=k.kind==="relay"?await ht(Gt,k.tunnel.fetch("/api/client-auth/pairing/redeem",M).catch(()=>null)):await St(`${k.url}/api/client-auth/pairing/redeem`,M);if(!j?.ok){u(e("mobile.connect.error.authRequired"));return}const I=await j.json().catch(()=>null),$=typeof I?.clientToken=="string"?I.clientToken.trim():"";if(!$){u(e("mobile.connect.error.authRequired"));return}const w=typeof I?.server?.label=="string"?I.server.label:"",B=C.label||w||zs(lt({candidates:R}));if(Te()&&!await wt(Ae({candidates:R}),$)){u(e("mobile.connect.error.authRequired"));return}x({label:B,candidates:R,clientToken:$}),jt(k.kind==="relay"?{kind:"relay",relay:k.relay,tunnel:k.tunnel}:{kind:"direct",url:k.url},$,{runtimeKey:Ae({candidates:R})}),z=k.kind==="relay",n()}catch(D){console.warn("[mobile-connect] pairing threw",D),u(e("mobile.connect.error.authRequired"))}finally{!z&&k?.kind==="relay"&&k.tunnel.close(),S("pairing")}},[b,S,n,x,e]),N=c.useCallback(async C=>{if(!f||!C.trim()||p.current==="password")return;u(null),b("password");const R=g.current.begin(),k=()=>g.current.isCurrent(R),{id:z,label:D,candidates:M}=f;let j=null,I=!1;try{if(j=await _r(M),!k())return;if(!j){u(e("mobile.connect.error.unreachable"));return}const $={method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({password:C,trustDevice:!0,issueClientToken:!0,clientLabel:"OpenChamber Mobile",clientKind:"mobile",devicePlatform:Tr(),dedupeKey:Ir()})};xe("password:start",{transport:j.kind});const w=j.kind==="relay"?await ht(Gt,j.tunnel.fetch("/auth/session",$).catch(()=>null)):await St(`${j.url}/auth/session`,$);if(!k())return;if(xe("password:done",{ok:w?.ok===!0,status:w?.status??null}),!w?.ok){u(e("mobile.connect.error.passwordFailed"));return}const B=await w.json().catch(()=>null);if(!k())return;const U=typeof B?.clientToken=="string"?B.clientToken.trim():"";if(xe("password:token",{issued:!!U}),!U){if(j.kind==="direct"&&!Te()){x({id:z,label:D,candidates:M}),d(null),jt({kind:"direct",url:j.url},null,{runtimeKey:Ae({candidates:M})}),n();return}u(e("mobile.connect.error.authRequired"));return}if(Te()&&(!k()||(await wt(Ae({candidates:M}),U),!k()))||!k()||(x({id:z,label:D,candidates:M,clientToken:U}),d(null),jt(j.kind==="relay"?{kind:"relay",relay:j.relay,tunnel:j.tunnel}:{kind:"direct",url:j.url},U,{runtimeKey:Ae({candidates:M})}),I=j.kind==="relay",!k()))return;n()}catch($){if(!k())return;console.warn("[mobile-connect] password threw",$),u(e("mobile.connect.error.passwordFailed"))}finally{!I&&j?.kind==="relay"&&j.tunnel.close(),k()&&S("password")}},[b,S,n,f,x,e]),A=c.useCallback(()=>{g.current.cancel(),S("password"),d(null),u(null)},[S]),y=c.useCallback(async C=>{u(null);let R=Dr(C);const k=C.id?l.current.find(j=>j.id===C.id)??null:null;if(k){const j=R.filter(w=>w.kind==="direct"),I=Js(k).filter(w=>w.url.startsWith("https://")&&!j.some(B=>Ai(B.url,w.url))),$=kt(k);R=[...j,...I,...$?[{kind:"relay",relay:$}]:[]]}if(R.length===0)return u(e("mobile.connect.error.urlRequired")),null;const z=C.clientToken?.trim()||void 0,D=C.label?.trim()||zs(lt({candidates:R}));if(Te()){const j=Ae({candidates:R});if(z)await wt(j,z);else if(k?.hasToken){const I=Ae(k);if(I&&j&&I!==j){const $=await bs(I);$&&await wt(j,$)}}}return x({id:C.id,label:D,candidates:R,clientToken:z}).find(j=>Vs(j.candidates,R))??null},[x,e]),P=c.useCallback(async C=>{const R=l.current.find(z=>z.id===C)??null,k=await tu(C);return h(k),R},[h]);return{connections:s,isBusy:r!==null,isPasswordBusy:r==="password",error:a,pendingConnection:f,connect:E,redeemPairingConnection:v,submitPassword:N,cancelPassword:A,saveConnection:y,removeConnection:P,setError:u}},Bi=n=>{const e=le.c(31),{onClose:s}=n,{t:i}=pe(),[r,o]=c.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=Dc(),e[0]=a):a=e[0];const u=a;let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{Po(Mc()).then(C=>{C.ok&&(o(!0),window.setTimeout(()=>o(!1),2e3))})},e[1]=f):f=e[1];const d=f;let l;e[2]!==i?(l=i("mobile.connectionDebug.title"),e[2]=i,e[3]=l):l=e[3];let p;e[4]!==l?(p=t.jsx("h2",{className:"min-w-0 truncate typography-ui-label text-foreground",children:l}),e[4]=l,e[5]=p):p=e[5];const g=r?"check":"file-copy";let h;e[6]!==g?(h=t.jsx(Z,{name:g,className:"size-4"}),e[6]=g,e[7]=h):h=e[7];let b;e[8]!==r||e[9]!==i?(b=i(r?"mobile.connectionDebug.copied":"mobile.connectionDebug.copy"),e[8]=r,e[9]=i,e[10]=b):b=e[10];let S;e[11]!==h||e[12]!==b?(S=t.jsxs(be,{type:"button",variant:"outline",size:"sm",onClick:d,disabled:u.length===0,children:[h,b]}),e[11]=h,e[12]=b,e[13]=S):S=e[13];let x;e[14]!==i?(x=i("mobile.connectionDebug.close"),e[14]=i,e[15]=x):x=e[15];let E;e[16]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Z,{name:"close",className:"size-[18px]"}),e[16]=E):E=e[16];let v;e[17]!==s||e[18]!==x?(v=t.jsx(be,{type:"button",variant:"ghost",size:"icon","aria-label":x,onClick:s,children:E}),e[17]=s,e[18]=x,e[19]=v):v=e[19];let N;e[20]!==v||e[21]!==S?(N=t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[S,v]}),e[20]=v,e[21]=S,e[22]=N):N=e[22];let A;e[23]!==N||e[24]!==p?(A=t.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border/70 px-4 py-2.5",children:[p,N]}),e[23]=N,e[24]=p,e[25]=A):A=e[25];let y;e[26]!==i?(y=t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-4 py-3",children:u.length===0?t.jsx("p",{className:"typography-small text-muted-foreground",children:i("mobile.connectionDebug.empty")}):t.jsx("pre",{className:"whitespace-pre-wrap break-words typography-code text-muted-foreground",children:u.map(Ci).join(`
|
|
4
|
+
`)})}),e[26]=i,e[27]=y):y=e[27];let P;return e[28]!==A||e[29]!==y?(P=t.jsxs("div",{className:"fixed inset-0 z-[70] flex flex-col bg-background pb-[var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))] pt-[var(--safe-area-inset-top,env(safe-area-inset-top,0px))] text-foreground",children:[A,y]}),e[28]=A,e[29]=y,e[30]=P):P=e[30],P},Li=()=>{if(typeof window>"u")return null;const e=window.Capacitor?.Plugins?.BarcodeScanner;return e&&(typeof e.scan=="function"||typeof e.startScan=="function")?e:null},cu=()=>window.Capacitor?.getPlatform?.()==="android",$i=n=>{const e=n.trim();if(!e)return null;if(/^openchamber:\/\//i.test(e)){const s=yo(e);return s?{pairing:s}:null}return/^https?:\/\//i.test(e)?{url:e}:null},Fi=(n,e)=>{const s=$i(n);if(!s&&e?.pairingStringFallback){const i=vo(n);if(i)return{status:"pairing",pairing:i}}return s?"pairing"in s?{status:"pairing",...s}:{status:"ok",...s}:{status:"invalid"}},uu=async(n,e)=>{if(!n.startScan||!n.stopScan||!n.addListener)return{status:"unsupported"};if(e?.aborted)return{status:"cancelled"};let s,i,r=!1,o=()=>{};const a=new Promise(d=>{o=d}),u=d=>{r||(r=!0,o(d))},f=()=>u({status:"cancelled"});e?.addEventListener("abort",f,{once:!0});try{return(await Promise.allSettled([Promise.resolve(n.addListener("barcodesScanned",({barcodes:l})=>{const p=l?.[0],g=(p?.rawValue??p?.displayValue??"").trim();g&&u(Fi(g,{pairingStringFallback:!0}))})).then(l=>{s=l}),Promise.resolve(n.addListener("scanError",()=>u({status:"failed"}))).then(l=>{i=l})])).some(({status:l})=>l==="rejected")?u({status:"failed"}):r||n.startScan({formats:["QR_CODE"]}).catch(()=>u({status:"failed"})),await a}finally{e?.removeEventListener("abort",f),await Promise.allSettled([Promise.resolve(s?.remove()),Promise.resolve(i?.remove()),n.stopScan()])}},wn=()=>Li()!==null,Wi=async n=>{const e=Li();if(!e)return{status:"unsupported"};try{if(e.requestPermissions){const a=(await e.requestPermissions())?.camera;if(a&&a!=="granted"&&a!=="limited")return{status:"permission-denied"}}if(n?.signal?.aborted)return{status:"cancelled"};if(cu())return uu(e,n?.signal);if(!e.scan)return{status:"unsupported"};const i=(await e.scan({formats:["QR_CODE"]}))?.barcodes?.[0],r=(i?.rawValue??i?.displayValue??"").trim();return r?Fi(r):{status:"cancelled"}}catch{return{status:"failed"}}},Lt={autoComplete:"off",autoCorrect:"off",spellCheck:!1},ds="oc-surface-elevated h-12 w-full rounded-[16px] border border-border/70 bg-surface-elevated px-4 text-[16px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-interactive-border-focus focus:ring-2 focus:ring-ring",Vi=n=>{const e=le.c(22),{onCancel:s}=n,{t:i}=pe(),r=c.useRef(null);let o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{const E={value:document.documentElement.style.getPropertyValue("background-color"),priority:document.documentElement.style.getPropertyPriority("background-color")},v={value:document.body.style.getPropertyValue("background-color"),priority:document.body.style.getPropertyPriority("background-color")};document.documentElement.style.setProperty("background-color","rgba(0, 0, 0, 0)","important"),document.body.style.setProperty("background-color","rgba(0, 0, 0, 0)","important");const N=new Map,A=P=>{!(P instanceof HTMLElement)||P===r.current||N.has(P)||(N.set(P,{opacity:P.style.opacity,pointerEvents:P.style.pointerEvents}),P.style.setProperty("opacity","0"),P.style.setProperty("pointer-events","none"))};Array.from(document.body.children).forEach(A);const y=new MutationObserver(P=>{P.forEach(C=>C.addedNodes.forEach(A))});return y.observe(document.body,{childList:!0}),()=>{y.disconnect(),N.forEach(du),E.value?document.documentElement.style.setProperty("background-color",E.value,E.priority):document.documentElement.style.removeProperty("background-color"),v.value?document.body.style.setProperty("background-color",v.value,v.priority):document.body.style.removeProperty("background-color")}},a=[],e[0]=o,e[1]=a):(o=e[0],a=e[1]),c.useLayoutEffect(o,a);let u,f;e[2]!==s?(u=()=>{const E=()=>{document.visibilityState==="hidden"&&s()};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},f=[s],e[2]=s,e[3]=u,e[4]=f):(u=e[3],f=e[4]),c.useEffect(u,f);let d;e[5]!==i?(d=i("mobile.connect.scanQr"),e[5]=i,e[6]=d):d=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"aspect-square w-full max-w-72 rounded-[28px] border-2 border-foreground/90 shadow-[0_0_0_9999px_color-mix(in_srgb,var(--surface-background)_18%,transparent)]","aria-hidden":!0}),e[7]=l):l=e[7];let p;e[8]!==i?(p=i("mobile.connect.welcome.scanHint"),e[8]=i,e[9]=p):p=e[9];let g;e[10]!==p?(g=t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-6",children:[l,t.jsx("p",{className:"max-w-sm rounded-[16px] border border-border/60 bg-background px-4 py-3 text-center typography-body text-foreground shadow-sm",children:p})]}),e[10]=p,e[11]=g):g=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Z,{name:"close",className:"size-[18px]"}),e[12]=h):h=e[12];let b;e[13]!==i?(b=i("mobile.instances.cancelEdit"),e[13]=i,e[14]=b):b=e[14];let S;e[15]!==s||e[16]!==b?(S=t.jsxs(be,{type:"button",variant:"outline",size:"lg",className:"mx-auto min-h-12 w-full max-w-sm bg-background",onClick:s,children:[h,b]}),e[15]=s,e[16]=b,e[17]=S):S=e[17];let x;return e[18]!==S||e[19]!==d||e[20]!==g?(x=$t.createPortal(t.jsxs("div",{ref:r,role:"dialog","aria-modal":"true","aria-label":d,className:"fixed inset-0 z-[1000] flex flex-col bg-transparent px-6 pb-[calc(var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))+24px)] pt-[calc(var(--safe-area-inset-top,env(safe-area-inset-top,0px))+24px)] text-foreground",children:[g,S]}),document.body),e[18]=S,e[19]=d,e[20]=g,e[21]=x):x=e[21],x},Ui=()=>{const n=le.c(6),{t:e}=pe();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Mt,{width:96,height:96,isAnimated:!0}),n[0]=s):s=n[0];let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Z,{name:"loader-4",className:"size-[18px] animate-spin"}),n[1]=i):i=n[1];let r;n[2]!==e?(r=e("mobile.connect.connecting"),n[2]=e,n[3]=r):r=n[3];let o;return n[4]!==r?(o=$t.createPortal(t.jsxs("div",{role:"status",className:"fixed inset-0 z-[1000] flex flex-col items-center justify-center gap-5 bg-background px-6 text-foreground",children:[s,t.jsxs("div",{className:"flex items-center gap-2 typography-ui-label text-muted-foreground",children:[i,t.jsx("span",{children:r})]})]}),document.body),n[4]=r,n[5]=o):o=n[5],o};function du(n,e){e.style.opacity=n.opacity,e.style.pointerEvents=n.pointerEvents}const fu=({onConnected:n,notice:e=null})=>{const{t:s}=pe(),i=Oi(n),{connections:r,isBusy:o,isPasswordBusy:a,error:u,pendingConnection:f}=i,[d,l]=c.useState(""),[p,g]=c.useState(""),[h,b]=c.useState(""),[S,x]=c.useState(!1),[E,v]=c.useState(!1),N=c.useRef(null),A=c.useMemo(()=>wn(),[]),[y,P]=c.useState(()=>!wn()),[C,R]=c.useState(null),[k,z]=c.useState(""),[D,M]=c.useState(!1),j=Ri(c.useCallback(()=>M(!0),[])),I=c.useCallback(O=>{O.preventDefault(),i.connect({url:d,clientToken:h,label:p})},[h,i,p,d]),$=c.useCallback(O=>{if(/^openchamber:\/\//i.test(O.trim())){const L=$i(O);if(L){if("pairing"in L){i.redeemPairingConnection(L.pairing);return}l(L.url),L.label&&g(L.label),L.clientToken&&b(L.clientToken);return}}l(O)},[i]),w=c.useCallback(async()=>{if(N.current||o)return;i.setError(null),x(!0);const O=new AbortController;N.current=O;try{const L=await Wi({signal:O.signal});switch(N.current===O&&(N.current=null,x(!1)),L.status){case"ok":v(!0),l(L.url),L.label&&g(L.label),L.clientToken&&b(L.clientToken),await i.connect({url:L.url,clientToken:L.clientToken,label:L.label});break;case"pairing":v(!0),await i.redeemPairingConnection(L.pairing);break;case"permission-denied":i.setError(s("mobile.connect.scan.permissionDenied"));break;case"invalid":i.setError(s("mobile.connect.scan.invalid"));break;case"unsupported":i.setError(s("mobile.connect.scan.unsupported"));break;case"failed":i.setError(s("mobile.connect.scan.failed"));break;default:break}}finally{v(!1),N.current===O&&(N.current=null,x(!1))}},[i,o,s]);c.useEffect(()=>()=>N.current?.abort(),[]);const B=c.useCallback(O=>{O.preventDefault(),i.submitPassword(k)},[i,k]),U=c.useCallback(()=>{z(""),i.cancelPassword()},[i]);return t.jsxs(t.Fragment,{children:[S?t.jsx(Vi,{onCancel:()=>N.current?.abort()}):null,E?t.jsx(Ui,{}):null,D?t.jsx(Bi,{onClose:()=>M(!1)}):null,t.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:t.jsxs("div",{className:"m-auto flex w-full max-w-[360px] shrink-0 flex-col items-center gap-9 py-8",children:[t.jsxs("div",{className:"flex flex-col items-center gap-5 text-center",children:[t.jsx("span",{...j,className:"select-none",style:{touchAction:"manipulation"},children:t.jsx(Mt,{width:72,height:72,className:"size-[72px]"})}),t.jsx("h1",{className:"typography-h2 text-foreground",children:s("mobile.connect.welcome.title")})]}),e?t.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:[t.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:t.jsx(Z,{name:e.kind==="auth-expired"?"lock":"cloud-off",className:"size-[18px]"})}),t.jsx("p",{className:"min-w-0 flex-1 typography-small text-foreground",children:e.kind==="auth-expired"?s("mobile.connect.notice.authExpired",{label:e.label}):s("mobile.connect.notice.unreachable",{label:e.label})})]}):null,f?t.jsxs("form",{className:"flex w-full flex-col gap-3",onSubmit:B,children:[t.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-border/70 bg-surface-elevated px-3.5 py-3",children:[t.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:t.jsx(Z,{name:"lock",className:"size-[18px]"})}),t.jsxs("div",{className:"min-w-0 text-left",children:[t.jsx("p",{className:"truncate typography-ui-label text-foreground",children:f.label}),t.jsx("p",{className:"truncate typography-small text-muted-foreground",children:f.candidates.some(O=>O.kind==="direct")?lt(f):s("mobile.connect.relay.badge")})]})]}),t.jsx("input",{...Lt,value:k,onChange:O=>z(O.target.value),placeholder:s("mobile.connect.password.placeholder"),"aria-label":s("mobile.connect.password.label"),type:"password",autoFocus:!0,className:ds}),u?t.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:u}):null,t.jsx(be,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",disabled:a||!k.trim(),children:s(a?"mobile.connect.connecting":"mobile.connect.unlockButton")}),t.jsx(be,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:U,children:s("mobile.connect.cancelPassword")})]}):t.jsxs("div",{className:"flex w-full flex-col gap-6",children:[A?t.jsxs("div",{className:"flex w-full flex-col gap-2",children:[t.jsxs(be,{type:"button",size:"lg",className:"h-12 w-full",onClick:()=>{w()},disabled:S||o,children:[t.jsx(Z,{name:"scan-2",className:Q("size-[18px]",S&&"animate-pulse")}),s(o?"mobile.connect.connecting":"mobile.connect.scanQr")]}),t.jsx("p",{className:"px-2 text-center typography-small text-muted-foreground",children:s("mobile.connect.welcome.scanHint")})]}):null,u&&!y?t.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:u}):null,r.length>0?t.jsxs("section",{className:"flex w-full flex-col gap-2.5",children:[t.jsx("h2",{className:"text-center typography-micro uppercase tracking-[0.14em] text-muted-foreground",children:s("mobile.connect.saved.title")}),t.jsx("div",{className:"overflow-hidden rounded-[18px] border border-border/70 bg-surface-elevated",children:r.map(O=>{const L=C===O.id;return t.jsxs("button",{type:"button",disabled:o,className:"flex min-h-14 w-full items-center gap-3 border-b border-border/70 px-3.5 py-2.5 text-left last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:opacity-70",onClick:()=>{R(O.id),i.connect({id:O.id,candidates:O.candidates,clientToken:O.clientToken,label:O.label}).finally(()=>R(null))},children:[t.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:t.jsx(Z,{name:"server",className:"size-[18px]"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate typography-ui-label text-foreground",children:O.label}),t.jsx("span",{className:Q("block truncate typography-small",L?"text-foreground":"text-muted-foreground"),children:L?s("mobile.connect.connecting"):O.candidates.some(ie=>ie.kind==="direct")?lt(O):s("mobile.connect.relay.badge")})]}),L?t.jsx(Z,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):t.jsx(Z,{name:"arrow-right-s",className:"size-5 text-muted-foreground"})]},O.id)})})]}):null,t.jsxs("div",{className:"flex w-full flex-col",children:[A?t.jsxs("button",{type:"button",onClick:()=>P(O=>!O),"aria-expanded":y,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-ring",children:[t.jsx("span",{children:s("mobile.connect.manual.toggle")}),t.jsx(Z,{name:"arrow-down-s",className:Q("size-4 transition-transform duration-200",y&&"rotate-180")})]}):null,t.jsx("div",{className:"grid transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:y?"1fr":"0fr"},children:t.jsx("div",{className:"min-h-0 overflow-hidden",children:t.jsxs("form",{className:"flex w-full flex-col gap-3 pt-3",onSubmit:I,children:[t.jsx("input",{...Lt,value:d,onChange:O=>$(O.target.value),placeholder:s("mobile.connect.url.placeholder"),"aria-label":s("mobile.connect.url.label"),type:"url",inputMode:"url",autoCapitalize:"none",tabIndex:y?void 0:-1,className:Q(ds,"text-center")}),t.jsx("input",{value:p,onChange:O=>g(O.target.value),placeholder:s("mobile.instances.label.placeholder"),"aria-label":s("mobile.instances.label.label"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,tabIndex:y?void 0:-1,className:Q(ds,"text-center")}),t.jsx("input",{...Lt,value:h,onChange:O=>b(O.target.value),placeholder:s("mobile.connect.token.placeholder"),"aria-label":s("mobile.connect.token.label"),tabIndex:y?void 0:-1,autoCapitalize:"none",className:Q(ds,"text-center")}),t.jsx("p",{className:"px-1 text-center typography-micro text-muted-foreground",children:s("mobile.connect.token.hint")}),u?t.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:u}):null,t.jsx(be,{type:"submit",variant:A?"outline":"default",size:"lg",className:"h-12 w-full",disabled:o||S||!d.trim(),children:s(o?"mobile.connect.connecting":"mobile.connect.connectButton")})]})})})]})]})]})})]})},mu=n=>{const e=n.usedPercent;return typeof e!="number"||!Number.isFinite(e)?"text-foreground":e>=80?"text-[var(--status-error)]":e>=50?"text-[var(--status-warning)]":"text-foreground"},pu=n=>{const e=le.c(12),{groups:s,displayMode:i,timeFormatPreference:r,className:o}=n;let a;e[0]!==o?(a=Q("space-y-1.5",o),e[0]=o,e[1]=a):a=e[1];let u;if(e[2]!==i||e[3]!==s||e[4]!==r){let d;e[6]!==i||e[7]!==r?(d=l=>t.jsxs("div",{className:"min-w-0 rounded-xl bg-[var(--surface-muted)] p-2.5",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(Ao,{providerId:l.providerId,className:"size-4 shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label font-medium text-foreground",children:l.providerName}),l.planLabel?t.jsx("span",{className:"shrink-0 typography-micro capitalize text-muted-foreground",children:l.planLabel}):null,l.status&&l.rows.length===0?t.jsx("span",{className:"shrink-0 truncate typography-micro text-muted-foreground",children:l.status}):null]}),l.rows.length>0?t.jsx("div",{className:"mt-1.5 space-y-1",children:l.rows.map(p=>{const g=i==="remaining"?p.window.remainingPercent:p.window.usedPercent,h=Io(p.window.valueLabel,g),b=To(p.window.resetAt,p.window.resetAfterFormatted??p.window.resetAtFormatted,r);return t.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[t.jsx("span",{className:"shrink-0 truncate typography-ui-label text-muted-foreground",children:p.subtitle?`${p.subtitle} · ${p.label}`:p.label}),b?t.jsx("span",{className:"min-w-0 truncate typography-micro text-muted-foreground/70",children:b}):null]}),t.jsx("span",{className:Q("shrink-0 typography-ui-label font-semibold tabular-nums",mu(p.window)),children:h==="-"?"":h})]},p.key)})}):null,l.status&&l.rows.length>0?t.jsx("div",{className:"mt-1.5 typography-micro text-muted-foreground",children:l.status}):null]},l.providerId),e[6]=i,e[7]=r,e[8]=d):d=e[8],u=s.map(d),e[2]=i,e[3]=s,e[4]=r,e[5]=u}else u=e[5];let f;return e[9]!==a||e[10]!==u?(f=t.jsx("div",{className:a,children:u}),e[9]=a,e[10]=u,e[11]=f):f=e[11],f},zr=380,hu=(n,e)=>{if(!n||typeof n!="object")return;const s=n[e];return typeof s=="number"&&Number.isFinite(s)?s:void 0},dn=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:String(n),gu="—",Gi=n=>{const e=le.c(20),{percentage:s}=n;let i,r,o,a,u,f,d;if(e[0]!==s){o=Bo(s??0)??0;const h=Lo(s??0);r=h==="critical"?"var(--status-error)":h==="warn"?"var(--status-warning)":"var(--status-success)",i=2*Math.PI*7.5,a="0 0 18 18",u="size-[18px] -rotate-90",f="progressbar",d=s===null?void 0:Math.round(o),e[0]=s,e[1]=i,e[2]=r,e[3]=o,e[4]=a,e[5]=u,e[6]=f,e[7]=d}else i=e[1],r=e[2],o=e[3],a=e[4],u=e[5],f=e[6],d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:"var(--interactive-border)",strokeWidth:3}),e[8]=l):l=e[8];let p;e[9]!==i||e[10]!==s||e[11]!==r||e[12]!==o?(p=s===null?null:t.jsx("circle",{cx:9,cy:9,r:7.5,fill:"none",stroke:r,strokeWidth:3,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:i*(1-o/100),className:"transition-[stroke-dashoffset,stroke] duration-300"}),e[9]=i,e[10]=s,e[11]=r,e[12]=o,e[13]=p):p=e[13];let g;return e[14]!==a||e[15]!==u||e[16]!==f||e[17]!==d||e[18]!==p?(g=t.jsxs("svg",{viewBox:a,className:u,role:f,"aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":100,children:[l,p]}),e[14]=a,e[15]=u,e[16]=f,e[17]=d,e[18]=p,e[19]=g):g=e[19],g},bu=n=>{const e=le.c(13),{icon:s,iconNode:i,label:r,children:o}=n;let a;e[0]!==s||e[1]!==i?(a=i??(s?t.jsx(Z,{name:s,className:"size-[18px]"}):null),e[0]=s,e[1]=i,e[2]=a):a=e[2];let u;e[3]!==a?(u=t.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:a}),e[3]=a,e[4]=u):u=e[4];let f;e[5]!==r?(f=t.jsx("span",{className:"shrink-0 typography-ui-label text-muted-foreground",children:r}),e[5]=r,e[6]=f):f=e[6];let d;e[7]!==o?(d=t.jsx("span",{className:"min-w-0 flex-1 truncate text-right typography-ui-label font-medium text-foreground",children:o}),e[7]=o,e[8]=d):d=e[8];let l;return e[9]!==u||e[10]!==f||e[11]!==d?(l=t.jsxs("div",{className:"flex min-w-0 items-center gap-3 rounded-xl px-2.5 py-2.5",children:[u,f,d]}),e[9]=u,e[10]=f,e[11]=d,e[12]=l):l=e[12],l},xu=n=>{const e=le.c(57),{open:s,onClose:i,anchorRef:r,contextDisplay:o,usageGroups:a,usageDisplayMode:u,isUsageLoading:f,timeFormatPreference:d}=n,{t:l}=pe(),p=c.useRef(null),[g,h]=c.useState(s),[b,S]=c.useState(!1),{enabled:x}=Rn(),E=c.useRef(null),[v,N]=c.useState(null);let A,y;e[0]!==r||e[1]!==x||e[2]!==s||e[3]!==g?(A=()=>{if(!s||!x||!g)return;const X=()=>{const ce=r.current?.getBoundingClientRect(),ue=E.current?.getBoundingClientRect();if(!ce||!ue){N(null);return}const q=ce.left-ue.left,oe=Math.min(Math.max(q,8),Math.max(8,ue.width-zr-8));N(oe)};X();const ne=E.current;if(typeof ResizeObserver>"u"||!ne)return;const re=new ResizeObserver(X);return re.observe(ne),()=>re.disconnect()},y=[r,x,s,g],e[0]=r,e[1]=x,e[2]=s,e[3]=g,e[4]=A,e[5]=y):(A=e[4],y=e[5]),c.useLayoutEffect(A,y);const P=x&&v!==null;let C,R;e[6]!==s||e[7]!==g?(C=()=>{if(s){h(!0),S(!1);return}if(!g)return;S(!0);const X=window.setTimeout(()=>{h(!1),S(!1)},140);return()=>window.clearTimeout(X)},R=[s,g],e[6]=s,e[7]=g,e[8]=C,e[9]=R):(C=e[8],R=e[9]),c.useEffect(C,R);let k,z;e[10]!==i||e[11]!==s?(k=()=>{if(!s)return;const X=ne=>{ne.key==="Escape"&&i()};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},z=[i,s],e[10]=i,e[11]=s,e[12]=k,e[13]=z):(k=e[12],z=e[13]),c.useEffect(k,z);let D,M;if(e[14]!==r||e[15]!==i||e[16]!==s?(D=()=>{if(!s)return;const X=ne=>{const re=ne.target;if(!(re instanceof Node)){i();return}p.current?.contains(re)||r.current?.contains(re)||i()};return document.addEventListener("pointerdown",X,!0),document.addEventListener("wheel",X,!0),()=>{document.removeEventListener("pointerdown",X,!0),document.removeEventListener("wheel",X,!0)}},M=[r,i,s],e[14]=r,e[15]=i,e[16]=s,e[17]=D,e[18]=M):(D=e[17],M=e[18]),c.useEffect(D,M),!g)return null;let j;e[19]!==l?(j=l("mobile.header.openMetadataAria"),e[19]=l,e[20]=j):j=e[20];const I=P?"absolute origin-top-left":"mx-3 mt-2",$=b?"pointer-events-none":"pointer-events-auto";let w;e[21]!==I||e[22]!==$?(w=Q("oc-surface-elevated overflow-y-auto overscroll-contain rounded-[20px] border border-border/70 bg-surface-elevated p-2 shadow-[0_12px_32px_rgb(0_0_0_/_0.2)] will-change-transform",I,$),e[21]=I,e[22]=$,e[23]=w):w=e[23];const B=`${b?"session-metadata-out":"session-metadata-in"} ${b?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`;let U;e[24]!==v||e[25]!==P?(U=P?{top:8,left:v??8,width:`min(${zr}px, calc(100% - 16px))`}:null,e[24]=v,e[25]=P,e[26]=U):U=e[26];let O;e[27]!==B||e[28]!==U?(O={animation:B,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...U},e[27]=B,e[28]=U,e[29]=O):O=e[29];let L;e[30]!==o||e[31]!==l?(L=o?t.jsx(bu,{iconNode:t.jsx(Gi,{percentage:o.state==="measured"?o.percentage:null}),label:l("mobile.header.metadata.context"),children:o.state==="pending"?null:t.jsxs("span",{className:"inline-flex items-baseline gap-1.5 tabular-nums",children:[o.state==="measured"?t.jsxs("span",{className:Q("font-semibold",o.colorClass),children:[o.percentage.toFixed(1),"%"]}):null,t.jsx("span",{className:"text-muted-foreground",children:o.tokens})]})}):null,e[30]=o,e[31]=l,e[32]=L):L=e[32];let ie;e[33]!==o?.state||e[34]!==l?(ie=o?.state==="compacted"?t.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:l("contextUsage.compacted.description")}):null,e[33]=o?.state,e[34]=l,e[35]=ie):ie=e[35];let te;e[36]!==o?.state||e[37]!==l?(te=o?.state==="pending"?t.jsx("p",{className:"px-2.5 pb-1 typography-meta text-muted-foreground",children:l("mobile.header.metadata.contextPending")}):null,e[36]=o?.state,e[37]=l,e[38]=te):te=e[38];let V;e[39]!==f||e[40]!==d||e[41]!==u||e[42]!==a?(V=t.jsx(yu,{groups:a,displayMode:u,isLoading:f,timeFormatPreference:d}),e[39]=f,e[40]=d,e[41]=u,e[42]=a,e[43]=V):V=e[43];let _;e[44]!==L||e[45]!==ie||e[46]!==te||e[47]!==V?(_=t.jsxs("div",{className:"space-y-1",children:[L,ie,te,V]}),e[44]=L,e[45]=ie,e[46]=te,e[47]=V,e[48]=_):_=e[48];let G;e[49]!==w||e[50]!==O||e[51]!==_||e[52]!==j?(G=t.jsx("div",{ref:p,role:"dialog","aria-label":j,className:w,style:O,children:_}),e[49]=w,e[50]=O,e[51]=_,e[52]=j,e[53]=G):G=e[53];let J;e[54]===Symbol.for("react.memo_cache_sentinel")?(J=t.jsx("style",{children:`
|
|
5
|
+
@keyframes session-metadata-in {
|
|
6
|
+
from { opacity: 0; transform: translateY(-8px) scale(0.985); }
|
|
7
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
8
|
+
}
|
|
9
|
+
@keyframes session-metadata-out {
|
|
10
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
11
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.985); }
|
|
12
|
+
}
|
|
13
|
+
`}),e[54]=J):J=e[54];let H;return e[55]!==G?(H=t.jsxs("div",{ref:E,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:[G,J]}),e[55]=G,e[56]=H):H=e[56],H},yu=n=>{const e=le.c(30),{groups:s,displayMode:i,isLoading:r,timeFormatPreference:o}=n,{t:a}=pe();let u;e[0]!==i||e[1]!==a?(u=a(i==="remaining"?"header.services.remaining":"header.services.used"),e[0]=i,e[1]=a,e[2]=u):u=e[2];const f=u;if(s.length===0){if(!r)return null;let v;e[3]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Z,{name:"loader-4",className:"size-4 animate-spin","aria-hidden":!0}),e[3]=v):v=e[3];let N;e[4]!==a?(N=a("common.loading"),e[4]=a,e[5]=N):N=e[5];let A;return e[6]!==N?(A=t.jsxs("div",{className:"flex items-center justify-center gap-2 px-2.5 py-6 text-muted-foreground",children:[v,t.jsx("span",{className:"typography-ui-label",children:N})]}),e[6]=N,e[7]=A):A=e[7],A}let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:t.jsx(Z,{name:"timer",className:"size-[18px]"})}),e[8]=d):d=e[8];let l;e[9]!==a?(l=a("mobile.header.metadata.usage"),e[9]=a,e[10]=l):l=e[10];let p;e[11]!==l?(p=t.jsx("span",{className:"shrink-0 typography-ui-label text-muted-foreground",children:l}),e[11]=l,e[12]=p):p=e[12];let g;e[13]!==r?(g=r?t.jsx(Z,{name:"refresh",className:"size-3.5 animate-spin"}):null,e[13]=r,e[14]=g):g=e[14];let h;e[15]!==f?(h=t.jsx("span",{className:"truncate",children:f}),e[15]=f,e[16]=h):h=e[16];let b;e[17]!==g||e[18]!==h?(b=t.jsxs("span",{className:"inline-flex min-w-0 flex-1 items-center justify-end gap-1.5 typography-ui-label text-muted-foreground",children:[g,h]}),e[17]=g,e[18]=h,e[19]=b):b=e[19];let S;e[20]!==p||e[21]!==b?(S=t.jsxs("div",{className:"flex min-w-0 items-center gap-3 px-2.5 pb-1.5",children:[d,p,b]}),e[20]=p,e[21]=b,e[22]=S):S=e[22];let x;e[23]!==i||e[24]!==s||e[25]!==o?(x=t.jsx(pu,{groups:s,displayMode:i,timeFormatPreference:o}),e[23]=i,e[24]=s,e[25]=o,e[26]=x):x=e[26];let E;return e[27]!==S||e[28]!==x?(E=t.jsxs("div",{className:"pt-2.5",children:[S,x]}),e[27]=S,e[28]=x,e[29]=E):E=e[29],E},vu=c.memo(function({open:e,onOpenChange:s,currentSessionId:i,effectiveDirectory:r,isNewSessionDraftOpen:o}){const{t:a}=pe(),u=c.useRef(null),f=Do(i??"",r||void 0),d=qe(w=>w.providers),l=qe(w=>w.currentProviderId),p=qe(w=>w.currentModelId),g=qe(w=>w.getModelMetadata);qe(w=>w.modelsMetadata.size);const h=_o(c.useCallback(w=>i?w.sessionModelSelections.get(i)??null:null,[i])),b=vt(w=>w.results),S=vt(w=>w.refreshErrors),x=c.useRef(!1),E=vt(w=>w.loadSettings),v=vt(w=>w.fetchAllQuotas),N=vt(w=>w.isLoading),A=vt(w=>w.displayMode),y=vt(w=>w.dropdownProviderIds),P=it(w=>w.timeFormatPreference);Mo(),c.useEffect(()=>{E()},[E]),c.useEffect(()=>{vr(y)},[y]),c.useEffect(()=>{if(!e){x.current=!1;return}x.current||N||!y.some(B=>!b.some(U=>U.providerId===B)||S[B])||(x.current=!0,v())},[y,v,N,e,b,S]);const R=c.useMemo(()=>{for(let w=f.length-1;w>=0;w-=1){const B=f[w];if(B.role!=="assistant")continue;const U=B.providerID.trim(),O=B.modelID.trim();if(U&&O)return{providerID:U,modelID:O}}return null},[f])??(h?{providerID:h.providerId,modelID:h.modelId}:null)??(l&&p?{providerID:l,modelID:p}:null),z=(R?d.find(w=>w.id===R.providerID):void 0)?.models.find(w=>w.id===R?.modelID),D=R?g(R.providerID,R.modelID):void 0,M=hu(z?.limit,"context")??D?.limit?.context??0,j=c.useMemo(()=>zo(f),[f]),I=c.useMemo(()=>{if(M<=0)return null;if(o||!j)return{state:"pending"};if(j.state==="compacted")return{state:"compacted",tokens:`${gu}/${dn(M)}`};const w=Math.min(j.totalTokens/M*100,999),B=w>=90?"text-[var(--status-error)]":w>=75?"text-[var(--status-warning)]":"text-[var(--status-success)]";return{state:"measured",percentage:w,tokens:`${dn(j.totalTokens)}/${dn(M)}`,colorClass:B}},[j,M,o]),$=Oo();return c.useEffect(()=>{!e||$.length===0||vr($.map(w=>w.providerId))},[e,$]),t.jsxs(t.Fragment,{children:[t.jsx("button",{ref:u,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-ring","aria-label":a("mobile.header.openMetadataAria"),"aria-expanded":e,onClick:()=>s(w=>!w),style:{touchAction:"manipulation"},children:t.jsx(Gi,{percentage:I?.state==="measured"?I.percentage:I?.state==="compacted"?null:0})}),t.jsx(xu,{open:e,onClose:()=>s(!1),anchorRef:u,contextDisplay:I,usageGroups:$,usageDisplayMode:A,isUsageLoading:N,timeFormatPreference:P})]})}),wu=10,Or=380,ju=(n,e)=>n.title?.trim()||e,ku=n=>{const e=le.c(33),{session:s,meta:i,active:r,onSelect:o}=n,{t:a}=pe(),u=En(s.id),f=Pn(s.id),d=!f&&u>0&&!r,l=An(s.id,f),p=(f||d)&&l,g=s.time?.updated??s.time?.created??0;let h;e[0]!==g?(h=Fo(g),e[0]=g,e[1]=h):h=e[1];const b=h,S=r&&"bg-[color-mix(in_srgb,var(--primary)_10%,transparent)]";let x;e[2]!==S?(x=Q("flex w-full items-center gap-3 rounded-xl px-2.5 py-2 text-left transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",S),e[2]=S,e[3]=x):x=e[3];let E;e[4]===Symbol.for("react.memo_cache_sentinel")?(E={touchAction:"manipulation"},e[4]=E):E=e[4];const v=r?"text-primary":"text-foreground";let N;e[5]!==v?(N=Q("block truncate typography-ui-label",v),e[5]=v,e[6]=N):N=e[6];let A;e[7]!==s||e[8]!==a?(A=ju(s,a("sessions.sidebar.session.untitled")),e[7]=s,e[8]=a,e[9]=A):A=e[9];let y;e[10]!==N||e[11]!==A?(y=t.jsx("span",{className:N,children:A}),e[10]=N,e[11]=A,e[12]=y):y=e[12];let P;e[13]!==i?(P=i?t.jsx("span",{className:"block truncate typography-micro text-muted-foreground",children:i}):null,e[13]=i,e[14]=P):P=e[14];let C;e[15]!==P||e[16]!==y?(C=t.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[y,P]}),e[15]=P,e[16]=y,e[17]=C):C=e[17];let R;e[18]!==f||e[19]!==d||e[20]!==a?(R=f||d?t.jsx(Ls,{state:f?"running":"unread",label:a(f?"sessions.sidebar.session.status.active":"sessions.sidebar.session.status.unread")}):null,e[18]=f,e[19]=d,e[20]=a,e[21]=R):R=e[21];let k;e[22]!==f||e[23]!==s.id||e[24]!==p||e[25]!==b?(k=p?t.jsx(Mn,{sessionId:s.id,running:f,className:"typography-micro"}):b?t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:b}):null,e[22]=f,e[23]=s.id,e[24]=p,e[25]=b,e[26]=k):k=e[26];let z;return e[27]!==o||e[28]!==C||e[29]!==R||e[30]!==k||e[31]!==x?(z=t.jsxs("button",{type:"button",className:x,onClick:o,style:E,children:[C,R,k]}),e[27]=o,e[28]=C,e[29]=R,e[30]=k,e[31]=x,e[32]=z):z=e[32],z},Su=n=>{const e=le.c(50),{open:s,onClose:i,anchorRef:r}=n,{t:o}=pe(),a=c.useRef(null),[u,f]=c.useState(s),[d,l]=c.useState(!1),{enabled:p}=Rn(),g=c.useRef(null),[h,b]=c.useState(null);let S,x;e[0]!==r||e[1]!==p||e[2]!==s||e[3]!==u?(S=()=>{if(!s||!p||!u)return;const H=()=>{const re=r.current?.getBoundingClientRect(),ce=g.current?.getBoundingClientRect();if(!re||!ce){b(null);return}const ue=re.left-ce.left;b(Math.min(Math.max(ue,8),Math.max(8,ce.width-Or-8)))};H();const X=g.current;if(typeof ResizeObserver>"u"||!X)return;const ne=new ResizeObserver(H);return ne.observe(X),()=>ne.disconnect()},x=[r,p,s,u],e[0]=r,e[1]=p,e[2]=s,e[3]=u,e[4]=S,e[5]=x):(S=e[4],x=e[5]),c.useLayoutEffect(S,x);const E=p&&h!==null,v=Ne(Nu),N=Ne(Cu),A=We(Ru);let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y={maxParents:wu},e[6]=y):y=e[6];const P=$o(s||u,y);let C,R;e[7]!==s||e[8]!==u?(C=()=>{if(s){In(),f(!0),l(!1);return}if(!u)return;l(!0);const H=window.setTimeout(()=>{f(!1),l(!1)},140);return()=>window.clearTimeout(H)},R=[s,u],e[7]=s,e[8]=u,e[9]=C,e[10]=R):(C=e[9],R=e[10]),c.useEffect(C,R);let k,z;e[11]!==i||e[12]!==s?(k=()=>{if(!s)return;const H=X=>{X.key==="Escape"&&i()};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},z=[i,s],e[11]=i,e[12]=s,e[13]=k,e[14]=z):(k=e[13],z=e[14]),c.useEffect(k,z);let D,M;e[15]!==r||e[16]!==i||e[17]!==s?(D=()=>{if(!s)return;const H=X=>{const ne=X.target;if(!(ne instanceof Node)){i();return}a.current?.contains(ne)||r.current?.contains(ne)||i()};return document.addEventListener("pointerdown",H,!0),()=>document.removeEventListener("pointerdown",H,!0)},M=[r,i,s],e[15]=r,e[16]=i,e[17]=s,e[18]=D,e[19]=M):(D=e[18],M=e[19]),c.useEffect(D,M);let j;e[20]!==i||e[21]!==N?(j=H=>{N(H.id,Cn(H)),i()},e[20]=i,e[21]=N,e[22]=j):j=e[22];const I=j;if(!u)return null;let $;e[23]!==o?($=o("sessions.switcher.openAria"),e[23]=o,e[24]=$):$=e[24];const w=E?"absolute origin-top-left":"mx-3 mt-2",B=d?"pointer-events-none":"pointer-events-auto";let U;e[25]!==w||e[26]!==B?(U=Q("oc-surface-elevated flex flex-col overflow-hidden rounded-[20px] border border-border/70 bg-surface-elevated p-2 shadow-[0_12px_32px_rgb(0_0_0_/_0.2)] will-change-transform",w,B),e[25]=w,e[26]=B,e[27]=U):U=e[27];const O=`${d?"session-switcher-out":"session-switcher-in"} ${d?140:170}ms cubic-bezier(0.32, 0.72, 0, 1) forwards`;let L;e[28]!==h||e[29]!==E?(L=E?{top:8,left:h??8,width:`min(${Or}px, calc(100% - 16px))`}:null,e[28]=h,e[29]=E,e[30]=L):L=e[30];let ie;e[31]!==O||e[32]!==L?(ie={animation:O,maxHeight:"min(72dvh, calc(100dvh - var(--oc-safe-area-top, 0px) - var(--oc-header-height, 56px) - 1rem))",...L},e[31]=O,e[32]=L,e[33]=ie):ie=e[33];let te;e[34]!==v||e[35]!==I||e[36]!==P||e[37]!==A||e[38]!==o?(te=P.length===0?t.jsx("p",{className:"px-3 py-6 text-center typography-small text-muted-foreground",children:o("sessions.switcher.empty")}):P.map(H=>{const X=H.node.session,ne=[H.secondaryMeta?.projectLabel,H.secondaryMeta?.branchLabel].filter(Boolean).join(" · ");return t.jsx(ku,{session:X,meta:ne,active:X.id===v,onSelect:()=>{H.projectId&&A(H.projectId),I(X)}},X.id)}),e[34]=v,e[35]=I,e[36]=P,e[37]=A,e[38]=o,e[39]=te):te=e[39];let V;e[40]!==te?(V=t.jsx("div",{className:"oc-hide-scrollbar min-h-0 flex-1 space-y-0.5 overflow-y-auto overscroll-contain",children:te}),e[40]=te,e[41]=V):V=e[41];let _;e[42]!==$||e[43]!==U||e[44]!==ie||e[45]!==V?(_=t.jsx("div",{ref:a,role:"dialog","aria-label":$,className:U,style:ie,children:V}),e[42]=$,e[43]=U,e[44]=ie,e[45]=V,e[46]=_):_=e[46];let G;e[47]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx("style",{children:`
|
|
14
|
+
@keyframes session-switcher-in {
|
|
15
|
+
from { opacity: 0; transform: translateY(-8px) scale(0.985); }
|
|
16
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
17
|
+
}
|
|
18
|
+
@keyframes session-switcher-out {
|
|
19
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
20
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.985); }
|
|
21
|
+
}
|
|
22
|
+
`}),e[47]=G):G=e[47];let J;return e[48]!==_?(J=t.jsxs("div",{ref:g,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:[_,G]}),e[48]=_,e[49]=J):J=e[49],J};function Nu(n){return n.currentSessionId}function Cu(n){return n.setCurrentSession}function Ru(n){return n.setActiveProjectIdOnly}const Eu=n=>{const e=le.c(78),{onOpenSessions:s,onOpenWorkspace:i,compactTitle:r}=n,o=r===void 0?!1:r,{t:a}=pe(),[u,f]=c.useState(!1),[d,l]=c.useState(!1),p=c.useRef(null),g=pt(Pu),h=Ne(Au);let b;e[0]!==h?(b=De=>h?De.getDirectoryForSession(h):null,e[0]=h,e[1]=b):b=e[1];const x=Ne(b)||g,E=Wo(h,x||void 0),v=Ne(Iu),N=ci(x||null);let A;e[2]!==x||e[3]!==N?(A=De=>{if(!x||N!==!0)return!1;const Oe=De.directories.get(x)?.status;return!!(Oe&&!Oe.isClean)},e[2]=x,e[3]=N,e[4]=A):A=e[4];const y=Fe(A);let P;e[5]!==E?.title?(P=E?.title?.trim(),e[5]=E?.title,e[6]=P):P=e[6];const C=P;let R;e[7]!==h||e[8]!==C||e[9]!==a?(R=C||a(h?"mobile.sessions.untitled":"sessions.switcher.draftTitle"),e[7]=h,e[8]=C,e[9]=a,e[10]=R):R=e[10];const k=R;let z;e[11]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{f(!1),l(!1)},e[11]=z):z=e[11];let D;e[12]!==h||e[13]!==x?(D=[h,x],e[12]=h,e[13]=x,e[14]=D):D=e[14],c.useEffect(z,D);let M;e[15]!==s?(M=()=>{f(!1),l(!1),s()},e[15]=s,e[16]=M):M=e[16];const j=M;let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=De=>{f(Oe=>{const Ce=typeof De=="function"?De(Oe):De;return Ce&&l(!1),Ce})},e[17]=I):I=e[17];const $=I;let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{l(De=>{const Oe=!De;return Oe&&f(!1),Oe})},e[18]=w):w=e[18];const B=w;let U;e[19]===Symbol.for("react.memo_cache_sentinel")?(U={paddingTop:"var(--oc-safe-area-top, 0px)"},e[19]=U):U=e[19];let O;e[20]!==a?(O=a("mobile.sessions.openSheetAria"),e[20]=a,e[21]=O):O=e[21];let L,ie;e[22]===Symbol.for("react.memo_cache_sentinel")?(L={touchAction:"manipulation"},ie=t.jsx(Z,{name:"list-unordered",className:"size-5"}),e[22]=L,e[23]=ie):(L=e[22],ie=e[23]);let te;e[24]!==j||e[25]!==O?(te=t.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-ring","aria-label":O,onClick:j,style:L,children:ie}),e[24]=j,e[25]=O,e[26]=te):te=e[26];const V=o?"shrink":"flex-1";let _;e[27]!==V?(_=Q("flex min-w-0 items-center rounded-lg px-2 py-1.5 text-left transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",V),e[27]=V,e[28]=_):_=e[28];let G;e[29]!==a?(G=a("sessions.switcher.openAria"),e[29]=a,e[30]=G):G=e[30];let J;e[31]===Symbol.for("react.memo_cache_sentinel")?(J={touchAction:"manipulation"},e[31]=J):J=e[31];let H;e[32]!==k?(H=t.jsx("span",{className:"block min-w-0 truncate typography-ui-label text-foreground",children:k}),e[32]=k,e[33]=H):H=e[33];const X=d&&"rotate-180";let ne;e[34]!==X?(ne=Q("size-4 shrink-0 text-muted-foreground transition-transform duration-150",X),e[34]=X,e[35]=ne):ne=e[35];let re;e[36]!==ne?(re=t.jsx(Z,{name:"arrow-down-s",className:ne}),e[36]=ne,e[37]=re):re=e[37];let ce;e[38]!==H||e[39]!==re?(ce=t.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[H,re]}),e[38]=H,e[39]=re,e[40]=ce):ce=e[40];let ue;e[41]!==d||e[42]!==_||e[43]!==G||e[44]!==ce?(ue=t.jsx("button",{ref:p,type:"button",className:_,"aria-label":G,"aria-haspopup":"dialog","aria-expanded":d,onClick:B,style:J,children:ce}),e[41]=d,e[42]=_,e[43]=G,e[44]=ce,e[45]=ue):ue=e[45];let q;e[46]!==o?(q=o?t.jsx("div",{className:"min-w-0 flex-1"}):null,e[46]=o,e[47]=q):q=e[47];let oe;e[48]!==h||e[49]!==x||e[50]!==v||e[51]!==u?(oe=t.jsx(vu,{open:u,onOpenChange:$,currentSessionId:h,effectiveDirectory:x,isNewSessionDraftOpen:v}),e[48]=h,e[49]=x,e[50]=v,e[51]=u,e[52]=oe):oe=e[52];let he;e[53]!==y||e[54]!==a?(he=a(y?"mobile.header.openWorkspaceWithChangesAria":"mobile.header.openWorkspaceAria"),e[53]=y,e[54]=a,e[55]=he):he=e[55];let ke;e[56]!==i?(ke=()=>{f(!1),l(!1),i()},e[56]=i,e[57]=ke):ke=e[57];let Y,fe;e[58]===Symbol.for("react.memo_cache_sentinel")?(Y={touchAction:"manipulation"},fe=t.jsx(Z,{name:"pencil-ruler-2",className:"size-5"}),e[58]=Y,e[59]=fe):(Y=e[58],fe=e[59]);let Re;e[60]!==y?(Re=y?t.jsx("span",{className:"absolute right-1.5 top-1.5 size-2.5 rounded-full border-2 border-[var(--background)] bg-[var(--status-warning)]","aria-hidden":!0}):null,e[60]=y,e[61]=Re):Re=e[61];let Me;e[62]!==he||e[63]!==ke||e[64]!==Re?(Me=t.jsxs("button",{type:"button",className:"relative 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-ring","aria-label":he,onClick:ke,style:Y,children:[fe,Re]}),e[62]=he,e[63]=ke,e[64]=Re,e[65]=Me):Me=e[65];let Ie;e[66]!==te||e[67]!==ue||e[68]!==q||e[69]!==oe||e[70]!==Me?(Ie=t.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:U,children:t.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] w-full items-center gap-1 px-2",children:[te,ue,q,oe,Me]})}),e[66]=te,e[67]=ue,e[68]=q,e[69]=oe,e[70]=Me,e[71]=Ie):Ie=e[71];let Ye;e[72]===Symbol.for("react.memo_cache_sentinel")?(Ye=()=>l(!1),e[72]=Ye):Ye=e[72];let et;e[73]!==d?(et=t.jsx(Su,{open:d,onClose:Ye,anchorRef:p}),e[73]=d,e[74]=et):et=e[74];let ut;return e[75]!==Ie||e[76]!==et?(ut=t.jsxs(t.Fragment,{children:[Ie,et]}),e[75]=Ie,e[76]=et,e[77]=ut):ut=e[77],ut};function Pu(n){return n.currentDirectory}function Au(n){return n.currentSessionId}function Iu(n){return!!n.newSessionDraft?.open}const Tu=({onActiveConnectionDeleted:n,onConnect:e})=>{const{t:s}=pe(),i=Oi(e),{connections:r,isBusy:o,isPasswordBusy:a,error:u,pendingConnection:f,connect:d,submitPassword:l,cancelPassword:p,saveConnection:g,removeConnection:h,setError:b}=i,[S,x]=c.useState(null),E=S?r.find(q=>q.id===S)??null:null,[v,N]=c.useState(null),[A,y]=c.useState(""),[P,C]=c.useState(""),[R,k]=c.useState(""),[z,D]=c.useState(""),[M,j]=c.useState(!1),[I,$]=c.useState(!1),w=c.useRef(null),B=c.useMemo(()=>wn(),[]),[U,O]=c.useState(!1),[L,ie]=c.useState(null),[te,V]=c.useState(!1),_=Ri(c.useCallback(()=>V(!0),[])),G=c.useCallback(()=>{x(null),y(""),C(""),k(""),b(null),O(!1)},[b]),J=c.useCallback(q=>{q.preventDefault(),g({id:S??void 0,url:A,label:P,clientToken:R}).then(oe=>{oe&&G()})},[R,S,P,G,g,A]),H=c.useCallback(async()=>{if(w.current)return;b(null),j(!0);const q=new AbortController;w.current=q;try{const oe=await Wi({signal:q.signal});switch(w.current===q&&(w.current=null,j(!1)),oe.status){case"ok":y(oe.url),oe.label&&C(oe.label),oe.clientToken&&k(oe.clientToken),O(!0);break;case"pairing":$(!0),await i.redeemPairingConnection(oe.pairing);break;case"permission-denied":b(s("mobile.connect.scan.permissionDenied"));break;case"invalid":b(s("mobile.connect.scan.invalid"));break;case"unsupported":b(s("mobile.connect.scan.unsupported"));break;case"failed":b(s("mobile.connect.scan.failed"));break;default:break}}finally{$(!1),w.current===q&&(w.current=null,j(!1))}},[i,b,s]);c.useEffect(()=>()=>w.current?.abort(),[]);const X=c.useCallback(q=>{q.preventDefault(),l(z)},[z,l]),ne=c.useCallback(()=>{D(""),p()},[p]),re=c.useCallback(q=>{N(oe=>oe===q?null:q)},[]),ce=c.useCallback(q=>{N(null),S===q&&G();const oe=r.length===1;h(q).then(he=>{he&&(oe||Mr(he))&&n()})},[r.length,S,n,h,G]),ue=ds;return f?t.jsx("div",{className:"flex h-full flex-col overflow-hidden",children:t.jsx("form",{className:"flex-1 overflow-y-auto px-5 py-4",onSubmit:X,children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-border/70 bg-surface-elevated px-3.5 py-3",children:[t.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:t.jsx(Z,{name:"lock",className:"size-[18px]"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate typography-ui-label text-foreground",children:f.label}),t.jsx("p",{className:"truncate typography-small text-muted-foreground",children:f.candidates.some(q=>q.kind==="direct")?lt(f):s("mobile.connect.relay.badge")})]})]}),t.jsx("input",{...Lt,value:z,onChange:q=>D(q.target.value),placeholder:s("mobile.connect.password.placeholder"),"aria-label":s("mobile.connect.password.label"),type:"password",autoFocus:!0,className:ue}),u?t.jsx("p",{className:"px-1 typography-small text-[var(--status-error)]",children:u}):null,t.jsx(be,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",disabled:a||!z.trim(),children:s(a?"mobile.connect.connecting":"mobile.connect.unlockButton")}),t.jsx(be,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:ne,children:s("mobile.connect.cancelPassword")})]})})}):t.jsxs(t.Fragment,{children:[M?t.jsx(Vi,{onCancel:()=>w.current?.abort()}):null,I?t.jsx(Ui,{}):null,te?t.jsx(Bi,{onClose:()=>V(!1)}):null,t.jsx("div",{className:"flex h-full flex-col overflow-hidden",children:t.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:t.jsxs("div",{className:"space-y-6",children:[r.length>0?t.jsx("div",{..._,className:"overflow-hidden rounded-[18px] border border-border/70 bg-surface-elevated",children:r.map(q=>{const oe=v===q.id,he=Mr(q),ke=L===q.id,Y=ke?s("mobile.connect.connecting"):he?gs()?s("mobile.instances.status.connectedRelay"):s("mobile.instances.status.connectedDirect"):q.candidates.some(fe=>fe.kind==="direct")?lt(q):s("mobile.connect.relay.badge");return t.jsxs("div",{className:Q("flex items-center border-b border-border/70 transition-colors last:border-b-0",oe&&"bg-[color-mix(in_srgb,var(--destructive)_8%,transparent)]"),children:[t.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-3 px-3.5 py-3 text-left transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:opacity-60",onClick:()=>{he||(ie(q.id),d({id:q.id,candidates:q.candidates,clientToken:q.clientToken,label:q.label}).finally(()=>ie(null)))},disabled:o&&!ke||oe,children:[t.jsxs("span",{className:"relative flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-interactive-hover text-foreground",children:[t.jsx(Z,{name:"server",className:"size-[18px]"}),he?t.jsx("span",{className:"absolute -right-0.5 -top-0.5 size-2.5 rounded-full border-2 border-[var(--surface-elevated)] bg-[var(--status-success)]","aria-hidden":!0}):null]}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate typography-ui-label text-foreground",children:q.label}),t.jsx("span",{className:Q("block truncate typography-small",he&&!ke?"text-[var(--status-success)]":"text-muted-foreground"),children:Y})]}),ke?t.jsx(Z,{name:"loader-4",className:"size-5 shrink-0 animate-spin text-muted-foreground"}):null]}),t.jsxs("div",{className:"flex items-center gap-0.5 pr-2",children:[oe?t.jsxs("button",{type:"button","aria-label":s("mobile.instances.confirmDeleteAria",{label:q.label}),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-destructive px-3 text-destructive-foreground transition-opacity active:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive",onClick:()=>ce(q.id),style:{touchAction:"manipulation"},children:[t.jsx(Z,{name:"delete-bin",className:"size-[18px]"}),t.jsx("span",{className:"typography-ui-label",children:s("mobile.instances.delete")})]}):q.candidates.some(fe=>fe.kind==="direct")?t.jsx("button",{type:"button","aria-label":s("mobile.instances.edit"),className:"flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>{x(q.id),y(lt(q)),C(q.label),k(q.clientToken||""),b(null)},style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"edit",className:"size-[18px]"})}):null,t.jsx("button",{type:"button","aria-label":oe?s("mobile.instances.cancelDeleteAria",{label:q.label}):s("mobile.instances.deleteAria",{label:q.label}),className:"flex size-9 items-center justify-center rounded-full text-muted-foreground transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>re(q.id),style:{touchAction:"manipulation"},children:t.jsx(Z,{name:oe?"close":"delete-bin",className:"size-[18px]"})})]})]},q.id)})}):t.jsx("p",{..._,className:"rounded-[18px] border border-dashed border-border/70 px-4 py-6 text-center typography-small text-muted-foreground",children:s("mobile.connect.saved.empty")}),!U&&!E?t.jsxs("div",{className:"space-y-2",children:[B?t.jsxs(be,{type:"button",size:"lg",className:"h-12 w-full",onClick:()=>{H()},disabled:M,children:[t.jsx(Z,{name:"scan-2",className:Q("size-[18px]",M&&"animate-pulse")}),s("mobile.connect.scanQr")]}):null,t.jsxs(be,{type:"button",variant:B?"ghost":"outline",size:"lg",className:"h-12 w-full",onClick:()=>{b(null),O(!0)},children:[t.jsx(Z,{name:"add",className:"size-[18px]"}),s("mobile.instances.addManual")]}),u?t.jsx("p",{className:"px-1 text-center typography-small text-[var(--status-error)]",children:u}):null]}):t.jsxs("form",{className:"space-y-3",onSubmit:J,children:[t.jsxs("div",{className:"flex h-8 items-center justify-between gap-3 px-1",children:[t.jsx("h3",{className:"typography-ui-label text-foreground",children:s(E?"mobile.instances.editTitle":"mobile.instances.addTitle")}),t.jsx(be,{type:"button",variant:"ghost",size:"xs",onClick:G,children:s("mobile.instances.cancelEdit")})]}),t.jsxs("label",{className:"block space-y-1.5",children:[t.jsx("span",{className:"block px-1 typography-ui-label text-foreground",children:s("mobile.connect.url.label")}),t.jsx("input",{...Lt,value:A,onChange:q=>y(q.target.value),placeholder:s("mobile.connect.url.placeholder"),type:"url",inputMode:"url",autoCapitalize:"none",className:ue})]}),t.jsxs("label",{className:"block space-y-1.5",children:[t.jsx("span",{className:"block px-1 typography-ui-label text-foreground",children:s("mobile.instances.label.label")}),t.jsx("input",{value:P,onChange:q=>C(q.target.value),placeholder:s("mobile.instances.label.placeholder"),autoComplete:"off",autoCapitalize:"words",autoCorrect:"off",spellCheck:!1,className:ue})]}),t.jsxs("label",{className:"block space-y-1.5",children:[t.jsx("span",{className:"block px-1 typography-ui-label text-foreground",children:s("mobile.connect.token.label")}),t.jsx("input",{...Lt,value:R,onChange:q=>k(q.target.value),placeholder:s("mobile.connect.token.placeholder"),autoCapitalize:"none",className:ue}),t.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:s("mobile.connect.token.hint")})]}),u?t.jsx("p",{className:"px-1 typography-small text-[var(--status-error)]",children:u}):null,t.jsx(be,{type:"submit",size:"lg",className:"mt-1 h-12 w-full",children:s(E?"mobile.instances.saveEdit":"mobile.instances.saveNew")})]})]})})})]})},_e=n=>wo(n)??"",fn=n=>{const e=_e(n);if(!e)return"";const s=e.split("/").filter(Boolean);return s[s.length-1]?.replace(/[-_]/g," ")||e},Br=qn(n=>({expandedParents:{},toggleParent:e=>n(s=>{const i={...s.expandedParents};return i[e]?delete i[e]:i[e]=!0,{expandedParents:i}})})),Ds=qn()(Si(n=>({projectExpanded:{},worktreeExpanded:{},setProjectExpanded:(e,s)=>n(i=>({projectExpanded:{...i.projectExpanded,[e]:s}})),setWorktreeExpanded:(e,s)=>n(i=>({worktreeExpanded:{...i.worktreeExpanded,[e]:s}}))}),{name:"mobile-session-tree"})),jn=qn()(Si(n=>({orderByProject:{},setWorktreeOrder:(e,s)=>n(i=>({orderByProject:{...i.orderByProject,[e]:s}}))}),{name:"mobile-worktree-order"})),Lr=n=>n.replace(/\\/g,"/").replace(/\/+$/,""),Du=(n,e)=>{if(!n||n.length===0)return e;const s=new Map(n.map((r,o)=>[Lr(r),o])),i=r=>s.get(Lr(r.path))??Number.MAX_SAFE_INTEGER;return e.map((r,o)=>({worktree:r,index:o})).sort((r,o)=>{const a=i(r.worktree)-i(o.worktree);return a!==0?a:r.index-o.index}).map(r=>r.worktree)},fs=n=>(n||"").replace(/\\/g,"/").replace(/\/+$/,""),_u=n=>{const e=n;return fs(e.directory??e.project?.worktree??null)},Ki=({open:n,project:e,worktree:s,onClose:i,onDeleted:r})=>{const{t:o}=pe(),a=ui(),u=Nn(k=>k.activeSessions),f=Ne(k=>k.archiveSessions),d=pt(k=>k.currentDirectory),[l,p]=c.useState(!1),[g,h]=c.useState(!1),[b,S]=c.useState(!1),[x,E]=c.useState(!1),v=fs(s?.path),N=typeof s?.branch=="string"&&s.branch.trim().length>0,A=c.useMemo(()=>{if(!v)return[];const k=new Map;for(const z of[...u,...a])_u(z)===v&&k.set(z.id,z);return Array.from(k.values())},[u,a,v]);c.useEffect(()=>{if(!n){p(!1),h(!1),S(!1),E(!1);return}if(!s?.path)return;let k=!1;return Vo(s.path).then(z=>{k||S(!!z?.isDirty)}).catch(()=>{k||S(!!s.status?.isDirty)}),()=>{k=!0}},[n,s?.path,s?.status?.isDirty]);const y=c.useCallback((k,z)=>{const D=Uo(k),M=me.loading(o("sessions.sidebar.sessionDialogs.worktree.removingTitle",{name:D}));(async()=>{try{if(z.length>0){const{failedIds:j}=await f(z);if(j.length>0){me.error(j.length===1?o("sessions.sidebar.bulkActions.failedArchiveSingle",{count:j.length}):o("sessions.sidebar.bulkActions.failedArchivePlural",{count:j.length}),{id:M,description:o("sessions.sidebar.dialogs.deleteResult.tryAgain")});return}}await Go(e,k,{deleteRemoteBranch:N&&g,deleteLocalBranch:N&&l}),fs(d)===v&&fs(e.path)&&pt.getState().setDirectory(fs(e.path),{showOverlay:!1}),me.success(o("sessions.sidebar.sessionDialogs.worktree.removedTitle",{name:D}),{id:M,description:o(N&&g?"sessions.sidebar.sessionDialogs.worktree.removedWithRemote":"sessions.sidebar.sessionDialogs.worktree.removed")}),r?.()}catch(j){me.error(o("sessions.sidebar.sessionDialogs.worktree.errorRemoveTitle",{name:D}),{id:M,description:j instanceof Error?j.message:o("sessions.sidebar.dialogs.deleteResult.tryAgain")})}})()},[f,d,l,g,N,r,e,o,v]),P=()=>{!s||x||(E(!0),y(s,A.map(k=>k.id)),i())};if(!s)return null;const C=s.branch||s.label||s.path,R=(k,z,D,M)=>t.jsxs("button",{type:"button",role:"switch","aria-checked":k,disabled:M,onClick:()=>z(!k),className:Q("flex w-full items-center justify-between gap-3 rounded-xl border border-border/70 px-3.5 py-3 text-left transition-colors","hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",M&&"pointer-events-none opacity-40"),style:{touchAction:"manipulation"},children:[t.jsx("span",{className:"typography-ui-label text-foreground",children:D}),t.jsx("span",{className:Q("relative h-6 w-10 shrink-0 rounded-full transition-colors",k?"bg-primary":"bg-muted-foreground/30"),children:t.jsx("span",{className:Q("absolute top-0.5 size-5 rounded-full bg-white transition-transform",k?"translate-x-[1.125rem]":"translate-x-0.5")})})]});return t.jsx(di,{open:n,onClose:i,title:o("mobile.projectEdit.deleteWorktreeTitle"),footer:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(be,{variant:"ghost",className:"flex-1",onClick:i,disabled:x,children:o("projectEditDialog.actions.cancel")}),t.jsx(be,{variant:"destructive",className:"flex-1",onClick:()=>{P()},disabled:x,children:o("mobile.projectEdit.deleteWorktreeConfirmButton")})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx("p",{className:"typography-ui-body text-foreground",children:o("mobile.projectEdit.deleteWorktreeConfirm",{name:C})}),b?t.jsx("p",{className:"rounded-xl border border-[var(--warning)]/40 bg-[color-mix(in_srgb,var(--warning)_10%,transparent)] px-3.5 py-3 typography-meta text-foreground",children:o("mobile.projectEdit.deleteWorktreeDirty")}):null,A.length>0?t.jsx("p",{className:"typography-meta text-muted-foreground",children:o("mobile.projectEdit.deleteWorktreeArchiveNote",{count:A.length})}):null,N?t.jsxs("div",{className:"flex flex-col gap-2",children:[R(l,p,o("mobile.projectEdit.deleteLocalBranch"),x),R(g,h,o("mobile.projectEdit.deleteRemoteBranch"),x)]}):null]})})},Ks=n=>{const e=le.c(18),{project:s,size:i}=n,r=i===void 0?"md":i,{currentTheme:o}=fi(),a=s.icon?mi[s.icon]:null,u=s.color?pi[s.color]??null:null,f=r==="sm"?"size-6 rounded-md":"size-8 rounded-lg",d=r==="sm"?"size-3.5":"size-4";let l;e[0]!==a||e[1]!==u||e[2]!==d?(l=a?t.jsx(Z,{name:a,className:d,style:u?{color:u}:void 0}):t.jsx(xn,{className:d,style:u?{color:u}:void 0}),e[0]=a,e[1]=u,e[2]=d,e[3]=l):l=e[3];const p=l,g=r==="md"&&"bg-[var(--surface-muted)]";let h;e[4]!==f||e[5]!==g?(h=Q("flex shrink-0 items-center justify-center overflow-hidden text-muted-foreground",g,f),e[4]=f,e[5]=g,e[6]=h):h=e[6];let b;e[7]!==s.iconBackground?(b=s.iconBackground?{backgroundColor:s.iconBackground}:void 0,e[7]=s.iconBackground,e[8]=b):b=e[8];let S;e[9]!==o||e[10]!==p||e[11]!==s.iconImage||e[12]!==s.id?(S=s.iconImage?t.jsx(hi,{project:{id:s.id,iconImage:s.iconImage??null},options:{themeVariant:o.metadata.variant,iconColor:o.colors.surface.foreground},className:"size-full object-contain",fallback:p}):p,e[9]=o,e[10]=p,e[11]=s.iconImage,e[12]=s.id,e[13]=S):S=e[13];let x;return e[14]!==h||e[15]!==b||e[16]!==S?(x=t.jsx("span",{className:h,style:b,children:S}),e[14]=h,e[15]=b,e[16]=S,e[17]=x):x=e[17],x},Hi=n=>{const e=le.c(44),{initialTitle:s,indent:i,className:r,onSubmit:o,onCancel:a}=n,{t:u}=pe(),[f,d]=c.useState(s),l=Mu;let p;e[0]!==s||e[1]!==a||e[2]!==o||e[3]!==f?(p=()=>{const $=f.trim();if(!$||$===s.trim()){a();return}o($)},e[0]=s,e[1]=a,e[2]=o,e[3]=f,e[4]=p):p=e[4];const g=p;let h;e[5]!==r?(h=Q("flex h-9 min-w-0 flex-1 items-center gap-2 pr-2",r),e[5]=r,e[6]=h):h=e[6];let b;e[7]!==i?(b={paddingLeft:i},e[7]=i,e[8]=b):b=e[8];let S;e[9]!==g?(S=$=>{$.preventDefault(),g()},e[9]=g,e[10]=S):S=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=$=>d($.target.value),e[11]=x):x=e[11];let E;e[12]!==a?(E=$=>al($,a),e[12]=a,e[13]=E):E=e[13];let v;e[14]!==u?(v=u("sessions.sidebar.session.rename.save"),e[14]=u,e[15]=v):v=e[15];let N;e[16]!==u?(N=u("sessions.sidebar.session.menu.rename"),e[16]=u,e[17]=N):N=e[17];let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A={minHeight:0},e[18]=A):A=e[18];let y;e[19]!==E||e[20]!==v||e[21]!==N||e[22]!==f?(y=t.jsx("input",{ref:l,value:f,onChange:x,onKeyDown:E,"aria-label":v,placeholder:N,className:"min-w-0 flex-1 bg-transparent text-[16px] typography-ui-label text-foreground outline-none placeholder:text-muted-foreground",style:A,enterKeyHint:"done"}),e[19]=E,e[20]=v,e[21]=N,e[22]=f,e[23]=y):y=e[23];let P;e[24]!==u?(P=u("sessions.sidebar.session.rename.save"),e[24]=u,e[25]=P):P=e[25];let C,R;e[26]===Symbol.for("react.memo_cache_sentinel")?(C={touchAction:"manipulation",minHeight:0,minWidth:0},R=t.jsx(Z,{name:"check",className:"size-4"}),e[26]=C,e[27]=R):(C=e[26],R=e[27]);let k;e[28]!==P?(k=t.jsx("button",{type:"submit","aria-label":P,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:C,children:R}),e[28]=P,e[29]=k):k=e[29];let z;e[30]!==u?(z=u("sessions.sidebar.session.rename.cancel"),e[30]=u,e[31]=z):z=e[31];let D,M;e[32]===Symbol.for("react.memo_cache_sentinel")?(D={touchAction:"manipulation",minHeight:0,minWidth:0},M=t.jsx(Z,{name:"close",className:"size-4"}),e[32]=D,e[33]=M):(D=e[32],M=e[33]);let j;e[34]!==a||e[35]!==z?(j=t.jsx("button",{type:"button",onClick:a,"aria-label":z,className:"flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:D,children:M}),e[34]=a,e[35]=z,e[36]=j):j=e[36];let I;return e[37]!==y||e[38]!==k||e[39]!==j||e[40]!==h||e[41]!==b||e[42]!==S?(I=t.jsxs("form",{className:h,style:b,onSubmit:S,children:[y,k,j]}),e[37]=y,e[38]=k,e[39]=j,e[40]=h,e[41]=b,e[42]=S,e[43]=I):I=e[43],I};function Mu(n){n&&(n.focus(),n.select())}const qi=192,zu=180,Hs=n=>{const e=le.c(27),{actionsWidth:s,actions:i,revealed:r,onRevealedChange:o,dataActiveSession:a,contentClassName:u,children:f}=n,d=u===void 0?"relative flex w-full items-center bg-background":u,l=c.useRef(null),p=c.useRef(null),g=c.useRef(!1),h=c.useRef(0),b=c.useRef(r);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=(w,B)=>{const U=l.current;U&&(U.style.transition=B?`transform ${zu}ms ease-out`:"none",U.style.transform=w===0?"none":`translateX(${w}px)`,h.current=w)},e[0]=S):S=e[0];const x=S;let E,v;e[1]!==s||e[2]!==r?(E=()=>{b.current=r,x(r?s:0,!0)},v=[s,x,r],e[1]=s,e[2]=r,e[3]=E,e[4]=v):(E=e[3],v=e[4]),c.useEffect(E,v);let N;e[5]===Symbol.for("react.memo_cache_sentinel")?(N=w=>{if(w.touches.length!==1)return;const B=w.touches[0];p.current={x:B.clientX,y:B.clientY},g.current=!1},e[5]=N):N=e[5];const A=N;let y;e[6]!==s?(y=w=>{if(!p.current)return;const B=w.touches[0],U=B.clientX-p.current.x,O=B.clientY-p.current.y;if(!g.current){if(Math.abs(U)<8||Math.abs(U)<=Math.abs(O))return;g.current=!0}const L=b.current?s:0;x(Math.max(0,Math.min(s,L+U)),!1)},e[6]=s,e[7]=y):y=e[7];const P=y;let C;e[8]!==s||e[9]!==o?(C=()=>{if(p.current=null,!g.current)return;g.current=!1;const w=h.current>s/2;x(w?s:0,!0),w!==b.current&&o(w)},e[8]=s,e[9]=o,e[10]=C):C=e[10];const R=C,k=a||void 0;let z;e[11]===Symbol.for("react.memo_cache_sentinel")?(z={touchAction:"pan-y"},e[11]=z):z=e[11];let D;e[12]!==s?(D={width:s},e[12]=s,e[13]=D):D=e[13];const M=!r;let j;e[14]!==i||e[15]!==D||e[16]!==M?(j=t.jsx("div",{className:"absolute inset-y-0 left-0 flex items-stretch",style:D,"aria-hidden":M,children:i}),e[14]=i,e[15]=D,e[16]=M,e[17]=j):j=e[17];let I;e[18]!==f||e[19]!==d?(I=t.jsx("div",{ref:l,className:d,children:f}),e[18]=f,e[19]=d,e[20]=I):I=e[20];let $;return e[21]!==R||e[22]!==P||e[23]!==j||e[24]!==I||e[25]!==k?($=t.jsxs("div",{"data-active-session":k,className:"relative overflow-hidden",onTouchStart:A,onTouchMove:P,onTouchEnd:R,onTouchCancel:R,style:z,children:[j,I]}),e[21]=R,e[22]=P,e[23]=j,e[24]=I,e[25]=k,e[26]=$):$=e[26],$},Ji=n=>{const e=le.c(52),{title:s,revealed:i,confirmingDelete:r,aiRename:o,onArchive:a,onRequestDelete:u,onConfirmDelete:f,onRequestRename:d,onRevealedChange:l}=n,{t:p}=pe(),g=i?0:-1,h=r?"rounded-lg bg-destructive text-destructive-foreground":"text-[var(--status-error)] active:opacity-80";let b;e[0]!==h?(b=Q("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-destructive",h),e[0]=h,e[1]=b):b=e[1];let S;e[2]!==r||e[3]!==p||e[4]!==s?(S=r?p("mobile.sessions.confirmDeleteSessionAria",{title:s}):p("mobile.sessions.deleteSessionAria",{title:s}),e[2]=r,e[3]=p,e[4]=s,e[5]=S):S=e[5];const x=r?f:u;let E,v;e[6]===Symbol.for("react.memo_cache_sentinel")?(E={touchAction:"manipulation"},v=t.jsx($s,{className:"size-[18px]"}),e[6]=E,e[7]=v):(E=e[6],v=e[7]);let N;e[8]!==b||e[9]!==S||e[10]!==x||e[11]!==g?(N=t.jsx("button",{type:"button",tabIndex:g,className:b,"aria-label":S,onClick:x,style:E,children:v}),e[8]=b,e[9]=S,e[10]=x,e[11]=g,e[12]=N):N=e[12];let A;e[13]!==p||e[14]!==s?(A=p("mobile.sessions.archiveSessionAria",{title:s}),e[13]=p,e[14]=s,e[15]=A):A=e[15];let y,P;e[16]===Symbol.for("react.memo_cache_sentinel")?(P={touchAction:"manipulation"},y=t.jsx(Ul,{className:"size-[18px]"}),e[16]=y,e[17]=P):(y=e[16],P=e[17]);let C;e[18]!==a||e[19]!==A||e[20]!==g?(C=t.jsx("button",{type:"button",tabIndex:g,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":A,onClick:a,style:P,children:y}),e[18]=a,e[19]=A,e[20]=g,e[21]=C):C=e[21];let R;e[22]!==p||e[23]!==s?(R=p("mobile.sessions.renameSessionAria",{title:s}),e[22]=p,e[23]=s,e[24]=R):R=e[24];let k,z;e[25]===Symbol.for("react.memo_cache_sentinel")?(k={touchAction:"manipulation"},z=t.jsx(yn,{className:"size-[18px]"}),e[25]=k,e[26]=z):(k=e[25],z=e[26]);let D;e[27]!==d||e[28]!==R||e[29]!==g?(D=t.jsx("button",{type:"button",tabIndex:g,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":R,onClick:d,style:k,children:z}),e[27]=d,e[28]=R,e[29]=g,e[30]=D):D=e[30];const M=o.disabled;let j;e[31]!==p?(j=p("sessions.aiRename.action"),e[31]=p,e[32]=j):j=e[32];let I;e[33]!==o||e[34]!==l?(I=()=>{o.run(),l?.(!1)},e[33]=o,e[34]=l,e[35]=I):I=e[35];let $;e[36]===Symbol.for("react.memo_cache_sentinel")?($={touchAction:"manipulation"},e[36]=$):$=e[36];const w=o.pending?"loader-4":"ai-generate-2",B=o.pending?"size-[18px] animate-spin":"size-[18px]";let U;e[37]!==w||e[38]!==B?(U=t.jsx(Z,{name:w,className:B}),e[37]=w,e[38]=B,e[39]=U):U=e[39];let O;e[40]!==o.disabled||e[41]!==o.hint||e[42]!==j||e[43]!==I||e[44]!==U||e[45]!==g?(O=t.jsx(be,{variant:"ghost",size:"icon",tabIndex:g,className:"flex-1 self-center text-muted-foreground",disabled:M,"aria-label":j,"aria-description":o.hint,title:o.hint,onClick:I,style:$,children:U}),e[40]=o.disabled,e[41]=o.hint,e[42]=j,e[43]=I,e[44]=U,e[45]=g,e[46]=O):O=e[46];let L;return e[47]!==C||e[48]!==D||e[49]!==O||e[50]!==N?(L=t.jsxs(t.Fragment,{children:[N,C,D,O]}),e[47]=C,e[48]=D,e[49]=O,e[50]=N,e[51]=L):L=e[51],L},mt=n=>n.parentID??null,kn=n=>{const e=n;return _e(e.directory??e.project?.worktree??null)},Yi=n=>{const e=n.time?.updated??n.time?.created,s=typeof e=="number"?e:Number(e);return Number.isFinite(s)&&s>0?s:0},Qi=n=>{if(n<=0)return"";const e=Date.now()-n;if(e<6e4)return"now";const s=Math.floor(e/6e4);if(s<60)return`${s}m`;const i=Math.floor(s/60);if(i<24)return`${i}h`;const r=Math.floor(i/24);return r<7?`${r}d`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(n))},$r=12,Ou=n=>{const e=le.c(83),{entry:s,active:i,revealed:r,confirmingDelete:o,renaming:a,handlers:u}=n,{t:f}=pe(),{session:d,project:l,branch:p}=s;let g;e[0]!==d.title||e[1]!==f?(g=d.title?.trim()||f("mobile.sessions.untitled"),e[0]=d.title,e[1]=f,e[2]=g):g=e[2];const h=g;let b;e[3]!==d?(b=Qi(Yi(d)),e[3]=d,e[4]=b):b=e[4];const S=b,x=ji(d.id,d.directory,r),E=En(d.id),v=Pn(d.id),N=!v&&E>0&&!i,A=An(d.id,v),y=(v||N)&&A;let P;e[5]!==u||e[6]!==d.id?(P=B=>u.onRevealedChange(d.id,B),e[5]=u,e[6]=d.id,e[7]=P):P=e[7];const C=i&&"bg-[color-mix(in_srgb,var(--primary)_10%,var(--background))]";let R;e[8]!==C?(R=Q("relative flex w-full items-center bg-background transition-colors",C),e[8]=C,e[9]=R):R=e[9];let k;e[10]!==u||e[11]!==d?(k=()=>u.onArchive(d),e[10]=u,e[11]=d,e[12]=k):k=e[12];let z;e[13]!==u||e[14]!==d.id?(z=()=>u.onRequestDelete(d.id),e[13]=u,e[14]=d.id,e[15]=z):z=e[15];let D;e[16]!==u||e[17]!==d?(D=()=>u.onConfirmDelete(d),e[16]=u,e[17]=d,e[18]=D):D=e[18];let M,j;e[19]!==u||e[20]!==d.id?(j=()=>u.onRequestRename(d.id),M=B=>u.onRevealedChange(d.id,B),e[19]=u,e[20]=d.id,e[21]=M,e[22]=j):(M=e[21],j=e[22]);let I;e[23]!==x||e[24]!==o||e[25]!==r||e[26]!==M||e[27]!==k||e[28]!==z||e[29]!==D||e[30]!==j||e[31]!==h?(I=t.jsx(Ji,{title:h,revealed:r,confirmingDelete:o,aiRename:x,onArchive:k,onRequestDelete:z,onConfirmDelete:D,onRequestRename:j,onRevealedChange:M}),e[23]=x,e[24]=o,e[25]=r,e[26]=M,e[27]=k,e[28]=z,e[29]=D,e[30]=j,e[31]=h,e[32]=I):I=e[32];let $;e:{let B;e[33]!==l?(B=t.jsx(Ks,{project:l,size:"sm"}),e[33]=l,e[34]=B):B=e[34];let U;e[35]!==l.label?(U=t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-micro text-muted-foreground",children:l.label}),e[35]=l.label,e[36]=U):U=e[36];let O;e[37]!==x.pending||e[38]!==v||e[39]!==N||e[40]!==f?(O=x.pending?t.jsx(Z,{name:"loader-4",className:"size-3 shrink-0 animate-spin text-primary","aria-label":f("sessions.aiRename.generating")}):v||N?t.jsx(Ls,{state:v?"running":"unread",label:f(v?"sessions.sidebar.session.status.active":"sessions.sidebar.session.status.unread")}):null,e[37]=x.pending,e[38]=v,e[39]=N,e[40]=f,e[41]=O):O=e[41];let L;e[42]!==v||e[43]!==d.id||e[44]!==y||e[45]!==S?(L=y?t.jsx(Mn,{sessionId:d.id,running:v,className:"shrink-0 typography-micro"}):S?t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:S}):null,e[42]=v,e[43]=d.id,e[44]=y,e[45]=S,e[46]=L):L=e[46];let ie;e[47]!==B||e[48]!==U||e[49]!==O||e[50]!==L?(ie=t.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[B,U,O,L]}),e[47]=B,e[48]=U,e[49]=O,e[50]=L,e[51]=ie):ie=e[51];let te;e[52]!==i||e[53]!==u||e[54]!==a||e[55]!==d.id||e[56]!==h?(te=a?t.jsx(Hi,{initialTitle:h,indent:0,className:"h-[1lh] pr-0 typography-ui-label [&_button]:size-6 [&_button>svg]:size-3.5",onSubmit:re=>u.onSubmitRename(d.id,re),onCancel:u.onCancelRename}):t.jsx("span",{className:Q("block min-w-0 truncate typography-ui-label",i?"text-primary":"text-foreground"),children:h}),e[52]=i,e[53]=u,e[54]=a,e[55]=d.id,e[56]=h,e[57]=te):te=e[57];let V;e[58]!==p?(V=p?t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[t.jsx(Z,{name:"git-branch",className:"size-3.5 shrink-0"}),t.jsx("span",{className:"block min-w-0 truncate typography-micro",children:p})]}):null,e[58]=p,e[59]=V):V=e[59];let _;e[60]!==ie||e[61]!==te||e[62]!==V?(_=t.jsxs(t.Fragment,{children:[ie,te,V]}),e[60]=ie,e[61]=te,e[62]=V,e[63]=_):_=e[63];const G=_;if(a){let re;e[64]===Symbol.for("react.memo_cache_sentinel")?(re={paddingLeft:$r},e[64]=re):re=e[64];let ce;e[65]!==G?(ce=t.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-1 py-2.5 pr-3 text-left",style:re,children:G}),e[65]=G,e[66]=ce):ce=e[66],$=ce;break e}let J,H;e[67]===Symbol.for("react.memo_cache_sentinel")?(J=Q("flex min-w-0 flex-1 flex-col gap-1 py-2.5 pr-3 text-left","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"),H={paddingLeft:$r,touchAction:"manipulation"},e[67]=J,e[68]=H):(J=e[67],H=e[68]);let X;e[69]!==u||e[70]!==r||e[71]!==d?(X=()=>{if(r){u.onRevealedChange(d.id,!1);return}u.onSelect(d)},e[69]=u,e[70]=r,e[71]=d,e[72]=X):X=e[72];let ne;e[73]!==G||e[74]!==X?(ne=t.jsx("button",{type:"button",className:J,style:H,onClick:X,children:G}),e[73]=G,e[74]=X,e[75]=ne):ne=e[75],$=ne}let w;return e[76]!==i||e[77]!==r||e[78]!==I||e[79]!==$||e[80]!==P||e[81]!==R?(w=t.jsx(Hs,{actionsWidth:qi,revealed:r,onRevealedChange:P,dataActiveSession:i,contentClassName:R,actions:I,children:$}),e[76]=i,e[77]=r,e[78]=I,e[79]=$,e[80]=P,e[81]=R,e[82]=w):w=e[82],w},Bu=n=>{const e=le.c(9),{scrollRootRef:s,visibleCount:i,onReachEnd:r}=n,o=c.useRef(null),a=c.useRef(r);let u,f;e[0]!==r?(u=()=>{a.current=r},f=[r],e[0]=r,e[1]=u,e[2]=f):(u=e[1],f=e[2]),c.useEffect(u,f);let d;e[3]!==s?(d=()=>{const g=o.current;if(!g)return;const h=new IntersectionObserver(b=>{b.some($u)&&a.current()},{root:s.current??null,rootMargin:"400px 0px"});return h.observe(g),()=>h.disconnect()},e[3]=s,e[4]=d):d=e[4];let l;e[5]!==s||e[6]!==i?(l=[s,i],e[5]=s,e[6]=i,e[7]=l):l=e[7],c.useEffect(d,l);let p;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{ref:o,"aria-hidden":!0,className:"h-px w-full"}),e[8]=p):p=e[8],p},Lu=n=>{const e=le.c(35),{entries:s,visibleCount:i,onRevealMore:r,scrollRootRef:o,handlers:a}=n,{t:u}=pe();let f,d,l,p,g;if(e[0]!==s||e[1]!==a||e[2]!==u||e[3]!==i){g=s.slice(0,i),l="border-t border-border/70";let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[var(--surface-muted)] text-muted-foreground",children:t.jsx(Z,{name:"folder-6",className:"size-4"})}),e[9]=x):x=e[9];let E;e[10]!==u?(E=u("mobile.sessions.section.projects"),e[10]=u,e[11]=E):E=e[11];let v;e[12]!==E?(v=t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground",children:E}),e[12]=E,e[13]=v):v=e[13];let N;e[14]!==s.length?(N=t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:s.length}),e[14]=s.length,e[15]=N):N=e[15],e[16]!==v||e[17]!==N?(p=t.jsxs("div",{className:"flex min-h-12 w-full items-center gap-2 px-3 py-1.5",children:[x,v,N]}),e[16]=v,e[17]=N,e[18]=p):p=e[18],f="pb-2";let A;e[19]!==a?(A=y=>t.jsx(Ou,{entry:y,active:a.currentSessionId===y.session.id,revealed:a.revealedSessionId===y.session.id,confirmingDelete:a.confirmingDeleteSessionId===y.session.id,renaming:a.renamingSessionId===y.session.id,handlers:a},y.session.id),e[19]=a,e[20]=A):A=e[20],d=g.map(A),e[0]=s,e[1]=a,e[2]=u,e[3]=i,e[4]=f,e[5]=d,e[6]=l,e[7]=p,e[8]=g}else f=e[4],d=e[5],l=e[6],p=e[7],g=e[8];let h;e[21]!==s.length||e[22]!==r||e[23]!==o||e[24]!==i||e[25]!==g.length?(h=g.length<s.length?t.jsx(Bu,{scrollRootRef:o,visibleCount:i,onReachEnd:r}):null,e[21]=s.length,e[22]=r,e[23]=o,e[24]=i,e[25]=g.length,e[26]=h):h=e[26];let b;e[27]!==f||e[28]!==d||e[29]!==h?(b=t.jsxs("div",{className:f,children:[d,h]}),e[27]=f,e[28]=d,e[29]=h,e[30]=b):b=e[30];let S;return e[31]!==l||e[32]!==p||e[33]!==b?(S=t.jsxs("section",{className:l,children:[p,b]}),e[31]=l,e[32]=p,e[33]=b,e[34]=S):S=e[34],S};function $u(n){return n.isIntersecting}const Bs=40,Fu=(n,e)=>Math.min(e,Math.max(n,0)+Bs),Fr="mobile-surface-root",mn=16,_s=200,Wu=()=>{if(typeof document>"u")return null;let n=document.getElementById(Fr);return n||(n=document.createElement("div"),n.id=Fr,document.body.appendChild(n)),n},Dt=({open:n,onClose:e,title:s,subtitle:i,trailing:r,disableEscapeDismiss:o=!1,headerless:a=!1,noHeaderBorder:u=!1,ariaLabel:f,variant:d="fullscreen",dialogAlign:l="chat",children:p})=>{const{t:g}=pe(),h=c.useRef(null),[b,S]=c.useState(!1),[x,E]=c.useState(!1),v=c.useRef(null),N=c.useRef(null),A=c.useRef(e);if(c.useEffect(()=>{A.current=e},[e]),typeof document<"u"&&!h.current&&(h.current=Wu()),c.useEffect(()=>{if(!n){S(!1);return}const C=window.setTimeout(()=>S(!0),mn);return()=>window.clearTimeout(C)},[n]),c.useEffect(()=>{if(!n){E(!1);return}const C=window.setTimeout(()=>E(!0),mn+_s+80);return()=>window.clearTimeout(C)},[n]),c.useEffect(()=>{if(!n)return;const C=document.body.style.overflow;N.current=document.activeElement instanceof HTMLElement?document.activeElement:null,document.body.style.overflow="hidden";const R=()=>{const D=v.current;if(!D)return;(D.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??D).focus({preventScroll:!0})},k=window.setTimeout(R,mn),z=D=>{if(D.key==="Escape"&&!o){A.current();return}if(D.key!=="Tab")return;const M=v.current;if(!M)return;const j=Array.from(M.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(B=>!B.hasAttribute("disabled")&&B.getAttribute("aria-hidden")!=="true");if(j.length===0){D.preventDefault(),M.focus({preventScroll:!0});return}const I=j[0],$=j[j.length-1],w=document.activeElement;D.shiftKey&&w===I?(D.preventDefault(),$.focus({preventScroll:!0})):!D.shiftKey&&w===$&&(D.preventDefault(),I.focus({preventScroll:!0}))};return document.addEventListener("keydown",z),()=>{window.clearTimeout(k),document.body.style.overflow=C,document.removeEventListener("keydown",z),N.current?.focus?.({preventScroll:!0}),N.current=null}},[o,n]),!n||!h.current)return null;const y=d==="dialog",P=t.jsxs("section",{ref:v,role:"dialog","aria-modal":"true","aria-label":f,tabIndex:-1,className:Q("flex flex-col bg-background text-foreground",y?"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 oc-bottom-safe-surface fixed inset-0 z-50"),style:y?{opacity:b?1:0,transform:b?"none":"scale(0.97)",transition:`opacity ${_s}ms ease-out, transform ${_s}ms cubic-bezier(0.32, 0.72, 0, 1)`}:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:b?"none":"translateX(100%)",transition:`transform ${_s}ms cubic-bezier(0.32, 0.72, 0, 1)`},onTransitionEnd:C=>{b&&C.target===C.currentTarget&&C.propertyName==="transform"&&E(!0)},children:[a?null:t.jsxs("header",{className:Q("flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",!u&&"border-b border-border/70"),children:[t.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-ring","aria-label":g("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"close",className:"size-5"})}),t.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[s?typeof s=="string"?t.jsx("h2",{className:"truncate typography-ui-label text-foreground",children:s}):s:null,i?typeof i=="string"?t.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:i}):i:null]}),r?t.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:r}):null]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:x?t.jsx("div",{className:"h-full",style:{animation:"oc-surface-content-in 200ms ease-out"},children:p}):null}),t.jsx("style",{children:"@keyframes oc-surface-content-in { from { opacity: 0 } to { opacity: 1 } }"})]});return y?$t.createPortal(t.jsx("div",{className:"oc-keyboard-inset-surface oc-bottom-safe-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:b?1:0,paddingLeft:l==="chat"?"max(1rem, var(--oc-chat-inset-left, 0px))":"1rem",paddingRight:l==="chat"?"max(1rem, var(--oc-chat-inset-right, 0px))":"1rem",paddingTop:"max(1rem, var(--oc-safe-area-top, 0px))"},onClick:e,children:t.jsx("div",{className:"flex w-full max-w-[720px] justify-center",onClick:C=>C.stopPropagation(),children:P})}),h.current):$t.createPortal(P,h.current)},Vu=n=>(n||"").replace(/\\/g,"/").replace(/\/+$/,""),Uu=n=>{const e=le.c(36),{worktree:s,onDelete:i}=n,{t:r}=pe();let o;e[0]!==s.path?(o={id:s.path},e[0]=s.path,e[1]=o):o=e[1];const{attributes:a,listeners:u,setNodeRef:f,transform:d,transition:l,isDragging:p}=Kn(o);let g;e[2]!==d?(g=Hn.Transform.toString(d),e[2]=d,e[3]=g):g=e[3];const h=p?10:1;let b;e[4]!==g||e[5]!==h||e[6]!==l?(b={transform:g,transition:l,zIndex:h},e[4]=g,e[5]=h,e[6]=l,e[7]=b):b=e[7];const S=b,x=s.branch||s.label||s.path,E=p&&"shadow-lg shadow-black/20";let v;e[8]!==E?(v=Q("flex items-center gap-1 rounded-2xl border border-border/70 bg-[var(--surface-elevated)] px-1.5 py-1.5 transition-colors",E),e[8]=E,e[9]=v):v=e[9];let N;e[10]!==x||e[11]!==r?(N=r("mobile.projectEdit.dragWorktreeAria",{label:x}),e[10]=x,e[11]=r,e[12]=N):N=e[12];let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(zn,{className:"size-4"}),e[13]=A):A=e[13];let y;e[14]!==a||e[15]!==u||e[16]!==N?(y=t.jsx("button",{type:"button",className:"flex size-9 shrink-0 cursor-grab touch-none items-center justify-center rounded-xl text-muted-foreground/70 transition-colors hover:text-foreground active:cursor-grabbing","aria-label":N,...a,...u,children:A}),e[14]=a,e[15]=u,e[16]=N,e[17]=y):y=e[17];let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Z,{name:"node-tree",className:"size-4 shrink-0 text-muted-foreground"}),e[18]=P):P=e[18];let C;e[19]!==x?(C=t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:x}),e[19]=x,e[20]=C):C=e[20];let R;e[21]!==x||e[22]!==r?(R=r("mobile.projectEdit.deleteWorktreeAria",{label:x}),e[21]=x,e[22]=r,e[23]=R):R=e[23];let k,z;e[24]===Symbol.for("react.memo_cache_sentinel")?(k={touchAction:"manipulation"},z=t.jsx($s,{className:"size-4"}),e[24]=k,e[25]=z):(k=e[24],z=e[25]);let D;e[26]!==i||e[27]!==R?(D=t.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-destructive","aria-label":R,onClick:i,style:k,children:z}),e[26]=i,e[27]=R,e[28]=D):D=e[28];let M;return e[29]!==f||e[30]!==S||e[31]!==C||e[32]!==D||e[33]!==v||e[34]!==y?(M=t.jsxs("div",{ref:f,style:S,className:v,children:[y,P,C,D]}),e[29]=f,e[30]=S,e[31]=C,e[32]=D,e[33]=v,e[34]=y,e[35]=M):M=e[35],M},Gu=({open:n,project:e,onClose:s,onWorktreesChanged:i})=>{const{t:r}=pe(),{currentTheme:o}=fi(),a=We(w=>w.updateProjectMeta),u=We(w=>w.discoverProjectIcon),f=We(w=>w.removeProjectIcon),d=jn(w=>w.setWorktreeOrder),l=We(w=>e?w.projects.find(B=>B.id===e.id)?.iconImage??null:null),[p,g]=c.useState(""),[h,b]=c.useState(null),[S,x]=c.useState(null),[E,v]=c.useState(!1),[N,A]=c.useState([]),[y,P]=c.useState(null),C=e?.id??null;c.useEffect(()=>{!n||!e||(g(e.label),b(e.icon??null),x(e.color??null),A(e.worktrees))},[n,C]),c.useEffect(()=>{!n||!e||A(w=>{const B=e.worktrees.map(L=>L.path),U=w.map(L=>L.path);return B.length===U.length&&B.every(L=>U.includes(L))?w:e.worktrees})},[e?.worktrees]);const R=Bn(Wt($n,{activationConstraint:{distance:8}}),Wt(Ln,{coordinateGetter:Vn})),k=()=>{if(!e)return;const w=p.trim();a(e.id,{label:w||e.label,icon:h,color:S}),s()},z=()=>{!e||E||(v(!0),u(e.id).then(w=>{if(!w.ok){me.error(w.error||r("projectEditDialog.toast.failedToDiscoverIcon"));return}if(w.skipped){me.success(r("projectEditDialog.toast.customIconAlreadySet"));return}me.success(r("projectEditDialog.toast.iconDiscovered"))}).finally(()=>v(!1)))},D=()=>{e&&f(e.id).then(w=>{if(!w.ok){me.error(w.error||r("projectEditDialog.toast.failedToRemoveIcon"));return}me.success(r("projectEditDialog.toast.iconRemoved"))})},M=w=>{const{active:B,over:U}=w;if(!U||B.id===U.id||!e)return;const O=N.findIndex(V=>V.path===B.id),L=N.findIndex(V=>V.path===U.id);if(O<0||L<0)return;const ie=[...N],[te]=ie.splice(O,1);ie.splice(L,0,te),A(ie),d(e.id,ie.map(V=>Vu(V.path)))},j=S?pi[S]??null:null,I=h?mi[h]:null,$=!!l;return t.jsxs(t.Fragment,{children:[t.jsx(Dt,{open:n,onClose:s,title:r("projectEditDialog.title"),ariaLabel:r("projectEditDialog.title"),noHeaderBorder:!0,trailing:t.jsxs(be,{type:"button",variant:"default",size:"sm","aria-label":r("projectEditDialog.actions.save"),onClick:k,disabled:!p.trim(),style:{touchAction:"manipulation"},children:[t.jsx(ki,{className:"size-4"}),r("projectEditDialog.actions.save")]}),children:e?t.jsxs("div",{className:"h-full space-y-6 overflow-y-auto px-4 pb-8 pt-2",children:[t.jsx("div",{className:"flex justify-center pt-2",children:t.jsx("span",{className:"flex size-16 items-center justify-center overflow-hidden rounded-2xl bg-[var(--surface-muted)] text-muted-foreground",style:e.iconBackground?{backgroundColor:e.iconBackground}:void 0,children:$?t.jsx(hi,{project:{id:e.id,iconImage:l},options:{themeVariant:o.metadata.variant,iconColor:o.colors.surface.foreground},className:"size-full object-contain",fallback:t.jsx(xn,{className:"size-7"})}):I?t.jsx(Z,{name:I,className:"size-7",style:j?{color:j}:void 0}):t.jsx(xn,{className:"size-7",style:j?{color:j}:void 0})})}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.name")}),t.jsx(gi,{value:p,onChange:w=>g(w.target.value),placeholder:r("projectEditDialog.field.namePlaceholder"),className:"h-11"}),t.jsx("p",{className:"truncate typography-meta text-muted-foreground",title:e.path,children:e.path})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.color")}),t.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[t.jsx("button",{type:"button",onClick:()=>x(null),"aria-label":r("projectEditDialog.option.none"),className:Q("flex size-9 items-center justify-center rounded-xl border-2 transition-all",S===null?"border-foreground":"border-border/70 hover:border-border/70"),style:{touchAction:"manipulation"},children:t.jsx("span",{className:"h-0.5 w-4 rotate-45 rounded-full bg-muted-foreground/40"})}),Ko.map(w=>t.jsx("button",{type:"button",onClick:()=>x(w.key),"aria-label":w.label,title:w.label,className:Q("size-9 rounded-xl border-2 transition-all",S===w.key?"border-foreground":"border-transparent hover:border-border/70"),style:{backgroundColor:w.cssVar,touchAction:"manipulation"}},w.key))]})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("projectEditDialog.field.icon")}),t.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[t.jsx("button",{type:"button",onClick:()=>b(null),"aria-label":r("projectEditDialog.option.none"),className:Q("flex size-9 items-center justify-center rounded-xl border-2 transition-all",h===null?"border-foreground bg-[var(--surface-elevated)]":"border-border/70 hover:border-border/70"),style:{touchAction:"manipulation"},children:t.jsx("span",{className:"h-0.5 w-4 rotate-45 rounded-full bg-muted-foreground/40"})}),Ho.map(w=>t.jsx("button",{type:"button",onClick:()=>b(w.key),"aria-label":w.label,title:w.label,className:Q("flex size-9 items-center justify-center rounded-xl border-2 transition-all",h===w.key?"border-foreground bg-[var(--surface-elevated)]":"border-border/70 hover:border-border/70"),style:{touchAction:"manipulation"},children:t.jsx(Z,{name:w.Icon,className:"size-4",style:j?{color:j}:void 0})},w.key))]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[t.jsx(be,{size:"sm",variant:"outline",onClick:z,disabled:E,children:r(E?"projectEditDialog.actions.discovering":"projectEditDialog.actions.discoverFavicon")}),$?t.jsx(be,{size:"sm",variant:"outline",onClick:D,children:r("projectEditDialog.actions.removeProjectIcon")}):null]})]}),e.isGitRepo?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("label",{className:"typography-ui-label font-medium text-foreground",children:r("mobile.projectEdit.worktreesTitle")}),N.length===0?t.jsx("p",{className:"typography-meta text-muted-foreground",children:r("mobile.projectEdit.worktreesEmpty")}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:r("mobile.projectEdit.reorderHint")}),t.jsx(Fn,{sensors:R,collisionDetection:Wn,onDragEnd:M,children:t.jsx(Un,{items:N.map(w=>w.path),strategy:Gn,children:t.jsx("div",{className:"flex flex-col gap-1.5",children:N.map(w=>t.jsx(Uu,{worktree:w,onDelete:()=>P(w)},w.path))})})})]})]}):null]}):null}),e?t.jsx(Ki,{open:!!y,project:{id:e.id,path:e.path},worktree:y,onClose:()=>P(null),onDeleted:()=>{A(w=>w.filter(B=>B.path!==y?.path)),i?.()}}):null]})},Ku=32,Hu=80,qu=64,Ju=.7,sr=(n,e)=>{const s=c.useRef(e);s.current=e;const i=e.enabled??!0;c.useEffect(()=>{if(!i)return;const r=n.current;if(!r)return;const a=window.Capacitor?.getPlatform?.()==="android"?Hu:Ku,u=r.ownerDocument;let f=!1,d=!1,l=0,p=0;const g=()=>u.getSelection()?.isCollapsed===!1,h=()=>{f=!1},b=()=>{f&&g()&&h()},S=E=>{if(E.touches.length!==1||g()){f=!1;return}const v=E.touches[0],N=r.clientWidth,A=v.clientX<=a,y=v.clientX>=N-a;f=A||y,d=A,l=v.clientX,p=v.clientY},x=E=>{if(!f||(f=!1,g()))return;const v=E.changedTouches[0];if(!v)return;const N=v.clientX-l,A=v.clientY-p;Math.abs(N)<qu||Math.abs(A)>Math.abs(N)*Ju||d&&N<=0||!d&&N>=0||(d?s.current.onLeftEdgeSwipe?.():s.current.onRightEdgeSwipe?.())};return r.addEventListener("touchstart",S,{passive:!0}),r.addEventListener("touchend",x,{passive:!0}),r.addEventListener("touchcancel",h,{passive:!0}),r.addEventListener("selectstart",h),u.addEventListener("selectionchange",b),()=>{r.removeEventListener("touchstart",S),r.removeEventListener("touchend",x),r.removeEventListener("touchcancel",h),r.removeEventListener("selectstart",h),u.removeEventListener("selectionchange",b)}},[i,n])},Yu=new Set,Qu=[["manual","sessions.sidebar.header.projectSort.manual"],["a-z","sessions.sidebar.header.projectSort.aToZ"],["z-a","sessions.sidebar.header.projectSort.zToA"],["date-added","sessions.sidebar.header.projectSort.dateAdded"],["recent","sessions.sidebar.header.projectSort.recent"]],Xu=[["projects","mobile.sessions.viewMode.projects"],["timeline","mobile.sessions.viewMode.timeline"]],Zu=7,ed=3,Ms=40,td=12,sd=16,nd=(n,e)=>{const s=_e(n),i=_e(e),r=i.endsWith("/")?i:`${i}/`;return!!(s&&i&&(s===i||s.startsWith(r)))},pn=(n,e)=>n.worktrees.find(s=>_e(s.path)===e)??null,hn=(n,e,s)=>bi([n.title,n.id,kn(n),e],s),rd=n=>{const e=le.c(2),{ariaLabel:s}=n;let i;return e[0]!==s?(i=t.jsx("span",{className:"inline-block size-1.5 shrink-0 rounded-full bg-primary","aria-label":s}),e[0]=s,e[1]=i):i=e[1],i},Wr=n=>{const e=le.c(12),{onClick:s,className:i}=n,{t:r}=pe();let o;e[0]!==r?(o=r("sessions.sidebar.project.actions.newWorktree"),e[0]=r,e[1]=o):o=e[1];const a=o;let u;e[2]!==i?(u=Q("flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]",i),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==s?(f=g=>{g.stopPropagation(),s()},e[4]=s,e[5]=f):f=e[5];let d,l;e[6]===Symbol.for("react.memo_cache_sentinel")?(d={touchAction:"manipulation"},l=t.jsx(Z,{name:"node-tree",className:"size-4"}),e[6]=d,e[7]=l):(d=e[6],l=e[7]);let p;return e[8]!==a||e[9]!==u||e[10]!==f?(p=t.jsx("button",{type:"button",className:u,"aria-label":a,title:a,onClick:f,style:d,children:l}),e[8]=a,e[9]=u,e[10]=f,e[11]=p):p=e[11],p},gn=n=>{const e=le.c(10),{label:s,onClick:i,className:r}=n;let o;e[0]!==r?(o=Q("flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--interactive-hover)] hover:text-[var(--surface-foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]",r),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==i?(a=l=>{l.stopPropagation(),i()},e[2]=i,e[3]=a):a=e[3];let u,f;e[4]===Symbol.for("react.memo_cache_sentinel")?(u={touchAction:"manipulation"},f=t.jsx(Z,{name:"add",className:"size-4"}),e[4]=u,e[5]=f):(u=e[4],f=e[5]);let d;return e[6]!==s||e[7]!==o||e[8]!==a?(d=t.jsx("button",{type:"button",className:o,"aria-label":s,title:s,onClick:a,style:u,children:f}),e[6]=s,e[7]=o,e[8]=a,e[9]=d):d=e[9],d},Vr=n=>{const e=le.c(66),{session:s,active:i,indent:r,contextLabel:o,statusOnRight:a,hasChildren:u,expanded:f,onToggleChildren:d,onSelect:l,revealed:p,onRevealedChange:g,confirmingDelete:h,onArchive:b,onRequestDelete:S,onConfirmDelete:x,renaming:E,onRequestRename:v,onSubmitRename:N,onCancelRename:A}=n,y=a===void 0?!1:a,P=u===void 0?!1:u,C=f===void 0?!1:f,R=p===void 0?!1:p,k=h===void 0?!1:h,z=E===void 0?!1:E,{t:D}=pe();let M;e[0]!==s?(M=Qi(Yi(s)),e[0]=s,e[1]=M):M=e[1];const j=M;let I;e[2]!==s.title||e[3]!==D?(I=s.title?.trim()||D("mobile.sessions.untitled"),e[2]=s.title,e[3]=D,e[4]=I):I=e[4];const $=I,w=!!(g&&b),B=ji(s.id,s.directory,w&&R),U=En(s.id),O=Pn(s.id),L=!O&&U>0&&!i,ie=An(s.id,O),te=(O||L)&&ie;let V;e[5]!==B||e[6]!==C||e[7]!==P||e[8]!==r||e[9]!==O||e[10]!==d||e[11]!==L||e[12]!==y||e[13]!==D?(V=!y&&(B.pending||O||L||P&&d)?t.jsx("button",{type:"button",className:"absolute z-10 flex w-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:{left:Math.max(r-32,2),top:0,bottom:0,touchAction:"manipulation"},"aria-label":B.pending?D("sessions.aiRename.generating"):D(C?"sessions.sidebar.session.subsessions.collapse":"sessions.sidebar.session.subsessions.expand"),disabled:!P||!d,onClick:ue=>{ue.stopPropagation(),d?.()},children:B.pending?t.jsx(Z,{name:"loader-4",className:"size-3 animate-spin text-primary","aria-label":D("sessions.aiRename.generating")}):O||L?t.jsx(Ls,{state:O?"running":"unread",label:D(O?"sessions.sidebar.session.status.active":"sessions.sidebar.session.status.unread")}):t.jsx(On,{className:Q("size-[18px] transition-transform duration-150",C?"rotate-0":"-rotate-90")})}):null,e[5]=B,e[6]=C,e[7]=P,e[8]=r,e[9]=O,e[10]=d,e[11]=L,e[12]=y,e[13]=D,e[14]=V):V=e[14];let _;e[15]!==i||e[16]!==B||e[17]!==o||e[18]!==r||e[19]!==O||e[20]!==A||e[21]!==g||e[22]!==l||e[23]!==N||e[24]!==z||e[25]!==R||e[26]!==s.id||e[27]!==te||e[28]!==L||e[29]!==y||e[30]!==D||e[31]!==j||e[32]!==$?(_=z&&N&&A?t.jsx(Hi,{initialTitle:$,indent:r,onSubmit:N,onCancel:A}):t.jsx("button",{type:"button",className:Q("flex min-w-0 flex-1 items-center gap-2.5 pr-3.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",o?"min-h-10 py-1":"h-9"),style:{paddingLeft:r,touchAction:"manipulation"},onClick:()=>{if(R){g?.(!1);return}l()},children:t.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsxs("span",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:Q("block min-w-0 flex-1 truncate typography-ui-label",i?"text-primary":"text-foreground"),children:$}),y&&(B.pending||O||L)?B.pending?t.jsx(Z,{name:"loader-4",className:"size-3 shrink-0 animate-spin text-primary","aria-label":D("sessions.aiRename.generating")}):t.jsx(Ls,{state:O?"running":"unread",label:D(O?"sessions.sidebar.session.status.active":"sessions.sidebar.session.status.unread")}):null,te?t.jsx(Mn,{sessionId:s.id,running:O,className:"typography-micro"}):j?t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:j}):null]}),o?t.jsx("span",{className:"block truncate typography-micro text-muted-foreground",children:o}):null]})}),e[15]=i,e[16]=B,e[17]=o,e[18]=r,e[19]=O,e[20]=A,e[21]=g,e[22]=l,e[23]=N,e[24]=z,e[25]=R,e[26]=s.id,e[27]=te,e[28]=L,e[29]=y,e[30]=D,e[31]=j,e[32]=$,e[33]=_):_=e[33];let G;e[34]!==_||e[35]!==V?(G=t.jsxs(t.Fragment,{children:[V,_]}),e[34]=_,e[35]=V,e[36]=G):G=e[36];const J=G;if(!w){const ue=i||void 0,q=i&&"bg-[color-mix(in_srgb,var(--primary)_10%,transparent)]";let oe;e[37]!==q?(oe=Q("relative flex items-center gap-1 transition-colors",q),e[37]=q,e[38]=oe):oe=e[38];let he;e[39]!==J||e[40]!==oe?(he=t.jsx("div",{className:oe,children:J}),e[39]=J,e[40]=oe,e[41]=he):he=e[41];let ke;return e[42]!==ue||e[43]!==he?(ke=t.jsx("div",{"data-active-session":ue,className:"relative overflow-hidden",children:he}),e[42]=ue,e[43]=he,e[44]=ke):ke=e[44],ke}let H;e[45]!==g?(H=ue=>g?.(ue),e[45]=g,e[46]=H):H=e[46];const X=i&&"bg-[color-mix(in_srgb,var(--primary)_10%,var(--background))]";let ne;e[47]!==X?(ne=Q("relative flex w-full items-center gap-1 bg-background transition-colors",X),e[47]=X,e[48]=ne):ne=e[48];let re;e[49]!==B||e[50]!==k||e[51]!==b||e[52]!==x||e[53]!==S||e[54]!==v||e[55]!==g||e[56]!==R||e[57]!==$?(re=t.jsx(Ji,{title:$,revealed:R,confirmingDelete:k,aiRename:B,onArchive:b,onRequestDelete:S,onConfirmDelete:x,onRequestRename:v,onRevealedChange:g}),e[49]=B,e[50]=k,e[51]=b,e[52]=x,e[53]=S,e[54]=v,e[55]=g,e[56]=R,e[57]=$,e[58]=re):re=e[58];let ce;return e[59]!==i||e[60]!==R||e[61]!==J||e[62]!==H||e[63]!==ne||e[64]!==re?(ce=t.jsx(Hs,{actionsWidth:qi,revealed:R,onRevealedChange:H,dataActiveSession:i,contentClassName:ne,actions:re,children:J}),e[59]=i,e[60]=R,e[61]=J,e[62]=H,e[63]=ne,e[64]=re,e[65]=ce):ce=e[65],ce},id=n=>{const e=le.c(11),{indent:s,onClick:i}=n,{t:r}=pe();let o;e[0]!==s?(o={paddingLeft:s,touchAction:"manipulation"},e[0]=s,e[1]=o):o=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(On,{className:"size-4"}),e[2]=a):a=e[2];let u;e[3]!==r?(u=r("sessions.sidebar.group.showMore"),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==u?(f=t.jsx("span",{className:"typography-micro",children:u}),e[5]=u,e[6]=f):f=e[6];let d;return e[7]!==i||e[8]!==o||e[9]!==f?(d=t.jsxs("button",{type:"button",className:"flex min-h-9 w-full items-center gap-2 py-1 pr-3 text-left text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",style:o,onClick:i,children:[a,f]}),e[7]=i,e[8]=o,e[9]=f,e[10]=d):d=e[10],d},od=n=>{const e=le.c(11),{indent:s,onClick:i}=n,{t:r}=pe();let o;e[0]!==s?(o={paddingLeft:s,touchAction:"manipulation"},e[0]=s,e[1]=o):o=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kl,{className:"size-4"}),e[2]=a):a=e[2];let u;e[3]!==r?(u=r("sessions.sidebar.group.showFewer"),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==u?(f=t.jsx("span",{className:"typography-micro",children:u}),e[5]=u,e[6]=f):f=e[6];let d;return e[7]!==i||e[8]!==o||e[9]!==f?(d=t.jsxs("button",{type:"button",className:"flex min-h-9 w-full items-center gap-2 py-1 pr-3 text-left text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",style:o,onClick:i,children:[a,f]}),e[7]=i,e[8]=o,e[9]=f,e[10]=d):d=e[10],d},ad=n=>{const e=le.c(29),{worktree:s}=n,{t:i}=pe();let r;e[0]!==s.path?(r=_e(s.path),e[0]=s.path,e[1]=r):r=e[1];const o=r;let a;e[2]!==o?(a={id:o},e[2]=o,e[3]=a):a=e[3];const{attributes:u,listeners:f,setNodeRef:d,transform:l,transition:p,isDragging:g}=Kn(a),h=s.branch||s.label||s.path;let b;e[4]!==l?(b=Hn.Transform.toString(l),e[4]=l,e[5]=b):b=e[5];const S=g?10:1;let x;e[6]!==b||e[7]!==S||e[8]!==p?(x={transform:b,transition:p,zIndex:S},e[6]=b,e[7]=S,e[8]=p,e[9]=x):x=e[9];const E=g&&"shadow-lg shadow-black/20";let v;e[10]!==E?(v=Q("flex items-center gap-1 rounded-xl bg-background px-1 py-1",E),e[10]=E,e[11]=v):v=e[11];let N;e[12]!==h||e[13]!==i?(N=i("mobile.sessions.dragHandleAria",{label:h}),e[12]=h,e[13]=i,e[14]=N):N=e[14];let A;e[15]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(zn,{className:"size-4"}),e[15]=A):A=e[15];let y;e[16]!==u||e[17]!==f||e[18]!==N?(y=t.jsx("button",{type:"button",className:"flex size-8 shrink-0 cursor-grab touch-none items-center justify-center rounded-lg text-muted-foreground/70 transition-colors hover:text-foreground active:cursor-grabbing","aria-label":N,...u,...f,children:A}),e[16]=u,e[17]=f,e[18]=N,e[19]=y):y=e[19];let P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Z,{name:"git-branch",className:"size-4 shrink-0 text-muted-foreground"}),e[20]=P):P=e[20];let C;e[21]!==h?(C=t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-bold text-muted-foreground",children:h}),e[21]=h,e[22]=C):C=e[22];let R;return e[23]!==d||e[24]!==y||e[25]!==C||e[26]!==x||e[27]!==v?(R=t.jsxs("div",{ref:d,style:x,className:v,children:[y,P,C]}),e[23]=d,e[24]=y,e[25]=C,e[26]=x,e[27]=v,e[28]=R):R=e[28],R},ld=n=>{const e=le.c(61),{project:s,totalSessions:i,expanded:r,onToggleExpanded:o,onReorderWorktrees:a}=n,{t:u}=pe();let f;e[0]!==s.id?(f={id:s.id},e[0]=s.id,e[1]=f):f=e[1];const{attributes:d,listeners:l,setNodeRef:p,transform:g,transition:h,isDragging:b}=Kn(f);let S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S={activationConstraint:{distance:8}},e[2]=S):S=e[2];let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x={coordinateGetter:Vn},e[3]=x):x=e[3];const E=Bn(Wt($n,S),Wt(Ln,x)),v=s.worktrees.length>0;let N;e[4]!==a||e[5]!==s.worktrees?(N=_=>{const{active:G,over:J}=_;if(!J||G.id===J.id)return;const H=s.worktrees.map(fd),X=H.indexOf(String(G.id)),ne=H.indexOf(String(J.id));if(X<0||ne<0)return;const re=[...H],[ce]=re.splice(X,1);re.splice(ne,0,ce),a(re)},e[4]=a,e[5]=s.worktrees,e[6]=N):N=e[6];const A=N;let y;e[7]!==g?(y=Hn.Transform.toString(g),e[7]=g,e[8]=y):y=e[8];const P=b?10:1;let C;e[9]!==y||e[10]!==P||e[11]!==h?(C={transform:y,transition:h,zIndex:P},e[9]=y,e[10]=P,e[11]=h,e[12]=C):C=e[12];const R=b&&"shadow-lg shadow-black/20";let k;e[13]!==R?(k=Q("rounded-2xl border border-border/70 bg-[var(--surface-elevated)] px-1.5 py-1.5 transition-colors",R),e[13]=R,e[14]=k):k=e[14];let z;e[15]!==s.label||e[16]!==u?(z=u("mobile.sessions.dragHandleAria",{label:s.label}),e[15]=s.label,e[16]=u,e[17]=z):z=e[17];let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(zn,{className:"size-4"}),e[18]=D):D=e[18];let M;e[19]!==d||e[20]!==l||e[21]!==z?(M=t.jsx("button",{type:"button",className:"flex size-9 shrink-0 cursor-grab touch-none items-center justify-center rounded-xl text-muted-foreground/70 transition-colors hover:text-foreground active:cursor-grabbing","aria-label":z,...d,...l,children:D}),e[19]=d,e[20]=l,e[21]=z,e[22]=M):M=e[22];let j;e[23]!==r||e[24]!==s.label||e[25]!==u?(j=r?u("sessions.sidebar.group.collapseAria",{label:s.label}):u("sessions.sidebar.group.expandAria",{label:s.label}),e[23]=r,e[24]=s.label,e[25]=u,e[26]=j):j=e[26];const I=!v;let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($={touchAction:"manipulation"},e[27]=$):$=e[27];let w;e[28]!==s?(w=t.jsx(Ks,{project:s}),e[28]=s,e[29]=w):w=e[29];let B;e[30]!==s.label?(B=t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:s.label}),e[30]=s.label,e[31]=B):B=e[31];let U;e[32]!==i?(U=t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:i}),e[32]=i,e[33]=U):U=e[33];let O;e[34]!==r||e[35]!==v?(O=v?t.jsx(On,{className:Q("size-4 shrink-0 text-muted-foreground transition-transform",r&&"rotate-180")}):null,e[34]=r,e[35]=v,e[36]=O):O=e[36];let L;e[37]!==r||e[38]!==o||e[39]!==j||e[40]!==I||e[41]!==w||e[42]!==B||e[43]!==U||e[44]!==O?(L=t.jsxs("button",{type:"button",className:"flex min-h-9 min-w-0 flex-1 items-center gap-2 rounded-xl px-1 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:o,"aria-expanded":r,"aria-label":j,disabled:I,style:$,children:[w,B,U,O]}),e[37]=r,e[38]=o,e[39]=j,e[40]=I,e[41]=w,e[42]=B,e[43]=U,e[44]=O,e[45]=L):L=e[45];let ie;e[46]!==M||e[47]!==L?(ie=t.jsxs("div",{className:"flex items-center gap-1",children:[M,L]}),e[46]=M,e[47]=L,e[48]=ie):ie=e[48];let te;e[49]!==r||e[50]!==A||e[51]!==v||e[52]!==s.worktrees||e[53]!==E?(te=r&&v?t.jsx(Fn,{sensors:E,collisionDetection:Wn,onDragEnd:A,children:t.jsx(Un,{items:s.worktrees.map(md),strategy:Gn,children:t.jsx("div",{className:"mt-1 flex flex-col gap-0.5 pl-3",children:s.worktrees.map(pd)})})}):null,e[49]=r,e[50]=A,e[51]=v,e[52]=s.worktrees,e[53]=E,e[54]=te):te=e[54];let V;return e[55]!==p||e[56]!==ie||e[57]!==te||e[58]!==C||e[59]!==k?(V=t.jsxs("div",{ref:p,style:C,className:k,children:[ie,te]}),e[55]=p,e[56]=ie,e[57]=te,e[58]=C,e[59]=k,e[60]=V):V=e[60],V},Ur=({open:n,onOpenChange:e,variant:s="drawer",footer:i})=>{const{t:r}=pe(),{git:o}=Tn(),a=Fe(m=>m.ensureStatus),u=ui(),f=Nn(m=>m.activeSessions),d=n||s==="sidebar",l=c.useRef(Yu),p=ai(c.useCallback(m=>(d&&(l.current=m.ids),l.current),[d])),g=c.useRef(qo),h=li(c.useCallback(m=>(d&&(g.current=m.rankById),g.current),[d])),b=We(m=>m.projects),S=Jo(m=>m.projects),x=We(m=>m.activeProjectId),E=pt(m=>m.currentDirectory),v=Ne(m=>m.currentSessionId),N=Ne(m=>m.setCurrentSession),A=Ne(m=>m.archiveSession),y=Ne(m=>m.archiveSessions),P=Ne(m=>m.deleteSession),C=Ne(m=>m.deleteSessions),R=Ne(m=>m.updateSessionTitle),k=Ne(m=>m.openNewSessionDraft),z=We(m=>m.setActiveProject),D=We(m=>m.setActiveProjectIdOnly),M=We(m=>m.reorderProjects),j=We(m=>m.manualProjectOrder),I=Ps(m=>m.projectSortOrder),$=Ps(m=>m.setProjectSortOrder),w=Ps(m=>m.sidebarViewMode),B=Ps(m=>m.setSidebarViewMode),U=Yo(d&&w==="timeline"),O=We(m=>m.removeProject),L=Ds(m=>m.projectExpanded),ie=Ds(m=>m.worktreeExpanded),te=Ds(m=>m.setProjectExpanded),V=Ds(m=>m.setWorktreeExpanded),_=jn(m=>m.orderByProject),G=jn(m=>m.setWorktreeOrder),J=Br(m=>m.expandedParents),H=Br(m=>m.toggleParent),[X,ne]=c.useState(""),[re,ce]=c.useState(null),[ue,q]=c.useState(null),[oe,he]=c.useState(null),[ke,Y]=c.useState(null),[fe,Re]=c.useState(null),[Me,Ie]=c.useState(null),[Ye,et]=c.useState(null),[ut,De]=c.useState(0),[Oe,Ce]=c.useState(!1),[xs,Ct]=c.useState(!1),[ys,qt]=c.useState(!1),[Qs,Ue]=c.useState(null),[$e,dt]=c.useState(()=>new Map(Ne.getState().availableWorktreesByProject)),[nt,ft]=c.useState(()=>{const m=new Set;for(const[W,K]of Ne.getState().availableWorktreesByProject)K.length>0&&m.add(W);return m}),[Be,gt]=c.useState(!1),[je,Rt]=c.useState(new Set),[Jt,Qe]=c.useState(new Map),[Xs,Yt]=c.useState(Bs),vs=c.useRef(null);c.useEffect(()=>{if(!n){ne(""),gt(!1),Rt(new Set),Qe(new Map),Yt(Bs),ce(null),q(null),he(null),Y(null),Re(null),Ie(null);return}In(u)},[n]),c.useEffect(()=>{Be||Rt(new Set)},[Be]),c.useEffect(()=>{Yt(Bs)},[w]),c.useEffect(()=>{if(!n||b.length===0)return;let m=!1;return(async()=>{const K=await Promise.all(b.map(async ge=>{const de=_e(ge.path);if(!de)return null;const Le=await o.checkIsGitRepository(de).catch(()=>!1),ze=Le?await xi({id:ge.id,path:de}).catch(()=>[]):[];return[de,ze,Le]}));if(m)return;const ee=new Map,ae=new Set;for(const ge of K)ge&&(ee.set(ge[0],ge[1]),ge[2]&&ae.add(ge[0]));dt(yi(b,ee)),ft(ae)})(),()=>{m=!0}},[o,n,b,ut]);const ye=c.useMemo(()=>ll(b.map(m=>({id:m.id,label:m.label?.trim()||fn(m.path),path:_e(m.path),icon:m.icon,color:m.color,iconImage:m.iconImage,iconBackground:m.iconBackground,isGitRepo:nt.has(_e(m.path)),worktrees:Du(_[m.id],$e.get(_e(m.path))??[]),addedAt:m.addedAt,lastOpenedAt:m.lastOpenedAt})),I,j),[nt,j,I,b,_,$e]),Xe=c.useMemo(()=>{const m=new Map(u.map(ee=>[ee.id,ee])),W=f.map(ee=>{const ae=m.get(ee.id);return ae?Qo(ae,ee):ee}),K=new Set(W.map(ee=>ee.id));for(const ee of u)K.has(ee.id)||W.push(ee);return W.filter(ee=>!ee.time?.archived)},[f,u]),Ge=c.useMemo(()=>{const m=new Map;for(const W of Xe){const K=mt(W);if(!K)continue;const ee=m.get(K)??[];ee.push(W),m.set(K,ee)}return m},[Xe]),{projectSessions:Ee,chatSessions:ot}=c.useMemo(()=>cl(Xe,!1),[Xe]),Ke=jo(m=>m.spaces),Et=c.useMemo(()=>Array.from(Ke.values()),[Ke]),ws=c.useMemo(()=>new Map(Et.map(m=>[m.id,m.name||r("sessions.sidebar.grouping.spaceUnnamed")])),[Et,r]),Se=c.useMemo(()=>ul(Ee,ye.map(m=>({id:m.id,normalizedPath:m.path})),new Map(ye.map(m=>[m.path,m.worktrees])),!1,[],S,Et),[S,Ee,ye,Et]),js=c.useMemo(()=>({key:os,label:"",path:"",worktree:null,space:null,sessions:Is(ot,p,h)}),[ot,p,h]),Zs=`${os}::${os}`,Pt=c.useMemo(()=>ot.filter(m=>!mt(m)).length,[ot]),Pe=X.trim().toLowerCase(),ks=c.useRef(null);c.useEffect(()=>{if(!n)return;const m=window.requestAnimationFrame(()=>{const W=ks.current;if(!W)return;(W.querySelector('[data-active-session="true"]')??W.querySelector('[data-active-project="true"]'))?.scrollIntoView({block:"center"})});return()=>window.cancelAnimationFrame(m)},[n]);const at=c.useMemo(()=>{const m=ye.map(K=>({project:K,buckets:[],totalSessions:0,isActive:K.id===x})),W=(K,ee,ae,ge=null)=>{const de=_e(ee)||K.project.path,Le=de||"__root__";let ze=K.buckets.find(ns=>ns.key===Le);return ze||(ze={key:Le,label:(ge?ge.name||r("sessions.sidebar.grouping.spaceUnnamed"):null)||ae?.branch||fn(de),path:de,worktree:ae,space:ge,sessions:[]},K.buckets.push(ze)),ze};for(const K of m){W(K,K.project.path,null);for(const ee of K.project.worktrees)W(K,ee.path,ee)}for(const K of Ee){const ee=Se.bySessionId.get(K.id);if(!ee)continue;const ae=m.find(ze=>ze.project.id===ee.projectId);if(!ae)continue;const ge=pn(ae.project,ee.scopeDirectory),de=ee.kind==="space"&&ee.spaceId?Ke.get(ee.spaceId)??null:null;(de?W(ae,ee.scopeDirectory,null,de):ge?W(ae,ge.path,ge):W(ae,ae.project.path,null)).sessions.push(K)}for(const K of m)for(const ee of K.buckets){ee.sessions=Is(ee.sessions,p,h);for(const ae of ee.sessions)mt(ae)||(K.totalSessions+=1)}return m},[x,p,Ee,ye,h,Se,Ke,r]),Qt=_e(E),bt=m=>m.isActive?Qt===m.project.path?m.project.path:m.project.worktrees.find(K=>nd(Qt,K.path))?.path??m.project.path:null,Xt=m=>L[m.project.id]??!0,Zt=(m,W)=>ie[`${m.project.id}::${W.key}`]??!0,es=m=>{Qe(W=>{if(!W.has(m))return W;const K=new Map(W);return K.delete(m),K})},en=m=>{Qe(W=>{let K=!1;const ee=new Map(W),ae=`${m}::`;for(const ge of ee.keys())ge.startsWith(ae)&&(ee.delete(ge),K=!0);return K?ee:W})},tn=(m,W,K)=>{Qe(ee=>{const ae=new Map(ee);return ae.set(m,W+K),ae})},At=(m,W,K,ee)=>{const ae=ee?.pageSize??Zu,ge=ee?.alwaysVisibleIds,de=new Set(W.sessions.map(ve=>ve.id)),Le=new Map;for(const ve of W.sessions){const rt=mt(ve);if(rt&&de.has(rt)){const rs=Le.get(rt)??[];rs.push(ve),Le.set(rt,rs)}}const ze=W.sessions.filter(ve=>{const rt=mt(ve);return!rt||!de.has(rt)}),ns=ge?ze.filter(ve=>ge.has(ve.id)):[],on=ge?ze.filter(ve=>!ge.has(ve.id)):ze,mo=Jt.get(m)??ae,an=on.slice(0,mo),po=[...ns,...an],ur=on.length-an.length,ho=on.length>ae&&ur===0,dr=(ve,rt)=>{const rs=Le.get(ve.id)??[],ln=rs.length>0,fr=!!J[ve.id];return t.jsxs(c.Fragment,{children:[t.jsx(Vr,{session:ve,active:v===ve.id,indent:rt,hasChildren:ln,expanded:fr,onToggleChildren:ln?()=>H(ve.id):void 0,onSelect:()=>It(ve),statusOnRight:ee?.statusOnRight,revealed:ue===ve.id,onRevealedChange:is=>ss(ve.id,is),confirmingDelete:oe===ve.id,onArchive:()=>{F(ve)},onRequestDelete:()=>he(ve.id),onConfirmDelete:()=>{se(ve)},renaming:ke===ve.id,onRequestRename:()=>we(ve.id),onSubmitRename:is=>{Ze(ve.id,is)},onCancelRename:()=>Y(null)}),ln&&fr?rs.map(is=>dr(is,rt+sd)):null]},ve.id)};return t.jsxs("div",{children:[po.map(ve=>dr(ve,K)),ur>0?t.jsx(id,{indent:K,onClick:()=>tn(m,an.length,ae)}):null,ho?t.jsx(od,{indent:K,onClick:()=>es(m)}):null]})},Ss=(m,W)=>{te(m,!W),en(m)},ts=(m,W,K)=>{V(`${m}::${W}`,!K),es(`${m}::${W}`)},It=m=>{const W=kn(m)||null,K=Se.bySessionId.get(m.id),ee=K?ye.find(ae=>ae.id===K.projectId)??null:null;if(ee){D(ee.id),te(ee.id,!0);const ae=pn(ee,K?.scopeDirectory??"");ae&&V(`${ee.id}::${_e(ae.path)}`,!0)}N(m.id,W),e(!1)},ss=(m,W)=>{q(W?m:null),he(null),Re(null),Ie(null)},xt=(m,W)=>{Re(W?m:null),Ie(null),q(null),he(null)},T=(m,W)=>(q(null),he(null),hl(m,W,gl(W.id,bl(Ge,W.id),m==="delete"),{archiveSession:A,archiveSessions:y,deleteSession:P,deleteSessions:C},r)),F=m=>T("archive",m),se=m=>T("delete",m),we=m=>{q(null),he(null),Y(m)},Ze=async(m,W)=>{Y(null);try{await R(m,W)}catch{me.error(r("mobile.sessions.renameError"))}},Ns=()=>{k(),e(!1)},yt=m=>{Ue(m),D(m),qt(!0)},sn=Bn(Wt($n,{activationConstraint:{distance:8}}),Wt(Ln,{coordinateGetter:Vn})),to=m=>{$(m),pr({sidebarProjectSortOrder:m}),m!=="manual"&>(!1)},so=m=>{B(m),pr({sidebarViewMode:m}),m==="timeline"&>(!1)},no=m=>{const{active:W,over:K}=m;if(!K||W.id===K.id)return;const ee=ye.findIndex(ge=>ge.id===W.id),ae=ye.findIndex(ge=>ge.id===K.id);ee<0||ae<0||M(ee,ae)},ro=m=>{Rt(W=>{const K=new Set(W);return K.has(m)?K.delete(m):K.add(m),K})},io=c.useCallback(m=>{const W=kn(m);if(Xo(W))return r("mobile.sessions.section.chats");const K=Se.bySessionId.get(m.id),ee=K?ye.find(de=>de.id===K.projectId)??null:null;if(!ee)return fn(W)||W;const ae=K?.kind==="space"&&K.spaceId?Ke.get(K.spaceId):void 0;if(ae)return`${ee.label} · ${ae.name||r("sessions.sidebar.grouping.spaceUnnamed")}`;const ge=pn(ee,K?.scopeDirectory??"");return ge?.branch?`${ee.label} · ${ge.branch}`:ee.label},[ye,Se,Ke,r]),oo=m=>{z(m.id),e(!1)},rr=m=>{D(m.id),k({selectedProjectId:m.id,directoryOverride:m.path}),e(!1)},ao=c.useMemo(()=>Pe?at.filter(m=>bi([m.project.label,m.project.path],Pe)?!0:m.buckets.some(W=>W.sessions.some(K=>hn(K,m.project.label,Pe)))):at,[Pe,at]),Cs=c.useMemo(()=>Pe?Is(Xe.filter(m=>{if(mt(m))return!1;const W=Se.bySessionId.get(m.id),K=W?ye.find(ee=>ee.id===W.projectId)??null:null;return hn(m,K?.label??"",Pe)}),p,h):[],[Pe,p,ye,h,Se,Xe]),Rs=c.useMemo(()=>Pe?Zo(ye,Pe,m=>[m.label,m.path]):[],[Pe,ye]),tt=w==="timeline"&&!Pe&&!Be;c.useEffect(()=>{if(!(!tt||!o))for(const m of ye){const W=_e(m.path);W&&ea(()=>a(W,o))}},[a,o,ye,tt]);const nn=c.useMemo(()=>{const m=new Map;if(!tt)return m;const W=dl({sessions:Ee,projects:ye.map(K=>({id:K.id,normalizedPath:K.path,label:K.label})),ownerBySessionId:Se.bySessionId,availableWorktreesByProject:new Map(ye.map(K=>[K.path,K.worktrees])),gitBranches:U,homeDirectory:null,hideBranchMatchingProjectLabel:!1,spaceLabelById:ws});for(const K of Ee){if(mt(K))continue;const ee=W.get(K.id),ae=ee?ye.find(ge=>ge.id===ee.projectId):null;!ae||!ee||m.set(K.id,{project:ae,branch:ee.branchLabel})}return m},[U,Ee,ye,Se,ws,tt]),rn=c.useMemo(()=>{if(!tt)return[];const m=Ee.filter(W=>!mt(W)&&nn.has(W.id));return Is(m,p,h).flatMap(W=>{const K=nn.get(W.id);return K?[{session:W,project:K.project,branch:K.branch}]:[]})},[p,Ee,h,tt,nn]),lo=c.useCallback(()=>{Yt(m=>Fu(m,rn.length))},[rn.length]),co={currentSessionId:v,revealedSessionId:ue,confirmingDeleteSessionId:oe,renamingSessionId:ke,onSelect:It,onRevealedChange:ss,onArchive:m=>{F(m)},onRequestDelete:he,onConfirmDelete:m=>{se(m)},onRequestRename:we,onSubmitRename:(m,W)=>{Ze(m,W)},onCancelRename:()=>Y(null)},uo=Pe&&Cs.length===0&&Rs.length===0,fo=!Pe&&!tt&&ye.length>1&&I==="manual",ir=!Be&&!Pe&&ye.length>0?t.jsx(be,{type:"button",variant:"chip",size:"sm","aria-label":r("sessions.sidebar.header.displayMode.label"),title:r("sessions.sidebar.header.displayMode.label"),onClick:()=>Ce(!0),style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"equalizer-2",className:"size-4"})}):null,or=fo?t.jsx(be,{type:"button",variant:"chip",size:"sm","aria-label":r(Be?"mobile.sessions.doneEditing":"mobile.sessions.editOrder"),"aria-pressed":Be,onClick:()=>gt(m=>!m),style:{touchAction:"manipulation"},children:Be?t.jsx(ki,{className:"size-4"}):t.jsx(yn,{className:"size-4"})}):null,ar=!Be&&ye.length>0?t.jsxs(be,{type:"button",variant:"default",size:"sm","aria-label":r("mobile.sessions.newChat"),onClick:Ns,style:{touchAction:"manipulation"},children:[t.jsx(Gl,{className:"size-4"}),r("mobile.sessions.newChat")]}):null,lr=Be?null:t.jsx(be,{type:"button",variant:"chip",size:"sm","aria-label":r("sessions.sidebar.header.actions.addProject"),title:r("sessions.sidebar.header.actions.addProject"),onClick:()=>Ct(!0),style:{touchAction:"manipulation"},children:t.jsx(jr,{className:"size-4"})}),Es=ar||lr||ir||or?t.jsxs(t.Fragment,{children:[lr,ir,or,ar]}):null,cr=t.jsxs("div",{ref:ks,className:"flex min-h-0 flex-1 flex-col",children:[t.jsxs(qs,{ref:vs,className:"min-h-0 flex-1 overflow-y-auto pb-4",children:[t.jsx("div",{className:Q("px-4 pb-2 pt-1",Be&&"hidden"),children:t.jsx(fl,{value:X,onSearch:ne,active:n||s==="sidebar",mobile:!0,placeholder:r("mobile.sessions.search.placeholder"),clearLabel:r("mobile.sessions.clearSearchAria")})}),ye.length===0&&ot.length===0?t.jsx(Hr,{title:r("mobile.sessions.empty.noProjectsTitle"),description:r("mobile.sessions.empty.noProjectsDescription"),action:t.jsxs("button",{type:"button",className:"flex items-center justify-center gap-2 rounded-2xl bg-primary px-5 py-3 typography-ui-label text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>Ct(!0),children:[t.jsx(jr,{className:"size-4"}),r("sessions.sidebar.header.actions.addProject")]})}):uo?t.jsx(Hr,{title:r("mobile.sessions.empty.searchTitle"),description:r("mobile.sessions.empty.searchDescription")}):Pe&&!Be?t.jsxs("div",{className:"flex flex-col gap-3 px-3 pt-2",children:[Cs.length>0?t.jsxs("section",{children:[t.jsxs("div",{className:"flex items-center justify-between px-1 pb-1.5",children:[t.jsx("span",{className:"typography-micro font-semibold uppercase tracking-wider text-muted-foreground",children:r("mobile.sessions.search.section.sessions")}),t.jsx("span",{className:"typography-micro text-muted-foreground tabular-nums",children:Cs.length})]}),t.jsx("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-[var(--surface-elevated)]",children:Cs.map((m,W)=>t.jsx("div",{className:Q(W>0&&"border-t border-border/70"),children:t.jsx(Vr,{session:m,active:v===m.id,indent:12,contextLabel:io(m),onSelect:()=>It(m)})},m.id))})]}):null,Rs.length>0?t.jsxs("section",{children:[t.jsxs("div",{className:"flex items-center justify-between px-1 pb-1.5",children:[t.jsx("span",{className:"typography-micro font-semibold uppercase tracking-wider text-muted-foreground",children:r("mobile.sessions.search.section.projects")}),t.jsx("span",{className:"typography-micro text-muted-foreground tabular-nums",children:Rs.length})]}),t.jsx("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-[var(--surface-elevated)]",children:Rs.map((m,W)=>t.jsxs("div",{className:Q("flex items-center",W>0&&"border-t border-border/70"),children:[t.jsxs("button",{type:"button",className:"flex min-h-12 min-w-0 flex-1 items-center gap-3 px-3 py-1.5 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>oo(m),style:{touchAction:"manipulation"},children:[t.jsx(Ks,{project:m}),t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:m.label})]}),m.isGitRepo?t.jsx(Wr,{onClick:()=>yt(m.id)}):null,t.jsx(gn,{className:"mr-2",label:r("mobile.sessions.newSessionInProjectAria",{label:m.label}),onClick:()=>rr(m)})]},m.id))})]}):null]}):Be?t.jsxs("div",{className:"flex flex-col gap-2 px-3 py-2",children:[t.jsx("p",{className:"px-1 typography-micro text-muted-foreground",children:r("mobile.sessions.editOrderHint")}),t.jsx(Fn,{sensors:sn,collisionDetection:Wn,onDragEnd:no,children:t.jsx(Un,{items:ye.map(m=>m.id),strategy:Gn,children:t.jsx("div",{className:"flex flex-col gap-1.5",children:ye.map(m=>{const W=at.find(K=>K.project.id===m.id);return t.jsx(ld,{project:m,totalSessions:W?.totalSessions??0,expanded:je.has(m.id),onToggleExpanded:()=>ro(m.id),onReorderWorktrees:K=>G(m.id,K)},m.id)})})})})]}):t.jsxs("div",{className:"flex flex-col",children:[(()=>{const m=L[os]??!0,W=r("mobile.sessions.section.chats");return t.jsxs("section",{children:[t.jsxs("div",{className:"flex min-h-12 w-full items-center",children:[t.jsxs("button",{type:"button",className:"flex min-h-12 min-w-0 flex-1 items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>{if(fe){xt(fe,!1);return}Ss(os,m)},"aria-expanded":m,"aria-label":m?r("sessions.sidebar.group.collapseAria",{label:W}):r("sessions.sidebar.group.expandAria",{label:W}),style:{touchAction:"manipulation"},children:[t.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[var(--surface-muted)] text-muted-foreground",children:t.jsx(Z,{name:"chat-4",className:"size-4"})}),t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground",children:W}),t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:Pt})]}),Be?null:t.jsx(gn,{className:"mr-2",label:r("mobile.sessions.newChat"),onClick:Ns})]}),m?t.jsx("div",{className:"pb-2",children:js.sessions.length>0?At(Zs,js,tt?td:Ms,tt?{pageSize:ed,alwaysVisibleIds:p,statusOnRight:!0}:void 0):t.jsx("p",{className:"px-3 pb-1 typography-micro text-muted-foreground",style:{paddingLeft:Ms},children:r("sessions.sidebar.activity.chatsEmpty")})}):null]})})(),tt?t.jsx(Lu,{entries:rn,visibleCount:Xs,onRevealMore:lo,scrollRootRef:vs,handlers:co}):null,tt?null:ao.map(m=>{const W=Xt(m),K=Pe?m.buckets.filter(ae=>ae.sessions.some(ge=>hn(ge,m.project.label,Pe))):m.buckets,ee=bt(m);return t.jsxs("section",{className:"border-t border-border/70",children:[t.jsx(Hs,{actionsWidth:96,revealed:fe===`project:${m.project.id}`,onRevealedChange:ae=>xt(`project:${m.project.id}`,ae),actions:t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",tabIndex:fe===`project:${m.project.id}`?0:-1,className:Q("flex flex-1 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-destructive",Me===m.project.id?"rounded-lg bg-destructive text-destructive-foreground":"text-[var(--status-error)] active:opacity-80"),"aria-label":Me===m.project.id?r("mobile.sessions.confirmRemoveProjectAria",{label:m.project.label}):r("mobile.sessions.removeProjectAria",{label:m.project.label}),onClick:()=>{if(Me===m.project.id){Re(null),Ie(null),O(m.project.id),me.success(r("mobile.sessions.toast.projectRemoved",{label:m.project.label}));return}Ie(m.project.id)},style:{touchAction:"manipulation"},children:t.jsx($s,{className:"size-[18px]"})}),t.jsx("button",{type:"button",tabIndex:fe===`project:${m.project.id}`?0:-1,className:"flex flex-1 items-center justify-center text-muted-foreground transition-colors active:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","aria-label":r("mobile.sessions.editProjectAria",{label:m.project.label}),onClick:()=>{Re(null),ce(m.project.id)},style:{touchAction:"manipulation"},children:t.jsx(yn,{className:"size-[18px]"})})]}),children:t.jsxs("div",{"data-active-project":m.isActive||void 0,className:"flex min-h-12 w-full items-center",children:[t.jsxs("button",{type:"button",className:"flex min-h-12 min-w-0 flex-1 items-center gap-2 px-3 py-1.5 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>{if(fe){xt(fe,!1);return}Ss(m.project.id,W)},"aria-expanded":W,"aria-label":W?r("sessions.sidebar.group.collapseAria",{label:m.project.label}):r("sessions.sidebar.group.expandAria",{label:m.project.label}),style:{touchAction:"manipulation"},children:[t.jsx(Ks,{project:m.project}),t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label font-semibold text-foreground",children:m.project.label})]}),m.project.isGitRepo?t.jsx(Wr,{onClick:()=>yt(m.project.id)}):null,t.jsx(gn,{className:"mr-2",label:r("mobile.sessions.newSessionInProjectAria",{label:m.project.label}),onClick:()=>rr(m.project)})]})}),W?t.jsx("div",{className:"pb-2",children:(()=>{const ae=K.find(de=>de.worktree===null&&de.space===null),ge=K.filter(de=>de!==ae);return t.jsxs(t.Fragment,{children:[ae&&ae.sessions.length>0?At(`${m.project.id}::${ae.key}`,ae,Ms):null,ge.map(de=>{const Le=Zt(m,de),ze=ee===de.path;return t.jsxs("div",{children:[t.jsx(Hs,{actionsWidth:de.space?0:48,revealed:fe===`wt:${de.key}`,onRevealedChange:ns=>xt(`wt:${de.key}`,ns),actions:de.worktree?t.jsx("button",{type:"button",tabIndex:fe===`wt:${de.key}`?0:-1,className:"flex flex-1 items-center justify-center text-[var(--status-error)] transition-colors active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-destructive","aria-label":r("mobile.projectEdit.deleteWorktreeAria",{label:de.label}),onClick:()=>{Re(null),de.worktree&&et({project:m.project,worktree:de.worktree})},style:{touchAction:"manipulation"},children:t.jsx($s,{className:"size-[18px]"})}):null,children:t.jsxs("button",{type:"button",className:"flex min-h-10 w-full items-center gap-2 px-3 py-1 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>{if(fe){xt(fe,!1);return}ts(m.project.id,de.key,Le)},"aria-expanded":Le,"aria-label":Le?r("sessions.sidebar.group.collapseAria",{label:de.label}):r("sessions.sidebar.group.expandAria",{label:de.label}),style:{touchAction:"manipulation"},children:[t.jsx(Z,{name:de.space?"box-3":"git-branch",className:Q("size-4 shrink-0",ze?"text-primary":"text-muted-foreground")}),t.jsx("span",{className:Q("block min-w-0 flex-1 truncate typography-ui-label font-bold",ze?"text-foreground":"text-muted-foreground"),children:de.label}),ze?t.jsx(rd,{ariaLabel:r("mobile.sessions.activeWorktreeAria")}):null,t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground tabular-nums",children:de.sessions.length})]})}),Le?At(`${m.project.id}::${de.key}`,de,Ms):null]},de.key)})]})})()}):null]},m.project.id)})]})]}),i?t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-t border-border/70 px-2 pt-1.5",style:{paddingBottom:"calc(0.375rem + var(--oc-safe-area-bottom, 0px))"},children:[i.instanceLabel&&i.onOpenInstances?t.jsxs(be,{type:"button",variant:"info",size:"lg",className:"min-w-0 shrink justify-start",onClick:i.onOpenInstances,"aria-label":r("mobile.menu.instances"),style:{touchAction:"manipulation"},children:[t.jsx(Z,{name:"server",className:"size-[18px]"}),t.jsx("span",{className:"block min-w-0 truncate",children:i.instanceLabel})]}):t.jsx("div",{className:"min-w-0 flex-1"}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.onOpenUpdate?t.jsxs(be,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:i.onOpenUpdate,"aria-label":r("mobile.menu.update"),title:r("mobile.menu.update"),style:{touchAction:"manipulation"},children:[t.jsx(Z,{name:"download",className:"size-5"}),t.jsx("span",{className:"absolute right-2 top-2 inline-flex size-2 rounded-full bg-primary","aria-hidden":!0})]}):null,t.jsx(be,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:i.onOpenUsage,"aria-label":r("usageStats.openAction"),title:r("usageStats.openAction"),style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"bar-chart",className:"size-5"})}),t.jsx(be,{type:"button",variant:"default",size:"lg",className:"w-10 px-0",onClick:i.onOpenSettings,"aria-label":r("mobile.menu.settings"),title:r("mobile.menu.settings"),style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"settings-3",className:"size-5"})})]})]}):null,t.jsx(ml,{open:xs,onOpenChange:Ct}),t.jsx(pl,{open:ys,onOpenChange:m=>{qt(m),m||Ue(null)},onWorktreeCreated:(m,W)=>{W?.sessionId?N(W.sessionId,m):k({selectedProjectId:Qs,directoryOverride:m,preserveDirectoryOverride:!0}),e(!1)}}),t.jsx(Gu,{open:re!==null,project:ye.find(m=>m.id===re)??null,onClose:()=>ce(null),onWorktreesChanged:()=>De(m=>m+1)}),t.jsx(di,{open:Oe,onClose:()=>Ce(!1),title:r("sessions.sidebar.header.displayMode.label"),children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"px-3 pb-1 pt-1 typography-micro font-semibold uppercase tracking-wider text-muted-foreground",children:r("mobile.sessions.viewMode.label")}),Xu.map(([m,W])=>t.jsxs("button",{type:"button",className:Q("flex min-h-11 w-full items-center justify-between rounded-lg px-3 text-left transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",w===m?"text-primary":"text-foreground"),onClick:()=>{so(m),Ce(!1)},style:{touchAction:"manipulation"},children:[t.jsx("span",{className:"typography-ui-label",children:r(W)}),w===m?t.jsx(Z,{name:"check",className:"size-4"}):null]},m)),w==="timeline"?null:t.jsx("span",{className:"px-3 pb-1 pt-3 typography-micro font-semibold uppercase tracking-wider text-muted-foreground",children:r("sessions.sidebar.header.actions.sortProjects")}),w==="timeline"?null:Qu.map(([m,W])=>t.jsxs("button",{type:"button",className:Q("flex min-h-11 w-full items-center justify-between rounded-lg px-3 text-left transition-colors active:bg-interactive-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",I===m?"text-primary":"text-foreground"),onClick:()=>{to(m),Ce(!1)},style:{touchAction:"manipulation"},children:[t.jsx("span",{className:"typography-ui-label",children:r(W)}),I===m?t.jsx(Z,{name:"check",className:"size-4"}):null]},m))]})}),Ye?t.jsx(Ki,{open:!0,project:{id:Ye.project.id,path:Ye.project.path},worktree:Ye.worktree,onClose:()=>et(null),onDeleted:()=>De(m=>m+1)}):null]});return s==="sidebar"?n?t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center justify-between gap-2 border-b border-border/70 px-4",children:[t.jsx("h2",{className:"truncate typography-ui-label font-semibold text-foreground",children:r("mobile.sessions.sheet.title")}),Es?t.jsx("div",{className:"flex shrink-0 items-center gap-2",children:Es}):null]}),cr]}):null:t.jsxs(dd,{open:n,onClose:()=>e(!1),onSwipeClose:()=>{if(ue||fe){q(null),Re(null),he(null),Ie(null);return}e(!1)},ariaLabel:r("mobile.sessions.sheet.title"),children:[t.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",children:[t.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-ring","aria-label":r("mobile.surface.closeAria"),onClick:()=>e(!1),style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"close",className:"size-5"})}),t.jsx("h2",{className:"min-w-0 flex-1 truncate px-1 typography-ui-label font-semibold text-foreground",children:r("mobile.sessions.sheet.title")}),Es?t.jsx("div",{className:"flex shrink-0 items-center gap-2",children:Es}):null]}),cr]})},Gr="mobile-surface-root",cd=16,Kr=320,ud="cubic-bezier(0.22, 1, 0.36, 1)",dd=({open:n,onClose:e,onSwipeClose:s,ariaLabel:i,children:r})=>{const o=c.useRef(null),a=c.useRef(null),[u,f]=c.useState(!1),[d,l]=c.useState(n),p=c.useRef(e);c.useEffect(()=>{p.current=e},[e]);const g=c.useRef(s);if(c.useEffect(()=>{g.current=s},[s]),sr(a,{enabled:n,onRightEdgeSwipe:()=>(g.current??p.current)()}),typeof document<"u"&&!o.current){let h=document.getElementById(Gr);h||(h=document.createElement("div"),h.id=Gr,document.body.appendChild(h)),o.current=h}return c.useEffect(()=>{if(n){l(!0);const b=window.setTimeout(()=>f(!0),cd);return()=>window.clearTimeout(b)}f(!1);const h=window.setTimeout(()=>l(!1),Kr+40);return()=>window.clearTimeout(h)},[n]),c.useEffect(()=>{if(!n)return;const h=document.body.style.overflow;document.body.style.overflow="hidden";const b=S=>{S.key==="Escape"&&p.current()};return document.addEventListener("keydown",b),()=>{document.body.style.overflow=h,document.removeEventListener("keydown",b)}},[n]),o.current?$t.createPortal(t.jsx("section",{ref:a,role:"dialog","aria-modal":"true","aria-label":i,"aria-hidden":!n,className:"oc-keyboard-inset-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:u?"none":"translateX(-100%)",transition:`transform ${Kr}ms ${ud}`,visibility:d?"visible":"hidden",pointerEvents:n?"auto":"none"},children:t.jsx("div",{className:"flex h-full min-h-0 flex-col",children:r})}),o.current):null},Hr=n=>{const e=le.c(10),{title:s,description:i,action:r}=n;let o;e[0]!==s?(o=t.jsx("p",{className:"typography-ui-label text-foreground",children:s}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=i?t.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[2]=i,e[3]=a):a=e[3];let u;e[4]!==r?(u=r?t.jsx("div",{className:"pt-2",children:r}):null,e[4]=r,e[5]=u):u=e[5];let f;return e[6]!==o||e[7]!==a||e[8]!==u?(f=t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[o,a,u]}),e[6]=o,e[7]=a,e[8]=u,e[9]=f):f=e[9],f};function fd(n){return _e(n.path)}function md(n){return _e(n.path)}function pd(n){return t.jsx(ad,{worktree:n},_e(n.path))}const hd=(n,e)=>{if(!n)return e("mcpDropdown.status.unknown");const s=n.status;switch(s.status){case"connected":return e("mcpDropdown.status.connected");case"failed":return e("mcpDropdown.status.failed",{error:s.error||e("mcpDropdown.status.unknownError")});case"needs_auth":return e("mcpDropdown.status.needsAuth");default:return s.status}},gd=n=>{switch(n?.status.status){case"connected":return"success";case"failed":return"error";case"needs_auth":return"warning";default:return"default"}},bd=({active:n,className:e,headerAction:s,listClassName:i,hideHeader:r=!1,mobileListDensity:o=!1})=>{const{t:a}=pe(),f=pt(y=>y.currentDirectory)??null,d=cs(y=>y.getStatusForDirectory(f)),l=cs(y=>y.refresh),p=cs(y=>y.connect),g=cs(y=>y.disconnect),h=Bt(y=>y.mcpServers),b=Bt(y=>y.loadMcpConfigs),[S,x]=c.useState(!1),[E,v]=c.useState(null);c.useEffect(()=>{l({directory:f,silent:!0})},[l,f]),c.useEffect(()=>{b({force:!0})},[b]),c.useEffect(()=>{n&&Promise.all([l({directory:f,silent:!0}),b({force:!0})])},[n,l,f,b]);const N=c.useMemo(()=>{const y=new Set(Object.keys(d));for(const P of h)P?.name&&y.add(P.name);return Array.from(y).sort((P,C)=>P.localeCompare(C))},[h,d]),A=c.useCallback(y=>{if(y?.preventDefault(),S)return;x(!0);const P=new Promise(C=>setTimeout(C,500));Promise.all([l({directory:f}),P]).finally(()=>{x(!1)})},[S,l,f]);return t.jsxs("div",{className:Q("w-full",e),children:[r?null:t.jsx("div",{className:"border-b border-[var(--interactive-border)]",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2.5",children:[t.jsxs("div",{className:"min-w-0 flex items-baseline gap-2",children:[t.jsx("div",{className:"typography-ui-header font-semibold text-foreground",children:a("mcpDropdown.title")}),f&&t.jsx("div",{className:"truncate typography-micro text-muted-foreground",children:f.split("/").pop()||f})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s,t.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",disabled:S,onClick:A,"aria-label":a("mcpDropdown.actions.refreshAria"),children:t.jsx(Z,{name:"refresh",className:Q("h-4 w-4",S&&"animate-spin")})})]})]})}),t.jsx("div",{className:Q("max-h-64 overflow-y-auto",o?"space-y-1 py-3":"px-3 py-2.5",i),children:t.jsxs("div",{className:Q(!o&&N.length>0&&"rounded-xl bg-[var(--surface-muted)] p-1.5"),children:[N.map(y=>{const P=d[y],C=gd(P),R=P?.status.status==="connected",k=E===y,z=hd(P,a);return t.jsxs("div",{className:Q("flex items-center justify-between rounded-lg hover:bg-interactive-hover/50",o?"gap-3 px-4 py-3":"gap-2 px-2.5 py-2"),children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsxs(ta,{children:[t.jsx(sa,{asChild:!0,children:t.jsx("span",{className:Q("rounded-full flex-shrink-0",o?"h-2.5 w-2.5":"h-2 w-2",C==="success"&&"bg-status-success",C==="error"&&"bg-status-error",C==="warning"&&"bg-status-warning",C==="default"&&"bg-muted-foreground/40"),"aria-label":z})}),t.jsx(na,{side:"left",children:t.jsx("p",{children:z})})]}),t.jsx("span",{className:Q("truncate",o?"text-[17px] leading-6 font-medium":"typography-ui-label"),children:y})]})}),t.jsx(ra,{checked:R,disabled:k,className:"data-[checked]:bg-status-info",onCheckedChange:async D=>{v(y);try{D?await p(y,f):await g(y,f)}catch(M){ec.error(M instanceof Error?M.message:a("mcpDropdown.status.unknownError"))}finally{v(null)}}})]},y)}),N.length===0&&t.jsx("div",{className:"px-4 py-5 typography-ui-label text-muted-foreground text-center",children:a("mcpDropdown.empty.configureInConfig")})]})})]})},qr={status:"loading"},Tt={type:"list"},xd=n=>(n||"").replace(/\\/g,"/").replace(/\/+$/g,""),yd=n=>{const e=n.index?.trim();return!!(e&&e!=="?")},vd=n=>{const e=n.working_dir?.trim(),s=n.index?.trim();return!!(e||s==="?")},Jr=(n,e)=>e?`${n}\0staged`:n,wd=n=>{const e=le.c(8),s=Dn()??null;let i;e[0]!==s?(i=xd(s),e[0]=s,e[1]=i):i=e[1];const r=i,o=n.visible??!0;let a;e[2]!==o?(a={enabled:o},e[2]=o,e[3]=a):a=e[3];const u=ia(r||null,a);let f;return e[4]!==n||e[5]!==u||e[6]!==r?(f=t.jsx(jd,{...n,rootDirectory:r,repository:u}),e[4]=n,e[5]=u,e[6]=r,e[7]=f):f=e[7],f},jd=({rootDirectory:n,repository:e,onClose:s,initialDiff:i,visible:r=!0})=>{const{t:o}=pe(),{git:a}=Tn(),{rootIsGitRepo:u,gitDirectory:f,nestedRepos:d}=e,l=f??n,p=oa(l||null),g=aa(l||null),h=ci(l||null),b=la(l||null),S=Fe(T=>T.setActiveDirectory),x=Fe(T=>T.ensureAll),E=Fe(T=>T.ensureNestedRepos),v=Fe(T=>T.selectNestedRepo),N=Fe(T=>T.fetchStatus),A=Fe(T=>T.fetchBranches),y=Fe(T=>T.prefetchDiffs),P=Fe(T=>T.getDiff),C=Fe(T=>T.setDiff),R=Fe(T=>T.runtimeKey),k=JSON.stringify([R,l]),z=c.useRef(k);z.current=k;const[D,M]=c.useState(()=>({ownerKey:k,mode:"working",route:i?.path?{type:"diff",path:i.path,staged:i.staged}:Tt})),j=D.ownerKey===k?D.mode:"working",I=D.ownerKey===k?D.route:Tt,[$,w]=c.useState(!1),B=c.useCallback(T=>{M({ownerKey:k,mode:T,route:Tt}),w(!1)},[k]),U=c.useCallback(T=>{M(F=>({ownerKey:k,mode:F.ownerKey===k?F.mode:"working",route:T}))},[k]);c.useEffect(()=>{M(T=>T.ownerKey===k?T:{ownerKey:k,mode:"working",route:Tt}),w(!1)},[k]),c.useEffect(()=>{r||w(!1)},[r]),c.useEffect(()=>{i?.path&&M({ownerKey:z.current,mode:"working",route:{type:"diff",path:i.path,staged:i.staged}})},[i]);const[O,L]=c.useState(null),[ie,te]=c.useState(null),[V,_]=c.useState(""),[G,J]=c.useState(new Set),[H,X]=c.useState(!1),[ne,re]=c.useState(!1),[ce,ue]=c.useState([]),[q,oe]=c.useState([]),[he,ke]=c.useState([]),[Y,fe]=c.useState(null),[Re,Me]=c.useState(null),[Ie,Ye]=c.useState(null),[et,ut]=c.useState(0),[De,Oe]=c.useState(null),Ce=p?.current??null,xs=p?.tracking?.trim().split("/")[0],Ct=(xs&&g?.defaultBranches?.[xs])??g?.defaultBranches?.origin??null,ys=gc(Ce,Ct),qt=h===!1||pc(Ce,Ct,p!==null,g!==null),Qs=rc(T=>T.setOverride),Ue=ic(l||null,Ce,r&&j==="branch"&&ys),$e=oc(l||null,Ce,r&&j==="commit"&&h===!0),dt=$e.selectedCommit?.hash??null,nt=ac(l||null,Ce,r&&j==="pr"&&h===!0),ft=nt.selectedSource,Be=c.useMemo(()=>j==="pr"?ft:j==="branch"&&Ce&&Ue.base?{kind:"branch",baseRef:Ue.base,headRef:Ce}:j==="commit"&&dt?{kind:"commit",hash:dt}:null,[Ue.base,Ce,j,dt,ft]),gt=j==="branch"?Ue.revision:"",je=fc(l||null,Be,r&&h===!0,gt),{fetchDiff:Rt}=je,Jt=c.useMemo(()=>je.files?[...je.files].sort((T,F)=>T.path.localeCompare(F.path)):null,[je.files]),Qe=I.type==="comparison"&&I.sourceKey===je.key?I.path:null,[Xs,Yt]=c.useState(0),vs=c.useCallback(async T=>{try{const{diff:F}=await Rt(T),se={original:"",modified:"",isBinary:lc(F)};return se.isBinary||(se.fileDiff=cc(T,F)),{status:"ready",diff:se}}catch(F){return{status:"error",message:F instanceof Error?F.message:o("diffView.state.failedToLoadDiff")}}},[Rt,o]),ye=mc(je.files?j==="pr"?JSON.stringify([je.key,je.revision]):je.key:null,r&&Qe?Qe:"",r?vs:null,qr,JSON.stringify([gt,j==="pr"?je.revision:0,Xs])),Xe=Qe?ye.get(Qe)??qr:null;c.useEffect(()=>{j==="branch"&&qt&&B("working")},[qt,B,j]),c.useEffect(()=>{M(T=>T.ownerKey===k&&T.route.type==="comparison"&&T.route.sourceKey!==je.key?{...T,route:Tt}:T)},[je.key,k]);const Ge=c.useMemo(()=>{const T=p?.files??[],F=new Map;for(const se of T)F.set(se.path,se);return Array.from(F.values()).sort((se,we)=>se.path.localeCompare(we.path))},[p?.files]),Ee=c.useMemo(()=>Ge.filter(yd),[Ge]),ot=c.useMemo(()=>Ge.filter(vd),[Ge]),Ke=c.useMemo(()=>{if(he.length>0)return he;const T=p?.tracking?.includes("/")?p.tracking.split("/")[0]:null;return T||Y?[{name:T||"origin",fetchUrl:Y??"",pushUrl:Y??""}]:[]},[Y,he,p?.tracking]),Et=Fe(c.useCallback(T=>!l||I.type!=="diff"?null:T.directories.get(l)?.diffCache.get(Jr(I.path,I.staged))??null,[l,I])),ws=c.useMemo(()=>I.type!=="diff"?null:Ge.find(T=>T.path===I.path)??null,[Ge,I]),Se=c.useCallback(async(T=!0)=>{if(l)try{await Promise.all([N(l,a),A(l,a)])}catch(F){T&&me.error(F instanceof Error?F.message:o("gitView.toast.refreshRepositoryFailed"))}},[l,A,N,a,o]),js=c.useMemo(()=>(g?.all??[]).filter(T=>!T.startsWith("remotes/")).sort(),[g]),Zs=c.useMemo(()=>(g?.all??[]).filter(T=>T.startsWith("remotes/")).map(T=>T.replace(/^remotes\//,"")).sort(),[g]),Pt=c.useCallback(async T=>{if(!l)return;const F=T.replace(/^remotes\//,"");try{const se=await a.checkoutBranch(l,F);me.success(o("gitView.toast.checkedOut",{name:se.branch||F})),await Se()}catch(se){me.error(se instanceof Error?se.message:o("gitView.toast.checkoutFailed",{name:F}))}},[l,a,Se,o]),Pe=c.useCallback(T=>{const F=T.replace(/^remotes\//,"");if((p?.files?.length??0)>0){Oe(F);return}Pt(F)},[Pt,p?.files]),ks=c.useCallback(async(T,F)=>{if(l)try{await a.createBranch(l,T,Ce??"HEAD"),await a.checkoutBranch(l,T),F&&await a.gitPush(l,{remote:F.name,branch:T,options:["--set-upstream"]}),await Se()}catch(se){throw me.error(se instanceof Error?se.message:o("gitView.toast.createBranchFailed")),se}},[Ce,l,a,Se,o]),at=c.useCallback(async()=>{if(!l){ke([]),fe(null);return}try{const[T,F]=await Promise.all([a.getRemotes(l).catch(()=>[]),a.getRemoteUrl?a.getRemoteUrl(l).catch(()=>null):Promise.resolve(null)]);ke(T),fe(F)}catch{ke([]),fe(null)}},[l,a]);c.useEffect(()=>{!l||!r||(S(l),x(l,a))},[l,x,a,S,r]),c.useEffect(()=>{r&&at()},[at,r]),c.useEffect(()=>{if(!r||j!=="working"||!l||Ge.length===0)return;const T=Array.from(new Set([...Ee.map(se=>se.path),...q,...Ge.slice(0,20).map(se=>se.path)])).filter(Boolean);if(T.length===0)return;const F=window.setTimeout(()=>{y(l,a,T,{maxFiles:40})},120);return()=>window.clearTimeout(F)},[Ge,l,a,j,y,Ee,q,r]),c.useEffect(()=>{if(!r)return;if(I.type!=="diff"){Me(null);return}const T=Jr(I.path,I.staged);if(Ye(null),!l||P(l,T)){Me(null);return}let F=!1;const se=Kt();return Me(null),a.getGitFileDiff(l,{path:I.path,staged:I.staged||void 0}).then(we=>{F||C(l,T,{original:we.original??"",modified:we.modified??"",isBinary:we.isBinary,submodule:we.submodule},se)}).catch(we=>{if(!F){if(we instanceof hr&&we.reason!=="path_not_found"){Ye({key:`${l}\0${I.path}`,reason:we.reason});return}we instanceof hr&&N(l,a,{force:!0,silent:!0}),Me(we instanceof Error?we.message:String(we))}}),()=>{F=!0}},[l,et,N,P,a,I,C,r]);const Qt=async(T,F)=>{if(l){L(T);try{if(T==="fetch"){if(!F)throw new Error(o("mobile.changes.noRemote"));await a.gitFetch(l,{remote:F.name}),me.success(o("gitView.toast.fetchedFromRemote",{name:F.name}))}else if(T==="sync"){if(!F)throw new Error(o("mobile.changes.noRemote"));let se=0;const we=await Sr({git:a,directory:l,remote:F,dirtyWorktreeError:o("gitView.toast.commitOrStashBeforeSync"),onPulled:Ze=>{se=Ze.files.length}});se>0&&me.success(se===1?o("gitView.toast.pulledFilesSingle",{count:se,name:F.name}):o("gitView.toast.pulledFilesPlural",{count:se,name:F.name})),we.pushed.length>0?me.success(o("gitView.toast.pushedToUpstream",{name:we.pushed[0].remote})):se===0&&me.success(o("gitView.toast.alreadyUpToDate"))}await Se(!1),await at()}catch(se){me.error(se instanceof Error?se.message:o("gitView.toast.syncActionFailed",{action:o("gitView.sync.syncChanges")}))}finally{L(null)}}},bt=c.useCallback(async(T,F)=>{if(!(!l||T.length===0))try{F==="stage"?T.length>1?await ca(l,T):await ua(l,T[0]):T.length>1?await da(l,T):await fa(l,T[0]),await Se(!1)}catch(se){me.error(se instanceof Error?se.message:o(F==="stage"?"gitView.toast.stageFileFailed":"gitView.toast.unstageFileFailed"))}},[l,Se,o]),Xt=c.useCallback((T,F=!1)=>{U({type:"diff",path:T,staged:F})},[U]),Zt=c.useCallback(async T=>{if(l){J(F=>new Set(F).add(T));try{await a.revertGitFile(l,T),me.success(o("gitView.toast.revertedFile",{path:T})),await Se(!1)}catch(F){me.error(F instanceof Error?F.message:o("gitView.toast.revertFailed"))}finally{J(F=>{const se=new Set(F);return se.delete(T),se})}}},[l,a,Se,o]),es=c.useCallback(async T=>{if(!l||T.length===0||H)return;const F=Array.from(new Set(T));X(!0),J(new Set(F));try{await Promise.all(F.map(se=>a.revertGitFile(l,se))),await Se(!1),me.success(F.length===1?o("gitView.toast.revertedFilesSingle",{count:F.length}):o("gitView.toast.revertedFilesPlural",{count:F.length}))}catch(se){me.error(se instanceof Error?se.message:o("gitView.toast.revertFailed"))}finally{J(new Set),X(!1)}},[l,a,H,Se,o]),en=c.useCallback(T=>{const F=T.map(se=>se.trim()).filter(Boolean);if(F.length===0){ue([]);return}_(se=>`${se.trim()}${se.trim()?`
|
|
23
|
+
|
|
24
|
+
`:""}${F.join(`
|
|
25
|
+
`)}`.trim()),ue([])},[]),tn=c.useCallback(async()=>{if(!l)return;const T=Ee.map(F=>F.path).sort();if(T.length===0){me.error(o("gitView.toast.selectFileToDescribe"));return}re(!0);try{const{message:F}=await wr(l,T);_(F.subject?.trim()??""),ue(Array.isArray(F.highlights)?F.highlights:[])}catch(F){me.error(F instanceof Error?F.message:o("gitView.toast.generateCommitMessageFailed"))}finally{re(!1)}},[l,Ee,o]),At=async(T={})=>{if(!l)return;if(!V.trim()){me.error(o("gitView.toast.enterCommitMessage"));return}const F=Ee.map(se=>se.path).sort();if(F.length===0){me.error(o("gitView.toast.selectFileToCommit"));return}te(T.pushAfter?"commitAndPush":"commit");try{if(await a.createGitCommit(l,V.trim(),{files:F}),me.success(o("gitView.toast.commitCreated")),_(""),ue([]),T.pushAfter){const se=p?.tracking?.split("/")[0],we=Ke.find(Ze=>Ze.name===se)??Ke[0];if(!we)throw new Error(o("mobile.changes.noRemote"));L("sync"),await Sr({git:a,directory:l,remote:we,dirtyWorktreeError:o("gitView.toast.commitOrStashBeforeSync"),onPushed:Ze=>{me.success(o("gitView.toast.pushedToUpstream",{name:Ze.pushed[0].remote}))}}),await Se(!1),await at()}else await Se(!1)}catch(se){me.error(se instanceof Error?se.message:o("gitView.toast.createCommitFailed"))}finally{te(null),T.pushAfter&&L(null)}},Ss=c.useMemo(()=>{const T=[];return Ee.length>0&&T.push({id:"staged",title:o("gitView.changes.stagedTitle"),entries:Ee,statsScope:"staged",actionSymbol:"-",actionAllLabel:o("gitView.changes.unstageAllAria"),getActionLabel:F=>o("gitView.changes.unstageFileAria",{path:F}),onActionFile:F=>{bt([F],"unstage")},onActionAll:F=>{bt(F,"unstage")},onViewDiff:F=>Xt(F,!0),onRevertFile:Zt,showRevertActions:!1,accent:!0}),ot.length>0&&T.push({id:"unstaged",title:o("gitView.changes.title"),entries:ot,statsScope:"working",actionSymbol:"+",actionAllLabel:o("gitView.changes.stageAllAria"),getActionLabel:F=>o("gitView.changes.stageFileAria",{path:F}),onActionFile:F=>{bt([F],"stage")},onActionAll:F=>{bt(F,"stage")},onViewDiff:F=>Xt(F,!1),onRevertFile:Zt}),T},[Zt,Xt,bt,Ee,o,ot]),ts=T=>t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground",children:[s?t.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-ring","aria-label":o("mobile.surface.closeAria"),onClick:s,style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"close",className:"size-5"})}):null,t.jsxs("div",{className:"min-w-0 flex-1 px-1",children:[t.jsx("h2",{className:"typography-ui-label text-foreground",children:o("mobile.nav.changes")}),t.jsx("p",{className:"truncate typography-micro text-muted-foreground",children:p?.current||l||""})]}),u===!1&&Array.isArray(d)&&d.length>0?t.jsx(wl,{repositories:d,selectedRepository:f??null,onSelectRepository:F=>{n&&v(n,F)},repositoryRoot:n??void 0}):null]}),t.jsx("div",{className:"min-h-0 flex-1",children:T})]});if(!l)return ts(t.jsx(Je,{message:o("gitView.empty.selectSessionOrDirectory")}));if(u===!1&&h!==!0)return ts(t.jsx(jl,{rootIsGitRepo:u,resolvedIsGitRepo:h,nestedRepos:d,onRetryDiscovery:()=>{n&&E(n,{force:!0})}}));if(b&&h===null)return ts(t.jsx(Je,{loading:!0,message:o("gitView.loading.checkingRepository")}));if(I.type==="diff")return t.jsx(Yr,{path:I.path,diff:Et,staged:I.staged,fileExists:!!ws,unavailableReason:Ie?.key===`${l}\0${I.path}`?Ie.reason:null,error:Re,onBack:()=>U({type:"list"}),onRetry:()=>ut(T=>T+1)});const It=o(j==="pr"?"session.githubIntegration.tabs.pullRequests":j==="branch"?"diffView.scope.branch":j==="commit"?"commitComparison.mode":"mobile.nav.changes"),ss=j==="branch"&&Ue.base?xl(Ue.base):j==="commit"?dt?.slice(0,8):j==="pr"&&ft?`#${ft.number}`:null;if(Qe&&Xe)return t.jsx(Yr,{path:Qe,subtitle:[It,ss].filter(Boolean).join(" · "),diff:Xe.status==="ready"?Xe.diff:null,fileExists:!je.files||je.files.some(T=>T.path===Qe),error:je.error??(Xe.status==="error"?Xe.message:null),onBack:()=>U(Tt),onRetry:()=>{je.error&&je.refresh(),Yt(T=>T+1)}});const xt=()=>j==="pr"&&!ft?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[t.jsx(Je,{loading:nt.loading,message:nt.error??(nt.loading?o("session.githubPrPicker.loading.pullRequests"):o("pullRequestComparison.select"))}),!nt.loading&&t.jsx(Nr,{mobile:!0,comparison:nt})]}):j==="branch"&&!Ue.base?t.jsx(Je,{loading:!Ue.resolved,message:Ue.resolved?o("gitView.pr.toast.baseBranchRequired"):o("diffView.branch.resolvingBase")}):j==="commit"&&!dt?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[$e.loading&&t.jsx(Z,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}),t.jsx("p",{className:"typography-ui-label text-muted-foreground",children:$e.loading?o("diffView.state.loadingChanges"):$e.error??o("commitComparison.noCommits")}),$e.error&&t.jsx(be,{variant:"outline",size:"lg",onClick:()=>{$e.refresh()},children:o("diffView.actions.retry")})]}):je.error?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[t.jsx("p",{className:"typography-ui-label font-semibold",children:o("diffView.state.failedToLoadDiff")}),t.jsx("p",{className:"typography-meta text-muted-foreground",children:je.error}),t.jsx(be,{variant:"outline",size:"lg",onClick:()=>{je.refresh()},children:o("diffView.actions.retry")})]}):Jt?Jt.length===0?t.jsx(Je,{icon:j==="branch",message:j==="pr"?o("walkthrough.blocked.emptyDiff.description"):j==="commit"?o("commitComparison.emptyDiff"):o("diffView.branch.empty",{base:ss??""})}):t.jsx(kd,{files:Jt,onSelect:T=>{je.key&&U({type:"comparison",path:T,sourceKey:je.key})}}):t.jsx(Je,{loading:!0,message:o("diffView.state.loadingChanges")});return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-3 py-2",children:[s?t.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-ring","aria-label":o("mobile.surface.closeAria"),onClick:s,style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"close",className:"size-5"})}):null,t.jsxs(ma,{open:$,onOpenChange:w,children:[t.jsx(pa,{asChild:!0,children:t.jsxs(be,{variant:"outline",className:ha({size:"default"}),"data-mobile-comparison-trigger":!0,"aria-label":o("diffView.scope.selectorAria"),children:[t.jsx("span",{children:It}),t.jsx(Z,{name:"arrow-down-s",className:"size-4"})]})}),t.jsx(ga,{align:"start",children:t.jsxs(ba,{value:j,onValueChange:T=>{(T==="working"||T==="branch"||T==="commit"||T==="pr")&&B(T)},children:[t.jsx(Ts,{value:"working",className:"min-h-8 items-center",children:o("mobile.nav.changes")}),ys&&t.jsx(Ts,{value:"branch",className:"min-h-8 items-center",children:o("diffView.scope.branch")}),t.jsx(Ts,{value:"commit",className:"min-h-8 items-center",children:o("commitComparison.mode")}),t.jsx(Ts,{value:"pr",className:"min-h-8 items-center",children:o("session.githubIntegration.tabs.pullRequests")})]})})]}),r&&j==="branch"&&t.jsx(uc,{mobile:!0,branches:g?.all??[],currentBranch:Ce,base:Ue.base,onSelect:T=>{Ce&&Qs(l,Ce,T)}},JSON.stringify([k,Ce])),r&&j==="commit"&&t.jsx(dc,{mobile:!0,commits:$e.commits,selectedHash:dt,loading:$e.loading,error:$e.error,onSelect:$e.select,onRefresh:()=>{$e.refresh()}},JSON.stringify([k,Ce])),r&&j==="pr"&&t.jsxs(t.Fragment,{children:[t.jsx(Nr,{mobile:!0,comparison:nt},JSON.stringify([k,Ce])),ft&&t.jsx(be,{variant:"ghost",size:"sm",disabled:je.loading,"aria-label":o("session.githubIssuePicker.actions.refresh"),onClick:()=>{je.refresh()},children:t.jsx(Z,{name:"refresh",className:"size-4"})})]})]}),j==="working"&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-3 py-2",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(yl,{currentBranch:p?.current,localBranches:js,remoteBranches:Zs,branchInfo:g?.branches,currentBranchAhead:p?.ahead,onCheckout:T=>{Pe(T)},onCreate:ks,remotes:Ke,disabled:b,directory:l,switchBlockedNotice:(p?.files?.length??0)>0?o("gitView.branch.switchBlockedNotice"):null})}),t.jsx(vl,{syncAction:O,remotes:Ke,onFetch:T=>{Qt("fetch",T)},onSync:T=>{Qt("sync",T)},disabled:ie!==null||b,aheadCount:p?.ahead??0,behindCount:p?.behind??0,trackingRemoteName:p?.tracking?.split("/")[0],hasUncommittedChanges:Ge.length>0})]}),j!=="working"?t.jsx("div",{className:"min-h-0 flex-1",children:xt()}):Ge.length>0?t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-4 pt-4",children:t.jsx(tc,{groups:Ss,diffStats:p?.diffStats,revertingPaths:G,onRevertAll:es,isRevertingAll:H,headerBackgroundClassName:"bg-transparent",onVisiblePathsChange:oe})}),t.jsx("div",{className:"shrink-0 border-t border-border/70 px-4 pb-4 pt-3",children:t.jsx(sc,{stagedCount:Ee.length,commitMessage:V,onCommitMessageChange:_,generatedHighlights:ce,onInsertHighlights:en,onGenerateMessage:tn,isGeneratingMessage:ne,onCommit:()=>{At({pushAfter:!1})},onCommitAndPush:()=>{At({pushAfter:!0})},commitAction:ie,gitmojiEnabled:!1,onOpenGitmojiPicker:()=>{}})})]}):t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(Je,{icon:!0,message:o("gitView.empty.cleanTitle"),description:o("mobile.changes.cleanDescription")})}),t.jsx(nc,{open:De!==null,onOpenChange:T=>{T||Oe(null)},targetBranch:De??"",changedFileCount:p?.files?.length??0,onCommitAndSwitch:async(T,F)=>{const se=De;if(!se||!l)return;const we=p?.current??null;await a.createGitCommit(l,T,{addAll:!0});let Ze=null;if(F){const Ns=p?.tracking?.split("/")[0],yt=Ke.find(sn=>sn.name===Ns)??Ke[0];try{if(!yt)throw new Error(o("mobile.changes.noRemote"));await a.gitPush(l,p?.tracking?{remote:yt.name}:{remote:yt.name,branch:we??void 0,options:["--set-upstream"]}),Ze=yt.name}catch{me.error(o("gitView.dirtySwitch.pushFailed")),await Se(),Oe(null);return}}me.success(we?Ze?o("gitView.toast.pushedToUpstream",{name:Ze}):o("gitView.dirtySwitch.committedNotPushed",{branch:we}):o("gitView.toast.commitCreated")),await Se(),Oe(null),await Pt(se)},onGenerateMessage:async()=>{if(!l)return"";const T=(p?.files??[]).map(se=>se.path).sort(),{message:F}=await wr(l,T);return F.subject?.trim()??""},onRevertAndSwitch:async()=>{const T=De;if(!T||!l)return;await es((p?.files??[]).map(se=>se.path));const F=await a.getGitStatus(l);if(!F.isClean&&(F.files?.length??0)>0){me.error(o("gitView.dirtySwitch.revertIncomplete"));return}Oe(null),await Pt(T)}})]})},Je=n=>{const e=le.c(13),{message:s,description:i,loading:r,icon:o}=n,a=r===void 0?!1:r,u=o===void 0?!1:o;let f;e[0]!==a?(f=a?t.jsx(Z,{name:"loader-4",className:"size-5 animate-spin text-muted-foreground"}):null,e[0]=a,e[1]=f):f=e[1];let d;e[2]!==u?(d=u?t.jsx(Z,{name:"git-branch",className:"size-6 text-muted-foreground"}):null,e[2]=u,e[3]=d):d=e[3];let l;e[4]!==s?(l=t.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:s}),e[4]=s,e[5]=l):l=e[5];let p;e[6]!==i?(p=i?t.jsx("p",{className:"typography-meta text-muted-foreground",children:i}):null,e[6]=i,e[7]=p):p=e[7];let g;return e[8]!==f||e[9]!==d||e[10]!==l||e[11]!==p?(g=t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[f,d,l,p]})}),e[8]=f,e[9]=d,e[10]=l,e[11]=p,e[12]=g):g=e[12],g},Yr=n=>{const e=le.c(31),{path:s,subtitle:i,diff:r,staged:o,fileExists:a,unavailableReason:u,error:f,onBack:d,onRetry:l}=n,p=o===void 0?!1:o,g=u===void 0?null:u,{t:h}=pe();let b;e[0]!==s?(b=xa(s)||"text",e[0]=s,e[1]=b):b=e[1];const S=b;let x;e[2]!==h?(x=h("header.actions.backAria"),e[2]=h,e[3]=x):x=e[3];let E;e[4]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Z,{name:"arrow-left",className:"size-5"}),e[4]=E):E=e[4];let v;e[5]!==d||e[6]!==x?(v=t.jsx("button",{type:"button",className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":x,onClick:d,children:E}),e[5]=d,e[6]=x,e[7]=v):v=e[7];let N;e[8]!==s?(N=t.jsx("h2",{className:"truncate typography-ui-header text-foreground",children:s}),e[8]=s,e[9]=N):N=e[9];let A;e[10]!==i?(A=i&&t.jsx("p",{className:"truncate typography-meta text-muted-foreground",children:i}),e[10]=i,e[11]=A):A=e[11];let y;e[12]!==N||e[13]!==A?(y=t.jsxs("div",{className:"min-w-0 flex-1 px-2",children:[N,A]}),e[12]=N,e[13]=A,e[14]=y):y=e[14];let P;e[15]!==v||e[16]!==y?(P=t.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-3 border-b border-border/70 px-3 text-foreground",children:[v,y]}),e[15]=v,e[16]=y,e[17]=P):P=e[17];let C;e[18]!==r||e[19]!==f||e[20]!==a||e[21]!==S||e[22]!==l||e[23]!==s||e[24]!==p||e[25]!==h||e[26]!==g?(C=t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a?g==="nested_repository"?t.jsx(Je,{icon:!0,message:h("diffView.unavailable.nestedRepositoryTitle"),description:h("diffView.unavailable.nestedRepositoryDescription")}):g==="untracked_directory"?t.jsx(Je,{icon:!0,message:h("diffView.unavailable.untrackedDirectoryTitle"),description:h("diffView.unavailable.untrackedDirectoryDescription")}):f?t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[t.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:h("mobile.changes.diffDetail.loadFailed")}),t.jsx("p",{className:"typography-meta text-muted-foreground",children:f}),t.jsx(be,{type:"button",size:"sm",variant:"outline",onClick:l,children:h("diffView.actions.retry")})]})}):r?r.submodule?t.jsx("div",{className:"p-3",children:t.jsx(hc,{state:r.submodule,staged:p})}):r.isBinary?t.jsx(Je,{icon:!0,message:h("diffView.binary.unavailable")}):ya(s)&&!r.fileDiff?t.jsx(Je,{icon:!0,message:h("mobile.changes.diffDetail.imageUnavailable")}):t.jsx(qs,{className:"h-full overflow-y-auto overflow-x-hidden p-3","data-diff-virtual-root":!0,"data-diff-virtual-content":!0,children:t.jsx(bc,{original:r.original,modified:r.modified,fileDiff:r.fileDiff,language:S,fileName:s,renderSideBySide:!1,wrapLines:!0,layout:"inline"})}):t.jsx(Je,{loading:!0,message:h("diffView.state.loadingDiff")}):t.jsx(Je,{icon:!0,message:h("mobile.changes.diffDetail.missingTitle"),description:h("mobile.changes.diffDetail.missingDescription")})}),e[18]=r,e[19]=f,e[20]=a,e[21]=S,e[22]=l,e[23]=s,e[24]=p,e[25]=h,e[26]=g,e[27]=C):C=e[27];let R;return e[28]!==P||e[29]!==C?(R=t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[P,C]}),e[28]=P,e[29]=C,e[30]=R):R=e[30],R},kd=n=>{const e=le.c(12),{files:s,onSelect:i}=n,{t:r}=pe();let o;e[0]!==r?(o=r("gitView.changes.changedFilesAria"),e[0]=r,e[1]=o):o=e[1];let a;if(e[2]!==s||e[3]!==i||e[4]!==r){let f;e[6]!==i||e[7]!==r?(f=d=>{const l=d.status==="A"?r("diffView.change.new"):d.status==="D"?r("diffView.change.deleted"):d.status==="R"?r("diffView.change.renamed"):d.status==="C"?r("diffView.change.copied"):r("diffView.change.modified"),p=d.status==="A"?"var(--status-success)":d.status==="D"?"var(--status-error)":d.status==="R"||d.status==="C"?"var(--status-info)":"var(--status-warning)";return t.jsx("li",{children:t.jsxs(be,{variant:"ghost",size:"lg",className:"w-full justify-start gap-2.5 text-left normal-case",onClick:()=>i(d.path),children:[t.jsx("span",{className:"w-4 shrink-0 text-center typography-meta font-semibold uppercase",style:{color:p},"aria-label":l,children:d.status}),t.jsx(vi,{filePath:d.path,className:"size-4 shrink-0"}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label",title:d.path,children:d.path}),(d.insertions>0||d.deletions>0)&&t.jsxs("span",{className:"shrink-0 typography-meta text-muted-foreground",children:["+",d.insertions," -",d.deletions]}),t.jsx(Z,{name:"arrow-right-s",className:"size-4 shrink-0 text-muted-foreground"})]})},d.path)},e[6]=i,e[7]=r,e[8]=f):f=e[8],a=s.map(f),e[2]=s,e[3]=i,e[4]=r,e[5]=a}else a=e[5];let u;return e[9]!==o||e[10]!==a?(u=t.jsx(qs,{className:"h-full overflow-y-auto overflow-x-hidden px-3 py-2",children:t.jsx("ul",{"aria-label":o,className:"flex flex-col gap-1",children:a})}),e[9]=o,e[10]=a,e[11]=u):u=e[11],u},Sd=c.lazy(()=>Ft(()=>import("./FilesView-DC2gadXM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126])).then(n=>({default:n.FilesView}))),ct=n=>(n||"").replace(/\\/g,"/").replace(/\/+$/g,""),ps=n=>{const e=ct(n);return!e||e==="/"?e||"/":e.split("/").filter(Boolean).at(-1)??e},Nd=n=>{const e=ct(n);if(!e||e==="/")return null;const s=e.lastIndexOf("/");return s<=0?e.startsWith("/")?"/":null:e.slice(0,s)},Cd=(n,e)=>{const s=ct(n),i=ct(e);return!i||s===i?ps(s):s.startsWith(`${i}/`)?s.slice(i.length+1):s},Rd=n=>{if(typeof n!="number"||!Number.isFinite(n)||n<0)return"";if(n<1024)return`${n} B`;const e=["KB","MB","GB"];let s=n/1024;for(const i of e){if(s<1024||i===e[e.length-1])return`${s.toFixed(s>=10?0:1)} ${i}`;s/=1024}return""},Ed=n=>{const e=le.c(5),{onClose:s}=n,i=Dn()??null;let r;e[0]!==i?(r=ct(i),e[0]=i,e[1]=r):r=e[1];const o=r;let a;return e[2]!==s||e[3]!==o?(a=t.jsx(Pd,{root:o,onClose:s},o),e[2]=s,e[3]=o,e[4]=a):a=e[4],a},Pd=({root:n,onClose:e})=>{const{t:s}=pe(),{files:i}=Tn(),r=ko(V=>V.setSelectedPath),[o,a]=c.useState(()=>({type:"browser",directory:n})),[u,f]=c.useState([]),[d,l]=c.useState(!1),[p,g]=c.useState(null),[h,b]=c.useState(""),[S,x]=c.useState([]),[E,v]=c.useState(!1),N=c.useRef(0),A=o.type==="browser"?o.directory:o.returnDirectory,y=c.useRef(A);y.current=A;const P=c.useCallback(async V=>{if(!V)return;const _=N.current+1;N.current=_,l(!0),g(null);try{const G=await i.listDirectory(V);if(N.current!==_)return;f(G.entries.slice().sort((J,H)=>J.isDirectory!==H.isDirectory?J.isDirectory?-1:1:J.name.localeCompare(H.name)))}catch(G){if(N.current!==_)return;f([]),g(G instanceof Error?G.message:s("mobile.files.error.listFailed"))}finally{N.current===_&&l(!1)}},[i,s]);c.useEffect(()=>{o.type==="browser"&&P(o.directory)},[P,o]);const C=c.useCallback(async V=>{ct(V)===ct(y.current)&&await P(y.current)},[P]),{canUpload:R,uploadingDirectory:k,pickFiles:z,uploadElements:D}=kl({root:n,refreshDirectory:C}),M=k!==null;c.useEffect(()=>{if(o.type!=="browser")return;const V=h.trim();if(!V){x([]),v(!1);return}let _=!1;const G=window.setTimeout(()=>{v(!0),i.search({directory:o.directory,query:V,maxResults:40}).then(J=>{_||x(J)}).catch(()=>{_||x([])}).finally(()=>{_||v(!1)})},250);return()=>{_=!0,window.clearTimeout(G)}},[i,h,o]);const j=V=>{b(""),a({type:"browser",directory:V})},I=V=>{r(n,V),a({type:"file",path:V,returnDirectory:A||n})},$=it(V=>V.pendingFileFocusPath),w=it(V=>V.pendingFileNavigation);if(c.useEffect(()=>{const V=ct(w?.path??$??"");!V||!n||V!==n&&!V.startsWith(`${n}/`)||(r(n,V),a({type:"file",path:V,returnDirectory:n}),$&&it.getState().setPendingFileFocusPath(null))},[$,w,n,r]),!n)return t.jsx(hs,{message:s("mobile.files.empty.noDirectory")});if(o.type==="file")return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[t.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 border-b border-border/70 px-3 text-foreground",children:[t.jsx("button",{type:"button",className:"-ml-1 flex size-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":s("header.actions.backAria"),onClick:()=>a({type:"browser",directory:o.returnDirectory}),style:{touchAction:"manipulation"},children:t.jsx(kr,{className:"size-5"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("h2",{className:"truncate typography-ui-header text-foreground",children:ps(o.path)})})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t.jsx(Ve,{children:t.jsx(c.Suspense,{fallback:t.jsx(hs,{loading:!0,message:s("filesView.state.loading")}),children:t.jsx(Sd,{mode:"editor-only"})})})})]});const B=o.directory===n?s("mobile.files.rootDirectory"):ps(o.directory),U=h.trim()?S:[],O=Nd(o.directory),L=o.directory!==n&&O!==null&&(O===n||O.startsWith(`${n}/`)),ie=L&&!h.trim(),te=L?O:null;return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background text-foreground",children:[D,t.jsxs("header",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground",children:[e?t.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-ring","aria-label":s("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:t.jsx(Hl,{className:"size-5"})}):null,ie&&te?t.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-ring","aria-label":s("mobile.files.backToParentAria",{name:ps(te)}),onClick:()=>j(te),style:{touchAction:"manipulation"},children:t.jsx(kr,{className:"size-5"})}):null,t.jsx("div",{className:"min-w-0 flex-1 px-1",children:t.jsx("h2",{className:"truncate typography-ui-label text-foreground",children:B})}),t.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-ring","aria-label":s("mobile.files.refreshAria"),onClick:()=>{P(o.directory)},style:{touchAction:"manipulation"},children:t.jsx(ql,{className:Q("size-5",d&&"animate-spin")})}),R?t.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-ring disabled:opacity-50","aria-label":s("sidebarFilesTree.actions.uploadFilesTitle"),onClick:()=>z(o.directory),disabled:M,style:{touchAction:"manipulation"},children:t.jsx(Z,{name:M?"loader-4":"upload-2",className:Q("size-5",M&&"animate-spin")})}):null]}),t.jsx("div",{className:"shrink-0 px-4 pb-2 pt-1",children:t.jsxs("div",{className:"relative",children:[t.jsx(Jl,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),t.jsx(gi,{value:h,onChange:V=>b(V.target.value),placeholder:s("mobile.files.search.placeholder"),className:"h-11 pl-9"})]})}),t.jsx(qs,{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-3",children:p?t.jsx(hs,{message:p}):h.trim()?t.jsx(Ad,{results:U,isSearching:E,onOpenFile:I}):t.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-[var(--surface-elevated)]",children:[u.length===0&&!d?t.jsx("div",{className:"px-4 py-8 text-center typography-body text-muted-foreground",children:s("mobile.files.empty.directory")}):null,u.map(V=>t.jsx(Xi,{name:V.name,path:V.path,directory:V.isDirectory,meta:V.isDirectory?void 0:Rd(V.size),onClick:()=>V.isDirectory?j(V.path):I(V.path)},V.path))]})})]})},Xi=n=>{const e=le.c(16),{name:s,path:i,directory:r,meta:o,onClick:a}=n;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={touchAction:"manipulation"},e[0]=u):u=e[0];let f;e[1]!==r||e[2]!==i?(f=r?t.jsx(Xl,{className:"size-5 shrink-0 text-primary/80"}):t.jsx(vi,{filePath:i,className:"size-5 shrink-0"}),e[1]=r,e[2]=i,e[3]=f):f=e[3];let d;e[4]!==s?(d=t.jsx("span",{className:"block min-w-0 flex-1 truncate typography-ui-label text-foreground",children:s}),e[4]=s,e[5]=d):d=e[5];let l;e[6]!==o?(l=o?t.jsx("span",{className:"shrink-0 typography-micro text-muted-foreground",children:o}):null,e[6]=o,e[7]=l):l=e[7];let p;e[8]!==r?(p=r?t.jsx(Zl,{className:"size-4 shrink-0 text-muted-foreground/60"}):null,e[8]=r,e[9]=p):p=e[9];let g;return e[10]!==a||e[11]!==f||e[12]!==d||e[13]!==l||e[14]!==p?(g=t.jsxs("button",{type:"button",className:"flex min-h-14 w-full items-center gap-3 border-b border-border/70 px-3 py-2.5 text-left transition-colors last:border-b-0 hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:a,style:u,children:[f,d,l,p]}),e[10]=a,e[11]=f,e[12]=d,e[13]=l,e[14]=p,e[15]=g):g=e[15],g},Ad=n=>{const e=le.c(10),{results:s,isSearching:i,onOpenFile:r}=n,{t:o}=pe(),a=ct(Dn()??null);if(i){let l;e[0]!==o?(l=o("common.loading"),e[0]=o,e[1]=l):l=e[1];let p;return e[2]!==l?(p=t.jsx(hs,{loading:!0,message:l}),e[2]=l,e[3]=p):p=e[3],p}if(s.length===0){let l;e[4]!==o?(l=o("mobile.files.search.empty"),e[4]=o,e[5]=l):l=e[5];let p;return e[6]!==l?(p=t.jsx(hs,{message:l}),e[6]=l,e[7]=p):p=e[7],p}const u="overflow-hidden rounded-2xl border border-border/70 bg-[var(--surface-elevated)]",f=s.map(l=>t.jsx(Xi,{name:ps(l.path),path:l.path,directory:!1,meta:Cd(l.path,a),onClick:()=>r(l.path)},l.path));let d;return e[8]!==f?(d=t.jsx("div",{className:u,children:f}),e[8]=f,e[9]=d):d=e[9],d},hs=n=>{const e=le.c(7),{message:s,loading:i}=n,r=i===void 0?!1:i;let o;e[0]!==r?(o=r?t.jsx(Yl,{className:"size-5 animate-spin text-muted-foreground"}):t.jsx(Ql,{className:"size-6 text-muted-foreground"}),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==s?(a=t.jsx("p",{className:"typography-ui-label font-semibold text-foreground",children:s}),e[2]=s,e[3]=a):a=e[3];let u;return e[4]!==o||e[5]!==a?(u=t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2",children:[o,a]})}),e[4]=o,e[5]=a,e[6]=u):u=e[6],u},Qr="mobile-surface-root",Id=16,Xr=320,Td="cubic-bezier(0.22, 1, 0.36, 1)",Dd=n=>{const e=le.c(36),{onOpenMcpSettings:s}=n,{t:i}=pe(),[r,o]=c.useState(!1),a=pt(Md),u=cs(zd),f=Bt(Od);let d;e[0]!==a||e[1]!==r||e[2]!==f||e[3]!==u?(d=()=>{if(r)return;o(!0);const z=new Promise(Bd);Promise.all([u({directory:a||null,silent:!0}),f({force:!0}),z]).finally(()=>o(!1))},e[0]=a,e[1]=r,e[2]=f,e[3]=u,e[4]=d):d=e[4];const l=d;let p;e[5]!==i?(p=i("settings.mcp.sidebar.actions.addServerTitle"),e[5]=i,e[6]=p):p=e[6];let g;e[7]!==i?(g=i("settings.mcp.sidebar.actions.addServerTitle"),e[7]=i,e[8]=g):g=e[8];let h,b;e[9]===Symbol.for("react.memo_cache_sentinel")?(h={touchAction:"manipulation"},b=t.jsx(Z,{name:"add",className:"size-5"}),e[9]=h,e[10]=b):(h=e[9],b=e[10]);let S;e[11]!==s||e[12]!==p||e[13]!==g?(S=t.jsx("button",{type:"button",className:"flex size-10 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-ring",onClick:s,"aria-label":p,title:g,style:h,children:b}),e[11]=s,e[12]=p,e[13]=g,e[14]=S):S=e[14];let x;e[15]!==i?(x=i("mcpDropdown.actions.refreshAria"),e[15]=i,e[16]=x):x=e[16];let E;e[17]!==i?(E=i("mcpDropdown.actions.refreshAria"),e[17]=i,e[18]=E):E=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v={touchAction:"manipulation"},e[19]=v):v=e[19];const N=r&&"animate-spin";let A;e[20]!==N?(A=Q("size-5",N),e[20]=N,e[21]=A):A=e[21];let y;e[22]!==A?(y=t.jsx(Z,{name:"refresh",className:A}),e[22]=A,e[23]=y):y=e[23];let P;e[24]!==r||e[25]!==l||e[26]!==y||e[27]!==x||e[28]!==E?(P=t.jsx("button",{type:"button",className:"flex size-10 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:l,disabled:r,"aria-label":x,title:E,style:v,children:y}),e[24]=r,e[25]=l,e[26]=y,e[27]=x,e[28]=E,e[29]=P):P=e[29];let C;e[30]!==P||e[31]!==S?(C=t.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1 px-2 pt-1",children:[S,P]}),e[30]=P,e[31]=S,e[32]=C):C=e[32];let R;e[33]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(bd,{active:!0,className:"h-full",listClassName:"max-h-none",hideHeader:!0,mobileListDensity:!0})}),e[33]=R):R=e[33];let k;return e[34]!==C?(k=t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[C,R]}),e[34]=C,e[35]=k):k=e[35],k},_d=({open:n,onClose:e,tab:s,onTabChange:i,pendingChangesDiff:r,onOpenPlan:o,onOpenMcpSettings:a,variant:u="drawer"})=>{const{t:f}=pe(),d=c.useRef(null),l=c.useRef(null),[p,g]=c.useState(!1),[h,b]=c.useState(n),S=c.useRef(e);c.useEffect(()=>{S.current=e},[e]);const x=c.useRef(s);c.useEffect(()=>{x.current=s},[s]),sr(l,{enabled:u==="drawer"&&n,onLeftEdgeSwipe:()=>S.current()});const[E,v]=c.useState(()=>new Set);if(c.useEffect(()=>{n&&v(y=>{if(y.has(s))return y;const P=new Set(y);return P.add(s),P})},[n,s]),typeof document<"u"&&!d.current){let y=document.getElementById(Qr);y||(y=document.createElement("div"),y.id=Qr,document.body.appendChild(y)),d.current=y}if(c.useEffect(()=>{if(n){b(!0);const P=window.setTimeout(()=>g(!0),Id);return()=>window.clearTimeout(P)}g(!1);const y=window.setTimeout(()=>b(!1),Xr+40);return()=>window.clearTimeout(y)},[n]),c.useEffect(()=>{if(!n)return;const y=document.body.style.overflow;u==="drawer"&&(document.body.style.overflow="hidden");const P=C=>{C.key!=="Escape"||x.current==="terminal"||wa(C.target)||S.current()};return document.addEventListener("keydown",P),()=>{u==="drawer"&&(document.body.style.overflow=y),document.removeEventListener("keydown",P)}},[n,u]),u==="drawer"&&!d.current)return null;const N=[{id:"changes",label:f("mobile.menu.changes"),icon:t.jsx(Z,{name:"git-branch",className:"h-3.5 w-3.5"})},{id:"files",label:f("mobile.menu.files"),icon:t.jsx(Z,{name:"file-text",className:"h-3.5 w-3.5"})},{id:"terminal",label:f("mobile.menu.terminal"),icon:t.jsx(Z,{name:"terminal",className:"h-3.5 w-3.5"})},{id:"notes",label:f("contextRail.surface.notes"),icon:t.jsx(Z,{name:"sticky-note",className:"h-3.5 w-3.5"})},{id:"mcp",label:f("mobile.menu.mcp"),icon:t.jsx(va,{className:"h-3.5 w-3.5"})}],A=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-[var(--oc-header-height,56px)] shrink-0 items-center gap-2 px-3",children:[t.jsx("div",{className:"flex h-9 min-w-0 flex-1 items-center",children:h?t.jsx(Sl,{items:N,activeId:s,onSelect:y=>i(y),layoutMode:"fit",variant:"active-pill",nonCompositedIndicator:!0,inactiveTabsIconOnly:!0,className:"h-full"}):null}),t.jsx("button",{type:"button",className:"-mr-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-ring","aria-label":f("mobile.surface.closeAria"),onClick:e,style:{touchAction:"manipulation"},children:t.jsx(Z,{name:"close",className:"size-5"})})]}),t.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[E.has("changes")?t.jsx("div",{className:Q("h-full",s!=="changes"&&"hidden"),children:t.jsx(Ve,{children:t.jsx(wd,{visible:n&&s==="changes",initialDiff:r})})},r?`changes:${r.path}:${r.staged}`:"changes"):null,E.has("files")?t.jsx("div",{className:Q("h-full",s!=="files"&&"hidden"),children:t.jsx(Ve,{children:t.jsx(Ed,{})})}):null,E.has("terminal")?t.jsx("div",{className:Q("h-full",s!=="terminal"&&"hidden"),children:t.jsx(Ve,{children:t.jsx(Nl,{visible:n&&s==="terminal"})})}):null,E.has("notes")?t.jsx("div",{className:Q("h-full",s!=="notes"&&"hidden"),children:t.jsx(Ve,{children:t.jsx(Cl,{onActionComplete:e,onOpenPlan:o})})}):null,E.has("mcp")?t.jsx("div",{className:Q("h-full",s!=="mcp"&&"hidden"),children:t.jsx(Ve,{children:t.jsx(Dd,{onOpenMcpSettings:a})})}):null]})]});return u==="panel"?t.jsx("div",{className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:A}):$t.createPortal(t.jsx("section",{ref:l,role:"dialog","aria-modal":"true","aria-label":f("mobile.header.openWorkspaceAria"),"aria-hidden":!n,className:"oc-keyboard-inset-surface oc-bottom-safe-surface fixed inset-0 z-50 flex flex-col bg-background text-foreground",style:{paddingTop:"var(--oc-safe-area-top, 0px)",transform:p?"none":"translateX(100%)",transition:`transform ${Xr}ms ${Td}`,visibility:h?"visible":"hidden",pointerEvents:n?"auto":"none"},children:A}),d.current)};function Md(n){return n.currentDirectory}function zd(n){return n.refresh}function Od(n){return n.loadMcpConfigs}function Bd(n){return window.setTimeout(n,500)}function Ld(n){const e=le.c(4),s=2500,{uiFont:i}=ja(),[r,o]=c.useState(!1);let a,u;return e[0]!==s||e[1]!==i?(a=()=>{let f=!1;const d=()=>{f||o(!0)},l=()=>{requestAnimationFrame(()=>requestAnimationFrame(d))},p=Promise.all([ka(i).catch(Ud),document.fonts?.ready?.then(Vd).catch(Wd)??Promise.resolve(),xc.catch(Fd)]).then($d),g=new Promise(h=>{window.setTimeout(h,s)});return Promise.race([p,g]).then(l),()=>{f=!0}},u=[i,s],e[0]=s,e[1]=i,e[2]=a,e[3]=u):(a=e[2],u=e[3]),c.useEffect(a,u),r}function $d(){}function Fd(){}function Wd(){}function Vd(){}function Ud(){}const Gd="openchamber",Kd=n=>n.replace(/^\/+|\/+$/g,""),Hd=n=>{const e=Kd(n.pathname).split("/").filter(Boolean);return n.host?[n.host,...e]:e};function qd(n){if(typeof n!="string"||n.length===0)return null;let e;try{e=new URL(n)}catch{return null}if(e.protocol!==`${Gd}:`)return null;const s=Hd(e),i=(s[0]??"").toLowerCase(),r=s.slice(1),o=e.searchParams;switch(i){case"session":{const a=r[0]||o.get("id")||"";return a?{type:"session",sessionId:a,directory:o.get("dir")??void 0}:null}case"new":case"new-session":return{type:"new-session",directory:o.get("dir")??void 0,projectId:o.get("project")??void 0,agent:o.get("agent")??void 0,model:o.get("model")??void 0};case"sessions":{const a=o.get("filter");return{type:"sessions",filter:a==="attention"||a==="recent"||a==="all"?a:void 0}}case"status":return{type:"status"};case"settings":return{type:"settings",section:r[0]||o.get("section")||void 0};case"changes":return{type:"changes",path:r.join("/")||o.get("path")||void 0,staged:o.get("staged")==="true"};case"view":{const a=(r[0]||"").toLowerCase();return a==="changes"?{type:"changes"}:a==="files"||a==="mcp"||a==="instances"||a==="update"?{type:"view",target:a}:null}default:return null}}let He={},Zi=!1,ms=null;const Jd=n=>{switch(n.type){case"session":return Ne.getState().setCurrentSession(n.sessionId,n.directory??null),!0;case"new-session":{const e=Ne.getState();return e.openNewSessionDraft(),(n.directory||n.projectId)&&e.setNewSessionDraftTarget({directoryOverride:n.directory??null,projectId:n.projectId??null,selectedProjectId:n.projectId??null}),!0}case"sessions":return He.openSessions?(He.openSessions(n.filter),!0):!1;case"status":return He.openSessions?(He.openSessions(),!0):!1;case"view":return He.openView?(He.openView(n.target),!0):!1;case"changes":return He.openChanges?(He.openChanges({path:n.path,staged:n.staged}),!0):!1;case"settings":return He.openSettings?(He.openSettings(n.section),!0):!1}},nr=()=>{if(!Zi||!ms)return;const n=ms;ms=null,Jd(n)||(ms=n)},eo=n=>{ms=n,nr()},Zr=n=>{const e=qd(n);e&&eo(e)},Yd=n=>{Zi=n,nr()},Qd=n=>{const e=le.c(3);let s,i;e[0]!==n?(s=()=>(He=n,nr(),()=>{He===n&&(He={})}),i=[n],e[0]=n,e[1]=s,e[2]=i):(s=e[1],i=e[2]),c.useEffect(s,i)},Xd=n=>{const{ready:e}=n;c.useEffect(()=>{Yd(e)},[e]),c.useEffect(()=>{if(!Te())return;let s=!1;const i=[];return Ft(()=>import("./vendor-capacitor-app-BrDJj9I_.js"),__vite__mapDeps([127,5,128])).then(async({App:r})=>{if(s)return;const o=await r.addListener("appUrlOpen",a=>{Zr(a?.url)});if(s){o.remove();return}i.push(()=>{o.remove()})}).catch(()=>{}),Ft(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([129,128])).then(async({PushNotifications:r})=>{if(s)return;const o=await r.addListener("pushNotificationActionPerformed",a=>{const u=a?.notification?.data,f=typeof u?.url=="string"?u.url:typeof u?.deeplink=="string"?u.deeplink:void 0;if(f){Zr(f);return}const d=typeof u?.sessionId=="string"?u.sessionId:void 0;d&&eo({type:"session",sessionId:d})});if(s){o.remove();return}i.push(()=>{o.remove()})}).catch(()=>{}),()=>{s=!0,i.forEach(r=>r())}},[])},Zd=()=>{if(typeof window>"u")return;const n=window.__OPENCHAMBER_APNS_ENV__;if(n==="development")return"sandbox";if(n==="production")return"production"},ef=()=>{if(typeof window>"u")return!1;const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"},tf=n=>{const{enabled:e}=n,s=it(r=>r.nativeNotificationsEnabled),i=c.useRef(null);c.useEffect(()=>{if(!e||!s||!ef())return;let r=!1;const o=[];return Ft(()=>import("./vendor-capacitor-push-notifications-KNe1zSBF.js"),__vite__mapDeps([129,128])).then(async({PushNotifications:a})=>{if(r)return;let u=await a.checkPermissions().catch(()=>null);if(u?.receive!=="granted"&&(u=await a.requestPermissions().catch(()=>null)),u?.receive!=="granted")return;const f=await a.addListener("registration",l=>{i.current=l.value,gr()?.push?.registerApnsToken?.({token:l.value,platform:ri(),environment:Zd()})}),d=await a.addListener("registrationError",l=>{console.warn("[Push] APNs registration error:",l)});if(await a.register().catch(()=>{}),r){f.remove(),d.remove();return}o.push(()=>{f.remove()},()=>{d.remove()})}).catch(()=>{}),()=>{r=!0,o.forEach(a=>a())}},[e,s]),c.useEffect(()=>{if(s)return;const r=i.current;if(!r)return;i.current=null,gr()?.push?.unregisterApnsToken?.({token:r})},[s])},ei=n=>{const e=le.c(12),{side:s,isResizing:i,ariaLabel:r,handleProps:o}=n,a=s==="left"?"right-0":"left-0";let u;e[0]!==a?(u=Q("absolute inset-y-0 z-50 w-6 cursor-col-resize touch-none",a),e[0]=a,e[1]=u):u=e[1];const f=s==="left"?"right-0":"left-0",d=i&&"bg-[var(--interactive-border)]";let l;e[2]!==f||e[3]!==d?(l=Q("absolute inset-y-0 w-[3px] transition-colors",f,d),e[2]=f,e[3]=d,e[4]=l):l=e[4];let p;e[5]!==l?(p=t.jsx("div",{className:l}),e[5]=l,e[6]=p):p=e[6];let g;return e[7]!==r||e[8]!==o||e[9]!==u||e[10]!==p?(g=t.jsx("div",{className:u,role:"separator","aria-orientation":"vertical","aria-label":r,...o,children:p}),e[7]=r,e[8]=o,e[9]=u,e[10]=p,e[11]=g):g=e[11],g},sf=320,nf=380,ti=280,rf=560,of=900;function si(n,e,s,i){const r=le.c(23),o=i===void 0?rf:i,a=c.useRef(null);let u;r[0]!==s||r[1]!==o||r[2]!==e?(u=()=>{if(typeof window>"u")return s;const j=Number.parseInt(window.localStorage.getItem(e)??"",10);return Number.isFinite(j)?Math.min(o,Math.max(ti,j)):s},r[0]=s,r[1]=o,r[2]=e,r[3]=u):u=r[3];const[f,d]=c.useState(u),[l,p]=c.useState(!1),g=c.useRef(0),h=c.useRef(f),b=c.useRef(null),S=c.useRef(null);let x;r[4]!==o?(x=j=>Math.min(o,Math.max(ti,Math.round(j))),r[4]=o,r[5]=x):x=r[5];const E=x;let v;r[6]===Symbol.for("react.memo_cache_sentinel")?(v=j=>{const I=a.current;I&&(I.style.width=`${j}px`,I.style.minWidth=`${j}px`,I.style.maxWidth=`${j}px`,I.style.setProperty("--oc-ipad-sidebar-width",`${j}px`))},r[6]=v):v=r[6];const N=v;let A;r[7]!==f?(A=j=>{try{j.currentTarget.setPointerCapture(j.pointerId)}catch{}S.current=j.pointerId,g.current=j.clientX,h.current=f,b.current=f,p(!0),j.preventDefault()},r[7]=f,r[8]=A):A=r[8];const y=A;let P;r[9]!==E||r[10]!==n?(P=j=>{if(S.current!==j.pointerId)return;const I=j.clientX-g.current,$=E(h.current+(n==="left"?I:-I));b.current!==$&&(b.current=$,N($))},r[9]=E,r[10]=n,r[11]=P):P=r[11];const C=P;let R;r[12]!==E||r[13]!==e?(R=j=>{if(S.current!==j.pointerId)return;try{j.currentTarget.releasePointerCapture(j.pointerId)}catch{}const I=E(b.current??h.current);S.current=null,b.current=null,p(!1),d(I);try{window.localStorage.setItem(e,String(I))}catch{}},r[12]=E,r[13]=e,r[14]=R):R=r[14];const k=R;let z;r[15]!==y||r[16]!==k||r[17]!==C?(z={onPointerDown:y,onPointerMove:C,onPointerUp:k,onPointerCancel:k},r[15]=y,r[16]=k,r[17]=C,r[18]=z):z=r[18];const D=z;let M;return r[19]!==D||r[20]!==l||r[21]!==f?(M={asideRef:a,width:f,isResizing:l,handleProps:D},r[19]=D,r[20]=l,r[21]=f,r[22]=M):M=r[22],M}const af=["general","appearance","chat","notifications","sessions","routing","git","magic-prompts","snippets","behavior","agents","commands","mcp","plugins","skills.installed","skills.catalog","providers","web-search","usage","voice","integrations","about"],lf=1e3,cf=({onActiveConnectionDeleted:n})=>{const{t:e}=pe();Ml();const[s,i]=c.useState(!1),[r,o]=c.useState(null),[a,u]=c.useState(!1),[f,d]=c.useState("changes"),[l,p]=c.useState(null),[g,h]=c.useState("nav"),[b,S]=c.useState(null),x=it(Y=>Y.setSettingsPage),E=it(Y=>Y.wideChatLayoutEnabled),v=zt(Y=>Y.available),N=zt(Y=>Y.runtimeType),A=c.useMemo(()=>_n(),[]),y=Bt(Y=>Y.mcpServers),P=Bt(Y=>Y.setMcpDraft),C=Bt(Y=>Y.setSelectedMcp),R=c.useCallback(()=>{o(null),p(null)},[]),k=c.useCallback(Y=>{o(Y)},[]),z=c.useCallback(()=>{u(!1)},[]),D=c.useCallback(Y=>{h(Y),k("settings")},[k]),{enabled:M,roomyForPanels:j}=Rn(),$=Ga()==="portrait",w=Ka(),[B,U]=c.useState(()=>Ha().roomyForPanels),O=c.useCallback(()=>{U(Y=>!Y)},[]);c.useEffect(()=>{M||U(!1)},[M]);const L=c.useCallback(()=>{S(null),d("files"),u(!0)},[]);c.useEffect(()=>wi(Y=>{if(Y.type!=="file-open-request")return;const fe=Y.directory??pt.getState().currentDirectory;fe&&(it.getState().openContextFile(fe,Y.path),L())}),[L]);const ie=c.useCallback((Y=null)=>{S(Y),d("changes"),u(!0)},[]),te=si("left","openchamber.ipad.leftSidebarWidth",sf),V=si("right","openchamber.ipad.rightSidebarWidth",nf,of),_=j,G=_&&a?V.width:0,J=M&&B?te.width:0;c.useEffect(()=>{if(typeof document>"u")return;const Y=document.documentElement;return Y.style.setProperty("--oc-chat-inset-left",`${J}px`),Y.style.setProperty("--oc-chat-inset-right",`${G}px`),()=>{Y.style.removeProperty("--oc-chat-inset-left"),Y.style.removeProperty("--oc-chat-inset-right")}},[J,G]),c.useEffect(()=>{if(typeof document>"u")return;const Y=document.documentElement;return Y.classList.toggle("wide-chat-layout",E),()=>Y.classList.remove("wide-chat-layout")},[E]),c.useEffect(()=>{if(typeof document>"u")return;const Y=M&&($||w),fe=document.documentElement;return fe.classList.toggle("oc-keep-draft-starters",Y),()=>fe.classList.remove("oc-keep-draft-starters")},[w,M,$]);const H=c.useMemo(()=>({openChanges:({diffPath:Y,staged:fe}={})=>{ie(Y?{path:Y,staged:fe===!0}:null)},openFiles:()=>L(),openSettings:()=>D("nav")}),[ie,L,D]),X=c.useMemo(()=>({openSessions:()=>{M?U(!0):i(!0)},openView:Y=>{if(Y==="files"){L();return}if(Y==="mcp"){d("mcp"),u(!0);return}k(Y)},openChanges:({path:Y,staged:fe}={})=>{ie(Y?{path:Y,staged:fe===!0}:null)},openSettings:Y=>{Y&&x(Y),D(Y?"page-content":"nav")}}),[M,ie,L,D,k,x]);Qd(X);const ne=c.useRef(null);sr(ne,{onLeftEdgeSwipe:()=>{M?U(!0):i(!0)},onRightEdgeSwipe:()=>u(!0)});const re=c.useRef(null),ce=c.useCallback(Y=>{re.current=Y},[]),ue=c.useCallback(()=>l?(p(null),!0):r==="settings"&&re.current?.()?!0:r?(R(),!0):a?(z(),!0):s?(i(!1),!0):!1,[r,R,z,l,s,a]);qa(ue);const q=!A&&v&&(N==="desktop"||N==="web"),oe=M?"dialog":"fullscreen",he=c.useMemo(()=>({instanceLabel:A?us():null,onOpenInstances:A?()=>k("instances"):void 0,onOpenSettings:()=>D("nav"),onOpenUsage:()=>k("usage"),onOpenUpdate:q?()=>k("update"):void 0}),[D,k,A,q]),ke=c.useCallback(()=>{const Y="new-mcp-server";let fe=Y,Re=1;for(;y.some(Ie=>Ie.name===fe);)fe=`${Y}-${Re}`,Re+=1;P({name:fe,scope:"user",type:"local",command:[],url:"",environment:[],headers:[],oauthEnabled:!0,oauthClientId:"",oauthClientSecret:"",oauthScope:"",oauthRedirectUri:"",oauthCallbackPort:"",oauthAuthServerMetadataUrl:"",protocol:"legacy",timeoutStartup:"",timeoutCatalog:"",timeoutExecution:"",codemode:"default",disabled:!1}),C(fe),x("mcp"),D("page-content")},[y,D,P,C,x]);return t.jsx(Ja,{actions:H,children:t.jsxs("div",{className:"oc-mobile-app-shell main-content-safe-area flex h-[100dvh] flex-row bg-background text-foreground","data-page-scroll-lock":"true",children:[M?t.jsxs("aside",{ref:te.asideRef,className:Q("relative flex h-full shrink-0 flex-col overflow-hidden border-r border-border/70 bg-background will-change-[width] motion-reduce:transition-none",!B&&"border-r-0"),style:{width:B?te.width:0,minWidth:B?te.width:0,maxWidth:B?te.width:0,"--oc-ipad-sidebar-width":`${te.width}px`,overflowX:"clip",paddingTop:"var(--oc-safe-area-top, 0px)",transitionProperty:te.isResizing?"none":"width, min-width, max-width",transitionDuration:"200ms",transitionTimingFunction:"cubic-bezier(0.22, 1, 0.36, 1)"},"aria-hidden":!B,"data-page-scroll-lock":"true",children:[t.jsx("div",{className:Q("flex h-full shrink-0 flex-col transition-opacity duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",te.isResizing&&"pointer-events-none",!B&&"pointer-events-none select-none opacity-0"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden"},children:t.jsx(Ve,{children:t.jsx(Ur,{open:!0,variant:"sidebar",onOpenChange:Y=>{!Y&&!j&&U(!1)},footer:he})})}),B?t.jsx(ei,{side:"left",isResizing:te.isResizing,ariaLabel:e("sidebar.resize.leftPanelAria"),handleProps:te.handleProps}):null]}):null,t.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col","data-page-scroll-lock":"true",children:[t.jsx(Eu,{onOpenSessions:()=>M?O():i(!0),onOpenWorkspace:()=>u(!0),compactTitle:M}),t.jsx("main",{ref:ne,className:"relative min-h-0 flex-1 overflow-hidden","data-page-scroll-lock":"true",children:t.jsx("div",{className:"h-full w-full",children:t.jsx(Ve,{children:t.jsx(zl,{})})})})]}),M?null:t.jsx(Ur,{open:s,onOpenChange:i,footer:he}),t.jsxs("aside",{ref:V.asideRef,className:Q("relative flex h-full shrink-0 flex-col overflow-hidden border-l border-border/70 bg-background will-change-[width] motion-reduce:transition-none",!G&&"border-l-0"),style:{width:G,minWidth:G,maxWidth:G,"--oc-ipad-sidebar-width":`${V.width}px`,overflowX:"clip",paddingTop:"var(--oc-safe-area-top, 0px)",transitionProperty:V.isResizing?"none":"width, min-width, max-width",transitionDuration:"200ms",transitionTimingFunction:"cubic-bezier(0.22, 1, 0.36, 1)"},"aria-hidden":!G,"data-page-scroll-lock":"true",children:[t.jsx("div",{className:Q("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",V.isResizing&&"pointer-events-none",!G&&"pointer-events-none select-none opacity-0"),style:{width:"var(--oc-ipad-sidebar-width)",overflowX:"hidden"},children:t.jsx(Ve,{children:t.jsx(_d,{open:a,onClose:z,tab:f,onTabChange:d,pendingChangesDiff:b,onOpenPlan:p,onOpenMcpSettings:ke,variant:_?"panel":"drawer"})})}),G?t.jsx(ei,{side:"right",isResizing:V.isResizing,ariaLabel:e("sidebar.resize.rightPanelAria"),handleProps:V.handleProps}):null]}),l?t.jsx(Dt,{open:!0,variant:oe,onClose:()=>p(null),ariaLabel:l.title,title:l.title,children:t.jsx(Ve,{children:t.jsx(Fl,{savedProjectPlan:{projectRef:l.projectRef,planId:l.id},onNavigatedToChat:()=>{R(),z()}})})}):null,r==="instances"&&A?t.jsx(Dt,{open:!0,variant:oe,dialogAlign:"app",onClose:R,ariaLabel:e("mobile.menu.instances"),title:e("mobile.menu.instances"),children:t.jsx(Tu,{onConnect:R,onActiveConnectionDeleted:n})}):null,r==="settings"?t.jsx(Dt,{open:!0,variant:oe,dialogAlign:"app",onClose:R,ariaLabel:e("mobile.menu.settings"),headerless:!0,children:t.jsx(Ve,{children:t.jsx(Ll,{forceMobile:!0,isWindowed:!0,initialMobileStage:g,registerBackHandler:ce,visiblePageSlugs:[...af],onClose:R})})}):null,r==="usage"?t.jsx(Dt,{open:!0,variant:oe,dialogAlign:"app",onClose:R,ariaLabel:e("usageStats.title"),title:e("usageStats.title"),children:t.jsx(Ve,{children:t.jsx(Ol,{})})}):null,r==="update"?t.jsx(Dt,{open:!0,variant:oe,dialogAlign:"app",onClose:R,ariaLabel:e("mobile.menu.update"),title:e("mobile.menu.update"),children:t.jsx(Ve,{children:t.jsx("div",{className:"h-full overflow-auto px-5 py-4",children:t.jsx($l,{initialUpdateDialogOpen:!0})})})}):null]})})};function ni({apis:n}){const{t:e}=pe(),s=qe(_=>_.initializeApp),i=qe(_=>_.isInitialized),r=qe(_=>_.isConnected),o=qe(_=>_.connectionPhase),a=qe(_=>_.providers.length),u=qe(_=>_.agents.length),f=qe(_=>_.loadProviders),d=qe(_=>_.loadAgents),l=pt(_=>_.currentDirectory),p=Ne(_=>_.error),g=Ne(_=>_.clearError),h=it(_=>_.setIsMobile),b=Sa(_=>_.refreshStatus),S=Na(_=>_.refreshStatus),x=Ca(_=>_.setPlanModeEnabled),E=We(_=>_.projects),[v,N]=c.useState(0),[A,y]=c.useState(0),[P,C]=c.useState(!1),[R,k]=c.useState("pending"),[z,D]=c.useState(null),M=c.useMemo(()=>us(),[]),[,j]=c.useReducer(_=>_+1,0),I=c.useMemo(()=>_n(),[]),$=c.useRef(0),w=c.useRef(0),B=c.useCallback(()=>{const _=st(),G=w.current+1;if(w.current=G,!_){as("resume:auto-connect",{}),ls();return}as("resume:reprobe",{});const J=()=>{s(),b(n.github,{force:!0}),S(n.linear,{force:!0}),a===0&&f({source:"mobileApp:nativeResume"}),u===0&&d({source:"mobileApp:nativeResume"})},H=ne=>{as("resume:disconnect",{reason:ne}),_t({apiBaseUrl:"",clientToken:null,runtimeKey:As}),N(re=>re+1)};Os().then(ne=>{if(w.current===G){if(ne==="no-connection"){H("no-connection");return}if(ne==="needs-login"){D({kind:"auth-expired",label:us()??""}),H("needs-login");return}if(ne==="unreachable"){const re=[4e3,1e4],ce=ue=>{window.setTimeout(()=>{if(w.current!==G)return;const q=ue===re.length-1;Os({fast:!q}).then(oe=>{if(w.current===G&&oe!=="switched"){if(oe==="unchanged"){J();return}if(oe==="needs-login"){D({kind:"auth-expired",label:us()??""}),H("retry-needs-login");return}if(!q){ce(ue+1);return}H(`retry-${oe}`)}})},re[ue])};ce(0);return}ne!=="switched"&&J()}});const X=Date.now();X-$.current>=lf&&($.current=X,window.dispatchEvent(new Event("openchamber:system-resume")))},[u,n.github,n.linear,s,d,f,a,b,S]);Ra(),Ea(B),c.useEffect(()=>{if(!I)return;let _;const G=()=>{window.clearTimeout(_),_=window.setTimeout(()=>B(),1500)};return window.addEventListener("online",G),()=>{window.removeEventListener("online",G),window.clearTimeout(_)}},[I,B]),c.useEffect(()=>{if(I)return br.subscribe((_,G)=>{_.state==="expired"&&G.state!=="expired"&&(B(),br.getState().markAuthenticated())})},[I,B]),c.useEffect(()=>(xr(n),()=>xr(null)),[n]),c.useEffect(()=>oi(_=>{if(as("endpoint:changed",{runtimeKey:_.runtimeKey||"none",previousRuntimeKey:_.previousRuntimeKey||"none",connected:!!_.apiBaseUrl}),!!_.runtimeKey&&_.runtimeKey===_.previousRuntimeKey){El(),j();return}Pl(_),y(J=>J+1),N(J=>J+1)}),[]),c.useEffect(()=>{if(!I||r||st()){k("done");return}let _=!1;return k("attempting"),(async()=>{const G=await ls().catch(()=>({status:"no-candidate"}));_||(G.status==="unreachable"?D({kind:"unreachable",label:G.label}):G.status==="needs-login"&&D({kind:"auth-expired",label:G.label}),k("done"),G.status==="unreachable"&&ls({fast:!1,skipIfConnected:!0}).catch(()=>null))})(),()=>{_=!0}},[]),c.useEffect(()=>{if(!I||!st())return;let _=!1;const G=J=>{as("cold-launch:drop",{kind:J?.kind??"unknown"}),J&&D(J),_t({apiBaseUrl:"",clientToken:null,runtimeKey:As}),N(H=>H+1)};return Os().then(async J=>{if(_||J==="switched"||J==="unchanged")return;const H=us();if(J==="needs-login"){G({kind:"auth-expired",label:H??""});return}if(J==="unreachable"){G(H?{kind:"unreachable",label:H}:null),ls({fast:!1,skipIfConnected:!0}).catch(()=>null);return}const X=await ls().catch(()=>({status:"no-candidate"}));_||X.status==="connected"||(X.status==="needs-login"?G({kind:"auth-expired",label:X.label}):X.status==="unreachable"?G({kind:"unreachable",label:X.label}):G(null))}),()=>{_=!0}},[]),c.useEffect(()=>{h(!0)},[h]),c.useEffect(()=>{I&&!st()||s()},[v,s,I]),c.useEffect(()=>{r&&(a===0&&f({source:"mobileApp:recovery"}),u===0&&d({source:"mobileApp:recovery"}))},[u,r,d,f,a]);const U=c.useRef(!1),[O,L]=c.useState(I);c.useEffect(()=>{if(!I||!r||U.current)return;if(Ne.getState().currentSessionId){U.current=!0,L(!1);return}const _=Kt(),G=Pa(_);if(!G){U.current=!0,L(!1);return}let J=!1;const H=window.setTimeout(()=>L(!1),6e3);return(async()=>{const X=await In().catch(()=>null);if(J)return;if(!X){L(!1);return}U.current=!0;const ne=X.activeSessions.find(ce=>ce.id===G.sessionId);if(!ne){Aa(_),L(!1);return}const re=Ne.getState();re.currentSessionId||re.setCurrentSession(ne.id,Cn(ne)??G.directory??void 0),L(!1)})(),()=>{J=!0,window.clearTimeout(H)}},[v,r,I]),c.useEffect(()=>{r&&yr.setDirectory(l)},[l,r]),c.useEffect(()=>{r&&(b(n.github,{force:!0}),S(n.linear,{force:!0}))},[n.github,n.linear,r,b,S]),c.useEffect(()=>{if(!r||E.length===0)return;let _=!1;return(async()=>{const J=new Map(Ne.getState().availableWorktreesByProject);if(await Promise.all(E.map(async ne=>{const re=ne.path.replace(/\\/g,"/").replace(/\/+$/,"");if(re)try{if(!(Fe.getState().directories.get(re)?.isGitRepo??await Ft(()=>import("./useAppFontEffects-BN06mgHB.js").then(oe=>oe.lx),__vite__mapDeps([9,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82])).then(oe=>oe.checkIsGitRepository(re))))return;const q=await xi({id:ne.id,path:re});if(_)return;J.set(re,q)}catch{}})),_)return;const H=yi(E,J),X=Ne.getState().availableWorktreesByProject;Va(H,X)||Ne.setState({availableWorktrees:[...H.values()].flat(),availableWorktreesByProject:H})})(),()=>{_=!0}},[r,E]),c.useEffect(()=>{if(!r)return;let _=!1;const G=wi(J=>{J.type==="worktree-changed"&&Ua(E,J.directories,()=>_)});return()=>{_=!0,G()}},[r,E]),c.useEffect(()=>{let _=!1;return(async()=>{const J=await Sn("/health",{method:"GET"}).catch(()=>null);if(!J||!J.ok||_)return;const H=await J.json().catch(()=>null);if(!H||_)return;const X=H.planModeExperimentalEnabled;x(X===!0||X===1||X==="1"||X==="true")})(),()=>{_=!0}},[x]),c.useEffect(()=>{if(!p)return;const _=window.setTimeout(()=>g(),5e3);return()=>window.clearTimeout(_)},[g,p]),c.useEffect(()=>{if(!(!r&&(I?!!st():!0))){C(!1);return}const G=window.setTimeout(()=>{C(!0)},I?4e3:8e3);return()=>window.clearTimeout(G)},[r,I,v,A]),Ia(),Ta({enabled:!0}),Al(),Da(),_a(),Il(),tf({enabled:I&&r}),Xd({ready:I&&r&&i});const ie=Ld(),te=!r&&o==="reconnecting";if(!ie)return t.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:t.jsx(Mt,{width:120,height:120,isAnimated:!0,variant:"splash"})});const V=!!st();return I&&(!V||!r&&!te)?V?t.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] px-6 text-center text-foreground",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-4",children:[t.jsx(Mt,{width:120,height:120,isAnimated:!P,variant:"splash"}),P?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h1",{className:"typography-h3 text-foreground",children:e("sessionAuth.error.networkTitle")}),t.jsx("p",{className:"typography-body text-muted-foreground",children:e("mobile.connect.recovery.description")})]}),t.jsx(be,{type:"button",variant:"outline",onClick:()=>{_t({apiBaseUrl:"",clientToken:null,runtimeKey:As}),N(_=>_+1)},children:e("mobile.connect.cancelPassword")})]}):null]})}):R!=="done"?t.jsxs("main",{className:"relative flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:[t.jsx(Mt,{width:120,height:120,isAnimated:!0,variant:"splash"}),M?t.jsxs("div",{className:"absolute inset-x-0 top-[calc(50%+84px)] flex flex-col items-center gap-0.5 px-6 text-center",children:[t.jsx("p",{className:"typography-small text-muted-foreground",children:e("mobile.connect.splash.connectingTo")}),t.jsxs("p",{className:"typography-small text-foreground",children:[M,t.jsx(Ma,{})]})]}):null]}):t.jsx(t.Fragment,{children:t.jsx(fu,{onConnected:()=>N(_=>_+1),notice:z})}):!r&&!te?P?t.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-background px-6 text-center text-foreground",children:t.jsxs("div",{className:"max-w-sm space-y-3",children:[t.jsx("h1",{className:"typography-h3 text-foreground",children:e("sessionAuth.error.networkTitle")}),t.jsx("p",{className:"typography-body text-muted-foreground",children:e("sessionAuth.error.networkDescription")})]})}):t.jsx("main",{className:"flex min-h-dvh items-center justify-center bg-[var(--splash-background,var(--surface-background))] text-foreground",children:t.jsx(Mt,{width:120,height:120,isAnimated:!0,variant:"splash"})}):t.jsx(Ve,{children:t.jsx(za,{sdk:yr.getSdkClient(),directory:l||"",children:t.jsx(Oa,{apis:n,children:t.jsx(Ba,{delayDuration:300,skipDelayDuration:150,children:t.jsxs("div",{className:"h-full bg-background text-foreground",children:[t.jsx(Tl,{ready:!I||!O,animated:!0}),t.jsx(La,{embeddedBackgroundWorkEnabled:i}),t.jsx(Dl,{}),t.jsx(Rc,{}),t.jsx(cf,{onActiveConnectionDeleted:()=>{_t({apiBaseUrl:"",clientToken:null,runtimeKey:As}),N(_=>_+1)}}),t.jsx($a,{}),t.jsx(Fa,{}),t.jsx(Wa,{position:"top-center",offset:"calc(var(--oc-safe-area-top, 0px) + 16px)"}),i?t.jsx(_l,{}):null]})})})},A)})}function uf(n){const e=le.c(4),s=c.useSyncExternalStore(df,st,st);if(_n()&&!s){let r;return e[0]!==n?(r=t.jsx(ni,{...n}),e[0]=n,e[1]=r):r=e[1],r}let i;return e[2]!==n?(i=t.jsx(Rl,{children:t.jsx(ni,{...n})}),e[2]=n,e[3]=i):i=e[3],i}function df(n){return oi(()=>n())}const ff=()=>{sl(),So().then(()=>{Promise.all([No(),nl()]).catch(n=>{console.error("[mobile-main] settings init failed:",n)}),rl(),il(),ol()}).catch(n=>{console.error("[mobile-main] appearance init failed:",n)}).finally(()=>{yc()})};function Up(n){window.__OPENCHAMBER_SURFACE__="mobile",Ya(),ff(),Cc(),Qa();const e=document.getElementById("root");if(!e)throw new Error("Root element not found");const i=window.Capacitor?.isNativePlatform?.()===!0||window.location.protocol==="capacitor:",r=i?{...n,notifications:{notifyAgentCompletion:async()=>!1,canNotify:()=>!1}}:n,o=t.jsx(uf,{apis:r});go.createRoot(e).render(t.jsx(bn.StrictMode,{children:t.jsx(Xa,{children:t.jsx(Za,{children:t.jsx(el,{children:t.jsx(Bl,{children:i?o:t.jsx(tl,{children:o})})})})})}))}export{Up as renderMobileApp};
|