@yuriai/web 0.3.5 → 0.3.6-beta.11
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/{AgentAvatar-CNOu_vy0.js → AgentAvatar-Ce3xIokt.js} +1 -1
- package/dist/assets/{AgentSelector-K5JSbXv3.js → AgentSelector-CMGO3rt5.js} +1 -1
- package/dist/assets/ArchivedSessionsDialog-7SxXt_dN.js +1 -0
- package/dist/assets/{AssistantConversationSurface-u3ndSmZP.js → AssistantConversationSurface-DN_0TqBx.js} +3 -3
- package/dist/assets/AssistantSessionCard-CpXxEZ9s.js +2 -0
- package/dist/assets/{AssistantUnreadBadge-opyLZlZd.js → AssistantUnreadBadge-DMz3nOHJ.js} +1 -1
- package/dist/assets/{AssistantView-CDPTtrUZ.js → AssistantView-hrY8xNCO.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-Vghb8xlt.js → AssistantWorkingAvatar-D8BEeeXa.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-Dt4OP3J-.js → AssistantsSettingsPage-6dBzudvs.js} +1 -1
- package/dist/assets/BinaryFileFallback-Ck_aBVmU.js +1 -0
- package/dist/assets/{BtwPanel-DnMW6R43.js → BtwPanel-CXo0GBAo.js} +3 -3
- package/dist/assets/{BusyDots-FXSlMe2F.js → BusyDots-CWyfTnAt.js} +3 -3
- package/dist/assets/ChatContainer-C0aZYA_a.js +65 -0
- package/dist/assets/{ChatView-AFUNEBdD.js → ChatView-tz6gA9q_.js} +3 -3
- package/dist/assets/{DiagramView-j7aFp44v.js → DiagramView-CzXoWMbU.js} +1 -1
- package/dist/assets/{DiffView-DZ_gKyTO.js → DiffView-CC2W_84v.js} +1 -1
- package/dist/assets/{DiffViewToggle-DkxhEUhV.js → DiffViewToggle-CI88C8kG.js} +1 -1
- package/dist/assets/{ErrorBoundary-CCH4LiRY.js → ErrorBoundary-DBZXhhMA.js} +1 -1
- package/dist/assets/{FadeInOnReveal-DO9PZrJL.js → FadeInOnReveal-Crw10nRn.js} +1 -1
- package/dist/assets/{GuiPluginMount-BCqt2pmM.js → GuiPluginMount-wQ9DWE6I.js} +1 -1
- package/dist/assets/{GuiPluginPage-BSjWEmIu.js → GuiPluginPage-CqHPTVP4.js} +1 -1
- package/dist/assets/{GuiPluginSurface-B8QjacMd.js → GuiPluginSurface-sDPisFX3.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-DfHugxsx.js → GuiPluginTitlebarItems-Dx5pTQiP.js} +1 -1
- package/dist/assets/{GuiPluginWindow-CDycMqzT.js → GuiPluginWindow-BP8DRUZz.js} +1 -1
- package/dist/assets/{Icon-B-w2YKpn.js → Icon-DrO1MlqW.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-DsgRtfYG.js → ImageLoadingPlaceholder-Brhbk0iP.js} +1 -1
- package/dist/assets/{LoadingImage-B3IL7hnv.js → LoadingImage-k1x9Kvl1.js} +1 -1
- package/dist/assets/MarkdownRenderer-BHnonkuY.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-CPgpkd9b.js → MarkdownRendererImpl-CnPzG_rJ.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-BzK1BO80.js → MarkstreamRendererImpl-CBGT2iHG.js} +1 -1
- package/dist/assets/{MobileAssistantSettingsPage-DVpE3b24.js → MobileAssistantSettingsPage-C3BxNP1l.js} +1 -1
- package/dist/assets/{MobileAssistantTab-BbccE67x.js → MobileAssistantTab-BRkzsLvg.js} +1 -1
- package/dist/assets/{MobileBtwPage-BRN1gAmR.js → MobileBtwPage-BjuxFp6a.js} +1 -1
- package/dist/assets/{MobileChangesSurface-BwmSTxeh.js → MobileChangesSurface-B2flw1Ap.js} +1 -1
- package/dist/assets/{MobileChatScreen-Bf42GrQ8.js → MobileChatScreen-D9fpOOvH.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DKWnQoSh.js → MobileDetailNavigation-BVA0JCsG.js} +1 -1
- package/dist/assets/MobileFilesSurface-CMBH785S.js +2 -0
- package/dist/assets/{MobileHtmlNetworkBoundary-BKSYPR9N.js → MobileHtmlNetworkBoundary-BJj2vivL.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-DcRWQlmf.js → MobileOverlayPanel-DPgcB7AO.js} +1 -1
- package/dist/assets/{MobileResizableSheet-CF3Pbot4.js → MobileResizableSheet-D5HcC4ME.js} +1 -1
- package/dist/assets/{MobileSettingsTab-of6zpTsr.js → MobileSettingsTab-B0-1WZRt.js} +1 -1
- package/dist/assets/{MobileShareBridge-CRq9F1rn.js → MobileShareBridge-8X_vdmZN.js} +1 -1
- package/dist/assets/{MobileSurface-DGNomvlu.js → MobileSurface-41iI-7Zd.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-0aJFe3_x.js → MobileTabPageHeader-CPz8P10R.js} +1 -1
- package/dist/assets/{ModelLogo-D27dq-si.js → ModelLogo-D4aymugJ.js} +1 -1
- package/dist/assets/{ModelSelector-Dg__8QLh.js → ModelSelector-BUSeXkcU.js} +1 -1
- package/dist/assets/{MultiRunWindow-COqSg1Nk.js → MultiRunWindow-BbYMumwu.js} +1 -1
- package/dist/assets/{OnboardingScreen-DUNyDwc6.js → OnboardingScreen-DMLpMUuF.js} +1 -1
- package/dist/assets/{OverlayScrollbar-DS6XJ1HA.js → OverlayScrollbar-B0O9-JfD.js} +1 -1
- package/dist/assets/{PierreDiffViewer-BHwj_6j8.js → PierreDiffViewer-DFDVqbNq.js} +1 -1
- package/dist/assets/{ProviderLogo-Cm9RNV_U.js → ProviderLogo-CBoJS4Di.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-DAjHRUrC.js → RemoteAssistantSessionCard-1MEZ6Wc_.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-Bays6pHh.js → RemoteDesktopPanel-CkwyCtui.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-DnwBC7cj.js → ScheduledTasksDialog-Cb_as8Cv.js} +1 -1
- package/dist/assets/{ScrollableOverlay-CkX-buJm.js → ScrollableOverlay-Cuq3KKRE.js} +1 -1
- package/dist/assets/{SettingsGroup-kZ_faXwL.js → SettingsGroup-BE-0Ya_e.js} +1 -1
- package/dist/assets/{SettingsView-C62JngPE.js → SettingsView-Q23asKrK.js} +15 -15
- package/dist/assets/{SettingsWindow-Cm8apHAR.js → SettingsWindow-C5quZoiL.js} +1 -1
- package/dist/assets/{SetupTourDialog-W_UeWH-i.js → SetupTourDialog-nJgPu0Kk.js} +1 -1
- package/dist/assets/{SyncActions-Blnq08ks.js → SyncActions-DddhcMDs.js} +1 -1
- package/dist/assets/{TerminalView-CMugifkh.js → TerminalView-DUwwOkqI.js} +1 -1
- package/dist/assets/{TextSelectionMenu-B2fIBlD3.js → TextSelectionMenu-Cd9EOoKM.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DdSUE2kP.js → ToolOutputDialog-DjekF5-2.js} +1 -1
- package/dist/assets/{YuriLogo-Ceon25sC.js → YuriLogo-CnV3RxpE.js} +1 -1
- package/dist/assets/{YuriWordmark-CW53XKgV.js → YuriWordmark-Bn5KdqMC.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-eNT2QtmP.js → assistant-attachment-cache-Y7yhlQcv.js} +1 -1
- package/dist/assets/{assistantMessagePreview-C7YAFen1.js → assistantMessagePreview-CR3sWqIa.js} +1 -1
- package/dist/assets/{assistantQueries-DxvTFlpL.js → assistantQueries-wJSqumUZ.js} +1 -1
- package/dist/assets/{auto-read-context-Ce0o43YI.js → auto-read-context-0SET_04C.js} +1 -1
- package/dist/assets/{capgoAdapter-DQwUA-Nt.js → capgoAdapter-DgVdXFZa.js} +1 -1
- package/dist/assets/{card-D44sTpdY.js → card-Br81AS-C.js} +1 -1
- package/dist/assets/{chatUpwardIntent-CnS7WWRL.js → chatUpwardIntent-D8gCJWE9.js} +1 -1
- package/dist/assets/{checkbox-DaKe0Tlq.js → checkbox-Cs7zimcx.js} +1 -1
- package/dist/assets/{client-ITylDDCS.js → client-QcYZg8_d.js} +3 -3
- package/dist/assets/{collapsible-CL3SPnOf.js → collapsible-BqnGY5G1.js} +1 -1
- package/dist/assets/{connection-hint-SMNZFDAe.js → connection-hint--2YSFO6b.js} +1 -1
- package/dist/assets/{context-menu-DZunhC8o.js → context-menu-C6YvSFUQ.js} +1 -1
- package/dist/assets/{desktopHosts-BsTrBVja.js → desktopHosts-DFa3lf0i.js} +1 -1
- package/dist/assets/{desktopRelayRestore-BxbRKak_.js → desktopRelayRestore-CGq-Ylgq.js} +1 -1
- package/dist/assets/{device-EIfSfSWk.js → device-CtdJ8KBJ.js} +1 -1
- package/dist/assets/{diagram-DFXqN638.js → diagram-IShCLLT-.js} +1 -1
- package/dist/assets/dialog-B6B8FIrL.css +1 -0
- package/dist/assets/{dialog-CmjXOKMz.js → dialog-C67GCo29.js} +1 -1
- package/dist/assets/{dropdown-menu-BT_66BFT.js → dropdown-menu-B6hbejyF.js} +1 -1
- package/dist/assets/{es-DqYZgeC6.js → es-BelVk9R_.js} +3 -3
- package/dist/assets/{fileMentionTouchSelection-B_62hIQI.js → fileMentionTouchSelection-SC-2eaMJ.js} +1 -1
- package/dist/assets/{fileReferenceActions-TmbrIHBI.js → fileReferenceActions-DEUhs_7h.js} +1 -1
- package/dist/assets/{fr-BHaun7Zq.js → fr-DtUzwB6h.js} +3 -3
- package/dist/assets/{gitApi-CBfYFgtd.js → gitApi-BZ4ZoWbQ.js} +1 -1
- package/dist/assets/gitApiHttp-C8AU1uiY.js +3 -0
- package/dist/assets/{githubAuthQueries-C5RxUNL2.js → githubAuthQueries-IJPWBo0B.js} +1 -1
- package/dist/assets/{historyImportQueries-CZsECryv.js → historyImportQueries-B3QBdaKo.js} +1 -1
- package/dist/assets/host-DchPrZpw.js +1 -0
- package/dist/assets/{i18n-Dojvs57M.js → i18n-BU8XOKjS.js} +1 -1
- package/dist/assets/{icons-D_vRtitD.js → icons-YECUJPe2.js} +1 -1
- package/dist/assets/{imageSource-Cq_p4gAe.js → imageSource-B39pFDdo.js} +1 -1
- package/dist/assets/{input-BllFKOjo.js → input-B2oH-nQc.js} +1 -1
- package/dist/assets/{input-store-dLjM4aiu.js → input-store-PqhVEhUI.js} +1 -1
- package/dist/assets/{insertionBoundaries-Br0Bdl9R.js → insertionBoundaries-B2RO01sd.js} +1 -1
- package/dist/assets/{ja-BGNugvrx.js → ja-CWta3CAu.js} +3 -3
- package/dist/assets/{kbd-CwkasrzN.js → kbd-B7_YRVny.js} +1 -1
- package/dist/assets/{ko-CGbNBfDe.js → ko-CJFoAZPE.js} +3 -3
- package/dist/assets/main-DCJxCPr0.js +2 -0
- package/dist/assets/main-DM5FeSEG.js +169 -0
- package/dist/assets/{markdownHeightCache-RX04MAqu.js → markdownHeightCache-BO7vbFmt.js} +1 -1
- package/dist/assets/{mcpQueries-qRW-HQMx.js → mcpQueries-CojZBAVK.js} +1 -1
- package/dist/assets/miniChat-VubQ-eH-.js +2 -0
- package/dist/assets/mobile-IXaFJ00O.js +2 -0
- package/dist/assets/{mobileBackNavigation-DsDUTnFY.js → mobileBackNavigation-CJq7EFq0.js} +1 -1
- package/dist/assets/mobileConnections--cUobzs-.js +2 -0
- package/dist/assets/{multirun-C2RRF2Q3.js → multirun-CphZu9f5.js} +1 -1
- package/dist/assets/{native-config-Czc142JT.js → native-config-Bes4FTeA.js} +1 -1
- package/dist/assets/{nativeComposerCover-DzEGSyOO.js → nativeComposerCover-C6VDH0H0.js} +1 -1
- package/dist/assets/navigation-DRRQnuzD.js +2 -0
- package/dist/assets/{openRemoteProjectSession-C5z2Juv7.js → openRemoteProjectSession-B4_B76XM.js} +1 -1
- package/dist/assets/openSessionFromDeepLink-DnoNsjzY.js +2 -0
- package/dist/assets/pathNormalization-ewtPqJWn.js +1 -0
- package/dist/assets/{pl-k8-4URiE.js → pl-BwZ6CWJm.js} +3 -3
- package/dist/assets/platform-CNdx57HN.js +1 -0
- package/dist/assets/{pluginPresentation-p_0sXPMT.js → pluginPresentation-DxjMvNYM.js} +1 -1
- package/dist/assets/{project-preview-BcLPKzwg.js → project-preview-CIkGbBPZ.js} +1 -1
- package/dist/assets/{projectActions-BPmI9_mW.js → projectActions-D84EVh3q.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-BGppTOgV.js → prompt-attachment-upload-D1c308Ba.js} +1 -1
- package/dist/assets/{pt-BR-DdwCzXBH.js → pt-BR-DPAcgEDe.js} +3 -3
- package/dist/assets/pwa-Duem_qqG.js +2 -0
- package/dist/assets/queue-abort-optimistic-BX5gCxYj.js +1 -0
- package/dist/assets/{quota-2PwXAoIg.js → quota-BEyQ6n-w.js} +1 -1
- package/dist/assets/{reference-history-BwtzPAmA.js → reference-history-DV-P9xV1.js} +1 -1
- package/dist/assets/{remote-input-store-DdjKfpxS.js → remote-input-store-CquhCIoR.js} +1 -1
- package/dist/assets/remoteProjectQueries-BunVM5PM.js +1 -0
- package/dist/assets/remoteSessionReference-C2q6a218.js +1 -0
- package/dist/assets/{renderElectronMiniChatApp-BekZAu-s.js → renderElectronMiniChatApp-CdLIP8ke.js} +2 -2
- package/dist/assets/{renderMobileApp-C5U2cyeq.js → renderMobileApp-YszxdkcG.js} +5 -5
- package/dist/assets/{runtime-file-download-1s2Al1t3.js → runtime-file-download-wMVtKk2v.js} +1 -1
- package/dist/assets/runtime-file-resource-DKJJoOOc.js +6 -0
- package/dist/assets/{runtimeConfig-DzYIc49M.js → runtimeConfig-CMNPCJna.js} +1 -1
- package/dist/assets/runtimeEndpointReset-DUTNA8O6.js +4 -0
- package/dist/assets/{scheduledTaskNavigation-VVTOq9n2.js → scheduledTaskNavigation-DpfZSGu8.js} +1 -1
- package/dist/assets/{select-BOtGs1FV.js → select-DU75Zpg-.js} +1 -1
- package/dist/assets/sessionChangeSummary-BCF9VwAA.js +1 -0
- package/dist/assets/sessionLookup-D-QJrAW9.js +1 -0
- package/dist/assets/sessionOwnership-WB9z_776.js +2 -0
- package/dist/assets/{shortcuts-Cu4ioDvH.js → shortcuts-CDljO5Z0.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-DACGW9sB.js → sortable-tabs-strip-D_QG6WdD.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BU-4Axb5.js → speechSettingsQueries-Ccs4XLfn.js} +1 -1
- package/dist/assets/src-Dv9gb-Yy.css +2 -0
- package/dist/assets/{store-DRUKTpV5.js → store-DWS9gJPW.js} +4 -4
- package/dist/assets/summaries-BQMyJaaw.js +1 -0
- package/dist/assets/{switch-DaUn0G3u.js → switch-CYejZ7B8.js} +1 -1
- package/dist/assets/{terminalApi-ClNhXBA8.js → terminalApi-D2ECmoAo.js} +1 -1
- package/dist/assets/{textarea-IhQHekYx.js → textarea-D-k4tYDG.js} +1 -1
- package/dist/assets/{timeFormat-BsuUDWLs.js → timeFormat-CUbYRR40.js} +1 -1
- package/dist/assets/{tooltip-Dw3DApa-.js → tooltip-DxtaOQnv.js} +1 -1
- package/dist/assets/{truncated-path-KHrfQ66P.js → truncated-path-DDDJbtPi.js} +1 -1
- package/dist/assets/types-BXjMc92F.js +2 -0
- package/dist/assets/ui-DLZtbTLJ.js +13 -0
- package/dist/assets/{uk-DU-7fAP4.js → uk-Dw75NtHH.js} +3 -3
- package/dist/assets/useAppFontEffects-DpMTXkXR.js +7 -0
- package/dist/assets/{useAssistantUIStore-CpJZ4Rqs.js → useAssistantUIStore-DEiMjSqf.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-3qd6LXL-.js +1 -0
- package/dist/assets/{useDictation-sdgDfATy.js → useDictation-CUADIj-o.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DZqC-2HE.js → useEffectiveDirectory-CXt-KLYT.js} +1 -1
- package/dist/assets/{useFontPreferences-Bb-bxdL8.js → useFontPreferences-BY0TXvWI.js} +1 -1
- package/dist/assets/{useGitStore-Bbmai549.js → useGitStore-CAj3309H.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-DrC99u6A.js → useInlineCommentDraftStore-DEzJN8u2.js} +1 -1
- package/dist/assets/{useMcpConfigStore-ZsZxSrCt.js → useMcpConfigStore-CCsT0TQj.js} +1 -1
- package/dist/assets/{useMobileSwipeActions-fUp7Bkbn.js → useMobileSwipeActions-BnJa2tLR.js} +1 -1
- package/dist/assets/{useMobileTranscriptSyncHint-B4izCfqe.js → useMobileTranscriptSyncHint-DwBUhnBr.js} +2 -2
- package/dist/assets/{useModelLists-B0qSYDby.js → useModelLists-Bd8KjZ16.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-B9d-wLZB.js → useOpenCodeReadiness-BodiUrhs.js} +1 -1
- package/dist/assets/{usePluginsStore-BLncdNj-.js → usePluginsStore-BLP01bCp.js} +1 -1
- package/dist/assets/{useProjectGitActions-CHMe1ku4.js → useProjectGitActions-iY0OP_M-.js} +1 -1
- package/dist/assets/{useProjectGitStore-Lz9AV32V.js → useProjectGitStore-aVtBQPmn.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-D51dVo-V.js → useProjectRuntimeAPIs-ACsFy7es.js} +1 -1
- package/dist/assets/{useQuotaStore-mZs9LTwx.js → useQuotaStore-CZU1NU_Z.js} +1 -1
- package/dist/assets/{useSessionBtwStore-CYaTDkvT.js → useSessionBtwStore-DwgrTiCi.js} +2 -2
- package/dist/assets/{useStreamingTextThrottle-ul6e3dUd.js → useStreamingTextThrottle-aFrPa42L.js} +1 -1
- package/dist/assets/{useUIStore-C3ewjGgP.js → useUIStore-P32bzAJc.js} +1 -1
- package/dist/assets/{worktreeManager-V6hoSVxH.js → worktreeManager-B1qB2-Pa.js} +1 -1
- package/dist/assets/{worktreeSourceBranchPreference-MQFPkOZy.js → worktreeSourceBranchPreference-DOyD0AQN.js} +1 -1
- package/dist/assets/{zh-CN-DOHH7nht.js → zh-CN-D5Jwengx.js} +3 -3
- package/dist/assets/{zh-TW-t1qlXGOg.js → zh-TW-CbbaPcxZ.js} +3 -3
- package/dist/index.html +18 -16
- package/dist/mini-chat.html +18 -16
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/lib/assistants/builtin-skills.js +1 -1
- package/server/lib/assistants/builtin-skills.test.js +1 -0
- package/server/lib/gui-customization/DOCUMENTATION.md +15 -0
- package/server/lib/gui-customization/session-skill.js +2 -2
- package/server/lib/gui-customization/session-skill.test.js +14 -1
- package/server/lib/gui-customization/skill/SKILL.md +3 -1
- package/server/lib/gui-customization/skill/references/deep-links.md +43 -0
- package/server/lib/gui-customization/skill/references/gui-api.md +50 -1
- package/server/lib/gui-customization/skill/references/projects.md +19 -0
- package/server/lib/opencode/DOCUMENTATION.md +1 -0
- package/server/lib/opencode/custom-provider.test.js +41 -0
- package/server/lib/opencode/settings-helpers.js +9 -0
- package/server/lib/opencode/settings-helpers.test.js +10 -0
- package/dist/assets/ArchivedSessionsDialog-CU9RXl8K.js +0 -1
- package/dist/assets/AssistantSessionCard-MYBAni6A.js +0 -2
- package/dist/assets/BinaryFileFallback-CJqnlBzh.js +0 -1
- package/dist/assets/ChatContainer-Dg9uDBjk.js +0 -65
- package/dist/assets/MarkdownRenderer-CsEylQVj.js +0 -2
- package/dist/assets/MobileFilesSurface-qkfC06Oh.js +0 -2
- package/dist/assets/dialog-D9CkSNCA.css +0 -1
- package/dist/assets/gitApiHttp-Bswf6gnl.js +0 -3
- package/dist/assets/host-C7jHgymK.js +0 -1
- package/dist/assets/main-B7wAfq9F.js +0 -2
- package/dist/assets/main-DVmi0I-y.js +0 -169
- package/dist/assets/miniChat-D7-JQ1hw.js +0 -2
- package/dist/assets/mobile-BFQBDlo9.js +0 -2
- package/dist/assets/mobileConnections-PVy2SsQ_.js +0 -2
- package/dist/assets/navigation-C1v9hIAT.js +0 -2
- package/dist/assets/platform-CiUKDeXd.js +0 -1
- package/dist/assets/pwa-Br2HZksc.js +0 -2
- package/dist/assets/queue-abort-optimistic-DciJN9X1.js +0 -1
- package/dist/assets/remoteProjectQueries-BXrXdLjN.js +0 -1
- package/dist/assets/remoteSessionReference-XfJOxItc.js +0 -1
- package/dist/assets/runtime-file-resource-C5kmYlLv.js +0 -6
- package/dist/assets/runtimeEndpointReset-BKLVdNhJ.js +0 -4
- package/dist/assets/sessionLookup-BTQ_AtWh.js +0 -1
- package/dist/assets/sessionOwnership-BPfk1qCS.js +0 -2
- package/dist/assets/src-Dj147H4m.css +0 -2
- package/dist/assets/types-BBBwzIOU.js +0 -2
- package/dist/assets/ui-CHdferA1.js +0 -13
- package/dist/assets/useAppFontEffects-Dw6o6XbA.js +0 -7
- package/dist/assets/useDesktopWindowControlsLayout-DAkTdcAP.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-BzK1BO80.js","assets/rolldown-runtime-hePW80VL.js","assets/platform-CiUKDeXd.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-switch-DEPKHgdL.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-wXsskyKm.js","assets/vendor-react-BkccXcWz.js","assets/runtime-file-resource-C5kmYlLv.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-C3ewjGgP.js","assets/vendor-zustand-CTekDqaS.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/safeStorage-DTOhKN0V.js","assets/useMobileHtmlPreviewStore-BYunNOBo.js","assets/vendor-markstream-react-BqCCtUAV.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/ui-CHdferA1.js","assets/gitApiHttp-Bswf6gnl.js","assets/client-ITylDDCS.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-BGppTOgV.js","assets/uuid-D-SDZijH.js","assets/vendor-sonner-DX3nfJx4.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/remoteProjectQueries-BXrXdLjN.js","assets/i18n-Dojvs57M.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-DRUKTpV5.js","assets/tour-CMXP3Kif.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/input-store-dLjM4aiu.js","assets/toolHelpers-iEHVHQ9p.js","assets/useAssistantUIStore-CpJZ4Rqs.js","assets/vendor-framer-motion-D5NyyC73.js","assets/tooltip-Dw3DApa-.js","assets/useThemeSystem-BIXghnHj.js","assets/useEffectiveDirectory-DZqC-2HE.js","assets/LoadingImage-B3IL7hnv.js","assets/ImageLoadingPlaceholder-DsgRtfYG.js","assets/image-loading-DA9JEHD8.css","assets/markdownHeightCache-RX04MAqu.js","assets/dualLimitLru-D8Sphgua.js","assets/imageSource-Cq_p4gAe.js","assets/FadeInOnReveal-DO9PZrJL.js","assets/useStreamingTextThrottle-ul6e3dUd.js","assets/MarkdownRendererImpl-CPgpkd9b.js","assets/vendor-katex-DNVSTX6g.js","assets/themes-BgDJcxRc.js","assets/inlineMessageLinks-DC78iKO5.js","assets/vendor-marked-S3gCOYp1.js","assets/markdownTheme-D84XyNiT.js","assets/vendor-pierre-diffs-B0OmIhMO.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-TmbrIHBI.js","assets/fileReferenceParser-1HHDBUum.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-CTekDqaS.js";import{ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-BkccXcWz.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{no as o}from"./ui-CHdferA1.js";import{t as s}from"./useEffectiveDirectory-DZqC-2HE.js";import{i as c,n as l,t as u}from"./markdownHeightCache-RX04MAqu.js";var d=i(),f=e(r(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.3.5:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},w=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},T=`yuri:markstream-react`,E=e=>C(T,e),D=t(e=>({markstreamReactEnabled:E(),setMarkstreamReactEnabled:t=>{w(T,t),e({markstreamReactEnabled:t})}})),O=null,k=()=>(O??=a(()=>import(`./MarkstreamRendererImpl-BzK1BO80.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])).catch(e=>{throw O=null,e}),O),A=()=>{k().catch(()=>void 0)},j=null,M=()=>(j??=a(()=>import(`./MarkdownRendererImpl-CPgpkd9b.js`).then(e=>e.n),__vite__mapDeps([63,1,4,3,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,64,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,53,65,54,58,59,60,66,67,68,69,70,71,72,73,74,75,76,77,78,79,61,80,81,82,83,84,85,57])).catch(e=>{throw j=null,e}),j),N=()=>{E()?A():M().catch(()=>void 0)},P=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},F=f.createContext(!0),I=()=>f.useContext(F),L=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),R=n(),z=S(()=>M().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>k().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>M().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=D(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=I(),r=D(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(P,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!L(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!I()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{N as a,F as i,G as n,S as o,L as r,W as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ToolOutputDialog-DdSUE2kP.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-base-ui-wXsskyKm.js","assets/vendor-react-BkccXcWz.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/runtime-file-resource-C5kmYlLv.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/useUIStore-C3ewjGgP.js","assets/vendor-zustand-CTekDqaS.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/safeStorage-DTOhKN0V.js","assets/useMobileHtmlPreviewStore-BYunNOBo.js","assets/runtime-file-download-1s2Al1t3.js","assets/vendor-pierre-diffs-B0OmIhMO.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/ui-CHdferA1.js","assets/gitApiHttp-Bswf6gnl.js","assets/client-ITylDDCS.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-BGppTOgV.js","assets/uuid-D-SDZijH.js","assets/vendor-sonner-DX3nfJx4.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/remoteProjectQueries-BXrXdLjN.js","assets/i18n-Dojvs57M.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-DRUKTpV5.js","assets/tour-CMXP3Kif.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/input-store-dLjM4aiu.js","assets/toolHelpers-iEHVHQ9p.js","assets/useAssistantUIStore-CpJZ4Rqs.js","assets/Icon-B-w2YKpn.js","assets/vendor-framer-motion-D5NyyC73.js","assets/MobileWindowStack-DGLdgoGr.js","assets/vendor-tanstack-react-virtual-qsd3nvZb.js","assets/dialog-CmjXOKMz.js","assets/dialog-D9CkSNCA.css","assets/tap-LkQum5bB.js","assets/useThemeSystem-BIXghnHj.js","assets/appThemeRegistry-BdjrGBQ4.js","assets/themes-BgDJcxRc.js","assets/useEffectiveDirectory-DZqC-2HE.js","assets/mobileBackNavigation-DsDUTnFY.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/ImageLoadingPlaceholder-DsgRtfYG.js","assets/image-loading-DA9JEHD8.css","assets/MarkdownRenderer-CsEylQVj.js","assets/markdownHeightCache-RX04MAqu.js","assets/dualLimitLru-D8Sphgua.js","assets/imageSource-Cq_p4gAe.js","assets/markdownTheme-D84XyNiT.js","assets/markdown-worker-oBGEB9Eg.js","assets/DiffViewToggle-DkxhEUhV.js","assets/touch-gestures-DOoBxhz5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,ot as n,st as r}from"./vendor-base-ui-wXsskyKm.js";import{n as i}from"./vendor-react-BkccXcWz.js";import{C as a,S as o,T as s,w as c}from"./runtime-file-resource-C5kmYlLv.js";import{r as l}from"./vendor-reactuses-core-DjKFMfz7.js";import{o as u}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{r as d}from"./useUIStore-C3ewjGgP.js";import{n as f}from"./vendor-pierre-diffs-B0OmIhMO.js";import{Yn as p,no as m,t as h,to as g}from"./ui-CHdferA1.js";import{n as _}from"./Icon-B-w2YKpn.js";import{t as v}from"./i18n-Dojvs57M.js";import{a as y,c as b,i as x,s as S}from"./toolHelpers-iEHVHQ9p.js";import{n as ee}from"./ScrollableOverlay-CkX-buJm.js";import{n as C}from"./MobileResizableSheet-CF3Pbot4.js";import{n as w}from"./useInlineCommentDraftStore-DrC99u6A.js";import{n as T}from"./useThemeSystem-BIXghnHj.js";import{t as E}from"./PierreDiffViewer-BHwj_6j8.js";import{t as D}from"./appThemeRegistry-BdjrGBQ4.js";import{r as O}from"./themes-BgDJcxRc.js";import{n as te,t as ne}from"./useProjectRuntimeAPIs-D51dVo-V.js";import{n as re}from"./mobileBackNavigation-DsDUTnFY.js";import{i as ie}from"./MobileHtmlNetworkBoundary-BKSYPR9N.js";import{n as ae,r as k,t as oe}from"./BinaryFileFallback-CJqnlBzh.js";import{t as se}from"./ImageLoadingPlaceholder-DsgRtfYG.js";import{t as ce}from"./LoadingImage-B3IL7hnv.js";import{t as le}from"./input-BllFKOjo.js";import{n as ue,o as A}from"./MarkdownRenderer-CsEylQVj.js";import{o as de}from"./imageSource-Cq_p4gAe.js";import{t as fe}from"./TextSelectionMenu-B2fIBlD3.js";import{t as pe}from"./useDebouncedValue-BHlMPqY8.js";var j=i(),M=e(r(),1),me=e(t(),1),N=n(),P=A(()=>u(()=>import(`./ToolOutputDialog-DdSUE2kP.js`).then(e=>e.n),__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]))),F=25e4,I=e=>(e||``).replace(/\\/g,`/`).replace(/\/+$/g,``),he=e=>{let t=I(e);return!t||t===`/`?t||`/`:t.split(`/`).filter(Boolean).at(-1)??t},ge=e=>{let t=I(e);if(!t||t===`/`)return null;let n=t.lastIndexOf(`/`);return n<=0?t.startsWith(`/`)?`/`:null:t.slice(0,n)},L=(e,t)=>{let n=I(e),r=I(t);return!r||n===r?he(n):n.startsWith(`${r}/`)?n.slice(r.length+1):n},_e=e=>{if(typeof e!=`number`||!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=e/1024;for(let e of t){if(n<1024||e===t[t.length-1])return`${n.toFixed(n>=10?0:1)} ${e}`;n/=1024}return``},R=e=>/\.(md|mdx|markdown)$/i.test(e),ve=e=>{let t=(0,j.c)(156),{onClose:n,initialFilePath:r,directFilePreview:i,hideFileHeader:u}=e,f=r===void 0?null:r,p=i!==void 0&&i,y=u!==void 0&&u,{t:x}=v(),{files:C}=te(),w=ne()??null,T;t[0]===w?T=t[1]:(T=I(w),t[0]=w,t[1]=T);let E=T,D;t[2]!==f||t[3]!==E?(D=()=>{let e=I(f);return e?{type:`file`,path:e,returnDirectory:ge(e)??E}:{type:`browser`,directory:E}},t[2]=f,t[3]=E,t[4]=D):D=t[4];let[O,ie]=M.useState(D),ae=M.useRef(null),[k,oe]=M.useState(``),se=d(Ee),ce=d(De),ue,A;t[5]===E?(ue=t[6],A=t[7]):(ue=()=>{E&&ie(e=>e.type===`file`?e.returnDirectory?e:{...e,returnDirectory:ge(e.path)??E}:e.type===`browser`&&e.directory?e:{type:`browser`,directory:E})},A=[E],t[5]=E,t[6]=ue,t[7]=A),M.useEffect(ue,A);let de,fe;t[8]!==se||t[9]!==E||t[10]!==ce?(fe=()=>{if(!se||!E)return;let e=I(se);if(!e){ce(null);return}oe(``),ie({type:`file`,path:e,returnDirectory:ge(e)??E}),ce(null)},de=[se,E,ce],t[8]=se,t[9]=E,t[10]=ce,t[11]=de,t[12]=fe):(de=t[11],fe=t[12]),M.useEffect(fe,de);let me=O.type===`browser`?O.directory:O.returnDirectory,P=O.type===`browser`?O.directory:``,L=O.type===`file`?O.path:``,[R,ve]=M.useState(`preview`),xe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{ve(`preview`)},t[13]=xe):xe=t[13];let Ce;t[14]===L?Ce=t[15]:(Ce=[L],t[14]=L,t[15]=Ce),M.useEffect(xe,Ce);let we=pe(k,250),ke;t[16]===k?ke=t[17]:(ke=k.trim(),t[16]=k,t[17]=ke);let Ae=ke,z;t[18]===we?z=t[19]:(z=we.trim(),t[18]=we,t[19]=z);let B=z,je;t[20]!==P||t[21]!==E?(je={scopeDirectory:E,directory:P},t[20]=P,t[21]=E,t[22]=je):je=t[22];let Me=!!P,V;t[23]===Me?V=t[24]:(V={enabled:Me,refetchOnMount:`always`},t[23]=Me,t[24]=V);let H=a(je,V),U;t[25]!==P||t[26]!==B?(U={directory:P,query:B,maxResults:40},t[25]=P,t[26]=B,t[27]=U):U=t[27];let W=!!(P&&B),G;t[28]===W?G=t[29]:(G={enabled:W},t[28]=W,t[29]=G);let Ne=c(U,G),K;t[30]===L?K=t[31]:(K=L&&(!b(L)||L.toLowerCase().endsWith(`.svg`)),t[30]=L,t[31]=K);let q=!!K,Pe;t[32]!==L||t[33]!==E?(Pe={scopeDirectory:E,path:L},t[32]=L,t[33]=E,t[34]=Pe):Pe=t[34];let J;t[35]===q?J=t[36]:(J={enabled:q},t[35]=q,t[36]=J);let Y=s(Pe,J),X=q&&Y.data?.isBinary===!0,Z;t[37]!==L||t[38]!==Y.data||t[39]!==Y.error||t[40]!==Y.isFetchedAfterMount||t[41]!==C||t[42]!==R||t[43]!==X?(Z=L&&C.readFile&&Y.data&&Y.isFetchedAfterMount&&!Y.error&&!X&&(!S(L)||R===`source`)&&(!b(L)||L.toLowerCase().endsWith(`.svg`)),t[37]=L,t[38]=Y.data,t[39]=Y.error,t[40]=Y.isFetchedAfterMount,t[41]=C,t[42]=R,t[43]=X,t[44]=Z):Z=t[44];let Fe=!!Z,Ie;t[45]!==L||t[46]!==E?(Ie={scopeDirectory:E,path:L},t[45]=L,t[46]=E,t[47]=Ie):Ie=t[47];let Le;t[48]===Fe?Le=t[49]:(Le={enabled:Fe},t[48]=Fe,t[49]=Le);let Q=o(Ie,Le),Re=H.data?.entries.slice().sort(Oe)??[],$;t[50]!==H.error||t[51]!==x?($=H.error?H.error instanceof Error?H.error.message:x(`mobile.files.error.listFailed`):null,t[50]=H.error,t[51]=x,t[52]=$):$=t[52];let ze=$,Be=H.isFetching,Ve;t[53]===Ne.data?Ve=t[54]:(Ve=Ne.data??[],t[53]=Ne.data,t[54]=Ve);let He=Ve,Ue=!!(Ae&&B&&k===we&&Ne.isFetching),We;t[55]!==Q.data||t[56]!==x?(We=Q.data&&Q.data.length>F?`${Q.data.slice(0,F)}\n\n${x(`mobile.files.file.truncated`)}`:Q.data??``,t[55]=Q.data,t[56]=x,t[57]=We):We=t[57];let Ge=We,Ke=Y.error??Q.error,qe;t[58]!==C||t[59]!==X||t[60]!==q||t[61]!==Ke||t[62]!==x?(qe=q&&(!C.statFile||!X&&!C.readFile)?x(`mobile.files.error.readUnavailable`):Ke?Ke instanceof Error?Ke.message:x(`filesView.error.readFileFailed`):null,t[58]=C,t[59]=X,t[60]=q,t[61]=Ke,t[62]=x,t[63]=qe):qe=t[63];let Je=qe,Ye=!Je&&(q&&(!Y.data||!Y.isFetchedAfterMount)||Fe&&Q.isFetching&&Q.data===void 0),Xe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>{oe(``),ie({type:`browser`,directory:e})},t[64]=Xe):Xe=t[64];let Ze=Xe,Qe;t[65]!==me||t[66]!==E?(Qe=e=>{ie({type:`file`,path:e,returnDirectory:me||E})},t[65]=me,t[66]=E,t[67]=Qe):Qe=t[67];let $e=Qe,et;t[68]!==p||t[69]!==n||t[70]!==O.returnDirectory||t[71]!==O.type?(et=()=>O.type===`file`?p?(n?.(),!0):(ie({type:`browser`,directory:O.returnDirectory}),!0):!1,t[68]=p,t[69]=n,t[70]=O.returnDirectory,t[71]=O.type,t[72]=et):et=t[72];let tt=l(et),nt=O.type===`file`,rt;t[73]!==tt||t[74]!==nt?(rt={id:`mobile-files-detail`,active:nt,layer:`overlay`,onBack:tt,surfaceRef:ae},t[73]=tt,t[74]=nt,t[75]=rt):rt=t[75],re(rt);let it;t[76]===x?it=t[77]:(it=async e=>{(await g(e)).ok||h.error(x(`mobile.files.toast.copyFailed`))},t[76]=x,t[77]=it);let at=it,ot;t[78]!==Ge||t[79]!==x?(ot=async()=>{(await g(Ge)).ok?h.success(x(`mobile.files.toast.contentCopied`)):h.error(x(`mobile.files.toast.copyFailed`))},t[78]=Ge,t[79]=x,t[80]=ot):ot=t[80];let st=ot;if(!E){let e;t[81]===x?e=t[82]:(e=x(`mobile.files.empty.noDirectory`),t[81]=x,t[82]=e);let n;return t[83]===e?n=t[84]:(n=(0,N.jsx)(Te,{message:e}),t[83]=e,t[84]=n),n}if(O.type===`file`){let e;t[85]!==at||t[86]!==O.path?(e=()=>void at(O.path),t[85]=at,t[86]=O.path,t[87]=e):e=t[87];let n;t[88]===st?n=t[89]:(n=()=>void st(),t[88]=st,t[89]=n);let r;return t[90]!==tt||t[91]!==Ge||t[92]!==Je||t[93]!==y||t[94]!==R||t[95]!==X||t[96]!==Ye||t[97]!==O.path||t[98]!==e||t[99]!==n?(r=(0,N.jsx)(`div`,{ref:ae,className:`flex h-full min-h-0 flex-col`,children:(0,N.jsx)(Se,{path:O.path,content:Ge,error:Je,isLoading:Ye,isBinary:X,hideHeader:y,htmlViewMode:R,onHtmlViewModeChange:ve,onBack:tt,onCopyPath:e,onCopyContent:n})}),t[90]=tt,t[91]=Ge,t[92]=Je,t[93]=y,t[94]=R,t[95]=X,t[96]=Ye,t[97]=O.path,t[98]=e,t[99]=n,t[100]=r):r=t[100],r}let ct;t[101]!==E||t[102]!==O.directory||t[103]!==x?(ct=O.directory===E?x(`mobile.files.rootDirectory`):he(O.directory),t[101]=E,t[102]=O.directory,t[103]=x,t[104]=ct):ct=t[104];let lt=ct,ut;t[105]!==k||t[106]!==He?(ut=k.trim()?He:[],t[105]=k,t[106]=He,t[107]=ut):ut=t[107];let dt=ut,ft,pt,mt,ht;if(t[108]!==n||t[109]!==k||t[110]!==E||t[111]!==O.directory||t[112]!==x){let e=ge(O.directory),r=O.directory!==E&&e!==null&&(e===E||e.startsWith(`${E}/`)),i=r&&!k.trim(),a=r?e:null;ht=`flex h-full flex-col overflow-hidden bg-background text-foreground`,ft=`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-2 px-3 text-foreground`,t[117]!==n||t[118]!==x?(pt=n?(0,N.jsx)(`button`,{type:`button`,className:`-ml-1 flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":x(`mobile.surface.closeAria`),onClick:n,style:{touchAction:`manipulation`},children:(0,N.jsx)(_,{name:`close`,className:`size-5`})}):null,t[117]=n,t[118]=x,t[119]=pt):pt=t[119],mt=i&&a?(0,N.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":x(`mobile.files.backToParentAria`,{name:he(a)}),onClick:()=>Ze(a),style:{touchAction:`manipulation`},children:(0,N.jsx)(_,{name:`arrow-left`,className:`size-5`})}):null,t[108]=n,t[109]=k,t[110]=E,t[111]=O.directory,t[112]=x,t[113]=ft,t[114]=pt,t[115]=mt,t[116]=ht}else ft=t[113],pt=t[114],mt=t[115],ht=t[116];let gt;t[120]===lt?gt=t[121]:(gt=(0,N.jsx)(`div`,{className:`min-w-0 flex-1 px-1`,children:(0,N.jsx)(`h2`,{className:`truncate typography-ui-label text-foreground`,children:lt})}),t[120]=lt,t[121]=gt);let _t;t[122]===x?_t=t[123]:(_t=x(`mobile.files.refreshAria`),t[122]=x,t[123]=_t);let vt;t[124]===H?vt=t[125]:(vt=()=>void H.refetch(),t[124]=H,t[125]=vt);let yt;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(yt={touchAction:`manipulation`},t[126]=yt):yt=t[126];let bt=Be&&`animate-spin`,xt;t[127]===bt?xt=t[128]:(xt=m(`size-5`,bt),t[127]=bt,t[128]=xt);let St;t[129]===xt?St=t[130]:(St=(0,N.jsx)(_,{name:`refresh`,className:xt}),t[129]=xt,t[130]=St);let Ct;t[131]!==_t||t[132]!==vt||t[133]!==St?(Ct=(0,N.jsx)(`button`,{type:`button`,className:`flex size-10 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-interactive-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,"aria-label":_t,onClick:vt,style:yt,children:St}),t[131]=_t,t[132]=vt,t[133]=St,t[134]=Ct):Ct=t[134];let wt;t[135]!==ft||t[136]!==pt||t[137]!==mt||t[138]!==gt||t[139]!==Ct?(wt=(0,N.jsxs)(`header`,{className:ft,children:[pt,mt,gt,Ct]}),t[135]=ft,t[136]=pt,t[137]=mt,t[138]=gt,t[139]=Ct,t[140]=wt):wt=t[140];let Tt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=(0,N.jsx)(_,{name:`search`,className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),t[141]=Tt):Tt=t[141];let Et;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(Et=e=>oe(e.target.value),t[142]=Et):Et=t[142];let Dt;t[143]===x?Dt=t[144]:(Dt=x(`mobile.files.search.placeholder`),t[143]=x,t[144]=Dt);let Ot;t[145]!==k||t[146]!==Dt?(Ot=(0,N.jsx)(`div`,{className:`shrink-0 px-4 pb-2 pt-1`,"data-mobile-sheet-no-dismiss":``,children:(0,N.jsxs)(`div`,{className:`relative`,children:[Tt,(0,N.jsx)(le,{type:`text`,inputMode:`search`,value:k,onChange:Et,placeholder:Dt,className:`h-11 pl-9`})]})}),t[145]=k,t[146]=Dt,t[147]=Ot):Ot=t[147];let kt=ee,At=ze?(0,N.jsx)(Te,{message:ze}):k.trim()?(0,N.jsx)(be,{results:dt,isSearching:Ue,onOpenFile:$e}):(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:[Re.length===0&&!Be?(0,N.jsx)(`div`,{className:`px-4 py-8 text-center typography-body text-muted-foreground`,children:x(`mobile.files.empty.directory`)}):null,Re.map(e=>(0,N.jsx)(ye,{name:e.name,path:e.path,directory:e.isDirectory,meta:e.isDirectory?void 0:_e(e.size),onClick:()=>e.isDirectory?Ze(e.path):$e(e.path)},e.path))]}),jt;t[148]!==kt||t[149]!==At?(jt=(0,N.jsx)(kt,{className:`overlay-scrollbar-container min-h-0 flex-1 overflow-y-auto px-4 pb-3`,children:At}),t[148]=kt,t[149]=At,t[150]=jt):jt=t[150];let Mt;return t[151]!==ht||t[152]!==wt||t[153]!==Ot||t[154]!==jt?(Mt=(0,N.jsxs)(`div`,{className:ht,children:[wt,Ot,jt]}),t[151]=ht,t[152]=wt,t[153]=Ot,t[154]=jt,t[155]=Mt):Mt=t[155],Mt},ye=e=>{let t=(0,j.c)(16),{name:n,path:r,directory:i,meta:a,onClick:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={touchAction:`manipulation`},t[0]=s):s=t[0];let c;t[1]!==i||t[2]!==r?(c=i?(0,N.jsx)(_,{name:`folder-3-fill`,className:`size-5 shrink-0 text-muted-foreground`}):(0,N.jsx)(w,{filePath:r,className:`size-5 shrink-0`}),t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,N.jsx)(`span`,{className:`block min-w-0 flex-1 truncate typography-ui-label text-foreground`,children:n}),t[4]=n,t[5]=l);let u;t[6]===a?u=t[7]:(u=a?(0,N.jsx)(`span`,{className:`shrink-0 typography-micro text-muted-foreground`,children:a}):null,t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=i?(0,N.jsx)(_,{name:`arrow-right-s`,className:`size-4 shrink-0 text-muted-foreground/60`}):null,t[8]=i,t[9]=d);let f;return t[10]!==o||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,N.jsxs)(`button`,{type:`button`,className:`flex min-h-14 w-full items-center gap-3 border-b border-border/30 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-primary focus-visible:ring-inset`,onClick:o,style:s,children:[c,l,u,d]}),t[10]=o,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f},be=e=>{let t=(0,j.c)(10),{results:n,isSearching:r,onOpenFile:i}=e,{t:a}=v(),o=I(ne()??null);if(r){let e;t[0]===a?e=t[1]:(e=a(`common.loading`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,N.jsx)(Te,{loading:!0,message:e}),t[2]=e,t[3]=n),n}if(n.length===0){let e;t[4]===a?e=t[5]:(e=a(`mobile.files.search.empty`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,N.jsx)(Te,{message:e}),t[6]=e,t[7]=n),n}let s=n.map(e=>(0,N.jsx)(ye,{name:he(e.path),path:e.path,directory:!1,meta:L(e.path,o),onClick:()=>i(e.path)},e.path)),c;return t[8]===s?c=t[9]:(c=(0,N.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/40 bg-[var(--surface-elevated)]`,children:s}),t[8]=s,t[9]=c),c},xe=e=>{let t=(0,j.c)(26),{path:n,canUseText:r,htmlViewMode:i,htmlFullscreen:a,onToggleHtmlViewMode:o,onEnterHtmlFullscreen:s,onCopyPath:c,onCopyContent:l}=e,{t:u}=v(),d;t[0]===n?d=t[1]:(d=S(n),t[0]=n,t[1]=d);let f=d,m;t[2]!==r||t[3]!==f||t[4]!==a||t[5]!==i||t[6]!==s||t[7]!==o||t[8]!==u?(m=f&&r?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u(i===`preview`?`mobile.files.html.viewSourceAria`:`mobile.files.html.viewPreviewAria`),children:(0,N.jsx)(_,{name:i===`preview`?`file-code`:`eye`,className:`size-4`})}),a?null:(0,N.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,onClick:s,"aria-label":u(`mobile.files.html.fullscreenAria`),children:(0,N.jsx)(_,{name:`fullscreen`,className:`size-4`})})]}):null,t[2]=r,t[3]=f,t[4]=a,t[5]=i,t[6]=s,t[7]=o,t[8]=u,t[9]=m):m=t[9];let h;t[10]!==r||t[11]!==f||t[12]!==l||t[13]!==n||t[14]!==u?(h=r&&!b(n)&&!f?(0,N.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,onClick:l,"aria-label":u(`mobile.files.copyContentAria`),children:(0,N.jsx)(_,{name:`file-copy`,className:`size-4`})}):null,t[10]=r,t[11]=f,t[12]=l,t[13]=n,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==r||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==u?(g=!r||b(n)||f?(0,N.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,onClick:c,"aria-label":u(`mobile.files.copyPathAria`),children:(0,N.jsx)(_,{name:`clipboard`,className:`size-4`})}):null,t[16]=r,t[17]=f,t[18]=c,t[19]=n,t[20]=u,t[21]=g):g=t[21];let y;return t[22]!==m||t[23]!==h||t[24]!==g?(y=(0,N.jsxs)(N.Fragment,{children:[m,h,g]}),t[22]=m,t[23]=h,t[24]=g,t[25]=y):y=t[25],y},Se=e=>{let t=(0,j.c)(90),{path:n,content:r,error:i,isLoading:a,isBinary:o,hideHeader:s,htmlViewMode:c,onHtmlViewModeChange:u,onBack:d,onCopyPath:f,onCopyContent:m}=e,h=s!==void 0&&s,{t:g}=v(),y=M.useRef(null),w=ne(),T=b(n)&&!n.toLowerCase().endsWith(`.svg`)?n:``,E;t[0]===n?E=t[1]:(E=ge(n)??``,t[0]=n,t[1]=E);let D=de(T,E,`preview`),[O,te]=M.useState(``),k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k={open:!1,title:``,content:``},t[2]=k):k=t[2];let[le,ue]=M.useState(k),A=D.source,pe;t[3]===n?pe=t[4]:(pe=he(n),t[3]=n,t[4]=pe);let F=pe,I;t[5]!==r||t[6]!==n?(I=b(n)?`data:${x(n)};utf8,${encodeURIComponent(r)}`:``,t[5]=r,t[6]=n,t[7]=I):I=t[7];let L=I,_e;t[8]!==r||t[9]!==L||t[10]!==A||t[11]!==n?(_e=A||(b(n)&&r?L:``),t[8]=r,t[9]=L,t[10]=A,t[11]=n,t[12]=_e):_e=t[12];let R=_e,ve;t[13]!==i||t[14]!==O||t[15]!==D.error||t[16]!==R||t[17]!==g?(ve=i??D.error??(R&&O===R?g(`filesView.error.readFileFailed`):null),t[13]=i,t[14]=O,t[15]=D.error,t[16]=R,t[17]=g,t[18]=ve):ve=t[18];let ye=ve,be;t[19]===R?be=t[20]:(be=()=>te(R),t[19]=R,t[20]=be);let Se=l(be),Ee;t[21]!==F||t[22]!==T||t[23]!==n||t[24]!==R?(Ee=e=>{let t=T||R;t&&ue({open:!0,title:F,content:``,previewSource:e.currentTarget.querySelector(`img`)??void 0,metadata:{tool:`image-preview`,filename:F,mime:x(n)},image:{url:t,mimeType:x(n),filename:F}})},t[21]=F,t[22]=T,t[23]=n,t[24]=R,t[25]=Ee):Ee=t[25];let De=l(Ee),Oe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>{ue(t=>t.open===e?t:{...t,open:e})},t[26]=Oe):Oe=t[26];let ke=l(Oe),Ae;t[27]===n?Ae=t[28]:(Ae=S(n),t[27]=n,t[28]=Ae);let z=Ae,[B,je]=M.useState(!1),Me=M.useRef(null),V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{je(!1)},t[29]=V):V=t[29];let H;t[30]===n?H=t[31]:(H=[n],t[30]=n,t[31]=H),M.useEffect(V,H);let U;t[32]!==c||t[33]!==u?(U=()=>{u(c===`preview`?`source`:`preview`)},t[32]=c,t[33]=u,t[34]=U):U=t[34];let W=l(U),G;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{je(!0)},t[35]=G):G=t[35];let Ne=l(G),K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>(je(!1),!0),t[36]=K):K=t[36];let q=l(K),Pe=z&&B,J;t[37]!==q||t[38]!==Pe?(J={id:`mobile-html-fullscreen`,active:Pe,layer:`overlay`,onBack:q,surfaceRef:Me},t[37]=q,t[38]=Pe,t[39]=J):J=t[39],re(J);let Y=!o&&!a&&!i,X;t[40]!==Ne||t[41]!==B||t[42]!==c||t[43]!==m||t[44]!==f||t[45]!==n||t[46]!==Y||t[47]!==W?(X=(0,N.jsx)(xe,{path:n,canUseText:Y,htmlViewMode:c,htmlFullscreen:B,onToggleHtmlViewMode:W,onEnterHtmlFullscreen:Ne,onCopyPath:f,onCopyContent:m}),t[40]=Ne,t[41]=B,t[42]=c,t[43]=m,t[44]=f,t[45]=n,t[46]=Y,t[47]=W,t[48]=X):X=t[48];let Z=X,Fe;t[49]!==r||t[50]!==i||t[51]!==c||t[52]!==a||t[53]!==n||t[54]!==g?(Fe=c===`source`?a?(0,N.jsx)(Te,{loading:!0,message:g(`filesView.state.loading`)}):i?(0,N.jsx)(ie,{message:i}):(0,N.jsx)(we,{path:n,content:r}):(0,N.jsx)(Ce,{path:n}),t[49]=r,t[50]=i,t[51]=c,t[52]=a,t[53]=n,t[54]=g,t[55]=Fe):Fe=t[55];let Ie=Fe,Le;t[56]!==q||t[57]!==z||t[58]!==Ie||t[59]!==B||t[60]!==c||t[61]!==F||t[62]!==g||t[63]!==W?(Le=z?(0,N.jsxs)(`div`,{ref:Me,"data-mobile-html-preview":c===`preview`&&!B?`true`:void 0,"data-mobile-html-fullscreen":c===`preview`&&B?`true`:void 0,className:B?`fixed inset-0 z-[80] flex flex-col bg-background text-foreground`:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[B?(0,N.jsxs)(`header`,{className:`flex shrink-0 items-center gap-2 border-b border-border/50 px-3 pb-2 pt-[max(0.5rem,env(safe-area-inset-top))]`,children:[(0,N.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,onClick:q,"aria-label":g(`mobile.files.html.exitFullscreenAria`),className:`shrink-0 text-muted-foreground`,children:(0,N.jsx)(_,{name:`arrow-left`,className:`size-5`})}),(0,N.jsx)(`h2`,{className:`min-w-0 flex-1 truncate typography-ui-header text-foreground`,children:F}),(0,N.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,onClick:W,"aria-label":g(c===`preview`?`mobile.files.html.viewSourceAria`:`mobile.files.html.viewPreviewAria`),children:(0,N.jsx)(_,{name:c===`preview`?`file-code`:`eye`,className:`size-4`})})]}):null,(0,N.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background`,children:Ie})]}):null,t[56]=q,t[57]=z,t[58]=Ie,t[59]=B,t[60]=c,t[61]=F,t[62]=g,t[63]=W,t[64]=Le):Le=t[64];let Q=Le,Re=w??void 0,$;t[65]!==r||t[66]!==i||t[67]!==Z||t[68]!==Se||t[69]!==ke||t[70]!==h||t[71]!==z||t[72]!==B||t[73]!==Q||t[74]!==ye||t[75]!==F||t[76]!==le||t[77]!==D.loading||t[78]!==o||t[79]!==a||t[80]!==d||t[81]!==De||t[82]!==n||t[83]!==R||t[84]!==g?($=e=>{let{preview:t,controls:s}=e;return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-background text-foreground`,"data-mobile-edge-to-edge-preview":`true`,children:[h?(0,N.jsxs)(C,{children:[s,Z]}):(0,N.jsxs)(`header`,{className:`flex h-[var(--yuri-header-height,56px)] shrink-0 items-center gap-3 border-b border-border/50 px-3 text-foreground`,children:[(0,N.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-primary`,"aria-label":g(`header.actions.backAria`),onClick:d,children:(0,N.jsx)(_,{name:`arrow-left`,className:`size-5`})}),(0,N.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,N.jsx)(`h2`,{className:`truncate typography-ui-header text-foreground`,children:F})}),s,Z]}),(0,N.jsx)(`div`,{ref:y,className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:t??(o&&!a&&!i?(0,N.jsx)(oe,{path:n},n):z&&!a&&!i?B&&typeof document<`u`?(0,me.createPortal)(Q,document.body):Q:a||D.loading?b(n)?(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:(0,N.jsx)(se,{className:`aspect-square w-64 max-w-full rounded-lg`})}):(0,N.jsx)(Te,{loading:!0,message:g(`filesView.state.loading`)}):ye?(0,N.jsx)(ie,{message:ye}):b(n)&&R?(0,N.jsx)(ee,{className:`h-full overflow-auto p-4`,children:(0,N.jsx)(`button`,{type:`button`,className:`mx-auto block w-full cursor-zoom-in rounded-lg border-0 bg-transparent p-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary [&>.yuri-image-frame]:w-full`,onClick:De,"aria-label":F,children:(0,N.jsx)(ce,{src:R,alt:F,className:`h-auto w-full rounded-lg object-contain`,draggable:!1,onError:Se})})}):(0,N.jsx)(we,{path:n,content:r}))}),(0,N.jsx)(fe,{containerRef:y}),le.open?(0,N.jsx)(M.Suspense,{fallback:null,children:(0,N.jsx)(P,{popup:le,onOpenChange:ke,isMobile:!0})}):null]})},t[65]=r,t[66]=i,t[67]=Z,t[68]=Se,t[69]=ke,t[70]=h,t[71]=z,t[72]=B,t[73]=Q,t[74]=ye,t[75]=F,t[76]=le,t[77]=D.loading,t[78]=o,t[79]=a,t[80]=d,t[81]=De,t[82]=n,t[83]=R,t[84]=g,t[85]=$):$=t[85];let ze;return t[86]!==n||t[87]!==Re||t[88]!==$?(ze=(0,N.jsx)(ae,{path:n,base:Re,children:$}),t[86]=n,t[87]=Re,t[88]=$,t[89]=ze):ze=t[89],ze},Ce=e=>{let t=(0,j.c)(5),{path:n}=e,{projectScope:r}=te(),i=ne(),a=r?.location.directory??i??``,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={backgroundColor:`var(--surface-background)`},t[0]=o):o=t[0];let s;return t[1]!==n||t[2]!==r||t[3]!==a?(s=(0,N.jsx)(k,{path:n,directory:a,entry:r,className:`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-background`,iframeClassName:`h-full min-h-0 w-full flex-1 border-none bg-background`,iframeStyle:o}),t[1]=n,t[2]=r,t[3]=a,t[4]=s):s=t[4],s},we=e=>{let t=(0,j.c)(30),{path:n,content:r}=e,{currentTheme:i,availableThemes:a,lightThemeId:o,darkThemeId:s}=T(),c;t[0]!==a||t[1]!==o?(c=a.find(e=>e.metadata.id===o)??O(!1),t[0]=a,t[1]=o,t[2]=c):c=t[2];let l=c,u;t[3]!==a||t[4]!==s?(u=a.find(e=>e.metadata.id===s)??O(!0),t[3]=a,t[4]=s,t[5]=u):u=t[5];let d=u,p,m;t[6]!==d||t[7]!==l?(p=()=>{D(l),D(d)},m=[d,l],t[6]=d,t[7]=l,t[8]=p,t[9]=m):(p=t[8],m=t[9]),M.useEffect(p,m);let h;t[10]!==d.metadata.id||t[11]!==l.metadata.id?(h={light:l.metadata.id,dark:d.metadata.id},t[10]=d.metadata.id,t[11]=l.metadata.id,t[12]=h):h=t[12];let g=h;if(R(n)){let e;return t[13]===r?e=t[14]:(e=(0,N.jsx)(ee,{className:`h-full overflow-y-auto px-4 py-4`,children:(0,N.jsx)(ue,{content:r,enableFileReferences:!1})}),t[13]=r,t[14]=e),e}let _;t[15]===n?_=t[16]:(_=he(n),t[15]=n,t[16]=_);let v;t[17]===n?v=t[18]:(v=y(n)||void 0,t[17]=n,t[18]=v);let b;t[19]!==r||t[20]!==_||t[21]!==v?(b={name:_,contents:r,lang:v},t[19]=r,t[20]=_,t[21]=v,t[22]=b):b=t[22];let x=i.metadata.variant===`dark`?`dark`:`light`,S;t[23]!==g||t[24]!==x?(S={disableFileHeader:!0,overflow:`wrap`,theme:g,themeType:x,unsafeCSS:E},t[23]=g,t[24]=x,t[25]=S):S=t[25];let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C={minHeight:`100%`},t[26]=C):C=t[26];let w;return t[27]!==S||t[28]!==b?(w=(0,N.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,N.jsx)(ee,{className:`min-h-0 flex-1 overflow-auto bg-[var(--syntax-base-background)]`,children:(0,N.jsx)(f,{file:b,options:S,className:`block min-h-full w-full`,style:C})})}),t[27]=S,t[28]=b,t[29]=w):w=t[29],w},Te=e=>{let t=(0,j.c)(7),{message:n,loading:r}=e,i=r!==void 0&&r,a;t[0]===i?a=t[1]:(a=i?(0,N.jsx)(_,{name:`loader-4`,className:`size-5 animate-spin text-muted-foreground`}):(0,N.jsx)(_,{name:`folder-open-fill`,className:`size-6 text-muted-foreground`}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,N.jsx)(`p`,{className:`typography-ui-label font-semibold text-foreground`,children:n}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,N.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center`,children:(0,N.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-2`,children:[a,o]})}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s};function Ee(e){return e.pendingFileFocusPath}function De(e){return e.setPendingFileFocusPath}function Oe(e,t){return e.isDirectory===t.isDirectory?e.name.localeCompare(t.name):e.isDirectory?-1:1}export{ve as MobileFilesSurface};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.yuri-picker-backdrop{transition-duration:.18s}@media (prefers-reduced-motion:reduce){.yuri-picker-backdrop{transition-duration:0s}}.yuri-picker-dialog{--yuri-picker-header-end-inset:1.5rem;max-height:min(42rem,80dvh)}.yuri-picker-dialog:has(>[data-slot=dialog-close]){--yuri-picker-header-end-inset:3rem}.yuri-picker-dialog .yuri-picker-header{padding:calc(1rem * var(--padding-scale,1)) var(--yuri-picker-header-end-inset) calc(.5rem * var(--padding-scale,1)) calc(1.5rem * var(--padding-scale,1));text-align:left;flex-shrink:0}.yuri-picker-dialog .yuri-picker-title{min-width:0;font-size:calc(13 * var(--dpt));font-weight:500;line-height:calc(20 * var(--dpt))}.yuri-picker-dialog .yuri-picker-search{margin:0 calc(1.5rem * var(--padding-scale,1)) calc(.5rem * var(--padding-scale,1));flex-shrink:0}.yuri-picker-dialog .yuri-picker-search [data-slot=input]{height:calc(2.5rem * var(--padding-scale,1));box-shadow:none;font-size:calc(14 * var(--dpt));line-height:calc(20 * var(--dpt));background:0 0}.yuri-picker-dialog .yuri-picker-search:has(svg) [data-slot=input]{padding-left:calc(1.5rem * var(--padding-scale,1));padding-right:0}.yuri-picker-dialog .yuri-picker-search>svg,.yuri-picker-dialog .yuri-picker-search>.relative>svg{left:0}.yuri-picker-dialog .yuri-picker-search:focus-within{box-shadow:inset 0 -1px 0 var(--interactive-border)}.yuri-picker-dialog .yuri-picker-list{overscroll-behavior:contain;min-height:0;padding:calc(.25rem * var(--padding-scale,1)) calc(.5rem * var(--padding-scale,1)) calc(.75rem * var(--padding-scale,1));flex:1;overflow-y:auto}.yuri-picker-dialog .yuri-picker-row{min-width:0;min-height:calc(2.25rem * var(--padding-scale,1));padding:calc(.5rem * var(--padding-scale,1)) calc(1rem * var(--padding-scale,1));border:0;border-radius:.5rem}.yuri-picker-dialog .yuri-picker-row+.yuri-picker-row{margin-top:calc(.125rem * var(--padding-scale,1))}.yuri-picker-dialog .yuri-picker-label{font-size:calc(13 * var(--dpt));font-weight:400;line-height:calc(20 * var(--dpt))}.yuri-picker-dialog .yuri-picker-meta{font-size:calc(11 * var(--dpt));font-weight:400;line-height:calc(17 * var(--dpt))}.yuri-picker-dialog .yuri-picker-empty{padding:calc(2.5rem * var(--padding-scale,1)) calc(1rem * var(--padding-scale,1));font-size:calc(12 * var(--dpt));line-height:calc(20 * var(--dpt));border:0}.yuri-picker-dialog .yuri-picker-footer{padding:calc(.25rem * var(--padding-scale,1)) calc(1.5rem * var(--padding-scale,1)) calc(1rem * var(--padding-scale,1));flex-shrink:0}.yuri-picker-dialog .yuri-picker-section+.yuri-picker-section{margin-top:calc(.75rem * var(--padding-scale,1))}.yuri-picker-dialog .yuri-picker-section-title{padding:0 calc(1rem * var(--padding-scale,1)) calc(.25rem * var(--padding-scale,1));font-size:calc(11 * var(--dpt));font-weight:400;line-height:calc(17 * var(--dpt))}.yuri-picker-dialog .yuri-picker-form{margin:0 calc(1.5rem * var(--padding-scale,1)) calc(.75rem * var(--padding-scale,1));flex-shrink:0}.yuri-picker-dialog .yuri-picker-rows>.yuri-picker-row{margin-block:0}.yuri-picker-dialog .yuri-picker-rows>.yuri-picker-row+.yuri-picker-row{margin-top:calc(.125rem * var(--padding-scale,1))}.yuri-picker-dialog .yuri-help-shortcut-row{align-items:center;gap:calc(1rem * var(--padding-scale,1));grid-template-columns:minmax(0,1fr) minmax(0,45%);display:grid}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{C as t,D as n,k as r}from"./runtime-auth-DA-qfGHk.js";import{c as i,f as a,i as o,n as s,s as c}from"./runtime-switch-DEPKHgdL.js";import{n as l}from"./runtime-fetch-V-iMWR8t.js";import{F as u,P as d,R as f,S as p,d as m}from"./platform-CiUKDeXd.js";import{t as h}from"./runtimeAPIRegistry-C2VogTny.js";import{a as g,i as ee,r as te}from"./vendor-zustand-CTekDqaS.js";import{st as ne}from"./vendor-base-ui-wXsskyKm.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{i as re,n as _,t as ie}from"./safeStorage-DTOhKN0V.js";import{Cr as v,R as ae,Sr as oe,n as y,xr as b}from"./client-ITylDDCS.js";import{A as se,F as ce,I as le,L as ue,M as de,N as fe,T as pe,V as me,f as he,g as ge,h as _e,j as ve,m as ye,p as be,x}from"./prompt-attachment-upload-BGppTOgV.js";import{n as xe}from"./vendor-react-BkccXcWz.js";import{q as Se}from"./runtime-file-resource-C5kmYlLv.js";import{_ as Ce,c as we,l as Te,r as S,v as Ee}from"./useUIStore-C3ewjGgP.js";import{t as De}from"./uuid-D-SDZijH.js";var Oe=(e,t)=>e!==t;function ke(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Invalid Hub project layout`);let t=e;if(typeof t.hubId!=`string`||!t.hubId.trim()||!Array.isArray(t.order)||t.order.some(e=>typeof e!=`string`||!e.trim())||!t.collapsed||typeof t.collapsed!=`object`||Array.isArray(t.collapsed)||Object.entries(t.collapsed).some(([e,t])=>!e.trim()||typeof t!=`boolean`))throw Error(`Invalid Hub project layout`);return{hubId:t.hubId,order:[...new Set(t.order)],collapsed:Object.fromEntries(Object.entries(t.collapsed))}}var Ae=e=>{let t=e.replace(/\\/g,`/`).replace(/\/+$/g,``).trim();if(!t)return``;let n=new TextEncoder().encode(t),r=``;for(let e of n)r+=String.fromCharCode(e);return`path_${typeof btoa==`function`?btoa(r).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``):t.replace(/[^A-Za-z0-9._-]+/g,`_`)}`},C={...x,sessionIdLength:x.sessionIDLength,visibleTextLength:1e5,canonicalOutputLength:2e5},je=e=>typeof e==`string`&&de(e),Me=e=>e.replaceAll(`\\`,`/`).split(`/`).at(-1)?.replace(/\.md$/,``)??``,Ne=e=>({trigger:`@`,icon:`chat-thread`,label:e}),Pe=e=>({type:`session`,sessionId:e.sessionId,...e.directory===void 0?{}:{directory:e.directory},...e.target?{target:e.target}:{}}),Fe=e=>e.directory!==void 0||e.target?`@session:${JSON.stringify({sessionID:e.sessionId,...le(e)})}`:`@session:${e.sessionId}`,Ie=`"(?:[^"\\\\\\r\\n]|\\\\.)*"`,Le=RegExp(`@session:(\\{"sessionID":${Ie},"directory":${Ie}(?:,"target":\\{"hubId":${Ie},"hostId":${Ie},"instanceId":${Ie}\\})?\\}|[A-Za-z0-9_-]+)`,`g`),Re=e=>{if(je(e))return{sessionId:e};try{let t=JSON.parse(e);if(!je(t.sessionID))return;let n=le(t);return n?{sessionId:t.sessionID,...n}:void 0}catch{return}},ze=(e,t)=>({trigger:`/`,icon:t,label:e}),Be=(e,t)=>({trigger:t,icon:`book-open`,label:e}),Ve=(e,t)=>[`/`,`@`].some(n=>ge(e,Be(t,n))),He=(e,t)=>ge(e,Be(t,`@`))?Be(t,`@`):Be(t,`/`),Ue={session:{kind:`session`,validatePayload:e=>je(e.sessionId)&&le(e)!==void 0,contributeCanonical:e=>({text:Fe(e),semantic:Pe(e)}),contributeDirectSend:e=>{let t=Ne(be(e.display,`@`));return{text:ye(t),semantic:Pe(e)}},decorate:e=>{let t=Ne(be(e.display,`@`));return{style:`mentionSession`,visual:_e(t,e.display)}},payloadBudget:()=>void 0,canonical:{matcher:Le,resolveDisplay:(e,t)=>{let n=e.index===0?``:t.text[e.index-1],r=t.text[e.index+e[0].length]??``,i=Re(e[1]);return i&&(n===``||/[\s([{]/.test(n))&&(r===``||/[\s)\]},.!?;:]/.test(r))?he(Ne((i.target?void 0:t.sessionTitles.get(i.sessionId))||i.sessionId)):null},materialize:(e,t,n)=>{let r=Re(e[1]);return{id:`session:${r.sessionId}:${e.index}`,kind:`session`,...r,display:t,start:n,end:n+t.length}}}},paste:{kind:`paste`,validatePayload:e=>typeof e.text==`string`&&e.text.length<=C.pastePayloadLength&&typeof e.characterCount==`number`&&Number.isSafeInteger(e.characterCount)&&e.characterCount===me(e.text)&&typeof e.index==`number`&&Number.isSafeInteger(e.index)&&e.index>=1,contributeCanonical:e=>({text:e.text}),contributeDirectSend:e=>({text:e.text}),decorate:()=>({style:`mentionPaste`}),payloadBudget:e=>({category:`opaque-text`,length:e.text.length})},skill:{kind:`skill`,validatePayload:e=>fe(e.skillName)&&typeof e.display==`string`&&Ve(e.display,e.skillName),contributeCanonical:e=>({text:`[skill:${e.skillName}]`}),contributeDirectSend:e=>({text:`[skill:${e.skillName}]`}),decorate:e=>({style:`mentionCommand`,skillName:e.skillName,visual:_e(He(e.display,e.skillName),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:pe(),resolveDisplay:e=>he(Be(e[1],`@`)),materialize:(e,t,n)=>({id:`skill:${n}`,kind:`skill`,skillName:e[1],display:t,start:n,end:n+t.length})}},command:{kind:`command`,validatePayload:e=>se(e.commandName)&&ve(e.reference)&&typeof e.display==`string`&&ge(e.display,ze(e.commandName,`command`)),contributeCanonical:e=>({text:`[command:${e.reference}]`}),contributeDirectSend:e=>({text:`[command:${e.reference}]`}),decorate:e=>({style:`mentionCommand`,visual:_e(ze(e.commandName,`command`),e.display)}),payloadBudget:()=>void 0,canonical:{matcher:/\[command:([^\]\r\n]+)\]/g,resolveDisplay:e=>{let t=Me(e[1]);return ve(e[1])&&se(t)?he(ze(t,`command`)):null},materialize:(e,t,n)=>({id:`command:${n}`,kind:`command`,commandName:Me(e[1]),reference:e[1],display:t,start:n,end:n+t.length})}}},w=e=>Ue[e],We=(e,t)=>w(e).validatePayload(t),Ge=e=>w(e.kind).contributeCanonical(e),Ke=e=>w(e.kind).contributeDirectSend(e),qe=e=>w(e.kind).decorate(e),Je=e=>w(e.kind).payloadBudget(e),Ye=e=>w(e.kind).describeResourceIdentity?.(e),Xe=Object.keys(Ue),Ze=e=>typeof e==`string`&&Xe.includes(e),Qe=()=>Xe.flatMap(e=>{let t=w(e).canonical;return t?[t]:[]}),$e=e=>{if(e.type===`attachment`)return`attachment:${e.attachmentRefID}`},et=e=>{let t=new Map;for(let n of e.references){let e=Ye(n);e&&t.set($e(e),e)}return[...t.values()]},tt=(e,t)=>{let n=new Map(e.map(e=>[$e(e),e])),r=new Map(t.map(e=>[$e(e),e]));return{previous:[...n.values()],next:[...r.values()],added:[...r].flatMap(([e,t])=>n.has(e)?[]:[t]),removed:[...n].flatMap(([e,t])=>r.has(e)?[]:[t])}},nt=(e,t)=>tt(et(e),et(t)),rt=(e,t=`queue-canonical`)=>{if(e.references.length>C.referenceCount)return{ok:!1,reason:`reference-budget-exceeded`};let n=[...e.references].sort((e,t)=>e.start-t.start),r=0,i=0;for(let t of n){if(t.start<r||t.start<0||t.end<=t.start||t.end>e.text.length||e.text.slice(t.start,t.end)!==t.display)return{ok:!1,reason:`invalid-references`};r=t.end;let n=Je(t);i+=n?.category===`opaque-text`?n.length:0}if(i>C.totalPastePayloadLength)return{ok:!1,reason:`reference-payload-budget-exceeded`};let a=[],o=[],s=0;for(let r of n){s<r.start&&a.push({provenance:`authored`,text:e.text.slice(s,r.start),start:s,end:r.start});let n=t===`direct-send-display`?Ke(r):Ge(r);n.semantic?(a.push({provenance:`generated-reference`,text:n.text,start:r.start,end:r.end,referenceId:r.id,semantic:n.semantic}),o.push(n.semantic)):a.push({provenance:`reference-payload`,text:n.text,start:r.start,end:r.end,referenceId:r.id}),s=r.end}s<e.text.length&&a.push({provenance:`authored`,text:e.text.slice(s),start:s,end:e.text.length});let c=a.map(e=>e.text).join(``);return c.length>C.canonicalOutputLength?{ok:!1,reason:`canonical-output-too-large`}:{ok:!0,plan:{chunks:a,semantics:o},text:c}},T=(e,t)=>Math.max(0,Math.min(e,t)),it=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,at=e=>{if(typeof e!=`object`||!e)return!1;let t=e;return!it(t.id,C.displayLength)||!it(t.display,C.displayLength)||!Number.isSafeInteger(t.start)||!Number.isSafeInteger(t.end)||typeof t.kind!=`string`?!1:Ze(t.kind)&&We(t.kind,t)},E=(e,t)=>{let n=[],r=0,i=[],a=Math.min(t.length,C.referenceCount);for(let e=0;e<a;e+=1){let a=t[e];if(!at(a)){typeof a==`object`&&a&&typeof a.id==`string`&&n.push(a.id),r+=1;continue}i.push({reference:a,index:e})}i.sort((e,t)=>e.reference.start-t.reference.start||e.index-t.index);let o=[],s=new Set,c=0,l=0,u=!1;for(let{reference:t}of i){if(s.has(t.id)||t.start<c||t.start<0||t.end<=t.start||t.end>e.length||e.slice(t.start,t.end)!==t.display){n.push(t.id),r+=1;continue}s.add(t.id),c=t.end;let i=Je(t);if(l+=i?.category===`opaque-text`?i.length:0,l>x.totalPastePayloadLength){n.push(t.id),r+=1,s.delete(t.id),c=o.at(-1)?.end??0,u=!0,l-=i?.category===`opaque-text`?i.length:0;continue}o.push(t)}return r+=t.length-a,{document:{text:e,references:o},rejectedIds:n,rejectedCount:r,budgetExceeded:t.length>C.referenceCount,payloadBudgetExceeded:u}},D=e=>{let t=[...e.references].sort((e,t)=>e.start-t.start||e.end-t.end),n=[],r=new Set,i=0,a=0;for(let o of t){if(!it(o.id,C.idLength)||!it(o.display,C.displayLength)||!Ze(o.kind)||!Number.isSafeInteger(o.start)||!Number.isSafeInteger(o.end)||r.has(o.id)||o.start<i||o.start<0||o.end<=o.start||o.end>e.text.length||e.text.slice(o.start,o.end)!==o.display)continue;let t=Je(o),s=t?.category===`opaque-text`?t.length:0;a+s>x.totalPastePayloadLength||(r.add(o.id),i=o.end,a+=s,n.push(o))}return{text:e.text,references:n}},ot=(e,t)=>{if(t.length>x.pastePayloadLength)return!1;let n=E(e.text,e.references);return n.budgetExceeded||n.payloadBudgetExceeded?!1:n.document.references.reduce((e,t)=>{let n=Je(t);return e+(n?.category===`opaque-text`?n.length:0)},0)+t.length<=x.totalPastePayloadLength},st=(e,t,n)=>{let r=e.filter(e=>t===n?t>e.start&&t<e.end:e.start<n&&e.end>t);return r.length===0?{start:t,end:n}:{start:Math.min(t,...r.map(e=>e.start)),end:Math.max(n,...r.map(e=>e.end))}};function ct(e,t,n,r,i={}){let a=D(e);if(!We(r.kind,r))return{document:a,caret:T(n,a.text.length),edit:{oldStart:t,oldEnd:n,newEnd:n}};let o=T(t,a.text.length),s=Math.max(o,T(n,a.text.length)),c=st(a.references,o,s),l=a.text.slice(0,c.start),u=a.text.slice(c.end),d=!!i.padDocumentEdges&&i.padLeadingDocumentEdge!==!1,f=!!i.padDocumentEdges,p=i.inlineBoundaries&&(l.length>0||d)&&!/\s$/.test(l)?` `:``,m=i.inlineBoundaries&&(u.length>0||f)&&!/^\s/.test(u)?` `:``,h=`${l}${p}${r.display}${m}${u}`,g={...r,start:c.start+p.length,end:c.start+p.length+r.display.length},ee=p.length+r.display.length+m.length-(c.end-c.start);return{document:D({text:h,references:[...a.references.filter(e=>e.end<=c.start||e.start>=c.end).map(e=>e.start>=c.end?{...e,start:e.start+ee,end:e.end+ee}:e),g]}),caret:g.end,edit:{oldStart:c.start,oldEnd:c.end,newEnd:c.start+p.length+r.display.length+m.length}}}var lt=(e,t)=>e<=t.oldStart?e:e>=t.oldEnd?e+t.newEnd-t.oldEnd:t.newEnd,ut=(e,t,n=t.length,r=n)=>{let i=D(e),a=0,o=Math.min(i.text.length,t.length);for(;a<o&&i.text[a]===t[a];)a+=1;let s=0;for(;s<i.text.length-a&&s<t.length-a&&i.text[i.text.length-s-1]===t[t.length-s-1];)s+=1;let c={oldStart:a,oldEnd:i.text.length-s,newEnd:t.length-s},l=st(i.references,c.oldStart,c.oldEnd),u=l.start!==c.oldStart||l.end!==c.oldEnd,d=i.references.filter(e=>e.start<l.end&&e.end>l.start),f=t.slice(c.oldStart,c.newEnd),p=`${i.text.slice(0,l.start)}${f}${i.text.slice(l.end)}`,m={oldStart:l.start,oldEnd:l.end,newEnd:l.start+f.length},h=m.newEnd-m.oldEnd,g=i.references.filter(e=>e.end<=l.start||e.start>=l.end).map(e=>e.start>=l.end?{...e,start:e.start+h,end:e.end+h}:e),ee=(e,n)=>{let r=T(e,t.length),i=c.newEnd+l.end-c.oldEnd;return T(r<=l.start?r:r<c.oldStart||r===c.oldStart&&n===`start`?l.start:r<c.newEnd||r===c.newEnd&&n===`start`?l.start+r-c.oldStart:r<=i?m.newEnd:m.newEnd+r-i,p.length)},te=ee(n,`start`),ne=Math.max(te,ee(r,`end`)),re=D({text:p,references:g});return{document:re,edit:m,requiresTextCorrection:u,selectionStart:te,selectionEnd:ne,caret:ne,mapCaret:e=>T(lt(e,m),re.text.length),removedReferences:d}},dt=(e,t,n)=>{let r=st(n,e,t);return r.start===e&&r.end===t?null:r},ft=(e,t,n)=>{let r=n,i=n;if(t===`Backspace`){for(;r>0&&/\s/.test(e[r-1]);)--r;for(;r>0&&!/\s/.test(e[r-1]);)--r}else{for(;i<e.length&&/\s/.test(e[i]);)i+=1;for(;i<e.length&&!/\s/.test(e[i]);)i+=1}return{start:r,end:i}},pt=(e,t)=>{let n=D(e),r=T(t.selectionStart,n.text.length),i=Math.max(r,T(t.selectionEnd,n.text.length)),a=r===i?t.altKey?ft(n.text,t.key,r):t.key===`Backspace`?{start:Math.max(0,r-1),end:r}:{start:r,end:Math.min(n.text.length,r+1)}:{start:r,end:i},o=dt(a.start,a.end,n.references);if(!o)return null;let s=n.references.filter(e=>e.start<o.end&&e.end>o.start);return{document:D({text:`${n.text.slice(0,o.start)}${n.text.slice(o.end)}`,references:n.references.filter(e=>!s.includes(e)).map(e=>e.start>=o.end?{...e,start:e.start-(o.end-o.start),end:e.end-(o.end-o.start)}:e)}),caret:o.start,edit:{oldStart:o.start,oldEnd:o.end,newEnd:o.start},removedIds:s.map(e=>e.id),removedReferences:s}},mt=(e,t)=>{let n=t,r=t;for(;n>0&&/\s/.test(e[n-1]);)--n;for(;r<e.length&&/\s/.test(e[r]);)r+=1;let i=n>0&&r<e.length?` `:``;return{text:`${e.slice(0,n)}${i}${e.slice(r)}`,caret:n+i.length}},ht=(e,t=`queue-canonical`)=>{let n=E(e.text,e.references);if(n.budgetExceeded)return{ok:!1,reason:`reference-budget-exceeded`};if(n.payloadBudgetExceeded)return{ok:!1,reason:`reference-payload-budget-exceeded`};if(n.rejectedCount>0)return{ok:!1,reason:`invalid-references`};let r=rt(n.document,t);return r.ok?{ok:!0,text:r.text,chunks:r.plan.chunks,semantics:r.plan.semantics}:r},gt=(e,t)=>e.match.index-t.match.index||e.adapterOrder-t.adapterOrder||e.matchOrder-t.matchOrder,_t=e=>{if(e.length>C.canonicalOutputLength||e.length>C.visibleTextLength)return null;let t=[],n=0;for(let[r,i]of Qe().entries()){i.matcher.lastIndex=0;let a,o=0;for(;(a=i.matcher.exec(e))!==null;){if(n+=1,n>C.referenceCount)return null;let e={codec:i,match:a,adapterOrder:r,matchOrder:o};o+=1;let s=t.findIndex(t=>gt(e,t)<0);s===-1?t.push(e):t.splice(s,0,e)}}return t},vt=(e,t)=>{let n=E(e.text,e.references).document,r=_t(n.text);if(r===null)return n;let i={text:n.text,sessionTitles:t},a=[],o=``,s=0,c=0,l=new Set(n.references.map(e=>e.id)),u=[];for(let e of r){let{match:t,codec:r}=e,a=t.index,o=a+t[0].length;if(a<c||n.references.some(e=>e.start<o&&e.end>a))continue;let s=r.resolveDisplay(t,i);if(s===null||s.length>C.displayLength)continue;let d=r.materialize(t,s,a),f=d.id;for(;l.has(f);)f=`materialized:${f}`;l.add(f),u.push({start:a,end:o,display:s,reference:{...d,id:f}}),c=o}s=0;let d=0;for(let e of u){o+=`${n.text.slice(s,e.start)}${e.display}`;let t=e.start+d;a.push({...e.reference,start:t,end:t+e.display.length}),d+=e.display.length-(e.end-e.start),s=e.end}if(o+=n.text.slice(s),o.length>C.visibleTextLength)return n;let f=n.references.map(e=>{let t=u.filter(t=>t.end<=e.start).reduce((e,t)=>e+t.display.length-(t.end-t.start),0);return{...e,start:e.start+t,end:e.end+t}});return E(o,[...f,...a]).document},yt=(e,t)=>vt({text:e,references:[]},t),bt=(e,t)=>yt(e,t),xt=(e,t,n=`
|
|
2
|
-
|
|
3
|
-
`)=>{let r=E(e.text,e.references).document,i=E(t.text,t.references).document;if(r.text===i.text&&JSON.stringify(r.references)===JSON.stringify(i.references))return i;let a=new Set(r.references.map(e=>e.id)),o=e=>{let t=e;for(;a.has(t);)t=`recovered:${t}`;return a.add(t),t},s=r.text.length+n.length;return E(`${r.text}${n}${i.text}`,[...r.references,...i.references.map(e=>({...e,id:o(e.id),start:e.start+s,end:e.end+s}))]).document},St=e=>({state:`unbound-legacy`,sessionID:e}),O=e=>e.state===`bound`?`bound:${JSON.stringify([e.transportIdentity,m(e.directory),e.sessionID,e.deliveryTarget??{kind:`primary`}])}`:`unbound-legacy:${JSON.stringify([e.sessionID])}`,Ct=(e,t)=>e.queuedMessages[O(t)]??wt,wt=[],Tt=3e4,Et=`queue`,Dt=e=>e===`steer`||e===`queue`,Ot=(e,t)=>e===`immediate`?`steer`:Dt(e)?e:t===!1?`steer`:`queue`,kt=[],At=(e,t)=>e.pendingAdmissions[O(t)]??kt,jt=e=>`${e}-${De()}`,Mt=e=>typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===Object.prototype,Nt=(e,t,n=[])=>{if(!Mt(e)||!Object.keys(e).every(e=>e===`text`||e===`references`))return;let r=e;if(typeof r.text!=`string`)return;let i=ce(r.text,r.references),a=i&&ht(i,`queue-canonical`);if(!a||!a.ok||a.text!==t)return;let o=new Set(n.map(e=>e.id));return et(i).every(e=>o.has(e.attachmentRefID))?i:void 0},Pt=(e,t)=>{if(e===void 0)return[];if(!t)return;let n=ue(t.text,e);if(n)return n.some(e=>t.references.some(t=>e.range.start<t.end&&t.start<e.range.end))?void 0:n},Ft=(e,t)=>{let n=Mt(e)&&typeof e.content==`string`?e:t,r=Nt(n.composerDocument,n.content,Array.isArray(n.attachments)?n.attachments:[]),i=Pt(n.composerMentions,r);return{content:n.content,...r?{composerDocument:r}:{},...r&&i?.length?{composerMentions:i}:{},...Array.isArray(n.attachments)?{attachments:n.attachments}:{},...Mt(n.sendConfig)?{sendConfig:n.sendConfig}:{}}},It=e=>Ft(void 0,e),Lt=(e,t)=>e.queueItemID===t.queueItemID&&e.operationID===t.operationID&&(!t.messageID||e.messageID===t.messageID),k=e=>e.status===`sending`||e.status===`reconciling`,Rt=ie(),zt=()=>Rt?.flush()??!0,Bt=`quiescing`,Vt=new Set,Ht=new Set,Ut=e=>{if(Bt!==e){Bt=e;for(let e of Ht)e()}},Wt=e=>{if(!(!e||Vt.has(e))){Vt.add(e);for(let e of Ht)e()}},Gt=e=>e.state===`bound`&&Vt.has(e.transportIdentity),A=e=>Bt===`open`&&(!e||!Gt(e)),Kt=(e,t=Date.now())=>({reconciliationStartedAt:e.reconciliationStartedAt??t,reconciliationDeadlineAt:e.reconciliationDeadlineAt??(e.reconciliationStartedAt??t)+Tt,reconciliationChecks:Math.max(0,Math.floor(e.reconciliationChecks??0))}),qt=(e,t,n)=>{let r=t.queueItemID??(t.id||jt(`queued`)),i=!t.owner&&(t.status===`sending`||t.status===`reconciling`),a=i?`unresolved`:t.status===`sending`?`reconciling`:t.status===`retrying`||t.status===`reconciling`||t.status===`unresolved`||t.status===`failed`?t.status:`queued`,o=typeof t.messageID==`string`&&t.messageID.startsWith(`msg_`)?t.messageID:ae(`msg`),s=Nt(t.composerDocument,t.content,t.attachments),c=Pt(t.composerMentions,s);return{...t,...s?{composerDocument:s}:{composerDocument:void 0},...s&&c?.length?{composerMentions:c}:{composerMentions:void 0},id:r,queueItemID:r,operationID:t.operationID??jt(`operation`),messageID:o,owner:n,status:a,attemptCount:Math.max(0,Math.floor(t.attemptCount??0)),...t.status===`sending`||t.status===`reconciling`?Kt(t):{},...i||a===`reconciling`&&t.status===`sending`?{failure:{kind:`ambiguous-dispatch`,recovery:Ft(t.failure?.recovery,t)}}:{}}},Jt=e=>{let t=e??{},n={};for(let[e,r]of Object.entries(t.queuedMessages??{})){if(!Array.isArray(r))continue;let t;if(e.startsWith(`bound:`)||e.startsWith(`unbound-legacy:`)){let n=r[0],i=e.startsWith(`unbound-legacy:`)?(()=>{try{let t=JSON.parse(e.slice(15));return Array.isArray(t)&&typeof t[0]==`string`?t[0]:e}catch{return e}})():e;t=n?.owner?.state===`bound`?n.owner:St(n?.owner?.sessionID??i)}else t=St(e);for(let e of r){let r=e.owner?.state===`bound`?e.owner:t,i=O(r);(n[i]??=[]).push(qt(r.sessionID,e,r))}}return{queuedMessages:n,followUpBehavior:Ot(t.followUpBehavior,t.queueModeEnabled??null)}},j=(e,t,n,r)=>{if(Gt(t))return;let i=O(t);e(e=>{let t=e.queuedMessages[i],a=t?.findIndex(e=>O(e.owner)===i&&Lt(e,n))??-1;if(a<0||!t)return e;let o=r(t[a]);if(o===t[a])return e;let s=t.slice();return s[a]=o,{queuedMessages:{...e.queuedMessages,[i]:s}}})},Yt=g()(te(ee((e,t)=>({queuedMessages:{},followUpBehavior:Et,pendingAdmissions:{},addToQueue:(t,n)=>{if(!A(t))return{ok:!1,reason:`invalid-composer-document`};let r=Nt(n.composerDocument,n.content,n.attachments);if(n.composerDocument!==void 0&&!r)return{ok:!1,reason:`invalid-composer-document`};let i=Pt(n.composerMentions,r);if(n.composerMentions!==void 0&&!i)return{ok:!1,reason:`invalid-composer-mentions`};n={...n,...r?{composerDocument:r}:{},...i?.length?{composerMentions:i}:{}};let a={...n,id:jt(`queued`),queueItemID:``,operationID:jt(`operation`),messageID:ae(`msg`),createdAt:Date.now(),owner:t,status:`queued`,attemptCount:0};a.queueItemID=a.id;let o=O(t);return e(e=>({queuedMessages:{...e.queuedMessages,[o]:[...e.queuedMessages[o]??[],a]}})),{ok:!0,item:a}},removeFromQueue:(n,r,i)=>{if(!A(n)||!i)return!1;let a=O(n),o=t().queuedMessages[a];if(!o||o.length===0)return!0;let s=o.find(e=>(e.queueItemID===r||e.id===r)&&O(e.owner)===a);if(s&&s.operationID!==i)return!1;let c=o.find(e=>(e.queueItemID===r||e.id===r)&&e.operationID===i&&O(e.owner)===a);return!c||!k(c)&&(e(e=>{let t=e.queuedMessages[a];if(!t)return e;let n=t.filter(e=>e!==c);if(n.length===t.length)return e;if(n.length)return{queuedMessages:{...e.queuedMessages,[a]:n}};let{[a]:r,...i}=e.queuedMessages;return{queuedMessages:i}}),!Ct(t(),n).some(e=>e===c||(e.queueItemID===r||e.id===r)&&e.operationID===i))},reorderQueue:(t,n,r,i)=>{if(!A(t)||!i)return;let a=O(t);e(e=>{let t=e.queuedMessages[a],o=t?.findIndex(e=>(e.id===n||e.queueItemID===n)&&e.operationID===i&&O(e.owner)===a)??-1,s=t?.findIndex(e=>(e.id===r||e.queueItemID===r)&&O(e.owner)===a)??-1;if(!t||o<0||s<0||o===s||k(t[o])||k(t[s]))return e;let c=t.slice(),[l]=c.splice(o,1);return c.splice(s,0,l),{queuedMessages:{...e.queuedMessages,[a]:c}}})},popToInput:(e,n,r)=>{if(!A(e)||!r)return null;let i=Ct(t(),e).find(t=>(t.id===n||t.queueItemID===n)&&t.operationID===r&&O(t.owner)===O(e));return!i||k(i)||!t().removeFromQueue(e,i.queueItemID,i.operationID)?null:i},clearQueue:n=>{if(!A(n))return!1;let r=O(n),i=t().queuedMessages[r],a=(t().pendingAdmissions[r]??[]).length>0;return(!i||i.length===0)&&!a||!i?.some(k)&&(e(e=>{if(e.queuedMessages[r]?.some(k))return e;let t={...e.queuedMessages},n={...e.pendingAdmissions};return delete t[r],delete n[r],{queuedMessages:t,pendingAdmissions:n}}),(t().queuedMessages[r]??[]).length===0)},clearAllQueues:()=>{A()&&e(e=>{let t={},n=!1;for(let[r,i]of Object.entries(e.queuedMessages)){if(i[0]&&Gt(i[0].owner)){t[r]=i;continue}let e=i.filter(k);e.length&&(t[r]=e),e.length!==i.length&&(n=!0)}let r=Object.keys(e.pendingAdmissions).length>0;return n||r?{queuedMessages:t,pendingAdmissions:{}}:e})},setFollowUpBehavior:t=>{A()&&(e({followUpBehavior:t}),z({followUpBehavior:t}))},getQueueForScope:e=>Ct(t(),e),getPendingAdmissionsForScope:e=>At(t(),e),stageAdmission:(t,n)=>{if(!A(t)||!n.requestID||!n.queueItemID||!n.operationID||!n.messageID||typeof n.content!=`string`)return;let r=Nt(n.composerDocument,n.content);if(n.composerDocument!==void 0&&!r)return;let i=Pt(n.composerMentions,r);if(n.composerMentions!==void 0&&!i)return;let a=O(t),o={kind:`pending-admission`,requestID:n.requestID,queueItemID:n.queueItemID,operationID:n.operationID,messageID:n.messageID,content:n.content,createdAt:n.createdAt,phase:`admitting`,attachmentCount:Math.max(0,Math.floor(n.attachmentCount??0)),...r?{composerDocument:r}:{},...r&&i?.length?{composerMentions:i}:{}};e(e=>{let t=[...(e.pendingAdmissions[a]??[]).filter(e=>e.requestID!==o.requestID&&e.queueItemID!==o.queueItemID),o];return{pendingAdmissions:{...e.pendingAdmissions,[a]:t}}})},unstageAdmission:(t,n)=>{if(!n)return;let r=O(t);e(e=>{let t=e.pendingAdmissions[r];if(!t?.length)return e;let i=t.filter(e=>e.requestID!==n);if(i.length===t.length)return e;if(i.length)return{pendingAdmissions:{...e.pendingAdmissions,[r]:i}};let{[r]:a,...o}=e.pendingAdmissions;return{pendingAdmissions:o}})},confirmAdmission:(n,r)=>{if(!A(n)||!r.requestID||!r.sendConfig?.providerID||!r.sendConfig?.modelID)return{ok:!1,reason:`invalid-composer-document`};let i=O(n),a=(t().pendingAdmissions[i]??[]).find(e=>e.requestID===r.requestID);if(!a)return{ok:!1,reason:`invalid-composer-document`};let o=Nt(a.composerDocument,a.content,r.attachments);if(a.composerDocument!==void 0&&!o)return{ok:!1,reason:`invalid-composer-document`};let s=Pt(a.composerMentions,o);if(a.composerMentions!==void 0&&!s)return{ok:!1,reason:`invalid-composer-mentions`};let c={id:a.queueItemID,queueItemID:a.queueItemID,operationID:a.operationID,messageID:a.messageID,content:a.content,createdAt:a.createdAt,owner:n,status:`queued`,attemptCount:0,sendConfig:r.sendConfig,...o?{composerDocument:o}:{},...o&&s?.length?{composerMentions:s}:{},...r.attachments?.length?{attachments:r.attachments}:{}};return e(e=>{let t=(e.pendingAdmissions[i]??[]).filter(e=>e.requestID!==r.requestID);return{pendingAdmissions:t.length?{...e.pendingAdmissions,[i]:t}:(()=>{let{[i]:t,...n}=e.pendingAdmissions;return n})(),queuedMessages:{...e.queuedMessages,[i]:[...e.queuedMessages[i]??[],c]}}}),{ok:!0,item:c}},bindLegacyQueue:(t,n)=>{if(!A(t)||!A(n)||t.state!==`unbound-legacy`||n.state!==`bound`||t.sessionID!==n.sessionID)return[];let r=O(t),i=O(n),a=[];return e(e=>{let t=e.queuedMessages[r];if(!t||(a=t.filter(e=>!k(e)),a.length===0))return e;let o=t.filter(k),s={...e.queuedMessages,[i]:[...a.map(e=>({...e,owner:n})),...e.queuedMessages[i]??[]]};return o.length?s[r]=o:delete s[r],{queuedMessages:s}}),a.map(e=>({...e,owner:n}))},markQueueItemSendAttempt:(t,n)=>{A(t)&&j(e,t,n,e=>e.status===`queued`||e.status===`retrying`&&(e.nextAttemptAt??0)<=Date.now()?{...e,status:`sending`,attemptCount:e.attemptCount+1,nextAttemptAt:void 0,failure:void 0}:e)},markQueueItemPreDispatchRetry:(t,n,r,i)=>j(e,t,n,e=>e.status===`sending`?{...e,status:`retrying`,nextAttemptAt:r,failure:{kind:`pre-dispatch`,recovery:i?.recovery??It(e)}}:e),markQueueItemReconciling:(t,n,r)=>j(e,t,n,e=>e.status===`sending`?{...e,status:`reconciling`,nextAttemptAt:void 0,...Kt(e),reconciliationNextCheckAt:void 0,failure:{kind:`ambiguous-dispatch`,recovery:r?.recovery??It(e)}}:e),recordQueueItemReconciliationCheck:(t,n)=>j(e,t,n,e=>e.status===`reconciling`&&Lt(e,n)?{...e,reconciliationChecks:(e.reconciliationChecks??0)+1,reconciliationNextCheckAt:Date.now()+2e3}:e),resolveQueueItemReconciliation:(t,n)=>j(e,t,n,e=>e.status===`reconciling`&&Lt(e,n)?{...e,status:`unresolved`,nextAttemptAt:void 0}:e),markQueueItemDefinitiveFailure:(t,n,r)=>j(e,t,n,e=>e.status===`sending`?{...e,status:`failed`,nextAttemptAt:void 0,failure:{kind:`definitive`,recovery:r?.recovery??It(e)}}:e),resetQueueItemForDispatch:(t,n)=>{A(t)&&j(e,t,n,e=>e.status!==`failed`&&e.status!==`unresolved`&&e.status!==`retrying`?e:{...e,status:`queued`,nextAttemptAt:void 0,failure:void 0,reconciliationStartedAt:void 0,reconciliationDeadlineAt:void 0,reconciliationChecks:void 0,reconciliationNextCheckAt:void 0})},beginQueueItemDispatch:(t,n,r,i,a=Date.now())=>{if(!A(t)||!r.startsWith(`msg_`))return null;let o=O(t),s=null;return e(e=>{let t=e.queuedMessages[o],c=i?t?.findIndex(e=>O(e.owner)===o&&Lt(e,n))??-1:0,l=c>=0?t?.[c]:void 0,u=l?.status===`queued`||l?.status===`retrying`&&(i||(l.nextAttemptAt??0)<=a)||i&&(l?.status===`failed`||l?.status===`unresolved`);if(!l||O(l.owner)!==o||!Lt(l,n)||!u||t?.some(k))return e;s={...l,messageID:r,status:`sending`,attemptCount:l.attemptCount+1,nextAttemptAt:void 0,failure:void 0,reconciliationStartedAt:void 0,reconciliationDeadlineAt:void 0,reconciliationChecks:void 0,reconciliationNextCheckAt:void 0};let d=t.slice();return d.splice(c,1),d.unshift(s),{queuedMessages:{...e.queuedMessages,[o]:d}}}),s},confirmQueueItem:(t,n)=>{if(Gt(t))return;let r=O(t);e(e=>{let t=e.queuedMessages[r],i=t?.find(e=>{let t=!n.operationID||e.operationID===n.operationID,r=!n.messageID||e.messageID===n.messageID,i=!n.queueItemID||e.queueItemID===n.queueItemID;return t&&r&&i});if(!i||!n.operationID&&!n.messageID)return e;let a=t.filter(e=>e!==i);if(a.length)return{queuedMessages:{...e.queuedMessages,[r]:a}};let{[r]:o,...s}=e.queuedMessages;return{queuedMessages:s}})}}),{name:`message-queue-store`,version:4,storage:Rt,partialize:e=>({queuedMessages:e.queuedMessages,followUpBehavior:e.followUpBehavior}),migrate:Jt,merge:(e,t)=>({...t,...Jt(e),pendingAdmissions:t.pendingAdmissions})}),{name:`message-queue-store`})),Xt=(e,t)=>{let n=Yt.getState().queuedMessages,r=[],i=[];for(let[a,o]of Object.entries(n)){let n=o[0]?.owner;if(!n||n.state!==`unbound-legacy`)continue;let s=t(n.sessionID);if(!s){i.push(n.sessionID);continue}r.push({sourceKey:a,target:{state:`bound`,transportIdentity:e,directory:s,sessionID:n.sessionID},items:o})}return!e||i.length?{ok:!1,unresolvedSessionIDs:i}:r.length?(Yt.setState(e=>{let t={...e.queuedMessages};for(let e of r){let n=O(e.target);t[n]=[...e.items.map(t=>({...t,owner:e.target})),...t[n]??[]],delete t[e.sourceKey]}return{queuedMessages:t}}),{ok:!0,moved:r.reduce((e,t)=>e+t.items.length,0)}):{ok:!0,moved:0}},Zt=xe(),Qt=e(ne(),1),$t=`directoryTreeShowHidden`,en=`directory-show-hidden-change`,tn=()=>{if(typeof window>`u`)return!0;try{let e=_().getItem($t);return e===null||e===`true`}catch{return!0}},nn=()=>{typeof window>`u`||window.dispatchEvent(new Event(en))},rn=(e,t={})=>{if(!(typeof window>`u`)){try{_().setItem($t,e?`true`:`false`),nn()}catch{}t.persist!==!1&&z({directoryShowHidden:e})}},an=()=>{let e=(0,Zt.c)(2),[t,n]=Qt.useState(tn),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>{n(tn())};return window.addEventListener(`storage`,e),window.addEventListener(en,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(en,e)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Qt.useEffect(r,i),t},on=`filesViewShowGitignored`,sn=`files-view-show-gitignored-change`,cn=()=>{if(typeof window>`u`)return!1;try{return _().getItem(on)===`true`}catch{return!1}},ln=()=>{typeof window>`u`||window.dispatchEvent(new Event(sn))},un=(e,t={})=>{if(!(typeof window>`u`)){try{_().setItem(on,e?`true`:`false`),ln()}catch{}t.persist!==!1&&z({filesViewShowGitignored:e})}},dn=()=>{let e=(0,Zt.c)(2),[t,n]=Qt.useState(cn),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{if(typeof window>`u`)return;let e=()=>{n(cn())};return window.addEventListener(`storage`,e),window.addEventListener(sn,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(sn,e)}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Qt.useEffect(r,i),t},fn=e=>{if(!e||typeof e!=`object`)return null;let t={};return typeof e.showReasoningTraces==`boolean`&&(t.showReasoningTraces=e.showReasoningTraces),typeof e.collapsibleThinkingBlocks==`boolean`&&(t.collapsibleThinkingBlocks=e.collapsibleThinkingBlocks),Object.keys(t).length>0?t:null},pn=e=>{if(!e||typeof e!=`object`)return null;let t=e;return{showReasoningTraces:t.showReasoningTraces,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks}},mn=e=>{let t=S.getState();typeof e.showReasoningTraces==`boolean`&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.collapsibleThinkingBlocks==`boolean`&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks)},hn=async()=>{if(typeof window>`u`)return null;let e=localStorage.getItem(`appearance-preferences`);if(!e)return null;try{return fn(pn(JSON.parse(e)))}catch(e){return console.warn(`Failed to parse stored appearance preferences:`,e),null}},gn=[{name:`explore`,icon:`compass-3`,labelKey:`chat.draftPresets.explore.label`,command:`/explore`},{name:`catch-up`,icon:`history`,labelKey:`chat.draftPresets.catchup.label`,command:`/catch-up`},{name:`weigh`,icon:`scales-3`,labelKey:`chat.draftPresets.weigh.label`,command:`/weigh`},{name:`craft-goal`,icon:`target`,labelKey:`chat.draftPresets.craftGoal.label`,command:`/craft-goal`},{name:`debug`,icon:`bug`,labelKey:`chat.draftPresets.debug.label`,command:`/debug`},{name:`review`,icon:`search-eye`,labelKey:`chat.draftPresets.review.label`,command:`/workspace-review`}],_n=new Map(gn.map(e=>[e.name,e])),vn=e=>_n.get(e),yn=[{type:`command`,name:`explore`},{type:`command`,name:`catch-up`},{type:`command`,name:`weigh`},{type:`command`,name:`debug`},{type:`command`,name:`review`}],bn=`terminal-box`,xn=`book-open`,Sn=e=>`${e.type}:${e.name}`,Cn=(e,t)=>e.type===t.type&&e.name===t.name,wn=e=>{let t=e.replace(/^\//,``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();return t?t.charAt(0).toUpperCase()+t.slice(1):e},Tn=e=>{if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.type===`command`||e.type===`skill`?e.type:null,a=typeof e.name==`string`?e.name.trim():``;if(!i||!a)continue;let o=`${i}:${a}`;n.has(o)||(n.add(o),t.push({type:i,name:a}))}return t},En=`yuri.rt.`,Dn=e=>{try{return btoa(unescape(encodeURIComponent(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}catch{return encodeURIComponent(e)}},M=(e,t=o())=>`${En}${Dn(t.trim().length>0?t.trim():`default`)}.${e}`,On=(e,t,n=o())=>e?e===M(t,n):!1,kn=()=>{if(typeof window>`u`)return!0;if(u())return d();let e=window.__YURI_API_BASE_URL__,t=window.__YURI_LOCAL_ORIGIN__;if(typeof e==`string`&&e.trim()&&typeof t==`string`&&t.trim())try{return new URL(e).origin===new URL(t).origin}catch{return!1}try{if(d())return!0}catch{}if(typeof e==`string`&&e.trim())try{let t=new URL(e).hostname;if(t!==`localhost`&&t!==`127.0.0.1`&&t!==`::1`)return!1}catch{return!1}return!0},An=(e,t)=>{let n=t?.storage??(typeof localStorage<`u`?localStorage:{getItem:()=>null}),r=t?.transport??o(),i=n.getItem(M(e,r));return i===null?kn()?n.getItem(e):null:i},N=(e,t,n)=>{let r=n?.storage??(typeof localStorage<`u`?localStorage:{setItem:()=>void 0}),i=n?.transport??o();r.setItem(M(e,i),t)},jn=e=>{let t;try{t=re()}catch{return}let n=t=>t===null?null:JSON.parse(t,e?.reviver),r=e=>t.getItem(e);return{getItem:e=>{let t=M(e,o()),i=r(t);if(i instanceof Promise)return i.then(t=>{if(t!==null)return n(t);if(!kn())return null;let i=r(e);return i instanceof Promise?i.then(n):n(i)});if(i!==null)return n(i);if(!kn())return null;let a=r(e);return a instanceof Promise?a.then(n):n(a)},setItem:(n,r)=>{let i=M(n,o());t.setItem(i,JSON.stringify(r,e?.replacer))},removeItem:e=>{let n=M(e,o());t.removeItem(n)}}},Mn=512,Nn=4096,Pn=64,Fn=2e5,In=[`concise`,`detailed`,`mentor`,`pushback`,`noFiller`,`matchEnergy`,`warmPeer`,`custom`],Ln=[`defaultModel`,`defaultVariant`,`defaultAgent`,`autoCreateWorktree`,`gitmojiEnabled`,`defaultFileViewerPreview`,`zenModel`,`messageStreamTransport`,`sttProvider`,`sttServerUrl`,`sttModel`,`sttLocalModel`,`sttLanguage`,`responseStyleEnabled`,`responseStylePreset`,`responseStyleCustomInstructions`],Rn=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype,zn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bn=(e,t)=>{if(typeof e!=`string`)return;let n=e.trim();return n.length<=t?n:void 0},Vn=e=>{let t=Bn(e,Nn);if(t!==void 0)try{let e=new URL(t);return(e.protocol===`http:`||e.protocol===`https:`)&&!e.username&&!e.password?t:void 0}catch{return}},Hn=(e,t)=>typeof e==`string`&&t.includes(e)?e:void 0,Un=e=>typeof e==`boolean`?e:void 0,Wn=(e,t)=>{let n=e[t];switch(t){case`autoCreateWorktree`:case`gitmojiEnabled`:case`defaultFileViewerPreview`:case`responseStyleEnabled`:return Un(n);case`messageStreamTransport`:return Hn(n,[`auto`,`ws`,`sse`]);case`sttProvider`:return Hn(n,[`local`,`openai-compatible`,`volcengine`]);case`sttServerUrl`:return Vn(n);case`sttLanguage`:return Bn(n,Pn);case`responseStyleCustomInstructions`:return Bn(n,Fn);case`responseStylePreset`:return Hn(n,In);default:return Bn(n,Mn)}},Gn=e=>{if(!Rn(e))throw Error(`Invalid settings bootstrap response`);if(!zn(e,`schemaVersion`)||e.schemaVersion!==1)throw Error(`Unsupported settings bootstrap schema version`);let t={schemaVersion:1};typeof e.hasRemoteProjects==`boolean`&&(t.hasRemoteProjects=e.hasRemoteProjects);for(let n of Ln){if(!zn(e,n))continue;let r=Wn(e,n);r!==void 0&&Object.assign(t,{[n]:r})}return t},Kn=e=>{if(!Rn(e))throw Error(`Invalid settings bootstrap patch`);for(let t of Object.keys(e))if(!Ln.includes(t))throw Error(`Invalid settings bootstrap patch`);let t=Gn({schemaVersion:1,...e}),n={};for(let r of Ln)if(zn(e,r)){if(!zn(t,r))throw Error(`Invalid settings bootstrap patch`);Object.assign(n,{[r]:t[r]})}return n},qn=e=>{if(!Rn(e))return{};let t={};for(let n of Ln){if(!zn(e,n))continue;let r=Wn(e,n);r!==void 0&&Object.assign(t,{[n]:r})}return t},Jn=async(e,t)=>{let n=new AbortController,r,i=new Promise((e,t)=>{r=t}),a=e=>{r(e),n.abort(e)},o=()=>a(e.reason??new DOMException(`Request aborted`,`AbortError`)),s=setTimeout(()=>a(new DOMException(`Configuration request timed out`,`TimeoutError`)),3e4);e.addEventListener(`abort`,o,{once:!0});try{return e.aborted?(o(),await i):await Promise.race([t(n.signal),i])}finally{clearTimeout(s),e.removeEventListener(`abort`,o)}},Yn=class extends Error{status;constructor(e){super(`Settings bootstrap request failed (${e})`),this.status=e,this.name=`SettingsBootstrapRequestError`}},Xn=(e=o())=>[e,`settings`,`bootstrap`],Zn=(e=o())=>({queryKey:Xn(e),queryFn:({signal:e})=>Jn(e,async e=>{let t=await l(`/api/config/settings/bootstrap`,{method:`GET`,headers:{Accept:`application/json`},signal:e});if(!t.ok)throw new Yn(t.status);return Gn(await t.json())}),retry:(e,t)=>!(t instanceof Yn&&(t.status===404||t.status===501))&&e<1,staleTime:1/0,gcTime:1/0}),Qn=(e=o())=>Se.fetchQuery(Zn(e)),$n=(e=o())=>Se.getQueryData(Xn(e)),er=(e,t=o())=>{let n=Kn(e),r=Xn(t),i=Gn({schemaVersion:1,...Se.getQueryData(r),...n});return Se.setQueryData(r,i),i},tr=e=>{if(!(typeof window>`u`)&&!(typeof window.__YURI_HOME__==`string`&&window.__YURI_HOME__.length>0))try{window.__YURI_HOME__=e}catch{}},nr=e=>{if(!(typeof window>`u`)){if(e.themeId&&N(`selectedThemeId`,e.themeId),e.themeVariant&&N(`selectedThemeVariant`,e.themeVariant),e.lightThemeId&&N(`lightThemeId`,e.lightThemeId),e.darkThemeId&&N(`darkThemeId`,e.darkThemeId),typeof e.useSystemTheme==`boolean`&&(N(`useSystemTheme`,String(e.useSystemTheme)),N(`themeMode`,e.useSystemTheme?`system`:e.themeVariant===`dark`||e.themeVariant===`light`?e.themeVariant:`system`)),e.lastDirectory&&v(`lastDirectory`,e.lastDirectory),e.homeDirectory&&(v(`homeDirectory`,e.homeDirectory),tr(e.homeDirectory)),Array.isArray(e.projects)&&e.projects.length>0?v(`projects`,JSON.stringify(e.projects)):oe(`projects`),e.activeProjectId?v(`activeProjectId`,e.activeProjectId):oe(`activeProjectId`),Array.isArray(e.pinnedDirectories)&&e.pinnedDirectories.length>0?v(`pinnedDirectories`,JSON.stringify(e.pinnedDirectories)):oe(`pinnedDirectories`),Array.isArray(e.projects)&&e.projects.length>0){let t=e.projects.filter(e=>e.sidebarCollapsed===!0).map(e=>e.id).filter(e=>typeof e==`string`&&e.length>0);t.length>0?v(`yuri.sessions.projectCollapse`,JSON.stringify(t)):oe(`yuri.sessions.projectCollapse`)}if(typeof e.gitmojiEnabled==`boolean`?localStorage.setItem(`gitmojiEnabled`,String(e.gitmojiEnabled)):localStorage.removeItem(`gitmojiEnabled`),typeof e.directoryShowHidden==`boolean`&&localStorage.setItem(`directoryTreeShowHidden`,e.directoryShowHidden?`true`:`false`),typeof e.filesViewShowGitignored==`boolean`&&localStorage.setItem(`filesViewShowGitignored`,e.filesViewShowGitignored?`true`:`false`),typeof e.openInAppId==`string`&&e.openInAppId.length>0&&localStorage.setItem(`openInAppId`,e.openInAppId),typeof e.pwaAppName==`string`){let t=e.pwaAppName.trim().replace(/\s+/g,` `).slice(0,64);t.length>0?localStorage.setItem(`yuri.pwaName`,t):localStorage.removeItem(`yuri.pwaName`)}if(typeof e.mobileKeyboardMode==`string`&&Te(e.mobileKeyboardMode),typeof e.openCodeUpdateToastDismissedVersion==`string`){let t=e.openCodeUpdateToastDismissedVersion.trim();t?localStorage.setItem(`opencode-update-toast-dismissed-version`,t):localStorage.removeItem(`opencode-update-toast-dismissed-version`)}}},rr=e=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`yuri:settings-synced`,{detail:e}))},ir=e=>{if(!Array.isArray(e))return;let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=typeof e.id==`string`?e.id.trim():``,a=typeof e.label==`string`?e.label.trim():``,o=typeof e.source==`string`?e.source.trim():``,s=typeof e.subpath==`string`?e.subpath.trim():``,c=typeof e.gitIdentityId==`string`?e.gitIdentityId.trim():``;!i||!a||!o||n.has(i)||(n.add(i),t.push({id:i,label:a,source:o,...s?{subpath:s}:{},...c?{gitIdentityId:c}:{}}))}return t},ar=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){let e=typeof n==`string`?n.trim():``,i=typeof r==`string`?r.trim():``;!e||!i||(t[e]=i)}return t},or=(e,t)=>{let n=Object.entries(e),r=Object.entries(t);return n.length===r.length&&n.every(([e,n])=>t[e]===n)},sr=(e,t)=>e.length===t.length&&e.every((e,n)=>e.providerID===t[n]?.providerID&&e.modelID===t[n]?.modelID&&e.variant===t[n]?.variant),cr=(e,t)=>{if(t.length===0)return t;let n=new Map;for(let t of e)typeof t.variant==`string`&&t.variant.length>0&&n.set(`${t.providerID}/${t.modelID}`,t.variant);return t.map(e=>{if(typeof e.variant==`string`&&e.variant.length>0)return e;let t=n.get(`${e.providerID}/${e.modelID}`);return t?{providerID:e.providerID,modelID:e.modelID,variant:t}:e})},lr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),ur=e=>{if(Array.isArray(e))return Array.from(new Set(e.filter(e=>typeof e==`string`&&e.length>0)))},dr=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){if(!n||!Array.isArray(r))continue;let e=ur(r);e&&e.length>0&&(t[n]=e.slice(0,5))}return Object.keys(t).length>0?t:void 0},fr=(e,t)=>{let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Array.isArray(t[n])&&lr(e[n],t[n]))},pr=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/,mr=e=>{if(typeof e!=`string`)return null;let t=e.trim();return t&&pr.test(t)?t.toLowerCase():null},hr=e=>{if(!Array.isArray(e))return;let t=[],n=new Set,r=new Set;for(let i of e){if(!i||typeof i!=`object`)continue;let e=i,a=typeof e.path==`string`?e.path.trim():``;if(!a)continue;let o=a===`/`?a:a.replace(/\\/g,`/`).replace(/\/+$/,``);if(!o)continue;let s=Ae(o);if(!s||n.has(s)||r.has(o))continue;n.add(s),r.add(o);let c={id:s,path:o};if(typeof e.label==`string`&&e.label.trim().length>0&&(c.label=e.label.trim()),typeof e.icon==`string`&&e.icon.trim().length>0&&(c.icon=e.icon.trim()),e.iconImage===null)c.iconImage=null;else if(e.iconImage&&typeof e.iconImage==`object`){let t=e.iconImage,n=typeof t.mime==`string`?t.mime.trim():``,r=typeof t.updatedAt==`number`&&Number.isFinite(t.updatedAt)?Math.max(0,Math.round(t.updatedAt)):0,i=t.source===`custom`||t.source===`auto`?t.source:null;n&&r>0&&i&&(c.iconImage={mime:n,updatedAt:r,source:i})}if(typeof e.color==`string`&&e.color.trim().length>0&&(c.color=e.color.trim()),e.iconBackground===null)c.iconBackground=null;else{let t=mr(e.iconBackground);t&&(c.iconBackground=t)}typeof e.addedAt==`number`&&Number.isFinite(e.addedAt)&&e.addedAt>=0&&(c.addedAt=e.addedAt),typeof e.lastOpenedAt==`number`&&Number.isFinite(e.lastOpenedAt)&&e.lastOpenedAt>=0&&(c.lastOpenedAt=e.lastOpenedAt),typeof e.sidebarCollapsed==`boolean`&&(c.sidebarCollapsed=e.sidebarCollapsed),t.push(c)}return t.length>0?t:void 0},gr=(e,t,n)=>{if(!Array.isArray(e))return;let r=[],i=new Set,a=n?.preserveVariant===!0;for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,o=typeof e.providerID==`string`?e.providerID.trim():``,s=typeof e.modelID==`string`?e.modelID.trim():``;if(!o||!s)continue;let c=`${o}/${s}`;if(!i.has(c)&&(i.add(c),a&&typeof e.variant==`string`&&e.variant.trim().length>0?r.push({providerID:o,modelID:s,variant:e.variant.trim()}):r.push({providerID:o,modelID:s}),r.length>=t))break}return r},_r=()=>{let e=S.persist;if(e&&typeof e==`object`)return e},vr=()=>h()?.settings??null,yr=(e,t,n)=>{let r={...qn(t),...qn(e)};if(Object.keys(r).length!==0)try{er(r,n)}catch(e){console.warn(`Failed to patch settings bootstrap cache:`,e)}},br=e=>{let t=S.getState(),n=typeof window<`u`?window.__zustand_config_store__?.getState?.()??null:null,r=Yt.getState();if(typeof e.showReasoningTraces==`boolean`&&e.showReasoningTraces!==t.showReasoningTraces&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.sessionTitleRefreshEnabled==`boolean`&&e.sessionTitleRefreshEnabled!==t.sessionTitleRefreshEnabled&&t.setSessionTitleRefreshEnabled(e.sessionTitleRefreshEnabled),typeof e.sessionGoalEnabled==`boolean`&&e.sessionGoalEnabled!==t.sessionGoalEnabled&&t.setSessionGoalEnabled(e.sessionGoalEnabled),typeof e.collapsibleThinkingBlocks==`boolean`&&e.collapsibleThinkingBlocks!==t.collapsibleThinkingBlocks&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks),typeof e.autoDeleteEnabled==`boolean`&&e.autoDeleteEnabled!==t.autoDeleteEnabled&&t.setAutoDeleteEnabled(e.autoDeleteEnabled),typeof e.autoDeleteAfterDays==`number`&&Number.isFinite(e.autoDeleteAfterDays)){let n=Math.max(1,Math.min(365,e.autoDeleteAfterDays));n!==t.autoDeleteAfterDays&&t.setAutoDeleteAfterDays(n)}(e.sessionRetentionAction===`archive`||e.sessionRetentionAction===`delete`)&&e.sessionRetentionAction!==t.sessionRetentionAction&&t.setSessionRetentionAction(e.sessionRetentionAction);let i=null;if(Dt(e.followUpBehavior)?i=e.followUpBehavior:typeof e.queueModeEnabled==`boolean`&&(i=Ot(void 0,e.queueModeEnabled)),i&&i!==r.followUpBehavior&&r.setFollowUpBehavior(i),typeof e.showDeletionDialog==`boolean`&&e.showDeletionDialog!==t.showDeletionDialog&&t.setShowDeletionDialog(e.showDeletionDialog),typeof e.nativeNotificationsEnabled==`boolean`&&e.nativeNotificationsEnabled!==t.nativeNotificationsEnabled&&t.setNativeNotificationsEnabled(e.nativeNotificationsEnabled),typeof e.notificationMode==`string`&&(e.notificationMode===`always`||e.notificationMode===`hidden-only`)&&e.notificationMode!==t.notificationMode&&t.setNotificationMode(e.notificationMode),typeof e.notifyOnSubtasks==`boolean`&&e.notifyOnSubtasks!==t.notifyOnSubtasks&&t.setNotifyOnSubtasks(e.notifyOnSubtasks),typeof e.notifyOnCompletion==`boolean`&&e.notifyOnCompletion!==t.notifyOnCompletion&&t.setNotifyOnCompletion(e.notifyOnCompletion),typeof e.notifyOnError==`boolean`&&e.notifyOnError!==t.notifyOnError&&t.setNotifyOnError(e.notifyOnError),typeof e.notifyOnQuestion==`boolean`&&e.notifyOnQuestion!==t.notifyOnQuestion&&t.setNotifyOnQuestion(e.notifyOnQuestion),typeof e.notifyOnPermission==`boolean`&&e.notifyOnPermission!==t.notifyOnPermission&&t.setNotifyOnPermission(e.notifyOnPermission),typeof e.notifyOnScheduledTasks==`boolean`&&e.notifyOnScheduledTasks!==t.notifyOnScheduledTasks&&t.setNotifyOnScheduledTasks(e.notifyOnScheduledTasks),typeof e.notifyOnAssistants==`boolean`&&e.notifyOnAssistants!==t.notifyOnAssistants&&t.setNotifyOnAssistants(e.notifyOnAssistants),typeof e.notifyOnGoals==`boolean`&&e.notifyOnGoals!==t.notifyOnGoals&&t.setNotifyOnGoals(e.notifyOnGoals),e.notificationTemplates&&typeof e.notificationTemplates==`object`&&t.setNotificationTemplates(e.notificationTemplates),typeof e.summarizeLastMessage==`boolean`&&e.summarizeLastMessage!==t.summarizeLastMessage&&t.setSummarizeLastMessage(e.summarizeLastMessage),typeof e.summaryThreshold==`number`&&Number.isFinite(e.summaryThreshold)&&t.setSummaryThreshold(e.summaryThreshold),typeof e.summaryLength==`number`&&Number.isFinite(e.summaryLength)&&t.setSummaryLength(e.summaryLength),typeof e.maxLastMessageLength==`number`&&Number.isFinite(e.maxLastMessageLength)&&t.setMaxLastMessageLength(e.maxLastMessageLength),typeof e.inputSpellcheckEnabled==`boolean`&&e.inputSpellcheckEnabled!==t.inputSpellcheckEnabled&&t.setInputSpellcheckEnabled(e.inputSpellcheckEnabled),typeof e.showOpenCodeUpdateNotifications==`boolean`&&e.showOpenCodeUpdateNotifications!==t.showOpenCodeUpdateNotifications&&t.setShowOpenCodeUpdateNotifications(e.showOpenCodeUpdateNotifications),typeof e.showToolFileIcons==`boolean`&&e.showToolFileIcons!==t.showToolFileIcons&&t.setShowToolFileIcons(e.showToolFileIcons),typeof e.showTurnChangedFiles==`boolean`&&e.showTurnChangedFiles!==t.showTurnChangedFiles&&t.setShowTurnChangedFiles(e.showTurnChangedFiles),typeof e.showExpandedBashTools==`boolean`&&e.showExpandedBashTools!==t.showExpandedBashTools&&t.setShowExpandedBashTools(e.showExpandedBashTools),typeof e.showSubagentTaskDetails==`boolean`&&e.showSubagentTaskDetails!==t.showSubagentTaskDetails&&t.setShowSubagentTaskDetails(e.showSubagentTaskDetails),typeof e.timeFormatPreference==`string`&&(e.timeFormatPreference===`auto`||e.timeFormatPreference===`12h`||e.timeFormatPreference===`24h`)&&e.timeFormatPreference!==t.timeFormatPreference&&t.setTimeFormatPreference(e.timeFormatPreference),typeof e.weekStartPreference==`string`&&(e.weekStartPreference===`auto`||e.weekStartPreference===`sunday`||e.weekStartPreference===`monday`)&&e.weekStartPreference!==t.weekStartPreference&&t.setWeekStartPreference(e.weekStartPreference),typeof e.desktopWindowControlsPosition==`string`&&(e.desktopWindowControlsPosition===`auto`||e.desktopWindowControlsPosition===`left`||e.desktopWindowControlsPosition===`right`)&&e.desktopWindowControlsPosition!==t.desktopWindowControlsPosition&&t.setDesktopWindowControlsPosition(e.desktopWindowControlsPosition),(e.sidebarView===`tasks`||e.sidebarView===`projects`)&&e.sidebarView!==t.sidebarView&&t.setSidebarView(e.sidebarView),typeof e.chatRenderMode==`string`&&(e.chatRenderMode===`sorted`||e.chatRenderMode===`live`)&&e.chatRenderMode!==t.chatRenderMode&&t.setChatRenderMode(e.chatRenderMode),typeof e.activityRenderMode==`string`&&(e.activityRenderMode===`collapsed`||e.activityRenderMode===`summary`)&&e.activityRenderMode!==t.activityRenderMode&&t.setActivityRenderMode(e.activityRenderMode),typeof e.collapsibleUserMessages==`boolean`&&e.collapsibleUserMessages!==t.collapsibleUserMessages&&t.setCollapsibleUserMessages(e.collapsibleUserMessages),typeof e.messageStreamTransport==`string`&&(e.messageStreamTransport===`auto`||e.messageStreamTransport===`ws`||e.messageStreamTransport===`sse`)&&n&&e.messageStreamTransport!==n.settingsMessageStreamTransport&&n.setSettingsMessageStreamTransport(e.messageStreamTransport),typeof e.promptNavigatorEnabled==`boolean`&&e.promptNavigatorEnabled!==t.promptNavigatorEnabled&&t.setPromptNavigatorEnabled(e.promptNavigatorEnabled),typeof e.showSplitAssistantMessageActions==`boolean`&&e.showSplitAssistantMessageActions!==t.showSplitAssistantMessageActions&&t.setShowSplitAssistantMessageActions(e.showSplitAssistantMessageActions),typeof e.showAssistantTps==`boolean`&&e.showAssistantTps!==t.showAssistantTps&&t.setShowAssistantTps(e.showAssistantTps),typeof e.reportUsage==`boolean`&&e.reportUsage!==t.reportUsage&&t.setReportUsage(e.reportUsage),typeof e.fontSize==`number`&&Number.isFinite(e.fontSize)&&e.fontSize!==t.fontSize&&t.setFontSize(e.fontSize),Array.isArray(e.draftStarters)){let n=Tn(e.draftStarters);JSON.stringify(t.globalDraftStarters)!==JSON.stringify(n)&&t.setGlobalDraftStarters(n)}if(typeof e.terminalFontSize==`number`&&Number.isFinite(e.terminalFontSize)&&e.terminalFontSize!==t.terminalFontSize&&t.setTerminalFontSize(e.terminalFontSize),typeof e.editorFontSize==`number`&&Number.isFinite(e.editorFontSize)&&e.editorFontSize!==t.editorFontSize&&t.setEditorFontSize(e.editorFontSize),Ee(e.uiFont)&&e.uiFont!==t.uiFont&&t.setUiFont(e.uiFont),Ce(e.monoFont)&&e.monoFont!==t.monoFont&&t.setMonoFont(e.monoFont),typeof e.padding==`number`&&Number.isFinite(e.padding)&&e.padding!==t.padding&&t.setPadding(e.padding),typeof e.cornerRadius==`number`&&Number.isFinite(e.cornerRadius)&&e.cornerRadius!==t.cornerRadius&&t.setCornerRadius(e.cornerRadius),typeof e.inputBarOffset==`number`&&Number.isFinite(e.inputBarOffset)&&e.inputBarOffset!==t.inputBarOffset&&t.setInputBarOffset(e.inputBarOffset),e.shortcutOverrides&&!or(e.shortcutOverrides,t.shortcutOverrides)&&S.setState({shortcutOverrides:e.shortcutOverrides}),typeof e.mobileKeyboardMode==`string`){let n=we(e.mobileKeyboardMode,t.mobileKeyboardMode);n!==t.mobileKeyboardMode&&t.setMobileKeyboardMode(n)}if(Array.isArray(e.favoriteModels)){let n=t.favoriteModels,r=cr(n,e.favoriteModels);sr(n,r)||S.setState({favoriteModels:r})}if(Array.isArray(e.hiddenModels)){let n=t.hiddenModels,r=e.hiddenModels;sr(n,r)||S.setState({hiddenModels:r})}if(Array.isArray(e.collapsedModelProviders)){let n=t.collapsedModelProviders,r=e.collapsedModelProviders;lr(n,r)||S.setState({collapsedModelProviders:r})}if(Array.isArray(e.recentModels)){let n=t.recentModels,r=cr(n,e.recentModels);sr(n,r)||S.setState({recentModels:r})}if(Array.isArray(e.recentAgents)){let n=t.recentAgents,r=e.recentAgents;lr(n,r)||S.setState({recentAgents:r})}if(e.recentEfforts&&typeof e.recentEfforts==`object`){let n=t.recentEfforts,r=e.recentEfforts;fr(n,r)||S.setState({recentEfforts:r})}typeof e.diffLayoutPreference==`string`&&(e.diffLayoutPreference===`dynamic`||e.diffLayoutPreference===`inline`||e.diffLayoutPreference===`side-by-side`)&&e.diffLayoutPreference!==t.diffLayoutPreference&&t.setDiffLayoutPreference(e.diffLayoutPreference),typeof e.gitChangesViewMode==`string`&&(e.gitChangesViewMode===`flat`||e.gitChangesViewMode===`tree`)&&e.gitChangesViewMode!==t.gitChangesViewMode&&t.setGitChangesViewMode(e.gitChangesViewMode),typeof e.directoryShowHidden==`boolean`&&rn(e.directoryShowHidden,{persist:!1}),typeof e.filesViewShowGitignored==`boolean`&&un(e.filesViewShowGitignored,{persist:!1})},xr=e=>{if(!e||typeof e!=`object`)return null;let t=e,n={};if(typeof t.hasRemoteProjects==`boolean`&&(n.hasRemoteProjects=t.hasRemoteProjects),t.hubProjectLayout!==void 0&&(n.hubProjectLayout=ke(t.hubProjectLayout)),typeof t.themeId==`string`&&t.themeId.length>0&&(n.themeId=t.themeId),(t.useSystemTheme===!0||t.useSystemTheme===!1)&&(n.useSystemTheme=t.useSystemTheme),typeof t.themeVariant==`string`&&(t.themeVariant===`light`||t.themeVariant===`dark`)&&(n.themeVariant=t.themeVariant),typeof t.lightThemeId==`string`&&t.lightThemeId.length>0&&(n.lightThemeId=t.lightThemeId),typeof t.darkThemeId==`string`&&t.darkThemeId.length>0&&(n.darkThemeId=t.darkThemeId),typeof t.lastDirectory==`string`&&t.lastDirectory.length>0&&(n.lastDirectory=t.lastDirectory),typeof t.homeDirectory==`string`&&t.homeDirectory.length>0&&(n.homeDirectory=t.homeDirectory),typeof t.opencodeBinary==`string`){let e=t.opencodeBinary.trim();n.opencodeBinary=e.length>0?e:void 0}typeof t.desktopLanAccessEnabled==`boolean`&&(n.desktopLanAccessEnabled=t.desktopLanAccessEnabled),typeof t.desktopKeepAwakeEnabled==`boolean`&&(n.desktopKeepAwakeEnabled=t.desktopKeepAwakeEnabled),typeof t.desktopMinimizeToTrayEnabled==`boolean`&&(n.desktopMinimizeToTrayEnabled=t.desktopMinimizeToTrayEnabled);let r=hr(t.projects);if([`manual`,`a-z`,`z-a`,`date-added`,`recent`].includes(t.projectSortOrder)&&(n.projectSortOrder=t.projectSortOrder),r&&(n.projects=r),typeof t.activeProjectId==`string`&&t.activeProjectId.length>0&&(n.activeProjectId=t.activeProjectId),Array.isArray(t.securityScopedBookmarks)&&(n.securityScopedBookmarks=t.securityScopedBookmarks.filter(e=>typeof e==`string`&&e.length>0)),Array.isArray(t.pinnedDirectories)&&(n.pinnedDirectories=Array.from(new Set(t.pinnedDirectories.filter(e=>typeof e==`string`&&e.length>0)))),Array.isArray(t.draftStarters)&&(n.draftStarters=Tn(t.draftStarters)),typeof t.draftStartersCraftGoalAdded==`boolean`&&(n.draftStartersCraftGoalAdded=t.draftStartersCraftGoalAdded),typeof t.showReasoningTraces==`boolean`&&(n.showReasoningTraces=t.showReasoningTraces),typeof t.sessionTitleRefreshEnabled==`boolean`&&(n.sessionTitleRefreshEnabled=t.sessionTitleRefreshEnabled),typeof t.sessionGoalEnabled==`boolean`&&(n.sessionGoalEnabled=t.sessionGoalEnabled),typeof t.collapsibleThinkingBlocks==`boolean`&&(n.collapsibleThinkingBlocks=t.collapsibleThinkingBlocks),typeof t.autoDeleteEnabled==`boolean`&&(n.autoDeleteEnabled=t.autoDeleteEnabled),typeof t.autoDeleteAfterDays==`number`&&Number.isFinite(t.autoDeleteAfterDays)&&(n.autoDeleteAfterDays=t.autoDeleteAfterDays),(t.sessionRetentionAction===`archive`||t.sessionRetentionAction===`delete`)&&(n.sessionRetentionAction=t.sessionRetentionAction),typeof t.defaultModel==`string`&&t.defaultModel.length>0&&(n.defaultModel=t.defaultModel),typeof t.defaultVariant==`string`&&t.defaultVariant.length>0&&(n.defaultVariant=t.defaultVariant),typeof t.defaultAgent==`string`&&t.defaultAgent.length>0&&(n.defaultAgent=t.defaultAgent),typeof t.smallModelUseDefault==`boolean`&&(n.smallModelUseDefault=t.smallModelUseDefault),typeof t.smallModelOverride==`string`&&t.smallModelOverride.length>0&&(n.smallModelOverride=t.smallModelOverride),(t.summaryModelMode===`provider`||t.summaryModelMode===`custom`)&&(n.summaryModelMode=t.summaryModelMode),typeof t.summaryProviderID==`string`&&t.summaryProviderID.length>0&&(n.summaryProviderID=t.summaryProviderID),typeof t.summaryModelID==`string`&&t.summaryModelID.length>0&&(n.summaryModelID=t.summaryModelID),typeof t.summaryCustomModelID==`string`&&t.summaryCustomModelID.length>0&&(n.summaryCustomModelID=t.summaryCustomModelID),typeof t.summaryCustomBaseURL==`string`&&(n.summaryCustomBaseURL=t.summaryCustomBaseURL),typeof t.hasSummaryCustomAPIToken==`boolean`&&(n.hasSummaryCustomAPIToken=t.hasSummaryCustomAPIToken),typeof t.summaryCommitPrompt==`string`&&(n.summaryCommitPrompt=t.summaryCommitPrompt),typeof t.summarySessionTitlePrompt==`string`&&(n.summarySessionTitlePrompt=t.summarySessionTitlePrompt),typeof t.autoCreateWorktree==`boolean`&&(n.autoCreateWorktree=t.autoCreateWorktree),typeof t.gitmojiEnabled==`boolean`&&(n.gitmojiEnabled=t.gitmojiEnabled),Dt(t.followUpBehavior)?n.followUpBehavior=t.followUpBehavior:typeof t.queueModeEnabled==`boolean`&&(n.followUpBehavior=Ot(void 0,t.queueModeEnabled)),typeof t.showDeletionDialog==`boolean`&&(n.showDeletionDialog=t.showDeletionDialog),typeof t.nativeNotificationsEnabled==`boolean`&&(n.nativeNotificationsEnabled=t.nativeNotificationsEnabled),typeof t.notificationMode==`string`&&(t.notificationMode===`always`||t.notificationMode===`hidden-only`)&&(n.notificationMode=t.notificationMode),typeof t.notifyOnSubtasks==`boolean`&&(n.notifyOnSubtasks=t.notifyOnSubtasks),typeof t.notifyOnCompletion==`boolean`&&(n.notifyOnCompletion=t.notifyOnCompletion),typeof t.notifyOnError==`boolean`&&(n.notifyOnError=t.notifyOnError),typeof t.notifyOnQuestion==`boolean`&&(n.notifyOnQuestion=t.notifyOnQuestion),typeof t.notifyOnPermission==`boolean`&&(n.notifyOnPermission=t.notifyOnPermission),typeof t.notifyOnScheduledTasks==`boolean`&&(n.notifyOnScheduledTasks=t.notifyOnScheduledTasks),typeof t.notifyOnAssistants==`boolean`&&(n.notifyOnAssistants=t.notifyOnAssistants),typeof t.notifyOnGoals==`boolean`&&(n.notifyOnGoals=t.notifyOnGoals),t.notificationTemplates&&typeof t.notificationTemplates==`object`){let e=t.notificationTemplates,r=t=>{let n=e[t];if(!n||typeof n!=`object`)return;let r=n;return{title:typeof r.title==`string`?r.title:``,message:typeof r.message==`string`?r.message:``}},i=r(`completion`),a=r(`error`),o=r(`question`),s=r(`subtask`);(i||a||o||s)&&(n.notificationTemplates={completion:i??{title:`Task Complete`,message:`Your task has finished.`},error:a??{title:`Error Occurred`,message:`An error occurred while processing your task.`},question:o??{title:`Input Needed`,message:`Please provide input to continue.`},subtask:s??{title:`Subtask Complete`,message:`A subtask has finished.`}})}if(typeof t.summarizeLastMessage==`boolean`&&(n.summarizeLastMessage=t.summarizeLastMessage),typeof t.summaryThreshold==`number`&&Number.isFinite(t.summaryThreshold)&&(n.summaryThreshold=Math.max(0,Math.round(t.summaryThreshold))),typeof t.summaryLength==`number`&&Number.isFinite(t.summaryLength)&&(n.summaryLength=Math.max(10,Math.round(t.summaryLength))),typeof t.maxLastMessageLength==`number`&&Number.isFinite(t.maxLastMessageLength)&&(n.maxLastMessageLength=Math.max(10,Math.round(t.maxLastMessageLength))),typeof t.usageAutoRefresh==`boolean`&&(n.usageAutoRefresh=t.usageAutoRefresh),typeof t.usageRefreshIntervalMs==`number`&&Number.isFinite(t.usageRefreshIntervalMs)&&(n.usageRefreshIntervalMs=t.usageRefreshIntervalMs),(t.usageDisplayMode===`usage`||t.usageDisplayMode===`remaining`)&&(n.usageDisplayMode=t.usageDisplayMode),typeof t.usageShowPredValues==`boolean`&&(n.usageShowPredValues=t.usageShowPredValues),Array.isArray(t.usageDropdownProviders)&&(n.usageDropdownProviders=t.usageDropdownProviders.filter(e=>typeof e==`string`&&e.length>0)),typeof t.magpieUsageUrl==`string`&&(n.magpieUsageUrl=t.magpieUsageUrl),Array.isArray(t.magpieHiddenProviders)&&(n.magpieHiddenProviders=t.magpieHiddenProviders.filter(e=>typeof e==`string`&&e.startsWith(`magpie:`))),t.usageSelectedModels&&typeof t.usageSelectedModels==`object`){let e={};for(let[n,r]of Object.entries(t.usageSelectedModels))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageSelectedModels=e)}if(t.usageCollapsedFamilies&&typeof t.usageCollapsedFamilies==`object`){let e={};for(let[n,r]of Object.entries(t.usageCollapsedFamilies))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageCollapsedFamilies=e)}if(t.usageExpandedFamilies&&typeof t.usageExpandedFamilies==`object`){let e={};for(let[n,r]of Object.entries(t.usageExpandedFamilies))Array.isArray(r)&&(e[n]=r.filter(e=>typeof e==`string`));Object.keys(e).length>0&&(n.usageExpandedFamilies=e)}if(t.usageModelGroups&&typeof t.usageModelGroups==`object`){let e={};for(let[n,r]of Object.entries(t.usageModelGroups))if(r&&typeof r==`object`){let t=r,i={};Array.isArray(t.customGroups)&&(i.customGroups=t.customGroups.filter(e=>e&&typeof e==`object`).map(e=>({id:String(e.id??``),label:String(e.label??``),models:Array.isArray(e.models)?e.models.filter(e=>typeof e==`string`):[],order:typeof e.order==`number`?e.order:0}))),t.modelAssignments&&typeof t.modelAssignments==`object`&&(i.modelAssignments=Object.fromEntries(Object.entries(t.modelAssignments).filter(([,e])=>typeof e==`string`).map(([e,t])=>[e,String(t)]))),t.renamedGroups&&typeof t.renamedGroups==`object`&&(i.renamedGroups=Object.fromEntries(Object.entries(t.renamedGroups).filter(([,e])=>typeof e==`string`).map(([e,t])=>[e,String(t)]))),Object.keys(i).length>0&&(e[n]=i)}Object.keys(e).length>0&&(n.usageModelGroups=e)}typeof t.inputSpellcheckEnabled==`boolean`&&(n.inputSpellcheckEnabled=t.inputSpellcheckEnabled),typeof t.showOpenCodeUpdateNotifications==`boolean`&&(n.showOpenCodeUpdateNotifications=t.showOpenCodeUpdateNotifications),typeof t.openCodeUpdateToastDismissedVersion==`string`&&(n.openCodeUpdateToastDismissedVersion=t.openCodeUpdateToastDismissedVersion.trim().slice(0,128)),typeof t.showToolFileIcons==`boolean`&&(n.showToolFileIcons=t.showToolFileIcons),typeof t.showTurnChangedFiles==`boolean`&&(n.showTurnChangedFiles=t.showTurnChangedFiles),typeof t.showExpandedBashTools==`boolean`&&(n.showExpandedBashTools=t.showExpandedBashTools),typeof t.showSubagentTaskDetails==`boolean`&&(n.showSubagentTaskDetails=t.showSubagentTaskDetails),typeof t.timeFormatPreference==`string`&&(t.timeFormatPreference===`auto`||t.timeFormatPreference===`12h`||t.timeFormatPreference===`24h`)&&(n.timeFormatPreference=t.timeFormatPreference),typeof t.weekStartPreference==`string`&&(t.weekStartPreference===`auto`||t.weekStartPreference===`sunday`||t.weekStartPreference===`monday`)&&(n.weekStartPreference=t.weekStartPreference),typeof t.desktopWindowControlsPosition==`string`&&(t.desktopWindowControlsPosition===`auto`||t.desktopWindowControlsPosition===`left`||t.desktopWindowControlsPosition===`right`)&&(n.desktopWindowControlsPosition=t.desktopWindowControlsPosition),(t.sidebarView===`tasks`||t.sidebarView===`projects`)&&(n.sidebarView=t.sidebarView),typeof t.chatRenderMode==`string`&&(t.chatRenderMode===`sorted`||t.chatRenderMode===`live`)&&(n.chatRenderMode=t.chatRenderMode),typeof t.messageStreamTransport==`string`&&(t.messageStreamTransport===`auto`||t.messageStreamTransport===`ws`||t.messageStreamTransport===`sse`)&&(n.messageStreamTransport=t.messageStreamTransport),typeof t.activityRenderMode==`string`&&(t.activityRenderMode===`collapsed`||t.activityRenderMode===`summary`)&&(n.activityRenderMode=t.activityRenderMode),typeof t.collapsibleUserMessages==`boolean`&&(n.collapsibleUserMessages=t.collapsibleUserMessages),typeof t.showSplitAssistantMessageActions==`boolean`&&(n.showSplitAssistantMessageActions=t.showSplitAssistantMessageActions),typeof t.showAssistantTps==`boolean`&&(n.showAssistantTps=t.showAssistantTps),typeof t.fontSize==`number`&&Number.isFinite(t.fontSize)&&(n.fontSize=t.fontSize),typeof t.terminalFontSize==`number`&&Number.isFinite(t.terminalFontSize)&&(n.terminalFontSize=t.terminalFontSize),typeof t.editorFontSize==`number`&&Number.isFinite(t.editorFontSize)&&(n.editorFontSize=t.editorFontSize),Ee(t.uiFont)&&(n.uiFont=t.uiFont),Ce(t.monoFont)&&(n.monoFont=t.monoFont),typeof t.padding==`number`&&Number.isFinite(t.padding)&&(n.padding=t.padding),typeof t.cornerRadius==`number`&&Number.isFinite(t.cornerRadius)&&(n.cornerRadius=t.cornerRadius),typeof t.inputBarOffset==`number`&&Number.isFinite(t.inputBarOffset)&&(n.inputBarOffset=t.inputBarOffset);let i=ar(t.shortcutOverrides);i&&(n.shortcutOverrides=i),typeof t.mobileKeyboardMode==`string`&&(t.mobileKeyboardMode===`native`||t.mobileKeyboardMode===`resize-content`)&&(n.mobileKeyboardMode=t.mobileKeyboardMode);let a=gr(t.favoriteModels,64,{preserveVariant:!0});a&&(n.favoriteModels=a);let o=gr(t.hiddenModels,1024);o&&(n.hiddenModels=o);let s=ur(t.collapsedModelProviders);s&&(n.collapsedModelProviders=s);let c=gr(t.recentModels,16,{preserveVariant:!0});c&&(n.recentModels=c);let l=ur(t.recentAgents);l&&(n.recentAgents=l);let u=dr(t.recentEfforts);if(u&&(n.recentEfforts=u),typeof t.diffLayoutPreference==`string`&&(t.diffLayoutPreference===`dynamic`||t.diffLayoutPreference===`inline`||t.diffLayoutPreference===`side-by-side`)&&(n.diffLayoutPreference=t.diffLayoutPreference),typeof t.gitChangesViewMode==`string`&&(t.gitChangesViewMode===`flat`||t.gitChangesViewMode===`tree`)&&(n.gitChangesViewMode=t.gitChangesViewMode),typeof t.directoryShowHidden==`boolean`&&(n.directoryShowHidden=t.directoryShowHidden),typeof t.filesViewShowGitignored==`boolean`&&(n.filesViewShowGitignored=t.filesViewShowGitignored),typeof t.openInAppId==`string`&&t.openInAppId.length>0&&(n.openInAppId=t.openInAppId),typeof t.pwaAppName==`string`){let e=t.pwaAppName.trim().replace(/\s+/g,` `).slice(0,64);n.pwaAppName=e.length>0?e:``}let d=ir(t.skillCatalogs);return d&&(n.skillCatalogs=d),typeof t.reportUsage==`boolean`&&(n.reportUsage=t.reportUsage),typeof t.globalBehaviorPrompt==`string`&&(n.globalBehaviorPrompt=t.globalBehaviorPrompt),typeof t.responseStyleEnabled==`boolean`&&(n.responseStyleEnabled=t.responseStyleEnabled),typeof t.responseStylePreset==`string`&&(t.responseStylePreset===`concise`||t.responseStylePreset===`detailed`||t.responseStylePreset===`mentor`||t.responseStylePreset===`pushback`||t.responseStylePreset===`noFiller`||t.responseStylePreset===`matchEnergy`||t.responseStylePreset===`warmPeer`||t.responseStylePreset===`custom`)&&(n.responseStylePreset=t.responseStylePreset),typeof t.responseStyleCustomInstructions==`string`&&(n.responseStyleCustomInstructions=t.responseStyleCustomInstructions),typeof t.dictationEnabled==`boolean`&&(n.dictationEnabled=t.dictationEnabled),t.sttProvider===`local`||t.sttProvider===`openai-compatible`||t.sttProvider===`volcengine`?n.sttProvider=t.sttProvider:t.sttProvider===`server`?n.sttProvider=`openai-compatible`:(t.sttProvider===`browser`||t.sttProvider===`wasm`)&&(n.sttProvider=`local`),typeof t.sttServerUrl==`string`&&(n.sttServerUrl=t.sttServerUrl.trim()),typeof t.sttModel==`string`&&(n.sttModel=t.sttModel.trim()),typeof t.sttLocalModel==`string`&&(n.sttLocalModel=t.sttLocalModel.trim()),typeof t.sttLanguage==`string`&&(n.sttLanguage=t.sttLanguage.trim()),n},P=new Map,Sr=new Map,Cr=2e3,wr=async e=>{let t=P.get(e);if(t&&Date.now()-t.at<Cr)return t.value;let n=Sr.get(e);if(n)return n;let r=(async()=>{if(o()!==e)return null;let t=vr();if(t)try{let n=xr((await t.load()).settings);return P.set(e,{value:n,at:Date.now()}),n}catch(e){console.warn(`Failed to load shared settings from runtime settings API:`,e)}if(o()!==e)return null;try{let t=await l(`/api/config/settings`,{method:`GET`,headers:{Accept:`application/json`}});if(!t.ok)return null;let n=xr(await t.json().catch(()=>null));return P.set(e,{value:n,at:Date.now()}),n}catch(e){return console.warn(`Failed to load shared settings from server:`,e),null}})();Sr.set(e,r);try{return await r}finally{Sr.get(e)===r&&Sr.delete(e)}},Tr=(e=o())=>{P.delete(e)},Er=async()=>{if(typeof window>`u`)return;let e=o(),t=_r(),n=()=>!t?.hasHydrated||t.hasHydrated()||!t.onFinishHydration?Promise.resolve():new Promise(e=>{let n=!1,r=()=>{n||(n=!0,e())},i=t.onFinishHydration(()=>{i?.(),r()});t.hasHydrated?.()&&r()}),r=async t=>{if(await n(),o()===e){try{nr(t)}catch(e){console.warn(`persistToLocalStorage failed:`,e)}try{br(t)}catch(e){console.warn(`applyDesktopUiPreferences failed:`,e)}rr(t)}};try{let t=await wr(e);t&&o()===e&&await r(t)}catch(e){console.warn(`Failed to synchronise settings:`,e)}},F=null,I=null,L=null,Dr=[],Or=200,R=new Map,kr=async e=>{for(;R.get(e)?.size;)await Promise.all([...R.get(e)])},Ar=async()=>{let e=F,t=I,n=Dr;if(F=null,I=null,L=null,Dr=[],!e||!t||Object.keys(e).length===0){n.forEach(e=>e());return}if(o()!==t){n.forEach(e=>e());return}let r=()=>o()===t,i=vr();if(i){try{let a=await i.save(e);yr(a,e,t),a&&r()&&(nr(a),br(a),rr(a),P.set(t,{value:xr(a),at:Date.now()})),n.forEach(e=>e());return}catch(e){console.warn(`Failed to update settings via runtime settings API:`,e)}if(!r()){n.forEach(e=>e());return}}try{let n=await l(`/api/config/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(e)});if(!n.ok){console.warn(`Failed to update shared settings via API:`,n.status,n.statusText);return}let i=await n.json().catch(()=>null);yr(i,e,t),i&&r()&&(nr(i),br(i),rr(i),P.set(t,{value:xr(i),at:Date.now()}))}catch(e){console.warn(`Failed to update shared settings via API:`,e)}finally{n.forEach(e=>e())}},z=async e=>{if(typeof window>`u`)return;let t=o();if(I&&I!==t){L&&=(clearTimeout(L),null),F=null,I=null;let e=Dr;Dr=[],e.forEach(e=>e())}let n={...F??{}},r=P.get(t)?.value;for(let[t,i]of Object.entries(e)){let e=r?.[t];Object.is(i,e)||i!==void 0&&e!==void 0&&JSON.stringify(i)===JSON.stringify(e)?delete n[t]:n[t]=i}if(F=n,I=t,Object.keys(n).length===0&&!L){F=null,I=null;return}L&&clearTimeout(L);let i=new Promise(e=>{Dr.push(e)}),a=R.get(t)??new Set;R.set(t,a),a.add(i),L=setTimeout(()=>void Ar(),Or);try{await i}finally{a.delete(i),a.size===0&&R.get(t)===a&&R.delete(t)}},jr=async()=>{if(typeof window>`u`)return;let e=_r();try{let t=await hn();if(!t)return;let n=()=>mn(t);if(e?.hasHydrated?.()){n();return}if(n(),e?.onFinishHydration){let t=e.onFinishHydration(()=>{t?.(),n()})}}catch(e){console.warn(`Failed to load appearance preferences:`,e)}},Mr=3e4,Nr=40,Pr=60,Fr=(e,t,n,r,i,a)=>{let o=e.trim(),s=t.trim().toLowerCase();return JSON.stringify([o,s,n,r,i,a])},Ir=(e,t)=>{try{let n=JSON.parse(e);return Array.isArray(n)&&n[0]===t}catch{return!1}},Lr=g()(te((e,t)=>({cache:{},cacheKeys:[],inFlight:{},async searchFiles(n,r,i=Pr,a){if(!n||n.trim().length===0)return[];let o=n.trim(),s=typeof r==`string`?r.trim():``,c=!!a?.includeHidden,l=a?.respectGitignore??!0,u=a?.type===`directory`?`directory`:`file`,d=Fr(o,s,i,c,l,u),f=Date.now(),p=t().cache[d];if(p&&f-p.timestamp<Mr)return p.files;let m=t().inFlight[d];if(m)return m;let h=y.searchFiles(s,{directory:o,limit:i,includeHidden:c,respectGitignore:l,dirs:u!==`file`,type:u}).then(t=>(e(e=>{if(e.inFlight[d]!==h)return e;let n={...e.cache,[d]:{files:t,timestamp:Date.now()}},r=e.cacheKeys.filter(e=>e!==d);for(r.push(d);r.length>Nr;){let e=r.shift();e&&delete n[e]}return{cache:n,cacheKeys:r}}),t)).finally(()=>{e(e=>{if(e.inFlight[d]!==h)return e;let t={...e.inFlight};return delete t[d],{inFlight:t}})});return e(e=>({inFlight:{...e.inFlight,[d]:h}})),h},invalidateDirectory(t){if(!t||t.trim().length===0){e({cache:{},cacheKeys:[],inFlight:{}});return}let n=t.trim();e(e=>{let t={...e.cache},r=e.cacheKeys.filter(e=>!Ir(e,n)||(delete t[e],!1)),i=Object.entries(e.inFlight).filter(([e])=>!Ir(e,n));return{cache:t,cacheKeys:r,inFlight:Object.fromEntries(i)}})}}),{name:`file-search-store`})),Rr=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`yuri_stream_debug`)===`1`}catch{return!1}},zr=`yuri_stream_perf`,Br=()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(zr)===`1`}catch{return!1}},Vr=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),Hr=()=>{if(!Br()||typeof window>`u`)return null;if(!window.__yuriStreamPerfState){let e=Date.now();window.__yuriStreamPerfState={counters:new Map,startedAt:e,lastUpdatedAt:e}}return window.__yuriStreamPerfState},Ur=e=>Array.from(e.entries()).map(([e,t])=>({metric:e,count:t.count,avg:t.count>0?Number((t.total/t.count).toFixed(3)):0,max:Number(t.max.toFixed(3)),total:Number(t.total.toFixed(3)),last:Number(t.last.toFixed(3))})).sort((e,t)=>t.total-e.total||t.count-e.count),Wr=(e,t)=>{let n=Hr();if(!n)return;let r=n.counters.get(e)??{count:0,total:0,max:0,last:0};r.count+=1,r.total+=t,r.max=Math.max(r.max,t),r.last=t,n.counters.set(e,r),n.lastUpdatedAt=Date.now()},Gr=e=>{if(!(typeof window>`u`))try{if(e){window.localStorage.setItem(zr,`1`),window.__yuriStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()};return}window.localStorage.removeItem(zr),delete window.__yuriStreamPerfState,delete window.__yuriVsCodeStreamPerfState}catch{}},Kr=()=>{typeof window>`u`||(Br()&&(window.__yuriStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}),window.__yuriVsCodeStreamPerfState&&(window.__yuriVsCodeStreamPerfState={...window.__yuriVsCodeStreamPerfState,counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}))},qr=()=>{if(typeof window>`u`)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};let e=window.__yuriStreamPerfState;return!Br()||!e?{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]}:{enabled:!0,startedAt:e.startedAt,lastUpdatedAt:e.lastUpdatedAt,durationMs:Math.max(0,Date.now()-e.startedAt),entries:Ur(e.counters)}},Jr=()=>{if(typeof window>`u`)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};let e=window.__yuriVsCodeStreamPerfState;if(!Br()||!e)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};let t=typeof e.startedAt==`number`?e.startedAt:null;return{enabled:!0,startedAt:t,lastUpdatedAt:typeof e.lastUpdatedAt==`number`?e.lastUpdatedAt:null,durationMs:t?Math.max(0,Date.now()-t):0,entries:Ur(e.counters)}},Yr=(e,t=1)=>{Wr(e,t)},Xr=(e,t)=>{Wr(e,t)},Zr=(e,t)=>{if(!Br())return t();let n=Vr();try{return t()}finally{Wr(e,Vr()-n)}},B=null,Qr=0,V=_(),$r=b(`lastDirectory`,{storage:V}),ei=typeof $r==`string`&&$r.length>0,ti=e=>{try{Lr.getState().invalidateDirectory(e)}catch(e){console.warn(`Failed to invalidate file search cache:`,e)}},H=e=>{let t=e.trim();if(!t)return t;let n=t.replace(/\\/g,`/`).replace(/^([a-z]):/,(e,t)=>t.toUpperCase()+`:`);return n.length>1?n.replace(/\/+$/,``):n},ni=(e,t)=>{let n=e.trim();return n.startsWith(`~`)?n===`~`?t||n:(n.startsWith(`~/`)||n.startsWith(`~\\`))&&t?`${t}${n.slice(1)}`:n:n},ri=(e,t)=>H(ni(e,t)),ii=()=>{let e=b(`homeDirectory`,{storage:V});if(typeof e!=`string`||e.trim().length===0)return null;let t=H(e);return t.length>0?t:null},ai=()=>{let e=b(`lastDirectory`,{storage:V});if(typeof e!=`string`||e.trim().length===0)return null;let t=H(e);return t.length>0?t:null},oi=()=>{if(typeof process>`u`)return null;let e={},t=e?.HOME||e?.USERPROFILE||(e?.HOMEDRIVE&&e?.HOMEPATH?`${e.HOMEDRIVE}${e.HOMEPATH}`:void 0);if(typeof t==`string`&&t.trim().length>0){let e=H(t);return e.length>0?e:null}let n=process?.cwd?.();if(typeof n==`string`&&n.trim().length>0){let e=H(n);return e.length>0?e:null}return null},si=()=>{if(typeof window<`u`){if(B)return B;let e=typeof window.__YURI_HOME__==`string`&&window.__YURI_HOME__.length>0?window.__YURI_HOME__:null;if(e&&e.length>0)return B=e,v(`homeDirectory`,e,{storage:V}),e;let t=ii();if(t&&!f())return B=t,t}return oi()||`/`},ci=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=t.replace(/\\/g,`/`);if(n.length>1){let e=n.replace(/\/+$/,``);if(e&&e.length>0)return e===`/`?null:e}return n===`/`||n.length===0?null:n},li=e=>(B=e,typeof window<`u`&&v(`homeDirectory`,e,{storage:V}),z({homeDirectory:e}),e),ui=async()=>{let e=e=>{let t=ci(e);return t?li(t):null};try{let t=e(await y.getFilesystemHome());if(t)return t}catch(e){console.warn(`Failed to obtain filesystem home directory:`,e)}try{let t=e((await y.getSystemInfo())?.homeDirectory);if(t)return t}catch(e){console.warn(`Failed to get home directory from system info:`,e)}try{let t=e(await p());if(t)return t}catch(e){console.warn(`Failed to obtain desktop-integrated home directory:`,e)}let t=si();return e(t)||t},di=(()=>{if(!f())return null;let e=window.__VSCODE_CONFIG__?.workspaceFolder;if(typeof e!=`string`||e.trim().length===0)return null;let t=H(e);return t.length>0?t:null})()||si(),fi=(()=>{let e=ai();return e&&!f()?ri(e,di):di})();fi&&y.setDirectory(fi);var pi=!!(di&&di!==`/`),mi=g()(te((e,t)=>({currentDirectory:fi,directoryHistory:[fi],historyIndex:0,homeDirectory:di,hasPersistedDirectory:ei,isHomeReady:pi,isSwitchingDirectory:!1,setDirectory:(n,r)=>{let i=ri(n,B||t().homeDirectory||b(`homeDirectory`,{storage:V}));Rr(),Oe(t().currentDirectory,i)&&(y.setDirectory(i),ti(),e(e=>{let t=[...e.directoryHistory.slice(0,e.historyIndex+1),i];return v(`lastDirectory`,i,{storage:V}),z({lastDirectory:i}),{currentDirectory:i,directoryHistory:t,historyIndex:t.length-1,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1}}))},goBack:()=>{let n=t();if(n.historyIndex>0){let t=n.historyIndex-1,r=n.directoryHistory[t];y.setDirectory(r),ti(),v(`lastDirectory`,r,{storage:V}),z({lastDirectory:r}),e({currentDirectory:r,historyIndex:t,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goForward:()=>{let n=t();if(n.historyIndex<n.directoryHistory.length-1){let t=n.historyIndex+1,r=n.directoryHistory[t];y.setDirectory(r),ti(),v(`lastDirectory`,r,{storage:V}),z({lastDirectory:r}),e({currentDirectory:r,historyIndex:t,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goToParent:()=>{let{currentDirectory:e,setDirectory:n}=t();if(e===(B||t().homeDirectory||si())||e===`/`)return;let r=e.endsWith(`/`)?e.slice(0,-1):e,i=r.lastIndexOf(`/`);n(i===-1?B||si():i===0?`/`:r.substring(0,i))},goHome:async()=>{let e=B||t().homeDirectory||await ui();t().setDirectory(e)},synchronizeHomeDirectory:n=>{let r=t(),i=n;B=i;let a=r.homeDirectory!==i,o=b(`lastDirectory`,{storage:V}),s=typeof o==`string`&&o.length>0,c=!s&&(r.currentDirectory===`/`||r.currentDirectory===r.homeDirectory||!r.currentDirectory);if(!a&&!c){r.isHomeReady||e({isHomeReady:!0});return}let l=typeof i==`string`&&i!==``&&i!==`/`,u=r.currentDirectory?ri(r.currentDirectory,i):r.currentDirectory,d=r.directoryHistory.map(e=>ri(e,i)),f=d.some((e,t)=>e!==r.directoryHistory[t]),p=!!(u&&u!==r.currentDirectory),m={homeDirectory:i,hasPersistedDirectory:s,isHomeReady:l};if(c?(m.currentDirectory=i,m.directoryHistory=[i],m.historyIndex=0,m.isSwitchingDirectory=!1):(p||f)&&(m.currentDirectory=u,m.directoryHistory=d,m.historyIndex=Math.min(r.historyIndex,d.length-1),m.isSwitchingDirectory=!1),e(()=>m),(c||p)&&l){let e=c?i:u;y.setDirectory(e),ti(),v(`lastDirectory`,e,{storage:V}),z({lastDirectory:e})}z({homeDirectory:i})}}),{name:`directory-store`}));typeof window<`u`&&(ui().then(e=>{mi.getState().synchronizeHomeDirectory(e)}),i(e=>{B=null;let t=++Qr;if(c(e)){let e=ii(),t=ai(),n=e||`/`,r=t||n;B=e,mi.setState({currentDirectory:r,directoryHistory:[r],historyIndex:0,homeDirectory:n,hasPersistedDirectory:!!t,isHomeReady:!!(e&&e!==`/`),isSwitchingDirectory:!1}),r&&(y.setDirectory(r),ti())}ui().then(e=>{t===Qr&&mi.getState().synchronizeHomeDirectory(e)})}));var hi=(e,i)=>{let a=t();return a?a.openWebSocket(r(e),i):n(i?new WebSocket(e,i):new WebSocket(e))},U=`/api/git`,gi=1200,_i=5e3,vi=2,yi=5e3,bi=`${U}/worktrees/queue-activation`,xi=`message_queue_activation_pending`,Si=`worktree_lifecycle_busy`,Ci=`worktree_activation_stale`,wi=5e3,Ti=3e4,Ei=[0,500,1e3,2e3,4e3,8e3,14e3],Di=new Map,W=new Map,Oi=new Map,ki=new Map,Ai=new Map,G=new Map,K=new Map,q=new Map,ji=new Map,Mi=new Map,J=new Map,Ni=new Map,Pi=new Set,Fi=0,Ii=[],Li=()=>Fi<vi?(Fi+=1,Promise.resolve()):new Promise(e=>{Ii.push(e)}),Ri=()=>{let e=Ii.shift();if(e){e();return}Fi=Math.max(0,Fi-1)},zi=async e=>{await Li();try{return await e()}finally{Ri()}},Bi=Symbol.for(`yuri.git.discoveryGated`),Vi=e=>(Object.defineProperty(e,Bi,{value:!0,configurable:!0}),e),Hi=e=>typeof e==`function`&&e[Bi]===!0,Y=e=>e.trim(),Ui=``,X=e=>{let t=`${s()}\u0000${o()}`;return t!==Ui&&(Ui=t,Ai.clear(),G.clear(),K.clear(),q.clear(),ji.clear(),Mi.clear(),J.clear(),Ni.clear()),`${t}\u0000${Y(e)}`},Wi=(e,t)=>t===`light`?`${Y(e)}::light`:Y(e),Gi=e=>Oi.get(Y(e))??0,Z=e=>{let t=Y(e);Oi.set(t,Gi(e)+1);for(let e of Array.from(ki.keys()))(e===t||e.startsWith(`${t}::`))&&ki.delete(e);for(let e of Array.from(Di.keys()))(e===t||e.startsWith(`${t}::`))&&Di.delete(e);for(let e of Array.from(W.keys()))(e===t||e.startsWith(`${t}::`))&&W.delete(e)},Ki=e=>Ni.get(X(e))??0,Q=e=>{let t=X(e);t&&(Ni.set(t,Ki(e)+1),Mi.delete(t),J.delete(t))};function $(e,t,n){let r={...n};return t&&(r.directory=t),a().api(e,r)}var qi=(e,t,n)=>{if(!Y(e))return;let r=X(e),i=Date.now()+yi;Ai.set(r,{value:t,expiresAt:i}),typeof n==`string`&&n?q.set(X(e),{value:{root:n},expiresAt:i}):q.delete(X(e))};async function Ji(e){let t=Array.from(new Set(e.map(e=>Y(e)).filter(Boolean))),n=new Map,r=s();if(t.length===0)return n;let i=Date.now(),o=[];for(let e of t){let t=X(e),r=Ai.get(t),a=q.get(t);if(r&&r.expiresAt>i&&(!r.value||a&&a.expiresAt>i)){n.set(e,{isGitRepository:r.value,primaryRoot:a?.value.root??null});continue}o.push(e)}if(o.length===0)return n;let c=e=>{for(let t of e){let e=typeof t.directory==`string`?Y(t.directory):``;if(!e)continue;let i=!!t.isGitRepository,a=typeof t.primaryRoot==`string`&&t.primaryRoot?t.primaryRoot:null;r===s()&&qi(e,i,a),n.set(e,{isGitRepository:i,primaryRoot:a})}},u=async e=>{await Promise.all(e.map(async e=>{try{let t=await Yi(e);if(r!==s())return;let i=t?(await Zi(e)).root:null;r===s()&&qi(e,t,t?i:null),n.set(e,{isGitRepository:t,primaryRoot:t?i:null})}catch{}}))},d=o.map(X),f=[...new Set(d.map(e=>K.get(e)).filter(e=>e!==void 0))];if(f.length>0)return await Promise.allSettled(f),r===s()?Ji(t):n;let p=zi(async()=>{if(r!==s())return;let e=new URLSearchParams;for(let t of o)e.append(`directories`,t);let t=a().api(`${U}/discover`),n=e.toString(),i=n?t.includes(`?`)?`${t}&${n}`:`${t}?${n}`:t,u=await l(i);if(u.status===501||!u.ok)throw Error(`Batch git discover unavailable: ${u.status} ${u.statusText}`);let d=await u.json().catch(()=>null),f=Array.isArray(d)?d:[];if(f.length===0&&o.length>0)throw Error(`Batch git discover returned empty payload`);c(f)});for(let e of d)K.set(e,p);try{await p}catch{}finally{for(let e of d)K.get(e)===p&&K.delete(e)}if(r!==s())return n;let m=o.filter(e=>!n.has(e));return m.length>0&&await u(m),n}async function Yi(e){let t=X(e),n=s(),r=K.get(t);if(r&&await r.catch(()=>void 0),n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let i=Date.now(),a=Ai.get(t);if(a&&a.expiresAt>i)return a.value;let o=G.get(t);if(o)return o;let c=zi(async()=>{if(n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let r=await l($(`${U}/check`,e));if(!r.ok)throw Error(`Failed to check git repository: ${r.statusText}`);let i=!!(await r.json()).isGitRepository;return n===s()&&Ai.set(t,{value:i,expiresAt:Date.now()+_i}),i});G.set(t,c);try{return await c}finally{G.get(t)===c&&G.delete(t)}}async function Xi(e,t){let n=t?.mode,r=Wi(e,n),i=Date.now(),a=Di.get(r);if(a&&a.expiresAt>i)return a.value;let s=W.get(r);if(s)return s;let c=(async()=>{let t=Gi(e),i=o(),a=ki.get(r),s=a&&a.transport===i&&a.cacheVersion===t?a:null,c=await l($(`${U}/status`,e,{...n?{mode:n}:{},...s?{since:s.revision}:{}}));if(!c.ok)throw Error(`Failed to get git status: ${c.statusText}`);let u=await c.json(),d;if(`unchanged`in u&&u.unchanged===!0){if(!s||u.revision!==s.revision)throw Error(`Failed to get git status: unexpected unchanged response`);d=s.value}else{let{revision:n,...a}=u;d=a,typeof n==`string`&&Gi(e)===t&&ki.set(r,{revision:n,value:d,transport:i,cacheVersion:t})}return Gi(e)===t&&Di.set(r,{value:d,expiresAt:Date.now()+gi}),d})();W.set(r,c);try{return await c}finally{W.get(r)===c&&W.delete(r)}}async function Zi(e){let t=X(e),n=s(),r=K.get(t);if(r&&await r.catch(()=>void 0),n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let i=Date.now(),a=q.get(t);if(a&&a.expiresAt>i)return a.value;let o=ji.get(t);if(o)return o;let c=zi(async()=>{if(n!==s())throw new DOMException(`Git discovery runtime changed`,`AbortError`);let r=await l($(`${U}/primary-root`,e));if(!r.ok)throw Error(`Failed to resolve git primary root: ${r.statusText}`);let i=await r.json().catch(()=>({}));if(typeof i.root!=`string`||!i.root.trim())throw Error(`Invalid git primary root response`);let a={root:i.root};return n===s()&&q.set(t,{value:a,expiresAt:Date.now()+yi}),a});ji.set(t,c);try{return await c}finally{ji.get(t)===c&&ji.delete(t)}}async function Qi(e){let t=await l($(`${U}/toplevel`,e));if(!t.ok)throw Error(`Failed to resolve git toplevel: ${t.statusText}`);let n=await t.json().catch(()=>({}));return{root:typeof n.root==`string`&&n.root?n.root:e}}async function $i(e,t){let n=await l($(`${U}/commit-summaries`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({shas:t})});if(!n.ok)throw Error(`Failed to get git commit summaries: ${n.statusText}`);let r=await n.json().catch(()=>({}));return{commits:Array.isArray(r.commits)?r.commits.map(e=>({sha:typeof e.sha==`string`?e.sha:``,short:typeof e.short==`string`?e.short:``,subject:typeof e.subject==`string`?e.subject:``})).filter(e=>e.sha&&e.short):[]}}async function ea(e,t){let{path:n,staged:r,contextLines:i}=t;if(!n)throw Error(`path is required to fetch git diff`);let a=await l($(`${U}/diff`,e,{path:n,staged:r?`true`:void 0,context:i}));if(!a.ok)throw Error(`Failed to get git diff: ${a.statusText}`);return a.json()}async function ta(e,t){let{path:n,staged:r}=t;if(!n)throw Error(`path is required to fetch git file diff`);let i=await l($(`${U}/file-diff`,e,{path:n,staged:r?`true`:void 0}));if(!i.ok)throw Error(`Failed to get git file diff: ${i.statusText}`);return i.json()}async function na(e,t,n){if(!t)throw Error(`path is required to revert git changes`);let r=await l($(`${U}/revert`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,scope:n?.scope})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to revert git changes`)}Z(e)}async function ra(e,t){await ia(e,[t])}async function ia(e,t){let n=t.map(e=>e.trim()).filter(Boolean);if(n.length===0)throw Error(`path is required to stage git changes`);let r=await l($(`${U}/stage`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({paths:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to stage git changes`)}Z(e)}async function aa(e,t){await oa(e,[t])}async function oa(e,t){let n=t.map(e=>e.trim()).filter(Boolean);if(n.length===0)throw Error(`path is required to unstage git changes`);let r=await l($(`${U}/unstage`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({paths:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to unstage git changes`)}Z(e)}async function sa(e,t,n){await ua(e,t,n,`stage`)}async function ca(e,t,n){await ua(e,t,n,`unstage`)}async function la(e,t,n){await ua(e,t,n,`discard`)}async function ua(e,t,n,r){if(!t)throw Error(`path is required to apply a git hunk`);if(typeof n!=`string`||!n.trim())throw Error(`patch is required to apply a git hunk`);let i=await l($(`${U}/apply-hunk`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,patch:n,action:r})});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||`Failed to apply git hunk`)}Z(e)}async function da(e){if(!e)return!1;let t=await l($(`${U}/worktree-type`,e));if(!t.ok)throw Error(`Failed to detect worktree type: ${t.statusText}`);return!!(await t.json()).linked}async function fa(e,t){let n=await l($(`${U}/branches`,e),{signal:t?.signal});if(!n.ok)throw Error(`Failed to get branches: ${n.statusText}`);return n.json()}async function pa(e,t){if(!t?.branch)throw Error(`branch is required to delete a branch`);let n=await l($(`${U}/branches`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to delete branch`)}return n.json()}async function ma(e,t){if(!t?.branch)throw Error(`branch is required to delete remote branch`);let n=await l($(`${U}/remote-branches`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to delete remote branch`)}return n.json()}async function ha(e,t){let n=t?.remote?.trim();if(!n)throw Error(`remote is required to remove a remote`);let r=await l($(`${U}/remotes`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({remote:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to remove remote`)}return r.json()}async function ga(e,t,n){if(!Array.isArray(t)||t.length===0)throw Error(`No files provided to generate commit message`);let r={files:t};n?.zenModel&&(r.zenModel=n.zenModel),n?.providerId&&(r.providerId=n.providerId),n?.modelId&&(r.modelId=n.modelId);let i=await l($(`${U}/commit-message`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));console.error(`[git-generation][browser] http error`,{status:i.status,statusText:i.statusText,error:e});let t=typeof e?.traceId==`string`&&e.traceId?` (traceId: ${e.traceId})`:``;throw Error(`${e.error||`Failed to generate commit message`}${t}`)}let a=await i.json();if(!a?.message||typeof a.message!=`object`)throw Error(`Malformed commit generation response`);return{message:{subject:typeof a.message.subject==`string`&&a.message.subject.trim().length>0?a.message.subject.trim():``,highlights:Array.isArray(a.message.highlights)?a.message.highlights.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()):[]}}}async function _a(e,t){let{base:n,head:r,context:i,zenModel:a,providerId:o,modelId:s}=t;if(!n||!r)throw Error(`base and head are required`);let c={base:n,head:r};i?.trim()&&(c.context=i.trim()),a&&(c.zenModel=a),o&&(c.providerId=o),s&&(c.modelId=s);let u=await l($(`${U}/pr-description`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)});if(!u.ok){let e=await u.json().catch(()=>({error:u.statusText}));throw Error(e.error||`Failed to generate PR description`)}let d=await u.json().catch(()=>null),f=typeof d?.title==`string`?d.title:``,p=typeof d?.body==`string`?d.body:``;if(!f&&!p)throw Error(`Malformed PR description response`);return{title:f,body:p}}async function va(e){let t=X(e),n=s(),r=Date.now(),i=Mi.get(t);if(i&&i.expiresAt>r)return i.value;let a=J.get(t);if(a)return a;let o=Ki(e),c=zi(async()=>{let r=await l($(`${U}/worktrees`,e));if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to list worktrees`)}let i=await r.json();return n===s()&&o===Ki(e)&&Mi.set(t,{value:i,expiresAt:Date.now()+yi}),i});J.set(t,c);try{return await c}finally{J.get(t)===c&&J.delete(t)}}Vi(va);async function ya(e,t){let n=await l($(`${U}/worktrees/validate`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to validate worktree`)}return n.json()}async function ba(e){let t=await l($(`${U}/worktrees/bootstrap-status`,e));if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to get worktree bootstrap status`)}return t.json()}async function xa(e,t){let n=await l($(`${U}/worktrees/preview`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to preview worktree`)}return n.json()}var Sa=e=>typeof e==`string`&&e.length>0,Ca=e=>{if(!e||typeof e!=`object`)return null;let t=e;if(!Sa(t.name)||!Sa(t.path))return null;let n={head:typeof t.head==`string`?t.head:``,name:t.name,branch:typeof t.branch==`string`?t.branch:``,path:t.path};return t.directoryCreated===!0&&(n.directoryCreated=!0),t.bootstrapStatus&&typeof t.bootstrapStatus==`object`&&(n.bootstrapStatus=t.bootstrapStatus),n},wa=(e,t,n)=>{if(e!==503||!t||typeof t!=`object`)return null;let r=t;if(r.code!==xi)return null;let i=Ca(r.worktree);if(!i)return null;let a=r.repair;if(!a||typeof a!=`object`)return null;let o=a;if(o.method!==`POST`||o.path!==bi)return null;let s=o.body;if(!s||typeof s!=`object`)return null;let c=s;return c.projectDirectory!==n||c.directory!==i.path?null:i},Ta=(e,t,n,r)=>`${e}\u0000${t}\u0000${n}\u0000${r}`,Ea=e=>new Promise(t=>{setTimeout(t,e)}),Da=async e=>{if(e.status===409){let t=await e.json().catch(()=>null);return t?.code===Si||t?.code===Ci}return e.status===503&&(await e.json().catch(()=>null))?.code===xi},Oa=e=>e===400||e===401||e===403||e===501,ka=(e,t)=>{let n=o(),r=s(),i=Ta(n,r,e,t);if(Pi.has(i))return;Pi.add(i);let a=()=>o()===n&&s()===r;(async()=>{let n=Date.now(),r=0;for(;Date.now()-n<Ti;){if(!a())return;let i=Ei[Math.min(r,Ei.length-1)]??0;if(i>0){let e=Ti-(Date.now()-n);if(e<=0||(await Ea(Math.min(i,e)),!a()))return}let o=new AbortController,s=setTimeout(()=>o.abort(),wi);try{let n=await l($(bi,void 0),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectDirectory:e,directory:t}),signal:o.signal});if(n.ok||Oa(n.status))return;if(await Da(n)){r+=1;continue}return}catch{r+=1}finally{clearTimeout(s)}}})().catch(()=>{}).finally(()=>{Pi.delete(i)})};async function Aa(e,t){let n=await l($(`${U}/worktrees`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})}),r=await n.json().catch(()=>null);if(n.ok){let t=Ca(r);if(t)return Q(e),t;if(r&&typeof r==`object`)return Q(e),r;throw Error(`Failed to create worktree`)}let i=wa(n.status,r,e);if(i)return Q(e),ka(e,i.path),i;let a=r&&typeof r==`object`?r:{error:n.statusText};throw Error(a.error||`Failed to create worktree`)}async function ja(e,t){let n=await l($(`${U}/worktrees`,e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to delete worktree`)}let r=await n.json();return Q(e),r}async function Ma(e,t,n={}){let r=await l($(`${U}/commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:t,addAll:n.addAll??!1,files:n.files,stageFiles:n.stageFiles})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to create commit`)}let i=await r.json();return Z(e),i}async function Na(e,t={}){let n=await l($(`${U}/push`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to push`)}let r=await n.json();return Z(e),r}async function Pa(e,t={}){let n=await l($(`${U}/pull`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to pull`)}let r=await n.json();return Z(e),r}async function Fa(e,t={}){let n=await l($(`${U}/fetch`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to fetch`)}let r=await n.json();return Z(e),r}async function Ia(e){let t=await l($(`${U}/stashes`,e));if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to list stashes`)}return t.json()}async function La(e,t){let n=await l($(`${U}/stashes/file-counts`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({refs:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to count stash files`)}return n.json()}async function Ra(e,t={}){let n=await l($(`${U}/stash`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to stash changes`)}return n.json()}var za=async(e,t,n)=>{let r=await l($(`${U}/${t}`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to ${t}`)}return r.json()},Ba=(e,t)=>za(e,`stash/apply`,t),Va=(e,t)=>za(e,`stash/pop`,t),Ha=(e,t)=>za(e,`stash/drop`,t);async function Ua(e,t){let n=await l($(`${U}/checkout`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({branch:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to checkout branch`)}return n.json()}async function Wa(e,t,n){let r=await l($(`${U}/branches`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t,startPoint:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to create branch`)}return r.json()}async function Ga(e,t,n){let r=await l($(`${U}/branches/rename`,e),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldName:t,newName:n})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error||`Failed to rename branch`)}return r.json()}async function Ka(e,t={}){let n=await l($(`${U}/log`,e,{maxCount:t.maxCount,from:t.from,to:t.to,file:t.file,all:t.all?`true`:void 0}));if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(`Failed to get git log: ${e.error||n.statusText}`)}return n.json()}async function qa(e,t){let n=await l($(`${U}/commit-files`,e,{hash:t}));if(!n.ok)throw Error(`Failed to get commit files: ${n.statusText}`);return n.json()}async function Ja(e,t,n,r){let i=await l($(`${U}/commit-file-diff`,e,{hash:t,path:n,binary:r?`true`:void 0}));if(!i.ok)throw Error(`Failed to get commit file diff: ${i.statusText}`);return i.json()}async function Ya(){let e=await l($(`${U}/identities`,void 0));if(!e.ok)throw Error(`Failed to get git identities: ${e.statusText}`);return e.json()}async function Xa(e){let t=await l($(`${U}/identities`,void 0),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to create git identity`)}return t.json()}async function Za(e,t){let n=await l($(`${U}/identities/${e}`,void 0),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to update git identity`)}return n.json()}async function Qa(e){let t=await l($(`${U}/identities/${e}`,void 0),{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to delete git identity`)}}async function $a(e){if(!e)return null;let t=await l($(`${U}/current-identity`,e));if(!t.ok)throw Error(`Failed to get current git identity: ${t.statusText}`);let n=await t.json();return n?{userName:n.userName??null,userEmail:n.userEmail??null,sshCommand:n.sshCommand??null}:null}async function eo(e){if(!e)return!1;let t=await l($(`${U}/has-local-identity`,e));if(!t.ok)throw Error(`Failed to check local identity: ${t.statusText}`);return(await t.json().catch(()=>null))?.hasLocalIdentity===!0}async function to(){let e=await l($(`${U}/global-identity`,void 0));if(!e.ok)throw Error(`Failed to get global git identity: ${e.statusText}`);let t=await e.json();return!t||!t.userName&&!t.userEmail?null:{userName:t.userName??null,userEmail:t.userEmail??null,sshCommand:t.sshCommand??null}}async function no(e,t){let n=await l($(`${U}/set-identity`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profileId:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to set git identity`)}return n.json()}async function ro(){let e=await l($(`${U}/discover-credentials`,void 0));if(!e.ok)throw Error(`Failed to discover git credentials: ${e.statusText}`);return e.json()}async function io(e,t){if(!e)return null;let n=await l($(`${U}/remote-url`,e,{remote:t}));return n.ok?(await n.json()).url??null:null}async function ao(e,t){let n=await l($(`${U}/remotes`,e),{signal:t?.signal});if(!n.ok)throw Error(`Failed to get remotes: ${n.statusText}`);return n.json()}async function oo(e,t){let n=await l($(`${U}/rebase`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to rebase`)}return n.json()}async function so(e){let t=await l($(`${U}/rebase/abort`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to abort rebase`)}return t.json()}async function co(e,t){let n=await l($(`${U}/merge`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to merge`)}return n.json()}async function lo(e,t){let n=await l($(`${U}/checkout-commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to checkout commit`)}return n.json()}async function uo(e,t){let n=await l($(`${U}/cherry-pick`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to cherry-pick`)}return n.json()}async function fo(e,t){let n=await l($(`${U}/revert-commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t})});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||`Failed to revert commit`)}return n.json()}async function po(e,t,n,r){let i=await l($(`${U}/reset-to-commit`,e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:t,mode:n,force:r})});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||`Failed to reset`)}return i.json()}async function mo(e){let t=await l($(`${U}/merge/abort`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to abort merge`)}return t.json()}async function ho(e){let t=await l($(`${U}/rebase/continue`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to continue rebase`)}return t.json()}async function go(e){let t=await l($(`${U}/merge/continue`,e),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({error:t.statusText}));throw Error(e.error||`Failed to continue merge`)}return t.json()}async function _o(e,t){return await Ra(e,{message:t?.message}),{success:!0}}async function vo(e){return await Va(e,{ref:`stash@{0}`}),{success:!0}}async function yo(e){let t=await l($(`${U}/conflict-details`,e));if(!t.ok)throw Error(`Failed to get conflict details: ${t.statusText}`);return t.json()}async function bo(e,t){let n=await l(`${U}/validate-directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({directory:e,worktreeRoot:t})});if(!n.ok)throw Error(`Failed to validate worktree directory: ${n.statusText}`);return n.json()}async function xo(e){let t=await l(`${U}/canonicalize-worktree-state`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({directory:e})});if(!t.ok)throw Error(`Failed to canonicalize worktree state: ${t.statusText}`);return t.json()}export{ha as $,vn as $t,$i as A,nt as An,Xr as At,Fa as B,Zn as Bt,ga as C,mt as Cn,qr as Ct,yo as D,E as Dn,Rr as Dt,qa as E,ht as En,Gr as Et,Xi as F,z as Ft,Hi as G,kn as Gt,Na as H,qn as Ht,ba as I,kr as It,va as J,N as Jt,da as K,An as Kt,to as L,Qn as Lt,ta as M,ke as Mn,jr as Mt,Ya as N,Tr as Nt,$a as O,qe as On,Yr as Ot,Ka as P,Er as Pt,oo as Q,xn as Qt,io as R,er as Rt,Ha as S,xt as Sn,mi as St,Ja as T,pt as Tn,Kr as Tt,eo as U,jn as Ut,Pa as V,Jn as Vt,Q as W,On as Wt,Va as X,bn as Xt,co as Y,gn as Yt,xa as Z,yn as Zt,Qa as _,dt as _n,Za as _t,Yi as a,dn as an,na as at,ro as b,yt as bn,zi as bt,uo as c,At as cn,ra as ct,La as d,Wt as dn,_o as dt,wn as en,Ga as et,Wa as f,Xt as fn,Ra as ft,pa as g,ot as gn,ca as gt,Aa as h,Yt as hn,oa as ht,xo as i,un as in,fo as it,ea as j,Ae as jn,Lr as jt,fa as k,et as kn,Zr as kt,go as l,Ct as ln,ia as lt,Xa as m,Ut as mn,aa as mt,so as n,Tn as nn,Zi as nt,Ua as o,an as on,la as ot,Ma as p,O as pn,vo as pt,Ia as q,M as qt,Ba as r,Sn as rn,Qi as rt,lo as s,zt as sn,no as st,mo as t,Cn as tn,po as tt,ho as u,St as un,sa as ut,ja as v,ct as vn,ya as vt,_a as w,ut as wn,Jr as wt,Ji as x,bt as xn,hi as xt,ma as y,vt as yn,bo as yt,ao as z,$n as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e,n as t}from"./platform-CiUKDeXd.js";import{C as n,D as r,I as i,L as a,M as o,O as s,P as c,S as l,T as u,_ as d,a as f,b as p,c as m,j as h,n as g,o as _,r as v,s as y,t as ee,v as b,w as x,y as S}from"./vendor-opencode-client-BM2r1f0o.js";import{a as te}from"./vendor-tanstack-query-core-BSjXNgF_.js";import{b as ne,v as C}from"./runtime-file-resource-C5kmYlLv.js";import{o as w}from"./path-utils-jGozTg9d.js";import{a as T,n as re}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{Dt as ie,ht as ae,mt as oe,y as se}from"./vendor-effect-X1Hqc7ba.js";import{t as E}from"./native-errors-06if6eu-.js";import{a as ce,i as le,n as ue,o as de,r as fe,s as D}from"./appearance-DFsI3pnP.js";import{i as pe,o as me}from"./fileReferenceParser-1HHDBUum.js";import{a as he,r as O}from"./pages-CYkE04ml.js";import{n as ge,t as _e}from"./vendor-solid-js-BBVUd3Hw.js";import{a as ve,c as ye,d as be,f as k,g as A,h as j,i as M,l as N,m as xe,n as Se,o as P,p as F,r as Ce,s as we,t as Te,u as Ee}from"./vendor-opencode-plugin-ZhpPgHCL.js";var I={"@opencode/plugin/gui":P,"@opencode/plugin/gui/main":P,"@opencode/plugin/gui/file":ve,"@opencode/plugin/gui/review":M,"@opencode/plugin/gui/browser":Ce,"@opencode/plugin/rpc":Te,"@opencode/schema/rpc":Se,"@opencode/client":v,"@opencode/client/effect":g,"@opencode/client/solid":ee,effect:se,"solid-js":c,"solid-js/web":ge,"solid-js/store":y},De=new Set(`assert assert/strict async_hooks buffer child_process cluster console constants crypto dgram diagnostics_channel dns dns/promises domain events fs fs/promises http http2 https inspector inspector/promises module net os path path/posix path/win32 perf_hooks process punycode querystring readline readline/promises repl stream stream/consumers stream/promises stream/web string_decoder sys timers timers/promises tls trace_events tty url util util/types v8 vm wasi worker_threads zlib`.split(` `));function Oe(){let e=new Proxy(function(){},{get:(t,n)=>n===`then`?void 0:n===Symbol.hasInstance?()=>!1:n===Symbol.toPrimitive||n===`toString`?()=>`[main-only module]`:e,apply:()=>e,construct:()=>e,set:()=>!0});return e}function ke(e,t){if(e.length>16777216)throw Error(`GUI bundle exceeds 16 MiB`);let n={exports:{}};Function(`require`,`module`,`exports`,e)(e=>{if(Object.hasOwn(I,e))return I[e];if(e===`electron`||e.startsWith(`node:`)||De.has(e))return Oe();throw Error(`Unsupported GUI shared module: ${e}`)},n,n.exports);let r=n.exports,i=r&&typeof r==`object`&&`default`in r?r.default:r;if(!i||typeof i!=`object`)throw Error(`GUI bundle must default-export Plugin.define`);if((!(`setup`in i)||typeof i.setup!=`function`)&&!(t&&`main`in i&&typeof i.main==`function`))throw new E(`GUI_PLUGIN_UNSUPPORTED`,`This host requires a window setup; main-only plugins are unsupported`);if(`os`in i&&i.os!==void 0){if(!t)throw new E(`GUI_PLUGIN_UNSUPPORTED`,`OS-restricted plugins require the native GUI host`);if(!Array.isArray(i.os)||!i.os.includes(t))throw new E(`GUI_PLUGIN_UNSUPPORTED`,`GUI plugin is unavailable on this OS`)}if(`main`in i&&i.main!==void 0&&typeof i.main!=`function`)throw Error(`Invalid GUI main entry`);if(`stores`in i&&i.stores!==void 0){if(!i.stores||typeof i.stores!=`object`||Array.isArray(i.stores))throw Error(`Invalid GUI stores`);for(let e of Object.values(i.stores))if(!e||typeof e!=`object`||!(`schema`in e)||!ie(e.schema)||!(`scope`in e)||![`global`,`session`].includes(String(e.scope))||!(`initial`in e))throw Error(`Invalid GUI store declaration`)}if(`i18n`in i&&i.i18n!==void 0){if(!i.i18n||typeof i.i18n!=`object`||Array.isArray(i.i18n))throw Error(`Invalid GUI locale catalog`);for(let e of Object.values(i.i18n))if(!e||typeof e!=`object`||Array.isArray(e)||Object.values(e).some(e=>typeof e!=`string`))throw Error(`GUI locales must be inline string dictionaries`)}return i}function L(t){let n=t;if(/^file:/i.test(n)){let e=new URL(n);n=`${e.hostname&&e.hostname!==`localhost`?`//${e.hostname}`:``}${decodeURIComponent(e.pathname)}`,/^\/[a-z]:\//i.test(n)&&(n=n.slice(1))}let r=e(n)??``;return r===`.`?``:r}var R=e=>/^(?:\/|[a-z]:\/)/i.test(e),z=()=>{throw Error(`Unsupported GUI file API: tree`)},B=class extends Error{},V=e=>new TextEncoder().encode(e).byteLength,Ae=class{files;query;transport;root;api;ended=!1;states=new Map;inflight=new Map;watches=new Map;apiLeases=new Map;registeredOwners=new WeakSet;endedOwners=new WeakSet;leaseCount=0;rerun=new Set;selections=new Map;scrolls=new Map;subscriptions=new Map;constructor(e,t,n,r){this.files=e,this.query=t,this.transport=n,this.root=r,this.root=L(r),this.api={root:this.root,ready:()=>!this.ended,resolve:e=>this.resolve(e),absolute:R,get:e=>{let t=this.track(e,`file`);return this.states.get(t)},missing:e=>{let t=this.track(e,`missing`);return this.states.get(t)?.notFound===!0},sync:(e,t)=>{let n=s();return this.ended||n&&this.endedOwners.has(n)?Promise.resolve():(this.acquireApiLease(e),this.sync(e,t?.force))},unwatch:e=>this.releaseApiLease(s(),this.resolve(e)),exists:async e=>{try{if(this.files.statFile)return(await this.query.fetchQuery(this.statOptions(e))).isFile;let t=this.full(e);return(await this.files.listDirectory(t.slice(0,t.lastIndexOf(`/`)))).entries.some(e=>!e.isDirectory&&L(e.path)===t)}catch{return!1}},search:async(e,t)=>{if(t?.kind===`any`)throw Error(`Unsupported GUI file search: directories`);t?.signal?.throwIfAborted();let r=await this.query.fetchQuery({queryKey:[`gui-plugin-files`,n,this.root,`search`,e,t?.limit],gcTime:3e4,queryFn:async({signal:n})=>(n.throwIfAborted(),this.files.search({directory:this.root,query:e,maxResults:t?.limit??100}))});if(t?.signal?.throwIfAborted(),this.ended)throw new DOMException(`GUI file model was disposed`,`AbortError`);return r.map(e=>this.resolve(e.path))},selection:{get:e=>this.selections.get(this.track(e,`selection`)),set:(e,t)=>{let n=this.resolve(e),r=this.selections.get(n);r===t||r&&t&&r.start===t.start&&r.end===t.end&&r.side===t.side&&r.endSide===t.endSide||(this.selections.set(n,t),this.trim(this.selections,`selection`),this.changed(n,`selection`))}},scroll:{get:e=>this.scrolls.get(this.track(e,`scroll`))??{},set:(e,t)=>{let n=this.resolve(e),r=this.scrolls.get(n),i={...r,...t};(r?.top!==i.top||r?.left!==i.left)&&(this.scrolls.set(n,i),this.trim(this.scrolls,`scroll`),this.changed(n,`scroll`))}},tree:{list:z,state:z,sync:z,expand:z,collapse:z}}}resolve(e){let t=L(e);if(!R(t))return t;if(t===this.root)return``;let n=this.root.endsWith(`/`)?this.root:`${this.root}/`;return t.startsWith(n)?t.slice(n.length):t}full(e){let t=this.resolve(e);return R(t)?t:L(`${this.root}/${t}`)}input(e){return{scopeDirectory:this.root,path:this.full(e),options:{directory:this.root}}}statOptions(e){return{...ne(this.files,this.input(e),this.transport),gcTime:3e4}}track(e,t){let n=this.resolve(e),i=r();if(!i||this.ended)return n;let a=`${t}:${n}`,s=this.subscriptions.get(a);s||(s={revision:u(0),listeners:new Set},this.subscriptions.set(a,s));let c=s;return c.listeners.has(i)||(c.listeners.add(i),o(i,()=>h(()=>{c.listeners.delete(i),!c.listeners.size&&this.subscriptions.get(a)===c&&this.subscriptions.delete(a)}))),c.revision[0](),n}changed(e,t){this.ended||this.subscriptions.get(`${t}:${e}`)?.revision[1](e=>e+1)}trim(e,t){for(;e.size>64;){let n=e.keys().next().value;e.delete(n),this.changed(n,t)}}setState(e,t){let n=this.states.get(e);n?.content?.content===t.content?.content&&n?.content?.type===t.content?.type&&(t.content=n?.content),!(n&&n.loaded===t.loaded&&n.loading===t.loading&&n.error===t.error&&n.notFound===t.notFound&&n.content===t.content)&&(this.states.set(e,t),d(()=>{this.changed(e,`file`),n?.notFound===!0!=(t.notFound===!0)&&this.changed(e,`missing`)}))}acquireApiLease(e){let t=s();if(this.ended||t&&this.endedOwners.has(t)||!this.files.statFile)return;let n=this.resolve(e),r=this.apiLeases.get(t);if(r?.has(n))return;if(this.leaseCount>=256)throw Error(`GUI file consumer limit exceeded`);let i=this.watch(n);r||(r=new Map,this.apiLeases.set(t,r)),r.set(n,i),this.leaseCount++,t&&!this.registeredOwners.has(t)&&(this.registeredOwners.add(t),h(()=>{`fn`in t||this.endedOwners.add(t),this.registeredOwners.delete(t);for(let e of[...this.apiLeases.get(t)?.keys()??[]])this.releaseApiLease(t,e)}))}releaseApiLease(e,t){let n=this.apiLeases.get(e),r=n?.get(t);r&&(n.delete(t),this.leaseCount--,n.size||this.apiLeases.delete(e),r())}reserve(e){if(!this.states.has(e)){if(this.states.size>=64){let e=[...this.states.keys()].find(e=>!this.watches.has(e)&&!this.inflight.has(e));if(!e)throw Error(`GUI file cache limit exceeded`);let t=this.states.get(e)?.notFound===!0;this.states.delete(e),d(()=>{this.changed(e,`file`),t&&this.changed(e,`missing`)})}this.states.set(e,{path:e,name:e.split(`/`).at(-1)??e})}}async sync(e,t=!1){if(this.ended)return;let n=this.resolve(e);if(this.inflight.has(n))return t&&this.rerun.add(n),this.inflight.get(n);if(!t&&this.states.get(n)?.loaded&&!this.states.get(n)?.error)return;this.reserve(n);let r=this.states.get(n);this.setState(n,{...r,path:n,name:n.split(`/`).at(-1)??n,loading:!r?.loaded&&!this.watches.get(n)?.failed});let i=(async()=>{try{do{this.rerun.delete(n);let e=this.watches.get(n),r=e?.epoch;try{let i=C(this.files,this.input(n),this.transport),a=await this.query.fetchQuery({...i,gcTime:3e4,staleTime:t?0:3e4,queryFn:async()=>{if(!this.files.readFile)throw Error(`File content reads are unavailable in this runtime`);let e=await this.files.readFile(this.full(n),{directory:this.root});if(e.exists===!1)throw new B(`File does not exist`);let t=e.content;if(V(t)>131072)throw Error(`GUI file preview exceeds 128 KiB`);return t}});if(this.ended)return;if(V(a)>131072)throw Error(`GUI file preview exceeds 128 KiB`);(!e||e.epoch===r&&!e.failed)&&this.setState(n,{path:n,name:n.split(`/`).at(-1)??n,loaded:!0,loading:!1,content:{type:`text`,content:a}})}catch(t){if(this.ended)return;if((!e||e.epoch===r&&!e.failed)&&this.setState(n,{...this.states.get(n),loading:!1,...t instanceof B?{notFound:!0}:{},error:String(t)}),!this.rerun.has(n))throw t}t=!0}while(!this.ended&&this.rerun.has(n))}finally{this.inflight.delete(n),this.rerun.delete(n)}})();return this.inflight.set(n,i),i}watch(e){if(this.ended||!this.files.statFile)return()=>{};let t=this.resolve(e),n=this.watches.get(t);if(!n){if(this.watches.size>=64)throw Error(`GUI file watch limit exceeded`);this.reserve(t),n={count:0,epoch:0,failed:!1,stop:()=>{}};let e=n;this.watches.set(t,e);let r,i=new te(this.query,{...this.statOptions(t),refetchInterval:2e3,refetchIntervalInBackground:!1}),a=i.subscribe(n=>{if(this.ended||this.watches.get(t)!==e||n.isFetching)return;if(n.isError||n.isSuccess&&!n.data.isFile){e.failed=!0,e.epoch++,this.setState(t,{...this.states.get(t),loading:!1,notFound:n.isSuccess?!0:this.states.get(t)?.notFound,error:n.isError?String(n.error):`File does not exist`});return}if(!n.data||!n.isSuccess)return;let i=`${n.data.size}:${n.data.mtimeMs??``}`,a=e.failed||r!==void 0&&i!==r;e.failed=!1,r=i,a&&(e.epoch++,this.sync(t,!0).catch(()=>{}))});e.stop=()=>{a(),i.destroy()},this.states.get(t)?.loaded&&this.sync(t,!0).catch(()=>{})}n.count++;let r=!0;return()=>{r&&(r=!1,--n.count===0&&this.watches.get(t)===n&&this.stopWatch(t))}}stopWatch(e){this.watches.get(e)?.stop(),this.watches.delete(e)}dispose(){this.ended=!0;for(let e of this.watches.values())e.stop();this.watches.clear(),this.apiLeases.clear(),this.leaseCount=0,this.rerun.clear(),this.states.clear(),this.inflight.clear(),this.selections.clear(),this.scrolls.clear(),this.subscriptions.clear()}},H=256,U=2097152,W=e=>structuredClone(m(e)),je=class{backend;transport;memory=new Map;resets=new Map;constructor(e,t){this.backend=e,this.transport=t}forPlugin(e,t){let n=(t,n=`global`)=>{if(typeof n==`object`&&`session`in n&&!n.session.location)throw Error(`Unsupported GUI storage: session location is unknown`);let r=n===`global`?n:`session`in n?[n.session.server.id,n.session.id,n.session.location]:[n.server,n.directory];return`yuri.gui-plugin.${JSON.stringify([this.transport,e,r,t])}`},r=e=>{if(t.aborted)throw Error(`GUI plugin has been disposed`);if(e!==void 0)throw Error(`Unsupported GUI storage migration: from`)},i=new Map;return{store:(e,a)=>{r(a.from);let o=n(e,a.scope),s=i.get(o);if(s)return s;if(i.size>=H)throw Error(`GUI plugin store limit exceeded`);let c=oe(a.schema),l=ae(a.schema),d=c(l(W(a.initial)));if(JSON.stringify(l(d)).length>U)throw Error(`GUI plugin store exceeds 2 MiB`);let f=d,p=this.backend.getItem(o);if(p!==null&&p.length<=U)try{f=c(JSON.parse(p))}catch{f=d}let[m,h]=u(f),g=e=>{r();let t=JSON.stringify(l(W(e)));if(t.length>U)throw Error(`GUI plugin store exceeds 2 MiB`);let n=c(JSON.parse(t));this.backend.setItem(o,t),h(()=>n)},_={get value(){return m()},ready:()=>!0,set:g,update:e=>{let t=W(m());if(e(t)!==void 0)throw Error(`Store update must not return a replacement`);g(t)}},v=()=>h(()=>W(d)),y=this.resets.get(o)??new Set;return y.add(v),this.resets.set(o,y),t.addEventListener(`abort`,()=>{y.delete(v),y.size||this.resets.delete(o),i.clear()},{once:!0}),i.set(o,_),_},memory:(e,t)=>{r();let i=n(e),a=this.memory.get(i);if(a)return[a[0],e=>{r(),a[1](e)}];if(this.memory.size>=H)throw Error(`GUI plugin memory store limit exceeded`);if(JSON.stringify(t.initial).length>U)throw Error(`GUI plugin memory exceeds 2 MiB`);let[o,s]=f(W(t.initial)),c=[o,e=>{r();let t=W(m(o));if(e(t)!==void 0)throw Error(`Memory update must not return a replacement`);if(JSON.stringify(t).length>U)throw Error(`GUI plugin memory exceeds 2 MiB`);s(_(t))}];return this.memory.set(i,[o,e=>{let t=W(m(o));if(e(t)!==void 0)throw Error(`Memory update must not return a replacement`);if(JSON.stringify(t).length>U)throw Error(`GUI plugin memory exceeds 2 MiB`);s(_(t))}]),c},remove:(e,t)=>{r(t?.from);let i=n(e,t?.scope);this.backend.removeItem(i);for(let e of this.resets.get(i)??[])e()}}}dispose(){this.memory.clear(),this.resets.clear()}};function Me(e){if(typeof e!=`string`||e.length>2097152)return;let t=e.trim();if(t)try{if(t.startsWith(`<`))return D(t);if(!/^data:/i.test(t))return t;let e=/^data:image\/(svg\+xml|png|jpeg|gif|webp|avif|x-icon|vnd\.microsoft\.icon)(?:;charset=utf-8)?(;base64)?,([\s\S]+)$/i.exec(t);if(!e)return;let[,n,r,i]=e;if(r&&!/^[A-Za-z0-9+/]+={0,2}$/.test(i))return;if(n.toLowerCase()===`svg+xml`){let e=r?new TextDecoder(`utf-8`,{fatal:!0}).decode(Uint8Array.from(atob(i),e=>e.charCodeAt(0))):decodeURIComponent(i);return D(e)}return!r||!atob(i).length?void 0:`data:image/${n.toLowerCase()};base64,${i}`}catch{return}}var G=e=>e===`yuri.exportPDF`||e===`yuri.exportLongImage`,Ne=class{api;probe;clients=new Map;ended=!1;constructor(e){this.api=e}use(e,t){let n=this.clients.get(t),r=n?.get(e);if(r)return r.live;let[i,a]=u(this.api&&!t.aborted&&!this.ended?{status:`pending`}:{status:`inactive`,reason:`disabled`}),o=()=>{a({status:`inactive`,reason:`disabled`}),t.removeEventListener(`abort`,o),this.clients.delete(t)},s={live:A(i),stop:o};if(this.ended||t.aborted||(n||(n=new Map,this.clients.set(t,n)),n.set(e,s),t.addEventListener(`abort`,o,{once:!0}),!this.api))return s.live;let c=this.api;return this.probe??=Promise.resolve().then(()=>c.capabilities()),this.probe.then(n=>{if(this.ended||t.aborted)return;let r=e===`yuri.exportPDF`?`exportPDF`:`exportLongImage`;if(n.version!==1||!n[r]){a({status:`inactive`,reason:`disabled`});return}let o=async(e,n={})=>{if(this.ended||t.aborted||i().status!==`active`)return{status:`cancelled`};let o=AbortSignal.any([t,...n.signal?[n.signal]:[]]);try{return await c[r](e,{...n,signal:o})}catch(e){throw e&&typeof e==`object`&&`code`in e&&e.code===`EXPORT_UNSUPPORTED`&&a({status:`inactive`,reason:`failed`}),e}},s=Object.freeze(e===`yuri.exportPDF`?{version:1,limits:n.limits,exportPDF:o}:{version:1,limits:n.limits,exportLongImage:o});a({status:`active`,generation:1,value:s})}).catch(()=>{!this.ended&&!t.aborted&&a({status:`inactive`,reason:`failed`})}),s.live}dispose(){this.ended=!0;for(let e of this.clients.values())for(let t of e.values())t.stop();this.clients.clear()}};function Pe(e,t){let n=new Map,r=Object.freeze({dismiss(){}});return e.addEventListener(`abort`,()=>{for(let e of[...n.values()])e.handle.dismiss()},{once:!0}),Object.freeze({show(i){if(e.aborted)return r;if(!t)throw new E(`GUI_PLUGIN_UNSUPPORTED`,`GUI toast is unavailable`);if(!i||typeof i!=`object`)throw new E(`GUI_PLUGIN_INVALID_INPUT`,`Expected toast options`);let{title:a,description:o,variant:s=`default`,duration:c=5e3,persistent:l=!1,icon:u,actions:d}=i;if(typeof a!=`string`||o!==void 0&&typeof o!=`string`||![`default`,`success`,`error`,`loading`].includes(s)||typeof l!=`boolean`||typeof c!=`number`||!Number.isFinite(c)||c<0)throw new E(`GUI_PLUGIN_INVALID_INPUT`,`Invalid toast options`);if(u!==void 0||d!==void 0)throw new E(`GUI_PLUGIN_UNSUPPORTED`,`GUI toast icon/actions are unsupported`);if(e.aborted)return r;let f=JSON.stringify([a,o??null,s,c,l]),p=n.get(f),m=()=>{let e=n.get(f);!e||e.id!==h||(clearTimeout(e.timer),n.delete(f))},h=(s==="default"?t:t[s])(a,{id:p?.id,description:o,duration:l?1/0:c,onDismiss:m,onAutoClose:m}),g=p?.handle??Object.freeze({dismiss(){m(),t.dismiss(h)}});clearTimeout(p?.timer);let _=s===`loading`&&!l?setTimeout(()=>g.dismiss(),c):void 0;return n.set(f,{id:h,handle:g,timer:_}),g}})}var Fe=T(`YuriMedia`);async function Ie(e){let n=/\.html?$/i.test(e.name)?`text/html`:`text/plain`,r=new Blob([e.content],{type:n});if(t()){if(!re.isPluginAvailable(`YuriMedia`))throw new E(`GUI_PLUGIN_UNSUPPORTED`,`Native file saving is unavailable`);if(r.size>33554432)throw new E(`GUI_PLUGIN_INVALID_INPUT`,`File exceeds maximum size`);let t=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>{if(typeof n.result!=`string`){t(Error(`Failed to encode file`));return}e(n.result.slice(n.result.indexOf(`,`)+1))},n.onerror=()=>t(n.error??Error(`Failed to encode file`)),n.readAsDataURL(r)});return!(await Fe.saveFile({dataBase64:t,mimeType:n,filename:e.name})).cancelled}let i=URL.createObjectURL(r),a=document.createElement(`a`);try{return a.href=i,a.download=e.name,document.body.append(a),a.click(),!0}finally{a.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}}var K=p();function Le(e){return{version:1,register(t){let n=a(K);if(!n||n.plugin!==e||n.signal.aborted||e.aborted)throw Error(`Preview actions require the owning mounted panel`);let r=new AbortController,i=AbortSignal.any([e,n.signal,r.signal]),o,s=()=>{i.removeEventListener(`abort`,s),r.abort(),o?.remove()};h(s),i.addEventListener(`abort`,s,{once:!0});try{o=t.render({element:t.element,signal:i,async snapshot(e={}){let r=AbortSignal.any([i,...e.signal?[e.signal]:[]]);if(r.throwIfAborted(),!n.content.contains(t.element)||n.target.contains(t.element))throw Error(`Preview capture region is no longer in its owning panel`);let a=await t.capture({...e,signal:r});if(r.throwIfAborted(),!n.content.contains(t.element))throw Error(`Preview capture region was replaced`);return a}}),i.throwIfAborted(),n.target.append(o)}catch(e){throw s(),e}return s}}}var Re=`yuri.work-status`;function q(e,t){return e===t||!!(e&&t&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>e[n]===t[n]))}var J=e=>e&&Object.freeze({...e});function Y(e,t,n){let r=new AbortController,[i,a]=u(!0),[o,s]=u(J(e.project),{equals:q}),[c,l]=u(J(e.worktree),{equals:q}),[f,p]=u(Object.freeze({...e.git}),{equals:q}),[m,h]=u(e.placement);return{props:Object.freeze({session:t,directory:e.directory,runtimeId:n,signal:r.signal,get active(){return i()},get project(){return o()},get worktree(){return c()},get git(){return f()},get placement(){return m()}}),matches:t=>t.sessionId===e.sessionId&&t.directory===e.directory&&t.scope===e.scope,update(e){r.signal.aborted||d(()=>{s(J(e.project)),l(J(e.worktree)),p(Object.freeze({...e.git})),h(e.placement)})},dispose(){r.signal.aborted||(a(!1),r.abort())}}}var ze=class{plugins=new Map;order=new Map;snapshot=Object.freeze([]);generation=0;listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;setOrder(e){e.length===this.order.size&&e.every((e,t)=>this.order.get(e)===t)||(this.order=new Map(e.map((e,t)=>[e,t])),this.publish())}replace(e,t,n){let r=this.plugins.get(e)??[],i=new Set,a=n.map(n=>{if(!n||typeof n!=`object`||!(`id`in n)||typeof n.id!=`string`||!n.id.trim()||n.id.length>128||i.has(n.id)||!(`render`in n)||typeof n.render!=`function`||`order`in n&&n.order!==void 0&&(typeof n.order!=`number`||!Number.isFinite(n.order)))throw Error(`Invalid or duplicate yuri.work-status contribution`);i.add(n.id);let a=JSON.stringify([e,n.id]),o=`order`in n&&typeof n.order==`number`?n.order:0,s=n.render,c=r.find(e=>e.key===a),l=c&&c.revision===t&&c.render===s?c.generation:++this.generation;return c&&c.revision===t&&c.render===s&&c.order===o?c:Object.freeze({key:a,pluginId:e,revision:t,generation:l,order:o,render:s})});a.length?this.plugins.set(e,a):this.plugins.delete(e),this.publish()}contains(e){return this.plugins.get(e.pluginId)?.some(t=>t.key===e.key&&t.generation===e.generation)??!1}remove(e){this.plugins.delete(e)&&this.publish()}dispose(){this.plugins.clear(),this.publish(),this.listeners.clear()}publish(){let e=[...this.plugins.values()].flat().sort((e,t)=>e.order-t.order||(this.order.get(e.pluginId)??2**53-1)-(this.order.get(t.pluginId)??2**53-1));if(!(e.length===this.snapshot.length&&e.every((e,t)=>e===this.snapshot[t]))){this.snapshot=Object.freeze(e);for(let e of this.listeners)i(e)}}},X=e=>{throw new E(`GUI_PLUGIN_UNSUPPORTED`,`Unsupported GUI host API: ${e}`)};function Z(e,t){return new Proxy(t,{get:(t,n)=>n in t?Reflect.get(t,n):X(`${e}.${String(n)}`)})}var Q=e=>Object.freeze(e.map(e=>Object.freeze(e)));function Be(e,t){if(!e.fields||!t.fields)return!1;let n=Reflect.ownKeys(e.fields);return n.length===Reflect.ownKeys(t.fields).length&&n.every(n=>{let r=e.fields[n],i=t.fields[n];return i!==void 0&&`value`in r&&`value`in i&&Object.is(r.value,i.value)&&r.enumerable===i.enumerable&&r.configurable===i.configurable&&r.writable===i.writable})}function $(e,t){if(e){for(let n of e.owned??[])$(n,t);e.cleanups&&=e.cleanups.map(e=>()=>{try{Promise.resolve(e()).catch(t)}catch(e){t(e)}})}}var Ve=class{options;fileIcons=new de;appearanceCatalog=new le;workStatus=new ze;instances=new Map;listeners=new Set;panelMounts=new Set;fileViews=new Map;changes=u(0);views=u(0);session=u();currentPage=u();mobilePageNetworkReady=u(!1);appearance;layouts=new Map;files;storage;ended=!1;contracts=new Map;snapshot=Object.freeze({plugins:Object.freeze([]),commands:Object.freeze([]),titlebarItems:Object.freeze([]),panels:Object.freeze([]),pages:Object.freeze([]),settings:Object.freeze([]),menuItems:Object.freeze([]),activePanel:null});#e;viewExports;constructor(e){this.options=e,this.viewExports=new Ne(e.viewExport),this.appearance=u({locale:e.locale,mode:e.mode,narrow:e.narrow}),this.storage=new je(e.storage,e.transport);let t=()=>(this.session[0](),this.files?.api??X(`screen.file without a session`));this.#e=Z(`screen`,{get file(){return t()}})}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.snapshot;changed(e=!1){let t=this.snapshot;this.changes[1](e=>e+1),e&&t===this.snapshot&&this.publish()}setSession(e){if(this.ended)return;let t=this.session[0]();if(t?.id===e?.id&&t?.directory===e?.directory)return;if(!e)for(let e of[...this.panelMounts])e();this.files?.dispose(),this.files=e?new Ae(this.options.files,this.options.queryClient,this.options.transport,e.directory):void 0;let n=e?this.sessionReference(e):void 0,r=this.snapshot;this.session[1](n),r===this.snapshot&&this.publish()}sessionReference(e,t){let n=t?JSON.stringify(t.queryScope):this.options.transport,r=Z(`session.server`,{id:n,name:t?.location.hostId??this.options.transport,...t?{}:{client:this.options.client}});return Object.freeze(Z(`session`,{id:e.id,directory:e.directory,key:t?JSON.stringify([n,e.id]):`${this.options.transport}\n${e.id}`,tab:e.id,server:r,pending:!1,visit:{},location:t?Object.freeze({...t.location}):{directory:e.directory}}))}setAppearance(e){if(this.ended)return;let t=this.appearance[0]();(t.locale!==e.locale||t.mode!==e.mode||t.narrow!==e.narrow)&&this.appearance[1]({...e})}setPage(e){this.ended||this.currentPage[1](e)}setMobilePageNetworkReady(e){this.mobilePageNetworkReady[1](!this.ended&&e)}install(e,t,r){if(this.options.mobileNetworkRequired&&!this.mobilePageNetworkReady[0]()&&!this.ended)throw new E(`GUI_PLUGIN_UNAVAILABLE`,`Mobile plugin Relay is not ready`);let a=this.instances.get(e);if(this.ended||a?.status===`active`&&a.revision===t.revision&&a.native?.active!==!1){r?.dispose();return}a&&(this.instances.delete(e),this.release(a));let c={id:e,native:r,revision:t.revision,controller:new AbortController,status:`active`,cleanups:new Set,contributions:new Set,iconChanges:u(0),appearanceChanges:u(0),workStatusChanges:u(0),commands:[],titlebarItems:[],panels:[],pages:[],settings:[],menus:[]};this.instances.set(e,c);try{if(e===`yuri`||e.startsWith(`yuri.`))throw Error(`The yuri namespace is reserved to the host`);let a=ke(t.code,r?.activation.os);x(e=>{c.dispose=e,c.root=s(),b(()=>S(j.Provider,{value:c.context=this.context(c,a,t.options),get children(){c.owner=s();let e=i(()=>a.setup?.(c.context));if(typeof e==`function`)c.cleanups.add(()=>{Promise.resolve(e()).catch(e=>{c.error=String(e)})});else if(e!==void 0)throw e&&typeof e==`object`&&`then`in e&&Promise.resolve(e).catch(()=>{}),Error(`GUI setup must be synchronous and return only cleanup`);return null}}),e=>this.fail(c,e)),c.controller.signal.aborted||o(c.owner,()=>n(()=>{if(c.iconChanges[0](),!c.controller.signal.aborted)try{let e=[...c.contributions].filter(e=>e.registry===ce).map(e=>e.read()).filter(e=>e!==void 0);this.fileIcons.replace(c.id,e),c.iconError!==void 0&&i(()=>{c.iconError=void 0,this.publish()})}catch(e){i(()=>{this.fileIcons.remove(c.id),c.iconError=e instanceof Error?e.message:String(e),this.publish()})}})),c.controller.signal.aborted||o(c.owner,()=>n(()=>{if(c.appearanceChanges[0](),!c.controller.signal.aborted)try{let e=e=>[...c.contributions].filter(t=>t.registry===e).map(e=>e.read()).filter(e=>e!==void 0);this.appearanceCatalog.replace(c.id,e(fe),e(ue),c.native?.activation.capabilities?.dockIcon===!0)}catch(e){i(()=>this.fail(c,e))}})),c.controller.signal.aborted||o(c.owner,()=>n(()=>{if(c.workStatusChanges[0](),!c.controller.signal.aborted)try{let e=[...c.contributions].filter(e=>e.registry===Re).map(e=>e.read()).filter(e=>e!==void 0);this.workStatus.replace(c.id,c.revision,e)}catch(e){i(()=>this.fail(c,e))}})),c.controller.signal.aborted||o(c.owner,()=>n(()=>{this.changes[0](),this.session[0](),this.appearance[0]();try{this.derive(c)}catch(e){i(()=>this.fail(c,e))}i(()=>this.publish())}))})}catch(e){this.fail(c,e)}this.changed(!0)}release(e){e.controller.abort(),e.native?.dispose();for(let t of[...e.cleanups])try{t()}catch(t){e.error??=String(t)}e.cleanups.clear(),$(e.root,t=>{e.error??=String(t)});try{e.dispose?.()}catch(t){e.error??=String(t)}e.contributions.clear(),e.commands=[],e.titlebarItems=[],e.panels=[],e.pages=[],e.settings=[],e.menus=[],this.fileIcons.remove(e.id),this.appearanceCatalog.remove(e.id),this.workStatus.remove(e.id);for(let t of this.contracts.values())t.provider===e&&(t.provider=void 0,t.live[1]({status:`inactive`,reason:e.status===`failed`?`failed`:`disabled`}))}fail(e,t){e.status!==`failed`&&this.instances.get(e.id)===e&&(e.status=`failed`,e.error=t instanceof Error?t.message:String(t),t instanceof E&&(e.errorCode=t.code),this.release(e),this.publish())}uninstall(e){let t=this.instances.get(e);if(t){this.instances.delete(e),this.release(t);for(let t of this.layouts.values())t.open=t.open.filter(t=>!t.startsWith(`${e}:`)),t.active?.startsWith(`${e}:`)&&(t.active=null);this.changed(!0)}}dispose(){this.ended||(this.ended=!0,d(()=>{for(let e of[...this.instances.keys()])this.uninstall(e)}),this.viewExports.dispose(),this.files?.dispose(),this.fileIcons.dispose(),this.appearanceCatalog.dispose(),this.workStatus.dispose(),this.storage.dispose(),this.layouts.clear(),this.fileViews.clear(),this.contracts.clear(),this.listeners.clear())}async setDockIcon(e,t){let n=this.instances.get(e),r=n?.native;if(!r?.active||!r.activation.capabilities?.dockIcon)return X(`Dock icon`);try{await r.setDockIcon(t)}catch(e){throw t!==null&&n&&this.fail(n,e),e}}own(e,t){let n=!0,r=()=>{n&&(n=!1,e.cleanups.delete(r),t())};return e.controller.signal.aborted||a(F)?.ended?(r(),r):(e.cleanups.add(r),s()&&h(r),r)}list(e){this.changes[0]();let t=[];for(let n of this.instances.values())if(n.status===`active`){for(let r of n.contributions)if(r.registry===e.id){let e=r.read();e!==void 0&&t.push(e)}}return t}context(e,t,r){let o=this.storage.forPlugin(e.id,e.controller.signal),c=Object.fromEntries(Object.entries(t.stores??{}).map(([e,t])=>[e,t.scope===`global`?o.store(e,{...t,scope:`global`}):n=>o.store(e,{...t,scope:{session:n}})])),u=(e,n)=>{let r=this.appearance[0]().locale;return(t.i18n?.[r]?.[e]??t.i18n?.[r.split(`-`)[0]]?.[e]??t.i18n?.en?.[e]??e).replace(/\{\{(\w+)\}\}/g,(e,t)=>String(n?.[t]??e))},d=Z(`layout`,{narrow:()=>this.appearance[0]().narrow,ready:()=>!!this.session[0](),open:(t,n,r)=>{e.controller.signal.aborted||this.openPanel(t,n,r)},close:(t,n)=>{e.controller.signal.aborted||this.closeFor(t,n)},toggle:(e,t)=>d.state(e,t)===`visible`?d.close(e,t):d.open(e,t),hide:(t,n)=>{if(e.controller.signal.aborted)return;let r=this.layout(n);r.active===t&&r.shown&&(r.shown=!1,this.changed())},state:(e,t)=>{this.changes[0]();let n=this.layout(t);return n.active===e?n.shown?`visible`:`active`:n.open.includes(e)?`open`:`closed`},stored:t=>(this.changes[0](),this.layout(t).open.filter(t=>t.startsWith(`${e.id}:`)).map(t=>t.slice(e.id.length+1))),side:{opened:e=>(this.changes[0](),this.layout(e).shown),toggle:t=>{if(e.controller.signal.aborted)return;let n=this.layout(t);n.shown=!n.shown,this.changed()},menu:()=>this.list(N).filter(e=>e.menu===`session.panel`).sort((e,t)=>(e.order??0)-(t.order??0))},scroll:{get:(e,t)=>(this.changes[0](),this.layout(e).scroll.get(t)),set:(t,n,r)=>{if(e.controller.signal.aborted)return;let i=this.layout(t).scroll;if(!i.has(n)&&i.size>=128)throw Error(`GUI layout scroll limit exceeded`);i.set(n,{...r}),this.changed()}}}),f=Le(e.controller.signal),p=A(()=>e.controller.signal.aborted?{status:`inactive`,reason:`disabled`}:{status:`active`,generation:1,value:f}),m={open:t=>e.controller.signal.aborted||this.appearance[0]().narrow&&!this.mobilePageNetworkReady[0]()||!e.pages.some(e=>e.id===t)?!1:this.options.openPage?.(O(e.id,t))??!1,current:()=>{let t=this.currentPage[0]();return e.pages.find(n=>O(e.id,n.id)===t)?.id}},g=A(()=>e.controller.signal.aborted||!this.options.openPage||this.appearance[0]().narrow&&!this.mobilePageNetworkReady[0]()?{status:`inactive`,reason:`disabled`}:{status:`active`,generation:1,value:m});return Z(`ctx`,{id:e.id,options:r,signal:e.controller.signal,client:this.options.client,storage:o,stores:c,toast:Pe(e.controller.signal,this.options.toast),app:{name:`yuri`,version:e.native?.activation.app.version??``,channel:e.native?.activation.app.packaged?`prod`:`local`,platform:e.native?`desktop`:`web`,packaged:e.native?.activation.app.packaged??!1},desktop:e.native?Z(`desktop`,{os:e.native.activation.os}):void 0,t:u,plural:(e,t,n)=>{let r=`${e}.${new Intl.PluralRules(this.appearance[0]().locale).select(t)}`;return u(r,{...n,count:t})===r?u(`${e}.other`,{...n,count:t}):u(r,{...n,count:t})},add:(t,r)=>{if(e.controller.signal.aborted||a(F)?.ended)return()=>{};if([`server`,`composer-pill`,`slot`,`file.viewer`,`menubar-item`].includes(t.id)&&X(`registry.${t.id}`),e.contributions.size>=256)throw Error(`GUI contribution limit exceeded`);let o=()=>{},c,u=x(i=>{o=i,c=s();let a=()=>typeof r==`function`?r():r,u;if(t.id===`yuri.file-icon`){let e=l(()=>{try{return{ok:!0,value:a()}}catch(e){return{ok:!1,error:e}}});u=()=>{let t=e();if(!t.ok)throw t.error;return t.value}}else u=l(a);if(t.id===`style`){let t=document.createElement(`style`);t.dataset.yuriPluginStyle=e.id,document.head.append(t),h(()=>t.remove()),n(()=>{let e=u();t.textContent=e===void 0?``:String(e)})}return{registry:t.id,read:u}},s()??e.owner);e.contributions.add(u);let d=()=>{t.id===`yuri.file-icon`&&e.iconChanges[1](e=>e+1)},f=()=>{(t.id===`yuri.theme`||t.id===`yuri.branding`)&&e.appearanceChanges[1](e=>e+1)},p=()=>{t.id===`yuri.work-status`&&e.workStatusChanges[1](e=>e+1)};return i(d),i(f),i(p),i(()=>this.changed()),this.own(e,()=>{$(c,t=>{e.error??=String(t)}),o(),e.contributions.delete(u),i(d),i(f),i(p),i(()=>this.changed())})},list:e=>this.list(e),provide:(t,n)=>{if(e.controller.signal.aborted||a(F)?.ended)return()=>{};if(G(t.id)||t.id===`yuri.previewActions`||t.id===`yuri.pages`)throw Error(`Preview/export/page contracts are provided only by the Yuri host`);if(t.kind!==`contract`||!(t.id===e.id||t.id.startsWith(`${e.id}.`)))throw Error(`Contract must belong to the providing plugin`);let r=this.contract(t.id);if(r.provider)throw Error(`Contract already provided: ${t.id}`);return r.provider=e,r.live[1]({status:`active`,value:n,generation:++r.generation}),this.own(e,()=>{r.provider===e&&(r.provider=void 0,r.live[1]({status:`inactive`,reason:e.status===`failed`?`failed`:`disabled`}))})},use:t=>t.id===`yuri.pages`?t.kind===`contract`?g:X(`pages token must be a Contract`):t.id===`yuri.previewActions`?t.kind===`contract`?p:X(`preview actions token must be a Contract`):G(t.id)?t.kind===`contract`?this.viewExports.use(t.id,e.controller.signal):X(`export token must be a Contract`):t.kind===`ipc`&&e.native?e.native.token(t).live:this.contract(t.id,t.kind===`ipc`).live[0],main:t=>{if(!(t.id===e.id||t.id.startsWith(`${e.id}.`)))throw new E(`GUI_PLUGIN_FORBIDDEN`,`IPC must belong to the plugin`);return e.native?e.native.token(t).value:new Proxy({state:()=>void 0},{get:(e,t)=>t===`state`?e.state:t===`on`?()=>{throw new E(`GUI_PLUGIN_UNSUPPORTED`)}:()=>Promise.reject(new E(`GUI_PLUGIN_UNSUPPORTED`))})},sessions:{current:this.session[0],list:()=>{let e=this.session[0]();return e?[e]:[]}},screen:{current:()=>this.session[0]()?this.#e:void 0},layout:d,appearance:{mode:()=>this.appearance[0]().mode,font:()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||`monospace`},locale:{locale:()=>this.appearance[0]().locale,direction:()=>/^(ar|fa|he|ur)(-|$)/i.test(this.appearance[0]().locale)?`rtl`:`ltr`},system:{copy:e=>navigator.clipboard.writeText(e),openExternal:e=>{let t=new URL(e);[`https:`,`http:`,`mailto:`].includes(t.protocol)||X(`system.openExternal protocol`),window.open(e,`_blank`,`noopener,noreferrer`)},save:Ie},commands:{run:t=>e.controller.signal.aborted||!this.command(t)?!1:(this.runCommand(t),!0)},links:{open:t=>!e.controller.signal.aborted&&this.navigateLink(e,t),exists:t=>i(()=>{if(e.controller.signal.aborted)return!1;let n=this.linkHandler(t);try{return Promise.resolve(n?.value.exists?.(t)??!1).catch(()=>!1)}catch{return!1}})}})}contract(e,t=!1){let n=this.contracts.get(e);if(!n){if(this.contracts.size>=256)throw Error(`GUI contract limit exceeded`);let t=u({status:`inactive`,reason:`disabled`});n={live:[A(t[0]),t[1]],generation:0},this.contracts.set(e,n)}return t&&n.provider&&X(`IPC contract collision`),n}derive(e){if(e.status!==`active`)return;let t=[],n=[],r=[],a=[],o=[],s=[],c=this.session[0]();for(let i of e.contributions){if([`yuri.file-icon`,`yuri.theme`,`yuri.branding`,`yuri.work-status`].includes(i.registry))continue;let l=i.read();if(l!==void 0){if(i.registry===`yuri.page`){let e=he(l);if(s.some(t=>t.id===e.id))throw Error(`Duplicate yuri.page id`);s.push(e)}else if(i.registry===we.id){let n=l;n.enabled!==!1&&t.push({key:`${e.id}.${n.id}`,pluginId:e.id,title:n.title,description:n.description,bind:n.bind,hidden:n.hidden,run:()=>this.invoke(e,()=>n.run())})}else if(i.registry===k.id){let t=l;o.push({key:JSON.stringify([e.id,t.id]),pluginId:e.id,label:t.label,title:t.title,icon:Me(t.icon),busy:t.busy,pressed:t.pressed,actionable:!!t.run,run:t.run})}else if(i.registry===Ee.id&&c){let t=l,r=`${e.id}:`,i=this.layout(c).open.filter(e=>e.startsWith(r)).map(e=>e.slice(r.length));for(let r of t.list({session:c,screen:this.#e,open:i}))n.push({plugin:e,panel:t,tab:r})}else if(i.registry===be.id){let e=l;(e.page||e.section)&&X(`SettingsPage host sections`),e.title,r.push(e)}else if(i.registry===N.id){let e=l;e.menu===`session.panel`?(e.title,a.push(e)):X(`MenuItem.${e.menu}`)}}}for(let e of n)e.tab.title;e.commands=t,e.titlebarItems=o,e.panels=n,e.pages=s,e.settings=r,e.menus=a,i(()=>this.views[1](e=>e+1))}publish(){let e=i(this.session[0]),t=e?this.layouts.get(e.key):void 0,n=[...this.instances.values()],r=n.filter(e=>e.status===`active`),a=r.flatMap(e=>e.panels.map(({tab:n})=>{let r=n.file?this.filePath(n.file):void 0;return{key:`${e.id}:${n.id}`,pluginId:e.id,title:n.title,file:r,inline:!!(r&&this.fileViews.has(r)),active:t?.shown===!0&&t.active===`${e.id}:${n.id}`}}));this.snapshot=Object.freeze({plugins:Q(n.map(({id:e,revision:t,status:n,error:r,errorCode:i,iconError:a})=>({id:e,revision:t,status:n,error:r??a,...i?{errorCode:i}:{}}))),commands:Q(r.flatMap(e=>e.commands.filter(e=>!e.hidden))),panels:Q(a),titlebarItems:Q(r.flatMap(e=>e.titlebarItems.map(({run:e,...t})=>t))),pages:Q(r.flatMap(e=>e.pages.map(t=>({key:O(e.id,t.id),pluginId:e.id,title:t.title,icon:t.icon})))),settings:Q(r.flatMap(e=>e.settings.map(t=>({key:`${e.id}:${t.id}`,pluginId:e.id,title:t.title})))),menuItems:Q(r.flatMap(e=>e.menus.map(t=>({key:`${e.id}:${t.id}`,pluginId:e.id,title:t.title,description:t.description,run:()=>{this.invoke(e,()=>t.run())}})))),activePanel:t?.shown&&a.some(e=>e.key===t.active)?t.active:null,sessionKey:e?.key});for(let e of this.listeners)e()}invoke(e,t){if(!e.controller.signal.aborted)try{let n=o(e.owner??null,t);if(n instanceof Promise)return n.catch(t=>this.fail(e,t))}catch(t){this.fail(e,t)}}command(e){return[...this.instances.values()].flatMap(e=>e.commands).find(t=>t.key===e)}runCommand(e){return this.command(e)?.run()}runTitlebarItem(e){for(let t of this.instances.values()){let n=t.titlebarItems.find(t=>t.key===e);if(n?.run&&!n.busy)return this.invoke(t,n.run)}}linkHandler(e){let t=[];for(let e of this.instances.values())for(let n of e.contributions)if(n.registry===ye.id){let r=n.read();r&&t.push({instance:e,value:r})}for(let n of t.sort((e,t)=>(t.value.priority??0)-(e.value.priority??0)))try{if(n.value.match(e))return n}catch(e){this.fail(n.instance,e)}}navigateLink(e,t){if(this.ended)return!1;let n=me(t.href);if(!n||!pe(n.path))return this.openLink(t);let r=this.session[0]();if(!r||t.session&&(t.session.key!==r.key||t.session.server.id!==r.server.id))return!1;if(!this.options.focusFile)return this.openLink(t);let i=w(t.base??r.directory,n.path),a=n.line===void 0?``:`:${n.line}${n.column===void 0?``:`:${n.column}`}`;return this.invoke(e,()=>this.options.focusFile(i+a,r.directory)),!0}openLink(e){if(this.ended)return!1;let t={...e,session:e.session??this.session[0]()},n=this.linkHandler(t);return n?(this.invoke(n.instance,()=>n.value.open(t)),!0):!1}filePath(e,t=this.session[0]()?.directory){let n=L(e);return/^(?:\/|[a-z]:\/)/i.test(n)||!t?n:L(`${t}/${n}`)}registerFileView(e,t){if(this.ended)return()=>{};let n=this.filePath(e,t),r=this.fileViews.get(n)??0;this.fileViews.set(n,r+1),r===0&&this.changed(!0);let i=!1;return()=>{if(i||this.ended)return;i=!0;let e=(this.fileViews.get(n)??1)-1;if(e){this.fileViews.set(n,e);return}{let e=this.session[0](),t=e&&this.layouts.get(e.key);t?.active&&this.snapshot.panels.some(e=>e.key===t.active&&e.file===n)&&(t.shown=!1),this.fileViews.delete(n)}this.changed(!0)}}filePanel(e,t){let n=this.filePath(e,t);return this.snapshot.panels.find(e=>e.file===n&&e.inline)}panelVisible(e){let t=this.session[0]();if(!t)return!1;let n=this.panel(e)?.tab.file;if(n&&this.fileViews.has(this.filePath(n)))return!0;let r=this.layouts.get(t.key);return!!(r?.shown&&r.active===e)}layout(e){let t=this.layouts.get(e.key);if(!t){if(this.layouts.size>=128)throw Error(`GUI session layout limit exceeded`);t={open:[],active:null,shown:!1,scroll:new Map},this.layouts.set(e.key,t)}return t}openPanel(e,t,n){if(this.ended)return;let r=this.layout(t),i=r.active,a=r.shown,o=r.open.length;if(!r.open.includes(e)){if(r.open.length>=64)throw Error(`GUI panel tab limit exceeded`);r.open=[...r.open,e]}n?.tab!==`append`&&(r.active=e,r.shown=!(this.appearance[0]().narrow&&n?.background)),(i!==r.active||a!==r.shown||o!==r.open.length)&&this.changed(!0);let s=this.panel(e);t.key===this.session[0]()?.key&&s&&n?.tab!==`append`&&this.invoke(s.plugin,()=>s.panel.focus?.({...this.props(e),restored:!1}))}selectPanel(e){let t=this.session[0]();t&&this.openPanel(e,t)}closeFor(e,t){let n=this.layout(t),r=t.key===this.session[0]()?.key?this.panel(e):void 0;if(!n.open.includes(e)||r?.tab.pinned||r?.tab.closable===!1)return;let i=this.session[0](),a=r&&i?{tab:r.tab,session:i,screen:this.#e}:void 0;n.open=n.open.filter(t=>t!==e),n.active===e&&(n.active=n.open.at(-1)??null),this.changed(!0),r&&a&&this.invoke(r.plugin,()=>r.panel.close?.(a))}closePanel(e){let t=this.session[0]();t&&this.closeFor(e,t)}hidePanel(){let e=this.session[0]();if(!e)return;let t=this.layout(e);t.shown&&(t.shown=!1,this.changed(!0))}panel(e){return[...this.instances.values()].flatMap(e=>e.panels).find(t=>`${t.plugin.id}:${t.tab.id}`===e)}props(e,t=!1){let n=this.panel(e)?.tab,r=()=>(this.views[0](),this.panel(e)?.tab??n??X(`panel no longer listed`)),i=t?l(()=>{let e=r();return{tab:e,fields:Object.getPrototypeOf(e)===Object.prototype?Object.getOwnPropertyDescriptors(e):void 0}},void 0,{equals:Be}):void 0,a=i?()=>i().tab:r,o=()=>this.session[0]()??X(`panel without session`);return{get tab(){return a()},get session(){return o()},screen:this.#e}}mountPanel(e,t,r){let a=this.panel(e);if(!a)return()=>{};let o=new AbortController,s=()=>{let s=l(()=>{this.session[0](),this.changes[0](),this.views[0]();let t=this.panel(e)?.tab.file;return t&&this.files&&this.panelVisible(e)?{model:this.files,file:t}:void 0},void 0,{equals:(e,t)=>e?.model===t?.model&&e?.file===t?.file});n(()=>{let e=s();e&&(h(e.model.watch(e.file)),e.model.sync(e.file).catch(()=>{}))});let c=()=>i(()=>a.panel.render(this.props(e,!0)));return S(K.Provider,{value:r?{plugin:a.plugin.controller.signal,signal:o.signal,content:t,target:r}:void 0,get children(){return c()}})},c=this.mount(a.plugin,t,()=>S(xe.Provider,{value:{visible:()=>(this.changes[0](),this.panelVisible(e)),present:()=>(this.changes[0](),this.panelVisible(e)),placement:()=>this.appearance[0]().narrow?`mobile`:`side`,reserve:()=>!1,animate:()=>!1,sidebar:Z(`panel.sidebar`,{}),open:()=>{let e=this.session[0]();return e?a.plugin.context.layout.stored(e):[]}},get children(){return s()}})),u=()=>{this.panelMounts.delete(u),o.abort(),c()};return this.panelMounts.add(u),this.own(a.plugin,u)}mountSettings(e,t){for(let n of this.instances.values()){let r=n.settings.find(t=>`${n.id}:${t.id}`===e);if(r)return this.mount(n,t,()=>r.render({}))}return()=>{}}mountPage(e,t){if(this.appearance[0]().narrow&&!this.mobilePageNetworkReady[0]())throw new E(`GUI_PLUGIN_UNAVAILABLE`,`Mobile page Relay is not ready`);for(let n of this.instances.values()){let r=n.pages.find(t=>O(n.id,t.id)===e);if(r)return this.mount(n,t,()=>r.render())}return()=>{}}mountWorkStatus(e,t,n){let r=this.instances.get(e.pluginId);if(!r||!this.workStatus.contains(e)||this.ended)return{update(){},dispose(){}};let i=Y(n,n.sessionId&&n.directory?this.sessionReference({id:n.sessionId,directory:n.directory},n.scope):void 0,n.scope?JSON.stringify(n.scope.queryScope):this.options.transport),a=()=>{},o=()=>{},s=this.own(r,()=>{i.dispose(),o(),a()});return o=this.workStatus.subscribe(()=>{this.workStatus.contains(e)||s()}),a=this.mount(r,t,()=>e.render(i.props)),i.props.signal.aborted&&(o(),a()),{update:e=>{if(!i.matches(e)){s();return}i.update(e)},dispose:s}}mount(e,t,n){if(e.controller.signal.aborted)return()=>{};let r=()=>{},a,o=t=>{queueMicrotask(()=>this.fail(e,t))};try{r=_e(()=>S(j.Provider,{value:e.context,get children(){return a=s(),b(()=>i(n),o)}}),t)}catch(t){this.fail(e,t)}return this.own(e,()=>{$(a,t=>{e.error??=String(t)}),r(),t.replaceChildren()})}};export{Ve as GuiPluginHost};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-workbox-window-15MWHJyx.js","assets/rolldown-runtime-hePW80VL.js","assets/renderMobileApp-C5U2cyeq.js","assets/runtime-auth-DA-qfGHk.js","assets/runtime-switch-DEPKHgdL.js","assets/runtime-fetch-V-iMWR8t.js","assets/reasoning-projection-client-BEhVknv9.js","assets/platform-CiUKDeXd.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-zustand-CTekDqaS.js","assets/vendor-base-ui-wXsskyKm.js","assets/gitApiHttp-Bswf6gnl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/safeStorage-DTOhKN0V.js","assets/client-ITylDDCS.js","assets/vendor-opencode-client-BM2r1f0o.js","assets/vendor-effect-X1Hqc7ba.js","assets/prompt-attachment-upload-BGppTOgV.js","assets/runtime-file-resource-C5kmYlLv.js","assets/vendor-react-BkccXcWz.js","assets/vendor-tanstack-query-core-BSjXNgF_.js","assets/vendor-tanstack-react-query-DIb_ItL-.js","assets/path-utils-jGozTg9d.js","assets/vendor-reactuses-core-DjKFMfz7.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/runtime-file-store-BVRgEtI-.js","assets/useUIStore-C3ewjGgP.js","assets/useMobileHtmlPreviewStore-BYunNOBo.js","assets/uuid-D-SDZijH.js","assets/capgoAdapter-DQwUA-Nt.js","assets/types-BBBwzIOU.js","assets/vendor-sonner-DX3nfJx4.js","assets/ui-CHdferA1.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/remoteProjectQueries-BXrXdLjN.js","assets/i18n-Dojvs57M.js","assets/runtime-ead7P81A.js","assets/bootstrap-eLlfzqAI.js","assets/store-DRUKTpV5.js","assets/tour-CMXP3Kif.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/input-store-dLjM4aiu.js","assets/toolHelpers-iEHVHQ9p.js","assets/useAssistantUIStore-CpJZ4Rqs.js","assets/Icon-B-w2YKpn.js","assets/ScrollableOverlay-CkX-buJm.js","assets/OverlayScrollbar-DS6XJ1HA.js","assets/MobileResizableSheet-CF3Pbot4.js","assets/vendor-framer-motion-D5NyyC73.js","assets/MobileWindowStack-DGLdgoGr.js","assets/mobileAppContext-BQgdTp5T.js","assets/dialog-CmjXOKMz.js","assets/dialog-D9CkSNCA.css","assets/tooltip-Dw3DApa-.js","assets/device-EIfSfSWk.js","assets/dropdown-menu-BT_66BFT.js","assets/dropdown-menu.styles-BDla58Rm.js","assets/DiffWorkerProvider-VFPkag9y.js","assets/vendor-pierre-diffs-B0OmIhMO.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/useThemeSystem-BIXghnHj.js","assets/appThemeRegistry-BdjrGBQ4.js","assets/themes-BgDJcxRc.js","assets/useGitStore-Bbmai549.js","assets/mobileBackNavigation-DsDUTnFY.js","assets/agentColors-DWSbQXy2.js","assets/rasterizePng-056Poix7.js","assets/MobileHtmlNetworkBoundary-BKSYPR9N.js","assets/relay-preview-frame-src-BPyz3nXA.js","assets/input-BllFKOjo.js","assets/MarkdownRenderer-CsEylQVj.js","assets/useEffectiveDirectory-DZqC-2HE.js","assets/markdownHeightCache-RX04MAqu.js","assets/dualLimitLru-D8Sphgua.js","assets/useSessionBtwStore-CYaTDkvT.js","assets/nativeComposerCover-DzEGSyOO.js","assets/mobileConnections-PVy2SsQ_.js","assets/assistantQueries-DxvTFlpL.js","assets/MobileShareBridge-CRq9F1rn.js","assets/assistantPresentation-DRbsH1Ej.js","assets/AgentAvatar-CNOu_vy0.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-C4OfoX7R.js","assets/MobileDetailNavigation-DKWnQoSh.js","assets/useAppFontEffects-Dw6o6XbA.js","assets/desktopHosts-BsTrBVja.js","assets/desktopRelayRestore-BxbRKak_.js","assets/gitApi-CBfYFgtd.js","assets/shortcuts-Cu4ioDvH.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/checkbox-DaKe0Tlq.js","assets/pwa-Br2HZksc.js","assets/YuriLogo-Ceon25sC.js","assets/ErrorBoundary-CCH4LiRY.js","assets/card-D44sTpdY.js","assets/contextPanelEmbeddedChat-Dm5R_b5X.js","assets/theme-validation-BGYdrOu7.js","assets/BusyDots-FXSlMe2F.js","assets/spacedFileMention-Ds4GtgiF.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/useProjectRuntimeAPIs-D51dVo-V.js","assets/terminalApi-ClNhXBA8.js","assets/useProjectGitStore-Lz9AV32V.js","assets/useDebouncedValue-BHlMPqY8.js","assets/MobileOverlayPanel-DcRWQlmf.js","assets/githubAuthQueries-C5RxUNL2.js","assets/worktreeManager-V6hoSVxH.js","assets/worktreeSourceBranchPreference-MQFPkOZy.js","assets/remote-input-store-DdjKfpxS.js","assets/vendor-cmdk-BDWoZLve.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-DACGW9sB.js","assets/vendor-dnd-kit-core-qy5stxu5.js","assets/vendor-dnd-kit-accessibility-u0XSXxKq.js","assets/vendor-dnd-kit-sortable-CiTIuX4o.js","assets/auto-read-context-Ce0o43YI.js","assets/audio-session-BFWjrDbp.js","assets/browserVoiceService-x5Pci8L3.js","assets/queue-abort-optimistic-DciJN9X1.js","assets/fileMentionAutocompleteState-B9411b4o.js","assets/vendor-fuzzysort-ukaRp9PC.js","assets/useFontPreferences-Bb-bxdL8.js","assets/speechSettingsQueries-BU-4Axb5.js","assets/ProviderLogo-Cm9RNV_U.js","assets/zhipuai-coding-plan-CcFj8zKy.js","assets/projectMeta-vIaGFaQr.js","assets/useQuotaStore-mZs9LTwx.js","assets/quota-2PwXAoIg.js","assets/timeFormat-BsuUDWLs.js","assets/openRemoteProjectSession-C5z2Juv7.js","assets/router-DXUi1sBd.js","assets/runtimeEndpointReset-BKLVdNhJ.js","assets/vendor-tanstack-react-virtual-qsd3nvZb.js","assets/react-CPBNl-S9.js","assets/SyncActions-Blnq08ks.js","assets/context-menu-DZunhC8o.js","assets/collapsible-CL3SPnOf.js","assets/kbd-CwkasrzN.js","assets/connection-hint-SMNZFDAe.js","assets/sessionLookup-BTQ_AtWh.js","assets/YuriWordmark-CW53XKgV.js","assets/sessionOwnership-BPfk1qCS.js","assets/mcpQueries-qRW-HQMx.js","assets/usePluginsStore-BLncdNj-.js","assets/switch-DaUn0G3u.js","assets/icons-D_vRtitD.js","assets/native-errors-06if6eu-.js","assets/appearance-DFsI3pnP.js","assets/navigation-C1v9hIAT.js","assets/MobileTabPageHeader-0aJFe3_x.js","assets/MobileSurface-DGNomvlu.js","assets/useMobileSwipeActions-fUp7Bkbn.js","assets/sortAssistantContacts-CcEdm3mS.js","assets/runtimeEndpointReset-DuvtZAyx.css","assets/SettingsGroup-kZ_faXwL.js","assets/useMcpConfigStore-ZsZxSrCt.js","assets/native-config-Czc142JT.js","assets/project-preview-BcLPKzwg.js","assets/useMobileTranscriptSyncHint-B4izCfqe.js","assets/select-assistant-mmsKjj2O.js","assets/AssistantUnreadBadge-opyLZlZd.js","assets/renderMobileApp-1G4-5u-t.css","assets/src-Dj147H4m.css","assets/image-loading-DA9JEHD8.css","assets/main-DVmi0I-y.js","assets/vendor-codemirror-autocomplete-C0FrlFqZ.js","assets/useInlineCommentDraftStore-DrC99u6A.js","assets/useProjectGitActions-CHMe1ku4.js","assets/truncated-path-KHrfQ66P.js","assets/PierreDiffViewer-BHwj_6j8.js","assets/textarea-IhQHekYx.js","assets/BinaryFileFallback-CJqnlBzh.js","assets/GuiPluginMount-BCqt2pmM.js","assets/BinaryFileFallback-CKNAgvHj.css","assets/ImageLoadingPlaceholder-DsgRtfYG.js","assets/LoadingImage-B3IL7hnv.js","assets/SessionSurfaceContext-BP4NCKp6.js","assets/insertionBoundaries-Br0Bdl9R.js","assets/fileMentionTouchSelection-B_62hIQI.js","assets/ModelLogo-D27dq-si.js","assets/ChatContainer-Dg9uDBjk.js","assets/imageSource-Cq_p4gAe.js","assets/TextSelectionMenu-B2fIBlD3.js","assets/chatUpwardIntent-CnS7WWRL.js","assets/useDictation-sdgDfATy.js","assets/BtwPanel-DnMW6R43.js","assets/inlineMessageLinks-DC78iKO5.js","assets/vendor-motion-vLNN8EMu.js","assets/vendor-marked-S3gCOYp1.js","assets/reference-history-BwtzPAmA.js","assets/reference-history-8C8nv-EP.css","assets/useModelLists-B0qSYDby.js","assets/useOpenCodeReadiness-B9d-wLZB.js","assets/ToolOutputDialog-DdSUE2kP.js","assets/runtime-file-download-1s2Al1t3.js","assets/tap-LkQum5bB.js","assets/markdownTheme-D84XyNiT.js","assets/markdown-worker-oBGEB9Eg.js","assets/DiffViewToggle-DkxhEUhV.js","assets/touch-gestures-DOoBxhz5.js","assets/select-BOtGs1FV.js","assets/permission-rules-DoQUXKll.js","assets/FadeInOnReveal-DO9PZrJL.js","assets/useStreamingTextThrottle-ul6e3dUd.js","assets/ChatContainer-K31q-1OV.css","assets/useDesktopWindowControlsLayout-DAkTdcAP.js","assets/GuiPluginPage-BSjWEmIu.js","assets/pages-CYkE04ml.js","assets/historyImportQueries-CZsECryv.js","assets/ScheduledTasksDialog-DnwBC7cj.js","assets/scheduledTaskNavigation-VVTOq9n2.js","assets/ModelSelector-Dg__8QLh.js","assets/AgentSelector-K5JSbXv3.js","assets/vendor-cron-parser-BmO80h0C.js","assets/ChatView-AFUNEBdD.js","assets/diagram-DFXqN638.js","assets/vendor-react-drawio-C9rszQEJ.js","assets/DiffView-DZ_gKyTO.js","assets/multirun-C2RRF2Q3.js","assets/ArchivedSessionsDialog-CU9RXl8K.js","assets/vendor-codemirror-lang-angular-Cm7vBE3E.js","assets/vendor-codemirror-lang-json-DowyFczU.js","assets/vendor-codemirror-lang-markdown-npWBZIoE.js","assets/vendor-codemirror-lang-python-OPRdU26g.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/vendor-codemirror-commands-5saeUOVY.js","assets/vendor-codemirror-search-hZY-L2l8.js","assets/vendor-replit-codemirror-vim-BmQmU1lR.js","assets/vendor-codemirror-language-data-B3pLWvv-.js","assets/projectActions-BPmI9_mW.js","assets/GuiPluginTitlebarItems-DfHugxsx.js","assets/vendor-zumer-snapdom-yq9vlCKr.js","assets/vendor-html-to-image-BDMm2v6d.js","assets/main-qSeeJRW1.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./modulepreload-polyfill-P2Xu9kJm.js";import{o as e}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as t,t as n}from"./runtimeConfig-DzYIc49M.js";/* empty css */var r=`true`,i=`false`,a=r===`true`,o=i===`true`;function s(t={}){let{immediate:n=!1,onNeedReload:r,onNeedRefresh:i,onOfflineReady:s,onRegistered:c,onRegisteredSW:l,onRegisterError:u}=t,d,f,p,m=async(e=!0)=>{await f,a||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await e(async()=>{let{Workbox:e}=await import(`./vendor-workbox-window-15MWHJyx.js`).then(e=>e.t);return{Workbox:e}},__vite__mapDeps([0,1])).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!o)if(a)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(r?r():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||s?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(r?r():window.location.reload())}),i?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&s?.():n.isExternal?t():!e&&s?.():n.isUpdate||s?.()}),d.addEventListener(`waiting`,t)}d.register({immediate:n}).then(e=>{l?l(`/sw.js`,e):c?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}window.__YURI_RUNTIME_APIS__=n();var c=()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(pointer: coarse)`).matches,l=(()=>{let e=new URLSearchParams(window.location.search).get(`surface`);if(e===`mobile`)return`mobile`;if(e===`desktop`)return`desktop`;let t=Math.min(window.innerWidth||0,window.screen?.width||window.innerWidth||0),n=navigator.maxTouchPoints||0;return t>0&&t<=760&&(n>0||c())?`mobile`:`desktop`})();window.__YURI_SURFACE__=l;var u=()=>!(!(`serviceWorker`in navigator)||!window.isSecureContext||window.location.protocol!==`http:`&&window.location.protocol!==`https:`||document.prerendering||String(document.visibilityState)===`prerender`),d=e=>{let t=!1,n=()=>{t||u()&&(t=!0,e())},r=()=>{setTimeout(n,0)};document.readyState===`complete`?r():window.addEventListener(`load`,r,{once:!0}),(document.prerendering||String(document.visibilityState)===`prerender`)&&document.addEventListener(`visibilitychange`,n,{once:!0})},f=()=>{d(()=>{try{s({onRegisterError(e){console.warn(`[PWA] service worker registration skipped:`,e)}})}catch(e){console.warn(`[PWA] service worker registration skipped:`,e)}})},p=`yuri.dev.module-reload`,m=(e,t)=>{console.error(`[yuri] failed to load ${t}:`,e)};l===`mobile`?e(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-C5U2cyeq.js`);return{renderMobileApp:e}},__vite__mapDeps([2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177])).then(({renderMobileApp:e})=>{try{sessionStorage.removeItem(p)}catch{}e(window.__YURI_RUNTIME_APIS__??n())}).catch(e=>m(e,`renderMobileApp`)):t().then(()=>e(()=>import(`./main-DVmi0I-y.js`),__vite__mapDeps([178,1,3,4,5,6,7,8,9,99,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,115,34,42,41,179,64,65,66,67,68,69,70,71,72,73,36,35,37,38,39,40,43,44,45,46,47,48,49,50,51,52,54,57,58,59,180,74,147,181,146,182,60,114,85,101,148,62,61,149,150,183,184,151,63,75,76,77,116,81,82,185,53,55,186,187,188,177,189,83,84,86,87,102,190,88,117,91,98,100,103,104,105,106,107,108,109,110,111,112,113,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,152,191,94,79,95,96,192,193,138,194,56,78,80,195,196,89,197,198,199,200,201,202,142,203,204,205,137,206,207,208,209,210,211,212,213,214,139,215,216,217,218,140,141,219,153,143,145,97,144,154,155,156,157,158,159,160,161,162,163,164,165,166,167,174,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,168,239,240,241,242,243,244,245,246,247,176]))).then(()=>{try{sessionStorage.removeItem(p)}catch{}}).catch(e=>m(e,`desktop main`)),f();
|