dorkos 0.120.0 → 0.122.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 +497 -356
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-Y8O56Cz5.js → AboutPage-ClN3P9B8.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DlROxqde.js → ActivityErrorState-B2lq1pyE.js} +1 -1
- package/dist/client/assets/{ActivityPage-BdV90CV2.js → ActivityPage-htTkSy18.js} +1 -1
- package/dist/client/assets/{ActivityRow-B5yiD_uD.js → ActivityRow-BqV0B1T0.js} +1 -1
- package/dist/client/assets/{AdapterIcon-Dyq92Eup.js → AdapterIcon-DlkN0YJo.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-D9tqz7Hl.js → AdapterSetupWizard-RyNPjSmU.js} +1 -1
- package/dist/client/assets/{AgentOptionRow-BeRqDo7c.js → AgentOptionRow-DSievGfL.js} +1 -1
- package/dist/client/assets/{AgentPicker-BRyYVJZu.js → AgentPicker-BCtWrhsA.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-xX6fAKgO.js → AgentRequestCard-BHIHWNRz.js} +4 -4
- package/dist/client/assets/{AppearancePage-DKF9BqRt.js → AppearancePage-B2eduuT0.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-CPvtr_-f.js → ApplyToOverridesDialog-C7G2t3X2.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-vBfioH1A.js → AttentionSignalRow-_8thTHYX.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-B50zNtwB.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-WpZU5xiO.js} +1 -1
- package/dist/client/assets/{BindingDialog-CSNjws3F.js → BindingDialog-BAwbHFq3.js} +1 -1
- package/dist/client/assets/BlintzCanvas-BEtRmEbL.js +1231 -0
- package/dist/client/assets/{BlintzCanvas-GgiCXV7C.css → BlintzCanvas-DCXOV_yN.css} +1 -1
- package/dist/client/assets/{CanvasCsvContent-0Mb7uOuA.js → CanvasCsvContent--6i2ETyZ.js} +2 -2
- package/dist/client/assets/CanvasFileContent-C86nyLbI.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-wYHHAovt.js +2 -0
- package/dist/client/assets/{ChatAppsOff-CLRB0YU5.js → ChatAppsOff-2Wvch1rr.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-B4uFJD6g.js → CodeMirrorDiff-s1TWguZ8.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-rYOrBAZc.js → CodeMirrorEditor-1ndoTbcZ.js} +1 -1
- package/dist/client/assets/{CommitmentList-i-IZ4gbr.js → CommitmentList-BK97ndab.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-ChO1JkrE.js → CommitmentsPage-_nd37gVX.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-pLuD2ie6.js → ComputerResourceView-C2Broer4.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D7tPmpY5.js → ComputerViewer-DgG7t2KZ.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-D6VH1vX3.js → ConnectionAccessLists-Pbo2lft8.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-7x5olD9q.js → ConnectionsPage-Dm2d9owX.js} +2 -2
- package/dist/client/assets/{ConventionPage-BTYLWw6p.js → ConventionPage-BUltejHJ.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-A9AdBBbw.js → ExtensionPageRoute-DAomCiMw.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-ayv0yz1C.js → FloatingTanStackRouterDevtools-CqogiFob-5fT29ZEV.js} +1 -1
- package/dist/client/assets/HandlePage-BoBFGnUB.js +1 -0
- package/dist/client/assets/{HeartbeatPage-Dh6W9Qg5.js → HeartbeatPage-BW0X4YAL.js} +1 -1
- package/dist/client/assets/{KeyEntry-owhPGtw3.js → KeyEntry-ClqAj0dS.js} +1 -1
- package/dist/client/assets/{LexicalField-B1NFMLD6.js → LexicalField-CbswpPQ7.js} +1 -1
- package/dist/client/assets/{ManagesPage-BAnBmBdo.js → ManagesPage-Daqs8hys.js} +1 -1
- package/dist/client/assets/{Marketplace-67maxdwz.js → Marketplace-BNMIm8g_.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-CzPBNJJj.js → MarketplaceSourcesView-B4WpzVpr.js} +1 -1
- package/dist/client/assets/{McpAppFrame-CuObpQTg.js → McpAppFrame-Dbg_Ni39.js} +1 -1
- package/dist/client/assets/{McpSigninBody-B-ayj6bQ.js → McpSigninBody-ZmmY1BZ4.js} +1 -1
- package/dist/client/assets/{Model3dViewer-DRVqxazk.js → Model3dViewer-DT8x0h7T.js} +1 -1
- package/dist/client/assets/NamePage-bC_9FOtD.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-B3DxayR2.js → NewDirectMessageMenu-BbehZd6I.js} +1 -1
- package/dist/client/assets/{NotificationsPage-BavEo7VZ.js → NotificationsPage-B9zEN26O.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BwkX2Toa.js → OpenMeshSwitch-D-AYDXjH.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-CtWgz2yi.js → OperatorIdentityForm-BdAqzVEG.js} +1 -1
- package/dist/client/assets/{PermissionHistory-DvM0F2bS.js → PermissionHistory-IOgLQ7qN.js} +1 -1
- package/dist/client/assets/{PermissionsPage-D1DJHezV.js → PermissionsPage-CKfDf5Pj.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BV-9wfIl.js → PersonalityPopover-CHPTuHIH.js} +1 -1
- package/dist/client/assets/PhotoPage-BOe3xwyN.js +1 -0
- package/dist/client/assets/{PresetPicker-BOQKgYAK.js → PresetPicker-BcKF2ds8.js} +2 -2
- package/dist/client/assets/{PreviewRefusedNotice-BdhUln2h.js → PreviewRefusedNotice-BuVUhjq3.js} +1 -1
- package/dist/client/assets/{ProfileFields-DFRnRR38.js → ProfileFields-DimHNpR4.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-CkxX9Dps.js → ProfilePanelContainer-FRZ5Px2L.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-BSYi_luB.js → ProfileRolePicker-UWhM5yuR.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-r08GqBH1.js → PromptSuggestionChips-DQaDSd7Y.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BcsM5Eia.js → ReportsToPopover-BOuCM8il.js} +1 -1
- package/dist/client/assets/RoomSurface-Dhv-LkWz.js +44 -0
- package/dist/client/assets/{RoomsPage-CQqsdVvB.js → RoomsPage-glKYJBpq.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DFb4xEhP.js → RunsOnPopover-BvxoHUeo.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-pKFJlNSJ.js → RuntimeConnectFlow-CgB_X5wo.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-DvBJbrmj.js → RuntimeSetupDialog-r1Ss_YQW.js} +1 -1
- package/dist/client/assets/{SessionsPage-CGgnEPh7.js → SessionsPage-CFLDx-aF.js} +1 -1
- package/dist/client/assets/{SettingsDialog-D0cmzjrH.js → SettingsDialog-BT5rYJUm.js} +3 -3
- package/dist/client/assets/{SkillsPage-DDoPlsn2.js → SkillsPage-CUQZ4I_r.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-DoIVzbKU.js → TaskDialogWrapper-DWpxyxBb.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-B68O6dnT.js → TasksEmptyState-B4TjUm8G.js} +2 -2
- package/dist/client/assets/{TasksPage-BsBDphim.js → TasksPage-D_vFBDA1.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CoQ4EsDm.js → TeamComputerEntry-EQ1fjMRb.js} +1 -1
- package/dist/client/assets/{ToolsPage-Cl1aOpev.js → ToolsPage-CyNXCe2l.js} +1 -1
- package/dist/client/assets/TopologyGraph-DsPEpDjt.js +30 -0
- package/dist/client/assets/{TourHost-4O6TJzc-.js → TourHost-D1z2mH5S.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-DIMY60Fi.js → UnlinkDialog-q-6B4Ftt.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-CzWw_SPD.js → WidgetErrorCard-BYMiUiAf.js} +23 -23
- package/dist/client/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
- package/dist/client/assets/_shell-scIpUrVY.js +80 -0
- package/dist/client/assets/{_shell._home-DG3Vw7S5.js → _shell._home-D-8JcUYq.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-COI96oAO.js → _shell._home.activity-xJKxWbtL.js} +1 -1
- package/dist/client/assets/{_shell._home.index-CTwsTjcQ.js → _shell._home.index-C74gh1aE.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-DOVoPYaf.js → _shell._home.tasks-Bh8jwRYJ.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-ApZhnjwy.js → _shell._home.workspaces-BKkUl6wW.js} +1 -1
- package/dist/client/assets/_shell.channels-B2A1G9n8.js +10 -0
- package/dist/client/assets/{_shell.connections-bhAK3jnE.js → _shell.connections-eDlPXmuG.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-k43R8-rW.js → _shell.feedback-requests-Cdbl3oKj.js} +1 -1
- package/dist/client/assets/_shell.marketplace-FHQpZxgB.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DXv90Z-v.js +1 -0
- package/dist/client/assets/_shell.session-BNeYm91q.js +63 -0
- package/dist/client/assets/{_shell.team-DHCM1QoO.js → _shell.team-Consxq97.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-DirEl_qN.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DirEl_qN.js +1 -0
- package/dist/client/assets/abnfDiagram-WEYOIA3C-DXTlLd8s.js +1 -0
- package/dist/client/assets/{access-copy-BVzi1REx.js → access-copy-B1SlOYEi.js} +1 -1
- package/dist/client/assets/arc-B3IW5TXq.js +1 -0
- package/dist/client/assets/architectureDiagram-ZHVYKT53-Bx-4szWe.js +36 -0
- package/dist/client/assets/{banner-3xXXsU5J.js → banner-RKoWGrEp.js} +1 -1
- package/dist/client/assets/blockDiagram-RJAE7QA3-D_B3EDQ1.js +140 -0
- package/dist/client/assets/c4Diagram-XDPPPE54-CSBl4ROD.js +38 -0
- package/dist/client/assets/{card-Bt6IU-Bh.js → card-DTMhLU7B.js} +1 -1
- package/dist/client/assets/channel-BlEJg4XA.js +1 -0
- package/dist/client/assets/chunk-2E7WHVMD-QSgLcVHQ.js +88 -0
- package/dist/client/assets/chunk-2Q5K7J3B-CAEYyBSj.js +1 -0
- package/dist/client/assets/chunk-4EMNKR2T-CQ_90aiz.js +1 -0
- package/dist/client/assets/chunk-55XCU76K-jsUyUA3N.js +1 -0
- package/dist/client/assets/chunk-5VM5RSS4-JHkf15PA.js +15 -0
- package/dist/client/assets/chunk-JWPE2WC7-BT-3krv8.js +1 -0
- package/dist/client/assets/chunk-VQ5W62QI-CJP11I5o.js +1 -0
- package/dist/client/assets/chunk-XXDRQBXY-BpqBecnj.js +1 -0
- package/dist/client/assets/chunk-ZCHMQSOR-BLb4KcT4.js +2 -0
- package/dist/client/assets/classDiagram-v2-4MYWR3UA-DwLyYGkw.js +217 -0
- package/dist/client/assets/{command-CWokzKS1.js → command-DDSiiJlP.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CxYTET88.js +1 -0
- package/dist/client/assets/{cpu-BzByzE9V.js → cpu--56q_Ey0.js} +1 -1
- package/dist/client/assets/cynefin-EF2NZ3EQ-9fHLZRHz.js +141 -0
- package/dist/client/assets/cynefinDiagram-WF24UDRP-DpfQecff.js +62 -0
- package/dist/client/assets/cytoscape.esm-BLAcgzS2.js +331 -0
- package/dist/client/assets/dagre-NK4GIZVX-DuV6buEQ.js +4 -0
- package/dist/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/client/assets/diagram-CBK3MWTC-B-A9Sx5n.js +24 -0
- package/dist/client/assets/diagram-I5XIIV2D-Ds5Hq9aV.js +24 -0
- package/dist/client/assets/diagram-ODIL2UCW-UUfSjM-R.js +30 -0
- package/dist/client/assets/diagram-PFBEJUXE-CUzSSYf9.js +3 -0
- package/dist/client/assets/diagram-RJA3I4VV-Cgp6U3q1.js +41 -0
- package/dist/client/assets/diagram-TYUNFSNR-BxVgzMNE.js +200 -0
- package/dist/client/assets/ebnfDiagram-V4P3TTPT-BgDiHzoi.js +1 -0
- package/dist/client/assets/elk-QONTBCTQ-BCCN6mFs.js +27 -0
- package/dist/client/assets/{empty-state-BgnQDiMZ.js → empty-state-BsA3jcrO.js} +1 -1
- package/dist/client/assets/erDiagram-KYQIGQAA-5RkmUbLz.js +99 -0
- package/dist/client/assets/{execution-config-D5-SEt2t.js → execution-config-CRkSeCj7.js} +1 -1
- package/dist/client/assets/{file-VHDTQub2.js → file-Bg_qGvWR.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DbWvGys0.js → file-exclamation-point-BWsLZQVN.js} +1 -1
- package/dist/client/assets/{file-text-BAhi2zct.js → file-text-DQThCdY3.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-Z0HPVqeK.js → find-latest-widget-fence-DFpYPIlS.js} +1 -1
- package/dist/client/assets/flowDiagram-IUGLLWBU-C2FFT_4u.js +213 -0
- package/dist/client/assets/{form-Blrb1xBU.js → form-DjMe15QR.js} +1 -1
- package/dist/client/assets/{format-cron-lKWqEmle.js → format-cron-Bo3D4N9C.js} +1 -1
- package/dist/client/assets/ganttDiagram-R7GPNTJY-BHG-HNDj.js +292 -0
- package/dist/client/assets/{git-branch-BObm8Rlz.js → git-branch-CJ1NlVLY.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-PDYL7XHY-D4bvs6_J.js +106 -0
- package/dist/client/assets/graph-D8MBmHRU.js +1 -0
- package/dist/client/assets/{heart-Du7nuefC.js → heart-Beze5rli.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-B_GO7V1P.js → highlighted-body-KPVGNVTW-B-za1R0D.js} +1 -1
- package/dist/client/assets/{image-lightbox-BZ1TV3mN.js → image-lightbox-a4gqhNXS.js} +1 -1
- package/dist/client/assets/{image-off-hnjcBIzN.js → image-off-dQCXn9D_.js} +1 -1
- package/dist/client/assets/{index-DoMJUxt_.js → index--vwACals.js} +1 -1
- package/dist/client/assets/{index-BVKXIbLh.js → index-B3VKw60l.js} +1 -1
- package/dist/client/assets/index-B3ybVnXe.js +23 -0
- package/dist/client/assets/{index-HxT_wkaZ.js → index-BJv8b9cZ.js} +1 -1
- package/dist/client/assets/{index-aXm0xP_2.js → index-BMhblg3s.js} +1 -1
- package/dist/client/assets/{index-4GC2fkeO.js → index-BMktWriw.js} +1 -1
- package/dist/client/assets/{index-Ci74HAFs.js → index-BPa0ZczY.js} +1 -1
- package/dist/client/assets/{index-1I8qHZDt.js → index-BTVsyrd0.js} +1 -1
- package/dist/client/assets/{index-DRea_Gi0.js → index-BTfwunle.js} +1 -1
- package/dist/client/assets/{index-BtbZpz4b.js → index-BaocSCDH.js} +1 -1
- package/dist/client/assets/{index-CCg7yRe1.js → index-Bk6YahnN.js} +1 -1
- package/dist/client/assets/{index-B0tAedq7.js → index-BqwfU5a7.js} +1 -1
- package/dist/client/assets/index-BydIKjk5.js +1 -0
- package/dist/client/assets/{index-Bm0z9mHt.js → index-C38pc-JE.js} +1 -1
- package/dist/client/assets/{index-Df7a-2P5.js → index-C9qjJR0B.js} +1 -1
- package/dist/client/assets/{index-CqoIjNC2.js → index-CAGOE4EU.js} +2 -2
- package/dist/client/assets/{index-D5TZCu8j.js → index-CDm1XkU1.js} +1 -1
- package/dist/client/assets/{index-CQCN6kWR.js → index-CGVRWEpN.js} +1 -1
- package/dist/client/assets/{index-CiQxS4Bn.js → index-CMlVfxJv.js} +1 -1
- package/dist/client/assets/{index-BeVbHOwX.js → index-CPxcbKL6.js} +2 -2
- package/dist/client/assets/{index-4PAAWURd.js → index-CU-gekzq.js} +1 -1
- package/dist/client/assets/{index-BnNTKsbt.js → index-Ckv0K82u.js} +1 -1
- package/dist/client/assets/{index-BUOcbPfv.js → index-CocSe_I3.js} +3 -3
- package/dist/client/assets/index-CodC2rG4.js +1 -0
- package/dist/client/assets/{index-BgzgdvDn.js → index-CxWJDJW7.js} +1 -1
- package/dist/client/assets/index-D18FqQKB.js +1 -0
- package/dist/client/assets/{index-BaRQVgiN.js → index-D4mYlxG0.js} +1 -1
- package/dist/client/assets/{index-Dc5cpBoO.js → index-DBdO-_iL.js} +240 -240
- package/dist/client/assets/{index-r_O6CmXY.js → index-DFN-GU8r.js} +1 -1
- package/dist/client/assets/{index-DkhM0fDi.js → index-DLdpa3d4.js} +1 -1
- package/dist/client/assets/{index-EZHlD3gf.js → index-DNlhbCX_.js} +1 -1
- package/dist/client/assets/{index-ox3ce99A.js → index-D_KBdkA4.js} +1 -1
- package/dist/client/assets/{index-WxtASL5_.js → index-Dbt6ttQb.js} +1 -1
- package/dist/client/assets/index-DfSOcv9s.js +74 -0
- package/dist/client/assets/{index-CBm3whA-.js → index-DnfhvN3q.js} +1 -1
- package/dist/client/assets/{index-BvjuGXcS.js → index-DpX_xwGs.js} +1 -1
- package/dist/client/assets/{index-C60RrnTd.js → index-DqD-Sg0W.js} +1 -1
- package/dist/client/assets/{index-Lh82Rz5C.js → index-Ds-LCBb6.js} +1 -1
- package/dist/client/assets/index-dnaC3n0i.js +17 -0
- package/dist/client/assets/{index-DB8TDRSm.js → index-hKY0860x.js} +1 -1
- package/dist/client/assets/{index-BP68J4pb.js → index-vNaWkS8Y.js} +1 -1
- package/dist/client/assets/{index-Ch-ON5gw.js → index-vieeLeZH.js} +1 -1
- package/dist/client/assets/{index-D6y4WeTi.js → index-yDf4EVDy.js} +1 -1
- package/dist/client/assets/{index.esm-DXsF3Bua.js → index.esm-Ruqz-OsH.js} +1 -1
- package/dist/client/assets/infoDiagram-MVDRKAX5-CmDlX3lx.js +2 -0
- package/dist/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/client/assets/{inline-code-DAEoWvTf.js → inline-code-plzdKGm9.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-HPEHV2GE-DZFRAvrx.js +70 -0
- package/dist/client/assets/journeyDiagram-BOSHW7O7-B140KXYu.js +139 -0
- package/dist/client/assets/kanban-definition-FNSA4HC5-QCZgRJic.js +89 -0
- package/dist/client/assets/katex-DLorvT8M.js +257 -0
- package/dist/client/assets/{layers-CsM34LRv.js → layers-Br3LALac.js} +1 -1
- package/dist/client/assets/{lightbulb-B8JAixK_.js → lightbulb-CeJgUDoT.js} +1 -1
- package/dist/client/assets/linear-BT-xgETh.js +1 -0
- package/dist/client/assets/{link-2-Csc6okl3.js → link-2-BXcZwTAC.js} +1 -1
- package/dist/client/assets/{list-runtime-types-DQrZNB7x.js → list-runtime-types-CqKIrt9D.js} +1 -1
- package/dist/client/assets/{markdown-content-DPc7aD1j.js → markdown-content-BKbjOTI2.js} +1 -1
- package/dist/client/assets/{mention-pill-8P_w4muj.js → mention-pill-B-FgNE6o.js} +1 -1
- package/dist/client/assets/mermaid.core-Br9hJ7FR.js +312 -0
- package/dist/client/assets/{message-square-off-D5DXu2cY.js → message-square-off-Co0W--np.js} +1 -1
- package/dist/client/assets/mindmap-definition-6OY57UG3-BxjSZAec.js +98 -0
- package/dist/client/assets/{more-details-DEeu2M-p.js → more-details-BsdCkGTg.js} +1 -1
- package/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/client/assets/{owner-notice-BW4k1ycg.js → owner-notice-BxltHzJH.js} +1 -1
- package/dist/client/assets/{package-BSwwAFVm.js → package-DPgmy9lP.js} +1 -1
- package/dist/client/assets/{page-container-CjPUNtNw.js → page-container-HokGbFg_.js} +1 -1
- package/dist/client/assets/{paperclip-DQaRz34E.js → paperclip-BDnApT-_.js} +1 -1
- package/dist/client/assets/{path-input-CgXSYNZn.js → path-input-C22n3ghr.js} +1 -1
- package/dist/client/assets/pegDiagram-ECIUJNBX-utA2pUiu.js +1 -0
- package/dist/client/assets/pieDiagram-GNMPY74T-DjEry_VP.js +39 -0
- package/dist/client/assets/{plug-BaUXMfIl.js → plug-tLTAmXis.js} +1 -1
- package/dist/client/assets/{primer-trigger-DHB0vilf.js → primer-trigger-CfVHNFbe.js} +2 -2
- package/dist/client/assets/{profile-errors-JW2XTgia.js → profile-errors-Dvm4O6MR.js} +1 -1
- package/dist/client/assets/{progress-CErAw8zp.js → progress-BduTwXMX.js} +1 -1
- package/dist/client/assets/quadrantDiagram-D57K4MC3-DO9NgnEq.js +7 -0
- package/dist/client/assets/{query-error-state-BFWpEXsl.js → query-error-state-puwJHnzi.js} +1 -1
- package/dist/client/assets/query-keys-DeYqUDia.js +1 -0
- package/dist/client/assets/{radio-Bkx216ga.js → radio-DR4E05zZ.js} +1 -1
- package/dist/client/assets/railroadDiagram-Y72NRBL7-BTilAS9p.js +1 -0
- package/dist/client/assets/registry-B3Ss4ItQ.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DiZj_AFV.js → relay-trace-schemas-DwqIIDB9.js} +2 -2
- package/dist/client/assets/requirementDiagram-EQYSW5RA-C6rzY7GK.js +84 -0
- package/dist/client/assets/{room-files-source-BilZvdpf.js → room-files-source-Duo4oiqX.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-D_SO1stN.js → rotate-ccw-clock-RJuoRE3k.js} +1 -1
- package/dist/client/assets/{rotate-cw-C68kM23F.js → rotate-cw-C0EpbK5k.js} +1 -1
- package/dist/client/assets/sankeyDiagram-SY24JHO5-BqpJRY1t.js +40 -0
- package/dist/client/assets/{scroll-area-CVWFUmJV.js → scroll-area-07T90PR6.js} +1 -1
- package/dist/client/assets/{search-x-BTFVvyA2.js → search-x-DQabogEL.js} +1 -1
- package/dist/client/assets/sequenceDiagram-BLEHNHQU-BHfzZpFt.js +169 -0
- package/dist/client/assets/{shield-check-Dpxi6WqO.js → shield-check-DbbCy17l.js} +1 -1
- package/dist/client/assets/{shield-x-CdCCgyXk.js → shield-x-Cuo1GTv4.js} +1 -1
- package/dist/client/assets/{signed-in-BxAnDo0S.js → signed-in-CFtA8gTK.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-U0MO-4ua.js +1 -0
- package/dist/client/assets/{soul-file-CRfKVJX3.js → soul-file-wKTqbR0Y.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-A6IESKWZ-fzo1sDsX.js +291 -0
- package/dist/client/assets/swimlanes-B3ENRKFQ-B7QcCUBU.js +1 -0
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CgZZnzbW.js +8 -0
- package/dist/client/assets/{table-BL3xUC41.js → table-BjHA85BX.js} +1 -1
- package/dist/client/assets/{terminal-u_UCRzSM.js → terminal-qfxxVZaa.js} +1 -1
- package/dist/client/assets/timeline-definition-JXYKGLGB-okVlmef4.js +120 -0
- package/dist/client/assets/transform-BqqRT-Iy.js +1 -0
- package/dist/client/assets/{trust-posture-B-v4BWo7.js → trust-posture-BmW0KVP6.js} +1 -1
- package/dist/client/assets/{unplug-CFbC-L5W.js → unplug-BYKBdSMl.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-ZUqscVFM.js → unverified-catalog-notice-CQHA4Cst.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-Z4MDWZAZ.js → use-adapter-catalog-rB4qQQ5D.js} +1 -1
- package/dist/client/assets/{use-bindings-CsTavmf-.js → use-bindings-DiFC7kWg.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-BY2dTvep.js → use-composer-prefs-DHY5vJ0l.js} +1 -1
- package/dist/client/assets/{use-connector-management-L9l21yTi.js → use-connector-management-CoinXIID.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-Bn2ZUtDY.js → use-deep-link-scroll-Cm8BRFAE.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DLvdHtPD.js → use-delete-binding-FtM6qPfF.js} +1 -1
- package/dist/client/assets/{use-dev-links-DFvL8mIg.js → use-dev-links-TQFCV3vk.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-Be57G4tz.js → use-external-adapter-catalog-Lx8LZDAa.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-Cp3lYXdi.js → use-full-activity-feed-CmcBAvUM.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-BB9kHnYm.js +1 -0
- package/dist/client/assets/use-is-hub-ab4UGRdN.js +1 -0
- package/dist/client/assets/{use-jump-back-in-ChH1FSEK.js → use-jump-back-in-V8G_6fYj.js} +3 -3
- package/dist/client/assets/{use-local-browser-zA8gMhcC.js → use-local-browser-CbS4typW.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CvoD-L1G.js → use-mesh-topology-DZ1qMT3J.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Ch0wqQry.js → use-mounted-ref-DUbNzP-m.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-DeR05zhp.js → use-notification-prefs-BAsICJ96.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-DdjrmaoK.js → use-panel-tab-placements-ymrpuL_s.js} +1 -1
- package/dist/client/assets/use-pending-read-BkCvAuX4.js +1 -0
- package/dist/client/assets/{use-personality-commit-qQfISO2-.js → use-personality-commit-rJOmDgC2.js} +1 -1
- package/dist/client/assets/{use-promo-activation-CwGoE7b-.js → use-promo-activation-BKeBloMI.js} +2 -2
- package/dist/client/assets/{use-promo-dismissals-BBqVN4hx.js → use-promo-dismissals-Cio8QMjL.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BKW7tjvX.js → use-pulse-freshness-DZkMVbSM.js} +1 -1
- package/dist/client/assets/{use-relay-config-D5iieBXl.js → use-relay-config-CbZQKFhZ.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BwZh2ZPH.js → use-room-follow-claim-DbJIsuWz.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-Ct7yDAUE.js → use-roving-tab-list-B4nZ7trj.js} +1 -1
- package/dist/client/assets/use-session-canvas-sAwc2L1A.js +25 -0
- package/dist/client/assets/{use-session-diagnostics-Dn-Wnyhh.js → use-session-diagnostics-0gcI762B.js} +2 -2
- package/dist/client/assets/{use-unclaimed-chats-M-c5tjXH.js → use-unclaimed-chats-BWIqOrvs.js} +1 -1
- package/dist/client/assets/use-update-config-DTL7WyZV.js +1 -0
- package/dist/client/assets/{useMutationState-Cd-VqRAv.js → useMutationState-C9Q5lRej.js} +1 -1
- package/dist/client/assets/usecaseDiagram-WPOLBNNX-CMjVaeX9.js +370 -0
- package/dist/client/assets/value-wA6veExk.js +1 -0
- package/dist/client/assets/vennDiagram-Q3Y3IDCW-BajZBf0H.js +34 -0
- package/dist/client/assets/wardleyDiagram-IVAIDKWA-BN4xF6JT.js +78 -0
- package/dist/client/assets/xychartDiagram-4URNHDU4-Cy0Z9a28.js +7 -0
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +31467 -29078
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/BlintzCanvas-ClOKWzws.js +0 -1141
- package/dist/client/assets/CanvasFileContent-B_8zsIas.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-UokbHY9i.js +0 -2
- package/dist/client/assets/HandlePage-BdRWgke2.js +0 -1
- package/dist/client/assets/NamePage-DyH8JAqT.js +0 -1
- package/dist/client/assets/PhotoPage-BHvRQnex.js +0 -1
- package/dist/client/assets/RoomSurface-DaRCf4og.js +0 -44
- package/dist/client/assets/TopologyGraph-D3CxaLGX.js +0 -30
- package/dist/client/assets/_shell-BRH2Y-U-.js +0 -80
- package/dist/client/assets/_shell.channels-CRkJHU5R.js +0 -10
- package/dist/client/assets/_shell.marketplace-DGN_IdZY.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-2YMpLInp.js +0 -1
- package/dist/client/assets/_shell.session-D871zZl3.js +0 -61
- package/dist/client/assets/_shell.x._extensionId-D3-n5IRW.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-D3-n5IRW.js +0 -1
- package/dist/client/assets/index-Cdyszxoa.js +0 -17
- package/dist/client/assets/index-DCOOlbEt.js +0 -1
- package/dist/client/assets/index-DHYvT3nr.js +0 -23
- package/dist/client/assets/index-Dain_3cO.js +0 -1
- package/dist/client/assets/index-_5Dn0bFm.js +0 -74
- package/dist/client/assets/registry-Ce1VRIS3.js +0 -1
- package/dist/client/assets/use-is-below-desktop-DmekpHAF.js +0 -1
- package/dist/client/assets/use-is-hub-el7LTkg3.js +0 -1
- package/dist/client/assets/use-pending-read-DBpte0GI.js +0 -1
- package/dist/client/assets/use-session-canvas-CJrfZrYG.js +0 -24
- package/dist/client/assets/use-update-config-DhlbZldm.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{eF as J,j as e,eG as Q,eH as Z,eI as C,eJ as ee,eK as z,ct as se,eL as te,r as O,ak as A,eM as D,H as V,aS as Y,X as ne,eN as ae,eO as ie,eP as re,eQ as oe,B as E,f as de,eR as le,eS as U,eT as ce,eU as X,a0 as me,bb as ue,eV as xe,eW as he,eX as ge,eY as pe,eZ as fe,e_ as ve,T as je,G as I,e$ as M,f0 as Ne,f1 as be,_ as T,$ as we,f2 as ye,f3 as Se,f4 as ke,f5 as Ce,f6 as Ee,f7 as $e,f8 as Pe,f9 as B,dz as Te,a7 as S,fa as Re,fb as F}from"./index-Dc5cpBoO.js";import{fc as ms,fd as us,fe as xs,ff as hs,fg as gs,fh as ps}from"./index-Dc5cpBoO.js";import{u as _e}from"./use-deep-link-scroll-Bn2ZUtDY.js";import{M as K}from"./more-details-DEeu2M-p.js";import{C as Ae}from"./card-Bt6IU-Bh.js";import{u as De,a as Ie}from"./use-panel-tab-placements-DdjrmaoK.js";import{C as Le,a as Oe,b as ze,c as Me,d as R,e as _}from"./command-CWokzKS1.js";import{F as q}from"./file-text-BAhi2zct.js";import{S as Be}from"./shield-check-Dpxi6WqO.js";const Fe=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],He={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 L(s){return Fe.includes(s)}function Ge(s,r){return L(s)?He[s](r):null}function Ve(s){return`Restarting ${s}…`}function Ye({extensionId:s}){const r=J("right-panel").filter(d=>d.extensionId===s);return r.length===0?null:e.jsx("div",{className:"space-y-3 pt-1","data-testid":`panel-tab-placement-${s}`,children:r.map(d=>e.jsx(Xe,{tab:d,labelled:r.length>1},d.id))})}function Ue(){var d;const s=(d=se().data)==null?void 0:d.agents,r=te().data;return O.useMemo(()=>{const l=new Map((s??[]).map(a=>[a.id,A(a)])),c=new Map((r??[]).map(a=>[a.id,D(a)]));return{agents:s??[],rooms:r??[],agentNames:l,roomNames:c}},[s,r])}function Xe({tab:s,labelled:r}){const d=Q(De(),s.id),{setPlacement:l}=Ie(),c=Ue(),a=Z(d,s.declaredPlacement),g=a.show.pages.includes(C),o=t=>l(s.id,{show:t.show,hide:t.hide}),m=t=>t.kind==="agents"?c.agentNames.get(t.id)??"An agent that is gone":t.kind==="rooms"?c.roomNames.get(t.id)??"A channel that is gone":ae(t.id),v=(t,u)=>["agents","rooms","pages"].flatMap(j=>t[j].filter(i=>u||i!==C).map(i=>({kind:j,id:i}))),n=(t,u)=>({...t,[u.kind]:t[u.kind].filter(j=>j!==u.id)}),p=v(a.show,!1),N=v(a.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:r?`${s.title} tab shows`:"Panel tab shows"}),e.jsxs(ee,{value:g?"everywhere":"only",onValueChange:t=>o({hide:a.hide,show:t==="everywhere"?{...a.show,pages:[C]}:{...a.show,pages:a.show.pages.filter(u=>u!==C)}}),"aria-label":`Where the ${s.title} tab shows`,children:[e.jsx(z,{value:"everywhere",children:"Everywhere"}),e.jsx(z,{value:"only",children:"Only in…"})]}),d&&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"})]}),!g&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p.map(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Remove ${m(t)}`,onRemove:()=>o({...a,show:n(a.show,t)})},`${t.kind}:${t.id}`)),e.jsx(qe,{tabTitle:s.title,names:c,taken:a.show,onAdd:t=>o({show:{...a.show,[t.kind]:[...a.show[t.kind],t.id]},hide:n(a.hide,t)})}),p.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(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Show in ${m(t)} again`,onRemove:()=>o({...a,hide:n(a.hide,t)})},`${t.kind}:${t.id}`))]})]})}const Ke={agents:Y,rooms:V,pages:q};function H({place:s,name:r,removeLabel:d,onRemove:l}){const c=Ke[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(c,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:r}),e.jsx("button",{type:"button",onClick:l,"aria-label":d,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(ne,{className:"size-3"})})]})}function qe({tabTitle:s,names:r,taken:d,onAdd:l}){const[c,a]=O.useState(!1),g=n=>{l(n),a(!1)},o=ie.filter(n=>!d.pages.includes(n.key)),m=r.agents.filter(n=>!d.agents.includes(n.id)),v=r.rooms.filter(n=>!d.rooms.includes(n.id));return e.jsxs(re,{open:c,onOpenChange:a,children:[e.jsx(oe,{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(de,{className:"size-3"}),"Add"]})}),e.jsx(le,{align:"start",className:"w-64 p-0",children:e.jsxs(Le,{children:[e.jsx(Oe,{placeholder:"Find an agent, channel or page"}),e.jsxs(ze,{className:"max-h-64",children:[e.jsx(Me,{children:"Nothing matches."}),m.length>0&&e.jsx(R,{heading:"Agents",children:m.map(n=>e.jsxs(_,{value:`agent ${A(n)} ${n.id}`,onSelect:()=>g({kind:"agents",id:n.id}),children:[e.jsx(Y,{className:"size-3.5"}),A(n)]},n.id))}),v.length>0&&e.jsx(R,{heading:"Channels and DMs",children:v.map(n=>e.jsxs(_,{value:`room ${D(n)} ${n.id}`,onSelect:()=>g({kind:"rooms",id:n.id}),children:[e.jsx(V,{className:"size-3.5"}),D(n)]},n.id))}),o.length>0&&e.jsx(R,{heading:"Pages",children:o.map(n=>e.jsxs(_,{value:`page ${n.label}`,onSelect:()=>g({kind:"pages",id:n.key}),children:[e.jsx(q,{className:"size-3.5"}),n.label]},n.key))})]})]})})]})}const We=new Set(["disabled","discovered","incompatible","invalid"]),Je="/marketplace?view=installed";function Qe({extension:s,onToggle:r,isToggling:d,onSetRunApproval:l,isSettingApproval:c,onReload:a,isReloading:g}){const{manifest:o,status:m,scope:v,error:n,serverError:p,origin:N,approvedToRun:t}=s,[u,j]=O.useState(!1),i=!We.has(m),x=m==="incompatible",b=m==="invalid",h=m==="compile_error"||m==="activate_error",y=!x&&!b,f=!(N==="core"&&o.canDisable===!1),k=s.hasServerEntry||s.hasDataProxy,w=U(s),W=ce(s.id,X(w)),$=h?"Not working":x?"Incompatible":b?"Can’t load":null;return e.jsx(Ae,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,"data-section":s.id,radius:"lg",gap:"none",className:I(h&&"border-amber-500/50",(x||b)&&"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:[h&&e.jsx(me,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(x||b)&&!h&&e.jsx(ue,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!h&&!x&&!b&&e.jsx(xe,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:o.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",o.version]}),s.devLink&&e.jsx(he,{})]}),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(ge,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void pe(Je),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),o.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:o.description}),e.jsx(fe,{gifts:ve(s),"data-testid":`extension-agent-gifts-${s.id}`}),i&&e.jsx(Ye,{extensionId:s.id}),x&&o.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",o.minHostVersion," or newer"]}),h&&n&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[m==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",n.message]}),n.details&&e.jsxs("button",{type:"button",onClick:()=>j(P=>!P),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":u,children:[e.jsx(je,{className:I("size-3 transition-transform",u&&"rotate-180")}),u?"Hide details":"Show details"]}),u&&n.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:n.details})]}),p&&L(p.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:p.message||Ge(p.code,o.name)}),e.jsx("button",{type:"button",onClick:a,disabled:g,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!p&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:Ve(o.name)}),p&&!L(p.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",p.message,". The last version still runs."]}),N==="user"&&(t?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(Be,{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:c,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(M,{permissions:w,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(M,{permissions:w,added:W,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:Ne(k,(w==null?void 0:w.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:be}),e.jsx(E,{size:"sm",onClick:()=>l(s.id,!0),disabled:c,"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(T,{variant:"outline",children:v}),$&&e.jsx(T,{variant:$==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:$}),o.author&&e.jsx("span",{children:o.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:f?e.jsx(we,{checked:i,onCheckedChange:P=>r(s.id,P),disabled:!y||d,"aria-label":`${i?"Disable":"Enable"} ${o.name}`}):e.jsx(T,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function G(s){const r=new Date(s);return Number.isNaN(r.getTime())?"":r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Ze(){const{data:s=[]}=ye(),{stop:r,pendingSource:d}=Se();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(K,{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:c})=>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}),G(c)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",G(c)]})]}),e.jsx(E,{type:"button",variant:"outline",size:"sm",disabled:d===l,onClick:()=>r(l),children:"Stop trusting"})]},l))})]})}function ds(){const{data:s=[],isLoading:r}=ke(),{section:d}=Ce();_e(r?null:d);const l=Ee(),c=$e(),a=Pe(),g=B(!0),o=B(!1),m=new Set([...l.variables?[l.variables]:[],...c.variables?[c.variables]:[]]),v=new Set([...g.isPending&&g.variables?[g.variables.id]:[],...o.isPending&&o.variables?[o.variables.id]:[]]);function n(i,x){const b=x?g:o,h=s.find(f=>f.id===i);if(!h)return;const y=x?X(U(h)):void 0;b.mutate({id:i,version:h.manifest.version,plugin:h.sourcePlugin??null,...y?{permissions:y}:{}},{onSuccess:f=>{x&&F.getState().forget(i);const k=f.extension.manifest.name,w=f.extension.isolation?"":" inside DorkOS";S.success(x?`${k} can now run${w}`:`${k} stopped running`)},onError:f=>{if(f instanceof Re&&f.stale){y&&F.getState().remember(i,y),S.error(`${h.manifest.name} changed since you saw it. Check it again.`);return}S.error(x?"Couldn’t let it run.":"Couldn’t stop it running.",{description:f.message})}})}async function p(i,x){(x?l:c).mutate(i,{onError:h=>{S.error(x?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:h.message})}})}function N(){a.mutate(void 0,{onSuccess:i=>{S.success(`Reloaded ${i.length} extension${i.length===1?"":"s"}`)},onError:i=>{S.error("Couldn’t reload your extensions.",{description:i.message})}})}if(r)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const t=s.filter(i=>i.origin==="core"),u=s.filter(i=>i.origin==="user"),j=i=>e.jsx(Qe,{extension:i,onToggle:p,isToggling:m.has(i.id),onSetRunApproval:n,isSettingApproval:v.has(i.id),onReload:N,isReloading:a.isPending},i.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(K,{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:[t.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:t.map(j)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(j)}):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(Ze,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(E,{variant:"outline",size:"sm",onClick:N,disabled:a.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(Te,{className:I("mr-2 size-4",a.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{ms as ExtensionEventBridge,us as ExtensionLoader,xs as ExtensionProvider,ds as ExtensionsSettingsTab,hs as createExtensionAPI,gs as createExtensionEventBridge,ps as useExtensions};
|
|
1
|
+
import{eG as J,j as e,eH as Q,eI as Z,eJ as C,eK as ee,eL as z,ct as se,eM as te,r as O,ak as A,eN as D,H as V,aS as Y,X as ne,eO as ae,eP as ie,eQ as re,eR as oe,B as E,f as de,eS as le,eT as U,eU as ce,eV as X,a0 as me,bb as ue,eW as xe,eX as he,eY as ge,eZ as pe,e_ as fe,e$ as ve,T as je,G as I,f0 as M,f1 as Ne,f2 as be,_ as T,$ as we,f3 as ye,f4 as Se,f5 as ke,f6 as Ce,f7 as Ee,f8 as $e,f9 as Pe,fa as B,dz as Te,a7 as S,fb as Re,fc as F}from"./index-DBdO-_iL.js";import{fd as ms,fe as us,ff as xs,fg as hs,fh as gs,fi as ps}from"./index-DBdO-_iL.js";import{u as _e}from"./use-deep-link-scroll-Cm8BRFAE.js";import{M as K}from"./more-details-BsdCkGTg.js";import{C as Ae}from"./card-DTMhLU7B.js";import{u as De,a as Ie}from"./use-panel-tab-placements-ymrpuL_s.js";import{C as Le,a as Oe,b as ze,c as Me,d as R,e as _}from"./command-DDSiiJlP.js";import{F as q}from"./file-text-DQThCdY3.js";import{S as Be}from"./shield-check-DbbCy17l.js";const Fe=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],He={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 L(s){return Fe.includes(s)}function Ge(s,r){return L(s)?He[s](r):null}function Ve(s){return`Restarting ${s}…`}function Ye({extensionId:s}){const r=J("right-panel").filter(d=>d.extensionId===s);return r.length===0?null:e.jsx("div",{className:"space-y-3 pt-1","data-testid":`panel-tab-placement-${s}`,children:r.map(d=>e.jsx(Xe,{tab:d,labelled:r.length>1},d.id))})}function Ue(){var d;const s=(d=se().data)==null?void 0:d.agents,r=te().data;return O.useMemo(()=>{const l=new Map((s??[]).map(a=>[a.id,A(a)])),c=new Map((r??[]).map(a=>[a.id,D(a)]));return{agents:s??[],rooms:r??[],agentNames:l,roomNames:c}},[s,r])}function Xe({tab:s,labelled:r}){const d=Q(De(),s.id),{setPlacement:l}=Ie(),c=Ue(),a=Z(d,s.declaredPlacement),g=a.show.pages.includes(C),o=t=>l(s.id,{show:t.show,hide:t.hide}),m=t=>t.kind==="agents"?c.agentNames.get(t.id)??"An agent that is gone":t.kind==="rooms"?c.roomNames.get(t.id)??"A channel that is gone":ae(t.id),v=(t,u)=>["agents","rooms","pages"].flatMap(j=>t[j].filter(i=>u||i!==C).map(i=>({kind:j,id:i}))),n=(t,u)=>({...t,[u.kind]:t[u.kind].filter(j=>j!==u.id)}),p=v(a.show,!1),N=v(a.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:r?`${s.title} tab shows`:"Panel tab shows"}),e.jsxs(ee,{value:g?"everywhere":"only",onValueChange:t=>o({hide:a.hide,show:t==="everywhere"?{...a.show,pages:[C]}:{...a.show,pages:a.show.pages.filter(u=>u!==C)}}),"aria-label":`Where the ${s.title} tab shows`,children:[e.jsx(z,{value:"everywhere",children:"Everywhere"}),e.jsx(z,{value:"only",children:"Only in…"})]}),d&&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"})]}),!g&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p.map(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Remove ${m(t)}`,onRemove:()=>o({...a,show:n(a.show,t)})},`${t.kind}:${t.id}`)),e.jsx(qe,{tabTitle:s.title,names:c,taken:a.show,onAdd:t=>o({show:{...a.show,[t.kind]:[...a.show[t.kind],t.id]},hide:n(a.hide,t)})}),p.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(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Show in ${m(t)} again`,onRemove:()=>o({...a,hide:n(a.hide,t)})},`${t.kind}:${t.id}`))]})]})}const Ke={agents:Y,rooms:V,pages:q};function H({place:s,name:r,removeLabel:d,onRemove:l}){const c=Ke[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(c,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:r}),e.jsx("button",{type:"button",onClick:l,"aria-label":d,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(ne,{className:"size-3"})})]})}function qe({tabTitle:s,names:r,taken:d,onAdd:l}){const[c,a]=O.useState(!1),g=n=>{l(n),a(!1)},o=ie.filter(n=>!d.pages.includes(n.key)),m=r.agents.filter(n=>!d.agents.includes(n.id)),v=r.rooms.filter(n=>!d.rooms.includes(n.id));return e.jsxs(re,{open:c,onOpenChange:a,children:[e.jsx(oe,{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(de,{className:"size-3"}),"Add"]})}),e.jsx(le,{align:"start",className:"w-64 p-0",children:e.jsxs(Le,{children:[e.jsx(Oe,{placeholder:"Find an agent, channel or page"}),e.jsxs(ze,{className:"max-h-64",children:[e.jsx(Me,{children:"Nothing matches."}),m.length>0&&e.jsx(R,{heading:"Agents",children:m.map(n=>e.jsxs(_,{value:`agent ${A(n)} ${n.id}`,onSelect:()=>g({kind:"agents",id:n.id}),children:[e.jsx(Y,{className:"size-3.5"}),A(n)]},n.id))}),v.length>0&&e.jsx(R,{heading:"Channels and DMs",children:v.map(n=>e.jsxs(_,{value:`room ${D(n)} ${n.id}`,onSelect:()=>g({kind:"rooms",id:n.id}),children:[e.jsx(V,{className:"size-3.5"}),D(n)]},n.id))}),o.length>0&&e.jsx(R,{heading:"Pages",children:o.map(n=>e.jsxs(_,{value:`page ${n.label}`,onSelect:()=>g({kind:"pages",id:n.key}),children:[e.jsx(q,{className:"size-3.5"}),n.label]},n.key))})]})]})})]})}const We=new Set(["disabled","discovered","incompatible","invalid"]),Je="/marketplace?view=installed";function Qe({extension:s,onToggle:r,isToggling:d,onSetRunApproval:l,isSettingApproval:c,onReload:a,isReloading:g}){const{manifest:o,status:m,scope:v,error:n,serverError:p,origin:N,approvedToRun:t}=s,[u,j]=O.useState(!1),i=!We.has(m),x=m==="incompatible",b=m==="invalid",h=m==="compile_error"||m==="activate_error",y=!x&&!b,f=!(N==="core"&&o.canDisable===!1),k=s.hasServerEntry||s.hasDataProxy,w=U(s),W=ce(s.id,X(w)),$=h?"Not working":x?"Incompatible":b?"Can’t load":null;return e.jsx(Ae,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,"data-section":s.id,radius:"lg",gap:"none",className:I(h&&"border-amber-500/50",(x||b)&&"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:[h&&e.jsx(me,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(x||b)&&!h&&e.jsx(ue,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!h&&!x&&!b&&e.jsx(xe,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:o.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",o.version]}),s.devLink&&e.jsx(he,{})]}),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(ge,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void pe(Je),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),o.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:o.description}),e.jsx(fe,{gifts:ve(s),"data-testid":`extension-agent-gifts-${s.id}`}),i&&e.jsx(Ye,{extensionId:s.id}),x&&o.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",o.minHostVersion," or newer"]}),h&&n&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[m==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",n.message]}),n.details&&e.jsxs("button",{type:"button",onClick:()=>j(P=>!P),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":u,children:[e.jsx(je,{className:I("size-3 transition-transform",u&&"rotate-180")}),u?"Hide details":"Show details"]}),u&&n.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:n.details})]}),p&&L(p.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:p.message||Ge(p.code,o.name)}),e.jsx("button",{type:"button",onClick:a,disabled:g,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!p&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:Ve(o.name)}),p&&!L(p.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",p.message,". The last version still runs."]}),N==="user"&&(t?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(Be,{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:c,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(M,{permissions:w,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(M,{permissions:w,added:W,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:Ne(k,(w==null?void 0:w.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:be}),e.jsx(E,{size:"sm",onClick:()=>l(s.id,!0),disabled:c,"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(T,{variant:"outline",children:v}),$&&e.jsx(T,{variant:$==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:$}),o.author&&e.jsx("span",{children:o.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:f?e.jsx(we,{checked:i,onCheckedChange:P=>r(s.id,P),disabled:!y||d,"aria-label":`${i?"Disable":"Enable"} ${o.name}`}):e.jsx(T,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function G(s){const r=new Date(s);return Number.isNaN(r.getTime())?"":r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Ze(){const{data:s=[]}=ye(),{stop:r,pendingSource:d}=Se();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(K,{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:c})=>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}),G(c)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",G(c)]})]}),e.jsx(E,{type:"button",variant:"outline",size:"sm",disabled:d===l,onClick:()=>r(l),children:"Stop trusting"})]},l))})]})}function ds(){const{data:s=[],isLoading:r}=ke(),{section:d}=Ce();_e(r?null:d);const l=Ee(),c=$e(),a=Pe(),g=B(!0),o=B(!1),m=new Set([...l.variables?[l.variables]:[],...c.variables?[c.variables]:[]]),v=new Set([...g.isPending&&g.variables?[g.variables.id]:[],...o.isPending&&o.variables?[o.variables.id]:[]]);function n(i,x){const b=x?g:o,h=s.find(f=>f.id===i);if(!h)return;const y=x?X(U(h)):void 0;b.mutate({id:i,version:h.manifest.version,plugin:h.sourcePlugin??null,...y?{permissions:y}:{}},{onSuccess:f=>{x&&F.getState().forget(i);const k=f.extension.manifest.name,w=f.extension.isolation?"":" inside DorkOS";S.success(x?`${k} can now run${w}`:`${k} stopped running`)},onError:f=>{if(f instanceof Re&&f.stale){y&&F.getState().remember(i,y),S.error(`${h.manifest.name} changed since you saw it. Check it again.`);return}S.error(x?"Couldn’t let it run.":"Couldn’t stop it running.",{description:f.message})}})}async function p(i,x){(x?l:c).mutate(i,{onError:h=>{S.error(x?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:h.message})}})}function N(){a.mutate(void 0,{onSuccess:i=>{S.success(`Reloaded ${i.length} extension${i.length===1?"":"s"}`)},onError:i=>{S.error("Couldn’t reload your extensions.",{description:i.message})}})}if(r)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const t=s.filter(i=>i.origin==="core"),u=s.filter(i=>i.origin==="user"),j=i=>e.jsx(Qe,{extension:i,onToggle:p,isToggling:m.has(i.id),onSetRunApproval:n,isSettingApproval:v.has(i.id),onReload:N,isReloading:a.isPending},i.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(K,{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:[t.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:t.map(j)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(j)}):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(Ze,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(E,{variant:"outline",size:"sm",onClick:N,disabled:a.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(Te,{className:I("mr-2 size-4",a.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{ms as ExtensionEventBridge,us as ExtensionLoader,xs as ExtensionProvider,ds as ExtensionsSettingsTab,hs as createExtensionAPI,gs as createExtensionEventBridge,ps as useExtensions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,r as u,a1 as oe,a3 as re,aW as F,B as E,I as ae,en as ce,c6 as le,gs as ie,gt as de,gu as ue}from"./index-Dc5cpBoO.js";import{u as he,L as z}from"./use-local-browser-zA8gMhcC.js";const G={embedded:"DorkOS browser","new-window":"New browser window"},me={embedded:"Browse here. Saved logins stay separate from your usual browser.","new-window":"Opens on the computer running DorkOS. Saved logins stay separate."};function we({value:t,onChange:s,capabilities:r,disabled:i}){var d;const a={embedded:!!(r!=null&&r.embedded)&&!!((d=window.electronAPI)!=null&&d.localBrowser),"new-window":!!(r!=null&&r.newWindow)};return n.jsxs("fieldset",{disabled:i,className:"space-y-2",children:[n.jsx("legend",{className:"sr-only",children:"Browser"}),Object.keys(G).map(l=>{var e;return n.jsxs("label",{className:"bg-muted/40 flex items-start gap-2 rounded-lg p-3",children:[n.jsx("input",{type:"radio",name:"local-browser-mode",value:l,checked:t===l,disabled:!a[l],onChange:()=>s(l),className:"mt-1"}),n.jsxs("span",{className:"min-w-0 space-y-1",children:[n.jsx("span",{className:"block text-sm font-medium",children:G[l]}),n.jsx("span",{className:"text-muted-foreground block text-xs",children:me[l]}),!a[l]&&n.jsx("span",{className:"text-muted-foreground block text-xs",children:((e=r==null?void 0:r.unavailableReasons)==null?void 0:e[l])??(l==="embedded"?"Requires the DorkOS desktop app.":"Available on your DorkOS computer.")})]})]},l)})]})}function pe(t,s,r,i){u.useEffect(()=>{var m,L;const a=(m=window.electronAPI)==null?void 0:m.localBrowser;if(!a||!s||!r)return;let d=!1,l=!1,e="",h=0,v=!1;const q=[];for(let c=(L=t.current)==null?void 0:L.parentElement;c;c=c.parentElement){const w=getComputedStyle(c);/(hidden|clip|auto|scroll)/.test(`${w.overflowX} ${w.overflowY}`)&&q.push(c)}const j=()=>{v=[...document.querySelectorAll('[role="dialog"][aria-modal="true"], [role="alertdialog"], [role="menu"], [data-radix-popper-content-wrapper]')].some(c=>!c.contains(t.current)&&c.getClientRects().length>0&&!c.hidden),R()},R=()=>{var T;if(d||l)return;const c=(T=t.current)==null?void 0:T.getBoundingClientRect();let w=(c==null?void 0:c.x)??0,p=(c==null?void 0:c.y)??0,A=w+((c==null?void 0:c.width)??0),x=p+((c==null?void 0:c.height)??0);for(const _ of q){const b=_.getBoundingClientRect();w=Math.max(w,b.x),p=Math.max(p,b.y),A=Math.min(A,b.x+b.width),x=Math.min(x,b.y+b.height)}const I=Math.max(0,A-w),g=Math.max(0,x-p),k=!!c&&!v&&document.visibilityState!=="hidden"&&I>0&&g>0,D={connectionId:s,x:w,y:p,width:I,height:g,visible:k},B=JSON.stringify(D);B!==e&&(e=B,a.setBounds(D).catch(()=>{d||(l=!0,i())}))},O=()=>{R(),!d&&!l&&(h=requestAnimationFrame(O))},C=new MutationObserver(j);return C.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-state","hidden","aria-modal","style","class"]}),j(),O(),()=>{d=!0,C.disconnect(),cancelAnimationFrame(h),a.setBounds({connectionId:s,x:0,y:0,width:0,height:0,visible:!1}).catch(()=>{})}},[t,s,r,i])}const ee={stale_page:"Page changed. Read it again before continuing.",navigation_uncertain:"Check what happened before continuing.",uncertain:"Check what happened before continuing.",paused:"Agent paused. Resume when ready.",busy:"Browser is busy. Wait a moment.",browser_download:"Couldn’t download the browser. Check your connection and try again.",cancelled:"Browser setup stopped. Open it again to continue.",focus_unavailable:"This tab stopped responding. Choose it again."},fe=["Free some space, then open the browser again.","Check folder permissions, then open the browser again."];function ge(t){const s=t;return(s==null?void 0:s.code)==="busy"&&s.message==="The browser is still closing. Wait before opening it again."?"The browser is still closing. Wait, then try again.":(s==null?void 0:s.code)==="busy"&&s.message==="Restart DorkOS to finish closing this browser."?"Restart DorkOS to finish closing this browser.":(s==null?void 0:s.code)==="browser_storage"?fe.find(i=>i===s.message)??"Couldn’t save the browser. Check free space and folder permissions.":(s!=null&&s.code&&Object.hasOwn(ee,s.code)?ee[s.code]:void 0)??"Couldn’t reach the browser. Reconnect and try again."}function xe(t){const s=u.useRef(null),r=u.useRef(null),i=a=>{r.current=document.activeElement===a?{action:a,interrupted:!1}:null};return u.useEffect(()=>{const a=l=>{const e=r.current;e&&l.target!==e.action&&!(l.type==="focusin"&&l.target===document.body)&&(e.interrupted=!0)},d=()=>{r.current&&(r.current.interrupted=!0)};return document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",a,!0),document.addEventListener("focusin",a,!0),window.addEventListener("blur",d),()=>{r.current=null,document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",a,!0),document.removeEventListener("focusin",a,!0),window.removeEventListener("blur",d)}},[]),u.useEffect(()=>{if(t||!r.current)return;const a=r.current;if(r.current=null,!a.interrupted&&document.activeElement===document.body&&document.hasFocus()){const d=s.current;d&&!d.disabled&&d.focus()}},[t]),{openButton:s,rememberFocus:i}}function be({preparation:t}){const s=t.stage==="checking"?"Checking browser files…":t.stage==="launching"?"Opening the browser…":t.component==="chromium"?"Downloading the browser…":t.component==="headless-shell"?"Downloading browser support…":t.component==="ffmpeg"?"Downloading video support…":"Downloading browser files…",r=t.component==="chromium"?"Browser download":t.component==="headless-shell"?"Browser support download":"Video support download",i=t.stage==="downloading"&&t.component&&t.percent!==null&&Number.isFinite(t.percent)&&t.percent>=0&&t.percent<=100?t.percent:null;return n.jsxs("div",{className:"space-y-1 text-xs","aria-live":"polite",children:[n.jsx("p",{children:s}),i!==null&&n.jsxs(n.Fragment,{children:[n.jsx("progress",{"aria-label":r,max:100,value:i,className:"w-full"}),n.jsxs("p",{children:[i,"%"]})]})]})}function ye({visible:t=!0,sessionId:s=null,agentName:r=null}){var J,X,Z;const i=oe(),a=re(),{state:d,capabilities:l}=he(),e=d.data,h=l.data,v=(J=d.error??l.error)==null?void 0:J.code,q=v==="local_only"?"Open DorkOS on your computer to use its browser.":v==="owner_only"?"Only this DorkOS owner can choose its browser.":"Couldn’t reach the browser. Reconnect and try again.",j=F(o=>o.localBrowserChoice),R=F(o=>o.localBrowserChoiceIssue),O=F(o=>o.setLocalBrowserChoice),C=!j&&R!==null,[m,L]=u.useState(!1),[c,w]=u.useState(!1),[p,A]=u.useState(null),[x,I]=u.useState(!1),g=u.useRef(0),k=u.useRef(null),[D,B]=u.useState(null),[T,_]=u.useState(null),[b,K]=u.useState(!1),U=u.useRef(null),S=(e==null?void 0:e.status)==="connected",W=!!(e!=null&&e.sessionId)&&e.sessionId!==s,f=S&&e.mode?e.mode:(j==null?void 0:j.mode)??(h!=null&&h.embedded&&((X=window.electronAPI)!=null&&X.localBrowser)?"embedded":"new-window"),Q=e==null?void 0:e.tabs.find(o=>o.id===e.selectedTabId),ne=u.useCallback(()=>K(!0),[]);u.useEffect(()=>()=>{g.current+=1},[]),pe(U,(e==null?void 0:e.connectionId)??null,t&&S&&!d.isError&&!W&&f==="embedded"&&!b,ne);const N=async(o,P=!1)=>{const y=++g.current;L(!0),w(P),B(null);try{if(P&&(await a.cancelQueries({queryKey:z}),y!==g.current))return!1;const M=await o();return y!==g.current||(await a.cancelQueries({queryKey:z}),y!==g.current)?!1:(a.setQueryData(z,M),!0)}catch(M){return y!==g.current||B(ge(M)),!1}finally{y===g.current&&(L(!1),w(!1))}},Y=()=>{O({mode:f}),A({sessionId:s,mode:f,previousConnectionId:(e==null?void 0:e.connectionId)??null,startedAt:Date.now()}),K(!1);const o=N(()=>i.openLocalBrowser({mode:f,...s?{sessionId:s}:{}}),!0);k.current=o,o.finally(()=>{k.current===o&&(k.current=null)})},se=async()=>{const o=k.current;I(!0);try{await N(()=>i.disconnectLocalBrowser())&&await a.invalidateQueries({queryKey:z}),await o}finally{I(!1)}},$=h&&(f==="embedded"?h.embedded&&!!((Z=window.electronAPI)!=null&&Z.localBrowser):h.newWindow),{openButton:te,rememberFocus:V}=xe(m||x||S||C||!$),H=c&&!x&&p&&(e!=null&&e.preparation)&&e.status==="disconnected"&&e.sessionId===p.sessionId&&e.mode===p.mode&&e.connectionId&&e.connectionId!==p.previousConnectionId&&d.dataUpdatedAt>=p.startedAt?e.preparation:null;return n.jsxs("section",{"aria-label":"Local browser","data-slot":"local-browser-panel",className:"flex h-full min-h-0 flex-col gap-3 p-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:S?G[f]:"Browser"}),n.jsx("span",{role:"status",className:"text-muted-foreground text-xs",children:x?"Cancelling…":c?"Preparing browser":m?"Updating…":(e==null?void 0:e.status)==="closed"?"Browser closed":S?e.paused?"Agent paused":"Connected":"Disconnected"})]}),c&&n.jsx(E,{size:"sm",variant:"outline",onClick:o=>{V(o.currentTarget),se()},children:"Cancel"}),H&&n.jsx(be,{preparation:H}),(D||d.isError||l.isError)&&n.jsx("p",{role:"alert",className:"text-sm",children:D??q}),(d.isError||l.isError)&&v!=="local_only"&&v!=="owner_only"&&n.jsx(E,{size:"sm",variant:"outline",onClick:()=>{d.refetch(),l.refetch()},children:"Reconnect"}),!S&&n.jsxs("div",{className:"min-h-0 space-y-3 overflow-y-auto",children:[R&&n.jsx("p",{className:"text-muted-foreground text-xs",children:C?"Choose a browser. The saved choice couldn’t be read.":"Browser choice couldn’t be saved. It lasts until this window closes."}),n.jsx(we,{value:C?null:f,onChange:o=>{O({mode:o})},capabilities:h,disabled:m||x}),(e==null?void 0:e.status)==="closed"&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Open it again to reconnect. Saved logins are kept."}),n.jsx(E,{ref:te,disabled:m||x||C||!$,onClick:Y,children:e!=null&&e.mode?"Reconnect":"Open browser"})]}),S&&n.jsxs(n.Fragment,{children:[W&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Shared with another chat. Disconnect to use it here."}),!e.sessionId&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Only you can use this page. Open from an agent chat to share it."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(E,{size:"sm",variant:"outline",disabled:m,onClick:()=>void N(()=>e.paused?i.resumeLocalBrowser():i.pauseLocalBrowser()),children:e.paused?"Resume agent":"Pause agent"}),n.jsx(E,{size:"sm",variant:"ghost",disabled:m,onClick:o=>{V(o.currentTarget),N(()=>i.disconnectLocalBrowser())},children:"Disconnect"})]}),n.jsxs("label",{className:"text-sm",children:[e.sessionId?W?"Shared with another chat":`Shared with ${r||"this chat’s agent"}`:"Browser tab",n.jsxs("select",{className:"bg-muted/40 mt-1 block w-full rounded-md p-2",value:e.selectedTabId??"",disabled:m,onChange:o=>{_(null),N(()=>i.selectLocalBrowserTab(o.target.value))},children:[!e.selectedTabId&&n.jsx("option",{value:"",children:"Choose a tab"}),e.tabs.map(o=>n.jsx("option",{value:o.id,children:o.title||(o.url==="about:blank"?"New tab":o.url)},o.id))]})]}),Q&&n.jsxs("form",{className:"flex gap-2",onSubmit:o=>{o.preventDefault();const P=T??Q.url;try{const y=new URL(P);if(!["http:","https:"].includes(y.protocol))throw new Error("unsupported");N(()=>i.navigateLocalBrowser(y.href)).then(M=>{M&&_(null)})}catch{B("Enter a full web address, starting with https:// or http://.")}},children:[n.jsx(ae,{"aria-label":"Web address",value:T??Q.url,onChange:o=>_(o.target.value),className:"min-w-0"}),n.jsx(E,{size:"sm",variant:"outline",type:"submit",disabled:m,children:"Go"})]}),e.paused&&n.jsxs("div",{className:"text-muted-foreground space-y-1 text-xs",children:[n.jsx("p",{children:"Pause stops new actions. An action already started may finish."}),n.jsx("p",{children:"Your mouse and keyboard still work."})]}),f!=="embedded"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"This page is in the separate browser window."}),f==="embedded"&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This page stays in the right panel."}),f==="embedded"&&!W&&n.jsx("p",{className:"text-muted-foreground text-xs",children:e.sessionId?"Extra windows are for you. Your agent stays on this page.":"Extra windows are for you."}),f==="embedded"&&n.jsx("div",{ref:U,"data-slot":"native-browser-surface",className:"bg-muted/20 relative min-h-48 flex-1 rounded-lg",children:b&&n.jsxs("div",{className:"space-y-2 p-3",children:[n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t show the page. Reconnect to try again."}),n.jsx(E,{size:"sm",variant:"outline",onClick:Y,disabled:m,children:"Reconnect"})]})})]})]})}function Ce(){const t=ce({select:h=>h.location.pathname}),[s]=le(),r=t==="/session"?s:null,{data:i}=ie(r,{enabled:!!r,nameOnly:!0}),{data:a}=de((i==null?void 0:i.cwd)??null),d=u.useContext(ue),l=F(h=>h.rightPanelOpen),e=F(h=>h.activeRightPanelTab);return n.jsx(ye,{visible:d&&l&&e==="local-browser",sessionId:t==="/session"?s:null,agentName:t==="/session"?a==null?void 0:a.name:null},t==="/session"?`chat:${s??""}`:"human-only")}export{Ce as LocalBrowserContent,ye as LocalBrowserPanel};
|
|
1
|
+
import{j as n,r as u,a1 as oe,a3 as re,aW as F,B as E,I as ae,eo as ce,c6 as le,gt as ie,gu as de,gv as ue}from"./index-DBdO-_iL.js";import{u as he,L as z}from"./use-local-browser-CbS4typW.js";const G={embedded:"DorkOS browser","new-window":"New browser window"},me={embedded:"Browse here. Saved logins stay separate from your usual browser.","new-window":"Opens on the computer running DorkOS. Saved logins stay separate."};function we({value:t,onChange:s,capabilities:r,disabled:i}){var d;const a={embedded:!!(r!=null&&r.embedded)&&!!((d=window.electronAPI)!=null&&d.localBrowser),"new-window":!!(r!=null&&r.newWindow)};return n.jsxs("fieldset",{disabled:i,className:"space-y-2",children:[n.jsx("legend",{className:"sr-only",children:"Browser"}),Object.keys(G).map(l=>{var e;return n.jsxs("label",{className:"bg-muted/40 flex items-start gap-2 rounded-lg p-3",children:[n.jsx("input",{type:"radio",name:"local-browser-mode",value:l,checked:t===l,disabled:!a[l],onChange:()=>s(l),className:"mt-1"}),n.jsxs("span",{className:"min-w-0 space-y-1",children:[n.jsx("span",{className:"block text-sm font-medium",children:G[l]}),n.jsx("span",{className:"text-muted-foreground block text-xs",children:me[l]}),!a[l]&&n.jsx("span",{className:"text-muted-foreground block text-xs",children:((e=r==null?void 0:r.unavailableReasons)==null?void 0:e[l])??(l==="embedded"?"Requires the DorkOS desktop app.":"Available on your DorkOS computer.")})]})]},l)})]})}function pe(t,s,r,i){u.useEffect(()=>{var m,L;const a=(m=window.electronAPI)==null?void 0:m.localBrowser;if(!a||!s||!r)return;let d=!1,l=!1,e="",h=0,v=!1;const q=[];for(let c=(L=t.current)==null?void 0:L.parentElement;c;c=c.parentElement){const w=getComputedStyle(c);/(hidden|clip|auto|scroll)/.test(`${w.overflowX} ${w.overflowY}`)&&q.push(c)}const j=()=>{v=[...document.querySelectorAll('[role="dialog"][aria-modal="true"], [role="alertdialog"], [role="menu"], [data-radix-popper-content-wrapper]')].some(c=>!c.contains(t.current)&&c.getClientRects().length>0&&!c.hidden),R()},R=()=>{var T;if(d||l)return;const c=(T=t.current)==null?void 0:T.getBoundingClientRect();let w=(c==null?void 0:c.x)??0,p=(c==null?void 0:c.y)??0,A=w+((c==null?void 0:c.width)??0),x=p+((c==null?void 0:c.height)??0);for(const _ of q){const b=_.getBoundingClientRect();w=Math.max(w,b.x),p=Math.max(p,b.y),A=Math.min(A,b.x+b.width),x=Math.min(x,b.y+b.height)}const I=Math.max(0,A-w),g=Math.max(0,x-p),k=!!c&&!v&&document.visibilityState!=="hidden"&&I>0&&g>0,D={connectionId:s,x:w,y:p,width:I,height:g,visible:k},B=JSON.stringify(D);B!==e&&(e=B,a.setBounds(D).catch(()=>{d||(l=!0,i())}))},O=()=>{R(),!d&&!l&&(h=requestAnimationFrame(O))},C=new MutationObserver(j);return C.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-state","hidden","aria-modal","style","class"]}),j(),O(),()=>{d=!0,C.disconnect(),cancelAnimationFrame(h),a.setBounds({connectionId:s,x:0,y:0,width:0,height:0,visible:!1}).catch(()=>{})}},[t,s,r,i])}const ee={stale_page:"Page changed. Read it again before continuing.",navigation_uncertain:"Check what happened before continuing.",uncertain:"Check what happened before continuing.",paused:"Agent paused. Resume when ready.",busy:"Browser is busy. Wait a moment.",browser_download:"Couldn’t download the browser. Check your connection and try again.",cancelled:"Browser setup stopped. Open it again to continue.",focus_unavailable:"This tab stopped responding. Choose it again."},fe=["Free some space, then open the browser again.","Check folder permissions, then open the browser again."];function ge(t){const s=t;return(s==null?void 0:s.code)==="busy"&&s.message==="The browser is still closing. Wait before opening it again."?"The browser is still closing. Wait, then try again.":(s==null?void 0:s.code)==="busy"&&s.message==="Restart DorkOS to finish closing this browser."?"Restart DorkOS to finish closing this browser.":(s==null?void 0:s.code)==="browser_storage"?fe.find(i=>i===s.message)??"Couldn’t save the browser. Check free space and folder permissions.":(s!=null&&s.code&&Object.hasOwn(ee,s.code)?ee[s.code]:void 0)??"Couldn’t reach the browser. Reconnect and try again."}function xe(t){const s=u.useRef(null),r=u.useRef(null),i=a=>{r.current=document.activeElement===a?{action:a,interrupted:!1}:null};return u.useEffect(()=>{const a=l=>{const e=r.current;e&&l.target!==e.action&&!(l.type==="focusin"&&l.target===document.body)&&(e.interrupted=!0)},d=()=>{r.current&&(r.current.interrupted=!0)};return document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",a,!0),document.addEventListener("focusin",a,!0),window.addEventListener("blur",d),()=>{r.current=null,document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",a,!0),document.removeEventListener("focusin",a,!0),window.removeEventListener("blur",d)}},[]),u.useEffect(()=>{if(t||!r.current)return;const a=r.current;if(r.current=null,!a.interrupted&&document.activeElement===document.body&&document.hasFocus()){const d=s.current;d&&!d.disabled&&d.focus()}},[t]),{openButton:s,rememberFocus:i}}function be({preparation:t}){const s=t.stage==="checking"?"Checking browser files…":t.stage==="launching"?"Opening the browser…":t.component==="chromium"?"Downloading the browser…":t.component==="headless-shell"?"Downloading browser support…":t.component==="ffmpeg"?"Downloading video support…":"Downloading browser files…",r=t.component==="chromium"?"Browser download":t.component==="headless-shell"?"Browser support download":"Video support download",i=t.stage==="downloading"&&t.component&&t.percent!==null&&Number.isFinite(t.percent)&&t.percent>=0&&t.percent<=100?t.percent:null;return n.jsxs("div",{className:"space-y-1 text-xs","aria-live":"polite",children:[n.jsx("p",{children:s}),i!==null&&n.jsxs(n.Fragment,{children:[n.jsx("progress",{"aria-label":r,max:100,value:i,className:"w-full"}),n.jsxs("p",{children:[i,"%"]})]})]})}function ye({visible:t=!0,sessionId:s=null,agentName:r=null}){var J,X,Z;const i=oe(),a=re(),{state:d,capabilities:l}=he(),e=d.data,h=l.data,v=(J=d.error??l.error)==null?void 0:J.code,q=v==="local_only"?"Open DorkOS on your computer to use its browser.":v==="owner_only"?"Only this DorkOS owner can choose its browser.":"Couldn’t reach the browser. Reconnect and try again.",j=F(o=>o.localBrowserChoice),R=F(o=>o.localBrowserChoiceIssue),O=F(o=>o.setLocalBrowserChoice),C=!j&&R!==null,[m,L]=u.useState(!1),[c,w]=u.useState(!1),[p,A]=u.useState(null),[x,I]=u.useState(!1),g=u.useRef(0),k=u.useRef(null),[D,B]=u.useState(null),[T,_]=u.useState(null),[b,K]=u.useState(!1),U=u.useRef(null),S=(e==null?void 0:e.status)==="connected",W=!!(e!=null&&e.sessionId)&&e.sessionId!==s,f=S&&e.mode?e.mode:(j==null?void 0:j.mode)??(h!=null&&h.embedded&&((X=window.electronAPI)!=null&&X.localBrowser)?"embedded":"new-window"),Q=e==null?void 0:e.tabs.find(o=>o.id===e.selectedTabId),ne=u.useCallback(()=>K(!0),[]);u.useEffect(()=>()=>{g.current+=1},[]),pe(U,(e==null?void 0:e.connectionId)??null,t&&S&&!d.isError&&!W&&f==="embedded"&&!b,ne);const N=async(o,P=!1)=>{const y=++g.current;L(!0),w(P),B(null);try{if(P&&(await a.cancelQueries({queryKey:z}),y!==g.current))return!1;const M=await o();return y!==g.current||(await a.cancelQueries({queryKey:z}),y!==g.current)?!1:(a.setQueryData(z,M),!0)}catch(M){return y!==g.current||B(ge(M)),!1}finally{y===g.current&&(L(!1),w(!1))}},Y=()=>{O({mode:f}),A({sessionId:s,mode:f,previousConnectionId:(e==null?void 0:e.connectionId)??null,startedAt:Date.now()}),K(!1);const o=N(()=>i.openLocalBrowser({mode:f,...s?{sessionId:s}:{}}),!0);k.current=o,o.finally(()=>{k.current===o&&(k.current=null)})},se=async()=>{const o=k.current;I(!0);try{await N(()=>i.disconnectLocalBrowser())&&await a.invalidateQueries({queryKey:z}),await o}finally{I(!1)}},$=h&&(f==="embedded"?h.embedded&&!!((Z=window.electronAPI)!=null&&Z.localBrowser):h.newWindow),{openButton:te,rememberFocus:V}=xe(m||x||S||C||!$),H=c&&!x&&p&&(e!=null&&e.preparation)&&e.status==="disconnected"&&e.sessionId===p.sessionId&&e.mode===p.mode&&e.connectionId&&e.connectionId!==p.previousConnectionId&&d.dataUpdatedAt>=p.startedAt?e.preparation:null;return n.jsxs("section",{"aria-label":"Local browser","data-slot":"local-browser-panel",className:"flex h-full min-h-0 flex-col gap-3 p-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:S?G[f]:"Browser"}),n.jsx("span",{role:"status",className:"text-muted-foreground text-xs",children:x?"Cancelling…":c?"Preparing browser":m?"Updating…":(e==null?void 0:e.status)==="closed"?"Browser closed":S?e.paused?"Agent paused":"Connected":"Disconnected"})]}),c&&n.jsx(E,{size:"sm",variant:"outline",onClick:o=>{V(o.currentTarget),se()},children:"Cancel"}),H&&n.jsx(be,{preparation:H}),(D||d.isError||l.isError)&&n.jsx("p",{role:"alert",className:"text-sm",children:D??q}),(d.isError||l.isError)&&v!=="local_only"&&v!=="owner_only"&&n.jsx(E,{size:"sm",variant:"outline",onClick:()=>{d.refetch(),l.refetch()},children:"Reconnect"}),!S&&n.jsxs("div",{className:"min-h-0 space-y-3 overflow-y-auto",children:[R&&n.jsx("p",{className:"text-muted-foreground text-xs",children:C?"Choose a browser. The saved choice couldn’t be read.":"Browser choice couldn’t be saved. It lasts until this window closes."}),n.jsx(we,{value:C?null:f,onChange:o=>{O({mode:o})},capabilities:h,disabled:m||x}),(e==null?void 0:e.status)==="closed"&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Open it again to reconnect. Saved logins are kept."}),n.jsx(E,{ref:te,disabled:m||x||C||!$,onClick:Y,children:e!=null&&e.mode?"Reconnect":"Open browser"})]}),S&&n.jsxs(n.Fragment,{children:[W&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Shared with another chat. Disconnect to use it here."}),!e.sessionId&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"Only you can use this page. Open from an agent chat to share it."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(E,{size:"sm",variant:"outline",disabled:m,onClick:()=>void N(()=>e.paused?i.resumeLocalBrowser():i.pauseLocalBrowser()),children:e.paused?"Resume agent":"Pause agent"}),n.jsx(E,{size:"sm",variant:"ghost",disabled:m,onClick:o=>{V(o.currentTarget),N(()=>i.disconnectLocalBrowser())},children:"Disconnect"})]}),n.jsxs("label",{className:"text-sm",children:[e.sessionId?W?"Shared with another chat":`Shared with ${r||"this chat’s agent"}`:"Browser tab",n.jsxs("select",{className:"bg-muted/40 mt-1 block w-full rounded-md p-2",value:e.selectedTabId??"",disabled:m,onChange:o=>{_(null),N(()=>i.selectLocalBrowserTab(o.target.value))},children:[!e.selectedTabId&&n.jsx("option",{value:"",children:"Choose a tab"}),e.tabs.map(o=>n.jsx("option",{value:o.id,children:o.title||(o.url==="about:blank"?"New tab":o.url)},o.id))]})]}),Q&&n.jsxs("form",{className:"flex gap-2",onSubmit:o=>{o.preventDefault();const P=T??Q.url;try{const y=new URL(P);if(!["http:","https:"].includes(y.protocol))throw new Error("unsupported");N(()=>i.navigateLocalBrowser(y.href)).then(M=>{M&&_(null)})}catch{B("Enter a full web address, starting with https:// or http://.")}},children:[n.jsx(ae,{"aria-label":"Web address",value:T??Q.url,onChange:o=>_(o.target.value),className:"min-w-0"}),n.jsx(E,{size:"sm",variant:"outline",type:"submit",disabled:m,children:"Go"})]}),e.paused&&n.jsxs("div",{className:"text-muted-foreground space-y-1 text-xs",children:[n.jsx("p",{children:"Pause stops new actions. An action already started may finish."}),n.jsx("p",{children:"Your mouse and keyboard still work."})]}),f!=="embedded"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"This page is in the separate browser window."}),f==="embedded"&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This page stays in the right panel."}),f==="embedded"&&!W&&n.jsx("p",{className:"text-muted-foreground text-xs",children:e.sessionId?"Extra windows are for you. Your agent stays on this page.":"Extra windows are for you."}),f==="embedded"&&n.jsx("div",{ref:U,"data-slot":"native-browser-surface",className:"bg-muted/20 relative min-h-48 flex-1 rounded-lg",children:b&&n.jsxs("div",{className:"space-y-2 p-3",children:[n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t show the page. Reconnect to try again."}),n.jsx(E,{size:"sm",variant:"outline",onClick:Y,disabled:m,children:"Reconnect"})]})})]})]})}function Ce(){const t=ce({select:h=>h.location.pathname}),[s]=le(),r=t==="/session"?s:null,{data:i}=ie(r,{enabled:!!r,nameOnly:!0}),{data:a}=de((i==null?void 0:i.cwd)??null),d=u.useContext(ue),l=F(h=>h.rightPanelOpen),e=F(h=>h.activeRightPanelTab);return n.jsx(ye,{visible:d&&l&&e==="local-browser",sessionId:t==="/session"?s:null,agentName:t==="/session"?a==null?void 0:a.name:null},t==="/session"?`chat:${s??""}`:"human-only")}export{Ce as LocalBrowserContent,ye as LocalBrowserPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a1 as wo,r as q,
|
|
1
|
+
import{a1 as wo,r as q,h1 as Ka,j as ne,G as $s,h2 as bo,X as qa,f as Va,aW as Ur,h3 as Ya,gv as Ga,h4 as hs,B as ja}from"./index-DBdO-_iL.js";import{u as Xa}from"./use-roving-tab-list-B4nZ7trj.js";const Za="dork.terminal.tabs",Fi=new Map;function Ja(t,e,i){const s=ts(t,e),r=Fi.get(s)??new Set;return r.add(i),Fi.set(s,r),()=>{r.delete(i),r.size||Fi.delete(s)}}function Qa(t,e,i){const s=Er(t,e);s.ids.includes(i.id)||yo(t,e,{ids:[...s.ids,i.id],activeIndex:s.activeIndex,closedIds:[...s.closedIds??[],...i.closed?[i.id]:[]]});for(const r of Fi.get(ts(t,e))??[])r(i)}const ls={ids:[],activeIndex:0};function ts(t,e){return`${Za}:${t??""}:${e}`}function Co(t,e){return e<=0||!Number.isInteger(t)||t<0?0:Math.min(t,e-1)}function Er(t,e){try{const i=sessionStorage.getItem(ts(t,e));if(!i)return ls;const s=JSON.parse(i);if(typeof s!="object"||s===null)return ls;const{ids:r,activeIndex:n,closedIds:o}=s,a=Array.isArray(r)?r.filter(c=>typeof c=="string"&&c.length>0):[],l=typeof n=="number"?n:0,h=Array.isArray(o)?a.filter(c=>o.includes(c)):[];return{ids:a,activeIndex:Co(l,a.length),...h.length?{closedIds:h}:{}}}catch{return ls}}function yo(t,e,i){try{const s={ids:i.ids,activeIndex:Co(i.activeIndex,i.ids.length)},r=i.ids.filter(n=>{var o;return(o=i.closedIds)==null?void 0:o.includes(n)});r.length&&(s.closedIds=r),sessionStorage.setItem(ts(t,e),JSON.stringify(s))}catch{}}/**
|
|
2
2
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
3
3
|
* @license MIT
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as L,N as $,g as E,D as j,h as y,T as S,I as G}from"./index-BUOcbPfv.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};
|
|
1
|
+
import{P as L,N as $,g as E,D as j,h as y,T as S,I as G}from"./index-CocSe_I3.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};
|