dorkos 0.124.0 → 0.125.0
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/bin/cli.js +2319 -1483
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BH8Ndn3e.js → AboutPage-GdrU2Z3k.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-K5Mew9EX.js → ActivityErrorState-D1T74VJE.js} +1 -1
- package/dist/client/assets/{ActivityPage-BB20L5HU.js → ActivityPage-7GXGUwd1.js} +1 -1
- package/dist/client/assets/{ActivityRow-C5O7rnmS.js → ActivityRow-C-8dACWp.js} +1 -1
- package/dist/client/assets/{AdapterIcon-Bmybvrzb.js → AdapterIcon-CRRs6yil.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-CkdV7Hhh.js → AdapterSetupWizard-K6DsejqG.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-BA2cDa7r.js → AgentOptionRow-CF5XZmBx.js} +1 -1
- package/dist/client/assets/{AgentPicker-CsIIPGZJ.js → AgentPicker-BXes2ymU.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-0fOxvaoe.js → AgentRequestCard-BuXVpWfb.js} +4 -4
- package/dist/client/assets/{AppearancePage-XOjkkoli.js → AppearancePage-DoqoCU4j.js} +1 -1
- package/dist/client/assets/ApplyToOverridesDialog-By8jgPX3.js +1 -0
- package/dist/client/assets/AttentionSignalRow-CgGyTDmT.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-9TVHyRPJ.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BzDxZ-G5.js} +3 -3
- package/dist/client/assets/{BindingDialog-DLoAQauL.js → BindingDialog-BXfjFGvP.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-CYHsXAcY.js → BlintzCanvas-C-dobEns.js} +4 -4
- package/dist/client/assets/{CanvasCsvContent--Gr7Fe_U.js → CanvasCsvContent-ClMFJX7T.js} +4 -4
- package/dist/client/assets/CanvasFileContent-BoDE2jjA.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-fnWc0B7B.js +2 -0
- package/dist/client/assets/ChannelComposer-DIRPjyyf.js +44 -0
- package/dist/client/assets/{ChatAppsOff-D4L1zJVN.js → ChatAppsOff-DlCWmwEz.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-DY_6ju-z.js → CodeMirrorDiff-COsbYyNC.js} +2 -2
- package/dist/client/assets/{CodeMirrorEditor-BUoDBsBv.js → CodeMirrorEditor-n3l14rY7.js} +1 -1
- package/dist/client/assets/{CommitmentList-wDkcVP9c.js → CommitmentList-S2O_hvwR.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-CzSM6b8R.js → CommitmentsPage-COOCQFpL.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-cERD9H2L.js → ComputerResourceView-PA9T4FZP.js} +1 -1
- package/dist/client/assets/{ComputerViewer-rMcfbk2_.js → ComputerViewer-CnYUWQBS.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-f7QeQbQo.js → ConnectionAccessLists-C1ZJtNl-.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-BmjtA6pw.js → ConnectionsPage-BBpWiN4-.js} +2 -2
- package/dist/client/assets/{ConventionPage-CH-ah6nI.js → ConventionPage-sa0Yn2uq.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-CJIxa6ST.js → ExtensionPageRoute-BztrmZNp.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BP7EJ2JL.js → FloatingTanStackRouterDevtools-CqogiFob-CJrqr29-.js} +1 -1
- package/dist/client/assets/HandlePage-tZidnrlt.js +1 -0
- package/dist/client/assets/{HeartbeatPage-BUsf-qrU.js → HeartbeatPage-BkyUpdZt.js} +1 -1
- package/dist/client/assets/{KeyEntry-C2kWdN8q.js → KeyEntry-DAMr1NNY.js} +1 -1
- package/dist/client/assets/{LexicalField-CR8ulsI_.js → LexicalField-Cnzrh08A.js} +2 -2
- package/dist/client/assets/{ManagesPage-DTtsIOGi.js → ManagesPage-EAbQtygH.js} +1 -1
- package/dist/client/assets/{Marketplace-iaV5XAzv.js → Marketplace-BfADALGd.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-6tgzUfFj.js → MarketplaceSourcesView-u1WKUk-p.js} +1 -1
- package/dist/client/assets/{McpAppFrame-C7eYYdI9.js → McpAppFrame-Cz-Ttlqr.js} +1 -1
- package/dist/client/assets/{McpSigninBody-BDyGbJ7I.js → McpSigninBody-CkOBUhOz.js} +1 -1
- package/dist/client/assets/{Model3dViewer-BujDNuVS.js → Model3dViewer-CvLaSO7V.js} +1 -1
- package/dist/client/assets/NamePage-BS-oN_Hi.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-D4e-z2Jt.js → NewDirectMessageMenu-Be_4mBPd.js} +1 -1
- package/dist/client/assets/{NotificationsPage-CkDeTaJp.js → NotificationsPage-GCk9gfsW.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-CtbOt3r5.js → OpenMeshSwitch-BBzgYSUc.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-Vr4qZnmM.js → OperatorIdentityForm-ZAbJ4FJn.js} +1 -1
- package/dist/client/assets/PermissionHistory-DgmFpdJK.js +1 -0
- package/dist/client/assets/{PermissionsPage-f4QaX8oM.js → PermissionsPage-DHFt_34a.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BkZruwF-.js → PersonalityPopover-CobRy95S.js} +1 -1
- package/dist/client/assets/PhotoPage-BmFypD13.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-BXC2K0tx.js → PreviewRefusedNotice-Ux5sq2Om.js} +1 -1
- package/dist/client/assets/ProfileFields-kBzeRPfc.js +1 -0
- package/dist/client/assets/{ProfilePanelContainer-DZoL65zQ.js → ProfilePanelContainer-CREt4ZC3.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-D9H7wsuT.js → ProfileRolePicker-hQbo8P6M.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-B5fDmc-g.js → PromptSuggestionChips-CmW1lIso.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-uVYhSqj7.js → ReportsToPopover-Dpa-_NsO.js} +1 -1
- package/dist/client/assets/RoomSurface-BQhgKnIE.js +1 -0
- package/dist/client/assets/{RoomsPage-yflYFulU.js → RoomsPage-BHUDRYzJ.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DtGrX1Vq.js → RunsOnPopover-bGZ6VJoF.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-DN2ElvcH.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-Cr4GRi8c.js → RuntimeSetupDialog-CUFie4LV.js} +1 -1
- package/dist/client/assets/SeenDevices-D_FnsL7V.js +19 -0
- package/dist/client/assets/{SessionsPage-BWu-en78.js → SessionsPage-1uOPUCP9.js} +1 -1
- package/dist/client/assets/SettingsDialog-AbwEHDG8.js +12 -0
- package/dist/client/assets/{SkillsPage-BdUb9SZy.js → SkillsPage-BEobBuAr.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-BAFSmT-z.js +1 -0
- package/dist/client/assets/{TasksEmptyState-Bgcg9vxF.js → TasksEmptyState-BFw2ODM-.js} +2 -2
- package/dist/client/assets/{TasksPage-Ch5W2WQS.js → TasksPage-C0CMgSFx.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CPwSIMRw.js → TeamComputerEntry-BpjxLA1n.js} +1 -1
- package/dist/client/assets/ToolsPage-dx-rQ2F1.js +2 -0
- package/dist/client/assets/TopologyGraph-LpxkBhGK.js +30 -0
- package/dist/client/assets/{TourHost-BPaSwh9I.js → TourHost--UYZoKlJ.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BUWZUu5P.js → UnlinkDialog-BN2odbqD.js} +1 -1
- package/dist/client/assets/UnreadDivider-LbVIAoxM.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-cS8yMCxU.js → WidgetErrorCard-CAUx4KUI.js} +7 -7
- package/dist/client/assets/WorkView-DVx4WoVI.js +63 -0
- package/dist/client/assets/_shell-D7Jp6t6_.js +80 -0
- package/dist/client/assets/{_shell._home-DCA5k-jb.js → _shell._home-uuqgFA3M.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BX4nFLna.js → _shell._home.activity-CiMsy7bF.js} +1 -1
- package/dist/client/assets/_shell._home.index-0Zm5q3-G.js +3 -0
- package/dist/client/assets/{_shell._home.tasks-BgUeEvhK.js → _shell._home.tasks-BClPai4g.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BPBdnkRt.js → _shell._home.workspaces-DH4BgLT0.js} +1 -1
- package/dist/client/assets/{_shell.channels-CX4kki7G.js → _shell.channels-BGXkXPhY.js} +4 -4
- package/dist/client/assets/{_shell.connections-0vP7g7E4.js → _shell.connections-BwjXkgi1.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-TsuaO4eR.js → _shell.feedback-requests-j7gTBF5b.js} +1 -1
- package/dist/client/assets/_shell.marketplace-6JRXJ9gt.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DriHXfBM.js +1 -0
- package/dist/client/assets/_shell.session-BXSWGdwi.js +1 -0
- package/dist/client/assets/{_shell.team-Bm6cOBhR.js → _shell.team-BgJu1gDa.js} +5 -5
- package/dist/client/assets/_shell.threads-C1IJJzcf.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-BNgicBXG.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-BNgicBXG.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-CrvoN15x.js → abnfDiagram-WEYOIA3C-BuEHMh0D.js} +1 -1
- package/dist/client/assets/{access-copy-B3yNZ7Gz.js → access-copy-BZNjpw9v.js} +1 -1
- package/dist/client/assets/{arc-CuT6QA_y.js → arc-BbGU9Ctb.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-CPXCZ9H4.js → architectureDiagram-ZHVYKT53-CdRG5sTM.js} +2 -2
- package/dist/client/assets/{banner-DRumuw3F.js → banner-C7kHJJGz.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CM0rka9p.js → blockDiagram-RJAE7QA3-CBQ6YXoI.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-D4j2cXRy.js → c4Diagram-XDPPPE54-DavNcKCF.js} +1 -1
- package/dist/client/assets/{card-B3CtfC3R.js → card-D4ek-VvX.js} +1 -1
- package/dist/client/assets/channel-ClNeQ2PQ.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-KGyqhVpO.js → chunk-2E7WHVMD-ClO15ze9.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-Dl0BHoqK.js → chunk-2Q5K7J3B-DsLDzf_i.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-Da7vH6Kv.js → chunk-4EMNKR2T-D20fXIIK.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-DgBUEROO.js → chunk-55XCU76K-no_S5sRX.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BQ4mn-_I.js → chunk-5VM5RSS4-D5xWEZ2p.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-8LPR3mXf.js → chunk-JWPE2WC7-CnsdZOv0.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-BkIVXi4W.js → chunk-VQ5W62QI-DxYg8tsH.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-DQXJx06h.js → chunk-XXDRQBXY-7CQ-MKdC.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-DzCE7qlD.js → chunk-ZCHMQSOR-Ca7Jh42b.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-C_cZra7c.js → classDiagram-v2-4MYWR3UA-BvZXavcI.js} +1 -1
- package/dist/client/assets/{command-CDKbyppr.js → command-srO4Wv-5.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-DlXHdGwT.js → cose-bilkent-JH36ORCC-1NCiJaHv.js} +1 -1
- package/dist/client/assets/{cpu-B7xLO7jn.js → cpu-CFIu4JtK.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-HhP4ArLc.js → cynefin-EF2NZ3EQ-DgZeohG3.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-D4GgWnZV.js → cynefinDiagram-WF24UDRP-MQB2xbJK.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-SZ_OI2Zi.js → dagre-NK4GIZVX-BFHk_Y44.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-BN-_Ja5m.js → diagram-CBK3MWTC-CloEvZfp.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-t7AK6xnL.js → diagram-I5XIIV2D-9nzUtfKI.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-C1V7szSc.js → diagram-ODIL2UCW-DVdnelgu.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-DPtraQ2g.js → diagram-PFBEJUXE-tTEeiAHa.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-D2XNRB2b.js → diagram-RJA3I4VV-QFehV9_1.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-BieaRy38.js → diagram-TYUNFSNR-CYU5li-4.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bwki86UY.js → ebnfDiagram-V4P3TTPT-Cn040Beg.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-WEXSAyHB.js → elk-QONTBCTQ-tBbnwcb3.js} +1 -1
- package/dist/client/assets/{empty-state-J-UJ0BUU.js → empty-state-Bxfi7_ss.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-DIKASnoc.js → erDiagram-KYQIGQAA-DAA0fFlD.js} +1 -1
- package/dist/client/assets/{execution-config-ILQiJAmy.js → execution-config-afKaYukD.js} +1 -1
- package/dist/client/assets/{file-D40js1Zx.js → file-C-ooqbRY.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-Dg3ZpiAe.js → file-exclamation-point-BWWgLsMF.js} +1 -1
- package/dist/client/assets/{file-text-DgdvRfMk.js → file-text-BJt8biPY.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-D4kBWC_1.js → find-latest-widget-fence-DPQimlUD.js} +2 -2
- package/dist/client/assets/{flowDiagram-IUGLLWBU-CoavNw0M.js → flowDiagram-IUGLLWBU-vYI6TodS.js} +1 -1
- package/dist/client/assets/{form-DlPwEgQH.js → form-LJ2Rf9ny.js} +1 -1
- package/dist/client/assets/{format-cron-BrK8RzgT.js → format-cron-DrUISrHj.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-DccKAz7f.js → ganttDiagram-R7GPNTJY-DLYpSX7r.js} +3 -3
- package/dist/client/assets/{git-branch-BpxhecMq.js → git-branch-D5xr7U5P.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DEbo_dgQ.js → gitGraphDiagram-PDYL7XHY-DNIbVOaY.js} +1 -1
- package/dist/client/assets/{graph-DROgI3M3.js → graph-DNjxkUSL.js} +1 -1
- package/dist/client/assets/{heart-c7u4Ezxt.js → heart-DnR_GX4I.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CrATNdTR.js → highlighted-body-KPVGNVTW-L_Jd2uei.js} +1 -1
- package/dist/client/assets/image-lightbox-DZIhMyF3.js +1 -0
- package/dist/client/assets/{image-off-BExgZjfM.js → image-off-DdvvVxmq.js} +2 -2
- package/dist/client/assets/index-5eNHb7up.js +1 -0
- package/dist/client/assets/{index-BVqSmajJ.js → index-5hCWBj-r.js} +1 -1
- package/dist/client/assets/{index-Be0OJLWK.js → index-9GoQjBFo.js} +1 -1
- package/dist/client/assets/{index-DswGXheF.js → index-ANmu61E0.js} +1 -1
- package/dist/client/assets/{index-dyAahqKe.js → index-B0jt7Nng.js} +1 -1
- package/dist/client/assets/index-B1gC3xYN.js +1 -0
- package/dist/client/assets/{index-DDgOoXP1.js → index-B2wx4J9U.js} +1 -1
- package/dist/client/assets/{index-DksjixUS.js → index-BAIKz_P0.js} +1 -1
- package/dist/client/assets/{index-CT_pFeX_.js → index-BFecX5dC.js} +1 -1
- package/dist/client/assets/{index-CqPRAM_6.js → index-BWQfqbbe.js} +1 -1
- package/dist/client/assets/{index-BlyoyIck.js → index-BYeyKNKj.js} +1 -1
- package/dist/client/assets/{index-CD8aw6Jb.js → index-Ba9q2CoQ.js} +1 -1
- package/dist/client/assets/{index-DeRDq7bD.js → index-Blhsfk7u.js} +1 -1
- package/dist/client/assets/{index-mwf7ZNk2.js → index-Bpwvxz0c.js} +1 -1
- package/dist/client/assets/{index-CYy1cjtq.js → index-BqKjnd_r.js} +1 -1
- package/dist/client/assets/{index-2wezsLA_.js → index-Bri5bZfv.js} +1 -1
- package/dist/client/assets/{index-CZmqtJWZ.js → index-BsHyymmC.js} +1 -1
- package/dist/client/assets/index-BsmR2hi4.js +23 -0
- package/dist/client/assets/index-By-VWzSF.js +43 -0
- package/dist/client/assets/{index-D150FXCC.js → index-By8pKNSM.js} +1 -1
- package/dist/client/assets/{index-B3eeEDWj.js → index-BzKkoaB1.js} +3 -3
- package/dist/client/assets/{index-DaZ1I8s-.js → index-CDGWl8qL.js} +1 -1
- package/dist/client/assets/{index-J3Hh1MnL.js → index-CDo6TA8n.js} +1 -1
- package/dist/client/assets/{index-DINk1YfD.js → index-CLQIvYHP.js} +1 -1
- package/dist/client/assets/{index-D3YeRrne.js → index-CLbs0fcq.js} +1 -1
- package/dist/client/assets/{index-DxiRRZRo.js → index-CQ2atcs_.js} +1 -1
- package/dist/client/assets/index-CSqz4B0v.js +1 -0
- package/dist/client/assets/{index-BizvylBV.js → index-CXWlrRzK.js} +1 -1
- package/dist/client/assets/{index-CbHCZsbE.js → index-D-Q7CW4p.js} +1 -1
- package/dist/client/assets/index-D0ujPZdD.js +1 -0
- package/dist/client/assets/index-D1kQ19Gb.css +1 -0
- package/dist/client/assets/index-DHi8-3w0.js +1 -0
- package/dist/client/assets/index-DKTd8X7n.js +1053 -0
- package/dist/client/assets/{index-D0eJtRlK.js → index-DTuNXPGU.js} +1 -1
- package/dist/client/assets/{index-Ccf1XBTs.js → index-DXWsH2Ep.js} +1 -1
- package/dist/client/assets/index-DjFFFMc-.js +2 -0
- package/dist/client/assets/{index-C7B3eSOP.js → index-DqCxUalt.js} +1 -1
- package/dist/client/assets/{index-C5or4L_3.js → index-Ixk2o7yl.js} +1 -1
- package/dist/client/assets/{index-AzyLwYS_.js → index-ZYbeRA5f.js} +3 -3
- package/dist/client/assets/index-a6ojvFqI.js +1 -0
- package/dist/client/assets/{index-DT7pv2iW.js → index-adYd35CJ.js} +1 -1
- package/dist/client/assets/{index-DhHobJd3.js → index-ld6lMfGU.js} +1 -1
- package/dist/client/assets/{index-DNGNMW3c.js → index-r0stHl-2.js} +1 -1
- package/dist/client/assets/index-uIonuakd.js +1 -0
- package/dist/client/assets/{index-BEkYBuOq.js → index-xfRcAp50.js} +1 -1
- package/dist/client/assets/{index.esm-BFJ9SG0n.js → index.esm-j5KQ_b6S.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-VL8q5pKx.js → infoDiagram-MVDRKAX5-DjvSkTas.js} +1 -1
- package/dist/client/assets/{inline-code-BE9ckzPs.js → inline-code-DlVYFFW7.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BLKkPYF-.js → ishikawaDiagram-HPEHV2GE-BBivrI5n.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-CSYpRobu.js → journeyDiagram-BOSHW7O7-DKdhbtdx.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-HilAqtZo.js → kanban-definition-FNSA4HC5-CkgAodR5.js} +1 -1
- package/dist/client/assets/{layers-Cm7coqdo.js → layers-CzyhuVSM.js} +1 -1
- package/dist/client/assets/{lightbulb-DqdWS75d.js → lightbulb-DwGE7s99.js} +1 -1
- package/dist/client/assets/{link-2-CDJapTSa.js → link-2-CljREnN9.js} +1 -1
- package/dist/client/assets/{list-runtime-types-CP82p1u4.js → list-runtime-types-D5ZO30FL.js} +1 -1
- package/dist/client/assets/{markdown-content-m_qereFc.js → markdown-content-CN_dGlgE.js} +1 -1
- package/dist/client/assets/{mention-pill-DV5HIG5Q.js → mention-pill-C6OT4gx4.js} +1 -1
- package/dist/client/assets/{mermaid.core-zxW6MBr-.js → mermaid.core-DNuzxE7q.js} +4 -4
- package/dist/client/assets/{message-square-off-YVtpbaJ0.js → message-square-off-DlkAPJdd.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-IAYemvOg.js → mindmap-definition-6OY57UG3-f9ygKKO1.js} +1 -1
- package/dist/client/assets/{more-details-ReA2ZFBn.js → more-details-DRPervoL.js} +1 -1
- package/dist/client/assets/{owner-notice-M4hn_1ep.js → owner-notice-C-Q9ySA7.js} +1 -1
- package/dist/client/assets/{package-CUuTl39E.js → package-BVNiaGrb.js} +1 -1
- package/dist/client/assets/{page-container-BnmNikNZ.js → page-container-D03bhclt.js} +1 -1
- package/dist/client/assets/pane-resize-handle-CZ9rHhNr.js +1 -0
- package/dist/client/assets/{paperclip-C6fYq5Zf.js → paperclip-DQQVX5tJ.js} +1 -1
- package/dist/client/assets/{path-input-DHn9-XaE.js → path-input-CQ16nhYd.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-CojaUwe7.js → pegDiagram-ECIUJNBX-CZ_YkcKh.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-CjP3pw6V.js → pieDiagram-GNMPY74T-DLHSPEH7.js} +1 -1
- package/dist/client/assets/{plug-DHQcxt7N.js → plug-CadJyjTp.js} +1 -1
- package/dist/client/assets/primer-trigger-DH4xfrlM.js +3 -0
- package/dist/client/assets/profile-errors-DSnHlauU.js +1 -0
- package/dist/client/assets/{progress-4FQQfnS6.js → progress-BB97hlmb.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-OP0Z8zcR.js → quadrantDiagram-D57K4MC3-BWcUu48x.js} +1 -1
- package/dist/client/assets/{query-error-state-BkUdxenP.js → query-error-state-B456s96E.js} +1 -1
- package/dist/client/assets/{radio-ta5Bw763.js → radio-DrpN3x3S.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-CT3NCb9b.js → railroadDiagram-Y72NRBL7-C2VRM83h.js} +1 -1
- package/dist/client/assets/registry-DRvQ3ChB.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DwUuyxao.js → relay-trace-schemas-BYCaGsVJ.js} +2 -2
- package/dist/client/assets/repeat-DPzic7-j.js +11 -0
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-tde4lYGp.js → requirementDiagram-EQYSW5RA-B1bpdcM7.js} +1 -1
- package/dist/client/assets/{room-files-source-CZWhaaOy.js → room-files-source-aN4p_kDV.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-RfbbgUa4.js → rotate-ccw-clock-gqBy98sI.js} +1 -1
- package/dist/client/assets/{rotate-cw-B3rB_YSw.js → rotate-cw-mHsqEte-.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-sdCzIA7-.js → sankeyDiagram-SY24JHO5-QCGTTh9k.js} +1 -1
- package/dist/client/assets/{scroll-area-B4WB7Q40.js → scroll-area-DVd6ctli.js} +1 -1
- package/dist/client/assets/{search-x-DCUmWW2_.js → search-x-CzgTzL0z.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-DvzTJcKu.js → sequenceDiagram-BLEHNHQU-kiR1gX_u.js} +1 -1
- package/dist/client/assets/{shield-x-CANziVLc.js → shield-x-Btfd3Xnx.js} +1 -1
- package/dist/client/assets/{signed-in-DctJ2IWe.js → signed-in-gS3tMpTW.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-DuDA7TKE.js → sizeCapture-INFHLROL-Da56aMj0.js} +1 -1
- package/dist/client/assets/{soul-file-Co_8f1qw.js → soul-file-C7zd1yXt.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BJPX5JTC.js → stateDiagram-v2-A6IESKWZ-BZ3qlQWl.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-CiLSffGv.js → swimlanes-B3ENRKFQ-B-wp91_T.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Drg_8k1s.js +8 -0
- package/dist/client/assets/{table-BSAvOYPp.js → table-BIdFvzBs.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-5oq8sl82.js → timeline-definition-JXYKGLGB-CQojjy-8.js} +1 -1
- package/dist/client/assets/{trust-posture-D-Yjm6ot.js → trust-posture-DszobEjt.js} +1 -1
- package/dist/client/assets/{unplug-Bq_1WdV7.js → unplug-xlfZ61jC.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-CEzu54YH.js → unverified-catalog-notice-DymrAwtm.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-Tn3ZbPAj.js → use-adapter-catalog-CytBTafV.js} +1 -1
- package/dist/client/assets/{use-bindings-Bz9YRgO7.js → use-bindings-BPNK3sUh.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-D9oKJSQN.js → use-composer-prefs-DMQT0qiv.js} +1 -1
- package/dist/client/assets/{use-connector-management-CLYFraXN.js → use-connector-management-PDVdWccW.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DkS713kG.js → use-deep-link-scroll-CwapSmGj.js} +1 -1
- package/dist/client/assets/{use-delete-binding-CukKpHBK.js → use-delete-binding-CgTwS83G.js} +1 -1
- package/dist/client/assets/{use-dev-links-DQ32IcGe.js → use-dev-links-BoZCIc4h.js} +1 -1
- package/dist/client/assets/use-direct-message-panel-Cs4I6669.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-D-FO_XW6.js → use-external-adapter-catalog-PBrsasQ8.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-BNxcyb1j.js → use-full-activity-feed-C2seN-V1.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-pvzUlnxh.js +1 -0
- package/dist/client/assets/use-is-hub-CvEPWuj0.js +1 -0
- package/dist/client/assets/{use-local-browser-xg7WXAVK.js → use-local-browser-CF0uGQ6e.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-BgCSFw8s.js → use-mesh-topology-CnCeK4gS.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-qRbdZfOU.js → use-mounted-ref-BtAb14HI.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-B-4kZR7I.js → use-notification-prefs-B8LHpZTt.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-CCq-mZlY.js → use-panel-tab-placements-DOXj0Pii.js} +1 -1
- package/dist/client/assets/use-pending-read-DBaC7e8N.js +1 -0
- package/dist/client/assets/{use-personality-commit-DwSisUfF.js → use-personality-commit-YV9FVC-a.js} +1 -1
- package/dist/client/assets/{use-promo-activation-Botoso6l.js → use-promo-activation-CjtGhz_3.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-RJXp-r_J.js → use-promo-dismissals-4rbLgSDG.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-B3390hGg.js → use-pulse-freshness-CGqANpVO.js} +1 -1
- package/dist/client/assets/{use-relay-config-BV0xcLwS.js → use-relay-config-CvU_70WJ.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-Du4hKHIJ.js → use-room-follow-claim-Doq_lWjk.js} +1 -1
- package/dist/client/assets/use-room-sessions-CoEIaBRt.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-g2hO6Ruz.js → use-roving-tab-list-BzsrpjWV.js} +1 -1
- package/dist/client/assets/use-session-canvas-DQ9ND8il.js +27 -0
- package/dist/client/assets/use-status-budget-AnHroEO0.js +16 -0
- package/dist/client/assets/{use-unclaimed-chats-B92om889.js → use-unclaimed-chats-DzOLK27i.js} +1 -1
- package/dist/client/assets/use-update-config-NRkQbxae.js +1 -0
- package/dist/client/assets/{useMutationState-DdOGdpjP.js → useMutationState-BAU_J-u3.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Di5pJvcw.js → usecaseDiagram-WPOLBNNX-BrHN0c6G.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-K7KAf26T.js → vennDiagram-Q3Y3IDCW-CbeP0Pbp.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DVTaxQt9.js → wardleyDiagram-IVAIDKWA-mn5ebFhs.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-x-lSJm_B.js → xychartDiagram-4URNHDU4-C8fXRQEv.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
- package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
- package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
- package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
- package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/server/extension-child.cjs +45 -3
- package/dist/server/index.js +61358 -29913
- package/dist/server/index.js.map +2 -2
- package/package.json +9 -9
- package/dist/client/assets/ApplyToOverridesDialog-CoO6V1G4.js +0 -1
- package/dist/client/assets/AttentionSignalRow-CjjZobp7.js +0 -1
- package/dist/client/assets/CanvasFileContent-estXyAbr.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-CkOo930M.js +0 -2
- package/dist/client/assets/HandlePage-Cg8H3mQS.js +0 -1
- package/dist/client/assets/NamePage-Bx8T98OF.js +0 -1
- package/dist/client/assets/PermissionHistory-DzU1rf2B.js +0 -1
- package/dist/client/assets/PhotoPage-CmrOIRjf.js +0 -1
- package/dist/client/assets/ProfileFields-BebX5oiv.js +0 -1
- package/dist/client/assets/RoomSurface-Bg5WV4Ep.js +0 -44
- package/dist/client/assets/RuntimeConnectFlow-DjReuQ-T.js +0 -1
- package/dist/client/assets/SeenDevices-SPWkdzoK.js +0 -19
- package/dist/client/assets/SettingsDialog-_dEXUhHe.js +0 -12
- package/dist/client/assets/TaskDialogWrapper-qYJPEoSR.js +0 -1
- package/dist/client/assets/ToolsPage-Idimrn3o.js +0 -2
- package/dist/client/assets/TopologyGraph-I4_mkMHM.js +0 -30
- package/dist/client/assets/_shell-ClVN2pUj.js +0 -80
- package/dist/client/assets/_shell._home.index-C8t8cw72.js +0 -3
- package/dist/client/assets/_shell.marketplace-CiL6YRbl.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-C0sI8e21.js +0 -1
- package/dist/client/assets/_shell.session-_hhBvFc6.js +0 -63
- package/dist/client/assets/_shell.x._extensionId-BWy5v1YE.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-BWy5v1YE.js +0 -1
- package/dist/client/assets/channel-DjBlTcCV.js +0 -1
- package/dist/client/assets/image-lightbox-DE_fHkw-.js +0 -1
- package/dist/client/assets/index-7jby-RRg.js +0 -1
- package/dist/client/assets/index-BGqvci3k.js +0 -1
- package/dist/client/assets/index-BkoMsjtM.js +0 -2
- package/dist/client/assets/index-BqIHtiaE.js +0 -1
- package/dist/client/assets/index-Cga0qx1T.js +0 -1033
- package/dist/client/assets/index-Ct4At33X.js +0 -1
- package/dist/client/assets/index-DCJQGDZk.js +0 -1
- package/dist/client/assets/index-DITPwUa9.js +0 -38
- package/dist/client/assets/index-DUZrTFYD.css +0 -1
- package/dist/client/assets/index-F-vqXYqa.js +0 -1
- package/dist/client/assets/index-InEBtYxw.js +0 -23
- package/dist/client/assets/primer-trigger-BmV5wjek.js +0 -3
- package/dist/client/assets/profile-errors-BSCuj3rT.js +0 -1
- package/dist/client/assets/registry-Dc102rws.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Dv1-QS9J.js +0 -8
- package/dist/client/assets/terminal-6CdY-T1V.js +0 -6
- package/dist/client/assets/use-is-below-desktop-gTvJDvw4.js +0 -1
- package/dist/client/assets/use-is-hub-B1vPpkYU.js +0 -1
- package/dist/client/assets/use-jump-back-in-Bibj5tVk.js +0 -11
- package/dist/client/assets/use-pending-read-C8L_v4Zw.js +0 -1
- package/dist/client/assets/use-session-canvas-i30oMO_Q.js +0 -25
- package/dist/client/assets/use-session-diagnostics-a4b83F5J.js +0 -16
- package/dist/client/assets/use-update-config-Tbn3SodN.js +0 -1
- /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var Lu=Object.defineProperty;var Fu=(e,t,s)=>t in e?Lu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var bn=(e,t,s)=>Fu(e,typeof t!="symbol"?t+"":t,s);import{rB as $u,r as u,fl as Ho,rC as Bu,fj as Yr,j as n,rD as zu,rE as Hi,fm as Uu,jW as Vr,a1 as ae,a2 as Ie,au as Be,eT as _e,fI as Rn,rF as Gs,jT as as,rG as Ku,rH as Hu,a3 as le,ap as we,pa as Wu,rI as Gu,W as Ge,ez as js,ar as se,B as L,X as Ue,G as K,jj as Wi,rJ as qu,x as De,a0 as Gi,bx as qi,be as ks,du as ze,aZ as Yu,rK as Wo,rL as Vu,bH as Qu,at as Yi,cj as Pe,as as Le,s as $t,kc as Xu,kd as Vi,a7 as ce,ks as Ln,kt as jt,ku as Qi,aY as P,rb as Ju,eM as kt,dZ as is,iM as an,rM as Zu,a4 as Wt,eL as Xi,fb as Qr,c$ as Xr,ax as Gt,rN as Go,jE as em,jI as Ji,jD as tm,pl as Jr,ji as Fn,J as cn,ib as Zr,ey as nn,l as je,aK as Zi,dR as ec,dS as tc,ei as nc,dT as nm,rO as sm,dV as it,bz as ln,bA as dn,T as qt,bB as un,bD as mn,C as hn,eu as We,ev as rm,mw as sc,l2 as rc,aP as Ke,rP as om,rQ as am,bI as im,g as cs,jS as vr,z as eo,dW as lt,gB as rt,g6 as to,fg as Ss,k5 as no,f as At,b9 as oc,eK as Cs,rR as ac,es as cm,am as so,_ as Tn,d8 as fn,d9 as pn,da as gn,ak as $e,aq as Ns,nq as ic,rS as lm,rT as dm,cQ as um,dI as ls,by as Xe,ki as en,cT as xt,cU as bt,cW as ht,cX as tt,cY as ft,dU as St,dB as tn,dz as mm,cb as cc,gX as lc,hx as qo,rU as hm,ig as ds,k1 as fm,k3 as pm,hv as dc,rV as gm,fO as As,fP as Es,fR as Is,rW as uc,fS as Qe,rX as $n,fU as es,h as ro,rY as oo,rZ as xm,fQ as bm,qk as ym,r_ as mc,jv as vm,r$ as wm,s0 as jm,s1 as km,gg as hc,s2 as Sm,s3 as Cm,iL as Nm,s4 as Am,s5 as Em,aA as Im,gO as fc,ad as Fe,ge as Rs,s6 as Rm,s7 as Tm,gP as Dm,rv as Yo,hV as Om,mu as Mm,hX as _m,hY as Pm,hZ as Lm,j8 as pc,cd as Bn,eF as Fm,s8 as $m,hc as gc,s9 as Bm,sa as me,sb as zm,sc as xc,sd as ao,se as wr,sf as bc,sg as io,sh as co,b8 as zn,si as Ts,sj as Um,sk as Km,sl as Hm,sm as Wm,sn as Gm,so as qm,sp as Ym,sq as Tt,jU as Vm,jo as Qm,n$ as Xm,sr as Vo,bd as Jm,hM as yc,ss as Bt,st as sn,su as Zm,sv as eh,sw as th,sx as nh,ff as vc,bX as Dt,sy as wc,sz as us,sA as jc,sB as sh,sC as rh,sD as kc,sE as Sc,sF as oh,sG as ah,h_ as Cc,h$ as Nc,sH as zt,sI as ih,sJ as ch,eB as lh,sK as Dn,sL as dh,a$ as Ac,sM as uh,sN as mh,sO as hh,sP as fh,sQ as ph,sR as Ec,sS as Ot,fe as Ct,fu as ct,fs as Un,ft as he,fx as Kn,fw as _t,fA as ge,I as gt,oH as Ic,oR as Rc,mV as Ut,mU as rn,cf as Ds,lz as gh,mT as Tc,eN as Dc,rm as Oc,o6 as xh,mS as bh,sT as yh,sU as Qo,sV as vh,sW as on,sX as Mc,bP as Os,ih as _c,sY as wh,pE as jh,sZ as kh,s_ as Pc,s$ as Sh,t0 as Ch,gk as Nh,a_ as lo,mW as uo,t1 as Ah,gR as Ms,t2 as Sn,t3 as mo,q as ms,kx as Lc,t4 as Eh,o as Fc,t5 as Ih,ke as Xo,lZ as Rh,oo as Th,t6 as Dh,c1 as Oh,t7 as Mh,aj as ho,ai as fo,n1 as $c,n0 as Bc,t8 as _h,ds as _s,lk as zc,t9 as Ph,ta as Lh,tb as Fh,tc as $h,td as Bh,te as zh,tf as Uh,hI as po,pk as Kh,tg as Uc,nt as Hh,l0 as jr,ee as Wh,th as Ps,mY as Ls,ti as Fs,tj as Gh,mX as qh,i6 as go,mZ as Kc,tk as Yh,qe as Vh,tl as Qh,tm as Xh,tn as Jo,to as Jh,tp as Zh,tq as ef,tr as tf,ts as Zo,tt as nf,tu as sf,tv as rf,tw as of,tx as ea,e as Pt,ty as af,tz as cf,kI as $s,kM as Hc,tA as lf,gT as Wc,kE as df,kT as uf,tB as mf,b6 as hf,jw as ff,tC as pf,tD as hs,kY as Gc,tE as qc,tF as gf,tG as xf,tH as Yc,tI as ta,tJ as na,tK as Vc,b5 as bf,tL as yf,tM as Qc,tN as qn,tO as vf,tP as wf,tQ as jf,tR as Xc,gQ as Bs,tS as kr,tT as kf,cs as yn,H as Jc,aV as Sf,tU as Zc,dX as sa,k7 as xo,bj as Cf,t as Nf,il as Sr,hU as Af,aQ as bo,i2 as el,tV as Ef,lQ as If,lR as Rf,oL as Tf,k_ as Df,tW as Of,k$ as ra,kU as tl,fX as Mf,fY as _f,fZ as Pf,f_ as Lf,f$ as Ff,g0 as $f,g1 as Bf,tX as zf,tY as Cr,tZ as Uf,t_ as qs,t$ as Kf,u0 as Hf,u1 as On,u2 as Wf,u3 as oa,my as Gf,kN as qf,u4 as Yf,jX as Vf,jY as Qf,ba as fs,jZ as Xf,j_ as aa,m6 as ia,m4 as Jf,m5 as ca,u5 as Zf,u6 as ep,u7 as tp,u8 as np,eU as sp,u9 as rp,ua as op,ub as ap,bS as ip,uc as cp,ud as nl,ue as sl,O as yo,Q as vo,U as wo,uf as lp,ug as dp,bM as up,fM as mp,uh as Ys,hB as hp,ui as fp,uj as pp,uk as gp,ul as xp,um as bp,un as yp,uo as vp,up as wp,uq as jp,ur as la,ju as kp,bL as Sp,us as rl,ut as Cp,fh as Np,uu as da,hT as Ap,uv as Ep,uw as Ip,oM as Rp,ux as Tp,uy as Dp,ca as Op,uz as Mp,uA as ua,uB as _p,uC as Pp,oG as Lp,oZ as Fp,jM as $p,a9 as ol,uD as Bp,jG as zp,jH as Up,ll as Kp,e_ as al,e$ as il,f0 as cl,f1 as ll,dv as Hp,ex as Wp,eY as Gp,eZ as qp,iY as Yp,j3 as Vp,lp as Qp,iZ as Xp,uE as Jp,eD as Zp,lq as eg,uF as dl,uG as tg,uH as ng,lo as sg,ln as rg,i_ as og,eG as ag,jR as ig,iP as cg,uI as lg,uJ as ul,uK as zs,bi as ml,$ as hl,uL as fl,pn as dg,bg as ug,bh as mg,eQ as ma,bf as hg,hd as Vs,hl as Qs,ew as fg,uM as jo,n as pg,aS as ha,oK as gg,bC as pl,uN as gl,uO as xl,py as xg,uP as bg,uQ as yg,uR as Zt,df as vg,uS as fa,n8 as wg,na as bl,dA as jg,jC as kg,on as Sg,uT as Nr,fN as Cg,ik as Ng,nl as ut,nn as Ag,ra as Eg,nV as pa,cL as Ig,uU as Rg,uV as Tg,uW as Dg,uX as Og,uY as Mg,uZ as _g,u_ as Pg,u$ as Lg,v0 as Fg,rA as $g,kr as Bg,hz as zg,v1 as Ug,v2 as Kg,v3 as Hg,v4 as Wg,v5 as Gg,v6 as qg,cm as Yg,v7 as Vg,v8 as Qg,j7 as Xg,c_ as Jg}from"./index-DKTd8X7n.js";import{u as Zg,g as ex}from"./use-connector-management-PDVdWccW.js";import{D as Nt,a as tx}from"./TourHost--UYZoKlJ.js";import{r as nx,f as sx,a as rx,K as ox}from"./RuntimeConnectFlow-DN2ElvcH.js";import{O as ax,B as yl}from"./banner-C7kHJJGz.js";import{u as Us,P as vl,a as ix}from"./ProfileRolePicker-hQbo8P6M.js";import{u as cx}from"./use-dev-links-BoZCIc4h.js";import{B as lx,u as dx}from"./use-bindings-BPNK3sUh.js";import{C as ko,o as wl,O as jl,p as at,H as ux,q as wt,I as nt,t as ps,s as Hn,v as kl,x as mx,y as Sl,z as hx,u as Cl,r as fx,w as px,b as gx,j as xx,A as Ar,T as bx,a as yx,P as vx,B as wx,e as Nl,D as Al,E as El,F as jx,G as kx,h as Sx,S as ga,n as Cx,J as Nx}from"./SeenDevices-D_FnsL7V.js";import{d as Ax}from"./untrusted-text-pHjcUwfI.js";import{S as Nn}from"./scroll-area-DVd6ctli.js";import{T as Il,a as Rl,b as ts,c as Xs,u as Ex,i as Ix,d as Rx,P as Tl}from"./PreviewRefusedNotice-Ux5sq2Om.js";import{P as Tx}from"./paperclip-DQQVX5tJ.js";import{L as Dx}from"./lightbulb-DwGE7s99.js";import{u as Wn}from"./use-update-config-NRkQbxae.js";import{a as Ox,u as Mx,S as _x,s as Px,b as Lx,P as Fx}from"./ApplyToOverridesDialog-By8jgPX3.js";import{r as Dl,s as xa,e as $x}from"./access-copy-BZNjpw9v.js";import{t as Bx,I as ba}from"./trust-posture-DszobEjt.js";import{a as zx}from"./use-pulse-freshness-CGqANpVO.js";import{c as Ux,B as Kx,w as Hx,b as Wx,a as Gx,e as qx}from"./primer-trigger-DH4xfrlM.js";import{M as Yx,u as Vx,s as Qx,P as Xx,a as Jx}from"./use-promo-activation-CjtGhz_3.js";import{u as Ol}from"./use-promo-dismissals-4rbLgSDG.js";import{u as Ml}from"./use-pending-read-DBaC7e8N.js";import{a as pt}from"./dorkbot-templates-8Yu9POWJ.js";import{i as Zx,O as _l,c as eb,b as tb}from"./OperatorIdentityForm-ZAbJ4FJn.js";import{A as Pl}from"./repeat-DPzic7-j.js";import{S as Ll,P as nb}from"./progress-BB97hlmb.js";import{P as sb,M as rb}from"./plug-CadJyjTp.js";import{i as So,a as ob,u as ab}from"./use-notification-prefs-B8LHpZTt.js";import{R as ib}from"./rotate-cw-mHsqEte-.js";import{b as cb,u as lb,O as db,c as ub}from"./OpenMeshSwitch-BBzgYSUc.js";import{u as mb,a as hb,C as fb,N as pb}from"./NewDirectMessageMenu-Be_4mBPd.js";import{P as gb,C as xb,f as bb,a as yb}from"./find-latest-widget-fence-DPQimlUD.js";import{o as vb}from"./owner-notice-C-Q9ySA7.js";import{a as Fl,C as wb}from"./cpu-CFIu4JtK.js";import{U as jb}from"./unplug-xlfZ61jC.js";import{c as kb,H as $l,a as Bl,b as zl}from"./RuntimeSetupDialog-CUFie4LV.js";import{P as ya}from"./page-container-D03bhclt.js";import{A as Sb}from"./AttentionSignalRow-CgGyTDmT.js";import{u as Ks}from"./use-is-hub-CvEPWuj0.js";import{u as Cb}from"./use-roving-tab-list-BzsrpjWV.js";import{R as Ul}from"./rotate-ccw-clock-gqBy98sI.js";import{d as et,e as Ce,f as va,g as Kl,C as Hl,a as Wl,b as Gl,c as Nb}from"./command-srO4Wv-5.js";import{A as Ab,M as Eb}from"./McpAppFrame-Cz-Ttlqr.js";import{L as Ib}from"./layers-CzyhuVSM.js";import{A as Rb}from"./AgentOptionRow-CF5XZmBx.js";import{R as Tb}from"./radio-DrpN3x3S.js";import{a as Db}from"./sound-D3r8dGFH.js";import{d as Ob}from"./connection-copy--MA7AN04.js";import{P as Mb}from"./path-input-CQ16nhYd.js";import"./WidgetErrorCard-CAUx4KUI.js";import{a as _b}from"./ComputerResourceView-PA9T4FZP.js";import{P as Pb,u as Lb}from"./pane-resize-handle-CZ9rHhNr.js";import{u as ql}from"./use-is-below-desktop-pvzUlnxh.js";import{a as Fb,u as $b}from"./use-panel-tab-placements-DOXj0Pii.js";import{u as Bb}from"./use-direct-message-panel-Cs4I6669.js";import{u as zb}from"./ComputerViewer-CnYUWQBS.js";import{a as Ub}from"./use-local-browser-CF0uGQ6e.js";import{F as Kb}from"./file-text-BJt8biPY.js";import"./use-relay-config-CvU_70WJ.js";import"./use-external-adapter-catalog-PBrsasQ8.js";import"./use-adapter-catalog-CytBTafV.js";import"./inline-code-DlVYFFW7.js";import"./useMutationState-BAU_J-u3.js";import"./runtime-connect-Dn0T5YWv.js";import"./execution-config-afKaYukD.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./shield-x-Btfd3Xnx.js";import"./use-full-activity-feed-C2seN-V1.js";import"./profile-errors-DSnHlauU.js";import"./use-mounted-ref-BtAb14HI.js";import"./ProfileFields-kBzeRPfc.js";import"./use-mesh-topology-CnCeK4gS.js";import"./card-D4ek-VvX.js";import"./list-runtime-types-D5ZO30FL.js";import"./more-details-DRPervoL.js";import"./index-CSqz4B0v.js";import"./markdown-content-CN_dGlgE.js";import"./table-BIdFvzBs.js";import"./package-BVNiaGrb.js";import"./heart-DnR_GX4I.js";import"./git-branch-D5xr7U5P.js";import"./file-C-ooqbRY.js";function Hb({children:e,isValidProp:t,...s}){t&&$u(t);const r=u.useContext(Ho);s={...r,...s},s.transition=Bu(s.transition,r.transition),s.isStatic=Yr(()=>s.isStatic);const o=u.useMemo(()=>s,[JSON.stringify(s.transition),s.transformPagePoint,s.reducedMotion,s.skipAnimations]);return n.jsx(Ho.Provider,{value:o,children:e})}function Wb(e){e.values.forEach(t=>t.stop())}function Er(e,t){[...t].reverse().forEach(r=>{const o=e.getVariant(r);o&&Hi(e,o),e.variantChildren&&e.variantChildren.forEach(a=>{Er(a,t)})})}function Gb(e,t){if(Array.isArray(t))return Er(e,t);if(typeof t=="string")return Er(e,[t]);Hi(e,t)}function qb(){const e=new Set,t={subscribe(s){return e.add(s),()=>void e.delete(s)},start(s,r){const o=[];return e.forEach(a=>{o.push(zu(a,s,{transitionOverride:r}))}),Promise.all(o)},set(s){return e.forEach(r=>{Gb(r,s)})},stop(){e.forEach(s=>{Wb(s)})},mount(){return()=>{t.stop()}}};return t}function Yb(){const e=Yr(qb);return Uu(e.mount,[]),e}class Vb{constructor(){this.componentControls=new Set}subscribe(t){return this.componentControls.add(t),()=>this.componentControls.delete(t)}start(t,s){this.componentControls.forEach(r=>{r.start(t.nativeEvent||t,s)})}cancel(){this.componentControls.forEach(t=>{t.cancel()})}stop(){this.componentControls.forEach(t=>{t.stop()})}}const Qb=()=>new Vb;function Xb(){return Yr(Qb)}const Jb=`${Vr.repo}/issues/new`,Zb={"tunnel.enabled":"boolean","tasks.enabled":"boolean","relay.enabled":"boolean","scheduler.enabled":"boolean","mesh.enabled":"boolean","mcp.enabled":"boolean","telemetry.install":"boolean","telemetry.heartbeat":"boolean","telemetry.errorReporting":"boolean","auth.enabled":"boolean","workspace.enabled":"boolean","harness.autoSync":"boolean","harness.autoAdopt":"boolean","runtimes.codex.enabled":"boolean","runtimes.opencode.enabled":"boolean","runtimes.default":"enum","logging.level":"enum","ui.theme":"enum"},ey={"runtimes.default":["claude-code","codex","opencode","doe"],"logging.level":["fatal","error","warn","info","debug","trace"],"ui.theme":["light","dark","system"]},ty=/^[a-z0-9][a-z0-9._-]{0,31}$/,ny={bug:["bug"],feature:["enhancement"],runtime:["bug"]},sy={bug:"Bug: (describe what went wrong)",feature:"Feature: (describe what you want)",runtime:"Runtime issue: (describe what went wrong)"};function ry(e){return e.replace(/\b(?:sk-|pk-|rk-|ghp_|gho_|ghu_|ghs_|github_pat_|glpat-|npm_|xox[baprsc]-)[A-Za-z0-9._-]+/g,"[redacted]").replace(/\b(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA)[0-9A-Z]{16}\b/g,"[redacted]").replace(/\bBearer\s+[A-Za-z0-9._-]+/gi,"[redacted]")}function Co(e){return ry(e).replace(/[^\s/@]+@[^\s/@]+\.[^\s/@]+/g,"[email]").replace(/\b\d{1,3}(?:\.\d{1,3}){3}\b/g,"[ip]").replace(/\b(?:[A-Fa-f0-9]{1,4}:){2,7}[A-Fa-f0-9]{1,4}\b/g,"[ip]").replace(new RegExp("(?<![\\w:.])(?:[A-Fa-f0-9]{1,4})?(?::[A-Fa-f0-9]{0,4}){2,}(?![\\w:.])","g"),"[ip]").replace(/\\\\[^\s\\]+(?:\\[^\s\\]+)+/g,"[path]").replace(/(^|[\s"'`(<[{])\/\/[^\s"'`)>\]}/]+\/[^\s"'`)>\]}]+/g,"$1[path]").replace(/\b[A-Za-z]:\\[^\r\n]*/g,"[path]").replace(/(^|[\s"'`(<[{/:])(~|\/(?:Users|home))\/[^\s"'`)>\]}]+/g,"$1[home]").replace(/(^|[\s"'`(<[{])\/[\w.-]+(?:\/[\w.-]*)+/g,"$1[path]").replace(/\b(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,"[redacted]")}function oy(e,t){const s=ey[e];return s?s.includes(t):ty.test(t)&&Co(t)===t}function ay(e){const t={};for(const[s,r]of Object.entries(Zb)){const o=e[s];o!=null&&(r==="boolean"&&typeof o=="boolean"||r==="number"&&typeof o=="number"&&Number.isFinite(o)||r==="enum"&&typeof o=="string"&&oy(s,o))&&(t[s]=o)}return t}const iy=["details","summary"];function No(e){return Ax(Co(e),iy)}function cy(e){const t=e.runtimes.length>0?e.runtimes.join(", "):"none configured",s=Object.entries(e.flags).map(([o,a])=>`- ${o}: ${String(a)}`).join(`
|
|
2
|
+
`),r=[`- DorkOS version: ${e.version}`,`- OS / arch: ${e.platform}`,`- Runtimes configured: ${t}`,`- Reported from: ${e.surface}`,"","Settings (on/off values only, no secrets or file paths):",s.length>0?s:"- (none available)"];return Co(r.join(`
|
|
3
|
+
`))}function ly(e){var s;const t=(s=e.body)==null?void 0:s.trim();return t?[No(t)]:e.kind==="feature"?["## What do you want DorkOS to do?","","","## Why would it help?","",""]:["## What happened?","","","## What did you expect?","","","## Steps to reproduce","","1. ","2. ","3. "]}function dy(e){return["<details><summary>Environment</summary>","",cy(e),"","</details>","","DorkOS filled in the details above. Please check them and remove anything you do not want to share.","","---","",...ly(e)].join(`
|
|
4
|
+
`)}function Js(e){var r;const t=(r=e.title)==null?void 0:r.trim(),s=new URLSearchParams({title:No(t||sy[e.kind]),body:dy(e),labels:ny[e.kind].join(",")});return`${Jb}?${s.toString()}`}const uy=6e3,wa=`
|
|
5
|
+
|
|
6
|
+
… (shortened to fit the link; paste the rest yourself)`;function ja(e){return new TextEncoder().encode(e).length}function ka(e,t){return Array.from(e).slice(0,t).join("")}function my(e,t=uy){var d;const s=Js(e);if(ja(s)<=t)return{url:s,truncated:!1};const r=((d=e.body)==null?void 0:d.trim())??"";if(!r)return{url:s,truncated:!1};const o=Array.from(r).length;let a=0,i=o;for(;a<i;){const l=Math.ceil((a+i)/2),m={...e,body:ka(r,l)+wa};ja(Js(m))<=t?a=l:i=l-1}const c={...e,body:ka(r,a)+wa};return{url:Js(c),truncated:!0,fullBody:No(r)}}function hy(e){return my(e).url}function fy(e){var t,s,r,o,a,i,c,d,l,m;return{"tunnel.enabled":(t=e.tunnel)==null?void 0:t.enabled,"tasks.enabled":(s=e.tasks)==null?void 0:s.enabled,"relay.enabled":(r=e.relay)==null?void 0:r.enabled,"mesh.enabled":(o=e.mesh)==null?void 0:o.enabled,"mcp.enabled":(a=e.mcp)==null?void 0:a.enabled,"telemetry.install":(i=e.telemetry)==null?void 0:i.install,"telemetry.heartbeat":(c=e.telemetry)==null?void 0:c.heartbeat,"telemetry.errorReporting":(d=e.telemetry)==null?void 0:d.errorReporting,"auth.enabled":(l=e.auth)==null?void 0:l.enabled,"logging.level":(m=e.logging)==null?void 0:m.level}}function Yl(e,t,s){return{kind:e,version:(t==null?void 0:t.version)??"unknown",platform:(t==null?void 0:t.platform)??"unknown",runtimes:(t==null?void 0:t.runtimes)??[],surface:`web ${s}`.trim(),flags:t?ay(fy(t)):{}}}function py(){const e=ae(),{data:t}=Ie({queryKey:Be.current(),queryFn:()=>e.getConfig(),staleTime:300*1e3}),s=_e({select:r=>r.location.pathname});return u.useCallback(r=>{const o=hy(Yl(r,t,s));Rn(o)},[t,s])}const gy=100;function xy({cwd:e,isStreaming:t,color:s}){const r=u.useRef(""),o=u.useRef([]),a=u.useRef(null),i=u.useRef(0),c=u.useRef(t);u.useEffect(()=>{c.current=t},[t]);const d=u.useCallback(()=>{a.current&&(clearInterval(a.current),a.current=null),o.current.length!==0&&(i.current=0,a.current=window.setInterval(()=>{const m=o.current;m.length!==0&&(Gs(m[i.current]),i.current=(i.current+1)%m.length)},gy))},[]),l=u.useCallback(()=>{a.current&&(clearInterval(a.current),a.current=null),r.current&&Gs(r.current)},[]);u.useEffect(()=>{if(!e)return;const m=s??as(e),f=Ku(m);r.current=f,o.current=[],Gs(f);let p=!1;return Hu(f).then(h=>{p||(o.current=h,c.current&&d())}).catch(()=>{}),()=>{p=!0}},[e,s,d]),u.useEffect(()=>(t?d():l(),l),[t,d,l])}function by(e,t){const[s,r]=u.useState(()=>document.hidden),[o,a]=u.useState(!1);u.useEffect(()=>{const d=()=>{r(document.hidden),document.hidden||a(!1)};return document.addEventListener("visibilitychange",d),()=>document.removeEventListener("visibilitychange",d)},[]);const i=u.useRef(t);u.useEffect(()=>{i.current&&!t&&document.hidden&&a(!0),i.current=t},[t]);const c=e({hidden:s,unseenReply:o});u.useEffect(()=>{document.title=c},[c])}function yy(){const e=le();we("account_usage",t=>{const s=t;!s||typeof s.runtime!="string"||e.getQueryData(Wu.usage(s.runtime))!==void 0&&Gu(e,s.runtime,[s])})}function vy(e,t,s,r){let o;switch(e){case"ArrowRight":o=t+1;break;case"ArrowLeft":o=t-1;break;case"ArrowDown":o=t+s;break;case"ArrowUp":o=t-s;break;case"Home":o=0;break;case"End":o=r-1;break;default:return null}return Math.max(0,Math.min(r-1,o))}function wy(e){const[t,s]=u.useState(0),r=u.useRef([]);function o(){const l=r.current.slice(0,e).filter(Boolean);if(l.length===0)return 1;const m=l[0].offsetTop;return Math.max(1,l.filter(f=>f.offsetTop===m).length)}function a(l){var f;const m=Math.max(0,Math.min(e-1,l));s(m),(f=r.current[m])==null||f.focus()}function i(l){return m=>{r.current[l]=m}}function c(l){return t===l?0:-1}function d(l,m){const f=vy(l.key,m,o(),e);f!==null&&(l.preventDefault(),a(f))}return{focusIndex:t,setRef:i,tabIndexFor:c,handleKeyDown:d,moveFocus:a}}function Vl(){const[e,t]=u.useState(Sa);return u.useEffect(()=>{const s=window.visualViewport,r=()=>{const o=Sa();t(a=>a.top===o.top&&a.height===o.height?a:o)};return window.addEventListener("resize",r),s==null||s.addEventListener("resize",r),s==null||s.addEventListener("scroll",r),()=>{window.removeEventListener("resize",r),s==null||s.removeEventListener("resize",r),s==null||s.removeEventListener("scroll",r)}},[]),e}function Sa(){if(typeof window>"u")return{top:0,height:0};const e=window.visualViewport;return e&&e.scale<=1?{top:Math.max(0,e.offsetTop),height:e.height}:{top:0,height:window.innerHeight}}/**
|
|
7
|
+
* @license lucide-react v1.48.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Ql={name:"building-complex",size:24,node:[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],aliases:["building-2"]};Ql.node;const jy=Ge(Ql);/**
|
|
12
|
+
* @license lucide-react v1.48.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Xl={name:"camera",size:24,node:[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]};Xl.node;const ky=Ge(Xl);/**
|
|
17
|
+
* @license lucide-react v1.48.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Jl={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};Jl.node;const Sy=Ge(Jl);/**
|
|
22
|
+
* @license lucide-react v1.48.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const Zl={name:"circle-plus",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],aliases:["plus-circle"]};Zl.node;const Cy=Ge(Zl);/**
|
|
27
|
+
* @license lucide-react v1.48.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const ed={name:"coffee",size:24,node:[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]};ed.node;const td=Ge(ed);/**
|
|
32
|
+
* @license lucide-react v1.48.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const nd={name:"compass",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]]};nd.node;const Ny=Ge(nd);/**
|
|
37
|
+
* @license lucide-react v1.48.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const sd={name:"copy-plus",size:24,node:[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};sd.node;const Ay=Ge(sd);/**
|
|
42
|
+
* @license lucide-react v1.48.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const rd={name:"crosshair",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]};rd.node;const gs=Ge(rd);/**
|
|
47
|
+
* @license lucide-react v1.48.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const od={name:"folder-search",size:24,node:[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]};od.node;const Ey=Ge(od);/**
|
|
52
|
+
* @license lucide-react v1.48.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const ad={name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]};ad.node;const Iy=Ge(ad);/**
|
|
57
|
+
* @license lucide-react v1.48.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const id={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};id.node;const Ry=Ge(id);/**
|
|
62
|
+
* @license lucide-react v1.48.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const cd={name:"square-arrow-out-up-right",size:24,node:[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],aliases:["arrow-up-right-from-square"]};cd.node;const Ty=Ge(cd);/**
|
|
67
|
+
* @license lucide-react v1.48.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const ld={name:"venetian-mask",size:24,node:[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]};ld.node;const Dy=Ge(ld),Ca=16,Oy=280,My=180;function Na(e,t,s){const r=Math.max(t,window.innerWidth-Ca),o=Math.max(s,window.innerHeight-Ca),a=Math.min(Math.max(e.width,t),r),i=Math.min(Math.max(e.height,s),o),c=Math.min(Math.max(e.x,0),Math.max(0,window.innerWidth-a)),d=Math.min(Math.max(e.y,0),Math.max(0,window.innerHeight-i));return{x:c,y:d,width:a,height:i}}function _y(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Py(e){const{title:t,geometry:s,onGeometryChange:r,onClose:o,onRestore:a,minWidth:i,minHeight:c,children:d,className:l}=e,m=u.useRef(null),f=i??Oy,p=c??My;u.useEffect(()=>{const y=()=>{const A=Na(s,f,p);_y(A,s)&&r(A)};return y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[s,f,p,r]);const h=u.useRef(null);u.useEffect(()=>()=>{var y;return(y=h.current)==null?void 0:y.call(h)},[]);const g=u.useCallback((y,A)=>{var j;y.preventDefault();const S=m.current;if(!S)return;const I=S;(j=h.current)==null||j.call(h);const v=y.clientX,E=y.clientY,R=s;let _=R,D=0;function O(){D=0,I.style.left=`${_.x}px`,I.style.top=`${_.y}px`,I.style.width=`${_.width}px`,I.style.height=`${_.height}px`}function T(k){_=A(k.clientX-v,k.clientY-E,R),D||(D=requestAnimationFrame(O))}function w(){D&&cancelAnimationFrame(D),D=0,document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",C),document.removeEventListener("pointercancel",C),h.current=null}function C(){w(),r(Na(_,f,p))}document.addEventListener("pointermove",T),document.addEventListener("pointerup",C),document.addEventListener("pointercancel",C),h.current=w},[s,f,p,r]),x=u.useCallback(y=>{y.target.closest("button")||g(y,(A,S,I)=>({...I,x:I.x+A,y:I.y+S}))},[g]),b=u.useCallback(y=>{y.stopPropagation(),g(y,(A,S,I)=>({...I,width:Math.max(f,I.width+A),height:Math.max(p,I.height+S)}))},[g,f,p]);return js.createPortal(n.jsxs(se.div,{ref:m,"data-slot":"floating-panel",role:"complementary","aria-label":t,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15,ease:[0,0,.2,1]},style:{left:s.x,top:s.y,width:s.width,height:s.height},className:K("bg-card border-border shadow-floating fixed z-40 flex flex-col overflow-hidden rounded-lg border",l),children:[n.jsxs("div",{onPointerDown:x,className:"border-border flex cursor-grab items-center gap-1 border-b px-3 py-2 select-none active:cursor-grabbing",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:t}),a?n.jsx(L,{variant:"ghost",size:"icon-sm","aria-label":"Restore",onClick:a,className:"text-muted-foreground hover:text-foreground",children:n.jsx(gb,{})}):null,n.jsx(L,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:o,className:"text-muted-foreground hover:text-foreground",children:n.jsx(Ue,{})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:d}),n.jsx("div",{"aria-hidden":!0,onPointerDown:b,className:"absolute right-0 bottom-0 size-4 cursor-nwse-resize"})]}),document.body)}function Ly({...e}){const{theme:t}=Wi();return n.jsx(qu,{theme:t,className:"toaster group",icons:{success:n.jsx(ks,{className:"size-4"}),info:n.jsx(qi,{className:"size-4"}),warning:n.jsx(Gi,{className:"size-4"}),error:n.jsx(ax,{className:"size-4"}),loading:n.jsx(De,{})},style:{"--normal-bg":"var(--color-popover)","--normal-text":"var(--color-popover-foreground)","--normal-border":"var(--color-border)","--border-radius":"var(--radius)"},...e})}async function Fy(){var t;if(!ze())return;const e=(t=window.electronAPI)==null?void 0:t.getShellLogExcerpt;if(typeof e=="function")try{const s=await e();return s&&s.length>0?s:void 0}catch{return}}const dd="root";function ud(){return document.getElementById(dd)??document.body}const Aa=2e4;class st extends Error{constructor(s,r){super(r);bn(this,"reason");this.name="AppCaptureError",this.reason=s}}function $y(){const e=typeof window<"u"?window.electronAPI:void 0;if(typeof(e==null?void 0:e.captureAppView)!="function")return null;const{captureAppView:t}=e;return()=>t()}function By(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}function zy(){const e=[];for(const t of Array.from(document.body.children)){if(!(t instanceof HTMLElement)||t.id===dd)continue;const s=t.style.opacity;t.style.opacity="0",e.push(()=>{t.style.opacity=s})}return()=>{for(const t of e)t()}}async function Uy(e){const t=await e().catch(s=>{throw new st("failed",`The desktop bridge threw: ${String(s)}`)});if(!t.ok)throw new st("failed",t.message);return{dataUrl:t.dataUrl,region:{left:0,top:0,width:window.innerWidth,height:window.innerHeight}}}async function Ky(){let e;try{({snapdom:e}=await Yu(()=>import("./snapdom-SRLjr6oU.js"),[]))}catch(r){const o=r instanceof Error?r.message:String(r);throw new st("unsupported",`Loading the screenshot library failed: ${o}`)}const t=ud(),s=getComputedStyle(document.body).backgroundColor;try{const r=t.getBoundingClientRect();return{dataUrl:(await e.toPng(t,{backgroundColor:s})).src,region:{left:r.left,top:r.top,width:r.width,height:r.height}}}catch(r){const o=r instanceof Error?r.message:String(r);throw new st("failed",`Rendering the app to an image failed: ${o}`)}}async function Hy(e){let t;const s=new Promise((r,o)=>{t=setTimeout(()=>{o(new st("failed",`The capture did not finish in ${Aa}ms.`))},Aa)});try{return await Promise.race([e,s])}finally{clearTimeout(t),e.catch(()=>{})}}async function Wy(){const e=$y(),t=zy();try{return await By(),await Hy(e?Uy(e):Ky())}finally{t()}}let vn=null;function md(){if(vn)return vn;const e=Wy();vn=e;const t=()=>{vn===e&&(vn=null)};return e.then(t,t),e}function Gy(){return md().then(e=>e.dataUrl)}function qy(){if(typeof window>"u")return;const{innerWidth:e,innerHeight:t,devicePixelRatio:s}=window;if(!(typeof e!="number"||typeof t!="number"))return{width:Math.round(e),height:Math.round(t),devicePixelRatio:typeof s=="number"?s:1}}function Yy(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}}function Vy(e){const t=qy(),s=typeof navigator<"u"?navigator.userAgent:void 0,r=typeof navigator<"u"?navigator.language:void 0,o=Yy();return{theme:e,shell:ze()?"desktop-app":"browser",...t?{viewport:t}:{},...s?{browser:s.slice(0,Vu)}:{},...r?{locale:r.slice(0,Wo)}:{},...o?{timezone:o.slice(0,Wo)}:{}}}function Hs(e){return t=>()=>{e(),t()}}const Qy=2e3,Xy=.8,Jy=1400,Zy=.6,ns=6e5,xs=1e4,ev=["image/webp","image/jpeg","image/png"],tv=/^data:image\/(webp|png|jpeg);base64,/;class Kt extends Error{constructor(s,r){super(r);bn(this,"reason");this.name="ImageCompressError",this.reason=s}}function nv(e){return tv.test(e)&&e.length<=ns}function sv(e){return new Promise((t,s)=>{const r=new Image,o=setTimeout(()=>{s(new Kt("unreadable",`Decoding timed out after ${xs}ms.`))},xs);r.onload=()=>{clearTimeout(o),t(r)},r.onerror=()=>{clearTimeout(o),s(new Kt("unreadable",`Could not decode the image at ${e.slice(0,32)}…`))},r.src=e})}function rv(e,t){for(const s of ev){const r=e.toDataURL(s,t);if(r.startsWith(`data:${s};base64,`))return r}throw new Kt("unsupported","This canvas produced no usable image encoding.")}function Ea(e,t,s=Qy){const r=Math.min(1,s/Math.max(e,t));return{width:Math.max(1,Math.round(e*r)),height:Math.max(1,Math.round(t*r))}}function Ia(e,t,s){const r=document.createElement("canvas");r.width=t.width,r.height=t.height;const o=r.getContext("2d");if(!o)throw new Kt("unsupported","This browser gave no 2d canvas context.");return o.drawImage(e,0,0,t.width,t.height),rv(r,s)}async function Ir(e){const t=typeof e=="string"?null:URL.createObjectURL(e);let s;try{s=await sv(t??e)}finally{t&&URL.revokeObjectURL(t)}const r=s.naturalWidth||s.width,o=s.naturalHeight||s.height;if(r<=0||o<=0)throw new Kt("unreadable","The image decoded to zero pixels.");let a=Ia(s,Ea(r,o),Xy);if(a.length>ns&&(a=Ia(s,Ea(r,o,Jy),Zy)),a.length>ns)throw new Kt("too-large",`Compressed to ${a.length} characters, over the ${ns} cap.`);return a}const ov=500;function av(e=ov){const t=le(),s=Qu({coalesceMs:e,shouldFlush:()=>t.isMutating({mutationKey:Yi})===0});we("config_changed",()=>{const r={queryKey:Be.current()};s([r])})}const hd="dorkbot",iv=["mesh","agent-paths"];function cv(e){var r,o;const t=(r=e==null?void 0:e.agents)==null?void 0:r.defaultDirectory;if(!t)return"";const s=((o=e==null?void 0:e.agents)==null?void 0:o.defaultAgent)||hd;return`${t}/${s}`}function lv(){var d;const e=Pe(),t=ae(),{data:s}=Le(),{data:r}=Ie({queryKey:[...iv],queryFn:()=>t.listMeshAgentPaths(),staleTime:3e4}),o=((d=s==null?void 0:s.agents)==null?void 0:d.defaultAgent)||hd,a=r==null?void 0:r.agents.find(l=>l.name===o),i=(a==null?void 0:a.projectPath)??cv(s);return{startSession:u.useCallback(()=>{a?e($t({agentId:a.id})):i&&Xu(t,i).then(l=>e(l)).catch(l=>{Vi(t,l),ce.error("Couldn’t open the chat. Try again.")})},[e,i,a,t]),defaultAgentDir:i}}function dv(e){return{pinned:e.pinned??[],groups:e.groups??[],muted:e.muted??[],sections:e.sections??{}}}function uv(){const e=le(),t=Ln();we("community_connections_changed",()=>{t&&e.invalidateQueries({queryKey:jt.connections(t),exact:!0})})}function fd(e){const t=ae(),s=e!==null&&e.status!=="pending",r=Ln(s),o=(e==null?void 0:e.ref)??"";return Ie({queryKey:r?jt.disconnectImpact(r,o):[...jt.all,"owner","unresolved",o,"disconnect-impact"],queryFn:()=>Qi(r,()=>t.getCommunityDisconnectImpact(o)),enabled:s&&r!==null,staleTime:0,refetchOnMount:"always"})}function pd(e){const t=e.flatMap(r=>r.displayName?[r.displayName]:[]),s=e.length-t.length;return s>0&&t.push(s===1?"an unnamed agent":`${s} unnamed agents`),t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function gd(e,t){return t.length===0?null:t.length===1?t[0].displayName?`The agent you added from here, ${t[0].displayName}, will be removed from ${e}.`:`The agent you added from here will be removed from ${e}.`:`The ${t.length} agents you added from here will be removed from ${e}: ${pd(t)}.`}function xd(e){return`Any agents you added from here will be removed from ${e}.`}function bd(e,{remoteRevoked:t,agentsNotRemoved:s}){const r=pd(s);return s.length===0?t?{tone:"success",message:`${e} is disconnected.`}:{tone:"warning",message:mv(e)}:t?{tone:"warning",message:`Disconnected, but ${r} couldn’t be removed. Remove ${s.length===1?"it":"them"} under Agents on ${e}.`}:{tone:"warning",message:`Disconnected here, but ${e} couldn’t be reached. Remove ${r} and this DorkOS there.`}}function mv(e){return`Disconnected here, but ${e} couldn’t be reached. Finish under Connected installations on ${e}.`}function hv(){const e=ae(),t=P(o=>o.selectedCwd),s=P(o=>o.setSelectedCwd),{data:r}=Ie({queryKey:["defaultCwd"],queryFn:()=>e.getDefaultCwd(),enabled:t===null,staleTime:1/0,refetchOnMount:!1,refetchOnReconnect:!1,networkMode:"always"});u.useEffect(()=>{r!=null&&r.path&&P.getState().selectedCwd===null&&s(r.path)},[r,t,s])}function Ra(e){e.invalidateQueries({queryKey:an.recentRoot})}const fv=5e3;function pv(e,t=fv){let s=-1/0,r=null;const o=()=>{r=null,s=Date.now(),e()};return{request(){if(r!==null)return;const a=s+t-Date.now();a<=0?o():r=setTimeout(o,a)},dispose(){r!==null&&clearTimeout(r),r=null}}}function Ta(e){e.invalidateQueries({queryKey:an.dailyCountsRoot})}function gv(e,t){const s=Object.keys(e);return s.length!==Object.keys(t).length?!0:s.some(r=>!(r in t))}function xv(e,t){e.setQueryData(an.list(t.cwd??null),s=>{const r=s??[];return(r.some(a=>a.id===t.id)?r.map(a=>a.id===t.id?t:a):[t,...r]).sort((a,i)=>i.updatedAt.localeCompare(a.updatedAt))})}function bv(e,t,s){e.setQueryData(an.list(s),r=>r&&r.filter(o=>o.id!==t))}function Da(e,t,s){const r=new Set(Object.keys(t).filter(o=>!(o in s)));r.size!==0&&e.setQueriesData({queryKey:an.listRoot},o=>o!=null&&o.some(a=>r.has(a.id))?o.flatMap(a=>{if(!r.has(a.id))return[a];const i=t[a.id];return o.some(d=>d.id===i)?[]:[{...a,id:i}]}):o)}function Oa(e,t,s){const r=Date.now(),o=[];for(const[a,i]of Object.entries(t))s[a]!==i&&(xv(e,i),o.push(i));Zu(e,o,r);for(const[a,i]of Object.entries(s))t[a]||bv(e,a,i.cwd??null)}function yv(){const e=le();u.useEffect(()=>{Ju();let t={},s={};const r=pv(()=>Ra(e)),o=kt.subscribe(c=>{c.sessions!==t&&(Oa(e,c.sessions,t),r.request(),gv(c.sessions,t)&&Ta(e),t=c.sessions),c.rekeys!==s&&(Da(e,c.rekeys,s),s=c.rekeys)}),a=is.subscribeEvent("session_list_invalidated",()=>{kt.getState().dropSessions(),e.invalidateQueries({queryKey:an.listRoot}),Ra(e),Ta(e)}),i=kt.getState();return Object.keys(i.sessions).length>0&&(Oa(e,i.sessions,t),t=i.sessions),Object.keys(i.rekeys).length>0&&(Da(e,i.rekeys,s),s=i.rekeys),is.connectList(),()=>{o(),a(),r.dispose()}},[e])}function Yt(){const e=ae(),t=le(),{data:s,isLoading:r}=Ie({queryKey:Be.current(),queryFn:()=>e.getConfig(),staleTime:Xi}),o=Ml(r),a={completedSteps:[],skippedSteps:[],startedAt:null,dismissedAt:null,completedAt:null,runtimeDefaultSetAt:null,firstRunPath:null,welcomeEntryId:null,priorRuntime:null},i=s!=null&&s.onboarding?{completedSteps:s.onboarding.completedSteps,skippedSteps:s.onboarding.skippedSteps,startedAt:s.onboarding.startedAt,dismissedAt:s.onboarding.dismissedAt,completedAt:s.onboarding.completedAt??null,runtimeDefaultSetAt:s.onboarding.runtimeDefaultSetAt,firstRunPath:s.onboarding.firstRunPath??null,welcomeEntryId:s.onboarding.welcomeEntryId??null,priorRuntime:s.onboarding.priorRuntime??null}:a,c=i.completedAt!==null,d=i.dismissedAt!==null,m=!o&&s!==void 0&&!c&&!d,f=!o&&c&&!d,p=Wt({mutationFn:b=>e.updateConfig({onboarding:b}),onSuccess:()=>{t.invalidateQueries({queryKey:Be.all})},onError:(b,y)=>{console.error("[onboarding] could not save progress",{fields:Object.keys(y),error:b}),ce.error("Couldn’t save your setup progress",{description:"Keep going. DorkOS tries again."})},meta:{suppressErrorToast:!0}});function h(){return p.mutateAsync({dismissedAt:new Date().toISOString()})}function g(){i.completedAt||p.mutate({completedAt:new Date().toISOString()})}function x(){i.startedAt||p.mutate({startedAt:new Date().toISOString()})}return{state:i,config:s,isLoading:o,isOnboardingComplete:c,isOnboardingDismissed:d,shouldShowOnboarding:m,shouldShowGettingStarted:f,dismiss:h,completeOnboarding:g,startOnboarding:x}}function vv(e){const{shouldShowOnboarding:t,onboardingHiddenForSession:s}=e,r=t&&!s,[o,a]=u.useState(!1);return r&&!o&&a(!0),o&&!s}function wv(){const e=Qr(),t=Gt(),s=Xr({strict:!1}).onboarding,r=Go(s)?s:"welcome",o=u.useRef(!1),a=_e({select:l=>l.status==="idle"}),i=u.useRef(!1);u.useEffect(()=>{if(i.current||!a||(i.current=!0,Go(s)))return;const l=m=>({...m,onboarding:"welcome"});e==null||e({search:l,replace:!0})},[a,s,e]);const c=u.useCallback(l=>{const m=f=>({...f,onboarding:l});o.current=!0,e==null||e({search:m})},[e]),d=u.useCallback(l=>{if(o.current){t.history.back();return}const m=f=>({...f,onboarding:l});e==null||e({search:m})},[t,e]);return{stage:r,goToStage:c,goBack:d}}function jv(e){const{done:t,overlayVisible:s}=e,r=Qr(),o=Xr({strict:!1}).onboarding;u.useEffect(()=>{if(!o||!t||s)return;const a=i=>({...i,onboarding:void 0});r==null||r({search:a,replace:!0})},[o,t,s,r])}function yd(e){try{if(e.verificationUriComplete){const s=new URL(e.verificationUriComplete);if(s.protocol==="https:"||s.protocol==="http:")return s.href}const t=new URL(e.verificationUri);return t.protocol!=="https:"&&t.protocol!=="http:"?null:(t.searchParams.set("code",e.userCode),t.href)}catch{return null}}const kv=2500,Sv="Couldn’t finish setup. Try again.";function Mn(e){return e instanceof Error&&e.message&&!/^HTTP \d+$/.test(e.message)?e.message:Sv}function Ao(){const e=ae(),t=le();return Wt({mutationFn:s=>e.chooseFirstRunPath(s),onSettled:()=>{for(const s of[Be.all,em,Ji.status()])t.invalidateQueries({queryKey:s});t.invalidateQueries({queryKey:tm})},meta:{suppressErrorToast:!0}})}function Cv(e){const t=ae(),{data:s}=Ie({queryKey:Ji.status(),queryFn:()=>t.getCloudCredits(),enabled:e,refetchInterval:e?kv:!1,refetchIntervalInBackground:e,staleTime:0});if(s)return s.readiness??(s.linked?"linked":"unlinked")}function Nv(){const e=ae(),t=le();return Wt({mutationFn:()=>e.postOnboardingWelcome(),onSettled:()=>void t.invalidateQueries({queryKey:Be.all}),meta:{suppressErrorToast:!0}})}function Av({link:e,waitingWindowRef:t,onReady:s}){const r=Ao(),[o,a]=u.useState(null),[i,c]=u.useState(!1),d=Cv(i),l=i?d:void 0,m=u.useRef(e),f=u.useRef(r.mutateAsync),p=u.useRef(s);u.useEffect(()=>{m.current=e,f.current=r.mutateAsync,p.current=s});const h=u.useCallback(()=>{var S;(S=t.current)==null||S.close(),t.current=null},[t]),g=u.useCallback(async()=>{a(null);try{await f.current({path:"dorkos"})}catch(v){h(),a(Mn(v));return}c(!0);const S=m.current;if(S.state==="linked"){h();return}if(S.state==="pending")return;await S.start()===null&&(h(),a(m.current.startError??"Couldn’t reach DorkOS. Try again."))},[h]),x=u.useRef(!1);u.useEffect(()=>{x.current||e.state==="loading"||(x.current=!0,g())},[e.state,g]);const b=e.state==="pending"?e.pending:null;u.useEffect(()=>{if(!b||!t.current)return;const S=yd(b);S?t.current.go(S):t.current.close(),t.current=null},[b,t]);const y=u.useRef(!1);u.useEffect(()=>{l!=="ready"||y.current||(y.current=!0,p.current())},[l]);const A=u.useCallback(()=>{var S;if((S=t.current)==null||S.close(),t.current=Jr(),m.current.state==="expired"||m.current.state==="denied"){a(null),m.current.start();return}g()},[g,t]);return{phase:Ev(o,i,e,b,l),retry:A}}function Ev(e,t,s,r,o){return e!==null?{kind:"failed",message:e}:o==="refused"?{kind:"refused"}:o==="needs-card"?{kind:"needs-card"}:s.state==="expired"||s.state==="denied"?{kind:"expired"}:s.state==="linked"&&t?{kind:"finishing"}:r?{kind:"waiting",pending:r}:{kind:"starting"}}function Eo(){const e=u.useRef(null);return u.useEffect(()=>{var t;(t=e.current)==null||t.focus({preventScroll:!0})},[]),e}function vd({phase:e,link:t,onRetry:s,onCancel:r,onUseOwnAi:o}){const a=Eo();return n.jsxs("div",{ref:a,tabIndex:-1,className:"mx-auto flex w-full max-w-sm flex-col items-center px-4 text-center outline-none",role:"region","aria-labelledby":"onboarding-connecting-heading","data-testid":"onboarding-connecting","data-phase":e.kind,children:[n.jsx(Nt,{size:72,className:"mb-6 opacity-90 dark:hidden"}),n.jsx(Nt,{variant:"white",size:72,className:"mb-6 hidden opacity-90 dark:block"}),n.jsx(Iv,{phase:e,link:t,onRetry:s,onUseOwnAi:o}),n.jsx(L,{variant:"ghost",size:"sm",className:"text-muted-foreground mt-8",onClick:r,children:"Cancel"})]})}function Iv({phase:e,link:t,onRetry:s,onUseOwnAi:r}){switch(e.kind){case"starting":return n.jsx(Ma,{heading:"Finish in your browser.",line:"Opening the DorkOS page…"});case"waiting":return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{children:"Finish in your browser."}),n.jsx(Yn,{children:"Sign in, then come back. This screen moves on by itself."}),n.jsx(Rv,{pending:e.pending})]});case"finishing":return n.jsx(Ma,{heading:"Signed in.",line:"Getting your account ready…"});case"needs-card":return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{children:"Add a card to finish."}),n.jsx(Yn,{children:"Your agents start once a card is saved."}),n.jsxs(L,{className:"mt-6",onClick:()=>t==null?void 0:t.openBilling(),disabled:!t||t.billingPending,children:[(t==null?void 0:t.billingPending)&&n.jsx(De,{size:"xs"}),"Add a card"]}),(t==null?void 0:t.billingNotice)&&n.jsx(Rr,{children:t.billingNotice})]});case"refused":return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{children:"Paid plans are US only."}),n.jsx(Yn,{children:"Use your own AI instead."}),n.jsx(L,{className:"mt-6",onClick:r,children:"Use my own AI"})]});case"expired":return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{children:"Your code expired."}),n.jsx(Yn,{children:"Get a new one to finish signing in."}),n.jsx(L,{className:"mt-6",onClick:s,children:"Get a new code"})]});case"failed":return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{children:"Couldn’t start signing in."}),n.jsx(Rr,{children:e.message}),n.jsx(L,{className:"mt-6",onClick:s,children:"Try again"})]})}}function Ma({heading:e,line:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Jt,{children:e}),n.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",role:"status",children:[n.jsx(De,{size:"xs"}),t]})]})}function Jt({children:e}){return n.jsx("h1",{id:"onboarding-connecting-heading",className:"text-2xl font-semibold tracking-tight text-balance",children:e})}function Yn({children:e}){return n.jsx("p",{className:"text-muted-foreground mt-3 text-sm text-balance",children:e})}function Rr({children:e}){return n.jsx("p",{className:"text-destructive mt-3 text-sm text-balance",role:"alert",children:e})}function Rv({pending:e}){const{copied:t,failed:s,copy:r}=Fn(),[o,a]=u.useState(!1),i=yd(e);return n.jsxs("div",{className:"mt-8 w-full space-y-4","data-testid":"onboarding-link-code",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"bg-muted min-w-0 flex-1 rounded-md px-3 py-3 text-center font-mono text-lg font-semibold tracking-[0.15em] whitespace-nowrap tabular-nums sm:text-xl",children:e.userCode}),n.jsx(L,{variant:"ghost",size:"icon-md",onClick:()=>void r(e.userCode),"aria-label":s?"Couldn’t copy code. Try again":"Copy code",children:t?n.jsx(cn,{className:"text-status-success size-4"}):s?n.jsx(Ue,{className:"text-destructive size-4"}):n.jsx(Zr,{className:"size-4"})})]}),n.jsxs(L,{variant:"outline",className:"w-full",disabled:i===null,onClick:()=>a(i===null||!Rn(i)),children:[n.jsx(nn,{className:"size-4"}),"Open the page again"]}),n.jsx("p",{className:"text-muted-foreground text-xs break-all",children:e.verificationUri}),o&&n.jsx(Rr,{children:"Couldn’t open the page. Copy the code instead."}),n.jsxs("p",{className:"text-muted-foreground flex items-center justify-center gap-2 text-sm",children:[n.jsx(De,{size:"xs"}),n.jsx("span",{role:"status",children:"Waiting for you to approve."})]})]})}function Tv({onComplete:e}){const t=Nv(),{completeOnboarding:s}=Yt(),r=Pe(),[o,a]=u.useState(null),i=u.useCallback(()=>{s(),r({...je.home(),search:{}}),e()},[s,r,e]),c=u.useCallback(async()=>{a(null);try{await t.mutateAsync()}catch(l){a(Mn(l));return}i()},[t,i]),d=u.useRef(!1);return u.useEffect(()=>{d.current||(d.current=!0,c())},[c]),n.jsx("div",{className:"mx-auto flex w-full max-w-sm flex-col items-center px-4 text-center","data-testid":"onboarding-landing",children:o?n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-destructive text-sm",role:"alert",children:o}),n.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[n.jsx(L,{onClick:()=>void c(),children:"Try again"}),n.jsx(L,{variant:"outline",onClick:i,children:"Go to #team"})]})]}):n.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[n.jsx(De,{size:"xs"}),"Opening #team…"]})})}const Dv="claude-code";function wd(e,t){return e.length===0?null:e.includes(t)?t:Zi.find(r=>e.includes(r))??e[0]}function Ov({readyTypes:e,settled:t,settleToken:s}){var b,y;const{data:r}=Le(),o=Wn(),a=le(),[i,c]=u.useState(null),[d,l]=u.useState(null),m=u.useRef(null),f=((b=r==null?void 0:r.executionDefaults)==null?void 0:b.runtime)??Dv,p=!!((y=r==null?void 0:r.onboarding)!=null&&y.runtimeDefaultSetAt),h=u.useCallback((A,S)=>{c(null),l(S),o.mutate(A,{onSuccess:()=>void a.invalidateQueries({queryKey:Be.all}),onError:I=>{l(null),c(I.message||"Couldn’t save that. Try again.")}})},[o,a]);u.useEffect(()=>{if(!t||e.length===0||!r||p)return;const A=wd(e,f);A&&m.current!==s&&(m.current=s,h({onboarding:{runtimeDefaultSetAt:new Date().toISOString()},...A===f?{}:{runtimes:{default:A}}},A))},[t,s,e,r,p,f,h]);const g=u.useCallback(A=>{A!==(d??f)&&h({runtimes:{default:A},...p?{}:{onboarding:{runtimeDefaultSetAt:new Date().toISOString()}}},A)},[h,d,f,p]);return{runtime:d??((p||d!==null)&&r?f:null),current:d??f,choose:g,error:i}}function Mv({onContinue:e,renderConnect:t,simulated:s}){const r=ec(),{data:o}=tc(),{data:a}=nc(),i=(s==null?void 0:s.requirements)??r.data,c=s!==void 0||r.isSuccess,d=o?Object.keys(o.capabilities):void 0,l=u.useMemo(()=>Zi.filter(b=>(i==null?void 0:i.runtimes[b])!==void 0),[i]),m=u.useMemo(()=>i?l.filter(b=>nm(i,b,!0).state==="ready"||s===void 0&&sm(a,b)):[],[l,i,a,s]),f=Ov({readyTypes:m,settled:c&&s===void 0,settleToken:r.dataUpdatedAt}),[p,h]=u.useState(null),g=s!=null&&s.defaultRuntime?{runtime:p??s.defaultRuntime,current:p??s.defaultRuntime,choose:h,error:null}:f;if(!c)return n.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status",children:[n.jsx(De,{size:"xs"}),"Looking for AI apps…"]});if(s===void 0&&r.isError)return n.jsxs("div",{className:"space-y-2",role:"alert",children:[n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t check for AI apps."}),n.jsx(L,{variant:"outline",size:"sm",onClick:()=>void r.refetch(),children:"Try again"})]});const x=m.length>0;return n.jsxs("div",{className:"space-y-4","data-testid":"onboarding-ai-apps",children:[x&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-sm",children:Pv(m,g.runtime)}),n.jsx(_v,{chosen:g.current,readyTypes:m,otherTypes:l.filter(b=>!m.includes(b)),onChoose:g.choose}),g.error&&n.jsx("p",{className:"text-destructive text-xs","data-testid":"default-runtime-error",children:g.error})]}),n.jsx(kb,{types:l,requirements:i,registeredTypes:d,renderConnect:t,onRecheck:s?void 0:()=>void r.refetch(),isRechecking:r.isFetching}),x&&n.jsx(L,{className:"w-full",onClick:e,"data-testid":"onboarding-ai-app-continue",children:"Continue"})]})}function _v({chosen:e,readyTypes:t,otherTypes:s,onChoose:r}){const[o,a]=u.useState(!1),i=[...t,...s];return i.includes(e)||i.unshift(e),n.jsxs(ln,{open:o,onOpenChange:a,children:[n.jsxs(dn,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs underline-offset-2 transition-colors hover:underline","data-testid":"default-runtime-change",children:["Change",n.jsx(qt,{className:"size-3"})]}),n.jsxs(un,{align:"start",className:"p-1",children:[n.jsx(mn,{children:"Start new chats with"}),n.jsx("div",{className:"flex flex-col",role:"listbox","aria-label":"Start new chats with",children:i.map(c=>{const d=c===e;return n.jsxs("button",{type:"button",role:"option","aria-selected":d,onClick:()=>{r(c),a(!1)},className:"hover:bg-accent flex items-center justify-between gap-3 rounded-md px-3 py-2.5 text-left text-sm transition-colors","data-testid":`default-runtime-option-${c}`,children:[n.jsxs("span",{className:"flex flex-col",children:[n.jsx("span",{children:it(c).label}),!t.includes(c)&&n.jsx("span",{className:"text-muted-foreground text-xs",children:"Not signed in yet"})]}),d&&n.jsx(cn,{className:"size-3.5 shrink-0","aria-hidden":!0})]},c)})})]})]})}function Pv(e,t){const s=e.map(c=>it(c).label),r=s.length===1?`${s[0]} is signed in.`:s.length===2?`${s[0]} and ${s[1]} are signed in.`:`${s.slice(0,-1).join(", ")}, and ${s[s.length-1]} are signed in.`;if(!t)return r;if(e.length===1&&e[0]===t)return`${r} New chats start with it.`;const o=it(t).label;if(e.includes(t))return`${r} New chats start with ${o}.`;const a=wd(e,t),i=a?it(a).label:null;return i?`${r} New chats use ${i} until ${o} is signed in.`:`${r} New chats start with ${o} once it’s signed in.`}const Lv=[{id:"openai",title:"An OpenAI API key",line:"Paste a key. DorkOS picks the model."},{id:"anthropic",title:"An Anthropic API key",line:"Paste a key. DorkOS picks the model."},{id:"openrouter",title:"An OpenRouter key",line:"Paste a key. DorkOS picks the model."},{id:"local",title:"A model on this computer",line:"Uses Ollama on this computer. No key."},{id:"agent-app",title:"An AI app you sign in to",line:"Claude Code, Codex or OpenCode, on your own sign-in."},{id:"custom",title:"Other service",line:"Set the address, format, model and key."}],Fv={openai:"OpenAI API key",anthropic:"Anthropic API key",openrouter:"OpenRouter key"};function $v({onSaved:e,beforePick:t,slots:s,initialRow:r,simulatedApps:o}){const[a,i]=u.useState(r??null),c=Ao(),[d,l]=u.useState(null),m=async(p,h=!1)=>{l(null);try{return await(t==null?void 0:t()),(await c.mutateAsync({path:"own",choice:p})).modelListed===!1&&ce("Using a default model. Change it in Settings."),!0}catch(g){if(h)throw new Error(Mn(g),{cause:g});return l(Mn(g)),!1}},f=p=>{l(null);const h=a===p?null:p;i(h),h==="agent-app"&&!o&&m({kind:"agent-app"})};return n.jsx("div",{className:"divide-border border-border w-full divide-y rounded-lg border text-left",children:Lv.map(p=>n.jsxs("section",{"data-testid":`own-ai-row-${p.id}`,children:[n.jsxs("button",{type:"button","aria-expanded":a===p.id,onClick:()=>f(p.id),className:"hover:bg-muted/60 focus-visible:ring-ring flex w-full items-center gap-3 px-4 py-3 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block text-sm font-medium",children:p.title}),n.jsx("span",{className:"text-muted-foreground block text-xs",children:p.line})]}),n.jsx(hn,{"aria-hidden":!0,className:K("text-muted-foreground size-4 shrink-0 transition-transform",a===p.id&&"rotate-90")})]}),a===p.id&&n.jsxs("div",{className:"px-4 pt-1 pb-4",children:[n.jsx(Bv,{row:p.id,busy:c.isPending,save:m,onSaved:e,slots:s,simulatedApps:o}),d&&n.jsx("p",{className:"text-destructive mt-3 text-sm",role:"alert",children:d})]})]},p.id))})}function Bv({row:e,busy:t,save:s,onSaved:r,slots:o,simulatedApps:a}){switch(e){case"local":return n.jsxs(L,{onClick:async()=>{await s({kind:"local"})&&r()},disabled:t,children:[t&&n.jsx(De,{size:"xs"}),"Use this computer’s model"]});case"agent-app":return n.jsx(Mv,{onContinue:r,renderConnect:o==null?void 0:o.renderRuntimeConnect,simulated:a});case"custom":return o!=null&&o.renderOtherService?o.renderOtherService({onSave:async(i,c)=>{await s({kind:"custom",inference:i,...c?{apiKey:c}:{}},!0),r()}}):n.jsx("p",{className:"text-muted-foreground text-sm",children:"Set this up later in Settings."});default:return n.jsx(zv,{service:e,busy:t,save:s,onSaved:r})}}function zv({service:e,busy:t,save:s,onSaved:r}){const o=u.useId(),[a,i]=u.useState(""),[c,d]=u.useState(null),l=async m=>{m.preventDefault();const f=a.trim();if(d(null),!f){d("Enter a key.");return}if(e==="anthropic"&&f.startsWith("sk-ant-oat")){d("Subscription tokens can’t run agents. Use an API key.");return}await s({kind:e,apiKey:f})&&(i(""),r())};return n.jsxs("form",{onSubmit:m=>void l(m),className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{htmlFor:`${o}-key`,children:Fv[e]}),n.jsx(rm,{id:`${o}-key`,value:a,onChange:m=>i(m.target.value),autoComplete:"off"})]}),c&&n.jsx("p",{className:"text-destructive text-sm",role:"alert",children:c}),n.jsxs(L,{type:"submit",disabled:t,children:[t&&n.jsx(De,{size:"xs"}),"Save"]})]})}function Uv({onBack:e,...t}){const s=Eo();return n.jsxs("div",{className:"mx-auto flex w-full max-w-md flex-col px-4","data-testid":"onboarding-own-ai",children:[n.jsx("h1",{ref:s,tabIndex:-1,className:"text-2xl font-semibold tracking-tight outline-none",children:"Use my own AI"}),n.jsx("p",{className:"text-muted-foreground mt-2 mb-6 text-sm",children:"Your agents run on a key, a local model or an AI app."}),n.jsx($v,{...t}),n.jsx(L,{variant:"ghost",size:"sm",className:"text-muted-foreground mt-6 self-start",onClick:e,children:"Back"})]})}function Kv({agentName:e,className:t}){var c;const s=Dl(),r=e.trim()||"This agent";if(s.isPending)return n.jsx("p",{className:K("text-muted-foreground text-center text-xs",t),"data-testid":"every-agent-access-checking",children:"Checking apps every agent can use…"});if(s.isError)return n.jsxs("p",{className:K("text-muted-foreground text-xs",t),"data-testid":"every-agent-access-unknown",children:["Couldn’t check apps shared with every agent. ",r," gets them too."]});const o=((c=s.data)==null?void 0:c.connections)??[];if(o.length===0)return null;const a=new Map;for(const d of o)a.set(d.toolkit,(a.get(d.toolkit)??0)+1);const i=o.map(d=>{const l=(a.get(d.toolkit)??0)>1?`${xa(d.toolkit)} · ${d.label}`:xa(d.toolkit),m=Ob(d.access.classifications);return`${l} (${d.lifecycle==="paused"?`${m}, paused`:m})`});return n.jsxs("div",{className:K("bg-muted/40 flex items-start gap-3 rounded-xl px-4 py-3 text-sm",t),"data-testid":"every-agent-access-notice",children:[n.jsx(sc,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("p",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"font-medium",children:[r," will get:"]})," ",i.join(", "),"."," ",n.jsx("span",{className:"text-muted-foreground",children:"You can change this in Connections."})]})]})}function Hv({onContinueWithDorkos:e,onUseOwnAi:t,onContinueWithout:s,busy:r=null,error:o=null}){const a=rc(),i=Eo();return n.jsxs("div",{className:"mx-auto flex w-full max-w-md flex-col items-center px-4 text-center","data-testid":"onboarding-welcome",children:[n.jsx(Nt,{size:120,className:"mb-8 opacity-90 dark:hidden"}),n.jsx(Nt,{variant:"white",size:120,className:"mb-8 hidden opacity-90 dark:block"}),n.jsx("h1",{ref:i,tabIndex:-1,className:"text-3xl font-semibold tracking-tight text-balance outline-none sm:text-4xl",children:"You, Multiplied."}),n.jsx("p",{className:"text-muted-foreground mt-3 text-balance",children:"Build and run your business with an agent team."}),n.jsxs("div",{className:"mt-10 flex w-full max-w-xs flex-col items-center gap-3",children:[n.jsxs(L,{size:"lg",className:"w-full",onClick:e,disabled:r!==null,"data-testid":"onboarding-continue-dorkos",children:[r==="dorkos"&&n.jsx(De,{size:"xs"}),"Continue with DorkOS"]}),n.jsx(ko,{withSpaces:a,className:"text-balance"}),o&&n.jsx("p",{className:"text-destructive text-sm",role:"alert",children:o})]}),n.jsxs("div",{className:"mt-8 flex flex-col items-center gap-1 sm:flex-row sm:gap-2",children:[n.jsx(L,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:t,disabled:r!==null,children:"Use my own AI"}),n.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground/50 hidden sm:inline",children:"·"}),n.jsxs(L,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:s,disabled:r!==null,children:[r==="none"&&n.jsx(De,{size:"xs"}),"Continue without an account"]})]})]})}function Wv({onComplete:e,slots:t}){const s=t==null?void 0:t.renderAccountLink,r=o=>n.jsx(Gv,{link:o,slots:t,onComplete:e});return n.jsx("div",{className:"bg-background h-full w-full overflow-y-auto",children:n.jsx("div",{className:"flex min-h-full w-full items-center justify-center p-4 py-10",children:s?s(r):r(null)})})}function Gv({link:e,slots:t,onComplete:s}){var I;const{stage:r,goToStage:o,goBack:a}=wv(),{startOnboarding:i}=Yt(),c=Ao(),[d,l]=u.useState(null),m=u.useRef(null),f=u.useRef(!1);u.useEffect(()=>{f.current||(f.current=!0,i())},[i]),u.useEffect(()=>{var v;r!=="connecting"&&((v=m.current)==null||v.close(),m.current=null)},[r]);const p=u.useRef(e);u.useEffect(()=>{p.current=e});const h=u.useCallback(async()=>{var v;((v=p.current)==null?void 0:v.state)==="pending"&&await p.current.cancel()},[]),g=u.useCallback(()=>{m.current!==null||r==="connecting"||(l(null),m.current=e&&e.state!=="linked"?Jr():null,o("connecting"))},[o,e,r]),x=u.useCallback(async()=>{l(null);try{await h(),await c.mutateAsync({path:"none"}),o("landing")}catch(v){l(Mn(v))}},[c,o,h]),b=u.useCallback(()=>o("landing"),[o]),y=u.useCallback(()=>o("own-ai"),[o]),A=u.useCallback(()=>a("welcome"),[a]);let S;return r==="connecting"?S=e?n.jsx(qv,{link:e,waitingWindowRef:m,onReady:b,onCancel:()=>{h(),A()},onUseOwnAi:()=>{h(),y()}}):n.jsx(vd,{phase:{kind:"failed",message:"Signing in isn’t available here."},link:null,onRetry:A,onCancel:A,onUseOwnAi:y}):r==="own-ai"?S=n.jsx(Uv,{onBack:A,onSaved:b,beforePick:h,slots:t}):r==="landing"?S=n.jsx(Tv,{onComplete:s}):S=n.jsx(Hv,{onContinueWithDorkos:g,onUseOwnAi:y,onContinueWithout:()=>void x(),busy:c.isPending&&((I=c.variables)==null?void 0:I.path)==="none"?"none":null,error:d}),S}function qv({link:e,waitingWindowRef:t,onReady:s,onCancel:r,onUseOwnAi:o}){const{phase:a,retry:i}=Av({link:e,waitingWindowRef:t,onReady:s});return n.jsx(vd,{phase:a,link:e,onRetry:i,onCancel:r,onUseOwnAi:o})}function Yv(){var l;const e=ae(),t=le(),{data:s}=Ie({queryKey:Be.current(),queryFn:()=>e.getConfig(),staleTime:300*1e3}),r=((l=s==null?void 0:s.mesh)==null?void 0:l.scanRoots)??[],o=(s==null?void 0:s.boundary)??"",a=r.length>0?r:o?[o]:[],{mutate:i,isPending:c}=Wt({mutationKey:Yi,mutationFn:async m=>{await e.updateConfig({mesh:{scanRoots:m}})},onSuccess:()=>{t.invalidateQueries({queryKey:Be.all})}}),d=u.useCallback(m=>i(m),[i]);return{roots:a,boundary:o,isSaving:c,setScanRoots:d}}const Vv=50,wn=["room_created","room_updated","room_member_added","room_member_removed","room_activity"];function _a(e){if(typeof e!="object"||e===null)return!1;const{roomId:t}=e;return typeof t=="string"&&t.length>0}function Qv(e){if(typeof e!="object"||e===null)return!1;const{userId:t,threadKind:s,threadId:r,lastReadSeq:o,unreadCount:a}=e;return s==="room"&&typeof t=="string"&&t.length>0&&typeof r=="string"&&r.length>0&&typeof o=="number"&&typeof a=="number"}function Xv(e,t){const s=e.getQueryData(Ke.detail(t.threadId));return s===void 0||s.viewerAuthorId===t.userId}function Jv(e,t){const s=e.isFetching({queryKey:Ke.lists()})>0;e.cancelQueries({queryKey:Ke.lists()}),e.setQueriesData({queryKey:Ke.lists()},o=>Array.isArray(o)?o.map(a=>{if(a.id!==t.threadId||a.unreadCount===null)return a;const i=Math.min(a.unreadCount,t.unreadCount);return a.mentionCount===void 0?{...a,unreadCount:i}:{...a,unreadCount:i,mentionCount:Math.min(a.mentionCount,i)}}):o),e.setQueryData(Ke.detail(t.threadId),o=>o&&{...o,members:o.members.map(a=>a.authorId===t.userId?{...a,lastReadSeq:Math.max(a.lastReadSeq,t.lastReadSeq)}:a)});const r=e.getQueryData(Ke.threads());r!=null&&r.some(o=>o.roomId===t.threadId&&o.unreadCount>0)&&e.invalidateQueries({queryKey:Ke.threads()}),s&&e.invalidateQueries({queryKey:Ke.lists()})}function Zv(){const e=le(),t=()=>{e.invalidateQueries({queryKey:Ke.lists()}),e.invalidateQueries({queryKey:Ke.wellKnowns()}),e.invalidateQueries({queryKey:Ke.threads()})};we(wn[0],t),we(wn[1],t),we(wn[2],t),we(wn[3],t),we(wn[4],t),we("room_updated",o=>{_a(o)&&e.invalidateQueries({queryKey:Ke.detail(o.roomId)})});const s=u.useRef(new Set),r=o=>{if(!_a(o))return;const a=s.current;if(a.has(o.roomId))return;a.add(o.roomId);const i=o.roomId;setTimeout(()=>{a.delete(i),e.invalidateQueries({queryKey:Ke.detail(i)})},Vv)};we("room_member_added",r),we("room_member_removed",r),we("room_presence",o=>om.getState().observe(o)),we("read_cursor",o=>{!Qv(o)||!Xv(e,o)||Jv(e,o)})}function ew(){const e=le();we("tasks_changed",()=>{e.invalidateQueries({queryKey:[...am],exact:!0})});const t=()=>{e.invalidateQueries({queryKey:[...im]})};we("task_run_failed",t),we("task_run_updated",t)}function tw(e){const t=new Set,s=[],r=[];for(const o of e){if(o.status==="running"){s.includes(o.scheduleId)||s.push(o.scheduleId),t.add(o.scheduleId);continue}t.has(o.scheduleId)||(t.add(o.scheduleId),(o.status==="failed"||o.status==="blocked")&&r.push(o.scheduleId))}return{running:s,failed:r}}function nw({members:e}){var d;const t=P(l=>l.explicitAgentPath),s=P(l=>l.setExplicitAgentPath),r=e.some(l=>l.agentPath===t),o=((d=e[0])==null?void 0:d.agentPath)??null;u.useEffect(()=>{!r&&o!==null&&s(o)},[r,o,s]);const a=u.useRef([]);if(e.length===0)return null;const i=Math.max(0,e.findIndex(l=>l.agentPath===t)),c=l=>{var p;const m=e.length-1,f=l.key==="ArrowRight"||l.key==="ArrowDown"?i===m?0:i+1:l.key==="ArrowLeft"||l.key==="ArrowUp"?i===0?m:i-1:l.key==="Home"?0:l.key==="End"?m:null;f!==null&&(l.preventDefault(),s(e[f].agentPath),(p=a.current[f])==null||p.focus())};return n.jsx("div",{role:"radiogroup","aria-label":"Show the panel for","data-testid":"group-dm-member-picker",onKeyDown:c,className:"flex shrink-0 flex-wrap gap-1.5 border-b px-3 py-2",children:e.map((l,m)=>{const f=l.agentPath===t;return n.jsxs("button",{type:"button",ref:p=>{a.current[m]=p},role:"radio","aria-checked":f,tabIndex:m===i?0:-1,onClick:()=>s(l.agentPath),className:K("focus-ring flex h-7 max-w-40 items-center gap-1.5 rounded-full border px-2 text-xs transition-colors",f?"bg-accent text-foreground border-transparent":"text-muted-foreground hover:bg-accent/60 hover:text-foreground"),children:[n.jsx(cs,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:"agent",color:l.color??as(l.authorId),emoji:l.emoji,badge:null,fallback:vr(l.displayName)}),n.jsx("span",{className:"truncate",children:l.displayName})]},l.authorId)})})}const sw=4e3;function jd(){var o;const e=eo(),{identityPromptDismissedAt:t,isLoading:s}=Us();if(s||e.isPending)return"pending";if(t!==null)return"settled";const r=(o=e.data)==null?void 0:o.members.find(a=>a.isSelf);return r&&Zx(r)?"ask":"settled"}function rw(){const{state:e,isLoading:t,shouldShowGettingStarted:s}=Yt(),r=jd(),{dismissIdentityPrompt:o}=Us(),[a,i]=u.useState("ask");u.useEffect(()=>{if(a!=="saved")return;const m=setTimeout(()=>i("done"),sw);return()=>clearTimeout(m)},[a]);const c=e.completedAt!==null||e.dismissedAt!==null,d=!t&&c&&r==="ask"&&!s,l=()=>{o().catch(()=>{})};return{visible:a!=="done"&&(d||a==="saved"),phase:a,markSaved:()=>{i("saved"),l()},skip:()=>{i("done"),l()}}}function kd(){const{firstRunPath:e}=Yt().state,{offered:t,pending:s}=wl(),r=e==="dorkos"||e==="own";return{due:r&&t,pending:r&&s}}const ow=4e3,Zs="Tell DorkBot your name",Pa="Tell DorkBot about your work";function aw({onDismiss:e}){const t=lt(),s=Pe(),{open:r}=rt(),o=to(),a=P(D=>D.requestTour),{startSession:i}=lv(),{roles:c,rolePromptDismissedAt:d,isLoading:l,saveRoles:m,dismissIdentityPrompt:f}=Us(),p=jd(),h=kd().due,[g,x]=u.useState("closed"),[b,y]=u.useState("closed"),[A,S]=u.useState([]),I=!l&&c.length===0&&d===null;u.useEffect(()=>{if(g!=="saved")return;const D=setTimeout(()=>x("closed"),ow);return()=>clearTimeout(D)},[g]);const v=()=>{x("saved"),f().catch(()=>{})},E=()=>{y("saving"),m(A).then(()=>y("closed")).catch(()=>y("error"))};let R="Save";b==="saving"?R="Saving…":b==="error"&&(R="Try again");const _=[{icon:Ss,label:"Talk to DorkBot",onClick:i},...p==="ask"||g==="saved"?[{icon:Pl,label:Zs,onClick:()=>x(D=>D==="saved"?D:D==="closed"?"open":"closed"),expanded:g!=="closed"}]:[],...I?[{icon:no,label:Pa,onClick:()=>y(D=>D==="closed"?"open":"closed"),expanded:b!=="closed"}]:[],{icon:Ny,label:"Show me around",onClick:()=>a("general")},{icon:At,label:"Create an agent",onClick:()=>Cs.getState().open("new")},{icon:oc,label:"Schedule a task",onClick:()=>s({...je.tasks()})},{icon:Ll,label:"Connect more runtimes",onClick:()=>r("runtimes")},{icon:sb,label:"Connect a service",onClick:()=>o()}];return n.jsxs(se.div,{initial:t?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3},className:"border-border bg-card relative rounded-lg border p-3",children:[n.jsx("button",{onClick:e,className:"text-muted-foreground/50 hover:text-muted-foreground absolute top-1.5 right-1.5 rounded-md p-0.5 transition-colors duration-150","aria-label":"Dismiss getting started",children:n.jsx(Ue,{className:"size-3.5"})}),n.jsx("h3",{className:"mb-2 text-xs font-medium",children:"Getting started"}),n.jsx("ul",{className:"space-y-0.5",children:_.map(({icon:D,label:O,onClick:T,expanded:w})=>n.jsxs("li",{children:[n.jsxs("button",{onClick:T,className:"hover:bg-accent group flex w-full items-center gap-2 rounded-md px-1.5 py-1 text-left transition-colors duration-150","aria-expanded":w,children:[n.jsx(D,{className:"text-muted-foreground size-3.5 shrink-0"}),n.jsx("span",{className:"text-foreground flex-1 text-xs",children:O}),n.jsx(hn,{className:"text-muted-foreground/40 group-hover:text-muted-foreground size-3.5 shrink-0 transition-colors"})]}),O===Zs&&g==="open"&&n.jsx("div",{className:"px-1.5 py-2","data-testid":"progress-card-identity-form",children:n.jsx(_l,{onSaved:v})}),O===Zs&&g==="saved"&&n.jsx("p",{role:"status",className:"text-muted-foreground px-1.5 py-2 text-xs",children:pt.identityCardSaved}),O===Pa&&b!=="closed"&&n.jsx("div",{className:"px-1.5 py-2","data-testid":"progress-card-profile-picker",children:n.jsx(vl,{selected:A,onChange:S,onConfirm:E,confirmLabel:R,busy:b==="saving",error:b==="error"?pt.saveError:null})})]},O))}),h&&n.jsx(jl,{compact:!0,className:"border-border mt-2 border-t px-1.5 pt-2"})]})}const La=72;function Sd({title:e,description:t,titleIsStatus:s}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsxs("div",{children:[n.jsx(Nt,{size:La,className:"block dark:hidden"}),n.jsx(Nt,{variant:"white",size:La,className:"hidden dark:block"})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("p",{className:"text-sm leading-relaxed",role:s?"status":void 0,children:e}),t!==void 0&&n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t})]})]})}function iw({prompt:e}){const t=lt(),{open:s}=rt(),{phase:r,selected:o,setSelected:a,confirmLabel:i,errorMessage:c}=e;return n.jsxs(se.div,{initial:t?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},role:"group","aria-label":"DorkBot suggestion","data-testid":"profile-prompt-card",className:"bg-secondary/60 flex flex-col gap-2 rounded-lg border p-3",children:[n.jsx(Sd,{title:r==="saved"?pt.profileSaved:pt.profileCardPrompt[0],description:n.jsxs(n.Fragment,{children:[pt.profileCardPrompt[1]," ",n.jsx("button",{type:"button",onClick:()=>s("profile"),className:"focus-visible:ring-ring hover:text-foreground rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Change it in Settings"}),"."]})}),r!=="saved"&&n.jsx(vl,{selected:o,onChange:a,onConfirm:e.save,confirmLabel:i,onSkip:e.skip,skipLabel:"Don’t ask again",busy:r==="saving",error:c})]})}const cw=4e3;function lw(){const{state:e,isLoading:t,shouldShowGettingStarted:s}=Yt(),{roles:r,rolePromptDismissedAt:o,isLoading:a,saveRoles:i,dismissRolePrompt:c}=Us(),[d,l]=u.useState([]),[m,f]=u.useState("ask");u.useEffect(()=>{if(m!=="saved")return;const b=setTimeout(()=>f("done"),cw);return()=>clearTimeout(b)},[m]);const p=e.completedAt!==null||e.dismissedAt!==null,h=!e.completedSteps.includes("profile")&&!e.skippedSteps.includes("profile"),g=!t&&!a&&p&&r.length===0&&h&&o===null&&!s;let x="Save";return m==="saving"?x="Saving…":m==="error"&&(x="Try again"),{visible:m!=="done"&&(g||m==="saved"),phase:m,selected:d,setSelected:l,confirmLabel:x,errorMessage:m==="error"?pt.saveError:null,save:()=>{f("saving"),i(d).then(()=>f("saved")).catch(()=>f("error"))},skip:()=>{f("done"),c().catch(()=>{})}}}function dw({prompt:e}){const t=lt(),s=e.phase==="saved";return n.jsxs(se.div,{initial:t?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},role:"group","aria-label":"DorkBot suggestion","data-testid":"identity-prompt-card",className:"bg-secondary/60 flex flex-col gap-3 rounded-lg border p-3",children:[n.jsx(Sd,{title:s?pt.identityCardSaved:pt.identityCardPrompt[0],description:s?void 0:pt.identityCardPrompt[1],titleIsStatus:s}),!s&&n.jsx(_l,{onSaved:e.markSaved,onSkip:e.skip,skipLabel:"Don’t ask again"})]})}function uw(){const e=ae(),t=u.useRef(null),{startScan:s,addCandidate:r,addExistingAgent:o,setProgress:a,completeScan:i,setError:c}=ac(),d=u.useCallback((m={roots:[]})=>{var p;(p=t.current)==null||p.abort();const f=new AbortController;t.current=f,s(),e.scan(m,h=>{switch(h.type){case"candidate":r(h.data);break;case"existing-agent":o(h.data);break;case"progress":a(h.data);break;case"complete":i(h.data);break;case"error":c(h.data.error);break}},f.signal).catch(h=>{h instanceof Error&&h.name!=="AbortError"&&c(h.message)})},[e,s,r,o,a,i,c]),l=u.useCallback(()=>{var m;(m=t.current)==null||m.abort(),t.current=null},[]);return{startScan:d,stopScan:l}}function mw(){const[e,t]=u.useState(new Set),s=u.useCallback(o=>{t(a=>new Set(a).add(o))},[]),r=u.useCallback(()=>{t(new Set)},[]);return{actedPaths:e,markActed:s,resetActed:r}}function hw({register:e,onSuccess:t}){const s=u.useRef(new Set),[r,o]=u.useState(new Set),[a,i]=u.useState(new Set),c=u.useCallback(async l=>{if(!s.current.has(l.path)){s.current.add(l.path),o(m=>new Set(m).add(l.path)),i(m=>{const f=new Set(m);return f.delete(l.path),f});try{await e(l),t(l)}catch{i(m=>new Set(m).add(l.path))}finally{s.current.delete(l.path),o(m=>{const f=new Set(m);return f.delete(l.path),f})}}},[t,e]),d=u.useCallback(()=>i(new Set),[]);return{failedPaths:a,pendingPaths:r,registerCandidate:c,resetFailures:d}}function fw(e){return{name:e.hints.suggestedName,runtime:e.hints.detectedRuntime,...e.hints.inferredCapabilities?{capabilities:e.hints.inferredCapabilities}:{},...e.hints.description?{description:e.hints.description}:{}}}function pw(e){return[...e].sort((t,s)=>{const r=t.strategy==="dork-manifest",o=s.strategy==="dork-manifest";return r!==o?r?-1:1:t.path.localeCompare(s.path)})}const gw={"claude-code":"Has an AGENTS.md file, so it’s a Claude Code project.",cursor:"Has a .cursor folder, so it’s a Cursor project.",codex:"Has a .codex folder, so it’s a Codex project.","dork-manifest":"Has a .dork/agent.json file, so it’s already a DorkOS agent."};function xw(e){return gw[e]??`Found by the “${e}” check.`}const bw={"code-review":"Reviews code for bugs, style issues, and correctness.",summarize:"Summarizes documents, chats, or code.","file-ops":"Reads and writes files on the filesystem.",test:"Generates and runs tests for a codebase.",search:"Searches code, files, or the web for relevant information.",refactor:"Refactors code while preserving existing behavior.",analyze:"Analyzes data, logs, or codebases for patterns and insights.",generate:"Generates code, content, or structured output.",debug:"Diagnoses and fixes bugs in code.",deploy:"Manages deployment pipelines and infrastructure changes."};function yw(e){return bw[e]??"Found in the project’s files."}function vw({candidate:e,onApprove:t,onDeny:s,onSkip:r,registrationFailed:o=!1,registrationPending:a=!1,className:i,ref:c}){const{path:d,strategy:l,hints:m}=e;return n.jsxs(se.div,{ref:c,"data-slot":"candidate-card","aria-busy":a,layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.15,ease:"easeOut"},className:K("flex items-start justify-between rounded-xl border p-4",i),children:[n.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[n.jsx("p",{className:"truncate text-sm leading-tight font-semibold",title:m.suggestedName||d.split("/").pop()||d,children:m.suggestedName||d.split("/").pop()||d}),n.jsxs("div",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[n.jsx(cm,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate font-mono",title:d,children:so(d)})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs($l,{openDelay:300,children:[n.jsx(Bl,{asChild:!0,children:n.jsx(Tn,{variant:"secondary",className:"hover:bg-secondary/80 cursor-default",children:m.detectedRuntime})}),n.jsxs(zl,{className:"w-56 space-y-1.5 p-3",side:"top",align:"start",children:[n.jsx("p",{className:"text-xs font-medium",children:"How DorkOS knows"}),n.jsx("p",{className:"text-muted-foreground text-xs",children:xw(l)})]})]}),m.inferredCapabilities&&m.inferredCapabilities.length>0&&m.inferredCapabilities.map(f=>n.jsxs(fn,{children:[n.jsx(pn,{asChild:!0,children:n.jsx(Tn,{size:"xs",variant:"outline",className:"cursor-default",children:f})}),n.jsx(gn,{side:"top",className:"max-w-48 text-center",children:yw(f)})]},f))]}),o&&n.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t add this project. Try again."})]}),n.jsxs("div",{className:"ml-4 flex shrink-0 items-center gap-1.5",children:[n.jsx("button",{type:"button",onClick:()=>t(e),disabled:a,className:"focus-visible:ring-ring rounded-md bg-green-600/10 px-2.5 py-1 text-xs font-medium text-green-700 hover:bg-green-600/20 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:text-green-400",children:a?"Adding…":o?"Try again":"Add"}),r&&n.jsx("button",{type:"button",onClick:()=>r(e),disabled:a,className:"text-muted-foreground hover:bg-muted focus-visible:ring-ring rounded-md px-2.5 py-1 text-xs font-medium focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:"Skip"}),s&&n.jsx("button",{type:"button",onClick:()=>s(e),disabled:a,className:"focus-visible:ring-ring rounded-md bg-red-600/10 px-2.5 py-1 text-xs font-medium text-red-700 hover:bg-red-600/20 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:text-red-400",children:"Deny"})]})]})}function ww({agent:e}){return n.jsxs("div",{className:"bg-muted/50 flex items-center gap-3 rounded-lg border px-4 py-3",children:[n.jsx(ks,{className:"text-muted-foreground size-4 shrink-0"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"truncate text-sm font-medium",children:$e(e)}),n.jsx("p",{className:"text-muted-foreground truncate text-xs",children:e.path})]}),n.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:"Imported"})]})}const jw=2;function kw({agents:e}){const[t,s]=u.useState(e.length<=jw);return e.length===0?null:n.jsxs("div",{children:[n.jsxs("button",{type:"button",onClick:()=>s(r=>!r),className:"text-muted-foreground hover:text-foreground flex w-full items-center gap-1.5 py-1.5 text-xs transition-colors",children:[n.jsx(hn,{className:K("size-3 transition-transform",t&&"rotate-90")}),e.length," project",e.length===1?"":"s"," already in DorkOS"]}),t&&n.jsx("div",{className:"mt-2 space-y-2",children:e.map(r=>n.jsx(ww,{agent:r},r.path))})]})}function Sw({count:e,onAddAll:t,disabled:s}){return e===0?null:n.jsxs("div",{className:"flex items-center justify-between py-1",children:[n.jsxs("span",{className:"text-muted-foreground text-sm font-medium",children:[e," new project",e===1?"":"s"]}),n.jsx(L,{variant:"outline",size:"sm",onClick:t,disabled:s,children:"Add all"})]})}function Cw({roots:e,onChange:t}){const[s,r]=u.useState(""),[o,a]=u.useState(!1),i=u.useCallback(m=>{const f=m.trim();f&&!e.includes(f)&&t([...e,f])},[e,t]),c=u.useCallback(m=>{t(e.filter(f=>f!==m))},[e,t]),d=u.useCallback(m=>{(m.key==="Enter"||m.key===",")&&(m.preventDefault(),s.trim()&&(i(s),r(""))),m.key==="Backspace"&&s===""&&e.length>0&&c(e[e.length-1])},[s,e,i,c]),l=u.useCallback(m=>{i(m)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"focus-within:ring-ring flex min-h-[40px] flex-wrap items-center gap-1.5 rounded-md border bg-transparent px-3 py-1.5 focus-within:ring-2",children:[e.map(m=>n.jsxs(Tn,{variant:"secondary",className:"gap-1 py-0.5 font-mono",children:[m,n.jsx("button",{type:"button",onClick:()=>c(m),className:"hover:bg-muted-foreground/20 ml-0.5 rounded-sm","aria-label":`Remove ${m}`,children:n.jsx(Ue,{className:"size-3"})})]},m)),n.jsx("input",{type:"text",value:s,onChange:m=>r(m.target.value),onKeyDown:d,placeholder:e.length===0?"Type a folder, then press Enter":"Add more…",className:"placeholder:text-muted-foreground min-w-[120px] flex-1 bg-transparent text-sm focus-visible:outline-none"}),n.jsx("button",{type:"button",onClick:()=>a(!0),className:"text-muted-foreground hover:bg-accent hover:text-foreground shrink-0 rounded p-1","aria-label":"Browse for a folder",children:n.jsx(Ns,{className:"size-4"})})]}),n.jsx(ic,{open:o,onOpenChange:a,onSelect:l})]})}function Nw(e,t){let s;for(const r of t){const o=r.endsWith("/")?r.slice(0,-1):r;(e===o||e.startsWith(o+"/"))&&(!s||o.length>s.length)&&(s=o)}return s}function Aw(){return n.jsxs("svg",{viewBox:"0 0 240 120",className:"mx-auto h-24 w-48","aria-hidden":"true",children:[n.jsx("path",{d:"M15 25 L33 25 L37 33 L60 33 L60 77 L15 77 Z",className:"fill-none stroke-current",strokeWidth:"1.5"}),n.jsx("rect",{x:"23",y:"44",width:"16",height:"2",rx:"1",className:"fill-current opacity-40"}),n.jsx("rect",{x:"23",y:"50",width:"26",height:"2",rx:"1",className:"fill-current opacity-20"}),n.jsx("rect",{x:"23",y:"56",width:"20",height:"2",rx:"1",className:"fill-current opacity-20"}),n.jsx("path",{d:"M180 25 L198 25 L202 33 L225 33 L225 77 L180 77 Z",className:"fill-none stroke-current",strokeWidth:"1.5"}),n.jsx("rect",{x:"188",y:"44",width:"20",height:"2",rx:"1",className:"fill-current opacity-40"}),n.jsx("rect",{x:"188",y:"50",width:"14",height:"2",rx:"1",className:"fill-current opacity-20"}),n.jsx("rect",{x:"188",y:"56",width:"24",height:"2",rx:"1",className:"fill-current opacity-20"}),n.jsx("circle",{cx:"120",cy:"48",r:"18",className:"fill-none stroke-current",strokeWidth:"2"}),n.jsx("line",{x1:"133",y1:"61",x2:"148",y2:"76",className:"stroke-current",strokeWidth:"3",strokeLinecap:"round"}),n.jsx("path",{d:"M110 38 Q114 33 120 32",className:"fill-none stroke-current opacity-30",strokeWidth:"1.5",strokeLinecap:"round"}),n.jsx("line",{x1:"63",y1:"55",x2:"102",y2:"50",className:"stroke-current opacity-40",strokeWidth:"1.5",strokeDasharray:"4 3"}),n.jsx("line",{x1:"138",y1:"50",x2:"177",y2:"55",className:"stroke-current opacity-40",strokeWidth:"1.5",strokeDasharray:"4 3"})]})}const Ew=[{name:"claude-code",signal:"AGENTS.md",label:"Claude Code project"},{name:"cursor",signal:".cursor/",label:"Cursor project"},{name:"codex",signal:".codex/",label:"Codex project"},{name:"dork",signal:".dork/agent.json",label:"DorkOS agent (auto-imported)"}];function Iw({fullBleed:e=!1,onRegistered:t}){var Q;const{roots:s,setScanRoots:r}=Yv(),[o,a]=u.useState(null),[i,c]=u.useState(!1),[d,l]=u.useState(3),{startScan:m}=uw(),{candidates:f,existingAgents:p,isScanning:h,progress:g,error:x,lastScanAt:b}=ac(),{mutateAsync:y}=lm(),{mutate:A}=dm(),{data:S}=um(),{actedPaths:I,markActed:v,resetActed:E}=mw(),R=o??s,_=u.useCallback(q=>y({path:q.path,overrides:fw(q),scanRoot:Nw(q.path,R)}),[R,y]),D=u.useCallback(q=>{v(q.path),t==null||t()},[v,t]),{failedPaths:O,pendingPaths:T,registerCandidate:w,resetFailures:C}=hw({register:_,onSuccess:D});function j(q){a(q),r(q)}function k(){R.length>0&&(E(),C(),m({roots:R,maxDepth:d}))}const F=u.useMemo(()=>h?f:pw(f),[f,h]).filter(q=>!I.has(q.path)),B=(((Q=S==null?void 0:S.agents)==null?void 0:Q.length)??0)>0,W=p.length>0,ne=f.length>0,fe=W||ne,z=!h&&b!==null,Y=!h&&b===null;function te(){for(const q of F)w(q)}const de=n.jsxs("div",{children:[n.jsxs("button",{type:"button",onClick:()=>c(!i),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs",children:[n.jsx(qt,{className:`size-3 transition-transform ${i?"":"-rotate-90"}`}),"Advanced"]}),i&&n.jsxs("div",{className:"bg-muted/30 mt-2 space-y-3 rounded-lg border p-3",children:[n.jsx(Cw,{roots:R,onChange:j}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("label",{htmlFor:"scan-depth",className:"text-muted-foreground text-xs",children:"Scan depth"}),n.jsx("input",{id:"scan-depth",type:"range",min:1,max:5,value:d,onChange:q=>l(Number(q.target.value)),className:"flex-1"}),n.jsx("span",{className:"min-w-[1.5rem] text-center text-xs font-medium",children:d})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("p",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[n.jsx(Ey,{className:"size-3"}),"What it looks for"]}),n.jsx("ul",{className:"space-y-1 pl-4",children:Ew.map(q=>n.jsxs("li",{className:"flex items-baseline gap-1.5",children:[n.jsx("code",{className:"text-foreground/70 text-3xs",children:q.signal}),n.jsxs("span",{className:"text-muted-foreground text-3xs",children:["→ ",q.label]})]},q.name))})]})]})]});return n.jsx("div",{className:e?"flex h-full flex-col p-6":"space-y-4 p-4",children:Y?n.jsx("div",{className:e?"flex flex-1 items-center justify-center":"",children:n.jsxs("div",{className:e?"w-full max-w-sm space-y-5":"space-y-5",children:[n.jsx(Aw,{}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-foreground text-sm font-medium",children:"Find your existing projects"}),n.jsx("p",{className:"text-muted-foreground mx-auto mt-1 max-w-[300px] text-xs leading-relaxed",children:"Find Claude Code, Cursor, Codex and other AI projects on this computer."})]}),x&&n.jsx("div",{className:"border-destructive/30 bg-destructive/5 text-destructive rounded-lg border px-4 py-3 text-sm",children:x}),n.jsxs(L,{onClick:k,disabled:R.length===0,className:"w-full",children:[n.jsx(ls,{className:"size-4"}),"Search for projects"]}),n.jsx("p",{className:"text-muted-foreground/60 text-center text-xs",children:"Read-only scan. Nothing changes until you approve"}),de]})}):n.jsxs(n.Fragment,{children:[e&&n.jsxs("div",{className:"mb-4 space-y-1",children:[n.jsx("h2",{className:"text-lg font-semibold",children:"Bring in existing projects"}),n.jsx("p",{className:"text-muted-foreground text-sm",children:"Search for existing projects to bring into DorkOS."})]}),n.jsxs("div",{className:"space-y-3",children:[de,n.jsxs(L,{onClick:k,disabled:h||R.length===0,children:[h?n.jsx(De,{}):n.jsx(ls,{className:"size-4"}),"Search for projects"]})]}),n.jsxs("div",{className:e?"mt-4 flex-1 overflow-y-auto":"",children:[h&&n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[n.jsx(De,{size:"md",className:"text-muted-foreground",label:"Searching for projects"}),g&&n.jsxs("div",{className:"text-muted-foreground space-y-0.5 text-center text-xs",children:[n.jsxs("p",{children:["Scanned ",g.scannedDirs," directories"]}),n.jsxs("p",{children:["Found ",g.foundAgents," project",g.foundAgents===1?"":"s"]})]})]}),x&&n.jsx("div",{className:"border-destructive/30 bg-destructive/5 text-destructive mb-3 rounded-lg border px-4 py-3 text-sm",children:x}),z&&!ne&&W&&n.jsxs("div",{className:"rounded-xl border border-dashed p-8 text-center",children:[n.jsx("p",{className:"text-sm font-medium",children:"All projects already added"}),n.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"See them on the Agents tab."})]}),z&&!fe&&n.jsxs("div",{className:"rounded-xl border border-dashed p-8 text-center",children:[n.jsx("p",{className:"text-sm font-medium",children:B?"No new projects found":"No projects found"}),n.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:B?"They’re already added. See the Agents tab.":"Try a deeper scan or other folders."})]}),z&&F.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(Sw,{count:F.length,onAddAll:te,disabled:T.size>0}),n.jsx(Xe,{mode:"popLayout",children:F.map(q=>n.jsx(vw,{candidate:q,className:"mb-2",registrationFailed:O.has(q.path),registrationPending:T.has(q.path),onApprove:re=>void w(re),onSkip:re=>v(re.path),onDeny:re=>A({path:re.path},{onSuccess:()=>v(re.path)})},q.path))})]}),z&&W&&n.jsx("div",{className:"mt-3",children:n.jsx(kw,{agents:p})})]})]})})}function Rw(){const e=Ks(),t=en(h=>h.isOpen)&&!e,s=en(h=>h.close);u.useEffect(()=>{e&&en.getState().isOpen&&s()},[e,s]);const r=Pe(),[o,a]=u.useState(0),[i,c]=u.useState(!1),[d,l]=u.useState(!1);t!==d&&(l(t),t&&(a(0),c(!1)));function m(h){h||s()}function f(){if(o>0&&!i){c(!0);return}s(),o>0&&r({...je.team()})}const p=`${o} project${o===1?"":"s"} joined`;return n.jsx(xt,{open:t,onOpenChange:m,children:n.jsxs(bt,{className:"max-h-[85vh] !min-h-0 sm:max-w-2xl",children:[n.jsxs(ht,{className:"shrink-0",children:[n.jsx(tt,{children:"Bring in existing projects"}),n.jsx(ft,{children:i?"Your projects are ready in DorkOS.":"Find projects on this computer to add."})]}),i?n.jsx(St,{className:"mt-2",children:n.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-10 text-center","data-testid":"import-complete",children:[n.jsx(ks,{className:"text-primary size-12","aria-hidden":!0}),n.jsx("p",{className:"text-lg font-semibold","data-testid":"import-joined-summary",children:p}),n.jsx("p",{className:"text-muted-foreground text-sm",children:"Manage agents, tasks and chat apps from the Team page."})]})}):n.jsx(St,{className:"mt-2 overflow-y-auto",children:n.jsx(Iw,{onRegistered:()=>a(h=>h+1)})}),n.jsxs(tn,{className:"shrink-0 sm:justify-between",children:[!i&&o>0?n.jsx("span",{className:"text-muted-foreground text-sm","data-testid":"import-joined-count",children:p}):n.jsx("span",{}),n.jsx(L,{onClick:f,"data-testid":"import-done",children:"Done"})]})]})})}function Tw(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.name=="string"&&(t.scope==="global"||t.scope==="project")&&typeof t.at=="string"&&Array.isArray(t.actions)&&(t.errors===void 0||Array.isArray(t.errors)&&t.errors.every(s=>typeof s=="string"))}function Dw(){const e=mm(s=>s.record),t=cx();we("marketplace_dev_link_reloaded",s=>{Tw(s)&&(e(s),t())})}function Ow(){const e=le();we("relay_bindings_changed",()=>{e.invalidateQueries({queryKey:[...lx]})})}class Fa extends u.Component{constructor(){super(...arguments);bn(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s,r){console.error("[RightPanel] Tab component error:",s,r)}componentDidUpdate(s){s.tabId!==this.props.tabId&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?n.jsx("div",{className:"flex h-full items-center justify-center p-4",children:n.jsx("p",{className:"text-muted-foreground text-sm",children:"This panel stopped working. Switch tabs to try again."})}):this.props.children}}const $a=new Set(["agent-profile","profile","files","room","computer"]),Ba=new Set(["pulse","session","canvas","browser","local-browser","terminal"]),Mw={};function _w(e,t){var Qt,$,ye;const s=P(N=>N.activeRightPanelTab),r=P(N=>N.setActiveRightPanelTab),o=P(N=>N.rightPanelLayoutKey),a=P(N=>N.selectedCwd),i=P(N=>N.explicitAgentPath),c=P(N=>N.sessionId),[d]=cc(),l=t==="/session"?d:null,m=l?`chat/${encodeURIComponent(l)}`:"human",{data:f}=Ub(e.some(N=>N.id==="local-browser")),p=(f==null?void 0:f.status)==="connected"&&f.connectionId&&f.sessionId===l?f:null,h=p?`resource/browser/${m}/${encodeURIComponent(p.connectionId)}`:"local-browser",g=P(N=>N.roomCanvasLiveRoomId),x=P(N=>N.openDocuments),b=P(N=>g?N.roomCanvasDocuments[g]:void 0),y=P(N=>g?N.roomCanvasUnread[g]:void 0),A=P(N=>g?N.roomCanvasPresence[g]:void 0),S=lc(g),I=ae(),v=P(N=>{var H;return g?(H=N.roomCanvasActive[g])==null?void 0:H.canvas:N.activeCanvasDocumentId}),E=P(N=>{var H;return g?(H=N.roomCanvasActive[g])==null?void 0:H.browser:N.activeBrowserDocumentId}),R=P(N=>N.activateCanvasDocument),_=P(N=>N.activateRoomCanvasDocument),D=qo(N=>N.chrome),O=`${c??""}:${a}`,T=(D==null?void 0:D.scope)===O?D:null,[w,C]=u.useState(null);u.useEffect(()=>{if((w==null?void 0:w.scope)!==O||!T)return;const N=w.id?T.tabs.find(H=>`resource/terminal/${H.id}`===w.id):T.tabs.find(H=>H.id===T.activeId);N&&!N.closed&&C(null)},[T,w,O]);const j=zb(),k=g?`room:${g}`:i??o??a??t,M=P(N=>N.canvasSessionId),F=P(N=>N.canvasSessionCwd),B=F!==void 0?M:M??c,W=F!==void 0?F:a,ne=g?`room:${g}`:hm(B,W),fe=g?`room:${g}`:gm(B,W),z=P(N=>N.panelViewPreferences)??Mw,Y=P(N=>N.updatePanelViewPreference),te=P(N=>N.reopenPanelResourceView),de=u.useMemo(()=>new Set(Object.values(z).flatMap(N=>N.closed)),[z]),Q=z[k]??{opened:[],closed:[]},q=((Qt=j.data)==null?void 0:Qt.cwd)!=null&&(i?j.data.cwd.replace(/\/workspace\/?$/,"")===i:j.data.cwd===a)&&j.data.phase!=="disabled"&&j.data.phase!=="unsupported",re=u.useMemo(()=>e.filter(N=>N.id!=="computer"||q),[e,q]),pe=N=>Y==null?void 0:Y(k,N),Z=N=>{var H;return((H=Ne.find(X=>X.id===N))==null?void 0:H.resource)==="browser"},G=N=>{var H;return Z(N)?N:(H=Ne.find(X=>X.id===N))!=null&&H.resource?`${ne}:${N}`:N},xe=N=>{var H;return((H=Ne.find(X=>X.id===N))==null?void 0:H.resource)==="document"?[G(N),`${fe}:${N}`]:[G(N)]},Se=N=>{var H;return((H=Ne.find(X=>X.id===N))==null?void 0:H.resource)==="document"},Je=N=>N==="profile"&&t==="/session",ee=N=>!Je(N)&&xe(N).some(H=>Se(N)||Z(N)?de.has(H):Q.closed.includes(H)),Ne=re.flatMap(N=>{const H=N.id;if(H==="local-browser"){if(!p)return[{...N,category:H,title:"Browser"}];const X=p.tabs.find(ve=>ve.id===p.selectedTabId),oe=p.mode==="embedded"?"DorkOS browser":"New browser window";return[{...N,category:H,resource:"browser",id:h,title:(X==null?void 0:X.title)||oe,icon:ds}]}if(H==="browser"||H==="canvas"){const X=g?fm(b??[],H):pm(x??[],H);if(X.length)return X.map(oe=>{var ve,J,ie;return{...N,category:H,resource:"document",id:`resource/${oe.id}`,title:"title"in oe&&oe.title||oe.sourceLabel||N.title,icon:H==="browser"?ds:Kb,activate:()=>{g?_(g,oe.id):R(oe.id)},..."authorId"in oe?{author:(J=(ve=S.data)==null?void 0:ve.members.find(Re=>Re.author.id===oe.authorId))==null?void 0:J.author,unread:(ie=y==null?void 0:y[H])==null?void 0:ie.includes(oe.id),pinned:oe.pinned,watchers:Object.entries(A??{}).filter(([Re,Ye])=>{var Ve;return Ye===oe.id&&Re!==((Ve=S.data)==null?void 0:Ve.viewerAuthorId)}).flatMap(([Re])=>{var Ye,Ve;return((Ve=(Ye=S.data)==null?void 0:Ye.members.find(Ws=>Ws.author.id===Re))==null?void 0:Ve.author)??[]})}:{}}})}return H==="terminal"&&(T!=null&&T.tabs.length)?T.tabs.map(X=>({...N,category:H,resource:"terminal",id:`resource/terminal/${X.id}`,title:X.title,closed:X.closed,icon:dc,activate:oe=>T.activate(X.id,oe)})):[{...N,category:H,...H==="browser"?{title:"Page previews"}:{},...Je(H)?{permanent:!0}:{}}]}),ot=new Set;if(!g){const N=(x??[]).filter(H=>H.id.startsWith("pending:")&&ee(`resource/${H.id}`));for(const H of x??[])H.id.startsWith("pending:")||H.openedHere||N.some(X=>{var oe;return(oe=X.pendingCandidateIds)==null?void 0:oe.includes(H.id)})&&ot.add(`resource/${H.id}`)}const dt=Ne.some(N=>$a.has(N.category)||!Ba.has(N.category)&&!N.isGlobal),Ae=Ne.filter(N=>(!N.closed||(w==null?void 0:w.scope)===O&&w.id===N.id)&&!ee(N.id)&&!ot.has(N.id)&&($a.has(N.category)||!Ba.has(N.category)||N.resource||N.extensionId||Q.opened.includes(N.category)||N.category===s||!dt&&N.isGlobal&&N.category!=="local-browser"));if(s==="terminal"&&(w==null?void 0:w.scope)===O&&w.id===null&&!Ae.some(N=>N.category==="terminal")){const N=re.find(H=>H.id==="terminal");N&&Ae.push({...N,category:"terminal"})}const be=s==="terminal"?`resource/terminal/${T==null?void 0:T.activeId}`:s==="local-browser"?h:s==="browser"?`resource/${E}`:s==="canvas"?`resource/${v}`:s,yt=(($=Ae.find(N=>N.id===be))==null?void 0:$.id)??((ye=Ae.find(N=>N.category===s))==null?void 0:ye.id)??null,Oe=g?b==null?void 0:b.find(N=>`resource/${N.id}`===be):x==null?void 0:x.find(N=>`resource/${N.id}`===be),U=Oe?`${Oe.rev}:${Oe.lastActiveAt}`:null,ue=P(N=>N.requestedRightPanel),ke=(N,H="pointer")=>{var oe;const X=Ne.find(ve=>ve.id===N);X&&(pe(ve=>({opened:[...new Set([...ve.opened,X.category])].slice(-100),closed:ve.closed.filter(J=>!xe(N).includes(J))})),(X.resource==="document"||X.resource==="browser")&&(te==null||te(xe(N))),C(X.resource==="terminal"?{scope:O,id:X.id}:null),(oe=X.activate)==null||oe.call(X,H),r(X.category))},Me=N=>{var J;if(Je(N))return;const H=x==null?void 0:x.find(ie=>ie.id.startsWith("pending:")&&`resource/${ie.id}`===N),X=H?Ae.filter(ie=>{var Re;return!((Re=H.pendingCandidateIds)!=null&&Re.some(Ye=>{var Ve;return`resource/${Ye}`===ie.id&&!((Ve=x==null?void 0:x.find(Ws=>Ws.id===Ye))!=null&&Ve.openedHere)}))}):Ae,oe=X[X.findIndex(ie=>ie.id===N)+1]??X[X.findIndex(ie=>ie.id===N)-1],ve=Ne.find(ie=>ie.id===N);if(C(null),(ve==null?void 0:ve.resource)==="terminal"&&(T!=null&&T.hide))T.hide(N.slice(18));else{const ie=Re=>({...Re,closed:[...new Set([...Re.closed,G(N)])].slice(-100)});(ve==null?void 0:ve.resource)==="document"?Y==null||Y(`documents:${ne}`,ie):(ve==null?void 0:ve.resource)==="browser"?Y==null||Y(`browsers:${m}`,ie):pe(ie)}N===yt&&((J=oe==null?void 0:oe.activate)==null||J.call(oe,"keyboard"),r((oe==null?void 0:oe.category)??null))};u.useEffect(()=>{if(!s)return;const N=be?xe(be):[];!Q.closed.includes(s)&&(!be||!ee(be))||(pe(H=>({...H,closed:H.closed.filter(X=>X!==s&&!N.includes(X))})),be&&(Se(be)||Z(be))&&(te==null||te(N)))},[s,be,U,ue,ne,m,k]);const qe=s==="browser"?E:s==="canvas"?v:null,Ee=g?b==null?void 0:b.find(N=>N.id===qe):x==null?void 0:x.find(N=>N.id===qe),Rt=async N=>{try{await N()}catch{ce.error("Couldn’t update the canvas.")}},Vt=N=>{Rt(()=>g?I.openRoomCanvasDocument(g,N):P.getState().openCanvasDocument(N)),r(N.type==="url"?"browser":"canvas")};return{available:re,allViews:Ne,visible:Ae,activeId:yt,activate:ke,closeView:Me,terminal:T,createTerminal:re.some(N=>N.id==="terminal")?()=>{C({scope:O,id:null}),pe(N=>({opened:[...new Set([...N.opened,"terminal"])].slice(-100),closed:N.closed.filter(H=>H!=="terminal")})),T?T.create():qo.getState().requestCreate(O),r("terminal")}:void 0,createBrowser:re.some(N=>N.id==="browser")?()=>Vt({type:"url",url:Vr.site,title:"Web Page"}):void 0,createDocument:re.some(N=>N.id==="canvas")?()=>Vt({type:"markdown",content:`# Untitled
|
|
72
|
+
|
|
73
|
+
Start writing…`,title:"Document"}):void 0,removeDocument:Ee?()=>void Rt(()=>g?I.closeRoomCanvasDocument(g,Ee.id):P.getState().closeCanvasDocument(Ee.id)):void 0,pinDocument:g&&Ee?()=>void Rt(()=>I.updateRoomCanvasDocument(g,Ee.id,{pinned:!Ee.pinned})):void 0,documentPinned:(Ee==null?void 0:Ee.pinned)??!1}}function Pw({views:e,activeId:t,onActivate:s,onCreateTerminal:r,onStopTerminal:o,onCreateBrowser:a,onCreateDocument:i,onRemoveDocument:c,onPinDocument:d,documentPinned:l}){const m=e.find(p=>p.resource==="browser")??e.find(p=>p.category==="local-browser"),f=e.filter(p=>p.category!=="local-browser"||p===m);return n.jsxs(As,{children:[n.jsx(Es,{asChild:!0,children:n.jsx(L,{variant:"ghost",size:"icon-md","aria-label":"Add view",className:"size-11 shrink-0 lg:size-7",children:n.jsx(At,{className:"size-3.5"})})}),n.jsxs(Is,{align:"end",className:"max-h-[70dvh] min-w-48 overflow-y-auto [&_[role=menuitem]]:min-h-11 lg:[&_[role=menuitem]]:min-h-0",children:[n.jsx(uc,{children:"Views"}),f.map(p=>n.jsxs(Qe,{"aria-current":p.id===t?"true":void 0,"data-view-category":p.category,"aria-label":p.category==="local-browser"?"Browser":void 0,onSelect:()=>s(p.id),children:[n.jsx($n,{icon:p.icon}),n.jsx("span",{className:"max-w-64 truncate",children:p.category==="local-browser"?"Browser":p.title}),p.category==="local-browser"&&p.resource==="browser"&&n.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground max-w-40 truncate",children:p.title}),p.id===t&&n.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:"✓"})]},p.id)),r&&n.jsxs(n.Fragment,{children:[n.jsx(es,{}),n.jsxs(Qe,{onSelect:r,children:[n.jsx(dc,{}),"New terminal"]})]}),a&&n.jsx(Qe,{onSelect:a,children:"New page preview"}),i&&n.jsx(Qe,{onSelect:i,children:"New document"}),d&&n.jsxs(n.Fragment,{children:[n.jsx(es,{}),n.jsx(Qe,{onSelect:d,children:l?"Unpin document":"Pin document"})]}),c&&n.jsx(Qe,{onSelect:c,children:"Remove document"}),o&&n.jsxs(n.Fragment,{children:[n.jsx(es,{}),n.jsx(Qe,{onSelect:o,children:"Stop terminal"})]})]})]})}function Lw({active:e,hidden:t,here:s,saved:r}){const{setPlacement:o}=Fb(),a=P(x=>x.setActiveRightPanelTab),i=rt(),c=ro(),d=ql(),l=P(x=>x.setRightPanelOpen),m=oo(),f=xm(s)!==null,p=x=>hc(r.get(x.id),x.declaredPlacement),h=(e==null?void 0:e.extensionId)!=null?m.find(x=>x.extensionId===e.extensionId&&x.path==="")??m.find(x=>x.extensionId===e.extensionId)??null:null,g=f?t:[];return!e&&g.length===0?null:n.jsxs(As,{children:[n.jsx(Es,{asChild:!0,children:n.jsx(L,{variant:"ghost",size:"icon-md","aria-label":"Add-on tab options",className:"size-11 shrink-0 lg:size-7","data-testid":"mini-app-tab-menu",children:n.jsx(bm,{className:"size-3.5"})})}),n.jsxs(Is,{align:"end",className:"max-h-[70dvh] min-w-48 overflow-y-auto [&_[role=menuitem]]:min-h-11 lg:[&_[role=menuitem]]:min-h-0",children:[e&&n.jsxs(n.Fragment,{children:[h&&c&&n.jsxs(Qe,{onSelect:()=>{d&&l(!1),c({href:mc(h.extensionId,h.path)})},children:[n.jsx(ym,{}),"Open full page"]}),f&&n.jsxs(Qe,{onSelect:()=>o(e.id,wm(p(e),s)),children:[n.jsx(vm,{}),"Hide here"]}),n.jsxs(Qe,{onSelect:()=>i.open("extensions",e.extensionId),children:[n.jsx(jm,{}),"Where it shows…"]})]}),e&&g.length>0&&n.jsx(es,{}),g.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(uc,{className:"text-muted-foreground text-xs font-normal",children:"Show here"}),g.map(x=>n.jsxs(Qe,{onSelect:()=>{o(x.id,km(p(x),s)),a(x.id)},children:[x.icon?n.jsx($n,{icon:x.icon}):n.jsx(At,{}),x.title]},x.id))]})]})]})}const Fw={canvas:"canvas",browser:"browser"};function $w(e,t){return t==="attention"?`${e}, something needs you`:e}function Bw({contributionId:e}){const t=Fw[e],s=P(o=>{var i;const a=o.roomCanvasLiveRoomId;return a===null||t===void 0?!1:(((i=o.roomCanvasUnread[a])==null?void 0:i[t].length)??0)>0});return Sm(e)==="attention"?n.jsx("span",{"data-slot":"right-panel-tab-marker","aria-hidden":!0,className:"bg-status-warning-dot size-1.5 shrink-0 rounded-full"}):s?n.jsx("span",{"data-slot":"right-panel-tab-unread","aria-hidden":!0,className:"bg-primary size-1.5 shrink-0 rounded-full"}):null}const Io="right-panel-content";function ss(e){return`right-panel-tab-${e}`}function zw({contributions:e,actions:t,activeId:s,onActivate:r,onCloseView:o}){const a=P(d=>d.setRightPanelOpen),i=P(d=>d.activeRightPanelTab),c=P(d=>d.setActiveRightPanelTab);return n.jsxs("div",{className:"flex w-full items-center justify-between px-3 py-2","data-slot":"right-panel-header",children:[e.length>1||r?n.jsx(Uw,{contributions:e,activeTab:s===void 0?i:s,onActivate:r??c,onCloseView:o}):e.length===1?n.jsxs("div",{className:"text-foreground flex items-center gap-1.5 px-1 text-xs font-medium",children:[n.jsx($n,{icon:e[0].icon,className:"text-muted-foreground size-3.5"}),n.jsx("span",{children:e[0].title})]}):n.jsx("div",{}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1 pl-1",children:[t,n.jsx(L,{variant:"ghost",size:"icon-md","aria-label":"Close panel",className:"size-11 shrink-0 lg:size-7",onClick:()=>a(!1),children:n.jsx(Ue,{className:"size-3.5"})})]})]})}function Uw({contributions:e,activeTab:t,onActivate:s,onCloseView:r}){const o=u.useRef(null),a=u.useRef("keyboard"),i=u.useRef(null),c=Cm(p=>p.tabMarkers),d=Nm(o,"horizontal"),l=u.useCallback(()=>{const p=o.current;return!p||!t?null:p.querySelector(`#${CSS.escape(ss(t))}`)},[t]),m=u.useCallback(()=>{const p=o.current,h=l();!p||!h||Am(p,h)},[l]),f=e.map(p=>p.id).join(",");return u.useEffect(()=>{if(m(),typeof ResizeObserver>"u")return;const p=new ResizeObserver(m);for(const h of[o.current,i.current,l()])h&&p.observe(h);return()=>p.disconnect()},[m,l,f]),n.jsx(Il,{asChild:!0,value:t??"",onValueChange:p=>{s(p,a.current),a.current="keyboard"},children:n.jsxs("div",{className:"relative min-w-0 flex-1",children:[n.jsx("div",{ref:o,onScroll:d.onScroll,"data-testid":"right-panel-tabs-scroller",className:"-my-1 overflow-x-auto overflow-y-hidden py-1 max-lg:snap-x max-lg:snap-proximity max-lg:scroll-px-6 max-lg:pe-6",children:n.jsx(Rl,{ref:i,responsive:!1,"aria-label":"Right panel tabs",className:"bg-accent/60 h-auto justify-start gap-0.5 rounded-lg p-0.5",children:e.map(p=>{var g,x;const h=p.id===t;return n.jsxs("div",{className:"group/view relative flex shrink-0 items-center py-2 max-lg:snap-start md:py-0",children:[n.jsxs(fn,{children:[n.jsx(pn,{asChild:!0,children:n.jsxs(ts,{value:p.id,"data-view-category":p.category??p.id,onPointerDown:()=>{a.current="pointer"},onKeyDown:b=>{var y;if(a.current="keyboard",b.key==="Delete"&&r&&!p.permanent){b.preventDefault();const A=e.findIndex(v=>v.id===p.id),S=e[A+1]??e[A-1],I=(y=b.currentTarget.closest('[data-slot="right-panel-header"]'))==null?void 0:y.querySelector('[aria-label="Add view"]');r(p.id),requestAnimationFrame(()=>{var v;S?(v=document.getElementById(ss(S.id)))==null||v.focus():I==null||I.focus()})}},"aria-label":[$w(p.title,c[p.id]??null),p.author&&`Posted by ${p.author.displayName}`,p.unread&&"Unread",((g=p.watchers)==null?void 0:g.length)&&`${p.watchers.map(b=>b.displayName).join(", ")} ${p.watchers.length===1?"is":"are"} looking at this.`].filter(Boolean).join(", "),id:ss(p.id),"aria-controls":h?Io:void 0,className:K("text-muted-foreground hover:text-foreground text-3xs shrink-0 gap-1.5 rounded-md px-2.5 py-1",h&&"bg-background text-foreground shadow-sm"),children:[n.jsx($n,{icon:p.icon,className:"size-3.5"}),p.author&&n.jsx("span",{title:`Posted by ${p.author.displayName}`,children:n.jsx(cs,{size:"xs",kind:p.author.kind,color:p.author.color??as(p.author.id),emoji:p.author.emoji,imageUrl:p.author.imageUrl,fallback:vr(p.author.displayName)})}),n.jsx("span",{className:"max-w-28 truncate",children:p.title}),p.pinned&&n.jsx("span",{"aria-label":"Pinned",children:"·"}),p.unread&&n.jsx("span",{"data-testid":"canvas-tab-unread","data-slot":"canvas-tab-unread","aria-label":"Unread",className:"bg-primary size-1.5 rounded-full"}),!!((x=p.watchers)!=null&&x.length)&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{"data-slot":"canvas-tab-watchers","aria-hidden":!0,className:"flex shrink-0 -space-x-1",children:[p.watchers.slice(0,3).map(b=>n.jsx(cs,{size:"xs",className:"ring-background text-3xs size-3.5 ring-1",kind:b.kind,color:b.color??as(b.id),emoji:b.emoji,imageUrl:b.imageUrl,badge:null,fallback:vr(b.displayName)},b.id)),p.watchers.length>3&&n.jsxs("span",{className:"text-3xs",children:["+",p.watchers.length-3]})]}),n.jsxs("span",{className:"sr-only",children:[p.watchers.map(b=>b.displayName).join(", ")," ",p.watchers.length===1?"is":"are"," looking at this."]})]}),n.jsx(Bw,{contributionId:p.id})]})}),n.jsx(gn,{side:"bottom",children:p.title})]}),r&&h&&!p.permanent&&n.jsx(L,{variant:"ghost",size:"icon-sm",tabIndex:-1,"aria-label":`Close ${p.title} view`,className:"relative size-6 after:absolute after:inset-x-0 after:-inset-y-2 md:after:hidden",onClick:()=>r(p.id),children:n.jsx(Ue,{className:"size-3"})})]},p.id)})})}),d.start&&n.jsx("div",{"aria-hidden":!0,"data-testid":"right-panel-tabs-fade-start",className:"from-sidebar via-sidebar/70 pointer-events-none absolute inset-y-0 left-0 w-6 bg-gradient-to-r to-transparent"}),d.end&&n.jsx("div",{"aria-hidden":!0,"data-testid":"right-panel-tabs-fade-end",className:"from-sidebar via-sidebar/70 pointer-events-none absolute inset-y-0 right-0 w-6 bg-gradient-to-l to-transparent"})]})})}const Tr="app-shell-right-panel",Kw=40,Hw=320,Cd=20,Ww=50;function Gw(e){if(e<=0)return Cd;const t=Hw/e*100;return Math.min(Math.round(t*10)/10,Ww)}function qw(){const[e,t]=u.useState(Cd);return u.useLayoutEffect(()=>{const s=document.querySelector(`[data-panel-group-id="${Tr}"]`);if(!(s instanceof HTMLElement))return;const r=()=>t(Gw(s.offsetWidth));r();const o=new ResizeObserver(r);return o.observe(s),()=>o.disconnect()},[]),{minPct:e,defaultPct:Math.max(Kw,e)}}function Yw(e,t){var h;const s=Em(e),r=Im(),o=P(g=>g.selectedCwd),a=s==="session",i=fc(a?o:null),c=r.status==="loading"||a&&o!==null&&i.isPending,d=r.status==="ready"&&!t?r.roomId:null,l=a?((h=i.data)==null?void 0:h.id)??null:null,m=u.useMemo(()=>Vw(s,d,l,a),[s,d,l,a]),[f,p]=u.useState(null);return!c&&f!==m&&p(m),c?{status:"pending",last:f}:{status:"ready",here:m}}function Vw(e,t,s,r){const o={page:e};return t&&(o.roomId=t),r&&(o.agentId=s),o}const Qw="cubic-bezier(0, 0, 0.2, 1)",Xw="cubic-bezier(0.4, 0, 1, 1)";function za(e,t){return`${e} 300ms ${t?Qw:Xw}`}const Jw=new Set(["pulse","files"]);function Zw(e){e.preventDefault();const t=document.getElementById(Io);t&&!t.contains(document.activeElement)&&t.focus({preventScroll:!0})}function ej({pathname:e,isRemoteCommunityRoom:t=!1}){var Z;const s=P(G=>G.rightPanelOpen),r=P(G=>G.setRightPanelOpen),o=P(G=>G.activeRightPanelTab),a=P(G=>G.setActiveRightPanelTabView),i=ql(),c=Fe(),d=Vl(),l=u.useRef(null),[m,f]=u.useState(!1),[p,h]=u.useState(!1);u.useEffect(()=>{const G=requestAnimationFrame(()=>h(!0));return()=>cancelAnimationFrame(G)},[]);const g=ae(),x=P(G=>G.currentAgentId),b=P(G=>G.selectedCwd),y=P(G=>G.explicitAgentPath),A=Bb(),S=(A==null?void 0:A.kind)??null,I=(A==null?void 0:A.showSessions)??!1,v=u.useMemo(()=>S===null?null:{kind:S,showSessions:I},[S,I]),E=Rs("right-panel"),R=u.useMemo(()=>E.filter(G=>!G.visibleWhen||G.visibleWhen({pathname:e,transport:g,agentId:x,cwd:b,explicitAgentPath:y,isRemoteCommunityRoom:t,directMessage:v})),[E,e,g,x,b,y,t,v]),_=Yw(e,t),D=_.status==="ready"?_.here:_.last,O=$b(),T=Le().data!==void 0,w=u.useMemo(()=>new Map(O.map(G=>[G.tab,G])),[O]),{visibleContributions:C,hiddenMiniAppTabs:j}=u.useMemo(()=>{const G=[],xe=[];for(const Se of R)Se.extensionId?D&&Rm(hc(w.get(Se.id),Se.declaredPlacement),D)?G.push(Se):xe.push(Se):G.push(Se);return{visibleContributions:G,hiddenMiniAppTabs:xe}},[R,D,w]),k=_w(C,e),M=k.visible,B=`${P(G=>G.sessionId)??""}:${b}`;u.useEffect(()=>{if(_.status!=="pending"&&M.length>0&&!M.some(xe=>xe.category===o)){const xe=M.find(Se=>!Se.isGlobal);a((xe??M[0]).category)}},[M,o,a,_.status]);const W=s,{minPct:ne,defaultPct:fe}=qw();u.useEffect(()=>{const G=l.current;G&&(W&&G.isCollapsed()?G.expand(fe):!W&&G.isExpanded()&&G.collapse())},[W,fe]);const z=k.available.find(G=>G.id===o&&M.some(xe=>xe.category===G.id)),Y=k.available.find(G=>G.id==="terminal"),te=Y==null?void 0:Y.component,de=k.terminal!==null||o==="terminal",Q=z==null?void 0:z.component,q=z==null?void 0:z.headerActions,re=n.jsxs(n.Fragment,{children:[n.jsx(zw,{contributions:M,activeId:k.activeId,onActivate:k.activate,onCloseView:k.closeView,actions:n.jsxs(n.Fragment,{children:[n.jsx(Pw,{views:k.allViews,activeId:k.activeId,onActivate:k.activate,onCreateBrowser:k.createBrowser,onCreateDocument:k.createDocument,onRemoveDocument:k.removeDocument,onPinDocument:k.pinDocument,documentPinned:k.documentPinned,onCreateTerminal:k.createTerminal,onStopTerminal:o==="terminal"&&((Z=k.terminal)!=null&&Z.activeId)?()=>{var G;return(G=k.terminal)==null?void 0:G.stop(k.terminal.activeId,"pointer")}:void 0}),q?n.jsx(u.Suspense,{fallback:null,children:n.jsx(q,{})}):null,_.status==="ready"&&T&&n.jsx(Lw,{active:z!=null&&z.extensionId?z:null,hidden:j,here:_.here,saved:w})]})}),(A==null?void 0:A.kind)==="group"&&s&&n.jsx(nw,{members:A.members}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden outline-none",...o===Yo?{tabIndex:-1}:{},...k.activeId&&M.some(G=>G.category===o)?{id:Io,role:"tabpanel","aria-labelledby":ss(k.activeId)}:{},children:n.jsx(Fa,{tabId:o,children:n.jsx(u.Suspense,{fallback:null,children:n.jsxs(Tm,{value:!0,children:[s&&o!=="terminal"&&Q?n.jsx(Q,{}):null,te&&de&&n.jsx("div",{hidden:o!=="terminal"||!s||!z,className:"h-full",children:n.jsx(Dm,{value:o==="terminal"&&s&&!!z,children:n.jsx(Fa,{tabId:o,children:n.jsx(te,{})})})},B),!z&&n.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-sm",children:"Add a view to this panel."})]})})})})]});if(i)return W?n.jsx(Om,{open:!0,onOpenChange:G=>!G&&r(!1),children:n.jsxs(Mm,{showCloseButton:!1,...o===Yo?{onOpenAutoFocus:Zw}:{},style:{top:d.top,bottom:"auto",height:d.height,maxHeight:d.height},className:K("bg-sidebar text-sidebar-foreground flex w-full flex-col gap-0 pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]",c&&"sm:max-w-full",c&&o&&Jw.has(o)&&"!bottom-auto !h-auto max-h-dvh overflow-y-auto"),children:[n.jsxs(_m,{className:"sr-only",children:[n.jsx(Pm,{children:"Panel"}),n.jsx(Lm,{children:"Right panel content."})]}),re]})}):null;const pe=p&&!m;return n.jsxs(n.Fragment,{children:[n.jsx(Pb,{"aria-label":"Resize right panel",disabled:!W,onDragging:f,gripStyle:{opacity:W?1:0,pointerEvents:W?"auto":"none",...pe&&{transition:za("opacity",W)}}}),n.jsx(pc,{ref:l,id:"right-panel",order:2,defaultSize:W?fe:0,minSize:ne,collapsible:!0,collapsedSize:0,onCollapse:()=>{p&&r(!1)},onExpand:()=>{s||r(!0)},style:pe?{transition:za("flex-grow",W)}:void 0,children:n.jsx("div",{inert:!W,className:"bg-sidebar text-sidebar-foreground flex h-full flex-col overflow-hidden border-l",children:re})})]})}const Ua="inbox",tj="open";function nj({blocked:e=!1}={}){const t=Bn()[Ua],s=Qr(),r=t!==void 0,o=t==null?"":String(t).trim();u.useEffect(()=>{!r||!s||(o&&!e&&Fm(void 0,o===tj?void 0:{focus:o}),s({search:a=>({...a,[Ua]:void 0}),replace:!0}))},[r,o,e,s]),u.useEffect(()=>{e&&$m()},[e])}function sj(){const e=P(t=>t.toggleRightPanel);u.useEffect(()=>{const t=s=>{(s.metaKey||s.ctrlKey)&&s.key==="."&&(s.preventDefault(),e())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}function rj(){const e=le();we("capabilities_changed",()=>{e.invalidateQueries({queryKey:gc.all})})}function oj(){const e=ae(),t=le();return Wt({mutationFn:({agentId:s,key:r,surface:o})=>e.patchAgentPermissions(s,{...r.kind==="area"?{areas:{[r.area]:null}}:{},...r.kind==="action"?{actions:{[r.action]:null}}:{},...r.kind==="files"?{filesAndCommands:null}:{},surface:o}),onSettled:()=>{t.invalidateQueries({queryKey:gc.all}),t.invalidateQueries({queryKey:["mesh","agents"]})}})}const Ka=new WeakMap;let aj=0;function ij(e){const t=Ka.get(e);if(t!==void 0)return t;const s=`bar-${aj++}`;return Ka.set(e,s),s}function cj(e){var t;for(let s=e.length-1;s>=0;s--){const r=(t=e[s].staticData)==null?void 0:t.header;if(r)return{key:ij(r),Header:r}}return null}function lj(e){const t=e.startsWith("/")?e:`/${e}`;if(ze()){const s=t.slice(1);if(s.length>0&&!s.startsWith("?")&&!s.startsWith("#"))return`dorkos://${s}`}return`${window.location.origin}${t}`}const dj="/";function Ro(){const e=Gt();return u.useMemo(()=>{const t=()=>ao(e),s=a=>{me.getState().selectTab(a),t()},r=a=>{const i=me.getState().tabs;a(),xc(i,me.getState().tabs)},o=a=>{const{tabs:i}=me.getState(),c=i[a];c&&s(c.id)};return{activate:s,activateIndex:o,activateLast:()=>o(me.getState().tabs.length-1),activateRelative:a=>{const{tabs:i,activeTabId:c}=me.getState();if(i.length<2)return;const d=i.findIndex(f=>f.id===c),m=(((d===-1?0:d)+a)%i.length+i.length)%i.length;s(i[m].id)},close:a=>{r(()=>me.getState().closeTab(a)),t()},closeActive:()=>{const{tabs:a,activeTabId:i}=me.getState();if(!i)return!1;const c=a.length;r(()=>me.getState().closeTab(i));const d=me.getState().tabs.length<c;if(d)try{t()}catch(l){console.error("[dorkos:tabs] could not follow a closed tab",l)}return d},create:()=>zm(e,dj),togglePin:a=>{const i=me.getState().tabs.find(c=>c.id===a);i&&me.getState().setTabPinned(a,!i.pinned)},duplicate:a=>{me.getState().duplicateTab(a),t()},closeOthers:a=>{r(()=>me.getState().closeOtherTabs(a)),t()},reorder:(a,i)=>me.getState().moveTab(a,i),reopenClosed:a=>{Bm(e,a).catch(i=>{console.error("[dorkos:tabs] could not reopen a closed tab",i)})}}},[e])}const uj={start:["Space"],cancel:["Escape"],end:["Space","Enter","Tab"]},mj=4,hj={draggable:"Press Space to move this tab. Arrows move it, Space drops it, Escape cancels."};function fj(e){return t=>{const s=e(String(t.active.id));return bc({...t,droppableContainers:t.droppableContainers.filter(r=>e(String(r.id))===s)})}}class pj extends Map{getEnabled(){return[...this.values()].filter(t=>!t.disabled)}toArray(){return[...this.values()]}}function gj(e){return(t,s)=>{const{context:r}=s;if(!r.active)return wr(t,s);const o=e(String(r.active.id)),a=new pj;for(const i of r.droppableContainers.toArray())e(String(i.id))===o&&a.set(i.id,i);return wr(t,{...s,context:{...r,droppableContainers:a}})}}function xj(e){return e.length===0?null:{left:Math.min(...e.map(t=>t.left)),right:Math.max(...e.map(t=>t.right))}}function bj(e){return({transform:t,activeNodeRect:s})=>{const r=e();if(!r||!s)return t;const o=r.left-s.left,a=r.right-s.right;return{...t,x:Math.min(Math.max(t.x,o),a)}}}function yj(e,t,s){if(s==null)return null;const r=e.indexOf(String(t)),o=e.indexOf(String(s));return r===-1||o===-1||r===o?null:[r,o]}function vj(e){const{nameOf:t,indexOf:s,count:r}=e,o=a=>`position ${s(a)+1} of ${r()}`;return{onDragStart:({active:a})=>`Picked up ${t(String(a.id))}.`,onDragOver:({active:a,over:i})=>i?`${t(String(a.id))} is over ${o(String(i.id))}.`:void 0,onDragEnd:({active:a,over:i})=>i?`${t(String(a.id))} dropped at ${o(String(i.id))}.`:`${t(String(a.id))} put back.`,onDragCancel:({active:a})=>`Move cancelled. ${t(String(a.id))} put back.`}}const wj=500;function jj(e){const t=zn(new Date(e).toISOString());return`Last active ${t==="Just now"?"just now":t}`}function kj({identity:e,className:t}){return n.jsxs("div",{className:K("flex min-w-0 flex-col gap-1.5 text-xs",t),children:[n.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[n.jsx(io,{icon:e.icon,className:"mt-px"}),n.jsxs("p",{className:"min-w-0 font-medium break-words",children:[e.primary,e.secondary&&n.jsxs("span",{className:"text-muted-foreground font-normal",children:[" · ",e.secondary]})]})]}),e.origin&&n.jsx("p",{className:"text-muted-foreground",children:e.origin}),e.statusSentence&&n.jsxs("p",{className:"flex items-center gap-1.5",children:[n.jsx(co,{identity:e}),n.jsx("span",{children:e.statusSentence})]}),e.lastActiveAt!==void 0&&!Number.isNaN(e.lastActiveAt)&&n.jsx("p",{className:"text-muted-foreground",children:jj(e.lastActiveAt)})]})}function Sj({identity:e,children:t}){return n.jsxs($l,{openDelay:wj,closeDelay:0,children:[n.jsx(Bl,{asChild:!0,children:t}),n.jsx(zl,{side:"bottom",align:"start",sideOffset:6,className:"w-64 p-3",children:n.jsx(kj,{identity:e})})]})}const Nd="app-tab-panel";function Cj({identity:e,isActive:t,canClose:s,collapseAgent:r=!1,pinned:o=!1,tabProps:a,onClose:i}){const c=Km(e,{collapseAgent:r}),d=u.useRef(null);u.useEffect(()=>{var m,f;t&&((f=(m=d.current)==null?void 0:m.scrollIntoView)==null||f.call(m,{block:"nearest",inline:"nearest"}))},[t]);const l=s&&!o;return n.jsxs("div",{ref:d,role:"presentation",className:"group relative flex shrink-0",children:[n.jsx(Sj,{identity:e,children:n.jsxs("button",{type:"button",role:"tab","aria-selected":t,"aria-controls":t?Nd:void 0,"aria-label":Hm(e,{collapseAgent:r}),...a,className:K("focus-ring flex min-w-0 items-center gap-1.5 rounded-md py-1 text-xs transition-colors",o?"px-2":t?"max-w-72 pl-2":"max-w-52 pl-2",!o&&(l?"pr-7":"pr-2"),t?"bg-secondary text-foreground contrast-more:ring-foreground/40 contrast-more:ring-1":"text-muted-foreground/80 hover:bg-secondary/50 hover:text-foreground contrast-more:text-muted-foreground"),children:[n.jsx(io,{icon:e.icon}),!o&&n.jsxs("span",{className:"min-w-0 truncate",children:[n.jsx("span",{className:"font-medium",children:c.lead}),c.trail&&n.jsxs("span",{className:"opacity-70",children:[" · ",c.trail]})]}),n.jsx(co,{identity:e})]})}),l&&i&&n.jsx("button",{type:"button",tabIndex:-1,onClick:()=>i("pointer"),"aria-label":`Close ${e.primary}`,className:K("focus-ring hover:bg-muted absolute top-1/2 right-1 -translate-y-1/2 rounded-sm p-0.5","opacity-0 transition-opacity group-hover:opacity-70 hover:opacity-100",t&&"opacity-70"),children:n.jsx(Ue,{className:"size-3"})})]})}function Nj({tab:e,isActive:t,canClose:s,pinned:r,tabProps:o,onClose:a}){const i=Ts(e.href),c=Um(i.agentKey);return n.jsx(Cj,{identity:i,isActive:t,canClose:s,collapseAgent:c,pinned:r??e.pinned??!1,tabProps:o,onClose:d=>a(e.id,d)})}function Aj({href:e,onSelect:t}){const s=Ts(e);return n.jsxs(Tt,{onSelect:t,children:[n.jsx("span",{className:"truncate",children:s.primary}),s.secondary&&n.jsx("span",{className:"text-muted-foreground ml-1.5 truncate",children:s.secondary})]})}function Ej({tabId:e,pinned:t,hasOthersToClose:s,canClose:r,actions:o,onClosed:a,children:i}){const c=Wm(),{reopenClosed:d}=o;return n.jsxs(Gm,{children:[n.jsx(qm,{asChild:!0,children:i}),n.jsxs(Ym,{className:"w-56",onCloseAutoFocus:a?l=>{l.preventDefault(),a()}:void 0,children:[n.jsxs(Tt,{onSelect:()=>o.togglePin(e),children:[t?n.jsx(Vm,{className:"mr-2 size-4"}):n.jsx(Qm,{className:"mr-2 size-4"}),t?"Unpin":"Pin"]}),n.jsxs(Tt,{onSelect:()=>o.duplicate(e),children:[n.jsx(Ay,{className:"mr-2 size-4"}),"Duplicate"]}),n.jsxs(Tt,{onSelect:()=>o.copyLink(e),children:[n.jsx(Xm,{className:"mr-2 size-4"}),"Copy link"]}),n.jsx(Vo,{}),n.jsxs(Tt,{disabled:!s,onSelect:()=>o.closeOthers(e),children:[n.jsx(Jm,{className:"mr-2 size-4"}),"Close others"]}),n.jsxs(Tt,{disabled:!r,onSelect:()=>o.close(e),children:[n.jsx(Ue,{className:"mr-2 size-4"}),"Close"]}),d&&n.jsxs(n.Fragment,{children:[n.jsx(Vo,{}),n.jsxs(Tt,{disabled:c.length===0,onSelect:()=>d(),children:[n.jsx(yc,{className:"mr-2 size-4"}),"Reopen closed tab",n.jsx("kbd",{className:"text-muted-foreground ml-auto pl-4 text-xs",children:Bt(sn.REOPEN_CLOSED_TAB)})]}),n.jsxs(Zm,{children:[n.jsxs(eh,{disabled:c.length===0,children:[n.jsx(Ul,{className:"mr-2 size-4"}),"Recently closed"]}),n.jsx(th,{className:"max-h-96 w-64 overflow-y-auto",children:c.map(l=>n.jsx(Aj,{href:l.tab.href,onSelect:()=>d({tabId:l.tab.id,closedAt:l.closedAt})},`${l.tab.id}-${l.closedAt}`))})]})]})]})]})}const Cn="data-app-tab-id";function Ij({tab:e,isActive:t,canClose:s,tabProps:r,onClose:o,sortable:a,dragActive:i,menu:c,hasOthersToClose:d,onMenuClosed:l}){const m=e.pinned??!1,{setNodeRef:f,setActivatorNodeRef:p,attributes:h,listeners:g,transform:x,transition:b,isDragging:y}=nh({id:e.id,disabled:!a}),A=g==null?void 0:g.onPointerDown,S=g==null?void 0:g.onKeyDown,I={transform:x?`translate3d(${Math.round(x.x)}px, 0, 0)`:void 0,transition:b??void 0},{ref:v,onKeyDown:E}=r,R=u.useCallback(T=>{v(T),p(T)},[v,p]),_=u.useCallback(T=>{if(c&&(T.key==="ContextMenu"||T.shiftKey&&T.key==="F10")){T.preventDefault();const w=T.currentTarget,C=w.getBoundingClientRect();w.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:C.left,clientY:C.bottom}));return}S==null||S(T),!(T.defaultPrevented||i)&&E(T)},[c,S,i,E]),D=u.useMemo(()=>({...r,ref:R,onKeyDown:_,...a?{"aria-describedby":h["aria-describedby"]}:{}}),[r,R,_,a,h]),O=n.jsx("div",{ref:f,role:"presentation",[Cn]:e.id,style:I,onPointerDown:A,className:K("flex shrink-0",y&&"bg-background shadow-soft relative z-10 rounded-md"),children:n.jsx(Nj,{tab:e,isActive:t,canClose:s,tabProps:D,onClose:o,pinned:m})});return c?n.jsx(Ej,{tabId:e.id,pinned:m,hasOthersToClose:d,canClose:s,actions:c,onClosed:l,children:O}):O}function Rj({tabs:e,activeId:t,onActivate:s,onClose:r,onCreate:o,menu:a,onReorder:i,className:c}){const d=u.useRef(null),l=u.useRef(null),m=vc(null),f=e.length>1,[p,h]=u.useState(!1),g=u.useMemo(()=>e.map(O=>O.id),[e]),x=Dt(e),{collisionDetection:b,coordinateGetter:y,modifiers:A,announcements:S}=u.useMemo(()=>{const O=w=>x.read().findIndex(C=>C.id===w),T=w=>{var C;return((C=x.read().find(j=>j.id===w))==null?void 0:C.pinned)??!1};return{collisionDetection:fj(T),coordinateGetter:gj(T),modifiers:[bj(m.read)],announcements:vj({nameOf:w=>{var C,j,k;return((k=(j=(C=Array.from(document.querySelectorAll(`[${Cn}]`)).find(M=>M.getAttribute(Cn)===w))==null?void 0:C.querySelector('[role="tab"]'))==null?void 0:j.textContent)==null?void 0:k.trim())||"Tab"},indexOf:O,count:()=>x.read().length})}},[x,m]),I=wc(us(Sc,{activationConstraint:{distance:mj}}),us(kc,{coordinateGetter:y,keyboardCodes:uj})),v=({active:O})=>{var C,j;h(!0);const T=((C=e.find(k=>k.id===O.id))==null?void 0:C.pinned)??!1,w=Array.from(((j=l.current)==null?void 0:j.querySelectorAll(`[${Cn}]`))??[]).filter(k=>{var F;const M=k.getAttribute(Cn);return(((F=e.find(B=>B.id===M))==null?void 0:F.pinned)??!1)===T}).map(k=>k.getBoundingClientRect());m.write(xj(w))},E=()=>{h(!1),m.write(null)},R=({active:O,over:T})=>{E();const w=yj(g,O.id,T==null?void 0:T.id);w&&i&&i(...w)},_=()=>{setTimeout(()=>{var O,T;(T=(O=l.current)==null?void 0:O.querySelector('[role="tab"][aria-selected="true"]'))==null||T.focus()},0)},{getTabProps:D}=Cb({orderedIds:e.map(O=>O.id),activeId:t,onActivate:s,onClose:f?r:void 0,getFallbackFocus:()=>d.current});return n.jsxs("div",{className:K("bg-muted/40 flex shrink-0 items-stretch border-b px-2 py-1",c),children:[n.jsx("div",{className:"flex min-w-0 flex-1 items-stretch overflow-x-auto",children:n.jsx(jc,{sensors:I,collisionDetection:b,modifiers:A,accessibility:{announcements:S,screenReaderInstructions:hj},onDragStart:v,onDragEnd:R,onDragCancel:E,children:n.jsx(sh,{items:g,strategy:rh,children:n.jsx("div",{ref:l,role:"tablist","aria-label":"Open tabs",className:"flex items-stretch gap-1",children:e.map(O=>n.jsx(Ij,{tab:O,isActive:O.id===t,canClose:f,tabProps:D(O.id),onClose:r,sortable:i!==void 0,dragActive:p,menu:a,onMenuClosed:_,hasOthersToClose:e.some(T=>T.id!==O.id&&!T.pinned)},O.id))})})})}),n.jsx("button",{ref:d,type:"button",onClick:o,"aria-label":"New tab",title:`New tab (${Bt(sn.NEW_TAB)})`,className:"focus-ring text-muted-foreground hover:bg-background/60 hover:text-foreground ml-1 flex shrink-0 items-center rounded-md px-1.5 transition-colors",children:n.jsx(At,{className:"size-3.5"})})]})}function Tj({className:e}){const t=oh(),s=me(h=>h.activeTabId),{activate:r,close:o,create:a,togglePin:i,duplicate:c,closeOthers:d,reorder:l,reopenClosed:m}=Ro(),{copy:f}=Fn({toastOnSettle:!0}),p=u.useMemo(()=>({togglePin:i,duplicate:c,closeOthers:d,close:o,reopenClosed:m,copyLink:h=>{const g=me.getState().tabs.find(x=>x.id===h);g&&f(lj(g.href))}}),[i,c,d,o,m,f]);return n.jsx(Rj,{tabs:t,activeId:s,onActivate:r,onClose:o,onCreate:a,menu:p,onReorder:l,className:e})}function bs(){var s;const{tabs:e,activeTabId:t}=me.getState();return((s=e.find(r=>r.id===t))==null?void 0:s.cursor)??null}function To(e,t){const s=bs();s!==null&&(me.getState().goToHistoryIndex(t),bs()!==s&&ao(e))}function Ad(e){const t=bs();t!==null&&To(e,t-1)}function Ed(e){const t=bs();t!==null&&To(e,t+1)}function Dj(e,t){To(e,t)}function Ha(e,t){const s=Bt(e);return zt?s:`${s} or ${Bt(`alt+${t}`)}`}const er="size-7";function Oj({href:e,isCurrent:t,onSelect:s}){const r=Ts(e);return n.jsxs(Qe,{disabled:t,"aria-current":t?"page":void 0,onSelect:s,"aria-label":r.accessibleName,className:"data-[disabled]:opacity-100",children:[n.jsx(io,{icon:r.icon}),n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[r.primary,r.secondary&&n.jsxs("span",{className:"text-muted-foreground",children:[" · ",r.secondary]})]}),n.jsx(co,{identity:r}),n.jsx(cn,{className:K("size-3.5 shrink-0",!t&&"invisible")})]})}function tr({label:e,keys:t,children:s}){return n.jsxs(fn,{children:[n.jsx(pn,{asChild:!0,children:s}),n.jsx(gn,{side:"bottom",className:"text-xs",children:t?`${e} (${t})`:e})]})}function Mj(){const e=Gt(),{entries:t,cursor:s,canGoBack:r,canGoForward:o}=ah();if(!ze())return null;const a=t.map((i,c)=>({href:i,index:c})).reverse();return n.jsxs("div",{className:"flex items-center",children:[n.jsx(tr,{label:"Back",keys:Ha(sn.HISTORY_BACK.key,"←"),children:n.jsx(L,{variant:"ghost",size:"icon-md",className:er,"aria-label":"Back",disabled:!r,onClick:()=>Ad(e),children:n.jsx(Cc,{})})}),n.jsx(tr,{label:"Forward",keys:Ha(sn.HISTORY_FORWARD.key,"→"),children:n.jsx(L,{variant:"ghost",size:"icon-md",className:er,"aria-label":"Forward",disabled:!o,onClick:()=>Ed(e),children:n.jsx(Nc,{})})}),n.jsxs(As,{children:[n.jsx(tr,{label:"History",children:n.jsx(Es,{asChild:!0,children:n.jsx(L,{variant:"ghost",size:"icon-md",className:er,"aria-label":"History",children:n.jsx(Ul,{})})})}),n.jsx(Is,{align:"start",className:"max-w-72 min-w-48",children:a.map(({href:i,index:c})=>n.jsx(Oj,{href:i,isCurrent:c===s,onSelect:()=>Dj(e,c)},c))})]})]})}function _j(){const e=Gt(),t=_e({select:o=>o.location.href}),s=u.useRef(!1),r=u.useRef(!0);u.useEffect(()=>{if(ze())return e.history.subscribe(({action:o})=>{s.current=o.type!=="PUSH"&&o.type!=="REPLACE",r.current=o.type==="REPLACE"})},[e]),u.useEffect(()=>{if(!ze())return;const o=s.current,a=r.current;s.current=!1,r.current=!1,me.getState().syncLocation(t,{traversal:o,replace:a})},[t])}const Wa=9;function Pj(){const e=Ro();u.useEffect(()=>{if(!ze())return;const t=s=>{if(!(s.metaKey||s.ctrlKey)||s.altKey)return;if(s.shiftKey){s.code==="BracketLeft"?(s.preventDefault(),e.activateRelative(-1)):s.code==="BracketRight"?(s.preventDefault(),e.activateRelative(1)):s.key.toLowerCase()==="t"&&(s.preventDefault(),e.reopenClosed());return}if(s.key==="t"||s.key==="T"){s.preventDefault(),e.create();return}if(!s.code.startsWith("Digit"))return;const r=Number(s.code.slice(5));!Number.isInteger(r)||r<1||r>Wa||(s.preventDefault(),r===Wa?e.activateLast():e.activateIndex(r-1))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}const Ga=3,Lj=4;function Fj(e){return e instanceof Element?e.closest("input, textarea, select")?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function qa(e){return e instanceof Element&&e.closest('[role="dialog"], [role="alertdialog"], [role="menu"]')!==null}function $j(e){if(e.shiftKey)return null;if((zt?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey)return e.code==="BracketLeft"?"back":e.code==="BracketRight"?"forward":null;if(!zt&&e.altKey&&!e.ctrlKey&&!e.metaKey){if(Fj(e.target))return null;if(e.key==="ArrowLeft")return"back";if(e.key==="ArrowRight")return"forward"}return null}function Bj(){const e=Gt();u.useEffect(()=>{if(!ze())return;const t=i=>i==="back"?Ad(e):Ed(e),s=i=>{if(i.defaultPrevented||i.isComposing||qa(i.target))return;const c=$j(i);c&&(i.preventDefault(),t(c))},r=i=>i.button===Ga||i.button===Lj,o=i=>{r(i)&&i.preventDefault()},a=i=>{r(i)&&(i.preventDefault(),!qa(i.target)&&t(i.button===Ga?"back":"forward"))};return document.addEventListener("keydown",s),document.addEventListener("mousedown",o),document.addEventListener("mouseup",a),()=>{document.removeEventListener("keydown",s),document.removeEventListener("mousedown",o),document.removeEventListener("mouseup",a)}},[e])}function zj(e){return typeof e=="object"&&e!==null&&e.status===404}async function Uj(e){try{return await e(),!1}catch(t){return zj(t)}}async function Kj(e,t){const s=new Map,r=(a,i)=>{let c=s.get(a);return c||(c=Uj(i),s.set(a,c)),c},o=await Promise.all(e.map(async a=>{const i=ih(a.href);if(i.pathname==="/session"&&i.sessionId&&!i.draft){const c=i.sessionId;return await r(`session:${c}`,()=>t.getSession(c))?a.id:null}if(i.pathname==="/channels"&&i.roomId&&!i.community){const c=i.roomId;return await r(`room:${c}`,()=>t.getRoom(c))?a.id:null}return null}));return new Set(o.filter(a=>a!==null))}function Hj(){const e=ae(),t=Gt();u.useEffect(()=>{if(!ze())return;let s=!1;const r=me.getState().tabs;return Kj(r,{getSession:o=>e.getSession(o),getRoom:o=>e.getRoom(o)}).then(o=>{if(s||o.size===0)return;const{tabs:a,activeTabId:i}=me.getState();me.getState().dropTabs(o),xc(a,me.getState().tabs),me.getState().activeTabId!==i&&ao(t)}).catch(o=>{console.error("[dorkos:tabs] could not check restored tabs",o)}),()=>{s=!0}},[])}function Wj(){_j(),Pj(),ch(),Hj(),Bj()}function Gj(e){return e.displayName||e.name}function Do(e,t){const s=Dn(r=>r.setRouteBadge);u.useEffect(()=>{s(e,t)},[e,t,s])}const qj=5*6e4;function Yj(e){return e.status==="active"&&e.enabled}function Vj(e){const{enabled:t}=dh(),{data:s}=Ac(t),{data:r}=uh(t),o=Dn(c=>c.setSchedulesWaitingCount),a=u.useMemo(()=>{const c=tw(t?r??[]:[]),d=new Map((s??[]).filter(Yj).map(l=>[l.id,l]));return{waiting:e,failed:c.failed.filter(l=>d.has(l)).length,running:c.running.flatMap(l=>{const m=d.get(l);return m?[Gj(m)]:[]})}},[t,r,s,e]),i=u.useMemo(()=>mh(a),[a]);Do("/tasks",i),u.useEffect(()=>{o(e)},[e,o])}function Qj(){const{count:e,more:t}=hh(),s=u.useMemo(()=>fh(e,t),[e,t]);Do("/activity",s)}function Xj(){const{data:e,isSuccess:t}=Zg("pending"),{data:s}=ex("pending",{enabled:t,refetchInterval:qj}),r=((e==null?void 0:e.length)??0)+((s==null?void 0:s.length)??0),o=u.useMemo(()=>ph(r),[r]);Do("/connections",o)}function Jj(){const{items:e,schedules:t}=lh(),s=Dn(r=>r.setNeedsYouCount);u.useEffect(()=>{s(e.length)},[e.length,s]),Vj(t.length),Qj(),Xj()}function Lt(e){return"problem"in e?{problem:e.problem}:{message:e.message}}const Ft={message:"Couldn’t reach your DorkOS account. Try again."},Zj={message:"Finish signing in in your browser, then try again."},ek={message:"Your browser blocked the window. Allow pop-ups, then try again."},nr={message:"Couldn’t connect this DorkOS to the space. Try again."},tk={message:"The approval ran out. Connect again."};function Oo(e,t,s){var D,O;const r=ae(),o=le(),a=Ln(e!==null),{signsInWithAccount:i,linkFor:c}=Ec(e!==null),[d,l]=u.useState({opened:!1,busy:!1,notice:null}),[m,f]=u.useState(null),p=u.useRef(null),h=Ie({queryKey:at.list(),queryFn:()=>r.listHostedCommunities(),enabled:e!==null&&m===null,refetchInterval:T=>{const w=T.state.data,C=(w==null?void 0:w.available)===!0?w.communities.find(j=>j.communityId===(e==null?void 0:e.communityId)):void 0;return(C==null?void 0:C.state)==="provisioning"?2e3:!1}}),g=((D=h.data)==null?void 0:D.available)===!0?h.data.communities.find(T=>T.communityId===(e==null?void 0:e.communityId)):void 0,x=(g==null?void 0:g.state)==="provisioning",b=u.useCallback(()=>{if(!e||d.busy)return;const T=Jr();if(T===null){l(w=>({...w,notice:ek}));return}l(w=>({...w,busy:!0,notice:null})),r.getHostedCommunityClaimLink(e.communityId).then(w=>{if(!w.ok){T.close(),l(j=>({...j,busy:!1,notice:Lt(w)}));return}const C=T.go(c(w.claimUrl));l(j=>({opened:j.opened||C,busy:!1,notice:null}))}).catch(()=>{T.close(),l(w=>({...w,busy:!1,notice:Ft}))})},[e,d.busy,r,c]),y=u.useCallback(async()=>{if(e){if(!a||!Ot(a)){f({ref:null,approvalUrl:null,busy:!1,notice:nr});return}f({ref:null,approvalUrl:null,busy:!0,notice:null});try{const T=await r.startCommunityConnection({url:e.communityUrl,installName:t});f({ref:T.connection.ref,approvalUrl:T.approvalUrl,busy:!1,notice:null}),await o.invalidateQueries({queryKey:jt.connections(a)})}catch{f({ref:null,approvalUrl:null,busy:!1,notice:nr})}}},[e,a,r,t,o]),A=u.useCallback(()=>{!e||d.busy||(l(T=>({...T,busy:!0,notice:null})),r.listHostedCommunities().then(T=>{o.setQueryData(at.list(),T);const w=T.available===!0?T.communities.find(C=>C.communityId===e.communityId):void 0;if(!w||w.state==="pending_owner"||w.state==="provisioning"){l(C=>({...C,busy:!1,notice:Zj}));return}l(C=>({...C,busy:!1})),y()}).catch(()=>l(T=>({...T,busy:!1,notice:Ft}))))},[e,d.busy,r,o,y]),S=(m==null?void 0:m.ref)??null,I=Ie({queryKey:a&&S?jt.approval(a,S):["cloud","no-approval"],queryFn:()=>Qi(a,()=>r.pollCommunityConnection(S)),enabled:a!==null&&S!==null,retry:!1,refetchInterval:T=>!T.state.error&&(!T.state.data||T.state.data.status==="pending")?2e3:!1}),v=S!==null?((O=I.data)==null?void 0:O.status)??"pending":"pending",E=v==="connected"?S:null;u.useEffect(()=>{E===null||p.current===E||(p.current=E,a&&o.invalidateQueries({queryKey:jt.connections(a)}),o.invalidateQueries({queryKey:at.all}),s(E))},[E,a,o,s]);const R=v==="expired"||v==="cancelled";return{state:E!==null?{kind:"done",ref:E}:m!==null?{kind:"connecting",approvalUrl:m.approvalUrl,busy:m.busy,notice:m.notice??(R?tk:I.error?nr:null)}:x?{kind:"preparing"}:{kind:"claim",...d,withAccount:e!==null&&i(e.communityUrl)},openClaim:b,confirmClaimed:A,openApproval:()=>{m!=null&&m.approvalUrl&&Ct(c(m.approvalUrl))},retryConnect:()=>void y()}}const xn=ct().regex(/^[a-z](?:[a-z0-9]|-(?=[a-z0-9])){2,31}$/,"must be lower-case letters, digits and single hyphens, start with a letter, and not end with a hyphen").describe("A community short name: lower case, 3 to 32 characters, letters, digits and single hyphens, starting with a letter and not ending with a hyphen."),Id=ct().trim().min(1).max(80).describe("The community`s display name. Trimmed, 1 to 80 characters."),Rd=ct().min(1).max(200).describe("A key the caller chooses, scoped to the caller. Sending it again returns the same community or move instead of making a second one.");function nk(e){return Hn.meta({description:e,[Sl]:!0})}const sk=Un(["provisioning","pending_owner","active","archived","held","suspended","deletion_pending"]).describe("Where a hosted community is in its lifecycle. The Community server`s own lifecycle names, plus provisioning while the server confirms a start."),rk=Un(["over_limit","inactive","host"]).describe("Why a hosted community is on hold: the account holds more than its allowance covers, nobody has posted in a long time, or the host placed the hold itself."),ok=he({title:ct().min(1).max(120).describe("A short summary, safe to show a person."),detail:ct().max(2e3).describe("The explanation, safe to show a person."),actionUrl:ux.optional().catch(void 0).describe("A page where the owner can act on the notice. Open it as given. A malformed value is dropped."),actionLabel:ct().min(1).max(60).optional().catch(void 0).describe("The text for a button that opens `actionUrl`. A malformed value is dropped.")}).describe("What the service wants the owner to read about this community, in its own words."),ak=he({allowed:_t().describe("The owner may choose this community as one to keep open."),wouldHold:Kn(nt).describe("The caller`s other communities that keeping this one would put on hold.")}).describe("Whether the owner may keep this community open, and which others it would hold."),Mo=he({communityId:nt.describe("The community`s permanent identifier on its Community server. Never changes, even across a rename."),orgId:nt.describe("The organization whose account this community belongs to."),name:ct().min(1).max(80).describe("The community`s display name."),shortName:xn.nullable().describe("The community`s current short name, or null when it has none."),communityUrl:Hn.describe("The community`s canonical link on its Community server, built on its permanent identifier. A runtime value; pair a DorkOS installation with this."),state:ps(sk).describe("Where the community is in its lifecycle. A state this release does not know reads as unrecognised."),hold:he({reason:ps(rk).describe("Why the community is on hold. A reason this release does not know reads as unrecognised."),since:wt,deletionNoticeAt:wt.nullable().describe("When the host may delete the community if the hold is not lifted, or null when no deletion is planned. The owner can export until then.")}).nullable().describe("Why and since when the community is on hold. Always set when the state is held."),deletionAt:wt.nullable().describe("When the Community server will delete the community for good. Always set when the state is deletion_pending."),notice:ok.nullable().describe("What the service wants the owner to read about this community, or null when there is nothing."),kept:_t().describe("True when the owner chose this community to stay open while the account holds more communities than its allowance covers."),moveId:nt.nullable().describe("The move filling this community from an owner export, while that move is unfinished. Null otherwise. Lets the app pick up a move after a restart."),limits:he({maxActiveMembers:ge().int().positive().nullable().describe("The most people who may be active members at once. Null means no limit."),maxStorageBytes:ge().int().nonnegative().nullable().describe("The most bytes of files the community may store. Null means no per-community limit.")}).describe("The limits the host enforces on this community. Agents and history never count."),usage:he({activeMembers:ge().int().nonnegative(),storageBytes:ge().int().nonnegative().describe("The bytes that count against the storage limit. Owner exports never count."),measuredAt:wt}).nullable().describe("The community`s last measured usage, or null before the first measurement."),actions:he({claimLink:_t().describe("The service will issue a fresh owner-claim link for this community."),keep:ak,restore:_t().describe("The owner may ask for this held community to reopen.")}).describe("What the caller may do next. Render an action only when it is allowed; the service applies the rule, the app never re-derives it."),createdAt:wt}).superRefine((e,t)=>{e.state==="held"&&e.hold===null&&t.addIssue({code:"custom",path:["hold"],message:"a held community says why"}),e.state==="deletion_pending"&&e.deletionAt===null&&t.addIssue({code:"custom",path:["deletionAt"],message:"a community pending deletion says when"})}).describe("One community the caller has hosted, with its state, limits and usage. Numbers only.");kl(Mo,"A page of the communities the caller has hosted.");he({name:xn}).describe("The short name to check.");const ik=Un(["taken","reserved"]).describe("Why a short name cannot be used: another community has it, or the host reserves it.");he({name:xn,available:_t(),reason:ik.nullable().describe("Why the name cannot be used. Null exactly when it is available.")}).superRefine((e,t)=>{e.available!==(e.reason===null)&&t.addIssue({code:"custom",path:["reason"],message:"reason is null exactly when the name is available"})}).describe("Whether a short name is free right now. Advisory; starting a community checks again.");he({idempotencyKey:Rd,name:Id,shortName:xn.optional().describe("The short name to give the community. Omitted means none."),orgId:nt.optional().describe("The organization whose account the community belongs to. Omitted means the caller`s personal one.")}).describe("Start a hosted community. Idempotent on the caller`s key.");const ck=he({communityId:nt,claimUrl:nk("The owner-claim link. A single-use credential: open it in the person`s own browser and never log it."),expiresAt:wt.describe("When the link stops working.")}).describe("A one-time link that makes a person the owner of a new community. Returned once.");he({community:Mo,claim:ck.nullable().describe("The owner-claim link, or null when this answer repeats an earlier request or the community is still provisioning."),replayed:_t().describe("True when this answer repeats an earlier request with the same key.")}).superRefine((e,t)=>{e.claim!==null&&(e.replayed||e.community.state!=="pending_owner")&&t.addIssue({code:"custom",path:["claim"],message:"a claim link comes only on the first answer, for a pending_owner community"})}).describe("The started community and, the first time only, its owner-claim link.");he({expectedHeldCommunityIds:Kn(nt).describe("The communities the owner was told this choice would hold, in any order.")}).describe("Keep this community open, confirming which others the owner agreed to hold.");he({community:Mo,heldCommunityIds:Kn(nt).describe("Other communities of the caller`s that this choice put on hold. Often empty.")}).describe("The kept community, and every other community the choice put on hold.");const lk=Un(["awaiting_upload","importing","ready","failed","cancelled","claimed"]).describe("Where a move is: waiting for the export, importing it, ready to claim, or finished."),dk=Un(["not_owner_export","archive_invalid","checksum_mismatch","version_unsupported","too_large","storage_limit_reached","upload_expired","storage_unavailable"]).describe("Why a move failed, in terms a person can act on."),uk=he({channels:ge().int().nonnegative(),entries:ge().int().nonnegative().describe("Messages and replies."),attachments:ge().int().nonnegative(),historicalMembers:ge().int().nonnegative().describe("People whose messages move. They join again by invitation."),historicalAgents:ge().int().nonnegative().describe("Agents whose messages move. Their owners pair them again."),attachmentBytes:ge().int().nonnegative(),countedBytes:ge().int().nonnegative().describe("The bytes that will count against the community`s storage limit.")}).describe("What an owner export holds, in counts and sizes only."),Td=he({moveId:nt,communityId:nt.describe("The new community the export fills. It no longer exists once a move has failed or been cancelled."),communityUrl:Hn.describe("The new community`s canonical link. A runtime value."),name:ct().min(1).max(80).describe("The name the new community was given."),state:ps(lk).describe("Where the move is. A state this release does not know reads as unrecognised."),failureCode:ps(dk).nullable().describe("Why the move failed. Always set when the state is failed. A code this release does not know reads as unrecognised."),report:uk.nullable().describe("What the export holds, once it has been read. Null before then."),pollAfterMs:ge().int().nonnegative().nullable().describe("How long to wait before reading the move again. Null once it has finished."),updatedAt:wt}).superRefine((e,t)=>{e.state==="failed"&&e.failureCode===null&&t.addIssue({code:"custom",path:["failureCode"],message:"a failed move says why"})}).describe("One move of a community into hosting, from an owner export.");kl(Td,"A page of the caller`s moves: every unfinished one, and those that finished within the last 7 days, newest first.");he({idempotencyKey:Rd,name:Id,shortName:xn.optional().describe("The short name to give the new community. Omitted means none."),orgId:nt.optional().describe("The organization whose account the community belongs to. Omitted means the caller`s personal one."),archiveBytes:ge().int().positive().describe("The size of the export file, in bytes."),archiveSha256:ct().regex(/^[a-f0-9]{64}$/,"must be a lower-case hex SHA-256 digest").describe("The SHA-256 of the export file, as lower-case hex.")}).describe("Start moving a community in from an owner export. Idempotent on the caller`s key.");const mk=he({url:Hn.describe("Where to send the export. A runtime value."),token:mx.meta({description:"The upload bearer credential. Returned once; never log it.",[Sl]:!0}),expiresAt:wt.describe("When the upload window closes."),maxBytes:ge().int().positive().describe("The largest file the upload accepts."),parts:he({partBytes:ge().int().positive().describe("The largest part the upload accepts."),maxBytes:ge().int().positive().describe("The largest file a parted upload accepts.")}).optional().describe("Present when the Community server accepts the file in parts.")}).describe("Where and how to send the export file. The token is returned once."),Dd=ct().regex(/^[a-f0-9]{64}$/,"must be a lower-case hex SHA-256 digest"),_o=1e4,hk=he({partNumber:ge().int().positive().max(_o).describe("The number of the part, counting up from one."),byteSize:ge().int().positive().describe("The size of the part, in bytes."),sha256:Dd.describe("The SHA-256 of the part, as lower-case hex.")}).describe("One part the Community server has received.");he({parts:Kn(hk).max(_o).describe("The parts received, in part order."),maxPartBytes:ge().int().positive().describe("The largest part the upload accepts."),maxArchiveBytes:ge().int().positive().describe("The largest file a parted upload accepts.")}).describe("The parts of a parted upload received so far.");he({parts:ge().int().positive().max(_o).describe("How many parts make up the file."),archiveBytes:ge().int().positive().describe("The size of the whole file, in bytes."),archiveSha256:Dd.describe("The SHA-256 of the whole file, as lower-case hex.")}).describe("Put the uploaded parts together into the declared file.");he({move:Td,upload:mk.nullable().describe("Where to send the export, or null when this answer repeats an earlier request."),replayed:_t().describe("True when this answer repeats an earlier request with the same key.")}).superRefine((e,t)=>{e.replayed!==(e.upload===null)&&t.addIssue({code:"custom",path:["upload"],message:"upload is null exactly when the answer is replayed"})}).describe("The started move and, the first time only, where to send the export.");const fk=Hn.regex(/^https?:\/\/[^/?#]+$/,"must be an origin: no path, query or fragment").refine(e=>new URL(e).origin===e,{message:"must be written as the URL standard writes an origin"}).describe("A Community server`s origin: scheme, host and port, written as the URL standard writes it. A runtime value."),pk=he({origin:fk}).describe("A Community server whose single sign-on is this account.");he({servers:Kn(pk).max(100).describe("Every Community server whose single sign-on is this account. Often one.")}).describe("The Community servers where this account signs a person in.");function Od(e){switch(e){case"not_owner_export":return{title:"This is a personal export, not an owner export.",next:"Sign in to the old space as its owner, export it from Settings, then try again."};case"archive_invalid":return{title:"This file is damaged, or it isn’t a space export.",next:"Export the old space again, then try again."};case"checksum_mismatch":return{title:"Part of this export is damaged.",next:"Export the old space again, then try again."};case"version_unsupported":return{title:"This export comes from a version DorkOS can’t read yet.",next:"Update the old space, export it again, then try again."};case"too_large":return{title:"This export is too large to move.",next:"Delete some large files in the old space, export it again, then try again."};case"storage_limit_reached":return{title:"The files don’t fit in the new space’s storage.",next:"Delete some files in the old space, export it again, then try again."};case"upload_expired":return{title:"The file didn’t arrive in time.",next:"Start the move again."};case"storage_unavailable":return{title:"DorkOS couldn’t store the files just now.",next:"Wait a little while, then start the move again."};default:return{title:"The move stopped for an unknown reason.",next:"Update DorkOS to see more, or start the move again."}}}function gk(e){switch(e){case"provisioning":return"Being set up";case"pending_owner":return"Waiting for its owner";case"active":return"Open";case"archived":return"Archived";case"held":return"On hold";case"suspended":return"Suspended";case"deletion_pending":return"Being deleted";default:return"Unknown state"}}function xk(e){switch(e){case"over_limit":return"Your account has more spaces than it allows. Choose which ones stay open.";case"inactive":return"Nobody has posted here in a long time. You can reopen it.";case"host":return"DorkOS put this space on hold. People can still read it.";default:return"This space is on hold. Update DorkOS to see why."}}function sr(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"})}function _n(e){const t=["bytes","KB","MB","GB","TB"];let s=e,r=0;for(;s>=1e3&&r<t.length-1;)s/=1e3,r++;return`${r===0||s>=10?Math.round(s):Math.round(s*10)/10} ${t[r]}`}function Md(e){if((e==null?void 0:e.maxCommunities)==null||e.usedCommunities==null)return null;const t=e.maxCommunities-e.usedCommunities;return t<=0?"Your account has no room for another space right now.":`You can start ${t} more ${t===1?"space":"spaces"}.`}const _d="Lower-case letters, numbers and single hyphens. 3 to 32 characters, starting with a letter.";function Gn(e){const t=e.trim().toLowerCase();return t===""?{value:t,valid:!0}:{value:t,valid:xn.safeParse(t).success}}const bk=80,Pd="That web address is taken.",Ld="That web address can’t be used.";function Fd(e){const t=ae(),{value:s,valid:r}=Gn(e),[o,a]=u.useState(s);u.useEffect(()=>{const d=setTimeout(()=>a(s),400);return()=>clearTimeout(d)},[s]);const i=Ie({queryKey:at.name(o),queryFn:()=>t.checkHostedCommunityName(o),enabled:r&&o!==""&&o===s,staleTime:1e4,retry:!1});if(s==="")return{kind:"none"};if(!r)return{kind:"invalid"};if(o!==s||i.isPending)return{kind:"checking"};const c=i.data;return!c||c.available===!1?{kind:"none"}:c.check.available?{kind:"available"}:{kind:c.check.reason==="reserved"?"reserved":"taken"}}function yk(){const e=u.useRef(null);return t=>{var r;const s=JSON.stringify(t);return((r=e.current)==null?void 0:r.body)!==s&&(e.current={body:s,key:crypto.randomUUID()}),e.current.key}}function vk(){const e=ae(),t=le(),s=yk(),[r,o]=u.useState(!1),[a,i]=u.useState({field:null,notice:null});async function c(d){const l={name:d.name.trim(),...d.shortName?{shortName:d.shortName}:{}};o(!0),i({field:null,notice:null});try{const m=await e.startHostedCommunity({...l,idempotencyKey:s(l)});return m.ok?(t.invalidateQueries({queryKey:at.list()}),{community:m.community}):("problem"in m&&m.problem.code==="community_name_taken"?i({field:Pd,notice:null}):"problem"in m&&m.problem.code==="community_name_reserved"?i({field:Ld,notice:null}):i({field:null,notice:Lt(m)}),null)}catch{return i({field:null,notice:Ft}),null}finally{o(!1)}}return{submitting:r,failure:a,clearFieldFailure:()=>i(d=>({...d,field:null})),submit:c}}function wk(e){switch(e.state){case"awaiting_upload":{const t=e.upload;if((t==null?void 0:t.state)==="sending")return{kind:"uploading",move:e};if((t==null?void 0:t.state)==="sent")return{kind:"importing",move:e};const s=t===null?"restarted":t.failure==="interrupted"?"interrupted":t.failure==="rejected"?"refused":"expired";return{kind:"upload-failed",move:e,why:s}}case"importing":return{kind:"importing",move:e};case"ready":case"claimed":return{kind:"ready",move:e};case"failed":return{kind:"failed",move:e};case"cancelled":return{kind:"cancelled",move:e};default:return{kind:"unrecognised",move:e}}}function jk(e){return e.state==="awaiting_upload"||e.state==="importing"||e.state==="ready"}function kk(e){var I;const t=ae(),s=le(),[r,o]=u.useState(e),[a,i]=u.useState(null),[c,d]=u.useState({field:null,notice:null}),[l,m]=u.useState(!1),f=u.useRef(null),p=u.useRef(null),h=Ie({queryKey:at.move(r??""),queryFn:()=>t.getHostedCommunityMove(r),enabled:r!==null,refetchInterval:v=>{var R;const E=v.state.data;return(E==null?void 0:E.available)!==!0?!1:((R=E.move.upload)==null?void 0:R.state)==="sending"?1e3:E.move.pollAfterMs===null?!1:Math.max(1e3,E.move.pollAfterMs)}}),g=((I=h.data)==null?void 0:I.available)===!0?h.data.move:null,x=g?wk(g):null,b=u.useCallback(v=>{s.setQueryData(at.move(v.moveId),{available:!0,move:v})},[s]);async function y(v){var O;const E={name:v.name.trim(),...v.shortName?{shortName:v.shortName}:{},file:[v.file.name,v.file.size,v.file.lastModified]},R=JSON.stringify(E);((O=p.current)==null?void 0:O.body)!==R&&(p.current={body:R,key:crypto.randomUUID()});const _=p.current.key,D=new AbortController;f.current=D,d({field:null,notice:null}),i({loaded:0,total:v.file.size});try{const T=await t.checkHostedCommunityMoveRoom(v.file.size,D.signal);if(D.signal.aborted)return;const w=T.ok?await t.startHostedCommunityMove(v.file,{idempotencyKey:_,name:E.name,...v.shortName?{shortName:v.shortName}:{}},C=>i(C),D.signal):T;(w.ok||w.mayExist!==!0)&&(p.current=null),w.ok?(b(w.move),o(w.move.moveId),s.invalidateQueries({queryKey:at.list()})):"problem"in w&&w.problem.code==="community_name_taken"?d({field:Pd,notice:null}):"problem"in w&&w.problem.code==="community_name_reserved"?d({field:Ld,notice:null}):d({field:null,notice:Lt(w)})}catch{D.signal.aborted?p.current=null:d({field:null,notice:Ft})}finally{f.current=null,i(null)}}async function A(){if(f.current){f.current.abort();return}if(r){m(!0);try{const v=await t.cancelHostedCommunityMove(r);v.ok?b(v.move):d({field:null,notice:Lt(v)}),s.invalidateQueries({queryKey:at.list()})}catch{d({field:null,notice:Ft})}finally{m(!1)}}}async function S(){if(r){m(!0),d({field:null,notice:null});try{const v=await t.retryHostedCommunityMoveUpload(r);v.ok?b(v.move):d({field:null,notice:Lt(v)})}catch{d({field:null,notice:Ft})}finally{m(!1)}}}return{step:x,sending:a,failure:c,clearFieldFailure:()=>d(v=>({...v,field:null})),busy:l,start:y,cancel:A,sendAgain:S,startOver:()=>{o(null),d({field:null,notice:null})}}}function Sk(){var a,i,c;const e=rc(),t=hx(),s=Cl(t);if(!e||!t||s.isPending||((a=s.data)==null?void 0:a.available)===!1)return null;const r=((i=s.data)==null?void 0:i.available)===!0?s.data:null,o=(r==null?void 0:r.moves)??[];return{allowance:(r==null?void 0:r.allowance)??null,unfinishedMoveId:((c=o.find(jk))==null?void 0:c.moveId)??null}}const Ck={message:"Your spaces changed. Check the list again."};function Nk(){const e=ae(),t=le(),[s,r]=u.useState(null),[o,a]=u.useState(null),[i,c]=u.useState({});function d(m,f){c(p=>{const h={...p};return f?h[m]=f:delete h[m],h})}async function l(m,f){a(m),d(m,null);try{d(m,await f())}catch{d(m,Ft)}finally{a(null),await t.invalidateQueries({queryKey:at.list()})}}return{confirmingKeep:s,busyId:o,notices:i,askKeep:r,cancelKeep:()=>r(null),keep:m=>l(m.communityId,async()=>{r(null);const f=await e.keepHostedCommunity(m.communityId,m.actions.keep.wouldHold);return f.ok?null:"problem"in f&&f.problem.code==="conflict"?Ck:Lt(f)}),restore:m=>l(m.communityId,async()=>{const f=await e.restoreHostedCommunity(m.communityId);return f.ok?null:Lt(f)})}}function Po({open:e,onOpenChange:t,step:s,locked:r}){return n.jsx(xt,{open:e,onOpenChange:o=>r&&!o?void 0:t(o),children:n.jsxs(bt,{className:"!min-h-0 sm:max-w-lg",children:[n.jsxs(ht,{children:[n.jsx(tt,{children:s.title}),s.description!==void 0&&n.jsx(ft,{children:s.description})]}),s.body!==void 0&&n.jsx(St,{className:"space-y-4 py-2",children:s.body}),n.jsx(tn,{className:"gap-2 sm:gap-2",children:s.actions})]})})}function Ht({notice:e}){if("message"in e)return n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e.message});const{title:t,detail:s,actionUrl:r,actionLabel:o}=e.problem;return n.jsxs("div",{role:"alert",className:"border-status-warning-border bg-status-warning-bg text-status-warning-fg space-y-2 rounded-md border p-3 text-sm",children:[n.jsx("p",{className:"font-medium break-words",children:t}),s&&n.jsx("p",{className:"break-words",children:s}),r&&n.jsxs(L,{type:"button",size:"sm",variant:"outline",onClick:()=>Ct(r),children:[o??"Open your account",n.jsx(nn,{className:"size-3.5","aria-hidden":!0})]})]})}function Lo(e){const{state:t,name:s}=e;switch(t.kind){case"preparing":return{title:`Setting up ${s}`,description:"Keep this open, or come back later.",body:n.jsxs("p",{role:"status",className:"text-muted-foreground flex items-center gap-2 text-sm",children:[n.jsx(De,{className:"size-4"})," Setting up…"]}),actions:n.jsx(L,{variant:"outline",onClick:e.onClose,children:"Close"})};case"claim":return{title:`Make ${s} yours`,description:t.withAccount?"Sign in with your DorkOS account in your browser, then come back.":"Sign in or create an account in your browser, then come back.",body:t.notice?n.jsx(Ht,{notice:t.notice}):void 0,actions:n.jsxs(n.Fragment,{children:[n.jsxs(L,{variant:t.opened?"outline":"default",disabled:t.busy,onClick:e.onOpenClaim,children:[t.opened?"Open it again":"Open in your browser",n.jsx(nn,{className:"size-3.5","aria-hidden":!0})]}),n.jsx(L,{variant:t.opened?"default":"outline",disabled:t.busy,onClick:e.onConfirmClaimed,children:t.busy?"Checking…":"I’ve finished"})]})};case"connecting":return{title:`Connect this DorkOS to ${s}`,description:t.approvalUrl?`Approve this DorkOS on ${s}. This page then moves on.`:"Getting the approval page ready…",body:n.jsxs(n.Fragment,{children:[t.approvalUrl&&!t.notice&&n.jsxs("p",{role:"status",className:"text-muted-foreground flex items-center gap-2 text-sm",children:[n.jsx(De,{className:"size-4"})," Waiting for your approval"]}),t.notice&&n.jsx(Ht,{notice:t.notice})]}),actions:t.notice?n.jsx(L,{disabled:t.busy,onClick:e.onRetryConnect,children:"Connect again"}):n.jsxs(L,{disabled:t.busy||!t.approvalUrl,onClick:e.onOpenApproval,children:["Open approval page",n.jsx(nn,{className:"size-3.5","aria-hidden":!0})]})};case"done":return{title:`${s} is ready`,description:e.doneDetail,body:n.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[n.jsx(ks,{className:"text-status-success-fg size-4","aria-hidden":!0}),"It’s selected in your spaces."]}),actions:n.jsx(L,{onClick:e.onClose,children:"Done"})}}}function Ak(e){const t=e.usage;if(!t)return null;const{maxActiveMembers:s,maxStorageBytes:r}=e.limits,o=`${t.activeMembers.toLocaleString()}${s!==null?` of ${s.toLocaleString()}`:""} ${t.activeMembers===1&&s===null?"person":"people"}`,a=`${_n(t.storageBytes)}${r!==null?` of ${_n(r)}`:""} of files`;return`${o} · ${a}`}function Ek({community:e,names:t,actions:s,onFinishSetup:r,onOpenMove:o}){const a=s.busyId===e.communityId,i=s.confirmingKeep===e.communityId,c=s.notices[e.communityId],d=Ak(e),l=e.actions.keep.wouldHold.map(f=>t.get(f)??"another space"),m=e.state==="held"||e.state==="deletion_pending"||e.state==="suspended";return n.jsxs("li",{className:"space-y-2 rounded-lg border p-3",children:[n.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"truncate text-sm font-medium",children:e.name}),e.shortName&&n.jsx("p",{className:"text-muted-foreground truncate font-mono text-xs",children:e.shortName})]}),n.jsx(Tn,{variant:m?"outline":"secondary",className:m?"border-status-warning-border text-status-warning-fg shrink-0":"shrink-0",children:gk(e.state)})]}),e.state==="unrecognised"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Update DorkOS to see this space’s state."}),e.hold&&n.jsxs("div",{className:"space-y-1 text-sm",children:[n.jsx("p",{children:xk(e.hold.reason)}),n.jsxs("p",{className:"text-muted-foreground",children:["On hold since ",sr(e.hold.since),"."]}),e.hold.deletionNoticeAt&&n.jsxs("p",{className:"text-destructive",children:["DorkOS may delete it after ",sr(e.hold.deletionNoticeAt),". You can export it until then."]})]}),e.deletionAt&&n.jsxs("p",{className:"text-destructive text-sm",children:["It will be deleted for good on ",sr(e.deletionAt),"."]}),e.notice&&n.jsxs("div",{className:"bg-muted/50 space-y-1 rounded-md p-2 text-sm",children:[n.jsx("p",{className:"font-medium break-words",children:e.notice.title}),e.notice.detail&&n.jsx("p",{className:"break-words",children:e.notice.detail}),e.notice.actionUrl&&n.jsxs(L,{size:"sm",variant:"outline",onClick:()=>Ct(e.notice.actionUrl),children:[e.notice.actionLabel??"Learn more",n.jsx(nn,{className:"size-3.5","aria-hidden":!0})]})]}),d&&n.jsx("p",{className:"text-muted-foreground text-xs tabular-nums",children:d}),i&&n.jsxs("div",{role:"group","aria-label":`Keep ${e.name} open`,className:"space-y-2 text-sm",children:[n.jsx("p",{children:l.length===0?`Keep ${e.name} open? Nothing else changes.`:`Keeping ${e.name} open puts ${l.length===1?"this one":"these"} on hold: ${l.join(", ")}. People can still read ${l.length===1?"it":"them"}.`}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(L,{size:"sm",variant:"outline",onClick:s.cancelKeep,children:"Cancel"}),n.jsx(L,{size:"sm",disabled:a,onClick:()=>void s.keep(e),children:"Keep it open"})]})]}),c&&n.jsx(Ht,{notice:c}),!i&&n.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.actions.claimLink&&n.jsx(L,{size:"sm",onClick:()=>r(e),children:"Finish setting up"}),e.moveId&&n.jsx(L,{size:"sm",variant:"outline",onClick:()=>o(e.moveId),children:"See the move"}),e.actions.keep.allowed&&n.jsx(L,{size:"sm",variant:"outline",disabled:a,onClick:()=>s.askKeep(e.communityId),children:"Keep this one open"}),e.actions.restore&&n.jsx(L,{size:"sm",variant:"outline",disabled:a,onClick:()=>void s.restore(e),children:a?"Reopening…":"Reopen"})]})]})}function Ik(e){switch(e.state){case"awaiting_upload":return{text:"Uploading the export"};case"importing":return{text:"Moving the history"};case"ready":return{text:"Ready to make yours"};case"claimed":return{text:"Moved"};case"cancelled":return{text:"Cancelled"};case"failed":{const t=Od(e.failureCode??"unrecognised");return{text:t.title,next:t.next}}default:return{text:"Unknown state. Update DorkOS to see more."}}}function Rk(e){const t=new Map(e.communities.map(s=>[s.communityId,s.name]));return n.jsxs("div",{className:"space-y-4",children:[e.allowanceText&&n.jsx("p",{className:"text-muted-foreground text-sm",children:e.allowanceText}),e.communities.length>0?n.jsx("ul",{className:"space-y-2",children:e.communities.map(s=>n.jsx(Ek,{community:s,names:t,actions:e.actions,onFinishSetup:e.onFinishSetup,onOpenMove:e.onOpenMove},s.communityId))}):n.jsx("p",{className:"text-muted-foreground text-sm",children:"No spaces yet."}),e.moves.length>0&&n.jsxs("section",{"aria-labelledby":"hosted-moves",className:"space-y-2",children:[n.jsx("h4",{id:"hosted-moves",className:"text-sm font-medium",children:"Recent moves"}),n.jsx("ul",{className:"space-y-2",children:e.moves.map(s=>{const r=Ik(s),o=s.state==="awaiting_upload"||s.state==="importing"||s.state==="ready";return n.jsxs("li",{className:"flex flex-wrap items-start justify-between gap-2 rounded-lg border p-3",children:[n.jsxs("div",{className:"min-w-0 space-y-0.5 text-sm",children:[n.jsx("p",{className:"truncate font-medium",children:s.name}),n.jsx("p",{className:s.state==="failed"?"text-destructive":"text-muted-foreground",children:r.text}),r.next&&n.jsx("p",{className:"text-muted-foreground",children:r.next})]}),o&&n.jsx(L,{size:"sm",variant:"outline",onClick:()=>e.onOpenMove(s.moveId),children:"Continue"})]},s.moveId)})})]})]})}function Tk(e){return e.open?n.jsx(Dk,{...e}):null}function Dk({open:e,onOpenChange:t,installName:s,onOpenMove:r,onMoveHere:o,onConnected:a}){var h;const i=Cl(!0),c=Nk(),[d,l]=u.useState(null),m=Oo(d,s,a),f=()=>t(!1);let p;if(d)p=Lo({state:m.state,name:d.name,doneDetail:"Invite people from the space’s own settings when you’re ready.",onOpenClaim:m.openClaim,onConfirmClaimed:m.confirmClaimed,onOpenApproval:m.openApproval,onRetryConnect:m.retryConnect,onClose:f});else{const g=((h=i.data)==null?void 0:h.available)===!0?i.data:null;p={title:"Your spaces",description:"Spaces hosted under your DorkOS account.",body:i.isPending?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"}):g?n.jsx(Rk,{communities:g.communities,moves:g.moves,allowanceText:Md(g.allowance),actions:c,onFinishSetup:l,onOpenMove:x=>{f(),r(x)}}):n.jsx(Ht,{notice:{message:"Couldn’t reach your DorkOS account. Try again."}}),actions:n.jsxs(n.Fragment,{children:[n.jsx(L,{variant:"outline",onClick:f,children:"Close"}),n.jsx(L,{variant:"outline",onClick:()=>{f(),o()},children:"Move one here"})]})}}return n.jsx(Po,{open:e,onOpenChange:t,step:p})}function Ok(e){switch(e.kind){case"invalid":return{text:_d,error:!0};case"checking":return{text:"Checking…",error:!1};case"available":return{text:"That web address is free.",error:!1};case"taken":return{text:"That web address is taken.",error:!0};case"reserved":return{text:"That web address can’t be used.",error:!0};default:return null}}function $d(e){const t=u.useId(),s=e.webAddressError?{text:e.webAddressError,error:!0}:Ok(e.webAddressStatus);return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{htmlFor:`${t}-name`,children:"Space name"}),n.jsx(gt,{id:`${t}-name`,required:!0,maxLength:bk,autoComplete:"off",value:e.name,disabled:e.disabled,onChange:r=>e.onNameChange(r.target.value)})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs(We,{htmlFor:`${t}-address`,children:["Web address ",n.jsx("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),n.jsx(gt,{id:`${t}-address`,autoComplete:"off",autoCapitalize:"none",spellCheck:!1,maxLength:32,placeholder:"book-club",value:e.webAddress,disabled:e.disabled,"aria-invalid":(s==null?void 0:s.error)||void 0,"aria-describedby":`${t}-address-hint`,onChange:r=>e.onWebAddressChange(r.target.value)}),n.jsx("p",{id:`${t}-address-hint`,"aria-live":"polite",className:s!=null&&s.error?"text-destructive text-sm":"text-muted-foreground text-sm",children:(s==null?void 0:s.text)??_d})]})]})}const Mk="Your history is here. Send invitations so people can join again.";function _k(e,t){return{title:"Move a space here",description:"This copies your space’s history and files to DorkOS.",body:n.jsxs("div",{className:"space-y-2 text-sm",children:[n.jsx("p",{children:"Everyone joins again and reconnects their DorkOS."}),n.jsx("p",{className:"text-muted-foreground",children:"Your old space keeps running until you delete it."}),n.jsx("p",{className:"font-medium",children:"First, export the old space:"}),n.jsxs("ol",{className:"text-muted-foreground list-decimal space-y-1 pl-5",children:[n.jsx("li",{children:"Sign in to the old space as its owner."}),n.jsx("li",{children:"Open its Settings."}),n.jsx("li",{children:"Choose Export."}),n.jsx("li",{children:"Enter your password."}),n.jsx("li",{children:"Save the .zip file."})]})]}),actions:n.jsxs(n.Fragment,{children:[n.jsx(L,{variant:"outline",onClick:t,children:"Cancel"}),n.jsx(L,{onClick:e,children:"I have the file"})]})}}function Pk({file:e,onFileChange:t}){const s=u.useId();return n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{htmlFor:s,children:"Export file"}),n.jsx(gt,{id:s,type:"file",accept:".zip,application/zip",onChange:r=>{var o;return t(((o=r.target.files)==null?void 0:o[0])??null)},className:"cursor-pointer"}),e&&n.jsxs("p",{className:"text-muted-foreground text-sm break-all",children:[e.name,", ",_n(e.size)]})]})}function Lk(e){const t=Gn(e.webAddress),s=e.file===null||e.name.trim()===""||!t.valid||e.webAddressStatus.kind==="taken"||e.webAddressStatus.kind==="reserved";return{title:"Choose the export",description:"Pick the .zip file, then name the space.",body:n.jsxs("form",{id:e.formId,onSubmit:e.onSubmit,className:"space-y-4",noValidate:!0,children:[n.jsx(Pk,{file:e.file,onFileChange:e.onFileChange}),n.jsx($d,{name:e.name,onNameChange:e.onNameChange,webAddress:e.webAddress,onWebAddressChange:e.onWebAddressChange,webAddressStatus:e.webAddressStatus,webAddressError:e.failure.field,disabled:!1}),e.failure.notice&&n.jsx(Ht,{notice:e.failure.notice}),n.jsx(ko,{})]}),actions:n.jsxs(n.Fragment,{children:[n.jsx(L,{type:"button",variant:"outline",onClick:e.onBack,children:"Back"}),n.jsx(L,{type:"submit",form:e.formId,disabled:s,children:"Start moving"})]})}}function Bd({label:e,loaded:t,total:s}){const r=s>0?Math.round(t/s*100):0;return n.jsxs("div",{className:"space-y-2",children:[n.jsx(nb,{value:r,"aria-label":e}),n.jsxs("p",{className:"text-muted-foreground text-sm tabular-nums",children:[_n(t)," of ",_n(s)]})]})}function Fk(e,t){return{title:"Getting the file ready",description:"Keep this open. The upload then starts on its own.",body:n.jsx(Bd,{label:"Getting the file ready",...e}),actions:n.jsx(L,{variant:"outline",onClick:t,children:"Cancel"})}}function $k(e){const t=e.report;if(!t)return null;const s=r=>r.toLocaleString();return`${s(t.channels)} ${t.channels===1?"channel":"channels"}, ${s(t.entries)} ${t.entries===1?"message":"messages"} and ${s(t.attachments)} ${t.attachments===1?"file":"files"}.`}function Bk(e,t){const{move:s}=e,r=t.notice?n.jsx(Ht,{notice:t.notice}):null,o=n.jsx(L,{variant:"outline",disabled:t.busy,onClick:t.onCancelMove,children:"Cancel move"}),a=n.jsx(L,{onClick:t.onStartOver,children:"Start again"}),i=n.jsx(L,{variant:"outline",onClick:t.onClose,children:"Close"});switch(e.kind){case"uploading":{const c=s.upload;return{title:`Uploading ${s.name}`,description:"You can close this window. Keep DorkOS running until it finishes.",body:n.jsxs(n.Fragment,{children:[n.jsx(Bd,{label:`Uploading ${s.name}`,loaded:c.sentBytes,total:c.totalBytes}),r]}),actions:o}}case"upload-failed":return e.why==="interrupted"?{title:"The upload didn’t finish",description:"DorkOS still has the file. Send it again to continue.",body:r,actions:n.jsxs(n.Fragment,{children:[o,n.jsx(L,{disabled:t.busy,onClick:t.onSendAgain,children:"Send again"})]})}:e.why==="refused"?{title:"DorkOS didn’t accept the file",description:"The file arrived changed or incomplete.",body:n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-muted-foreground text-sm",children:"Cancel the move, export the old space again, then start again."}),r]}),actions:o}:e.why==="restarted"?{title:"This move has to start again",description:"DorkOS restarted, or the move began on another computer.",body:n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-muted-foreground text-sm",children:"Cancel the move and start again with the same export."}),n.jsx("p",{className:"text-muted-foreground text-sm",children:"Or finish it on the computer that started it."}),n.jsx("p",{className:"text-muted-foreground text-sm",children:"For safety, uploads only work while DorkOS stays running."}),r]}),actions:o}:{title:"The time to upload ran out",description:"Cancel the move, then start again with the same export.",body:r,actions:o};case"importing":{const c=$k(s);return{title:`Moving ${s.name}`,description:"You can close this window or quit. The move keeps going.",body:n.jsxs(n.Fragment,{children:[n.jsxs("p",{role:"status",className:"text-muted-foreground flex items-center gap-2 text-sm",children:[n.jsx(De,{className:"size-4"})," Moving your history…"]}),c&&n.jsx("p",{className:"text-sm",children:c}),r]}),actions:n.jsxs(n.Fragment,{children:[o,n.jsx(L,{onClick:t.onClose,children:"Close"})]})}}case"failed":{const c=Od(s.failureCode??"unrecognised");return{title:c.title,description:c.next,body:n.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing was kept. Your old space is unchanged."}),actions:n.jsxs(n.Fragment,{children:[i,a]})}}case"cancelled":return{title:"Move cancelled",description:"Nothing was kept. Your old space is unchanged.",actions:n.jsxs(n.Fragment,{children:[i,a]})};case"unrecognised":return{title:`Moving ${s.name}`,description:"Update DorkOS to see where this move is.",body:r,actions:i}}}function zk(e){return e.open?n.jsx(Uk,{...e}):null}function Uk({open:e,onOpenChange:t,installName:s,resumeMoveId:r,onConnected:o}){var I,v;const[a,i]=u.useState("explain"),[c,d]=u.useState(null),[l,m]=u.useState(""),[f,p]=u.useState(""),h=kk(r),g=Fd(a==="choose"&&!h.step?f:""),x=((I=h.step)==null?void 0:I.kind)==="ready"?h.step.move:null,b=Oo(x?{communityId:x.communityId,name:x.name,communityUrl:x.communityUrl}:null,s,o),y=()=>t(!1);function A(E){E.preventDefault();const R=Gn(f);!c||l.trim()===""||!R.valid||h.start({file:c,name:l,shortName:R.value})}let S;return h.sending?S=Fk(h.sending,()=>void h.cancel()):((v=h.step)==null?void 0:v.kind)==="ready"?S=Lo({state:b.state,name:h.step.move.name,doneDetail:Mk,onOpenClaim:b.openClaim,onConfirmClaimed:b.confirmClaimed,onOpenApproval:b.openApproval,onRetryConnect:b.retryConnect,onClose:y}):h.step?S=Bk(h.step,{busy:h.busy,notice:h.failure.notice,onCancelMove:()=>void h.cancel(),onSendAgain:()=>void h.sendAgain(),onStartOver:()=>{h.startOver(),i("choose")},onClose:y}):a==="explain"?S=_k(()=>i("choose"),y):S=Lk({file:c,onFileChange:d,name:l,onNameChange:m,webAddress:f,onWebAddressChange:E=>{p(E),h.clearFieldFailure()},webAddressStatus:g,failure:h.failure,formId:"move-community-form",onSubmit:A,onBack:()=>i("explain")}),n.jsx(Po,{open:e,onOpenChange:t,step:S,locked:h.sending!==null})}function Kk(e){const t=Gn(e.webAddress),s=e.name.trim()===""||!t.valid||e.webAddressStatus.kind==="taken"||e.webAddressStatus.kind==="reserved",r=Md(e.allowance);return{title:"Start a space",description:"Share channels with people and agents. You own it.",body:n.jsxs("form",{id:e.formId,onSubmit:e.onSubmit,className:"space-y-4",noValidate:!0,children:[n.jsx($d,{name:e.name,onNameChange:e.onNameChange,webAddress:e.webAddress,onWebAddressChange:e.onWebAddressChange,webAddressStatus:e.webAddressStatus,webAddressError:e.failure.field,disabled:e.submitting}),r&&n.jsx("p",{className:"text-muted-foreground text-sm",children:r}),e.failure.notice&&n.jsx(Ht,{notice:e.failure.notice}),n.jsx(ko,{})]}),actions:n.jsxs(n.Fragment,{children:[n.jsx(L,{type:"button",variant:"outline",onClick:e.onCancel,children:"Cancel"}),n.jsx(L,{type:"submit",form:e.formId,disabled:s||e.submitting,children:e.submitting?"Starting…":"Start space"})]})}}function Hk(e){return e.open?n.jsx(Wk,{...e}):null}function Wk({open:e,onOpenChange:t,installName:s,allowance:r,onConnected:o}){const[a,i]=u.useState(""),[c,d]=u.useState(""),[l,m]=u.useState(null),f=vk(),p=Fd(l?"":c),h=Oo(l,s,o),g=()=>t(!1);async function x(y){y.preventDefault();const A=Gn(c);if(a.trim()===""||!A.valid||f.submitting)return;const S=await f.submit({name:a,shortName:A.value});S&&m({communityId:S.community.communityId,name:S.community.name,communityUrl:S.community.communityUrl})}const b=l?Lo({state:h.state,name:l.name,doneDetail:"Invite people from the space’s own settings when you’re ready.",onOpenClaim:h.openClaim,onConfirmClaimed:h.confirmClaimed,onOpenApproval:h.openApproval,onRetryConnect:h.retryConnect,onClose:g}):Kk({name:a,webAddress:c,onNameChange:i,onWebAddressChange:y=>{d(y),f.clearFieldFailure()},webAddressStatus:p,submitting:f.submitting,failure:f.failure,allowance:r,formId:"start-community-form",onSubmit:y=>void x(y),onCancel:g});return n.jsx(Po,{open:e,onOpenChange:t,step:b,locked:f.submitting})}function Gk({entry:e,dialog:t,onDialogChange:s,installName:r,onConnected:o}){if(e===null)return null;const a=i=>{i||s(null)};return n.jsxs(n.Fragment,{children:[n.jsx(Hk,{open:(t==null?void 0:t.kind)==="start",onOpenChange:a,installName:r,allowance:e.allowance,onConnected:o}),n.jsx(zk,{open:(t==null?void 0:t.kind)==="move",onOpenChange:a,installName:r,resumeMoveId:(t==null?void 0:t.kind)==="move"?t.moveId:null,onConnected:o},(t==null?void 0:t.kind)==="move"?t.moveId??"new":"closed"),n.jsx(Tk,{open:(t==null?void 0:t.kind)==="hosted",onOpenChange:a,installName:r,onOpenMove:i=>s({kind:"move",moveId:i}),onMoveHere:()=>s({kind:"move",moveId:e.unfinishedMoveId}),onConnected:o})]})}const qk=.1;function Yk(e){if(!(e!=null&&e.available)||e.balance===null)return null;const{allowance:t,purchased:s,denomination:r}=e.balance,o=fx(t.remainingMicro,t.grantedMicro);if(o===null||o>=qk||!/^\d+$/.test(t.remainingMicro)||!/^\d+$/.test(s.remainingMicro)||BigInt(s.remainingMicro)>0n)return null;const a=px(gx(t.remainingMicro,r));return a===null?null:`${a} left`}function Vk(e){if(e.state!=="loading")return e.state==="signed-out"?"Not signed in":["Signed in",e.label,e.lowCredits].filter(Boolean).join(" · ")}function Qk(){var r;const e=Ic(),t=((r=e.data)==null?void 0:r.linked)===!0,s=Rc({enabled:t});return e.data===void 0?{state:"loading"}:t?{state:"signed-in",label:e.data.accountLabel,lowCredits:Yk(s.data)}:{state:"signed-out"}}function Xk(){const e=le();we("commands_changed",()=>{e.invalidateQueries({queryKey:["commands"]})})}function zd(e){return e.kind==="agent"?Ut("agent",e.agent.projectPath):Ut("room",e.room.id)}function Dr(e){return e.kind==="agent"?$e(e.agent):e.room.kind==="channel"&&e.room.slug?`#${e.room.slug}`:e.room.title}function Ya(e){return`Chats ${e.kind==="agent"?"with":"in"} ${Dr(e)}`}function Jk(e){return e.kind==="agent"?`No chats with ${Dr(e)} yet.`:`No chats came from ${Dr(e)}.`}function Zk(e){return e.kind==="channel"&&e.slug?`#${e.slug}`:e.title}function e0(e){const t=new Map,s=[...e].sort((r,o)=>{const a=+(r.kind==="dm")-+(o.kind==="dm");return a!==0?a:Number(r.archived)-Number(o.archived)});for(const r of s){const o=Zk(r);t.has(o)||t.set(o,r.id)}return t}function t0(e,t){const s=[];e.cwd!==null&&s.push(Ut("agent",e.cwd));const r=n0(e,t);return r!==void 0&&s.push(Ut("room",r)),s}function n0(e,t){if(e.origin==="room"){if(e.originRoomId!==void 0)return e.originRoomId;if(e.originLabel!==void 0)return t.get(e.originLabel)}}function s0(e,t){const s=Number(e.archived)-Number(t.archived);if(s!==0)return s;const r=Number(rn(t))-Number(rn(e));return r!==0?r:t.lastActivityAt.localeCompare(e.lastActivityAt)||t.id.localeCompare(e.id)}function rr(e){return[...e].sort(s0)}function Or(e){const t=[e.title];e.slug&&t.push(e.slug);for(const s of e.participants??[])t.push(s.displayName);return t}function r0(){const{data:e,isLoading:t,isError:s}=Ds({includeArchived:!0});return u.useMemo(()=>{const r=e??[],o=rr(r.filter(i=>i.kind==="channel")),a=rr(r.filter(i=>i.kind==="dm"));return{channels:o,dms:a,unread:rr([...o,...a].filter(i=>!i.archived&&rn(i))),isLoading:t,isError:s}},[e,t,s])}const o0=8;function a0(e,t){const s=new Set(gh(Object.keys(e),t)),r=[];for(const[o,a]of Object.entries(e))a&&s.has(o)&&(a.lifecycle!=="streaming"&&a.lifecycle!=="blocked"||r.push({sessionId:o,lifecycle:a.lifecycle,activity:a.activity??null}));return r.sort((o,a)=>o.lifecycle!==a.lifecycle?o.lifecycle==="blocked"?-1:1:o.sessionId.localeCompare(a.sessionId))}function Va(e){const t=Date.parse(e.lastActivityAt);return Number.isNaN(t)?Number.NEGATIVE_INFINITY:t}function i0(e){return!(e.unreadCount===null||e.archived||e.lastActivityAt===e.createdAt)}function c0({sessions:e,rooms:t,unreadRoomIds:s,agents:r,agentActivity:o,excludeSessionIds:a=new Set,limit:i=o0}){const c=e.filter(g=>!a.has(g.id)).map(g=>({kind:"session",key:`session:${g.id}`,lastActivityAt:g.lastActivityAt,session:g})),d=new Set(e.flatMap(g=>g.cwd?[g.cwd]:[])),l=t.filter(i0).map(g=>({kind:"room",key:`room:${g.id}`,lastActivityAt:g.lastActivityAt,room:g})),m=r.flatMap(g=>{if(d.has(g.projectPath))return[];const x=o[g.projectPath];return x?[{kind:"agent",key:`agent:${g.projectPath}`,lastActivityAt:x,agent:g}]:[]}),f=[],p=[];for(const g of[...c,...l,...m])g.kind==="room"&&s.has(g.room.id)?f.push(g):p.push(g);const h=(g,x)=>Va(x)-Va(g)||x.key.localeCompare(g.key);return[...f.sort(h),...p.sort(h)].slice(0,i)}const l0=50;function Ud(e){const t=[e.id];return e.who&&t.push(e.who),e.cwd&&t.push(e.cwd),t}function d0(e){return e?e.split("/").filter(Boolean).pop()??null:null}function Qa(e,t,s){const r=new Map(t.map(o=>[o.projectPath,o]));return e.map(o=>{const a=o.cwd??null,i=a?r.get(a)??null:null,c=Date.parse(o.updatedAt);return{id:o.id,who:i?$e(i):d0(a),title:Tc(o.title),cwd:a,agent:i,origin:o.origin,originLabel:o.originLabel,originRoomId:o.originRoomId,lastActivityAt:o.updatedAt,archived:!Number.isNaN(c)&&c<s}})}function u0(e,t,s,r){const{data:o}=Dc(l0),a=kt(p=>p.statuses),i=kt(Oc(p=>Object.values(p.sessions))),c=u.useMemo(()=>Qa((o==null?void 0:o.sessions)??[],e,r),[o==null?void 0:o.sessions,e,r]),d=u.useMemo(()=>Qa(i,e,r),[i,e,r]),l=u.useMemo(()=>[...i,...(o==null?void 0:o.sessions)??[]],[i,o]),m=u.useMemo(()=>{const p=new Map;for(const h of d)p.set(h.id,h);for(const h of c)p.has(h.id)||p.set(h.id,h);return a0(a,l).flatMap(h=>{const g=p.get(h.sessionId);return g?[{session:g,verb:xh(h.lifecycle,h.activity),signal:h.lifecycle==="blocked"?"needs-you":"working"}]:[]})},[a,d,c,l]),f=u.useMemo(()=>{const p=new Set(bh((o==null?void 0:o.sessions)??[]).yours.map(h=>h.id));return c0({sessions:c.filter(h=>p.has(h.id)),rooms:t,unreadRoomIds:s,agents:e,agentActivity:(o==null?void 0:o.agentActivity)??{},excludeSessionIds:new Set(m.map(h=>h.session.id))})},[o,c,t,s,e,m]);return{sessions:c,continueRows:m,recent:f,agentActivity:(o==null?void 0:o.agentActivity)??m0}}const m0=Object.freeze({});function h0(){const{data:e,dataUpdatedAt:t}=Le(),s=e!==void 0&&t>on,{status:r,url:o}=yh(e==null?void 0:e.tunnel),a=u.useRef(void 0);u.useEffect(()=>{if(!s)return;const i=a.current;a.current=r,!(i===void 0||i===r)&&(Qo.getState().consumeSuppression()||vh(Qo.getState().report)||(r==="reconnecting"?ce.warning("Remote access is reconnecting",{id:"tunnel-status",description:"Your other devices can’t reach DorkOS until then."}):r==="off"?ce.error("Remote access turned off",{id:"tunnel-status",description:"Your other devices can’t reach DorkOS now."}):o&&ce.success("Remote access is on",{id:"tunnel-status",description:o})))},[s,r,o])}const mt={copyLink:"copyRemoteLink",showQr:"showRemoteQr",turnOn:"turnRemoteAccessOn",turnOff:"turnRemoteAccessOff"},jn={copyLink:11,showQr:12,turnOff:13,turnOn:11};function f0(e,t,s){return(e==="connected"||e==="reconnecting"||e==="asleep")&&t?[{id:"remote-access-copy",label:"Copy remote link",icon:"Copy",action:mt.copyLink,category:"quick-action",priority:jn.copyLink,keywords:["remote","tunnel","url","address","phone","share"]},{id:"remote-access-qr",label:"Show QR code",icon:"QrCode",action:mt.showQr,category:"quick-action",priority:jn.showQr,keywords:["remote","tunnel","scan","phone"]},{id:"remote-access-off",label:"Turn remote access off",icon:"Globe",action:mt.turnOff,category:"quick-action",priority:jn.turnOff,keywords:["remote","tunnel","ngrok","stop","disconnect"]}]:e==="asleep"||e==="blocked"?[{id:"remote-access-off",label:"Turn remote access off",icon:"Globe",action:mt.turnOff,category:"quick-action",priority:jn.turnOff,keywords:["remote","tunnel","ngrok","stop","disconnect"]}]:s&&(e==="off"||e==="error")?[{id:"remote-access-on",label:"Turn remote access on",icon:"Globe",action:mt.turnOn,category:"quick-action",priority:jn.turnOn,keywords:["remote","tunnel","ngrok","phone","start"]}]:[]}function p0(){const{state:e,url:t,isSetUp:s}=Mc();return u.useMemo(()=>f0(e,t,s),[e,t,s])}const g0=new Set(["discover","browse"]),Vn={usageKey:null,lastActivityAt:null,waiting:!1,demoted:!1,scopes:[]};function Xa(e){return{usageKey:Ut("room",e.id),lastActivityAt:e.lastActivityAt,waiting:rn(e),demoted:e.archived,scopes:[]}}const x0=[];function b0(e,t){const{data:s,isLoading:r}=Os(),o=r0(),{sessions:a}=_c(),i=u.useMemo(()=>!a||!e?null:wh(a,e)[0]??null,[a,e]),{data:c}=Ux(e,i==null?void 0:i.id,i==null?void 0:i.runtime),d=Rs("command-palette.items"),l=oo(),m=u.useMemo(()=>l.map(w=>({id:w.id,label:w.title,href:mc(w.extensionId,w.path),icon:w.icon})),[l]),f=Ks(),p=u.useMemo(()=>{const w=new Set(jh(f).map(j=>j.id)),C=new Set(kh.map(j=>j.id).filter(j=>!w.has(j)));return d.filter(j=>{if(j.category!=="feature")return!1;const k=Pc(j.action);return k===null||!C.has(k)})},[d,f]),h=p0(),g=f?x0:h,x=u.useMemo(()=>[...d.filter(w=>w.category==="quick-action"&&!(f&&g0.has(w.id))),...g],[d,g,f]),b=u.useMemo(()=>Sh.flatMap(w=>{const C=x.find(j=>j.id===w);return C?[C]:[]}),[x]),y=u.useMemo(()=>(s==null?void 0:s.agents)??[],[s]),A=u.useMemo(()=>new Set(o.unread.map(w=>w.id)),[o.unread]),S=u.useMemo(()=>[...o.channels,...o.dms],[o.channels,o.dms]),I=u.useMemo(()=>Ch(t),[t]),{sessions:v,continueRows:E,recent:R,agentActivity:_}=u0(y,S,A,I),D=u.useMemo(()=>e0(S),[S]),O=u.useMemo(()=>c?c.commands.map(w=>({name:w.fullCommand,description:w.description})):[],[c]),T=u.useMemo(()=>{const w=[];for(const C of y)w.push({id:C.id,name:C.name,type:"agent",keywords:[C.projectPath,C.id],usageKey:Ut("agent",C.projectPath),lastActivityAt:_[C.projectPath]??null,waiting:!1,demoted:!1,scopes:[],data:C});for(const C of v)w.push({id:C.id,name:C.title,type:"session",keywords:Ud(C),usageKey:Ut("session",C.id),lastActivityAt:C.lastActivityAt,waiting:!1,demoted:!1,scopes:t0(C,D),data:C});for(const C of p)w.push({id:C.id,name:C.label,type:"feature",keywords:C.keywords,...Vn,data:C});for(const C of O)w.push({id:`cmd-${C.name}`,name:C.name,type:"command",keywords:C.description?[C.description]:void 0,...Vn,data:C});for(const C of x)w.push({id:C.id,name:C.label,type:"quick-action",keywords:C.keywords,...Vn,data:C});for(const C of o.channels)w.push({id:C.id,name:Nh(C),type:"room",keywords:Or(C),...Xa(C),data:C});for(const C of o.dms)w.push({id:C.id,name:C.title,type:"dm",keywords:Or(C),...Xa(C),data:C});for(const C of m)w.push({id:C.id,name:C.label,type:"page",keywords:["add-on","extension"],...Vn,data:C});return w},[y,_,v,O,p,x,o.channels,o.dms,D,m]);return{allAgents:y,newActions:b,rooms:o,sessions:v,continueRows:E,recent:R,searchableItems:T,isLoading:r}}function y0(){const e=P(a=>a.toggleGlobalPalette),t=P(a=>a.setGlobalPaletteOpen),s=P(a=>a.globalPaletteOpen),{close:r}=rt(),{close:o}=lo();return u.useEffect(()=>{const a=i=>{(i.metaKey||i.ctrlKey)&&i.key==="k"&&(i.preventDefault(),s||(r(),o()),e())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r,o,s]),{globalPaletteOpen:s,setGlobalPaletteOpen:t,toggleGlobalPalette:e}}function Et(e){return Array.isArray?Array.isArray(e):Hd(e)==="[object Array]"}function v0(e){if(typeof e=="string")return e;if(typeof e=="bigint")return e.toString();const t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Mr(e){return e==null?"":v0(e)}function Te(e){return typeof e=="string"}function rs(e){return typeof e=="number"}function w0(e){return e===!0||e===!1||j0(e)&&Hd(e)=="[object Boolean]"}function Kd(e){return typeof e=="object"}function j0(e){return Kd(e)&&e!==null}function He(e){return e!=null}function Qn(e){return!e.trim().length}function Hd(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const k0="Incorrect 'index' type",_r="Invalid doc index: must be a non-negative integer within the bounds of the docs array",S0=e=>`Invalid value for key ${e}`,C0=e=>`Pattern length exceeds max of ${e}.`,N0=e=>`Missing ${e} property in key`,A0=e=>`Property 'weight' in key '${e}' must be a positive integer`,E0="Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.",Ja=Object.prototype.hasOwnProperty;var I0=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(s=>{const r=Wd(s);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight}),this._keys.forEach(s=>{s.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Wd(e){let t=null,s=null,r=null,o=1,a=null;if(Te(e)||Et(e))r=e,t=Za(e),s=os(e);else{if(!Ja.call(e,"name"))throw new Error(N0("name"));const i=e.name;if(r=i,Ja.call(e,"weight")&&e.weight!==void 0&&(o=e.weight,o<=0))throw new Error(A0(os(i)));t=Za(i),s=os(i),a=e.getFn??null}return{path:t,id:s,weight:o,src:r,getFn:a}}function Za(e){return Et(e)?e:e.split(".")}function os(e){return Et(e)?e.join("."):e}function R0(e,t){const s=[];let r=!1;const o=(a,i,c,d)=>{if(He(a))if(!i[c])s.push(d!==void 0?{v:a,i:d}:a);else{const l=a[i[c]];if(!He(l))return;if(c===i.length-1&&(Te(l)||rs(l)||w0(l)||typeof l=="bigint"))s.push(d!==void 0?{v:Mr(l),i:d}:Mr(l));else if(Et(l)){r=!0;for(let m=0,f=l.length;m<f;m+=1)o(l[m],i,c+1,m)}else i.length&&o(l,i,c+1,d)}};return o(e,Te(t)?t.split("."):t,0),r?s:s[0]}const T0={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},D0={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},O0={location:0,threshold:.6,distance:100},M0={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:R0,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},V=Object.freeze({...D0,...T0,...O0,...M0});function _0(e){return e>=9&&e<=13||e===32||e===160}function P0(e=1,t=3){const s=new Map,r=Math.pow(10,t);return{get(o){let a=0,i=!1;for(let d=0;d<o.length;d++)_0(o.charCodeAt(d))?i=!1:i||(a++,i=!0);if(a===0&&(a=1),s.has(a))return s.get(a);const c=Math.round(r/Math.pow(a,.5*e))/r;return s.set(a,c),c},clear(){s.clear()}}}var Fo=class{constructor({getFn:e=V.getFn,fieldNormWeight:t=V.fieldNormWeight}={}){this.norm=P0(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,s)=>{this._keysMap[t.id]=s})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const e=this.docs.length;this.records=new Array(e);let t=0;if(Te(this.docs[0]))for(let s=0;s<e;s++){const r=this._createStringRecord(this.docs[s],s);r&&(this.records[t++]=r)}else for(let s=0;s<e;s++)this.records[t++]=this._createObjectRecord(this.docs[s],s);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw new Error(_r);if(Te(e)){const r=this._createStringRecord(e,t);return r&&this.records.push(r),r}const s=this._createObjectRecord(e,t);return this.records.push(s),s}removeAt(e){if(!Number.isInteger(e)||e<0)throw new Error(_r);for(let t=0,s=this.records.length;t<s;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,s=this.records.length;t<s;t+=1)this.records[t].i>e&&(this.records[t].i-=1)}removeAll(e){const t=new Set;for(const r of e)Number.isInteger(r)&&r>=0&&t.add(r);if(t.size===0)return;this.records=this.records.filter(r=>!t.has(r.i));const s=Array.from(t).sort((r,o)=>r-o);for(const r of this.records){let o=0,a=s.length;for(;o<a;){const i=o+a>>>1;s[i]<r.i?o=i+1:a=i}r.i-=o}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!He(e)||Qn(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){const s={i:t,$:{}};for(let r=0,o=this.keys.length;r<o;r++){const a=this.keys[r],i=a.getFn?a.getFn(e):this.getFn(e,a.path);if(He(i)){if(Et(i)){const c=[];for(let d=0,l=i.length;d<l;d+=1){const m=i[d];if(He(m)){if(Te(m)){if(!Qn(m)){const f={v:m,i:d,n:this.norm.get(m)};c.push(f)}}else if(He(m.v)){const f=Te(m.v)?m.v:Mr(m.v);if(!Qn(f)){const p={v:f,i:m.i,n:this.norm.get(f)};c.push(p)}}}}s.$[r]=c}else if(Te(i)&&!Qn(i)){const c={v:i,n:this.norm.get(i)};s.$[r]=c}}}return s}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function Gd(e,t,{getFn:s=V.getFn,fieldNormWeight:r=V.fieldNormWeight}={}){const o=new Fo({getFn:s,fieldNormWeight:r});return o.setKeys(e.map(Wd)),o.setSources(t),o.create(),o}function L0(e,{getFn:t=V.getFn,fieldNormWeight:s=V.fieldNormWeight}={}){const{keys:r,records:o}=e,a=new Fo({getFn:t,fieldNormWeight:s});return a.setKeys(r),a.setIndexRecords(o),a}function F0(e=[],t=V.minMatchCharLength){const s=[];let r=-1,o=-1,a=0;for(let i=e.length;a<i;a+=1){const c=e[a];c&&r===-1?r=a:!c&&r!==-1&&(o=a-1,o-r+1>=t&&s.push([r,o]),r=-1)}return e[a-1]&&a-r>=t&&s.push([r,a-1]),s}function $0(e,t,s,{location:r=V.location,distance:o=V.distance,threshold:a=V.threshold,findAllMatches:i=V.findAllMatches,minMatchCharLength:c=V.minMatchCharLength,includeMatches:d=V.includeMatches,ignoreLocation:l=V.ignoreLocation}={}){if(t.length>32)throw new Error(C0(32));const m=t.length,f=e.length,p=Math.max(0,Math.min(r,f));let h=a,g=p;const x=(D,O)=>{const T=D/m;if(l)return T;const w=Math.abs(p-O);return o?T+w/o:w?1:T},b=c>1||d,y=b?Array(f):[];let A;for(;(A=e.indexOf(t,g))>-1;){const D=x(0,A);if(h=Math.min(D,h),g=A+m,b){let O=0;for(;O<m;)y[A+O]=1,O+=1}}g=-1;let S=[],I=1,v=0,E=m+f;const R=1<<m-1;for(let D=0;D<m;D+=1){let O=0,T=E;for(;O<T;)x(D,p+T)<=h?O=T:E=T,T=Math.floor((E-O)/2+O);E=T;let w=Math.max(1,p-T+1);const C=i?f:Math.min(p+T,f)+m,j=Array(C+2);j[C+1]=(1<<D)-1;for(let k=C;k>=w;k-=1){const M=k-1,F=s[e[M]];if(j[k]=(j[k+1]<<1|1)&F,D&&(j[k]|=(S[k+1]|S[k])<<1|1|S[k+1]),j[k]&R&&(I=x(D,M),I<=h)){if(h=I,g=M,v=D,g<=p)break;w=Math.max(1,2*p-g)}}if(x(D+1,p)>h)break;S=j}if(b&&g>=0){const D=Math.min(f-1,g+m-1+v);for(let O=g;O<=D;O+=1)s[e[O]]&&(y[O]=1)}const _={isMatch:g>=0,score:Math.max(.001,I)};if(b){const D=F0(y,c);D.length?d&&(_.indices=D):_.isMatch=!1}return _}function B0(e){const t={};for(let s=0,r=e.length;s<r;s+=1){const o=e.charAt(s);t[o]=(t[o]||0)|1<<r-s-1}return t}function $o(e){if(e.length<=1)return e;e.sort((s,r)=>s[0]-r[0]||s[1]-r[1]);const t=[e[0]];for(let s=1,r=e.length;s<r;s+=1){const o=t[t.length-1],a=e[s];a[0]<=o[1]+1?o[1]=Math.max(o[1],a[1]):t.push(a)}return t}const qd={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},z0=new RegExp("["+Object.keys(qd).join("")+"]","g"),Pn=typeof String.prototype.normalize=="function"?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(z0,t=>qd[t]):e=>e;var Bo=class{constructor(e,{location:t=V.location,threshold:s=V.threshold,distance:r=V.distance,includeMatches:o=V.includeMatches,findAllMatches:a=V.findAllMatches,minMatchCharLength:i=V.minMatchCharLength,isCaseSensitive:c=V.isCaseSensitive,ignoreDiacritics:d=V.ignoreDiacritics,ignoreLocation:l=V.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:r,includeMatches:o,findAllMatches:a,minMatchCharLength:i,isCaseSensitive:c,ignoreDiacritics:d,ignoreLocation:l},e=c?e:e.toLowerCase(),e=d?Pn(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const m=(p,h)=>{this.chunks.push({pattern:p,alphabet:B0(p),startIndex:h})},f=this.pattern.length;if(f>32){let p=0;const h=f%32,g=f-h;for(;p<g;)m(this.pattern.substr(p,32),p),p+=32;if(h){const x=f-32;m(this.pattern.substr(x),x)}}else m(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:s,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=s?Pn(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const g={isMatch:!0,score:0};return r&&(g.indices=[[0,e.length-1]]),g}const{location:o,distance:a,threshold:i,findAllMatches:c,minMatchCharLength:d,ignoreLocation:l}=this.options,m=[];let f=0,p=!1;this.chunks.forEach(({pattern:g,alphabet:x,startIndex:b})=>{const{isMatch:y,score:A,indices:S}=$0(e,g,x,{location:o+b,distance:a,threshold:i,findAllMatches:c,minMatchCharLength:d,includeMatches:r,ignoreLocation:l});y&&(p=!0),f+=A,y&&S&&m.push(...S)});const h={isMatch:p,score:p?f/this.chunks.length:1};return p&&r&&(h.indices=$o(m)),h}};const U0=new Set(["fuzzy","include"]);function K0(e){return e.startsWith("inverse")}const Pr=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:"exact",search(t){const s=t===e;return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:"include",search(t){let s=0,r;const o=[],a=e.length;for(;(r=t.indexOf(e,s))>-1;)s=r+a,o.push([r,s-1]);const i=!!o.length;return{isMatch:i,score:i?0:1,indices:o}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:"prefix-exact",search(t){const s=t.startsWith(e);return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:"inverse-prefix-exact",search(t){const s=!t.startsWith(e);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:"inverse-suffix-exact",search(t){const s=!t.endsWith(e);return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:"suffix-exact",search(t){const s=t.endsWith(e);return{isMatch:s,score:s?0:1,indices:[t.length-e.length,t.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:"inverse-exact",search(t){const s=t.indexOf(e)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{const s=new Bo(e,{location:t.location??V.location,threshold:t.threshold??V.threshold,distance:t.distance??V.distance,includeMatches:t.includeMatches??V.includeMatches,findAllMatches:t.findAllMatches??V.findAllMatches,minMatchCharLength:t.minMatchCharLength??V.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??V.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??V.ignoreDiacritics,ignoreLocation:t.ignoreLocation??V.ignoreLocation});return{type:"fuzzy",search(r){return s.searchIn(r)}}}}],ei=Pr.length,H0="\0",W0="|";function G0(e){const t=[],s=e.length;let r=0;for(;r<s;){for(;r<s&&e[r]===" ";)r++;if(r>=s)break;let o=r;for(;o<s&&e[o]!==" "&&e[o]!=='"';)o++;if(o<s&&e[o]==='"'){for(o++;o<s;){if(e[o]==='"'){const a=o+1;if(a>=s||e[a]===" "){o++;break}if(e[a]==="$"&&(a+1>=s||e[a+1]===" ")){o+=2;break}}o++}t.push(e.substring(r,o)),r=o}else{for(;o<s&&e[o]!==" ";)o++;t.push(e.substring(r,o)),r=o}}return t}function ti(e,t){const s=e.match(t);return s?s[1]:null}function q0(e,t={}){return e.replace(/\\\|/g,H0).split(W0).map(s=>{const r=G0(s.replace(/\u0000/g,"|").trim()).filter(a=>a&&!!a.trim()),o=[];for(let a=0,i=r.length;a<i;a+=1){const c=r[a];let d=!1,l=-1;for(;!d&&++l<ei;){const m=Pr[l],f=ti(c,m.multiRegex);f&&(o.push(m.create(f,t)),d=!0)}if(!d)for(l=-1;++l<ei;){const m=Pr[l],f=ti(c,m.singleRegex);if(f){o.push(m.create(f,t));break}}}return o})}var Y0=class{constructor(e,{isCaseSensitive:t=V.isCaseSensitive,ignoreDiacritics:s=V.ignoreDiacritics,includeMatches:r=V.includeMatches,minMatchCharLength:o=V.minMatchCharLength,ignoreLocation:a=V.ignoreLocation,findAllMatches:i=V.findAllMatches,location:c=V.location,threshold:d=V.threshold,distance:l=V.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:s,includeMatches:r,minMatchCharLength:o,findAllMatches:i,ignoreLocation:a,location:c,threshold:d,distance:l},e=t?e:e.toLowerCase(),e=s?Pn(e):e,this.pattern=e,this.query=q0(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:r,ignoreDiacritics:o}=this.options;e=r?e:e.toLowerCase(),e=o?Pn(e):e;let a=0;const i=[];let c=0,d=!1;for(let l=0,m=t.length;l<m;l+=1){const f=t[l];i.length=0,a=0,d=!1;for(let p=0,h=f.length;p<h;p+=1){const g=f[p],{isMatch:x,indices:b,score:y}=g.search(e);if(x)a+=1,c+=y,K0(g.type)&&(d=!0),s&&(U0.has(g.type)?i.push(...b):i.push(b));else{c=0,a=0,i.length=0,d=!1;break}}if(a){const p={isMatch:!0,score:c/a};return d&&(p.hasInverse=!0),s&&(p.indices=$o(i)),p}}return{isMatch:!1,score:1}}};const Lr=[];function zo(...e){Lr.push(...e)}function ys(e,t){for(let s=0,r=Lr.length;s<r;s+=1){const o=Lr[s];if(o.condition(e,t))return new o(e,t)}return new Bo(e,t)}const vs={AND:"$and",OR:"$or"},Fr={PATH:"$path",PATTERN:"$val"},$r=e=>!!(e[vs.AND]||e[vs.OR]),V0=e=>!!e[Fr.PATH],Q0=e=>!Et(e)&&Kd(e)&&!$r(e),ni=e=>({[vs.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Yd(e,t,{auto:s=!0}={}){const r=o=>{if(Te(o)){const d={keyId:null,pattern:o};return s&&(d.searcher=ys(o,t)),d}const a=Object.keys(o),i=V0(o);if(!i&&a.length>1&&!$r(o))return r(ni(o));if(Q0(o)){const d=i?o[Fr.PATH]:a[0],l=i?o[Fr.PATTERN]:o[d];if(!Te(l))throw new Error(S0(d));const m={keyId:os(d),pattern:l};return s&&(m.searcher=ys(l,t)),m}const c={children:[],operator:a[0]};return a.forEach(d=>{const l=o[d];Et(l)&&l.forEach(m=>{c.children.push(r(m))})}),c};return $r(e)||(e=ni(e)),r(e)}function Br(e,{ignoreFieldNorm:t=V.ignoreFieldNorm}){let s=1;return e.forEach(({key:r,norm:o,score:a})=>{const i=r?r.weight:null;s*=Math.pow(a===0&&i?Number.EPSILON:a,(i||1)*(t?1:o))}),s}function X0(e,{ignoreFieldNorm:t=V.ignoreFieldNorm}){e.forEach(s=>{s.score=Br(s.matches,{ignoreFieldNorm:t})})}var J0=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){const t=this.heap;for(;e>0;){const s=e-1>>1;if(this.comparator(t[e],t[s])<=0)break;const r=t[e];t[e]=t[s],t[s]=r,e=s}}_sinkDown(e){const t=this.heap,s=t.length;let r=e;do{e=r;const o=2*e+1,a=2*e+2;if(o<s&&this.comparator(t[o],t[r])>0&&(r=o),a<s&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){const i=t[e];t[e]=t[r],t[r]=i}}while(r!==e)}};function Z0(e){const t=[];return e.matches.forEach(s=>{if(!He(s.indices)||!s.indices.length)return;const r={indices:s.indices,value:s.value};s.key&&(r.key=s.key.id),s.idx>-1&&(r.refIndex=s.idx),t.push(r)}),t}function eS(e,t,{includeMatches:s=V.includeMatches,includeScore:r=V.includeScore}={}){return e.map(o=>{const{idx:a}=o,i={item:t[a],refIndex:a};return s&&(i.matches=Z0(o)),r&&(i.score=o.score),i})}const tS=/[\p{L}\p{M}\p{N}_]+/gu,si=new WeakSet;function nS(e){si.has(e)||(si.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function sS(e){if(typeof e=="function"){let t=!1;return s=>{const r=e(s);if(!t&&(t=!0,!Array.isArray(r)||r.some(o=>typeof o!="string")))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?"array containing non-strings":typeof r}.`);return r}}return e instanceof RegExp?(e.global||nS(e),t=>t.match(e)||[]):t=>t.match(tS)||[]}function zr({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:s}={}){const r=sS(s);return{tokenize(o){return e||(o=o.toLowerCase()),t&&(o=Pn(o)),r(o)}}}var rS=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=zr({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});const s=this.analyzer.tokenize(e),{df:r,fieldCount:o}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const a of s){this.termSearchers.push(new Bo(a,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));const i=r.get(a)||0,c=Math.log(1+(o-i+.5)/(i+.5));this.idfWeights.push(c)}this.combineAll=t.tokenMatch==="all",this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};const t=[];let s=0,r=0,o=0,a=0;const i=this.combineAll&&!this.useMask?new Set:null;for(let l=0;l<this.termSearchers.length;l++){const m=this.termSearchers[l].searchIn(e),f=this.idfWeights[l];r+=f,m.isMatch&&(o++,s+=f*(1-m.score),m.indices&&t.push(...m.indices),this.combineAll&&(this.useMask?a|=1<<l:i.add(l)))}if(o===0)return{isMatch:!1,score:1};const c=r>0?1-s/r:0,d={isMatch:!0,score:Math.max(.001,c)};return this.options.includeMatches&&t.length&&(d.indices=$o(t)),this.combineAll&&(this.useMask?d.matchedMask=a:d.matchedTerms=i,d.termCount=this.numTerms),d}};function or(e,t,s,r){const o=r.tokenize(t);if(!o.length)return;e.fieldCount++,e.docFieldCount.set(s,(e.docFieldCount.get(s)||0)+1);const a=new Set(o);let i=e.docTermFieldHits.get(s);i||(i=new Map,e.docTermFieldHits.set(s,i));for(const c of a)i.set(c,(i.get(c)||0)+1),e.df.set(c,(e.df.get(c)||0)+1)}function Vd(e,t,s,r){const{i:o,v:a,$:i}=t;if(a!==void 0){or(e,a,o,r);return}if(i)for(let c=0;c<s;c++){const d=i[c];if(d)if(Array.isArray(d))for(const l of d)or(e,l.v,o,r);else or(e,d.v,o,r)}}function oS(e,t,s){const r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const o of e)Vd(r,o,t,s);return r}function aS(e,t,s,r){Vd(e,t,s,r)}function iS(e,t){const s=e.docFieldCount.get(t);if(s===void 0)return;e.fieldCount-=s,e.docFieldCount.delete(t);const r=e.docTermFieldHits.get(t);if(r){for(const[o,a]of r){const i=(e.df.get(o)||0)-a;i<=0?e.df.delete(o):e.df.set(o,i)}e.docTermFieldHits.delete(t)}}function ri(e,t){if(t.length===0)return;const s=Array.from(new Set(t)).sort((c,d)=>c-d);for(const c of s)iS(e,c);const r=c=>{let d=0,l=s.length;for(;d<l;){const m=d+l>>>1;s[m]<c?d=m+1:l=m}return c-d},o=s[0],a=new Map;for(const[c,d]of e.docFieldCount)a.set(c>o?r(c):c,d);e.docFieldCount=a;const i=new Map;for(const[c,d]of e.docTermFieldHits)i.set(c>o?r(c):c,d);e.docTermFieldHits=i}var It=class{constructor(e,t,s){this.options={...V,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new I0(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,s),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;const t=ys(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Fo))throw new Error(k0);if(this._myIndex=t||Gd(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const s=zr({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=oS(this._myIndex.records,this._myIndex.keys.length,s)}this._invalidateSearcherCache()}add(e){if(!He(e))return;this._docs.push(e);const t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){const s=zr({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});aS(this._invertedIndex,t,this._myIndex.keys.length,s)}this._invalidateSearcherCache()}remove(e=()=>!1){const t=[],s=[];for(let r=0,o=this._docs.length;r<o;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),s.push(r));if(s.length){this._invertedIndex&&ri(this._invertedIndex,s);const r=new Set(s);this._docs=this._docs.filter((o,a)=>!r.has(a)),this._myIndex.removeAll(s),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw new Error(_r);this._invertedIndex&&ri(this._invertedIndex,[e]);const t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){const{limit:s=-1}=t||{},{includeMatches:r,includeScore:o,shouldSort:a,sortFn:i,ignoreFieldNorm:c}=this.options;if(Te(e)&&!e.trim()){let p=this._docs.map((h,g)=>({item:h,refIndex:g}));return rs(s)&&s>-1&&(p=p.slice(0,s)),p}const d=a&&rs(s)&&s>0&&Te(e),l=i,m=(p,h)=>l(p,h)||p.idx-h.idx;let f;if(d){const p=new J0(s,m);Te(this._docs[0])?this._searchStringList(e,{heap:p,ignoreFieldNorm:c}):this._searchObjectList(e,{heap:p,ignoreFieldNorm:c}),f=p.extractSorted()}else f=Te(e)?Te(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),X0(f,{ignoreFieldNorm:c}),a&&f.sort(Te(e)?m:l),rs(s)&&s>-1&&(f=f.slice(0,s));return eS(f,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e,{heap:t,ignoreFieldNorm:s}={}){const r=this._getSearcher(e),o=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:a}=this._myIndex,i=t?null:[];return a.forEach(({v:c,i:d,n:l})=>{if(!He(c))return;const m=r.searchIn(c);if(m.isMatch){const f={score:m.score,value:c,norm:l,indices:m.indices};o&&(f.matchedMask=m.matchedMask,f.matchedTerms=m.matchedTerms,f.termCount=m.termCount);const p=[f];if(!o||this._coversAllTokens(p)){const h={item:c,idx:d,matches:p};t?(h.score=Br(h.matches,{ignoreFieldNorm:s}),t.insert(h)):i.push(h)}}}),i}_searchLogical(e){const t=Yd(e,this.options),s=this._normalizedKeys(),r=(c,d,l)=>{if(!("children"in c)){const{keyId:h,searcher:g}=c;let x;return h===null?(x=[],s.forEach((b,y)=>{x.push(...this._findMatches({key:b,value:d[y],searcher:g}))})):x=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(d,h),searcher:g}),x&&x.length?[{idx:l,item:d,matches:x}]:[]}const{children:m,operator:f}=c,p=[];for(let h=0,g=m.length;h<g;h+=1){const x=m[h],b=r(x,d,l);if(b.length)p.push(...b);else if(f===vs.AND)return[]}return p},o=this._myIndex.records,a=new Map,i=[];return o.forEach(({$:c,i:d})=>{if(He(c)){const l=r(t,c,d);l.length&&(a.has(d)||(a.set(d,{idx:d,item:c,matches:[]}),i.push(a.get(d))),l.forEach(({matches:m})=>{a.get(d).matches.push(...m)}))}}),i}_searchObjectList(e,{heap:t,ignoreFieldNorm:s}={}){const r=this._getSearcher(e),o=this.options.useTokenSearch&&this.options.tokenMatch==="all",{records:a}=this._myIndex,i=this._normalizedKeys(),c=t?null:[];return a.forEach(({$:d,i:l})=>{if(!He(d))return;const m=[];let f=!1,p=!1;if(i.forEach((h,g)=>{const x=this._findMatches({key:h,value:d[g],searcher:r});x.length?(m.push(...x),x[0].hasInverse&&(p=!0)):f=!0}),!(p&&f)&&m.length&&(!o||this._coversAllTokens(m))){const h={idx:l,item:d,matches:m};t?(h.score=Br(h.matches,{ignoreFieldNorm:s}),t.insert(h)):c.push(h)}}),c}_findMatches({key:e,value:t,searcher:s}){if(!He(t))return[];const r=[];if(Et(t))t.forEach(({v:o,i:a,n:i})=>{if(!He(o))return;const c=s.searchIn(o);if(c.isMatch){const d={score:c.score,key:e,value:o,idx:a,norm:i,indices:c.indices,hasInverse:c.hasInverse};c.termCount!==void 0&&(d.matchedMask=c.matchedMask,d.matchedTerms=c.matchedTerms,d.termCount=c.termCount),r.push(d)}});else{const{v:o,n:a}=t,i=s.searchIn(o);if(i.isMatch){const c={score:i.score,key:e,value:o,norm:a,indices:i.indices,hasInverse:i.hasInverse};i.termCount!==void 0&&(c.matchedMask=i.matchedMask,c.matchedTerms=i.matchedTerms,c.termCount=i.termCount),r.push(c)}}return r}_coversAllTokens(e){const t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let r=0;for(let o=0;o<e.length;o++)r|=e[o].matchedMask||0;return r===2**t-1}const s=new Set;for(let r=0;r<e.length;r++){const o=e[r].matchedTerms;if(o)for(const a of o)s.add(a)}return s.size===t}};It.version="7.5.0";It.createIndex=Gd;It.parseIndex=L0;It.config=V;It.match=function(e,t,s){if(s&&s.useTokenSearch)throw new Error(E0);return ys(e,{...V,...s}).searchIn(t)};It.parseQuery=Yd;zo(Y0);zo(rS);It.use=function(...e){e.forEach(t=>zo(t))};var cS=It;const lS=.02,Qd=.5,Xd=.35,Jd=.15,dS=1+Qd+Xd+Jd,uS=4320*60*1e3,mS=3,hS=1440*60*1e3,fS=.15,pS={lastUsedAt:null,useCount:0};function Uo(e){return!Number.isFinite(e)||e<0?0:e>1?1:e}function Zd(e,t){return!Number.isFinite(e)||e<=0?1:Uo(Math.pow(2,-e/t))}function gS(e,t){const s=e.lastUsedAt===null?0:Zd(t-e.lastUsedAt,uS),r=Math.max(0,e.useCount),o=r===0?0:r/(r+mS);return Uo((s+o)/2)}function xS(e,t){const s=e.distance===null?1:Uo(Math.pow(2,-Math.max(0,e.distance)/lS)),r=gS(e.usage,t),o=e.lastActivityAt===null?0:Zd(t-e.lastActivityAt,hS),a=1+(e.waiting?Qd:0)+Xd*r+Jd*o;return{score:s*a/dS,signals:{relevance:s,frecency:r,recency:o}}}function bS(e,t){return e.map(s=>{const{score:r,signals:o}=xS(s,t);return{key:s.key,item:s.item,score:r,signals:o,demoted:s.demoted}}).sort((s,r)=>Number(s.demoted)-Number(r.demoted)||r.score-s.score||s.key.localeCompare(r.key))}function yS(e,t){const s=[...e],r=e[0],o=e[1];return t.queried?!r||!o?{best:null,rest:s}:r.demoted||r.score<=0?{best:null,rest:s}:(r.score-o.score)/r.score<fS?{best:null,rest:s}:{best:r,rest:s.slice(1)}:{best:null,rest:s}}function vS(e,t){const s=[];for(const r of e){const o=t(r),a=s[s.length-1];a&&a.label===o?a.rows.push(r):s.push({label:o,rows:[r]})}return s}const wS={keys:["name","keywords"],includeMatches:!0,includeScore:!0,threshold:.3,distance:100,minMatchCharLength:1};function jS(e,t,s){const{usage:r,now:o,scope:a}=s,{prefix:i,term:c}=u.useMemo(()=>a===null?kS(t):{prefix:null,term:t},[t,a]),d=u.useMemo(()=>{if(a===null)return e;const x=zd(a);return e.filter(b=>b.scopes.includes(x))},[e,a]),l=u.useMemo(()=>i==="#"?d.filter(x=>x.type==="room"):i==="@"?d.filter(x=>x.type==="agent"||x.type==="dm"):i===">"?d.filter(x=>x.type==="command"):d,[d,i]),m=u.useMemo(()=>new cS(l,wS),[l]),f=u.useMemo(()=>{const x=(b,y,A)=>{const S=b.lastActivityAt===null?NaN:Date.parse(b.lastActivityAt);return{key:`${b.type}:${b.id}`,item:{item:b,matches:y},distance:A,usage:(b.usageKey===null?void 0:r[b.usageKey])??pS,lastActivityAt:Number.isNaN(S)?null:S,waiting:b.waiting,demoted:b.demoted}};return c?m.search(c).map(b=>x(b.item,b.matches,b.score??0)):l.map(b=>x(b,void 0,null))},[m,c,l,r]),p=u.useMemo(()=>bS(f,o),[f,o]),{best:h,rest:g}=u.useMemo(()=>yS(p,{queried:c.length>0}),[p,c]);return{bestMatch:h,rows:g,prefix:i,term:c}}function kS(e){return e.startsWith("#")?{prefix:"#",term:e.slice(1)}:e.startsWith("@")?{prefix:"@",term:e.slice(1)}:e.startsWith(">")?{prefix:">",term:e.slice(1)}:{prefix:null,term:e}}function SS(){const e=uo(),t=Ah();return u.useMemo(()=>{const s={};for(const[r,o]of Object.entries(e)){const a=Date.parse(o);s[r]={lastUsedAt:Number.isNaN(a)?null:a,useCount:t[r]??0}}return s},[e,t])}const CS=/^\/([A-Za-z0-9][\w.-]*(?::[\w.-]+)*)(?=\s|$)\s*/;function NS(e,t){const s=t.trim().replace(CS,"").trim();return s?`${e} ${s}`:`${e} `}function AS(e){const[t,s]=Ms(),{setTheme:r,theme:o}=Wi(),a=Pe(),i=le(),c=ae(),d=Sn(j=>j.openFeedback),l=mo(),{url:m}=Mc(),{copy:f}=Fn({toastOnSettle:!0}),{open:p}=rt(),{open:h}=lo(),g=to(),x=P(j=>j.setPickerOpen),b=P(j=>j.setCanvasOpen),y=P(j=>j.setRightPanelOpen),A=P(j=>j.setActiveRightPanelTab),S=u.useCallback(j=>{ms.getState().recordOpened("agent",j)},[]),I=Lc(),v=u.useCallback(j=>{if(Eh(i,Mh)){e(),I({agentPath:j.projectPath}).then(k=>{k&&S(j.projectPath)});return}s(j.projectPath,{onOpened:()=>{S(j.projectPath)}}),e()},[i,I,S,s,e]),E=Fc(),R=u.useCallback(j=>{ms.getState().recordOpened("room",j.id),e(),a({...je.channels(),search:{id:j.id}})},[e,a]),_=u.useCallback((j,k)=>{k&&S(k),e(),a($t({session:j,dir:k??void 0}))},[e,a,S]),D=u.useCallback(j=>{e(),Ih({queryClient:i,transport:c},t).then(async k=>{if(k===null){Xo(t);return}t&&S(t);const M=Rh.getState(),F=M.getSession(k.sessionId).input;M.updateSession(k.sessionId,{input:NS(j,F)}),a(k.isNew?await Th(c,{session:k.sessionId,dir:t??void 0}):$t({session:k.sessionId}))}).catch(k=>{Vi(c,k),Xo(t)})},[e,a,i,c,t,S]),O=u.useCallback(j=>{e(),a({href:j})},[e,a]),T=u.useCallback(j=>{Dh(j)||console.warn(`[command-palette] no handler registered for action "${j}"`)},[]),w=u.useCallback(j=>{switch(e(),j){case"openTasks":h();return;case"openRelay":g();return;case"openMesh":a({...je.team()});return;case"openSettings":p();return;case"discoverAgents":en.getState().open();return;case"browseFilesystem":x(!0);return;case"openAgentProfile":A(Oh),y(!0);return;default:{const k=Pc(j);if(k){p(k);return}T(j);return}}},[e,a,h,g,p,x,A,y,T]),C=u.useCallback(j=>{switch(e(),j){case"navigateDashboard":a({...je.home()});return;case"newSession":E();return;case"openDevPlayground":Rn("/dev");return;case"toggleDevtools":P.getState().toggleDevtools();return;case"toggleRouterDevtools":P.getState().toggleRouterDevtools();return;case"createAgent":Cs.getState().open();return;case"switchShape":P.getState().setShapeSwitcherOpen(!0);return;case"openControlCenter":P.getState().setControlCenterOpen(!0);return;case"toggleCanvas":b(!P.getState().canvasOpen);return;case"toggleTheme":r(o==="dark"?"light":"dark");return;case"openFeedback":d();return;case"openYourReports":a({...je.feedbackRequests()});return;case"openTasks":h();return;case"openRelay":g();return;case"openMesh":a({...je.team()});return;case"discoverAgents":en.getState().open();return;case"openSettings":p();return;case"browseFilesystem":x(!0);return;case mt.copyLink:m&&f(m);return;case mt.showQr:P.getState().setRemoteAccessBeaconOpen(!0);return;case mt.turnOn:l.start();return;case mt.turnOff:l.stop();return;default:T(j);return}},[e,a,T,r,o,b,x,h,g,p,d,f,l,m,E]);return{handleAgentSelect:v,startNewSession:E,handleFeatureAction:w,handleQuickAction:C,handleRoomSelect:R,handleSessionSelect:_,handleCommandSelect:D,handlePageSelect:O,recordAgentOpened:S,setDir:s,selectedCwd:t}}const oi='[cmdk-item=""]:not([aria-disabled="true"])',ES=new Set(["ArrowUp","ArrowDown","Home","End"]),IS=new Set(["n","p","j","k"]);function RS({rootRef:e,activePage:t,onPin:s,resetKey:r}){const o=u.useRef(!1);u.useLayoutEffect(()=>{o.current=!1},[r]),u.useLayoutEffect(()=>{var l;if(o.current)return;const c=(l=e.current)==null?void 0:l.querySelector(`[data-palette-page="${CSS.escape(t)}"] ${oi}`);if(!c||c.getAttribute("aria-selected")==="true")return;const d=c.getAttribute("data-value");d&&s(d)});const a=u.useCallback(c=>{c.nativeEvent.isComposing||c.keyCode===229||(ES.has(c.key)||c.ctrlKey&&IS.has(c.key))&&(o.current=!0)},[]),i=u.useCallback(c=>{c.target instanceof Element&&c.target.closest(oi)&&(o.current=!0)},[]);return{onKeyDown:a,onPointerMove:i}}function TS({scope:e,className:t}){return n.jsx("span",{"data-testid":"palette-scope-chip",className:K("bg-accent text-accent-foreground inline-flex shrink-0 items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs font-medium",t),children:e.kind==="agent"?n.jsxs(n.Fragment,{children:[n.jsx(ho,{...fo(e.agent),size:"xs",badge:null}),$e(e.agent)]}):n.jsxs(n.Fragment,{children:[n.jsx($c,{room:e.room,participants:e.room.participants,size:"xs"}),n.jsx(Bc,{room:e.room})]})})}function DS(e){const t=e.trim();return t.length===0?null:t}function eu(e,t){const s=u.useDeferredValue(e),{sessions:r}=_h(t),{data:o}=cb(s||null),a=u.useMemo(()=>r.slice(0,3).map(i=>({id:i.id,title:Tc(i.title),lastActive:i.updatedAt})),[r]);return{sessionCount:r.length,recentSessions:a,health:o??null}}function OS({agent:e}){const{sessionCount:t,recentSessions:s,health:r}=eu(e.id,e.projectPath),{color:o,emoji:a}=fo(e);return n.jsx(se.div,{initial:{opacity:0,width:0},animate:{opacity:1,width:240},exit:{opacity:0,width:0},transition:{duration:.2,ease:[0,0,.2,1]},className:"flex-shrink-0 overflow-hidden border-l will-change-[width]",children:n.jsxs("div",{className:"w-[240px] space-y-3 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ho,{color:o,emoji:a,size:"sm",className:"shrink-0"}),n.jsx("span",{className:"truncate text-sm font-semibold",children:$e(e)})]}),n.jsx("p",{className:"text-muted-foreground truncate text-xs",children:so(e.projectPath)}),n.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[r&&n.jsx(Tn,{size:"xs",variant:r.status==="active"?"default":"secondary",children:r.status}),n.jsxs("span",{className:"text-muted-foreground",children:[t," ",t===1?"chat":"chats"]})]}),s.length>0&&n.jsxs("div",{className:"space-y-1 pt-1",children:[n.jsx("p",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Recent"}),n.jsx("ul",{className:"space-y-0.5",children:s.map(i=>n.jsx("li",{className:"text-muted-foreground truncate text-xs",children:i.title},i.id))})]})]})})}function MS({agent:e,onOpenHere:t,onOpenNewTab:s,onOpenNewWindow:r,onNewSession:o,onBrowseSessions:a,onEditSettings:i,recentSessions:c,onSelectSession:d}){const l=zt?"⌘":"Ctrl+";return n.jsxs(n.Fragment,{children:[n.jsxs(et,{heading:`${$e(e)} actions`,children:[n.jsxs(Ce,{value:"open-here",onSelect:t,children:[n.jsx(Ns,{className:"size-4"}),n.jsx("span",{children:"Open here"}),n.jsx(va,{children:"Enter"})]}),n.jsxs(Ce,{value:"open-new-tab",onSelect:s,children:[n.jsx(Ab,{className:"size-4"}),n.jsx("span",{children:"Open in a new tab"}),n.jsxs(va,{children:[l,"Enter"]})]}),r&&n.jsxs(Ce,{value:"open-new-window",onSelect:r,children:[n.jsx(Ty,{className:"size-4"}),n.jsx("span",{children:"Open in a new window"})]}),n.jsxs(Ce,{value:"new-session",onSelect:o,children:[n.jsx(At,{className:"size-4"}),n.jsx("span",{children:"New chat"})]}),a&&n.jsxs(Ce,{value:"browse-sessions",onSelect:a,children:[n.jsx(Ib,{className:"size-4"}),n.jsx("span",{children:"Browse chats…"})]}),n.jsxs(Ce,{value:"edit-settings",onSelect:i,children:[n.jsx(_s,{className:"size-4"}),n.jsxs("span",{children:["Edit ",$e(e)," settings"]})]})]}),c.length>0&&n.jsx(et,{heading:"Recent chats",children:c.map(m=>n.jsxs(Ce,{value:m.id,onSelect:()=>d(m.id),children:[n.jsx(Ss,{className:"size-4"}),n.jsx("span",{className:"truncate",children:m.title}),n.jsx("span",{className:"text-muted-foreground ml-auto text-xs",children:_S(m.lastActive)})]},m.id))})]})}function _S(e){const t=Date.now(),s=new Date(e).getTime(),r=t-s,o=Math.floor(r/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const a=Math.floor(o/60);if(a<24)return`${a}h ago`;const i=Math.floor(a/24);return i<7?`${i}d ago`:`${Math.floor(i/7)}w ago`}const vt="bg-muted rounded px-1 py-0.5 font-mono text-3xs";function PS({page:e,hasAgentSelected:t,canScope:s,isScoped:r}){const o=zt?"⌘":"Ctrl";return n.jsxs("div",{className:"text-muted-foreground flex flex-shrink-0 items-center gap-3 border-t px-3 py-1.5 text-xs",children:[n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"↑↓"}),"Navigate"]}),!e&&t&&n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"Enter"}),"Open"]}),(!e&&t||e==="agent-actions")&&n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsxs("kbd",{className:vt,children:[o,"Enter"]}),"New tab"]}),e==="agent-actions"&&n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"Enter"}),"Select"]}),e&&n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"Backspace"}),"Back"]}),s&&n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"Tab"}),"Search inside"]}),r&&n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"Backspace"}),"Clear scope, at the start"]}),n.jsxs("span",{className:"ml-auto inline-flex items-center gap-1",children:[n.jsx("kbd",{className:vt,children:"esc"}),"Close"]})]})}const LS=[{key:"#",means:"channels"},{key:"@",means:"agents and DMs"},{key:">",means:"commands"}];function tu({className:e}){return n.jsx("div",{className:K("text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-xs",e),children:LS.map(({key:t,means:s})=>n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:"bg-muted text-3xs rounded px-1 py-0.5 font-mono",children:t}),s]},t))})}function FS({text:e,indices:t,className:s}){if(!t||t.length===0)return n.jsx("span",{className:s,children:e});const r=[];let o=0;for(let a=0;a<t.length;a++){const[i,c]=t[a],d=c+1;o<i&&r.push(n.jsx("span",{children:e.slice(o,i)},`p-${a}`)),r.push(n.jsx("mark",{className:"text-foreground bg-transparent font-semibold",children:e.slice(i,d)},`m-${a}`)),o=d}return o<e.length&&r.push(n.jsx("span",{children:e.slice(o)},"tail")),n.jsx("span",{className:s,children:r})}function nu({agent:e,isActive:t,onSelect:s,nameIndices:r,isSelected:o}){return n.jsxs(Ce,{value:$e(e),keywords:[e.name,e.projectPath,e.id],onSelect:()=>s(),className:"relative py-2",forceMount:t?!0:void 0,children:[o&&n.jsx(se.div,{layoutId:"cmd-palette-selection",className:"bg-accent absolute inset-0 rounded-sm",transition:{duration:.15,ease:[0,0,.2,1]}}),n.jsx("div",{className:"relative z-10 w-full",children:n.jsx(Rb,{agent:e,name:r?n.jsx(FS,{text:$e(e),indices:r,className:"truncate text-sm font-semibold"}):n.jsx("span",{className:"truncate text-sm font-semibold",children:$e(e)}),secondary:so(e.projectPath),selected:t})})]})}function su(){return n.jsx("span",{"data-testid":"palette-archived-mark",className:"text-muted-foreground border-border text-3xs shrink-0 rounded-full border px-1.5 py-0.5 font-medium",children:"Archived"})}function ru({room:e,onSelect:t}){const s=rn(e);return n.jsxs(Ce,{value:e.id,keywords:Or(e),onSelect:t,className:"flex items-center gap-2 py-2",children:[n.jsx($c,{room:e,participants:e.participants,className:"shrink-0"}),e.kind==="dm"?n.jsxs("span",{className:"min-w-0 flex-1 truncate text-sm",children:["Open DM with ",e.title]}):n.jsx(Bc,{room:e,className:"min-w-0 flex-1 text-sm"}),e.archived&&n.jsx(su,{}),s&&n.jsx("span",{className:"bg-brand/15 text-brand-text text-3xs shrink-0 rounded-full px-1.5 py-0.5 font-medium tabular-nums","aria-label":`${e.unreadCount} unread`,children:e.unreadCount})]})}const $S=6e4;function BS({lastActivityAt:e}){const t=po($S),s=u.useMemo(()=>Number.isNaN(Date.parse(e))?null:zn(e),[e,t]);return s===null?null:n.jsx("span",{className:"text-muted-foreground text-2xs font-normal",children:s})}function Ur({item:e,live:t,isSelected:s=!1,onSelect:r}){const o=zc(e.agent,e.cwd??e.id),a=Ph(e.who,e.title),i=(t==null?void 0:t.verb)??null;return n.jsxs(Ce,{value:e.id,keywords:Ud(e),onSelect:r,title:a,className:K("flex gap-2 py-1.5",i!==null?"items-start":"items-center"),children:[n.jsx(ho,{color:o.color,emoji:o.emoji,size:"xs",className:K("shrink-0",i!==null&&"mt-px")}),n.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("span",{"data-slot":"palette-session-line",className:"flex w-full items-center gap-1.5 text-sm",children:[e.who?n.jsxs(n.Fragment,{children:[n.jsx("span",{"data-slot":"palette-session-who",className:Lh,children:e.who}),n.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground/60 flex-none",children:Fh})]}):null,n.jsx("span",{"data-slot":"palette-session-title",className:$h,children:e.title}),n.jsxs("span",{className:K("flex items-center gap-1.5",zh),children:[e.archived&&t===void 0&&n.jsx(su,{}),n.jsx(Bh,{origin:e.origin,label:e.originLabel,className:"text-muted-foreground"}),n.jsx(BS,{lastActivityAt:e.lastActivityAt}),s&&n.jsx(zS,{canStartNewSession:e.cwd!==null})]})]}),i!==null&&n.jsxs("span",{className:"text-muted-foreground text-2xs flex items-center gap-1.5 font-normal",children:[t!==void 0&&n.jsx("span",{"aria-hidden":!0,className:K("size-1.5 shrink-0 rounded-full",Uh(t.signal))}),i]})]})]})}function zS({canStartNewSession:e}){return n.jsxs("span",{"aria-hidden":!0,className:"text-muted-foreground flex items-center gap-1",children:[n.jsx("kbd",{className:"bg-accent text-3xs rounded px-1 py-0.5 font-mono",children:"↵"}),e&&n.jsx("kbd",{className:"bg-accent text-3xs rounded px-1 py-0.5 font-mono",children:"⌘↵"})]})}const US={session:"Conversations",agent:"Agents",room:"Channels",dm:"Direct messages",command:"Commands",feature:"Actions","quick-action":"Actions",page:"Add-ons"},KS="Best match",Kr={Clock:oc,Radio:Tb,Globe:ds,Settings:_s,Plus:At,Search:ls,FolderOpen:Ns,Moon:Yx,Shapes:Hh,MessageSquarePlus:Uc,Inbox:Kh},Mt=[0,0,.2,1],HS=[.4,0,1,1],ou={hidden:{opacity:0,scale:.96,y:-8},visible:{opacity:1,scale:1,y:0,transition:{duration:.2,ease:Mt}},exit:{opacity:0,scale:.96,y:-8,transition:{duration:.12,ease:HS}}},WS={hidden:{},visible:{transition:{staggerChildren:.035,delayChildren:.04}}},An={hidden:{opacity:0,y:-4},visible:{opacity:1,y:0,transition:{duration:.15,ease:Mt}}},ar=8;function GS({continueRows:e,recent:t,newActions:s,selectedCwd:r,selectedValue:o,onSessionSelect:a,onRoomSelect:i,onGoToAgentActions:c,onQuickAction:d}){return n.jsxs(n.Fragment,{children:[e.length>0&&n.jsx(et,{heading:"Continue",children:e.map((l,m)=>n.jsx(se.div,{variants:m<ar?An:void 0,children:n.jsx(Ur,{item:l.session,live:{verb:l.verb,signal:l.signal},isSelected:o===l.session.id,onSelect:()=>a(l.session)})},l.session.id))}),t.length>0&&n.jsx(et,{heading:"Recent",children:t.map((l,m)=>n.jsxs(se.div,{variants:m<ar?An:void 0,children:[l.kind==="session"&&n.jsx(Ur,{item:l.session,isSelected:o===l.session.id,onSelect:()=>a(l.session)}),l.kind==="room"&&n.jsx(ru,{room:l.room,onSelect:()=>i(l.room)}),l.kind==="agent"&&n.jsx(nu,{agent:l.agent,isActive:l.agent.projectPath===r,isSelected:o===$e(l.agent),onSelect:()=>c(l.agent)})]},l.key))}),s.length>0&&n.jsxs(n.Fragment,{children:[(e.length>0||t.length>0)&&n.jsx(Kl,{}),n.jsx(et,{heading:"New",children:s.map((l,m)=>{const f=Kr[l.icon];return n.jsx(se.div,{variants:m<ar?An:void 0,children:n.jsx(Ce,{value:l.label,onSelect:()=>d(l.action),children:n.jsxs(se.div,{whileHover:{x:2},transition:{duration:.1,ease:Mt},className:"flex w-full items-center gap-2",children:[f&&n.jsx(f,{className:"size-4"}),n.jsx("span",{children:l.label})]})})},l.id)})})]})]})}function ai({row:e,selectedCwd:t,selectedValue:s,onFeatureAction:r,onQuickAction:o,onGoToAgentActions:a,onRoomSelect:i,onSessionSelect:c,onCommandSelect:d,onPageSelect:l}){var p;const{item:m,matches:f}=e.item;switch(m.type){case"session":return n.jsx(Ur,{item:m.data,isSelected:s===m.data.id,onSelect:()=>c(m.data)});case"agent":return n.jsx(nu,{agent:m.data,isActive:m.data.projectPath===t,isSelected:s===$e(m.data),onSelect:()=>a(m.data),nameIndices:(p=f==null?void 0:f.find(h=>h.key==="name"))==null?void 0:p.indices});case"room":case"dm":return n.jsx(ru,{room:m.data,onSelect:()=>i(m.data)});case"command":return n.jsx(Ce,{value:m.data.name,onSelect:()=>d(m.data.name),children:n.jsxs(se.div,{whileHover:{x:2},transition:{duration:.1,ease:Mt},className:"flex w-full items-center gap-2",children:[n.jsx("span",{className:"font-mono text-xs",children:m.data.name}),m.data.description&&n.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:m.data.description})]})});case"feature":{const h=Kr[m.data.icon];return n.jsx(Ce,{value:m.data.label,onSelect:()=>r(m.data.action),children:n.jsxs(se.div,{whileHover:{x:2},transition:{duration:.1,ease:Mt},className:"flex w-full items-center gap-2",children:[h&&n.jsx(h,{className:"size-4"}),n.jsx("span",{children:m.data.label}),m.data.shortcut&&n.jsx("span",{className:"text-muted-foreground ml-auto text-xs",children:m.data.shortcut})]})})}case"page":return n.jsx(Ce,{value:m.data.id,onSelect:()=>l(m.data.href),children:n.jsxs(se.div,{whileHover:{x:2},transition:{duration:.1,ease:Mt},className:"flex w-full items-center gap-2",children:[n.jsx($n,{icon:m.data.icon,className:"size-4"}),n.jsx("span",{children:m.data.label})]})});case"quick-action":{const h=Kr[m.data.icon];return n.jsx(Ce,{value:m.data.label,onSelect:()=>o(m.data.action),children:n.jsxs(se.div,{whileHover:{x:2},transition:{duration:.1,ease:Mt},className:"flex w-full items-center gap-2",children:[h&&n.jsx(h,{className:"size-4"}),n.jsx("span",{children:m.data.label})]})})}}}function qS({term:e,isScoped:t=!1,onSelect:s}){return n.jsxs(Ce,{value:"search-messages-handoff",onSelect:s,className:"flex items-center gap-2 py-2",children:[n.jsx(Ss,{className:"text-muted-foreground size-4 shrink-0"}),n.jsxs("span",{className:"min-w-0 flex-1 truncate text-sm",children:["Search ",t?"all messages":"messages"," for"," ",n.jsxs("mark",{className:"text-foreground bg-transparent font-semibold",children:["“",e,"”"]}),"…"]}),n.jsx("kbd",{className:"bg-muted text-muted-foreground text-3xs shrink-0 rounded px-1 py-0.5 font-mono",children:zt?"⌘⇧F":"Ctrl⇧F"})]})}const ii=8;function YS({staggerKey:e,isZeroQuery:t,isRoomMode:s,scope:r,hasQuery:o,selectedCwd:a,selectedValue:i,continueRows:c,recent:d,newActions:l,bestMatch:m,rows:f,rooms:p,searchHandoff:h,onFeatureAction:g,onQuickAction:x,onGoToAgentActions:b,onRoomSelect:y,onSessionSelect:A,onCommandSelect:S,onPageSelect:I}){const v=s?p.isError?"Couldn’t load your channels.":p.isLoading?"Loading channels…":p.channels.length===0?"No channels yet.":null:null,E=vS(f,O=>r?Ya(r):US[O.item.item.type]),R=r&&!o&&f.length===0&&!m?Jk(r):null,_=new Set(f.slice(0,m?ii-1:ii).map(O=>O.key)),D={selectedCwd:a,selectedValue:i,onFeatureAction:g,onQuickAction:x,onGoToAgentActions:b,onRoomSelect:y,onSessionSelect:A,onCommandSelect:S,onPageSelect:I};return n.jsxs(se.div,{variants:WS,initial:"hidden",animate:"visible",children:[t&&n.jsx(GS,{continueRows:c,recent:d,newActions:l,selectedCwd:a,selectedValue:i,onSessionSelect:A,onRoomSelect:y,onGoToAgentActions:b,onQuickAction:x}),!t&&m&&n.jsx(et,{heading:KS,children:n.jsx(se.div,{variants:An,children:n.jsx(ai,{row:m,...D})})}),!t&&E.map((O,T)=>n.jsx(et,{heading:O.label,children:O.rows.map(w=>n.jsx(se.div,{variants:_.has(w.key)?An:void 0,children:n.jsx(ai,{row:w,...D})},w.key))},`${O.label}-${T}`)),R&&n.jsx(et,{heading:r?Ya(r):void 0,children:n.jsx(Ce,{disabled:!0,value:"scope-status",className:"text-muted-foreground text-sm",children:R})}),v&&n.jsx(et,{heading:"Channels",children:n.jsx(Ce,{disabled:!0,value:"rooms-status",className:"text-muted-foreground text-sm",children:v})}),h&&n.jsx(et,{children:n.jsx(qS,{term:h.term,isScoped:h.isScoped,onSelect:h.onSelect})}),t&&n.jsxs(n.Fragment,{children:[n.jsx(Kl,{}),n.jsx(tu,{})]})]},e)}function VS(e,t){const s=Vx(),{dismissedIds:r}=Ol(),o=P(a=>a.promoEnabled);return u.useMemo(()=>o?Qx(Xx.filter(a=>a.placements.includes(e)),s,r,t):[],[e,t,s,r,o])}const QS={initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,scale:.95,transition:{duration:.15}}};function XS({promo:e}){const{activate:t,dialog:s}=Jx(e),{dismissPromo:r}=Ol(),o=lt(),a=e.content.icon;return n.jsxs(se.div,{variants:o?void 0:QS,layout:!o,className:"group/promo relative",children:[n.jsxs("button",{"data-slot":"promo-card-compact",onClick:t,className:"bg-sidebar-accent/40 text-sidebar-foreground/70 hover:bg-sidebar-accent/70 hover:text-sidebar-foreground focus-visible:ring-sidebar-ring flex w-full items-center gap-2 rounded-md py-1.5 pr-7 pl-2 text-left outline-hidden transition-colors duration-150 focus-visible:ring-2",children:[n.jsx("span",{className:"flex size-[18px] shrink-0 items-center justify-center",children:n.jsx(a,{className:"size-4"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"text-sidebar-foreground/90 text-control block truncate font-medium",children:e.content.title}),n.jsx("span",{className:"text-2xs block truncate",children:e.content.shortDescription})]}),n.jsx(Nc,{className:"size-3.5 shrink-0 opacity-60"})]}),n.jsx("button",{type:"button",onClick:()=>r(e.id),"aria-label":"Dismiss",className:"text-sidebar-foreground/40 hover:text-sidebar-foreground focus-ring absolute top-1/2 right-1.5 -translate-y-1/2 rounded-md p-0.5 opacity-70 transition-[color,opacity] duration-150 group-hover/promo:opacity-100",children:n.jsx(Ue,{className:"size-3.5"})}),s]})}const JS=1;function ZS(e){const[t]=VS(e,JS);return u.useMemo(()=>t===void 0?{id:"promo",show:!1,render:()=>null}:{id:`promo:${t.id}`,show:!0,render:()=>n.jsx(XS,{promo:t})},[t])}const eC=new Set(["downloading","downloaded","install-failed"]);function ci(e,t){return(e==null?void 0:e.state)==="install-failed"?t.state==="downloaded"&&So(t.version,e.version)?t:e:eC.has(t.state)||t.state==="error"?t:e&&(e.state==="downloading"||e.state==="downloaded")?e:t}function tC(){var o;const e=typeof window<"u"&&!!((o=window.electronAPI)!=null&&o.onUpdateStatus),[t,s]=u.useState(null);u.useEffect(()=>{var c;const a=window.electronAPI;if(!(a!=null&&a.onUpdateStatus))return;const i=a.onUpdateStatus(d=>{s(l=>ci(l,d))});return(c=a.getUpdateStatus)==null||c.call(a).then(d=>{d&&s(l=>ci(l,d))}),i},[]);const r=u.useCallback(()=>{var a,i;(i=(a=window.electronAPI)==null?void 0:a.restartToUpdate)==null||i.call(a)},[]);return{isDesktop:e,status:t,restart:r}}const nC={darwin:jr("/download/mac"),win32:jr("/download/windows")},sC=Vr.site;function rC(){var t;const e=typeof window>"u"||(t=window.electronAPI)==null?void 0:t.platform;Ct((e&&nC[e])??sC)}function oC(){const{data:e}=Le(),{isDesktop:t,status:s,restart:r}=tC(),o=Wn(),a=e==null?void 0:e.version,i=(e==null?void 0:e.latestVersion)??null,c=u.useMemo(()=>(e==null?void 0:e.dismissedUpgradeVersions)??[],[e==null?void 0:e.dismissedUpgradeVersions]),d=u.useCallback(m=>{o.mutate({ui:{dismissedUpgradeVersions:[...c,m]}})},[c,o]),l=(e==null?void 0:e.serverRole)==="hub";return u.useMemo(()=>l?{kind:"none"}:t?(s==null?void 0:s.state)==="install-failed"?{kind:"desktop-install-failed",downloadFresh:rC}:(s==null?void 0:s.state)!=="downloaded"?{kind:"none"}:{kind:"desktop-restart",restart:r}:i!==null&&a!==void 0&&So(i,a)&&!c.includes(i)?{kind:"command",latestVersion:i,dismiss:()=>d(i)}:{kind:"none"},[l,t,s,r,i,a,c,d])}const aC="npm update -g dorkos",iC="The update couldn’t install itself. Download a fresh copy. Your settings and agents stay put.",ir="focus-ring inline-flex items-center gap-1 rounded-full bg-amber-500/15 px-2 py-0.5 text-2xs font-medium text-amber-700 transition-colors duration-150 hover:bg-amber-500/25 dark:text-amber-300";function cC(e,t,s){return t?"Command copied":s?"Couldn’t copy":`Update ready: v${e}`}function lC({update:e}){const{copied:t,failed:s,copy:r}=Fn(),o=u.useCallback(()=>{r(aC)},[r]);return e.kind==="none"?null:e.kind==="desktop-restart"?n.jsx("div",{className:"flex items-center px-0.5",children:n.jsxs("button",{type:"button",onClick:e.restart,"aria-label":"Restart to install the update",className:ir,children:[n.jsx(ib,{className:"size-3"}),"Restart to update"]})}):e.kind==="desktop-install-failed"?n.jsxs("div",{role:"group","aria-label":"Update didn’t install",className:"flex flex-col gap-1.5 px-0.5",children:[n.jsx("p",{className:"text-sidebar-foreground/70 text-2xs leading-snug",children:iC}),n.jsxs("button",{type:"button",onClick:e.downloadFresh,"aria-label":"Download a fresh copy of DorkOS",className:K(ir,"self-start"),children:[n.jsx(Wh,{className:"size-3"}),"Download fresh copy"]})]}):n.jsxs("div",{className:"flex items-center gap-1 px-0.5",children:[n.jsxs("button",{type:"button",onClick:o,"aria-label":`Copy the update command for v${e.latestVersion}`,className:ir,children:[t?n.jsx(cn,{className:"size-3"}):n.jsx(Zr,{className:"size-3"}),cC(e.latestVersion,t,s)]}),n.jsx("button",{type:"button",onClick:e.dismiss,"aria-label":"Dismiss update notification",className:"text-sidebar-foreground/50 hover:text-sidebar-foreground focus-ring rounded-md p-0.5 transition-colors duration-150",children:n.jsx(Ue,{className:"size-3"})})]})}function au(){const{shouldShowGettingStarted:e,dismiss:t}=Yt(),s=oC(),r=rw(),o=lw(),a=kd(),i=ZS("dashboard-sidebar"),c=Ps(),d=[{id:"getting-started",show:e,render:()=>n.jsx(aw,{onDismiss:t})},{id:"update",show:s.kind!=="none",render:()=>n.jsx(lC,{update:s})},{id:"identity-prompt",show:r.visible,render:()=>n.jsx(dw,{prompt:r})},{id:"profile-prompt",show:o.visible,render:()=>n.jsx(iw,{prompt:o})},{id:"official-space-offer",show:a.due&&!e,render:()=>n.jsx(jl,{className:"bg-secondary/60 rounded-lg"})},{...i,show:i.show&&!a.pending}];return n.jsx(Kx,{candidates:d,ready:c.settled})}const li="dorkos-pinned-agents";function iu(){const{data:e}=Le(),t=Ls(),{update:s}=Fs(),r=t.pinned.length,o=u.useRef(!1);u.useEffect(()=>{if(o.current||e===void 0)return;const a=localStorage.getItem(li);if(a===null){o.current=!0;return}o.current=!0;let i=[];try{const c=JSON.parse(a);Array.isArray(c)&&(i=c.filter(d=>typeof d=="string"))}catch{i=[]}r===0&&i.length>0&&s(c=>({...c,pinned:i.map(d=>({kind:"agent",path:d}))})),localStorage.removeItem(li)},[e,r,s])}function cu(e){return u.useMemo(()=>Gh(e),[e])}const dC=6e4,uC=[];function lu(e,t){const s=vc(e),r=s.read();return r!==e&&!t(r,e)?(s.write(e),e):r}function mC(e,t){const s=Object.keys(e),r=Object.keys(t);return s.length===r.length&&r.every(o=>Object.is(e[o],t[o]))}function hC(e,t){return e.length===t.length&&t.every((s,r)=>e[r]===s)}function cr(e){return lu(e,mC)}function fC(e){return lu(e,hC)}function pC(e,t){const s=_e({select:p=>p.location.pathname}),r=Yh(t,s),o=(r==null?void 0:r.extensionId)??null,a=(r==null?void 0:r.path)??null,i=Xr({strict:!1}),c=s==="/session"?i.session??null:null,d=Vh(c),l=s==="/session"?(d==null?void 0:d.cwd)??i.dir??null:null,m=s==="/channels"?i.id??null:null,f=m===null?null:e(m);return u.useMemo(()=>c!==null?{kind:"session",sessionId:c,agentPath:l??"",cwd:l}:s==="/threads"?{kind:"command",commandId:"open-threads"}:s==="/team"?{kind:"command",commandId:"open-directory"}:o!==null&&a!==null?{kind:"add-on",extensionId:o,path:a}:m===null||f===null?null:{kind:"room",roomId:m,roomKind:f},[c,l,s,o,a,m,f])}function du(){const e=po(dC),t=Ps(),s=Dc(qh),r=u.useMemo(()=>{var j;return((j=s.data)==null?void 0:j.sessions)??[]},[s.data]),o=kt(Oc(j=>{const k={};for(const[M,F]of Object.entries(j.statuses))k[M]=F.lifecycle;return k})),a=u.useMemo(()=>Object.entries(o).filter(([,j])=>j==="streaming").map(([j])=>j),[o]),i=kt(u.useCallback(j=>j.statusCwds,[])),c=Ds(),d=u.useMemo(()=>{const j=c.data??[];return t.fleetKnown?j:j.filter(k=>k.kind!=="dm")},[c.data,t.fleetKnown]),l=cr(u.useMemo(()=>{const j={};for(const k of c.data??[]){const M=k.mentionCount??0;M>0&&(j[k.id]=M)}return j},[c.data])),m=uo(),f=cr(u.useMemo(()=>{const j={};for(const[k,M]of Object.entries(m)){if(!k.startsWith("agent:"))continue;const F=Date.parse(M);Number.isNaN(F)||(j[k.slice(6)]=F)}return j},[m])),h=Os().data,g=fC(u.useMemo(()=>((h==null?void 0:h.agents)??[]).map(j=>j.projectPath),[h])),b=go(g).data,{brokenPaths:y}=xx(),A=cr(lb(g,y,f)),S=u.useMemo(()=>{var j;return((j=s.data)==null?void 0:j.agentActivity)??{}},[s.data]),I=t.fleetKnown?g:uC,v=u.useMemo(()=>I.map(j=>{const k=(b==null?void 0:b[j])??null,M=S[j],F=M===void 0?NaN:Date.parse(M);return{path:j,runtime:(k==null?void 0:k.runtime)??"claude-code",namespace:(k==null?void 0:k.namespace)??null,isSystem:(k==null?void 0:k.isSystem)??!1,lastActivityAt:Number.isNaN(F)?null:F,attention:A[j]??"inactive"}}),[I,b,S,A]),E=u.useMemo(()=>Kc(I,b??{}),[I,b]),R=Ls(),_=u.useMemo(()=>dv(R),[R]),D=u.useMemo(()=>{const j=new Map;for(const k of d)j.set(k.id,k.kind==="dm"?"dm":"channel");return j},[d]),O=u.useMemo(()=>j=>D.get(j)??"channel",[D]),T=oo(),w=u.useMemo(()=>T.map(({id:j,extensionId:k,path:M,title:F})=>({id:j,extensionId:k,path:M,title:F})),[T]),C=pC(O,w);return u.useMemo(()=>({now:e,sessions:r,workingSessionIds:a,liveSessionCwds:i,rooms:d,agents:v,displayNames:E,prefs:_,mentions:l,addOns:w,activeTarget:C}),[e,r,a,i,d,v,E,_,l,w,C])}const gC="Threads and Directory are pages. Drop it in a section.",xC="Add-ons lists extension pages only.";function uu(e){return e==="addons"?xC:gC}const mu={channels:"Channels",dms:"Direct messages"};function di(e){if(typeof e!="object"||e===null)return!1;const t=e.kind;if(t==="ungrouped"){const s=e.section;return s===void 0||typeof s=="string"&&s in mu}if(t==="computed"){const s=e.section;return s==="top"||s==="addons"}return t==="group"&&typeof e.groupId=="string"}function bC(e){if(typeof e!="object"||e===null)return!1;const t=e.kind;return t==="agent"?typeof e.path=="string":t==="room"&&typeof e.roomId=="string"}function En(e){if(typeof e!="object"||e===null)return null;const t=e.type;if(t==="item"){const s=e.ref,r=e.container;return bC(s)&&di(r)?{type:"item",ref:s,container:r}:null}if(t==="group"){const s=e.groupId;return typeof s=="string"?{type:"group",groupId:s}:null}if(t==="container"){const s=e.container;return di(s)?{type:"container",container:s}:null}return null}function hu(e){return e===null?null:e.type==="item"?{type:"item",ref:e.ref,from:e.container}:e.type==="group"?{type:"group",groupId:e.groupId}:null}function fu(e){if(e===null)return null;switch(e.type){case"item":return{type:"item",ref:e.ref,container:e.container};case"group":return{type:"group-header",groupId:e.groupId};case"container":return{type:"container",container:e.container}}}function pu(e){switch(e.type){case"container":return{container:e.container};case"item":return{container:e.container,overRef:e.ref};case"group-header":return{container:{kind:"group",groupId:e.groupId}}}}function Hr(e,t){return e.findIndex(s=>Qh(s,t))}function ui(e,t,s,r){const o=e.groups.find(i=>i.id===s);if(!o)return{kind:"none"};if(o.kind==="smart")return{kind:"reject-smart-group",groupId:s,ref:t};let a=null;if(o.sortMode==="manual"&&r!==void 0){const i=Hr(o.items,r);i>=0&&(a=i)}return{kind:"move-to-group",ref:t,groupId:s,toIndex:a}}function Ko(e,t,s){if(s===null)return{kind:"none"};if(t.type==="group"){if(s.type!=="group-header")return{kind:"none"};const c=e.groups.findIndex(l=>l.id===t.groupId),d=e.groups.findIndex(l=>l.id===s.groupId);return c<0||d<0||c===d?{kind:"none"}:{kind:"reorder-group",groupId:t.groupId,from:c,to:d}}const{ref:r,from:o}=t,{container:a,overRef:i}=pu(s);if(a.kind==="computed")return{kind:"reject-computed-section",ref:r,section:a.section};if(o.kind==="group"){if(a.kind==="ungrouped")return{kind:"remove-from-group",ref:r};if(a.groupId!==o.groupId)return ui(e,r,a.groupId,i);const c=e.groups.find(m=>m.id===o.groupId);if(!c||c.sortMode!=="manual"||i===void 0)return{kind:"none"};const d=Hr(c.items,r),l=Hr(c.items,i);return d<0||l<0||d===l?{kind:"none"}:{kind:"reorder-within-group",groupId:o.groupId,ref:r,from:d,to:l}}return a.kind==="group"?ui(e,r,a.groupId,i):{kind:"none"}}function yC(e,t,s){switch(t.kind){case"none":case"reject-smart-group":case"reject-computed-section":return e;case"reorder-group":return Zh(e,t.from,t.to);case"remove-from-group":return Jh(e,{kind:"item",ref:t.ref},s);case"reorder-within-group":return Jo(e,t.groupId,t.from,t.to);case"move-to-group":{const r=Xh(e,t.ref,t.groupId);if(t.toIndex===null)return r;const o=r.groups.find(a=>a.id===t.groupId);return o?Jo(r,t.groupId,o.items.length-1,t.toIndex):r}}}function vC(e,t,s,r){return yC(e,Ko(e,t,s),r)}function wC(e,t){return e.type==="group"?`Picked up section ${t.groupName(e.groupId)}.`:`Picked up ${t.itemName(e.ref)}.`}function jC(e,t){switch(e.kind){case"reorder-group":return`Moved section ${t.groupName(e.groupId)}.`;case"move-to-group":return`Moved ${t.itemName(e.ref)} to ${t.groupName(e.groupId)}.`;case"remove-from-group":return`Moved ${t.itemName(e.ref)} out of its section.`;case"reorder-within-group":return`Reordered ${t.itemName(e.ref)} in ${t.groupName(e.groupId)}.`;case"reject-smart-group":return`Can’t move ${t.itemName(e.ref)} into ${t.groupName(e.groupId)}. Membership is rule-based. Edit rules instead.`;case"reject-computed-section":return`Can’t move ${t.itemName(e.ref)} there. ${uu(e.section)}`;case"none":return""}}function kC(e,t){if(e===null)return"";const{container:s}=pu(e);switch(s.kind){case"ungrouped":return`Over ${mu[s.section??"dms"]}.`;case"computed":return s.section==="addons"?"Over Add-ons.":"Over Threads and Directory.";case"group":return`Over ${t.groupName(s.groupId)}.`}}function SC(e){const t=r=>hu(En(r.active.data.current)),s=r=>{var o;return fu(En((o=r.over)==null?void 0:o.data.current))};return{onDragStart:r=>{const o=t(r);return o?wC(o,e()):void 0},onDragOver:r=>{if(t(r))return kC(s(r),e())||void 0},onDragEnd:r=>{const o=t(r);if(!o)return;const a=e(),i=Ko(a.prefs,o,s(r));return i.kind==="none"?"Movement cancelled. Item returned to its place.":jC(i,a)},onDragCancel:r=>{const o=t(r);if(!o)return;const a=e();return`Movement cancelled. ${o.type==="group"?a.groupName(o.groupId):a.itemName(o.ref)} returned to its place.`}}}function CC({label:e}){const t=lt();return n.jsx(se.div,{initial:{scale:1},animate:{scale:t===!0?1:tf},transition:{duration:t===!0?0:ef},className:"bg-sidebar border-sidebar-border text-sidebar-foreground shadow-floating flex items-center rounded-md border px-2.5 py-1.5 text-xs font-medium",children:e})}function NC(e){const t=e.defaultView;if(t===null)return;const s=[],r=a=>{a.preventDefault(),a.stopImmediatePropagation(),s.push(a)};t.addEventListener("keydown",r,!0);const o=()=>{const a=s.shift();if(a===void 0)return;(a.target instanceof t.Node?a.target:e).dispatchEvent(new t.KeyboardEvent("keydown",{key:a.key,code:a.code,altKey:a.altKey,ctrlKey:a.ctrlKey,metaKey:a.metaKey,shiftKey:a.shiftKey,repeat:a.repeat,bubbles:!0,cancelable:!0,composed:!0})),s.length>0&&t.setTimeout(o)};t.setTimeout(()=>{t.setTimeout(()=>{t.removeEventListener("keydown",r,!0),o()})})}const AC=60;function EC(e){const t=document.querySelectorAll(`[${Zo}]`);for(const s of t)if(s.getAttribute(Zo)===e)return s.querySelector(`[${nf}]`);return null}function IC(e,t=AC){let s=t;const r=()=>{const o=EC(e);if(o!==null){o.focus();return}s-- >0&&requestAnimationFrame(r)};requestAnimationFrame(r)}const RC={start:["Space"],cancel:["Escape"],end:["Space","Enter","Tab"]};function TC(e){switch(e.kind){case"move-to-group":return ea(e.groupId,e.ref);case"remove-from-group":return ea("ungrouped",e.ref);default:return null}}function DC({data:e,itemName:t,groupName:s}){const r=e.type==="group"?s(e.groupId):e.type==="item"?t(e.ref):"";return n.jsx(CC,{label:r})}function OC({children:e,displayNames:t,rooms:s}){const r=Fe(),o=Ls(),{update:a}=Fs(),[i,c]=u.useState(null),d=Dt(o),l=Dt(t),m=u.useMemo(()=>Object.fromEntries(s.map(I=>[I.id,I.slug??I.title])),[s]),f=Dt(m),p=u.useMemo(()=>sf(s),[s]),h=Dt(p),g=wc(us(Sc,{activationConstraint:{distance:8}}),us(kc,{coordinateGetter:wr,keyboardCodes:RC}));if(r)return n.jsx(n.Fragment,{children:e});const x=I=>{var v;return((v=d.read().groups.find(E=>E.id===I))==null?void 0:v.name)??"group"},b=I=>I.kind==="agent"?l.read()[I.path]??I.path.split("/").pop()??"Agent":f.read()[I.roomId]??"room",y=SC(()=>({prefs:d.read(),itemName:b,groupName:x})),A=I=>{if(I.activatorEvent instanceof KeyboardEvent&&I.activatorEvent.target instanceof Node){const v=I.activatorEvent.target.ownerDocument;v!==null&&NC(v)}c(En(I.active.data.current))},S=I=>{var D;c(null);const v=hu(En(I.active.data.current));if(v===null)return;const E=fu(En((D=I.over)==null?void 0:D.data.current)),R=Ko(d.read(),v,E);if(R.kind==="reject-smart-group"){ce.info("Membership is rule-based. Edit rules instead.",{description:x(R.groupId)});return}if(R.kind==="reject-computed-section"){ce.info(uu(R.section),{description:b(R.ref)});return}if(R.kind==="none"||(a(O=>vC(O,v,E,h.read())),!(I.activatorEvent instanceof KeyboardEvent)))return;const _=TC(R);_!==null&&IC(_)};return n.jsx(rf,{value:!0,children:n.jsxs(jc,{sensors:g,collisionDetection:bc,accessibility:{announcements:y},onDragStart:A,onDragEnd:S,onDragCancel:()=>c(null),children:[e,n.jsx(of,{children:i?n.jsx(DC,{data:i,itemName:b,groupName:x}):null})]})})}const MC='[aria-current="page"]';function _C(e,t,s){const r=lt(),o=u.useRef(null);u.useLayoutEffect(()=>{var l,m;if(!s)return;const a=o.current===null,i=((l=o.current)==null?void 0:l.key)??null;if(o.current={key:t},!a&&(i===t||t===null)||t===null)return;const c=(m=e.current)==null?void 0:m.querySelector(MC);if(!(c instanceof HTMLElement))return;const d=!a&&r!==!0;c.scrollIntoView({block:"nearest",behavior:d?"smooth":"auto"})},[t,e,s])}function PC(e){const t=new Map;for(const s of e)s.rows.forEach((r,o)=>{t.set(r.key,{sectionId:s.id,index:o,row:r})});return t}function LC(e,t){const s=new Set(e.map(c=>c.id)),r=new Map,o=new Map;for(const c of e)for(const d of c.rows)r.set(d.key,d),o.set(d.key,c.id);const a=new Map;for(const[c,d]of t){if(d.row.target.kind==="command"||o.get(c)===d.sectionId||!s.has(d.sectionId))continue;const l=a.get(d.sectionId)??[];l.push({index:d.index,row:r.get(c)??d.row}),a.set(d.sectionId,l)}const i=new Set([...a.values()].flat().map(c=>c.row.key));return i.size===0?e:e.map(c=>{const d=a.get(c.id)??[],l=c.rows.filter(f=>!i.has(f.key));if(d.length===0&&l.length===c.rows.length)return c;const m=[...l];for(const f of[...d].sort((p,h)=>p.index-h.index))m.splice(Math.min(f.index,m.length),0,f.row);return{...c,rows:m}})}function FC(){const[e,t]=u.useState(!1),[s,r]=u.useState(!1),o=u.useCallback(()=>t(!0),[]),a=u.useCallback(()=>t(!1),[]),i=u.useCallback(()=>r(!0),[]),c=u.useCallback(d=>{const l=d.relatedTarget;(l===null||!d.currentTarget.contains(l))&&r(!1)},[]);return{inside:e||s,handlers:{onPointerEnter:o,onPointerLeave:a,onFocus:i,onBlur:c}}}function $C(e,t,s){const[r,o]=u.useState(null);!t&&r!==null&&o(null),t&&(r===null||r.key!==s)&&o({held:PC(e),key:s});const a=t?(r==null?void 0:r.held)??null:null;return u.useMemo(()=>a===null?e:LC(e,a),[e,a])}const BC=[2,3,3],mi=["w-14","w-10","w-16"];function zC(){return n.jsx("div",{className:"flex flex-col gap-1","data-testid":"sidebar-skeleton","aria-hidden":!0,children:BC.map((e,t)=>n.jsxs("div",{className:"flex flex-col",children:[n.jsx("div",{className:K("flex h-7 items-center",af),children:n.jsx(Pt,{className:K("h-2.5 rounded-sm",mi[t])})}),Array.from({length:e},(s,r)=>n.jsx(cf,{showIcon:!0},r))]},mi[t]))})}const UC=.16,KC=4,HC=.03,WC={hidden:{},shown:{transition:{staggerChildren:HC}}},GC={hidden:{opacity:0,y:KC},shown:{opacity:1,y:0}};function hi(e){return{duration:e===!0?0:UC}}function qC(){var r;const e=$s(!0),t=Bn();if(!t.community)return null;if(e.isPending)return n.jsx("p",{role:"status",className:"text-muted-foreground px-3 py-2 text-xs",children:"Loading space…"});if(e.isError)return n.jsxs("p",{role:"status",className:"text-muted-foreground px-3 py-2 text-xs",children:["Spaces could not be loaded."," ",n.jsx(L,{variant:"ghost",size:"sm",onClick:()=>void e.refetch(),children:"Retry"})]});const s=(r=e.data)==null?void 0:r.find(({ref:o})=>o===t.community);return s?s.status!=="connected"?n.jsx("p",{role:"status",className:"text-muted-foreground px-3 py-2 text-xs",children:"Reconnect this space to open its channels."}):n.jsx(YC,{connection:s}):n.jsx("p",{role:"status",className:"text-muted-foreground px-3 py-2 text-xs",children:"This space is no longer connected."})}function YC({connection:e}){var o,a,i;const t=Hc(e.access),s=lf(e.ref,t.capabilities.read,t.fingerprint),r=Bn();return n.jsxs("section",{"aria-label":e.label,className:"px-2 py-2",children:[n.jsx("h3",{className:"text-muted-foreground px-2 text-xs font-medium",children:e.label}),!t.cacheReadable&&n.jsx("p",{role:"status",className:"text-muted-foreground px-2 py-1 text-xs",children:e.status==="reconnect-required"?"Reconnect to view channels.":"Channels aren’t available."}),t.cacheReadable&&!t.verified&&n.jsx("p",{role:"status",className:"text-muted-foreground px-2 py-1 text-xs",children:"Saved channels"}),t.verified&&s.isPending&&n.jsx("p",{role:"status",className:"text-muted-foreground px-2 py-1 text-xs",children:"Loading channels…"}),t.verified&&s.isError&&n.jsxs("p",{role:"status",className:"text-muted-foreground px-2 py-1 text-xs",children:["Space unavailable."," ",n.jsx(L,{variant:"ghost",size:"sm",onClick:()=>void s.refetch(),children:"Retry"})]}),((o=s.data)==null?void 0:o.stale)&&n.jsx("p",{className:"text-muted-foreground px-2 text-xs",children:"Saved channels · offline"}),(a=s.data)==null?void 0:a.rooms.filter(c=>!c.archived).map(c=>n.jsxs(Wc,{...je.channels(),search:{community:e.ref,id:c.roomId},"aria-current":r.community===e.ref&&r.id===c.roomId?"page":void 0,className:"hover:bg-accent aria-[current=page]:bg-accent flex min-h-9 items-center justify-between gap-2 rounded-md px-2 py-1 text-sm",children:[n.jsxs("span",{className:"truncate",children:["#",c.slug??c.title]}),c.unreadCount!==null&&c.unreadCount>0&&n.jsx("span",{className:"text-muted-foreground text-xs","aria-label":`${c.unreadCount} unread messages`,children:c.unreadCount})]},c.roomId)),((i=s.data)==null?void 0:i.rooms.length)===0&&n.jsx("p",{className:"text-muted-foreground px-2 py-1 text-xs",children:"No channels available."}),t.verified&&n.jsx(VC,{connection:e})]})}function VC({connection:e}){var o;const t=Hc(e.access),s=df(e.ref,t.capabilities.read,t.fingerprint),r=Bn();return!((o=s.data)!=null&&o.available)||s.data.dms.length===0&&!s.data.incomplete?null:n.jsxs("section",{className:"mt-2","aria-label":"Direct messages",children:[n.jsx("h4",{className:"text-muted-foreground px-2 text-xs font-medium",children:"Direct messages"}),s.data.dms.map(a=>n.jsxs(Wc,{...je.channels(),search:{community:e.ref,id:a.roomId},"aria-current":r.community===e.ref&&r.id===a.roomId?"page":void 0,className:"hover:bg-accent aria-[current=page]:bg-accent flex min-h-9 items-center justify-between gap-2 rounded-md px-2 py-1 text-sm",children:[n.jsxs("span",{className:"truncate",children:[uf(a),a.readOnly&&n.jsx("span",{className:"text-muted-foreground",children:" · read-only"})]}),!a.readOnly&&a.unreadCount>0&&n.jsx("span",{className:"text-muted-foreground text-xs","aria-label":`${a.unreadCount} unread messages`,children:a.unreadCount})]},a.roomId)),s.data.incomplete&&n.jsx("p",{role:"status",className:"text-muted-foreground px-2 py-1 text-xs",children:"Some direct messages couldn’t load."})]})}const QC=1,fi=40;function XC({onCommit:e,onCancel:t}){const[s,r]=u.useState(""),o=u.useRef(null),a=u.useRef(!1),i=mf(o);u.useEffect(()=>{var l;(l=o.current)==null||l.focus()},[]);const c=()=>{if(a.current)return;a.current=!0;const l=s.trim();if(l.length<QC||l.length>fi){t();return}e(l)},d=l=>{l.key==="Enter"?(l.preventDefault(),c()):l.key==="Escape"&&(l.preventDefault(),a.current=!0,t())};return n.jsx(hf,{children:n.jsxs("div",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5",children:[n.jsx(ff,{className:"text-muted-foreground size-3.5 shrink-0"}),n.jsx("input",{ref:o,value:s,maxLength:fi,placeholder:"Section name","aria-label":"New section name",onChange:l=>r(l.target.value),onKeyDown:d,onBlur:l=>{i.shouldHandleBlur(l)&&(a.current||t())},className:K("bg-background text-foreground placeholder:text-muted-foreground/50","focus-visible:ring-ring min-w-0 flex-1 rounded border px-1.5 py-0.5 text-xs outline-none focus-visible:ring-1")})]})})}function JC(e){return e.collapsible?e.id.startsWith("group:")||Yc(e.id)!==null:!1}function gu({model:e}){const{update:t}=Fs(),s=Ls(),{inside:r,handlers:o}=FC(),a=$C(e.sections,r,s),i=pf(),c=hs(i.destination),l=Gc(c??void 0).visible?c:null,m=Ps(),f=lt(),p=qc(),h=u.useRef(null),g=p.activeTarget===null?null:gf(p.activeTarget);_C(h,g,m.settled);const x=e.sections.filter(JC),b=u.useCallback(()=>{if(x.length===0)return;const v=x.some(E=>!E.collapsed);t(E=>{let R=E;for(const _ of x){if(_.id.startsWith("group:")){R=xf(R,_.id.slice(6),v);continue}const D=Yc(_.id);D!==null&&(R=ta(R,D,v))}return R})},[x,t]),y=e.sections.find(v=>v.id==="addons"),A=(y==null?void 0:y.collapsed)??!1,S=u.useCallback(()=>t(v=>ta(v,"addons",!A)),[A,t]),I={variants:GC,transition:hi(f)};return l?n.jsxs("div",{className:"flex min-h-0 flex-col","data-community-context":l,children:[n.jsx(qC,{}),y!==void 0&&n.jsx(na,{section:y,onToggleAll:S})]}):n.jsx("div",{ref:h,className:"flex flex-col gap-1",...o,children:n.jsx(Xe,{mode:"wait",initial:!1,children:m.phase==="cold"?n.jsx(se.div,{exit:{opacity:0},transition:hi(f),children:n.jsx(zC,{})},"skeleton"):n.jsx(se.div,{className:"flex flex-col gap-1",variants:WC,initial:m.startedWarm?!1:"hidden",animate:"shown",children:n.jsx(Vc,{id:"sidebar-sections",children:a.map(v=>n.jsxs(se.div,{...I,children:[n.jsx(na,{section:v,onToggleAll:b}),v.id==="top"&&n.jsx(ZC,{})]},v.id))})},"sections")})})}function ZC(){const e=qc();return e.groupCreation===null?null:n.jsx(bf,{children:n.jsx(XC,{onCommit:e.commitNewGroup,onCancel:e.cancelNewGroup})})}function eN(){iu();const e=du(),t=cu(e),s=Ps();return n.jsxs("nav",{"aria-label":"Sidebar","aria-busy":s.phase==="cold"?!0:void 0,className:"flex min-h-0 flex-1 flex-col",children:[n.jsx(yf,{className:"sidebar-scroll-edges px-2 py-3",children:n.jsx(Qc,{activeTarget:e.activeTarget,children:n.jsx(OC,{displayNames:e.displayNames,rooms:e.rooms,children:n.jsx(gu,{model:t})})})}),n.jsx(au,{})]})}const tN=2;function nN(){return{label:"Active now",rules:{statuses:["needs-attention","active"]}}}function sN(e){const t=new Map;for(const s of e)t.set(s.runtime,(t.get(s.runtime)??0)+1);return Array.from(t.entries()).filter(([,s])=>s>=tN).map(([s,r])=>({runtime:s,count:r,label:it(s).label})).sort((s,r)=>r.count-s.count||s.label.localeCompare(r.label)).map(({runtime:s,label:r})=>({label:`Runs on ${r}`,rules:{runtimes:[s]}}))}const pi="agent:";function rN(){const[e]=Ms(),t=uo(),{data:s}=Os(),r=u.useMemo(()=>((s==null?void 0:s.agents)??[]).map(i=>i.projectPath),[s]),{data:o}=go(r),a=u.useMemo(()=>Kc(r,o??{}),[r,o]);return u.useMemo(()=>{const i=new Set(r);let c=null,d=-1/0;for(const[m,f]of Object.entries(t)){if(!m.startsWith(pi))continue;const p=m.slice(pi.length);if(!i.has(p))continue;const h=Date.parse(f);Number.isNaN(h)||h<=d||(d=h,c=p)}const l=e!==null&&i.has(e)?e:c;return l===null?null:{path:l,displayName:a[l]??l}},[a,t,r,e])}function oN(e){u.useEffect(()=>{if(!ze())return;const t=s=>{!(s.metaKey||s.ctrlKey)||s.shiftKey||s.altKey||s.key.toLowerCase()==="n"&&(s.preventDefault(),e())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}function aN(e){const t=e.smartGroupPresets.length===0?[]:[{kind:"separator",id:"sep-smart"},...e.smartGroupPresets.map(r=>({kind:"action",id:`new-group-preset:${r.label}`,label:r.label,icon:yn,opensInput:!1,run:()=>e.onCreatePresetSmartGroup(r)})),{kind:"action",id:"new-group-custom",label:"Custom rules",icon:yn,opensInput:!0,run:e.onOpenSmartGroupDialog}],s=[t.length===0?{kind:"action",id:"new-group",label:"Section",icon:yn,opensInput:!0,run:e.onNewGroup}:{kind:"submenu",id:"new-group",label:"Section",icon:yn,items:[{kind:"action",id:"new-group-empty",label:"Empty section",icon:yn,opensInput:!0,run:e.onNewGroup},...t]}];return[{kind:"action",id:"new-session",label:"Chat",icon:Uc,opensInput:!1,...e.showSessionShortcut?{hint:Bt(sn.NEW_SESSION)}:{},run:e.onNewSession},...e.lastUsedAgentName===null?[]:[{kind:"note",id:"new-session-note",icon:xb,text:`Starts with ${e.lastUsedAgentName} (last used)`}],{kind:"separator",id:"sep-rooms"},{kind:"action",id:"new-channel",label:"Channel",icon:Jc,opensInput:!0,run:e.onNewChannel},{kind:"action",id:"new-message",label:"Group message",icon:Pl,opensInput:!0,run:e.onNewMessage},{kind:"separator",id:"sep-agents"},{kind:"action",id:"new-agent",label:"Agent",icon:Sf,opensInput:!0,run:e.onNewAgent},...s]}function iN(){const e=Fe(),t=qn(M=>M.menuOpen),s=qn(M=>M.preselect),r=qn(M=>M.setMenuOpen),o=qn(M=>M.requestNewGroup),a=Pe(),i=Fc(),c=mb(),d=Lc(),l=rN(),{update:m}=Fs(),[f,p]=u.useState(!1),[h,g]=u.useState(!1),[x,b]=u.useState(!1),{data:y}=Os(),A=u.useMemo(()=>((y==null?void 0:y.agents)??[]).map(M=>M.projectPath),[y]),{data:S}=go(A),I=u.useMemo(()=>A.map(M=>{var F,B;return{projectPath:M,runtime:((F=S==null?void 0:S[M])==null?void 0:F.runtime)??"claude-code",namespace:((B=S==null?void 0:S[M])==null?void 0:B.namespace)??null,attention:"inactive",lastActivityAt:null}}),[A,S]),v=vf(I),E=u.useMemo(()=>v?[nN(),...sN(I)]:[],[I,v]),R=u.useMemo(()=>{const M=new Map;for(const F of I)M.has(F.runtime)||M.set(F.runtime,it(F.runtime).label);return Array.from(M,([F,B])=>({value:F,label:B})).sort((F,B)=>F.label.localeCompare(B.label))},[I]),_=u.useMemo(()=>{const M=new Set;for(const F of I)F.namespace&&M.add(F.namespace);return Array.from(M).sort()},[I]),D=u.useCallback((M,F)=>m(B=>wf(B,M,F).next),[m]),O=u.useCallback(M=>{ms.getState().recordOpened("room",M.id),a({...je.channels(),search:{id:M.id}})},[a]),T=u.useCallback(()=>i(l==null?void 0:l.path),[l,i]);oN(T);const w=u.useCallback(M=>{const[F]=M;if(F!==void 0&&hb(M)){ms.getState().recordOpened("agent",F.agentPath),d({agentPath:F.agentPath});return}const B=jf(M.map(W=>W.displayName));c.mutate({agentPaths:M.map(W=>W.agentPath),title:B},{onSuccess:O})},[d,O,c]),C=aN({onNewSession:T,lastUsedAgentName:(l==null?void 0:l.displayName)??null,onNewChannel:()=>p(!0),onNewMessage:()=>g(!0),onNewAgent:()=>Cs.getState().open(),onNewGroup:()=>o(),smartGroupPresets:E,onCreatePresetSmartGroup:M=>D(M.label,M.rules),onOpenSmartGroupDialog:()=>b(!0),showSessionShortcut:ze()}),j=Xc(C),k=u.useRef(null);return u.useEffect(()=>{if(!t||s===null)return;const M=requestAnimationFrame(()=>{var F,B;(B=(F=k.current)==null?void 0:F.querySelector(`[data-menu-item-id="${s}"]`))==null||B.focus()});return()=>cancelAnimationFrame(M)},[t,s]),n.jsxs(n.Fragment,{children:[n.jsxs(As,{open:t,onOpenChange:r,children:[n.jsx(Es,{asChild:!0,children:n.jsxs("button",{type:"button","data-testid":"sidebar-new-button",className:K("bg-sidebar-accent text-sidebar-accent-foreground hover:bg-sidebar-accent/70 focus-visible:ring-sidebar-ring flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium outline-hidden transition-colors duration-150 focus-visible:ring-2",e&&K(Bs,"px-3")),children:[n.jsx(At,{className:"size-3.5"}),"New"]})}),n.jsx(Is,{ref:k,align:"end",className:"w-56",onCloseAutoFocus:j.onCloseAutoFocus,children:n.jsx(kr,{variant:"dropdown",nodes:j.nodes})})]}),f&&n.jsx(fb,{open:!0,onOpenChange:M=>!M&&p(!1),onCreated:O}),n.jsx(pb,{open:h,onOpenChange:g,onStart:w,hideTrigger:!0}),n.jsx(kf,{open:x,onOpenChange:b,mode:"create",runtimeOptions:R,namespaceOptions:_,onSubmit:({name:M,rules:F})=>D(M,F)})]})}function cN(){const e=P(s=>s.setGlobalPaletteOpen),t=Fe();return n.jsxs("button",{type:"button","data-testid":"sidebar-search-pill",onClick:()=>e(!0),className:K("bg-sidebar-accent/40 text-sidebar-foreground/60 hover:bg-sidebar-accent/70 hover:text-sidebar-foreground focus-visible:ring-sidebar-ring text-control flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 outline-hidden transition-colors duration-150 focus-visible:ring-2",t&&Bs),children:[n.jsx(ls,{className:"size-(--size-icon-sm) shrink-0"}),n.jsx("span",{className:"truncate",children:"Find a conversation…"}),n.jsx(Zc,{className:"bg-sidebar-accent text-sidebar-foreground/70 ml-auto shrink-0 border-transparent",children:Bt(sn.COMMAND_PALETTE)})]})}function lN(e){const t=[];return e.you!==null&&t.push({kind:"action",id:"you",label:e.you.name,description:"View profile",icon:no,leading:e.you.face,guardsFocus:!0,run:e.you.onOpen}),t.push({kind:"action",id:"dorkos-account",label:"DorkOS account",description:e.accountStatus,icon:Fl,guardsFocus:!0,run:e.onOpenAccount},{kind:"action",id:"settings",label:"Settings",icon:_s,guardsFocus:!0,run:e.onOpenSettings}),t}function dN(e){return e.isDevMode?[{kind:"separator",id:"sep-version"},{kind:"note",id:"version",icon:sa,text:"Development build"}]:e.version===null?[]:[{kind:"separator",id:"sep-version"},{kind:"action",id:"version",label:`v${e.version} beta`,icon:sa,opensInput:!1,hint:"Check for updates",run:e.onCheckForUpdates}]}function uN(e){const t=(e==null?void 0:e.trim())??"";return t.length===0||t===Cf?"Your team":t.endsWith("s")?`${t}’ team`:`${t}’s team`}function mN(e,t){const s=Nf(e);return u.createElement(cs,{size:t,kind:s.kind,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,fallback:s.fallback,origin:s.origin})}function xu(e="xs"){var i;const t=eo(),{open:s}=rt(),{open:r}=xo(),o=Qk(),a=((i=t.data)==null?void 0:i.members.find(c=>c.isSelf))??null;return{you:a===null?null:{name:a.displayName,face:mN(a,e),onOpen:()=>r(a.id)},accountStatus:Vk(o),onOpenAccount:()=>s("account"),onOpenSettings:()=>s()}}function hN(e=[]){var l;const t=eo(),s=ae(),r=le(),o=xu(),a=((l=t.data)==null?void 0:l.members.find(m=>m.isSelf))??null,{data:i,refetch:c}=Ie({queryKey:Be.current(),queryFn:()=>s.getConfig(),staleTime:Xi}),d=u.useCallback(async()=>{var h,g;await r.invalidateQueries({queryKey:Be.all});const m=await c(),f=(h=m.data)==null?void 0:h.version,p=((g=m.data)==null?void 0:g.latestVersion)??null;if(f===void 0){ce.error("Couldn’t check for updates");return}if(p!==null&&So(p,f)){ce.success(`Version ${p} is available`);return}ce.success("You’re up to date")},[r,c]);return{teamName:uN((a==null?void 0:a.displayName)??null),nameUnknown:t.isPending,identityNodes:lN(o),nodes:[...e,...dN({version:(i==null?void 0:i.version)??null,isDevMode:(i==null?void 0:i.isDevMode)??!1,onCheckForUpdates:()=>void d()})]}}const fN=el("/self-hosting/space-server");function pN(e){const t=[];for(const s of e)s.hostOperator===!0&&!t.includes(s.pinnedOrigin)&&t.push(s.pinnedOrigin);return t}function gN(e){var o,a,i;const t=e.status!=="pending"&&((o=e.access)==null?void 0:o.state)!=="unverified",s=((i=(a=e.access)==null?void 0:a.lastKnown)==null?void 0:i.lifecycle)??null,r=e.status==="connected";return{hostReachable:t,canInvite:t&&r&&s==="active",canOpenSettings:t,canLeave:t&&r}}function Xn(e){try{return new URL(e).host}catch{return e}}function xN(e){const t=[],s=e.selected;if(s){const{connection:i,availability:c}=s,d=[],l={host:Xn(i.pinnedOrigin)};c.canInvite&&d.push({kind:"action",id:"community-invite",label:"Invite people",icon:Ef,external:l,run:e.onInvite}),c.canOpenSettings&&d.push({kind:"action",id:"community-settings",label:"Space settings",icon:_s,external:l,run:e.onOpenSettings}),s.canMoveUp&&d.push({kind:"action",id:"community-move-up",label:"Move up",icon:If,run:()=>e.onMove("up")}),s.canMoveDown&&d.push({kind:"action",id:"community-move-down",label:"Move down",icon:Rf,run:()=>e.onMove("down")}),d.push({kind:"separator",id:"community-sep-end"}),d.push({kind:"action",id:"community-disconnect",label:"Disconnect",icon:jb,opensInput:!0,destructive:!0,run:e.onDisconnect}),c.canLeave&&d.push({kind:"action",id:"community-leave",label:"Leave space",icon:Tf,opensInput:!0,external:l,run:e.onLeave}),t.push({kind:"submenu",id:"community-actions",label:`Manage ${i.label}`,icon:Ar,items:d})}e.onJoinOfficial&&t.push({kind:"action",id:"join-official-space",label:"Join the DorkOS community",icon:Sr,opensInput:!0,run:e.onJoinOfficial});const r=e.onJoin;if(!r)return t;const o=[...e.creationOrigins.map(i=>({kind:"action",id:e.creationOrigins.length===1?"add-community-create":`add-community-create-${Xn(i)}`,label:e.creationOrigins.length===1?"Create a space on your server":`Create a space on ${Xn(i)}`,icon:Cy,opensInput:!0,external:{host:Xn(i)},run:()=>e.onCreate(i)})),{kind:"action",id:"add-community-deploy",label:"Run your own space server",icon:Af,run:e.onDeploy}],a=[];return e.hosting&&a.push({kind:"action",id:"add-community-start",label:"Start a space",icon:bo,opensInput:!0,run:e.hosting.onStart}),a.push({kind:"action",id:"add-community-join",label:"Join a space",icon:Sr,opensInput:!0,run:r}),e.hosting&&a.push({kind:"action",id:"add-community-yours",label:"Your spaces",icon:jy,guardsFocus:!0,run:e.hosting.onOpenYourSpaces}),a.push({kind:"separator",id:"add-community-sep-advanced"},{kind:"submenu",id:"add-community-advanced",label:"Advanced",icon:Ll,items:o}),t.push({kind:"submenu",id:"add-community",label:"Add a space",icon:At,items:a}),t}function bu(e){var s,r,o,a,i,c;const t=(r=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:r.lifecycle;return{kind:"community",key:`community:${e.ref}`,ref:e.ref,remoteCommunityId:e.remoteCommunityId,label:e.label,icon:{kind:"community",ref:e.ref},pinnedOrigin:e.pinnedOrigin,membershipState:t==="deletion_pending"?"deletion-pending":t==="taken_down"?"taken-down":t??(e.status==="pending"?"pending":"active"),connectionState:e.status,availability:((o=e.access)==null?void 0:o.state)==="verified"?"online":((a=e.access)==null?void 0:a.state)==="unverified"?"offline":"unknown",unreadCount:((i=e.attention)==null?void 0:i.unreadCount)??null,mentionCount:((c=e.attention)==null?void 0:c.mentionCount)??null}}function bN(e){var r,o;if(e.status==="reconnect-required")return"Reconnect required";const t=(o=(r=e.access)==null?void 0:r.lastKnown)==null?void 0:o.lifecycle;if(e.seemsGoneSince&&t!=="deleted"&&t!=="taken_down")return"Seems to be gone";const s=bu(e);if(s.membershipState!=="active")return s.membershipState.replace("-"," ");if(s.availability!=="online")return s.availability}function yN(e,t){const s=new Map(t.map((r,o)=>[r,o]));return[...e].sort((r,o)=>{const a=s.get(r.ref)??Number.MAX_SAFE_INTEGER,i=s.get(o.ref)??Number.MAX_SAFE_INTEGER;return a-i||r.label.localeCompare(o.label)||r.ref.localeCompare(o.ref)})}function vN(e){return e.charAt(0).toLowerCase()+e.slice(1)}function wN(e,t){const s=Df(),r=Gc(e),o=wl();return{spaces:s.enabled,anySpace:s.anySpace,selectedRef:r.visible?e:void 0,visible:(t??[]).filter(a=>Of(a,s.enabled)),joinOfficial:o.link!==null&&!o.joined?o.join:null}}function jN(e){const t=ra(r=>r.url),s=ra(r=>r.take);u.useEffect(()=>{if(t===null)return;const r=s();r!==null&&e(r)},[t,s])}function kN({connection:e,onOpenChange:t,onDisconnected:s}){var p;const r=tl(),o=fd(e),[a,i]=u.useState(e);e!==null&&e!==a&&i(e);const c=(a==null?void 0:a.label)??"this space",d=(a==null?void 0:a.status)==="pending"?[]:(p=o.data)==null?void 0:p.agents,l=d===void 0&&o.fetchStatus==="fetching",m=d?gd(c,d):l?null:xd(c);function f(){e&&r.mutate(e,{onSuccess:h=>{t(!1);const g=bd(e.label,h);g.tone==="success"?ce.success(g.message):ce.warning(g.message,{duration:15e3}),s(e)}})}return n.jsx(Mf,{open:e!==null,onOpenChange:h=>{h||r.reset(),t(h)},children:n.jsxs(_f,{children:[n.jsxs(Pf,{children:[n.jsxs(Lf,{children:["Disconnect this DorkOS from ",c,"?"]}),n.jsx(Ff,{asChild:!0,children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{children:["Its channels leave this app. You stay a member of ",c,"."]}),n.jsx("p",{children:"You can connect again later."}),m&&n.jsx("p",{className:"text-foreground",children:m}),l&&n.jsx("p",{children:"Checking for agents you added from here…"})]})})]}),o.isError&&d===void 0&&!l&&n.jsxs("div",{role:"alert",className:"flex flex-col items-start gap-2 text-sm sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[n.jsxs("p",{className:"text-destructive",children:["Couldn’t check which of your agents are on ",c,"."]}),n.jsx(L,{size:"sm",variant:"outline",onClick:()=>void o.refetch(),children:"Check again"})]}),r.isError&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t disconnect. Check DorkOS is running and try again."}),n.jsxs($f,{children:[n.jsx(Bf,{disabled:r.isPending,children:"Keep connected"}),n.jsx(L,{variant:"destructive",disabled:r.isPending||l,onClick:f,children:r.isPending?"Disconnecting…":"Disconnect"})]})]})})}function SN(e,t){var r;const s=typeof e=="object"&&e!==null?e:{};switch(s.code){case"COMMUNITY_SELECTION_REQUIRED":return`That address has several spaces. Use one space’s own link, like ${NN(t)}.`;case"COMMUNITY_NAME_NOT_FOUND":return"No space uses that address. Check the spelling, or ask for its full link.";case"COMMUNITY_RATE_LIMITED":return`Too many tries. Your address may be fine. Wait ${zf((r=s.body)==null?void 0:r.retryAfterSeconds)}, then try again.`;case"COMMUNITY_UPGRADE_REQUIRED":return"This space’s server is too old for this DorkOS. Ask its owner to update it.";default:return"Couldn’t connect. Check the space’s address and try again."}}function CN(e){const t=typeof e=="object"&&e!==null?e.code:"";return t!=="COMMUNITY_RATE_LIMITED"&&t!=="COMMUNITY_UPGRADE_REQUIRED"}function NN(e){try{return`${new URL(e??"").origin}/your-space`}catch{return"https://example.com/acme"}}const AN="That invitation link is incomplete or isn’t secure. Copy the whole link again.";function EN(e){let t;try{t=new URL(e.trim())}catch{return!1}return/^\/(?:c\/[^/]+\/)?join\/?$/u.test(t.pathname)&&!Cr(e)}function IN(e){const t=new URL(e.trim()),s=/^(\/c\/[^/]+)\/join\/?$/u.exec(t.pathname);return s?`${t.origin}${s[1]}`:t.origin}function RN({request:e,onOpenChange:t,installName:s,onConnected:r}){var F;const o=Ln(!0),a=$s(!0),i=Uf(o),c=e!==null,d=qs(B=>B.links),l=qs(B=>B.rememberLink),m=qs(B=>B.ending),f=(o==null?void 0:o.ownerKey)??null,[p,h]=u.useState(null),g=B=>h(B===null?null:{owner:f,ref:B}),[x,b]=u.useState(null),[y,A]=u.useState(null),[S,I]=u.useState((m==null?void 0:m.id)??0),[v,E]=u.useState(null),[R,_]=u.useState(null);e!==R&&(_(e),e&&(g(e.ref),b(null))),p!==null&&f!==null&&p.owner!==f&&(p.owner===null?h({owner:f,ref:p.ref}):(h(null),b(null),E(null)));const D=p!==null&&p.owner===f?p.ref:null,O=D===null||(F=a.data)==null?void 0:F.find(B=>B.ref===D),T=!O&&y!==null&&!y.settled&&y.address===i&&y.connection.ref===D?y.connection:null,w=O??T;if(w&&f!==null&&((v==null?void 0:v.owner)!==f||v.ref!==w.ref||v.label!==w.label)&&E({owner:f,ref:w.ref,label:w.label}),m&&m.id!==S)I(m.id),m.ref===D&&m.outcome!=="connected"&&(g(null),b({address:i,value:m.outcome==="expired"?`Approval for ${m.label} expired. Connect again to continue.`:`Approval for ${m.label} was cancelled.`}));else if(c&&D!==null&&!w&&a.isSuccess){const B=(v==null?void 0:v.owner)===f&&v.ref===D?v.label:"this space";g(null),b({address:i,value:`Approval for ${B} ended somewhere else. Connect again to continue.`})}Kf(c&&(w==null?void 0:w.status)==="pending"?w.ref:null);const C=Hf((w==null?void 0:w.status)==="pending"?w:null),j=c&&(w==null?void 0:w.status)==="connected"?w.ref:null,k=u.useRef(r),M=u.useRef(t);return u.useEffect(()=>{k.current=r,M.current=t}),u.useEffect(()=>{j===null||!w||(ce.success(`${w.label} is connected.`,{id:`community-approval-${j}`}),M.current(!1),k.current(j))},[j]),n.jsx(xt,{open:c,onOpenChange:t,children:n.jsx(bt,{className:"!min-h-0 sm:max-w-md",children:n.jsx(TN,{authority:o,connection:w,check:C,approvalUrl:w&&(d==null?void 0:d.address)===i?d.urls[w.ref]:void 0,notice:(x==null?void 0:x.address)===i?x.value:"",installName:s,initialUrl:R==null?void 0:R.url,onStarted:B=>{l(i,B.connection.ref,B.approvalUrl),A({address:i,connection:B.connection,settled:!1}),g(B.connection.ref),b({address:i,value:`Next, approve this DorkOS on ${B.connection.label}.`})},onStartSettled:B=>A(W=>(W==null?void 0:W.connection.ref)===B?{...W,settled:!0}:W),onEnded:B=>{g(null),b({address:i,value:B})},onCancelled:B=>{t(!1),ce.success(`Approval for ${B} was cancelled.`)},onClose:()=>t(!1)})})})}function TN({authority:e,connection:t,check:s,approvalUrl:r,notice:o,installName:a,initialUrl:i,onStarted:c,onStartSettled:d,onEnded:l,onCancelled:m,onClose:f}){const p=ae(),h=le(),g=Ec(),x=u.useId(),[b,y]=u.useState(i??""),[A,S]=u.useState(null),[I,v]=u.useState(!1),[E,R]=u.useState(a),_=u.useRef(null),D=u.useRef(null),O=t===null?"form":t.status,T=u.useRef(O);u.useEffect(()=>{var Y,te;const z=T.current;T.current=O,z!==O&&(O==="form"?(Y=_.current)==null||Y.focus():O==="pending"&&((te=D.current)==null||te.focus()))},[O]);const w=Wt({mutationFn:async z=>{if(!e||!Ot(e))throw new Error("Community owner is still loading.");const Y=await p.startCommunityConnection({url:z,installName:E.trim()});if(!Ot(e))throw new Error("Community owner changed.");return Y},onSuccess:async z=>{y(""),c(z),e&&await h.invalidateQueries({queryKey:jt.connections(e)}),d(z.connection.ref)}}),C=tl(),j=fd((t==null?void 0:t.status)==="reconnect-required"?t:null),k=w.error;u.useEffect(()=>{var z;(k||I)&&((z=_.current)==null||z.focus())},[k,I]);const M=Cr(b),F=I?AN:w.error?SN(w.error,w.variables):null;function B(z){if(z.preventDefault(),!(!b.trim()||w.isPending)){if(EN(b)){w.reset(),v(!0);return}if(Cr(b)){if(!Ct(g.linkFor(b.trim())))return;y(IN(b)),S({host:new URL(b.trim()).host,withAccount:g.signsInWithAccount(b)}),w.reset();return}E.trim()&&w.mutate(b.trim())}}function W(z){C.mutate(z,{onSuccess:Y=>{if(z.status==="pending")m(z.label);else{const te=bd(z.label,Y);l(te.tone==="success"?`${z.label} is disconnected. Connect again to continue.`:te.message)}},onSettled:()=>{e&&h.invalidateQueries({queryKey:jt.connections(e)})}})}const ne=n.jsx("p",{role:"status","aria-live":"polite",className:o?"text-muted-foreground text-sm":"sr-only",children:o});if(t===null)return n.jsxs("form",{onSubmit:B,children:[n.jsxs(ht,{children:[n.jsx(tt,{children:"Join a space"}),n.jsx(ft,{children:"Bring a space’s channels here. You approve it on the space’s site."})]}),n.jsxs(St,{className:"space-y-4 py-4",children:[ne,n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{htmlFor:`${x}-url`,children:"Space address or invitation link"}),n.jsx(gt,{ref:_,id:`${x}-url`,type:"url",inputMode:"url",placeholder:"https://example.com/acme","aria-describedby":F?`${x}-url-hint ${x}-url-error`:`${x}-url-hint`,"aria-invalid":I||w.error&&CN(w.error)?!0:void 0,required:!0,autoComplete:"off",value:b,onChange:z=>{y(z.target.value),S(null),v(!1)},disabled:w.isPending||!e}),n.jsx("p",{id:`${x}-url-hint`,"aria-live":"polite",className:"text-muted-foreground text-xs",children:A?A.withAccount?`Join on ${A.host} with your DorkOS account in the new tab, then connect.`:`Finish joining on ${A.host} in the new tab, then connect.`:"Its link, short address or an invitation link."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{htmlFor:`${x}-name`,children:"Name for this installation"}),n.jsx(gt,{id:`${x}-name`,required:!0,maxLength:120,"aria-describedby":`${x}-name-hint`,value:E,onChange:z=>R(z.target.value),disabled:w.isPending||!e}),n.jsx("p",{id:`${x}-name-hint`,className:"text-muted-foreground text-xs",children:"What the space calls this DorkOS."})]}),F&&n.jsx("p",{id:`${x}-url-error`,role:"alert",className:"text-destructive text-sm",children:F})]}),n.jsxs(tn,{children:[n.jsx(L,{type:"button",variant:"outline",onClick:f,children:"Cancel"}),n.jsx(L,{type:"submit",disabled:w.isPending||!b.trim()||!M&&(!e||!E.trim()),children:w.isPending?"Connecting…":M?"Open invitation":"Connect"})]})]});const fe=n.jsx("p",{className:"text-muted-foreground text-xs break-all",children:t.pinnedOrigin});if(t.status==="reconnect-required"){const z=!j.data&&j.fetchStatus==="fetching",Y=j.data?gd(t.label,j.data.agents):z?null:xd(t.label);return n.jsxs(n.Fragment,{children:[n.jsxs(ht,{children:[n.jsxs(tt,{children:["Reconnect ",t.label]}),n.jsxs(ft,{children:["DorkOS can’t reach ",t.label,"’s channels. Disconnect, then connect again."]})]}),n.jsxs(St,{className:"space-y-3 py-4",children:[fe,Y&&n.jsx("p",{className:"text-sm",children:Y}),j.isError&&!j.data&&!z&&n.jsxs("div",{role:"alert",className:"flex flex-col items-start gap-2 text-sm sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[n.jsxs("p",{className:"text-destructive",children:["Couldn’t check which of your agents are on ",t.label,"."]}),n.jsx(L,{size:"sm",variant:"outline",onClick:()=>void j.refetch(),children:"Check again"})]}),C.isError&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t disconnect. Check DorkOS is running and try again."})]}),n.jsxs(tn,{children:[n.jsx(L,{type:"button",variant:"outline",onClick:f,children:"Close"}),n.jsx(L,{disabled:C.isPending||z,onClick:()=>W(t),children:C.isPending?"Disconnecting…":"Disconnect"})]})]})}return n.jsxs(n.Fragment,{children:[n.jsxs(ht,{children:[n.jsxs(tt,{children:["Approve on ",t.label]}),n.jsx(ft,{asChild:!0,children:n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{children:["Approve this DorkOS on ",t.label,"’s site."]}),r&&g.signsInWithAccount(r)&&n.jsx("p",{children:"Sign in there with your DorkOS account."}),n.jsx("p",{children:"This screen moves on once you do."})]})})]}),n.jsxs(St,{className:"space-y-3 py-4",children:[fe,ne,n.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[n.jsx(De,{})," Waiting for your approval"]}),r?n.jsx(L,{asChild:!0,children:n.jsxs("a",{ref:D,href:g.linkFor(r),target:"_blank",rel:"noopener noreferrer",children:["Open ",t.label," to approve",n.jsx(nn,{className:"size-3.5","aria-hidden":!0})]})}):n.jsx("p",{className:"text-muted-foreground text-sm",children:"Approve in the tab that opened. Closed it? Cancel and connect again."}),(C.isError||!!s.error)&&n.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[n.jsx("p",{children:C.isError?"Couldn’t confirm it was cancelled. Refresh to check.":"Couldn’t check approval. Try again."}),!C.isError&&n.jsx(L,{size:"sm",variant:"outline",onClick:s.retry,disabled:s.isFetching,children:"Check approval"})]})]}),n.jsxs(tn,{children:[n.jsx(L,{type:"button",variant:"outline",onClick:f,children:"Close"}),n.jsx(L,{variant:"outline",disabled:C.isPending,onClick:()=>W(t),children:C.isPending?"Cancelling…":"Cancel approval"})]})]})}function DN(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;const t=[...e.currentTarget.querySelectorAll('[role^="menuitem"]:not(:disabled):not([aria-disabled="true"])')];if(t.length===0)return;e.preventDefault();const s=t.indexOf(document.activeElement),r=t.length-1;let o;e.key==="Home"?o=0:e.key==="End"?o=r:e.key==="ArrowDown"?o=s<0||s===r?0:s+1:o=s<=0?r:s-1,t[o].focus()}function gi({sheet:e,label:t="Actions",children:s}){return e?n.jsx("div",{role:"menu","aria-label":t,tabIndex:-1,onKeyDown:DN,children:s}):n.jsx(n.Fragment,{children:s})}function lr(){let e=!1;const t=()=>{e=!0};return document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",t,!0),{acted:()=>e,stop:()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",t,!0)}}}function ON({trigger:e,selectedRef:t}){const s=ae(),r=Fe(),o=Pe(),a=_e({select:h=>h.location}),i=u.useRef(!1),c=u.useRef(!1),[d,l]=u.useState(null);function m(h,g){var b;if(!r||(h||(c.current=!1),g))return;if(h){const y=lr();Gf({cancelled:y.acted}).finally(y.stop);return}const x=document.activeElement;(x===null||x===document.body)&&((b=e.current)==null||b.focus())}async function f(h){if(h.ref===t||i.current||h.status!=="connected")return;const g=oa();if(g.ownerKey===null)return;const x={epoch:g.epoch,ownerKey:g.ownerKey},b={pathname:a.pathname,search:a.search};c.current=r;const y=lr();i.current=!0,l(h.ref);let A=!1,S=null;try{await o({...je.channels(),search:{community:h.ref}}),A=!0,S=On();const I=await s.resolveCommunityNavigation(h.ref),v=I?null:(await s.listRemoteCommunityRooms(h.ref)).rooms.find(R=>R.readable&&!R.archived)??null,E=(I==null?void 0:I.roomId)??(v==null?void 0:v.roomId);if(!Ot(x)||!S.isCurrent()){m(!1,y.acted());return}E&&await o({...je.channels(),search:{community:h.ref,...E?{id:E}:{},...I!=null&&I.threadId?{thread:I.threadId}:{}}}),m(!0,y.acted())}catch{m(!1,y.acted()),A&&(S==null?void 0:S.isCurrent())===!0&&Ot(x)&&await o({to:b.pathname,search:b.search,replace:!0}).then(()=>!0,()=>!1)&&ce.error(`Couldn’t open ${h.label}.`,{description:"You’re still where you were. Try again in a moment."})}finally{y.stop(),i.current=!1,l(null)}}async function p(){if(t===void 0||i.current)return;const h=oa();if(h.ownerKey===null)return;const g={epoch:h.epoch,ownerKey:h.ownerKey},x=On();c.current=r;const b=lr();i.current=!0;try{const y=await s.getCommunityNavigation();if(y.ownerKey!==g.ownerKey||!Ot(g)||!x.isCurrent()){m(!1,b.acted());return}const A=Wf.safeParse(y.installationDestination);await o(A.success?{to:A.data.path,search:A.data.search}:{...je.home()}),m(!0,b.acted())}catch{const y=Ot(g)&&x.isCurrent();y&&await o({...je.home()}),m(y,b.acted())}finally{b.stop(),i.current=!1}}return{pendingRef:d,isSelecting:()=>i.current,holdCloseFocus:()=>{c.current=!0},takeCloseFocusHold:()=>{const h=c.current;return c.current=!1,h},selectCommunity:f,selectInstallation:p}}function MN(e){const t=u.useRef(e);u.useEffect(()=>{t.current=e},[e]),u.useEffect(()=>{const s=r=>{if(r.isComposing||!(r.metaKey||r.ctrlKey)||!r.shiftKey||r.altKey||r.key.toLowerCase()!=="k")return;r.preventDefault();const o=document.activeElement;t.current(o instanceof HTMLElement&&o!==document.body?o:null)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[])}function yu({triggerClassName:e,compact:t=!1}){var Oe;const s=Fe(),r=Pe(),o=_e({select:U=>U.location.search.community}),a=qf(),i=Yf(),c=$s(),{spaces:d,anySpace:l,selectedRef:m,visible:f,joinOfficial:p}=wN(o,c.data),h=u.useMemo(()=>{var U;return yN(f,((U=a.data)==null?void 0:U.order)??[])},[f,(Oe=a.data)==null?void 0:Oe.order]),g=h.find(U=>U.ref===m)??null,x=u.useRef(null),b=u.useRef(null),y=u.useRef(null),{pendingRef:A,isSelecting:S,holdCloseFocus:I,takeCloseFocusHold:v,selectCommunity:E,selectInstallation:R}=ON({trigger:y,selectedRef:m}),[_,D]=u.useState(""),[O,T]=u.useState(!1),[w,C]=u.useState(null),[j,k]=u.useState(null),M=Sk(),[F,B]=u.useState(null),W=m?h.findIndex(U=>U.ref===m):-1;function ne(U,ue){Ct(new URL(ep(U.remoteCommunityId,ue),U.pinnedOrigin).toString())}const fe=xN({selected:g?{connection:g,availability:gN(g),canMoveUp:W>0,canMoveDown:W>=0&&W<h.length-1}:null,onMove:U=>{g&&i.mutate({ref:g.ref,direction:U})},onInvite:()=>g&&ne(g,"community"),onOpenSettings:()=>g&&ne(g),onLeave:()=>g&&ne(g,"account"),onDisconnect:()=>k(g),onJoin:d?()=>C({ref:null}):null,onJoinOfficial:p,creationOrigins:d?pN(h):[],onCreate:U=>Ct(new URL(Zf,U).toString()),onDeploy:()=>Ct(fN),hosting:d&&M?{onStart:()=>B({kind:"start"}),onOpenYourSpaces:()=>B({kind:"hosted"})}:null}),z=l?fe:[];jN(U=>C({ref:null,url:U}));const Y=hN(z),te=Xc([...Y.identityNodes,...Y.nodes]),de=te.nodes.slice(0,Y.identityNodes.length),Q=te.nodes.slice(Y.identityNodes.length),q=Le().data,re=(q==null?void 0:q.serverRole)==="hub",pe=re?"Private":Y.teamName,Z=q===void 0||!re&&Y.nameUnknown,G=re?fs:Iy,xe=Y.nameUnknown?"My DorkOS":Y.teamName,Se=m!==void 0&&c.data===void 0,Je=m===void 0?Z:Se,ee=m===void 0?pe:(g==null?void 0:g.label)??"Space",Ne=s&&h.length>=8&&_.trim().length>0?h.filter(U=>U.label.toLocaleLowerCase().includes(_.trim().toLocaleLowerCase())):h;MN(U=>{b.current=U,T(!0)});function ot(U){if(S())return;if(b.current=null,U==="installation"){R();return}const ue=h.find(ke=>`community:${ke.ref}`===U);if(ue){if(ue.status==="connected"){E(ue);return}I(),C({ref:ue.ref})}}function dt(U){T(U),U||D("")}function Ae(U){if(te.onCloseAutoFocus(U),v()){U.preventDefault();return}const ue=b.current;b.current=null,!(U.defaultPrevented||!(ue!=null&&ue.isConnected))&&(U.preventDefault(),ue.focus())}u.useEffect(()=>{if(!O)return;const U=requestAnimationFrame(()=>{var ue;return(ue=x.current)==null?void 0:ue.focus()});return()=>cancelAnimationFrame(U)},[O]);async function be(U){var Me;const ke=(Me=(await c.refetch()).data)==null?void 0:Me.find(qe=>qe.ref===U&&qe.status==="connected");ke&&await E(ke)}function yt(U){hs(On().destination)===U.ref&&r({...je.home(),replace:!0})}return n.jsxs(n.Fragment,{children:[n.jsxs(Vf,{open:O,onOpenChange:dt,children:[n.jsx(Qf,{asChild:!0,children:n.jsxs("button",{ref:y,type:"button","data-testid":"sidebar-header-block","aria-label":Je?"Context menu":`${ee} menu`,"aria-busy":A!==null||void 0,title:re&&m===void 0?"Just you and your agents":void 0,className:e,children:[t?m===void 0?n.jsx(G,{className:"size-4 shrink-0","aria-hidden":!0}):n.jsx(Ar,{className:"size-4 shrink-0","aria-hidden":!0}):Je?n.jsx(Pt,{className:"my-[3px] h-3.5 w-24 rounded-sm","data-testid":"sidebar-team-name-skeleton"}):n.jsxs(n.Fragment,{children:[re&&m===void 0&&n.jsx(fs,{className:"size-3.5 shrink-0","aria-hidden":!0}),n.jsx("span",{className:"truncate",children:ee})]}),n.jsx(qt,{className:t?"size-3 shrink-0 opacity-50":"size-3.5 shrink-0 opacity-50","aria-hidden":!0}),n.jsx("span",{className:"sr-only",children:"Choose context"})]})}),n.jsxs(Xf,{align:"start",className:"max-h-(--radix-dropdown-menu-content-available-height) w-64 overflow-y-auto",onCloseAutoFocus:Ae,children:[s&&n.jsx(aa,{children:l?"Switch context":"Menu"}),n.jsx(gi,{sheet:s,label:"You",children:n.jsx(kr,{variant:s?"sheet":"dropdown",nodes:de,onSheetClose:()=>dt(!1)})}),l&&n.jsx(ia,{}),l&&!s&&n.jsx(aa,{children:"Switch context"}),l&&s&&h.length>=8&&n.jsx("div",{className:"px-4 pb-2",children:n.jsx(gt,{type:"search",value:_,onChange:U=>D(U.target.value),placeholder:"Find a space","aria-label":"Find a space"})}),l&&n.jsxs(Jf,{value:m?`community:${m}`:"installation",onValueChange:ot,children:[n.jsx(ca,{value:"installation",icon:G,disabled:A!==null,itemRef:m===void 0?x:void 0,className:A!==null?"opacity-50":void 0,children:n.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[pe,re&&n.jsx("span",{className:"text-muted-foreground block truncate text-xs",children:"Just you and your agents"})]})}),Ne.map(U=>{var Ee;const ue=bu(U),ke=ue.mentionCount??0,Me=Math.max(0,(ue.unreadCount??0)-ke),qe=[ke>0?`${ke} ${ke===1?"mention":"mentions"}`:null,Me>0?`${Me} other unread`:null,((Ee=U.attention)==null?void 0:Ee.state)==="stale"?`last checked ${vN(zn(U.attention.verifiedAt))}`:null].filter(Boolean).join(", ");return n.jsx(ca,{value:`community:${U.ref}`,icon:Ar,disabled:A!==null,itemRef:U.ref===m?x:void 0,description:[bN(U),qe].filter(Boolean).join(" · ")||void 0,className:A!==null?"opacity-50":void 0,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[n.jsx("span",{className:"min-w-0 truncate",children:U.label}),vb(U)&&n.jsx("span",{role:"img",className:"bg-status-warning-dot size-2 shrink-0 rounded-full","aria-label":"Someone asked to take over this space",title:"Someone asked to take over this space"}),ke>0&&n.jsxs("span",{className:"bg-primary text-primary-foreground shrink-0 rounded-full px-1.5 text-xs","aria-label":`${ke} ${ke===1?"mention":"mentions"}`,children:["@",ke]}),Me>0&&n.jsx("span",{className:"bg-muted text-muted-foreground shrink-0 rounded-full px-1.5 text-xs","aria-label":`${Me} other unread`,children:Me})]})},U.ref)})]}),Q.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(ia,{}),n.jsx(gi,{sheet:s,children:n.jsx(kr,{variant:s?"sheet":"dropdown",nodes:Q,onSheetClose:()=>dt(!1)})})]})]})]}),n.jsx(RN,{request:w,onOpenChange:U=>{U||C(null)},installName:xe,onConnected:U=>void be(U)}),n.jsx(Gk,{entry:M,dialog:F,onDialogChange:B,installName:xe,onConnected:U=>void be(U)}),n.jsx(kN,{connection:j,onOpenChange:U=>{U||k(null)},onDisconnected:yt})]})}function _N(){return n.jsx(yu,{compact:!0,triggerClassName:K("hover:bg-accent focus-visible:ring-ring text-foreground flex shrink-0 items-center rounded-md px-1 py-1.5 outline-hidden focus-visible:ring-2",Bs)})}function vu(){const e=Fe();return n.jsxs(tp,{className:"gap-2 px-2 py-3",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[!e&&n.jsx(yu,{triggerClassName:"text-sidebar-foreground hover:bg-sidebar-accent/70 focus-visible:ring-sidebar-ring flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 py-1 text-left text-control font-semibold outline-hidden transition-colors duration-150 focus-visible:ring-2"}),n.jsx(iN,{})]}),n.jsx(cN,{})]})}function PN(){const e=xu("sm");return n.jsxs("div",{className:"space-y-1 pb-2",children:[e.you!==null&&n.jsx(xi,{leading:e.you.face,label:e.you.name,description:"View profile",onClick:e.you.onOpen}),n.jsx(xi,{leading:n.jsx(Fl,{className:"text-muted-foreground size-7 p-0.5","aria-hidden":!0}),label:"DorkOS account",description:e.accountStatus,onClick:e.onOpenAccount})]})}function xi({leading:e,label:t,description:s,onClick:r}){return n.jsxs("button",{type:"button",onClick:r,className:K("hover:bg-accent focus-visible:ring-ring flex w-full items-center gap-3 rounded-md px-2 py-2 text-left outline-hidden focus-visible:ring-2",Bs),children:[n.jsx("span",{className:"flex shrink-0",children:e}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"text-foreground block truncate text-sm font-medium",children:t}),s!==void 0&&n.jsx("span",{className:"text-muted-foreground block truncate text-xs",children:s})]}),n.jsx(hn,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0})]})}const LN=6e4;function FN(e){return e===null?!0:(e.selectionStart??0)===0&&(e.selectionEnd??0)===0}function $N(e,t,s){if(!e)return null;const r=t===null?s:[t,...s];for(const o of r){const{item:a}=o.item;if(a.type==="agent"&&$e(a.data)===e)return{kind:"agent",agent:a.data};if((a.type==="room"||a.type==="dm")&&a.id===e)return{kind:"room",room:a.data}}return null}function BN(){const{globalPaletteOpen:e,setGlobalPaletteOpen:t}=y0(),s=P($=>$.openMessageSearch),[r,o]=u.useState(""),a=u.useRef(null),[i,c]=u.useState(""),d=u.useRef(null),[l,m]=u.useState([]),[f,p]=u.useState(null),[h,g]=u.useState(null),[x,b]=u.useState(null),y=l[l.length-1],[A,S]=u.useState(0),I=Fe(),v=P($=>$.globalPaletteInitialSearch),E=P($=>$.clearGlobalPaletteInitialSearch),R=u.useCallback(()=>{t(!1),E(),o(""),c(""),m([]),p(null),b(null)},[t,E]),{handleAgentSelect:_,startNewSession:D,handleFeatureAction:O,handleQuickAction:T,handleRoomSelect:w,handleSessionSelect:C,handleCommandSelect:j,handlePageSelect:k,recordAgentOpened:M,selectedCwd:F}=AS(R),B=le(),W=u.useCallback($=>{const ye=np(B,$.projectPath);return sp(ye?{session:ye}:{agentId:$.id})},[B]),ne=u.useCallback($=>{if(!rp()){_($);return}Rn(W($),{target:"tab"}),M($.projectPath),R()},[W,_,M,R]),fe=u.useCallback($=>{Rn(W($),{target:"window"}),M($.projectPath),R()},[W,M,R]),z=op(),Y=SS(),te=po(LN),{allAgents:de,newActions:Q,rooms:q,sessions:re,continueRows:pe,recent:Z,searchableItems:G}=b0(F,te);ap(de);const{bestMatch:xe,rows:Se,prefix:Je,term:ee}=jS(G,r,{usage:Y,now:te,scope:x}),Ne=Je==="#",ot=DS(ee),dt=ot?{term:ot,isScoped:x!==null,onSelect:()=>{R(),s(ot)}}:null,Ae=u.useMemo(()=>i?de.find($=>$.name===i)??null:null,[i,de]),be=$N(i,xe,Se),yt=u.useCallback($=>{b($),o(""),c("")},[]),Oe=!I&&Ae!==null,U=u.useMemo(()=>{var $;return i?re.find(ye=>ye.id===i)??(($=pe.find(ye=>ye.session.id===i))==null?void 0:$.session)??null:null},[i,re,pe]),ue=eu((f==null?void 0:f.id)??"",(f==null?void 0:f.projectPath)??""),ke=u.useCallback(()=>{m($=>$.slice(0,-1)),p($=>l.length<=1?null:$),c("")},[l.length]),Me=u.useCallback($=>{p($),m(ye=>[...ye,"agent-actions"]),o(""),c(""),S(ye=>ye+1)},[]);u.useEffect(()=>{e&&v!=null&&(o(v),E(),requestAnimationFrame(()=>{const $=a.current;if($){const ye=v.length;$.setSelectionRange(ye,ye)}}))},[e,v,E]);const qe=u.useCallback($=>{t($),$?S(ye=>ye+1):(o(""),c(""),m([]),p(null),b(null))},[t]),Ee=RS({rootRef:d,activePage:y??"root",onPin:c,resetKey:JSON.stringify([e,y??null,r,x&&zd(x)])}),Rt=!r&&x===null,Vt=u.useId(),Qt=n.jsx(xt,{open:e,onOpenChange:qe,children:n.jsx(bt,{className:K("!min-h-0 overflow-hidden p-0 transition-[max-width] duration-200","[&>button:last-child]:top-2 [&>button:last-child]:right-2.5",Oe?"max-w-[640px]":"max-w-[480px]",I&&"h-[85vh]"),children:n.jsxs(se.div,{variants:ou,initial:"hidden",animate:"visible",exit:"exit",className:K("flex overflow-hidden",I&&"h-full flex-col"),children:[n.jsxs(Hl,{ref:d,loop:!0,shouldFilter:!1,value:i,onValueChange:c,onPointerMove:Ee.onPointerMove,className:K("min-w-0 flex-1",I&&"flex flex-col [&_[cmdk-list]]:max-h-none [&_[cmdk-list]]:flex-1 [&_[cmdk-list]]:overflow-y-auto"),onKeyDown:$=>{if(Ee.onKeyDown($),$.key==="Enter"&&($.metaKey||$.ctrlKey)&&!y&&(U==null?void 0:U.cwd)!=null){$.preventDefault(),D(U.cwd),R();return}if($.key==="Enter"&&($.metaKey||$.ctrlKey)&&!y&&Ae){$.preventDefault(),ne(Ae);return}if($.key==="Enter"&&($.metaKey||$.ctrlKey)&&y==="agent-actions"&&f){$.preventDefault(),ne(f);return}if($.key==="Tab"&&!$.shiftKey&&!y&&be){$.preventDefault(),$.stopPropagation(),yt(be);return}if($.key==="Backspace"&&x&&!y&&FN(a.current)){$.preventDefault(),b(null);return}$.key==="Backspace"&&!r&&l.length>0&&($.preventDefault(),ke()),$.key==="Escape"&&l.length>0&&($.preventDefault(),$.stopPropagation(),ke())},children:[l.length>0&&n.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 border-b px-3 py-1.5 text-xs",children:[n.jsx("button",{onClick:()=>{m([]),p(null),S($=>$+1)},className:"hover:text-foreground transition-colors",children:"All"}),n.jsx("span",{children:"/"}),n.jsxs("span",{children:["Agent: ",f==null?void 0:f.name]})]}),n.jsx(Wl,{ref:a,"data-testid":"command-palette-input",leading:x&&!y?n.jsx(TS,{scope:x}):void 0,placeholder:y==="agent-actions"?`${(f==null?void 0:f.name)??"Agent"} actions…`:x&&!y?"Search within…":"Search rooms, agents, commands…",value:r,onValueChange:o}),n.jsx(Gl,{children:n.jsxs(Nn,{className:"h-full",children:[n.jsxs(Nb,{children:[n.jsx("p",{children:"No results found."}),n.jsx(tu,{className:"justify-center pb-0"})]}),n.jsx(Xe,{mode:"wait",initial:!1,children:n.jsxs(se.div,{"data-palette-page":y??"root",initial:{opacity:0,x:y?16:-16},animate:{opacity:1,x:0},exit:{opacity:0,x:y?-16:16},transition:{duration:.15,ease:"easeOut"},children:[!y&&n.jsx(YS,{staggerKey:A,isZeroQuery:Rt,isRoomMode:Ne,scope:x,hasQuery:ee.length>0,selectedCwd:F,selectedValue:i,continueRows:pe,recent:Z,newActions:Q,bestMatch:xe,rows:Se,rooms:q,searchHandoff:dt,onFeatureAction:O,onQuickAction:T,onGoToAgentActions:Me,onRoomSelect:w,onSessionSelect:$=>C($.id,$.cwd),onCommandSelect:j,onPageSelect:k}),y==="agent-actions"&&f&&n.jsx(MS,{agent:f,onOpenHere:()=>_(f),onOpenNewTab:()=>ne(f),onOpenNewWindow:z?()=>fe(f):void 0,onNewSession:()=>{D(f.projectPath),M(f.projectPath),R()},onEditSettings:()=>{ip.getState().openProfileDocked(f.projectPath),R()},onBrowseSessions:ue.sessionCount>0?()=>{g(f),M(f.projectPath),R()}:void 0,recentSessions:ue.recentSessions,onSelectSession:$=>C($,f.projectPath)})]},y??"root")})]})}),n.jsx(PS,{page:y,hasAgentSelected:Oe,canScope:!y&&be!==null,isScoped:x!==null})]}),n.jsx(Xe,{children:Oe&&Ae&&n.jsx(OS,{agent:Ae},Ae.id)})]})})});return n.jsxs(n.Fragment,{children:[n.jsx(Vc,{id:Vt,children:Qt}),h!==null&&n.jsx(cp,{agentPath:h.projectPath,agentName:h.displayName??h.name,agentVisual:fo(h),open:!0,onOpenChange:$=>{$||g(null)},onSelectSession:$=>C($,h.projectPath),onNewSession:()=>D(h.projectPath)})]})}const zN="",UN="";function KN(e){const t=[];let s=e,r=!1;for(;s.length>0;){const o=r?UN:zN,a=s.indexOf(o);if(a===-1){t.push({text:s,matched:r});break}a>0&&t.push({text:s.slice(0,a),matched:r}),s=s.slice(a+o.length),r=!r}return t}function HN({excerpt:e,className:t}){const s=KN(e);return n.jsx("span",{className:t,children:s.map((r,o)=>r.matched?n.jsx("mark",{className:"text-foreground bg-transparent font-semibold",children:r.text},o):n.jsx("span",{children:r.text},o))})}const wu="rooms",WN=["claude-code","opencode"];function GN(e){if(e.source===wu)return{kind:"room",...je.channels(),search:{id:e.container,entry:e.ordinal}};if(e.sessionId===void 0)return{kind:"unopenable"};const t=e.messageId!==void 0&&WN.includes(e.source);return{kind:"session",...$t({session:e.sessionId,dir:e.containerPath??void 0,...t?{message:e.messageId}:{}})}}function qN(e,t){return e.source===wu?t.get(e.container)??"Channel":e.containerPath===null?"Conversation":nl(e.containerPath)}function YN(e){return e==="user"?"You":"Agent"}function VN({hit:e,containerLabel:t,value:s,onSelect:r,openable:o}){const a=e.source==="rooms"?Jc:Ry;return n.jsxs(Ce,{value:s,onSelect:r,className:"flex flex-col items-start gap-1 py-2",children:[n.jsxs("div",{className:"text-muted-foreground flex w-full min-w-0 items-center gap-1.5 text-xs",children:[n.jsx(a,{className:"size-3.5 shrink-0","aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 truncate",children:t}),n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:"shrink-0",children:YN(e.role)}),!o&&n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:"shrink-0",children:"Ran outside DorkOS"})]}),e.createdAt!==null&&n.jsx("span",{className:"ml-auto shrink-0 tabular-nums",children:zn(e.createdAt)})]}),n.jsx(HN,{excerpt:e.excerpt,className:"text-foreground line-clamp-2 w-full text-sm break-words"}),e.containerPath!==null&&n.jsx("span",{dir:"rtl",className:"text-muted-foreground/70 text-3xs w-full truncate text-left",children:n.jsx("bdi",{dir:"ltr",children:e.containerPath})})]})}const QN=["Your channels and direct messages, as soon as they’re posted.","DorkOS chats can lag five minutes.","Claude Code, Codex and OpenCode chats, even outside DorkOS. These can lag five minutes."],XN=["Tool output is never searched: no errors, stack traces, file contents or diffs.","Matches whole words: “ogs” won’t find “dogs”. Type “dog*” to match word starts."],JN="Searches channels, direct messages, and DorkOS, Claude Code, Codex and OpenCode chats. Not tool output.",ZN=`Type at least ${sl} letters to search.`,eA="Search what was said…";function tA({detailOpen:e=!1,className:t}){const[s,r]=u.useState(null),o=s??e,a=XN;return n.jsxs(yo,{open:o,onOpenChange:r,className:K("px-3 py-2",t),children:[n.jsxs(vo,{className:K("text-muted-foreground/80 hover:text-foreground focus-ring text-2xs","flex w-full items-start gap-2 rounded-sm py-1 text-left leading-relaxed transition-colors"),children:[n.jsx("span",{className:"min-w-0 flex-1",children:JN}),n.jsx(qt,{className:K("mt-0.5 size-3 shrink-0 transition-transform",!o&&"-rotate-90"),"aria-hidden":"true"})]}),n.jsx(wo,{children:n.jsxs("ul",{className:"mt-2 space-y-1.5",children:[QN.map(i=>n.jsxs("li",{className:"text-muted-foreground flex gap-2 text-xs leading-relaxed",children:[n.jsx(cn,{className:"text-brand mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),n.jsx("span",{children:i})]},i)),a.map(i=>n.jsxs("li",{className:"text-muted-foreground flex gap-2 text-xs leading-relaxed",children:[n.jsx(rb,{className:"mt-0.5 size-3.5 shrink-0 opacity-60","aria-hidden":"true"}),n.jsx("span",{children:i})]},i))]})})]})}const nA=3e4,sA=e=>["message-search",e];function dr(e){return lp(e).some(t=>t.length>=sl)}function rA(e,t){const s=ae(),r=oA(e,dp),o=t&&dr(e)&&dr(r),{data:a,isFetching:i,error:c}=Ie({queryKey:sA(r),queryFn:()=>s.search({q:r}),enabled:o,staleTime:nA,placeholderData:l=>l,retry:!1});return{submitted:o?r:"",tooShort:t&&r.trim().length>0&&!dr(r),results:o?(a==null?void 0:a.results)??[]:[],warnings:o?(a==null?void 0:a.warnings)??[]:[],isSearching:o&&i,error:o&&c instanceof Error?c:null}}function oA(e,t){const[s,r]=u.useState(e);return u.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),s}function aA(){const e=P(t=>t.toggleMessageSearch);u.useEffect(()=>{const t=s=>{(s.metaKey||s.ctrlKey)&&s.shiftKey&&s.code==="KeyF"&&(s.preventDefault(),e())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}const ur="bg-muted rounded px-1 py-0.5 font-mono text-3xs";function iA(){aA();const e=P(v=>v.messageSearchOpen),t=P(v=>v.messageSearchQuery),s=P(v=>v.setMessageSearchOpen),r=Fe(),o=Pe(),a=ae(),[i,c]=u.useState("");u.useEffect(()=>{e&&c(t??"")},[e,t]);const{results:d,warnings:l,tooShort:m,isSearching:f,error:p,submitted:h}=rA(i,e),{data:g}=Ds({includeArchived:!0}),x=u.useMemo(()=>{const v=new Map;for(const E of g??[])v.set(E.id,E.kind==="channel"&&E.slug?`#${E.slug}`:E.title);return v},[g]),b=u.useCallback(()=>s(!1),[s]),y=u.useCallback((v,E)=>{if(E.kind!=="unopenable"&&(b(),o({to:E.to,search:E.search}),E.kind==="session"&&v.containerPath!==null)){const R=v.containerPath;a.browseDirectory(R).catch(_=>{if((_==null?void 0:_.status)===404){ce.info("That folder is gone",{description:`${R} is gone, so nothing new can run there. You can still read it.`});return}ce.info("Couldn’t open that folder",{description:`DorkOS couldn’t read ${R}. The chat may not open.`})})}},[b,o,a]),A=d.length>0,S=!A&&!m&&!f&&h.trim().length>0&&p===null,I=!A&&!m&&h.trim().length>0&&p===null;return n.jsx(xt,{open:e,onOpenChange:s,children:n.jsxs(bt,{"data-testid":"message-search-dialog",className:K("!min-h-0 max-w-[560px] overflow-hidden p-0","[&>button:last-child]:top-2 [&>button:last-child]:right-2.5",r&&"h-[85vh]"),children:[n.jsx(tt,{className:"sr-only",children:"Search your messages"}),n.jsx(se.div,{variants:ou,initial:"hidden",animate:"visible",exit:"exit",className:K("flex overflow-hidden",r&&"h-full flex-col"),children:n.jsxs(Hl,{loop:!0,shouldFilter:!1,className:K("min-w-0 flex-1",r&&"flex flex-col [&_[cmdk-list]]:max-h-none [&_[cmdk-list]]:flex-1 [&_[cmdk-list]]:overflow-y-auto"),children:[n.jsx(Wl,{"data-testid":"message-search-input",placeholder:eA,value:i,onValueChange:c}),p!==null&&n.jsxs("p",{className:"text-destructive flex items-start gap-2 px-3 py-3 text-xs leading-relaxed",children:[n.jsx(up,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),n.jsx("span",{children:p.message})]}),l.map(v=>n.jsxs("p",{role:"status",className:"text-muted-foreground text-2xs flex items-start gap-2 px-3 pt-2 leading-relaxed",children:[n.jsx(qi,{className:"mt-0.5 size-3 shrink-0","aria-hidden":"true"}),n.jsx("span",{children:v.message})]},v.source)),n.jsx(Gl,{children:n.jsx(Nn,{className:"h-full",children:A&&n.jsx(et,{className:K("transition-opacity duration-150",f&&"opacity-60"),children:d.map(v=>{const E=`${v.source}:${v.container}:${v.ordinal}`,R=GN(v);return n.jsx(VN,{value:E,hit:v,containerLabel:qN(v,x),openable:R.kind!=="unopenable",onSelect:()=>y(v,R)},E)})})})}),p===null&&n.jsxs("div",{className:"max-h-[45vh] min-h-0 shrink-0 overflow-y-auto",children:[m&&n.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs",children:ZN}),S&&n.jsxs("p",{className:"text-muted-foreground px-3 pt-3 text-xs",children:["No messages match “",h.trim(),"”."]}),n.jsx(tA,{detailOpen:I})]}),n.jsxs("div",{className:"text-muted-foreground flex flex-shrink-0 items-center gap-3 border-t px-3 py-1.5 text-xs",children:[n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:ur,children:"↑↓"}),"Navigate"]}),n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("kbd",{className:ur,children:"Enter"}),"Open"]}),n.jsxs("span",{className:"ml-auto inline-flex items-center gap-1",children:[n.jsx("kbd",{className:ur,children:"esc"}),"Close"]})]})]})})]})})}function cA(e){return`set${e.charAt(0).toUpperCase()}${e.slice(1)}`}function lA(e){const t=rt(),s=lo(),r=xo();switch(e){case"settings":return{isOpen:t.isOpen,close:t.close};case"tasks":return{isOpen:s.isOpen,close:s.close};case"profile":return{isOpen:r.isOpen,close:r.close};default:return{isOpen:!1,close:()=>{}}}}function dA({contribution:e,openStateKey:t}){const s=P(m=>m[t]),r=P(m=>m[cA(t)]),o=lA(e.urlParam),a=o.isOpen,i=o.close,c=s||a,d=u.useCallback(m=>{r(m),!m&&a&&i()},[r,a,i]),l=e.component;return n.jsx(l,{open:c,onOpenChange:d})}function uA({contribution:e,openState:t}){const s=u.useSyncExternalStore(t.subscribe,t.getSnapshot),r=e.component;return s?n.jsx(mp,{fallback:null,onError:o=>{console.error(`[extensions] Dialog ${e.id} crashed and was closed:`,o),t.set(!1)},children:n.jsx(r,{open:!0,onOpenChange:t.set})}):null}function mA({contribution:e}){return e.openState?n.jsx(uA,{contribution:e,openState:e.openState}):n.jsx(dA,{contribution:e,openStateKey:e.openStateKey})}function hA(){const e=Rs("dialog");return n.jsx(n.Fragment,{children:e.map(t=>n.jsx(mA,{contribution:t},t.id))})}const fA=["session","id","thread","entry","itemId","agent","profile","continuedFrom","pkg","view","region","detail","panel"];function pA(e,t){if(e.length>=Ys)return e.slice(0,Ys);const s=new URLSearchParams(t);let r="";for(const o of fA)for(const a of s.getAll(o)){const i=new URLSearchParams([[o,a]]).toString(),c=r?`${r}&${i}`:i;e.length+1+c.length<=Ys&&(r=c)}return r?`${e}?${r}`:e}const gA=6e4,xA={bug:"when it’s fixed",idea:"when it ships",feedback:"when the team acts on it"};function bA(e,t){var s;return JSON.stringify([e.kind,t,e.screenshotDataUrl??null,((s=e.element)==null?void 0:s.selector)??null])}function bi(e,t,s,r){const o=Yl("bug",e,t),a=[...gp()];r&&a.push({at:new Date().toISOString(),kind:"console_error",message:fp(r).slice(0,pp)});const i=a.slice(-xp);return{clientReport:{version:o.version,platform:o.platform,runtimes:o.runtimes,flags:Object.fromEntries(Object.entries(o.flags).map(([c,d])=>[c,typeof d=="number"?String(d):d])),...Vy(s)},...i.length>0?{breadcrumbs:i}:{}}}function yA(){const e=ae(),t=_e({select:h=>h.location.pathname}),s=_e({select:h=>h.location.searchStr}),r=hp(),o=pA(t,s),a=_e({select:h=>{const g=h.location.search;return typeof(g==null?void 0:g.session)=="string"?g.session:void 0}}),{data:i}=Ie({queryKey:Be.current(),queryFn:()=>e.getConfig(),staleTime:300*1e3}),[c,d]=u.useState(!1),l=Pe(),m=u.useRef(null),f=u.useCallback(h=>i?bi(i,t,r,h==null?void 0:h.crashStack):void 0,[i,t,r]),p=u.useCallback(async h=>{var v;const g=h.message.trim();if(!g)return!1;const x=(v=h.contact)==null?void 0:v.trim(),b=bA(h,g),y=m.current;if(y&&y.fingerprint===b&&Date.now()-y.at<gA)return ce.info("Already sent a moment ago."),!0;const A=h.includeDiagnostics?bi(i,t,r,h.crashStack):void 0,S=h.includeDiagnostics&&h.kind==="bug",I=!!(h.includeConversation&&a);d(!0);try{const E=A&&S?await Fy():void 0,{ok:R}=await e.sendFeedback({kind:h.kind,message:g,...x?{contact:x}:{},...o?{route:o}:{},...A?{diagnostics:{...A,...E?{shellLogExcerpt:E}:{}}}:{},...S?{includeServerLogs:!0}:{},...I?{sessionId:a,includeTranscript:!0}:{},...h.screenshotDataUrl?{screenshot:{dataUrl:h.screenshotDataUrl}}:{},...h.anonymous?{anonymous:!0}:{},...h.element?{element:h.element}:{}});return R?(m.current={fingerprint:b,at:Date.now()},ce.success("Sent. Thank you.",{...h.notifyEmail?{description:`DorkOS emails ${h.notifyEmail} ${xA[h.kind]}.`}:{},action:{label:"Your reports",onClick:()=>l(je.feedbackRequests())}})):ce.error("Couldn’t send. Your words are still here. Try again or open a GitHub issue."),R}finally{d(!1)}},[e,t,o,a,i,r,l]);return{isSubmitting:c,sessionId:a,route:o,buildDiagnostics:f,send:p}}const vA=24;function yi(e,t){const s=Math.max(e.left,t.left),r=Math.max(e.top,t.top),o=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return o<=s||a<=r?null:{left:s,top:r,width:o-s,height:a-r}}function wA(e){const{element:t,viewport:s,region:r,image:o}=e,a=e.padding??vA;if(o.width<=0||o.height<=0)return null;const i={left:t.left-a,top:t.top-a,width:t.width+a*2,height:t.height+a*2},c=yi(i,{left:0,top:0,width:s.width,height:s.height});if(!c)return null;const d=yi(c,r);if(!d)return null;const l=o.width/r.width,m=o.height/r.height,f=Math.round((d.left-r.left)*l),p=Math.round((d.top-r.top)*m),h=Math.round((d.left+d.width-r.left)*l),g=Math.round((d.top+d.height-r.top)*m),x=Math.min(Math.max(0,f),Math.max(0,o.width-1)),b=Math.min(Math.max(0,p),Math.max(0,o.height-1));return{sx:x,sy:b,sw:Math.max(1,h-x),sh:Math.max(1,g-b)}}function jA(e){return new Promise((t,s)=>{const r=new Image,o=i=>{clearTimeout(a),s(new st("failed",i))},a=setTimeout(()=>o(`The capture did not decode within ${xs}ms.`),xs);r.onload=()=>{clearTimeout(a),t(r)},r.onerror=()=>o("The capture did not decode, so it cannot be cropped."),r.src=e})}function kA(e,t){const s=document.createElement("canvas");s.width=t.sw,s.height=t.sh;const r=s.getContext("2d");if(!r)throw new st("failed","This browser gave no 2d canvas context to crop with.");return r.drawImage(e,t.sx,t.sy,t.sw,t.sh,0,0,t.sw,t.sh),s.toDataURL("image/png")}async function SA(e,t){const s=t.getBoundingClientRect();if(s.width===0&&s.height===0)throw new st("failed","That element has no size to crop to.");if(!ud().contains(t))throw new st("failed","That element is not part of the app that was captured.");const r=await jA(e.dataUrl),o=wA({element:{left:s.left,top:s.top,width:s.width,height:s.height},viewport:{width:window.innerWidth,height:window.innerHeight},region:e.region,image:{width:r.naturalWidth||r.width,height:r.naturalHeight||r.height}});if(!o)throw new st("failed","That element is no longer inside the captured picture.");return Ir(kA(r,o))}const vi={"too-large":"That image is too big to send. Crop it to the part that matters.",unreadable:"Couldn’t read that image. Try a PNG or JPEG.",unsupported:"This browser can’t prepare images to send."},CA={failed:"Couldn’t capture the app view. You can still add a screenshot yourself.",unsupported:"Couldn’t start the app capture. Reload, or add a screenshot yourself."};function NA(e){return e instanceof st?CA[e.reason]:e instanceof Kt?vi[e.reason]:vi.unreadable}const mr="Only images can be attached.",AA="Files";function kn(e){return e?Array.from(e.types).includes(AA):!1}function wi(e){return e.find(t=>t.type.startsWith("image/"))}function EA(e={}){const{enabled:t=!1}=e,[s,r]=u.useState(null),[o,a]=u.useState(!1),[i,c]=u.useState(!1),d=u.useRef(0),l=u.useRef(0),m=u.useCallback(async v=>{const E=++l.current;a(!0);try{const R=await v();return E!==l.current?null:(r(R),R)}catch(R){return E!==l.current||ce.error(NA(R)),null}finally{E===l.current&&a(!1)}},[]),f=u.useCallback(async v=>{if(!v.type.startsWith("image/")){ce.error(mr);return}await m(()=>Ir(v))},[m]),p=u.useCallback(async()=>{await m(async()=>Ir(await Gy()))},[m]),h=u.useCallback(v=>m(async()=>SA(await md(),v)),[m]),g=u.useCallback(()=>{l.current+=1,r(null),a(!1)},[]),x=u.useCallback(v=>{l.current+=1,d.current=0,v!==void 0&&!nv(v)?(console.warn("[feedback] Ignoring an initial screenshot that is not a bounded image data URL."),r(null)):r(v??null),a(!1),c(!1)},[]);u.useEffect(()=>{if(!t)return;const v=E=>{kn(E.dataTransfer)&&E.preventDefault()};return window.addEventListener("dragover",v),window.addEventListener("drop",v),()=>{window.removeEventListener("dragover",v),window.removeEventListener("drop",v)}},[t]);const b=u.useCallback(v=>{var _;const E=Array.from(((_=v.clipboardData)==null?void 0:_.items)??[]).map(D=>D.getAsFile()).filter(D=>D!==null);if(E.length===0)return;const R=wi(E);if(!R){ce.error(mr);return}v.preventDefault(),f(R)},[f]),y=u.useCallback(v=>{kn(v.dataTransfer)&&(v.preventDefault(),d.current+=1,c(!0))},[]),A=u.useCallback(v=>{kn(v.dataTransfer)&&(v.preventDefault(),v.dataTransfer.dropEffect="copy")},[]),S=u.useCallback(v=>{kn(v.dataTransfer)&&(d.current=Math.max(0,d.current-1),d.current===0&&c(!1))},[]),I=u.useCallback(v=>{if(!kn(v.dataTransfer))return;v.preventDefault(),d.current=0,c(!1);const E=wi(Array.from(v.dataTransfer.files));if(!E){ce.error(mr);return}f(E)},[f]);return{dataUrl:s,isPreparing:o,isDraggingOver:i,attach:f,capture:p,captureElement:h,clear:g,reset:x,handlers:{onPaste:b,onDragEnter:y,onDragOver:A,onDragLeave:S,onDrop:I}}}const ji=vp,IA="root";function ju(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["'\\[\]]/g,t=>`\\${t}`)}function ki(e,t){try{const s=t.ownerDocument.querySelectorAll(e);return s.length===1&&s[0]===t}catch{return!1}}function ku(e){return e.id?`#${ju(e.id)}`:null}function Wr(e,t){const s=e.getAttribute(t);return s?`[${t}="${ju(s)}"]`:null}function RA(e){const t=e.tagName;let s=1,r=e.previousElementSibling;for(;r;)r.tagName===t&&(s+=1),r=r.previousElementSibling;return s}function TA(e){const t=e.tagName.toLowerCase(),s=ku(e);if(s)return s;const r=Wr(e,"data-testid")??Wr(e,"data-slot"),o=`:nth-of-type(${RA(e)})`;if(!r)return`${t}${o}`;const a=`${t}${r}`;return(e.parentElement?Array.from(e.parentElement.children).filter(c=>c.matches(a)):[e]).length===1?a:`${a}${o}`}function DA(e){for(const r of[ku(e),Wr(e,"data-testid")])if(r&&r.length<=ji&&ki(r,e))return r;const t=[];let s=e;for(;s&&s.id!==IA&&s.tagName!=="BODY";){t.unshift(TA(s));const r=t.join(" > ");if(r.length>ji){t.shift();break}if(ki(r,e))return r;s=s.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Si(e,t){var r;const s=(r=e.closest(`[${t}]`))==null?void 0:r.getAttribute(t);if(!(!s||s.length>bp))return s}const OA=8;function Su(e,t){const s=(t==null?void 0:t.closest("[data-testid]"))??null;if(!s||s===e)return s;const r=e.getBoundingClientRect().height;return r<=0||s.getBoundingClientRect().height<=r*OA?s:null}function MA(e){const t=Si(e,"data-slot"),s=Su(e,e),r=s?Si(s,"data-testid"):void 0,o=Cu(e);return{selector:DA(e),...t?{slot:t}:{},...r?{testId:r}:{},...o?{label:o}:{}}}const hr=40,_A=["button","a[href]","summary","input","select","textarea",'[role="button"]','[role="link"]','[role="menuitem"]','[role="tab"]','[role="option"]','[role="checkbox"]','[role="switch"]'].join(", "),PA=new Set(["INPUT","SELECT","TEXTAREA"]),LA=['[contenteditable]:not([contenteditable="false"])','[role="textbox"]','[role="searchbox"]','[role="combobox"]'].join(", "),FA=["h1","h2","h3","h4","h5","h6",'[role="heading"]',"label","legend","th","dt"].join(", ");function $A(e){if(typeof Intl<"u"&&"Segmenter"in Intl){const t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e),s=>s.segment)}return Array.from(e)}function In(e){const t=(e??"").replace(/\s+/g," ").trim();if(!t)return;const s=$A(t);if(s.length<=hr)return t;const r=s.slice(0,hr-1),o=r.lastIndexOf(" ");return`${(o>hr/2?r.slice(0,o):r).join("").trimEnd()}…`}function BA(e){var r;const s=(((r=e.getAttribute("aria-labelledby"))==null?void 0:r.split(/\s+/).filter(Boolean))??[]).map(o=>{var a;return((a=e.ownerDocument.getElementById(o))==null?void 0:a.textContent)??""}).join(" ");return In(s)}function Jn(e){return In(e.getAttribute("aria-label"))??BA(e)}function Cu(e){const t=zA(e);return t&&t.length<=yp?t:void 0}function zA(e){var a,i;const t=e.closest(LA);if(t)return Jn(t);const s=e.closest(_A);if(s){if(PA.has(s.tagName)){const c=s;return Jn(s)??In((i=(a=c.labels)==null?void 0:a[0])==null?void 0:i.textContent)}return Jn(s)??In(s.textContent)}const r=Jn(e);if(r)return r;const o=e.closest(FA);return o?In(o.textContent):void 0}function Ci(e){const t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[-_\s]+/).filter(Boolean).map(r=>r.toLowerCase());if(t.length===0)return null;const s=t.join(" ");return s.charAt(0).toUpperCase()+s.slice(1)}function UA(e){var d;const t=Cu(e);if(t)return{text:t,onScreen:!0};const s=e.getAttribute("data-testid")??e.getAttribute("data-slot"),r=s?Ci(s):null;if(r)return{text:r,onScreen:!1};const o=(d=e.parentElement)==null?void 0:d.closest("[data-testid], [data-slot]"),i=(o&&Su(e,o)===o?o.getAttribute("data-testid"):null)??(o==null?void 0:o.getAttribute("data-slot")),c=i?Ci(i):null;return c?{text:c,onScreen:!1}:null}const KA="This part";function Nu(e){return(e==null?void 0:e.text)??KA}function HA(e){return e?e.onScreen?`What’s wrong with “${e.text}”?`:`What’s wrong with the ${e.text.toLowerCase()}?`:"What’s wrong with this part?"}function WA(e){return e!=null&&e.onScreen?`Remove “${e.text}”`:`Remove ${Nu(e).toLowerCase()}`}const Ni=500;function Ai(e){const t=e.trim();return t.length>Ni?`${t.slice(0,Ni)}… [trimmed]`:t}function GA(e){const t=[`${e.role}: ${e.content.trim()}`.trim()];for(const s of e.toolCalls??[])t.push(` [tool: ${s.toolName}]`),s.input&&t.push(` input: ${Ai(s.input)}`),s.result&&t.push(` result: ${Ai(s.result)}`);return t.join(`
|
|
74
|
+
`)}function qA(e){const t=e.slice(-20),s=wp(jp(t.map(GA).join(`
|
|
75
|
+
|
|
76
|
+
`))).trim();return s.length>la?`${s.slice(0,la-1)}…`:s}function YA(e,t){const s=ae(),[r]=Ms(),{data:o,isLoading:a,isError:i}=Ie({queryKey:["feedback-transcript-preview",e,r],queryFn:async()=>{const{messages:c}=await s.getMessages(e,r??void 0);return qA(c)},enabled:t&&!!e,staleTime:30*1e3});return{text:o??"",isLoading:a,isError:i}}function VA(){return n.jsx("div",{"data-slot":"feedback-preview-footer",className:"bg-background relative -mx-4 -mb-4 shrink-0 border-t px-4 py-3 sm:mx-0 sm:px-0",children:n.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[n.jsx(fs,{className:"size-3 shrink-0","aria-hidden":!0}),"Private. Only the DorkOS core team sees these. Never public."]})})}function Ze({label:e,value:t}){return n.jsxs("div",{className:"flex items-baseline justify-between gap-4 py-1",children:[n.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e}),n.jsx("span",{className:"text-foreground text-right font-mono text-xs break-all",children:t})]})}function QA({diagnostics:e,kind:t,route:s}){if(!e)return n.jsx("p",{className:"text-muted-foreground text-xs",children:"Gathering diagnostics…"});const{clientReport:r,breadcrumbs:o}=e,{viewport:a,browser:i,shell:c,theme:d,locale:l,timezone:m}=r;return n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"rounded-md border p-3",children:[n.jsx(Ze,{label:"Page",value:s}),n.jsx(Ze,{label:"Version",value:r.version}),n.jsx(Ze,{label:"Platform",value:r.platform}),n.jsx(Ze,{label:"Runtimes",value:r.runtimes.length?r.runtimes.join(", "):"none"}),a&&n.jsx(Ze,{label:"Window",value:`${a.width}×${a.height}${a.devicePixelRatio&&a.devicePixelRatio!==1?` @${a.devicePixelRatio}x`:""}`}),c&&n.jsx(Ze,{label:"Shell",value:c}),d&&n.jsx(Ze,{label:"Theme",value:d}),l&&n.jsx(Ze,{label:"Locale",value:l}),m&&n.jsx(Ze,{label:"Timezone",value:m}),i&&n.jsx(Ze,{label:"Browser",value:i}),Object.entries(r.flags).map(([f,p])=>n.jsx(Ze,{label:f,value:String(p)},f))]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("span",{className:"text-muted-foreground text-xs font-medium",children:["Recent events (",(o==null?void 0:o.length)??0,")"]}),o&&o.length>0?n.jsx("ul",{className:"flex flex-col gap-1",children:o.map((f,p)=>n.jsxs("li",{className:"text-foreground font-mono text-xs break-all",children:[n.jsx("span",{className:"text-muted-foreground",children:f.kind})," ",f.message]},p))}):n.jsx("p",{className:"text-muted-foreground text-xs",children:"No recent errors or warnings."})]}),t==="bug"&&n.jsxs("div",{className:"text-muted-foreground space-y-1 text-xs",children:[n.jsx("p",{children:ze()?"Recent server and app log excerpts are added when you send.":"An excerpt of recent server logs is added when you send."}),n.jsx("p",{children:"Scrubbed first: home paths shown as ~, tokens removed, web addresses cut to the page."})]})]})}function XA({sessionId:e,active:t}){const{text:s,isLoading:r,isError:o}=YA(e,t);return r?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(Pt,{className:"h-4 w-3/4"}),n.jsx(Pt,{className:"h-4 w-full"}),n.jsx(Pt,{className:"h-4 w-2/3"})]}):o?n.jsx("p",{className:"text-muted-foreground text-xs",children:"Couldn’t load the chat preview."}):s?n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsxs("div",{className:"text-muted-foreground space-y-1 text-xs",children:[n.jsx("p",{children:"The last ~10 turns, gathered and scrubbed when you send."}),n.jsx("p",{children:"Home paths shown as ~, tokens removed, long tool output trimmed."})]}),n.jsx("pre",{className:"text-foreground bg-muted/40 rounded-md p-3 font-mono text-xs break-words whitespace-pre-wrap",children:s})]}):n.jsx("p",{className:"text-muted-foreground text-xs",children:"No recent chat to attach."})}function JA({dataUrl:e}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("p",{className:"text-muted-foreground text-xs",children:"Sent exactly as shown, shrunk to keep the message small."}),n.jsx("img",{src:e,alt:"The screenshot you attached",className:"bg-muted/30 w-full rounded-md border object-contain"})]})}function ZA({open:e,onOpenChange:t,initialTab:s,diagnostics:r,kind:o,route:a,showConversation:i,sessionId:c,screenshotDataUrl:d}){const l=!Fe(),m=["diagnostics",...i?["conversation"]:[],...d?["screenshot"]:[]],f=m.includes(s)?s:"diagnostics";return n.jsx(xt,{open:e,onOpenChange:t,children:n.jsxs(bt,{className:K("max-h-[85vh]",l&&"max-w-lg"),children:[n.jsxs(ht,{children:[n.jsx(tt,{className:"text-sm font-medium",children:"What will be sent"}),n.jsx(ft,{className:"text-muted-foreground text-xs",children:"Each part is sent only if its toggle is on."})]}),n.jsxs(Il,{defaultValue:f,className:"flex min-h-0 flex-col gap-3 px-4 pb-4 sm:px-0",children:[n.jsxs(Rl,{className:K("grid shrink-0",m.length===3&&"grid-cols-3",m.length===2&&"grid-cols-2",m.length===1&&"grid-cols-1"),children:[n.jsx(ts,{value:"diagnostics",children:"Diagnostics"}),i&&n.jsx(ts,{value:"conversation",children:"Chat"}),d&&n.jsx(ts,{value:"screenshot",children:"Screenshot"})]}),n.jsx(Xs,{value:"diagnostics",className:"min-h-0",children:n.jsx(Nn,{className:"max-h-[45vh]",children:n.jsx(QA,{diagnostics:r,kind:o,route:a})})}),i&&n.jsx(Xs,{value:"conversation",className:"min-h-0",children:n.jsx(Nn,{className:"max-h-[45vh]",children:n.jsx(XA,{sessionId:c,active:e})})}),d&&n.jsx(Xs,{value:"screenshot",className:"min-h-0",children:n.jsx(Nn,{className:"max-h-[45vh]",children:n.jsx(JA,{dataUrl:d})})}),n.jsx(VA,{})]},f)]})})}const eE="0 0 0 9999px rgb(0 0 0 / 0.5)";function tE(e){var r,o;const t=(r=e.closest("[data-slot]"))==null?void 0:r.getAttribute("data-slot");return((o=e.closest("[data-testid]"))==null?void 0:o.getAttribute("data-testid"))??t??e.tagName.toLowerCase()}function nE(e){let t=e;for(;t;){if(/^(auto|scroll|overlay)$/.test(getComputedStyle(t).overflowY)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function sE({phase:e,onSelect:t,onCancel:s}){const r=u.useRef(null),o=u.useRef(null),[a,i]=u.useState(null),c=e==="picking",d=u.useCallback((x,b)=>{const y=r.current;if(!y)return null;const A=y.style.pointerEvents;y.style.pointerEvents="none";try{return document.elementFromPoint(x,b)}finally{y.style.pointerEvents=A}},[]),l=u.useCallback(x=>{var b;return x instanceof Node&&!!((b=o.current)!=null&&b.contains(x))},[]),m=u.useCallback(x=>{if(!c)return;if(l(x.target)){i(null);return}const b=d(x.clientX,x.clientY);if(!b){i(null);return}const y=b.getBoundingClientRect();i({element:b,box:{left:y.left,top:y.top,width:y.width,height:y.height},label:tE(b)})},[c,d,l]),f=u.useCallback(x=>{if(!c||l(x.target))return;const b=d(x.clientX,x.clientY)??(a==null?void 0:a.element);b&&t(b)},[c,d,l,t,a]),p=u.useCallback(x=>{if(!c)return;const b=nE(d(x.clientX,x.clientY));b==null||b.scrollBy({left:x.deltaX,top:x.deltaY})},[c,d]);u.useEffect(()=>{if(!c)return;const x=b=>{b.preventDefault(),b.stopImmediatePropagation(),b.key==="Escape"&&s()};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[c,s]),u.useEffect(()=>{var b;const x=document.activeElement;return(b=r.current)==null||b.focus(),()=>{x instanceof HTMLElement&&x.focus()}},[]),u.useEffect(()=>{if(!c)return;const x=()=>{i(b=>{if(!b)return b;const y=b.element.getBoundingClientRect();return{...b,box:{left:y.left,top:y.top,width:y.width,height:y.height}}})};return window.addEventListener("scroll",x,!0),()=>window.removeEventListener("scroll",x,!0)},[c]);const h=c?a:null,g=h!==null&&h.box.top<28;return js.createPortal(n.jsxs("div",{ref:r,role:"dialog","aria-modal":"true","aria-label":"Point at the part of the app that looks wrong",tabIndex:-1,className:K("fixed inset-0 z-50 focus:outline-none",c?"cursor-crosshair":"cursor-wait"),onPointerMove:m,onPointerLeave:()=>i(null),onClick:f,onWheel:p,onContextMenu:x=>{x.preventDefault(),c&&s()},children:[c&&(h?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"border-primary pointer-events-none absolute rounded-sm border-2",style:{left:h.box.left,top:h.box.top,width:h.box.width,height:h.box.height,boxShadow:eE}}),n.jsx("div",{className:"bg-primary text-primary-foreground text-2xs pointer-events-none absolute max-w-[60vw] truncate rounded-sm px-1.5 py-0.5 font-mono leading-tight",style:{left:Math.max(4,h.box.left),top:g?h.box.top+h.box.height+4:h.box.top-22},children:h.label})]}):n.jsx("div",{className:"absolute inset-0 bg-black/50"})),c&&n.jsxs("div",{ref:o,className:"bg-popover text-popover-foreground absolute bottom-6 left-1/2 flex -translate-x-1/2 items-center gap-3 rounded-lg border px-3 py-2 shadow-lg",children:[n.jsxs("span",{className:"flex items-center gap-2 text-xs",children:[n.jsx(gs,{className:"size-3.5 shrink-0","aria-hidden":!0}),"Click the part that looks wrong. Esc to cancel."]}),n.jsx("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring rounded-sm text-xs underline underline-offset-2 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:"Cancel"})]})]}),document.body)}const Ei="text-muted-foreground hover:text-foreground h-8 px-2 text-xs aria-disabled:pointer-events-none aria-disabled:opacity-50";function fr({tip:e,children:t}){return n.jsxs(fn,{children:[n.jsx(pn,{asChild:!0,children:t}),n.jsx(gn,{className:"max-w-60 text-center",children:e})]})}function rE({showPictureTools:e,isPreparing:t,hasPointed:s,hasWords:r,isMobile:o,onCapture:a,onPointAtElement:i,onPick:c}){const d=u.useId(),l=u.useId(),m=u.useId(),f=u.useId();function p(A){var I;const S=(I=A.target.files)==null?void 0:I[0];A.target.value="",S&&c(S)}const h=r&&!o;if(!e&&!h)return null;const g=o?"Add a photo":"Add an image",x=o?"Add a photo from your library.":"Add an image from your files, or paste or drop one here.",b="Take a picture of this app. Never the rest of your screen.",y="Click the part that looks wrong. DorkOS crops the picture to it.";return n.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-t px-1.5 py-1.5",children:[e&&n.jsxs(n.Fragment,{children:[n.jsx("span",{id:l,className:"sr-only",children:b}),n.jsx(fr,{tip:b,children:n.jsxs(L,{"aria-describedby":l,type:"button",variant:"ghost",size:"sm",onClick:()=>{t||a()},"aria-disabled":t||void 0,className:Ei,children:[n.jsx(ky,{className:"size-3.5","aria-hidden":!0}),"Capture app"]})}),!o&&n.jsx(fr,{tip:y,children:n.jsxs(L,{"aria-describedby":m,type:"button",variant:"ghost",size:"sm",onClick:()=>{t||i()},"aria-disabled":t||void 0,className:Ei,children:[n.jsx(gs,{className:"size-3.5","aria-hidden":!0}),s?"Point again":"Point at it"]})}),!o&&n.jsx("span",{id:m,className:"sr-only",children:y}),n.jsx("span",{id:f,className:"sr-only",children:x}),n.jsx(fr,{tip:x,children:n.jsxs("label",{htmlFor:d,"aria-disabled":t||void 0,className:"text-muted-foreground hover:text-foreground hover:bg-accent focus-within:ring-ring flex size-8 cursor-pointer items-center justify-center rounded-md transition-colors duration-150 focus-within:ring-2 aria-disabled:pointer-events-none aria-disabled:opacity-50",children:[n.jsx(Tx,{className:"size-3.5","aria-hidden":!0}),n.jsx("input",{id:d,type:"file",accept:"image/*","aria-label":g,"aria-describedby":f,disabled:t,className:"sr-only",onChange:p})]})})]}),h&&n.jsxs("span",{className:"text-muted-foreground ml-auto pr-1.5 text-xs","aria-hidden":!0,children:[zt?"⌘↵":"Ctrl+↵"," to send"]})]})}function Ii({imageUrl:e,alt:t,caption:s,pointed:r=!1,detail:o,onOpen:a,onRemove:i,removeLabel:c}){const d=n.jsxs(n.Fragment,{children:[e?n.jsx("img",{src:e,alt:t,className:"size-full object-cover"}):n.jsx("span",{className:"text-muted-foreground flex size-full items-center justify-center",children:n.jsx(gs,{className:"size-4","aria-hidden":!0})}),s&&n.jsxs("span",{className:"bg-background/85 text-2xs absolute inset-x-0 bottom-0 flex items-center gap-1 truncate px-1.5 py-0.5 text-left leading-tight",children:[r&&n.jsx(gs,{className:"size-3 shrink-0","aria-hidden":!0}),n.jsx("span",{className:"truncate",children:s})]})]}),l=a?n.jsx("button",{type:"button",onClick:a,"aria-label":`Open ${t.charAt(0).toLowerCase()}${t.slice(1)}`,className:"focus-visible:ring-ring relative block size-full overflow-hidden rounded-[inherit] focus-visible:ring-2 focus-visible:outline-none",children:d}):n.jsx("div",{role:"img","aria-label":t,className:"relative size-full overflow-hidden rounded-[inherit]",children:d});return n.jsxs("div",{className:"bg-muted/40 relative h-16 w-28 shrink-0 rounded-md border",children:[o&&a?n.jsxs(fn,{children:[n.jsx(pn,{asChild:!0,children:l}),n.jsx(gn,{className:"text-2xs max-w-72 font-mono break-all",children:o})]}):l,n.jsx("button",{type:"button",onClick:i,"aria-label":c,className:"bg-background/90 text-muted-foreground hover:text-foreground focus-visible:ring-ring absolute top-1 right-1 flex size-5 items-center justify-center rounded-full border transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:n.jsx(Ue,{className:"size-3","aria-hidden":!0})})]})}function Ri({label:e,summary:t,pressed:s,onPressedChange:r,onPreview:o}){return n.jsxs("span",{className:K("inline-flex items-center rounded-full border text-xs transition-colors duration-150",s?"bg-muted/60 text-foreground":"text-muted-foreground"),children:[n.jsxs(fn,{children:[n.jsx(pn,{asChild:!0,children:n.jsxs("button",{type:"button","aria-pressed":s,onClick:()=>r(!s),className:"hover:text-foreground focus-visible:ring-ring flex items-center gap-1.5 rounded-full py-1 pr-1.5 pl-2.5 focus-visible:ring-2 focus-visible:outline-none",children:[n.jsx("span",{"aria-hidden":!0,className:K("size-1.5 rounded-full transition-colors duration-150",s?"bg-primary":"bg-muted-foreground/40")}),e]})}),n.jsx(gn,{className:"max-w-60",children:t})]}),n.jsx("button",{type:"button",onClick:o,"aria-label":`Preview ${e.toLowerCase()}`,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex items-center rounded-full py-1 pr-2.5 pl-1 focus-visible:ring-2 focus-visible:outline-none",children:n.jsx(kp,{className:"size-3.5","aria-hidden":!0})})]})}function oE({currentUser:e,anonymous:t,onToggleAnonymous:s,contact:r,onContactChange:o}){const a=u.useId(),i=u.useId();if(e)return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("div",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[t?n.jsx(Dy,{className:"size-3.5 shrink-0","aria-hidden":!0}):n.jsx(Sp,{className:"size-3.5 shrink-0","aria-hidden":!0}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t?"Sending anonymously":`Replying to ${e.email}`}),n.jsx("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring shrink-0 rounded-sm underline underline-offset-2 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:t?"Use my account":"Send anonymously"})]}),t&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Without your name or email, the team can’t reply. Track it in Your reports."})]});const c=r.trim().length>0&&!rl(r);return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(We,{htmlFor:a,className:"text-xs",children:"Your email"}),n.jsx(gt,{id:a,type:"email",inputMode:"email",autoComplete:"email",value:r,onChange:d=>o(d.target.value),placeholder:"you@example.com",maxLength:Cp,"aria-describedby":i,onKeyDown:d=>{d.key==="Enter"&&!d.metaKey&&!d.ctrlKey&&d.preventDefault()},"aria-invalid":c||void 0}),n.jsx("p",{id:i,className:"text-muted-foreground text-xs",children:c?"Not an email yet, so no reply can reach you.":"Get a note when it’s fixed. DorkOS remembers it."})]})}const aE=[{value:"feedback",label:"Feedback",icon:Ss},{value:"bug",label:"Bug",icon:Np},{value:"idea",label:"Idea",icon:Dx}];function iE({kind:e,onChange:t}){return n.jsx("div",{role:"radiogroup","aria-label":"What kind of feedback",className:"flex gap-1.5",children:aE.map(({value:s,label:r,icon:o})=>{const a=e===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":a,onClick:()=>t(s),className:K("focus-visible:ring-ring flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",a?"border-foreground/60 text-foreground bg-muted/60":"text-muted-foreground hover:text-foreground"),children:[n.jsx(o,{className:"size-3.5","aria-hidden":!0}),r]},s)})})}function cE({needsWords:e,canSend:t,isSubmitting:s,onOpenGitHubIssue:r}){const o=u.useId();return n.jsxs(tn,{className:"shrink-0 flex-col gap-2 sm:flex-col sm:justify-start sm:space-x-0",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[e?n.jsx("p",{id:o,"aria-live":"polite",className:"text-status-warning min-w-0 flex-1 text-xs",children:"Add a few words about what to look for."}):n.jsxs("p",{className:"text-muted-foreground flex min-w-0 flex-1 items-center gap-1.5 text-xs",children:[n.jsx(fs,{className:"size-3 shrink-0","aria-hidden":!0}),"Only the DorkOS team sees this"]}),n.jsx(L,{type:"submit",disabled:!t,"aria-keyshortcuts":"Meta+Enter Control+Enter","aria-describedby":e?o:void 0,className:"shrink-0",children:s?"Sending…":"Send"})]}),n.jsxs("p",{className:"text-muted-foreground text-center text-xs",children:["Prefer a public GitHub issue?"," ",n.jsx("button",{type:"button",onClick:r,className:"hover:text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:"Open one instead"})]})]})}const lE={feedback:"What works, what does not, what you wish it did…",bug:"What happened, and what did you expect instead?",idea:"What would you like DorkOS to do?"};function Ti(e,t,s){return{diagnostics:e==="bug"||s,conversation:e==="bug"&&t}}function dE({open:e,onOpenChange:t,initialKind:s,prefillMessage:r,crashStack:o,currentUser:a,initialScreenshotDataUrl:i}){const c=!Fe(),{isSubmitting:d,sessionId:l,route:m,buildDiagnostics:f,send:p}=yA(),h=py(),g=!!l,x=!!a,b=u.useId(),[y,A]=u.useState(s??"feedback"),[S,I]=u.useState(r??""),[v,E]=u.useState(da),[R,_]=u.useState(!1),[D,O]=u.useState(!1),[T,w]=u.useState(!1),[C,j]=u.useState(!1),[k,M]=u.useState("diagnostics"),[F,B]=u.useState(null),[W,ne]=u.useState(null),[fe,z]=u.useState(null),[Y,te]=u.useState(null),[de,Q]=u.useState(0),q=u.useRef(de);u.useEffect(()=>{q.current=de},[de]);const[re,pe]=u.useState(!1),[Z,G]=u.useState(o),[xe,Se]=u.useState(l),Je=u.useRef(null),ee=EA({enabled:e}),Ne=S.trim().length>0,ot=Ne||ee.dataUrl!==null||F!==null,[dt,Ae]=u.useState(e);if(e!==dt&&(Ae(e),e)){j(!1),te(null);const J=i;if(!!(r||o||J)||!ot){const Re=s??"feedback",Ye=Ti(Re,g,!!o);A(Re),I(r??""),E(da()),_(!1),O(Ye.diagnostics),w(Ye.conversation),pe(!1),B(null),ne(null),G(o),Se(l),ee.reset(J),Q(Ve=>Ve+1)}else l!==xe&&(w(!1),Se(l))}function be(J){const ie=Ti(J,g,!!Z);O(ie.diagnostics),w(ie.conversation)}function yt(J){A(J),be(J)}function Oe(J){M(J),j(!0)}async function U(J){const ie=q.current,Re=MA(J),Ye=UA(J);W&&ee.dataUrl===W&&ee.clear(),ne(null),te("capturing");const Ve=await ee.captureElement(J);ie===q.current&&(te(null),B(Re),z(Ye),ne(Ve),A("bug"),re||be("bug"))}function ue(){W&&ee.dataUrl===W&&ee.clear(),B(null),ne(null)}function ke(){I(""),B(null),ne(null),pe(!1),G(void 0),ee.clear()}const Me=Ne&&!d&&!ee.isPreparing,qe=x?R||a==null?void 0:a.email:rl(v)?v.trim():void 0;async function Ee(){!Me||!await p({kind:y,message:S,...x?{}:{contact:v},includeDiagnostics:D,includeConversation:T,anonymous:R,...Z?{crashStack:Z}:{},...ee.dataUrl?{screenshotDataUrl:ee.dataUrl}:{},...F?{element:F}:{},...qe?{notifyEmail:qe}:{}})||(x||Ip(v),ke(),t(!1))}function Rt(J){J.preventDefault(),Ee()}function Vt(J){const ie=Je.current;ie&&(J.preventDefault(),ie.focus(),ie.setSelectionRange(ie.value.length,ie.value.length))}function Qt(J){J.key!=="Enter"||!(J.metaKey||J.ctrlKey)||J.nativeEvent.isComposing||C||(J.preventDefault(),Ee())}const $=ee.handlers,ye=Y!==null,N=F?fe:null,H=Nu(N),X=!!(F&&W&&ee.dataUrl===W),oe=!!ee.dataUrl&&!X,ve=!Ne&&(!!ee.dataUrl||F!==null);return n.jsxs(n.Fragment,{children:[ye&&n.jsx(sE,{phase:Y,onSelect:J=>void U(J),onCancel:()=>te(null)}),n.jsx(xt,{open:e&&!ye,onOpenChange:t,children:n.jsxs(bt,{...$,onKeyDown:Qt,desktopProps:{className:"max-w-md",onOpenAutoFocus:Vt},className:K("max-h-[85vh] !min-h-0",ee.isDraggingOver&&"ring-primary ring-2"),children:[n.jsxs(ht,{children:[n.jsx(tt,{className:"text-sm font-medium",children:"Send feedback"}),n.jsx(ft,{className:"text-muted-foreground text-xs",children:"Straight to the DorkOS team. Private."})]}),n.jsxs("form",{onSubmit:Rt,noValidate:!0,className:"flex min-h-0 flex-1 flex-col gap-4",children:[n.jsxs(St,{alignWithHeader:!0,className:"flex flex-col gap-4",children:[n.jsx(iE,{kind:y,onChange:yt}),n.jsxs("div",{className:K("dark:bg-input/30 flex flex-col rounded-lg border transition-[border-color,box-shadow] duration-150","focus-within:border-ring focus-within:ring-ring focus-within:ring-[3px]",ee.isDraggingOver&&"border-primary"),children:[n.jsx(We,{htmlFor:b,className:"sr-only",children:"Your message"}),n.jsx(Ap,{ref:Je,id:b,value:S,onChange:J=>I(J.target.value),placeholder:F?HA(N):lE[y],rows:4,maxLength:Ep,className:"min-h-24 resize-none rounded-lg border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent"}),(F||oe||ee.isPreparing||ee.isDraggingOver)&&n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-2.5 pb-2.5",children:[F&&n.jsx(Ii,{imageUrl:X?W??void 0:void 0,alt:`The part you pointed at: ${H}`,caption:H,pointed:!0,detail:F.selector,...X?{onOpen:()=>Oe("screenshot")}:{},onRemove:ue,removeLabel:WA(N)}),oe&&ee.dataUrl&&n.jsx(Ii,{imageUrl:ee.dataUrl,alt:"The screenshot you attached",onOpen:()=>Oe("screenshot"),onRemove:ee.clear,removeLabel:"Remove screenshot"}),(ee.isPreparing||ee.isDraggingOver)&&n.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-xs",children:ee.isDraggingOver?"Drop to attach":"Getting it ready…"})]}),n.jsx(rE,{showPictureTools:!0,isPreparing:ee.isPreparing,hasPointed:F!==null,hasWords:Ne,isMobile:!c,onCapture:()=>void ee.capture(),onPointAtElement:()=>te("picking"),onPick:J=>void ee.attach(J)})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-muted-foreground mr-0.5 text-xs",children:"Also send"}),n.jsx(Ri,{label:"Diagnostics",summary:"Version, window size, browser, and recent errors.",pressed:D,onPressedChange:J=>{pe(!0),O(J)},onPreview:()=>Oe("diagnostics")}),g&&n.jsx(Ri,{label:"This chat",summary:"Shows what led to the bug.",pressed:T,onPressedChange:J=>{pe(!0),w(J)},onPreview:()=>Oe("conversation")})]}),n.jsx(oE,{currentUser:a??null,anonymous:R,onToggleAnonymous:()=>_(J=>!J),contact:v,onContactChange:E})]}),n.jsx(cE,{needsWords:ve,canSend:Me,isSubmitting:d,onOpenGitHubIssue:()=>h(y==="idea"?"feature":"bug")})]}),n.jsx(ZA,{open:C,onOpenChange:j,initialTab:k,diagnostics:f(Z?{crashStack:Z}:void 0),kind:y,route:m,showConversation:g,sessionId:l,...ee.dataUrl?{screenshotDataUrl:ee.dataUrl}:{}})]})})]})}function uE(){const e=Sn(a=>a.open),t=Sn(a=>a.prefill),s=Sn(a=>a.openFeedback),r=Sn(a=>a.setOpen),o=Rp();return u.useEffect(()=>{const a=Tp();a&&s(a)},[s]),n.jsx(dE,{open:e,onOpenChange:r,initialKind:t.kind,prefillMessage:t.message,crashStack:t.crashStack,currentUser:o?{email:o.email,name:o.name}:null})}function mE(){const e=Pe();u.useEffect(()=>{var s,r,o;if(!((s=window.electronAPI)!=null&&s.onNavigate))return;const t=window.electronAPI.onNavigate(a=>{e({href:a})});return(o=(r=window.electronAPI).getPendingNavigate)==null||o.call(r).then(a=>{a&&e({href:a})}),t},[e])}function hE(){const{closeActive:e}=Ro();u.useEffect(()=>{const t=window.electronAPI;if(t!=null&&t.onCloseTab)return t.onCloseTab(()=>e())},[e])}function fE(){const[e,t]=u.useState(!1);return u.useEffect(()=>{var a,i,c;if(!((a=window.electronAPI)!=null&&a.onFullscreenChange))return;let s=!0,r=!1;const o=window.electronAPI.onFullscreenChange(d=>{r=!0,t(d)});return(c=(i=window.electronAPI).getFullscreenState)==null||c.call(i).then(d=>{s&&!r&&t(d)}),()=>{s=!1,o()}},[]),e}const Di="window-blurred";function pE(){u.useEffect(()=>{var a,i,c;if(!Dp||!((a=window.electronAPI)!=null&&a.onFocusChange))return;const e=document.documentElement,t=d=>{e.classList.toggle(Di,!d)};let s=!0,r=!1;const o=window.electronAPI.onFocusChange(d=>{r=!0,t(d)});return(c=(i=window.electronAPI).getFocusState)==null||c.call(i).then(d=>{s&&!r&&t(d)}),()=>{s=!1,o(),e.classList.remove(Di)}},[])}const gE="/channels";function xE(){Zv();const e=Op(),t=Bn(),s=e===gE&&!t.community?t.id??null:null,{data:r}=lc(s),{data:o}=Ds(),a=u.useMemo(()=>(o??[]).filter(rn).length,[o]);return{room:s&&r?r:null,unreadRoomCount:a}}function bE({unreadRoomCount:e}){Jj();const t=P(c=>c.isStreaming),s=P(c=>c.isWaitingForUser),r=Dn(c=>c.schedulesWaitingCount),o=Dn(c=>c.needsYouCount),a=_e({select:c=>c.location.href}),i=Ts(a);return by(c=>Mp(i,{...c,badgeCount:e+r,needsYou:s||o>0}),t),null}function yE(){const e=Ln(),t=$s(),s=le(),r=Pe(),o=u.useRef(null);u.useEffect(()=>{var d;if(!e||!t.data)return;const a=JSON.stringify([e.ownerKey,e.epoch]),i=((d=o.current)==null?void 0:d.owner)===a?o.current.rows:null,c=new Map(t.data.map(l=>[l.ref,{status:l.status,label:l.label,generation:ua(l.ref)}]));if(o.current={owner:a,rows:c},!!i)for(const[l,m]of i){if(m.status!=="connected")continue;const f=c.get(l);if((f==null?void 0:f.status)==="connected")continue;const p=hs(On().destination)===l,h=ua(l)>m.generation,g=f===void 0?"removed":"revoked";(h?Promise.resolve():_p(s,e,l,g)).then(()=>{p&&hs(On().destination)===l&&r({...je.home(),replace:!0})}),g==="revoked"&&ce(`This DorkOS can no longer reach ${m.label}.`,{description:"Still a member? Pick it in the sidebar switcher to reconnect."})}},[e,t.data,r,s])}function vE(){yE(),uv(),Pp()}function wE({isFullscreen:e}){return n.jsx("div",{className:K("desktop-darwin:block app-drag-region hidden shrink-0",!e&&"desktop-darwin:h-11"),"aria-hidden":"true"})}class jE extends u.Component{constructor(){super(...arguments);bn(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s,r){console.error("[Sidebar] Body contribution error:",s,r)}componentDidUpdate(s){s.contributionId!==this.props.contributionId&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?n.jsx("div",{"data-testid":"sidebar-body-error",className:"flex h-full items-center justify-center p-4",children:n.jsx("p",{className:"text-muted-foreground text-center text-sm",children:"This panel couldn’t load. Reload the page."})}):this.props.children}}const kE=5e3;function Au({testId:e,headline:t,detail:s}){const{isFetching:r,refetch:o}=Le({refetchInterval:kE});return n.jsx("div",{"data-testid":e,className:"bg-background text-foreground flex h-dvh flex-col items-center justify-center px-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center text-center",children:[n.jsx(Nt,{size:120,className:"mb-8 opacity-80 dark:hidden"}),n.jsx(Nt,{variant:"white",size:120,className:"mb-8 hidden opacity-80 dark:block"}),n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:t}),n.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:s}),n.jsx(L,{variant:"outline",className:"mt-6",onClick:()=>void o(),disabled:r,children:r?"Trying…":"Try again"})]})})}function SE(){return n.jsx(Au,{testId:"server-unreachable",headline:"DorkOS can’t reach its server",detail:"It may still be starting up. DorkOS keeps checking."})}const CE="onboarding";function NE({render:e}){const t=Lp(),s=Fp(),{view:r}=t,o=s.notice;return e({state:r.kind,pending:r.kind==="pending"?{userCode:r.userCode,verificationUri:r.verificationUri,...r.verificationUriComplete?{verificationUriComplete:r.verificationUriComplete}:{}}:null,starting:t.starting,startError:t.startError,start:()=>t.start({origin:CE}),cancel:t.cancel,openBilling:()=>s.open({page:"portal"}),billingPending:s.pending!==null,billingNotice:o===null?null:"message"in o?o.message:o.problem.detail??o.problem.title})}const AE={renderAccountLink:e=>n.jsx(NE,{render:e}),renderRuntimeConnect:nx,renderOtherService:({onSave:e})=>n.jsx(sx,{onSave:e})},EE="HOST_NOT_ALLOWED",Oi=240;function IE({status:e,message:t,code:s}){const r=s===EE&&t?t:void 0,o=r===void 0?`Your settings didn’t load (HTTP ${e}). DorkOS keeps trying.`:r.length>Oi?`${r.slice(0,Oi).trimEnd()}…`:r;return n.jsx(Au,{testId:"server-error",headline:"The server answered with an error",detail:o})}function RE(e){const t=e;return{...typeof(t==null?void 0:t.status)=="number"?{status:t.status}:{},...typeof(t==null?void 0:t.message)=="string"&&t.message.length>0?{message:t.message}:{},...typeof(t==null?void 0:t.code)=="string"&&t.code.length>0?{code:t.code}:{}}}let pr={at:0};function TE(e,t){return e>pr.at&&(pr=t==null?{at:e}:{at:e,...RE(t)}),e>on?pr:void 0}function DE(e){return e.state.dataUpdatedAt>on?!0:"always"}function OE(e){return!e}function ME(e){var t;return((t=e.at(-1))==null?void 0:t.pathname)??""}function _E({descriptors:e}){const t=e.reduce((s,r)=>s===null||r.priority>s.priority?r:s,null);return n.jsx(Xe,{mode:"wait",initial:!1,children:t&&n.jsx(se.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:[0,0,.2,1]},className:"shrink-0 overflow-hidden",children:t.render()},t.id)})}const PE=["memory-provider-status"],LE=6e4;function FE(){const e=ae(),{data:t}=Ie({queryKey:[...PE],queryFn:()=>e.getMemoryProviderStatus(),staleTime:LE,refetchOnWindowFocus:!0});return t}function $E(e){const t=new Map;for(const s of e){if(s.kind!=="signin.required")continue;const r=t.get(s.subject.id);(r===void 0||BE(s,r))&&t.set(s.subject.id,s)}return[...t.entries()].filter(([,s])=>s.outcome!=="cleared").map(([s])=>s)}function BE(e,t){return e.createdAt!==t.createdAt?e.createdAt>t.createdAt:e.id>t.id}function zE({configuredId:e,benched:t}){return n.jsxs(yl,{variant:"warning",children:["The ",n.jsx("span",{className:"font-medium",children:e})," memory"," ",t?"stopped answering":"isn’t set up",". DorkOS uses its own memory until you restart."]})}const UE="runtimes",KE=3;function HE({runtimes:e}){const{open:t}=rt(),s=$p();if(e.length===0)return null;const r=e.slice(0,KE).map(ol),o=e.length-r.length,a=e.length===1?`${r[0]} sign-in`:`${GE(r)} sign-ins`,i=o>0?`, and ${o} more`:"";return n.jsxs(yl,{variant:"critical",icon:Sr,actions:n.jsxs(n.Fragment,{children:[s&&n.jsx(WE,{runtimes:e,renderCreditsOffer:s}),n.jsx(L,{variant:"outline",size:"sm",onClick:()=>t(UE),children:"Sign in"})]}),children:["Your ",n.jsx("span",{className:"font-medium",children:a})," stopped working",i,". Agents and tasks wait until you sign in again."]})}function WE({runtimes:e,renderCreditsOffer:t}){var d;const s=ec(),{data:r}=nc(),o=!rx(),a=((d=Ic().data)==null?void 0:d.linked)===!0,i=Bp(a,Rc({enabled:a}).data),c=e.find(l=>zp(Up(s.data,l),r,l)==="lead");return c?n.jsxs(ln,{children:[n.jsx(dn,{asChild:!0,children:n.jsx(L,{size:"sm","data-testid":"signin-banner-credits",disabled:i===null,children:i===null?"DorkOS credits":`${i} DorkOS credits`})}),n.jsxs(un,{align:"end",className:"w-80 p-4",children:[n.jsxs(mn,{children:["Run ",ol(c)," on DorkOS credits"]}),n.jsxs("div",{className:"space-y-3",children:[t({runtime:c,origin:`signin-banner:${c}`,fullWidth:!0}),n.jsx(ox,{remote:o})]})]})]}):null}function GE(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}const Eu={critical:40,warning:30};function qE(){const e=FE();return!e||e.configuredId===e.activeId?null:{id:"memory-provider-benched",variant:"warning",priority:Eu.warning,render:()=>n.jsx(zE,{configuredId:e.configuredId,benched:e.benched})}}const YE={kinds:["signin.required"]};function VE(){const{notifications:e}=Kp(YE),t=u.useMemo(()=>$E(e),[e]);return t.length===0?null:{id:"runtime-signin",variant:"critical",priority:Eu.critical,render:()=>n.jsx(HE,{runtimes:t})}}function QE(e){const t=qE(),s=VE();return[t,s].filter(r=>r!==null)}function XE(){const e=Wn(),[t,s]=u.useState(!1),r=()=>{e.mutate({telemetry:{install:!1,heartbeat:!1,usage:!1,userHasDecided:!0}})},o=()=>{e.mutate({telemetry:{install:!0,heartbeat:!0,usage:!0,userHasDecided:!0}})};return n.jsxs(n.Fragment,{children:[n.jsxs(al,{children:[n.jsx(il,{children:"Share anonymous usage data?"}),n.jsx(cl,{children:"A daily ping, package installs and feature use. Never your prompts, code or files."})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n.jsx(bx,{open:t,onToggle:()=>s(a=>!a)}),n.jsx("a",{href:jr("/telemetry"),target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground text-xs font-medium underline underline-offset-2",children:"Full contract"})]}),t&&n.jsx(yx,{})]}),n.jsxs(ll,{className:"items-center gap-2 sm:justify-between",children:[e.isError?n.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save your choice. Try again."}):n.jsx("span",{"aria-hidden":!0}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(L,{variant:"outline",size:"sm",onClick:r,disabled:e.isPending,children:"Don’t share"}),n.jsx(L,{size:"sm",onClick:o,disabled:e.isPending,children:"Share anonymously"})]})]})]})}function JE(e){return e.everyAgentLevel!==void 0?e.everyAgentLevel!==null:e.everyAgent!==null}function ZE(e){const{data:t}=$x(),s=new Set(e),r=((t==null?void 0:t.connections)??[]).filter(a=>s.has(a.connectionId)&&JE(a)),o=new Map;for(const a of r)o.set(a.toolkit,(o.get(a.toolkit)??0)+1);return r.map(a=>{const i=Hp(a.toolkit);return{connectionId:a.connectionId,name:(o.get(a.toolkit)??0)>1?`${i} (${a.label})`:i}})}function e1({apps:e,onChooseAgents:t,disabled:s}){return n.jsxs("div",{className:"space-y-1 text-sm","data-testid":"trust-notice-shared-apps",children:[n.jsx("p",{className:"text-muted-foreground",children:"Shared with every agent:"}),n.jsx("ul",{className:"space-y-0.5",children:e.map(r=>n.jsxs("li",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{children:r.name}),n.jsx(L,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",disabled:s,"aria-label":`Choose agents for ${r.name}`,onClick:()=>t(r.connectionId),children:"Choose agents"})]},r.connectionId))})]})}const t1=el("/guides/permissions#what-changed"),n1=["Everything they do is recorded in Activity. Anyone can pause an agent.","Messages and code from strangers still need your yes."],s1="Agents ask first again. Shared apps stay shared; change them in Connections.";function r1(e){return e instanceof Error&&e.message||"Couldn’t save that. Try again."}function o1({onClose:e,sharedConnectionIds:t=[]}){return t.length>0?n.jsx(a1,{onClose:e,connectionIds:t}):n.jsx(Iu,{onClose:e,sharedApps:[]})}function a1({onClose:e,connectionIds:t}){return n.jsx(Iu,{onClose:e,sharedApps:ZE(t)})}function Iu({onClose:e,sharedApps:t}){const s=Pe(),r=Wn(),o=Ox({kind:"default"}),[a,i]=u.useState(!1),[c,d]=u.useState(null),l=a||r.isPending||o.isPending,m=async(h,g)=>{d(null),i(!0);try{h&&await o.mutateAsync({kind:"preset",preset:"careful",surface:"first-run"}),await r.mutateAsync({ui:{trustNoticeSeenAt:new Date().toISOString()}})}catch(x){d(r1(x)),i(!1);return}i(!1),h&&ce.success(t.length>0?s1:"Agents ask first again. Change it in Permissions."),e(),g==null||g()},f=h=>void s({...je.connections(),search:{app:h,who:"picked"}}),p=h=>{if(t.length>1){e(),f(h);return}m(!1,()=>f(h))};return n.jsxs(n.Fragment,{children:[n.jsxs(al,{children:[n.jsx(il,{"data-testid":"trust-notice",children:"Agents now work without asking"}),n.jsx(cl,{children:"They edit files, run commands, schedule work and use your connected apps on their own."})]}),n.jsx("div",{className:"text-muted-foreground space-y-2 text-sm",children:n1.map(h=>n.jsx("p",{children:h},h))}),t.length>0&&n.jsx(e1,{apps:t,onChooseAgents:p,disabled:l}),c&&n.jsx("p",{role:"alert",className:"text-destructive text-xs",children:c}),n.jsxs(ll,{className:"items-center gap-2 sm:justify-between",children:[n.jsx(Wp,{href:t1,className:"text-muted-foreground hover:text-foreground text-xs font-medium underline underline-offset-2",children:"What changed"}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(L,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:l,children:"Keep asking me"}),n.jsx(L,{size:"sm",onClick:()=>m(!1),disabled:l,children:"Got it"})]})]})]})}function i1(e){var s,r,o,a;return!e||!(((s=e.onboarding)==null?void 0:s.completedAt)!=null||((r=e.onboarding)==null?void 0:r.dismissedAt)!=null)||((o=e.ui)==null?void 0:o.trustNoticeSeenAt)!=null||e.callerRoute==="wifi"?!1:Bx((a=e.permissions)==null?void 0:a.preset)==="trusted"}const Ru={high:30,low:10};function c1(){var t;const{data:e}=Le();return(t=e==null?void 0:e.telemetry)!=null&&t.userHasDecided?null:{id:"telemetry-consent",priority:Ru.low,render:()=>n.jsx(XE,{})}}function l1(){const{data:e}=Le();return i1(e)?{id:"trust-notice",priority:Ru.high,render:({onClose:t})=>{var s;return n.jsx(o1,{onClose:t,sharedConnectionIds:((s=e==null?void 0:e.permissions)==null?void 0:s.sharedAtUpgrade)??[]})}}:null}function d1(){const e=l1(),t=c1();return P(r=>r.onboardingHiddenForSession)?[]:[e,t].filter(r=>r!==null)}function u1(e){return e.reduce((t,s)=>t===null||s.priority>t.priority?s:t,null)}function m1({onboardingOverlayVisible:e=!1}){const t=d1(),{data:s,dataUpdatedAt:r}=Le(),o=P(y=>y.momentShownThisLaunch),a=P(y=>y.markMomentShown),[i,c]=u.useState(null),[d,l]=u.useState(null),m=u.useRef(null),f=(s==null?void 0:s.onboarding)!=null&&(s.onboarding.completedAt!=null||s.onboarding.dismissedAt!=null),p=r>on,h=e||!p||!f,g=h?null:u1(t);i===null&&g!==null&&!o&&(c(g.id),l(g)),u.useEffect(()=>{i!==null&&a()},[i,a]);const x=!h&&i!==null&&t.some(y=>y.id===i),b=()=>c(null);return n.jsx(Gp,{open:x,onOpenChange:y=>{y||b()},children:d!==null&&n.jsx(qp,{ref:m,onOpenAutoFocus:y=>{var A;y.preventDefault(),(A=m.current)==null||A.focus()},children:d.render({onClose:b})},d.id)})}function h1(){const{approvals:e,isError:t,retry:s}=Yp(),{interactions:r}=Vp(),o=Qp(),a=Xp(e),{schedules:i}=Jp(),c=Zp(i),d=eg(r),l=dl(),m=Pe(),f=u.useMemo(()=>{const g=new Set([...e.map(x=>tg(x.approvalId)),...r.map(x=>ng(x.interaction.id))]);return l.filter(x=>x.kind!=="schedule-approval"&&!g.has(x.id))},[l,e,r]),p=e.length+r.length+i.length+f.length;return!t&&a.length===0&&r.length===0&&o.length===0&&c.length===0&&f.length===0?{slot:null,count:p}:{count:p,slot:n.jsxs("div",{"data-testid":"mobile-now-attention",className:"flex flex-col gap-2 px-2 pt-0.5 pb-1",children:[t&&n.jsx(sg,{onRetry:s}),(r.length>0||o.length>0)&&n.jsx(rg,{asks:r,agentNames:d,onOpenSession:g=>{m($t({session:g}))}}),a.length>0&&n.jsx(og,{approvals:a}),n.jsx(Xe,{initial:!1,children:c.map(g=>n.jsx(ag,{task:g},g.id))}),f.length>0&&n.jsx("div",{"data-testid":"mobile-now-rows",className:"flex flex-col",children:f.map(g=>n.jsx(Sb,{signal:g},g.id))})]})}}const Tu=[{id:"home",label:"Home",icon:ig,badged:!0,kind:"panel"},{id:"dorkbot",label:"DorkBot",icon:bo,badged:!1,kind:"action"},{id:"you",label:"You",icon:no,badged:!1,kind:"panel"}],Gr="calc(3.5rem + env(safe-area-inset-bottom))",ws=cg(e=>({panelUp:!1,raise:()=>e({panelUp:!0}),lower:()=>e({panelUp:!1})}));function Mi(){ws.getState().lower()}const f1=1e3;function p1(e){if(e!==0)return e===1?"1 agent needs you":`${e} agents need you`}function g1(e){const[t,s]=u.useState(""),r=u.useRef(t);return u.useEffect(()=>{const o=e??"";if(o===r.current)return;const a=setTimeout(()=>{r.current=o,s(o)},f1);return()=>clearTimeout(a)},[e]),t}function x1({current:e,needsYouCount:t,dorkBotReady:s,onSelect:r,label:o="Main"}){return n.jsx("nav",{"aria-label":o,"data-testid":"mobile-tab-bar",className:"bg-sidebar border-border/60 flex shrink-0 items-stretch border-t",style:{height:Gr,paddingBottom:"env(safe-area-inset-bottom)"},children:Tu.map(a=>{const i=a.icon,c=a.id===e,d=a.badged&&t>0?t:null,l=a.kind==="action"&&!s;return n.jsxs("button",{type:"button",onClick:()=>r(a.id),disabled:l,"aria-current":c?"page":void 0,"data-testid":`mobile-tab-${a.id}`,"data-mobile-tab":"",className:K("focus-ring text-2xs relative flex flex-1 flex-col items-center justify-center gap-0.5 transition-[color,background-color,scale] duration-150","active:bg-sidebar-accent motion-safe:active:scale-[0.96]",c?"text-sidebar-foreground font-semibold":"text-sidebar-foreground/70 hover:text-sidebar-foreground font-medium","disabled:pointer-events-none disabled:opacity-50"),children:[n.jsxs("span",{className:"relative",children:[n.jsx(i,{className:"size-5","aria-hidden":!0}),d!==null&&n.jsx("span",{"data-testid":`mobile-tab-badge-${a.id}`,"aria-hidden":!0,className:"text-3xs absolute -top-1.5 -right-2.5 min-w-4 rounded-full bg-amber-500 px-1 text-center leading-4 font-semibold text-amber-950 tabular-nums",children:d})]}),a.label]},a.id)})})}function _i({id:e,active:t,children:s}){return n.jsx("div",{id:`mobile-tab-panel-${e}`,"data-testid":`mobile-tab-panel-${e}`,"data-active":t?"":void 0,inert:!t,className:K("absolute inset-0",!t&&"invisible"),children:s})}function b1({takeover:e}){iu();const t=h1(),s=du(),r=cu(s),{ask:o,ready:a}=lg(),[i,c]=u.useState("home"),d=ws(g=>g.panelUp),l=ws(g=>g.raise),m=Gt();u.useEffect(()=>m.subscribe("onBeforeLoad",Mi),[m]),u.useEffect(()=>Mi,[]),u.useEffect(()=>(document.documentElement.style.setProperty("--mobile-tab-dock",Gr),()=>{document.documentElement.style.removeProperty("--mobile-tab-dock")}),[]);const f=u.useCallback(g=>{const x=Tu.find(b=>b.id===g);if(x!==void 0){if(x.kind==="action"){if(!a)return;c(g),o();return}c(g),l()}},[o,a,l]),p=t.count,h=g1(p1(p));return n.jsxs(Qc,{activeTarget:s.activeTarget,children:[n.jsxs("div",{"data-testid":"mobile-tab-panels",inert:!d,className:K("bg-background fixed inset-x-0 top-0 z-30",!d&&"pointer-events-none invisible"),style:{bottom:`calc(${Gr} + var(--pip-dock, 0px))`},children:[n.jsx(_i,{id:"home",active:i==="home",children:n.jsxs(ya,{width:"full",className:"px-3 py-2",children:[n.jsx(vu,{}),t.slot,e??n.jsx(gu,{model:r}),n.jsx(au,{})]})}),n.jsx(_i,{id:"you",active:i==="you",children:n.jsxs(ya,{width:"full",className:"px-3 py-4",children:[n.jsx("h1",{className:"text-foreground px-2 pb-2 text-sm font-semibold",children:"You"}),n.jsx(PN,{}),n.jsx(ul,{})]})})]}),n.jsx("span",{"data-testid":"mobile-needs-you-live-region","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:h}),n.jsx(x1,{current:d?i:null,needsYouCount:p,dorkBotReady:a,onSelect:f})]})}function y1(){const{open:e}=rt(),t=P(r=>r.setControlCenterOpen),s=Hs(()=>t(!1));return n.jsxs("section",{className:"@container flex flex-col gap-2","data-testid":"control-center-dial",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium",children:"Power"}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"What agents may do without asking you."})]}),n.jsx(vx,{surface:"control-center"}),n.jsxs(L,{variant:"ghost",size:"sm",className:"text-muted-foreground h-7 self-start px-2 text-xs",onClick:s(()=>e("permissions")),children:["Edit permissions",n.jsx(hn,{className:"size-3.5","aria-hidden":!0})]})]})}const Xt={unconfigured:"Use DorkOS from your phone. One-time setup.",off:"Use DorkOS from your phone or another computer.",starting:"Connecting…",stopping:"Turning off…",draining:"Closing…"};function v1(){var m,f;const e=zs(),t=mo(),s=P(p=>p.setRemoteAccessOpen),r=P(p=>p.setControlCenterOpen),a=Hs(()=>r(!1))(()=>s(!0)),i=e.isSetUp,c=e.state==="starting"||e.state==="stopping",d=e.hasServerReport;let l;return d?i?e.error!==null?l=n.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[n.jsx("span",{className:"text-destructive truncate",children:fl(e.error)}),n.jsx("button",{type:"button",onClick:a,className:"focus-ring text-foreground shrink-0 rounded-sm underline underline-offset-2",children:"Fix…"})]}):e.state==="blocked"?l=n.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[n.jsx("span",{className:"text-status-warning-fg truncate",children:((m=e.managed)==null?void 0:m.reason)??"Needs attention"}),n.jsx("button",{type:"button",onClick:a,className:"focus-ring text-foreground shrink-0 rounded-sm underline underline-offset-2",children:"Fix…"})]}):e.state==="connected"?l=`On · ${e.host??"connected"}`:e.state==="asleep"?l=e.host?`Closed for now · ${e.host}`:"Closed for now":e.state==="draining"?l=Xt.draining:e.state==="reconnecting"?l=e.host?`On · ${e.host} · reconnecting…`:"Reconnecting…":e.state==="starting"?l=Xt.starting:e.state==="stopping"?l=Xt.stopping:l=Xt.off:l=Xt.unconfigured:l=Xt.off,d&&((f=e.managed)!=null&&f.cloudStale)&&typeof l=="string"&&(l=`${l} · Can’t reach DorkOS Cloud`),n.jsx(ml,{label:"Remote access",description:n.jsx("span",{"data-testid":"remote-access-row-description",className:K("block min-w-0",c&&"motion-safe:animate-breath"),children:l}),children:n.jsx(hl,{checked:i&&e.isChecked,disabled:!d||i&&e.isTransitioning,"aria-label":"Remote access",onCheckedChange:p=>{if(!i){a();return}t.toggle(p)}})})}const w1=1,j1=10,k1=4;function S1(){var l,m;const{data:e}=Le(),t=Wn(),s=le(),{limits:r,setLimits:o}=dg(),a=Ks(),i=()=>void s.invalidateQueries({queryKey:Be.all}),c=((l=e==null?void 0:e.claudeCode)==null?void 0:l.persistentSession)??!0,d=((m=e==null?void 0:e.scheduler)==null?void 0:m.maxConcurrentRuns)??k1;return n.jsx(ug,{children:n.jsxs(mg,{children:[!a&&n.jsx(v1,{}),n.jsx(db,{}),n.jsx(ma,{label:"Limit automatic replies",description:(r==null?void 0:r.turnLimitsEnabled)===!1?"Agents reply to each other without limit until you press Stop.":n.jsxs(n.Fragment,{children:["Agents pause after a long back-and-forth."," ",n.jsxs(ba,{label:"About reply limits",children:[n.jsx("p",{children:"Your next message starts the count over."}),n.jsx("p",{children:"Set the numbers in Settings → Advanced → Room limits."})]})]}),checked:(r==null?void 0:r.turnLimitsEnabled)??!0,disabled:r===null,onCheckedChange:f=>o({turnLimitsEnabled:f})}),!a&&n.jsx(ma,{label:"Warm agents",description:n.jsxs(n.Fragment,{children:["Replies start about 4× faster. Each warm agent uses up to about 1 GB."," ",n.jsxs(ba,{label:"About warm agents",children:[n.jsx("p",{children:"Your agent stays running between messages."}),n.jsx("p",{children:"At most twelve agents stay warm at once."})]})]}),checked:c,disabled:t.isPending,onCheckedChange:f=>t.mutate({runtimes:{claudeCode:{persistentSession:f}}},{onSuccess:i})}),n.jsx(ml,{label:"Scheduled runs at once",description:"How many scheduled tasks run together.",children:n.jsx(wx,{value:d,min:w1,max:j1,"aria-label":"Scheduled runs at once",onCommit:f=>t.mutate({scheduler:{maxConcurrentRuns:f}},{onSuccess:i})})})]})})}const Pi="claude-code";function C1(){var R,_,D,O,T;const{data:e}=Le(),{data:t}=tc(),{sessions:s}=_c(),r=hg(),{data:o}=Ac(r),{data:a}=dx(),i=Mx(),c=i.data,d=oj(),l=ro(),{open:m}=rt(),{open:f}=xo(),p=to(),h=P(w=>w.setControlCenterOpen),g=Hs(()=>h(!1)),x=i.isError,b=t===void 0||e===void 0||c===void 0&&!x,y=e==null?void 0:e.executionDefaults,A=(y==null?void 0:y.runtime)??Pi,S=(R=t==null?void 0:t.capabilities[A])==null?void 0:R.permissionModes,I=((_=S==null?void 0:S.values.find(w=>w.id===S.default))==null?void 0:_.stop)??"ask",v=(y==null?void 0:y.trustStop)??I,E=[];if(!b){for(const C of(y==null?void 0:y.perRuntime)??[])C.trustStop===null||C.trustStop===v||E.push({key:`runtime:${C.runtime}`,kind:"runtime",name:it(C.runtime).label,detail:Vs(C.trustStop),onOpen:l?g(()=>m("runtimes")):null});for(const C of s){const j=(D=t==null?void 0:t.capabilities[C.runtime])==null?void 0:D.permissionModes,k=j==null?void 0:j.values.find(F=>F.id===C.permissionMode),M=k==null?void 0:k.stop;!M||M===v||E.push({key:`session:${C.id}`,kind:"session",name:C.title||"Untitled chat",detail:(k==null?void 0:k.label)??Qs(C.permissionMode),onOpen:l?g(()=>l($t({session:C.id,dir:C.cwd}))):null})}const w=((T=(O=t==null?void 0:t.capabilities[Pi])==null?void 0:O.permissionModes)==null?void 0:T.values)??[];for(const C of o??[]){const j=w.find(M=>M.id===C.permissionMode),k=j==null?void 0:j.stop;!k||k===v||E.push({key:`task:${C.id}`,kind:"task",name:C.displayName??C.name,detail:(j==null?void 0:j.label)??Qs(C.permissionMode),onOpen:l?g(()=>l({...je.tasks()})):null})}for(const C of a??[]){const j=w.find(M=>M.id===C.permissionMode),k=j==null?void 0:j.stop;!k||k===v||E.push({key:`binding:${C.id}`,kind:"binding",name:C.label||C.adapterId,detail:(j==null?void 0:j.label)??Qs(C.permissionMode),onOpen:l?g(()=>p({app:C.adapterId})):null})}}if(c){const w=new Map(c.areas.map(k=>[k.id,k.label])),C=new Map(c.areas.flatMap(k=>k.actions.map(M=>[M.id,M.title]))),j=k=>g(()=>f(k,"permissions"));for(const k of c.exceptions){const M=k.action?C.get(k.action)??k.action:w.get(k.area),F=_x[k.state];E.push({key:`agent-permission:${k.agentId}:${k.action??k.area}`,kind:"agent-permission",name:k.agentName,detail:`${M??k.area} ${F}`,why:{question:`Why is ${M??k.area} set to ${F} for ${k.agentName}?`,sentence:Px({state:k.state,source:k.action?"agent-action":"agent-area",preset:c.preset,agentName:k.agentName}),...k.lastChange?{lastChange:k.lastChange}:{}},onOpen:j(k.agentId),onReset:()=>d.mutate({agentId:k.agentId,key:k.action?{kind:"action",action:k.action}:{kind:"area",area:k.area},surface:"control-center"}),resetting:d.isPending})}for(const k of c.filesAndCommands.exceptions)E.push({key:`agent-permission:${k.agentId}:files`,kind:"agent-permission",name:k.agentName,detail:`Files & commands ${Vs(k.stop)}`,why:{question:`Why is Files & commands set to ${Vs(k.stop)} for ${k.agentName}?`,sentence:Lx(k.stop,"agent",k.agentName),...k.lastChange?{lastChange:k.lastChange}:{}},onOpen:j(k.agentId),onReset:()=>d.mutate({agentId:k.agentId,key:{kind:"files"},surface:"control-center"}),resetting:d.isPending})}return{rows:E,isEmpty:!b&&!x&&E.length===0,isResolving:b,permissionsUnreadable:x}}const N1={runtime:wb,session:pg,task:jo,binding:sc,"agent-permission":fg};function A1(){const{rows:e,isEmpty:t,isResolving:s,permissionsUnreadable:r}=C1();return n.jsxs("section",{className:"flex flex-col gap-2","data-testid":"control-center-overrides",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium",children:"Exceptions"}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"These skip the preset. Changing the preset leaves them alone."})]}),s?n.jsx("p",{className:"text-muted-foreground px-1 text-xs",children:"Checking…"}):t?n.jsx("p",{"data-testid":"overrides-ledger-empty",className:"text-muted-foreground px-1 text-xs",children:"Everything follows your preset. Chats open in other projects aren’t counted."}):n.jsx("ul",{className:"flex flex-col gap-0.5",children:e.map(o=>{const a=N1[o.kind];return n.jsxs("li",{className:"flex items-center gap-1",children:[n.jsxs("button",{type:"button","data-testid":`override-row-${o.kind}`,onClick:()=>{var i;return(i=o.onOpen)==null?void 0:i.call(o)},disabled:!o.onOpen,"aria-label":`${o.name}: ${o.detail}. Open.`,className:"focus-ring hover:bg-accent/60 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors disabled:pointer-events-none disabled:opacity-60",children:[n.jsx(a,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":!0}),n.jsx("span",{className:"min-w-16 flex-1 truncate",children:o.name}),n.jsx("span",{className:"text-muted-foreground min-w-0 truncate",children:o.detail}),n.jsx(hn,{className:"text-muted-foreground/60 size-3.5 shrink-0","aria-hidden":!0})]}),o.why?n.jsx(Fx,{question:o.why.question,sentence:o.why.sentence,...o.why.lastChange?{lastChange:o.why.lastChange}:{},className:"shrink-0 px-1"}):null,o.onReset?n.jsxs(L,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:o.resetting,"aria-label":`Reset ${o.name}: ${o.detail}`,onClick:o.onReset,children:[n.jsx(yc,{className:"size-3.5","aria-hidden":!0}),"Reset"]}):null]},o.key)})}),r?n.jsx("p",{"data-testid":"overrides-ledger-permissions-error",className:"text-muted-foreground px-1 text-xs",children:"Couldn’t load agents with their own permissions. See Settings → Permissions."}):null]})}function E1(){const e=Nl();return Al(e)?n.jsxs("p",{"data-testid":"control-center-keep-awake",className:"text-muted-foreground flex items-start gap-1.5 px-1 text-xs",children:[n.jsx(td,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),n.jsxs("span",{children:["Keeping this computer awake: ",El(e.working),"."]})]}):null}function I1(){return n.jsxs("div",{className:"flex flex-col gap-4","data-testid":"control-center-body",children:[n.jsx(y1,{}),n.jsx(S1,{}),n.jsx(A1,{}),n.jsx(E1,{})]})}function R1(){const e=P(r=>r.controlCenterOpen),t=P(r=>r.setControlCenterOpen),s=Fe();return n.jsxs(ln,{open:e,onOpenChange:t,modal:!0,autoFocus:!0,children:[n.jsx(dn,{asChild:!0,children:n.jsx("button",{type:"button","data-testid":"control-center-trigger","aria-label":"Control Center",className:"focus-ring text-muted-foreground hover:text-foreground inline-flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",children:n.jsx(ha,{className:"size-4","aria-hidden":!0})})}),n.jsxs(un,{side:"bottom",align:"end","aria-label":"Control Center",className:"w-96 max-w-[calc(100vw-1.5rem)] p-3",children:[!s&&n.jsxs("header",{className:"mb-3 flex items-center gap-2",children:[n.jsx(ha,{className:"text-status-success size-4 shrink-0","aria-hidden":!0}),n.jsx("h2",{className:"text-sm font-semibold",children:"Control Center"})]}),n.jsx(mn,{children:"Control Center"}),n.jsx(I1,{})]})]})}function T1(){const e=P(t=>t.toggleControlCenter);u.useEffect(()=>{const t=s=>{(s.metaKey||s.ctrlKey)&&s.shiftKey&&(s.key==="l"||s.key==="L")&&(s.preventDefault(),e())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}function D1(){const{isDesktop:e}=pl(),t="In use from the web";return e?n.jsx("p",{className:"text-sm font-medium",children:t}):n.jsx(mn,{className:"text-sm font-medium",children:t})}function O1(){const{presence:e,canEnd:t,end:s,ending:r,error:o}=jx(),[a,i]=u.useState(!1);return e!=null&&e.active?n.jsxs(ln,{open:a,onOpenChange:i,children:[n.jsx(dn,{asChild:!0,children:n.jsx("button",{type:"button","data-testid":"remote-session-indicator","aria-label":"In use from the web. Show details",className:"focus-ring text-muted-foreground hover:text-foreground inline-flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",children:n.jsx(gg,{className:"size-4","aria-hidden":!0})})}),n.jsxs(un,{side:"bottom",align:"end","aria-label":"In use from the web",className:"w-72 max-w-[calc(100vw-1.5rem)] space-y-3 p-3",children:[n.jsxs("div",{className:"space-y-0.5",children:[n.jsx(D1,{}),e.since&&n.jsxs("p",{className:"text-muted-foreground text-xs",children:["Someone is chatting here from the web. Started ",zn(e.since),"."]})]}),e.devices.length>0?n.jsx(kx,{devices:e.devices}):n.jsx("p",{className:"text-muted-foreground text-xs",children:"No device named yet."}),t?n.jsxs("div",{className:"space-y-1",children:[n.jsx(L,{variant:"outline",size:"sm",disabled:r,onClick:s,children:"End now"}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"This also pauses chat from the web."})]}):n.jsx("p",{className:"text-muted-foreground text-xs",children:"End it on the computer DorkOS runs on."}),o&&n.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o})]})]}):null}function M1(e,t){const s=u.useRef(null),[r,o]=u.useState(0);return u.useEffect(()=>{if(!t)return;const a=s.current;s.current=e,a!==null&&a!=="connected"&&e==="connected"&&o(i=>i+1)},[e,t]),r}function _1({url:e}){const t=lt();return n.jsxs("div",{"data-testid":"remote-access-qr",children:[n.jsx(se.div,{initial:t?!1:{clipPath:"inset(0 100% 0 0)"},animate:{clipPath:"inset(0 0% 0 0)"},transition:{duration:.2,ease:[0,0,.2,1]},children:n.jsx(xg,{url:e,size:168})}),n.jsx("p",{className:"text-muted-foreground mt-2 text-center text-xs",children:"Scan with your phone"})]})}function P1({url:e}){const{copied:t,failed:s,copy:r}=Fn();let o,a;return t?(o=n.jsx(cn,{className:"size-3.5"}),a="Copied"):s?(o=n.jsx(Ue,{className:"text-destructive size-3.5"}),a="Couldn’t copy"):(o=n.jsx(Zr,{className:"size-3.5"}),a="Copy link"),n.jsxs("div",{className:"bg-muted/40 rounded-lg border p-2.5","data-testid":"remote-access-link",children:[n.jsx("p",{className:"text-foreground truncate font-mono text-xs",title:e,children:e}),n.jsxs(L,{variant:"outline",size:"sm",className:"mt-2 w-full gap-1.5",onClick:()=>void r(e),children:[o,a]})]})}function L1(){const e=zs(),t=e.managed;if(!t)return null;const s=[];return t.alwaysAvailable&&s.push("Always available"),e.state==="asleep"&&s.push("Your address stays the same."),t.reason&&s.push(t.reason),t.cloudStale&&s.push("Couldn’t reach DorkOS Cloud. Showing the last known state."),s.length===0?null:n.jsx("div",{className:"text-muted-foreground space-y-1 text-xs","data-testid":"remote-access-managed-note",children:s.map(r=>n.jsx("p",{children:r},r))})}function F1({onClose:e}){const t=zs(),s=mo(),r=Fe(),o=P(f=>f.setRemoteAccessOpen),a=Hs(e),i=t.url,c=t.mode==="managed",d=i?n.jsx(P1,{url:i},"link"):null,l=i?n.jsx(_1,{url:i},"qr"):null,m=r?[d,l]:[l,d];return n.jsxs("div",{className:"flex flex-col gap-3","data-testid":"remote-access-panel",children:[!r&&n.jsxs("header",{className:"flex items-center gap-2",children:[n.jsx("span",{className:K("inline-block size-2 shrink-0 rounded-full",gl(t.state)),"aria-hidden":!0}),n.jsx("h2",{className:"text-sm font-semibold",children:xl(t.state)})]}),t.error!==null&&n.jsx("p",{role:"alert","data-testid":"remote-access-panel-error",className:"text-destructive text-xs",children:fl(t.error)}),c&&n.jsx(L1,{}),i===null&&t.state!=="asleep"&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Your link appears here when it’s ready."}),m,n.jsxs("div",{className:"flex items-center justify-between gap-3 pt-1",children:[n.jsx("span",{className:"text-muted-foreground text-sm",children:"Remote access"}),n.jsx(hl,{checked:t.isChecked,disabled:t.isTransitioning,"aria-label":"Remote access",onCheckedChange:f=>void s.toggle(f)})]}),n.jsx(L,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground -mx-1 justify-start",onClick:a(()=>o(!0)),children:"Manage…"})]})}function Du(e,t){return e==="starting"?"Remote access is connecting":e==="reconnecting"?"Remote access is reconnecting":e==="stopping"?"Remote access is turning off":e==="draining"?"Remote access is closing":e==="asleep"?t?`Remote access is closed for now at ${t}`:"Remote access is closed for now":t?`Remote access is on at ${t}`:"Remote access is on"}function $1(e,t){const s=e==="starting"||e==="asleep"&&!t?"Open remote access":"Show link and QR code";return`${Du(e,t)}. ${s}`}function B1(){const e=zs(),t=P(i=>i.remoteAccessBeaconOpen),s=P(i=>i.setRemoteAccessBeaconOpen),r=lt(),o=M1(e.state,e.hasServerReport);u.useEffect(()=>{!e.isLive&&t&&s(!1)},[e.isLive,t,s]);const a=e.isLive?Du(e.state,e.host):"";return n.jsxs(n.Fragment,{children:[n.jsx("span",{role:"status",className:"sr-only","data-testid":"remote-access-announcement",children:a}),e.isLive&&n.jsxs(ln,{open:t,onOpenChange:s,modal:!0,children:[n.jsx(dn,{asChild:!0,children:n.jsxs("button",{type:"button","data-testid":"remote-access-beacon","data-state-name":e.state,"aria-label":$1(e.state,e.host),className:K("focus-ring text-muted-foreground hover:text-foreground relative inline-flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",e.state==="reconnecting"&&"opacity-70"),children:[n.jsx(ds,{className:K("size-4",e.state==="starting"&&"motion-safe:animate-breath"),"aria-hidden":!0}),n.jsx("span",{"aria-hidden":!0,"data-testid":"remote-access-beacon-dot",className:K("border-background absolute right-0.5 bottom-0.5 size-1.5 rounded-full border",gl(e.state))}),o>0&&!r&&n.jsx("span",{"aria-hidden":!0,"data-testid":"remote-access-beacon-ripple",className:"animate-beacon-ripple border-status-success pointer-events-none absolute inset-0 rounded-full border"},o)]})}),n.jsxs(un,{side:"bottom",align:"end","aria-label":"Remote access",className:"w-72 max-w-[calc(100vw-1.5rem)] p-3",children:[n.jsx(mn,{children:xl(e.state)}),n.jsx(F1,{onClose:()=>s(!1)})]})]}),n.jsx(O1,{})]})}function z1({work:e}){const{isDesktop:t}=pl();return t?n.jsxs("p",{className:"text-sm font-medium",children:["Keeping awake: ",e]}):n.jsxs(mn,{className:"text-sm font-medium",children:["Keeping awake: ",e]})}function U1(){const e=Nl(),{open:t}=rt(),[s,r]=u.useState(!1);if(!Al(e))return null;const o=El(e.working);return n.jsxs(ln,{open:s,onOpenChange:r,children:[n.jsx(dn,{asChild:!0,children:n.jsx("button",{type:"button","data-testid":"keep-awake-beacon","aria-label":`Keeping this computer awake: ${o}. Show details`,className:"focus-ring text-muted-foreground hover:text-foreground inline-flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",children:n.jsx(td,{className:"size-4","aria-hidden":!0})})}),n.jsxs(un,{side:"bottom",align:"end","aria-label":"Keeping awake",className:"w-72 max-w-[calc(100vw-1.5rem)] space-y-2 p-3",children:[n.jsx(z1,{work:o}),n.jsx("p",{className:"text-muted-foreground text-xs",children:Sx}),n.jsx(L,{variant:"outline",size:"sm",onClick:()=>{r(!1),t(ga.tab,ga.section)},children:"Sleep settings"})]})]})}function K1(){const e=ae(),t=le();return Wt({mutationFn:s=>e.createAgent(s),onSuccess:()=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["mesh","agents"]}),t.invalidateQueries({queryKey:["mesh","agent-paths"]}),t.invalidateQueries({queryKey:["team"]})},meta:{errorLabel:"Couldn’t create that agent",isShownInline:s=>{var r;return((r=s.body)==null?void 0:r.code)==="template_needs_review"}}})}async function H1(e,t){try{return(await e.browseDirectory(t)).entries.some(r=>r.name===".dork")?"exists-has-dork":"exists-no-dork"}catch(s){const r=s instanceof Error?s.message:"";return r.includes("EACCES")||r.includes("permission")?"error":"no-path"}}function W1({step:e,templateName:t,seedDisplayName:s=null,faceSeed:r=null,runtimeSeed:o="claude-code"}){var de;const a=ae(),{data:i}=Ie({queryKey:Be.current(),queryFn:()=>a.getConfig(),staleTime:3e4}),c=((de=i==null?void 0:i.agents)==null?void 0:de.defaultDirectory)??"",[d,l]=u.useState(""),[m,f]=u.useState(!1),[p,h]=u.useState(""),[g,x]=u.useState(!1),[b,y]=u.useState(!1),[A,S]=u.useState(null),[I,v]=u.useState(""),[E,R]=u.useState(!1),[_,D]=u.useState(o),[O,T]=u.useState(s);s!==O&&(T(s),s&&(l(s),f(!1)));const[w,C]=u.useState(o);o!==w&&(C(o),D(o));const j=u.useMemo(()=>d?bg(d):"",[d]),k=u.useMemo(()=>j?yg(j):{valid:!1,error:void 0},[j]),M=d.length>0&&j.length>0&&!k.valid,F=p||(c&&j?`${c}/${j}`:""),B=e!=="naming"||!F?"idle":A!==null&&A.directory===F?A.status:"checking",W=d.length>0&&k.valid&&B!=="error",ne=u.useRef(null);u.useEffect(()=>{if(e!=="naming")return;const Q=t?!d||m?t.replace(/^@[^/]+\//,""):null:m?"":null;if(Q===null)return;const q=`${e}|${t??""}`;ne.current!==q&&(ne.current=q,l(Q),f(!!t))},[e,t]);const fe=u.useRef(null);u.useEffect(()=>{if(e!=="naming"||E||!r)return;const Q=`${e}|${r}`;fe.current!==Q&&(fe.current=Q,v(r))},[e,r]),u.useEffect(()=>{if(e!=="naming"||!F)return;const Q=F,q=setTimeout(()=>{H1(a,Q).then(re=>{S({directory:Q,status:re})})},500);return()=>clearTimeout(q)},[e,F,a]);function z(Q){l(Q),m&&f(!1)}function Y(Q){v(Q),R(!0)}function te(){ne.current=null,fe.current=null,l(""),f(!1),h(""),x(!1),y(!1),S(null),v(""),R(!1),D(o)}return{displayName:d,slug:j,handleNameChange:z,nameAutoFilled:m,slugValidation:k,showSlugError:M,defaultDirectory:c,resolvedDirectory:F,directoryOverride:p,setDirectoryOverride:h,directoryOpen:g,setDirectoryOpen:x,directoryPickerOpen:b,setDirectoryPickerOpen:y,conflictStatus:B,canSubmit:W,icon:I,setIcon:Y,runtime:_,setRuntime:D,reset:te}}function G1(e){var a;const t=(e==null?void 0:e.packageName)??null,{data:s,isError:r,error:o}=Ex(t,e!=null&&e.marketplace?{marketplace:e.marketplace}:void 0);return{schedules:((a=s==null?void 0:s.preview)==null?void 0:a.schedules)??[],isChecking:t!==null&&s===void 0&&!r,failed:t!==null&&r,...t!==null&&r&&Ix(o)&&{refusal:o},...s!=null&&s.disclosed&&s.contentHash?{approval:{approvedDisclosure:s.disclosed,approvedContentHash:s.contentHash},packageAgentName:s.manifest.name}:{}}}const q1={gallery:{title:"New agent",description:"What will your agent do?"},naming:{title:"Name your agent",description:"Give it a name and a face."},arrival:{description:"Add a ready-made agent."}},gr={keeper:["Keeper","Warden","Steward","Curator","Archivist","Ledger","Tally","Sorter"],scout:["Scout","Ranger","Pathfinder","Lookout","Recon","Probe","Tracer","Radar"],guardian:["Sentinel","Guardian","Aegis","Bastion","Vigil","Auditor","Gatekeep","Warden"],builder:["Forge","Smith","Builder","Mason","Wright","Maker","Anvil","Crafter"],scribe:["Scribe","Quill","Muse","Author","Penn","Bard","Editor","Note"],default:["Scout","Sage","Pilot","Beacon","Atlas","Nova","Ranger","Echo","Vera","Onyx"]},Y1=[["keeper",["board","organize","tidy","manage","linear","jira","project","backlog","task"]],["scout",["research","search","monitor","watch","discover","scan","find","intel","inbox","email","mail"]],["guardian",["review","security","audit","qa","test","lint","guard","protect","compliance"]],["builder",["build","code","scaffold","deploy","engineer","refactor","ci","release"]],["scribe",["doc","write","content","blog","summar","note","changelog","copy"]]];function V1(e){if(!e)return gr.default;const t=[e.name,e.description,e.category,...e.tags??[]].filter(Boolean).join(" ").toLowerCase();for(const[s,r]of Y1)if(r.some(o=>t.includes(o)))return gr[s];return gr.default}function Q1(e,t,s){if(e.length===0)return[];const r=Math.min(s,e.length),o=(t%e.length+e.length)%e.length;return Array.from({length:r},(a,i)=>e[(o+i)%e.length])}const X1=64,J1=16,Li=3;function Z1(e){return e.map(t=>t.replace(/[\u0000-\u001f\u007f]/g," ").replace(/\s+/g," ").trim().slice(0,X1)).filter(t=>t.length>0).slice(0,J1)}function eI(e){const t=Z1(e.capabilities??[]),s=t.length>0?`
|
|
77
|
+
|
|
78
|
+
Your declared abilities include: ${t.join(", ")}. Draw your first-action offer from these when it fits.`:"";return["You have just been created. This is your first moment awake — greet the person who made you.","",`Read your ${Zt.soul} to recall who you are, then, in 2 to 4 short sentences:`,"- Introduce yourself in your own voice, drawn from that persona.","- State plainly what your job is.","- Propose one concrete first action you could take — as an offer, and wait for their go-ahead.","",`Do NOT start any work yet — do not act on the project or change any files. (Reading your own ${Zt.soul} so you can introduce yourself is fine; anything beyond that waits for their go-ahead.) Just make the offer and let them decide. Speak warmly and directly to the person.`+s].join(`
|
|
79
|
+
`)}function tI(e){return[`You have just been created${e.displayName?` and named ${e.displayName}`:""}, and you do not have a job yet — the person who made you will define it with you, right now, in this conversation. This is your first moment awake, and by the end of it you will have written your own ${Zt.soul}.`,"","Run a short interview to discover who you should be, then capture it:","","1. Say a brief, warm hello (1 to 2 sentences) and ask them what they would like you to take care of. Do not assume a role yet.","",`2. Hold a SHORT interview. Ask AT MOST ${Li} questions in total across this whole conversation — this is a hard limit. Only ask what you genuinely need to write a good soul (typically the scope of the work, how often you should do it, and anything you must never touch). If their first answer already tells you enough, ask fewer. For a one-word or vague answer, ask a single clarifying question and then proceed with a reasonable role rather than interrogating them. If they say something like "just figure it out," do not push — propose a sensible role from what you have and move on. Never trap them in endless back-and-forth: once you have asked ${Li} questions, stop asking and write your best soul from what you learned.`,"","3. Before you write, tell them in one line what you understood and that you are about to capture it as your soul — so they see it coming. Then write it.","",`4. Write your ${Zt.soul} now, using your file-editing tools. It lives at \`.dork/${Zt.soul}\` in your working directory and already contains a "Personality Traits" block fenced by \`${vg}\` and \`${fa}\` — leave that fenced block exactly as it is. Replace only the prose BELOW the \`${fa}\` marker with your persona: who you are in your own voice, what you take care of, how you go about it, and the boundaries you keep. Keep it concise.`,"","5. After the file is written, confirm it in one or two sentences and propose ONE concrete first action you could take — as an offer, and wait for their go-ahead.","",`Do not start the actual job yet — your own ${Zt.soul} is the only file you touch now. Do not act on their project or run their work until they say go. Speak warmly and directly to the person throughout.`].join(`
|
|
80
|
+
`)}const nI={template:eI,"design-your-own":tI};function sI(e,t){return nI[e](t)}function rI(e,t){return Hx(sI(e,t))}const Ou="🤖",oI=["🤖","🦾","🧭","🛰️","📡","🔭","🗺️","🧠","🦉","🦊","🐝","🐙","🚀","⚡","🌟","🔮","🛠️","🔧","📊","📋","✅","🗂️","🔔","🛡️"];function Fi({face:e,title:t,subtitle:s,chips:r,variant:o,tabIndex:a,onSelect:i,onKeyDown:c,ref:d,"data-testid":l}){return n.jsxs("button",{ref:d,type:"button",tabIndex:a,onClick:i,onKeyDown:c,"data-gallery-card":"","data-testid":l,className:K("card-interactive group flex h-full flex-col gap-2 rounded-xl border p-4 text-left","focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",o==="design"?"border-primary/40 bg-primary/5 hover:border-primary/60 border-dashed":"bg-card hover:border-border/80 hover:shadow-md"),children:[n.jsx("span",{className:"text-3xl leading-none","aria-hidden":!0,children:e}),n.jsxs("div",{className:"space-y-0.5",children:[n.jsx("p",{className:"text-sm font-semibold",children:t}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s})]}),r&&r.length>0&&n.jsx("div",{className:"mt-auto flex flex-wrap gap-1 pt-1",children:r.map(m=>n.jsx("span",{className:"bg-muted text-muted-foreground text-2xs rounded-full px-2 py-0.5",children:m},m))})]})}function aI(e){return{source:e.source,name:e.name,displayName:bl(e),description:e.description,icon:e.icon,tags:e.tags,category:e.category,packageName:e.name,...e.marketplace?{marketplace:e.marketplace}:{}}}function iI(e){return e.tags&&e.tags.length>0?e.tags.slice(0,2):e.category?[e.category]:[]}function cI(e){const t=e.replace(/\/+$/,"");return t.split("/").pop()??t}function lI({onDesignYourOwn:e,onSelectTemplate:t,onImport:s}){const{data:r,error:o,isLoading:a}=wg(),i=Ml(a),[c,d]=u.useState(""),[l,m]=u.useState(!1),f=u.useMemo(()=>(r??[]).filter(h=>h.type==="agent"),[r]),p=wy(f.length+1);return n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{role:"group","aria-label":"Choose what your agent will do",className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"agent-gallery",children:[n.jsx(Fi,{ref:p.setRef(0),variant:"design",face:n.jsx(bo,{className:"text-primary size-7"}),title:"Design your own",subtitle:"Describe the job in your own words.",tabIndex:p.tabIndexFor(0),onSelect:e,onKeyDown:h=>p.handleKeyDown(h,0),"data-testid":"gallery-design-your-own"}),f.map((h,g)=>{const x=g+1;return n.jsx(Fi,{ref:p.setRef(x),variant:"template",face:h.icon??Ou,title:bl(h),subtitle:h.description??"A ready-made agent.",chips:iI(h),tabIndex:p.tabIndexFor(x),onSelect:()=>t(aI(h)),onKeyDown:b=>p.handleKeyDown(b,x),"data-testid":`gallery-template-${h.name}`},h.name)}),i&&f.length===0&&Array.from({length:2}).map((h,g)=>n.jsx(Pt,{className:"h-28 rounded-xl","data-testid":"gallery-skeleton"},g))]}),!i&&f.length===0&&n.jsx("p",{className:"text-muted-foreground text-center text-xs","data-testid":"gallery-templates-note",children:o?"Couldn’t load ready-made agents. Check marketplace sources in Settings.":"No ready-made agents yet. Add a marketplace source in Settings."}),n.jsxs(yo,{open:l,onOpenChange:m,children:[n.jsx(vo,{asChild:!0,children:n.jsxs("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","data-testid":"advanced-toggle",children:[n.jsx(qt,{className:K("size-3.5 transition-transform",l&&"rotate-180")}),"Build from a template URL"]})}),n.jsx(wo,{children:n.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[n.jsx(gt,{value:c,onChange:h=>d(h.target.value),placeholder:"github.com/org/repo","data-testid":"custom-url-input",className:"flex-1"}),n.jsx(L,{size:"sm",disabled:!c,onClick:()=>{const h=cI(c);t({source:c,name:h,displayName:jg(h)}),d("")},"data-testid":"custom-url-go",children:"Continue"})]})})]}),s&&n.jsx("div",{className:"border-t pt-3",children:n.jsxs("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 text-sm transition-colors","data-testid":"gallery-import-link",children:[n.jsx(kg,{className:"size-4"}),"Bring in an existing project folder",n.jsx("span",{"aria-hidden":!0,children:"→"})]})})]})}function dI({value:e,onChange:t}){return n.jsx("div",{role:"group","aria-label":"Choose a face",className:"flex flex-wrap gap-1.5","data-testid":"face-picker",children:oI.map(s=>{const r=s===e;return n.jsx("button",{type:"button","aria-label":`Face ${s}`,"aria-pressed":r,onClick:()=>t(s),className:K("flex size-9 items-center justify-center rounded-md border text-lg transition-colors","focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",r?"border-primary bg-primary/10":"hover:border-border hover:bg-accent border-transparent"),"data-testid":`face-${s}`,children:n.jsx("span",{"aria-hidden":!0,children:s})},s)})})}function uI({value:e,onChange:t}){return n.jsx("div",{role:"radiogroup","aria-label":"Runs on",className:"flex gap-1.5","data-testid":"runtime-picker",children:Sg.map(s=>{const r=it(s),o=r.icon,a=e===s;return n.jsxs("button",{type:"button",role:"radio","aria-checked":a,onClick:()=>t(s),className:K("flex flex-1 items-center justify-center gap-1.5 rounded-md border px-2 py-1.5 text-xs transition-colors","focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",a?"border-primary bg-primary/10 font-medium":"hover:border-border hover:bg-accent border-transparent"),"data-testid":`runtime-${s}`,children:[n.jsx(o,{size:14}),r.label]},s)})})}function mI({face:e,name:t,jobLine:s,capabilities:r,className:o}){const a=t.trim()||"Your agent",i=t.trim().length===0;return n.jsxs("div",{className:K("bg-card shadow-soft flex flex-col items-center gap-3 rounded-lg border p-5",o),"data-testid":"agent-preview",children:[n.jsx("span",{className:"bg-primary/10 flex size-16 items-center justify-center rounded-full text-3xl","aria-hidden":!0,children:e}),n.jsxs("div",{className:"space-y-1 text-center",children:[n.jsx("p",{className:K("text-lg font-semibold",i&&"text-muted-foreground"),"data-testid":"preview-name",children:a}),n.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s})]}),r.length>0&&n.jsx("div",{className:"flex flex-wrap justify-center gap-1.5","data-testid":"preview-capabilities",children:r.map(c=>n.jsx("span",{className:"bg-muted text-muted-foreground rounded-full px-2 py-0.5 text-xs",children:c},c))})]})}function Mu({schedules:e,checkFailed:t,testIdPrefix:s}){return n.jsxs(n.Fragment,{children:[e.length>0&&n.jsxs("div",{className:"flex items-start gap-2","data-testid":`${s}-package-schedules`,children:[n.jsx(jo,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Brings a schedule"}),n.jsx("dd",{className:"min-w-0 space-y-1",children:e.map((r,o)=>n.jsxs("p",{children:[n.jsx("span",{className:"font-medium",children:r.name}),": ",Rx(r)]},`${r.name}-${o}`))})]}),t&&n.jsxs("div",{className:"flex items-start gap-2","data-testid":`${s}-offer-check-failed`,children:[n.jsx(Gi,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Not checked"}),n.jsx("dd",{className:"min-w-0",children:"Couldn’t check for scheduled work. Anything it brings still needs your approval."})]})]})}const $i=4;function hI({form:e,suggestionPool:t,jobLine:s,previewCapabilities:r,onBack:o,onImportInstead:a,onCreate:i,isCreating:c,packageSchedules:d=[],offerCheckFailed:l=!1,isCheckingOffer:m=!1,offerRefusal:f,packageDirectory:p,templateReview:h,inheritance:g,isCheckingInheritance:x=!1}){const b=u.useRef(null),[y,A]=u.useState(0),S=e.displayName.trim().toLowerCase(),I=t.filter(_=>_.toLowerCase()!==S),v=Q1(I,y,$i);u.useEffect(()=>{const _=setTimeout(()=>{var D;return(D=b.current)==null?void 0:D.focus()},160);return()=>clearTimeout(_)},[]);const E=e.displayName.trim(),R=c?`Creating ${E||"your agent"}…`:`Create ${E||"agent"}`;return n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"space-y-5",children:[n.jsxs("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 text-xs transition-colors","data-testid":"naming-back",children:[n.jsx(Cc,{className:"size-3.5"}),"Choose a different agent"]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(We,{htmlFor:"agent-name",className:"text-sm",children:"Name"}),n.jsx(gt,{ref:b,id:"agent-name",placeholder:"Name your agent",value:e.displayName,onChange:_=>e.handleNameChange(_.target.value),"aria-invalid":e.showSlugError,"aria-describedby":e.showSlugError?"agent-name-error":void 0,className:"h-11 text-base"}),e.showSlugError&&n.jsx("p",{id:"agent-name-error",className:"text-destructive text-xs",role:"alert",children:e.slugValidation.error}),e.conflictStatus==="exists-has-dork"&&n.jsxs("div",{"data-testid":"conflict-status",children:[n.jsx("p",{className:"text-status-warning-fg text-xs font-medium",children:"This folder has a project"}),a&&n.jsx("button",{type:"button",className:"text-primary text-xs hover:underline",onClick:a,"data-testid":"import-instead-link",children:"Import it instead"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-muted-foreground text-xs",children:"Need a name?"}),n.jsx("button",{type:"button",onClick:()=>A(_=>_+$i),"aria-label":"Show other names",className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring rounded text-sm transition-colors focus-visible:ring-2 focus-visible:outline-none","data-testid":"suggestion-reroll",children:n.jsx("span",{"aria-hidden":!0,children:"🎲"})})]}),n.jsx("div",{className:"flex flex-wrap gap-1.5","data-testid":"name-suggestions",children:v.map(_=>n.jsx("button",{type:"button",onClick:()=>e.handleNameChange(_),className:"bg-muted hover:bg-accent focus-visible:ring-ring rounded-full px-2.5 py-1 text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none","data-testid":`suggestion-${_}`,children:_},_))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx(We,{className:"text-sm",children:"Face"}),!e.icon&&n.jsx("span",{className:"text-muted-foreground text-xs",children:"Picked for you if skipped"})]}),n.jsx(dI,{value:e.icon,onChange:e.setIcon})]}),n.jsxs(yo,{open:e.directoryOpen,onOpenChange:e.setDirectoryOpen,children:[n.jsx(vo,{asChild:!0,children:n.jsxs("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex w-full items-center gap-1 text-sm transition-colors","data-testid":"details-toggle",children:[n.jsx(qt,{className:K("size-4 transition-transform",e.directoryOpen&&"rotate-180")}),"Details",e.directoryOverride&&n.jsx("span",{className:"bg-primary/10 text-primary ml-1 rounded px-1.5 py-0.5 text-xs",children:"Custom"})]})}),n.jsx(wo,{children:n.jsxs("div",{className:"space-y-4 pt-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{className:"text-muted-foreground text-xs",children:"Runs on"}),n.jsx(uI,{value:e.runtime,onChange:e.setRuntime})]}),p?n.jsxs("div",{className:"space-y-1.5","data-testid":"package-directory",children:[n.jsx(We,{className:"text-muted-foreground text-xs",children:"Directory"}),n.jsx("p",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:p}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Kept in its package’s folder so updates reach it."})]}):n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(We,{htmlFor:"agent-directory",className:"text-muted-foreground text-xs",children:"Directory"}),n.jsx(Mb,{id:"agent-directory",placeholder:e.resolvedDirectory||(e.defaultDirectory?`${e.defaultDirectory}/…`:""),value:e.directoryOverride,onChange:e.setDirectoryOverride,onBrowse:()=>e.setDirectoryPickerOpen(!0),browseTestId:"browse-directory-button","data-testid":"directory-preview"}),e.conflictStatus==="no-path"&&n.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"conflict-status",children:"Creates a new folder"}),e.conflictStatus==="exists-no-dork"&&n.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"conflict-status",children:"That folder is already there. The project goes inside it."}),e.conflictStatus==="error"&&n.jsx("p",{className:"text-destructive text-xs","data-testid":"conflict-status",children:"Can’t open this folder. Pick another."})]}),!p&&e.slug&&!e.showSlugError&&n.jsxs("p",{className:"text-muted-foreground text-xs",children:["Folder name:"," ",n.jsx("code",{className:"bg-muted rounded px-1 py-0.5 font-mono text-xs",children:e.slug})]})]})})]})]}),n.jsxs("div",{className:"flex flex-col gap-4 self-start",children:[n.jsx(mI,{face:e.icon||Ou,name:e.displayName,jobLine:s,capabilities:r}),(d.length>0||l)&&n.jsx("dl",{className:"bg-muted/30 space-y-2.5 rounded-lg border p-3.5 text-sm",children:n.jsx(Mu,{schedules:d,checkFailed:l,testIdPrefix:"naming"})}),f!==void 0&&n.jsx(Tl,{error:f}),h,m&&n.jsx("p",{className:"text-muted-foreground text-center text-xs","data-testid":"naming-checking-offer",children:"Checking for scheduled work…"}),g,n.jsx(L,{size:"lg",onClick:i,disabled:!e.canSubmit||c||m||x||f!==void 0,"data-testid":"create-button",children:R})]})]})}function fI({seed:e,packageSchedules:t,isCheckingOffer:s,offerCheckFailed:r,offerRefusal:o,resolvedDirectory:a,canSubmit:i,isCreating:c,inheritance:d,isCheckingInheritance:l=!1,onCreate:m,onCustomize:f,onNotNow:p}){const{displayName:h,persona:g,runtime:x,capabilities:b,skills:y,schedule:A,icon:S}=e.template,I=it(x??"claude-code").label,v=h.trim().charAt(0).toUpperCase()||"?",E=S&&Nr(S)?S:v,R=e.sourceLabel?`Offered by ${e.sourceLabel}.`:"A ready-made agent.";return n.jsxs("div",{className:"mx-auto max-w-md space-y-6","data-testid":"arrival-confirm",children:[n.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[n.jsx("span",{className:"bg-primary/10 text-primary flex size-20 items-center justify-center rounded-full text-4xl font-semibold","aria-hidden":"true",children:E}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs(tt,{className:"text-xl",children:["Meet ",h]}),n.jsx(ft,{children:R})]})]}),g&&n.jsx("p",{className:"text-foreground text-sm leading-relaxed whitespace-pre-line",children:g}),n.jsxs("dl",{className:"bg-muted/30 space-y-2.5 rounded-lg border p-3.5 text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(pI,{runtime:x}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Runs on"}),n.jsx("dd",{children:I})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Ns,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Lives in"}),n.jsx("dd",{className:"min-w-0",children:a?n.jsx("code",{className:"text-xs break-all",children:a}):n.jsx(Pt,{className:"h-3.5 w-48 max-w-full rounded"})})]}),A&&n.jsxs("div",{className:"flex items-start gap-2","data-testid":"arrival-schedule",children:[n.jsx(jo,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Runs on a schedule"}),n.jsx("dd",{children:A})]}),n.jsx(Mu,{schedules:t,checkFailed:r,testIdPrefix:"arrival"}),b&&b.length>0&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Cx,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Can"}),n.jsx("dd",{children:b.join(", ")})]}),y&&y.length>0&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Cg,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsx("dt",{className:"text-muted-foreground shrink-0",children:"Uses skills"}),n.jsx("dd",{children:y.join(", ")})]})]}),o!==void 0&&n.jsx(Tl,{error:o}),n.jsxs("div",{className:"flex flex-col gap-2",children:[!i&&n.jsx("p",{className:"text-status-warning-fg text-center text-xs","data-testid":"arrival-needs-name",children:"Needs a name. Choose “Customize first” to add one."}),s&&n.jsx("p",{className:"text-muted-foreground text-center text-xs","data-testid":"arrival-checking-offer",children:"Checking for scheduled work…"}),d,n.jsx(L,{size:"lg",onClick:m,disabled:c||!i||s||l||o!==void 0,"data-testid":"arrival-create",children:c?"Creating…":`Create ${h}`}),n.jsxs("div",{className:"flex items-center justify-center gap-4",children:[n.jsx(L,{variant:"ghost",size:"sm",onClick:f,className:"text-muted-foreground","data-testid":"arrival-customize",children:"Customize first"}),n.jsx(L,{variant:"ghost",size:"sm",onClick:p,className:"text-muted-foreground","data-testid":"arrival-not-now",children:"Not now"})]})]})]})}function pI({runtime:e}){const t=it(e??"claude-code").icon;return n.jsx(t,{size:16,className:"text-muted-foreground shrink-0"})}function gI(e){const t=e==null?void 0:e.body;return(t==null?void 0:t.code)==="template_needs_review"?t.template:void 0}function xI(e,t){const s=e.replace(/\/*$/,"/");return t.filter(r=>r.path===e||r.path.startsWith(s))}function bI(e){return e.omitted==="link"?"A link. It isn’t copied into the agent.":e.omitted==="not-text"?`Not text (${e.bytes} bytes).`:`Too long to show (${e.bytes} bytes). Read it in the template first.`}function yI(e){const t=(e.settings??[]).filter(s=>s.omitted==="too-long"||s.omitted==="not-text");return t.length===0?"Create with these":t.length===1?`Create without seeing ${t[0].path}`:`Create without seeing ${t.length} files`}function vI(e){const{disclosed:t}=e;return[...e.findings.map(s=>({key:`finding:${s.path}`,label:s.path,detail:"Settings the agent loads: hooks, permission rules or servers.",files:xI(s.path,e.settings??[])})),...t.hooks.map((s,r)=>({key:`hook:${r}`,label:ut(s.command),detail:`Runs on ${s.event}${s.source?`, while ${ut(s.source)} is in use`:""}.`})),...(t.skillCommands??[]).map((s,r)=>({key:`command:${s.source}:${r}`,label:ut(s.command),detail:`Runs when skill “${ut(s.skill)}” is used (${ut(s.source)})`+(s.usesArguments?". Reads the text typed after it.":".")})),...t.mcpServers.map(s=>({key:`mcp:${s.name}`,label:s.command?Ag(s.command,s.args):ut(s.url??s.name),detail:`Starts the MCP server “${ut(s.name)}”.`})),...t.skillTools.map(s=>({key:`tools:${s.source}`,label:s.tools.map(ut).join(", "),detail:`Skill “${ut(s.skill)}” may use these without asking you.`}))]}function wI({template:e,onCreateAnyway:t,onCancel:s,isCreating:r}){return n.jsxs("div",{role:"alert",className:"space-y-3 rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-sm","data-testid":"template-review",children:[n.jsxs("p",{className:"flex items-center gap-2 font-medium text-amber-700 dark:text-amber-300",children:[n.jsx(Ng,{className:"size-4 shrink-0","aria-hidden":!0}),"This template brings things that run in your agent’s chats"]}),n.jsxs("p",{className:"text-muted-foreground text-xs [overflow-wrap:anywhere]",children:["From ",e.source,". Check each before you create the agent."]}),n.jsx("ul",{className:"space-y-2",children:vI(e).map(o=>{var a;return n.jsxs("li",{className:"text-xs",children:[n.jsx("code",{className:"bg-muted text-foreground block rounded px-1.5 py-1 font-mono [overflow-wrap:anywhere] whitespace-pre-wrap",children:o.label}),n.jsx("span",{className:"text-muted-foreground",children:o.detail}),(a=o.files)==null?void 0:a.map(i=>n.jsxs("details",{className:"mt-1","data-testid":"template-settings-file",children:[n.jsx("summary",{className:"text-muted-foreground hover:text-foreground cursor-pointer",children:i.path===o.label?"Show what it contains":`Show ${i.path}`}),i.content!==void 0?n.jsx("pre",{className:"border-border/60 bg-muted/40 mt-1 max-h-[50dvh] overflow-auto rounded border p-2 font-mono text-xs break-words whitespace-pre-wrap md:max-h-56",children:i.content}):n.jsx("p",{className:"text-muted-foreground mt-1",children:bI(i)})]},i.path))]},o.key)})}),n.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[n.jsx(L,{variant:"ghost",size:"sm",onClick:s,disabled:r,children:"Don’t create it"}),n.jsx(L,{size:"sm",onClick:t,disabled:r,className:"h-auto max-w-full py-1.5 text-left [overflow-wrap:anywhere] whitespace-normal",children:r?"Creating…":yI(e)})]})]})}function jI(){const{isOpen:e,seed:t,onCreated:s,close:r}=Cs(),o=en(z=>z.open),a=K1(),i=Pe(),[c,d]=u.useState("gallery"),[l,m]=u.useState(null),[f,p]=u.useState(!1);e!==f&&(p(e),e&&(m(null),d(t?"arrival":"gallery")));const h=t!=null&&t.template.icon&&Nr(t.template.icon)?t.template.icon:void 0,g=l!=null&&l.icon&&Nr(l.icon)?l.icon:h??null,x=(t==null?void 0:t.template.runtime)??"claude-code",b=(t==null?void 0:t.packageName)!==void 0?t:(l==null?void 0:l.packageName)!==void 0?{packageName:l.packageName,marketplace:l.marketplace}:null,y=G1(b),{data:A}=Le(),S=Ks()?void 0:k,I=b&&y.packageAgentName&&(A!=null&&A.dorkHome)?`${A.dorkHome}/agents/${y.packageAgentName}`:void 0,[v,E]=u.useState(null),R=W1({step:c,templateName:(l==null?void 0:l.displayName)??null,seedDisplayName:(t==null?void 0:t.template.displayName)??null,faceSeed:g,runtimeSeed:x}),_=V1(l?{name:l.name,description:l.description,category:l.category,tags:l.tags}:t?{name:t.template.displayName,description:t.template.persona}:void 0),D=l?l.description??"A ready-made agent.":t!=null&&t.template.persona?t.template.persona:"You’ll define the job together in your first chat.",O=l?l.tags??[]:(t==null?void 0:t.template.capabilities)??[];function T(){R.reset(),E(null),m(null),d("gallery")}const w=u.useCallback(z=>{m(z),d("naming")},[]),C=u.useCallback(()=>{m(null),d("naming")},[]);function j(){d(t?"arrival":"gallery")}function k(){r(),T(),o()}function M(z){var de;if(!R.canSubmit||a.isPending)return;const Y=(b==null?void 0:b.packageName)!==void 0&&y.approval?{package:{name:b.packageName,...b.marketplace?{marketplace:b.marketplace}:{},...y.approval}}:void 0,te=Y?void 0:(l==null?void 0:l.source)??(t==null?void 0:t.template.source);a.mutate({name:R.slug,displayName:R.displayName.trim()||void 0,runtime:R.runtime,...!Y&&R.directoryOverride?{directory:R.directoryOverride}:{},...R.icon?{icon:R.icon}:{},...Y??{},...te?{template:te}:{},...z?{approvedTemplateHash:z}:{},...t!=null&&t.template.persona?{persona:t.template.persona}:{},...(de=t==null?void 0:t.template.capabilities)!=null&&de.length?{capabilities:t.template.capabilities}:{}},{onSuccess:Q=>{const q=crypto.randomUUID(),re=Q.displayName??Q.name,pe=l||t?"template":"design-your-own";Eg.getState().register(q,{name:Q.name,displayName:re,agentId:Q.id,icon:Q.icon,color:Q.color,bornAt:Q.registeredAt,path:Q._path,runtime:Q.runtime,kickoffMessage:rI(pe,{displayName:re,capabilities:Q.capabilities})}),Db();const Z=s;if(r(),T(),Z){Z();return}i($t({agentId:Q.id,draft:"1",session:q,runtime:Q.runtime}))},onError:Q=>{const q=gI(Q);q&&E(q)}})}function F(z){z||(r(),T())}const B=Dl(e),W=n.jsx(Kv,{agentName:R.displayName||(t==null?void 0:t.template.displayName)||""}),ne=q1[c],fe=c==="gallery"?"max-w-6xl":c==="naming"?"max-w-5xl":"max-w-2xl";return n.jsx(xt,{open:e,onOpenChange:F,defaultFullscreen:!0,children:n.jsxs(bt,{className:"flex flex-col gap-0 p-0",children:["title"in ne&&n.jsxs(ht,{className:"shrink-0 border-b px-5 py-4",children:[n.jsx(tt,{children:ne.title}),n.jsx(ft,{children:ne.description})]}),n.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:ne.description}),n.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-6 sm:px-8",children:n.jsxs("div",{className:`mx-auto my-auto w-full ${fe}`,children:[n.jsx(Xe,{mode:"wait",children:n.jsxs(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[c==="gallery"&&n.jsx(lI,{onDesignYourOwn:C,onSelectTemplate:w,onImport:S}),c==="arrival"&&t&&n.jsx(fI,{seed:t,packageSchedules:y.schedules,isCheckingOffer:y.isChecking,offerCheckFailed:y.failed,offerRefusal:y.refusal,resolvedDirectory:I??R.resolvedDirectory,canSubmit:R.canSubmit,isCreating:a.isPending,inheritance:W,isCheckingInheritance:B.isPending,onCreate:()=>M(),onCustomize:()=>d("naming"),onNotNow:()=>F(!1)}),c==="naming"&&n.jsx(hI,{form:R,suggestionPool:_,jobLine:D,previewCapabilities:O,onBack:j,onImportInstead:S,onCreate:()=>M(),isCreating:a.isPending,packageSchedules:y.schedules,offerCheckFailed:y.failed,offerRefusal:y.refusal,isCheckingOffer:y.isChecking,packageDirectory:I,inheritance:W,isCheckingInheritance:B.isPending,templateReview:v?n.jsx(wI,{template:v,isCreating:a.isPending,onCreateAnyway:()=>M(v.contentHash),onCancel:()=>E(null)}):void 0})]},c)}),c!=="gallery"&&n.jsx(ub,{className:"mt-6"})]})}),n.jsx(ic,{open:R.directoryPickerOpen,onOpenChange:R.setDirectoryPickerOpen,initialPath:R.directoryOverride||R.defaultDirectory,onSelect:z=>{R.setDirectoryOverride(z),R.directoryOpen||R.setDirectoryOpen(!0)}})]})})}function kI({sessionId:e}){u.useEffect(()=>{var a;const r=kt.getState(),o=((a=r.sessions[e])==null?void 0:a.cwd)??r.statusCwds[e]??null;return is.pinSession(e,o),pa.getState().setPinnedSession(e),()=>{is.unpinSession(),pa.getState().setPinnedSession(null)}},[e]);const t=Ig(e),s=u.useMemo(()=>bb(t),[t]);return s===null?n.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-4 text-center text-sm",children:"No live widget in this chat"}):n.jsx(yb,{code:s.code,isIncomplete:s.isIncomplete,sessionId:e,isLatestMessage:s.isLatest,isStreaming:s.isStreaming},s.sourceMessageKey)}function SI({content:e}){return n.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-4 text-center text-sm",children:e.title})}const xr=64,CI={type:"spring",stiffness:480,damping:44};function NI({content:e,onRestore:t,onClose:s}){u.useEffect(()=>(document.documentElement.style.setProperty("--pip-dock",`${xr}px`),()=>{document.documentElement.style.removeProperty("--pip-dock")}),[]);const r=Lb();return js.createPortal(n.jsxs(se.div,{"data-slot":"pip-minibar",role:"complementary","aria-label":e.title,initial:{y:xr},animate:{y:0},exit:{y:xr},transition:CI,style:{bottom:`max(var(--mobile-tab-dock, 0px), ${r}px)`},className:"bg-background border-border shadow-elevated fixed inset-x-0 z-40 flex h-16 items-center border-t",children:[n.jsxs("button",{type:"button",onClick:t,className:"focus-ring flex h-full min-w-0 flex-1 items-center gap-3 px-4 text-left",children:[n.jsx("span",{className:"bg-primary size-2 shrink-0 animate-pulse rounded-full"}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title}),n.jsx(Sy,{className:"text-muted-foreground size-4 shrink-0"})]}),n.jsx("button",{type:"button","aria-label":"Close",onClick:s,className:"text-muted-foreground hover:bg-muted hover:text-foreground focus-ring mr-3 flex size-11 shrink-0 items-center justify-center rounded-md transition-colors",children:n.jsx(Ue,{className:"size-4"})})]}),document.body)}const Zn={peek:.5,expanded:.94},AI=.4,EI=800,Bi=500,br={type:"spring",stiffness:480,damping:44};function II({content:e,onClose:t,onMinimize:s,children:r}){const o=Xb(),a=Yb(),[i,c]=u.useState("peek"),d=Vl(),l=d.height,m=Math.max(0,window.innerHeight-d.top-d.height),f=Zn.expanded*l,p=(Zn.expanded-Zn.peek)*l,h=i==="expanded"?0:p;u.useEffect(()=>{a.start({y:h,transition:br})},[a,h]);const g=(b,y)=>{const A=h+y.offset.y,S=y.velocity.y,I=A-p,v=Zn.peek*l;if(I>AI*v||I>0&&S>EI){s();return}let E;S<-Bi?E="expanded":S>Bi?E="peek":E=A<p/2?"expanded":"peek",E===i?a.start({y:h,transition:br}):c(E)},x=b=>{b.target.closest("button")||o.start(b)};return js.createPortal(n.jsxs(se.div,{"data-slot":"pip-sheet",role:"complementary","aria-label":e.title,initial:{y:f},animate:a,exit:{y:f},transition:br,drag:"y",dragListener:!1,dragControls:o,dragConstraints:{top:0,bottom:f},dragElastic:.1,dragMomentum:!1,onDragEnd:g,style:{height:f,bottom:m},className:"bg-background border-border shadow-modal fixed inset-x-0 z-40 flex flex-col rounded-t-lg border-t",children:[n.jsxs("div",{onPointerDown:x,className:"cursor-grab touch-none select-none active:cursor-grabbing",children:[n.jsx("div",{className:"bg-muted mx-auto mt-4 h-2 w-[100px] rounded-full"}),n.jsxs("div",{className:"flex items-center justify-between gap-2 border-b pt-1 pr-[max(1rem,env(safe-area-inset-right))] pb-2 pl-[max(1rem,env(safe-area-inset-left))]",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e.title}),n.jsx("button",{type:"button","aria-label":"Minimize",onClick:s,className:"text-muted-foreground hover:bg-muted hover:text-foreground focus-ring flex size-11 shrink-0 items-center justify-center rounded-md transition-colors",children:n.jsx(qt,{className:"size-4"})}),n.jsx("button",{type:"button","aria-label":"Close",onClick:t,className:"text-muted-foreground hover:bg-muted hover:text-foreground focus-ring flex size-11 shrink-0 items-center justify-center rounded-md transition-colors",children:n.jsx(Ue,{className:"size-4"})})]})]}),n.jsx("div",{"data-slot":"pip-sheet-content",style:{marginBottom:h},className:"min-h-0 flex-1 overflow-y-auto pt-3 pr-[max(0.75rem,env(safe-area-inset-right))] pb-[max(0.75rem,env(safe-area-inset-bottom))] pl-[max(0.75rem,env(safe-area-inset-left))]",children:r})]}),document.body)}const zi=360,Ui=240,qr=16,yr={demo:SI,mcp_app:RI,widget:TI};function RI({content:e}){return n.jsx(Eb,{sessionId:e.sessionId,serverName:e.serverName,uri:e.uri,title:e.title,className:"h-full"})}function TI({content:e}){return n.jsx(kI,{sessionId:e.sessionId})}function DI(e){u.useEffect(()=>{},[e])}function Ki(){return{x:window.innerWidth-zi-qr,y:window.innerHeight-Ui-qr,width:zi,height:Ui}}function OI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _u(e){switch(e.kind){case"demo":{const t=yr.demo;return n.jsx(t,{content:e})}case"mcp_app":{const t=yr.mcp_app;return n.jsx(t,{content:e})}case"computer":return n.jsx(_b,{content:e});case"widget":{const t=yr.widget;return n.jsx(t,{content:e})}default:return e}}function MI({content:e,onClose:t}){const s=P(c=>c.pipGeometry),r=P(c=>c.setPipGeometry),[o,a]=u.useState(Ki);u.useEffect(()=>{if(s!==null)return;const c=()=>a(d=>{const l=Ki();return OI(d,l)?d:l});return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[s]);const i=u.useMemo(()=>s||((e==null?void 0:e.kind)!=="computer"?o:{...o,width:480,height:360,x:Math.max(0,window.innerWidth-480-qr),y:Math.max(0,window.innerHeight-360-80)}),[s,o,e==null?void 0:e.kind]);return n.jsx(Xe,{children:e!==null&&n.jsx(Py,{title:e.title,geometry:i,onGeometryChange:r,onClose:t,minWidth:e.kind==="computer"?360:void 0,minHeight:e.kind==="computer"?300:void 0,children:_u(e)},"pip-panel")})}function _I(){const e=P(d=>d.pipContent),t=P(d=>d.pipMinimized),s=P(d=>d.closePip),r=P(d=>d.minimizePip),o=P(d=>d.restorePip),a=P(d=>d.openPip),i=Fe();DI(a);const c=u.useRef(i);return u.useEffect(()=>{i&&!c.current&&e!==null&&r(),c.current=i},[i,e,r]),i?n.jsx(Xe,{children:e!==null&&(t?n.jsx(NI,{content:e,onRestore:o,onClose:s},"pip-minibar"):n.jsx(II,{content:e,onClose:s,onMinimize:r,children:_u(e)},"pip-sheet"))}):n.jsx(MI,{content:e,onClose:s})}const PI=new Set(["permission-prompt","question","schedule-approval"]),LI={"permission-prompt":"Needs your approval to go on.",question:"Has a question for you.","schedule-approval":"Wants to run on a timer."};function Pu(e){const t=dl(),s=Rg(),r=Dt(e),o=u.useRef(null);u.useEffect(()=>{var l,m,f,p;if(s)return;const a=new Map;for(const h of t)PI.has(h.kind)&&a.set(h.id,{id:h.id,who:h.primary,summary:LI[h.kind],deepLink:h.deepLink});const i=o.current;if(o.current=new Set(a.keys()),i===null)return;const c=[...a.values()].filter(h=>!i.has(h.id)),d=[...i].filter(h=>!a.has(h));c.length>0&&((m=(l=r.read()).onArrive)==null||m.call(l,c)),d.length>0&&((p=(f=r.read()).onDepart)==null||p.call(f,d,a.size))},[s,t,r])}function FI(){const{permission:e}=ob(),{prefs:t}=ab(),s=ro(),r=ze(),o=u.useRef(new Map),a=Dt(s),i=u.useCallback(()=>r||e!=="granted"||typeof document>"u"||!document.hidden?!1:typeof window<"u"&&typeof window.Notification<"u",[r,e]),c=u.useCallback((f,p,h,g)=>{let x;try{x=new Notification(p,{body:h,tag:f,silent:!0})}catch{return}x.onclick=()=>{var b;window.focus(),x.close(),o.current.delete(f),g!==null&&((b=a.read())==null||b({href:g}))},x.onclose=()=>{o.current.delete(f)},o.current.set(f,{notification:x,href:g})},[a]),d=u.useCallback(f=>{if(i())for(const p of f)c(p.id,`${p.who} needs you`,p.summary,p.deepLink)},[i,c]),l=u.useCallback(f=>{for(const p of f){const h=o.current.get(p);h!==void 0&&(h.notification.close(),o.current.delete(p))}},[]);Pu({onArrive:d,onDepart:l});const m=t.notifyOnTurnCompleteWhileAway;we("notification",f=>{const p=Tg.safeParse(f);if(!p.success)return;const h=p.data.notification;if(h.tier!=="notable"||!m||!i())return;const g=Dg(h),x=g===null?null:$I(g.to,g.search);c(h.id,h.title,h.body??"",x)}),u.useEffect(()=>{const f=o.current;return()=>{for(const{notification:p}of f.values())p.close();f.clear()}},[])}function $I(e,t){const s=new URLSearchParams;for(const[o,a]of Object.entries(t))a!=null&&s.set(o,String(a));const r=s.toString();return r===""?e:`${e}?${r}`}function BI(){const{play:e}=Wx(),t=u.useCallback(()=>{e("knock"),Gx()},[e]),s=u.useCallback((r,o)=>{o===0&&e("settle")},[e]);return Pu({onArrive:t,onDepart:s}),FI(),null}function zI(){const e=P(r=>r.shortcutsPanelOpen),t=P(r=>r.setShortcutsPanelOpen),s=Og();return n.jsx(xt,{open:e,onOpenChange:t,children:n.jsxs(bt,{className:"sm:max-w-md",children:[n.jsx(ht,{children:n.jsx(tt,{children:"Keyboard shortcuts"})}),n.jsx(St,{className:"space-y-6",children:s.map(({group:r,label:o,shortcuts:a})=>n.jsxs("div",{children:[n.jsx("h3",{className:"text-muted-foreground mb-2 text-xs font-medium tracking-wider uppercase",children:o}),n.jsx("div",{className:"space-y-1",children:a.map(i=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 text-sm",children:[n.jsx("span",{children:i.label}),n.jsx(Zc,{className:"inline-flex",children:Bt(i)})]},i.id))})]},r))})]})})}function UI(){const e=P(t=>t.toggleShortcutsPanel);u.useEffect(()=>{const t=s=>{const r=s.target,o=r.tagName==="INPUT"||r.tagName==="TEXTAREA"||r.isContentEditable;s.key==="?"&&!o&&(s.preventDefault(),e())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}const KI=15e3;function HI(){const e=_e({select:r=>r.location.pathname}),s=Rs("sidebar.body").find(r=>{var o;return(o=r.visibleWhen)==null?void 0:o.call(r,{pathname:e})});if(s){const r=s.component;return{key:`body:${s.id}`,body:n.jsx(jE,{contributionId:s.id,children:n.jsx(u.Suspense,{fallback:null,children:n.jsx(r,{})})}),direction:1,isTakeover:!0}}return{key:"dashboard",body:n.jsx(eN,{}),direction:-1,isTakeover:!1}}function WI(){const e=_e({select:t=>t.matches});return cj(e)}function GI(){const{sidebarOpen:e,setSidebarOpen:t}=P(),s=Fe(),r=ws(Z=>Z.panelUp),[o]=cc(),a=_e({select:Z=>Z.location.pathname}),i=_e({select:Z=>Z.location.searchStr}),c=new URLSearchParams(i),d=a==="/channels"&&!!c.get("community")&&!!c.get("id"),l=OE(lt()??!1),m=_e({select:Z=>ME(Z.matches)});hv();const[f]=Ms(),p=P(Z=>Z.isStreaming),{data:h}=fc(f),g=zc(h??null,f??""),{room:x,unreadRoomCount:b}=xE();vE(),xy({cwd:f,isStreaming:p,color:h?g.color:void 0}),UI(),sj(),eb(),T1(),tb(),qx(),Wj(),mE(),hE();const y=fE();pE(),yv(),Xk(),Dw(),Ow(),Mg(),Nx(),ew(),_g(),av(),ix(),yy(),Pg(),rj(),Lg(),h0(),zx();const A=P(Z=>Z.onboardingHiddenForSession),S=P(Z=>Z.setOnboardingHiddenForSession),{shouldShowOnboarding:I,isLoading:v,isOnboardingComplete:E,isOnboardingDismissed:R}=Yt(),_=vv({shouldShowOnboarding:I,onboardingHiddenForSession:A});jv({done:E||R,overlayVisible:_}),nj({blocked:_});const{dataUpdatedAt:D,errorUpdatedAt:O,error:T}=Le({refetchOnMount:DE}),w=D>on,C=O>on,j=TE(O,T),[k,M]=u.useState(!1);u.useEffect(()=>{if(w)return;const Z=setTimeout(()=>M(!0),KI);return()=>clearTimeout(Z)},[w]);const F=(j==null?void 0:j.status)===void 0,B=!w&&F&&(C||k),W=w||(j==null?void 0:j.status)===void 0?void 0:j,[ne,fe]=u.useState(!1);u.useEffect(()=>{if(!v)return;const Z=setTimeout(()=>fe(!0),3e3);return()=>clearTimeout(Z)},[v]);const z=u.useCallback(()=>S(!0),[S]),Y=HI(),{origin:te,originLabel:de}=Fg(o),{data:Q}=$g(o,{enabled:!1,select:Z=>Z.title}),q=WI(),re=u.useMemo(()=>({sessionId:o??void 0,agentName:h?$e(h):void 0,agentVisual:h?g:void 0,origin:te,originLabel:de,sessionTitle:Q,sessionDirectoryName:f?nl(f):void 0,room:x,teamViewMode:Bg(new URLSearchParams(i).get("view")??void 0)}),[o,h,g,te,de,Q,f,x,i]),pe=QE();return B?n.jsx(SE,{}):(W==null?void 0:W.status)!==void 0?n.jsx(IE,{status:W.status,message:W.message,code:W.code}):v&&!ne?n.jsx("div",{className:"bg-background h-dvh"}):n.jsxs(zg,{children:[n.jsx(bE,{unreadRoomCount:b}),n.jsxs(Hb,{reducedMotion:"user",children:[n.jsx(Xe,{mode:"wait",children:_?n.jsx(se.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-50",children:n.jsx(Wv,{onComplete:z,slots:AE})},"onboarding"):n.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"h-dvh",children:n.jsxs("div",{"data-testid":"app-shell",className:"bg-background text-foreground flex h-dvh flex-col",children:[n.jsxs(Ug,{open:e,onOpenChange:t,className:K("flex-1 overflow-hidden",s&&"min-h-0"),style:{"--sidebar-width":"calc(272px + 1rem)"},children:[!s&&n.jsxs(Kg,{variant:"inset",children:[n.jsx(wE,{isFullscreen:y}),n.jsx(vu,{}),n.jsx("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:n.jsx(Xe,{mode:"wait",initial:!1,custom:Y.direction,children:n.jsx(se.div,{"data-testid":"sidebar-body-swap",custom:Y.direction,initial:"enter",animate:"center",exit:"exit",variants:{enter:Z=>({x:`${Z*100}%`,opacity:0}),center:{x:0,opacity:1},exit:Z=>({x:`${Z*-100}%`,opacity:0})},transition:{duration:.2,ease:[.4,0,.2,1]},className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:Y.body},Y.key)})}),n.jsx(Hg,{className:"px-2 py-3",children:n.jsx(ul,{})}),n.jsx(Wg,{})]}),n.jsxs(Gg,{className:"overflow-hidden",inert:s&&r,children:[ze()&&n.jsx(Tj,{className:K("app-drag-region",!e&&!y&&"desktop-darwin:pl-20")}),n.jsxs("header",{className:"app-drag-region @container/bar relative flex h-9 shrink-0 items-center gap-1 border-b px-2 transition-[border-color] duration-300 lg:gap-2",children:[!s&&n.jsxs(n.Fragment,{children:[n.jsx(qg,{className:"-ml-0.5"}),n.jsx(Mj,{}),n.jsx(Yg,{orientation:"vertical",className:"mr-1 h-4"})]}),s&&n.jsx(_N,{}),n.jsx(Xe,{mode:"wait",initial:!1,children:q&&n.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},className:"flex min-w-0 flex-1 items-center gap-1 self-stretch lg:gap-2",children:n.jsx(Vg,{value:re,children:n.jsx(q.Header,{})})},q.key)}),n.jsx(R1,{}),n.jsx(B1,{}),n.jsx(U1,{}),n.jsx(Qg,{})]}),n.jsx(_E,{descriptors:pe}),n.jsx("main",{id:Nd,className:"flex-1 overflow-hidden pb-[var(--pip-dock,0px)]",children:n.jsxs(Xg,{direction:"horizontal",id:Tr,autoSaveId:Tr,children:[n.jsx(pc,{id:"main-content",order:1,minSize:30,defaultSize:100,children:n.jsx(se.div,{initial:l?{opacity:0}:!1,animate:{opacity:1},transition:l?{duration:.12,ease:"easeOut"}:{duration:0},"data-route-fade":l,className:"h-full",children:n.jsx(Jg,{})},m)}),n.jsx(ej,{pathname:a,isRemoteCommunityRoom:d})]})})]})]}),s&&n.jsx(b1,{takeover:Y.isTakeover?Y.body:null})]})},"main-app")}),n.jsx(hA,{}),n.jsx(m1,{onboardingOverlayVisible:_}),n.jsx(uE,{}),n.jsx(BN,{}),n.jsx(iA,{}),n.jsx(jI,{}),n.jsx(Rw,{}),n.jsx(zI,{}),n.jsx(Ly,{}),n.jsx(_I,{}),n.jsx(tx,{}),n.jsx(BI,{})]})]})}const kT=GI;export{kT as component};
|