dorkos 0.128.0 → 0.130.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 +766 -517
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-CmQERFxo.js → AboutPage-B2CzVj5W.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-Dw231W2w.js → ActivityErrorState-Dl-P-e0R.js} +1 -1
- package/dist/client/assets/{ActivityPage-DVfeyA9u.js → ActivityPage-CW7tqLHb.js} +1 -1
- package/dist/client/assets/ActivityRow-Vy4aXWk-.js +1 -0
- package/dist/client/assets/{AdapterIcon-NqCDzgCI.js → AdapterIcon-aabKVZmM.js} +1 -1
- package/dist/client/assets/AdapterSetupWizard-C5Hs0xkG.js +2 -0
- package/dist/client/assets/{AgentOptionRow-BRJfZo2y.js → AgentOptionRow-CqIMxq9S.js} +1 -1
- package/dist/client/assets/{AgentPicker-B7upjYRk.js → AgentPicker-C6mbTDJJ.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DXJnLk6q.js → AgentRequestCard-C8GV5Sxn.js} +4 -4
- package/dist/client/assets/AppearancePage-C0JKrHsO.js +1 -0
- package/dist/client/assets/{ApplyToOverridesDialog-C_QQhNIf.js → ApplyToOverridesDialog-DWEi0MNt.js} +1 -1
- package/dist/client/assets/AttentionSignalRow-Cpu0lKYg.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-G7vrCqeA.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-_zVrHu5s.js} +3 -3
- package/dist/client/assets/BindingDialog-4UeaJfUu.js +1 -0
- package/dist/client/assets/BlintzCanvas-DCXIQZM_.js +1231 -0
- package/dist/client/assets/{CanvasCsvContent-CtLpZnTs.js → CanvasCsvContent-D-0TuvVs.js} +4 -4
- package/dist/client/assets/CanvasFileContent-DqSx7lz9.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-zTx660yQ.js +2 -0
- package/dist/client/assets/ChannelComposer-D4TYVkvO.js +45 -0
- package/dist/client/assets/{ChatAppsOff-CCZUzDIH.js → ChatAppsOff-BzfyQc55.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-BCpYdhgZ.js → CodeMirrorDiff-BLWBYGLp.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BeCubxHV.js → CodeMirrorEditor-D0q3ETxK.js} +1 -1
- package/dist/client/assets/{CommitmentList-BZtfTnwg.js → CommitmentList-BoMiLsRe.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-DmurDgxV.js → CommitmentsPage-_7mNJVUZ.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-Bik6GLKp.js → ComputerResourceView-Bo2LaCJf.js} +1 -1
- package/dist/client/assets/{ComputerViewer-CksBDqdu.js → ComputerViewer-a4VSdAw_.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-Dvv0YO31.js +1 -0
- package/dist/client/assets/{ConnectionsPage-Cgg36gDY.js → ConnectionsPage-oO8pNgbc.js} +2 -2
- package/dist/client/assets/{ConventionPage-CNhpF6Z1.js → ConventionPage-CFJjwhBd.js} +2 -2
- package/dist/client/assets/{ExtensionPageRoute-C2zue_Pw.js → ExtensionPageRoute-BqZN9q7M.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-3v1TfY1P.js → FloatingTanStackRouterDevtools-CqogiFob-CnSp2ZEM.js} +1 -1
- package/dist/client/assets/{ForwardConsentHost-Mbo0D-zk.js → ForwardConsentHost-4LhRvCdu.js} +1 -1
- package/dist/client/assets/HandlePage-BjoYPqme.js +1 -0
- package/dist/client/assets/HeartbeatPage-rJzICayy.js +1 -0
- package/dist/client/assets/{KeyEntry-C43vkwpA.js → KeyEntry-BTTuXleL.js} +1 -1
- package/dist/client/assets/{LexicalField-iAHcvRmI.js → LexicalField-Dk_SDrjk.js} +1 -1
- package/dist/client/assets/{ManagesPage-BUIJvLmv.js → ManagesPage-Cvu3CQDn.js} +1 -1
- package/dist/client/assets/Marketplace-DPjPPlZz.js +36 -0
- package/dist/client/assets/{MarketplaceSourcesView-BZODwhxu.js → MarketplaceSourcesView-ChCys0on.js} +1 -1
- package/dist/client/assets/{McpAppFrame-D15nxVaI.js → McpAppFrame-DNamtzOp.js} +2 -2
- package/dist/client/assets/{McpSigninBody-DmBxqgxN.js → McpSigninBody-DLw3ZdZE.js} +1 -1
- package/dist/client/assets/{Model3dViewer-RGXeJd6a.js → Model3dViewer-IwCBCPZ2.js} +1 -1
- package/dist/client/assets/NamePage-FY_D0eA2.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-BB0gvClR.js +1 -0
- package/dist/client/assets/{NotificationsPage-NRfyiinS.js → NotificationsPage-aCF0AtqL.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-CgQ6uefo.js → OpenMeshSwitch-DjCWF2Vy.js} +2 -2
- package/dist/client/assets/OperatorIdentityForm-Bcveds6f.js +1 -0
- package/dist/client/assets/{PermissionHistory-DPEPq8D9.js → PermissionHistory-CYsxFYmV.js} +1 -1
- package/dist/client/assets/{PermissionsPage--k-xutbJ.js → PermissionsPage-sxHkY92V.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-DMMptmPS.js → PersonalityPopover-BZ20JTnJ.js} +1 -1
- package/dist/client/assets/PhotoPage-KBzkb0sT.js +1 -0
- package/dist/client/assets/PreviewRefusedNotice-BFQPYcUG.js +1 -0
- package/dist/client/assets/{ProfileFields-DbPJ7fvN.js → ProfileFields-sp17IFo8.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-CzwhrIlw.js → ProfilePanelContainer-mA44jh5A.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-CZEXvlJm.js → ProfileRolePicker-Chh4_ZMB.js} +1 -1
- package/dist/client/assets/PromptSuggestionChips-CEi_-fHF.js +1 -0
- package/dist/client/assets/{ReportsToPopover-YOwGLJy5.js → ReportsToPopover-D1uknwnk.js} +1 -1
- package/dist/client/assets/RoomSurface-Clf1yLrr.js +1 -0
- package/dist/client/assets/{RoomsPage-CoXjZMWL.js → RoomsPage-BtCNzvhQ.js} +1 -1
- package/dist/client/assets/RunsOnPopover-LCvBpe9J.js +1 -0
- package/dist/client/assets/RuntimeConnectFlow-C5UDeHUC.js +1 -0
- package/dist/client/assets/RuntimeSetupDialog-Bqh67Vqb.js +1 -0
- package/dist/client/assets/{SeenDevices-Bh2yh-PW.js → SeenDevices-DvCfdeDo.js} +3 -3
- package/dist/client/assets/{SessionsPage-CFvkbT9X.js → SessionsPage-DLByE-re.js} +1 -1
- package/dist/client/assets/SettingsDialog-Co-Oxtyw.js +12 -0
- package/dist/client/assets/SkillsPage-Cc79IstM.js +1 -0
- package/dist/client/assets/TaskDialogWrapper-DuYV7Zch.js +1 -0
- package/dist/client/assets/TasksEmptyState-CfmPtBra.js +3 -0
- package/dist/client/assets/{TasksPage-D0Zi6Mve.js → TasksPage-DGk0zUhO.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CY9eLVad.js → TeamComputerEntry-CLHbeX5i.js} +1 -1
- package/dist/client/assets/{ToolsPage-0_vx5P-F.js → ToolsPage-CSkDE7rZ.js} +2 -2
- package/dist/client/assets/{TopologyGraph-DUZLZZrB.js → TopologyGraph-pBC37k5P.js} +14 -14
- package/dist/client/assets/TourHost-CS9RsLj_.js +1 -0
- package/dist/client/assets/{UnlinkDialog-ptZy3IN4.js → UnlinkDialog-CelhOUZ0.js} +1 -1
- package/dist/client/assets/{UnreadDivider-Ckey1IWn.js → UnreadDivider-B_OMR0mQ.js} +1 -1
- package/dist/client/assets/WidgetErrorCard-CsMqCyCb.js +108 -0
- package/dist/client/assets/{WithheldExtensionsNotice-7Vu1Jctn.js → WithheldExtensionsNotice-GiKb0iQu.js} +1 -1
- package/dist/client/assets/WorkQueuePage-Cu721KyM.js +1 -0
- package/dist/client/assets/WorkView-CpWEaxMr.js +51 -0
- package/dist/client/assets/_shell-CmGG8Ysk.js +80 -0
- package/dist/client/assets/{_shell._home-BRIXhYLg.js → _shell._home-BnKkAeSp.js} +1 -1
- package/dist/client/assets/_shell._home.activity-DaaLJbvO.js +1 -0
- package/dist/client/assets/_shell._home.index-CNPasFxP.js +3 -0
- package/dist/client/assets/_shell._home.tasks-DXEOJ5Nq.js +1 -0
- package/dist/client/assets/_shell._home.workspaces-UeSvmquR.js +1 -0
- package/dist/client/assets/{_shell.channels-Bx6q9xVH.js → _shell.channels-NUbf5mcb.js} +4 -4
- package/dist/client/assets/_shell.connections-BEns4DKb.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-DFznTGbN.js → _shell.feedback-requests-NyjHNdnj.js} +2 -2
- package/dist/client/assets/_shell.marketplace-BEYqsDKe.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-D6Ls30FY.js +1 -0
- package/dist/client/assets/_shell.session-CVc6i3eN.js +1 -0
- package/dist/client/assets/{_shell.team-DmA09abY.js → _shell.team-CXeOt4XD.js} +6 -6
- package/dist/client/assets/_shell.threads-BYdN1UtZ.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-DtJYSfvG.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DtJYSfvG.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-DxgtVd9I.js → abnfDiagram-WEYOIA3C-BLCVDt6M.js} +1 -1
- package/dist/client/assets/{access-copy-Dqct36mi.js → access-copy-BSQ3QECN.js} +1 -1
- package/dist/client/assets/{arc-C-67Ef0p.js → arc-t4OhsI5R.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-B7TjdT-_.js → architectureDiagram-ZHVYKT53-BcIfbGZR.js} +1 -1
- package/dist/client/assets/{banner-C9qTs6-C.js → banner-B6xfuDA7.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-DNqxJ3Ww.js → blockDiagram-RJAE7QA3-DTOlrcEZ.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-D3jNLV0j.js → c4Diagram-XDPPPE54-CHGqwaxa.js} +1 -1
- package/dist/client/assets/channel-CSk6LhO2.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-C6OKx0ty.js → chunk-2E7WHVMD-Bh4L_7yX.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-Dr_6hHrZ.js → chunk-2Q5K7J3B-BmouLl8r.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-CSrZVDEt.js → chunk-4EMNKR2T-BVhtiAdG.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-CIazeRXO.js → chunk-55XCU76K-BdbLnE56.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-C8IJ3zTR.js → chunk-5VM5RSS4-Qg9lQpPO.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-D9DGXb79.js → chunk-JWPE2WC7-CfIrQaMW.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-B0LNYdif.js → chunk-VQ5W62QI-BP9oQzc0.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C7IAIbvZ.js → chunk-XXDRQBXY-DKzIjnsB.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-C79hvjlu.js → chunk-ZCHMQSOR-DsvG6BGY.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-0Di1C2ZB.js → classDiagram-v2-4MYWR3UA-BSiSmGgP.js} +1 -1
- package/dist/client/assets/{command-BVQb6I3_.js → command-B_FPXirc.js} +1 -1
- package/dist/client/assets/copy-button-Bp75zBSh.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-rZumaV4b.js → cose-bilkent-JH36ORCC-CXgyrZix.js} +1 -1
- package/dist/client/assets/{cpu-DeRuDMl4.js → cpu-DpkNIYeK.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-CI9l9xhM.js → cynefin-EF2NZ3EQ-DkmPO3hK.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-C8CdorJJ.js → cynefinDiagram-WF24UDRP-BDknJT17.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-AHpsTq1O.js → dagre-NK4GIZVX-BR4J5E3b.js} +1 -1
- package/dist/client/assets/detail-row-C8zz6mAC.js +1 -0
- package/dist/client/assets/{diagram-CBK3MWTC-BpPLL30n.js → diagram-CBK3MWTC-CvLKqPry.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-D6loMn3G.js → diagram-I5XIIV2D-CVtE60X9.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-BaGNd5eN.js → diagram-ODIL2UCW-B--CpfLk.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-BnDdKu_g.js → diagram-PFBEJUXE-08gch1t1.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-UXagB0_c.js → diagram-RJA3I4VV-C2e-ubaD.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-C-whBP-S.js → diagram-TYUNFSNR-DcpK4OXX.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BbG481iS.js → ebnfDiagram-V4P3TTPT-DM44BkBt.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-FtssIxOc.js → elk-QONTBCTQ-maYS1Zzm.js} +1 -1
- package/dist/client/assets/{empty-state-CACt-76q.js → empty-state-HtOTBAoq.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-PpFgUf4C.js → erDiagram-KYQIGQAA-BR7z9r2M.js} +1 -1
- package/dist/client/assets/{execution-config-CGL73sRn.js → execution-config-DYYeJyJh.js} +1 -1
- package/dist/client/assets/{file-D80JE_L0.js → file-VtGYNr9E.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-CcJ_e4_m.js → file-exclamation-point-eBlQssyW.js} +1 -1
- package/dist/client/assets/{file-text-Ds9edaTZ.js → file-text-DvNAxTGZ.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-BtqFMP_f.js → find-latest-widget-fence-C2qXvASs.js} +5 -5
- package/dist/client/assets/{flowDiagram-IUGLLWBU-BIva66g9.js → flowDiagram-IUGLLWBU-DiuMtMbj.js} +1 -1
- package/dist/client/assets/form-CGIIzr1u.js +1 -0
- package/dist/client/assets/{format-cron-BpGrgPLu.js → format-cron-BzJ6ekoo.js} +1 -1
- package/dist/client/assets/format-tokens-DymkROvy.js +1 -0
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-CZqips_4.js → ganttDiagram-R7GPNTJY-Cf_z8Ri1.js} +1 -1
- package/dist/client/assets/{git-branch-B8JNwQ6q.js → git-branch-BVzjBPW-.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DoIc3lda.js → gitGraphDiagram-PDYL7XHY-RZXACCBr.js} +1 -1
- package/dist/client/assets/{graph-yizM0vwL.js → graph-DfAV_ObD.js} +1 -1
- package/dist/client/assets/{heart-BavUIV45.js → heart-BMOCYMFT.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CGr3AgaU.js → highlighted-body-KPVGNVTW-DrrsaKBc.js} +1 -1
- package/dist/client/assets/image-lightbox-tAwBNBhm.js +1 -0
- package/dist/client/assets/{image-off-C1uTDs9-.js → image-off-BpagBHk1.js} +1 -1
- package/dist/client/assets/{index-CrTmY12y.js → index-0uCJUW_h.js} +2 -2
- package/dist/client/assets/index-0y0K3rYv.js +1 -0
- package/dist/client/assets/{index-CJXMgnYp.js → index-2GjydAcS.js} +1 -1
- package/dist/client/assets/index-6dsaPQ7-.js +1 -0
- package/dist/client/assets/{index-X282DRZf.js → index-7-yzdcAx.js} +3 -3
- package/dist/client/assets/{index-C8ZpJXTQ.js → index-A7HgzxSw.js} +1 -1
- package/dist/client/assets/{index-DW4KUPHp.js → index-BEqKTiCR.js} +1 -1
- package/dist/client/assets/{index-56EOd-zy.js → index-BIN0yv4s.js} +1 -1
- package/dist/client/assets/{index-FhWMRBQP.js → index-BL5Vmq62.js} +1 -1
- package/dist/client/assets/index-BOvFXsF_.js +1 -0
- package/dist/client/assets/index-BbcfxnHC.js +1 -0
- package/dist/client/assets/{index-DqkFtcGQ.js → index-BdKIijqB.js} +1 -1
- package/dist/client/assets/{index-BOEPL6hN.js → index-BfAymWoj.js} +1 -1
- package/dist/client/assets/{index-BKWJiERs.js → index-Bgts5its.js} +1 -1
- package/dist/client/assets/{index-n_pnc-CO.js → index-BiL3chP7.js} +1 -1
- package/dist/client/assets/{index-FI_y_dND.js → index-Bu3PEVA_.js} +1 -1
- package/dist/client/assets/{index-BOhSPP-6.js → index-C6DTV4h3.js} +1 -1
- package/dist/client/assets/{index-Cdod8zEY.js → index-CCH9c-nB.js} +1 -1
- package/dist/client/assets/{index-BkJlIXqM.js → index-CH4NJ8dD.js} +1 -1
- package/dist/client/assets/{index-CiGYtR9O.js → index-CKGJp3Cm.js} +1 -1
- package/dist/client/assets/{index-DEiSJbvu.js → index-CeqI4FFw.js} +1 -1
- package/dist/client/assets/{index-C4t0UTU-.js → index-Cj9-XXKl.js} +1 -1
- package/dist/client/assets/{index-ZR5f82z2.js → index-Cu8tnfM_.js} +1 -1
- package/dist/client/assets/{index-Dcd4NqFB.js → index-D4OWRMsG.js} +1 -1
- package/dist/client/assets/{index-Br6xDNvu.js → index-D8SP73Xw.js} +1 -1
- package/dist/client/assets/{index-CoNMlH37.js → index-DEJXVqcY.js} +1 -1
- package/dist/client/assets/{index-CoKNU2F9.js → index-DEMZynQt.js} +1 -1
- package/dist/client/assets/index-DGzMwE1Z.js +1 -0
- package/dist/client/assets/{index-1QfQImuJ.js → index-DIJdZqg2.js} +3 -3
- package/dist/client/assets/{index-YSHcMqHa.js → index-DIRqrOEK.js} +1 -1
- package/dist/client/assets/{index-CeDn1Ak1.js → index-DNbdGvs9.js} +1 -1
- package/dist/client/assets/{index-7XeZCCDI.js → index-DOBjxRe9.js} +1 -1
- package/dist/client/assets/{index-BJEt9R_G.js → index-DcBlHsnC.js} +1 -1
- package/dist/client/assets/index-DdsaTuqO.js +1 -0
- package/dist/client/assets/index-Dt4H9Tms.js +17 -0
- package/dist/client/assets/{index-DYEmUa5t.js → index-HXC63Ry8.js} +1 -1
- package/dist/client/assets/index-MHIn2TC9.js +1063 -0
- package/dist/client/assets/{index-tgbcsB6H.js → index-OjJ_8uMM.js} +1 -1
- package/dist/client/assets/index-P4Wos1Gi.css +1 -0
- package/dist/client/assets/{index-QSXJR98z.js → index-U5jTIqzv.js} +1 -1
- package/dist/client/assets/{index-CXBYgGja.js → index-ZzPr9GUI.js} +1 -1
- package/dist/client/assets/index-d9cqTUAj.js +1 -0
- package/dist/client/assets/{index-LwL5BpE4.js → index-fcfCRITA.js} +1 -1
- package/dist/client/assets/{index-SOKlO1zZ.js → index-onQlu3UR.js} +1 -1
- package/dist/client/assets/{index.esm-CAeUe7uQ.js → index.esm-DSKTDEoH.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-DweUdYSy.js → infoDiagram-MVDRKAX5-B8dulOBe.js} +1 -1
- package/dist/client/assets/{inline-code-SYHTKcle.js → inline-code-B3qpjdZ2.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DKNQIv7P.js → ishikawaDiagram-HPEHV2GE-Cy8aIg0O.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-DPD7F4VO.js → journeyDiagram-BOSHW7O7-BZAlejG3.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-B_uPSwxC.js → kanban-definition-FNSA4HC5-BxS1edpe.js} +1 -1
- package/dist/client/assets/{layers-F4mvrI2l.js → layers-ByCM7XO5.js} +1 -1
- package/dist/client/assets/{lightbulb-a6nNsrzy.js → lightbulb-KjW8YTXH.js} +1 -1
- package/dist/client/assets/{link-2-yI2Tlm7Q.js → link-2-CtFfuMO5.js} +1 -1
- package/dist/client/assets/{list-runtime-types-CsGil5te.js → list-runtime-types-DrzHejZo.js} +1 -1
- package/dist/client/assets/{markdown-content-Cjhsscbn.js → markdown-content-DgiSdNwz.js} +1 -1
- package/dist/client/assets/mention-pill-CHPHlu-U.js +1 -0
- package/dist/client/assets/{mermaid.core-9PwG-9fN.js → mermaid.core-ovqlC4PC.js} +4 -4
- package/dist/client/assets/{message-square-off-aV4NMCjd.js → message-square-off-CEOyy4Pq.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-BRbWmQkj.js → mindmap-definition-6OY57UG3-CsngqLzI.js} +1 -1
- package/dist/client/assets/{more-details-CRLU2HN4.js → more-details-BW9mauVT.js} +1 -1
- package/dist/client/assets/{owner-notice-CTJbhUak.js → owner-notice-BRUVafHC.js} +1 -1
- package/dist/client/assets/{package-sPggO7Dr.js → package-Bbs99yqi.js} +1 -1
- package/dist/client/assets/{page-container-CnfDuiDC.js → page-container-BVfGgaaJ.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-63OC5vfI.js → pane-resize-handle-BL7Meu5R.js} +1 -1
- package/dist/client/assets/{paperclip-WhPo3_WD.js → paperclip-QOWXs8-5.js} +1 -1
- package/dist/client/assets/path-input-BDRHmgzW.js +1 -0
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Ct9Li_PA.js → pegDiagram-ECIUJNBX-DPsWmWqw.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-BAB5RA5v.js → pieDiagram-GNMPY74T-BdOIDv4F.js} +1 -1
- package/dist/client/assets/{plug-_q5iqunq.js → plug-BrsPyUhu.js} +1 -1
- package/dist/client/assets/primer-trigger-C97fRm1v.js +3 -0
- package/dist/client/assets/{profile-errors-COcBx7w5.js → profile-errors-nPLX60ha.js} +1 -1
- package/dist/client/assets/{progress-77FCPL2y.js → progress-C9TALtIa.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-BqPJVmMS.js → quadrantDiagram-D57K4MC3-MzMEunU7.js} +1 -1
- package/dist/client/assets/{query-error-state-5236P3z0.js → query-error-state-BJjgx-WC.js} +1 -1
- package/dist/client/assets/{radio-C8xmfoqO.js → radio-Biql29-B.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-B8U11nT6.js → railroadDiagram-Y72NRBL7-Dzx_PYVW.js} +1 -1
- package/dist/client/assets/registry-B0HgbN69.js +1 -0
- package/dist/client/assets/registry-fiUD5cv6.js +39 -0
- package/dist/client/assets/{relay-trace-schemas-B80E4EUn.js → relay-trace-schemas-BJ4MfChd.js} +2 -2
- package/dist/client/assets/{repeat-CHmB_vD7.js → repeat-CKufDGoQ.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-CzJ1gzTh.js → requirementDiagram-EQYSW5RA-J0pg6FEt.js} +1 -1
- package/dist/client/assets/{room-files-source-B0gc97Ri.js → room-files-source-iaYdshKo.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-CCU6SVnv.js → rotate-ccw-clock-CnARSw5V.js} +1 -1
- package/dist/client/assets/{rotate-cw-B8WQa8O-.js → rotate-cw-BAn_5-Gq.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-D4vQwyve.js → sankeyDiagram-SY24JHO5-6V_uy-zQ.js} +1 -1
- package/dist/client/assets/scroll-area-XDq7yL_d.js +1 -0
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BVnIsPQe.js → sequenceDiagram-BLEHNHQU-C4jZi3N4.js} +1 -1
- package/dist/client/assets/{shield-x-ijIbRppV.js → shield-x-CpiXuMbN.js} +1 -1
- package/dist/client/assets/signed-in-Rv3Sjk8n.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-DGb1rAJL.js → sizeCapture-INFHLROL-B7nxFreb.js} +1 -1
- package/dist/client/assets/{soul-file-CXgYs25S.js → soul-file-BQz4TtHo.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DeX3IKTm.js → stateDiagram-v2-A6IESKWZ-B5rvc4n2.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-DN5ljYhG.js → swimlanes-B3ENRKFQ-DnElusDo.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DLpKz5fF.js +8 -0
- package/dist/client/assets/{table-D9ww_3Ij.js → table-NGiWzPO4.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-DpRthC3r.js → timeline-definition-JXYKGLGB-DMgyn3XX.js} +1 -1
- package/dist/client/assets/{trust-posture-Dn2ciEE0.js → trust-posture-BArJ9H4j.js} +1 -1
- package/dist/client/assets/{unplug-BZ8zSvfB.js → unplug-MSjeZ0tJ.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-CGy05tAO.js → unverified-catalog-notice-DA96H8Df.js} +1 -1
- package/dist/client/assets/{use-bindings-BLAWQRpe.js → use-bindings-BojBqRJS.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-ICOpilWK.js → use-composer-prefs-BDl8aMme.js} +1 -1
- package/dist/client/assets/{use-connector-management-DEMGZy9N.js → use-connector-management-FONU6FK8.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DxGYrks3.js → use-deep-link-scroll-CtbBPBgi.js} +1 -1
- package/dist/client/assets/{use-delete-binding-Bnv3J5Fu.js → use-delete-binding-COhBv6X3.js} +1 -1
- package/dist/client/assets/{use-dev-links-BOcktLiE.js → use-dev-links-Dh0MCiGY.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-D38tSozW.js → use-direct-message-panel-CYnWunqk.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-9qiNBqpc.js → use-external-adapter-catalog-RTDOW8Yi.js} +1 -1
- package/dist/client/assets/use-filter-state-CSFTDx7z.js +6 -0
- package/dist/client/assets/use-full-activity-feed-DlY_ZbRZ.js +1 -0
- package/dist/client/assets/use-is-below-desktop-ClzGXlRb.js +1 -0
- package/dist/client/assets/{use-local-browser-B1huJhdg.js → use-local-browser-WwZd-FOP.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-BTYAy6zc.js → use-mesh-topology-WnFkjq41.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-CaPc6Prv.js → use-mounted-ref-Dz1h70pz.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-u76DPoP0.js → use-notification-prefs-IrF5_cko.js} +1 -1
- package/dist/client/assets/use-pending-read-CnAnzOt_.js +1 -0
- package/dist/client/assets/use-personality-commit-C4hYkSPy.js +1 -0
- package/dist/client/assets/use-promo-activation-CPVANFBh.js +6 -0
- package/dist/client/assets/{use-promo-dismissals-CO7-qhEl.js → use-promo-dismissals-B9m0HT6L.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-D07Mv-Sa.js → use-pulse-freshness-DMySxN8D.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-DRQBuAIe.js → use-room-follow-claim-ByaYVY0o.js} +1 -1
- package/dist/client/assets/{use-room-sessions-Bzk7rM40.js → use-room-sessions-DPB29acU.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-CcznVldj.js → use-roving-tab-list-BO8kbs-w.js} +1 -1
- package/dist/client/assets/{use-session-canvas-CpgE7tFb.js → use-session-canvas-Cunag2K7.js} +9 -9
- package/dist/client/assets/use-status-budget-jt-9aQR0.js +21 -0
- package/dist/client/assets/{use-transform-ByJGn3hq.js → use-transform-ydtuYUNp.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-C-z5fstJ.js → use-unclaimed-chats-ClBWJgNm.js} +1 -1
- package/dist/client/assets/use-update-config-ZHtOtve0.js +1 -0
- package/dist/client/assets/{useMutationState-BF1EFtIZ.js → useMutationState-B8ArIqeH.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-efVKbRIX.js → usecaseDiagram-WPOLBNNX-C5JdAkG9.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Bravmwce.js → vennDiagram-Q3Y3IDCW-CqLCy7LU.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-fR77zByv.js → wardleyDiagram-IVAIDKWA-C9FlHLTd.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-BphORSLh.js → xychartDiagram-4URNHDU4-BIm-RUWd.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261031012841_dor3309_file_turn_on_offer.sql +2 -0
- package/dist/drizzle/20261101122330_schedule_declined_content_key.sql +1 -0
- package/dist/drizzle/20261101195529_work_queue.sql +38 -0
- package/dist/drizzle/20261101233656_dor3644_session_launched_by.sql +1 -0
- package/dist/drizzle/20261102041558_dor3070_marketplace_summary.sql +2 -0
- package/dist/drizzle/20261102051715_dor3440_clear_origin_holds.sql +10 -0
- package/dist/drizzle/20261102135442_agent_browser_profiles.sql +15 -0
- package/dist/drizzle/meta/20261031012841_snapshot.json +14116 -0
- package/dist/drizzle/meta/20261101122330_snapshot.json +14123 -0
- package/dist/drizzle/meta/20261101195529_snapshot.json +14363 -0
- package/dist/drizzle/meta/20261101233656_snapshot.json +14370 -0
- package/dist/drizzle/meta/20261102041558_snapshot.json +14384 -0
- package/dist/drizzle/meta/20261102051715_snapshot.json +14384 -0
- package/dist/drizzle/meta/20261102135442_snapshot.json +14483 -0
- package/dist/drizzle/meta/_journal.json +49 -0
- package/dist/server/extension-child.cjs +1147 -572
- package/dist/server/index.js +45678 -38894
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/ActivityRow-DIBH4v9c.js +0 -1
- package/dist/client/assets/AdapterSetupWizard-Dle_b9qc.js +0 -2
- package/dist/client/assets/AppearancePage-DXbhUt2e.js +0 -1
- package/dist/client/assets/AttentionSignalRow-5E7TkG98.js +0 -1
- package/dist/client/assets/BindingDialog-q--8SDJF.js +0 -1
- package/dist/client/assets/BlintzCanvas-DruVZcDU.js +0 -1231
- package/dist/client/assets/CanvasFileContent-BThy5fjD.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-BbgR73jh.js +0 -2
- package/dist/client/assets/ChannelComposer-qhk0KtW7.js +0 -44
- package/dist/client/assets/ConnectionAccessLists-DRwO1v0V.js +0 -1
- package/dist/client/assets/HandlePage-B4qbFi40.js +0 -1
- package/dist/client/assets/HeartbeatPage-BnNbQLCW.js +0 -1
- package/dist/client/assets/Marketplace-DbdLWz0-.js +0 -36
- package/dist/client/assets/NamePage-fhxyWDDY.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-DBAdvv5p.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-Bls5Vo_u.js +0 -1
- package/dist/client/assets/PhotoPage-CNHcXbz4.js +0 -1
- package/dist/client/assets/PreviewRefusedNotice-Ds4IO32o.js +0 -1
- package/dist/client/assets/PromptSuggestionChips-BXxC799Q.js +0 -1
- package/dist/client/assets/RoomSurface-DgH3a_Fv.js +0 -1
- package/dist/client/assets/RunsOnPopover-CEkkjrGg.js +0 -1
- package/dist/client/assets/RuntimeConnectFlow-DXWGgvCW.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-D6L1QhMF.js +0 -1
- package/dist/client/assets/SettingsDialog-BOOqWKcj.js +0 -12
- package/dist/client/assets/SkillsPage-ntCEhUIM.js +0 -1
- package/dist/client/assets/TaskDialogWrapper-vBWAWwTY.js +0 -1
- package/dist/client/assets/TasksEmptyState-C_3UkAbA.js +0 -3
- package/dist/client/assets/TourHost-B69XAKpE.js +0 -1
- package/dist/client/assets/WidgetErrorCard-BlqaIsPK.js +0 -108
- package/dist/client/assets/WorkView-BekLkR4O.js +0 -51
- package/dist/client/assets/_shell-Du0F-5fK.js +0 -80
- package/dist/client/assets/_shell._home.activity-5rihXoYF.js +0 -1
- package/dist/client/assets/_shell._home.index-BsLNqt4f.js +0 -3
- package/dist/client/assets/_shell._home.tasks-Cxs5tLWA.js +0 -1
- package/dist/client/assets/_shell._home.workspaces-CEHDdfbP.js +0 -1
- package/dist/client/assets/_shell.connections-Bm0WmgXH.js +0 -1
- package/dist/client/assets/_shell.marketplace-CsQ60Mlc.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-DNyShS1x.js +0 -1
- package/dist/client/assets/_shell.session-BN42bV3w.js +0 -1
- package/dist/client/assets/_shell.threads-HH4EvufJ.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-3ZlJV1iu.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-3ZlJV1iu.js +0 -1
- package/dist/client/assets/card-DUmTNXJJ.js +0 -1
- package/dist/client/assets/channel-B7zgJbnU.js +0 -1
- package/dist/client/assets/form-D93N5lrK.js +0 -1
- package/dist/client/assets/image-lightbox-vgPEvSCc.js +0 -1
- package/dist/client/assets/index-B36osK_S.js +0 -17
- package/dist/client/assets/index-B446r3dL.js +0 -1
- package/dist/client/assets/index-BGo1YiUE.js +0 -1
- package/dist/client/assets/index-BO3yPJt-.js +0 -1
- package/dist/client/assets/index-DE6uOpn4.js +0 -1
- package/dist/client/assets/index-Dag1qeZI.js +0 -1
- package/dist/client/assets/index-Dm0Tav7v.js +0 -1
- package/dist/client/assets/index-Dry_agqN.css +0 -1
- package/dist/client/assets/index-OQuvRZTD.js +0 -1058
- package/dist/client/assets/index-eVrGefuq.js +0 -1
- package/dist/client/assets/mention-pill-BsOeTJ2f.js +0 -1
- package/dist/client/assets/path-input-C2KIXdON.js +0 -1
- package/dist/client/assets/primer-trigger-B2tjuHBx.js +0 -3
- package/dist/client/assets/registry-BzXBOE9h.js +0 -34
- package/dist/client/assets/registry-sfhDu9q2.js +0 -1
- package/dist/client/assets/scroll-area-FwZwM74Q.js +0 -1
- package/dist/client/assets/search-x-Q18Wm-C5.js +0 -6
- package/dist/client/assets/signed-in-DEOMBWVX.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D8kHFWtL.js +0 -8
- package/dist/client/assets/use-full-activity-feed-CtQquOBW.js +0 -1
- package/dist/client/assets/use-is-below-desktop-CAGEAsCC.js +0 -1
- package/dist/client/assets/use-pending-read-D0y6i7G9.js +0 -1
- package/dist/client/assets/use-personality-commit-C3h8upDo.js +0 -1
- package/dist/client/assets/use-promo-activation-5HG08FlB.js +0 -11
- package/dist/client/assets/use-status-budget-Xn2sIeM1.js +0 -16
- package/dist/client/assets/use-update-config-L5NCTj3t.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var et=t=>{throw TypeError(t)};var tt=(t,n,e)=>n.has(t)||et("Cannot "+e);var y=(t,n,e)=>(tt(t,n,"read from private field"),e?e.call(t):n.get(t)),N=(t,n,e)=>n.has(t)?et("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),k=(t,n,e,i)=>(tt(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e);var it=(t,n,e,i)=>({set _(r){k(t,n,r,e)},get _(){return y(t,n,i)}});import{r as C,lu as St,j as p,lv as pt,dp as ce,dq as he,I as yt,h0 as fe,h_ as me,h$ as Vt,eg as At,eh as Et,ei as wt,ej as It,ek as Ct,$ as Lt,gQ as Tt,eo as xt,B as Dt}from"./index-OQuvRZTD.js";function kt({update:t,notify:n,unwatched:e}){return{link:i,unlink:r,propagate:h,checkDirty:s,shallowPropagate:a};function i(l,d,o){const f=d.depsTail;if(f!==void 0&&f.dep===l)return;const m=f!==void 0?f.nextDep:d.deps;if(m!==void 0&&m.dep===l){m.version=o,d.depsTail=m;return}const c=l.subsTail;if(c!==void 0&&c.version===o&&c.sub===d)return;const g=d.depsTail=l.subsTail={version:o,dep:l,sub:d,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:d.deps=g,c!==void 0?c.nextSub=g:l.subs=g}function r(l,d=l.sub){const o=l.dep,f=l.prevDep,m=l.nextDep,c=l.nextSub,g=l.prevSub;return m!==void 0?m.prevDep=f:d.depsTail=f,f!==void 0?f.nextDep=m:d.deps=m,c!==void 0?c.prevSub=g:o.subsTail=g,g!==void 0?g.nextSub=c:(o.subs=c)===void 0&&e(o),m}function h(l){let d=l.nextSub,o;e:do{const f=l.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&u(l,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&n(f),m&1){const c=f.subs;if(c!==void 0){const g=(l=c).nextSub;g!==void 0&&(o={value:d,prev:o},d=g);continue}}if((l=d)!==void 0){d=l.nextSub;continue}for(;o!==void 0;)if(l=o.value,o=o.prev,l!==void 0){d=l.nextSub;continue e}break}while(!0)}function s(l,d){let o,f=0,m=!1;e:do{const c=l.dep,g=c.flags;if(d.flags&16)m=!0;else if((g&17)===17){if(t(c)){const v=c.subs;v.nextSub!==void 0&&a(v),m=!0}}else if((g&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(o={value:l,prev:o}),l=c.deps,d=c,++f;continue}if(!m){const v=l.nextDep;if(v!==void 0){l=v;continue}}for(;f--;){const v=d.subs,S=v.nextSub!==void 0;if(S?(l=o.value,o=o.prev):l=v,m){if(t(d)){S&&a(v),d=l.sub;continue}m=!1}else d.flags&=-33;d=l.sub;const F=l.nextDep;if(F!==void 0){l=F;continue e}}return m}while(!0)}function a(l){do{const d=l.sub,o=d.flags;(o&48)===32&&(d.flags=o|16,(o&6)===2&&n(d))}while((l=l.nextSub)!==void 0)}function u(l,d){let o=d.depsTail;for(;o!==void 0;){if(o===l)return!0;o=o.prevDep}return!1}}function Ze(t,n,e){var h,s,a;const i=typeof t=="object",r=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(r),error:(s=i?t.error:n)==null?void 0:s.bind(r),complete:(a=i?t.complete:e)==null?void 0:a.bind(r)}}const qe=[];let xe=0;const{link:st,unlink:Bt,propagate:jt,checkDirty:ft,shallowPropagate:rt}=kt({update(t){return t._update()},notify(t){qe[He++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,je(t))}});let Ce=0,He=0,z,Xe=0;function _(t){try{++Xe,t()}finally{--Xe||mt()}}function je(t){const n=t.depsTail;let e=n!==void 0?n.nextDep:t.deps;for(;e!==void 0;)e=Bt(e,t)}function mt(){if(!(Xe>0)){for(;Ce<He;){const t=qe[Ce];qe[Ce++]=void 0,t.notify()}Ce=0,He=0}}function gt(t,n){const e=typeof t=="function",i=t,r={_snapshot:e?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:e?0:1,get(){return z!==void 0&&st(r,z,xe),r._snapshot},subscribe(h){const s=Ze(h),a={current:!1},u=Pt(()=>{var l;r.get(),a.current?(l=s.next)==null||l.call(s,r._snapshot):a.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=r,++xe,r.depsTail=void 0;else if(h===void 0)return!1;e&&(r.flags=5);try{const u=r._snapshot,l=typeof h=="function"?h(u):h===void 0&&e?i(u):h;return u===void 0||!a(u,l)?(r._snapshot=l,!0):!1}finally{z=s,e&&(r.flags&=-5),je(r)}}};return e?(r.flags=17,r.get=function(){const h=r.flags;if(h&16||h&32&&ft(r.deps,r)){if(r._update()){const s=r.subs;s!==void 0&&rt(s)}}else h&32&&(r.flags=h&-33);return z!==void 0&&st(r,z,xe),r._snapshot}):r.set=function(h){if(r._update(h)){const s=r.subs;s!==void 0&&(jt(s),rt(s),mt())}},r}function Pt(t){const n=()=>{const i=z;z=e,++xe,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,je(e)}},e={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const i=this.flags;i&16||i&32&&ft(this.deps,this)?n():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,je(this)}};return n(),e}var _t=class{constructor(t,n){this.atom=gt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ze(t))}},Rt=class{constructor(t){this.atom=gt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ze(t))}};function ie(t,n){return typeof t=="function"?new Rt(t):new _t(t)}var Nt=class{constructor(t,n){this.fn=t,this.options=n,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{const i=Date.now()-this.lastExecutionTime;if(this.options.leading&&i>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){const r=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},r)}},this.execute=(...e)=>{var i,r;this.fn(...e),(r=(i=this.options).onExecute)==null||r.call(i,e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Ot(t,n){return new Nt(t,n).maybeExecute}var ee,U,G,Ee,H,re,X,le,we,Re,te,ue,Q,Ie,de,Ne;class Gt{constructor({pluginId:n,debug:e=!1,enabled:i=!0,reconnectEveryMs:r=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,Ee);N(this,H);N(this,re);N(this,X);N(this,le);N(this,we,0);N(this,Re,5);N(this,te,!1);N(this,ue,!1);N(this,Q,null);N(this,Ie,()=>{this.debugLog("Connected to event bus"),k(this,re,!0),k(this,te,!1),this.debugLog("Emitting queued events",y(this,H)),y(this,H).forEach(n=>this.emitEventToBus(n)),k(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ie))});N(this,de,()=>{if(y(this,we)<y(this,Re)){it(this,we)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,de)),k(this,ue,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Ne,()=>{y(this,te)||(k(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ie)),y(this,de).call(this))});k(this,U,n),k(this,ee,i),k(this,G,this.getGlobalTarget),k(this,Ee,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),k(this,H,[]),k(this,re,!1),k(this,ue,!1),k(this,X,null),k(this,le,r)}startConnectLoop(){y(this,X)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,le)}ms)`),k(this,X,setInterval(y(this,de),y(this,le))))}stopConnectLoop(){k(this,te,!1),y(this,X)!==null&&(clearInterval(y(this,X)),k(this,X,null),k(this,H,[]),this.debugLog("Stopped connect loop"))}debugLog(...n){y(this,Ee)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...n)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const n=typeof EventTarget<"u"?new EventTarget:void 0;return typeof n>"u"||typeof n.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),n)}getPluginId(){return y(this,U)}dispatchCustomEventShim(n,e){try{const i=new Event(n,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(n,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(n,{detail:e}))}catch{this.dispatchCustomEventShim(n,e)}}emitEventToBus(n){this.debugLog("Emitting event to client bus",n),this.dispatchCustomEvent("tanstack-dispatch-event",n)}createEventPayload(n,e){return{type:`${y(this,U)}:${n}`,payload:e,pluginId:y(this,U)}}emit(n,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",n,e);return}if(y(this,Q)&&(this.debugLog("Emitting event to internal event target",n,e),y(this,Q).dispatchEvent(new CustomEvent(`${y(this,U)}:${n}`,{detail:this.createEventPayload(n,e)}))),y(this,ue)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!y(this,re)){this.debugLog("Bus not available, will be pushed as soon as connected"),y(this,H).push(this.createEventPayload(n,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Ne).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(n,e))}on(n,e,i){const r=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${n}`;if(r&&(y(this,Q)||k(this,Q,new EventTarget),y(this,Q).addEventListener(h,a=>{e(a.detail)})),!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event",h),()=>{};const s=a=>{this.debugLog("Received event from bus",a.detail),e(a.detail)};return y(this,G).call(this).addEventListener(h,s),this.debugLog("Registered event to bus",h),()=>{var a;r&&((a=y(this,Q))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;y(this,U)&&r.pluginId!==y(this,U)||n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}}ee=new WeakMap,U=new WeakMap,G=new WeakMap,Ee=new WeakMap,H=new WeakMap,re=new WeakMap,X=new WeakMap,le=new WeakMap,we=new WeakMap,Re=new WeakMap,te=new WeakMap,ue=new WeakMap,Q=new WeakMap,Ie=new WeakMap,de=new WeakMap,Ne=new WeakMap;class $t extends Gt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new $t;function ge(t,n){return typeof t=="function"?t(n):t}function oe(t,n){return Oe(n).reduce((i,r)=>{if(i===null)return null;if(typeof i<"u")return i[r]},t)}function be(t,n,e){const i=Oe(n);function r(h){if(!i.length)return ge(e,h);const s=i.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(h))return typeof h=="object"?(h===null&&(h={}),{...h,[s]:r(h[s])}):{[s]:r()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),r(h[s]),...h.slice(s+1)]}return[...new Array(s),r()]}return r(t)}function Wt(t,n){const e=Oe(n);function i(r){if(!r)return;if(e.length===1){const s=e[0];if(Array.isArray(r)&&typeof s=="number")return r.filter((l,d)=>d!==s);const{[s]:a,...u}=r;return u}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(r))&&typeof r=="object")return{...r,[h]:i(r[h])};if(typeof h=="number"&&Array.isArray(r)){if(h>=r.length)return r;const s=r.slice(0,h);return[...s.length?s:new Array(h),i(r[h]),...r.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const nt=46,Ge=91,$e=93,at=48,Ut=57;function Oe(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const n=t.length,e=[];let i=n>0&&t.charCodeAt(0)===Ge?1:0,r=!0,h=-1;for(let s=i;s<=n;s++){const a=s<n?t.charCodeAt(s):-1;if(s===n||a===nt||a===Ge||a===$e){const u=s-i;if(u>0){const l=r&&(u===1||t.charCodeAt(i)!==at),d=t.slice(i,s);if(l){const o=parseInt(d,10);u<=15||String(o)===d?e.push(o):e.push(d)}else e.push(d)}else h!==$e&&!(h===-1&&a===$e)&&!(h===a&&(a===nt||a===Ge))&&e.push("");i=s+1,r=!0}else(a<at||a>Ut)&&(r=!1);h=a}return e.length||e.push(""),e}function ot(t,n){return t.length===0?n:n.length===0?t:n.startsWith("[")||n.startsWith(".")?t+n:`${t}.${n}`}function Kt(t){return!(Array.isArray(t)&&t.length===0)}function pe(t,n){const e=i=>i.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!1},runValidation:e})}function ye(t,n){const{asyncDebounceMs:e}=n,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:h}=n.validators||{},s=e??0,a=u=>u.validators.filter(Boolean).map(l=>{const d=(l==null?void 0:l.cause)||t;let o=s;switch(d){case"change":o=r??s;break;case"blur":o=i??s;break;case"dynamic":o=h??s;break;case"submit":o=0;break}return t==="submit"&&(o=0),{cause:d,validate:l.fn,debounceMs:o}});return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!0},runValidation:a})}const De=t=>!!t&&typeof t=="object"&&"fields"in t;function Z(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;if(t instanceof Date&&n instanceof Date)return t.getTime()===n.getTime();if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const[r,h]of t)if(!n.has(r)||!Object.is(h,n.get(r)))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const r of t)if(!n.has(r))return!1;return!0}const e=Object.keys(t),i=Object.keys(n);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(n)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(n)!==Object.prototype))return!1;for(const r of e)if(!i.includes(r)||!Z(t[r],n[r]))return!1;return!0}const Qe=({newFormValidatorError:t,isPreviousErrorFromFormValidator:n,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},Pe=({formLevelError:t,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,n){return t==null?n:{...t,...n}}let se=256;const ke=[];let Le;for(;se--;)ke[se]=(se+256).toString(16).substring(1);function vt(){let t=0,n,e="";if(!Le||se+16>256){for(Le=new Array(256),t=256;t--;)Le[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)n=Le[se+t],t===6?e+=ke[n&15|64]:t===8?e+=ke[n&63|128]:e+=ke[n],t&1&&t>1&&t<11&&(e+="-");return se++,e}const zt=Ot(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function Se(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e[i]=Se(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,r)=>{e.set(r,Se(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(Se(i))}),e}const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Se(t[e]));return n}function ne(t,n){return n===t||n.startsWith(`${t}.`)||n.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const n=t.event.async,e=n?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:n?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},r={fn:n?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:n?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=n?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[e],form:t.form});case"submit":return t.runValidation({validators:[i,r,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[r,s],form:t.form});case"change":return t.runValidation({validators:[i,s],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function qt(t,n){const e=new Map;for(const i of t){const r=i.path??[];let h=n,s="";for(let a=0;a<r.length;a++){const u=r[a];if(u===void 0)continue;const l=typeof u=="object"?u.key:u,d=Number(l);Array.isArray(h)&&!Number.isNaN(d)?s+=`[${d}]`:s+=(a>0?".":"")+String(l),typeof h=="object"&&h!==null?h=h[l]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const lt=(t,n)=>{const e=qt(t,n);return{form:e,fields:e}},ae={validate({value:t,validationSource:n},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return n==="field"?i.issues:lt(i.issues,t)},async validateAsync({value:t,validationSource:n},e){const i=await e["~standard"].validate(t);if(i.issues)return n==="field"?i.issues:lt(i.issues,t)}},Je=t=>!!t&&"~standard"in t,O={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Y(t){function n(o){const f=t.getFieldMeta(o)??O;t.setFieldMeta(o,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(o,f,m){n(o);const c=a(o,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(o,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(o,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);l(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(o,m))).forEach(F=>{const M=F.replace(s(o,m),s(o,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(o,f){n(o);const m=a(o,f,"remove");l(m,"up")}function r(o,f,m){n(o),a(o,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(o,f)))return;const v=g.toString().replace(s(o,f),s(o,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(o,f){n(o);const m=a(o,f,"insert");l(m,"down"),m.forEach(c=>{c.toString().startsWith(s(o,f))&&t.setFieldMeta(c,d())})}function s(o,f){return`${o}[${f}]`}function a(o,f,m,c){const g=[s(o,f)];switch(m){case"swap":g.push(s(o,c));break;case"move":{const[v,S]=[Math.min(f,c),Math.max(f,c)];for(let F=v;F<=S;F++)g.push(s(o,F));break}default:{const v=t.getFieldValue(o),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(o,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function u(o,f){return o.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function l(o,f){(f==="up"?o:[...o].reverse()).forEach(c=>{const g=u(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,d())})}const d=()=>O;return{bumpArrayVersion:n,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:h}}function We(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},formGroupStateBase:t.formGroupStateBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ut{constructor(n){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{zt(this)}),a=K.on("request-form-state",c=>{c.payload.id===this._formId&&K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),u=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),l=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),d=()=>{l(),u(),a(),s.unsubscribe(),K.emit("form-unmounted",{id:this._formId})};(m=(f=this.options.listeners)==null?void 0:f.onMount)==null||m.call(f,{formApi:this});const{onMount:o}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),d},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const u=s.defaultValues&&!Z(s.defaultValues,a.defaultValues)&&!this.state.isTouched,l=!Z(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!u&&!l)){if(_(()=>{this.baseStore.setState(()=>We(Object.assign({},this.state,l?s.defaultState:{},u?{values:s.defaultValues}:{})))}),u){const d=Y(this);for(const o of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(o))&&d.bumpArrayVersion(o)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:u}=this.state,l=this.resetFieldMeta(u);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var o;let d=s??this.options.defaultValues??((o=this.options.defaultState)==null?void 0:o.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(d=be(d,f.instance.name,f.instance.options.defaultValue))}),We({...this.options.defaultState,values:d,fieldMetaBase:l})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(l=>{if(!l.instance)return;const d=l.instance;a.push(Promise.resolve().then(()=>d.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),l.instance.store.state.meta.isTouched||l.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null,o=[`${s}[${a}]`];for(let g=a+1;g<=(d??0);g++)o.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>o.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,u)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var l,d;const u=(l=this.fieldInfo[s])==null?void 0:l.instance;if(!u){const{hasErrored:o}=this.validateSync(a);return o&&!this.options.asyncAlways?((d=this.getFieldMeta(s))==null?void 0:d.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return u.store.state.meta.isTouched||u.setMeta(o=>({...o,isTouched:!0})),u.validate(a)},this.validateSync=(s,a)=>{const u=pe(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let l=!1;const d={};return _(()=>{var m,c,g;for(const v of u){if(!v.validate)continue;const S=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:F,fieldErrors:M}=Be(S),V=Fe(v.cause);let w=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(M||{})]);a!=null&&a.filterFieldNames&&(w=new Set([...w].filter(a.filterFieldNames)));for(const b of w){if(this.baseStore.state.fieldMetaBase[b]===void 0&&!(M!=null&&M[b]))continue;const L=this.getFieldMeta(b)??O,{errorMap:E,errorSourceMap:A}=L,D=M==null?void 0:M[b],{newErrorValue:j,newSource:T}=Qe({newFormValidatorError:D,isPreviousErrorFromFormValidator:(A==null?void 0:A[V])==="form",previousErrorValue:E==null?void 0:E[V]});T==="form"&&(d[b]={...d[b],[V]:D}),(E==null?void 0:E[V])!==j&&this.setFieldMeta(b,(I=O)=>({...I,errorMap:{...I.errorMap,[V]:j},errorSourceMap:{...I.errorSourceMap,[V]:T}}))}a!=null&&a.dontUpdateFormErrorMap||((m=this.state.errorMap)==null?void 0:m[V])!==F&&this.baseStore.setState(b=>({...b,errorMap:{...b.errorMap,[V]:F}})),(F||M)&&(l=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const o=Fe("submit");(c=this.state.errorMap)!=null&&c[o]&&s!=="submit"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}));const f=Fe("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:l,fieldsErrorMap:d}},this.validateAsync=async(s,a)=>{const u=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});this.state.isFormValidating||this.baseStore.setState(m=>({...m,isFormValidating:!0}));const l=[];let d;for(const m of u){if(!m.validate)continue;const c=Fe(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},l.push(new Promise(async S=>{let F;try{F=await new Promise((E,A)=>{setTimeout(async()=>{if(v.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:m.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(D){A(D)}},m.debounceMs)})}catch(E){F=E}const{formError:M,fieldErrors:V}=Be(F);V&&(d=d?{...d,...V}:V);const w=Fe(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(d||{})]);let L=Array.from(b);a!=null&&a.filterFieldNames&&(L=L.filter(a.filterFieldNames));for(const E of L){if(this.baseStore.state.fieldMetaBase[E]===void 0&&!(d!=null&&d[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=d==null?void 0:d[E],{newErrorValue:I,newSource:P}=Qe({newFormValidatorError:T,isPreviousErrorFromFormValidator:(j==null?void 0:j[w])==="form",previousErrorValue:D==null?void 0:D[w]});(D==null?void 0:D[w])!==I&&this.setFieldMeta(E,(R=O)=>({...R,errorMap:{...R.errorMap,[w]:I},errorSourceMap:{...R.errorSourceMap,[w]:P}}))}a!=null&&a.dontUpdateFormErrorMap||this.baseStore.setState(E=>({...E,errorMap:{...E.errorMap,[w]:M}})),S(d?{fieldErrors:d,errorMapKey:w}:void 0)}))}let o=[];const f={};if(l.length){o=await Promise.all(l);for(const m of o)if(m!=null&&m.fieldErrors){const{errorMapKey:c}=m;for(const[g,v]of Object.entries(m.fieldErrors)){const F={...f[g]||{},[c]:v};f[g]=F}}}return this.baseStore.setState(m=>({...m,isFormValidating:!1})),f},this.validate=(s,a)=>{const{hasErrored:u,fieldsErrorMap:l}=this.validateSync(s,a);return u&&!this.options.asyncAlways?l:this.validateAsync(s,a)},this._handleSubmit=async s=>{var l,d,o,f,m,c,g,v,S,F;this.baseStore.setState(M=>({...M,isSubmitted:!1,submissionAttempts:M.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.fieldInfo).forEach(M=>{M.instance&&(M.instance.store.state.meta.isTouched||M.instance.setMeta(V=>({...V,isTouched:!0})))})});const a=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){(d=(l=this.options).onSubmitInvalid)==null||d.call(l,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const u=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){u(),(f=(o=this.options).onSubmitInvalid)==null||f.call(o,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(M=>M.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){u(),(c=(m=this.options).onSubmitInvalid)==null||c.call(m,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}_(()=>{Object.values(this.fieldInfo).forEach(M=>{var V;(V=M.instance)==null||V.triggerOnSubmitListener()})}),(v=(g=this.options.listeners)==null?void 0:g.onSubmit)==null||v.call(g,{formApi:this,meta:a});try{await((F=(S=this.options).onSubmit)==null?void 0:F.call(S,{value:this.state.values,formApi:this,meta:a})),_(()=>{this.baseStore.setState(M=>({...M,isSubmitted:!0,isSubmitSuccessful:!0})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),u()})}catch(M){throw this.baseStore.setState(V=>({...V,isSubmitSuccessful:!1})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:M}),u(),M}},this.getFieldValue=s=>oe(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFormGroupMeta=s=>this.formGroupMetaDerived.state[s],this.getFieldInfo=s=>{var a;return(a=this.fieldInfo)[s]||(a[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,a)=>{this.baseStore.setState(u=>({...u,fieldMetaBase:{...u.fieldMetaBase,[s]:ge(a,u.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,u)=>{const l=u;return a[l]=O,a},{}),this.setFieldValue=(s,a,u)=>{var f;const l=(u==null?void 0:u.dontUpdateMeta)??!1,d=(u==null?void 0:u.dontRunListeners)??!1,o=(u==null?void 0:u.dontValidate)??!1;_(()=>{l||this.setFieldMeta(s,m=>({...m,isTouched:!0,isDirty:!0,errorMap:{...m==null?void 0:m.errorMap,onMount:void 0}})),this.baseStore.setState(m=>({...m,values:be(m.values,s,a)}))}),d||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const u=[...Object.keys(this.fieldInfo).filter(l=>{const d=s.toString();return l.startsWith(`${d}.`)||l.startsWith(`${d}[`)}),s];this.baseStore.setState(l=>{const d={...l};return u.forEach(o=>{d.values=Wt(d.values,o),delete this.fieldInfo[o],delete d.fieldMetaBase[o]}),d})},this.pushFieldValue=(s,a,u)=>{this.setFieldValue(s,l=>[...Array.isArray(l)?l:[],a],u),Y(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>[...o.slice(0,a),u,...o.slice(a)],$(l,{dontValidate:!0}));const d=(l==null?void 0:l.dontValidate)??!1;d||await this.validateField(s,"change"),Y(this).handleArrayInsert(s,a),d||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>o.map((f,m)=>m===a?u:f),$(l,{dontValidate:!0})),Y(this).bumpArrayVersion(s),((l==null?void 0:l.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(u,{dontValidate:!0})),Y(this).handleArrayRemove(s,a),d!==null){const f=`${s}[${d}]`;this.deleteField(f)}((u==null?void 0:u.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=o[a],m=o[u];return be(be(o,`${a}`,m),`${u}`,f)},$(l,{dontValidate:!0})),Y(this).handleArraySwap(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.moveFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=[...o];return f.splice(u,0,f.splice(a,1)[0]),f},$(l,{dontValidate:!0})),Y(this).handleArrayMove(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.clearFieldValues=(s,a)=>{const u=this.getFieldValue(s),l=Array.isArray(u)?Math.max(u.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Y(this).bumpArrayVersion(s),l!==null)for(let o=0;o<=l;o++){const f=`${s}[${o}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var o;const u=(o=this.getFieldInfo(s).instance)==null?void 0:o.options.defaultValue,l=oe(this.options.defaultValues,s),d=u??l;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:d!==void 0?be(a.values,s,d):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,u])=>{const l=a;if(De(u)){const{formError:d,fieldErrors:o}=Be(u);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[l]:o==null?void 0:o[f]},errorSourceMap:{...c.errorSourceMap,[l]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[l]:d}}))}else this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[l]:u}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,u])=>(Object.keys(u).length&&u.errors.length&&(s[a]={errors:u.errors,errorMap:u.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(n==null?void 0:n.formId)??vt(),this._devtoolsSubmissionOverride=!1;let e=We({...n==null?void 0:n.defaultState,values:(n==null?void 0:n.defaultValues)??((h=n==null?void 0:n.defaultState)==null?void 0:h.values)});if(n!=null&&n.transform){e=n.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!De(a)))for(const u of Object.keys(a.fields)){const l=a.fields[u];if(l===void 0)continue;const d=e.fieldMetaBase[u];e.fieldMetaBase[u]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...d??{},errorSourceMap:{...(d==null?void 0:d.errorSourceMap)??{},onChange:"form"},errorMap:{...(d==null?void 0:d.errorMap)??{},[s]:l}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var d,o,f;const a=this.baseStore.get();let u=0;const l={};for(const m of Object.keys(a.fieldMetaBase)){const c=a.fieldMetaBase[m],g=i==null?void 0:i.fieldMetaBase[m],v=s==null?void 0:s[m],S=oe(a.values,m);let F=v==null?void 0:v.errors;if(!g||c.errorMap!==g.errorMap){F=Object.values(c.errorMap??{}).filter(L=>L!==void 0);const b=(d=this.getFieldInfo(m))==null?void 0:d.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!Kt(F),V=!c.isDirty,w=Z(S,((f=(o=this.getFieldInfo(m))==null?void 0:o.instance)==null?void 0:f.options.defaultValue)??oe(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){l[m]=v,u++;continue}l[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&u===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),l):l}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l={};for(const d of this.formGroupApis){const o=d.name,f=a.formGroupStateBase[o]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=u[o];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in u){if(W===o||!ne(o,W))continue;const B=u[W];B&&(B.isValidating&&(c=!0),B.isValid||(g=!1),B.isTouched&&(v=!0),B.isBlurred&&(S=!0),B.isDefaultValue||(F=!1),B.isDirty&&(M=!0))}const V=!M,w=!!c||f.isValidating,b=(m==null?void 0:m.errorMap)??{},L=(m==null?void 0:m.errorSourceMap)??{},E=!!(b.onMount||Object.entries(u).some(([W,B])=>B&&W!==o&&ne(o,W)&&B.errorMap.onMount)),A=s==null?void 0:s[o];let D=(A==null?void 0:A.errors)??[];(!A||A.__srcErrorMap!==b)&&(D=Object.values(b).reduce((W,B)=>{if(B===void 0)return W;if(B&&typeof B=="object"&&"fields"in B){const Ye=B.group;return Ye!==void 0&&W.push(Ye),W}return W.push(B),W},[]));const j=D.length===0,T=g&&j,I=d.options.canSubmitWhenInvalid??!1,P=f.submissionAttempts===0&&!v&&!E||!w&&!f.isSubmitting&&T||I;if(A&&A.errorMap===b&&A.errorSourceMap===L&&A.errors===D&&A.isFieldsValidating===c&&A.isFieldsValid===g&&A.isGroupValid===j&&A.isValid===T&&A.canSubmit===P&&A.isTouched===v&&A.isBlurred===S&&A.isPristine===V&&A.isDefaultValue===F&&A.isDirty===M&&A.isValidating===w&&A.isSubmitting===f.isSubmitting&&A.isSubmitted===f.isSubmitted&&A.submissionAttempts===f.submissionAttempts&&A.isSubmitSuccessful===f.isSubmitSuccessful){l[o]=A;continue}const R={...f,errorMap:b,errorSourceMap:L,_arrayVersion:(m==null?void 0:m._arrayVersion)??0,isTouched:v,isBlurred:S,isDirty:M,isPristine:V,isDefaultValue:F,isValid:T,errors:D,isValidating:w,isFieldsValidating:c,isFieldsValid:g,isGroupValid:j,canSubmit:P};Object.defineProperty(R,"__srcErrorMap",{value:b,enumerable:!1,configurable:!0}),l[o]=R}return l});let r;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l=Object.values(u).filter(Boolean),d=l.some(I=>I.isValidating),o=l.every(I=>I.isValid),f=l.some(I=>I.isTouched),m=l.some(I=>I.isBlurred),c=l.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=l.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||l.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!d;let V=(s==null?void 0:s.errors)??[];(!r||a.errorMap!==r.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&De(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=o&&w,L=this.options.canSubmitWhenInvalid??!1,E=a.submissionAttempts===0&&!f&&!F||!M&&!a.isSubmitting&&b||L;let A=a.errorMap;if(g&&(V=V.filter(I=>I!==a.errorMap.onMount),A=Object.assign(A,{onMount:void 0})),s&&r&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===d&&s.isFieldsValid===o&&s.isFormValid===w&&s.isValid===b&&s.canSubmit===E&&s.isTouched===f&&s.isBlurred===m&&s.isPristine===S&&s.isDefaultValue===c&&s.isDirty===v&&Z(r,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:d,isFieldsValid:o,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return r=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Be(t){if(t){if(De(t)){const n=Be(t.form).formError,e=t.fields;return{formError:n,fieldErrors:e}}return{formError:t}}return{formError:void 0}}function Fe(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Ve{constructor(n){this.options={},this.mount=()=>{var r,h;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const e=this.getInfo();e.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const s=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(a=>({...a,errorMap:{...a==null?void 0:a.errorMap,onMount:s},errorSourceMap:{...a==null?void 0:a.errorSourceMap,onMount:"field"}}))}return(h=(r=this.options.listeners)==null?void 0:r.onMount)==null||h.call(r,{value:this.state.value,fieldApi:this}),()=>{var a,u,l,d;for(const[o,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var f,m,c;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...O,isTouched:((f=o.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=o.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=o.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(u=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||u.call(a,{value:this.state.value,fieldApi:this}),(d=(l=this.form.options.listeners)==null?void 0:l.onFieldUnmount)==null||d.call(l,{formApi:this.form,fieldApi:this})}}},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Z(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,i)=>{this.form.pushFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,i,r)=>{this.form.insertFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,r)=>{this.form.replaceFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,i)=>{this.form.removeFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,i,r)=>{this.form.swapFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,r)=>{this.form.moveFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,$(e,{dontRunListeners:!0})),e!=null&&e.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{const i=Object.values(this.form.fieldInfo),r=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ve))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&r.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&r.push(h.instance)}return r},this.validateSync=(e,i)=>{var l;const r=pe(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((d,o)=>{const f=pe(e,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||q});return f.forEach(m=>{m.field=o}),d.concat(f)},[]);let a=!1;_(()=>{const d=(o,f)=>{var F;const m=Me(f.cause),c=f.validate?dt(o.runValidator({validate:f.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=Pe({formLevelError:g,fieldLevelError:c});((F=o.state.meta.errorMap)==null?void 0:F[m])!==v&&o.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const o of r)d(this,o);for(const o of s)o.validate&&d(o.field,o)});const u=Me("submit");return(l=this.state.meta.errorMap)!=null&&l[u]&&e!=="submit"&&!a&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[u]:void 0},errorSourceMap:{...d.errorSourceMap,[u]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const r=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),h=await i,a=this.getLinkedFields(e).reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,fieldName:g.name,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),u=[],l=[],d=r.some(c=>c.validate),o=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{d&&this.startValidation();for(const c of o)c.startValidation()});const f=(c,g,v)=>{const S=Me(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V},v.push(new Promise(async w=>{var j;let b;try{b=await new Promise((T,I)=>{c.timeoutIds.validations[g.cause]&&(clearTimeout(c.timeoutIds.validations[g.cause]),c.endValidation()),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return T(void 0);try{T(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,fieldApi:c,signal:V.signal,validationSource:"field"},type:"validateAsync"}))}catch(P){I(P)}},g.debounceMs)})}catch(T){b=T}if(V.signal.aborted)return w(void 0);const L=dt(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=Pe({formLevelError:E,fieldLevelError:L});if(c.getInfo().instance!==c)return w(void 0);c.setMeta(T=>({...T,errorMap:{...T==null?void 0:T.errorMap,[S]:A},errorSourceMap:{...T.errorSourceMap,[S]:D}})),w(A)}))};for(const c of r)c.validate&&f(this,c,u);for(const c of a)c.validate&&f(c.field,c,l);let m=[];return(u.length||l.length)&&(m=await Promise.all(u),await Promise.all(l)),_(()=>{d&&this.endValidation();for(const c of o)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const r=i!=null&&i.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(c=>this.name.startsWith(c.name));let s=(i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!(i!=null&&i.skipFormValidation))for(const c of r){if(c.state.meta.submissionAttempts===0)continue;const{fieldsErrorMap:g}=this.form.validateSync(e,{group:c,dontUpdateFormErrorMap:!0,filterFieldNames:v=>ne(c.name,v)});s={...s,...g[this.name]??{}}}const{hasErrored:a}=this.validateSync(e,s),u=new WeakMap;for(const c of r){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});u.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Me(e)])==null||f.lastAbortController.abort();const c=[];for(const g of r)(m=g.getInfo().validationMetaMap[Me(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const l=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),d=this.validateAsync(e,l),o=[];for(const c of r)u.get(c)&&!c.options.asyncAlways||o.push(c.validateAsync(e,l,{skipRelatedFieldValidation:!0}));return o.length===0?d:Promise.all([d,...o]).then(c=>c.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(i=>({...i,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(i=>({...i,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(i=>({...i,errorMap:{...i.errorMap,...e}}))},this.parseValueWithSchema=e=>ae.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>ae.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnBlurListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onBlur)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChange)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this});for(const d of this.form.formGroupApis)ne(d.name,this.name)&&d.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,fieldApi:this})},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...n.defaultMeta};let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Z(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}})}get state(){return this.store.state}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}startValidation(){this.setMeta(n=>{const e=n._pendingValidationsCount+1;return{...n,_pendingValidationsCount:e,isValidating:e>0&&!n.isValidating?!0:n.isValidating}})}endValidation(){this.setMeta(n=>{const e=Math.max(0,n._pendingValidationsCount-1);return{...n,_pendingValidationsCount:e,isValidating:e===0&&n.isValidating?!1:n.isValidating}})}}function dt(t){if(t)return t}function Me(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function Ue(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Ht(t){return{...O,...t,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}class Ae{constructor(n){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const r=i.formGroupStateBase[this.name]??Ue({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(r)}}})},this._lastDistributedFieldNames={},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Z(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...O,...this.options.defaultMeta})},this.mount=()=>{var i,r;this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(h=>({...h,formGroupStateBase:{...h.formGroupStateBase,[this.name]:h.formGroupStateBase[this.name]??Ue({...this.options.defaultState})}}));const{onMount:e}=this.options.validators||{};if(e){const h=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:"form"},type:"validate"});let s=h,a;ze(h)&&(s=h.group,a=h.fields);const u=Ke(s);u&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,onMount:u},errorSourceMap:{...l.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(r=(i=this.options.listeners)==null?void 0:i.onMount)==null||r.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,u]of Object.entries(this.timeoutIds.validations))u&&(clearTimeout(u),this.timeoutIds.validations[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.listeners))u&&(clearTimeout(u),this.timeoutIds.listeners[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.formListeners))u&&(clearTimeout(u),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,u]of Object.entries(this.fieldInfo.validationMetaMap))u==null||u.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ue({})}})),this.fieldInfo.instance=null,(s=(h=this.options.listeners)==null?void 0:h.onUnmount)==null||s.call(h,{value:this.state.value,groupApi:this})}}},this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{const e=Object.values(this.form.fieldInfo),i=[];for(const r of e)r.instance&&r.instance instanceof Ve&&r.instance.name.startsWith(this.name)&&i.push(r.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[r,h]of e)r!==this.name&&ne(this.name,r)&&i.push({...h,name:r});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const r=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[u,l]of Object.entries(i))l==null||l===!1||h.add(this.buildChildFieldName(u));const s=new Set([...r,...h]);let a=!1;for(const u of s){const l=u.startsWith(this.name+"[")?u.slice(this.name.length):u.slice(this.name.length+1),d=i==null?void 0:i[l],o=this.form.getFieldMeta(u);if(!o&&!d)continue;const f=o==null?void 0:o.errorMap[e],m=(o==null?void 0:o.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Qe({newFormValidatorError:d,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(o==null?void 0:o.errorSourceMap[e])===g)&&this.form.setFieldMeta(u,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,r={})=>{var d;const h=pe(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((o,f)=>{const m=pe(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),o.concat(m)},[]);let u=!1;_(()=>{const o=(f,m)=>{var L;const c=Te(m.cause),g=f===this;let v;m.validate&&(v=f.runValidator({validate:m.validate,value:{value:f.store.state.value,validationSource:g?"form":"field",...f instanceof Ae?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&ze(v)&&(S=v.group,F=v.fields);const M=Ke(S),V=i[c],{newErrorValue:w,newSource:b}=Pe({formLevelError:V,fieldLevelError:M});((L=f.state.meta.errorMap)==null?void 0:L[c])!==w&&f.setMeta(E=>({...E,errorMap:{...E.errorMap,[c]:w},errorSourceMap:{...E.errorSourceMap,[c]:b}})),w&&(u=!0),g&&this.distributeFieldErrors(c,F)&&(u=!0)};for(const f of h)o(this,f);for(const f of a)f.validate&&o(f.field,f)});const l=Te("submit");return(d=this.state.meta.errorMap)!=null&&d[l]&&e!=="submit"&&!u&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,[l]:void 0},errorSourceMap:{...o.errorSourceMap,[l]:void 0}})),{hasErrored:u}},this.validateAsync=async(e,i,r={})=>{const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),u=a.reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),l=[],d=[],o=h.some(c=>c.validate)||u.some(c=>c.validate);if(o){this.state.meta.isValidating||this.setMeta(c=>({...c,isValidating:!0}));for(const c of a)c.setMeta(g=>({...g,isValidating:!0}))}const f=(c,g,v)=>{const S=Te(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V};const w=c===this;v.push(new Promise(async b=>{var P;let L;try{L=await new Promise((R,W)=>{c.timeoutIds.validations[g.cause]&&clearTimeout(c.timeoutIds.validations[g.cause]),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return R(void 0);try{R(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,signal:V.signal,validationSource:w?"form":"field",...c instanceof Ae?{groupApi:c}:{fieldApi:c}},type:"validateAsync"}))}catch(B){W(B)}},g.debounceMs)})}catch(R){L=R}if(V.signal.aborted)return b(void 0);let E=L,A;w&&ze(L)&&(E=L.group,A=L.fields);const D=Ke(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=Pe({formLevelError:j,fieldLevelError:D});if(c.getInfo().instance!==c)return b(void 0);c.setMeta(R=>({...R,errorMap:{...R==null?void 0:R.errorMap,[S]:T},errorSourceMap:{...R.errorSourceMap,[S]:I}})),w&&this.distributeFieldErrors(S,A),b(T)}))};for(const c of h)c.validate&&f(this,c,l);for(const c of u)c.validate&&f(c.field,c,d);let m=[];if((l.length||d.length)&&(m=await Promise.all(l),await Promise.all(d)),o){this.setMeta(c=>({...c,isValidating:!1}));for(const c of a)c.setMeta(g=>({...g,isValidating:!1}))}return m.filter(Boolean)},this.validateAllFields=async e=>{const i=[];return _(()=>{Object.values(this.getRelatedFields()).forEach(h=>{i.push(Promise.resolve().then(()=>h.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),h.store.state.meta.isTouched||h.setMeta(s=>({...s,isTouched:!0}))})}),(await Promise.all(i)).flat()},this.validateArrayFieldsStartingFrom=(e,i,r)=>this.form.validateArrayFieldsStartingFrom(e,i,r),this.validateField=(e,i)=>this.form.validateField(e,i),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(e,i),this.setFieldValue=(e,i)=>this.form.setFieldValue(e,i),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,i)=>this.form.pushFieldValue(e,i),this.insertFieldValue=(e,i,r)=>this.form.insertFieldValue(e,i,r),this.replaceFieldValue=(e,i,r)=>this.form.replaceFieldValue(e,i,r),this.swapFieldValues=(e,i,r)=>this.form.swapFieldValues(e,i,r),this.moveFieldValues=(e,i,r)=>this.form.moveFieldValues(e,i,r),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,i)=>this.form.removeFieldValue(e,i),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,i)=>{var a;const{fieldsErrorMap:r}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)}),{hasErrored:h}=this.validateSync(e,r[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[Te(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChangeGroup)==null||o.call(d,{formApi:this.form,groupApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChangeGroup)==null||s.call(h,{formApi:this.form,groupApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,groupApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{var h,s,a,u,l,d,o,f;this.setFormGroupState(m=>({...m,isSubmitted:!1,submissionAttempts:m.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{m.state.meta.isTouched||m.setMeta(c=>({...c,isTouched:!0}))})});const i=e??this.options.onSubmitMeta;this.setFormGroupState(m=>({...m,isSubmitting:!0}));const r=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){r(),(s=(h=this.options).onGroupSubmitInvalid)==null||s.call(h,{value:this.state.value,groupApi:this,meta:i});return}if(await this.validate("submit",{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){r(),(u=(a=this.options).onGroupSubmitInvalid)==null||u.call(a,{value:this.state.value,groupApi:this,meta:i});return}_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{var c,g;(g=(c=m.options.listeners)==null?void 0:c.onGroupSubmit)==null||g.call(c,{value:m.state.value,fieldApi:m})})}),(d=(l=this.options.listeners)==null?void 0:l.onSubmit)==null||d.call(l,{groupApi:this,value:this.state.value});try{await((f=(o=this.options).onGroupSubmit)==null?void 0:f.call(o,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),r(),m}},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=ie(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();const i=this.form.getFormGroupMeta(this.name)??Ht(n.defaultMeta);let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Z(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(n){if(Je(n.validate)){const e=ae[n.type](n.value,n.validate);return n.type==="validate"?ct(e):e.then(ct)}return n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Ke(t){if(t)return t}function ze(t){return!!t&&typeof t=="object"&&"fields"in t}function ct(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:n,fields:e,...i}=t;return{...i,group:n,fields:e}}function Te(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class _e{constructor(n){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return ot(this.fieldsMap,e);const i=Oe(e)[0];if(typeof i!="string")return"";const r=e.slice(i.length),h=this.fieldsMap[i];return ot(h,r)},this.getFormFieldOptions=e=>{const i={...e},r=i.validators;if(i.name=this.getFormFieldName(e.name),r&&(r.onChangeListenTo||r.onBlurListenTo)){const h={...r},s=a=>{if(a)return a.map(u=>this.getFormFieldName(u))};h.onChangeListenTo=s(r.onChangeListenTo),h.onBlurListenTo=s(r.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,r),this.validateField=(e,i)=>this.form.validateField(this.getFormFieldName(e),i),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(this.getFormFieldName(e),i),this.setFieldValue=(e,i,r)=>this.form.setFieldValue(this.getFormFieldName(e),i,r),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,r)=>this.form.pushFieldValue(this.getFormFieldName(e),i,r),this.insertFieldValue=async(e,i,r,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,r,h),this.replaceFieldValue=async(e,i,r,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,r,h),this.removeFieldValue=async(e,i,r)=>this.form.removeFieldValue(this.getFormFieldName(e),i,r),this.swapFieldValues=(e,i,r,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,r,h),this.moveFieldValues=(e,i,r,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,r,h),this.clearFieldValues=(e,i)=>this.form.clearFieldValues(this.getFormFieldName(e),i),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),n.form instanceof _e){const e=n.form;if(this.form=e.form,typeof n.fields=="string")this.fieldsMap=e.getFormFieldName(n.fields);else{const i={...n.fields};for(const r in i)i[r]=e.getFormFieldName(i[r]);this.fieldsMap=i}}else this.form=n.form,this.fieldsMap=n.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=oe(e.values,this.fieldsMap);else{i={};const r=this.fieldsMap;for(const h in r)i[h]=oe(e.values,r[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}function Xt(t,n){if(!n)return;const e=Object.assign({},t,{state:Se(t.state)});n(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((h,s)=>(t.state[s]!==e.state[s]&&(h[s]=e.state[s]),h),{});return _(()=>{Object.keys(r).length&&t.baseStore.setState(h=>({...h,...r})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Qt(t,n){return t===n}function x(t,n=i=>i,e){const i=(e==null?void 0:e.compare)??Qt,r=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return St.useSyncExternalStoreWithSelector(r,h,h,n,i)}const J=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Zt(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ve({...t}));let h=i;(n.form!==t.form||n.name!==t.name)&&(h=new Ve({...t}),r(h),e({form:t.form,name:t.name}));const s=x(h.store,t.mode==="array"?c=>c.meta._arrayVersion||0:c=>c.value),a=x(h.store,c=>c.meta.isTouched),u=x(h.store,c=>c.meta.isBlurred),l=x(h.store,c=>c.meta.isDirty),d=x(h.store,c=>c.meta.errorMap),o=x(h.store,c=>c.meta.errorSourceMap),f=x(h.store,c=>c.meta.isValidating),m=C.useMemo(()=>({...h,get state(){return{value:t.mode==="array"?h.state.value:s,get meta(){return{...h.state.meta,isTouched:a,isBlurred:u,isDirty:l,errorMap:d,errorSourceMap:o,isValidating:f}}}}}),[h,t.mode,s,a,u,l,d,o,f]);return J(h.mount,[h]),J(()=>{h.update(t)}),m}const Jt=(({children:t,...n})=>{const e=Zt(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function Yt(){return C.useState(()=>vt())[0]}const ei=pt,ti=C.version.split(".")[0]==="17"?Yt:ei.useId;function ii(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ae({...t}));(n.form!==t.form||n.name!==t.name)&&(r(new Ae({...t})),e({form:t.form,name:t.name}));const h=x(i.store,b=>b.value),s=x(i.store,b=>b.meta.isTouched),a=x(i.store,b=>b.meta.isBlurred),u=x(i.store,b=>b.meta.isDirty),l=x(i.store,b=>b.meta.errorMap),d=x(i.store,b=>b.meta.errorSourceMap),o=x(i.store,b=>b.meta.isValidating),f=x(i.store,b=>b.meta.isSubmitting),m=x(i.store,b=>b.meta.isSubmitted),c=x(i.store,b=>b.meta.submissionAttempts),g=x(i.store,b=>b.meta.isSubmitSuccessful),v=x(i.store,b=>b.meta.canSubmit),S=x(i.store,b=>b.meta.isValid),F=x(i.store,b=>b.meta.isFieldsValid),M=x(i.store,b=>b.meta.isFieldsValidating),V=x(i.store,b=>b.meta.isGroupValid),w=C.useMemo(()=>({...i,handleSubmit:((...E)=>i._handleSubmit(...E)),get state(){return{...i.state,value:h,get meta(){return{...i.state.meta,isTouched:s,isBlurred:a,isDirty:u,errorMap:l,errorSourceMap:d,isValidating:o,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,u,l,d,o,f,m,c,g,v,S,F,M,V]);return J(i.mount,[i]),J(()=>{i.update(t)}),w}const si=(({children:t,...n})=>{const e=ii(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ri({form:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function ni(t){const n=ti(),[e,i]=C.useState(t==null?void 0:t.formId),[r,h]=C.useState(()=>new ut({...t,formId:(t==null?void 0:t.formId)??n}));if(e!==(t==null?void 0:t.formId)){const u=(t==null?void 0:t.formId)??n;h(new ut({...t,formId:u})),i(u)}const s=C.useMemo(()=>{const u={...r,handleSubmit:((...l)=>r._handleSubmit(...l)),get formId(){return r._formId},get state(){return r.store.state}};return u.Field=function(d){return p.jsx(Jt,{...d,form:r})},u.FormGroup=function(d){return p.jsx(si,{...d,form:r})},u.Subscribe=function(d){return p.jsx(ri,{form:r,selector:d.selector,children:d.children})},u},[r]);J(r.mount,[]),J(()=>{r.update(t)});const a=C.useRef(!1);return J(()=>{a.current&&t!=null&&t.transform&&Xt(r,t.transform)},[r,t==null?void 0:t.transform]),J(()=>{a.current=!0}),s}function ai({lens:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function oi(t){const[n]=C.useState(()=>{const e=new _e(t),i=t.form instanceof _e?t.form.form:t.form,r=e;return r.AppForm=function(s){return p.jsx(i.AppForm,{...s})},r.AppField=function(s){return p.jsx(i.AppField,{...n.getFormFieldOptions(s)})},r.Field=function(s){return p.jsx(i.Field,{...n.getFormFieldOptions(s)})},r.Subscribe=function(s){return p.jsx(ai,{lens:n,selector:s.selector,children:s.children})},Object.assign(r,{...t.formComponents})});return J(n.mount,[n]),n}const ht=C.createContext(null),bt=C.createContext(null);function Ft(){const t=C.useContext(bt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function li(){function t(){const n=C.useContext(ht);if(!n)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return n}return{fieldContext:ht,useFieldContext:t,useFormContext:Ft,formContext:bt}}function Mt({fieldComponents:t,fieldContext:n,formContext:e,formComponents:i}){function r(l){const d=ni(l),o=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:d,children:c}),[d]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(d.Field,{...v,children:S=>p.jsx(n.Provider,{value:S,children:g(Object.assign(S,t))})})),[d]);return C.useMemo(()=>Object.assign(d,{AppField:f,AppForm:o,...i}),[d,f,o])}function h({render:l,props:d}){return function(f){return l({...d,...f})}}function s({render:l,props:d,defaultValues:o}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:o,formComponents:i}),[m.form,m.fields]),g=oi(c);return l({...d,...m,group:g})}}function a(l){return Ft()}function u(l){return Mt({fieldContext:n,formContext:e,fieldComponents:{...t,...l.fieldComponents},formComponents:{...i,...l.formComponents}})}return{useAppForm:r,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:u}}const{fieldContext:ui,formContext:di,useFieldContext:ve,useFormContext:ci}=li();function hi({label:t,placeholder:n,type:e="text",description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(yt,{id:r.name,type:e,value:r.state.value,placeholder:n,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function fi({label:t,placeholder:n,description:e,rows:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(Vt,{id:r.name,value:r.state.value,placeholder:n,rows:i,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:a})]})}function mi({label:t,options:n,placeholder:e,description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsxs(At,{value:r.state.value,onValueChange:u=>r.handleChange(u),onOpenChange:u=>{u||r.handleBlur()},children:[p.jsx(Et,{id:r.name,children:p.jsx(wt,{placeholder:e})}),p.jsx(It,{children:n.map(u=>p.jsx(Ct,{value:u.value,children:u.label},u.value))})]}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function gi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(he,{htmlFor:e.name,children:t}),p.jsx(Lt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s)}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function vi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(Tt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s===!0)}),p.jsx(he,{htmlFor:e.name,children:t}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function bi({label:t,placeholder:n,description:e}){const i=ve(),{isTouched:r,errors:h}=i.state.meta,s=r?h.map(a=>({message:String(a)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:i.name,children:t}),p.jsx(xt,{id:i.name,value:i.state.value,placeholder:n,onBlur:i.handleBlur,onChange:a=>i.handleChange(a.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:s})]})}function Fi({label:t,pendingLabel:n="Saving…"}){const e=ci();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:r})=>p.jsx(Dt,{type:"submit",disabled:!i||r,children:r?n:t})})}const{useAppForm:pi}=Mt({fieldContext:ui,formContext:di,fieldComponents:{TextField:hi,TextareaField:fi,SelectField:mi,SwitchField:gi,CheckboxField:vi,PasswordField:bi},formComponents:{SubmitButton:Fi}});export{x as a,pi as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as h,e3 as te,j as i,dP as ne,dQ as se,dR as oe,ap as _,dS as re,e4 as ie,G as Y,e5 as ce,X as ae,x as le,C as ue,e6 as de}from"./index-OQuvRZTD.js";import{T as fe,a as me}from"./index.esm-CAeUe7uQ.js";import{a as d}from"./index-CoKNU2F9.js";import{u as z,a as he}from"./use-transform-ByJGn3hq.js";import{I as pe}from"./image-off-C1uTDs9-.js";const J={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/avif":"avif","image/svg+xml":"svg"},xe=new Set(["png","jpg","jpeg","gif","webp","avif","svg"]);function G(n,s){var u;const o=/^(.*)\.([a-z0-9]{1,5})$/i.exec(n),e=(o?o[1]:n)||"image",c=(u=o==null?void 0:o[2])==null?void 0:u.toLowerCase(),a=(s?J[s.split(";")[0].trim()]:void 0)??(c&&xe.has(c)?c:"png");return`${e}.${a}`}function ge(n){var s;if(n.downloadName)return n.downloadName;if(n.src.startsWith("data:")){const o=((s=/^data:([^;,]+)/.exec(n.src))==null?void 0:s[1])??"";return`image.${J[o]??"png"}`}try{const o=new URL(n.src,"http://local").pathname.split("/").pop()??"",e=decodeURIComponent(o);return/\.[a-z0-9]{2,5}$/i.test(e)?e:"image"}catch{return"image"}}function $(n,s,o){const e=document.createElement("a");e.href=n,e.download=s,o&&(e.target="_blank",e.rel="noopener noreferrer"),document.body.append(e),e.click(),e.remove()}async function be(n){const s=ge(n);try{const o=await fetch(n.src);if(!o.ok)throw new Error(`HTTP ${o.status}`);const e=await o.blob(),c=URL.createObjectURL(e);$(c,G(s,e.type),!1),setTimeout(()=>URL.revokeObjectURL(c),1e3)}catch{$(n.src,G(s),!0)}}function H(n,s,o){const e=Math.min(s.width/n.width,s.height/n.height),c=o?e:Math.min(e,1),f=n.width*c,a=n.height*c;return{left:s.left+(s.width-f)/2,top:s.top+(s.height-a)/2,width:f,height:a}}function q(n,s,o){const e={width:n.naturalWidth,height:n.naturalHeight};if(e.width===0||e.height===0)return null;const c=n.getBoundingClientRect();if(c.width===0||c.height===0||!(c.bottom>0&&c.right>0&&c.top<o.height&&c.left<o.width))return null;const a=H(e,c,!0),u=H(e,s,!1);return{x:a.left+a.width/2-(s.left+s.width/2),y:a.top+a.height/2-(s.top+s.height/2),scale:a.width/u.width}}const ye=8,we=110,ve=70,V=.5,je=6,O={type:"spring",stiffness:520,damping:42};function Se(n){const s=h.useRef(n);h.useLayoutEffect(()=>{s.current=n});const o=h.useRef(new Set),e=h.useRef(null),c=h.useRef(null),f=h.useRef(!1),a=()=>{const{x:r,y:l,scale:x,backdrop:y}=s.current;d(r,0,O),d(l,0,O),d(x,1,O),d(y,1,O)},u=r=>{var l;if(c.current={x:r.clientX,y:r.clientY},f.current=!1,r.pointerType!=="mouse"){if(o.current.add(r.pointerId),o.current.size>1){(l=e.current)!=null&&l.axis&&a(),e.current=null;return}e.current=s.current.canGesture()?{id:r.pointerId,startX:r.clientX,startY:r.clientY,startTime:r.timeStamp,axis:null}:null}},j=r=>{c.current&&Math.hypot(r.clientX-c.current.x,r.clientY-c.current.y)>je&&(f.current=!0);const l=e.current;if(!l||l.id!==r.pointerId)return;const x=r.clientX-l.startX,y=r.clientY-l.startY;if(l.axis===null){if(Math.max(Math.abs(x),Math.abs(y))<ye)return;l.axis=Math.abs(y)>Math.abs(x)?"y":"x"}const{x:v,y:k,scale:C,backdrop:S,canStep:T}=s.current;if(l.axis==="y"){const N=Math.min(Math.abs(y)/320,1);k.set(y),C.set(1-N*.12),S.set(1-N*.7)}else v.set(T(x<0?1:-1)?x:x*.25)},p=r=>{o.current.delete(r.pointerId);const l=e.current;if(!l||l.id!==r.pointerId||(e.current=null,l.axis===null))return;const x=Math.max(r.timeStamp-l.startTime,1),{canStep:y,onDismiss:v,onStep:k}=s.current;if(r.type==="pointercancel"){a();return}if(l.axis==="y"){const N=r.clientY-l.startY;Math.abs(N)>we||Math.abs(N)/x>V?v():a();return}const C=r.clientX-l.startX,S=C<0?1:-1;(Math.abs(C)>ve||Math.abs(C)/x>V)&&y(S)?k(S):a()};return{handlers:{onPointerDown:u,onPointerMove:j,onPointerUp:p,onPointerCancel:p},endedDrag:()=>f.current}}const A={type:"spring",stiffness:360,damping:34,mass:.9},U={type:"spring",stiffness:420,damping:40},P={duration:.16,ease:"easeOut"},Q=72,w=n=>n.stopPropagation(),Ne={onClick:w,onDoubleClick:w,onContextMenu:w,onKeyDown:w,onKeyUp:w,onPointerDown:w,onPointerMove:w,onPointerUp:w,onPointerCancel:w,onTouchStart:w,onTouchMove:w,onTouchEnd:w,onWheel:w};function Ie({open:n,onOpenChange:s,images:o,index:e,onIndexChange:c,getTrigger:f}){const a=te()===!0,u=z(0),j=z(0),p=z(1),r=z(1),l=z(0),x=he(l,[.55,1],[0,1]),y=h.useRef(null),v=h.useRef("idle"),k=h.useRef(!1),C=h.useRef(async()=>{}),S=h.useRef(null),[T,N]=h.useState(null),[ee,F]=h.useState({}),g=o[e],E=o.length,B=g?ee[g.src]??"loading":"loading",D=g!==void 0&&T===g.src;h.useLayoutEffect(()=>{var L,R;if(!n)return;v.current="idle",k.current=!1,S.current=null,u.set(0),j.set(0),p.set(1),d(l,1,a?P:{duration:.24,ease:"easeOut"});const t=(L=f==null?void 0:f(e))==null?void 0:L.querySelector("img"),m=(R=y.current)==null?void 0:R.getBoundingClientRect(),b=!a&&t&&m?q(t,m,{width:window.innerWidth,height:window.innerHeight}):null;b?(u.set(b.x),j.set(b.y),p.set(b.scale),r.set(1),d(u,0,A),d(j,0,A),d(p,1,A)):(r.set(0),a||p.set(.96),d(r,1,P),d(p,1,P))},[n]),h.useLayoutEffect(()=>{const t=S.current;t!==null&&(S.current=null,j.set(0),p.set(1),u.set(a?0:t*Q),d(u,0,O),d(r,1,P).then(()=>{v.current="idle",k.current&&(k.current=!1,C.current())}))},[e,r,a,u,j,p]),h.useEffect(()=>{if(n)for(const t of[o[e-1],o[e+1]])t&&(new Image().src=t.src)},[n,o,e]);const I=h.useCallback(async()=>{var R,X;if(v.current==="closing")return;if(v.current==="stepping"){k.current=!0;return}v.current="closing",N(null);const t=(R=f==null?void 0:f(e))==null?void 0:R.querySelector("img"),m=(X=y.current)==null?void 0:X.getBoundingClientRect(),b=!a&&!D&&t&&m?q(t,m,{width:window.innerWidth,height:window.innerHeight}):null,L=d(l,0,a?P:{duration:.22,ease:"easeIn"});b?await Promise.all([d(u,b.x,U),d(j,b.y,U),d(p,b.scale,U),L]):await Promise.all([d(r,0,P),a?null:d(p,p.get()*.96,P),L]),s==null||s(!1)},[l,f,e,s,r,a,p,u,j,D]);h.useLayoutEffect(()=>{C.current=I},[I]);const M=h.useCallback(async t=>{const m=e+t;v.current!=="idle"||m<0||m>=E||(v.current="stepping",await Promise.all([a?null:d(u,-t*Q+u.get()*.5,P),d(r,0,{duration:.1})]),S.current=t,c(m))},[E,e,c,r,a,u]),K=Se({x:u,y:j,scale:p,backdrop:l,canGesture:()=>v.current==="idle"&&!D,canStep:t=>e+t>=0&&e+t<E,onDismiss:()=>void I(),onStep:t=>void M(t)});return g?i.jsx(ne,{open:n,onOpenChange:t=>{t||I()},children:i.jsx(se,{container:document.body,children:i.jsxs("div",{className:"contents",...Ne,children:[i.jsx(oe,{asChild:!0,children:i.jsx(_.div,{"data-slot":"image-lightbox-backdrop",style:{opacity:l},className:"bg-background/90 fixed inset-0 z-50 backdrop-blur-xl"})}),i.jsxs(re,{"data-slot":"image-lightbox","aria-describedby":void 0,onOpenAutoFocus:t=>{var m;t.preventDefault(),(m=t.currentTarget)==null||m.focus()},onFocusOutside:t=>t.preventDefault(),onCloseAutoFocus:t=>{const m=f==null?void 0:f(e);m&&(t.preventDefault(),m.focus({preventScroll:!0}))},onKeyDown:t=>{t.key==="ArrowRight"?M(1):t.key==="ArrowLeft"&&M(-1)},onClick:t=>{var R,X;const m=t.target;if(K.endedDrag()||m.closest("button"))return;const b=(X=(R=y.current)==null?void 0:R.querySelector("img"))==null?void 0:X.getBoundingClientRect();b!==void 0&&t.clientX>=b.left&&t.clientX<=b.right&&t.clientY>=b.top&&t.clientY<=b.bottom||I()},...K.handlers,className:"fixed inset-0 z-50 flex touch-none flex-col outline-none select-none",children:[i.jsx(ie,{className:"sr-only",children:g.alt||"Image"}),i.jsxs(_.div,{style:{opacity:x},className:"flex shrink-0 items-center justify-between gap-2 pt-[max(0.75rem,env(safe-area-inset-top))] pr-[max(0.75rem,env(safe-area-inset-right))] pb-2 pl-[max(0.75rem,env(safe-area-inset-left))]",children:[i.jsxs("p",{"aria-live":"polite",className:Y("text-muted-foreground px-2 text-sm tabular-nums",E<2&&"invisible"),children:[e+1," of ",E]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(W,{label:"Download image",onClick:()=>void be(g),children:i.jsx(ce,{className:"size-[18px]"})}),i.jsx(W,{label:"Close",onClick:()=>void I(),children:i.jsx(ae,{className:"size-5"})})]})]}),i.jsxs("div",{className:"relative min-h-0 flex-1 px-3 sm:px-20",children:[i.jsxs("div",{ref:y,className:"relative h-full w-full",children:[i.jsx(_.div,{style:{x:u,y:j,scale:p,opacity:r},className:"h-full w-full",children:i.jsx(fe,{centerOnInit:!0,minScale:1,maxScale:8,doubleClick:{mode:"toggle",step:1.2},wheel:{step:.15},panning:{disabled:!D,velocityDisabled:!0},onTransform:(t,m)=>N(m.scale>1.01?g.src:null),children:i.jsx(me,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:B==="error"?i.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[i.jsx(pe,{"aria-hidden":!0,className:"size-4"}),"This image couldn’t be loaded."]}):i.jsx("img",{src:g.src,alt:g.alt,draggable:!1,onLoad:()=>F(t=>({...t,[g.src]:"loaded"})),onError:()=>F(t=>({...t,[g.src]:"error"})),className:Y("max-h-full max-w-full rounded-lg object-contain shadow-2xl shadow-black/25",D?"cursor-grab active:cursor-grabbing":"cursor-zoom-in")})})},g.src)}),B==="loading"&&i.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:i.jsx(le,{size:"md",label:"Loading image",className:"text-muted-foreground"})})]}),e>0&&i.jsx(Z,{direction:-1,fade:x,onClick:()=>void M(-1)}),e<E-1&&i.jsx(Z,{direction:1,fade:x,onClick:()=>void M(1)})]}),i.jsx(_.div,{style:{opacity:x},className:"flex min-h-12 shrink-0 items-center justify-center px-6 pt-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:g.alt&&i.jsx("p",{className:"text-muted-foreground line-clamp-2 max-w-prose text-center text-sm",children:g.alt})})]})]})})}):null}function W({label:n,onClick:s,fade:o,className:e,children:c}){return i.jsx(_.button,{type:"button","aria-label":n,title:n,onClick:s,style:o?{opacity:o}:void 0,className:Y("focus-ring bg-background/70 text-foreground border-border/60 hover:bg-background","flex size-10 items-center justify-center rounded-full border shadow-sm backdrop-blur-md","transition-colors duration-150 motion-reduce:transition-none",e),children:c})}function Z({direction:n,fade:s,onClick:o}){return i.jsx(W,{label:n===1?"Next image":"Previous image",onClick:o,fade:s,className:Y("absolute top-1/2 hidden -translate-y-1/2 sm:flex",n===1?"right-4":"left-4"),children:n===1?i.jsx(ue,{className:"size-5"}):i.jsx(de,{className:"size-5"})})}export{Ie as ImageLightbox};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{O as De,aS as _e,a1 as ne,r as a,jo as He,jp as Q,jq as W,jr as U,gg as ie,js as Ce,dD as Z,jt as ee,aL as dt,ju as ut,a3 as oe,jv as ft,jw as ht,jx as pt,jy as mt,aW as Te,jz as xt,j as e,x as Fe,U as gt,C as Ue,ao as yt,el as be,jA as vt,G as Oe,jB as Ct,jC as bt,jD as jt,jE as X,jF as ve,bH as de,bI as ue,bJ as fe,bK as he,bL as pe,bM as me,bN as xe,bP as ge,B as Y,b6 as kt,es as Ae,jG as wt,jH as Et,a2 as ce,jI as qe,eR as Nt,jJ as Rt,jK as St,jL as Dt,jM as Tt,aN as je,jN as Qe,a4 as Be,ge as Pe,a0 as Ft,gQ as Ot,e2 as Le,jO as Pt,gv as Mt,jP as _t,d0 as At,d1 as Lt,d3 as zt,d4 as It,d5 as $t,eC as Kt,I as Ht,dN as Ut}from"./index-OQuvRZTD.js";import{t as ae,g as qt,C as Qt,n as Ge,r as Ye,a as Bt,p as Gt,F as Yt,w as Wt,c as We,b as Vt}from"./room-files-source-B0gc97Ri.js";import{N as ls,R as cs}from"./room-files-source-B0gc97Ri.js";import{d as Jt}from"./query-keys-DeYqUDia.js";import{r as Xt,c as Zt}from"./composer-insert-BpyATrmR.js";import{u as en}from"./index-n_pnc-CO.js";import{r as Ve,h as Je,F as tn}from"./file-drag-GDx2qhdk.js";import{R as Xe}from"./rotate-cw-B8WQa8O-.js";import{L as nn}from"./link-2-yI2Tlm7Q.js";import{F as Ze}from"./file-D80JE_L0.js";import{G as et}from"./git-branch-B8JNwQ6q.js";import{M as sn}from"./more-details-CRLU2HN4.js";import"./markdown-content-Cjhsscbn.js";import"./file-exclamation-point-CcJ_e4_m.js";/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const tt={name:"corner-left-up",size:24,node:[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]};tt.node;const an=De(tt);/**
|
|
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 nt={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};nt.node;const st=De(nt);/**
|
|
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 at={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};at.node;const rn=De(at);function le(t,n,r){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?r:null]}function we(t,n,r,m){return{queryKey:le(t,n,r),queryFn:()=>t.list(n,{showHidden:r}),staleTime:_e.FILE_TREE_STALE_TIME_MS,gcTime:_e.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:f=>f??m.getQueryData(le(t,n,!r))}}const on=[".git",".dork",".claude",".agents","node_modules"];function ln(t){return t.startsWith(".")||on.includes(t)}const Re=["ROOM.md","README.md"];function Se(t){return Re.some(n=>n.toLowerCase()===t.toLowerCase())}function rt(t){return t.filter(n=>!ln(n.name))}function cn(t){if(t.reduce((f,g)=>g.type==="file"&&Se(g.name)?f+1:f,0)===0)return t;const r=[],m=[];for(const f of t)f.type==="file"&&Se(f.name)?r.push(f):m.push(f);return r.sort((f,g)=>Re.findIndex(s=>s.toLowerCase()===f.name.toLowerCase())-Re.findIndex(s=>s.toLowerCase()===g.name.toLowerCase())),[...r,...m]}const dn=/ copy(?: \d+)?$/;function Me({name:t,isDir:n,taken:r}){const m=new Set(r);if(!m.has(t))return t;const f=n?-1:t.lastIndexOf("."),g=f>0,s=g?t.slice(f):"",p=(g?t.slice(0,f):t).replace(dn,"");for(let o=1;;o+=1){const i=o===1?`${p} copy${s}`:`${p} copy ${o}${s}`;if(!m.has(i))return i}}function ze(t,n,r){return{name:n,path:t,type:r,size:0,mtime:Date.now(),isSymlink:!1}}function un(t){const n=ne(),{source:r,showHidden:m,queryClient:f,inFlightRef:g}=t,s=r.cwd??"",[p,o]=a.useState(null),i=a.useCallback(async u=>{g.current+=1;try{return await u()}finally{g.current-=1}},[g]),d=a.useMemo(()=>{const u=x=>le(r,x,m);return{getChildren:x=>{var w;return((w=f.getQueryData(u(x)))==null?void 0:w.entries)??[]},isLoaded:x=>f.getQueryData(u(x))!==void 0,takenNames:async x=>(await n.readFileTree(s,{path:x===Q?void 0:x,showHidden:!0})).entries.map(j=>j.name),snapshot:x=>f.getQueryData(u(x)),setChildren:(x,w)=>{f.setQueryData(u(x),j=>({entries:He(w((j==null?void 0:j.entries)??[]))}))},restore:(x,w)=>{f.setQueryData(u(x),w)},invalidate:x=>{f.invalidateQueries({queryKey:u(x),exact:!0}),f.invalidateQueries({queryKey:Jt.index(s)})}}},[f,n,s,r,m]),R=a.useCallback((u,x,w)=>i(async()=>{const j=ee(u,x),D=!d.getChildren(u).some(L=>L.path===j),H=d.snapshot(u);D&&d.setChildren(u,L=>[...L,ze(j,x,w)]);try{return await n.createEntry(s,j,w),!0}catch(L){return D&&d.restore(u,H),ae(L,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{d.invalidate(u)}}),[n,s,d,i]),F=a.useCallback((u,x)=>i(async()=>{if(x===u.name||x.length===0)return!0;const w=W(u.path),j=ee(w,x),D=d.getChildren(w).some(A=>A.path===j),H=d.snapshot(w),L={...u,name:x,path:j};D||d.setChildren(w,A=>A.map(K=>K.path===u.path?L:K));try{return await n.renameEntry(s,u.path,j),U.getState().remapExpandedPaths(u.path,j),!0}catch(A){return D||d.restore(w,H),ae(A,"Couldn’t rename"),!1}finally{d.invalidate(w)}}),[n,s,d,i]),E=a.useCallback(u=>i(async()=>{const x=W(u.path),w=d.snapshot(x);d.setChildren(x,j=>j.filter(D=>D.path!==u.path));try{await n.deleteEntry(s,u.path,{recursive:!0}),U.getState().dropExpandedPaths(u.path)}catch(j){d.restore(x,w),ae(j,"Couldn’t delete")}finally{d.invalidate(x)}}),[n,s,d,i]),_=a.useCallback(u=>i(async()=>{const x=W(u.path);if(u.type==="file"){const w=d.snapshot(x);d.setChildren(x,j=>j.filter(D=>D.path!==u.path));try{await n.deleteEntry(s,u.path),U.getState().dropExpandedPaths(u.path)}catch(j){d.restore(x,w),ae(j,"Couldn’t delete")}finally{d.invalidate(x)}return}try{await n.deleteEntry(s,u.path),d.setChildren(x,w=>w.filter(j=>j.path!==u.path)),U.getState().dropExpandedPaths(u.path),d.invalidate(x)}catch(w){if(qt(w)==="DIR_NOT_EMPTY"){o(u);return}ae(w,"Couldn’t delete")}}),[n,s,d,i]),b=a.useCallback(async()=>{const u=p;o(null),u&&await E(u)},[p,E]),I=a.useCallback(()=>o(null),[]),$=a.useCallback((u,x)=>i(async()=>{const w=W(u),j=ie(u),D=ee(x,j);if(x===w||D===u||Ce(x,u))return;const H=d.getChildren(w).find(C=>C.path===u);if(!H)return;const L=d.isLoaded(x),A=L&&d.getChildren(x).some(C=>C.path===D),K={...H,name:j,path:D},G=d.snapshot(w),O=L?d.snapshot(x):void 0;d.setChildren(w,C=>C.filter(z=>z.path!==u)),L&&!A&&d.setChildren(x,C=>[...C,K]);try{await n.renameEntry(s,u,D),U.getState().remapExpandedPaths(u,D)}catch(C){d.restore(w,G),L&&!A&&d.restore(x,O),ae(C,"Couldn’t move")}finally{d.invalidate(w),L&&d.invalidate(x)}}),[n,s,d,i]),v=a.useCallback((u,x)=>i(async()=>{if(u.isDir&&Ce(x,u.path)){Z.error(Qt);return}let w;try{w=await d.takenNames(x)}catch(A){ae(A,"Couldn’t copy");return}const j=Me({name:ie(u.path),isDir:u.isDir,taken:w}),D=ee(x,j),H=d.isLoaded(x),L=H?d.snapshot(x):void 0;if(H){const A=d.getChildren(W(u.path)).find(G=>G.path===u.path),K=A?{...A,name:j,path:D}:ze(D,j,u.isDir?"dir":"file");d.setChildren(x,G=>[...G,K])}try{await n.copyEntry(s,u.path,D)}catch(A){H&&d.restore(x,L),ae(A,"Couldn’t copy")}finally{d.invalidate(x)}}),[n,s,d,i]);return{createEntry:R,renameEntry:F,removeEntry:_,moveEntry:$,copyEntry:v,pendingRecursiveDelete:p,confirmRecursiveDelete:b,cancelRecursiveDelete:I}}function fn(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function hn(t,n){const r=t.includes("\\")&&!t.includes("/"),m=t.replace(/[\\/]+$/,""),f=r?n.split("/").join("\\"):n;return`${m}${r?"\\":"/"}${f}`}function pn(t){const n=ne(),{data:r}=dt(),m=a.useMemo(()=>n.supportsReveal?fn(r==null?void 0:r.platform):null,[n.supportsReveal,r==null?void 0:r.platform]),f=a.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(d){ae(d,"Couldn’t open the file manager")}},[n,t]),{copy:g}=ut(),s=a.useCallback(async(i,d)=>{const R=d==="absolute"&&t?hn(t,i.path):i.path;await g(R)||Z.error("Couldn’t copy to the clipboard")},[t,g]),p=a.useCallback(i=>{Xt(Zt(i.path))||Z.error("Open a chat to add this file")},[]),o=a.useCallback(i=>{U.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:m,reveal:f,copyPath:s,addToChat:p,copyToClipboard:o}}const mn=1e3;function xn(t){const{source:n,showHidden:r,queryClient:m,inFlightRef:f}=t,g=n.changes,[s,p]=a.useState(null),[o,i]=a.useState(null),[d,R]=a.useState(null),[F,E]=a.useState(0),_=a.useCallback(async c=>{f.current+=1,E(h=>h+1);try{return await c()}finally{f.current-=1,E(h=>h-1)}},[f]),b=a.useMemo(()=>{const c=h=>le(n,h,r);return{listing:h=>m.getQueryData(c(h)),isLoaded:h=>m.getQueryData(c(h))!==void 0,entries:h=>{var T;return((T=m.getQueryData(c(h)))==null?void 0:T.entries)??[]},setEntries:(h,T)=>m.setQueryData(c(h),y=>({...y,entries:He(T((y==null?void 0:y.entries)??[]))})),restore:(h,T)=>m.setQueryData(c(h),T),fetch:h=>n.list(h,{showHidden:!0}),refreshAll:()=>{m.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),m.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[m,n,r]),I=a.useCallback(async c=>{const h=b.listing(c);return(h==null?void 0:h.commit)!==void 0?h.commit:(await b.fetch(c)).commit??null},[b]),$=a.useCallback((c,h,T,y)=>{switch(c.status){case"changed":return!0;case"conflict":return R({kind:h,path:c.path,lastCommit:c.lastCommit,retry:()=>T(c.commit)}),!1;case"exists":return Z.error(y===void 0?c.reason:Ge(y)),!1;case"refused":return Z.error(c.reason),!1}},[]),v=a.useCallback((c,h)=>{Z.error(Ye(c)??h)},[]),u=a.useCallback((c,h,T)=>{const y=P=>_(async()=>{if(g===void 0)return!1;const N=W(c.path),S=W(h),k=ie(h),q=b.isLoaded(S),te=q&&b.entries(S).some(J=>J.path===h),V=b.listing(N),ye=S===N?void 0:b.listing(S),l={...c,name:k,path:h};te||(S===N?b.setEntries(N,J=>J.map(se=>se.path===c.path?l:se)):(b.setEntries(N,J=>J.filter(se=>se.path!==c.path)),q&&b.setEntries(S,J=>[...J,l])));const M=()=>{b.restore(N,V),S!==N&&q&&b.restore(S,ye)};try{const J=P??await I(N);if(J===null)return M(),Z.error("This room has no files to change yet."),!1;const se=await g.move({from:c.path,to:h,baseCommit:J}),Ee=$(se,T,async re=>{await y(re)},k);return Ee?U.getState().remapExpandedPaths(c.path,h):M(),Ee}catch(J){return M(),v(J,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{b.refreshAll()}});return y(null)},[g,b,_,I,$,v]),x=a.useCallback(async(c,h)=>h===c.name||h.length===0?!0:u(c,ee(W(c.path),h),"rename"),[u]),w=a.useCallback(async(c,h)=>{const T=W(c),y=ee(h,ie(c));if(h===T||y===c||Ce(h,c))return;const P=b.entries(T).find(N=>N.path===c);P&&await u(P,y,"move")},[b,u]),j=a.useCallback(async c=>{let h=0;const T=[c];for(;T.length>0;){const y=T.shift(),P=await b.fetch(y);for(const N of P.entries)if(N.type==="dir"?T.push(N.path):h+=1,h>=mn)return{count:h,moreThan:!0}}return{count:h,moreThan:!1}},[b]),D=a.useCallback(c=>{if(c.type!=="dir"){p({entry:c,fileCount:1,moreThan:!1});return}p({entry:c,fileCount:null,moreThan:!1}),j(c.path).then(({count:h,moreThan:T})=>p(y=>(y==null?void 0:y.entry.path)===c.path?{entry:c,fileCount:h,moreThan:T}:y),()=>{})},[j]),H=a.useCallback(c=>{const h=T=>_(async()=>{if(g===void 0)return;const y=W(c.path),P=b.listing(y);b.setEntries(y,N=>N.filter(S=>S.path!==c.path));try{const N=T??await I(y);if(N===null){b.restore(y,P);return}const S=await g.remove({path:c.path,baseCommit:N});$(S,"delete",q=>h(q))?U.getState().dropExpandedPaths(c.path):b.restore(y,P)}catch(N){b.restore(y,P),v(N,"Couldn’t delete")}finally{b.refreshAll()}});return h(null)},[g,b,_,I,$,v]),L=a.useCallback(async()=>{const c=s;p(null),c&&await H(c.entry)},[s,H]),A=a.useCallback(()=>p(null),[]),K=a.useCallback((c,h,T,y)=>{const P=N=>_(async()=>{if(g===void 0)return;const S=b.isLoaded(c),k=S?b.listing(c):void 0;if(S){const q=new Set(b.entries(c).map(V=>V.name)),te=h.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(c,V.name),type:"file",size:V.size}));te.length>0&&b.setEntries(c,V=>[...V,...te])}try{const q=await g.upload({dir:c,baseCommit:N,replace:T,files:h});!$(q,"upload",V=>P(V))&&S&&b.restore(c,k)}catch(q){S&&b.restore(c,k),v(q,"Couldn’t upload")}finally{b.refreshAll()}});return P(y)},[g,b,_,$,v]),G=a.useCallback(async(c,h)=>{if(g===void 0||h.length===0)return;if(h.length>g.maxUploadFiles){Z.error(`Nothing was uploaded. One upload takes up to ${g.maxUploadFiles} files.`);return}let T;try{T=await b.fetch(c)}catch(k){v(k,"Couldn’t upload");return}const y=T.entries.map(k=>k.name),P=new Set(y),N=h.map(k=>k.name).filter(k=>P.has(k)),S=T.commit??null;if(N.length===0){await K(c,h,[],S);return}i({dir:c,files:h,names:N,taken:y,baseCommit:S})},[g,b,v,K]),O=a.useCallback(async c=>{const h=o;if(i(null),h===null)return;if(c==="replace"){await K(h.dir,h.files,h.names,h.baseCommit);return}const T=new Set([...h.taken,...h.files.map(N=>N.name)]),y=new Set(h.names),P=h.files.map(N=>{if(!y.has(N.name))return N;const S=Me({name:N.name,isDir:!1,taken:T});return T.add(S),new File([N],S,{type:N.type,lastModified:N.lastModified})});await K(h.dir,P,[],h.baseCommit)},[o,K]),C=a.useCallback(()=>i(null),[]),z=a.useCallback(()=>R(null),[]),B=a.useMemo(()=>o===null?null:{dir:o.dir,names:o.names},[o]);return{renameEntry:x,moveEntry:w,requestDelete:D,pendingDelete:s,confirmDelete:L,cancelDelete:A,upload:G,pendingClash:B,resolveClash:O,cancelClash:C,conflict:d,dismissConflict:z,busy:F>0}}const Ie={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function gn(t){var c,h,T;const n=ne(),r=oe(),{setTheme:m}=ft(),f=U(y=>y.showHidden),g=U(y=>y.expanded),s=U(y=>y.loadExplorerForCwd),p=U(y=>y.pruneMissing),o=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;a.useEffect(()=>{s(o)},[o,s]);const d=a.useMemo(()=>[Q,...ht(g)],[g]),R=pt({queries:t?d.map(y=>we(t,y,f,r)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,E=a.useMemo(()=>{const y={};return d.forEach((P,N)=>{var q;const S=R[N];let k=((q=S==null?void 0:S.data)==null?void 0:q.entries)??[];!f&&!F&&(k=rt(k)),P===Q&&(k=cn(k)),y[P]={entries:k,loading:(S==null?void 0:S.isLoading)??!1,error:(S==null?void 0:S.isError)??!1}}),y},[d,R,f,F]),_=a.useRef(0),b=a.useRef({});a.useEffect(()=>{_.current>0||d.forEach((y,P)=>{var S,k,q;const N=(k=(S=R[P])==null?void 0:S.data)==null?void 0:k.entries;!N||(q=R[P])!=null&&q.isError||b.current[y]!==N&&(b.current[y]=N,p(y,N.map(te=>te.name)))})},[d,R,p]);const I=a.useMemo(()=>mt(g,E),[g,E]),$=!!t&&!!((c=E[Q])!=null&&c.loading),v=!!t&&!!((h=E[Q])!=null&&h.error),u=(T=R[0])==null?void 0:T.error,x=v&&u?Bt(u):void 0,w=(x==null?void 0:x.message)??null,j=(x==null?void 0:x.command)??null,D=a.useMemo(()=>{var P;const y=new Set;for(const N of d)N!==Q&&((P=E[N])!=null&&P.error)&&y.add(N);return y},[d,E]),H=a.useCallback(y=>{if(y.type!=="dir")return;const P=U.getState();P.setDirExpanded(y.path,!P.expanded[y.path])},[]),L=a.useCallback(y=>{if(y===Q)return;const P=U.getState();P.expanded[y]||P.setDirExpanded(y,!0)},[]),A=(t==null?void 0:t.preview)==="canvas",K=a.useCallback(y=>{if(y.type!=="file"||!A)return;const P={getStore:Te.getState,setTheme:m,supportsTerminal:n.supportsTerminal};xt(P,{action:"open_file",sourcePath:y.path},"user")},[A,m,n]),G=a.useCallback(()=>{o!==null&&r.invalidateQueries({queryKey:["file-explorer","tree",o]})},[r,o]),O=a.useCallback(y=>{t!==null&&r.invalidateQueries({queryKey:le(t,y,f),exact:!0})},[r,t,f]);a.useEffect(()=>{if(t!=null&&t.events)return t.events(G)},[t,G]);const C=un({source:t??Ie,showHidden:f,queryClient:r,inFlightRef:_}),z=xn({source:t??Ie,showHidden:f,queryClient:r,inFlightRef:_}),B=pn(i);return{rows:I,rootLoading:$,rootError:v,rootErrorMessage:w,rootErrorCommand:j,errorPaths:D,toggleExpand:H,ensureExpanded:L,openFile:K,reload:G,retryDir:O,changes:t!=null&&t.changes?z:null,...C,...B}}function yn(t){const{transport:n,cwd:r}=t;return{scopeKey:r,cwd:r,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(m,f){return n.readFileTree(r,{path:m===""?void 0:m,showHidden:f.showHidden})}}}function ke(t){return Array.from(t).includes("Files")}function ot(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(g=>"webkitGetAsEntry"in g)))return{files:Array.from(t.files??[]),folders:0};const m=[];let f=0;for(const g of n){if(g.kind!=="file")continue;const s=g.webkitGetAsEntry();if(s!=null&&s.isDirectory){f+=1;continue}const p=g.getAsFile();p&&m.push(p)}return{files:m,folders:f}}const vn=12;function Cn({row:t,selected:n,renaming:r,error:m,onSelect:f,onActivate:g,onRetry:s,onSubmitRename:p,onCancelRename:o,onNewFile:i,onNewFolder:d,onStartRename:R,onDelete:F,onMove:E,onCopyInto:_,onCopy:b,onPaste:I,onDuplicate:$,canPasteInto:v,revealLabel:u,onReveal:x,onAddToChat:w,onCopyPath:j,readOnly:D=!1,provenance:H=!1,copyable:L=!0,onDisk:A=!0,onUpload:K,onPickUpload:G}){const{entry:O,depth:C,expanded:z,loading:B}=t,c=O.type==="dir",h=c?O.path:W(O.path),[T,y]=a.useState(!1),P=!c&&C===0&&Se(O.name),N=Gt(O.lastCommit),S=e.jsxs("div",{role:"treeitem","aria-label":O.name,"aria-expanded":c?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),f(O),g(O))},draggable:!r&&!D,onDragStart:k=>{D||(k.dataTransfer.setData("text/plain",O.path),k.dataTransfer.setData(tn,O.path),k.dataTransfer.effectAllowed="copyMove")},onDragOver:k=>{if(k.stopPropagation(),!D&&K&&ke(k.dataTransfer.types)){k.preventDefault(),k.dataTransfer.dropEffect="copy",y(!0);return}D||!c||!Je(k.dataTransfer.types)||(k.preventDefault(),k.dataTransfer.dropEffect=k.altKey&&L?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:k=>{if(k.stopPropagation(),D)return;if(y(!1),K&&ke(k.dataTransfer.types)){k.preventDefault();const{files:te}=ot(k.dataTransfer);K(h,te);return}if(!c)return;const q=Ve(k.dataTransfer);q!==null&&(k.preventDefault(),k.altKey&&L?_(q,O.path):E(q,O.path))},onClick:()=>{f(O),g(O)},className:Oe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:C*vn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:c&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):m?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:k=>{k.stopPropagation(),s()},className:"flex items-center justify-center",children:e.jsx(Xe,{className:"text-destructive size-3.5"})}):z?e.jsx(gt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ue,{className:"text-muted-foreground size-3.5"}))}),c?z?e.jsx(yt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):O.isSymlink===!0?e.jsx(nn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ze,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),r?e.jsx(bn,{initialName:O.name,onSubmit:k=>p(O,k),onCancel:o}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:O.name}),P&&!r&&e.jsx(vt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),H&&!r&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:N.title??void 0,children:N.label})]});return D?S:e.jsxs(Ct,{children:[e.jsx(bt,{asChild:!0,children:S}),e.jsxs(jt,{className:"w-52",children:[e.jsx(X,{movesFocus:!0,onClick:()=>i(h),children:"New file"}),e.jsx(X,{movesFocus:!0,onClick:()=>d(h),children:"New folder"}),G&&e.jsx(X,{onClick:()=>G(h),children:"Upload files…"}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),u&&e.jsx(X,{onClick:()=>x(O),children:u}),e.jsx(X,{movesFocus:!0,onClick:()=>w(O),children:"Add to chat"})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{}),e.jsx(X,{onClick:()=>b(O),children:"Copy"}),e.jsx(X,{disabled:!v(h),onClick:()=>I(h),children:"Paste"}),e.jsx(X,{onClick:()=>$(O),children:"Duplicate"})]}),e.jsx(ve,{}),A?e.jsxs(e.Fragment,{children:[e.jsx(X,{onClick:()=>j(O,"absolute"),children:"Copy path"}),e.jsx(X,{onClick:()=>j(O,"relative"),children:"Copy relative path"})]}):e.jsx(X,{onClick:()=>j(O,"relative"),children:"Copy path"}),e.jsx(ve,{}),e.jsx(X,{movesFocus:!0,onClick:()=>R(O),children:"Rename"}),e.jsx(X,{variant:"destructive",onClick:()=>F(O),children:"Delete"})]})]})}function bn({initialName:t,onSubmit:n,onCancel:r}){const m=a.useRef(null),[f,g]=a.useState(t);a.useEffect(()=>{const p=m.current;if(!p)return;p.focus();const o=t.lastIndexOf(".");p.setSelectionRange(0,o>0?o:t.length)},[t]);const s=()=>{const p=f.trim();p&&p!==t?n(p):r()};return e.jsx("input",{ref:m,type:"text",value:f,"aria-label":"New name",onChange:p=>g(p.target.value),onClick:p=>p.stopPropagation(),onBlur:s,onKeyDown:p=>{p.stopPropagation(),p.key==="Enter"?s():p.key==="Escape"&&r()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const jn=100,kn=28,wn=250;function En(t){const{rows:n,selectedPath:r,renamingPath:m,errorPaths:f,onSelectPath:g,onRetryDir:s}=t,p=a.useRef(null),o=U(C=>C.setScrollTop),i=U(C=>C.scopeKey),d=a.useCallback(C=>C.type==="dir"?t.onToggle(C):t.onOpen(C),[t]),R=Rn(t,d),F=n.length>jn,E=en({count:n.length,getScrollElement:()=>p.current,estimateSize:()=>kn,overscan:12,enabled:F}),_=a.useRef({scope:void 0,done:!1}),b=a.useRef(null);a.useLayoutEffect(()=>{const C=_.current;if(C.scope!==i&&(C.scope=i,C.done=!1),C.done||n.length===0)return;const z=p.current;if(!z)return;const B=U.getState().scrollTop;if(B<=0){C.done=!0;return}F?E.scrollToOffset(B):z.scrollTop=B,b.current=z.scrollTop,z.scrollTop>=B&&(C.done=!0)},[n.length,i,F,E]);const I=a.useRef(null),$=a.useRef(null),v=a.useCallback(()=>{const C=p.current;C&&C.scrollTop!==b.current&&(_.current.done=!0,I.current=C.scrollTop,$.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,I.current!==null&&o(I.current)},wn))},[o]);a.useEffect(()=>()=>{$.current&&clearTimeout($.current),I.current!==null&&o(I.current)},[o]);const u=a.useRef(void 0);a.useEffect(()=>{var c,h;const C=u.current;if(u.current=r,C===void 0||r===C||r===null)return;const z=n.findIndex(T=>T.entry.path===r);if(z<0)return;const B=p.current;B&&(F?E.scrollToIndex(z,{align:"auto"}):(h=(c=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"}),b.current=B.scrollTop)},[r,n,F,E]);const[x,w]=a.useState(!1),{onCopyInto:j,onMove:D}=t,H=t.readOnly===!0,L=t.copyable!==!1,A=a.useCallback(C=>{H||!Je(C.dataTransfer.types)||(C.preventDefault(),C.dataTransfer.dropEffect=C.altKey&&L?"copy":"move",w(!0))},[H,L]),K=a.useCallback((C,z)=>{const B=n.find(c=>c.entry.path===C);B&&j({path:C,isDir:B.entry.type==="dir"},z)},[n,j]),G=a.useCallback(C=>{if(w(!1),H)return;const z=Ve(C.dataTransfer);z!==null&&(C.preventDefault(),C.altKey&&L?K(z,Q):D(z,Q))},[K,D,H,L]),O=C=>e.jsx(Cn,{row:C,selected:C.entry.path===r,renaming:C.entry.path===m,error:C.entry.type==="dir"&&C.expanded&&f.has(C.entry.path),onSelect:z=>g(z.path),onActivate:d,onRetry:()=>s(C.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:K,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:p,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:R,onScroll:v,onDragOver:A,onDragLeave:()=>w(!1),onDrop:G,className:Oe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",x&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:E.getTotalSize()},className:"relative w-full",children:E.getVirtualItems().map(C=>e.jsx("div",{"data-row-index":C.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${C.start}px)`},children:O(n[C.index])},n[C.index].entry.path))}):n.map((C,z)=>e.jsx("div",{"data-row-index":z,children:O(C)},C.entry.path))})}function Nn(t){return t?t.type==="dir"?t.path:W(t.path):Q}function Rn(t,n){const{rows:r,selectedPath:m,renamingPath:f,onSelectPath:g}=t;return a.useCallback(s=>{var i,d,R,F;if(f!==null)return;const p=r.findIndex(E=>E.entry.path===m),o=p>=0?r[p]:void 0;if(s.metaKey||s.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const E=s.key.toLowerCase();if(E==="c"&&o){s.preventDefault(),t.onCopy(o.entry);return}if(E==="v"){s.preventDefault(),t.onPaste(Nn(o==null?void 0:o.entry));return}return}switch(s.key){case"ArrowDown":s.preventDefault(),g(((i=r[Math.min(p+1,r.length-1)])==null?void 0:i.entry.path)??((d=r[0])==null?void 0:d.entry.path));break;case"ArrowUp":s.preventDefault(),g(((R=r[Math.max(p-1,0)])==null?void 0:R.entry.path)??((F=r[0])==null?void 0:F.entry.path));break;case"ArrowRight":(o==null?void 0:o.entry.type)==="dir"&&!o.expanded&&(s.preventDefault(),t.onToggle(o.entry));break;case"ArrowLeft":if(!o)break;if(s.preventDefault(),o.entry.type==="dir"&&o.expanded)t.onToggle(o.entry);else{const E=W(o.entry.path);E&&g(E)}break;case"Enter":o&&(s.preventDefault(),n(o.entry));break;case"F2":o&&t.readOnly!==!0&&(s.preventDefault(),t.onStartRename(o.entry));break;case"Delete":case"Backspace":o&&t.readOnly!==!0&&(s.preventDefault(),t.onDelete(o.entry));break}},[r,m,f,g,t,n])}const Sn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Dn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Tn(t){const{entry:n,fileCount:r,moreThan:m}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const f=r===null?"everything in it":m?`the more than ${r.toLocaleString()} files in it`:r===1?"the 1 file in it":`the ${r.toLocaleString()} files in it`;return`“${n.name}” and ${f} leave the room’s files.`}const Fn="The room’s history keeps a copy. An agent can restore it.";function On({changes:t,onOpenTheirs:n,onReturnFocus:r}){var E;const m=_=>{_.preventDefault();const b=document.activeElement;b!==null&&b!==document.body||r()},{pendingDelete:f,pendingClash:g,conflict:s}=t,[p,o]=a.useState(f);f!==null&&f!==p&&o(f);const[i,d]=a.useState(g);g!==null&&g!==i&&d(g);const R=i===null?"":i.dir===Q?"The top folder":`“${i.dir}”`,F=(i==null?void 0:i.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(de,{open:f!==null,onOpenChange:_=>!_&&t.cancelDelete(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:p===null?"":`Delete “${p.entry.name}”?`}),e.jsx(pe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:p===null?"":Tn(p)}),e.jsx("p",{children:Fn})]})})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ge,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(p==null?void 0:p.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(de,{open:g!==null,onOpenChange:_=>!_&&t.cancelClash(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(pe,{children:F?`${R} already has a file with this name. Replace it, or keep both.`:`${R} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ge,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(de,{open:s!==null,onOpenChange:_=>!_&&t.dismissConflict(),children:e.jsxs(ue,{onCloseAutoFocus:m,children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Somebody changed this first"}),e.jsx(pe,{children:s===null?"":`${((E=s.lastCommit)==null?void 0:E.author)??"Somebody"} changed “${s.path}” after you opened it, so ${Dn[s.kind]}.`})]}),(s==null?void 0:s.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.lastCommit.subject," · ",kt(s.lastCommit.at)]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>{s!==null&&(t.dismissConflict(),n(s.path))},children:"Open their version"}),e.jsx(ge,{onClick:()=>{s!==null&&(t.dismissConflict(),s.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:s===null?"":Sn[s.kind]})]})]})})]})}function $e(t,n){return n.name===t?Ge(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function Mn({source:t,className:n,onCommands:r}={}){var ye;const m=ne(),f=Te(l=>l.selectedCwd),g=a.useMemo(()=>f?yn({transport:m,cwd:f}):null,[m,f]),s=t===void 0?g:t,p=s!==null&&!s.writable,o=gn(s),i=o.changes,d=oe(),R=U(l=>l.showHidden),{rows:F,rootLoading:E,rootError:_,rootErrorMessage:b,rootErrorCommand:I,errorPaths:$}=o,v=U(l=>l.setCommands),u=U(l=>l.selectedPath),x=U(l=>l.setSelectedPath),w=U(l=>l.clipboard),[j,D]=a.useState(null),[H,L]=a.useState(null),[A,K]=a.useState(null),G=a.useCallback(l=>K(l===null?null:{path:l,isNew:!1}),[]),O=a.useRef(null),C=a.useRef(Q),[z,B]=a.useState(!1),c=a.useCallback((l,M)=>{if(i!==null){if(M.length===0){Z.error(Pn);return}o.ensureExpanded(l),i.upload(l,M)}},[i,o]),h=a.useRef(null),T=a.useCallback(()=>{var l,M;(M=(l=h.current)==null?void 0:l.querySelector('[role="tree"]'))==null||M.focus()},[]),y=a.useCallback(l=>{var M;C.current=l,(M=O.current)==null||M.click()},[]),P=a.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),N=a.useCallback((l,M)=>{o.ensureExpanded(l),Ae.flushSync(()=>{L(null),D({parent:l,type:M})})},[o]),S=a.useCallback(l=>{Ae.flushSync(()=>L(l.path))},[]),k=a.useRef({startCreate:N,reload:o.reload,pickUpload:y});a.useEffect(()=>{k.current={startCreate:N,reload:o.reload,pickUpload:y}});const q=i!==null;a.useEffect(()=>{if(p||r===void 0&&q)return;const l=r??v;return l({newFile:()=>k.current.startCreate(Q,"file"),newFolder:()=>k.current.startCreate(Q,"dir"),refresh:()=>k.current.reload(),...q&&{upload:()=>k.current.pickUpload(Q)}}),()=>l(null)},[v,r,p,q]);const te=a.useCallback(async l=>{var se;if(!j||s===null)return;const M=j;if(D(null),i!==null){const re=(((se=d.getQueryData(le(s,M.parent,R)))==null?void 0:se.entries)??[]).find(ct=>ct.name.toLowerCase()===l.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){Z.error($e(l,re));return}D({parent:ee(M.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){Z.error($e(l,re));return}const lt=ee(M.parent,l);K({path:lt,isNew:!0});return}await o.createEntry(M.parent,l,M.type)&&x(ee(M.parent,l))},[j,s,i,d,R,o,x]),V=a.useCallback(async(l,M)=>{L(null),(i?await i.renameEntry(l,M):await o.renameEntry(l,M))&&x(ee(W(l.path),M))},[i,o,x]);return s===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:h,className:Oe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:l=>{i===null||!ke(l.dataTransfer.types)||(l.preventDefault(),l.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:l=>{l.currentTarget.contains(l.relatedTarget)||B(!1)},onDrop:l=>{B(!1),!(i===null||!ke(l.dataTransfer.types))&&(l.preventDefault(),c(Q,ot(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:O,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:l=>{const M=Array.from(l.target.files??[]);l.target.value="",c(C.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[j&&e.jsx(_n,{type:j.type,firstInFolder:j.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>D(null)},`${j.parent}:${j.type}:${j.firstInFolder??""}`),E&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):_&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:b??"Couldn’t load files."}),I!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:I}),e.jsxs(Y,{variant:"outline",size:"xs",onClick:o.reload,children:[e.jsx(Xe,{}),"Retry"]})]}):F.length===0&&!j?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(En,{rows:F,selectedPath:u,renamingPath:H,errorPaths:$,onSelectPath:x,onToggle:o.toggleExpand,onOpen:l=>{s.preview==="inline"?G(l.path):o.openFile(l)},onRetryDir:o.retryDir,onSubmitRename:(l,M)=>void V(l,M),onCancelRename:()=>L(null),onStartRename:S,onNewFile:l=>N(l,"file"),onNewFolder:l=>N(l,"dir"),onDelete:l=>i?i.requestDelete(l):void o.removeEntry(l),onMove:(l,M)=>void(i?i.moveEntry(l,M):o.moveEntry(l,M)),onCopyInto:(l,M)=>void o.copyEntry(l,M),onCopy:o.copyToClipboard,onPaste:l=>{w&&o.copyEntry(w,l)},onDuplicate:l=>void o.copyEntry({path:l.path,isDir:l.type==="dir"},W(l.path)),canPasteInto:P,readOnly:p,provenance:s.provenance,copyable:i===null,onDisk:s.cwd!==null,onUpload:i?c:void 0,onPickUpload:i?y:void 0,revealLabel:o.revealLabel,onReveal:l=>void o.reveal(l),onAddToChat:o.addToChat,onCopyPath:(l,M)=>void o.copyPath(l,M)})]}),s.preview==="inline"&&e.jsx(Yt,{source:s,path:(A==null?void 0:A.path)??null,isNew:(A==null?void 0:A.isNew)??!1,onCreated:()=>{A!==null&&(K({path:A.path,isNew:!1}),x(A.path))},onClose:()=>K(null)}),i!==null&&e.jsx(On,{changes:i,onOpenTheirs:l=>G(l),onReturnFocus:T}),e.jsx(de,{open:o.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&o.cancelRecursiveDelete(),children:e.jsxs(ue,{children:[e.jsxs(fe,{children:[e.jsxs(he,{children:["Delete “",(ye=o.pendingRecursiveDelete)==null?void 0:ye.name,"”?"]}),e.jsx(pe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(me,{children:[e.jsx(xe,{onClick:o.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ge,{onClick:()=>void o.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function _n({type:t,firstInFolder:n,onSubmit:r,onCancel:m}){const f=a.useRef(null),[g,s]=a.useState("");a.useEffect(()=>{var i;(i=f.current)==null||i.focus()},[]);const p=()=>{const i=g.trim();i?r(i):m()},o=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ze,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:f,type:"text",value:g,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>s(i.target.value),onBlur:p,onKeyDown:i=>{i.key==="Enter"?p():i.key==="Escape"&&m()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:o}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),o,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function it(){const t=U(m=>m.showHidden),n=U(m=>m.setShowHidden),r=t?"Hide hidden files":"Show hidden files";return e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":r,title:r,onClick:()=>n(!t),children:t?e.jsx(wt,{className:"text-muted-foreground"}):e.jsx(Et,{className:"text-muted-foreground"})})}function An({cwd:t}){const n=ne(),{data:r}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return r!=null&&r.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${r.key} on ${r.branch}`,children:[e.jsx(et,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:r.branch})]}):null}function ss(){const t=Te(r=>r.selectedCwd),n=U(r=>r.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(An,{cwd:t}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(st,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(qe,{className:"text-muted-foreground"})}),e.jsx(it,{}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(Nt,{className:"text-muted-foreground"})})]}):null}function Ln({roomId:t}){const n=ne(),r=oe(),m=ce(Qe(n,t));a.useEffect(()=>Wt(r,t,()=>{r.invalidateQueries({queryKey:je.repoStatus(t)})}),[r,t]);const f=a.useMemo(()=>{var o;return((o=m.data)==null?void 0:o.kind)==="ok"?Rt(m.data.status):[]},[m.data]),g=St(f),s=Dt(f);if(!s)return null;const p=f.map((o,i)=>`${g[i]}: ${Tt(o)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:p.join(`
|
|
17
|
-
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(et,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",p.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:s})]})}const zn={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},In=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var I,$;const n=ne(),r=oe(),m=ce(Qe(n,t)),[f,g]=a.useState([]),[s,p]=a.useState(!1),[o,i]=a.useState(null),d=Be({mutationFn:v=>n.repairRoomMain(t,v),onSuccess:()=>{g([]),p(!1),i(null),r.invalidateQueries({queryKey:je.repoStatus(t)})},onError:v=>{p(!1);const u=In.get(Pe(v)??"");i(u??"Couldn’t update the files. Try again in a moment."),r.invalidateQueries({queryKey:je.repoStatus(t)})}});if(((I=m.data)==null?void 0:I.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const R=(($=m.data)==null?void 0:$.kind)==="ok"?m.data.status.main:void 0;if(R===void 0||!R.dirty)return null;const F=R.branch!=="main",E=f.filter(v=>R.strays.some(u=>u.path===v)),_=s&&E.length>0,b=v=>g(u=>u.includes(v)?u.filter(x=>x!==v):[...u,v]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ft,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${R.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(sn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:R.strays.map(v=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ot,{id:`stray-${t}-${v.path}`,checked:E.includes(v.path),onCheckedChange:()=>b(v.path),disabled:d.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${v.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:v.path,children:v.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:zn[v.kind]})]},v.path))}),R.strayCount>R.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",R.strayCount-R.strays.length," more not shown. “Keep them all” keeps these too."]}),_?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:E.length===1?"Discard this change? It can’t be undone.":`Discard these ${E.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:d.isPending,onClick:()=>p(!1),children:"Cancel"}),e.jsx(Y,{type:"button",variant:"destructive",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({action:"discard",paths:[...E]}),children:E.length===1?"Discard change":`Discard ${E.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:d.isPending,onClick:()=>d.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:d.isPending||E.length===0,onClick:()=>p(!0),children:E.length===0?"Discard…":`Discard ${E.length}`})]})]}),o!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:o})]})}const Ne="pointer-coarse:size-11",Kn=new Map([["ROOM_REPOS_DISABLED","Room files are turned off for this DorkOS."],["ROOM_REPO_GIT_UNAVAILABLE","Git isn’t available on this computer."],["MERGE_IN_FLIGHT","This room’s files are busy. Try again."],["ROOM_ARCHIVED","Bring this room back before setting up files."],["OPERATOR_ONLY","Only the owner can set up room files."]]);function Hn(t){const n=Kn.get(Pe(t)??"");return n||(t instanceof TypeError||t instanceof Error&&/fetch|offline|network/i.test(t.message)?"You’re offline. Try again when this computer reconnects.":"Couldn’t set up files. Try again.")}function as({roomId:t,canChange:n,canSetUp:r=!1}){const m=ne(),f=oe(),g=U(v=>v.showHidden),[s,p]=a.useState(null),[o,i]=a.useState(!1),d=a.useMemo(()=>We({transport:m,queryClient:f,roomId:t,canChange:n}),[m,f,t,n]),R=we(d,Q,g,f),F=ce(R),E=Be({mutationFn:async()=>{try{return await m.enableRoomRepo(t)}catch(v){if(Pe(v)==="ROOM_REPO_EXISTS")return null;throw v}},onSuccess:async()=>{i(!1),await Promise.all([f.invalidateQueries({queryKey:R.queryKey}),f.invalidateQueries({queryKey:je.repoStatus(t)})])}}),_=F.isSuccess&&F.data.absent===!0,b=F.isSuccess&&!_||F.isError,[I,$]=a.useState(null);if(b&&I!==t&&$(t),!b&&I!==t&&!_)return null;if(_){if(!r)return null;const v=E.isError?Hn(E.error):null;return e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"text-muted-foreground size-(--size-icon-sm) shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"})]}),e.jsxs("div",{className:"border-border/60 flex items-center justify-between gap-3 rounded-lg border px-3 py-2.5",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"This room has no shared files."}),e.jsx(Y,{type:"button",size:"sm",variant:"outline",className:"shrink-0 pointer-coarse:min-h-11",onClick:()=>{E.reset(),i(!0)},children:"Set up files…"})]}),v!==null&&e.jsx("p",{role:"alert",className:"text-status-danger text-xs",children:v}),e.jsx(de,{open:o,onOpenChange:i,children:e.jsxs(ue,{className:"max-sm:top-auto max-sm:bottom-0 max-sm:translate-y-0 max-sm:rounded-b-none",children:[e.jsxs(fe,{children:[e.jsx(he,{children:"Set up files for this room?"}),e.jsx(pe,{children:"This creates shared files and ROOM.md for everyone here. It can’t be undone."})]}),v!==null&&e.jsx("p",{role:"alert",className:"text-status-danger text-sm",children:v}),e.jsxs(me,{children:[e.jsx(xe,{className:"pointer-coarse:min-h-11",children:"Cancel"}),e.jsxs(ge,{className:"pointer-coarse:min-h-11",disabled:E.isPending,onClick:u=>{u.preventDefault(),E.mutate()},children:[E.isPending&&e.jsx(Pt,{className:"animate-spin"}),E.isPending?"Setting up…":"Set up files"]})]})]})})]})}return e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Ln,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"New file",title:"New file",disabled:s===null,onClick:()=>s==null?void 0:s.newFile(),children:e.jsx(st,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"New folder",title:"New folder",disabled:s===null,onClick:()=>s==null?void 0:s.newFolder(),children:e.jsx(qe,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ne,"aria-label":"Upload files",title:"Upload files",disabled:(s==null?void 0:s.upload)===void 0,onClick:()=>{var v;return(v=s==null?void 0:s.upload)==null?void 0:v.call(s)},children:e.jsx(rn,{className:"text-muted-foreground"})})]}),e.jsx(it,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(Mn,{source:d,onCommands:p})})]})}function rs({roomId:t,attachment:n}){var i;const r=ne(),m=oe(),f=a.useMemo(()=>We({transport:r,queryClient:m,roomId:t}),[r,m,t]),g=ce(we(f,Q,!1,m)),[s,p]=a.useState(!1),o=Mt(t);return!g.isSuccess||g.data.absent===!0||((i=o.data)==null?void 0:i.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(Y,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>p(!0),children:e.jsx(_t,{})}),s&&e.jsx(Un,{roomId:t,source:f,attachment:n,onClose:()=>p(!1)})]})}function Un({roomId:t,source:n,attachment:r,onClose:m}){const f=ne(),g=oe(),[s,p]=a.useState(Q),[o,i]=a.useState(r.name),[d,R]=a.useState(null),[F,E]=a.useState(!1),_=a.useId(),b=ce(we(n,s,!1,g)),I=a.useMemo(()=>{var v;return rt(((v=b.data)==null?void 0:v.entries)??[]).filter(u=>u.type==="dir")},[b.data]),$=async()=>{var u,x;const v=o.trim();if(v!==""){E(!0),R(null);try{await f.saveAttachmentToRoomFiles(t,{attachmentId:r.id,dir:s,name:v,baseCommit:((u=b.data)==null?void 0:u.commit)??null}),g.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),Z.success(`Saved ${v} to the room’s files`),m()}catch(w){let j;try{j=Vt(w,g,t)}catch{j={status:"refused",reason:Ye(w)??"Couldn’t save. Try again in a moment."}}if(j.status==="exists"){const D=(((x=b.data)==null?void 0:x.entries)??[]).map(H=>H.name);R({reason:`This folder already has a file called “${v}”. Pick another name.`,suggestion:Me({name:v,isDir:!1,taken:[...D,v]})})}else j.status==="conflict"?(R({reason:"This folder changed while you chose, so nothing was saved. Try again."}),b.refetch()):j.status==="refused"&&R({reason:j.reason})}finally{E(!1)}}};return e.jsx(At,{open:!0,onOpenChange:v=>!v&&m(),children:e.jsxs(Lt,{className:"sm:max-w-md",children:[e.jsxs(zt,{children:[e.jsx(It,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(Kt,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:s===Q?"Top folder":`${s}/`}),s!==Q&&e.jsx(Ke,{label:"Up one folder",icon:e.jsx(an,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>p(W(s))}),b.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):I.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):I.map(v=>e.jsx(Ke,{label:v.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>p(ee(s,ie(v.path)))},v.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:_,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Ht,{id:_,value:o,onChange:v=>{i(v.target.value),R(null)},spellCheck:!1,autoComplete:"off"})]}),d!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:d.reason}),d.suggestion!==void 0&&e.jsxs(Y,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(d.suggestion),R(null)},children:["Use “",d.suggestion,"”"]})]})]}),e.jsxs(Ut,{className:"gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",onClick:m,children:"Cancel"}),e.jsx(Y,{type:"button",disabled:F||o.trim()===""||b.isPending,onClick:()=>void $(),children:F?"Saving…":s===Q?"Save to the top folder":`Save to ${ie(s)}`})]})]})})}function Ke({label:t,icon:n,chevron:r=!1,onClick:m}){return e.jsxs("button",{type:"button",onClick:m,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),r&&e.jsx(Ue,{className:"text-muted-foreground size-3.5"})]})}export{Mn as FileExplorer,ss as FileExplorerActions,Yt as FilePreviewDialog,on as HIDDEN_ENTRY_NAMES,it as HiddenEntriesToggle,ls as NO_PROVENANCE,Re as PINNED_ENTRY_NAMES,cs as ROOM_FILES_REFRESH_INTERVAL_MS,as as RoomFilesSection,rs as SaveToRoomFilesButton,We as createRoomFilesSource,yn as createSessionCwdSource,le as explorerDirQueryKey,we as explorerDirQueryOptions,ln as isHiddenEntryName,Se as isPinnedEntryName,cn as pinnedFirst,Gt as provenanceLine,Qe as roomRepoStatusQueryOptions,rt as withoutHidden};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,cs as j,cj as w,et as T,eu as L,ev as O,aW as z,ew as E,B as u,ex as B,ey as F,bw as Q,ez as _,ap as M,eA as W,l as y,ab as q}from"./index-OQuvRZTD.js";import{u as D}from"./use-is-below-desktop-CAGEAsCC.js";import{u as A}from"./use-pending-read-D0y6i7G9.js";import{A as H}from"./AttentionSignalRow-5E7TkG98.js";import{T as U,a as V}from"./table-D9ww_3Ij.js";import{u as Y}from"./use-pulse-freshness-D07Mv-Sa.js";import{a as de}from"./use-pulse-freshness-D07Mv-Sa.js";import{A as G}from"./ActivityRow-DIBH4v9c.js";import"./use-full-activity-feed-CtQquOBW.js";function b({label:a,empty:i,allClear:n,action:o,children:l}){return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-2 flex min-h-6 items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-widest uppercase",children:a}),!i&&o]}),i?e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:n}):l]})}const d=5,J={animate:{transition:{staggerChildren:.04}}};function K(){const a=j(),i=w(),{schedules:n,errors:o,activity:l,isLoading:m,total:c}=T(),t=L(),h=D(),N=A(m||t.isLoading),S=O(),C=z(s=>s.setRightPanelOpen),x=E(n),P=i==="/"&&!h,r=x.slice(0,d),p=o.slice(0,d-r.length),k=l.slice(0,d-r.length-p.length),I=new Set(n.map(s=>s.id)),g=x.slice(d).filter(s=>I.has(s.id)),R={...t,schedules:g},f=t.items.filter(s=>s.kind!=="schedule-approval").length+g.length,v=t.isAnyError;return P?null:e.jsxs(b,{label:"Needs attention",empty:!N&&c===0&&r.length===0&&f===0&&!v,allClear:"All quiet. Nothing needs you.",action:e.jsx(u,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>a({...y.home()}),children:"View all →"}),children:[v&&e.jsxs("div",{"data-slot":"pulse-waiting-unreadable",className:"mb-2 flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1",children:[e.jsx("span",{className:"text-muted-foreground min-w-0 flex-1 text-xs",children:"Couldn’t check everything waiting on you."}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-xs",onClick:t.retryFailed,children:"Try again"})]}),f>0&&e.jsxs("div",{"data-slot":"pulse-waiting-line",className:"mb-2 flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1",children:[e.jsx("span",{className:"bg-status-warning size-1.5 shrink-0 rounded-full","aria-hidden":!0}),e.jsx("span",{className:"text-foreground/90 min-w-0 flex-1 text-xs",children:B(R)}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-xs",onClick:()=>{h&&C(!1),F()},children:"Open Inbox"})]}),e.jsx(Q,{initial:!1,children:r.map(s=>e.jsx(_,{task:s,className:"mb-2"},s.id))}),e.jsxs(M.div,{variants:J,initial:"initial",animate:"animate",children:[p.map(s=>e.jsx(H,{signal:s},s.id)),k.map(s=>e.jsx(W,{notification:s,onOpen:()=>S(s)},s.id))]})]})}const X=5;function Z(){const a=j(),i=w(),n=q(),{groups:o,isLoading:l}=Y(),m=A(l);if(i==="/activity"&&!n)return null;const c=o.flatMap(t=>t.items).slice(0,X);return e.jsx(b,{label:"Activity",empty:!m&&c.length===0,allClear:"No recent activity.",action:e.jsx(u,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>a({...y.activity()}),children:"Open activity →"}),children:e.jsx(U,{children:e.jsx(V,{children:c.map(t=>e.jsx(G,{item:t},t.id))})})})}function le(){return e.jsxs("div",{"data-slot":"pulse",className:"flex h-full flex-col gap-6 overflow-y-auto p-4",children:[e.jsx(K,{}),e.jsx(Z,{})]})}export{le as PulsePanel,de as usePulseFreshness};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hl as je,j as e,hm as ve,hn as Ne,ho as T,hp as we,hq as W,cZ as ae,co as re,r as C,ai as R,gw as k,H as D,aT as _,X as q,hr as ye,hs as be,g9 as B,ga as H,B as E,f as K,gb as U,a2 as ie,a3 as oe,a4 as de,ht as z,hu as le,dD as b,hv as ce,hw as me,hx as Ce,hy as ue,a0 as Se,bb as ke,f$ as Ee,hz as $e,fV as Ae,fW as Pe,hA as Te,hB as Re,U as De,G as M,ep as _e,hC as Z,hD as ze,hE as Ie,_ as L,$ as Oe,hF as Le,hG as Me,hH as Fe,hI as qe,hJ as Be,hK as He,hL as Ke,hM as ee,eR as Ue,hN as Ge,hO as se}from"./index-OQuvRZTD.js";import{hP as $s,hQ as As,hR as Ps,hS as Ts,hT as Rs,fZ as Ds}from"./index-OQuvRZTD.js";import{u as Ve}from"./use-deep-link-scroll-DxGYrks3.js";import{M as he}from"./more-details-CRLU2HN4.js";import{C as Xe}from"./card-DUmTNXJJ.js";import{u as Ye,a as Qe}from"./ForwardConsentHost-Mbo0D-zk.js";import{F as zs}from"./ForwardConsentHost-Mbo0D-zk.js";import{C as G,a as V,b as X,c as Y,d as $,e as A}from"./command-BVQb6I3_.js";import{F as xe}from"./file-text-Ds9edaTZ.js";const Je=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],We={server_crashed:s=>`${s} stopped unexpectedly 3 times. Reload it to try again.`,server_out_of_memory:s=>`${s} ran out of memory and stopped. Reload it to try again.`,server_unresponsive:s=>`${s} stopped responding, so DorkOS stopped it.`,isolation_unavailable:s=>`${s} can’t run with its limits on this computer.`,server_start_failed:s=>`${s} couldn’t start. Reload it to try again.`,server_start_timeout:s=>`${s} took too long to start. Reload it to try again.`};function F(s){return Je.includes(s)}function Ze(s,n){return F(s)?We[s](n):null}function es(s){return`Restarting ${s}…`}function ss({extensionId:s}){const n=je("right-panel").filter(a=>a.extensionId===s);return n.length===0?null:e.jsx("div",{className:"space-y-3 pt-1","data-testid":`panel-tab-placement-${s}`,children:n.map(a=>e.jsx(ns,{tab:a,labelled:n.length>1},a.id))})}function ts(){var a;const s=(a=ae().data)==null?void 0:a.agents,n=re().data;return C.useMemo(()=>{const l=new Map((s??[]).map(t=>[t.id,R(t)])),d=new Map((n??[]).map(t=>[t.id,k(t)]));return{agents:s??[],rooms:n??[],agentNames:l,roomNames:d}},[s,n])}function ns({tab:s,labelled:n}){const a=ve(Ye(),s.id),{setPlacement:l}=Qe(),d=ts(),t=Ne(a,s.declaredPlacement),h=t.show.pages.includes(T),c=o=>l(s.id,{show:o.show,hide:o.hide}),u=o=>o.kind==="agents"?d.agentNames.get(o.id)??"An agent that is gone":o.kind==="rooms"?d.roomNames.get(o.id)??"A channel that is gone":ye(o.id),r=(o,p)=>["agents","rooms","pages"].flatMap(v=>o[v].filter(m=>p||m!==T).map(m=>({kind:v,id:m}))),i=(o,p)=>({...o,[p.kind]:o[p.kind].filter(v=>v!==p.id)}),f=r(t.show,!1),N=r(t.hide,!0);return e.jsxs("div",{className:"space-y-2","data-testid":`panel-tab-placement-${s.id}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:n?`${s.title} tab shows`:"Panel tab shows"}),e.jsxs(we,{value:h?"everywhere":"only",onValueChange:o=>c({hide:t.hide,show:o==="everywhere"?{...t.show,pages:[T]}:{...t.show,pages:t.show.pages.filter(p=>p!==T)}}),"aria-label":`Where the ${s.title} tab shows`,children:[e.jsx(W,{value:"everywhere",children:"Everywhere"}),e.jsx(W,{value:"only",children:"Only in…"})]}),a&&e.jsx("button",{type:"button",onClick:()=>l(s.id,null),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:s.declaredPlacement?"Use its default":"Reset"})]}),!h&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.map(o=>e.jsx(te,{place:o,name:u(o),removeLabel:`Remove ${u(o)}`,onRemove:()=>c({...t,show:i(t.show,o)})},`${o.kind}:${o.id}`)),e.jsx(rs,{tabTitle:s.title,names:d,taken:t.show,onAdd:o=>c({show:{...t.show,[o.kind]:[...t.show[o.kind],o.id]},hide:i(t.hide,o)})}),f.length===0&&e.jsx("span",{className:"text-muted-foreground text-xs",children:"Shows nowhere yet. Add a place."})]}),N.length>0&&e.jsxs("div",{role:"group","aria-labelledby":`${s.id}-hidden-in`,className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{id:`${s.id}-hidden-in`,className:"text-muted-foreground text-xs",children:"Hidden in"}),N.map(o=>e.jsx(te,{place:o,name:u(o),removeLabel:`Show in ${u(o)} again`,onRemove:()=>c({...t,hide:i(t.hide,o)})},`${o.kind}:${o.id}`))]})]})}const as={agents:_,rooms:D,pages:xe};function te({place:s,name:n,removeLabel:a,onRemove:l}){const d=as[s.kind];return e.jsxs("span",{className:"bg-muted inline-flex h-6 items-center gap-1 rounded-md pr-0.5 pl-1.5 text-xs",children:[e.jsx(d,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:n}),e.jsx("button",{type:"button",onClick:l,"aria-label":a,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(q,{className:"size-3"})})]})}function rs({tabTitle:s,names:n,taken:a,onAdd:l}){const[d,t]=C.useState(!1),h=i=>{l(i),t(!1)},c=be.filter(i=>!a.pages.includes(i.key)),u=n.agents.filter(i=>!a.agents.includes(i.id)),r=n.rooms.filter(i=>!a.rooms.includes(i.id));return e.jsxs(B,{open:d,onOpenChange:t,children:[e.jsx(H,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-xs","aria-label":`Add a place for the ${s} tab`,children:[e.jsx(K,{className:"size-3"}),"Add"]})}),e.jsx(U,{align:"start",className:"w-64 p-0",children:e.jsxs(G,{children:[e.jsx(V,{placeholder:"Find an agent, channel or page"}),e.jsxs(X,{className:"max-h-64",children:[e.jsx(Y,{children:"Nothing matches."}),u.length>0&&e.jsx($,{heading:"Agents",children:u.map(i=>e.jsxs(A,{value:`agent ${R(i)} ${i.id}`,onSelect:()=>h({kind:"agents",id:i.id}),children:[e.jsx(_,{className:"size-3.5"}),R(i)]},i.id))}),r.length>0&&e.jsx($,{heading:"Channels and DMs",children:r.map(i=>e.jsxs(A,{value:`room ${k(i)} ${i.id}`,onSelect:()=>h({kind:"rooms",id:i.id}),children:[e.jsx(D,{className:"size-3.5"}),k(i)]},i.id))}),c.length>0&&e.jsx($,{heading:"Pages",children:c.map(i=>e.jsxs(A,{value:`page ${i.label}`,onSelect:()=>h({kind:"pages",id:i.key}),children:[e.jsx(xe,{className:"size-3.5"}),i.label]},i.key))})]})]})})]})}const ge=s=>[...le.detail(s),"room-access"];function is(s){return ie({queryKey:ge(s),queryFn:async()=>{const n=await fetch(z(`/extensions/${s}/room-access`));if(!n.ok)throw new Error(`Couldn’t load the rooms. The server answered ${n.status}.`);return(await n.json()).roomIds}})}function os(s){const n=oe();return de({mutationFn:async a=>{const l=await fetch(z(`/extensions/${s}/room-access`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({roomIds:a})});if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.message??d.error??"Couldn’t save the rooms. Try again.")}return(await l.json()).roomIds},onSuccess:a=>{n.setQueryData(ge(s),a)}})}function ds({extensionId:s,name:n}){const a=is(s).data??[],{mutate:l}=os(s),d=re().data,t=C.useMemo(()=>(d??[]).filter(r=>!r.bridge),[d]),h=C.useMemo(()=>new Map((d??[]).map(r=>[r.id,k(r)])),[d]),c=r=>l(r,{onError:i=>b.error(i.message)}),u=r=>h.get(r)??"A room that is gone";return e.jsxs("div",{className:"space-y-1.5 pt-1","data-testid":`room-access-${s}`,children:[e.jsx("p",{className:"text-sm",children:"Rooms it can use"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map(r=>e.jsxs("span",{className:"bg-muted inline-flex h-6 items-center gap-1 rounded-md pr-0.5 pl-1.5 text-xs",children:[e.jsx(D,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:u(r)}),e.jsx("button",{type:"button",onClick:()=>c(a.filter(i=>i!==r)),"aria-label":`Remove ${u(r)}`,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(q,{className:"size-3"})})]},r)),e.jsx(ls,{name:n,rooms:t.filter(r=>!a.includes(r.id)),onAdd:r=>c([...a,r])})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a.length===0?"None yet. It can’t read or reply anywhere.":"It reads and replies as you, only here."})]})}function ls({name:s,rooms:n,onAdd:a}){const[l,d]=C.useState(!1);return e.jsxs(B,{open:l,onOpenChange:d,children:[e.jsx(H,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-xs","aria-label":`Add a room for ${s}`,children:[e.jsx(K,{className:"size-3"}),"Add"]})}),e.jsx(U,{align:"start",className:"w-64 p-0",children:e.jsxs(G,{children:[e.jsx(V,{placeholder:"Find a channel or DM"}),e.jsxs(X,{className:"max-h-64",children:[e.jsx(Y,{children:"Nothing matches."}),n.length>0&&e.jsx($,{heading:"Channels and DMs",children:n.map(t=>e.jsxs(A,{value:`room ${k(t)} ${t.id}`,onSelect:()=>{a(t.id),d(!1)},children:[e.jsx(D,{className:"size-3.5"}),k(t)]},t.id))})]})]})})]})}const pe=s=>[...le.detail(s),"forward-agents"];function cs(s){return ie({queryKey:pe(s),queryFn:async()=>{const n=await fetch(z(`/extensions/${s}/forward-agents`),{headers:{"X-Client-Id":ce()}});if(!n.ok)throw new Error(`Couldn’t load the agents. The server answered ${n.status}.`);return await n.json()}})}function ms(s){const n=oe();return de({mutationFn:async a=>{const l=await fetch(z(`/extensions/${s}/forward-agents`),{method:"PUT",headers:{"Content-Type":"application/json","X-Client-Id":ce()},body:JSON.stringify({agentIds:a})});if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.message??d.error??"Couldn’t save the agents. Try again.")}return await l.json()},onSuccess:a=>{n.setQueryData(pe(s),a)}})}function us({extensionId:s,name:n}){var u;const a=cs(s).data,{mutate:l}=ms(s),d=((u=ae().data)==null?void 0:u.agents)??[],t=[...(a==null?void 0:a.agents)??[],...((a==null?void 0:a.missing)??[]).map(r=>({id:r,name:"An agent that is gone"}))],h=t.map(r=>r.id),c=r=>l(r,{onError:i=>b.error(i.message)});return e.jsxs("div",{className:"space-y-1.5 pt-1","data-testid":`forward-agents-${s}`,children:[e.jsx("p",{className:"text-sm",children:"Sends your comments to"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.map(r=>e.jsxs("span",{className:"bg-muted inline-flex h-6 items-center gap-1 rounded-md pr-0.5 pl-1.5 text-xs",children:[e.jsx(_,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:r.name}),e.jsx("button",{type:"button",onClick:()=>c(h.filter(i=>i!==r.id)),"aria-label":`Remove ${r.name}`,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(q,{className:"size-3"})})]},r.id)),e.jsx(hs,{name:n,agents:d.filter(r=>!h.includes(r.id)).map(r=>({id:r.id,name:R(r)})),onAdd:r=>c([...h,r])})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:t.length===0?"None yet. It asks you the first time you send a comment.":"Your comments reach these agents as your own words."})]})}function hs({name:s,agents:n,onAdd:a}){const[l,d]=C.useState(!1);return e.jsxs(B,{open:l,onOpenChange:d,children:[e.jsx(H,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-xs","aria-label":`Add an agent for ${s}`,children:[e.jsx(K,{className:"size-3"}),"Add"]})}),e.jsx(U,{align:"start",className:"w-64 p-0",children:e.jsxs(G,{children:[e.jsx(V,{placeholder:"Find an agent"}),e.jsxs(X,{className:"max-h-64",children:[e.jsx(Y,{children:"Nothing matches."}),n.length>0&&e.jsx($,{heading:"Agents",children:n.map(t=>e.jsxs(A,{value:`agent ${t.name} ${t.id}`,onSelect:()=>{a(t.id),d(!1)},children:[e.jsx(_,{className:"size-3.5"}),t.name]},t.id))})]})]})})]})}const xs=new Set(["disabled","discovered","incompatible","invalid"]),gs="/marketplace?view=installed";function ps({extension:s,onToggle:n,isToggling:a,onSetRunApproval:l,isSettingApproval:d,onReload:t,isReloading:h}){var Q,J;const{manifest:c,status:u,scope:r,error:i,serverError:f,origin:N,approvedToRun:o}=s,[p,v]=C.useState(!1),m=!xs.has(u),x=u==="incompatible",w=u==="invalid",g=u==="compile_error"||u==="activate_error",S=!x&&!w,j=!(N==="core"&&c.canDisable===!1),P=s.hasServerEntry||s.hasDataProxy,y=me(s),fe=Ce(s.id,ue(y)),I=g?"Not working":x?"Incompatible":w?"Can’t load":null;return e.jsx(Xe,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,"data-section":s.id,radius:"lg",gap:"none",className:M(g&&"border-amber-500/50",(x||w)&&"opacity-70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g&&e.jsx(Se,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(x||w)&&!g&&e.jsx(ke,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!g&&!x&&!w&&e.jsx(Ee,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:c.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",c.version]}),s.devLink&&e.jsx($e,{})]}),s.devLink&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-dev-link-${s.id}`,children:[e.jsx(Ae,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void Pe(gs),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),c.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:c.description}),e.jsx(Te,{gifts:Re(s),"data-testid":`extension-agent-gifts-${s.id}`}),m&&e.jsx(ss,{extensionId:s.id}),((Q=c.capabilities)==null?void 0:Q.rooms)===!0&&e.jsx(ds,{extensionId:s.id,name:c.name}),((J=c.capabilities)==null?void 0:J.forward)===!0&&e.jsx(us,{extensionId:s.id,name:c.name}),x&&c.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",c.minHostVersion," or newer"]}),g&&i&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[u==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",i.message]}),i.details&&e.jsxs("button",{type:"button",onClick:()=>v(O=>!O),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":p,children:[e.jsx(De,{className:M("size-3 transition-transform",p&&"rotate-180")}),p?"Hide details":"Show details"]}),p&&i.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:i.details})]}),f&&F(f.code)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-server-status-${s.id}`,children:[e.jsx("p",{className:"text-status-warning-fg text-sm",children:f.message||Ze(f.code,c.name)}),e.jsx("button",{type:"button",onClick:t,disabled:h,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!f&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:es(c.name)}),f&&!F(f.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",f.message,". The last version still runs."]}),N==="user"&&(o?e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs","data-testid":`extension-run-allowed-${s.id}`,children:[e.jsx(_e,{className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"You allowed this to run."}),s.originProblem==="changed"&&e.jsx("span",{children:"You approved its changed files. Any further change asks again."}),e.jsx("button",{type:"button",onClick:()=>l(s.id,!1),disabled:d,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(Z,{permissions:y,className:"basis-full","data-testid":`extension-permissions-${s.id}`})]}):e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/40 bg-amber-500/5 p-3","data-testid":`extension-needs-approval-${s.id}`,children:[e.jsx("p",{className:"text-sm font-medium",children:"This extension is waiting for you"}),s.originProblem&&e.jsx("p",{className:"text-status-warning-fg text-sm","data-testid":`extension-origin-problem-${s.id}`,children:s.originProblem==="changed"?"Its files changed after install, so DorkOS can’t vouch for it. Look it over first.":s.originProblem==="dev-link"?"It runs from your folder, so DorkOS can’t vouch for its source.":"Its plugin links to files elsewhere, so DorkOS can’t vouch for its source."}),e.jsx(Z,{permissions:y,added:fe,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:ze(P,(y==null?void 0:y.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:Ie}),e.jsx(E,{size:"sm",onClick:()=>l(s.id,!0),disabled:d,"data-testid":`extension-approve-run-${s.id}`,children:"Turn it on"})]})),e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs",children:[e.jsx(L,{variant:"outline",children:r}),I&&e.jsx(L,{variant:I==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:I}),c.author&&e.jsx("span",{children:c.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:j?e.jsx(Oe,{checked:m,onCheckedChange:O=>n(s.id,O),disabled:!S||a,"aria-label":`${m?"Disable":"Enable"} ${c.name}`}):e.jsx(L,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function ne(s){const n=new Date(s);return Number.isNaN(n.getTime())?"":n.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function fs(){const{data:s=[]}=Le(),{stop:n,pendingSource:a}=Me();return s.length===0?null:e.jsxs("section",{className:"space-y-3","data-testid":"trusted-sources-section",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Trusted sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Extensions from these sources turn on without asking."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Stop trusting one, and extensions already on keep running."}),e.jsx(he,{className:"text-muted-foreground text-sm",label:"If you stop trusting one",openLabel:"If you stop trusting one",children:e.jsx("p",{children:"Newer versions and new extensions from it wait for your yes."})})]}),e.jsx("ul",{className:"divide-y rounded-xl border",children:s.map(({source:l,trustedAt:d})=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-mono text-sm",children:l}),ne(d)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",ne(d)]})]}),e.jsx(E,{type:"button",variant:"outline",size:"sm",disabled:a===l,onClick:()=>n(l),children:"Stop trusting"})]},l))})]})}function Ss(){const{data:s=[],isLoading:n}=Fe(),{section:a}=qe();Ve(n?null:a);const l=Be(),d=He(),t=Ke(),h=ee(!0),c=ee(!1),u=new Set([...l.variables?[l.variables]:[],...d.variables?[d.variables]:[]]),r=new Set([...h.isPending&&h.variables?[h.variables.id]:[],...c.isPending&&c.variables?[c.variables.id]:[]]);function i(m,x){const w=x?h:c,g=s.find(j=>j.id===m);if(!g)return;const S=x?ue(me(g)):void 0;w.mutate({id:m,version:g.manifest.version,plugin:g.sourcePlugin??null,...S?{permissions:S}:{},...x&&g.digest?{expectedDigest:g.digest}:{}},{onSuccess:j=>{x&&se.getState().forget(m);const P=j.extension.manifest.name,y=j.extension.isolation?"":" inside DorkOS";b.success(x?`${P} can now run${y}`:`${P} stopped running`)},onError:j=>{if(j instanceof Ge&&j.stale){S&&se.getState().remember(m,S),b.error(`${g.manifest.name} changed since you saw it. Check it again.`);return}b.error(x?"Couldn’t let it run.":"Couldn’t stop it running.",{description:j.message})}})}async function f(m,x){(x?l:d).mutate(m,{onError:g=>{b.error(x?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:g.message})}})}function N(){t.mutate(void 0,{onSuccess:m=>{b.success(`Reloaded ${m.length} extension${m.length===1?"":"s"}`)},onError:m=>{b.error("Couldn’t reload your extensions.",{description:m.message})}})}if(n)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const o=s.filter(m=>m.origin==="core"),p=s.filter(m=>m.origin==="user"),v=m=>e.jsx(ps,{extension:m,onToggle:f,isToggling:u.has(m.id),onSetRunApproval:i,isSettingApproval:r.has(m.id),onReload:N,isReloading:t.isPending},m.id);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-muted-foreground space-y-1 text-sm",children:[e.jsx("p",{children:"Extensions add new screens and tools to DorkOS."}),e.jsxs(he,{children:[e.jsx("p",{children:"Core extensions come with DorkOS."}),e.jsxs("p",{children:["Installed ones live in"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:"~/.dork/extensions/"})," or your project’s"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:".dork/extensions/"}),"."]})]})]}),s.length===0?e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm","data-testid":"no-extensions",children:e.jsx("p",{children:"No extensions installed."})}):e.jsxs(e.Fragment,{children:[o.length>0&&e.jsxs("section",{className:"space-y-3","data-testid":"core-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Core extensions"}),e.jsx("div",{className:"space-y-3",children:o.map(v)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),p.length>0?e.jsx("div",{className:"space-y-3",children:p.map(v)}):e.jsxs("div",{className:"text-muted-foreground rounded-xl border border-dashed p-4 text-sm","data-testid":"no-installed-extensions",children:["No extensions installed yet. Browse"," ",e.jsx("span",{className:"text-foreground font-medium",children:"Marketplace"})," to add some."]})]})]}),e.jsx(fs,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(E,{variant:"outline",size:"sm",onClick:N,disabled:t.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(Ue,{className:M("mr-2 size-4",t.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{$s as ExtensionEventBridge,As as ExtensionLoader,Ps as ExtensionProvider,Ss as ExtensionsSettingsTab,zs as ForwardConsentHost,Ts as createExtensionAPI,Rs as createExtensionEventBridge,Ds as useExtensions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as t,D as a}from"./TourHost-B69XAKpE.js";import{T as h,a as g,b as j}from"./TourHost-B69XAKpE.js";import{j as e,ap as l,B as r}from"./index-OQuvRZTD.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./use-external-adapter-catalog-9qiNBqpc.js";function p(){const{pendingOffer:s,pendingOfferId:i,acceptOffer:o,declineOffer:n}=t();return!s||i===null||!s.offerLine?null:e.jsxs(l.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":"DorkBot suggestion",className:"bg-secondary/60 mt-1.5 flex flex-col gap-2 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"mt-0.5 shrink-0",children:[e.jsx(a,{size:18,className:"dark:hidden"}),e.jsx(a,{variant:"white",size:18,className:"hidden dark:block"})]}),e.jsx("p",{className:"text-sm leading-relaxed",children:s.offerLine})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-6",children:[e.jsx(r,{size:"sm",onClick:()=>o(i),children:"Show me"}),e.jsx(r,{size:"sm",variant:"ghost",onClick:()=>n(i),children:"Later"})]})]})}export{h as TOUR_DEFINITIONS,g as TourHost,p as TourOfferChips,j as useTourOccasions,t as useTours};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as M,s as k,W as x}from"./WorkView-BekLkR4O.js";import{a as Ys,b as Xs,c as $s,S as zs,d as Js,u as Zs}from"./WorkView-BekLkR4O.js";import{a1 as w,a3 as P,r as m,a2 as T,aS as h,j as c,cU as A,cV as b,cW as v,cX as C,cY as N,aW as R,h as _,s as j}from"./index-OQuvRZTD.js";import{u as I}from"./use-room-sessions-Bzk7rM40.js";import{u as W}from"./use-direct-message-panel-D38tSozW.js";import"./registry-BzXBOE9h.js";import"./WidgetErrorCard-BlqaIsPK.js";import"./PromptSuggestionChips-BXxC799Q.js";import"./primer-trigger-B2tjuHBx.js";import"./use-is-below-desktop-CAGEAsCC.js";import"./use-notification-prefs-u76DPoP0.js";import"./card-DUmTNXJJ.js";import"./use-status-budget-Xn2sIeM1.js";import"./git-branch-B8JNwQ6q.js";import"./use-update-config-L5NCTj3t.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./RuntimeSetupDialog-D6L1QhMF.js";import"./inline-code-SYHTKcle.js";import"./list-runtime-types-CsGil5te.js";import"./RuntimeConnectFlow-DXWGgvCW.js";import"./useMutationState-BF1EFtIZ.js";import"./runtime-connect-Dn0T5YWv.js";import"./unverified-catalog-notice-CGy05tAO.js";import"./layers-F4mvrI2l.js";import"./cpu-DeRuDMl4.js";import"./banner-C9qTs6-C.js";import"./UnreadDivider-Ckey1IWn.js";import"./composer-insert-BpyATrmR.js";import"./use-composer-prefs-ICOpilWK.js";import"./McpAppFrame-D15nxVaI.js";import"./more-details-CRLU2HN4.js";import"./find-latest-widget-fence-BtqFMP_f.js";import"./file-D80JE_L0.js";import"./use-session-canvas-CpgE7tFb.js";import"./rotate-cw-B8WQa8O-.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CAeUe7uQ.js";import"./file-text-Ds9edaTZ.js";import"./shield-x-ijIbRppV.js";import"./McpSigninBody-DmBxqgxN.js";import"./image-off-C1uTDs9-.js";import"./format-duration-BCr6uzby.js";import"./use-connector-management-DEMGZy9N.js";import"./AgentRequestCard-DXJnLk6q.js";import"./access-copy-Dqct36mi.js";import"./query-error-state-5236P3z0.js";import"./empty-state-CACt-76q.js";import"./use-bindings-BLAWQRpe.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-C43vkwpA.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-WhPo3_WD.js";import"./index-n_pnc-CO.js";import"./markdown-content-Cjhsscbn.js";import"./use-transform-ByJGn3hq.js";import"./index-CoKNU2F9.js";import"./progress-77FCPL2y.js";import"./table-D9ww_3Ij.js";import"./package-sPggO7Dr.js";import"./heart-BavUIV45.js";const L=[];function q(s,t){const o=w(),i=P(),n=m.useRef(t);m.useEffect(()=>{const r=n.current&&!t;n.current=t,r&&s!==null&&i.invalidateQueries({queryKey:["session-readout",s]})},[t,s,i]);const e=T({queryKey:["session-readout",s],queryFn:async()=>M((await o.getMessages(s)).messages),enabled:s!==null,staleTime:h.MESSAGE_STALE_TIME_MS,refetchInterval:t?h.ACTIVE_TAB_REFETCH_MS:!1});return{messages:e.data??L,isLoading:s!==null&&e.isLoading,isError:e.isError}}function Hs(){const s=W();return(s==null?void 0:s.kind)==="one-to-one"?c.jsx(D,{sessionId:s.sessionId,agentPath:s.agentPath,showSessions:s.showSessions}):(s==null?void 0:s.kind)==="group"?c.jsx(O,{roomId:s.roomId,members:s.members,working:s.working,showSessions:s.showSessions}):c.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-xs",children:"Open a DM to see its work."})}function D({sessionId:s,agentPath:t,showSessions:o}){const i=A(s),{messages:n}=b(s),e=m.useMemo(()=>k(i,n),[i,n]),r=v(s)==="streaming",{name:l}=C(t),{openSessionView:S}=N();return c.jsx(x,{sessionId:s,messages:e,agentName:l,showSessions:o,onOpenSession:S,working:r})}function O({roomId:s,members:t,working:o,showSessions:i}){var g,E;const n=R(u=>u.explicitAgentPath),e=t.find(u=>u.agentPath===n)??null,r=I(s,{enabled:e!==null}),{refetch:l}=r,S=m.useRef(o);m.useEffect(()=>{S.current!==o&&(S.current=o,l())},[o,l]);const a=e===null?null:((E=(g=r.data)==null?void 0:g.bindings.find(u=>u.authorId===e.authorId))==null?void 0:E.sessionId)??null,d=q(a,o),f=_(),y=m.useCallback(()=>{a!==null&&f&&f(j({session:a}))},[f,a]);let p=null;return e===null?p="Pick a member above.":r.isError||d.isError?p="Couldn’t load these steps.":r.isPending||d.isLoading?p="Loading steps…":a===null&&(p=`${e.displayName} hasn’t worked in this DM yet.`),c.jsx(x,{sessionId:a,messages:d.messages,agentName:(e==null?void 0:e.displayName)??null,showSessions:i,onOpenSession:y,notice:p})}export{Ys as SESSION_CAPABILITIES,Xs as SessionComposer,$s as SessionMessage,zs as SessionPage,Js as SessionTranscript,Hs as WorkPanel,Zs as useSessionTarget};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as n,M as h}from"./Marketplace-DbdLWz0-.js";import{M as I,P as U,m as V,u as b,a as C}from"./index-OQuvRZTD.js";import{M as j}from"./MarketplaceSourcesView-BZODwhxu.js";import{U as v}from"./UnlinkDialog-ptZy3IN4.js";import"./PreviewRefusedNotice-Ds4IO32o.js";import"./shield-x-ijIbRppV.js";import"./card-DUmTNXJJ.js";import"./empty-state-CACt-76q.js";import"./markdown-content-Cjhsscbn.js";import"./use-unclaimed-chats-C-z5fstJ.js";import"./use-bindings-BLAWQRpe.js";import"./more-details-CRLU2HN4.js";import"./use-dev-links-BOcktLiE.js";import"./file-D80JE_L0.js";import"./AgentPicker-B7upjYRk.js";import"./command-BVQb6I3_.js";import"./AgentOptionRow-BRJfZo2y.js";import"./useMutationState-BF1EFtIZ.js";import"./file-exclamation-point-CcJ_e4_m.js";import"./rotate-ccw-clock-CCU6SVnv.js";import"./path-input-C2KIXdON.js";import"./use-pending-read-D0y6i7G9.js";export{n as InstalledPackagesView,h as Marketplace,I as MarketplaceSidebar,j as MarketplaceSourcesView,U as PackageCard,v as UnlinkDialog,V as marketplaceSearchSchema,b as useMarketplaceParams,C as useMarketplaceStore};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as m,a as x,c as h}from"./use-status-budget-Xn2sIeM1.js";import{A as xe,b as he,d as pe,e as fe,G as ge,M as je,f as Se,P as be,g as ve,R as ke,h as Ne,S as Ce,i as Ie,j as we,U as Pe,W as ye,k as Me,l as Re,m as Ae,n as Te,o as Ue,p as De,r as Ee,s as Ge,q as Le,u as Oe,t as $e,v as Be,w as qe,x as Fe,y as _e,z as ze}from"./use-status-budget-Xn2sIeM1.js";import{cs as p,j as s,l as f,B as g,ck as j,cu as S,aW as b,cv as v,cw as t,G as k,cx as r,cy as N,cz as C,cA as I,r as l,cB as w,_ as P}from"./index-OQuvRZTD.js";import{cC as Qe,cD as We,cE as Ke,cF as Ve,cG as Je,cH as Xe,cI as Ye,cJ as Ze,cK as es,cL as ss,cM as ts,cN as ns,cO as as,cP as os,cQ as rs,cR as is,cS as cs,cT as ls}from"./index-OQuvRZTD.js";import{f as y}from"./format-duration-BCr6uzby.js";import{r as M}from"./composer-insert-BpyATrmR.js";import{S as R}from"./ConnectionAccessLists-DRwO1v0V.js";import"./git-branch-B8JNwQ6q.js";import"./use-update-config-L5NCTj3t.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./card-DUmTNXJJ.js";import"./RuntimeSetupDialog-D6L1QhMF.js";import"./inline-code-SYHTKcle.js";import"./list-runtime-types-CsGil5te.js";import"./RuntimeConnectFlow-DXWGgvCW.js";import"./useMutationState-BF1EFtIZ.js";import"./runtime-connect-Dn0T5YWv.js";import"./unverified-catalog-notice-CGy05tAO.js";import"./layers-F4mvrI2l.js";import"./cpu-DeRuDMl4.js";import"./access-copy-Dqct36mi.js";import"./query-error-state-5236P3z0.js";import"./empty-state-CACt-76q.js";const A="I need access to another service. Ask me which service and actions you need, then request only that access.";function T({sessionId:e}){const a=p(),o=s.jsx(g,{variant:"secondary",size:"sm","data-testid":`ask-agent-for-connection-${e}`,onClick:()=>M(A),children:"Ask your agent"});return s.jsx(R,{sessionId:e,onManage:()=>void a({...f.connections()}),emptyAction:o,footer:s.jsx("div",{className:"pt-1",children:o})})}const U=1e3;function ue(){const[e]=j(),a=S(e??""),o=b(n=>n.rightPanelOpen);return e?s.jsx(D,{diagnostics:a,live:o,connectors:s.jsx(T,{sessionId:e})}):s.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-xs",children:"Open a chat to inspect it."})}function D({diagnostics:e,live:a=!0,connectors:o}){return s.jsxs("div",{"data-slot":"session-inspector",className:"flex h-full min-w-0 flex-col gap-4 overflow-y-auto p-3",children:[s.jsx(E,{diagnostics:e,live:a}),s.jsx(G,{diagnostics:e}),s.jsx(L,{diagnostics:e}),s.jsx(O,{diagnostics:e}),o,s.jsxs("div",{className:"mt-auto pt-2",children:[s.jsx(v,{className:"mb-2"}),s.jsx(m,{diagnostics:e,className:"w-full justify-center"})]})]})}function E({diagnostics:e,live:a}){const o=F(e.lastEventAt,a),n=x[e.connectionState];return s.jsxs(c,{label:"Live",children:[s.jsx(t,{label:"Live updates",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{"aria-hidden":!0,className:k("inline-block size-1.5 rounded-full",n.color,n.tasks&&"animate-breath")}),n.shortLabel]})}),s.jsx(t,{label:"Turn",children:$(e)}),s.jsx(t,{label:"Last event",children:e.lastEventSeq===0?"none yet":`seq ${e.lastEventSeq}`}),s.jsx(t,{label:"Resumed from",children:e.snapshotCursor===null?"not hydrated":`cursor ${e.snapshotCursor}`}),s.jsx(t,{label:"Last update",children:o===null?"—":`${y(o)} ago`}),s.jsx(t,{label:"Queued messages",children:String(e.queueDepth)})]})}function G({diagnostics:e}){return s.jsxs(c,{label:"Resolved",children:[s.jsx(t,{label:"Directory",wrap:!0,children:e.cwd??"—"}),s.jsx(t,{label:"Git",children:q(e.git)}),s.jsx(t,{label:"Runs on",children:e.runtime??"—"}),s.jsx(t,{label:"Model",wrap:!0,children:e.model??"—"}),e.selectedModel!==null&&e.selectedModel!==e.model&&s.jsx(t,{label:"Model selected",children:e.selectedModel}),s.jsx(t,{label:"Effort",children:e.effort??"—"}),s.jsx(t,{label:"Fast mode",children:e.fastMode?"on":"off"}),s.jsx(t,{label:"Permissions",children:e.permissionMode}),s.jsx(t,{label:"Chat ID",wrap:!0,children:e.sessionId}),s.jsx(t,{label:"DorkOS version",children:e.clientVersion??"—"})]})}function L({diagnostics:e}){var o;const a=(((o=e.contextUsage)==null?void 0:o.categories)??[]).filter(n=>n.tokens>0).sort((n,i)=>i.tokens-n.tokens);return s.jsxs(c,{label:"Usage",children:[s.jsx(t,{label:"Context",children:e.contextPercent===null?"—":`${e.contextPercent}% full`}),e.contextUsage&&s.jsxs(t,{label:"Tokens",children:[r(e.contextUsage.totalTokens)," / ",r(e.contextUsage.maxTokens)]}),a.map(n=>s.jsx(t,{label:n.name,indent:!0,swatch:n.color,"data-testid":`context-category-${n.name}`,children:r(n.tokens)},n.name)),e.cache===null?s.jsx(t,{label:"Cache",children:"nothing cached yet"}):s.jsxs(s.Fragment,{children:[s.jsx(t,{label:"Cache hit",children:`${h(e.cache)}%`}),s.jsx(t,{label:"Cache read",indent:!0,children:r(e.cache.readTokens)}),s.jsx(t,{label:"Cache written",indent:!0,children:r(e.cache.creationTokens)})]}),e.usage!==null&&N(e.usage)?s.jsx("div",{className:"pt-1",children:s.jsx(C,{usage:e.usage})}):s.jsx(t,{label:"Usage & cost",children:"no usage reported"})]})}function O({diagnostics:e}){const{running:a,finished:o}=I(e.activeSubagents);return s.jsxs(c,{label:"Subagents",children:[s.jsx(t,{label:"Running",children:B(a.length,e.runningSubagentCount)}),a.map(n=>s.jsx(u,{subagent:n},n.taskId)),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(t,{label:"Finished this turn",children:String(o.length)}),o.map(n=>s.jsx(u,{subagent:n},n.taskId))]}),s.jsx(t,{label:"Available",children:e.subagents.length===0?"none":e.subagents.map(n=>n.name).join(", ")})]})}function u({subagent:e}){return s.jsxs("div",{"data-testid":`active-subagent-${e.taskId}`,"data-status":e.status,className:"space-y-0.5 py-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(w,{className:"text-muted-foreground size-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.description??e.taskId}),s.jsx(P,{size:"xs",variant:"secondary",className:"shrink-0",children:e.status})]}),s.jsxs("p",{className:"text-muted-foreground text-3xs pl-5 leading-tight",children:[e.toolUses??0," tool",e.toolUses===1?"":"s",e.lastToolName?` · last ${e.lastToolName}`:""]})]})}function c({label:e,children:a}){return s.jsxs("section",{className:"min-w-0",children:[s.jsx("h3",{className:"text-muted-foreground px-1 pb-1 text-xs font-medium tracking-wide uppercase",children:e}),s.jsx("div",{className:"space-y-1 px-1 text-xs",children:a})]})}function $(e){return e.triggerPending?"sending":e.streaming?"streaming":e.lifecycle??"not hydrated"}function B(e,a){const o=e===0?"none":String(e);return a===null||a===e?o:`${o} · server says ${a}`}function q(e){return e.state==="unknown"?"—":e.state==="no-repo"?"no repo":e.dirty?`${e.branch} · changed`:`${e.branch} · clean`}function F(e,a){const[o,n]=l.useState(()=>Date.now());return l.useEffect(()=>{if(e===null||!a)return;const i=()=>n(Date.now());i();const d=setInterval(i,U);return()=>clearInterval(d)},[e,a]),e===null?null:Math.max(0,o-e)}export{Qe as AccountBadge,We as AccountBadgeView,Ke as AccountItem,Ve as AccountMenuRow,Je as AccountPopover,Xe as AccountTrigger,xe as AutoModeConfirmDialog,he as ConnectionItem,pe as ContextItem,fe as CwdItem,ge as GitStatusItem,je as MakeDefaultStopLine,Se as ModelConfigPopover,be as PermissionModeItem,ve as PlanModeItem,ke as ReadOnlyModeNotice,Ne as RuntimeItem,ue as SessionInspector,Ce as SessionPopover,D as SessionReadout,Ie as StatusLine,we as SubagentsItem,Pe as UsageRevealPopover,Ye as UsageStatusItem,ye as WifiTurnCapPill,Ze as accountChipPromotion,Me as applyStatusBudget,es as canOfferContinue,ss as chipToneFor,Re as evaluateExtensionStatusItems,ts as formatCost,Ae as formatDiagnostics,Te as gitPromotionState,N as hasRenderableUsage,ns as isGitStatusOk,Ue as isPhoneDensity,De as isUsageAbsorbed,I as partitionSubagents,Ee as resolveStatusBudget,Ge as selectPromotedItems,as as showsStaleMark,Le as statusModelLabel,Oe as useExtensionStatusItems,os as useGitStatus,$e as useMakeDefaultStop,Be as useReadOnlyModeHint,rs as useResolvedSessionRuntime,is as useRuntimeChip,cs as useSessionAccount,S as useSessionDiagnostics,ls as useSessionPermissionPicker,qe as useSessionPopoverShortcut,Fe as useStatusBarPins,_e as useStatusBudget,ze as useStatusUsage};
|