dorkos 0.124.1 → 0.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1406 -954
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DHaZvsJE.js → AboutPage-GdrU2Z3k.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-BP-qFk2S.js → ActivityErrorState-D1T74VJE.js} +1 -1
- package/dist/client/assets/{ActivityPage-Bme3TzdQ.js → ActivityPage-7GXGUwd1.js} +1 -1
- package/dist/client/assets/{ActivityRow-BRZyW9MA.js → ActivityRow-C-8dACWp.js} +1 -1
- package/dist/client/assets/{AdapterIcon-BcfquTja.js → AdapterIcon-CRRs6yil.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-B4I23pBg.js → AdapterSetupWizard-K6DsejqG.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-Cb34LtmH.js → AgentOptionRow-CF5XZmBx.js} +1 -1
- package/dist/client/assets/{AgentPicker-ouNRFSDh.js → AgentPicker-BXes2ymU.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-B6MHIsxa.js → AgentRequestCard-BuXVpWfb.js} +4 -4
- package/dist/client/assets/{AppearancePage-CutehigK.js → AppearancePage-DoqoCU4j.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-B-wIUI27.js → ApplyToOverridesDialog-By8jgPX3.js} +1 -1
- package/dist/client/assets/AttentionSignalRow-CgGyTDmT.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CdWF4WLz.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BzDxZ-G5.js} +3 -3
- package/dist/client/assets/{BindingDialog-BAdueON5.js → BindingDialog-BXfjFGvP.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-b30dG4gx.js → BlintzCanvas-C-dobEns.js} +4 -4
- package/dist/client/assets/{CanvasCsvContent-DGHgSikG.js → CanvasCsvContent-ClMFJX7T.js} +4 -4
- package/dist/client/assets/CanvasFileContent-BoDE2jjA.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-fnWc0B7B.js +2 -0
- package/dist/client/assets/ChannelComposer-DIRPjyyf.js +44 -0
- package/dist/client/assets/{ChatAppsOff-DiObvmJS.js → ChatAppsOff-DlCWmwEz.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-BncI1OY1.js → CodeMirrorDiff-COsbYyNC.js} +2 -2
- package/dist/client/assets/{CodeMirrorEditor-DV6psv19.js → CodeMirrorEditor-n3l14rY7.js} +1 -1
- package/dist/client/assets/{CommitmentList-Dx_Ek_Gl.js → CommitmentList-S2O_hvwR.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-Bca8NMUa.js → CommitmentsPage-COOCQFpL.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-DNVNFTdn.js → ComputerResourceView-PA9T4FZP.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D8SxJdMm.js → ComputerViewer-CnYUWQBS.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-Bhj1YT15.js → ConnectionAccessLists-C1ZJtNl-.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-B20JZxoK.js → ConnectionsPage-BBpWiN4-.js} +2 -2
- package/dist/client/assets/{ConventionPage-De645wxU.js → ConventionPage-sa0Yn2uq.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-nTeiOBRQ.js → ExtensionPageRoute-BztrmZNp.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DM79UITv.js → FloatingTanStackRouterDevtools-CqogiFob-CJrqr29-.js} +1 -1
- package/dist/client/assets/HandlePage-tZidnrlt.js +1 -0
- package/dist/client/assets/{HeartbeatPage-CBoUxz6t.js → HeartbeatPage-BkyUpdZt.js} +1 -1
- package/dist/client/assets/{KeyEntry-Cug8ocpX.js → KeyEntry-DAMr1NNY.js} +1 -1
- package/dist/client/assets/{LexicalField-Bv_ogmAq.js → LexicalField-Cnzrh08A.js} +2 -2
- package/dist/client/assets/{ManagesPage-DfJBQKK3.js → ManagesPage-EAbQtygH.js} +1 -1
- package/dist/client/assets/{Marketplace-swCVUbdY.js → Marketplace-BfADALGd.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-CDZDChpV.js → MarketplaceSourcesView-u1WKUk-p.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BM9cNPPd.js → McpAppFrame-Cz-Ttlqr.js} +1 -1
- package/dist/client/assets/{McpSigninBody-DKyUKrEE.js → McpSigninBody-CkOBUhOz.js} +1 -1
- package/dist/client/assets/{Model3dViewer-rXSL5y2P.js → Model3dViewer-CvLaSO7V.js} +1 -1
- package/dist/client/assets/NamePage-BS-oN_Hi.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-GCEMS5oV.js → NewDirectMessageMenu-Be_4mBPd.js} +1 -1
- package/dist/client/assets/{NotificationsPage-DSWsOVLa.js → NotificationsPage-GCk9gfsW.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BTuctDj4.js → OpenMeshSwitch-BBzgYSUc.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-ODDMd2YN.js → OperatorIdentityForm-ZAbJ4FJn.js} +1 -1
- package/dist/client/assets/{PermissionHistory-41a58Se7.js → PermissionHistory-DgmFpdJK.js} +1 -1
- package/dist/client/assets/{PermissionsPage-DefmymZ6.js → PermissionsPage-DHFt_34a.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-7zPVBI1I.js → PersonalityPopover-CobRy95S.js} +1 -1
- package/dist/client/assets/PhotoPage-BmFypD13.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CwGlBJ7U.js → PreviewRefusedNotice-Ux5sq2Om.js} +1 -1
- package/dist/client/assets/ProfileFields-kBzeRPfc.js +1 -0
- package/dist/client/assets/{ProfilePanelContainer-RrhoPD3T.js → ProfilePanelContainer-CREt4ZC3.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-CXRVBCAu.js → ProfileRolePicker-hQbo8P6M.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-bBroJdTi.js → PromptSuggestionChips-CmW1lIso.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-CfPatsWM.js → ReportsToPopover-Dpa-_NsO.js} +1 -1
- package/dist/client/assets/RoomSurface-BQhgKnIE.js +1 -0
- package/dist/client/assets/{RoomsPage-C3dDp1Mb.js → RoomsPage-BHUDRYzJ.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-BcKjfQi-.js → RunsOnPopover-bGZ6VJoF.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-DN2ElvcH.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-Bg-0b-LC.js → RuntimeSetupDialog-CUFie4LV.js} +1 -1
- package/dist/client/assets/SeenDevices-D_FnsL7V.js +19 -0
- package/dist/client/assets/{SessionsPage-Cqfx4FGW.js → SessionsPage-1uOPUCP9.js} +1 -1
- package/dist/client/assets/SettingsDialog-AbwEHDG8.js +12 -0
- package/dist/client/assets/{SkillsPage-BleHQavF.js → SkillsPage-BEobBuAr.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-BAFSmT-z.js +1 -0
- package/dist/client/assets/{TasksEmptyState-Bprx1k8M.js → TasksEmptyState-BFw2ODM-.js} +2 -2
- package/dist/client/assets/{TasksPage-Dub39yEJ.js → TasksPage-C0CMgSFx.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CJ-NG0u5.js → TeamComputerEntry-BpjxLA1n.js} +1 -1
- package/dist/client/assets/{ToolsPage-IsD6M-ZW.js → ToolsPage-dx-rQ2F1.js} +2 -2
- package/dist/client/assets/TopologyGraph-LpxkBhGK.js +30 -0
- package/dist/client/assets/{TourHost-BYfztuPb.js → TourHost--UYZoKlJ.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BKhgxVdF.js → UnlinkDialog-BN2odbqD.js} +1 -1
- package/dist/client/assets/UnreadDivider-LbVIAoxM.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-1NyzIJBj.js → WidgetErrorCard-CAUx4KUI.js} +3 -3
- package/dist/client/assets/WorkView-DVx4WoVI.js +63 -0
- package/dist/client/assets/_shell-D7Jp6t6_.js +80 -0
- package/dist/client/assets/{_shell._home-xWj7wO5z.js → _shell._home-uuqgFA3M.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BqcLoaB1.js → _shell._home.activity-CiMsy7bF.js} +1 -1
- package/dist/client/assets/_shell._home.index-0Zm5q3-G.js +3 -0
- package/dist/client/assets/{_shell._home.tasks--UhQB6h3.js → _shell._home.tasks-BClPai4g.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BPFD8Of2.js → _shell._home.workspaces-DH4BgLT0.js} +1 -1
- package/dist/client/assets/{_shell.channels-CnFdvRzc.js → _shell.channels-BGXkXPhY.js} +4 -4
- package/dist/client/assets/{_shell.connections-Ik01wS5M.js → _shell.connections-BwjXkgi1.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-Czu42kzo.js → _shell.feedback-requests-j7gTBF5b.js} +1 -1
- package/dist/client/assets/_shell.marketplace-6JRXJ9gt.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DriHXfBM.js +1 -0
- package/dist/client/assets/_shell.session-BXSWGdwi.js +1 -0
- package/dist/client/assets/{_shell.team-UfaJqohh.js → _shell.team-BgJu1gDa.js} +5 -5
- package/dist/client/assets/_shell.threads-C1IJJzcf.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-BNgicBXG.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-BNgicBXG.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-oxkfGyl6.js → abnfDiagram-WEYOIA3C-BuEHMh0D.js} +1 -1
- package/dist/client/assets/{access-copy-Dggxx2cX.js → access-copy-BZNjpw9v.js} +1 -1
- package/dist/client/assets/{arc-CqQdP0Qe.js → arc-BbGU9Ctb.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-89xM7zJD.js → architectureDiagram-ZHVYKT53-CdRG5sTM.js} +2 -2
- package/dist/client/assets/{banner-DqJ2pM0Y.js → banner-C7kHJJGz.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CcxwDmZC.js → blockDiagram-RJAE7QA3-CBQ6YXoI.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DCIhIyXa.js → c4Diagram-XDPPPE54-DavNcKCF.js} +1 -1
- package/dist/client/assets/{card-DT-vFAns.js → card-D4ek-VvX.js} +1 -1
- package/dist/client/assets/channel-ClNeQ2PQ.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-BfWEXcCj.js → chunk-2E7WHVMD-ClO15ze9.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-KLXLZXlR.js → chunk-2Q5K7J3B-DsLDzf_i.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-CL5Gttmj.js → chunk-4EMNKR2T-D20fXIIK.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-cfAl84Mv.js → chunk-55XCU76K-no_S5sRX.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BqUyGgoH.js → chunk-5VM5RSS4-D5xWEZ2p.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BWr2ST9i.js → chunk-JWPE2WC7-CnsdZOv0.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-V5zYx50O.js → chunk-VQ5W62QI-DxYg8tsH.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-gnvheN_J.js → chunk-XXDRQBXY-7CQ-MKdC.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-ClGxxZvV.js → chunk-ZCHMQSOR-Ca7Jh42b.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DvmHzDb5.js → classDiagram-v2-4MYWR3UA-BvZXavcI.js} +1 -1
- package/dist/client/assets/{command-CNx4L11m.js → command-srO4Wv-5.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Df8nXBRj.js → cose-bilkent-JH36ORCC-1NCiJaHv.js} +1 -1
- package/dist/client/assets/{cpu-D8KJEkdh.js → cpu-CFIu4JtK.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-CAn6ufHs.js → cynefin-EF2NZ3EQ-DgZeohG3.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-Cep_NrRw.js → cynefinDiagram-WF24UDRP-MQB2xbJK.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-sWD3z9wf.js → dagre-NK4GIZVX-BFHk_Y44.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-CUpaBATr.js → diagram-CBK3MWTC-CloEvZfp.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-BejWB2ry.js → diagram-I5XIIV2D-9nzUtfKI.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-BGKJfNk9.js → diagram-ODIL2UCW-DVdnelgu.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-V0dP8H8k.js → diagram-PFBEJUXE-tTEeiAHa.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-Bf5dVsFX.js → diagram-RJA3I4VV-QFehV9_1.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-CLrMSqb4.js → diagram-TYUNFSNR-CYU5li-4.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BGG4CWA0.js → ebnfDiagram-V4P3TTPT-Cn040Beg.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-bf9D6f0w.js → elk-QONTBCTQ-tBbnwcb3.js} +1 -1
- package/dist/client/assets/{empty-state-CDoXnrKn.js → empty-state-Bxfi7_ss.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-fEUv-33P.js → erDiagram-KYQIGQAA-DAA0fFlD.js} +1 -1
- package/dist/client/assets/{execution-config-Ca9MDOtV.js → execution-config-afKaYukD.js} +1 -1
- package/dist/client/assets/{file-CiyVL55_.js → file-C-ooqbRY.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DaFRIKco.js → file-exclamation-point-BWWgLsMF.js} +1 -1
- package/dist/client/assets/{file-text-DsnD-A8g.js → file-text-BJt8biPY.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-CNsnCgbB.js → find-latest-widget-fence-DPQimlUD.js} +2 -2
- package/dist/client/assets/{flowDiagram-IUGLLWBU-CRbeSDod.js → flowDiagram-IUGLLWBU-vYI6TodS.js} +1 -1
- package/dist/client/assets/{form-Cru78aT-.js → form-LJ2Rf9ny.js} +1 -1
- package/dist/client/assets/{format-cron-9K38-tn1.js → format-cron-DrUISrHj.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-Mkk7zgs_.js → ganttDiagram-R7GPNTJY-DLYpSX7r.js} +3 -3
- package/dist/client/assets/{git-branch-CONwEYiR.js → git-branch-D5xr7U5P.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-Drre0vyA.js → gitGraphDiagram-PDYL7XHY-DNIbVOaY.js} +1 -1
- package/dist/client/assets/{graph-BJlnKWgo.js → graph-DNjxkUSL.js} +1 -1
- package/dist/client/assets/{heart-CqwUlIUG.js → heart-DnR_GX4I.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-e4LXC_pS.js → highlighted-body-KPVGNVTW-L_Jd2uei.js} +1 -1
- package/dist/client/assets/image-lightbox-DZIhMyF3.js +1 -0
- package/dist/client/assets/{image-off-DZuLkaRJ.js → image-off-DdvvVxmq.js} +2 -2
- package/dist/client/assets/index-5eNHb7up.js +1 -0
- package/dist/client/assets/{index-BV2Ezdxv.js → index-5hCWBj-r.js} +1 -1
- package/dist/client/assets/{index-A41zxoWk.js → index-9GoQjBFo.js} +1 -1
- package/dist/client/assets/{index-By58MgcZ.js → index-ANmu61E0.js} +1 -1
- package/dist/client/assets/{index-pVFjKNjX.js → index-B0jt7Nng.js} +1 -1
- package/dist/client/assets/index-B1gC3xYN.js +1 -0
- package/dist/client/assets/{index-Bd7vUYhr.js → index-B2wx4J9U.js} +1 -1
- package/dist/client/assets/{index-BIB-maE5.js → index-BAIKz_P0.js} +1 -1
- package/dist/client/assets/{index-DdJBZE0H.js → index-BFecX5dC.js} +1 -1
- package/dist/client/assets/{index-CyVH876g.js → index-BWQfqbbe.js} +1 -1
- package/dist/client/assets/{index-Bo7x9IkO.js → index-BYeyKNKj.js} +1 -1
- package/dist/client/assets/{index-DL8ISRMH.js → index-Ba9q2CoQ.js} +1 -1
- package/dist/client/assets/{index-B25gvCK_.js → index-Blhsfk7u.js} +1 -1
- package/dist/client/assets/{index-x1yAu9zJ.js → index-Bpwvxz0c.js} +1 -1
- package/dist/client/assets/{index-mZqojApH.js → index-BqKjnd_r.js} +1 -1
- package/dist/client/assets/{index-cI2u8WZS.js → index-Bri5bZfv.js} +1 -1
- package/dist/client/assets/{index-HR8BYVRQ.js → index-BsHyymmC.js} +1 -1
- package/dist/client/assets/index-BsmR2hi4.js +23 -0
- package/dist/client/assets/index-By-VWzSF.js +43 -0
- package/dist/client/assets/{index-BtDxwJsM.js → index-By8pKNSM.js} +1 -1
- package/dist/client/assets/{index-DijWcSDZ.js → index-BzKkoaB1.js} +3 -3
- package/dist/client/assets/{index-BBmkfbXd.js → index-CDGWl8qL.js} +1 -1
- package/dist/client/assets/{index-LEcodwyW.js → index-CDo6TA8n.js} +1 -1
- package/dist/client/assets/{index-DzwZJuO1.js → index-CLQIvYHP.js} +1 -1
- package/dist/client/assets/{index-DAlpmAIA.js → index-CLbs0fcq.js} +1 -1
- package/dist/client/assets/{index-skAhJyIF.js → index-CQ2atcs_.js} +1 -1
- package/dist/client/assets/index-CSqz4B0v.js +1 -0
- package/dist/client/assets/{index-vJy88bwb.js → index-CXWlrRzK.js} +1 -1
- package/dist/client/assets/{index-BKp2B9JS.js → index-D-Q7CW4p.js} +1 -1
- package/dist/client/assets/index-D0ujPZdD.js +1 -0
- package/dist/client/assets/index-D1kQ19Gb.css +1 -0
- package/dist/client/assets/index-DHi8-3w0.js +1 -0
- package/dist/client/assets/index-DKTd8X7n.js +1053 -0
- package/dist/client/assets/{index-1yEXEZiH.js → index-DTuNXPGU.js} +1 -1
- package/dist/client/assets/{index-BFNy-Yp3.js → index-DXWsH2Ep.js} +1 -1
- package/dist/client/assets/index-DjFFFMc-.js +2 -0
- package/dist/client/assets/{index-B_0LYi32.js → index-DqCxUalt.js} +1 -1
- package/dist/client/assets/{index-CVuEUzi5.js → index-Ixk2o7yl.js} +1 -1
- package/dist/client/assets/{index-DabU6r9W.js → index-ZYbeRA5f.js} +3 -3
- package/dist/client/assets/index-a6ojvFqI.js +1 -0
- package/dist/client/assets/{index-Vz7VUm9l.js → index-adYd35CJ.js} +1 -1
- package/dist/client/assets/{index-BTjZIgFn.js → index-ld6lMfGU.js} +1 -1
- package/dist/client/assets/{index-BDD2EyoW.js → index-r0stHl-2.js} +1 -1
- package/dist/client/assets/index-uIonuakd.js +1 -0
- package/dist/client/assets/{index-DDNwNOHF.js → index-xfRcAp50.js} +1 -1
- package/dist/client/assets/{index.esm-BUPoRUaG.js → index.esm-j5KQ_b6S.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-B_Wyzufh.js → infoDiagram-MVDRKAX5-DjvSkTas.js} +1 -1
- package/dist/client/assets/{inline-code-BIzGDx6z.js → inline-code-DlVYFFW7.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BDk2-6Pd.js → ishikawaDiagram-HPEHV2GE-BBivrI5n.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-7qf9KWEQ.js → journeyDiagram-BOSHW7O7-DKdhbtdx.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-CFYDQmXn.js → kanban-definition-FNSA4HC5-CkgAodR5.js} +1 -1
- package/dist/client/assets/{layers-C9tVVcXg.js → layers-CzyhuVSM.js} +1 -1
- package/dist/client/assets/{lightbulb-f4jtsAh0.js → lightbulb-DwGE7s99.js} +1 -1
- package/dist/client/assets/{link-2-ZNlK1BG1.js → link-2-CljREnN9.js} +1 -1
- package/dist/client/assets/{list-runtime-types-CqO-QFYD.js → list-runtime-types-D5ZO30FL.js} +1 -1
- package/dist/client/assets/{markdown-content-DaEVxezf.js → markdown-content-CN_dGlgE.js} +1 -1
- package/dist/client/assets/{mention-pill-BiCPflY-.js → mention-pill-C6OT4gx4.js} +1 -1
- package/dist/client/assets/{mermaid.core-SX8SzrsU.js → mermaid.core-DNuzxE7q.js} +4 -4
- package/dist/client/assets/{message-square-off-_qbedNGF.js → message-square-off-DlkAPJdd.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-BloJIArH.js → mindmap-definition-6OY57UG3-f9ygKKO1.js} +1 -1
- package/dist/client/assets/{more-details-CdJT0Ehl.js → more-details-DRPervoL.js} +1 -1
- package/dist/client/assets/{owner-notice-BDafFD_I.js → owner-notice-C-Q9ySA7.js} +1 -1
- package/dist/client/assets/{package-Cb7lEm7t.js → package-BVNiaGrb.js} +1 -1
- package/dist/client/assets/{page-container-DsRgIMAL.js → page-container-D03bhclt.js} +1 -1
- package/dist/client/assets/pane-resize-handle-CZ9rHhNr.js +1 -0
- package/dist/client/assets/{paperclip-DNu1VtoX.js → paperclip-DQQVX5tJ.js} +1 -1
- package/dist/client/assets/{path-input-D3O71b-X.js → path-input-CQ16nhYd.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Di48kPNu.js → pegDiagram-ECIUJNBX-CZ_YkcKh.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-DY8B_SPD.js → pieDiagram-GNMPY74T-DLHSPEH7.js} +1 -1
- package/dist/client/assets/{plug-IIS_cL9-.js → plug-CadJyjTp.js} +1 -1
- package/dist/client/assets/primer-trigger-DH4xfrlM.js +3 -0
- package/dist/client/assets/profile-errors-DSnHlauU.js +1 -0
- package/dist/client/assets/{progress-g5kkqvlR.js → progress-BB97hlmb.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-Depv_dON.js → quadrantDiagram-D57K4MC3-BWcUu48x.js} +1 -1
- package/dist/client/assets/{query-error-state-PuLGD7Jp.js → query-error-state-B456s96E.js} +1 -1
- package/dist/client/assets/{radio-QOLZSBz1.js → radio-DrpN3x3S.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-BfD2AiZM.js → railroadDiagram-Y72NRBL7-C2VRM83h.js} +1 -1
- package/dist/client/assets/registry-DRvQ3ChB.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DF_DfZ7s.js → relay-trace-schemas-BYCaGsVJ.js} +2 -2
- package/dist/client/assets/repeat-DPzic7-j.js +11 -0
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-B1iTjrkD.js → requirementDiagram-EQYSW5RA-B1bpdcM7.js} +1 -1
- package/dist/client/assets/{room-files-source-g1th8mWs.js → room-files-source-aN4p_kDV.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-BGwYMaGL.js → rotate-ccw-clock-gqBy98sI.js} +1 -1
- package/dist/client/assets/{rotate-cw-B4Y0q4GY.js → rotate-cw-mHsqEte-.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-D5TzVJrQ.js → sankeyDiagram-SY24JHO5-QCGTTh9k.js} +1 -1
- package/dist/client/assets/{scroll-area-BvScZKSa.js → scroll-area-DVd6ctli.js} +1 -1
- package/dist/client/assets/{search-x-CqN5twBj.js → search-x-CzgTzL0z.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BhUahaNf.js → sequenceDiagram-BLEHNHQU-kiR1gX_u.js} +1 -1
- package/dist/client/assets/{shield-x-DHJrwtKp.js → shield-x-Btfd3Xnx.js} +1 -1
- package/dist/client/assets/signed-in-gS3tMpTW.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-D2Vi1Kq9.js → sizeCapture-INFHLROL-Da56aMj0.js} +1 -1
- package/dist/client/assets/{soul-file-BMpVFN7U.js → soul-file-C7zd1yXt.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-b9gSbZnF.js → stateDiagram-v2-A6IESKWZ-BZ3qlQWl.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-i47jxLY6.js → swimlanes-B3ENRKFQ-B-wp91_T.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Drg_8k1s.js +8 -0
- package/dist/client/assets/{table-CN2HCi4p.js → table-BIdFvzBs.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-eY5gj0js.js → timeline-definition-JXYKGLGB-CQojjy-8.js} +1 -1
- package/dist/client/assets/{trust-posture-Bcyy5Fub.js → trust-posture-DszobEjt.js} +1 -1
- package/dist/client/assets/{unplug-lkD35Rwp.js → unplug-xlfZ61jC.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DiCIrrhU.js → unverified-catalog-notice-DymrAwtm.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-BrqVd-47.js → use-adapter-catalog-CytBTafV.js} +1 -1
- package/dist/client/assets/{use-bindings-CU2RSXOy.js → use-bindings-BPNK3sUh.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-Dy2oTM8Y.js → use-composer-prefs-DMQT0qiv.js} +1 -1
- package/dist/client/assets/{use-connector-management-5oRqzydY.js → use-connector-management-PDVdWccW.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-Bg5nW8qq.js → use-deep-link-scroll-CwapSmGj.js} +1 -1
- package/dist/client/assets/{use-delete-binding-qeyRkvR1.js → use-delete-binding-CgTwS83G.js} +1 -1
- package/dist/client/assets/{use-dev-links-FY4J_PjA.js → use-dev-links-BoZCIc4h.js} +1 -1
- package/dist/client/assets/use-direct-message-panel-Cs4I6669.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-HiWFZZrW.js → use-external-adapter-catalog-PBrsasQ8.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-K1uk9Wya.js → use-full-activity-feed-C2seN-V1.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-pvzUlnxh.js +1 -0
- package/dist/client/assets/use-is-hub-CvEPWuj0.js +1 -0
- package/dist/client/assets/{use-local-browser-CTFiF0wf.js → use-local-browser-CF0uGQ6e.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CafidaIH.js → use-mesh-topology-CnCeK4gS.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-B38uSLCx.js → use-mounted-ref-BtAb14HI.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-m9XSNB6W.js → use-notification-prefs-B8LHpZTt.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-D9n6rNJ1.js → use-panel-tab-placements-DOXj0Pii.js} +1 -1
- package/dist/client/assets/use-pending-read-DBaC7e8N.js +1 -0
- package/dist/client/assets/{use-personality-commit-ChLQfLrK.js → use-personality-commit-YV9FVC-a.js} +1 -1
- package/dist/client/assets/{use-promo-activation-DbJDgp4_.js → use-promo-activation-CjtGhz_3.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-Csw0j0N0.js → use-promo-dismissals-4rbLgSDG.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BIZ7daHW.js → use-pulse-freshness-CGqANpVO.js} +1 -1
- package/dist/client/assets/{use-relay-config-hUB3lVFv.js → use-relay-config-CvU_70WJ.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BpKzhniV.js → use-room-follow-claim-Doq_lWjk.js} +1 -1
- package/dist/client/assets/use-room-sessions-CoEIaBRt.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-BtM0bZL7.js → use-roving-tab-list-BzsrpjWV.js} +1 -1
- package/dist/client/assets/use-session-canvas-DQ9ND8il.js +27 -0
- package/dist/client/assets/use-status-budget-AnHroEO0.js +16 -0
- package/dist/client/assets/{use-unclaimed-chats-BbMZtNG9.js → use-unclaimed-chats-DzOLK27i.js} +1 -1
- package/dist/client/assets/use-update-config-NRkQbxae.js +1 -0
- package/dist/client/assets/{useMutationState-CVpvw27W.js → useMutationState-BAU_J-u3.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-CHcpeLg4.js → usecaseDiagram-WPOLBNNX-BrHN0c6G.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-gQbZL_A6.js → vennDiagram-Q3Y3IDCW-CbeP0Pbp.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BFH_WHzZ.js → wardleyDiagram-IVAIDKWA-mn5ebFhs.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-B0QpyqeZ.js → xychartDiagram-4URNHDU4-C8fXRQEv.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
- package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
- package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
- package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/server/extension-child.cjs +27 -1
- package/dist/server/index.js +12384 -9857
- package/dist/server/index.js.map +2 -2
- package/package.json +8 -8
- package/dist/client/assets/AttentionSignalRow-B1aMjgX_.js +0 -1
- package/dist/client/assets/CanvasFileContent-D1bFaUeh.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-dST7g1v2.js +0 -2
- package/dist/client/assets/HandlePage-B08V-om7.js +0 -1
- package/dist/client/assets/NamePage-JwMDK1JD.js +0 -1
- package/dist/client/assets/PhotoPage-DlOVhkW9.js +0 -1
- package/dist/client/assets/ProfileFields-DVMkpJSb.js +0 -1
- package/dist/client/assets/RoomSurface-CdgCdV6h.js +0 -44
- package/dist/client/assets/RuntimeConnectFlow-DCIRnvOH.js +0 -1
- package/dist/client/assets/SeenDevices-nMsGUQTv.js +0 -19
- package/dist/client/assets/SettingsDialog-C8r2igJ_.js +0 -12
- package/dist/client/assets/TaskDialogWrapper-BhTEvf-u.js +0 -1
- package/dist/client/assets/TopologyGraph-CwyasvFI.js +0 -30
- package/dist/client/assets/_shell-Ct2Bz7D0.js +0 -80
- package/dist/client/assets/_shell._home.index-D4sQsKKk.js +0 -3
- package/dist/client/assets/_shell.marketplace-Cezv-i16.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-BTENmr4W.js +0 -1
- package/dist/client/assets/_shell.session-BjevHF_O.js +0 -63
- package/dist/client/assets/_shell.x._extensionId-0OO_Xr72.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-0OO_Xr72.js +0 -1
- package/dist/client/assets/channel-Ngk70nQZ.js +0 -1
- package/dist/client/assets/image-lightbox-DHDtzoja.js +0 -1
- package/dist/client/assets/index-B9bZYNKR.js +0 -1
- package/dist/client/assets/index-BLP5O7X9.js +0 -1
- package/dist/client/assets/index-C3cvP8Fo.js +0 -1033
- package/dist/client/assets/index-CoWJD3Jg.js +0 -2
- package/dist/client/assets/index-D67Kfy-M.js +0 -1
- package/dist/client/assets/index-DyRGZyur.css +0 -1
- package/dist/client/assets/index-UPF8suf2.js +0 -1
- package/dist/client/assets/index-YW-v746p.js +0 -1
- package/dist/client/assets/index-iTQUa_b2.js +0 -23
- package/dist/client/assets/index-wY5OcS4a.js +0 -43
- package/dist/client/assets/index-xAgihCJ7.js +0 -1
- package/dist/client/assets/primer-trigger-DurKYe8C.js +0 -3
- package/dist/client/assets/profile-errors-BdhZfdvZ.js +0 -1
- package/dist/client/assets/registry-Ck8p6n1T.js +0 -1
- package/dist/client/assets/signed-in-BmywDpR5.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CA9gW19w.js +0 -8
- package/dist/client/assets/terminal-BORQniao.js +0 -6
- package/dist/client/assets/use-is-below-desktop-Cu_jKnft.js +0 -1
- package/dist/client/assets/use-is-hub-BX7ypNRJ.js +0 -1
- package/dist/client/assets/use-jump-back-in-BjZ8EswV.js +0 -11
- package/dist/client/assets/use-pending-read-BoV-UI1E.js +0 -1
- package/dist/client/assets/use-session-canvas-DRrkNRcL.js +0 -25
- package/dist/client/assets/use-session-diagnostics-BTNgouum.js +0 -16
- package/dist/client/assets/use-update-config-CkWwKNkY.js +0 -1
- /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var tt=Object.defineProperty;var nt=(e,n,s)=>n in e?tt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s;var Y=(e,n,s)=>nt(e,typeof n!="symbol"?n+"":n,s);import{W as A,a1 as D,jP as st,r as h,aN as at,jQ as ue,aL as rt,j as t,ig as W,jR as ot,g as Z,jS as ee,jT as te,G as O,jU as it,jo as lt,X as ct,jV as dt,B as b,dW as ut,ar as $,aQ as mt,jW as ht,a2 as ne,a3 as se,a4 as K,_ as ye,gi as pt,gj as ft,cn as F,x as xt,bz as be,bA as we,bB as je,bD as Ne,b8 as gt,fg as vt,jX as yt,jY as bt,ju as wt,jZ as jt,j_ as Nt,j$ as me,J as kt,hw as ke,aY as N,gX as Ct,h0 as Rt,k0 as Et,a7 as he,k1 as Tt,k2 as At,k3 as Dt}from"./index-DKTd8X7n.js";import{u as _t}from"./use-roving-tab-list-BzsrpjWV.js";import{F as Ce,c as St,d as pe,e as It,R as Ot,C as Re}from"./use-session-canvas-DQ9ND8il.js";import{f as ps,g as fs,h as xs,b as gs,i as vs}from"./use-session-canvas-DQ9ND8il.js";import{A as zt}from"./McpAppFrame-Cz-Ttlqr.js";import{F as Mt}from"./file-C-ooqbRY.js";import{F as Ee}from"./file-text-BJt8biPY.js";import{R as Ut}from"./rotate-cw-mHsqEte-.js";import{a as $t}from"./use-room-follow-claim-Doq_lWjk.js";import{R as Lt}from"./rotate-ccw-clock-gqBy98sI.js";import{c as Ft,F as Pt}from"./room-files-source-aN4p_kDV.js";import"./query-keys-DeYqUDia.js";import"./index.esm-j5KQ_b6S.js";import"./WidgetErrorCard-CAUx4KUI.js";import"./index-CSqz4B0v.js";import"./card-D4ek-VvX.js";import"./progress-BB97hlmb.js";import"./markdown-content-CN_dGlgE.js";import"./table-BIdFvzBs.js";import"./package-BVNiaGrb.js";import"./heart-DnR_GX4I.js";import"./git-branch-D5xr7U5P.js";import"./more-details-DRPervoL.js";import"./file-exclamation-point-BWWgLsMF.js";/**
|
|
2
|
+
* @license lucide-react v1.48.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Te={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};Te.node;const Ht=A(Te);/**
|
|
7
|
+
* @license lucide-react v1.48.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Ae={name:"braces",size:24,node:[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],aliases:["curly-braces"]};Ae.node;const De=A(Ae);/**
|
|
12
|
+
* @license lucide-react v1.48.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const _e={name:"file-headphone",size:24,node:[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],aliases:["file-audio","file-audio-2"]};_e.node;const Gt=A(_e);/**
|
|
17
|
+
* @license lucide-react v1.48.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Se={name:"file-play",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],aliases:["file-video"]};Se.node;const Bt=A(Se);/**
|
|
22
|
+
* @license lucide-react v1.48.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const Ie={name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]};Ie.node;const Wt=A(Ie);/**
|
|
27
|
+
* @license lucide-react v1.48.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Oe={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};Oe.node;const Kt=A(Oe);/**
|
|
32
|
+
* @license lucide-react v1.48.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const ze={name:"table",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]};ze.node;const Vt=A(ze);/**
|
|
37
|
+
* @license lucide-react v1.48.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Me={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]};Me.node;const Yt=A(Me);function qt(e){const n=D(),{roomId:s,viewerAuthorId:r,documentId:l,url:m,readScrollY:o,subscribe:i}=e,a=st(s,r),g=h.useRef({roomId:s,documentId:l,url:m,readScrollY:o});g.current={roomId:s,documentId:l,url:m,readScrollY:o};const p=h.useRef(null),d=h.useRef(0);h.useEffect(()=>{if(!a||s===null||l===null)return;const x=()=>{p.current=null,d.current=Date.now();const w=g.current;if(w.roomId===null||w.documentId===null)return;const E=w.roomId,S={documentId:w.documentId,...w.url!==void 0?{url:w.url}:{},...w.readScrollY?{scrollY:Math.max(0,Math.round(w.readScrollY()))}:{}};n.publishRoomView(E,S).then(z=>{!z.followed&&r!==null&&rt.getState().noteNobodyFollowing(E,r)}).catch(()=>{})},y=()=>{if(p.current!==null)return;const w=Date.now()-d.current;if(w>=ue){x();return}p.current=setTimeout(x,ue-w)};y();const c=i==null?void 0:i(y),R=setInterval(y,at);return()=>{clearInterval(R),c==null||c()}},[n,a,s,r,l,m,i]),h.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[])}const Qt={url:W,markdown:Ee,json:De,image:Kt,pdf:Mt,widget:ot,mcp_app:zt,file:Ce,model3d:Ht,audio:Gt,video:Bt,csv:Vt,browser:W,diff:Wt},Xt="after:absolute after:inset-x-0 after:-inset-y-2 md:after:hidden";function ae(e){return e==="browser"?"browser-panel":"canvas-panel"}const Jt={canvas:"Open canvas documents",browser:"Open browser pages"};function re(e){return`canvas-tab-${e}`}const Zt=3;function en(e){const n=e.map(r=>r.displayName);if(n.length===0)return null;if(n.length===1)return`${n[0]} is looking at this.`;if(n.length===2)return`${n[0]} and ${n[1]} are looking at this.`;const s=n.length-2;return`${n[0]}, ${n[1]} and ${s} ${s===1?"other":"others"} are looking at this.`}function tn({watchers:e}){const n=en(e);if(n===null)return null;const s=e.slice(0,Zt),r=e.length-s.length;return t.jsxs(t.Fragment,{children:[t.jsxs("span",{"data-slot":"canvas-tab-watchers","aria-hidden":!0,className:"flex shrink-0 -space-x-1",children:[s.map(l=>t.jsx(Z,{size:"xs",className:"ring-background text-3xs size-3.5 ring-1",kind:l.kind,color:l.color??te(l.id),emoji:l.emoji,imageUrl:l.imageUrl,badge:null,fallback:ee(l.displayName)},l.id)),r>0&&t.jsxs("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-3.5 shrink-0 items-center justify-center rounded-full ring-1",children:["+",r]})]}),t.jsx("span",{className:"sr-only",children:n})]})}function Ue({view:e,documents:n,activeDocumentId:s,onActivate:r,onClose:l,onPin:m}){const o=ae(e),{getTabProps:i}=_t({orderedIds:n.map(a=>a.id),activeId:s,onActivate:a=>r(a),onClose:a=>l(a),getFallbackFocus:()=>document.getElementById(o)});return n.length===0?null:t.jsx("div",{role:"tablist","aria-label":Jt[e],className:"flex items-stretch gap-1 overflow-x-auto border-b px-2 py-1",children:n.map(a=>{const g=Qt[a.contentType],p=a.id===s,d=a.author;return t.jsxs("div",{role:"presentation",className:"group relative flex shrink-0",children:[t.jsxs("button",{type:"button",role:"tab","aria-selected":p,id:re(a.id),"aria-controls":p?o:void 0,...i(a.id),className:O("focus-ring flex items-center gap-1.5 rounded-md py-3 pl-2 text-xs transition-colors md:py-1",m?"pr-12":"pr-7",p?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[d&&t.jsx(Z,{"aria-hidden":!0,size:"xs",className:"text-3xs size-3.5 shrink-0",kind:d.kind,color:d.color??te(d.id),emoji:d.emoji,imageUrl:d.imageUrl,badge:null,fallback:ee(d.displayName)}),t.jsx(g,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"max-w-40 truncate font-medium",children:a.sourceLabel}),a.watchers&&a.watchers.length>0&&t.jsx(tn,{watchers:a.watchers}),a.unread&&t.jsx("span",{"data-slot":"canvas-tab-unread","aria-hidden":!0,className:"bg-primary size-1.5 shrink-0 rounded-full"})]}),m&&t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(a.id,!a.pinned),"aria-label":a.pinned?`Unpin ${a.sourceLabel}`:`Pin ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-6 -translate-y-1/2 rounded-sm p-1.5 transition-opacity md:p-0.5",a.pinned?"opacity-100":"opacity-0 group-hover:opacity-60"),children:a.pinned?t.jsx(it,{className:"size-3"}):t.jsx(lt,{className:"size-3"})}),t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>l(a.id),"aria-label":`Close ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-1 -translate-y-1/2 rounded-sm p-1.5 opacity-60 transition-opacity group-hover:opacity-100 md:p-0.5",Xt),children:t.jsx(ct,{className:"size-3"})})]},a.id)})})}function nn({error:e,onRetry:n}){const s=dt(e);return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx("p",{children:"This tab hit a problem"}),s?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm",children:"The app may have updated. Reloading usually fixes it."}),t.jsx(b,{type:"button",size:"sm",onClick:()=>window.location.reload(),children:"Reload DorkOS"})]}):t.jsxs(b,{type:"button",variant:"outline",size:"sm",onClick:n,children:[t.jsx(Ut,{className:"size-4"}),"Try again"]})]})}class $e extends h.Component{constructor(){super(...arguments);Y(this,"state",{error:null,retryKey:0});Y(this,"handleRetry",()=>{this.setState(s=>({error:null,retryKey:s.retryKey+1}))})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,r){console.error(`[Canvas] Document viewer error (${this.props.documentId}):`,s,r)}render(){const{error:s,retryKey:r}=this.state;return s?t.jsx(nn,{error:s,onRetry:this.handleRetry}):t.jsx(h.Fragment,{children:this.props.children},r)}}function sn({onReload:e,onKeepMine:n}){return t.jsxs("div",{role:"status",className:"border-border/60 bg-muted/40 mx-2 mt-2 space-y-2 rounded-md border px-3 py-2 text-sm",children:[t.jsx("p",{children:"Your agent changed this while you were editing. Your edit is safe."}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:e,children:"Reload"}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Keep mine"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Reload shows its version and ends your edit. Keep mine discards it."})]})}const an={canvas:{heading:"A blank canvas",blurb:"Your agent can show documents, data and files here.",actions:[{icon:Ee,label:"Markdown",description:"Render a document",action:()=>({type:"markdown",content:`# Untitled
|
|
42
|
+
|
|
43
|
+
Start writing…`,title:"Document"})},{icon:De,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: your files, dev servers, or sites from your agent.",actions:[{icon:W,label:"Web page",description:"Open a page, then type any address",action:()=>({type:"url",url:ht.site,title:"Web Page"})}]}};function q(e,n,s,r){return e.split("").reduce((m,o)=>m+o.charCodeAt(0),0)*(n+1)*7%(r-s)+s}function Le({view:e,onAction:n}){const s=ut(),r=h.useId(),l=an[e],m=h.useMemo(()=>Array.from({length:6},(o,i)=>({x:q(r,i*3,10,90),y:q(r,i*3+1,10,80),size:q(r,i*3+2,24,56),delay:i*.4})),[r]);return t.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&m.map((o,i)=>t.jsx($.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${o.x}%`,top:`${o.y}%`,width:o.size,height:o.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:o.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},i)),t.jsxs($.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[t.jsx($.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:e==="browser"?t.jsx(W,{className:"size-7"}):t.jsx(mt,{className:"size-7"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:l.heading}),t.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[l.blurb,t.jsx("br",{}),"Or pick a starting point below."]})]}),t.jsx($.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:l.actions.map(({icon:o,label:i,description:a,action:g})=>t.jsxs($.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(g()),children:[t.jsx(o,{className:"text-muted-foreground size-4 shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("span",{className:"text-sm font-medium",children:i}),t.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},i))})]})]})}const Fe=[{value:"hour",label:"1 hour",ms:36e5},{value:"day",label:"1 day",ms:864e5},{value:"week",label:"1 week",ms:6048e5}];function fe(e,n=Date.now()){const s=Fe.find(r=>r.value===e).ms;return new Date(Math.ceil((n+s)/6e4)*6e4).toISOString()}const rn=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function B(e){return rn.format(new Date(e))}function L(e){switch(e.kind){case"log":return"Kept on this document";case"room":return e.agentName?`To ${e.agentName} in this room`:"To this room";case"owner":return e.agentName?`To ${e.agentName}`:"To the agent that opened this";case"agent":return e.agentName?`To ${e.agentName}`:"To an agent that’s gone"}}const on={no_grant:"Off",granted:"On",waiting:"Waiting for you",suspended:"Paused",revoked:"Turned off",expired:"Ended"};function Pe(e){return on[e]}function ln(e){const n=e.grant;switch(e.state){case"granted":return n!=null&&n.expiresAt?`Until ${B(n.expiresAt)}`:"On";case"waiting":return"An agent asked for this route.";case"suspended":return"The route or its app changed. Allow it again.";case"revoked":return n!=null&&n.revokedAt?`Turned off ${B(n.revokedAt)}`:"Turned off";case"expired":return n!=null&&n.expiresAt?`Ended ${B(n.expiresAt)}`:"Ended";case"no_grant":return e.needsPerson?"Needs your approval to start work.":"Off until someone allows it."}}function He(e){const n=`${e.turnsPerHour} ${e.turnsPerHour===1?"turn":"turns"} an hour`,s=`${e.eventsPerMinute} ${e.eventsPerMinute===1?"event":"events"} a minute`;return`${n} · ${s}`}function Ge(e){return`${Pe(e.state)}: ${L(e.destination)}`}function cn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&un.has(n)}function dn(e){return{on:e.filter(n=>n.state==="granted").length,waiting:e.filter(n=>n.state==="waiting").length}}const P="This route changed. Review it again.",un=new Set(["ROUTE_CHANGED","GRANT_BINDING_CHANGED","DECLARATION_HASH_MISMATCH","MANIFEST_CHANGED"]),H="Only a signed-in person can change routes.",xe={ROUTE_CHANGED:P,GRANT_BINDING_CHANGED:P,DECLARATION_HASH_MISMATCH:P,MANIFEST_CHANGED:P,ROUTE_UNDECLARED:"This document no longer declares that route.",ROUTE_ALREADY_ON:"This route is already on.",ROUTE_ALREADY_GRANTED:"This route is already on.",APPROVAL_NOT_RECORDED:"Couldn’t record the approval. Nothing was allowed.",TARGET_UNAVAILABLE:"The agent for this route isn’t available.",TARGET_IDENTITY_MISMATCH:"The agent for this route isn’t available.",TARGET_SCOPE_MISMATCH:"The agent for this route isn’t available.",ROOM_ROUTE_UNAVAILABLE:"This room can’t take events right now.",ORIGIN_AUTHORITY_LOST:"The agent that opened this isn’t available.",GRANT_EXPIRED:"That end time has passed. Pick another.",AGENT_CANNOT_DECIDE:H,REQUESTER_CANNOT_DECIDE:H,PERSON_REQUIRED:H,operator_cookie_required:H,AUTH_REQUIRED:"Sign in to change routes."};function Q(e){const n=e==null?void 0:e.code;return typeof n=="string"&&xe[n]?xe[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this route. Try again."}const X=e=>["canvas-doc-routes",e];function mn(e,n){const s=D();return ne({queryKey:X(e),queryFn:()=>s.getCanvasDocRoutes(e),retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:n?15e3:6e4})}function hn(e,n,s){const r=D();return ne({queryKey:["canvas-doc-route-review",e,n,s],queryFn:()=>r.reviewCanvasDocRoute(e,n,{expiresAt:s}),enabled:s!==null,retry:!1,networkMode:"always",staleTime:1/0,gcTime:0})}function Be(e){const n=D(),s=se(),r=o=>{s.setQueryData(X(e),i=>i&&{...i,routes:i.routes.map(a=>a.id===o.route.id?o.route:a)}),s.invalidateQueries({queryKey:X(e)})},l=K({mutationFn:o=>n.approveCanvasDocRoute(e,o.routeId,{expiresAt:o.expiresAt,reviewHash:o.reviewHash}),networkMode:"always",onSuccess:r}),m=K({mutationFn:o=>n.revokeCanvasDocRoute(e,o.routeId),networkMode:"always",onSuccess:r});return{approve:l,revoke:m}}function pn(e){return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}}function fn(){return h.useSyncExternalStore(pn,()=>navigator.onLine,()=>!0)}const xn={no_grant:"neutral",granted:"success",waiting:"warning",suspended:"warning",revoked:"neutral",expired:"neutral"};function gn({documentId:e,route:n,online:s,onDone:r,onAnnounce:l}){const m=h.useId(),[o,i]=h.useState("day"),[a,g]=h.useState(()=>fe("day")),p=hn(e,n.id,a),{approve:d}=Be(e),x=p.data,y=()=>{x&&d.mutate({routeId:n.id,expiresAt:x.expiresAt,reviewHash:x.reviewHash},{onSuccess:c=>{l(Ge(c.route)),r()},onError:c=>{cn(c)&&p.refetch()}})};return t.jsxs("section",{"aria-labelledby":m,"data-testid":`doc-route-review-${n.id}`,className:"bg-background space-y-3 rounded-md p-3",children:[t.jsx("h4",{id:m,className:"text-sm font-medium",children:"Allow this route?"}),t.jsx(pt,{"aria-label":"How long",value:o,onValueChange:c=>{i(c),g(fe(c))},children:Fe.map(c=>t.jsx(ft,{value:c.value,children:c.label},c.value))}),t.jsx("div",{className:"min-h-20 space-y-1.5 text-xs",children:x?t.jsxs(t.Fragment,{children:[t.jsx(F,{label:"Goes to",align:"start",wrap:!0,children:L(x.destination)}),t.jsx(F,{label:"Events",align:"start",wrap:!0,children:t.jsx("code",{className:"font-mono",children:x.allowedTypes.join(", ")})}),t.jsx(F,{label:"Limits",align:"start",wrap:!0,children:He(x.limits)}),t.jsx(F,{label:"Ends",align:"start",wrap:!0,children:B(x.expiresAt)})]}):p.isError?t.jsx("p",{role:"alert",className:"text-destructive",children:Q(p.error)}):t.jsxs("p",{className:"text-muted-foreground flex items-center gap-2",children:[t.jsx(xt,{size:"xs"}),"Checking details…"]})}),d.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Q(d.error)}),t.jsxs("div",{className:"flex justify-end gap-2",children:[p.isError&&t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void p.refetch(),children:"Try again"}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:r,children:"Cancel"}),t.jsx(b,{type:"button",size:"sm","data-testid":`doc-route-allow-${n.id}`,disabled:!x||p.isFetching||!s||d.isPending,onClick:y,children:d.isPending?"Allowing…":"Allow route"})]})]})}function vn({documentId:e,route:n,online:s,onAnnounce:r}){const[l,m]=h.useState(!1),{revoke:o}=Be(e),i=n.state==="granted"&&n.grant!==null,a=()=>{o.mutate({routeId:n.id},{onSuccess:g=>r(Ge(g.route))})};return t.jsxs("li",{"data-testid":`doc-route-${n.id}`,"data-state":n.state,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:L(n.destination),children:L(n.destination)}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[t.jsx("code",{className:"font-mono",children:n.on})," · ",n.id]})]}),t.jsx(ye,{shape:"pill",variant:"outline",size:"xs",tone:xn[n.state],"data-testid":`doc-route-state-${n.id}`,className:"shrink-0",children:Pe(n.state)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:ln(n)}),i&&n.grant&&t.jsx("p",{className:"text-muted-foreground text-xs",children:He(n.grant.limits)}),o.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Q(o.error)}),l?t.jsx(gn,{documentId:e,route:n,online:s,onAnnounce:r,onDone:()=>m(!1)}):t.jsx("div",{className:"flex justify-end",children:i?t.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-turn-off-${n.id}`,disabled:!s||o.isPending,onClick:a,children:o.isPending?"Turning off…":"Turn off"}):t.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-review-button-${n.id}`,disabled:!s,onClick:()=>m(!0),children:"Review"})})]})}function yn(e){return e==="expired"?"Never started":"May have run"}function bn(e){return e==="expired"?"It waited a day and never started.":"It reached the agent, but its result is unknown."}function wn(e){switch(e.replay){case"ready":return null;case"no_grant":return"This route is off. Allow it to run this again.";case"route_changed":return"The route changed, so this can’t run again.";case"inputs_gone":return"Some of its events are no longer kept.";case"still_running":return"It may still be running. Check back once it stops.";case"route_busy":return e.status==="in_doubt"?"Newer work is waiting behind this. Clear it to continue.":"Newer work is waiting on this route. Try again after it runs."}}function jn(e){return`${e} ${e===1?"event":"events"}`}function Nn(e){return`${e} to review`}const G="Only a signed-in person can change this.",ge="This work changed. The list is up to date now.",ve={WORK_ALREADY_REVIEWED:"This was already run again or cleared.",WORK_STILL_RUNNING:"It may still be running. Try again once it stops.",WORK_NOT_FOUND:ge,WORK_NOT_REVIEWABLE:ge,CONFIRM_REPEAT_REQUIRED:"Confirm before running this again.",GRANT_REQUIRED:"This route is off. Allow it first.",GRANT_REVOKED:"This route is off. Allow it first.",GRANT_EXPIRED:"This route’s approval ended. Allow it again first.",MANIFEST_CHANGED:"The document’s app changed. Allow the route again.",ROUTE_CHANGED:"The route changed, so this can’t run again.",INPUTS_GONE:"Some of its events are no longer kept.",ROUTE_BUSY:"Newer work is waiting on this route.",AGENT_CANNOT_DECIDE:G,REQUESTER_CANNOT_DECIDE:G,PERSON_REQUIRED:G,operator_cookie_required:G,AUTH_REQUIRED:"Sign in to change this."};function kn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&ve[n]?ve[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this work. Try again."}const J=e=>["canvas-doc-work",e];function Cn(e,n,s){const r=D();return ne({queryKey:J(e),queryFn:()=>r.getCanvasDocWork(e),enabled:n,retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:s?15e3:6e4})}function Rn(e){const n=D(),s=se(),r=i=>s.setQueryData(J(e),a=>a&&{...a,items:a.items.filter(g=>g.batchId!==i.batchId)}),l=()=>void s.invalidateQueries({queryKey:J(e)}),m=K({mutationFn:i=>n.replayCanvasDocWork(e,i.batchId,i.confirmRepeat?{confirmRepeat:!0}:{}),networkMode:"always",onSuccess:r,onSettled:l}),o=K({mutationFn:i=>n.clearCanvasDocWork(e,i.batchId),networkMode:"always",onSuccess:r,onSettled:l});return{replay:m,clear:o}}function En({documentId:e,item:n,route:s,online:r,onAnnounce:l}){const[m,o]=h.useState(!1),[i,a]=h.useState(null),g=h.useRef(null),p=h.useRef(null),{replay:d,clear:x}=Rn(e),y=d.isPending||x.isPending,c=n.replay==="still_running",R=wn(n),w=s?L(s.destination):n.routeId,E=n.status==="in_doubt",S=d.error??x.error;h.useEffect(()=>{var C,T;i==="cancel"&&((C=g.current)==null||C.focus()),i==="replay"&&((T=p.current)==null||T.focus())},[i,m]);const z=()=>{o(!0),a("cancel")},V=()=>{o(!1),a("replay")},k=C=>{x.reset(),d.mutate({batchId:n.batchId,...C?{confirmRepeat:C}:{}},{onSuccess:()=>l(`Running again: ${w}`)})},_=()=>{d.reset(),x.mutate({batchId:n.batchId},{onSuccess:()=>l(`Cleared: ${w}`)})};return t.jsxs("li",{"data-testid":`doc-work-${n.batchId}`,"data-status":n.status,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:w,children:w}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[jn(n.eventCount)," · ",gt(n.since)]})]}),t.jsx(ye,{shape:"pill",variant:"outline",size:"xs",tone:E?"warning":"neutral",className:"shrink-0",children:yn(n.status)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:bn(n.status)}),R&&t.jsx("p",{"data-testid":`doc-work-blocked-${n.batchId}`,className:"text-muted-foreground text-xs",children:R}),S&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:kn(S)}),m?t.jsxs("div",{"data-testid":`doc-work-confirm-${n.batchId}`,className:"bg-background space-y-2 rounded-md p-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Run this again?"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"It may repeat what the agent already did."}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(b,{ref:g,type:"button",variant:"ghost",size:"sm",onClick:V,children:"Cancel"}),t.jsx(b,{type:"button",size:"sm","data-testid":`doc-work-confirm-replay-${n.batchId}`,disabled:!r||y,onClick:()=>k(!0),children:d.isPending?"Starting…":"Run again"})]})]}):t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(b,{type:"button",variant:"ghost",size:"sm","data-testid":`doc-work-clear-${n.batchId}`,disabled:!r||y||c,onClick:_,children:x.isPending?"Clearing…":"Clear"}),t.jsx(b,{ref:p,type:"button",variant:"outline",size:"sm","data-testid":`doc-work-replay-${n.batchId}`,disabled:!r||y||R!==null,onClick:()=>E?z():k(),children:d.isPending?"Starting…":"Run again"})]})]})}function Tn({documentId:e,routes:n,online:s}){var y;const[r,l]=h.useState(!1),[m,o]=h.useState(""),i=Cn(e,n.length>0,r),a=h.useCallback(c=>o(c),[]),g=((y=i.data)==null?void 0:y.items)??[],p=t.jsx("p",{"aria-live":"polite",className:"sr-only",children:m});if(g.length===0)return p;const d=Nn(g.length),x=g.some(c=>c.status==="in_doubt");return t.jsxs(t.Fragment,{children:[p,t.jsxs(be,{open:r,onOpenChange:l,modal:!0,fullHeight:!0,children:[t.jsx(we,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-work-trigger","aria-label":`Unfinished work: ${d}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Lt,{className:"size-3.5"}),t.jsxs("span",{className:O("flex items-center gap-1",x?"text-status-warning-fg":"text-muted-foreground"),children:[x&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),d]})]})}),t.jsxs(je,{align:"end","aria-label":"Unfinished work","data-testid":"doc-work-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(Ne,{children:"Unfinished work"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Unfinished work"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Nothing runs again until you choose."})]}),!s&&t.jsx("p",{className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),i.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh this list."}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Work to review",children:g.map(c=>t.jsx(En,{documentId:e,item:c,route:n.find(R=>R.id===c.routeId),online:s,onAnnounce:a},c.batchId))})]})]})]})}function An(e,n){return n>0?`${n} waiting`:e>0?`${e} on`:"Off"}function We({documentId:e}){var x;const[n,s]=h.useState(!1),[r,l]=h.useState(""),m=fn(),o=mn(e,n),i=h.useCallback(y=>l(y),[]),a=((x=o.data)==null?void 0:x.routes)??[];if(a.length===0)return null;const{on:g,waiting:p}=dn(a),d=An(g,p);return t.jsxs("div",{"data-testid":"doc-routes-bar",className:"text-muted-foreground flex items-center justify-end gap-1 border-b px-3 py-1 text-xs",children:[t.jsx(Tn,{documentId:e,routes:a,online:m}),t.jsxs(be,{open:n,onOpenChange:s,modal:!0,fullHeight:!0,children:[t.jsx(we,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-routes-trigger","aria-label":`Event routes: ${d}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Yt,{className:"size-3.5"}),"Routes",t.jsxs("span",{className:O("flex items-center gap-1",p>0?"text-status-warning-fg":"text-muted-foreground"),children:[p>0&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),d]})]})}),t.jsxs(je,{align:"end","aria-label":"Event routes","data-testid":"doc-routes-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(Ne,{children:"Event routes"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Event routes"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"A route does nothing until it’s allowed."})]}),!m&&t.jsx("p",{"data-testid":"doc-routes-offline",className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),o.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh routes."}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void o.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Declared routes",children:a.map(y=>t.jsx(vn,{documentId:e,route:y,online:m,onAnnounce:i},y.id))}),t.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:r})]})]})]})}function Dn({sourceLabel:e,people:n,following:s,onFollow:r,onStopFollowing:l,onDiscuss:m,discussing:o=!1}){const i=n.find(a=>a.id===s)??null;return e===void 0&&n.length===0&&m===void 0?null:t.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[e!==void 0&&t.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),e===void 0&&t.jsx("span",{className:"flex-1"}),m&&t.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:o,onClick:m,children:[t.jsx(vt,{className:"size-3.5"}),"Discuss"]}),n.length>0&&t.jsxs(yt,{children:[t.jsx(bt,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:O("h-6 gap-1 px-1.5",i&&"text-foreground"),children:[t.jsx(wt,{className:"size-3.5"}),i?`Following ${i.displayName}`:"Follow"]})}),t.jsxs(jt,{align:"end",children:[t.jsx(Nt,{children:"Follow somebody’s browser"}),n.map(a=>t.jsxs(me,{onSelect:()=>a.id===s?l():r(a.id),children:[t.jsx(Z,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??te(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:ee(a.displayName)}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&t.jsx(kt,{className:"size-3.5 shrink-0"})]},a.id)),i&&t.jsx(me,{onSelect:l,children:"Stop following"})]})]})]})}function _n({roomId:e,document:n,reading:s}){const r=D(),l=se(),[m,o]=h.useState(null),i=h.useMemo(()=>Ft({transport:r,queryClient:l,roomId:e}),[r,l,e]);return t.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[t.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ce,{className:"text-muted-foreground size-4 shrink-0"}),t.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),t.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"A room file. Each save is recorded with your name."}),t.jsx(b,{type:"button",size:"sm",onClick:()=>o(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&t.jsx(Pt,{source:i,path:m,onClose:()=>o(null)})]})}const Sn=["image","pdf","audio","video","csv","model3d"];function In(e){return/^(https?:|data:)/.test(e)}function On(e){if(e.type==="file"||e.type==="diff")return e.sourcePath;if(e.type==="markdown")return e.sourcePath??null;if(Sn.includes(e.type)){const n=e.src;return In(n)?null:n}return null}function zn(e){return e.type==="file"||e.type==="diff"||e.type==="markdown"}function Mn(e){const n=/^(?:in )?(.+?)['’]s /.exec(e.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function Un(e){const n=On(e.content);if(n===null)return{kind:"inline"};if(e.treeKind==="room-main"||e.treeKind===void 0)return zn(e.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s files. Open it from Files in the Room tab."};if(e.content.type==="diff"&&e.treeKind==="worktree"&&typeof e.aheadOfMain=="number"&&e.aheadOfMain>0)return{kind:"worktree-diff",sourcePath:n,content:e.content};if(e.content.type==="markdown")return{kind:"inline"};const s=Mn(e);return{kind:"elsewhere",sourcePath:n,sentence:`${s.charAt(0).toUpperCase()}${s.slice(1)}’s project isn’t open to you. Ask them to share it, or open your copy.`}}function $n(e){return e.title||e.contentType}function Ln({roomId:e,document:n,onUpdate:s}){const r=Un(n);return r.kind==="worktree-diff"?t.jsx(At,{roomId:e,content:r.content,documentId:n.id,authorId:n.authorId}):r.kind!=="inline"?t.jsx(_n,{roomId:e,document:n,reading:r}):n.content.type==="markdown"?t.jsx(Ot,{roomId:e,document:n,content:n.content,onSave:s}):t.jsx(Re,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function Ke({roomId:e,view:n}){var le;const s=ke(),r=N(u=>u.roomCanvasDocuments[e]),l=N(u=>{var f;return((f=u.roomCanvasActive[e])==null?void 0:f[n])??null}),m=N(u=>{var f;return(f=u.roomCanvasUnread[e])==null?void 0:f[n]}),o=N(u=>u.activateRoomCanvasDocument),i=N(u=>u.clearRoomCanvasUnread),a=N(u=>u.roomCanvasPresence[e]),g=St(e),p=Ct(e),d=D(),x=((le=p.data)==null?void 0:le.viewerAuthorId)??null,y=N(u=>u.roomCanvasEditing[e]??null),c=Rt(u=>u.openThread),[R,w]=h.useState(!1),E=n==="browser"?e:null,{following:S,follow:z,stop:V}=$t(E),k=Et(E),_=h.useRef(null),C=h.useCallback(async(u,f)=>{try{return await f(),!0}catch(M){return he.error(u,{description:pe(M)}),!1}},[]),T=h.useMemo(()=>Tt(r??[],n),[r,n]),j=T.find(u=>u.id===l)??null,oe=(m==null?void 0:m.length)??0;h.useEffect(()=>{oe>0&&i(e,n)},[oe,i,e,n]);const Ye=h.useMemo(()=>{var ce;const u=new Map(((ce=p.data)==null?void 0:ce.members.map(v=>[v.author.id,v.author]))??[]),f=v=>({id:v.id,displayName:v.displayName,kind:v.kind,...v.emoji?{emoji:v.emoji}:{},...v.color?{color:v.color}:{},...v.imageUrl?{imageUrl:v.imageUrl}:{}}),M=new Map;for(const[v,U]of Object.entries(a??{})){if(v===x)continue;const I=u.get(v);if(!I)continue;const de=M.get(U);de?de.push(f(I)):M.set(U,[f(I)])}return T.map(v=>{const U=u.get(v.authorId),I=M.get(v.id);return{id:v.id,sourceLabel:$n(v),contentType:v.content.type,pinned:v.pinned,unread:(m==null?void 0:m.includes(v.id))??!1,...U?{author:f(U)}:{},...I?{watchers:I}:{}}})},[T,p.data,m,a,x]);It(e,(j==null?void 0:j.id)??null);const qe=h.useMemo(()=>{var u;return(((u=p.data)==null?void 0:u.members)??[]).map(f=>f.author).filter(f=>f.kind==="human"&&f.id!==x).map(f=>({id:f.id,displayName:f.displayName,kind:f.kind,emoji:f.emoji,color:f.color,imageUrl:f.imageUrl}))},[p.data,x]),Qe=N(u=>{if(l===null)return;const f=u.browserHistories[l];return f?f.stack[f.cursor]:void 0}),Xe=h.useCallback(()=>{var u;return((u=_.current)==null?void 0:u.scrollTop)??0},[]),Je=h.useCallback(u=>{const f=_.current;return f?(f.addEventListener("scroll",u,{passive:!0}),()=>f.removeEventListener("scroll",u)):()=>{}},[]);qt({roomId:E,viewerAuthorId:x,documentId:l,url:Qe,readScrollY:Xe,subscribe:Je});const ie=h.useMemo(()=>T.map(u=>u.id).join("\0"),[T]);h.useEffect(()=>{if(!(k===null||y!==null)&&ie.split("\0").includes(k.documentId)){if(k.documentId!==l){o(e,k.documentId);return}k.scrollY!==void 0&&_.current&&(_.current.scrollTop=k.scrollY)}},[k,y,l,ie,o,e]);const Ze=h.useCallback(()=>{j!==null&&(w(!0),d.discussCanvasDocument(e,j.id).then(u=>c(e,u.threadRootEntryId,!1)).catch(u=>{he.error("Couldn’t start a discussion.",{description:pe(u)})}).finally(()=>w(!1)))},[j,d,e,c]),et=ae(n);return t.jsxs(t.Fragment,{children:[!s&&t.jsx(Ue,{view:n,documents:Ye,activeDocumentId:l,onActivate:u=>o(e,u),onClose:u=>void C("Couldn’t take that off the canvas.",()=>g.close(u)),onPin:(u,f)=>void C(f?"Couldn’t pin that.":"Couldn’t unpin that.",()=>g.pin(u,f))}),t.jsx(Dn,{sourceLabel:j==null?void 0:j.sourceLabel,people:n==="browser"?qe:[],following:S,onFollow:z,onStopFollowing:V,onDiscuss:j===null?void 0:Ze,discussing:R}),j&&t.jsx(We,{documentId:j.id},j.id),t.jsx("div",{id:et,ref:_,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!s&&j?{role:"tabpanel","aria-labelledby":re(j.id)}:{},children:j?t.jsx($e,{documentId:j.id,children:t.jsx(Ln,{roomId:e,document:j,onUpdate:(u,f)=>C("Couldn’t save that for the room.",()=>g.update(u,f))})},j.id):t.jsx(Le,{view:n,onAction:u=>void C("Couldn’t put that on the canvas.",()=>g.open(u))})})]})}function Ve({view:e}){const n=ke(),s=N(c=>c.openDocuments),r=N(c=>e==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),l=N(c=>c.activateCanvasDocument),m=N(c=>c.closeCanvasDocument),o=N(c=>c.setDocumentContent),i=N(c=>c.openCanvasDocument),a=N(c=>c.applyHeldUpdate),g=N(c=>c.discardHeldUpdate),p=Dt(s,e),d=p.find(c=>c.id===r)??null,x=p.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),y=ae(e);return t.jsxs(t.Fragment,{children:[!n&&t.jsx(Ue,{view:e,documents:x,activeDocumentId:r,onActivate:l,onClose:m}),d&&t.jsx(We,{documentId:d.id},d.id),(d==null?void 0:d.heldUpdate)&&t.jsx(sn,{onReload:()=>a(d.id),onKeepMine:()=>g(d.id)}),t.jsx("div",{id:y,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!n&&d?{role:"tabpanel","aria-labelledby":re(d.id)}:{},children:d?t.jsx($e,{documentId:d.id,children:t.jsx(Re,{documentId:d.id,content:d.content,onContentChange:c=>o(d.id,c)})},d.id):t.jsx(Le,{view:e,onAction:i})})]})}function ds(){const e=N(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(Ke,{roomId:e,view:"canvas"}):t.jsx(Ve,{view:"canvas"})})}function us(){const e=N(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(Ke,{roomId:e,view:"browser"}):t.jsx(Ve,{view:"browser"})})}export{us as BrowserContent,ds as CanvasContent,ps as CanvasWidgetContent,fs as resetSessionCanvasImport,xs as useDevtoolsBridge,gs as useDocChannel,vs as useSessionCanvas};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a1 as wo,r as q,
|
|
1
|
+
import{a1 as wo,r as q,hu as Ka,he as qa,j as ne,G as $s,hv as bo,X as Va,f as Ya,aY as Ur,hw as Ga,gP as ja,hx as hs,B as Xa}from"./index-DKTd8X7n.js";import{u as Za}from"./use-roving-tab-list-BzsrpjWV.js";const Ja="dork.terminal.tabs",Fi=new Map;function Qa(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 eh(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`${Ja}:${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,4 +1,4 @@
|
|
|
1
|
-
import{W as Se,
|
|
1
|
+
import{W as Se,aU as Me,a1 as ne,r as s,jc as Ie,jd as Q,je as G,jf as H,g9 as le,jg as Ce,a7 as J,jh as ee,as as lt,ji as it,a3 as oe,jj as ct,jk as dt,jl as ut,jm as ft,aY as Te,jn as ht,j as e,x as Fe,T as pt,C as Ke,aq as mt,es as be,jo as xt,G as Pe,jp as gt,jq as yt,jr as vt,js as Z,jt as ue,fX as fe,fY as he,fZ as pe,f_ as me,f$ as xe,g0 as ge,g1 as ye,g2 as ve,B as W,b8 as Ct,ez as _e,ju as bt,jv as jt,a2 as ce,jw as He,dX as kt,jx as wt,jy as Et,jz as Dt,jA as Nt,aP as De,jB as Ue,a4 as Rt,g7 as St,a0 as Tt,hf as Ft,ec as Pt,gX as Ot,jC as Mt,cT as _t,cU as At,cW as Lt,cX as zt,cY as $t,dU as It,I as Kt,dB as Ht}from"./index-DKTd8X7n.js";import{t as ae,g as Ut,C as qt,n as qe,r as Qe,a as Qt,p as Bt,F as Yt,w as Wt,c as Be,b as Gt}from"./room-files-source-aN4p_kDV.js";import{N as rs,R as os}from"./room-files-source-aN4p_kDV.js";import{d as Vt}from"./query-keys-DeYqUDia.js";import{r as Xt,c as Zt}from"./composer-insert-BpyATrmR.js";import{u as Jt}from"./index-B0jt7Nng.js";import{r as Ye,h as We,F as en}from"./file-drag-GDx2qhdk.js";import{R as Ge}from"./rotate-cw-mHsqEte-.js";import{L as tn}from"./link-2-CljREnN9.js";import{F as Ve}from"./file-C-ooqbRY.js";import{G as Xe}from"./git-branch-D5xr7U5P.js";import{M as nn}from"./more-details-DRPervoL.js";import"./markdown-content-CN_dGlgE.js";import"./file-exclamation-point-BWWgLsMF.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,5 +13,5 @@ import{W as Se,aR as Me,a1 as ne,r as s,iJ as Ie,iK as Q,iL as G,iM as H,gn as i
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const an=Se(tt);function le(t,n,a){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?a:null]}function ke(t,n,a,x){return{queryKey:le(t,n,a),queryFn:()=>t.list(n,{showHidden:a}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:p=>p??x.getQueryData(le(t,n,!a))}}const rn=[".git",".dork",".claude",".agents","node_modules"];function on(t){return t.startsWith(".")||rn.includes(t)}const Ne=["ROOM.md","README.md"];function Re(t){return Ne.some(n=>n.toLowerCase()===t.toLowerCase())}function nt(t){return t.filter(n=>!on(n.name))}function ln(t){if(t.reduce((p,c)=>c.type==="file"&&Re(c.name)?p+1:p,0)===0)return t;const a=[],x=[];for(const p of t)p.type==="file"&&Re(p.name)?a.push(p):x.push(p);return a.sort((p,c)=>Ne.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Ne.findIndex(o=>o.toLowerCase()===c.name.toLowerCase())),[...a,...x]}const cn=/ copy(?: \d+)?$/;function Oe({name:t,isDir:n,taken:a}){const x=new Set(a);if(!x.has(t))return t;const p=n?-1:t.lastIndexOf("."),c=p>0,o=c?t.slice(p):"",m=(c?t.slice(0,p):t).replace(cn,"");for(let r=1;;r+=1){const i=r===1?`${m} copy${o}`:`${m} copy ${r}${o}`;if(!x.has(i))return i}}function Ae(t,n,a){return{name:n,path:t,type:a,size:0,mtime:Date.now(),isSymlink:!1}}function dn(t){const n=ne(),{source:a,showHidden:x,queryClient:p,inFlightRef:c}=t,o=a.cwd??"",[m,r]=s.useState(null),i=s.useCallback(async h=>{c.current+=1;try{return await h()}finally{c.current-=1}},[c]),u=s.useMemo(()=>{const h=g=>le(a,g,x);return{getChildren:g=>{var w;return((w=p.getQueryData(h(g)))==null?void 0:w.entries)??[]},isLoaded:g=>p.getQueryData(h(g))!==void 0,takenNames:async g=>(await n.readFileTree(o,{path:g===Q?void 0:g,showHidden:!0})).entries.map(b=>b.name),snapshot:g=>p.getQueryData(h(g)),setChildren:(g,w)=>{p.setQueryData(h(g),b=>({entries:Ie(w((b==null?void 0:b.entries)??[]))}))},restore:(g,w)=>{p.setQueryData(h(g),w)},invalidate:g=>{p.invalidateQueries({queryKey:h(g),exact:!0}),p.invalidateQueries({queryKey:Vt.index(o)})}}},[p,n,o,a,x]),N=s.useCallback((h,g,w)=>i(async()=>{const b=ee(h,g),S=!u.getChildren(h).some(A=>A.path===b),K=u.snapshot(h);S&&u.setChildren(h,A=>[...A,Ae(b,g,w)]);try{return await n.createEntry(o,b,w),!0}catch(A){return S&&u.restore(h,K),ae(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,i]),F=s.useCallback((h,g)=>i(async()=>{if(g===h.name||g.length===0)return!0;const w=G(h.path),b=ee(w,g),S=u.getChildren(w).some(_=>_.path===b),K=u.snapshot(w),A={...h,name:g,path:b};S||u.setChildren(w,_=>_.map($=>$.path===h.path?A:$));try{return await n.renameEntry(o,h.path,b),H.getState().remapExpandedPaths(h.path,b),!0}catch(_){return S||u.restore(w,K),ae(_,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,i]),D=s.useCallback(h=>i(async()=>{const g=G(h.path),w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}}),[n,o,u,i]),L=s.useCallback(h=>i(async()=>{const g=G(h.path);if(h.type==="file"){const w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}return}try{await n.deleteEntry(o,h.path),u.setChildren(g,w=>w.filter(b=>b.path!==h.path)),H.getState().dropExpandedPaths(h.path),u.invalidate(g)}catch(w){if(Ut(w)==="DIR_NOT_EMPTY"){r(h);return}ae(w,"Couldn’t delete")}}),[n,o,u,i]),C=s.useCallback(async()=>{const h=m;r(null),h&&await D(h)},[m,D]),U=s.useCallback(()=>r(null),[]),I=s.useCallback((h,g)=>i(async()=>{const w=G(h),b=ie(h),S=ee(g,b);if(g===w||S===h||Ce(g,h))return;const K=u.getChildren(w).find(v=>v.path===h);if(!K)return;const A=u.isLoaded(g),_=A&&u.getChildren(g).some(v=>v.path===S),$={...K,name:b,path:S},W=u.snapshot(w),P=A?u.snapshot(g):void 0;u.setChildren(w,v=>v.filter(z=>z.path!==h)),A&&!_&&u.setChildren(g,v=>[...v,$]);try{await n.renameEntry(o,h,S),H.getState().remapExpandedPaths(h,S)}catch(v){u.restore(w,W),A&&!_&&u.restore(g,P),ae(v,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(g)}}),[n,o,u,i]),k=s.useCallback((h,g)=>i(async()=>{if(h.isDir&&Ce(g,h.path)){J.error(qt);return}let w;try{w=await u.takenNames(g)}catch(_){ae(_,"Couldn’t copy");return}const b=Oe({name:ie(h.path),isDir:h.isDir,taken:w}),S=ee(g,b),K=u.isLoaded(g),A=K?u.snapshot(g):void 0;if(K){const _=u.getChildren(G(h.path)).find(W=>W.path===h.path),$=_?{..._,name:b,path:S}:Ae(S,b,h.isDir?"dir":"file");u.setChildren(g,W=>[...W,$])}try{await n.copyEntry(o,h.path,S)}catch(_){K&&u.restore(g,A),ae(_,"Couldn’t copy")}finally{u.invalidate(g)}}),[n,o,u,i]);return{createEntry:N,renameEntry:F,removeEntry:L,moveEntry:I,copyEntry:k,pendingRecursiveDelete:m,confirmRecursiveDelete:C,cancelRecursiveDelete:U}}function un(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function fn(t,n){const a=t.includes("\\")&&!t.includes("/"),x=t.replace(/[\\/]+$/,""),p=a?n.split("/").join("\\"):n;return`${x}${a?"\\":"/"}${p}`}function hn(t){const n=ne(),{data:a}=it(),x=s.useMemo(()=>n.supportsReveal?un(a==null?void 0:a.platform):null,[n.supportsReveal,a==null?void 0:a.platform]),p=s.useCallback(async i=>{if(t)try{await n.revealEntry(t,i.path)}catch(u){ae(u,"Couldn’t open the file manager")}},[n,t]),{copy:c}=lt(),o=s.useCallback(async(i,u)=>{const N=u==="absolute"&&t?fn(t,i.path):i.path;await c(N)||J.error("Couldn’t copy to the clipboard")},[t,c]),m=s.useCallback(i=>{Xt(Zt(i.path))||J.error("Open a chat to add this file")},[]),r=s.useCallback(i=>{H.getState().setClipboard({path:i.path,isDir:i.type==="dir"});try{navigator.clipboard.writeText(i.path).catch(()=>{})}catch{}},[]);return{revealLabel:x,reveal:p,copyPath:o,addToChat:m,copyToClipboard:r}}const pn=1e3;function mn(t){const{source:n,showHidden:a,queryClient:x,inFlightRef:p}=t,c=n.changes,[o,m]=s.useState(null),[r,i]=s.useState(null),[u,N]=s.useState(null),[F,D]=s.useState(0),L=s.useCallback(async d=>{p.current+=1,D(f=>f+1);try{return await d()}finally{p.current-=1,D(f=>f-1)}},[p]),C=s.useMemo(()=>{const d=f=>le(n,f,a);return{listing:f=>x.getQueryData(d(f)),isLoaded:f=>x.getQueryData(d(f))!==void 0,entries:f=>{var T;return((T=x.getQueryData(d(f)))==null?void 0:T.entries)??[]},setEntries:(f,T)=>x.setQueryData(d(f),y=>({...y,entries:Ie(T((y==null?void 0:y.entries)??[]))})),restore:(f,T)=>x.setQueryData(d(f),T),fetch:f=>n.list(f,{showHidden:!0}),refreshAll:()=>{x.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),x.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[x,n,a]),U=s.useCallback(async d=>{const f=C.listing(d);return(f==null?void 0:f.commit)!==void 0?f.commit:(await C.fetch(d)).commit??null},[C]),I=s.useCallback((d,f,T,y)=>{switch(d.status){case"changed":return!0;case"conflict":return N({kind:f,path:d.path,lastCommit:d.lastCommit,retry:()=>T(d.commit)}),!1;case"exists":return J.error(y===void 0?d.reason:qe(y)),!1;case"refused":return J.error(d.reason),!1}},[]),k=s.useCallback((d,f)=>{J.error(Qe(d)??f)},[]),h=s.useCallback((d,f,T)=>{const y=O=>L(async()=>{if(c===void 0)return!1;const E=G(d.path),R=G(f),j=ie(f),q=C.isLoaded(R),te=q&&C.entries(R).some(X=>X.path===f),V=C.listing(E),de=R===E?void 0:C.listing(R),l={...d,name:j,path:f};te||(R===E?C.setEntries(E,X=>X.map(se=>se.path===d.path?l:se)):(C.setEntries(E,X=>X.filter(se=>se.path!==d.path)),q&&C.setEntries(R,X=>[...X,l])));const M=()=>{C.restore(E,V),R!==E&&q&&C.restore(R,de)};try{const X=O??await U(E);if(X===null)return M(),J.error("This room has no files to change yet."),!1;const se=await c.move({from:d.path,to:f,baseCommit:X}),we=I(se,T,async re=>{await y(re)},j);return we?H.getState().remapExpandedPaths(d.path,f):M(),we}catch(X){return M(),k(X,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{C.refreshAll()}});return y(null)},[c,C,L,U,I,k]),g=s.useCallback(async(d,f)=>f===d.name||f.length===0?!0:h(d,ee(G(d.path),f),"rename"),[h]),w=s.useCallback(async(d,f)=>{const T=G(d),y=ee(f,ie(d));if(f===T||y===d||Ce(f,d))return;const O=C.entries(T).find(E=>E.path===d);O&&await h(O,y,"move")},[C,h]),b=s.useCallback(async d=>{let f=0;const T=[d];for(;T.length>0;){const y=T.shift(),O=await C.fetch(y);for(const E of O.entries)if(E.type==="dir"?T.push(E.path):f+=1,f>=pn)return{count:f,moreThan:!0}}return{count:f,moreThan:!1}},[C]),S=s.useCallback(d=>{if(d.type!=="dir"){m({entry:d,fileCount:1,moreThan:!1});return}m({entry:d,fileCount:null,moreThan:!1}),b(d.path).then(({count:f,moreThan:T})=>m(y=>(y==null?void 0:y.entry.path)===d.path?{entry:d,fileCount:f,moreThan:T}:y),()=>{})},[b]),K=s.useCallback(d=>{const f=T=>L(async()=>{if(c===void 0)return;const y=G(d.path),O=C.listing(y);C.setEntries(y,E=>E.filter(R=>R.path!==d.path));try{const E=T??await U(y);if(E===null){C.restore(y,O);return}const R=await c.remove({path:d.path,baseCommit:E});I(R,"delete",q=>f(q))?H.getState().dropExpandedPaths(d.path):C.restore(y,O)}catch(E){C.restore(y,O),k(E,"Couldn’t delete")}finally{C.refreshAll()}});return f(null)},[c,C,L,U,I,k]),A=s.useCallback(async()=>{const d=o;m(null),d&&await K(d.entry)},[o,K]),_=s.useCallback(()=>m(null),[]),$=s.useCallback((d,f,T,y)=>{const O=E=>L(async()=>{if(c===void 0)return;const R=C.isLoaded(d),j=R?C.listing(d):void 0;if(R){const q=new Set(C.entries(d).map(V=>V.name)),te=f.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(d,V.name),type:"file",size:V.size}));te.length>0&&C.setEntries(d,V=>[...V,...te])}try{const q=await c.upload({dir:d,baseCommit:E,replace:T,files:f});!I(q,"upload",V=>O(V))&&R&&C.restore(d,j)}catch(q){R&&C.restore(d,j),k(q,"Couldn’t upload")}finally{C.refreshAll()}});return O(y)},[c,C,L,I,k]),W=s.useCallback(async(d,f)=>{if(c===void 0||f.length===0)return;if(f.length>c.maxUploadFiles){J.error(`Nothing was uploaded. One upload takes up to ${c.maxUploadFiles} files.`);return}let T;try{T=await C.fetch(d)}catch(j){k(j,"Couldn’t upload");return}const y=T.entries.map(j=>j.name),O=new Set(y),E=f.map(j=>j.name).filter(j=>O.has(j)),R=T.commit??null;if(E.length===0){await $(d,f,[],R);return}i({dir:d,files:f,names:E,taken:y,baseCommit:R})},[c,C,k,$]),P=s.useCallback(async d=>{const f=r;if(i(null),f===null)return;if(d==="replace"){await $(f.dir,f.files,f.names,f.baseCommit);return}const T=new Set([...f.taken,...f.files.map(E=>E.name)]),y=new Set(f.names),O=f.files.map(E=>{if(!y.has(E.name))return E;const R=Oe({name:E.name,isDir:!1,taken:T});return T.add(R),new File([E],R,{type:E.type,lastModified:E.lastModified})});await $(f.dir,O,[],f.baseCommit)},[r,$]),v=s.useCallback(()=>i(null),[]),z=s.useCallback(()=>N(null),[]),B=s.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:g,moveEntry:w,requestDelete:S,pendingDelete:o,confirmDelete:A,cancelDelete:_,upload:W,pendingClash:B,resolveClash:P,cancelClash:v,conflict:u,dismissConflict:z,busy:F>0}}const Le={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function xn(t){var d,f,T;const n=ne(),a=oe(),{setTheme:x}=ct(),p=H(y=>y.showHidden),c=H(y=>y.expanded),o=H(y=>y.loadExplorerForCwd),m=H(y=>y.pruneMissing),r=(t==null?void 0:t.scopeKey)??null,i=(t==null?void 0:t.cwd)??null;s.useEffect(()=>{o(r)},[r,o]);const u=s.useMemo(()=>[Q,...dt(c)],[c]),N=ut({queries:t?u.map(y=>ke(t,y,p,a)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,D=s.useMemo(()=>{const y={};return u.forEach((O,E)=>{var q;const R=N[E];let j=((q=R==null?void 0:R.data)==null?void 0:q.entries)??[];!p&&!F&&(j=nt(j)),O===Q&&(j=ln(j)),y[O]={entries:j,loading:(R==null?void 0:R.isLoading)??!1,error:(R==null?void 0:R.isError)??!1}}),y},[u,N,p,F]),L=s.useRef(0),C=s.useRef({});s.useEffect(()=>{L.current>0||u.forEach((y,O)=>{var R,j,q;const E=(j=(R=N[O])==null?void 0:R.data)==null?void 0:j.entries;!E||(q=N[O])!=null&&q.isError||C.current[y]!==E&&(C.current[y]=E,m(y,E.map(te=>te.name)))})},[u,N,m]);const U=s.useMemo(()=>ft(c,D),[c,D]),I=!!t&&!!((d=D[Q])!=null&&d.loading),k=!!t&&!!((f=D[Q])!=null&&f.error),h=(T=N[0])==null?void 0:T.error,g=k&&h?Qt(h):void 0,w=(g==null?void 0:g.message)??null,b=(g==null?void 0:g.command)??null,S=s.useMemo(()=>{var O;const y=new Set;for(const E of u)E!==Q&&((O=D[E])!=null&&O.error)&&y.add(E);return y},[u,D]),K=s.useCallback(y=>{if(y.type!=="dir")return;const O=H.getState();O.setDirExpanded(y.path,!O.expanded[y.path])},[]),A=s.useCallback(y=>{if(y===Q)return;const O=H.getState();O.expanded[y]||O.setDirExpanded(y,!0)},[]),_=(t==null?void 0:t.preview)==="canvas",$=s.useCallback(y=>{if(y.type!=="file"||!_)return;const O={getStore:Te.getState,setTheme:x,supportsTerminal:n.supportsTerminal};ht(O,{action:"open_file",sourcePath:y.path},"user")},[_,x,n]),W=s.useCallback(()=>{r!==null&&a.invalidateQueries({queryKey:["file-explorer","tree",r]})},[a,r]),P=s.useCallback(y=>{t!==null&&a.invalidateQueries({queryKey:le(t,y,p),exact:!0})},[a,t,p]);s.useEffect(()=>{if(t!=null&&t.events)return t.events(W)},[t,W]);const v=dn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),z=mn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),B=hn(i);return{rows:U,rootLoading:I,rootError:k,rootErrorMessage:w,rootErrorCommand:b,errorPaths:S,toggleExpand:K,ensureExpanded:A,openFile:$,reload:W,retryDir:P,changes:t!=null&&t.changes?z:null,...v,...B}}function gn(t){const{transport:n,cwd:a}=t;return{scopeKey:a,cwd:a,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(x,p){return n.readFileTree(a,{path:x===""?void 0:x,showHidden:p.showHidden})}}}function je(t){return Array.from(t).includes("Files")}function st(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(c=>"webkitGetAsEntry"in c)))return{files:Array.from(t.files??[]),folders:0};const x=[];let p=0;for(const c of n){if(c.kind!=="file")continue;const o=c.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const m=c.getAsFile();m&&x.push(m)}return{files:x,folders:p}}const yn=12;function vn({row:t,selected:n,renaming:a,error:x,onSelect:p,onActivate:c,onRetry:o,onSubmitRename:m,onCancelRename:r,onNewFile:i,onNewFolder:u,onStartRename:N,onDelete:F,onMove:D,onCopyInto:L,onCopy:C,onPaste:U,onDuplicate:I,canPasteInto:k,revealLabel:h,onReveal:g,onAddToChat:w,onCopyPath:b,readOnly:S=!1,provenance:K=!1,copyable:A=!0,onDisk:_=!0,onUpload:$,onPickUpload:W}){const{entry:P,depth:v,expanded:z,loading:B}=t,d=P.type==="dir",f=d?P.path:G(P.path),[T,y]=s.useState(!1),O=!d&&v===0&&Re(P.name),E=Bt(P.lastCommit),R=e.jsxs("div",{role:"treeitem","aria-label":P.name,"aria-expanded":d?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(P),c(P))},draggable:!a&&!S,onDragStart:j=>{S||(j.dataTransfer.setData("text/plain",P.path),j.dataTransfer.setData(en,P.path),j.dataTransfer.effectAllowed="copyMove")},onDragOver:j=>{if(j.stopPropagation(),!S&&$&&je(j.dataTransfer.types)){j.preventDefault(),j.dataTransfer.dropEffect="copy",y(!0);return}S||!d||!Ye(j.dataTransfer.types)||(j.preventDefault(),j.dataTransfer.dropEffect=j.altKey&&A?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:j=>{if(j.stopPropagation(),S)return;if(y(!1),$&&je(j.dataTransfer.types)){j.preventDefault();const{files:te}=st(j.dataTransfer);$(f,te);return}if(!d)return;const q=We(j.dataTransfer);q!==null&&(j.preventDefault(),j.altKey&&A?L(q,P.path):D(q,P.path))},onClick:()=>{p(P),c(P)},className:Pe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:v*yn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):x?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:j=>{j.stopPropagation(),o()},className:"flex items-center justify-center",children:e.jsx(Ge,{className:"text-destructive size-3.5"})}):z?e.jsx(pt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ke,{className:"text-muted-foreground size-3.5"}))}),d?z?e.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):P.isSymlink===!0?e.jsx(tn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),a?e.jsx(Cn,{initialName:P.name,onSubmit:j=>m(P,j),onCancel:r}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),O&&!a&&e.jsx(xt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),K&&!a&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:E.title??void 0,children:E.label})]});return S?R:e.jsxs(gt,{children:[e.jsx(yt,{asChild:!0,children:R}),e.jsxs(vt,{className:"w-52",children:[e.jsx(Z,{movesFocus:!0,onClick:()=>i(f),children:"New file"}),e.jsx(Z,{movesFocus:!0,onClick:()=>u(f),children:"New folder"}),W&&e.jsx(Z,{onClick:()=>W(f),children:"Upload files…"}),_&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),h&&e.jsx(Z,{onClick:()=>g(P),children:h}),e.jsx(Z,{movesFocus:!0,onClick:()=>w(P),children:"Add to chat"})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),e.jsx(Z,{onClick:()=>C(P),children:"Copy"}),e.jsx(Z,{disabled:!k(f),onClick:()=>U(f),children:"Paste"}),e.jsx(Z,{onClick:()=>I(P),children:"Duplicate"})]}),e.jsx(ue,{}),_?e.jsxs(e.Fragment,{children:[e.jsx(Z,{onClick:()=>b(P,"absolute"),children:"Copy path"}),e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy relative path"})]}):e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy path"}),e.jsx(ue,{}),e.jsx(Z,{movesFocus:!0,onClick:()=>N(P),children:"Rename"}),e.jsx(Z,{variant:"destructive",onClick:()=>F(P),children:"Delete"})]})]})}function Cn({initialName:t,onSubmit:n,onCancel:a}){const x=s.useRef(null),[p,c]=s.useState(t);s.useEffect(()=>{const m=x.current;if(!m)return;m.focus();const r=t.lastIndexOf(".");m.setSelectionRange(0,r>0?r:t.length)},[t]);const o=()=>{const m=p.trim();m&&m!==t?n(m):a()};return e.jsx("input",{ref:x,type:"text",value:p,"aria-label":"New name",onChange:m=>c(m.target.value),onClick:m=>m.stopPropagation(),onBlur:o,onKeyDown:m=>{m.stopPropagation(),m.key==="Enter"?o():m.key==="Escape"&&a()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const bn=100,jn=28,kn=250;function wn(t){const{rows:n,selectedPath:a,renamingPath:x,errorPaths:p,onSelectPath:c,onRetryDir:o}=t,m=s.useRef(null),r=H(v=>v.setScrollTop),i=H(v=>v.scopeKey),u=s.useCallback(v=>v.type==="dir"?t.onToggle(v):t.onOpen(v),[t]),N=Dn(t,u),F=n.length>bn,D=Jt({count:n.length,getScrollElement:()=>m.current,estimateSize:()=>jn,overscan:12,enabled:F}),L=s.useRef({scope:void 0,done:!1}),C=s.useRef(null);s.useLayoutEffect(()=>{const v=L.current;if(v.scope!==i&&(v.scope=i,v.done=!1),v.done||n.length===0)return;const z=m.current;if(!z)return;const B=H.getState().scrollTop;if(B<=0){v.done=!0;return}F?D.scrollToOffset(B):z.scrollTop=B,C.current=z.scrollTop,z.scrollTop>=B&&(v.done=!0)},[n.length,i,F,D]);const U=s.useRef(null),I=s.useRef(null),k=s.useCallback(()=>{const v=m.current;v&&v.scrollTop!==C.current&&(L.current.done=!0,U.current=v.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,U.current!==null&&r(U.current)},kn))},[r]);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),U.current!==null&&r(U.current)},[r]);const h=s.useRef(void 0);s.useEffect(()=>{var d,f;const v=h.current;if(h.current=a,v===void 0||a===v||a===null)return;const z=n.findIndex(T=>T.entry.path===a);if(z<0)return;const B=m.current;B&&(F?D.scrollToIndex(z,{align:"auto"}):(f=(d=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:d.scrollIntoView)==null||f.call(d,{block:"nearest"}),C.current=B.scrollTop)},[a,n,F,D]);const[g,w]=s.useState(!1),{onCopyInto:b,onMove:S}=t,K=t.readOnly===!0,A=t.copyable!==!1,_=s.useCallback(v=>{K||!Ye(v.dataTransfer.types)||(v.preventDefault(),v.dataTransfer.dropEffect=v.altKey&&A?"copy":"move",w(!0))},[K,A]),$=s.useCallback((v,z)=>{const B=n.find(d=>d.entry.path===v);B&&b({path:v,isDir:B.entry.type==="dir"},z)},[n,b]),W=s.useCallback(v=>{if(w(!1),K)return;const z=We(v.dataTransfer);z!==null&&(v.preventDefault(),v.altKey&&A?$(z,Q):S(z,Q))},[$,S,K,A]),P=v=>e.jsx(vn,{row:v,selected:v.entry.path===a,renaming:v.entry.path===x,error:v.entry.type==="dir"&&v.expanded&&p.has(v.entry.path),onSelect:z=>c(z.path),onActivate:u,onRetry:()=>o(v.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:$,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:m,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:N,onScroll:k,onDragOver:_,onDragLeave:()=>w(!1),onDrop:W,className:Pe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",g&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:D.getTotalSize()},className:"relative w-full",children:D.getVirtualItems().map(v=>e.jsx("div",{"data-row-index":v.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${v.start}px)`},children:P(n[v.index])},n[v.index].entry.path))}):n.map((v,z)=>e.jsx("div",{"data-row-index":z,children:P(v)},v.entry.path))})}function En(t){return t?t.type==="dir"?t.path:G(t.path):Q}function Dn(t,n){const{rows:a,selectedPath:x,renamingPath:p,onSelectPath:c}=t;return s.useCallback(o=>{var i,u,N,F;if(p!==null)return;const m=a.findIndex(D=>D.entry.path===x),r=m>=0?a[m]:void 0;if(o.metaKey||o.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const D=o.key.toLowerCase();if(D==="c"&&r){o.preventDefault(),t.onCopy(r.entry);return}if(D==="v"){o.preventDefault(),t.onPaste(En(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),c(((i=a[Math.min(m+1,a.length-1)])==null?void 0:i.entry.path)??((u=a[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),c(((N=a[Math.max(m-1,0)])==null?void 0:N.entry.path)??((F=a[0])==null?void 0:F.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),t.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)t.onToggle(r.entry);else{const D=G(r.entry.path);D&&c(D)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&t.readOnly!==!0&&(o.preventDefault(),t.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&t.readOnly!==!0&&(o.preventDefault(),t.onDelete(r.entry));break}},[a,x,p,c,t,n])}const Nn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Rn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Sn(t){const{entry:n,fileCount:a,moreThan:x}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const p=a===null?"everything in it":x?`the more than ${a.toLocaleString()} files in it`:a===1?"the 1 file in it":`the ${a.toLocaleString()} files in it`;return`“${n.name}” and ${p} leave the room’s files.`}const Tn="The room’s history keeps a copy. An agent can restore it.";function Fn({changes:t,onOpenTheirs:n,onReturnFocus:a}){var D;const x=L=>{L.preventDefault();const C=document.activeElement;C!==null&&C!==document.body||a()},{pendingDelete:p,pendingClash:c,conflict:o}=t,[m,r]=s.useState(p);p!==null&&p!==m&&r(p);const[i,u]=s.useState(c);c!==null&&c!==i&&u(c);const N=i===null?"":i.dir===Q?"The top folder":`“${i.dir}”`,F=(i==null?void 0:i.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(fe,{open:p!==null,onOpenChange:L=>!L&&t.cancelDelete(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:m===null?"":`Delete “${m.entry.name}”?`}),e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:m===null?"":Sn(m)}),e.jsx("p",{children:Tn})]})})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(m==null?void 0:m.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(fe,{open:c!==null,onOpenChange:L=>!L&&t.cancelClash(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:F?`Replace “${i==null?void 0:i.names[0]}”?`:`Replace ${(i==null?void 0:i.names.length)??0} files?`}),e.jsx(xe,{children:F?`${N} already has a file with this name. Replace it, or keep both.`:`${N} already has files named ${(i==null?void 0:i.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ve,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(fe,{open:o!==null,onOpenChange:L=>!L&&t.dismissConflict(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:"Somebody changed this first"}),e.jsx(xe,{children:o===null?"":`${((D=o.lastCommit)==null?void 0:D.author)??"Somebody"} changed “${o.path}” after you opened it, so ${Rn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",Ct(o.lastCommit.at)]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(Y,{variant:"outline",onClick:()=>{o!==null&&(t.dismissConflict(),n(o.path))},children:"Open their version"}),e.jsx(ve,{onClick:()=>{o!==null&&(t.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":Nn[o.kind]})]})]})})]})}function ze(t,n){return n.name===t?qe(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function On({source:t,className:n,onCommands:a}={}){var de;const x=ne(),p=Te(l=>l.selectedCwd),c=s.useMemo(()=>p?gn({transport:x,cwd:p}):null,[x,p]),o=t===void 0?c:t,m=o!==null&&!o.writable,r=xn(o),i=r.changes,u=oe(),N=H(l=>l.showHidden),{rows:F,rootLoading:D,rootError:L,rootErrorMessage:C,rootErrorCommand:U,errorPaths:I}=r,k=H(l=>l.setCommands),h=H(l=>l.selectedPath),g=H(l=>l.setSelectedPath),w=H(l=>l.clipboard),[b,S]=s.useState(null),[K,A]=s.useState(null),[_,$]=s.useState(null),W=s.useCallback(l=>$(l===null?null:{path:l,isNew:!1}),[]),P=s.useRef(null),v=s.useRef(Q),[z,B]=s.useState(!1),d=s.useCallback((l,M)=>{if(i!==null){if(M.length===0){J.error(Pn);return}r.ensureExpanded(l),i.upload(l,M)}},[i,r]),f=s.useRef(null),T=s.useCallback(()=>{var l,M;(M=(l=f.current)==null?void 0:l.querySelector('[role="tree"]'))==null||M.focus()},[]),y=s.useCallback(l=>{var M;v.current=l,(M=P.current)==null||M.click()},[]),O=s.useCallback(l=>w!==null&&!(w.isDir&&Ce(l,w.path)),[w]),E=s.useCallback((l,M)=>{r.ensureExpanded(l),_e.flushSync(()=>{A(null),S({parent:l,type:M})})},[r]),R=s.useCallback(l=>{_e.flushSync(()=>A(l.path))},[]),j=s.useRef({startCreate:E,reload:r.reload,pickUpload:y});s.useEffect(()=>{j.current={startCreate:E,reload:r.reload,pickUpload:y}});const q=i!==null;s.useEffect(()=>{if(m||a===void 0&&q)return;const l=a??k;return l({newFile:()=>j.current.startCreate(Q,"file"),newFolder:()=>j.current.startCreate(Q,"dir"),refresh:()=>j.current.reload(),...q&&{upload:()=>j.current.pickUpload(Q)}}),()=>l(null)},[k,a,m,q]);const te=s.useCallback(async l=>{var se;if(!b||o===null)return;const M=b;if(S(null),i!==null){const re=(((se=u.getQueryData(le(o,M.parent,N)))==null?void 0:se.entries)??[]).find(ot=>ot.name.toLowerCase()===l.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===l)){J.error(ze(l,re));return}S({parent:ee(M.parent,l),type:"file",firstInFolder:l});return}if(re!==void 0){J.error(ze(l,re));return}const rt=ee(M.parent,l);$({path:rt,isNew:!0});return}await r.createEntry(M.parent,l,M.type)&&g(ee(M.parent,l))},[b,o,i,u,N,r,g]),V=s.useCallback(async(l,M)=>{A(null),(i?await i.renameEntry(l,M):await r.renameEntry(l,M))&&g(ee(G(l.path),M))},[i,r,g]);return o===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:f,className:Pe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:l=>{i===null||!je(l.dataTransfer.types)||(l.preventDefault(),l.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:l=>{l.currentTarget.contains(l.relatedTarget)||B(!1)},onDrop:l=>{B(!1),!(i===null||!je(l.dataTransfer.types))&&(l.preventDefault(),d(Q,st(l.dataTransfer).files))},children:[i!==null&&e.jsx("input",{ref:P,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:l=>{const M=Array.from(l.target.files??[]);l.target.value="",d(v.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(Mn,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:l=>void te(l),onCancel:()=>S(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),D&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):L&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:C??"Couldn’t load files."}),U!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:U}),e.jsxs(Y,{variant:"outline",size:"xs",onClick:r.reload,children:[e.jsx(Ge,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:i!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(wn,{rows:F,selectedPath:h,renamingPath:K,errorPaths:I,onSelectPath:g,onToggle:r.toggleExpand,onOpen:l=>{o.preview==="inline"?W(l.path):r.openFile(l)},onRetryDir:r.retryDir,onSubmitRename:(l,M)=>void V(l,M),onCancelRename:()=>A(null),onStartRename:R,onNewFile:l=>E(l,"file"),onNewFolder:l=>E(l,"dir"),onDelete:l=>i?i.requestDelete(l):void r.removeEntry(l),onMove:(l,M)=>void(i?i.moveEntry(l,M):r.moveEntry(l,M)),onCopyInto:(l,M)=>void r.copyEntry(l,M),onCopy:r.copyToClipboard,onPaste:l=>{w&&r.copyEntry(w,l)},onDuplicate:l=>void r.copyEntry({path:l.path,isDir:l.type==="dir"},G(l.path)),canPasteInto:O,readOnly:m,provenance:o.provenance,copyable:i===null,onDisk:o.cwd!==null,onUpload:i?d:void 0,onPickUpload:i?y:void 0,revealLabel:r.revealLabel,onReveal:l=>void r.reveal(l),onAddToChat:r.addToChat,onCopyPath:(l,M)=>void r.copyPath(l,M)})]}),o.preview==="inline"&&e.jsx(Wt,{source:o,path:(_==null?void 0:_.path)??null,isNew:(_==null?void 0:_.isNew)??!1,onCreated:()=>{_!==null&&($({path:_.path,isNew:!1}),g(_.path))},onClose:()=>$(null)}),i!==null&&e.jsx(Fn,{changes:i,onOpenTheirs:l=>W(l),onReturnFocus:T}),e.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:l=>!l&&r.cancelRecursiveDelete(),children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(me,{children:["Delete “",(de=r.pendingRecursiveDelete)==null?void 0:de.name,"”?"]}),e.jsx(xe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function Mn({type:t,firstInFolder:n,onSubmit:a,onCancel:x}){const p=s.useRef(null),[c,o]=s.useState("");s.useEffect(()=>{var i;(i=p.current)==null||i.focus()},[]);const m=()=>{const i=c.trim();i?a(i):x()},r=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:p,type:"text",value:c,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:i=>o(i.target.value),onBlur:m,onKeyDown:i=>{i.key==="Enter"?m():i.key==="Escape"&&x()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:r}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),r,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function at(){const t=H(x=>x.showHidden),n=H(x=>x.setShowHidden),a=t?"Hide hidden files":"Show hidden files";return e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":a,title:a,onClick:()=>n(!t),children:t?e.jsx(bt,{className:"text-muted-foreground"}):e.jsx(jt,{className:"text-muted-foreground"})})}function _n({cwd:t}){const n=ne(),{data:a}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return a!=null&&a.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${a.key} on ${a.branch}`,children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.branch})]}):null}function es(){const t=Te(a=>a.selectedCwd),n=H(a=>a.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(_n,{cwd:t}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(at,{}),e.jsx(Y,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(kt,{className:"text-muted-foreground"})})]}):null}function An({roomId:t}){const n=ne(),a=oe(),x=ce(Ue(n,t));s.useEffect(()=>Yt(a,t,()=>{a.invalidateQueries({queryKey:De.repoStatus(t)})}),[a,t]);const p=s.useMemo(()=>{var r;return((r=x.data)==null?void 0:r.kind)==="ok"?wt(x.data.status):[]},[x.data]),c=Et(p),o=Dt(p);if(!o)return null;const m=p.map((r,i)=>`${c[i]}: ${Nt(r)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:m.join(`
|
|
17
|
-
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",m.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const Ln={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},zn=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var U,I;const n=ne(),a=oe(),x=ce(Ue(n,t)),[p,c]=s.useState([]),[o,m]=s.useState(!1),[r,i]=s.useState(null),u=Rt({mutationFn:k=>n.repairRoomMain(t,k),onSuccess:()=>{c([]),m(!1),i(null),a.invalidateQueries({queryKey:De.repoStatus(t)})},onError:k=>{m(!1);const h=zn.get(St(k)??"");i(h??"Couldn’t update the files. Try again in a moment."),a.invalidateQueries({queryKey:De.repoStatus(t)})}});if(((U=x.data)==null?void 0:U.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const N=((I=x.data)==null?void 0:I.kind)==="ok"?x.data.status.main:void 0;if(N===void 0||!N.dirty)return null;const F=N.branch!=="main",D=p.filter(k=>N.strays.some(h=>h.path===k)),L=o&&D.length>0,C=k=>c(h=>h.includes(k)?h.filter(g=>g!==k):[...h,k]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Tt,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${N.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(nn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:N.strays.map(k=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ft,{id:`stray-${t}-${k.path}`,checked:D.includes(k.path),onCheckedChange:()=>C(k.path),disabled:u.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${k.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:k.path,children:k.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:Ln[k.kind]})]},k.path))}),N.strayCount>N.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",N.strayCount-N.strays.length," more not shown. “Keep them all” keeps these too."]}),L?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:D.length===1?"Discard this change? It can’t be undone.":`Discard these ${D.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>m(!1),children:"Cancel"}),e.jsx(Y,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...D]}),children:D.length===1?"Discard change":`Discard ${D.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(Y,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||D.length===0,onClick:()=>m(!0),children:D.length===0?"Discard…":`Discard ${D.length}`})]})]}),r!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:r})]})}const Ee="pointer-coarse:size-11";function ts({roomId:t,canChange:n}){const a=ne(),x=oe(),p=H(F=>F.showHidden),[c,o]=s.useState(null),m=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t,canChange:n}),[a,x,t,n]),r=ce(ke(m,Q,p,x)),i=r.isSuccess&&r.data.absent!==!0||r.isError,[u,N]=s.useState(null);return i&&u!==t&&N(t),!i&&u!==t?null:e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Pt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(An,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New file",title:"New file",disabled:c===null,onClick:()=>c==null?void 0:c.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New folder",title:"New folder",disabled:c===null,onClick:()=>c==null?void 0:c.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(Y,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"Upload files",title:"Upload files",disabled:(c==null?void 0:c.upload)===void 0,onClick:()=>{var F;return(F=c==null?void 0:c.upload)==null?void 0:F.call(c)},children:e.jsx(an,{className:"text-muted-foreground"})})]}),e.jsx(at,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(On,{source:m,onCommands:o})})]})}function ns({roomId:t,attachment:n}){var i;const a=ne(),x=oe(),p=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t}),[a,x,t]),c=ce(ke(p,Q,!1,x)),[o,m]=s.useState(!1),r=Ot(t);return!c.isSuccess||c.data.absent===!0||((i=r.data)==null?void 0:i.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(Y,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>m(!0),children:e.jsx(Mt,{})}),o&&e.jsx(In,{roomId:t,source:p,attachment:n,onClose:()=>m(!1)})]})}function In({roomId:t,source:n,attachment:a,onClose:x}){const p=ne(),c=oe(),[o,m]=s.useState(Q),[r,i]=s.useState(a.name),[u,N]=s.useState(null),[F,D]=s.useState(!1),L=s.useId(),C=ce(ke(n,o,!1,c)),U=s.useMemo(()=>{var k;return nt(((k=C.data)==null?void 0:k.entries)??[]).filter(h=>h.type==="dir")},[C.data]),I=async()=>{var h,g;const k=r.trim();if(k!==""){D(!0),N(null);try{await p.saveAttachmentToRoomFiles(t,{attachmentId:a.id,dir:o,name:k,baseCommit:((h=C.data)==null?void 0:h.commit)??null}),c.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${k} to the room’s files`),x()}catch(w){let b;try{b=Gt(w,c,t)}catch{b={status:"refused",reason:Qe(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const S=(((g=C.data)==null?void 0:g.entries)??[]).map(K=>K.name);N({reason:`This folder already has a file called “${k}”. Pick another name.`,suggestion:Oe({name:k,isDir:!1,taken:[...S,k]})})}else b.status==="conflict"?(N({reason:"This folder changed while you chose, so nothing was saved. Try again."}),C.refetch()):b.status==="refused"&&N({reason:b.reason})}finally{D(!1)}}};return e.jsx(_t,{open:!0,onOpenChange:k=>!k&&x(),children:e.jsxs(At,{className:"sm:max-w-md",children:[e.jsxs(Lt,{children:[e.jsx(zt,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(It,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&e.jsx($e,{label:"Up one folder",icon:e.jsx(sn,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>m(G(o))}),C.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):U.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):U.map(k=>e.jsx($e,{label:k.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>m(ee(o,ie(k.path)))},k.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:L,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Kt,{id:L,value:r,onChange:k=>{i(k.target.value),N(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:u.reason}),u.suggestion!==void 0&&e.jsxs(Y,{type:"button",variant:"outline",size:"xs",onClick:()=>{i(u.suggestion),N(null)},children:["Use “",u.suggestion,"”"]})]})]}),e.jsxs(Ht,{className:"gap-2",children:[e.jsx(Y,{type:"button",variant:"ghost",onClick:x,children:"Cancel"}),e.jsx(Y,{type:"button",disabled:F||r.trim()===""||C.isPending,onClick:()=>void I(),children:F?"Saving…":o===Q?"Save to the top folder":`Save to ${ie(o)}`})]})]})})}function $e({label:t,icon:n,chevron:a=!1,onClick:x}){return e.jsxs("button",{type:"button",onClick:x,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),a&&e.jsx(Ke,{className:"text-muted-foreground size-3.5"})]})}export{On as FileExplorer,es as FileExplorerActions,Wt as FilePreviewDialog,rn as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,rs as NO_PROVENANCE,Ne as PINNED_ENTRY_NAMES,os as ROOM_FILES_REFRESH_INTERVAL_MS,ts as RoomFilesSection,ns as SaveToRoomFilesButton,Be as createRoomFilesSource,gn as createSessionCwdSource,le as explorerDirQueryKey,ke as explorerDirQueryOptions,on as isHiddenEntryName,Re as isPinnedEntryName,ln as pinnedFirst,Bt as provenanceLine,Ue as roomRepoStatusQueryOptions,nt as withoutHidden};
|
|
16
|
+
*/const tt={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};tt.node;const an=Se(tt);function ie(t,n,a){return["file-explorer","tree",t.scopeKey,n,t.filtersHidden?a:null]}function ke(t,n,a,x){return{queryKey:ie(t,n,a),queryFn:()=>t.list(n,{showHidden:a}),staleTime:Me.FILE_TREE_STALE_TIME_MS,gcTime:Me.FILE_TREE_GC_TIME_MS,refetchOnWindowFocus:!0,placeholderData:p=>p??x.getQueryData(ie(t,n,!a))}}const rn=[".git",".dork",".claude",".agents","node_modules"];function on(t){return t.startsWith(".")||rn.includes(t)}const Ne=["ROOM.md","README.md"];function Re(t){return Ne.some(n=>n.toLowerCase()===t.toLowerCase())}function nt(t){return t.filter(n=>!on(n.name))}function ln(t){if(t.reduce((p,c)=>c.type==="file"&&Re(c.name)?p+1:p,0)===0)return t;const a=[],x=[];for(const p of t)p.type==="file"&&Re(p.name)?a.push(p):x.push(p);return a.sort((p,c)=>Ne.findIndex(o=>o.toLowerCase()===p.name.toLowerCase())-Ne.findIndex(o=>o.toLowerCase()===c.name.toLowerCase())),[...a,...x]}const cn=/ copy(?: \d+)?$/;function Oe({name:t,isDir:n,taken:a}){const x=new Set(a);if(!x.has(t))return t;const p=n?-1:t.lastIndexOf("."),c=p>0,o=c?t.slice(p):"",m=(c?t.slice(0,p):t).replace(cn,"");for(let r=1;;r+=1){const l=r===1?`${m} copy${o}`:`${m} copy ${r}${o}`;if(!x.has(l))return l}}function Ae(t,n,a){return{name:n,path:t,type:a,size:0,mtime:Date.now(),isSymlink:!1}}function dn(t){const n=ne(),{source:a,showHidden:x,queryClient:p,inFlightRef:c}=t,o=a.cwd??"",[m,r]=s.useState(null),l=s.useCallback(async h=>{c.current+=1;try{return await h()}finally{c.current-=1}},[c]),u=s.useMemo(()=>{const h=g=>ie(a,g,x);return{getChildren:g=>{var w;return((w=p.getQueryData(h(g)))==null?void 0:w.entries)??[]},isLoaded:g=>p.getQueryData(h(g))!==void 0,takenNames:async g=>(await n.readFileTree(o,{path:g===Q?void 0:g,showHidden:!0})).entries.map(b=>b.name),snapshot:g=>p.getQueryData(h(g)),setChildren:(g,w)=>{p.setQueryData(h(g),b=>({entries:Ie(w((b==null?void 0:b.entries)??[]))}))},restore:(g,w)=>{p.setQueryData(h(g),w)},invalidate:g=>{p.invalidateQueries({queryKey:h(g),exact:!0}),p.invalidateQueries({queryKey:Vt.index(o)})}}},[p,n,o,a,x]),N=s.useCallback((h,g,w)=>l(async()=>{const b=ee(h,g),S=!u.getChildren(h).some(A=>A.path===b),K=u.snapshot(h);S&&u.setChildren(h,A=>[...A,Ae(b,g,w)]);try{return await n.createEntry(o,b,w),!0}catch(A){return S&&u.restore(h,K),ae(A,`Couldn’t create ${w==="dir"?"folder":"file"}`),!1}finally{u.invalidate(h)}}),[n,o,u,l]),F=s.useCallback((h,g)=>l(async()=>{if(g===h.name||g.length===0)return!0;const w=G(h.path),b=ee(w,g),S=u.getChildren(w).some(_=>_.path===b),K=u.snapshot(w),A={...h,name:g,path:b};S||u.setChildren(w,_=>_.map($=>$.path===h.path?A:$));try{return await n.renameEntry(o,h.path,b),H.getState().remapExpandedPaths(h.path,b),!0}catch(_){return S||u.restore(w,K),ae(_,"Couldn’t rename"),!1}finally{u.invalidate(w)}}),[n,o,u,l]),D=s.useCallback(h=>l(async()=>{const g=G(h.path),w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path,{recursive:!0}),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}}),[n,o,u,l]),L=s.useCallback(h=>l(async()=>{const g=G(h.path);if(h.type==="file"){const w=u.snapshot(g);u.setChildren(g,b=>b.filter(S=>S.path!==h.path));try{await n.deleteEntry(o,h.path),H.getState().dropExpandedPaths(h.path)}catch(b){u.restore(g,w),ae(b,"Couldn’t delete")}finally{u.invalidate(g)}return}try{await n.deleteEntry(o,h.path),u.setChildren(g,w=>w.filter(b=>b.path!==h.path)),H.getState().dropExpandedPaths(h.path),u.invalidate(g)}catch(w){if(Ut(w)==="DIR_NOT_EMPTY"){r(h);return}ae(w,"Couldn’t delete")}}),[n,o,u,l]),C=s.useCallback(async()=>{const h=m;r(null),h&&await D(h)},[m,D]),U=s.useCallback(()=>r(null),[]),I=s.useCallback((h,g)=>l(async()=>{const w=G(h),b=le(h),S=ee(g,b);if(g===w||S===h||Ce(g,h))return;const K=u.getChildren(w).find(v=>v.path===h);if(!K)return;const A=u.isLoaded(g),_=A&&u.getChildren(g).some(v=>v.path===S),$={...K,name:b,path:S},Y=u.snapshot(w),P=A?u.snapshot(g):void 0;u.setChildren(w,v=>v.filter(z=>z.path!==h)),A&&!_&&u.setChildren(g,v=>[...v,$]);try{await n.renameEntry(o,h,S),H.getState().remapExpandedPaths(h,S)}catch(v){u.restore(w,Y),A&&!_&&u.restore(g,P),ae(v,"Couldn’t move")}finally{u.invalidate(w),A&&u.invalidate(g)}}),[n,o,u,l]),k=s.useCallback((h,g)=>l(async()=>{if(h.isDir&&Ce(g,h.path)){J.error(qt);return}let w;try{w=await u.takenNames(g)}catch(_){ae(_,"Couldn’t copy");return}const b=Oe({name:le(h.path),isDir:h.isDir,taken:w}),S=ee(g,b),K=u.isLoaded(g),A=K?u.snapshot(g):void 0;if(K){const _=u.getChildren(G(h.path)).find(Y=>Y.path===h.path),$=_?{..._,name:b,path:S}:Ae(S,b,h.isDir?"dir":"file");u.setChildren(g,Y=>[...Y,$])}try{await n.copyEntry(o,h.path,S)}catch(_){K&&u.restore(g,A),ae(_,"Couldn’t copy")}finally{u.invalidate(g)}}),[n,o,u,l]);return{createEntry:N,renameEntry:F,removeEntry:L,moveEntry:I,copyEntry:k,pendingRecursiveDelete:m,confirmRecursiveDelete:C,cancelRecursiveDelete:U}}function un(t){return t!=null&&t.startsWith("darwin")?"Reveal in Finder":t!=null&&t.startsWith("win32")?"Reveal in File Explorer":"Show in file manager"}function fn(t,n){const a=t.includes("\\")&&!t.includes("/"),x=t.replace(/[\\/]+$/,""),p=a?n.split("/").join("\\"):n;return`${x}${a?"\\":"/"}${p}`}function hn(t){const n=ne(),{data:a}=lt(),x=s.useMemo(()=>n.supportsReveal?un(a==null?void 0:a.platform):null,[n.supportsReveal,a==null?void 0:a.platform]),p=s.useCallback(async l=>{if(t)try{await n.revealEntry(t,l.path)}catch(u){ae(u,"Couldn’t open the file manager")}},[n,t]),{copy:c}=it(),o=s.useCallback(async(l,u)=>{const N=u==="absolute"&&t?fn(t,l.path):l.path;await c(N)||J.error("Couldn’t copy to the clipboard")},[t,c]),m=s.useCallback(l=>{Xt(Zt(l.path))||J.error("Open a chat to add this file")},[]),r=s.useCallback(l=>{H.getState().setClipboard({path:l.path,isDir:l.type==="dir"});try{navigator.clipboard.writeText(l.path).catch(()=>{})}catch{}},[]);return{revealLabel:x,reveal:p,copyPath:o,addToChat:m,copyToClipboard:r}}const pn=1e3;function mn(t){const{source:n,showHidden:a,queryClient:x,inFlightRef:p}=t,c=n.changes,[o,m]=s.useState(null),[r,l]=s.useState(null),[u,N]=s.useState(null),[F,D]=s.useState(0),L=s.useCallback(async d=>{p.current+=1,D(f=>f+1);try{return await d()}finally{p.current-=1,D(f=>f-1)}},[p]),C=s.useMemo(()=>{const d=f=>ie(n,f,a);return{listing:f=>x.getQueryData(d(f)),isLoaded:f=>x.getQueryData(d(f))!==void 0,entries:f=>{var T;return((T=x.getQueryData(d(f)))==null?void 0:T.entries)??[]},setEntries:(f,T)=>x.setQueryData(d(f),y=>({...y,entries:Ie(T((y==null?void 0:y.entries)??[]))})),restore:(f,T)=>x.setQueryData(d(f),T),fetch:f=>n.list(f,{showHidden:!0}),refreshAll:()=>{x.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),x.invalidateQueries({queryKey:["file-explorer","preview",n.scopeKey]})}}},[x,n,a]),U=s.useCallback(async d=>{const f=C.listing(d);return(f==null?void 0:f.commit)!==void 0?f.commit:(await C.fetch(d)).commit??null},[C]),I=s.useCallback((d,f,T,y)=>{switch(d.status){case"changed":return!0;case"conflict":return N({kind:f,path:d.path,lastCommit:d.lastCommit,retry:()=>T(d.commit)}),!1;case"exists":return J.error(y===void 0?d.reason:qe(y)),!1;case"refused":return J.error(d.reason),!1}},[]),k=s.useCallback((d,f)=>{J.error(Qe(d)??f)},[]),h=s.useCallback((d,f,T)=>{const y=O=>L(async()=>{if(c===void 0)return!1;const E=G(d.path),R=G(f),j=le(f),q=C.isLoaded(R),te=q&&C.entries(R).some(X=>X.path===f),V=C.listing(E),de=R===E?void 0:C.listing(R),i={...d,name:j,path:f};te||(R===E?C.setEntries(E,X=>X.map(se=>se.path===d.path?i:se)):(C.setEntries(E,X=>X.filter(se=>se.path!==d.path)),q&&C.setEntries(R,X=>[...X,i])));const M=()=>{C.restore(E,V),R!==E&&q&&C.restore(R,de)};try{const X=O??await U(E);if(X===null)return M(),J.error("This room has no files to change yet."),!1;const se=await c.move({from:d.path,to:f,baseCommit:X}),we=I(se,T,async re=>{await y(re)},j);return we?H.getState().remapExpandedPaths(d.path,f):M(),we}catch(X){return M(),k(X,T==="rename"?"Couldn’t rename":"Couldn’t move"),!1}finally{C.refreshAll()}});return y(null)},[c,C,L,U,I,k]),g=s.useCallback(async(d,f)=>f===d.name||f.length===0?!0:h(d,ee(G(d.path),f),"rename"),[h]),w=s.useCallback(async(d,f)=>{const T=G(d),y=ee(f,le(d));if(f===T||y===d||Ce(f,d))return;const O=C.entries(T).find(E=>E.path===d);O&&await h(O,y,"move")},[C,h]),b=s.useCallback(async d=>{let f=0;const T=[d];for(;T.length>0;){const y=T.shift(),O=await C.fetch(y);for(const E of O.entries)if(E.type==="dir"?T.push(E.path):f+=1,f>=pn)return{count:f,moreThan:!0}}return{count:f,moreThan:!1}},[C]),S=s.useCallback(d=>{if(d.type!=="dir"){m({entry:d,fileCount:1,moreThan:!1});return}m({entry:d,fileCount:null,moreThan:!1}),b(d.path).then(({count:f,moreThan:T})=>m(y=>(y==null?void 0:y.entry.path)===d.path?{entry:d,fileCount:f,moreThan:T}:y),()=>{})},[b]),K=s.useCallback(d=>{const f=T=>L(async()=>{if(c===void 0)return;const y=G(d.path),O=C.listing(y);C.setEntries(y,E=>E.filter(R=>R.path!==d.path));try{const E=T??await U(y);if(E===null){C.restore(y,O);return}const R=await c.remove({path:d.path,baseCommit:E});I(R,"delete",q=>f(q))?H.getState().dropExpandedPaths(d.path):C.restore(y,O)}catch(E){C.restore(y,O),k(E,"Couldn’t delete")}finally{C.refreshAll()}});return f(null)},[c,C,L,U,I,k]),A=s.useCallback(async()=>{const d=o;m(null),d&&await K(d.entry)},[o,K]),_=s.useCallback(()=>m(null),[]),$=s.useCallback((d,f,T,y)=>{const O=E=>L(async()=>{if(c===void 0)return;const R=C.isLoaded(d),j=R?C.listing(d):void 0;if(R){const q=new Set(C.entries(d).map(V=>V.name)),te=f.filter(V=>!q.has(V.name)).map(V=>({name:V.name,path:ee(d,V.name),type:"file",size:V.size}));te.length>0&&C.setEntries(d,V=>[...V,...te])}try{const q=await c.upload({dir:d,baseCommit:E,replace:T,files:f});!I(q,"upload",V=>O(V))&&R&&C.restore(d,j)}catch(q){R&&C.restore(d,j),k(q,"Couldn’t upload")}finally{C.refreshAll()}});return O(y)},[c,C,L,I,k]),Y=s.useCallback(async(d,f)=>{if(c===void 0||f.length===0)return;if(f.length>c.maxUploadFiles){J.error(`Nothing was uploaded. One upload takes up to ${c.maxUploadFiles} files.`);return}let T;try{T=await C.fetch(d)}catch(j){k(j,"Couldn’t upload");return}const y=T.entries.map(j=>j.name),O=new Set(y),E=f.map(j=>j.name).filter(j=>O.has(j)),R=T.commit??null;if(E.length===0){await $(d,f,[],R);return}l({dir:d,files:f,names:E,taken:y,baseCommit:R})},[c,C,k,$]),P=s.useCallback(async d=>{const f=r;if(l(null),f===null)return;if(d==="replace"){await $(f.dir,f.files,f.names,f.baseCommit);return}const T=new Set([...f.taken,...f.files.map(E=>E.name)]),y=new Set(f.names),O=f.files.map(E=>{if(!y.has(E.name))return E;const R=Oe({name:E.name,isDir:!1,taken:T});return T.add(R),new File([E],R,{type:E.type,lastModified:E.lastModified})});await $(f.dir,O,[],f.baseCommit)},[r,$]),v=s.useCallback(()=>l(null),[]),z=s.useCallback(()=>N(null),[]),B=s.useMemo(()=>r===null?null:{dir:r.dir,names:r.names},[r]);return{renameEntry:g,moveEntry:w,requestDelete:S,pendingDelete:o,confirmDelete:A,cancelDelete:_,upload:Y,pendingClash:B,resolveClash:P,cancelClash:v,conflict:u,dismissConflict:z,busy:F>0}}const Le={scopeKey:"",cwd:null,writable:!1,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list:()=>Promise.resolve({entries:[]})};function xn(t){var d,f,T;const n=ne(),a=oe(),{setTheme:x}=ct(),p=H(y=>y.showHidden),c=H(y=>y.expanded),o=H(y=>y.loadExplorerForCwd),m=H(y=>y.pruneMissing),r=(t==null?void 0:t.scopeKey)??null,l=(t==null?void 0:t.cwd)??null;s.useEffect(()=>{o(r)},[r,o]);const u=s.useMemo(()=>[Q,...dt(c)],[c]),N=ut({queries:t?u.map(y=>ke(t,y,p,a)):[]}),F=(t==null?void 0:t.filtersHidden)??!0,D=s.useMemo(()=>{const y={};return u.forEach((O,E)=>{var q;const R=N[E];let j=((q=R==null?void 0:R.data)==null?void 0:q.entries)??[];!p&&!F&&(j=nt(j)),O===Q&&(j=ln(j)),y[O]={entries:j,loading:(R==null?void 0:R.isLoading)??!1,error:(R==null?void 0:R.isError)??!1}}),y},[u,N,p,F]),L=s.useRef(0),C=s.useRef({});s.useEffect(()=>{L.current>0||u.forEach((y,O)=>{var R,j,q;const E=(j=(R=N[O])==null?void 0:R.data)==null?void 0:j.entries;!E||(q=N[O])!=null&&q.isError||C.current[y]!==E&&(C.current[y]=E,m(y,E.map(te=>te.name)))})},[u,N,m]);const U=s.useMemo(()=>ft(c,D),[c,D]),I=!!t&&!!((d=D[Q])!=null&&d.loading),k=!!t&&!!((f=D[Q])!=null&&f.error),h=(T=N[0])==null?void 0:T.error,g=k&&h?Qt(h):void 0,w=(g==null?void 0:g.message)??null,b=(g==null?void 0:g.command)??null,S=s.useMemo(()=>{var O;const y=new Set;for(const E of u)E!==Q&&((O=D[E])!=null&&O.error)&&y.add(E);return y},[u,D]),K=s.useCallback(y=>{if(y.type!=="dir")return;const O=H.getState();O.setDirExpanded(y.path,!O.expanded[y.path])},[]),A=s.useCallback(y=>{if(y===Q)return;const O=H.getState();O.expanded[y]||O.setDirExpanded(y,!0)},[]),_=(t==null?void 0:t.preview)==="canvas",$=s.useCallback(y=>{if(y.type!=="file"||!_)return;const O={getStore:Te.getState,setTheme:x,supportsTerminal:n.supportsTerminal};ht(O,{action:"open_file",sourcePath:y.path},"user")},[_,x,n]),Y=s.useCallback(()=>{r!==null&&a.invalidateQueries({queryKey:["file-explorer","tree",r]})},[a,r]),P=s.useCallback(y=>{t!==null&&a.invalidateQueries({queryKey:ie(t,y,p),exact:!0})},[a,t,p]);s.useEffect(()=>{if(t!=null&&t.events)return t.events(Y)},[t,Y]);const v=dn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),z=mn({source:t??Le,showHidden:p,queryClient:a,inFlightRef:L}),B=hn(l);return{rows:U,rootLoading:I,rootError:k,rootErrorMessage:w,rootErrorCommand:b,errorPaths:S,toggleExpand:K,ensureExpanded:A,openFile:$,reload:Y,retryDir:P,changes:t!=null&&t.changes?z:null,...v,...B}}function gn(t){const{transport:n,cwd:a}=t;return{scopeKey:a,cwd:a,writable:!0,provenance:!1,filtersHidden:!0,preview:"canvas",editable:!1,list(x,p){return n.readFileTree(a,{path:x===""?void 0:x,showHidden:p.showHidden})}}}function je(t){return Array.from(t).includes("Files")}function st(t){const n=Array.from(t.items??[]);if(!(n.length>0&&n.every(c=>"webkitGetAsEntry"in c)))return{files:Array.from(t.files??[]),folders:0};const x=[];let p=0;for(const c of n){if(c.kind!=="file")continue;const o=c.webkitGetAsEntry();if(o!=null&&o.isDirectory){p+=1;continue}const m=c.getAsFile();m&&x.push(m)}return{files:x,folders:p}}const yn=12;function vn({row:t,selected:n,renaming:a,error:x,onSelect:p,onActivate:c,onRetry:o,onSubmitRename:m,onCancelRename:r,onNewFile:l,onNewFolder:u,onStartRename:N,onDelete:F,onMove:D,onCopyInto:L,onCopy:C,onPaste:U,onDuplicate:I,canPasteInto:k,revealLabel:h,onReveal:g,onAddToChat:w,onCopyPath:b,readOnly:S=!1,provenance:K=!1,copyable:A=!0,onDisk:_=!0,onUpload:$,onPickUpload:Y}){const{entry:P,depth:v,expanded:z,loading:B}=t,d=P.type==="dir",f=d?P.path:G(P.path),[T,y]=s.useState(!1),O=!d&&v===0&&Re(P.name),E=Bt(P.lastCommit),R=e.jsxs("div",{role:"treeitem","aria-label":P.name,"aria-expanded":d?z:void 0,"aria-selected":n,tabIndex:-1,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(P),c(P))},draggable:!a&&!S,onDragStart:j=>{S||(j.dataTransfer.setData("text/plain",P.path),j.dataTransfer.setData(en,P.path),j.dataTransfer.effectAllowed="copyMove")},onDragOver:j=>{if(j.stopPropagation(),!S&&$&&je(j.dataTransfer.types)){j.preventDefault(),j.dataTransfer.dropEffect="copy",y(!0);return}S||!d||!We(j.dataTransfer.types)||(j.preventDefault(),j.dataTransfer.dropEffect=j.altKey&&A?"copy":"move",y(!0))},onDragLeave:()=>y(!1),onDrop:j=>{if(j.stopPropagation(),S)return;if(y(!1),$&&je(j.dataTransfer.types)){j.preventDefault();const{files:te}=st(j.dataTransfer);$(f,te);return}if(!d)return;const q=Ye(j.dataTransfer);q!==null&&(j.preventDefault(),j.altKey&&A?L(q,P.path):D(q,P.path))},onClick:()=>{p(P),c(P)},className:Pe("flex w-full cursor-pointer items-center gap-1 py-1 pr-2 text-sm transition-colors",n?"bg-accent text-foreground":"hover:bg-accent/50",T&&"ring-ring/60 bg-accent ring-1"),style:{paddingLeft:v*yn+8},children:[e.jsx("span",{className:"flex size-4 flex-shrink-0 items-center justify-center",children:d&&(B?e.jsx(Fe,{size:"xs",className:"text-muted-foreground"}):x?e.jsx("button",{type:"button","aria-label":"Retry loading",title:"Couldn’t load. Retry",onClick:j=>{j.stopPropagation(),o()},className:"flex items-center justify-center",children:e.jsx(Ge,{className:"text-destructive size-3.5"})}):z?e.jsx(pt,{className:"text-muted-foreground size-3.5"}):e.jsx(Ke,{className:"text-muted-foreground size-3.5"}))}),d?z?e.jsx(mt,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):P.isSymlink===!0?e.jsx(tn,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),a?e.jsx(Cn,{initialName:P.name,onSubmit:j=>m(P,j),onCancel:r}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name}),O&&!a&&e.jsx(xt,{"aria-label":"Pinned to the top",className:"text-muted-foreground/60 size-3 flex-shrink-0"}),K&&!a&&e.jsx("span",{className:"text-muted-foreground/70 text-2xs max-w-[45%] flex-shrink-0 truncate tabular-nums",title:E.title??void 0,children:E.label})]});return S?R:e.jsxs(gt,{children:[e.jsx(yt,{asChild:!0,children:R}),e.jsxs(vt,{className:"w-52",children:[e.jsx(Z,{movesFocus:!0,onClick:()=>l(f),children:"New file"}),e.jsx(Z,{movesFocus:!0,onClick:()=>u(f),children:"New folder"}),Y&&e.jsx(Z,{onClick:()=>Y(f),children:"Upload files…"}),_&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),h&&e.jsx(Z,{onClick:()=>g(P),children:h}),e.jsx(Z,{movesFocus:!0,onClick:()=>w(P),children:"Add to chat"})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{}),e.jsx(Z,{onClick:()=>C(P),children:"Copy"}),e.jsx(Z,{disabled:!k(f),onClick:()=>U(f),children:"Paste"}),e.jsx(Z,{onClick:()=>I(P),children:"Duplicate"})]}),e.jsx(ue,{}),_?e.jsxs(e.Fragment,{children:[e.jsx(Z,{onClick:()=>b(P,"absolute"),children:"Copy path"}),e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy relative path"})]}):e.jsx(Z,{onClick:()=>b(P,"relative"),children:"Copy path"}),e.jsx(ue,{}),e.jsx(Z,{movesFocus:!0,onClick:()=>N(P),children:"Rename"}),e.jsx(Z,{variant:"destructive",onClick:()=>F(P),children:"Delete"})]})]})}function Cn({initialName:t,onSubmit:n,onCancel:a}){const x=s.useRef(null),[p,c]=s.useState(t);s.useEffect(()=>{const m=x.current;if(!m)return;m.focus();const r=t.lastIndexOf(".");m.setSelectionRange(0,r>0?r:t.length)},[t]);const o=()=>{const m=p.trim();m&&m!==t?n(m):a()};return e.jsx("input",{ref:x,type:"text",value:p,"aria-label":"New name",onChange:m=>c(m.target.value),onClick:m=>m.stopPropagation(),onBlur:o,onKeyDown:m=>{m.stopPropagation(),m.key==="Enter"?o():m.key==="Escape"&&a()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})}const bn=100,jn=28,kn=250;function wn(t){const{rows:n,selectedPath:a,renamingPath:x,errorPaths:p,onSelectPath:c,onRetryDir:o}=t,m=s.useRef(null),r=H(v=>v.setScrollTop),l=H(v=>v.scopeKey),u=s.useCallback(v=>v.type==="dir"?t.onToggle(v):t.onOpen(v),[t]),N=Dn(t,u),F=n.length>bn,D=Jt({count:n.length,getScrollElement:()=>m.current,estimateSize:()=>jn,overscan:12,enabled:F}),L=s.useRef({scope:void 0,done:!1}),C=s.useRef(null);s.useLayoutEffect(()=>{const v=L.current;if(v.scope!==l&&(v.scope=l,v.done=!1),v.done||n.length===0)return;const z=m.current;if(!z)return;const B=H.getState().scrollTop;if(B<=0){v.done=!0;return}F?D.scrollToOffset(B):z.scrollTop=B,C.current=z.scrollTop,z.scrollTop>=B&&(v.done=!0)},[n.length,l,F,D]);const U=s.useRef(null),I=s.useRef(null),k=s.useCallback(()=>{const v=m.current;v&&v.scrollTop!==C.current&&(L.current.done=!0,U.current=v.scrollTop,I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{I.current=null,U.current!==null&&r(U.current)},kn))},[r]);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),U.current!==null&&r(U.current)},[r]);const h=s.useRef(void 0);s.useEffect(()=>{var d,f;const v=h.current;if(h.current=a,v===void 0||a===v||a===null)return;const z=n.findIndex(T=>T.entry.path===a);if(z<0)return;const B=m.current;B&&(F?D.scrollToIndex(z,{align:"auto"}):(f=(d=B.querySelector(`[data-row-index="${z}"]`))==null?void 0:d.scrollIntoView)==null||f.call(d,{block:"nearest"}),C.current=B.scrollTop)},[a,n,F,D]);const[g,w]=s.useState(!1),{onCopyInto:b,onMove:S}=t,K=t.readOnly===!0,A=t.copyable!==!1,_=s.useCallback(v=>{K||!We(v.dataTransfer.types)||(v.preventDefault(),v.dataTransfer.dropEffect=v.altKey&&A?"copy":"move",w(!0))},[K,A]),$=s.useCallback((v,z)=>{const B=n.find(d=>d.entry.path===v);B&&b({path:v,isDir:B.entry.type==="dir"},z)},[n,b]),Y=s.useCallback(v=>{if(w(!1),K)return;const z=Ye(v.dataTransfer);z!==null&&(v.preventDefault(),v.altKey&&A?$(z,Q):S(z,Q))},[$,S,K,A]),P=v=>e.jsx(vn,{row:v,selected:v.entry.path===a,renaming:v.entry.path===x,error:v.entry.type==="dir"&&v.expanded&&p.has(v.entry.path),onSelect:z=>c(z.path),onActivate:u,onRetry:()=>o(v.entry.path),onSubmitRename:t.onSubmitRename,onCancelRename:t.onCancelRename,onStartRename:t.onStartRename,onNewFile:t.onNewFile,onNewFolder:t.onNewFolder,onDelete:t.onDelete,onMove:t.onMove,onCopyInto:$,onCopy:t.onCopy,onPaste:t.onPaste,onDuplicate:t.onDuplicate,canPasteInto:t.canPasteInto,revealLabel:t.revealLabel,onReveal:t.onReveal,onAddToChat:t.onAddToChat,onCopyPath:t.onCopyPath,readOnly:t.readOnly,provenance:t.provenance,copyable:t.copyable,onDisk:t.onDisk,onUpload:t.onUpload,onPickUpload:t.onPickUpload});return e.jsx("div",{ref:m,role:"tree","aria-label":"File explorer",tabIndex:0,onKeyDown:N,onScroll:k,onDragOver:_,onDragLeave:()=>w(!1),onDrop:Y,className:Pe("focus-visible:ring-ring h-full overflow-auto outline-none focus-visible:ring-1 focus-visible:ring-inset",g&&"ring-ring/60 bg-accent/30 ring-1 ring-inset"),children:F?e.jsx("div",{style:{height:D.getTotalSize()},className:"relative w-full",children:D.getVirtualItems().map(v=>e.jsx("div",{"data-row-index":v.index,className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${v.start}px)`},children:P(n[v.index])},n[v.index].entry.path))}):n.map((v,z)=>e.jsx("div",{"data-row-index":z,children:P(v)},v.entry.path))})}function En(t){return t?t.type==="dir"?t.path:G(t.path):Q}function Dn(t,n){const{rows:a,selectedPath:x,renamingPath:p,onSelectPath:c}=t;return s.useCallback(o=>{var l,u,N,F;if(p!==null)return;const m=a.findIndex(D=>D.entry.path===x),r=m>=0?a[m]:void 0;if(o.metaKey||o.ctrlKey){if(t.readOnly===!0||t.copyable===!1)return;const D=o.key.toLowerCase();if(D==="c"&&r){o.preventDefault(),t.onCopy(r.entry);return}if(D==="v"){o.preventDefault(),t.onPaste(En(r==null?void 0:r.entry));return}return}switch(o.key){case"ArrowDown":o.preventDefault(),c(((l=a[Math.min(m+1,a.length-1)])==null?void 0:l.entry.path)??((u=a[0])==null?void 0:u.entry.path));break;case"ArrowUp":o.preventDefault(),c(((N=a[Math.max(m-1,0)])==null?void 0:N.entry.path)??((F=a[0])==null?void 0:F.entry.path));break;case"ArrowRight":(r==null?void 0:r.entry.type)==="dir"&&!r.expanded&&(o.preventDefault(),t.onToggle(r.entry));break;case"ArrowLeft":if(!r)break;if(o.preventDefault(),r.entry.type==="dir"&&r.expanded)t.onToggle(r.entry);else{const D=G(r.entry.path);D&&c(D)}break;case"Enter":r&&(o.preventDefault(),n(r.entry));break;case"F2":r&&t.readOnly!==!0&&(o.preventDefault(),t.onStartRename(r.entry));break;case"Delete":case"Backspace":r&&t.readOnly!==!0&&(o.preventDefault(),t.onDelete(r.entry));break}},[a,x,p,c,t,n])}const Nn={rename:"Rename it anyway",move:"Move it anyway",delete:"Delete it anyway",upload:"Upload mine over it"},Rn={rename:"nothing was renamed",move:"nothing was moved",delete:"nothing was deleted",upload:"nothing was uploaded"};function Sn(t){const{entry:n,fileCount:a,moreThan:x}=t;if(n.type!=="dir")return`“${n.name}” leaves the room’s files.`;const p=a===null?"everything in it":x?`the more than ${a.toLocaleString()} files in it`:a===1?"the 1 file in it":`the ${a.toLocaleString()} files in it`;return`“${n.name}” and ${p} leave the room’s files.`}const Tn="The room’s history keeps a copy. An agent can restore it.";function Fn({changes:t,onOpenTheirs:n,onReturnFocus:a}){var D;const x=L=>{L.preventDefault();const C=document.activeElement;C!==null&&C!==document.body||a()},{pendingDelete:p,pendingClash:c,conflict:o}=t,[m,r]=s.useState(p);p!==null&&p!==m&&r(p);const[l,u]=s.useState(c);c!==null&&c!==l&&u(c);const N=l===null?"":l.dir===Q?"The top folder":`“${l.dir}”`,F=(l==null?void 0:l.names.length)===1;return e.jsxs(e.Fragment,{children:[e.jsx(fe,{open:p!==null,onOpenChange:L=>!L&&t.cancelDelete(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:m===null?"":`Delete “${m.entry.name}”?`}),e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:m===null?"":Sn(m)}),e.jsx("p",{children:Tn})]})})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void t.confirmDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:(m==null?void 0:m.entry.type)==="dir"?"Delete folder":"Delete file"})]})]})}),e.jsx(fe,{open:c!==null,onOpenChange:L=>!L&&t.cancelClash(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:F?`Replace “${l==null?void 0:l.names[0]}”?`:`Replace ${(l==null?void 0:l.names.length)??0} files?`}),e.jsx(xe,{children:F?`${N} already has a file with this name. Replace it, or keep both.`:`${N} already has files named ${(l==null?void 0:l.names.join(", "))??""}. Replace them, or keep both.`})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.cancelClash,children:"Cancel"}),e.jsx(W,{variant:"outline",onClick:()=>void t.resolveClash("keep-both"),children:"Keep both"}),e.jsx(ve,{onClick:()=>void t.resolveClash("replace"),children:"Replace"})]})]})}),e.jsx(fe,{open:o!==null,onOpenChange:L=>!L&&t.dismissConflict(),children:e.jsxs(he,{onCloseAutoFocus:x,children:[e.jsxs(pe,{children:[e.jsx(me,{children:"Somebody changed this first"}),e.jsx(xe,{children:o===null?"":`${((D=o.lastCommit)==null?void 0:D.author)??"Somebody"} changed “${o.path}” after you opened it, so ${Rn[o.kind]}.`})]}),(o==null?void 0:o.lastCommit)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[o.lastCommit.subject," · ",Ct(o.lastCommit.at)]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:t.dismissConflict,children:"Cancel"}),e.jsx(W,{variant:"outline",onClick:()=>{o!==null&&(t.dismissConflict(),n(o.path))},children:"Open their version"}),e.jsx(ve,{onClick:()=>{o!==null&&(t.dismissConflict(),o.retry())},className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:o===null?"":Nn[o.kind]})]})]})})]})}function ze(t,n){return n.name===t?qe(t):`“${n.name}” is already there. Some computers ignore capital letters in names. Pick another name.`}const Pn="Folders can’t be uploaded. Drop the files inside instead.";function On({source:t,className:n,onCommands:a}={}){var de;const x=ne(),p=Te(i=>i.selectedCwd),c=s.useMemo(()=>p?gn({transport:x,cwd:p}):null,[x,p]),o=t===void 0?c:t,m=o!==null&&!o.writable,r=xn(o),l=r.changes,u=oe(),N=H(i=>i.showHidden),{rows:F,rootLoading:D,rootError:L,rootErrorMessage:C,rootErrorCommand:U,errorPaths:I}=r,k=H(i=>i.setCommands),h=H(i=>i.selectedPath),g=H(i=>i.setSelectedPath),w=H(i=>i.clipboard),[b,S]=s.useState(null),[K,A]=s.useState(null),[_,$]=s.useState(null),Y=s.useCallback(i=>$(i===null?null:{path:i,isNew:!1}),[]),P=s.useRef(null),v=s.useRef(Q),[z,B]=s.useState(!1),d=s.useCallback((i,M)=>{if(l!==null){if(M.length===0){J.error(Pn);return}r.ensureExpanded(i),l.upload(i,M)}},[l,r]),f=s.useRef(null),T=s.useCallback(()=>{var i,M;(M=(i=f.current)==null?void 0:i.querySelector('[role="tree"]'))==null||M.focus()},[]),y=s.useCallback(i=>{var M;v.current=i,(M=P.current)==null||M.click()},[]),O=s.useCallback(i=>w!==null&&!(w.isDir&&Ce(i,w.path)),[w]),E=s.useCallback((i,M)=>{r.ensureExpanded(i),_e.flushSync(()=>{A(null),S({parent:i,type:M})})},[r]),R=s.useCallback(i=>{_e.flushSync(()=>A(i.path))},[]),j=s.useRef({startCreate:E,reload:r.reload,pickUpload:y});s.useEffect(()=>{j.current={startCreate:E,reload:r.reload,pickUpload:y}});const q=l!==null;s.useEffect(()=>{if(m||a===void 0&&q)return;const i=a??k;return i({newFile:()=>j.current.startCreate(Q,"file"),newFolder:()=>j.current.startCreate(Q,"dir"),refresh:()=>j.current.reload(),...q&&{upload:()=>j.current.pickUpload(Q)}}),()=>i(null)},[k,a,m,q]);const te=s.useCallback(async i=>{var se;if(!b||o===null)return;const M=b;if(S(null),l!==null){const re=(((se=u.getQueryData(ie(o,M.parent,N)))==null?void 0:se.entries)??[]).find(ot=>ot.name.toLowerCase()===i.toLowerCase());if(M.type==="dir"){if(re!==void 0&&!(re.type==="dir"&&re.name===i)){J.error(ze(i,re));return}S({parent:ee(M.parent,i),type:"file",firstInFolder:i});return}if(re!==void 0){J.error(ze(i,re));return}const rt=ee(M.parent,i);$({path:rt,isNew:!0});return}await r.createEntry(M.parent,i,M.type)&&g(ee(M.parent,i))},[b,o,l,u,N,r,g]),V=s.useCallback(async(i,M)=>{A(null),(l?await l.renameEntry(i,M):await r.renameEntry(i,M))&&g(ee(G(i.path),M))},[l,r,g]);return o===null?t!==void 0?null:e.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-6 text-center text-sm",children:"Pick a folder to see its files."}):e.jsxs("div",{ref:f,className:Pe("flex h-full flex-col",z&&"ring-ring/60 bg-accent/30 ring-1 ring-inset",n),onDragOver:i=>{l===null||!je(i.dataTransfer.types)||(i.preventDefault(),i.dataTransfer.dropEffect="copy",B(!0))},onDragLeave:i=>{i.currentTarget.contains(i.relatedTarget)||B(!1)},onDrop:i=>{B(!1),!(l===null||!je(i.dataTransfer.types))&&(i.preventDefault(),d(Q,st(i.dataTransfer).files))},children:[l!==null&&e.jsx("input",{ref:P,type:"file",multiple:!0,hidden:!0,"aria-hidden":!0,tabIndex:-1,"data-testid":"room-files-upload-input",onChange:i=>{const M=Array.from(i.target.files??[]);i.target.value="",d(v.current,M)}}),e.jsxs("div",{className:"min-h-0 flex-1",children:[b&&e.jsx(Mn,{type:b.type,firstInFolder:b.firstInFolder,onSubmit:i=>void te(i),onCancel:()=>S(null)},`${b.parent}:${b.type}:${b.firstInFolder??""}`),D&&F.length===0?e.jsx("div",{className:"flex h-20 items-center justify-center",children:e.jsx(Fe,{size:"md",className:"text-muted-foreground",label:"Loading files"})}):L&&F.length===0?e.jsxs("div",{className:"text-muted-foreground flex min-h-20 flex-col items-center justify-center gap-2 px-4 py-3 text-center text-xs [overflow-wrap:anywhere]",children:[e.jsx("span",{children:C??"Couldn’t load files."}),U!==null&&e.jsx("code",{"aria-label":"Command that removes the settings",className:"bg-muted text-foreground block w-full rounded px-2 py-1.5 text-left font-mono select-all",children:U}),e.jsxs(W,{variant:"outline",size:"xs",onClick:r.reload,children:[e.jsx(Ge,{}),"Retry"]})]}):F.length===0&&!b?e.jsx("div",{className:"text-muted-foreground/60 flex h-20 items-center justify-center px-4 text-center text-xs",children:l!==null?"No files yet. Drop files here, or use Upload.":"Empty folder"}):e.jsx(wn,{rows:F,selectedPath:h,renamingPath:K,errorPaths:I,onSelectPath:g,onToggle:r.toggleExpand,onOpen:i=>{o.preview==="inline"?Y(i.path):r.openFile(i)},onRetryDir:r.retryDir,onSubmitRename:(i,M)=>void V(i,M),onCancelRename:()=>A(null),onStartRename:R,onNewFile:i=>E(i,"file"),onNewFolder:i=>E(i,"dir"),onDelete:i=>l?l.requestDelete(i):void r.removeEntry(i),onMove:(i,M)=>void(l?l.moveEntry(i,M):r.moveEntry(i,M)),onCopyInto:(i,M)=>void r.copyEntry(i,M),onCopy:r.copyToClipboard,onPaste:i=>{w&&r.copyEntry(w,i)},onDuplicate:i=>void r.copyEntry({path:i.path,isDir:i.type==="dir"},G(i.path)),canPasteInto:O,readOnly:m,provenance:o.provenance,copyable:l===null,onDisk:o.cwd!==null,onUpload:l?d:void 0,onPickUpload:l?y:void 0,revealLabel:r.revealLabel,onReveal:i=>void r.reveal(i),onAddToChat:r.addToChat,onCopyPath:(i,M)=>void r.copyPath(i,M)})]}),o.preview==="inline"&&e.jsx(Yt,{source:o,path:(_==null?void 0:_.path)??null,isNew:(_==null?void 0:_.isNew)??!1,onCreated:()=>{_!==null&&($({path:_.path,isNew:!1}),g(_.path))},onClose:()=>$(null)}),l!==null&&e.jsx(Fn,{changes:l,onOpenTheirs:i=>Y(i),onReturnFocus:T}),e.jsx(fe,{open:r.pendingRecursiveDelete!==null,onOpenChange:i=>!i&&r.cancelRecursiveDelete(),children:e.jsxs(he,{children:[e.jsxs(pe,{children:[e.jsxs(me,{children:["Delete “",(de=r.pendingRecursiveDelete)==null?void 0:de.name,"”?"]}),e.jsx(xe,{children:"This folder isn’t empty. Everything inside is deleted. This can’t be undone."})]}),e.jsxs(ge,{children:[e.jsx(ye,{onClick:r.cancelRecursiveDelete,children:"Cancel"}),e.jsx(ve,{onClick:()=>void r.confirmRecursiveDelete(),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:"Delete folder"})]})]})})]})}function Mn({type:t,firstInFolder:n,onSubmit:a,onCancel:x}){const p=s.useRef(null),[c,o]=s.useState("");s.useEffect(()=>{var l;(l=p.current)==null||l.focus()},[]);const m=()=>{const l=c.trim();l?a(l):x()},r=e.jsxs("div",{className:"flex items-center gap-1",children:[t==="dir"?e.jsx(be,{className:"size-(--size-icon-sm) flex-shrink-0 text-sky-500"}):e.jsx(Ve,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("input",{ref:p,type:"text",value:c,"aria-label":n!==void 0?`First file in ${n}`:t==="dir"?"New folder name":"New file name",placeholder:t==="dir"?"folder-name":"file-name",onChange:l=>o(l.target.value),onBlur:m,onKeyDown:l=>{l.key==="Enter"?m():l.key==="Escape"&&x()},className:"border-border bg-background focus-ring min-w-0 flex-1 rounded border px-1 py-0 text-sm outline-none"})]});return n===void 0?e.jsx("div",{className:"px-3 py-1",children:r}):e.jsxs("div",{className:"space-y-1 px-3 py-1",children:[e.jsxs("p",{className:"text-muted-foreground flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(be,{className:"size-(--size-icon-xs) flex-shrink-0 text-sky-500"}),e.jsx("span",{className:"truncate",children:n})]}),r,e.jsx("p",{className:"text-muted-foreground text-2xs",children:"Name its first file. The folder appears on save."})]})}function at(){const t=H(x=>x.showHidden),n=H(x=>x.setShowHidden),a=t?"Hide hidden files":"Show hidden files";return e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":a,title:a,onClick:()=>n(!t),children:t?e.jsx(bt,{className:"text-muted-foreground"}):e.jsx(jt,{className:"text-muted-foreground"})})}function _n({cwd:t}){const n=ne(),{data:a}=ce({queryKey:["file-explorer","workspace",t],queryFn:()=>n.resolveWorkspace(t),staleTime:6e4});return a!=null&&a.branch?e.jsxs("span",{className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",title:`Workspace ${a.key} on ${a.branch}`,children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a.branch})]}):null}function es(){const t=Te(a=>a.selectedCwd),n=H(a=>a.commands);return t?e.jsxs(e.Fragment,{children:[e.jsx(_n,{cwd:t}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"New file",title:"New file",onClick:()=>n==null?void 0:n.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"New folder",title:"New folder",onClick:()=>n==null?void 0:n.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(at,{}),e.jsx(W,{variant:"ghost",size:"icon-xs","aria-label":"Refresh",title:"Refresh",onClick:()=>n==null?void 0:n.refresh(),children:e.jsx(kt,{className:"text-muted-foreground"})})]}):null}function An({roomId:t}){const n=ne(),a=oe(),x=ce(Ue(n,t));s.useEffect(()=>Wt(a,t,()=>{a.invalidateQueries({queryKey:De.repoStatus(t)})}),[a,t]);const p=s.useMemo(()=>{var r;return((r=x.data)==null?void 0:r.kind)==="ok"?wt(x.data.status):[]},[x.data]),c=Et(p),o=Dt(p);if(!o)return null;const m=p.map((r,l)=>`${c[l]}: ${Nt(r)}`);return e.jsxs("span",{"data-slot":"pending-work-badge",title:m.join(`
|
|
17
|
+
`),className:"text-muted-foreground bg-muted/50 text-2xs inline-flex min-w-0 items-center gap-1 rounded px-1.5 py-0.5",children:[e.jsx(Xe,{className:"size-3 flex-shrink-0"}),e.jsxs("span",{className:"sr-only",children:["Not merged into the room yet. ",m.join(". "),"."]}),e.jsx("span",{"aria-hidden":"true",className:"truncate",children:o})]})}const Ln={added:"added",modified:"changed",deleted:"deleted",untracked:"new"},zn=new Map([["OPERATOR_ONLY","Only the owner of this DorkOS can keep or discard these."],["ROOM_FILE_NOT_FOUND","One of those changes is gone, so nothing was discarded. The list is refreshed."],["MERGE_IN_FLIGHT","Something else is writing to these files. Nothing changed. Try again in a moment."],["MAIN_CHECKOUT_DIRTY","These files are on another branch. Switch them back to main yourself."],["ROOM_REPO_GIT_UNAVAILABLE","Room files need git, and git isn’t installed on this computer."],["ROOM_HAS_NO_REPO","This room no longer has its own files."],["ROOM_REPOS_DISABLED","Room files are turned off on this install."]]);function $n({roomId:t}){var U,I;const n=ne(),a=oe(),x=ce(Ue(n,t)),[p,c]=s.useState([]),[o,m]=s.useState(!1),[r,l]=s.useState(null),u=Rt({mutationFn:k=>n.repairRoomMain(t,k),onSuccess:()=>{c([]),m(!1),l(null),a.invalidateQueries({queryKey:De.repoStatus(t)})},onError:k=>{m(!1);const h=zn.get(St(k)??"");l(h??"Couldn’t update the files. Try again in a moment."),a.invalidateQueries({queryKey:De.repoStatus(t)})}});if(((U=x.data)==null?void 0:U.kind)==="unavailable")return e.jsx("p",{role:"alert","data-slot":"room-main-warning",className:"border-border/60 text-muted-foreground rounded-lg border px-3 py-2.5 text-xs",children:"Couldn’t check this room’s files. Saves may not work. Try again soon."});const N=((I=x.data)==null?void 0:I.kind)==="ok"?x.data.status.main:void 0;if(N===void 0||!N.dirty)return null;const F=N.branch!=="main",D=p.filter(k=>N.strays.some(h=>h.path===k)),L=o&&D.length>0,C=k=>c(h=>h.includes(k)?h.filter(g=>g!==k):[...h,k]);return e.jsxs("div",{"data-slot":"room-main-warning",className:"border-border/60 bg-muted/40 space-y-3 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Tt,{className:"text-muted-foreground mt-0.5 size-(--size-icon-sm) flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{role:"alert",className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Somebody changed this room’s files outside DorkOS"}),F?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:`This room’s files are on ${N.branch??"no branch"}, not main.`}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until they’re back on main."})]}):e.jsx("p",{className:"text-muted-foreground text-xs",children:"Saves and agent merges wait until you keep or discard these."})]}),F&&e.jsx(nn,{className:"text-xs",children:e.jsx("p",{children:"DorkOS won’t switch the branch for you. There may be work on it."})})]})]}),!F&&e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:N.strays.map(k=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Ft,{id:`stray-${t}-${k.path}`,checked:D.includes(k.path),onCheckedChange:()=>C(k.path),disabled:u.isPending}),e.jsx("label",{htmlFor:`stray-${t}-${k.path}`,className:"min-w-0 flex-1 cursor-pointer truncate font-mono text-xs",title:k.path,children:k.path}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:Ln[k.kind]})]},k.path))}),N.strayCount>N.strays.length&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["…and ",N.strayCount-N.strays.length," more not shown. “Keep them all” keeps these too."]}),L?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs",children:D.length===1?"Discard this change? It can’t be undone.":`Discard these ${D.length} changes? They can’t be undone.`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(W,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending,onClick:()=>m(!1),children:"Cancel"}),e.jsx(W,{type:"button",variant:"destructive",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"discard",paths:[...D]}),children:D.length===1?"Discard change":`Discard ${D.length} changes`})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(W,{type:"button",variant:"outline",size:"sm",disabled:u.isPending,onClick:()=>u.mutate({action:"commit"}),children:"Keep them all"}),e.jsx(W,{type:"button",variant:"ghost",size:"sm",disabled:u.isPending||D.length===0,onClick:()=>m(!0),children:D.length===0?"Discard…":`Discard ${D.length}`})]})]}),r!==null&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:r})]})}const Ee="pointer-coarse:size-11";function ts({roomId:t,canChange:n}){const a=ne(),x=oe(),p=H(F=>F.showHidden),[c,o]=s.useState(null),m=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t,canChange:n}),[a,x,t,n]),r=ce(ke(m,Q,p,x)),l=r.isSuccess&&r.data.absent!==!0||r.isError,[u,N]=s.useState(null);return l&&u!==t&&N(t),!l&&u!==t?null:e.jsxs("section",{"aria-label":"Room files",className:"space-y-2",children:[e.jsxs("header",{className:"flex items-center gap-2",children:[e.jsx(Pt,{className:"text-muted-foreground size-(--size-icon-sm) flex-shrink-0"}),e.jsx("h3",{className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Files"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(An,{roomId:t})}),n&&e.jsxs(e.Fragment,{children:[e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New file",title:"New file",disabled:c===null,onClick:()=>c==null?void 0:c.newFile(),children:e.jsx(et,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"New folder",title:"New folder",disabled:c===null,onClick:()=>c==null?void 0:c.newFolder(),children:e.jsx(He,{className:"text-muted-foreground"})}),e.jsx(W,{variant:"ghost",size:"icon-xs",className:Ee,"aria-label":"Upload files",title:"Upload files",disabled:(c==null?void 0:c.upload)===void 0,onClick:()=>{var F;return(F=c==null?void 0:c.upload)==null?void 0:F.call(c)},children:e.jsx(an,{className:"text-muted-foreground"})})]}),e.jsx(at,{})]}),e.jsx($n,{roomId:t}),e.jsx("div",{"data-slot":"room-files-body",className:"border-border/60 h-72 overflow-hidden rounded-lg border",children:e.jsx(On,{source:m,onCommands:o})})]})}function ns({roomId:t,attachment:n}){var l;const a=ne(),x=oe(),p=s.useMemo(()=>Be({transport:a,queryClient:x,roomId:t}),[a,x,t]),c=ce(ke(p,Q,!1,x)),[o,m]=s.useState(!1),r=Ot(t);return!c.isSuccess||c.data.absent===!0||((l=r.data)==null?void 0:l.archived)!==!1?null:e.jsxs(e.Fragment,{children:[e.jsx(W,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Save ${n.name} to the room’s files`,title:"Save to room files",className:"text-muted-foreground hover:text-foreground mt-0.5 pointer-coarse:size-11",onClick:()=>m(!0),children:e.jsx(Mt,{})}),o&&e.jsx(In,{roomId:t,source:p,attachment:n,onClose:()=>m(!1)})]})}function In({roomId:t,source:n,attachment:a,onClose:x}){const p=ne(),c=oe(),[o,m]=s.useState(Q),[r,l]=s.useState(a.name),[u,N]=s.useState(null),[F,D]=s.useState(!1),L=s.useId(),C=ce(ke(n,o,!1,c)),U=s.useMemo(()=>{var k;return nt(((k=C.data)==null?void 0:k.entries)??[]).filter(h=>h.type==="dir")},[C.data]),I=async()=>{var h,g;const k=r.trim();if(k!==""){D(!0),N(null);try{await p.saveAttachmentToRoomFiles(t,{attachmentId:a.id,dir:o,name:k,baseCommit:((h=C.data)==null?void 0:h.commit)??null}),c.invalidateQueries({queryKey:["file-explorer","tree",n.scopeKey]}),J.success(`Saved ${k} to the room’s files`),x()}catch(w){let b;try{b=Gt(w,c,t)}catch{b={status:"refused",reason:Qe(w)??"Couldn’t save. Try again in a moment."}}if(b.status==="exists"){const S=(((g=C.data)==null?void 0:g.entries)??[]).map(K=>K.name);N({reason:`This folder already has a file called “${k}”. Pick another name.`,suggestion:Oe({name:k,isDir:!1,taken:[...S,k]})})}else b.status==="conflict"?(N({reason:"This folder changed while you chose, so nothing was saved. Try again."}),C.refetch()):b.status==="refused"&&N({reason:b.reason})}finally{D(!1)}}};return e.jsx(_t,{open:!0,onOpenChange:k=>!k&&x(),children:e.jsxs(At,{className:"sm:max-w-md",children:[e.jsxs(Lt,{children:[e.jsx(zt,{children:"Save to room files"}),e.jsx($t,{children:"Everyone in the room, and their agents, can find it there."})]}),e.jsxs(It,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Folder"}),e.jsxs("div",{role:"group","aria-label":"Folders",className:"border-border/60 max-h-56 overflow-auto rounded-md border",children:[e.jsx("p",{className:"bg-muted/40 truncate px-3 py-1.5 font-mono text-xs",children:o===Q?"Top folder":`${o}/`}),o!==Q&&e.jsx($e,{label:"Up one folder",icon:e.jsx(sn,{className:"text-muted-foreground size-(--size-icon-sm)"}),onClick:()=>m(G(o))}),C.isPending?e.jsx("div",{className:"flex h-12 items-center justify-center",children:e.jsx(Fe,{size:"sm",className:"text-muted-foreground",label:"Loading folders"})}):U.length===0?e.jsx("p",{className:"text-muted-foreground px-3 py-2 text-xs",children:"No folders in here."}):U.map(k=>e.jsx($e,{label:k.name,icon:e.jsx(be,{className:"size-(--size-icon-sm) text-sky-500"}),chevron:!0,onClick:()=>m(ee(o,le(k.path)))},k.path))]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:L,className:"text-muted-foreground text-xs font-medium",children:"Name"}),e.jsx(Kt,{id:L,value:r,onChange:k=>{l(k.target.value),N(null)},spellCheck:!1,autoComplete:"off"})]}),u!==null&&e.jsxs("div",{role:"alert",className:"text-destructive space-y-1 text-xs",children:[e.jsx("p",{children:u.reason}),u.suggestion!==void 0&&e.jsxs(W,{type:"button",variant:"outline",size:"xs",onClick:()=>{l(u.suggestion),N(null)},children:["Use “",u.suggestion,"”"]})]})]}),e.jsxs(Ht,{className:"gap-2",children:[e.jsx(W,{type:"button",variant:"ghost",onClick:x,children:"Cancel"}),e.jsx(W,{type:"button",disabled:F||r.trim()===""||C.isPending,onClick:()=>void I(),children:F?"Saving…":o===Q?"Save to the top folder":`Save to ${le(o)}`})]})]})})}function $e({label:t,icon:n,chevron:a=!1,onClick:x}){return e.jsxs("button",{type:"button",onClick:x,className:"hover:bg-accent/50 focus-visible:bg-accent flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm outline-none",children:[n,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),a&&e.jsx(Ke,{className:"text-muted-foreground size-3.5"})]})}export{On as FileExplorer,es as FileExplorerActions,Yt as FilePreviewDialog,rn as HIDDEN_ENTRY_NAMES,at as HiddenEntriesToggle,rs as NO_PROVENANCE,Ne as PINNED_ENTRY_NAMES,os as ROOM_FILES_REFRESH_INTERVAL_MS,ts as RoomFilesSection,ns as SaveToRoomFilesButton,Be as createRoomFilesSource,gn as createSessionCwdSource,ie as explorerDirQueryKey,ke as explorerDirQueryOptions,on as isHiddenEntryName,Re as isPinnedEntryName,ln as pinnedFirst,Bt as provenanceLine,Ue as roomRepoStatusQueryOptions,nt as withoutHidden};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as G,E as A,C as N}from"./index-cI2u8WZS.js";import{s as I,t as p,E as Y,e as k,j,a as U,L as Z,i as B,f as D,O as M}from"./index-DabU6r9W.js";import"./index-C3cvP8Fo.js";const h=1,F=2,L=3,K=4,H=5,J=36,ee=37,te=38,Oe=11,oe=13;function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ne(e){return e==9||e==10||e==13||e==32}let Q=null,V=null,X=0;function W(e,t){let o=e.pos+t;if(V==e&&X==o)return Q;for(;ne(e.peek(t));)t++;let O="";for(;;){let r=e.peek(t);if(!re(r))break;O+=String.fromCharCode(r),t++}return V=e,X=o,Q=O||null}function _(e,t){this.name=e,this.parent=t}const ae=new N({start:null,shift(e,t,o,O){return t==h?new _(W(O,1)||"",e):e},reduce(e,t){return t==Oe&&e?e.parent:e},reuse(e,t,o,O){let r=t.type.id;return r==h||r==oe?new _(W(O,1)||"",e):e},strict:!1}),le=new A((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let o=W(e,0);if(!o)return e.acceptToken(H);if(t.context&&o==t.context.name)return e.acceptToken(F);for(let O=t.context;O;O=O.parent)if(O.name==o)return e.acceptToken(L,-2);e.acceptToken(K)}else if(e.next!=33&&e.next!=63)return e.acceptToken(h)}},{contextual:!0});function y(e,t){return new A(o=>{let O=0,r=t.charCodeAt(0);e:for(;!(o.next<0);o.advance(),O++)if(o.next==r){for(let a=1;a<t.length;a++)if(o.peek(a)!=t.charCodeAt(a))continue e;break}O&&o.acceptToken(e)})}const se=y(J,"-->"),ie=y(ee,"?>"),ce=y(te,"]]>"),me=I({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),$e=G.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(TOpO7+$fOOOP7+$f7+$fO(]O!bO<<GuOOOP<<Gu<<GuOOOP<<G}<<G}O'bOpO1G.qO'bOpO1G.qO(hO#tO'#CnO(vO&jO'#CnOOOO1G.q1G.qO)UOpO7+$aOOOP7+$a7+$aOOOP<<HQ<<HQOOOPAN=aAN=aOOOPAN=iAN=iO'bOpO7+$]OOOO7+$]7+$]OOOO'#Cz'#CzO)^O#tO,59YOOOO,59Y,59YOOOO'#C{'#C{O)lO&jO,59YOOOP<<G{<<G{OOOO<<Gw<<GwOOOO-E6x-E6xOOOO1G.t1G.tOOOO-E6y-E6y",stateData:")z~OPQOSVOTWOVWOWWOXWOiXOyPO!QTO!SUO~OvZOx]O~O^`Oz^O~OPQOQcOSVOTWOVWOWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:ae,nodeProps:[["closedBy",1,"SelfCloseEndTag EndTag",13,"CloseTag MissingCloseTag"],["openedBy",12,"StartTag StartCloseTag",19,"OpenTag",20,"StartTag"],["isolate",-6,13,18,19,21,22,24,""]],propSources:[me],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qa%nVVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%gP&YTVPOv&Tw!^&T!_;'S&T;'S;=`&i<%lO&TP&lP;=`<%l&T`&tS!O`Ov&ox;'S&o;'S;=`'Q<%lO&o`'TP;=`<%l&oa'ZP;=`<%l%gX'eWVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^W(ST|WOr'}sv'}w;'S'};'S;=`(c<%lO'}W(fP;=`<%l'}X(lP;=`<%l'^h(vV|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oh)`P;=`<%l(oi)fP;=`<%l$qo)t`VP|W!O`zUOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk+PV{YVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%g~+iast,n![!]-r!c!}-r#R#S-r#T#o-r%W%o-r%p&a-r&b1p-r4U4d-r4e$IS-r$I`$Ib-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~,qQ!Q![,w#l#m-V~,zQ!Q![,w!]!^-Q~-VOX~~-YR!Q![-c!c!i-c#T#Z-c~-fS!Q![-c!]!^-Q!c!i-c#T#Z-c~-ug}!O-r!O!P-r!Q![-r![!]-r!]!^/^!c!}-r#R#S-r#T#o-r$}%O-r%W%o-r%p&a-r&b1p-r1p4U-r4U4d-r4e$IS-r$I`$Ib-r$Je$Jg-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~/cOW~~/fP;=`<%l-rk/rW}bVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^k0eZVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O1W!O!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk1aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a2S!a;'S$q;'S;=`)c<%lO$qk2_X!PQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qm3TZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a3v!a;'S$q;'S;=`)c<%lO$qm4RXdSVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo4{!P`S^QVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O4n!O!P4n!P!Q$q!Q![4n![!]4n!]!^$q!^!_(o!_!c$q!c!}4n!}#R$q#R#S4n#S#T$q#T#o4n#o$}$q$}%O4n%O%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U4n4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Je$q$Je$Jg4n$Jg$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qo8RP;=`<%l4ni8]Y|W!O`Oq(oqr8{rs&osv(owx'}x!a(o!a!b!#U!b;'S(o;'S;=`)]<%lO(oi9S_|W!O`Or(ors&osv(owx'}x}(o}!O:R!O!f(o!f!g;e!g!}(o!}#ODh#O#W(o#W#XLp#X;'S(o;'S;=`)]<%lO(oi:YX|W!O`Or(ors&osv(owx'}x}(o}!O:u!O;'S(o;'S;=`)]<%lO(oi;OV!QP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oi;lX|W!O`Or(ors&osv(owx'}x!q(o!q!r<X!r;'S(o;'S;=`)]<%lO(oi<`X|W!O`Or(ors&osv(owx'}x!e(o!e!f<{!f;'S(o;'S;=`)]<%lO(oi=SX|W!O`Or(ors&osv(owx'}x!v(o!v!w=o!w;'S(o;'S;=`)]<%lO(oi=vX|W!O`Or(ors&osv(owx'}x!{(o!{!|>c!|;'S(o;'S;=`)]<%lO(oi>jX|W!O`Or(ors&osv(owx'}x!r(o!r!s?V!s;'S(o;'S;=`)]<%lO(oi?^X|W!O`Or(ors&osv(owx'}x!g(o!g!h?y!h;'S(o;'S;=`)]<%lO(oi@QY|W!O`Or?yrs@psv?yvwA[wxBdx!`?y!`!aCr!a;'S?y;'S;=`Db<%lO?ya@uV!O`Ov@pvxA[x!`@p!`!aAy!a;'S@p;'S;=`B^<%lO@pPA_TO!`A[!`!aAn!a;'SA[;'S;=`As<%lOA[PAsOiPPAvP;=`<%lA[aBQSiP!O`Ov&ox;'S&o;'S;=`'Q<%lO&oaBaP;=`<%l@pXBiX|WOrBdrsA[svBdvwA[w!`Bd!`!aCU!a;'SBd;'S;=`Cl<%lOBdXC]TiP|WOr'}sv'}w;'S'};'S;=`(c<%lO'}XCoP;=`<%lBdiC{ViP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiDeP;=`<%l?yiDoZ|W!O`Or(ors&osv(owx'}x!e(o!e!fEb!f#V(o#V#WIr#W;'S(o;'S;=`)]<%lO(oiEiX|W!O`Or(ors&osv(owx'}x!f(o!f!gFU!g;'S(o;'S;=`)]<%lO(oiF]X|W!O`Or(ors&osv(owx'}x!c(o!c!dFx!d;'S(o;'S;=`)]<%lO(oiGPX|W!O`Or(ors&osv(owx'}x!v(o!v!wGl!w;'S(o;'S;=`)]<%lO(oiGsX|W!O`Or(ors&osv(owx'}x!c(o!c!dH`!d;'S(o;'S;=`)]<%lO(oiHgX|W!O`Or(ors&osv(owx'}x!}(o!}#OIS#O;'S(o;'S;=`)]<%lO(oiI]V|W!O`yPOr(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiIyX|W!O`Or(ors&osv(owx'}x#W(o#W#XJf#X;'S(o;'S;=`)]<%lO(oiJmX|W!O`Or(ors&osv(owx'}x#T(o#T#UKY#U;'S(o;'S;=`)]<%lO(oiKaX|W!O`Or(ors&osv(owx'}x#h(o#h#iK|#i;'S(o;'S;=`)]<%lO(oiLTX|W!O`Or(ors&osv(owx'}x#T(o#T#UH`#U;'S(o;'S;=`)]<%lO(oiLwX|W!O`Or(ors&osv(owx'}x#c(o#c#dMd#d;'S(o;'S;=`)]<%lO(oiMkX|W!O`Or(ors&osv(owx'}x#V(o#V#WNW#W;'S(o;'S;=`)]<%lO(oiN_X|W!O`Or(ors&osv(owx'}x#h(o#h#iNz#i;'S(o;'S;=`)]<%lO(oi! RX|W!O`Or(ors&osv(owx'}x#m(o#m#n! n#n;'S(o;'S;=`)]<%lO(oi! uX|W!O`Or(ors&osv(owx'}x#d(o#d#e!!b#e;'S(o;'S;=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[le,se,ie,ce,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function T(e,t){let o=t&&t.getChild("TagName");return o?e.sliceString(o.from,o.to):""}function P(e,t){let o=t&&t.firstChild;return!o||o.name!="OpenTag"?"":T(e,o)}function Se(e,t,o){let O=t&&t.getChildren("Attribute").find(a=>a.from<=o&&a.to>=o),r=O&&O.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}function C(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function ge(e,t){var o;let O=k(e).resolveInner(t,-1),r=null;for(let a=O;!r&&a.parent;a=a.parent)(a.name=="OpenTag"||a.name=="CloseTag"||a.name=="SelfClosingTag"||a.name=="MismatchedCloseTag")&&(r=a);if(r&&(r.to>t||r.lastChild.type.isError)){let a=r.parent;if(O.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:a}:{type:"openTag",from:O.from,context:C(a)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:r};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:r};let s=O==r||O.name=="Attribute"?O.childBefore(t):O;return(s==null?void 0:s.name)=="StartTag"?{type:"openTag",from:t,context:C(a)}:(s==null?void 0:s.name)=="StartCloseTag"&&s.to<=t?{type:"closeTag",from:t,context:a}:(s==null?void 0:s.name)=="Is"?{type:"attrValue",from:t,context:r}:s?{type:"attrName",from:t,context:r}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((o=O.lastChild)===null||o===void 0)&&o.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:C(O)}:null}class ue{constructor(t,o,O){this.attrs=o,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(r=>({label:r,type:"text"})):[]}}const b=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function R(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let o=[],O=[],r=Object.create(null);for(let n of t){let $=E(n);o.push($),n.global&&O.push($),n.values&&(r[n.name]=n.values.map(R))}let a=[],s=[],f=Object.create(null);for(let n of e){let $=O,c=r;n.attributes&&($=$.concat(n.attributes.map(l=>typeof l=="string"?o.find(d=>d.label==l)||{label:l,type:"property"}:(l.values&&(c==r&&(c=Object.create(c)),c[l.name]=l.values.map(R)),E(l)))));let u=new ue(n,$,c);f[u.name]=u,a.push(u),n.top&&s.push(u)}s.length||(s=a);for(let n=0;n<a.length;n++){let $=e[n],c=a[n];if($.children)for(let u of $.children)f[u]&&c.children.push(f[u]);else c.children=a}return n=>{var $;let{doc:c}=n.state,u=ge(n.state,n.pos);if(!u||u.type=="tag"&&!n.explicit)return null;let{type:l,from:d,context:S}=u;if(l=="openTag"){let i=s,m=P(c,S);if(m){let g=f[m];i=(g==null?void 0:g.children)||a}return{from:d,options:i.map(g=>g.completion),validFor:b}}else if(l=="closeTag"){let i=P(c,S);return i?{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)==">"?1:0),options:[(($=f[i])===null||$===void 0?void 0:$.closeNameCompletion)||{label:i+">",type:"type"}],validFor:b}:null}else if(l=="attrName"){let i=f[T(c,S)];return{from:d,options:(i==null?void 0:i.attrs)||O,validFor:b}}else if(l=="attrValue"){let i=Se(c,S,d);if(!i)return null;let m=f[T(c,S)],g=((m==null?void 0:m.attrValues)||r)[i];return!g||!g.length?null:{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)=='"'?1:0),options:g,validFor:/^"[^"]*"?$/}}else if(l=="tag"){let i=P(c,S),m=f[i],g=[],q=S&&S.lastChild;i&&(!q||q.name!="CloseTag"||T(c,q)!=i)&&g.push(m?m.closeCompletion:{label:"</"+i+">",type:"type",boost:2});let v=g.concat(((m==null?void 0:m.children)||(S?a:s)).map(x=>x.openCompletion));if(S&&(m!=null&&m.text.length)){let x=S.firstChild;x.to>n.pos-20&&!/\S/.test(n.state.sliceDoc(x.to,n.pos))&&(v=v.concat(m.text))}return{from:d,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const w=Z.define({name:"xml",parser:$e.configure({props:[B.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),D.add({Element(e){let t=e.firstChild,o=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:o.name=="CloseTag"?o.from:e.to}}}),M.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function Te(e={}){let t=[w.data.of({autocomplete:pe(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(fe),new U(w,t)}function z(e,t,o=e.length){if(!t)return"";let O=t.firstChild,r=O&&O.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,o)):""}const fe=Y.inputHandler.of((e,t,o,O,r)=>{if(e.composing||e.state.readOnly||t!=o||O!=">"&&O!="/"||!w.isActiveAt(e.state,t,-1))return!1;let a=r(),{state:s}=a,f=s.changeByRange(n=>{var $,c,u;let{head:l}=n,d=s.doc.sliceString(l-1,l)==O,S=k(s).resolveInner(l,-1),i;if(d&&O==">"&&S.name=="EndTag"){let m=S.parent;if(((c=($=m.parent)===null||$===void 0?void 0:$.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(i=z(s.doc,m.parent,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`</${i}>`;return{range:n,changes:{from:l,to:g,insert:q}}}}else if(d&&O=="/"&&S.name=="StartCloseTag"){let m=S.parent;if(S.from==l-2&&((u=m.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(i=z(s.doc,m,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`${i}>`;return{range:j.cursor(l+q.length,-1),changes:{from:l,to:g,insert:q}}}}return{range:n}});return f.changes.empty?!1:(e.dispatch([a,s.update(f,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{fe as autoCloseTags,pe as completeFromSchema,Te as xml,w as xmlLanguage};
|
|
1
|
+
import{L as G,E as A,C as N}from"./index-Bri5bZfv.js";import{s as I,t as p,E as Y,e as k,j,a as U,L as Z,i as B,f as D,O as M}from"./index-ZYbeRA5f.js";import"./index-DKTd8X7n.js";const h=1,F=2,L=3,K=4,H=5,J=36,ee=37,te=38,Oe=11,oe=13;function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ne(e){return e==9||e==10||e==13||e==32}let Q=null,V=null,X=0;function W(e,t){let o=e.pos+t;if(V==e&&X==o)return Q;for(;ne(e.peek(t));)t++;let O="";for(;;){let r=e.peek(t);if(!re(r))break;O+=String.fromCharCode(r),t++}return V=e,X=o,Q=O||null}function _(e,t){this.name=e,this.parent=t}const ae=new N({start:null,shift(e,t,o,O){return t==h?new _(W(O,1)||"",e):e},reduce(e,t){return t==Oe&&e?e.parent:e},reuse(e,t,o,O){let r=t.type.id;return r==h||r==oe?new _(W(O,1)||"",e):e},strict:!1}),le=new A((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let o=W(e,0);if(!o)return e.acceptToken(H);if(t.context&&o==t.context.name)return e.acceptToken(F);for(let O=t.context;O;O=O.parent)if(O.name==o)return e.acceptToken(L,-2);e.acceptToken(K)}else if(e.next!=33&&e.next!=63)return e.acceptToken(h)}},{contextual:!0});function y(e,t){return new A(o=>{let O=0,r=t.charCodeAt(0);e:for(;!(o.next<0);o.advance(),O++)if(o.next==r){for(let a=1;a<t.length;a++)if(o.peek(a)!=t.charCodeAt(a))continue e;break}O&&o.acceptToken(e)})}const se=y(J,"-->"),ie=y(ee,"?>"),ce=y(te,"]]>"),me=I({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),$e=G.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6z-E6zOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6{-E6{OOOP1G.x1G.xOOOS-E6|-E6|OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'mO!bO,59eOOOO-E6w-E6wO'{OpO1G.uO'{OpO1G.uOOOP1G.u1G.uO(TOpO7+$fOOOP7+$f7+$fO(]O!bO<<GuOOOP<<Gu<<GuOOOP<<G}<<G}O'bOpO1G.qO'bOpO1G.qO(hO#tO'#CnO(vO&jO'#CnOOOO1G.q1G.qO)UOpO7+$aOOOP7+$a7+$aOOOP<<HQ<<HQOOOPAN=aAN=aOOOPAN=iAN=iO'bOpO7+$]OOOO7+$]7+$]OOOO'#Cz'#CzO)^O#tO,59YOOOO,59Y,59YOOOO'#C{'#C{O)lO&jO,59YOOOP<<G{<<G{OOOO<<Gw<<GwOOOO-E6x-E6xOOOO1G.t1G.tOOOO-E6y-E6y",stateData:")z~OPQOSVOTWOVWOWWOXWOiXOyPO!QTO!SUO~OvZOx]O~O^`Oz^O~OPQOQcOSVOTWOVWOWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:ae,nodeProps:[["closedBy",1,"SelfCloseEndTag EndTag",13,"CloseTag MissingCloseTag"],["openedBy",12,"StartTag StartCloseTag",19,"OpenTag",20,"StartTag"],["isolate",-6,13,18,19,21,22,24,""]],propSources:[me],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qa%nVVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%gP&YTVPOv&Tw!^&T!_;'S&T;'S;=`&i<%lO&TP&lP;=`<%l&T`&tS!O`Ov&ox;'S&o;'S;=`'Q<%lO&o`'TP;=`<%l&oa'ZP;=`<%l%gX'eWVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^W(ST|WOr'}sv'}w;'S'};'S;=`(c<%lO'}W(fP;=`<%l'}X(lP;=`<%l'^h(vV|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oh)`P;=`<%l(oi)fP;=`<%l$qo)t`VP|W!O`zUOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk+PV{YVP!O`Ov%gwx&Tx!^%g!^!_&o!_;'S%g;'S;=`'W<%lO%g~+iast,n![!]-r!c!}-r#R#S-r#T#o-r%W%o-r%p&a-r&b1p-r4U4d-r4e$IS-r$I`$Ib-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~,qQ!Q![,w#l#m-V~,zQ!Q![,w!]!^-Q~-VOX~~-YR!Q![-c!c!i-c#T#Z-c~-fS!Q![-c!]!^-Q!c!i-c#T#Z-c~-ug}!O-r!O!P-r!Q![-r![!]-r!]!^/^!c!}-r#R#S-r#T#o-r$}%O-r%W%o-r%p&a-r&b1p-r1p4U-r4U4d-r4e$IS-r$I`$Ib-r$Je$Jg-r$Kh%#t-r&/x&Et-r&FV;'S-r;'S;:j/c?&r?Ah-r?BY?Mn-r~/cOW~~/fP;=`<%l-rk/rW}bVP|WOr'^rs&Tsv'^w!^'^!^!_'}!_;'S'^;'S;=`(i<%lO'^k0eZVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O1W!O!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk1aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a2S!a;'S$q;'S;=`)c<%lO$qk2_X!PQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qm3TZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a3v!a;'S$q;'S;=`)c<%lO$qm4RXdSVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo4{!P`S^QVP|W!O`Or$qrs%gsv$qwx'^x}$q}!O4n!O!P4n!P!Q$q!Q![4n![!]4n!]!^$q!^!_(o!_!c$q!c!}4n!}#R$q#R#S4n#S#T$q#T#o4n#o$}$q$}%O4n%O%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U4n4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Je$q$Je$Jg4n$Jg$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qo8RP;=`<%l4ni8]Y|W!O`Oq(oqr8{rs&osv(owx'}x!a(o!a!b!#U!b;'S(o;'S;=`)]<%lO(oi9S_|W!O`Or(ors&osv(owx'}x}(o}!O:R!O!f(o!f!g;e!g!}(o!}#ODh#O#W(o#W#XLp#X;'S(o;'S;=`)]<%lO(oi:YX|W!O`Or(ors&osv(owx'}x}(o}!O:u!O;'S(o;'S;=`)]<%lO(oi;OV!QP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oi;lX|W!O`Or(ors&osv(owx'}x!q(o!q!r<X!r;'S(o;'S;=`)]<%lO(oi<`X|W!O`Or(ors&osv(owx'}x!e(o!e!f<{!f;'S(o;'S;=`)]<%lO(oi=SX|W!O`Or(ors&osv(owx'}x!v(o!v!w=o!w;'S(o;'S;=`)]<%lO(oi=vX|W!O`Or(ors&osv(owx'}x!{(o!{!|>c!|;'S(o;'S;=`)]<%lO(oi>jX|W!O`Or(ors&osv(owx'}x!r(o!r!s?V!s;'S(o;'S;=`)]<%lO(oi?^X|W!O`Or(ors&osv(owx'}x!g(o!g!h?y!h;'S(o;'S;=`)]<%lO(oi@QY|W!O`Or?yrs@psv?yvwA[wxBdx!`?y!`!aCr!a;'S?y;'S;=`Db<%lO?ya@uV!O`Ov@pvxA[x!`@p!`!aAy!a;'S@p;'S;=`B^<%lO@pPA_TO!`A[!`!aAn!a;'SA[;'S;=`As<%lOA[PAsOiPPAvP;=`<%lA[aBQSiP!O`Ov&ox;'S&o;'S;=`'Q<%lO&oaBaP;=`<%l@pXBiX|WOrBdrsA[svBdvwA[w!`Bd!`!aCU!a;'SBd;'S;=`Cl<%lOBdXC]TiP|WOr'}sv'}w;'S'};'S;=`(c<%lO'}XCoP;=`<%lBdiC{ViP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiDeP;=`<%l?yiDoZ|W!O`Or(ors&osv(owx'}x!e(o!e!fEb!f#V(o#V#WIr#W;'S(o;'S;=`)]<%lO(oiEiX|W!O`Or(ors&osv(owx'}x!f(o!f!gFU!g;'S(o;'S;=`)]<%lO(oiF]X|W!O`Or(ors&osv(owx'}x!c(o!c!dFx!d;'S(o;'S;=`)]<%lO(oiGPX|W!O`Or(ors&osv(owx'}x!v(o!v!wGl!w;'S(o;'S;=`)]<%lO(oiGsX|W!O`Or(ors&osv(owx'}x!c(o!c!dH`!d;'S(o;'S;=`)]<%lO(oiHgX|W!O`Or(ors&osv(owx'}x!}(o!}#OIS#O;'S(o;'S;=`)]<%lO(oiI]V|W!O`yPOr(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(oiIyX|W!O`Or(ors&osv(owx'}x#W(o#W#XJf#X;'S(o;'S;=`)]<%lO(oiJmX|W!O`Or(ors&osv(owx'}x#T(o#T#UKY#U;'S(o;'S;=`)]<%lO(oiKaX|W!O`Or(ors&osv(owx'}x#h(o#h#iK|#i;'S(o;'S;=`)]<%lO(oiLTX|W!O`Or(ors&osv(owx'}x#T(o#T#UH`#U;'S(o;'S;=`)]<%lO(oiLwX|W!O`Or(ors&osv(owx'}x#c(o#c#dMd#d;'S(o;'S;=`)]<%lO(oiMkX|W!O`Or(ors&osv(owx'}x#V(o#V#WNW#W;'S(o;'S;=`)]<%lO(oiN_X|W!O`Or(ors&osv(owx'}x#h(o#h#iNz#i;'S(o;'S;=`)]<%lO(oi! RX|W!O`Or(ors&osv(owx'}x#m(o#m#n! n#n;'S(o;'S;=`)]<%lO(oi! uX|W!O`Or(ors&osv(owx'}x#d(o#d#e!!b#e;'S(o;'S;=`)]<%lO(oi!!iX|W!O`Or(ors&osv(owx'}x#X(o#X#Y?y#Y;'S(o;'S;=`)]<%lO(oi!#_V!SP|W!O`Or(ors&osv(owx'}x;'S(o;'S;=`)]<%lO(ok!$PXaQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qo!$wX[UVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!%mZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!&`!a;'S$q;'S;=`)c<%lO$qk!&kX!RQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[le,se,ie,ce,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function T(e,t){let o=t&&t.getChild("TagName");return o?e.sliceString(o.from,o.to):""}function P(e,t){let o=t&&t.firstChild;return!o||o.name!="OpenTag"?"":T(e,o)}function Se(e,t,o){let O=t&&t.getChildren("Attribute").find(a=>a.from<=o&&a.to>=o),r=O&&O.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}function C(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function ge(e,t){var o;let O=k(e).resolveInner(t,-1),r=null;for(let a=O;!r&&a.parent;a=a.parent)(a.name=="OpenTag"||a.name=="CloseTag"||a.name=="SelfClosingTag"||a.name=="MismatchedCloseTag")&&(r=a);if(r&&(r.to>t||r.lastChild.type.isError)){let a=r.parent;if(O.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:a}:{type:"openTag",from:O.from,context:C(a)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:r};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:r};let s=O==r||O.name=="Attribute"?O.childBefore(t):O;return(s==null?void 0:s.name)=="StartTag"?{type:"openTag",from:t,context:C(a)}:(s==null?void 0:s.name)=="StartCloseTag"&&s.to<=t?{type:"closeTag",from:t,context:a}:(s==null?void 0:s.name)=="Is"?{type:"attrValue",from:t,context:r}:s?{type:"attrName",from:t,context:r}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((o=O.lastChild)===null||o===void 0)&&o.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:C(O)}:null}class ue{constructor(t,o,O){this.attrs=o,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(r=>({label:r,type:"text"})):[]}}const b=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function R(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let o=[],O=[],r=Object.create(null);for(let n of t){let $=E(n);o.push($),n.global&&O.push($),n.values&&(r[n.name]=n.values.map(R))}let a=[],s=[],f=Object.create(null);for(let n of e){let $=O,c=r;n.attributes&&($=$.concat(n.attributes.map(l=>typeof l=="string"?o.find(d=>d.label==l)||{label:l,type:"property"}:(l.values&&(c==r&&(c=Object.create(c)),c[l.name]=l.values.map(R)),E(l)))));let u=new ue(n,$,c);f[u.name]=u,a.push(u),n.top&&s.push(u)}s.length||(s=a);for(let n=0;n<a.length;n++){let $=e[n],c=a[n];if($.children)for(let u of $.children)f[u]&&c.children.push(f[u]);else c.children=a}return n=>{var $;let{doc:c}=n.state,u=ge(n.state,n.pos);if(!u||u.type=="tag"&&!n.explicit)return null;let{type:l,from:d,context:S}=u;if(l=="openTag"){let i=s,m=P(c,S);if(m){let g=f[m];i=(g==null?void 0:g.children)||a}return{from:d,options:i.map(g=>g.completion),validFor:b}}else if(l=="closeTag"){let i=P(c,S);return i?{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)==">"?1:0),options:[(($=f[i])===null||$===void 0?void 0:$.closeNameCompletion)||{label:i+">",type:"type"}],validFor:b}:null}else if(l=="attrName"){let i=f[T(c,S)];return{from:d,options:(i==null?void 0:i.attrs)||O,validFor:b}}else if(l=="attrValue"){let i=Se(c,S,d);if(!i)return null;let m=f[T(c,S)],g=((m==null?void 0:m.attrValues)||r)[i];return!g||!g.length?null:{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)=='"'?1:0),options:g,validFor:/^"[^"]*"?$/}}else if(l=="tag"){let i=P(c,S),m=f[i],g=[],q=S&&S.lastChild;i&&(!q||q.name!="CloseTag"||T(c,q)!=i)&&g.push(m?m.closeCompletion:{label:"</"+i+">",type:"type",boost:2});let v=g.concat(((m==null?void 0:m.children)||(S?a:s)).map(x=>x.openCompletion));if(S&&(m!=null&&m.text.length)){let x=S.firstChild;x.to>n.pos-20&&!/\S/.test(n.state.sliceDoc(x.to,n.pos))&&(v=v.concat(m.text))}return{from:d,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const w=Z.define({name:"xml",parser:$e.configure({props:[B.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),D.add({Element(e){let t=e.firstChild,o=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:o.name=="CloseTag"?o.from:e.to}}}),M.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function Te(e={}){let t=[w.data.of({autocomplete:pe(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(fe),new U(w,t)}function z(e,t,o=e.length){if(!t)return"";let O=t.firstChild,r=O&&O.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,o)):""}const fe=Y.inputHandler.of((e,t,o,O,r)=>{if(e.composing||e.state.readOnly||t!=o||O!=">"&&O!="/"||!w.isActiveAt(e.state,t,-1))return!1;let a=r(),{state:s}=a,f=s.changeByRange(n=>{var $,c,u;let{head:l}=n,d=s.doc.sliceString(l-1,l)==O,S=k(s).resolveInner(l,-1),i;if(d&&O==">"&&S.name=="EndTag"){let m=S.parent;if(((c=($=m.parent)===null||$===void 0?void 0:$.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(i=z(s.doc,m.parent,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`</${i}>`;return{range:n,changes:{from:l,to:g,insert:q}}}}else if(d&&O=="/"&&S.name=="StartCloseTag"){let m=S.parent;if(S.from==l-2&&((u=m.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(i=z(s.doc,m,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`${i}>`;return{range:j.cursor(l+q.length,-1),changes:{from:l,to:g,insert:q}}}}return{range:n}});return f.changes.empty?!1:(e.dispatch([a,s.update(f,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{fe as autoCloseTags,pe as completeFromSchema,Te as xml,w as xmlLanguage};
|