dorkos 0.117.0 → 0.118.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 +1266 -938
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-H-acF3Uh.js → AboutPage-BOS59p1y.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DHDeFsXG.js → ActivityErrorState-DOmV85tr.js} +1 -1
- package/dist/client/assets/{ActivityPage-xyMrmAY2.js → ActivityPage-DbsBpb6N.js} +1 -1
- package/dist/client/assets/ActivityRow-B1ZeL7Jb.js +1 -0
- package/dist/client/assets/AdapterIcon-XPLZ-NAi.js +1 -0
- package/dist/client/assets/AdapterSetupWizard-DfNJz5SD.js +2 -0
- package/dist/client/assets/{AgentOptionRow-BgPnj-jY.js → AgentOptionRow-C15RQsub.js} +1 -1
- package/dist/client/assets/{AgentPicker-3POlE_TY.js → AgentPicker-CydNJYi_.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-CL5bwXYH.js → AgentRequestCard-BBSbluBs.js} +3 -3
- package/dist/client/assets/{AppearancePage-D3z40f_b.js → AppearancePage-8ALtWGZZ.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-GafmL5mr.js → ApplyToOverridesDialog-Cv3KEf7T.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-4ZSIhmin.js → AttentionSignalRow-c-u1cE1l.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CD8bGnb5.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Re2CfOlC.js} +3 -3
- package/dist/client/assets/BindingDialog-8xnsM47D.js +1 -0
- package/dist/client/assets/{BlintzCanvas-B-PoJThg.js → BlintzCanvas-DUDSNxlM.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-CgiQWBJA.js → CanvasCsvContent-D697P3sa.js} +6 -6
- package/dist/client/assets/CanvasFileContent-BJ39nHuR.js +2 -0
- package/dist/client/assets/{CanvasModel3dContent-BXCQRGHN.js → CanvasModel3dContent-TaunlbT2.js} +2 -2
- package/dist/client/assets/{ChatAppsOff-C60EWHju.js → ChatAppsOff-CFEmPGm1.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-B5dKqE-I.js → CodeMirrorDiff-B7VUevZG.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BzB4Bznz.js → CodeMirrorEditor-BX1bJlnT.js} +1 -1
- package/dist/client/assets/CommitmentList-CDocwl5K.js +1 -0
- package/dist/client/assets/{CommitmentsPage-ChzV2lIP.js → CommitmentsPage-Cr_MvU96.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-mF8l9rkm.js → ComputerResourceView-CJMUZPDy.js} +1 -1
- package/dist/client/assets/{ComputerViewer-CKR_ZSO1.js → ComputerViewer-BA-9lBBN.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-BLLpxhn3.js +1 -0
- package/dist/client/assets/{ConnectionsPage-6PEoOCSe.js → ConnectionsPage-BWVfAPd1.js} +2 -2
- package/dist/client/assets/ConventionPage-EK3WUWVa.js +11 -0
- package/dist/client/assets/{ExtensionPageRoute-Bv2i-Pqm.js → ExtensionPageRoute-C9hsJNX2.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-C5S-Mncm.js → FloatingTanStackRouterDevtools-CqogiFob-BeyAgBfh.js} +1 -1
- package/dist/client/assets/HandlePage-CfeEzfDk.js +1 -0
- package/dist/client/assets/HeartbeatPage-DfbNenFv.js +1 -0
- package/dist/client/assets/{KeyEntry-IgIIE1HE.js → KeyEntry-CEbe5Xvn.js} +2 -2
- package/dist/client/assets/{LexicalField-B3neANKd.js → LexicalField-DC_6Z-Ye.js} +1 -1
- package/dist/client/assets/{ManagesPage-gDDvLXjS.js → ManagesPage-CYnGvNM2.js} +1 -1
- package/dist/client/assets/{Marketplace-DAe-slPr.js → Marketplace-CWiiq8of.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-jhoKlyGb.js → MarketplaceSourcesView-DF3cHMR0.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BQxyYB23.js → McpAppFrame-D5Muf5Sf.js} +2 -2
- package/dist/client/assets/{McpSigninBody-DNB9IVJs.js → McpSigninBody-CLZFoQgC.js} +1 -1
- package/dist/client/assets/{Model3dViewer-CZYCij-x.js → Model3dViewer-C9ODHy5I.js} +1 -1
- package/dist/client/assets/NamePage-B4YrH-ug.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-Co9Uv5t5.js +1 -0
- package/dist/client/assets/{NotificationsPage-BZIME3p9.js → NotificationsPage-ldulSpVu.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-C1E_5NM2.js → OpenMeshSwitch-BfEvR7s7.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-BV0aT5IX.js → OperatorIdentityForm-ZM_zDnjM.js} +1 -1
- package/dist/client/assets/{PermissionHistory-Btciwm3c.js → PermissionHistory-liL_pJDR.js} +1 -1
- package/dist/client/assets/{PermissionsPage-CdLK-g0S.js → PermissionsPage-DFMjDQby.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-D7hczXpC.js → PersonalityPopover-CITFG0_N.js} +1 -1
- package/dist/client/assets/PhotoPage-DYDJPBfu.js +1 -0
- package/dist/client/assets/{PresetPicker-Cw2jlFQM.js → PresetPicker-CpYu7nb6.js} +2 -2
- package/dist/client/assets/{PreviewRefusedNotice-CcoKHPsy.js → PreviewRefusedNotice-CF3bzfSe.js} +1 -1
- package/dist/client/assets/{ProfileFields-xAsiq8Mz.js → ProfileFields-D4p6bhIa.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-DM8F3Evu.js → ProfilePanelContainer-XCuCnd1t.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-CJYZpLNj.js → ProfileRolePicker-qRf3DSdk.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-CHWGhlr1.js → PromptSuggestionChips-CUwLk83h.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-D781EUfA.js → ReportsToPopover-Cu-Cnzij.js} +1 -1
- package/dist/client/assets/{RoomSurface-CT_OGVWw.js → RoomSurface-CsAifwp2.js} +7 -7
- package/dist/client/assets/{RoomsPage-DcoGt4-A.js → RoomsPage-DZYMR2in.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-6PnPqbut.js → RunsOnPopover-CTBEMstG.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-DY4sjRgN.js +1 -0
- package/dist/client/assets/RuntimeSetupDialog-DJu_-eNa.js +1 -0
- package/dist/client/assets/{SessionsPage-Cnai5quH.js → SessionsPage-thndqcpY.js} +1 -1
- package/dist/client/assets/{SettingsDialog-DUWvCqf_.js → SettingsDialog-CKmcLF66.js} +3 -3
- package/dist/client/assets/SkillsPage-CmXyAw3J.js +1 -0
- package/dist/client/assets/{TaskDialogWrapper-CepIueBg.js → TaskDialogWrapper-Boxr_hgF.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-CCPObBmm.js → TasksEmptyState-CQf1YroK.js} +2 -2
- package/dist/client/assets/{TasksPage-CqoHRhDG.js → TasksPage-DGNXrDAk.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-mHbMrj9_.js → TeamComputerEntry-CIfFRo6-.js} +1 -1
- package/dist/client/assets/ToolsPage-BKZkSarf.js +2 -0
- package/dist/client/assets/{TopologyGraph-Br4qaSXn.js → TopologyGraph-og2tlLj7.js} +1 -1
- package/dist/client/assets/{TourHost-BNT2J0zS.js → TourHost-DzEG8bZP.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-CPtwQ55a.js → UnlinkDialog-BTYC_Sit.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-BeQ2x8Ar.js → WidgetErrorCard-CT4sl_T6.js} +8 -8
- package/dist/client/assets/_shell-BDlkTSin.js +90 -0
- package/dist/client/assets/{_shell._home-DzhKFHpd.js → _shell._home-CP7HQ7Cs.js} +1 -1
- package/dist/client/assets/_shell._home.activity-DGXa_ouh.js +1 -0
- package/dist/client/assets/_shell._home.index-D5kOfqnL.js +3 -0
- package/dist/client/assets/_shell._home.tasks-BSMD-atB.js +1 -0
- package/dist/client/assets/_shell._home.workspaces-Cdsw2-jI.js +1 -0
- package/dist/client/assets/_shell.channels-B4VQ7tiZ.js +10 -0
- package/dist/client/assets/_shell.connections-sF5vS-Lm.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-dFRmIBE1.js → _shell.feedback-requests-hu21WXyA.js} +2 -2
- package/dist/client/assets/_shell.marketplace-B-T-ALMv.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-Chu-9-Vi.js +1 -0
- package/dist/client/assets/{_shell.session-DnREJ52s.js → _shell.session-Bz6wvDBp.js} +3 -3
- package/dist/client/assets/{_shell.team-B1hbq8aH.js → _shell.team-raG7wRwF.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-DSqMu6Ey.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DSqMu6Ey.js +1 -0
- package/dist/client/assets/{access-copy-BLfnVgF5.js → access-copy-CcG3wpsK.js} +1 -1
- package/dist/client/assets/{banner-Cqt8YzUW.js → banner-nt7EFLr6.js} +2 -2
- package/dist/client/assets/card-B_zeSZiU.js +1 -0
- package/dist/client/assets/{command-C9CeOcFB.js → command-CDfYcQI6.js} +1 -1
- package/dist/client/assets/{cpu-D0mdP6ki.js → cpu-D861493C.js} +1 -1
- package/dist/client/assets/empty-state-CQ1oXLFa.js +1 -0
- package/dist/client/assets/{execution-config-AW7ORH0Y.js → execution-config-on8kVvnW.js} +1 -1
- package/dist/client/assets/{file-D3iv2i0G.js → file-Bwo21EVR.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-zZf2-mqw.js → file-exclamation-point-BedYLbs2.js} +1 -1
- package/dist/client/assets/{file-text-CwK7EV60.js → file-text-BTj3WyHS.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-DW1zqXSL.js → find-latest-widget-fence-B8fM5rIs.js} +3 -3
- package/dist/client/assets/form-lSBktWDn.js +1 -0
- package/dist/client/assets/{format-cron-BtOOA5e7.js → format-cron-W7G0In8e.js} +1 -1
- package/dist/client/assets/{git-branch-DPgttvPa.js → git-branch-CKlZ81Bg.js} +1 -1
- package/dist/client/assets/{heart-BwQb2EFQ.js → heart-BSVjeGLA.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-GGvkvk_S.js → highlighted-body-KPVGNVTW-Ct8vmPkj.js} +1 -1
- package/dist/client/assets/index-09EqfhW0.js +1 -0
- package/dist/client/assets/{index-C7BvPaXV.js → index-6pYWHTBx.js} +1 -1
- package/dist/client/assets/{index-ukv5t1cK.js → index-7Fd_Eeda.js} +1 -1
- package/dist/client/assets/{index-CkluSB9W.js → index-B-C_A3lP.js} +2 -2
- package/dist/client/assets/index-BDCqg2iM.css +1 -0
- package/dist/client/assets/index-BHt5KOZA.js +1 -0
- package/dist/client/assets/{index-2MwCJp-O.js → index-BVedye9r.js} +1 -1
- package/dist/client/assets/{index-C1zEos_1.js → index-BdrbKBym.js} +1 -1
- package/dist/client/assets/index-BjTJ6p2k.js +1 -0
- package/dist/client/assets/{index-DUvx8VEa.js → index-C0TknRcB.js} +1 -1
- package/dist/client/assets/index-C8-dwIPp.js +1018 -0
- package/dist/client/assets/{index-BCwnroTw.js → index-C96eZrOR.js} +1 -1
- package/dist/client/assets/index-CAv_6Po4.js +1 -0
- package/dist/client/assets/index-CCWSicoJ.js +1 -0
- package/dist/client/assets/{index-DvpWMPrj.js → index-CF73kwtO.js} +36 -36
- package/dist/client/assets/{index-DxU-VkDj.js → index-CNnnXzI4.js} +1 -1
- package/dist/client/assets/{index-Dk05g-u9.js → index-CQrM6oF9.js} +1 -1
- package/dist/client/assets/{index-6TyLF_Kz.js → index-CaKe9EaL.js} +1 -1
- package/dist/client/assets/{index-obbYyK_q.js → index-CeZ13dpH.js} +1 -1
- package/dist/client/assets/{index-DylucJZe.js → index-CeeHkxIC.js} +1 -1
- package/dist/client/assets/index-ClELcMX1.js +1 -0
- package/dist/client/assets/{index-B-032E-J.js → index-CrEyJcPM.js} +3 -3
- package/dist/client/assets/{index-CmELWXLL.js → index-D7kjWnlR.js} +1 -1
- package/dist/client/assets/{index-8XbUBB9y.js → index-DEOzZEcu.js} +3 -3
- package/dist/client/assets/{index-2kcIgMts.js → index-DOuj--Yi.js} +1 -1
- package/dist/client/assets/{index-DsRVcCEI.js → index-DQJM5kjJ.js} +1 -1
- package/dist/client/assets/{index-D09-6MJl.js → index-DShrfGYE.js} +1 -1
- package/dist/client/assets/{index-BSGR71VY.js → index-DURo45pu.js} +1 -1
- package/dist/client/assets/{index-mPmWFWvR.js → index-DeNVXdMl.js} +1 -1
- package/dist/client/assets/{index-CYRBybyy.js → index-DgRqCuFH.js} +1 -1
- package/dist/client/assets/{index-BzHf9H2D.js → index-Dh8D-3Sb.js} +1 -1
- package/dist/client/assets/{index-5jiMMwFO.js → index-DjI5vH_U.js} +1 -1
- package/dist/client/assets/{index-BBKtLMOE.js → index-Dq4bx2np.js} +1 -1
- package/dist/client/assets/{index-BtUom5gL.js → index-GINKfP45.js} +1 -1
- package/dist/client/assets/{index-DhWcN0iH.js → index-KaSZDcGa.js} +1 -1
- package/dist/client/assets/{index-Xmzz0kKG.js → index-RFknyjho.js} +1 -1
- package/dist/client/assets/{index-BYRhWLhr.js → index-SdTS2P3x.js} +1 -1
- package/dist/client/assets/{index-aRrsIRtW.js → index-UNxDevG6.js} +1 -1
- package/dist/client/assets/{index-D_bIHF5l.js → index-V_EcsvR4.js} +1 -1
- package/dist/client/assets/{index--IvDgnWz.js → index-bvqpTKLz.js} +1 -1
- package/dist/client/assets/{index-Bw9sMeWJ.js → index-gbNK9zj5.js} +3 -3
- package/dist/client/assets/{index-aqnG9V3q.js → index-sfSRuIXm.js} +6 -6
- package/dist/client/assets/{inline-code-BDPvCbUE.js → inline-code-Beal0546.js} +1 -1
- package/dist/client/assets/{layers-C0fTjhD3.js → layers-DUfQMkMa.js} +1 -1
- package/dist/client/assets/{lightbulb-CauvTp1H.js → lightbulb-DTSn-mNB.js} +2 -2
- package/dist/client/assets/{link-2-BFWagtwF.js → link-2-CHr2s4m2.js} +2 -2
- package/dist/client/assets/{list-runtime-types-DWuilOeW.js → list-runtime-types-CwEp9Lg4.js} +1 -1
- package/dist/client/assets/{markdown-content-irJMN3oI.js → markdown-content-GoymYcRL.js} +1 -1
- package/dist/client/assets/mention-pill-XE9mX9G8.js +1 -0
- package/dist/client/assets/{message-square-off-CEgJ9mPa.js → message-square-off-DUkKSITA.js} +1 -1
- package/dist/client/assets/more-details-3dDtVYc6.js +1 -0
- package/dist/client/assets/{owner-notice-D0r6ZH_Y.js → owner-notice-BKmuWRki.js} +1 -1
- package/dist/client/assets/{package-DzrvXxqm.js → package-DM7e-GVa.js} +1 -1
- package/dist/client/assets/page-container-nGewlFnj.js +1 -0
- package/dist/client/assets/{paperclip-C_2eggQt.js → paperclip-BgXlvBBI.js} +1 -1
- package/dist/client/assets/{path-input-ExHSfE6J.js → path-input-RzOiTE45.js} +1 -1
- package/dist/client/assets/primer-trigger-B60oEVY7.js +3 -0
- package/dist/client/assets/{profile-errors-C-4JXW0u.js → profile-errors-CFZN0y6a.js} +1 -1
- package/dist/client/assets/{progress--zm5Rh4c.js → progress-Cvnh4Qcr.js} +1 -1
- package/dist/client/assets/{query-error-state-CPMymRkX.js → query-error-state-CfJfYpa3.js} +1 -1
- package/dist/client/assets/{radio-oT4bYZ-T.js → radio-BOcAjXVO.js} +1 -1
- package/dist/client/assets/registry-B9wsS5De.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-CfXA97kO.js → relay-trace-schemas-Cvb7RGjg.js} +2 -2
- package/dist/client/assets/{room-files-source-BgBqLMLB.js → room-files-source-B-ZJA_NM.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-CrElPm6O.js → rotate-ccw-clock-vRQP4hWE.js} +1 -1
- package/dist/client/assets/{rotate-cw-CdW7VTvV.js → rotate-cw-DD2nOAQ-.js} +2 -2
- package/dist/client/assets/{scroll-area-BqDwmAjQ.js → scroll-area-DTvv8_DS.js} +1 -1
- package/dist/client/assets/search-x-Ig8nk-DU.js +6 -0
- package/dist/client/assets/{shield-check-B7JJvCBE.js → shield-check-DjnWx7aT.js} +1 -1
- package/dist/client/assets/{shield-x-DvFRtrsO.js → shield-x-BrtccpM7.js} +1 -1
- package/dist/client/assets/{soul-file-BDthDhZW.js → soul-file-C5mMIP4v.js} +1 -1
- package/dist/client/assets/{table-CK_OyzSy.js → table-Rll_Jxd8.js} +1 -1
- package/dist/client/assets/{terminal-CqyyqODz.js → terminal-Bjss9oke.js} +1 -1
- package/dist/client/assets/{trust-posture-JGG7FWhE.js → trust-posture-Dmk2WlZv.js} +1 -1
- package/dist/client/assets/{unplug-D2Avzz6s.js → unplug-BHYMc4ND.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-BgsW86t7.js → unverified-catalog-notice-BmIVQhjE.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-NFvlYTrH.js → use-adapter-catalog-RzlxX2Wa.js} +1 -1
- package/dist/client/assets/{use-bindings-Ofq1UjvW.js → use-bindings-Ds_MAC67.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-Cr3bdM7x.js → use-composer-prefs-ckA_eZQS.js} +1 -1
- package/dist/client/assets/{use-connector-management-Dz2D5qIt.js → use-connector-management-oEqok0QG.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-wwMMFsmG.js → use-deep-link-scroll-Clu9Sz2-.js} +1 -1
- package/dist/client/assets/use-delete-binding-B_zHPcy8.js +1 -0
- package/dist/client/assets/{use-dev-links-Buq6rA0h.js → use-dev-links-BO7-IHe9.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-DXgiQHcR.js → use-external-adapter-catalog-7lRWtn7J.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-FN5AfUr-.js → use-full-activity-feed-DrcMJL9m.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-BhzXZsbH.js +1 -0
- package/dist/client/assets/{use-jump-back-in-CF-nu5zW.js → use-jump-back-in-Dav0ttfs.js} +3 -3
- package/dist/client/assets/use-local-browser-CtltDlof.js +1 -0
- package/dist/client/assets/{use-mesh-topology-BdnC6sCG.js → use-mesh-topology-CiS9XQsg.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-B5J2da-A.js → use-mounted-ref-DuK0vm9N.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-B1iYUOEO.js → use-notification-prefs-Chf4UNbq.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-J6Ed141H.js → use-panel-tab-placements-C5y831aL.js} +1 -1
- package/dist/client/assets/use-pending-read-i6TB4gGQ.js +1 -0
- package/dist/client/assets/use-personality-commit-KKJ2ve1V.js +1 -0
- package/dist/client/assets/{use-promo-activation-CZfM_gjU.js → use-promo-activation-D45fuXdT.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-DlSguZS3.js → use-promo-dismissals-8-hGry_v.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-Bxf5sc_M.js → use-pulse-freshness-CWudgqNc.js} +1 -1
- package/dist/client/assets/{use-relay-config-BwMES9xB.js → use-relay-config-8mXfegbP.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-lzWFVGRY.js → use-room-follow-claim-DgEWUsoP.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-0RaD5Yyr.js → use-roving-tab-list-CXy0Hv5J.js} +1 -1
- package/dist/client/assets/use-session-canvas-CUvHGgMf.js +64 -0
- package/dist/client/assets/{use-session-diagnostics-gBgn5q2r.js → use-session-diagnostics-LKiXub1H.js} +3 -3
- package/dist/client/assets/{use-unclaimed-chats-DOqEolFt.js → use-unclaimed-chats-Cr812OTh.js} +1 -1
- package/dist/client/assets/use-update-config-Bad4g6mB.js +1 -0
- package/dist/client/assets/useMutationState-BnXJ-0A_.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261015190907_bored_skreet.sql +30 -0
- package/dist/drizzle/20261016144104_remote_command_hub_kinds.sql +21 -0
- package/dist/drizzle/meta/20261015190907_snapshot.json +14012 -0
- package/dist/drizzle/meta/20261016144104_snapshot.json +14012 -0
- package/dist/drizzle/meta/_journal.json +14 -0
- package/dist/server/index.js +130465 -126661
- package/dist/server/index.js.map +2 -2
- package/package.json +4 -4
- package/dist/client/assets/ActivityRow-CXLwJ28E.js +0 -1
- package/dist/client/assets/AdapterIcon-DsMXg2AE.js +0 -1
- package/dist/client/assets/AdapterSetupWizard-CuKhSucd.js +0 -2
- package/dist/client/assets/BindingDialog-DUqmAWDb.js +0 -1
- package/dist/client/assets/CanvasFileContent-D5egw6o3.js +0 -2
- package/dist/client/assets/CommitmentList-EjCcpBJ1.js +0 -1
- package/dist/client/assets/ConnectionAccessLists-BkFNTeLh.js +0 -1
- package/dist/client/assets/ConventionPage-Cc1bx5BQ.js +0 -11
- package/dist/client/assets/HandlePage-B0l9YTdO.js +0 -1
- package/dist/client/assets/HeartbeatPage-COV5M0c_.js +0 -1
- package/dist/client/assets/NamePage-BaS8zqwG.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-Dvmoevnh.js +0 -1
- package/dist/client/assets/PhotoPage-Copz-uyh.js +0 -1
- package/dist/client/assets/RuntimeConnectFlow-COnfwsEa.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-cfZVbgJJ.js +0 -1
- package/dist/client/assets/SkillsPage-BVt3zxB-.js +0 -1
- package/dist/client/assets/ToolsPage-IYUQ8OGL.js +0 -2
- package/dist/client/assets/_shell-TKho4VPJ.js +0 -90
- package/dist/client/assets/_shell._home.activity-DyrGuSto.js +0 -1
- package/dist/client/assets/_shell._home.index-jWJ7womG.js +0 -3
- package/dist/client/assets/_shell._home.tasks-tOBxVLcL.js +0 -1
- package/dist/client/assets/_shell._home.workspaces-B0ovWo_a.js +0 -1
- package/dist/client/assets/_shell.channels-Cs-s7a-W.js +0 -10
- package/dist/client/assets/_shell.connections-BXVkOfW_.js +0 -1
- package/dist/client/assets/_shell.marketplace-CuTHl0Cy.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-UWbdjpMd.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-DdiN22Ga.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-DdiN22Ga.js +0 -1
- package/dist/client/assets/agent-browser-BkFCE19g.js +0 -1
- package/dist/client/assets/card-BaRHWQF1.js +0 -1
- package/dist/client/assets/empty-state-C0Xjezko.js +0 -1
- package/dist/client/assets/form-CwnBnnFI.js +0 -1
- package/dist/client/assets/index-CMaIfS_G.js +0 -1018
- package/dist/client/assets/index-CTxREsg3.js +0 -1
- package/dist/client/assets/index-D5QS-i8I.css +0 -1
- package/dist/client/assets/index-DLE5hltn.js +0 -1
- package/dist/client/assets/index-DaWx8Mly.js +0 -1
- package/dist/client/assets/index-GvMV_K0T.js +0 -1
- package/dist/client/assets/index-lbAGzLtf.js +0 -1
- package/dist/client/assets/mention-pill-C0AzfrQH.js +0 -1
- package/dist/client/assets/more-details-CwkthrCT.js +0 -1
- package/dist/client/assets/page-container-CH8mJ_Yk.js +0 -1
- package/dist/client/assets/primer-trigger-CgHlhMZL.js +0 -3
- package/dist/client/assets/registry-DLUlxXR7.js +0 -1
- package/dist/client/assets/search-x-DqLtufOG.js +0 -6
- package/dist/client/assets/use-delete-binding-j0PZzvHt.js +0 -1
- package/dist/client/assets/use-is-below-desktop-BudV2uCQ.js +0 -1
- package/dist/client/assets/use-pending-read-BNKrtv93.js +0 -1
- package/dist/client/assets/use-personality-commit-CWBNZX4E.js +0 -1
- package/dist/client/assets/use-session-canvas-CAxswuAf.js +0 -64
- package/dist/client/assets/use-update-config-9fndji1c.js +0 -1
- package/dist/client/assets/useMutationState-CtolUzjw.js +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlintzCanvas-B-PoJThg.js","assets/index-CMaIfS_G.js","assets/index-D5QS-i8I.css","assets/index-Bw9sMeWJ.js","assets/BlintzCanvas-GgiCXV7C.css","assets/CanvasFileContent-D5egw6o3.js","assets/rotate-cw-CdW7VTvV.js","assets/WidgetErrorCard-BeQ2x8Ar.js","assets/card-BaRHWQF1.js","assets/progress--zm5Rh4c.js","assets/markdown-content-irJMN3oI.js","assets/table-CK_OyzSy.js","assets/terminal-CqyyqODz.js","assets/package-DzrvXxqm.js","assets/heart-BwQb2EFQ.js","assets/git-branch-DPgttvPa.js","assets/file-text-CwK7EV60.js","assets/file-D3iv2i0G.js","assets/McpAppFrame-BQxyYB23.js","assets/more-details-CwkthrCT.js","assets/CanvasModel3dContent-BXCQRGHN.js","assets/CanvasCsvContent-CgiQWBJA.js","assets/index-obbYyK_q.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Hn=Object.defineProperty;var vr=e=>{throw TypeError(e)};var Un=(e,r,t)=>r in e?Hn(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var ee=(e,r,t)=>Un(e,typeof r!="symbol"?r+"":r,t),Zn=(e,r,t)=>r.has(e)||vr("Cannot "+t);var gr=(e,r,t)=>r.has(e)?vr("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,t);var xe=(e,r,t)=>(Zn(e,r,"access private method"),t);import{a2 as St,ke as kt,z as ie,K,J as br,F as Ge,G as et,kf as Vn,kg as Gn,kh as $n,b3 as je,a8 as pe,r as g,cg as Kt,ki as Jn,b0 as J,hN as Qn,j as h,h4 as Kn,h5 as In,e6 as ei,Q as It,I as ti,fs as ri,B as mt,R as qr,b2 as Hr,C as ni,hV as Pt,kj as ii,kk as Ur,kl as Wt,km as gt,kn as Zr,_ as wr,ko as oi,D as yr,kp as ai,kq as si,kr as te,ks as li,kt as Cr}from"./index-CMaIfS_G.js";import{R as ui}from"./rotate-cw-CdW7VTvV.js";import{v as ci,a as di,W as fi}from"./WidgetErrorCard-BeQ2x8Ar.js";import{M as pi}from"./McpAppFrame-BQxyYB23.js";/**
|
|
3
|
-
* @license lucide-react v1.48.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Vr={name:"file-code",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:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};Vr.node;const yl=St(Vr);/**
|
|
8
|
-
* @license lucide-react v1.48.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const Gr={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};Gr.node;const hi=St(Gr);/**
|
|
13
|
-
* @license lucide-react v1.48.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const $r={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};$r.node;const mi=St($r);/**
|
|
18
|
-
* @license lucide-react v1.48.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const Jr={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};Jr.node;const vi=St(Jr),ze={pending:64,queueBytes:1048576,batchMs:300,frames:62,imageChars:9e5,imageEdge:1568,resourceErrors:1e4},bt=et().min(1).max(128),Le={bridgeGeneration:bt},gi=ie({...Le,__dorkosDevtools:K("capture-result"),requestId:bt,dataUrl:et().max(9e5).optional(),error:et().max(2048).optional()}),bi=Vn.omit({hostOutcome:!0}).extend({...Le,__dorkosDevtools:K("act-result"),dataUrl:et().max(9e5).optional()}),wi=Gn.extend({status:Ge().int().min(0).max(599),durationMs:Ge().min(0),responseSize:Ge().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),timestamp:Ge().min(0)}),yi=$n.refine(e=>e.timestamp>=0),Ci=kt("__dorkosDevtools",[ie({__dorkosDevtools:K("hello"),pageInstanceId:bt,bridgeVersion:K(2)}),ie({...Le,__dorkosDevtools:K("ready"),pageInstanceId:bt}),ie({...Le,__dorkosDevtools:K("navigated")}),ie({...Le,__dorkosDevtools:K("resource-error")}),ie({...Le,__dorkosDevtools:K("batch"),seq:Ge().int().min(0).max(Number.MAX_SAFE_INTEGER),console:br(yi).max(500),network:br(wi).max(200)}),gi,bi]);function Si(e){const r=new Set;let t=0,n=0;const i=l=>(n+=l)<=16384;function o(l){if(!i(2))return!1;for(let s=0;s<l.length;s++){const u=l.charCodeAt(s);if(u>=55296&&u<=56319&&s+1<l.length&&l.charCodeAt(s+1)>=56320&&l.charCodeAt(s+1)<=57343){if(!i(2))return!1;s++;continue}const c=u===34||u===92||[8,9,10,12,13].includes(u)?2:u<32||u>=55296&&u<=57343?6:1;if(!i(c))return!1}return!0}function a(l,s){if(++t>2048||s>8)return!1;if(l===null)return i(4);if(typeof l=="boolean")return i(l?4:5);if(typeof l=="string")return o(l);if(typeof l=="number")return Number.isFinite(l)&&i(String(l).length);if(typeof l!="object"||r.has(l))return!1;const u=Object.getPrototypeOf(l);if(u!==Object.prototype&&u!==null&&u!==Array.prototype)return!1;const c=Array.isArray(l);if(c&&l.length>2048||Object.getOwnPropertySymbols(l).length||!i(2))return!1;r.add(l);let d=0;for(const f in l){if(!Object.prototype.hasOwnProperty.call(l,f))continue;if(++d>2048||c&&(!/^\d+$/.test(f)||Number(f)>=l.length))return!1;const p=Object.getOwnPropertyDescriptor(l,f);if(["__proto__","constructor","prototype"].includes(f)||!("value"in p)||!p.enumerable||d>1&&!i(1)||!c&&(!o(f)||!i(1))||!a(p.value,s+1))return!1}return r.delete(l),!c||d===l.length}try{return a(e,0)}catch{return!1}}function ki(e){try{if(!e||typeof e!="object")return null;const r=e;if(r.__dorkosDevtools==="capture-result"&&r.dataUrl===void 0&&r.error===void 0)return null;if(r.__dorkosDevtools==="batch"){if(!Array.isArray(r.console)||r.console.length>500||!Array.isArray(r.network)||r.network.length>200)return null;for(const i of r.console){if(!i||typeof i!="object")return null;const o=i.args;if(o!==void 0&&(!Array.isArray(o)||o.length>50||!Si(o)))return null}}const t=Ci.safeParse(e);if(!t.success)return null;const n=t.data;return"dataUrl"in n&&n.dataUrl!==void 0&&!Qr(n.dataUrl)?null:n}catch{return null}}function Qr(e){if(e.length>9e5||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(e))return null;try{const r=atob(e.slice(e.indexOf(",")+1));if(r.length<24||r.slice(0,8)!==`PNG\r
|
|
23
|
-
|
|
24
|
-
`||r.slice(12,16)!=="IHDR")return null;const t=o=>r.charCodeAt(o)*2**24+(r.charCodeAt(o+1)<<16)+(r.charCodeAt(o+2)<<8)+r.charCodeAt(o+3),n=t(16),i=t(20);return n>0&&i>0&&n<=1568&&i<=1568?{width:n,height:i}:null}catch{return null}}let jt=null;async function Sr(){return jt===null&&(jt=(await je(()=>import("./html-to-image-cl8bZGTj.js"),[])).default),jt}let At=null;async function Pi(){if(At===null){const e=await je(()=>import("./gifenc.esm-sOOlYEo8.js"),[]);At={GIFEncoder:e.GIFEncoder,quantize:e.quantize,applyPalette:e.applyPalette}}return At}async function kr(e,r,t=()=>{}){if(e.length===0)return{ok:!1,error:"The recording has no frames in it."};t();const{GIFEncoder:n,quantize:i,applyPalette:o}=await Pi();t();const a=e[0],l=e[e.length-1],s=new Uint8ClampedArray(a.data.length+l.data.length);s.set(a.data,0),s.set(l.data,a.data.length);const u=i(s,256),c=n();for(let f=0;f<e.length;f++){t();const p=e[f];if(c.writeFrame(o(p.data,u),p.width,p.height,{...f===0?{palette:u,repeat:0}:{},delay:r.frameMs}),c.bytesView().byteLength>r.maxBytes)return{ok:!1,error:`The recording came out bigger than ${Math.round(r.maxBytes/1024/1024)} MB, so it was not saved.`}}c.finish();const d=c.bytes();return d.byteLength>r.maxBytes?{ok:!1,error:`The recording came out bigger than ${Math.round(r.maxBytes/1024/1024)} MB, so it was not saved.`}:{ok:!0,bytes:d}}async function Ti(e,r,t=()=>{}){const n=[],i=document.createElement("canvas");let o=0,a=0;try{for(let l=0;l<Math.min(e.length,62);l++){t();const s=e[l];if(!Qr(s)){e[l]="";continue}const u=await Oi(s);e[l]="";try{if(t(),!u)continue;if(!o){const f=Math.min(1,Math.min(800,r)/Math.max(u.width,u.height,1));o=Math.max(1,Math.round(u.width*f)),a=Math.max(1,Math.round(u.height*f)),i.width=o,i.height=a}const c=i.getContext("2d",{willReadFrequently:!0});if(!c)return[];c.fillStyle="#ffffff",c.fillRect(0,0,o,a);const d=Math.min(o/u.width,a/u.height);c.drawImage(u,0,0,Math.round(u.width*d),Math.round(u.height*d)),t(),n.push({data:c.getImageData(0,0,o,a).data,width:o,height:a})}finally{u&&(u.src="")}}return n}catch(l){throw n.length=0,l}finally{e.length=0,i.width=0,i.height=0}}function Ei(e,r=()=>{}){const t=document.createElement("canvas"),n=document.createElement("canvas");try{for(let i=0;i<e.length;i++){r();const o=e[i];n.width=o.width,n.height=o.height,t.width=Math.max(1,Math.round(o.width/2)),t.height=Math.max(1,Math.round(o.height/2));const a=n.getContext("2d"),l=t.getContext("2d",{willReadFrequently:!0});if(!a||!l)throw new Error("Canvas pixels are unavailable");a.putImageData(new ImageData(new Uint8ClampedArray(o.data),o.width,o.height),0,0),l.drawImage(n,0,0,t.width,t.height),e[i]={data:l.getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}}finally{n.width=n.height=t.width=t.height=0}}function Oi(e){return new Promise(r=>{const t=new Image;t.onload=()=>{t.onload=t.onerror=null,r(t)},t.onerror=()=>{t.onload=t.onerror=null,t.src="",r(null)},t.src=e})}function Pr(e,r,t){const n=t.slice().buffer;return{name:e,type:r,size:t.byteLength,arrayBuffer:async()=>n}}function _i(e){const r=atob(e.slice(e.indexOf(",")+1));return Uint8Array.from(r,t=>t.charCodeAt(0))}const ji=8e3;function Ai(e){const r=pe(),t=g.useRef(r);g.useLayoutEffect(()=>{t.current=r});const[n]=Kt(),[i,o]=g.useState(0),a=g.useRef(null),l=g.useRef(new Map),s=g.useRef(null),u=g.useRef({console:[],network:[],entryBytes:0,overheadBytes:0}),c=g.useRef(null),d=g.useRef(-1),f=g.useRef(null),p=g.useRef(null),v=g.useRef(!1),m=g.useRef(-1/0),S=g.useRef(!1),y=g.useRef(null),z=g.useRef(0),j=g.useRef(null),R=g.useRef(null),D=g.useRef(!1),k=g.useRef(null),T=g.useRef({...e,sessionId:n}),M=g.useRef(Promise.resolve()),N=g.useRef(()=>{}),B=g.useRef({initialize:O,retire:w,consume:we,register:se,eligiblePending:le,refuseRequest:G,live:Z,captureFrame:He,valid:Be,reportRecordingStart:Xe,cancelReservation:We,finish:ct});g.useLayoutEffect(()=>{B.current={initialize:O,retire:w,consume:we,register:se,eligiblePending:le,refuseRequest:G,live:Z,captureFrame:He,valid:Be,reportRecordingStart:Xe,cancelReservation:We,finish:ct}});const q=E=>k.current===E||J.getState().openDocuments.some(b=>b.id===E&&b.openedHere);function C(E,{active:b,activation:_=!1,keepalive:P=!1,reset:Y=!1}){if(!E.sessionId)return;const $={documentId:E.documentId,logicalUrl:E.logicalUrl,bridgeGeneration:E.generation,seq:Math.max(0,d.current),console:[],network:[],active:b,activation:_,instrumented:E.ready&&!E.retired,...Y?{reset:!0}:{}};M.current=M.current.then(()=>t.current.ingestDevtoolsCapture(E.sessionId,$,P?{keepalive:!0}:void 0)).catch(()=>{})}function w(){var _;const E=a.current;E&&(E.retired=!0),a.current=null,c.current!==null&&clearTimeout(c.current),c.current=null,s.current=null,u.current={console:[],network:[],entryBytes:0,overheadBytes:0},d.current=-1,m.current=-1/0,S.current=!1;for(const[P,Y]of l.current)Y.life.sessionId&&Y.deadline>Date.now()&&Y.kind!=="frame"&&G(P,Y.kind,Y.life,"The frame changed while this request was pending."),clearTimeout(Y.timer),(_=Y.resolve)==null||_.call(Y,null);l.current.clear(),E&&C(E,{active:!1});const b=y.current;b&&(clearTimeout(b.reservationTimer),b.cancelled=!0,b.abort.abort(),b.frames.length=0,b.finishing||(b.drawn.length=0,y.current=null)),j.current!==null&&cancelAnimationFrame(j.current),j.current=null,z.current=0,o(0)}function O({loadActivation:E,reset:b=!1}={}){var H,ne;const _=T.current,P=(H=_.iframeRef.current)==null?void 0:H.contentWindow;if(v.current||!P||!_.bridgeEligibility||!_.resolvedSource)return;const Y={generation:crypto.randomUUID(),frame:P,sessionId:_.sessionId,documentId:_.documentId,logicalUrl:_.logicalUrl,source:_.resolvedSource,origin:_.bridgeEligibility==="served-document"?"null":_.previewOrigin,ready:!1,activation:!1,retired:!1};a.current=Y;const $=E??(D.current||R.current!==Y.documentId&&q(Y.documentId));Y.activation=$,D.current=!1,R.current=Y.documentId,C(Y,{active:!0,activation:$,reset:b}),((ne=f.current)==null?void 0:ne.frame)===P&&f.current.source===_.resolvedSource&&f.current.reload===_.reloadNonce&&f.current.documentId===_.documentId&&f.current.logicalUrl===_.logicalUrl&&P.postMessage({__dorkosDevtools:"init",bridgeGeneration:Y.generation},"*")}g.useLayoutEffect(()=>{var P;T.current={...e,sessionId:n};const E={frame:(P=e.iframeRef.current)==null?void 0:P.contentWindow,sessionId:n,documentId:e.documentId,logicalUrl:e.logicalUrl,source:e.resolvedSource,eligibility:e.bridgeEligibility,origin:e.previewOrigin,reload:e.reloadNonce},b=p.current;if(!b||Object.keys(E).some(Y=>E[Y]!==b[Y])){const Y=!b||b.frame!==E.frame||b.documentId!==E.documentId||b.logicalUrl!==E.logicalUrl||b.source!==E.source||b.reload!==E.reload;p.current=E,v.current=!1,w(),O({reset:Y})}});const A=g.useCallback(()=>{var $,H,ne;const{initialize:E,retire:b}=B.current,_=T.current,P=($=_.iframeRef.current)==null?void 0:$.contentWindow,Y=(H=a.current)!=null&&H.ready?!1:(ne=a.current)==null?void 0:ne.activation;P&&_.resolvedSource&&(f.current={frame:P,source:_.resolvedSource,reload:_.reloadNonce,documentId:_.documentId,logicalUrl:_.logicalUrl}),v.current=!1,b(),E({loadActivation:Y,reset:!0})},[]),X=g.useCallback(()=>{const E=a.current;D.current=!0,k.current=T.current.documentId,E&&N.current({active:!0,activation:!0})},[]);g.useLayoutEffect(()=>{N.current=E=>{a.current&&C(a.current,E)}});function Z(E){return a.current===E&&!E.retired}function G(E,b,_,P){if(!_.sessionId)return;const Y={requestId:E,bridgeGeneration:_.generation,documentId:_.documentId,hostOutcome:"host",error:P};b==="action"?t.current.postDevtoolsAction(_.sessionId,{...Y,ok:!1}).catch(()=>{}):t.current.ingestDevtoolsCapture(_.sessionId,{...Y,logicalUrl:_.logicalUrl,seq:Math.max(0,d.current),console:[],network:[],screenshot:{requestId:E,error:P}}).catch(()=>{})}function se(E,b,_,{capture:P=!1,resolve:Y,timeoutMs:$=8e3}={}){if(l.current.size>=ze.pending||l.current.has(E))return null;const H=setTimeout(()=>me(E,ne),$),ne={kind:b,life:_,capture:P,deadline:Date.now()+$,timer:H,resolve:Y};return l.current.set(E,ne),ne}function me(E,b){var _;l.current.get(E)===b&&(l.current.delete(E),clearTimeout(b.timer),(_=b.resolve)==null||_.call(b,null))}function le(E,b,_){return l.current.get(E)!==b||b.life!==_||!Z(_)?!1:Date.now()>=b.deadline?(me(E,b),!1):!0}function we(E,b,_){const P=l.current.get(E);return!P||P.life!==_||P.kind!==b&&!(b==="capture"&&P.kind==="frame")||!le(E,P,_)?null:(l.current.delete(E),clearTimeout(P.timer),P)}g.useEffect(()=>{const{initialize:E,retire:b,consume:_}=B.current;function P(){c.current=null;const he=s.current;s.current=null,u.current={console:[],network:[],entryBytes:0,overheadBytes:0};const x=a.current;he&&x&&!x.retired&&x.sessionId&&he.bridgeGeneration===x.generation&&t.current.ingestDevtoolsCapture(x.sessionId,he)}function Y(he){var cr,dr,fr,pr;const x=a.current;if(!x||x.retired||he.source!==x.frame||he.origin!==x.origin||((cr=f.current)==null?void 0:cr.frame)!==x.frame||f.current.source!==x.source||f.current.reload!==T.current.reloadNonce||f.current.documentId!==x.documentId||f.current.logicalUrl!==x.logicalUrl)return;const W=he.data;if(!W||typeof W!="object"||typeof W.__dorkosDevtools!="string"||!["hello","ready","navigated","resource-error","batch","capture-result","act-result"].includes(W.__dorkosDevtools)||W.__dorkosDevtools!=="hello"&&W.bridgeGeneration!==x.generation)return;const oe=W.__dorkosDevtools==="batch";if(oe){if(!x.ready||!x.sessionId||W.bridgeGeneration!==x.generation||!Number.isSafeInteger(W.seq)||W.seq<0||W.seq<=d.current)return;const V=Date.now();if(V-m.current<ze.batchMs){s.current?s.current.dropped=!0:S.current=!0;return}m.current=V}const U=ki(W);if(!U){oe&&(S.current=!0);return}if(U.__dorkosDevtools==="hello"){x.frame.postMessage({__dorkosDevtools:"init",bridgeGeneration:x.generation},"*");return}if(U.bridgeGeneration!==x.generation)return;if(U.__dorkosDevtools==="ready"){x.ready||(x.ready=!0,x.activation=!1,C(x,{active:!0}));return}if(!x.ready)return;if(U.__dorkosDevtools==="navigated"){v.current=!0,b();return}if(U.__dorkosDevtools==="resource-error"){z.current=Math.min(ze.resourceErrors,z.current+1),j.current===null&&(j.current=requestAnimationFrame(()=>{j.current=null,Z(x)&&o(z.current)}));return}if(!x.sessionId)return;if(U.__dorkosDevtools==="batch"){if(U.seq<=d.current)return;d.current=U.seq;const V=s.current??{documentId:x.documentId,logicalUrl:x.logicalUrl,bridgeGeneration:x.generation,seq:U.seq,console:[],network:[]};V.seq=U.seq,S.current&&(V.dropped=!0),S.current=!1;const Pe=u.current,hr=new TextEncoder;if(s.current||(Pe.overheadBytes=hr.encode(JSON.stringify({...V,seq:Number.MAX_SAFE_INTEGER,dropped:!0,console:[],network:[]})).length),Pe.overheadBytes>ze.queueBytes){s.current=null,u.current={console:[],network:[],entryBytes:0,overheadBytes:0},S.current=!0;return}for(const[Ze,Fn]of[["console",U.console],["network",U.network]])for(const qn of Fn){const mr=hr.encode(JSON.stringify(qn)).length;Pe[Ze].push(mr),Pe.entryBytes+=mr}V.console.push(...U.console),V.network.push(...U.network);const Ln=()=>Pe.overheadBytes+Pe.entryBytes+Math.max(0,V.console.length-1)+Math.max(0,V.network.length-1);for(;V.console.length>500||V.network.length>200||Ln()>ze.queueBytes;){V.dropped=!0;const Ze=(((dr=V.console[0])==null?void 0:dr.timestamp)??1/0)<=(((fr=V.network[0])==null?void 0:fr.timestamp)??1/0)?"console":"network";if(!V[Ze].length)break;V[Ze].shift(),Pe.entryBytes-=Pe[Ze].shift()}s.current=V,c.current===null&&(c.current=setTimeout(P,ze.batchMs));return}if(U.__dorkosDevtools==="capture-result"){const V=_(U.requestId,"capture",x);if(!V)return;if(V.kind==="frame"){(pr=V.resolve)==null||pr.call(V,U.dataUrl??null);return}t.current.ingestDevtoolsCapture(x.sessionId,{bridgeGeneration:x.generation,documentId:x.documentId,logicalUrl:x.logicalUrl,seq:Math.max(0,d.current),console:[],network:[],hostOutcome:"page-reported",screenshot:{requestId:U.requestId,dataUrl:U.dataUrl,error:U.error}});return}const Ue=_(U.requestId,"action",x);if(!Ue)return;const Re=y.current,ur=Ue.capture&&U.dataUrl!==void 0&&Re!==null&&Re.life===x&&Re.activated&&!Re.finishing&&!Re.cancelled&&Re.frames.length<61;ur&&Re.frames.push(U.dataUrl);const{__dorkosDevtools:pl,dataUrl:hl,...Bn}=U;t.current.postDevtoolsAction(x.sessionId,{...Bn,hostOutcome:"page-reported",documentId:x.documentId,captured:ur||void 0})}window.addEventListener("message",Y);const $=setInterval(()=>N.current({active:!0}),15e3),H=()=>{a.current||E(),N.current({active:!0,activation:!0})},ne=()=>{N.current({active:!1,keepalive:!0}),b()},ae=()=>{document.visibilityState==="visible"&&H()};return window.addEventListener("focus",H),window.addEventListener("pagehide",ne),window.addEventListener("pageshow",H),document.addEventListener("visibilitychange",ae),()=>{window.removeEventListener("message",Y),clearInterval($),window.removeEventListener("focus",H),window.removeEventListener("pagehide",ne),window.removeEventListener("pageshow",H),document.removeEventListener("visibilitychange",ae),b()}},[]),g.useEffect(()=>Jn.subscribeSessionEvent((E,b)=>{if(b.type!=="devtools_capture_request"&&b.type!=="devtools_action_request"&&b.type!=="devtools_recording_request")return;const{register:_,eligiblePending:P,refuseRequest:Y,captureFrame:$,valid:H,finish:ne,reportRecordingStart:ae,cancelReservation:he}=B.current,x=a.current;if(!(!(x!=null&&x.ready)||!x.sessionId||x.retired||b.targetClientId!==t.current.clientId||b.documentId!==x.documentId||b.bridgeGeneration!==x.generation)){if(b.type==="devtools_capture_request"||b.type==="devtools_action_request"){const W=b.type==="devtools_action_request",oe=_(b.requestId,W?"action":"capture",x,{capture:W&&!!b.capture,timeoutMs:W&&b.command.action==="wait_for"?Math.min(1e4,b.command.timeoutMs)+2e3:8e3});if(!oe){l.current.has(b.requestId)||Y(b.requestId,W?"action":"capture",x,"Too many browser requests are waiting. Try again when one finishes.");return}const U=Ue=>{P(b.requestId,oe,x)&&x.frame.postMessage(W?{__dorkosDevtools:"act-request",bridgeGeneration:x.generation,requestId:b.requestId,documentId:x.documentId,command:b.command,...b.capture?{capture:!0,lib:Ue}:{}}:{__dorkosDevtools:"capture-request",bridgeGeneration:x.generation,requestId:b.requestId,lib:Ue},"*")};!W||b.capture?Sr().then(U,()=>U()):U()}if(b.type==="devtools_recording_request"){if(b.action==="cancel-start"){he(b.recordingId,b.requestId,x);return}if(b.action==="confirm-start"){const W=y.current;if(!W||W.id!==b.recordingId||W.startRequestId!==b.requestId||W.life!==x||W.finishing||!H(W))return;if(!W.activated){if(performance.now()>=W.reservationDeadline){he(W.id,W.startRequestId,x),ae(b,x,{phase:"started",ok:!1,error:"This recording reservation expired before capture could start."});return}clearTimeout(W.reservationTimer),W.activated=!0,W.startedAt=Date.now(),$(x).then(oe=>{oe&&H(W)&&W.frames.push(oe)})}ae(b,x,{phase:"started",ok:!0});return}if(b.action==="start"){const W=b.reservationTimeoutMs;if(!Number.isSafeInteger(W)||!W||W<1||W>ji){ae(b,x,{phase:"reserved",ok:!1,error:"This recording request has no valid reservation timeout."});return}if(y.current){ae(b,x,{phase:"reserved",ok:!1,error:"Another recording in this window is still running or being saved. Wait for it to finish, then start again."});return}const oe={id:b.recordingId,startRequestId:b.requestId,activated:!1,reservationDeadline:performance.now()+W,life:x,startedAt:Date.now(),frames:[],drawn:[],finishing:!1,cancelled:!1,abort:new AbortController};y.current=oe,oe.reservationTimer=setTimeout(()=>{y.current===oe&&!oe.activated&&he(oe.id,oe.startRequestId,x)},W),ae(b,x,{phase:"reserved",ok:!0})}else ne(b.requestId,b.recordingId,x)}}}),[]);function Xe(E,b,_){!Z(b)||!b.sessionId||t.current.ingestDevtoolsCapture(b.sessionId,{hostOutcome:"host",documentId:b.documentId,bridgeGeneration:b.generation,seq:0,console:[],network:[],recordingStart:{..._,requestId:E.requestId,recordingId:E.recordingId}}).catch(()=>{})}function We(E,b,_){var Y;const P=y.current;if(!(!P||P.id!==E||P.startRequestId!==b||P.life!==_||P.finishing)){clearTimeout(P.reservationTimer),P.cancelled=!0,P.abort.abort(),P.frames.length=0,P.drawn.length=0;for(const[$,H]of l.current)H.life===_&&H.kind==="frame"&&(clearTimeout(H.timer),(Y=H.resolve)==null||Y.call(H,null),l.current.delete($));y.current=null}}function Be(E){return y.current===E&&!E.cancelled&&Z(E.life)}function He(E){const b=`frame-${crypto.randomUUID()}`;return new Promise(_=>{const P=se(b,"frame",E,{resolve:_});if(!P){_(null);return}Sr().then(Y=>{le(b,P,E)&&E.frame.postMessage({__dorkosDevtools:"capture-request",bridgeGeneration:E.generation,requestId:b,lib:Y},"*")},()=>{me(b,P)})})}async function ct(E,b,_){const P=y.current;if(!P||!P.activated||P.id!==b||P.life!==_){Z(_)&&await t.current.uploadDevtoolsRecording(_.sessionId,{requestId:E,bridgeGeneration:_.generation,documentId:_.documentId,hostOutcome:"host",error:"The window showing that page stopped recording before it could be saved."}).catch(()=>{});return}if(P.finishing)return;P.finishing=!0;const Y=()=>{if(!Be(P))throw new Error("retired")},$={requestId:E,bridgeGeneration:_.generation,documentId:_.documentId};try{const H=await He(_);Y(),H&&P.frames.length<ze.frames&&P.frames.push(H);const ne=P.frames.length?_i(P.frames[P.frames.length-1]):new Uint8Array;P.drawn=await Ti(P.frames,800,Y),Y();let ae=await kr(P.drawn,{frameMs:500,maxBytes:8*1024*1024},Y);if(Y(),!ae.ok&&P.drawn.length&&(Ei(P.drawn,Y),ae=await kr(P.drawn,{frameMs:500,maxBytes:8*1024*1024},Y),Y()),!ae.ok){await t.current.uploadDevtoolsRecording(_.sessionId,{...$,hostOutcome:"host",error:ae.error},{signal:P.abort.signal}),Y();return}Y(),await t.current.uploadDevtoolsRecording(_.sessionId,{...$,frames:P.drawn.length,durationMs:Date.now()-P.startedAt,recording:Pr(`${b}.gif`,"image/gif",ae.bytes),keyframe:Pr(`${b}.png`,"image/png",ne)},{signal:P.abort.signal}),Y()}catch{Be(P)&&await t.current.uploadDevtoolsRecording(_.sessionId,{...$,hostOutcome:"host",error:"This window could not turn that recording into a file."},{signal:P.abort.signal}).catch(()=>{})}finally{P.frames.length=0,P.drawn.length=0,y.current===P&&(y.current=null)}}return{resourceErrorCount:i,notePersonNavigated:X,noteFrameLoaded:A}}const Ri=15e3;function xi(e){const r=e instanceof Error?e.message.trim():"";return r.length>0?r:"Couldn’t reach DorkOS. Check your network and try again."}function zi(e){const r=pe();return{open:g.useCallback(async t=>{await r.openRoomCanvasDocument(e,t)},[r,e]),update:g.useCallback(async(t,n)=>{await r.updateRoomCanvasDocument(e,t,{content:n})},[r,e]),pin:g.useCallback(async(t,n)=>{await r.updateRoomCanvasDocument(e,t,{pinned:n})},[r,e]),close:g.useCallback(async t=>{await r.closeRoomCanvasDocument(e,t)},[r,e])}}function Di(e,r){const t=pe(),n=J(i=>i.setRoomCanvasEditing);g.useEffect(()=>{if(n(e,r),r===null)return;const i=a=>{t.setRoomCanvasEditing(e,r,a).catch(l=>{console.warn("[room-canvas] edit lock failed",{roomId:e,documentId:r,err:l})})};i(!0);const o=setInterval(()=>i(!0),Ri);return()=>{clearInterval(o),i(!1),n(e,null)}},[t,e,r,n])}const Ni=400;function Cl(e,r){const t=pe(),n=J(i=>i.roomCanvasPresenceEpoch[e]??0);g.useEffect(()=>{const i=l=>{t.setRoomCanvasViewing(e,l).catch(s=>{console.warn("[room-canvas] could not say where we are looking",{roomId:e,err:s})})};let o=!1;const a=setTimeout(()=>{o=!0,i(r)},Ni);return()=>{clearTimeout(a),o&&i(null)}},[t,e,r,n])}const Mi="allow-scripts allow-forms allow-popups allow-modals",Rt="allow-scripts allow-same-origin allow-popups allow-forms allow-modals allow-downloads",Yi=new Set(["javascript:","data:","blob:"]),Xi=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","::1"]);function er(e){return Xi.has(e)||e.endsWith(".localhost")}function Wi(e){return er(e)?"direct":"server"}function Bi(e,r){let t;try{t=new URL(e)}catch{return null}const n=t.searchParams.get(Tr),i=new URL(t.origin),o=r.indexOf("?");return i.pathname=(o===-1?r:r.slice(0,o))||"/",i.search=o===-1?"":r.slice(o),n!==null&&i.searchParams.set(Tr,n),i.toString()}const Tr="__dorkos_preview",Li="/__dorkos_preview/health";function Fi(e){return e==="https:"?443:80}function Kr(e){let r;try{r=new URL(e)}catch{return{mode:"serve",path:e}}if(Yi.has(r.protocol))return{mode:"blocked"};if(r.protocol==="file:")return{mode:"serve",path:decodeURIComponent(r.pathname)};if(r.protocol==="http:"||r.protocol==="https:"){if(er(r.hostname)){const t=r.port?Number(r.port):Fi(r.protocol);return{mode:"proxy",hostname:r.hostname,port:t,path:`${r.pathname}${r.search}`}}return{mode:"external",url:e}}return{mode:"blocked"}}function qi(e){const r=e.trim();if(r===""||/^[a-z][a-z0-9+.-]*:\/\//i.test(r)||r.startsWith("/")||r.startsWith("./")||r.startsWith("../"))return r;const t=r.split("/")[0];if(r.includes("/")&&!t.includes(".")&&!t.includes(":"))return r;const i=t.split(":")[0];return`${er(i)?"http":"https"}://${r}`}function Hi(e){const r=Kr(e);if(r.mode==="serve")return{kind:"local",path:r.path};if(r.mode==="blocked")return{kind:"raw",text:e};try{const t=new URL(e),n=t.host.replace(/^www\./,""),i=t.pathname==="/"&&t.search===""&&t.hash===""?"":`${t.pathname}${t.search}${t.hash}`;return{kind:"url",host:n,rest:i}}catch{return{kind:"raw",text:e}}}const Ui=2e3;async function Er(e,r=globalThis.fetch,t=Ui){const n=new AbortController,i=setTimeout(()=>n.abort(),t);try{return await r(e,{mode:"no-cors",cache:"no-store",signal:n.signal}),!0}catch{return n.signal.aborted}finally{clearTimeout(i)}}function Zi({target:e,currentUrl:r,strategy:t,cwd:n,reloadNonce:i}){const o=JSON.stringify([r,t,n,i]),[a,l]=g.useState(null),[s,u]=g.useState(null),[c,d]=g.useState(null),f=pe(),p=g.useRef(f);return g.useEffect(()=>{p.current=f}),g.useEffect(()=>{const v=p.current;let m=!1;const S=R=>{l(o),u(R)};async function y(R){if(n===null){d({kind:"no-session"});return}try{const D=await v.createServeUrl(n,R);if(m)return;D===null?d({kind:"unsupported"}):S({src:D,sandbox:Mi,previewOrigin:null,bridgeEligibility:"served-document"})}catch{m||d({kind:"failed"})}}async function z(R,D){let k;try{const M=await v.probeLoopbackPort(R);k=M===null?"unknown":M.listening}catch{k="unknown"}if(m)return;let T=null;if(k!==!1){let M=null;try{M=await v.createProxyUrl(R)}catch{if(m)return;T={kind:"failed"}}if(m)return;if((M==null?void 0:M.unavailable)==="tunnel"){d({kind:"tunnel"});return}if((M==null?void 0:M.unavailable)==="no-port"&&(T={kind:"no-port"}),M!=null&&M.url){const N=new URL(M.url);if(await Er(`${N.origin}${Li}`)){if(m)return;const B=Bi(M.url,D);if(B!==null){S({src:B,sandbox:Rt,previewOrigin:N.origin,bridgeEligibility:"preview-listener"});return}}if(m)return;T={kind:"origin-unreachable",host:N.hostname,listenPort:N.port}}}if(t==="direct"&&await Er(r)){if(m)return;S({src:r,sandbox:Rt,previewOrigin:null,bridgeEligibility:null});return}m||d(T??{kind:"no-upstream"})}async function j(){if(d(null),u(null),e.mode!=="blocked"){if(e.mode==="external"){S({src:e.url,sandbox:Rt,previewOrigin:null,bridgeEligibility:null});return}return e.mode==="serve"?y(e.path):z(e.port,e.path)}}return j(),()=>{m=!0}},[e,r,t,n,i,o]),{resolved:a===o?s:null,resolveError:c}}const Vi=1e4;function Gi(e,r){if(e&&e.contentUrl===r&&e.stack.length>0){const t=Math.min(Math.max(e.cursor,0),e.stack.length-1);return{stack:e.stack,cursor:t}}return{stack:[r],cursor:0}}function $i({documentId:e,content:r}){const t=J(A=>A.selectedCwd),n=J(A=>A.writeBrowserHistory),[i]=g.useState(()=>Gi(J.getState().browserHistories[e],r.url)),[o,a]=g.useState(i.stack),[l,s]=g.useState(i.cursor),[u,c]=g.useState(0);g.useEffect(()=>{n(e,{contentUrl:r.url,stack:o,cursor:l})},[e,r.url,o,l,n]);const d=o[l],f=g.useMemo(()=>Kr(d),[d]),p=g.useMemo(()=>f.mode==="proxy"?Wi(window.location.hostname):null,[f]),v=g.useRef(null),{resolved:m,resolveError:S}=Zi({target:f,currentUrl:d,strategy:p,cwd:t,reloadNonce:u}),{resourceErrorCount:y,notePersonNavigated:z,noteFrameLoaded:j}=Ai({iframeRef:v,documentId:e,logicalUrl:d,reloadNonce:u,previewOrigin:(m==null?void 0:m.previewOrigin)??null,bridgeEligibility:(m==null?void 0:m.bridgeEligibility)??null,resolvedSource:(m==null?void 0:m.src)??null}),R=J(A=>A.roomCanvasLiveRoomId),{open:D}=zi(R??""),[k,T]=g.useState(null),M=g.useCallback(A=>{a(X=>[...X.slice(0,l+1),A]),s(X=>X+1)},[l]),N=Qn(R),B=J(A=>R?A.roomCanvasEditing[R]??null:null);g.useEffect(()=>{if(N===null||B!==null||N.documentId!==e)return;const A=N.url;A===void 0||A===d||M(A)},[N,B,e,d,M]);const q=l>0,C=l<o.length-1,w=g.useCallback(A=>{const X=qi(A);if(!X||X===d){z(),c(Z=>Z+1);return}if(R){T(null),D({type:"browser",url:X}).catch(Z=>{T({url:X,message:xi(Z)})});return}z(),M(X)},[d,M,R,D,z]),O=()=>ri(d);return h.jsxs("div",{className:"flex h-full flex-col",children:[h.jsxs("div",{className:"border-border/60 flex shrink-0 flex-wrap items-center gap-1 border-b px-2 py-1 lg:h-9 lg:flex-nowrap lg:py-0",children:[h.jsx(dt,{label:"Back",disabled:!q,onClick:()=>s(A=>A-1),children:h.jsx(Kn,{className:"size-4"})}),h.jsx(dt,{label:"Forward",disabled:!C,onClick:()=>s(A=>A+1),children:h.jsx(In,{className:"size-4"})}),h.jsx(dt,{label:"Reload",onClick:()=>c(A=>A+1),children:h.jsx(ui,{className:"size-4"})}),h.jsx("div",{className:"order-first flex w-full min-w-0 lg:order-none lg:w-auto lg:flex-1",children:h.jsx(Ji,{url:(k==null?void 0:k.url)??d,startEditing:k!==null,onSubmit:w},k===null?"address":`retry:${k.url}`)}),h.jsx(dt,{label:"Open in system browser",onClick:O,children:h.jsx(ei,{className:"size-4"})})]}),k!==null&&h.jsx("p",{role:"status",className:"text-destructive border-border/60 border-b px-2 py-1 text-xs",children:k.message}),h.jsx(eo,{target:f,resolved:m,resolveError:S,reloadNonce:u,resourceErrorCount:y,title:r.title??"Embedded browser",onOpenExternally:O,onReload:()=>{z(),c(A=>A+1)},iframeRef:v,onFrameLoad:j})]})}function Ji({url:e,startEditing:r=!1,onSubmit:t}){const[n,i]=g.useState(r),[o,a]=g.useState(e);if(!n)return h.jsx(Ki,{url:e,onActivate:()=>{a(e),i(!0)}});const l=s=>{s.preventDefault(),i(!1),t(o)};return h.jsx("form",{onSubmit:l,className:"min-w-0 flex-1",children:h.jsx(ti,{"aria-label":"Address",autoFocus:!0,value:o,onChange:s=>a(s.target.value),onFocus:s=>s.currentTarget.select(),onBlur:()=>i(!1),onKeyDown:s=>{s.key==="Escape"&&(s.preventDefault(),i(!1))},spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",className:"h-11 w-full text-base lg:h-7 lg:text-sm"})})}function Qi(e){return e.kind==="local"?e.path:e.kind==="url"?`${e.host}${e.rest}`:e.text}function Ki({url:e,onActivate:r}){const t=g.useMemo(()=>Hi(e),[e]);return h.jsxs("button",{type:"button","aria-label":`Address: ${Qi(t)}`,onClick:r,className:"text-muted-foreground hover:bg-muted focus-ring flex h-11 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 text-left text-sm transition-colors lg:h-7",children:[t.kind==="local"&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"bg-muted-foreground/15 text-3xs rounded px-1 py-0.5 font-medium tracking-wide uppercase",children:"local"}),h.jsx("span",{className:"text-foreground truncate",children:t.path})]}),t.kind==="url"&&h.jsxs("span",{className:"truncate",children:[h.jsx("span",{className:"text-foreground",children:t.host}),h.jsx("span",{className:"text-muted-foreground",children:t.rest})]}),t.kind==="raw"&&h.jsx("span",{className:"truncate",children:t.text})]})}function Ii(e,r){switch(e.kind){case"no-session":return"Open a chat to preview local files.";case"unsupported":return"Local previews aren’t available in this environment.";case"failed":return"Couldn’t load this preview. Reload, or open the app in your browser.";case"tunnel":return"Dev server previews don’t work remotely. Open DorkOS on the computer running it.";case"no-port":return"All preview ports are in use. Close a preview, then reload.";case"origin-unreachable":return`This view can’t reach port ${e.listenPort} on ${e.host}. Open DorkOS on the computer running it.`;case"no-upstream":return`Nothing is listening on ${r.mode==="proxy"?`${r.hostname}:${r.port}`:"that address"}. Start the dev server, then reload.`}}function eo({target:e,resolved:r,resolveError:t,reloadNonce:n,resourceErrorCount:i,title:o,onOpenExternally:a,onReload:l,iframeRef:s,onFrameLoad:u}){if(e.mode==="blocked")return h.jsx(xt,{children:"This address is blocked for safety."});if(t!==null)return h.jsxs(xt,{children:[h.jsx("p",{children:Ii(t,e)}),t.kind!=="no-session"&&t.kind!=="unsupported"&&h.jsx("button",{type:"button",onClick:l,className:"text-foreground mt-3 hover:underline",children:"Reload"})]});if(r===null)return h.jsx(xt,{children:"Loading…"});const c=e.mode==="external";return h.jsx(to,{src:r.src,sandbox:r.sandbox,title:o,iframeRef:s,onFrameLoad:u,watchLoadDeadline:!c,resourceErrorCount:i,showEmbedFallback:c,onOpenExternally:a,onReload:l},`${r.src}:${n}`)}function to({src:e,sandbox:r,title:t,iframeRef:n,onFrameLoad:i,watchLoadDeadline:o,resourceErrorCount:a,showEmbedFallback:l,onOpenExternally:s,onReload:u}){const[c,d]=g.useState(!1),[f,p]=g.useState(!1);return g.useEffect(()=>{if(!o)return;const v=setTimeout(()=>p(!0),Vi);return()=>clearTimeout(v)},[o]),h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[f&&!c&&h.jsx(Or,{onOpenExternally:s,onReload:u,children:"This preview is slow to load."}),a>0&&h.jsxs(Or,{onOpenExternally:s,children:["This page hit ",a===1e4?"at least 10,000":a," ",a===1?"error":"errors"," while loading."]}),h.jsx("iframe",{ref:n,src:e,sandbox:r,onLoad:()=>{d(!0),i()},className:"min-h-0 w-full flex-1 border-0",title:t}),l&&h.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-t px-3 py-1.5 text-xs",children:[h.jsx("span",{children:"This site can’t always be embedded here."}),h.jsx("button",{type:"button",onClick:s,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function Or({children:e,onOpenExternally:r,onReload:t}){return h.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-b px-3 py-1.5 text-xs",children:[h.jsx("span",{children:e}),h.jsxs("span",{className:"flex shrink-0 items-center gap-3",children:[t&&h.jsx("button",{type:"button",onClick:t,className:"text-foreground hover:underline",children:"Reload"}),h.jsx("button",{type:"button",onClick:r,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function dt({label:e,disabled:r,onClick:t,children:n}){return h.jsx("button",{type:"button","aria-label":e,disabled:r,onClick:t,className:It("text-muted-foreground hover:text-foreground hover:bg-muted focus-ring flex size-11 shrink-0 items-center justify-center rounded-md transition-colors lg:size-7",r&&"pointer-events-none opacity-40"),children:n})}function xt({children:e}){return h.jsx("div",{className:"text-muted-foreground flex min-h-0 flex-1 flex-col items-center justify-center p-8 text-center",children:e})}function ro({sourcePath:e,cwd:r,loadedContent:t,documentId:n}){const i=pe(),o=g.useMemo(()=>({sourcePath:e,cwd:r,documentId:n,transport:i}),[e,r,n,i]),a=g.useRef(null),l=g.useRef(Promise.resolve()),s=g.useCallback(()=>{var k;return((k=a.current)==null?void 0:k.identity)===o&&a.current.active},[o]);g.useLayoutEffect(()=>{var k;return((k=a.current)==null?void 0:k.identity)!==o?a.current={identity:o,baseHash:null,baseContent:t,active:!0}:a.current.active=!0,()=>{var T;((T=a.current)==null?void 0:T.identity)===o&&(a.current.active=!1)}},[o,t]);const[u,c]=g.useState({owner:o,status:"idle",conflict:null}),d=u.owner===o?u.status:"idle",f=u.owner===o?u.conflict:null,p=g.useCallback(k=>{s()&&c(T=>({owner:o,status:k,conflict:T.owner===o?T.conflict:null}))},[o,s]),v=g.useCallback(k=>{s()&&c(T=>({owner:o,conflict:k,status:T.owner===o?T.status:"idle"}))},[o,s]),m=!!(e&&r),S=g.useCallback(async(k,T)=>{if(!s())return{status:"idle"};const M=a.current,N=await i.writeFile(r,e,k,T);if(N.ok){if(typeof N.hash!="string"||N.hash.length===0||N.effect!=="changed"&&N.effect!=="no_op")throw new Error("Invalid file save acknowledgement");return M.baseHash=N.hash,M.baseContent=k,s()?(v(null),p("saved"),{status:N.effect,confirmed:{hash:N.hash,content:k}}):{status:"idle"}}return s()?(v(N.conflict),p("conflict"),{status:"conflict"}):{status:"idle"}},[i,r,e,s,v,p]),y=g.useCallback(k=>{var N;if(!m||!s())return Promise.resolve({status:"idle"});const T=((N=a.current.finalToken)==null?void 0:N.content)===k?a.current.finalToken:void 0,M=l.current.catch(()=>{}).then(async()=>{if(!s())return{status:"idle"};a.current.finalToken===T&&(a.current.finalToken=void 0),p("saving");try{const B=a.current.baseHash!==null?{expectedHash:a.current.baseHash}:{expectedContent:a.current.baseContent};return await S(k,B)}catch{return s()?(p("error"),{status:"error"}):{status:"idle"}}});return l.current=M.then(()=>{}),M},[m,S,s,p]),z=g.useCallback(k=>{if(!m||!s())return null;const T=a.current,M={content:k,id:Symbol("buffered canvas draft")};return T.finalToken=M,{cancel(){T.finalToken===M&&(T.finalToken=void 0)},flush(){if(T.finalToken!==M||a.current!==T||T.active)return Promise.resolve({status:"idle"});T.finalToken=void 0;const N=l.current.catch(()=>{}).then(async()=>{if(a.current!==T||T.active)return{status:"idle"};try{const B=T.baseHash!==null?{expectedHash:T.baseHash}:{expectedContent:T.baseContent},q=await i.writeFile(r,e,k,B);return q.ok?typeof q.hash!="string"||q.hash.length===0||q.effect!=="changed"&&q.effect!=="no_op"?{status:"error"}:(T.baseHash=q.hash,T.baseContent=k,{status:q.effect,confirmed:{hash:q.hash,content:k}}):{status:"conflict"}}catch{return{status:"error"}}});return l.current=N.then(()=>{}),N}}},[m,s,i,r,e]),j=g.useCallback(k=>{var B;if(!m||!f||!s())return Promise.resolve({status:"idle"});const T=f.currentHash,M=((B=a.current.finalToken)==null?void 0:B.content)===k?a.current.finalToken:void 0,N=l.current.catch(()=>{}).then(async()=>{if(!s())return{status:"idle"};a.current.finalToken===M&&(a.current.finalToken=void 0),p("saving");try{return await S(k,{expectedHash:T})}catch{return s()?(p("error"),{status:"error"}):{status:"idle"}}});return l.current=N.then(()=>{}),N},[m,f,S,s,p]),R=g.useCallback(()=>{var k;return((k=a.current)==null?void 0:k.identity)===o?{hash:a.current.baseHash,content:a.current.baseContent}:{hash:null,content:t}},[o,t]),D=g.useCallback(()=>{if(!f||!s())return null;a.current.finalToken=void 0;const k=f.currentContent;return a.current.baseHash=f.currentHash,a.current.baseContent=k,v(null),p("idle"),k},[f,s,v,p]);return{status:d,conflict:f,canSave:m,save:y,overwrite:j,adoptDisk:D,getConfirmedBase:R,prepareFinalSave:z}}const no=g.lazy(()=>je(()=>import("./BlintzCanvas-B-PoJThg.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.BlintzCanvas}))),io=500;function oo(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function ao({content:e,documentId:r,onContentChange:t}){const[n,i]=g.useState(!1),[o,a]=g.useState(e.content),l=J(w=>w.canvasSessionId),s=J(w=>w.setDocumentEditing),u=J(w=>{var O;return((O=w.openDocuments.find(A=>A.id===r))==null?void 0:O.editing)??!1}),c=J(w=>w.selectedCwd),d=n&&u,f=ro({documentId:r,sourcePath:e.sourcePath,cwd:c,loadedContent:e.content}),p=f.canSave,v=g.useRef(null),m=g.useRef(null),S=g.useRef(o),y=g.useRef(e),z=g.useRef(t),j=g.useRef(f.save),R=g.useRef(f.prepareFinalSave),D=g.useRef(null);g.useEffect(()=>{S.current=o,y.current=e,z.current=t,j.current=f.save,R.current=f.prepareFinalSave});const k=g.useCallback(w=>{J.getState().canvasSessionId===v.current&&(z.current({...y.current,content:w}),j.current(w))},[]),T=g.useCallback(w=>{var O;a(w),S.current=w,(O=D.current)==null||O.cancel(),D.current=R.current(w),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{m.current=null,k(w)},io)},[k]),M=()=>{v.current=J.getState().canvasSessionId,a(e.content),i(!0),s(r,!0)},N=()=>{m.current&&(clearTimeout(m.current),m.current=null,k(S.current)),i(!1),s(r,!1)};g.useEffect(()=>{var w;d&&l!==v.current&&(m.current&&(clearTimeout(m.current),m.current=null),(w=D.current)==null||w.cancel(),D.current=null,i(!1),s(r,!1))},[l,d,r,s]),g.useEffect(()=>{var w;!n||d||(m.current&&clearTimeout(m.current),m.current=null,(w=D.current)==null||w.cancel(),D.current=null)},[d,n]),g.useEffect(()=>()=>{var w,O;m.current&&(clearTimeout(m.current),m.current=null,J.getState().canvasSessionId===v.current&&z.current({...y.current,content:S.current})),J.getState().canvasSessionId===v.current?(w=D.current)==null||w.flush():(O=D.current)==null||O.cancel(),D.current=null,s(r,!1)},[k,r,s]);const B=()=>{const w=f.adoptDisk();w!=null&&(t({...e,content:w}),a(w))},q=()=>{f.overwrite(S.current)},C=oo(f.status);return h.jsxs("div",{className:"relative flex h-full flex-col",children:[h.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[p&&C&&h.jsx("span",{className:"text-muted-foreground mt-3 text-xs","aria-live":"polite",children:C}),p&&h.jsx(mt,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:d?N:M,"aria-label":d?"Finish editing":"Edit document",children:d?h.jsx(qr,{className:"size-4"}):h.jsx(Hr,{className:"size-4"})})]}),f.status==="conflict"&&h.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[h.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),h.jsx(mt,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:B,children:"Reload"}),h.jsx(mt,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:q,children:"Overwrite"})]}),h.jsx("div",{className:"flex-1 px-2 pb-6",children:h.jsx(g.Suspense,{fallback:h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:h.jsx(no,{value:d?o:e.content,editable:d,onChange:d?T:void 0})})})]})}function so({content:e}){return h.jsx("div",{className:"p-4 font-mono text-sm",children:h.jsx(Ir,{value:e.data,depth:0})})}const lo=20;function Ir({value:e,depth:r,keyName:t}){const[n,i]=g.useState(r>2),o=g.useCallback(()=>i(c=>!c),[]);if(r>=lo)return h.jsx(Ve,{keyName:t,value:"[max depth]",className:"text-muted-foreground"});if(e===null)return h.jsx(Ve,{keyName:t,value:"null",className:"text-muted-foreground"});if(typeof e=="boolean")return h.jsx(Ve,{keyName:t,value:String(e),className:"text-blue-500"});if(typeof e=="number")return h.jsx(Ve,{keyName:t,value:String(e),className:"text-green-500"});if(typeof e=="string")return h.jsx(Ve,{keyName:t,value:`"${e}"`,className:"text-amber-500"});const a=Array.isArray(e),l=a?e.map((c,d)=>[String(d),c]):Object.entries(e),s=a?"[":"{",u=a?"]":"}";return h.jsxs("div",{style:{paddingLeft:r>0?16:0},children:[h.jsxs("button",{type:"button",className:"hover:bg-muted -ml-0.5 inline-flex items-center gap-0.5 rounded px-0.5 transition-colors duration-150",onClick:o,children:[h.jsx(ni,{className:It("size-3 transition-transform",!n&&"rotate-90")}),t!=null&&h.jsxs("span",{className:"text-foreground",children:[t,": "]}),h.jsxs("span",{className:"text-muted-foreground",children:[s,n&&` … ${l.length} items `,n&&u]})]}),!n&&h.jsxs(h.Fragment,{children:[l.map(([c,d])=>h.jsx(Ir,{keyName:a?void 0:c,value:d,depth:r+1},c)),h.jsx("div",{className:"text-muted-foreground",children:u})]})]})}function Ve({keyName:e,value:r,className:t}){return h.jsxs("div",{style:{paddingLeft:16},children:[e!=null&&h.jsxs("span",{className:"text-foreground",children:[e,": "]}),h.jsx("span",{className:t,children:r})]})}var Ce=function(e,r){return Number(e.toFixed(r))},uo=function(e,r){return typeof e=="number"?e:r},F=function(e,r,t){t&&typeof t=="function"&&t(e,r)},co=function(e){return-Math.cos(e*Math.PI)/2+.5},fo=function(e){return e},po=function(e){return e*e},ho=function(e){return e*(2-e)},mo=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},vo=function(e){return e*e*e},go=function(e){return--e*e*e+1},bo=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},wo=function(e){return e*e*e*e},yo=function(e){return 1- --e*e*e*e},Co=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},So=function(e){return e*e*e*e*e},ko=function(e){return 1+--e*e*e*e*e},Po=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},en={easeOut:co,linear:fo,easeInQuad:po,easeOutQuad:ho,easeInOutQuad:mo,easeInCubic:vo,easeOutCubic:go,easeInOutCubic:bo,easeInQuart:wo,easeOutQuart:yo,easeInOutQuart:Co,easeInQuint:So,easeOutQuint:ko,easeInOutQuint:Po},To=function(e){var r=e.animationResolve;e.animationResolve=null,r==null||r()},ue=function(e){e.animationFrame!==null&&cancelAnimationFrame(e.animationFrame),e.animationFrame=null,e.isAnimating=!1,e.animation=null,e.velocity=null,To(e)};function tn(e,r,t,n,i){if(!e.mounted){i==null||i();return}var o=new Date().getTime(),a=1;ue(e);var l=function(){if(!(!e.mounted||e.animation!==l)){var s=new Date().getTime()-o,u=s/t,c=en[r],d=c(u);if(s>=t){e.animation=null,e.animationFrame=null;var f=e.animationResolve;e.animationResolve=null,n(a),f==null||f(),e.flushResizeAlignment()}else n(d),e.animationFrame=requestAnimationFrame(l)}};e.animation=l,e.animationResolve=i??null,e.animationFrame=requestAnimationFrame(l)}function Eo(e){var r=e.scale,t=e.positionX,n=e.positionY;return!(Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n))}function Ae(e,r,t,n){var i=Eo(r);if(!e.mounted||!i)return Promise.resolve();var o=e.setState,a=e.state,l=a.scale,s=a.positionX,u=a.positionY,c=r.scale-l,d=r.positionX-s,f=r.positionY-u;return t===0?(o(r.scale,r.positionX,r.positionY),Promise.resolve()):new Promise(function(p){tn(e,n,t,function(v){v!==1?e.isAnimating=!0:e.isAnimating=!1;var m=l+c*v,S=s+d*v,y=u+f*v;o(m,S,y)},p)})}function Oo(e,r,t){var n=e.clientWidth,i=e.clientHeight,o=r.offsetWidth,a=r.offsetHeight,l=o*t,s=a*t,u=n-l,c=i-s;return{wrapperWidth:n,wrapperHeight:i,newContentWidth:l,newDiffWidth:u,newContentHeight:s,newDiffHeight:c}}var _o=function(e,r,t,n,i,o,a){var l=e>r?t*(a?.5:1):0,s=n>i?o*(a?.5:1):0,u=e-r-l,c=l,d=n-i-s,f=s;return{minPositionX:u,maxPositionX:c,minPositionY:d,maxPositionY:f,scaleWidthFactor:l,scaleHeightFactor:s}},tr=function(e,r){var t=e.wrapperComponent,n=e.contentComponent,i=e.setup,o=i.centerZoomedOut,a=i.disablePadding;if(!t||!n)throw new Error("Components are not mounted");var l=Oo(t,n,r),s=l.wrapperWidth,u=l.wrapperHeight,c=l.newContentWidth,d=l.newContentHeight,f=l.newDiffWidth,p=l.newDiffHeight,v=_o(s,c,f,u,d,p,!!o),m=s>=c&&u>=d;a&&m&&!o&&(v.minPositionX=0,v.maxPositionX=0,v.minPositionY=0,v.maxPositionY=0);var S=e.setup,y=S.minPositionX,z=S.maxPositionX,j=S.minPositionY,R=S.maxPositionY;return y!=null&&(v.minPositionX=s*(1-r)+y*r),z!=null&&(v.maxPositionX=z*r),j!=null&&(v.minPositionY=u*(1-r)+j*r),R!=null&&(v.maxPositionY=R*r),v},tt=function(e,r,t,n){return n?e<r?Ce(r,2):e>t?Ce(t,2):Ce(e,2):Ce(e,2)},ce=function(e,r){var t=tr(e,r);return e.bounds=t,t};function Me(e,r,t,n,i,o,a){var l=t.minPositionX,s=t.minPositionY,u=t.maxPositionX,c=t.maxPositionY,d=0,f=0;a&&(d=i,f=o);var p=tt(e,l-d,u+d,n),v=tt(r,s-f,c+f,n);return{x:p,y:v}}function Tt(e,r,t,n,i,o){var a=e.state,l=a.scale,s=a.positionX,u=a.positionY,c=n-l;if(!Number.isFinite(r)||!Number.isFinite(t))return console.error("Mouse X and Y position were not provided!"),{x:s,y:u};var d=s-r*c,f=u-t*c,p=Me(d,f,i,o,0,0,null);return p}var _r=1e-7;function Fe(e,r,t,n,i){var o=i?n:0,a=Math.max(r-o,_r),l=t+o;return!Number.isNaN(t)&&e>=l?l:!Number.isNaN(r)&&e<=a?a:Math.max(e,_r)}var jr=function(e,r){var t=e.setup.panning.excluded,n=e.isInitialized,i=e.wrapperComponent,o=r.target,a=function(c){return!!c&&typeof c=="object"&&c.nodeType===1&&typeof c.contains=="function"},l=typeof r.composedPath=="function"?r.composedPath().some(function(c){return a(c)&&!!(i!=null&&i.contains(c))}):!!(i!=null&&i.contains(o)),s=n&&o&&l;if(!s)return!1;var u=qe(o,t);return!(u||sa(o)||ir(o))},Ar=function(e){var r=e.isInitialized,t=e.isPanning,n=e.setup,i=n.panning.disabled,o=r&&t&&!i;return!!o},jo=function(e,r){var t=e.state,n=t.positionX,i=t.positionY;e.isPanning=!0;var o=r.clientX,a=r.clientY;e.startCoords={x:o-n,y:a-i}},Ao=function(e,r){var t=r.touches,n=e.state,i=n.positionX,o=n.positionY;e.isPanning=!0;var a=t.length===1;if(a){var l=t[0].clientX,s=t[0].clientY;e.startCoords={x:l-i,y:s-o}}};function Ro(e){var r=e.state,t=r.positionX,n=r.positionY,i=r.scale,o=e.setup,a=o.disabled,l=o.limitToBounds,s=o.centerZoomedOut,u=e.wrapperComponent;if(!(a||!u||!e.bounds)){var c=e.bounds,d=c.maxPositionX,f=c.minPositionX,p=c.maxPositionY,v=c.minPositionY,m=t>d||t<f,S=n>p||n<v,y=t>d?u.clientWidth:e.setup.minPositionX||0,z=n>p?u.clientHeight:e.setup.minPositionY||0,j=Tt(e,y,z,i,e.bounds,l||s),R=j.x,D=j.y;return{scale:i,positionX:m?R:t,positionY:S?D:n}}}function rn(e,r,t,n,i){var o=e.setup.limitToBounds,a=e.wrapperComponent,l=e.bounds,s=e.state,u=s.scale,c=s.positionX,d=s.positionY;if(!(a===null||l===null||r===c&&t===d)){var f=Me(r,t,l,o,n,i,a),p=f.x,v=f.y;e.setState(u,p,v)}}var xo=function(e,r,t){var n=e.startCoords,i=e.state,o=e.setup.panning,a=o.lockAxisX,l=o.lockAxisY,s=i.positionX,u=i.positionY;if(!n)return{x:s,y:u};var c=r-n.x,d=t-n.y,f=a?s:c,p=l?u:d;return{x:f,y:p}},Oe=function(e,r,t){var n=e.setup,i=e.state,o=n.minScale,a=n.disablePadding,l=n.centerZoomedOut,s=t??i.scale;return r>0&&s>=o&&!a&&!l?r:0},Ee;(function(e){e.TRACK_PAD="track_pad",e.MOUSE="mouse",e.TOUCH="touch"})(Ee||(Ee={}));var zo=function(e){var r=e.mounted,t=e.wrapperComponent,n=e.contentComponent,i=e.setup,o=i.disabled,a=i.velocityAnimation,l=i.limitToBounds,s=e.state.scale,u=a.disabled;if(u||o||!r||!t||!n)return!1;if(!l)return!0;var c=t.clientWidth<n.offsetWidth*s||t.clientHeight<n.offsetHeight*s;return c},Do=function(e){var r=e.mounted,t=e.velocity,n=e.bounds,i=e.setup,o=i.disabled,a=i.velocityAnimation,l=a.disabled,s=!l&&!o&&r;return!(!s||!t||!n)};function No(e,r){var t=e.setup.velocityAnimation,n=t.animationTime,i=t.maxAnimationTime,o=t.inertia;return Math.min(n*Math.max(1,Math.abs(r/o)),i)}function Rr(e,r,t,n,i,o,a,l,s,u){if(i){if(r>a&&t>a){var c=a+(e-a)*u;return c>s?s:c<a?a:c}if(r<o&&t<o){var c=o+(e-o)*u;return c<l?l:c>o?o:c}}return n?r:tt(e,o,a,i)}function Mo(e){var r=1,t=e.clientWidth/window.innerWidth;return Number.isNaN(t)?r:Math.min(r,t)}var zt=function(e,r,t){var n=0,i=e*t;return Number.isNaN(i)?n:e<0?Math.max(i,-r):Math.min(i,r)};function Yo(e,r,t){var n,i,o=zo(e);if(o){var a=e.lastMousePosition,l=e.velocityTime,s=e.setup,u=e.wrapperComponent,c=s.velocityAnimation,d=c.maxStrengthMouse,f=c.maxStrengthTouch,p=c.sensitivityTouch,v=c.sensitivityMouse,m=Date.now();if(a&&l&&u){var S=Mo(u),y=(n={},n[Ee.TOUCH]=p,n[Ee.MOUSE]=v,n)[t],z=(i={},i[Ee.TOUCH]=f,i[Ee.MOUSE]=d,i)[t],j=r.x-a.x,R=r.y-a.y,D=zt(j/S,z,y),k=zt(R/S,z,y),T=m-l,M=j*j+R*R,N=zt(Math.sqrt(M)/T,z,y);e.velocity={velocityX:D,velocityY:k,total:N}}e.lastMousePosition=r,e.velocityTime=m}}function Xo(e){var r=e.velocity,t=e.bounds,n=e.setup,i=e.wrapperComponent,o=Do(e);if(!(!o||!r||!t||!i)){var a=r.velocityX,l=r.velocityY,s=r.total,u=t.maxPositionX,c=t.minPositionX,d=t.maxPositionY,f=t.minPositionY,p=n.limitToBounds,v=n.autoAlignment,m=n.zoomAnimation,S=n.panning,y=S.lockAxisY,z=S.lockAxisX,j=m.animationType,R=v.sizeX,D=v.sizeY,k=v.velocityAlignmentTime,T=k,M=No(e,s),N=Math.max(M,T),B=Oe(e,R),q=Oe(e,D),C=B*i.clientWidth/100,w=q*i.clientHeight/100,O=u+C,A=c-C,X=d+w,Z=f-w,G=e.state,se=new Date().getTime();tn(e,j,N,function(me){var le=e.state,we=le.scale,Xe=le.positionX,We=le.positionY,Be=new Date().getTime()-se,He=Be/T,ct=en[v.animationType],E=1-ct(Math.min(1,He)),b=1-me,_=Xe+a*b,P=We+l*b,Y=Rr(_,G.positionX,Xe,z,p,c,u,A,O,E),$=Rr(P,G.positionY,We,y,p,f,d,Z,X,E);if(Xe!==_||We!==P){e.setState(we,Y,$);var H=e.props.onPanning;H&&H(L(e),{})}})}}function xr(e,r){var t=e.state,n=t.scale,i=t.positionX,o=t.positionY;e.panStartPosition={x:i,y:o},ue(e),ce(e,n),"touches"in r?Ao(e,r):jo(e,r)}function nn(e,r){var t=e.state.scale,n=e.setup,i=n.minScale,o=n.autoAlignment,a=o.disabled,l=o.sizeX,s=o.sizeY,u=o.animationTime,c=o.animationType,d=a||t<i||!l&&!s;if(!d){e.isResizeAlignmentPending&&ce(e,t);var f=Ro(e);if(f){var p=e.state,v=p.positionX,m=p.positionY,S=f.positionX===v&&f.positionY===m;S||Ae(e,f,u,c)}}}function zr(e,r,t,n){var i=e.startCoords,o=e.setup,a=o.autoAlignment,l=a.sizeX,s=a.sizeY;if(i){var u=xo(e,r,t),c=u.x,d=u.y,f=Oe(e,l),p=Oe(e,s);Yo(e,{x:c,y:d},n),rn(e,c,d,f,p)}}function Wo(e,r){if(e.isPanning){var t=e.velocity,n=e.wrapperComponent,i=e.contentComponent;e.isPanning=!1;var o=e.state,a=o.positionX,l=o.positionY,s=o.scale,u=e.panStartPosition;if(e.panStartPosition=null,u){var c=a-u.x,d=l-u.y;if(c*c+d*d<=25)return}e.isAnimating=!1,e.animation=null,e.isResizeAlignmentPending&&ce(e,s);var f=(n==null?void 0:n.clientWidth)||0,p=(n==null?void 0:n.clientHeight)||0,v=((i==null?void 0:i.offsetWidth)||0)*s,m=((i==null?void 0:i.offsetHeight)||0)*s,S=!e.setup.limitToBounds||f<v||p<m,y=!r&&t&&t.total>.1&&S;y?Xo(e):nn(e)}}function Et(e,r,t,n){var i=e.setup,o=i.minScale,a=i.maxScale,l=i.limitToBounds,s=Fe(Ce(r,2),o,a,0,!1),u=ce(e,s),c=Tt(e,t,n,s,u,l),d=c.x,f=c.y;return{scale:s,positionX:d,positionY:f}}function rr(e,r,t){var n=e.state.scale,i=e.wrapperComponent,o=e.setup,a=o.minScale,l=o.maxScale,s=o.limitToBounds,u=o.zoomAnimation,c=u.disabled,d=u.animationTime,f=u.animationType,p=n>=a&&n<=l,v=c||p;if((n>=1||s)&&nn(e),!(v||!i||!e.mounted)){var m=r||i.clientWidth/2,S=t||i.clientHeight/2,y=n<a?a:l,z=Et(e,y,m,S);z&&Ae(e,z,d,f)}}var de=function(){return de=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},de.apply(this,arguments)};function Dr(e,r,t){for(var n=0,i=r.length,o;n<i;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return e.concat(o||Array.prototype.slice.call(r))}var Dt={scale:1,positionX:0,positionY:0},Ne={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,fitOnInit:!1,disablePadding:!1,smooth:!0,detached:!1,wheel:{step:.015,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},trackPadPanning:{disabled:!0,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,allowPanning:!0,excluded:[]},keyboard:{disabled:!0,panStep:50,zoomStep:.25,animationTime:100,animationType:"easeOut",excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},autoAlignment:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivityMouse:1,sensitivityTouch:1.2,maxStrengthMouse:20,maxStrengthTouch:40,inertia:1,animationTime:300,maxAnimationTime:800,animationType:"easeOut"}},Bt={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},on=function(e){var r,t,n,i,o,a,l,s,u,c=Math.max((r=e.minScale)!==null&&r!==void 0?r:Ne.minScale,1e-7),d=(t=e.maxScale)!==null&&t!==void 0?t:Ne.maxScale,f=(n=e.initialScale)!==null&&n!==void 0?n:Dt.scale,p=Math.min(Math.max(f,c),d),v=tt((i=e.initialPositionX)!==null&&i!==void 0?i:Dt.positionX,(o=e.minPositionX)!==null&&o!==void 0?o:-1/0,(a=e.maxPositionX)!==null&&a!==void 0?a:1/0,e.minPositionX!=null||e.maxPositionX!=null),m=tt((l=e.initialPositionY)!==null&&l!==void 0?l:Dt.positionY,(s=e.minPositionY)!==null&&s!==void 0?s:-1/0,(u=e.maxPositionY)!==null&&u!==void 0?u:1/0,e.minPositionY!=null||e.maxPositionY!=null);return{previousScale:p,scale:p,positionX:v,positionY:m}},Nr=function(e){var r=de({},Ne);return Object.keys(e).forEach(function(t){var n=t,i=typeof e[n]<"u",o=typeof Ne[n]<"u";if(o&&i){var a=Object.prototype.toString.call(Ne[n]),l=a==="[object Object]",s=a==="[object Array]";l?r[n]=de(de({},Ne[n]),e[n]):s?r[n]=Dr(Dr([],Ne[n],!0),e[n]):r[n]=e[n]}}),r.minScale<=0&&(r.minScale=1e-7),r},an=function(e,r,t){var n=e.state.scale,i=e.wrapperComponent,o=e.setup,a=o.maxScale,l=o.minScale,s=o.zoomAnimation,u=s.size;if(!i)throw new Error("Wrapper is not mounted");var c=n+r*t,d=Fe(Ce(c,3),l,a,u,!1);return d};function rt(e,r,t,n){var i,o,a=e.wrapperComponent,l=e.props,s=l.onZoomStart,u=l.onZoom,c=l.onZoomStop,d=new MouseEvent("mousemove",{bubbles:!0}),f=L(e);F(f,d,s),F(f,d,u);var p=Ae(e,r,t,n),v=(o=(i=a==null?void 0:a.ownerDocument)===null||i===void 0?void 0:i.defaultView)!==null&&o!==void 0?o:typeof window<"u"?window:null;return v&&v.setTimeout(function(){e.mounted&&F(L(e),d,c)},t),p}function sn(e,r,t,n,i){var o=e.wrapperComponent,a=e.state,l=a.scale,s=a.positionX,u=a.positionY,c=e.setup.zoomAnimation;if(!o)return console.error("No WrapperComponent found"),Promise.resolve();var d=c.disabled?0:n,f=o.clientWidth,p=o.clientHeight,v=(f/2-s)/l,m=(p/2-u)/l,S=an(e,r,t),y=Et(e,S,v,m);return y?rt(e,y,d,i):(console.error("Error during zoom event. New transformation state was not calculated."),Promise.resolve())}function Bo(e,r,t,n){var i,o,a=e.wrapperComponent,l=e.props,s=l.onPanningStart,u=l.onPanning,c=l.onPanningStop,d=new MouseEvent("mousemove",{bubbles:!0}),f=L(e);F(f,d,s),F(f,d,u);var p=Ae(e,r,t,n),v=(o=(i=a==null?void 0:a.ownerDocument)===null||i===void 0?void 0:i.defaultView)!==null&&o!==void 0?o:typeof window<"u"?window:null;return v&&v.setTimeout(function(){e.mounted&&F(L(e),d,c)},t),p}function nr(e,r,t,n){r===void 0&&(r="contain");var i=e.wrapperComponent,o=e.contentComponent,a=e.setup;if(!i||!o)return null;var l=o.offsetWidth,s=o.offsetHeight,u=i.clientWidth,c=i.clientHeight;if(!l||!s||!u||!c)return null;var d=u/l,f=c/s,p=r==="cover"?Math.max(d,f):Math.min(d,f);return n!==void 0&&(p=Math.min(p,n)),t!==void 0&&(p=Math.max(p,t)),p=Fe(p,a.minScale,a.maxScale,0,!1),Ot(p,i,o)}function ln(e,r,t,n){var i=e.setup,o=e.wrapperComponent,a=e.contentComponent,l=i.limitToBounds,s=i.centerOnInit,u=i.fitOnInit,c=on(e.props),d=e.state,f=d.scale,p=d.positionX,v=d.positionY;if(!o)return Promise.resolve();if(u){var m=nr(e,u==="cover"?"cover":"contain");if(m)return f===m.scale&&p===m.positionX&&v===m.positionY?Promise.resolve():(n==null||n(),rt(e,m,r,t))}var S=c.positionX,y=c.positionY;if(s&&a){var z=Ot(c.scale,o,a);S=z.positionX,y=z.positionY}var j=tr(e,c.scale),R=Me(S,y,j,l,0,0,o),D={scale:c.scale,positionX:R.x,positionY:R.y};return f===c.scale&&p===c.positionX&&v===c.positionY?Promise.resolve():(n==null||n(),rt(e,D,r,t))}var un=function(e){if("getBoundingClientRect"in e){var r=e.getBoundingClientRect();return{x:r.left,y:r.top,width:r.width,height:r.height}}return e};function Lo(e){var r=e.map(un),t=Math.min.apply(Math,r.map(function(a){return a.x})),n=Math.min.apply(Math,r.map(function(a){return a.y})),i=Math.max.apply(Math,r.map(function(a){return a.x+a.width})),o=Math.max.apply(Math,r.map(function(a){return a.y+a.height}));return{x:t,y:n,width:i-t,height:o-n}}function Fo(e,r,t,n){var i=un(e),o=r.getBoundingClientRect(),a=t.getBoundingClientRect(),l=o.x*n.scale,s=o.y*n.scale;return{x:(i.x-a.x+l)/n.scale,y:(i.y-a.y+s)/n.scale}}function qo(e,r,t,n,i,o,a){n===void 0&&(n=0),i===void 0&&(i=0);var l=e.wrapperComponent,s=e.contentComponent,u=e.state,c=e.setup,d=c.limitToBounds,f=c.minScale,p=c.maxScale;if(!l||!s)return u;var v=l.getBoundingClientRect(),m=Fo(r,l,s,u),S=m.x,y=m.y,z=r.width/u.scale,j=r.height/u.scale,R=l.clientWidth/z,D=l.clientHeight/j,k=t||Math.min(R,D);a!==void 0&&(k=Math.min(k,a)),o!==void 0&&(k=Math.max(k,o));var T=Fe(k,f,p,0,!1),M=(v.width-z*T)/2,N=(v.height-j*T)/2,B=(v.left-S)*T+M+n,q=(v.top-y)*T+N+i,C=tr(e,T),w=Me(B,q,C,d,0,0,l),O=w.x,A=w.y;return{positionX:O,positionY:A,scale:T}}function cn(e,r,t){var n=e.wrapperComponent,i=e.state;if(!n)return{x:0,y:0};var o=n.getBoundingClientRect();return{x:(r-o.left-i.positionX)/i.scale,y:(t-o.top-i.positionY)/i.scale}}function Ho(e,r,t){var n=e.wrapperComponent,i=e.state;if(!n)return{x:0,y:0};var o=n.getBoundingClientRect();return{x:o.left+i.positionX+r*i.scale,y:o.top+i.positionY+t*i.scale}}var Uo=function(e){return function(r,t,n){return r===void 0&&(r=.5),t===void 0&&(t=300),n===void 0&&(n="easeOut"),sn(e,1,r,t,n)}},Zo=function(e){return function(r,t,n){return r===void 0&&(r=.5),t===void 0&&(t=300),n===void 0&&(n="easeOut"),sn(e,-1,r,t,n)}},Vo=function(e){return function(r,t,n,i,o){i===void 0&&(i=300),o===void 0&&(o="easeOut");var a=e.state,l=a.positionX,s=a.positionY,u=a.scale,c=e.wrapperComponent,d=e.contentComponent,f=e.setup.disabled;if(f||!c||!d)return Promise.resolve();var p={positionX:Number.isNaN(r)?l:r,positionY:Number.isNaN(t)?s:t,scale:Number.isNaN(n)?u:n};return Ae(e,p,i,o)}},Go=function(e){return function(r,t){return r===void 0&&(r=200),t===void 0&&(t="easeOut"),ln(e,r,t)}},$o=function(e){return function(r,t,n){t===void 0&&(t=200),n===void 0&&(n="easeOut");var i=e.state,o=e.wrapperComponent,a=e.contentComponent;if(o&&a){var l=Ot(r||i.scale,o,a);return Ae(e,l,t,n)}return Promise.resolve()}},Jo=function(e){return function(r,t,n,i,o){i===void 0&&(i=300),o===void 0&&(o="easeOut");var a=e.wrapperComponent,l=e.contentComponent,s=e.setup;if(s.disabled||!a||!l)return Promise.resolve();var u=cn(e,t,n),c=Et(e,r,u.x,u.y);if(!c)return Promise.resolve();var d=s.zoomAnimation.disabled?0:i;return rt(e,c,d,o)}},Qo=function(e){return function(r,t){return cn(e,r,t)}},Ko=function(e){return function(r,t){return Ho(e,r,t)}},Io=function(e,r){var t,n=e.wrapperComponent;if(!n)return[];var i=n.getRootNode(),o=i&&"getElementById"in i?i:(t=n.ownerDocument)!==null&&t!==void 0?t:typeof document<"u"?document:null,a=Array.isArray(r)?r:[r];return a.map(function(l){return typeof l=="string"?o==null?void 0:o.getElementById(l):l}).filter(function(l){return!!l&&n.contains(l)})},ea=function(e){return function(r,t,n,i,o,a){var l,s,u,c;n===void 0&&(n=600),i===void 0&&(i="easeOut"),o===void 0&&(o=0),a===void 0&&(a=0),ue(e);var d=typeof t=="object"&&t!==null?t:{scale:t},f=Io(e,r);if(!e.wrapperComponent||f.length===0)return Promise.resolve();var p=qo(e,Lo(f),d.scale,(l=d.offsetX)!==null&&l!==void 0?l:o,(s=d.offsetY)!==null&&s!==void 0?s:a,d.minScale,d.maxScale);return Ae(e,p,(u=d.animationTime)!==null&&u!==void 0?u:n,(c=d.animationType)!==null&&c!==void 0?c:i)}},ta=function(e){return function(r){var t,n,i;r===void 0&&(r={});var o=e.wrapperComponent,a=e.contentComponent,l=e.setup;if(l.disabled||!o||!a)return Promise.resolve();var s=nr(e,(t=r.mode)!==null&&t!==void 0?t:"contain",r.minScale,r.maxScale);if(!s)return Promise.resolve();var u=l.zoomAnimation.disabled?0:(n=r.animationTime)!==null&&n!==void 0?n:200;return rt(e,s,u,(i=r.animationType)!==null&&i!==void 0?i:"easeOut")}},ra=function(e){return function(r,t,n,i){n===void 0&&(n=200),i===void 0&&(i="easeOut");var o=e.wrapperComponent,a=e.contentComponent,l=e.setup,s=e.state;if(l.disabled||!o||!a||!Number.isFinite(r)||!Number.isFinite(t))return Promise.resolve();var u=ce(e,s.scale),c=Me(s.positionX+r,s.positionY+t,u,l.limitToBounds,0,0,o),d=c.x,f=c.y;return d===s.positionX&&f===s.positionY?Promise.resolve():Bo(e,{scale:s.scale,positionX:d,positionY:f},n,i)}},nt=function(e){return{instance:e,state:e.state,zoomIn:Uo(e),zoomOut:Zo(e),setTransform:Vo(e),resetTransform:Go(e),centerView:$o(e),zoomToElement:ea(e),zoomToPoint:Jo(e),clientToContent:Qo(e),contentToClient:Ko(e),fitToView:ta(e),panBy:ra(e)}},na=function(e){return{instance:e,state:e.state}},L=function(e){var r={};return Object.assign(r,na(e)),Object.assign(r,nt(e)),r},Nt=!1;function ft(){try{var e={get passive(){return Nt=!0,!1}};return e}catch{return Nt=!1,Nt}}var pt=".".concat(Bt.wrapperClass),qe=function(e,r){return r.some(function(t){return e.matches("".concat(pt," ").concat(t,", ").concat(pt," .").concat(t,", ").concat(pt," ").concat(t," *, ").concat(pt," .").concat(t," *"))})},ia=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]),oa='[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]',aa='[draggable="true"]',dn=function(e){return!e||typeof e.closest!="function"?null:e},ir=function(e){var r=dn(e);return r?ia.has(r.tagName)||r.isContentEditable?!0:r.closest(oa)!==null:!1},sa=function(e){var r=dn(e);return r?r.closest(aa)!==null:!1},it=function(e){e&&clearTimeout(e)},la=function(e){return Number.parseFloat(e.toFixed(8))},fn=function(e,r,t){var n=la(t);return"translate(".concat(e,"px, ").concat(r,"px) scale(").concat(n,")")},Ot=function(e,r,t){var n=t.offsetWidth*e,i=t.offsetHeight*e,o=(r.clientWidth-n)/2,a=(r.clientHeight-i)/2;return{scale:e,positionX:o,positionY:a}};function ua(e,r){e!=null&&(typeof e=="function"?e(r):e.current=r)}function ca(e){return function(r){e.forEach(function(t){typeof t=="function"?t(r):t!=null&&(t.current=r)})}}var or=typeof window<"u"?g.useLayoutEffect:g.useEffect,da={panLeft:["ArrowLeft"],panRight:["ArrowRight"],panUp:["ArrowUp"],panDown:["ArrowDown"],zoomIn:["+","="],zoomOut:["-","_"],reset:["0"]},fa=function(e){return Object.values(da).some(function(r){return r.includes(e)})};function pa(e,r){var t=e.setup,n=t.disabled,i=t.keyboard,o=t.panning;if(n||i.disabled||r.defaultPrevented||r.ctrlKey||r.metaKey||r.altKey||!fa(r.key))return!1;var a=r.target;if(ir(a)||a&&typeof a.matches=="function"&&qe(a,i.excluded))return!1;var l=i.panStep,s=i.zoomStep,u=i.animationTime,c=i.animationType,d=nt(e),f=r.key,p=o.lockAxisX?0:l,v=o.lockAxisY?0:l;return f==="ArrowLeft"?d.panBy(p,0,u,c):f==="ArrowRight"?d.panBy(-p,0,u,c):f==="ArrowUp"?d.panBy(0,v,u,c):f==="ArrowDown"?d.panBy(0,-v,u,c):f==="+"||f==="="?d.zoomIn(s,u,c):f==="-"||f==="_"?d.zoomOut(s,u,c):f==="0"&&d.resetTransform(u,c),r.cancelable&&r.preventDefault(),r.stopPropagation(),!0}var Lt=function(e,r){return{wrapperWidth:e.offsetWidth,wrapperHeight:e.offsetHeight,contentWidth:r.offsetWidth,contentHeight:r.offsetHeight}},ha=function(e,r){return!e||e.wrapperWidth!==r.wrapperWidth||e.wrapperHeight!==r.wrapperHeight||e.contentWidth!==r.contentWidth||e.contentHeight!==r.contentHeight},pn=function(e){return e.isPanning||e.isPinching},ma=function(e){return pn(e)||e.wheelStopEventTimer!==null||e.wheelAnimationTimer!==null};function hn(e){var r=e.wrapperComponent,t=e.contentComponent,n=e.setup,i=e.state;if(!r||!t)return null;var o=ce(e,i.scale),a=n.limitToBounds,l=n.centerZoomedOut;if(!a&&!l)return null;var s=Me(i.positionX,i.positionY,o,!0,0,0,r),u=s.x,c=s.y,d=u===Ce(i.positionX,2)&&c===Ce(i.positionY,2);return d?null:{scale:i.scale,positionX:u,positionY:c}}var Ft=function(e){e.animation=null,e.animationFrame=null,e.isAnimating=!1,e.resizeAnimation=null};function va(e){var r=e.setup.autoAlignment.animationTime,t=Math.max(r/5,1);ue(e);var n=Date.now(),i=function(){if(!(!e.mounted||e.animation!==i)){var o=Date.now(),a=Math.max(o-n,1);n=o;var l=hn(e);if(!l){Ft(e);return}var s=e.state,u=s.scale,c=s.positionX,d=s.positionY,f=1-Math.exp(-a/t),p=c+(l.positionX-c)*f,v=d+(l.positionY-d)*f,m=Math.abs(l.positionX-p)<.5&&Math.abs(l.positionY-v)<.5;if(m&&(p=l.positionX,v=l.positionY),e.isAnimating=!m,e.setState(u,p,v),m){Ft(e);return}e.animationFrame=requestAnimationFrame(i)}};e.animation=i,e.resizeAnimation=i,e.animationResolve=null,e.animationFrame=requestAnimationFrame(i)}function mn(e){if(e.setup.disabled){ce(e,e.state.scale);return}if(pn(e)){e.isResizeAlignmentPending=!0;return}var r=e.animation!==null&&e.animation===e.resizeAnimation;if(e.animation&&!r){var t=e.state.scale,n=e.setup,i=n.minScale,o=n.maxScale;if(t<i||t>o){e.isResizeAlignmentPending=!0;return}ue(e)}var a=hn(e);if(!a){r&&Ft(e);return}if(!r){if(e.setup.autoAlignment.animationTime===0){e.setState(a.scale,a.positionX,a.positionY);return}va(e)}}function ga(e){var r=e.wrapperComponent,t=e.contentComponent;if(!(!r||!t)){var n=Lt(r,t);ha(e.measuredSizes,n)&&(e.measuredSizes=n,mn(e))}}var vn=function(e,r){var t=e.setup.wheel,n=t.disabled,i=t.wheelDisabled,o=t.touchPadDisabled,a=t.excluded,l=e.isInitialized,s=e.isPanning,u=r.target,c=l&&!s&&!n&&u;if(!c||r.deltaY===0||i&&!r.ctrlKey||o&&r.ctrlKey)return!1;var d=qe(u,a);if(d)return!1;var f=e.isPressingKeys(e.setup.wheel.activationKeys);return!!f},ba=function(e,r){var t=e.setup,n=t.disabled,i=t.trackPadPanning,o=i.activationKeys,a=i.excluded;if(!e.wrapperComponent||!e.contentComponent||n||i.disabled||r.ctrlKey)return!1;var l=vn(e,r);if(l)return!1;var s=r.target,u=qe(s,a);if(u)return!1;var c=e.isPressingKeys(o);return!!c},wa=function(e){return e?e.deltaY<0?1:-1:0};function ya(e,r){var t=wa(e),n=uo(r,t);return n}function gn(e,r,t){var n=r.getBoundingClientRect(),i=0,o=0;if("clientX"in e)i=(e.clientX-n.left)/t,o=(e.clientY-n.top)/t;else{var a=e.touches[0];i=(a.clientX-n.left)/t,o=(a.clientY-n.top)/t}return Number.isNaN(i)||Number.isNaN(o)?(console.error("No mouse or touch offset found"),{x:0,y:0}):{x:i,y:o}}var Ca=function(e,r,t,n,i){var o=e.state.scale,a=e.wrapperComponent,l=e.setup,s=l.maxScale,u=l.minScale,c=l.zoomAnimation,d=l.disablePadding,f=c.size,p=c.disabled;if(!a)throw new Error("Wrapper is not mounted");var v=o+r*t,m=n?!1:!p,S=Fe(v,u,s,f,m&&!d);return S},bn=function(e,r){var t=e.previousWheelEvent,n=e.state.scale,i=e.setup,o=i.maxScale,a=i.minScale;return t?n<o||n>a||Math.sign(t.deltaY)!==Math.sign(r.deltaY)||t.deltaY>0&&t.deltaY<r.deltaY||t.deltaY<0&&t.deltaY>r.deltaY||Math.sign(t.deltaY)!==Math.sign(r.deltaY):!1},Sa=function(e,r){var t=e.setup.pinch,n=t.disabled,i=t.excluded,o=e.isInitialized,a=r.target,l=o&&!n&&a;if(!l)return!1;var s=qe(a,i);return!s},ka=function(e){var r=e.setup.pinch.disabled,t=e.isInitialized,n=e.pinchStartDistance,i=t&&!r&&n!==null;return!!i},Pa=function(e,r,t){var n=t.getBoundingClientRect(),i=e.touches,o=i[0].clientX-n.left,a=i[0].clientY-n.top,l=i[1].clientX-n.left,s=i[1].clientY-n.top;return{x:(o+l)/2/r,y:(a+s)/2/r}},wn=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},Ta=5,Ea=function(e,r){var t=e.pinchStartScale,n=e.pinchStartDistance,i=e.setup,o=i.maxScale,a=i.minScale,l=i.zoomAnimation,s=i.disablePadding,u=i.pinch,c=l.size,d=l.disabled,f=u.step;if(!t||n===null)throw new Error("Pinch touches distance was not provided");if(r<0)return e.state.scale;var p=r/n,v=p*t,m=(v-t)*(f/Ta),S=t+m,y=S===1/0?0:Ce(S,10);return Fe(y,a,o,c,!d&&!s)},yn=160,Cn=100,Oa=function(e,r){var t=e.props,n=t.onWheelStart,i=t.onZoomStart;ue(e),e.wheelStopEventTimer||(F(L(e),r,n),F(L(e),r,i))},_a=function(e,r){var t=e.props,n=t.onWheel,i=t.onZoom,o=e.contentComponent,a=e.setup,l=e.state,s=l.scale,u=a.limitToBounds,c=a.centerZoomedOut,d=a.zoomAnimation,f=a.wheel,p=a.disablePadding,v=a.smooth,m=d.size,S=d.disabled,y=f.step;if(!o)throw new Error("Component not mounted");r.cancelable&&r.preventDefault(),r.stopPropagation();var z=ya(r,null),j=v?y*Math.abs(r.deltaY):y,R=Ca(e,z,j,!r.ctrlKey);if(s!==R){var D=ce(e,R),k=gn(r,o,s),T=S||m===0||c||p,M=u&&T,N=Tt(e,k.x,k.y,R,D,M),B=N.x,q=N.y;e.previousWheelEvent=r,e.setState(R,B,q),F(L(e),r,n),F(L(e),r,i)}},ja=function(e,r){var t=e.props,n=t.onWheelStop,i=t.onZoomStop;it(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(rr(e,r.x,r.y),e.wheelAnimationTimer=null,e.flushResizeAlignment())},Cn);var o=bn(e,r);o&&(it(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,F(L(e),r,n),F(L(e),r,i),e.flushResizeAlignment())},yn))},Aa=function(e,r){var t=e.props,n=t.onWheelStart,i=t.onPanningStart;ue(e),e.wheelStopEventTimer||(e.wheelAnimationTimer||ce(e,e.state.scale),F(L(e),r,n),F(L(e),r,i))},Ra=function(e,r){var t=e.props,n=t.onWheelStop,i=t.onPanningStop;it(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(rr(e,r.x,r.y),e.wheelAnimationTimer=null,e.flushResizeAlignment())},Cn);var o=bn(e,r);o&&(it(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,F(L(e),r,n),F(L(e),r,i),e.flushResizeAlignment())},yn))},Sn=function(e){for(var r=0,t=0,n=0;n<2;n+=1)r+=e.touches[n].clientX,t+=e.touches[n].clientY;var i=r/2,o=t/2;return{x:i,y:o}},xa=function(e,r){var t=wn(r);e.pinchStartDistance=t,e.lastDistance=t,e.pinchStartScale=e.state.scale,e.isPanning=!1,e.isPinching=!0,e.pinchPreviousCenter=Sn(r),ue(e)},za=function(e,r){var t=e.contentComponent,n=e.pinchStartDistance,i=e.wrapperComponent,o=e.pinchPreviousCenter,a=e.state.scale,l=e.setup,s=l.limitToBounds,u=l.centerZoomedOut,c=l.zoomAnimation,d=l.autoAlignment,f=l.pinch,p=l.panning,v=c.disabled,m=c.size,S=f.allowPanning;if(!(n===null||!t)){var y=Pa(r,a,t);if(!(!Number.isFinite(y.x)||!Number.isFinite(y.y))){var z=wn(r),j=Ea(e,z),R=Sn(r),D=a/j,k=(R.x-((o==null?void 0:o.x)||0))*D,T=(R.y-((o==null?void 0:o.y)||0))*D;if(!(j===a&&k===0&&T===0)){e.pinchPreviousCenter=R;var M=ce(e,j),N=v||m===0||u,B=s&&N,q=Tt(e,y.x,y.y,j,M,B),C=q.x,w=q.y;if(e.pinchMidpoint=y,e.lastDistance=z,p.disabled||!S)e.setState(j,C,w);else{var O=d.sizeX,A=d.sizeY,X=Oe(e,O,j),Z=Oe(e,A,j),G=C+k,se=w+T,me=Me(G,se,M,s,X,Z,i),le=me.x,we=me.y;e.setState(j,le,we)}}}}},Da=function(e){var r=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,e.isPinching=!1,rr(e,r==null?void 0:r.x,r==null?void 0:r.y)},kn=function(e,r){var t=e.props.onZoomStop,n=e.setup.doubleClick.animationTime;it(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,e.mounted&&F(L(e),r,t)},n)},Na=function(e,r){var t=e.props,n=t.onZoomStart,i=t.onZoom,o=e.setup.doubleClick,a=o.animationTime,l=o.animationType;F(L(e),r,n),ln(e,a,l,function(){return F(L(e),r,i)}),kn(e,r)};function Ma(e,r){return e==="toggle"?r===1?1:-1:e==="zoomOut"?-1:1}function Ya(e,r){var t=e.setup,n=e.doubleClickStopEventTimer,i=e.state,o=e.contentComponent,a=i.scale,l=e.props,s=l.onZoomStart,u=l.onZoom,c=t.doubleClick,d=c.disabled,f=c.mode,p=c.step,v=c.animationTime,m=c.animationType;if(!d&&!n){if(f==="reset")return Na(e,r);if(!o)return console.error("No ContentComponent found");var S=Ma(f,e.state.scale),y=an(e,S,p);if(a!==y){F(L(e),r,s);var z=gn(r,o,a),j=Et(e,y,z.x,z.y);if(!j)return console.error("Error during zoom event. New transformation state was not calculated.");F(L(e),r,u),Ae(e,j,v,m),kn(e,r)}}}var Xa=function(e,r){var t=e.isInitialized,n=e.setup,i=e.wrapperComponent,o=n.doubleClick,a=o.disabled,l=o.excluded,s=r.target,u=i==null?void 0:i.contains(s),c=t&&s&&u&&!a;if(!c)return!1;var d=qe(s,l);return!(d||ir(s))},Wa=(function(){function e(r){var t=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.onTransformCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.panStartPosition=null,this.lastTouch=null,this.isPinching=!1,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.pinchPreviousCenter=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.isAnimating=!1,this.animation=null,this.animationFrame=null,this.animationResolve=null,this.initObserverTimer=null,this.isInitialLayoutPending=!1,this.measuredSizes=null,this.isResizeAlignmentPending=!1,this.resizeAnimation=null,this.pressedKeys={},this.selectionLock=null,this.mount=function(){t.mounted=!0,t.initializeWindowEvents()},this.unmount=function(){t.mounted=!1,t.cleanupWindowEvents()},this.update=function(n){t.props=n,t.setup=Nr(n),t.wrapperComponent&&t.contentComponent&&!ma(t)&&ce(t,t.state.scale)},this.clearTimers=function(){t.wheelStopEventTimer&&clearTimeout(t.wheelStopEventTimer),t.wheelAnimationTimer&&clearTimeout(t.wheelAnimationTimer),t.doubleClickStopEventTimer&&clearTimeout(t.doubleClickStopEventTimer),t.initObserverTimer&&clearTimeout(t.initObserverTimer),t.wheelStopEventTimer=null,t.wheelAnimationTimer=null,t.doubleClickStopEventTimer=null,t.initObserverTimer=null},this.initializeWindowEvents=function(){var n,i,o,a,l=ft(),s=(n=t.wrapperComponent)===null||n===void 0?void 0:n.ownerDocument,u=s==null?void 0:s.defaultView;(i=t.wrapperComponent)===null||i===void 0||i.addEventListener("wheel",t.onWheelPanning,l),(o=t.wrapperComponent)===null||o===void 0||o.addEventListener("keyup",t.setKeyUnPressed,l),(a=t.wrapperComponent)===null||a===void 0||a.addEventListener("keydown",t.setKeyPressed,l),u==null||u.addEventListener("mousedown",t.onPanningStart,l),u==null||u.addEventListener("mousemove",t.onPanning,l),u==null||u.addEventListener("mouseup",t.onPanningStop,l),s==null||s.addEventListener("mouseleave",t.clearPanning,l),u==null||u.addEventListener("keyup",t.setKeyUnPressed,l),u==null||u.addEventListener("keydown",t.setKeyPressed,l),u==null||u.addEventListener("blur",t.handleWindowBlur)},this.cleanupWindowEvents=function(){var n,i,o,a,l,s=ft(),u=(n=t.wrapperComponent)===null||n===void 0?void 0:n.ownerDocument,c=u==null?void 0:u.defaultView;c==null||c.removeEventListener("mousedown",t.onPanningStart,s),c==null||c.removeEventListener("mousemove",t.onPanning,s),c==null||c.removeEventListener("mouseup",t.onPanningStop,s),u==null||u.removeEventListener("mouseleave",t.clearPanning,s),c==null||c.removeEventListener("keyup",t.setKeyUnPressed,s),c==null||c.removeEventListener("keydown",t.setKeyPressed,s),c==null||c.removeEventListener("blur",t.handleWindowBlur),(i=t.wrapperComponent)===null||i===void 0||i.removeEventListener("wheel",t.onWheelPanning,s),(o=t.wrapperComponent)===null||o===void 0||o.removeEventListener("keyup",t.setKeyUnPressed,s),(a=t.wrapperComponent)===null||a===void 0||a.removeEventListener("keydown",t.setKeyPressed,s),t.cleanupWrapperEvents(),t.clearTimers(),ue(t),t.unlockTextSelection(),(l=t.observer)===null||l===void 0||l.disconnect(),t.observer=void 0,t.isInitialLayoutPending=!1,t.isResizeAlignmentPending=!1,t.resizeAnimation=null},this.cleanupWrapperEvents=function(){var n=t.wrapperComponent;if(n){var i=ft();n.removeEventListener("wheel",t.onWheelZoom,i),n.removeEventListener("dblclick",t.onDoubleClick,i),n.removeEventListener("keydown",t.onKeyboardNavigation,i),n.removeEventListener("touchstart",t.onTouchPanningStart,i),n.removeEventListener("touchmove",t.onTouchPanning,i),n.removeEventListener("touchend",t.onTouchPanningStop,i)}},this.handleInitializeWrapperEvents=function(n){var i=ft();n.addEventListener("wheel",t.onWheelZoom,i),n.addEventListener("dblclick",t.onDoubleClick,i),n.addEventListener("keydown",t.onKeyboardNavigation,i),n.addEventListener("touchstart",t.onTouchPanningStart,i),n.addEventListener("touchmove",t.onTouchPanning,i),n.addEventListener("touchend",t.onTouchPanningStop,i)},this.handleInitialize=function(){var n=t.setup,i=n.centerOnInit,o=n.fitOnInit;if(t.applyTransformation(),t.onInitCallbacks.forEach(function(l){return l(L(t))}),i||o){var a=t.applyInitialLayout();t.isInitialLayoutPending=!0,t.initObserverTimer&&clearTimeout(t.initObserverTimer),a&&(t.initObserverTimer=setTimeout(function(){t.initObserverTimer=null,t.isInitialLayoutPending=!1},5e3))}},this.observeSizes=function(n,i){var o;(o=t.observer)===null||o===void 0||o.disconnect(),t.observer=void 0,t.measuredSizes=Lt(n,i),!(typeof ResizeObserver>"u")&&(t.observer=new ResizeObserver(t.onSizeChange),t.observer.observe(n),t.observer.observe(i))},this.onSizeChange=function(){var n=t,i=n.wrapperComponent,o=n.contentComponent;if(!(!t.mounted||!i||!o)){if(t.isInitialLayoutPending){var a=(o.offsetWidth>0||o.offsetHeight>0)&&i.clientWidth>0&&i.clientHeight>0;if(!a)return;t.isInitialLayoutPending=!1,t.initObserverTimer&&clearTimeout(t.initObserverTimer),t.initObserverTimer=null,t.onInitCallbacks.forEach(function(l){return l(L(t))}),t.applyInitialLayout(),t.measuredSizes=Lt(i,o),ce(t,t.state.scale);return}ga(t)}},this.flushResizeAlignment=function(){t.isResizeAlignmentPending&&(t.isResizeAlignmentPending=!1,mn(t))},this.onWheelZoom=function(n){var i=t.setup.disabled;if(!i){t.syncModifierKeys(n);var o=vn(t,n);o&&(Oa(t,n),_a(t,n),ja(t,n))}},this.onWheelPanning=function(n){var i=t.props.onPanning,o=t.setup.trackPadPanning,a=o.lockAxisX,l=o.lockAxisY;t.syncModifierKeys(n);var s=ba(t,n);if(s){n.cancelable&&n.preventDefault(),n.stopPropagation();var u=t.state,c=u.positionX,d=u.positionY,f=c-n.deltaX,p=d-n.deltaY,v=a?c:f,m=l?d:p,S=t.setup.autoAlignment,y=S.sizeX,z=S.sizeY,j=Oe(t,y),R=Oe(t,z);v===c&&m===d||(Aa(t,n),rn(t,v,m,j,R),F(L(t),n,i),Ra(t,n))}},this.onPanningStart=function(n){var i=t.setup,o=i.disabled,a=i.panning,l=t.props.onPanningStart;if(!(o||a.disabled)){t.syncModifierKeys(n);var s=jr(t,n);if(s){var u=t.isPressingKeys(t.setup.panning.activationKeys);u&&(n.button===0&&!t.setup.panning.allowLeftClickPan||n.button===1&&!t.setup.panning.allowMiddleClickPan||n.button===2&&!t.setup.panning.allowRightClickPan||(n.cancelable&&n.preventDefault(),n.stopPropagation(),ue(t),xr(t,n),t.lockTextSelection(),t.focusForKeyboard(),F(L(t),n,l)))}}},this.onPanning=function(n){var i=t.setup.disabled,o=t.props.onPanning;if(!i){if(t.syncModifierKeys(n),t.isPanning&&n.buttons===0){t.clearPanning(n);return}var a=Ar(t);if(a){var l=t.isPressingKeys(t.setup.panning.activationKeys);l&&(n.cancelable&&n.preventDefault(),n.stopPropagation(),zr(t,n.clientX,n.clientY,Ee.MOUSE),F(L(t),n,o))}}},this.onPanningStop=function(n){var i=t.setup.panning.velocityDisabled,o=t.props.onPanningStop;t.isPanning&&(t.unlockTextSelection(),Wo(t,i),F(L(t),n,o),t.flushResizeAlignment())},this.onPinchStart=function(n){var i=t.setup.disabled,o=t.props.onPinchStart;if(!i){var a=Sa(t,n);a&&(xa(t,n),ue(t),F(L(t),n,o))}},this.onPinch=function(n){var i=t.setup.disabled,o=t.props.onPinch;if(!i){var a=ka(t);a&&(n.cancelable&&n.preventDefault(),n.stopPropagation(),za(t,n),F(L(t),n,o))}},this.onPinchStop=function(n){var i=t.props.onPinchStop;t.pinchStartScale&&(Da(t),F(L(t),n,i),t.flushResizeAlignment())},this.onTouchPanningStart=function(n){var i=t.setup,o=i.disabled,a=i.doubleClick,l=t.props.onPanningStart;if(!o){var s=!(a!=null&&a.disabled),u=t.lastTouch&&+new Date-t.lastTouch<200;if(s&&u&&n.touches.length===1)t.lastTouch=null,t.onDoubleClick(n);else{t.lastTouch=+new Date,ue(t);var c=n.touches,d=c.length===1,f=c.length===2,p=jr(t,n);if(d){if(!p||t.setup.panning.disabled)return;ue(t),xr(t,n),t.lockTextSelection(),t.focusForKeyboard(),F(L(t),n,l)}f&&t.onPinchStart(n)}}},this.onTouchPanning=function(n){var i=t.setup.disabled,o=t.props.onPanning;if(t.isPanning&&n.touches.length===1){if(i)return;var a=Ar(t);if(!a)return;n.cancelable&&n.preventDefault(),n.stopPropagation();var l=n.touches[0];zr(t,l.clientX,l.clientY,Ee.TOUCH),F(L(t),n,o)}else n.touches.length>1&&t.onPinch(n)},this.onTouchPanningStop=function(n){t.onPanningStop(n),t.onPinchStop(n)},this.onDoubleClick=function(n){var i=t.setup.disabled;if(!i){var o=Xa(t,n);o&&Ya(t,n)}},this.clearPanning=function(n){t.isPanning&&t.onPanningStop(n)},this.handleWindowBlur=function(){t.pressedKeys={},t.isPanning&&(t.isPanning=!1,t.startCoords=null),t.unlockTextSelection(),t.flushResizeAlignment()},this.syncModifierKeys=function(n){var i=n.ctrlKey,o=n.metaKey,a=n.shiftKey,l=n.altKey;typeof i=="boolean"&&(t.pressedKeys.Control=i),typeof o=="boolean"&&(t.pressedKeys.Meta=o),typeof a=="boolean"&&(t.pressedKeys.Shift=a),typeof l=="boolean"&&(t.pressedKeys.Alt=l)},this.setKeyPressed=function(n){t.pressedKeys[n.key]=!0},this.setKeyUnPressed=function(n){t.pressedKeys[n.key]=!1},this.isPressingKeys=function(n){return typeof n=="function"?n(Object.entries(t.pressedKeys).filter(function(i){var o=i[1];return o}).map(function(i){var o=i[0];return o})):n.length?!!n.every(function(i){return t.pressedKeys[i]}):!0},this.onKeyboardNavigation=function(n){pa(t,n)},this.focusForKeyboard=function(){var n,i=t.wrapperComponent;if(!(!i||t.setup.keyboard.disabled)){var o=(n=i.ownerDocument)===null||n===void 0?void 0:n.activeElement;o&&i.contains(o)||typeof i.focus=="function"&&i.focus({preventScroll:!0})}},this.lockTextSelection=function(){var n=t.wrapperComponent;!n||t.selectionLock||(t.selectionLock={userSelect:n.style.userSelect,webkitUserSelect:n.style.webkitUserSelect},n.style.userSelect="none",n.style.webkitUserSelect="none")},this.unlockTextSelection=function(){var n=t.selectionLock;t.selectionLock=null;var i=t.wrapperComponent;!i||!n||(i.style.userSelect=n.userSelect,i.style.webkitUserSelect=n.webkitUserSelect)},this.applyInitialLayout=function(){var n=t.setup.fitOnInit,i=t,o=i.wrapperComponent,a=i.contentComponent,l=!!o&&!!a&&o.clientWidth>0&&o.clientHeight>0&&(a.offsetWidth>0||a.offsetHeight>0);if(n){var s=nr(t,n==="cover"?"cover":"contain");if(s)return t.setState(s.scale,s.positionX,s.positionY),l}return t.setCenter(),l},this.setCenter=function(){if(t.wrapperComponent&&t.contentComponent){var n=Ot(t.state.scale,t.wrapperComponent,t.contentComponent);t.setState(n.scale,n.positionX,n.positionY)}},this.handleTransformStyles=function(n,i,o){return t.props.customTransform?t.props.customTransform(n,i,o):fn(n,i,o)},this.getContext=function(){return L(t)},this.applyTransformation=function(){if(!(!t.mounted||!t.contentComponent)){var n=t.state,i=n.scale,o=n.positionX,a=n.positionY,l=t.handleTransformStyles(o,a,i);t.props.detached||(t.contentComponent.style.transform=l),t.onTransformCallbacks.forEach(function(s){return s({scale:i,positionX:o,positionY:a,previousScale:t.state.previousScale,ref:L(t)})})}},this.setState=function(n,i,o){var a=t.props.onTransform;if(!Number.isNaN(n)&&!Number.isNaN(i)&&!Number.isNaN(o)){var l=Math.max(n,1e-7);l!==t.state.scale&&(t.state.previousScale=t.state.scale,t.state.scale=l),t.state.positionX=i,t.state.positionY=o,t.applyTransformation();var s=L(t);t.onChangeCallbacks.forEach(function(u){return u(s)}),F(s,{scale:t.state.scale,positionX:i,positionY:o},a)}else console.error("Detected NaN set state values")},this.onTransform=function(n){return t.onTransformCallbacks.has(n)||t.onTransformCallbacks.add(n),function(){t.onTransformCallbacks.delete(n)}},this.onChange=function(n){return t.onChangeCallbacks.has(n)||t.onChangeCallbacks.add(n),function(){t.onChangeCallbacks.delete(n)}},this.onInit=function(n){return t.onInitCallbacks.has(n)||t.onInitCallbacks.add(n),function(){t.onInitCallbacks.delete(n)}},this.init=function(n,i){t.mounted=!0,t.cleanupWindowEvents(),t.wrapperComponent=n,t.contentComponent=i,ce(t,t.state.scale),t.handleInitializeWrapperEvents(n),t.handleInitialize(),t.observeSizes(n,i),t.initializeWindowEvents(),t.isInitialized=!0;var o=L(t);F(o,void 0,t.props.onInit),ua(t.props.ref,o)},this.props=r,this.setup=Nr(this.props),this.state=on(this.props)}return e})(),lt=Pt.createContext(null),Ba=function(e,r){return typeof e=="function"?e(r):e},La=Pt.forwardRef(function(e,r){var t=g.useRef(null);t.current===null&&(t.current=new Wa(e));var n=t.current,i=Ba(e.children,nt(n));return g.useImperativeHandle(r,function(){return nt(n)},[n]),g.useEffect(function(){return n.mount(),function(){n.unmount()}},[n]),g.useEffect(function(){n.update(e)},[n,e]),h.jsx(lt.Provider,de({value:n},{children:i}))});Pt.forwardRef(function(e,r){var t=g.useRef(null),n=g.useContext(lt);return or(function(){var i=function(o){if(t.current){var a=0,l=0;t.current.style.transform=n.handleTransformStyles(a,l,1/o)}};return i(n.state.scale),n.onChange(function(o){i(o.instance.state.scale)})},[n]),h.jsx("div",de({},e,{ref:ca([t,r])}))});function Fa(e,r){r===void 0&&(r={});var t=r.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var qa=`.transform-component-module_wrapper__SPB86 {
|
|
25
|
-
position: relative;
|
|
26
|
-
width: -moz-fit-content;
|
|
27
|
-
width: fit-content;
|
|
28
|
-
height: -moz-fit-content;
|
|
29
|
-
height: fit-content;
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
32
|
-
/* Text stays selectable (#467); the instance applies an inline lock
|
|
33
|
-
only while a pan gesture is active. */
|
|
34
|
-
margin: 0;
|
|
35
|
-
padding: 0;
|
|
36
|
-
transform: translate3d(0, 0, 0);
|
|
37
|
-
}
|
|
38
|
-
.transform-component-module_content__FBWxo {
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-wrap: wrap;
|
|
41
|
-
width: -moz-fit-content;
|
|
42
|
-
width: fit-content;
|
|
43
|
-
height: -moz-fit-content;
|
|
44
|
-
height: fit-content;
|
|
45
|
-
margin: 0;
|
|
46
|
-
padding: 0;
|
|
47
|
-
transform-origin: 0% 0%;
|
|
48
|
-
}
|
|
49
|
-
.transform-component-module_content__FBWxo img {
|
|
50
|
-
pointer-events: none;
|
|
51
|
-
}
|
|
52
|
-
.transform-component-module_infiniteGrid__Z-aP3 {
|
|
53
|
-
position: absolute;
|
|
54
|
-
inset: 0;
|
|
55
|
-
pointer-events: none;
|
|
56
|
-
background-image: radial-gradient(
|
|
57
|
-
circle,
|
|
58
|
-
rgba(0, 0, 0, 0.12) 1px,
|
|
59
|
-
transparent 1px
|
|
60
|
-
);
|
|
61
|
-
background-size: 20px 20px;
|
|
62
|
-
background-position: 0 0;
|
|
63
|
-
}
|
|
64
|
-
`,Mt={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo",infiniteGrid:"transform-component-module_infiniteGrid__Z-aP3"};Fa(qa);var Ha=function(e){var r,t=e.children,n=e.wrapperClass,i=n===void 0?"":n,o=e.contentClass,a=o===void 0?"":o,l=e.wrapperStyle,s=e.contentStyle,u=e.wrapperProps,c=u===void 0?{}:u,d=e.contentProps,f=d===void 0?{}:d,p=e.infinite,v=p===void 0?!1:p,m=g.useContext(lt),S=m.init,y=m.cleanupWindowEvents,z=g.useRef(null),j=g.useRef(null),R=g.useRef(null);or(function(){var k=z.current,T=j.current;return k!==null&&T!==null&&S&&(S==null||S(k,T)),function(){y==null||y()}},[]),g.useEffect(function(){if(v){var k=R.current;if(k){var T=function(){var M=m.state,N=M.positionX,B=M.positionY;k.style.backgroundPosition="".concat(N,"px ").concat(B,"px")};return T(),m.onChange(T)}}},[v,m]);var D=!(!((r=m.setup.keyboard)===null||r===void 0)&&r.disabled);return h.jsxs("div",de({tabIndex:D?0:void 0},c,{ref:z,className:"".concat(Bt.wrapperClass," ").concat(Mt.wrapper," ").concat(i),style:l},{children:[v&&h.jsx("div",{ref:R,className:Mt.infiniteGrid,"aria-hidden":!0}),h.jsx("div",de({},f,{ref:j,className:"".concat(Bt.contentClass," ").concat(Mt.content," ").concat(a),style:de(de({transformOrigin:"0 0"},s),{transform:fn(m.state.positionX,m.state.positionY,m.state.scale)})},{children:t}))]}))};function Ua(e,r){var t=Math.max(0,Math.min(e.x+e.width,r.x+r.width)-Math.max(e.x,r.x)),n=Math.max(0,Math.min(e.y+e.height,r.y+r.height)-Math.max(e.y,r.y));return t*n}function Za(e){var r=e.elementX,t=e.elementY,n=e.elementWidth,i=e.elementHeight,o=e.scale,a=e.positionX,l=e.positionY,s=e.viewportWidth,u=e.viewportHeight,c=e.margin,d=c===void 0?0:c,f=e.threshold,p=f===void 0?0:f,v={x:-d,y:-d,width:s+2*d,height:u+2*d},m={x:r*o+a,y:t*o+l,width:n*o,height:i*o};if(p<=0){var S=m.x<v.x+v.width&&m.x+m.width>v.x,y=m.y<v.y+v.height&&m.y+m.height>v.y;return S&&y}var z=m.width*m.height;if(z<=0)return!1;var j=Ua(v,m);return j/z>=p}Pt.forwardRef(function(e,r){var t=e.x,n=e.y,i=e.width,o=e.height,a=e.margin,l=a===void 0?0:a,s=e.threshold,u=s===void 0?0:s,c=e.placeholder,d=c===void 0?null:c,f=e.onShow,p=e.onHide,v=e.children,m=e.className,S=e.style,y=g.useContext(lt),z=function(){var N=y.wrapperComponent;return N?Za({elementX:t,elementY:n,elementWidth:i,elementHeight:o,scale:y.state.scale,positionX:y.state.positionX,positionY:y.state.positionY,viewportWidth:N.clientWidth,viewportHeight:N.clientHeight,margin:l,threshold:u}):!1},j=g.useState(z),R=j[0],D=j[1],k=g.useRef(!1),T=g.useRef(f),M=g.useRef(p);return T.current=f,M.current=p,or(function(){var N=function(){var C,w;if(y.wrapperComponent){var O=z();O!==k.current&&(k.current=O,D(O),O?(C=T.current)===null||C===void 0||C.call(T):(w=M.current)===null||w===void 0||w.call(M))}};N();var B=y.onChange(N),q;return y.wrapperComponent||(q=y.onInit(function(){return N()})),function(){B(),q==null||q()}},[y,t,n,i,o,l,u]),R?h.jsx("div",de({ref:r,className:m,style:S},{children:v})):d?h.jsx(h.Fragment,{children:d}):null});var Va=function(){var e=g.useContext(lt);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},Ga=function(){var e=Va();return nt(e)};const $a=new Set(["http:","https:"]);function Ja(e){const r=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!r||r[1].length===1?null:`${r[1].toLowerCase()}:`}const Qa={image:"data:image/",pdf:"data:application/pdf"};function Pn(e,r,t){const n=e.trim();if(n.startsWith("data:"))return n.toLowerCase().startsWith(Qa[r])?{url:n,error:null}:{url:null,error:"unsupported-data"};const i=Ja(n);if(i!==null)return $a.has(i)?{url:n,error:null}:{url:null,error:"blocked"};const o=t(n);return o?{url:o,error:null}:{url:null,error:"local-unavailable"}}function Tn(e,r){switch(e){case"blocked":return`This ${r} source is blocked for safety.`;case"unsupported-data":return`This data URI isn’t a valid ${r} source.`;case"local-unavailable":return`Local ${r} files can’t be displayed here.`}}function Ka({content:e}){const r=pe(),t=J(c=>c.selectedCwd),n=g.useMemo(()=>Pn(e.src,"image",c=>r.mediaUrl(t??"",c)),[e.src,r,t]),[i,o]=g.useState("loading"),[a,l]=g.useState(e.src);a!==e.src&&(l(e.src),o("loading"));const s=e.alt??e.title??"Canvas image";if(n.url===null){const c=n.error?Tn(n.error,"image"):"";return h.jsx(Mr,{children:c})}const u=n.url;return h.jsxs("div",{className:"bg-muted/40 relative flex h-full items-center justify-center",children:[i==="loading"&&h.jsx("p",{className:"text-muted-foreground absolute text-sm","aria-live":"polite",children:"Loading image…"}),i==="error"?h.jsx(Mr,{children:"This image couldn’t be loaded."}):h.jsxs(La,{centerOnInit:!0,doubleClick:{mode:"toggle"},wheel:{step:.15},children:[h.jsx(Ia,{}),h.jsx(Ha,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:h.jsx("img",{src:u,alt:s,onLoad:()=>o("loaded"),onError:()=>o("error"),className:It("max-h-full max-w-full object-contain transition-opacity",i==="loaded"?"opacity-100":"opacity-0")})})]})]})}function Ia(){const{zoomIn:e,zoomOut:r,resetTransform:t}=Ga();return h.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[h.jsx(Yt,{label:"Zoom in",onClick:()=>e(),children:h.jsx(mi,{className:"size-4"})}),h.jsx(Yt,{label:"Zoom out",onClick:()=>r(),children:h.jsx(vi,{className:"size-4"})}),h.jsx(Yt,{label:"Reset zoom",onClick:()=>t(),children:h.jsx(hi,{className:"size-4"})})]})}function Yt({label:e,onClick:r,children:t}){return h.jsx("button",{type:"button",onClick:r,"aria-label":e,className:"bg-background/80 text-muted-foreground hover:text-foreground focus-ring rounded-md border p-1.5 backdrop-blur transition-colors",children:t})}function Mr({children:e}){return h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:e})})}function es({content:e}){const r=pe(),t=J(a=>a.selectedCwd),n=g.useMemo(()=>Pn(e.src,"pdf",a=>r.mediaUrl(t??"",a)),[e.src,r,t]);if(n.url===null){const a=n.error?Tn(n.error,"pdf"):"";return h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:a})})}const i=n.url,o=e.title??"PDF document";return h.jsx("object",{data:i,type:"application/pdf",title:o,className:"h-full w-full",children:h.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[h.jsx("p",{children:"This PDF can’t be shown here."}),h.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Open ",o," in a new tab"]})]})})}function ts(e){const r=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!r||r[1].length===1?null:`${r[1].toLowerCase()}:`}const rs=new Set(["http:","https:","data:"]);function En(e,r,t){const n=e.trim(),i=ts(n);return i!==null?rs.has(i)?i==="data:"&&t!==void 0?n.toLowerCase().startsWith(t)?{url:n}:{url:null}:{url:n}:{url:null}:{url:r(n)}}function ns({content:e}){const r=pe(),t=J(o=>o.selectedCwd),n=g.useMemo(()=>En(e.src,o=>r.mediaUrl(t??"",o),"data:audio/"),[e.src,r,t]),i=e.title??"Canvas audio";return n.url===null?h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:"This audio can’t be played here."})}):h.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center p-8",children:h.jsx("audio",{controls:!0,src:n.url,"aria-label":i,className:"w-full max-w-2xl",children:h.jsxs("p",{className:"text-muted-foreground text-sm",children:["Your browser can’t play this audio."," ",h.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",i]}),"."]})})})}function is({content:e}){const r=pe(),t=J(o=>o.selectedCwd),n=g.useMemo(()=>En(e.src,o=>r.mediaUrl(t??"",o),"data:video/"),[e.src,r,t]),i=e.title??"Canvas video";return n.url===null?h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:"This video can’t be played here."})}):h.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center",children:h.jsx("video",{controls:!0,src:n.url,"aria-label":i,className:"max-h-full w-full max-w-full object-contain",children:h.jsxs("p",{className:"text-muted-foreground p-8 text-sm",children:["Your browser can’t play this video."," ",h.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",i]}),"."]})})})}function On({content:e,documentId:r,channel:t}){const[n]=Kt(),i=ci(e.definition),o=g.useMemo(()=>JSON.stringify(e.definition),[e.definition]);return h.jsx("div",{className:"p-4",children:i.ok?h.jsx(di,{channel:t,document:i.document,sessionId:n??void 0},t?r??t.documentId:o):h.jsx(fi,{error:i.error,raw:i.raw})})}const ot=et().min(1).max(128),ve={protocol:K("dorkos-doc"),v:K(1),nonce:ot,requestToken:ot,loadToken:Wt,generation:Ur.shape.generation};kt("kind",[ie({...ve,kind:K("challenge")}).strict(),ie({...ve,kind:K("ack")}).strict(),ie({...ve,kind:K("connect")}).strict()]);kt("kind",[ie({...ve,kind:K("emit"),requestId:ot,event:gt}).strict(),ie({...ve,kind:K("retire")}).strict()]);kt("kind",[ie({...ve,kind:K("receipt"),requestId:ot,receipt:Zr}).strict(),ie({...ve,kind:K("refused"),requestId:ot,outcome:wr(["cancelled","unconfirmed","refused"])}).strict(),ie({...ve,kind:K("state"),state:oi,stateRev:Wt,docSeq:Wt,reset:yr()}).strict(),ie({...ve,kind:K("event"),frame:ai}).strict(),ie({...ve,kind:K("status"),status:wr(["connecting","ready","offline","revoked"]),unconfirmed:yr()}).strict()]);function os(e,r){try{if(ii(r,1048576)!==void 0)return null;const t=e.safeParse(r);return t.success?t.data:null}catch{return null}}class as{constructor(){ee(this,"contiguous",0);ee(this,"through",0);ee(this,"pending",new Map)}get highest(){return this.contiguous}get catchUpThrough(){return this.through}get pendingCount(){return this.pending.size}reset(){this.contiguous=0,this.through=0,this.pending.clear()}resetHighest(){this.contiguous=0}advance(r){this.contiguous=Math.max(this.contiguous,r)}markThrough(r){this.through=Math.max(this.through,r)}recordGap(r){return this.markThrough(r.docSeq),this.pending.set(r.docSeq,r),this.pending.size<=200?!1:(this.pending.clear(),!0)}takeNextContiguous(){for(const n of this.pending.keys())n<=this.contiguous&&this.pending.delete(n);const r=this.contiguous+1,t=this.pending.get(r);return t&&this.pending.delete(r),t}clearReachedTarget(){return this.contiguous<this.through?!1:(this.through=0,!0)}}const qt=new WeakMap,ut=new WeakMap,Se=new WeakMap,Ke=new WeakMap;function _e(e){Ye(e);const r=qt.get(e);if(!r)throw new Error("Replay owner lifetime is absent.");return r}function ss(e,r){const t=ut.get(r);if(!t||t.owner!==e)throw new Error("Replay run is foreign.");return t}function _n(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){for(const r of Object.values(e))_n(r);Object.freeze(e)}return e}function ls(e){if(Ye(e),qt.has(e))throw new Error("Replay owner lifetime is already initialized.");qt.set(e,new as)}function ar(e){const r=_e(e);return Object.freeze({highest:r.highest,through:r.catchUpThrough,pending:r.pendingCount})}function Yr(e){_e(e).reset()}function Xr(e,r){const t=ut.get(r);if(!(!t||t.owner!==e))return Object.freeze({subject:t.subject,epoch:t.epoch,revision:t.revision,observation:t.observation,ended:t.ended})}function us(e,r,t){const n=Se.get(t),i=ut.get(r);if(!(!i||i.owner!==e||!n||n.owner!==e||n.run!==r||n.phase!=="consuming"||n.admissionRead||!re(e,r)))return n.admissionRead=!0,Object.freeze({response:n.response,since:n.since,revision:n.revision,observation:n.observation,targetBirth:i.targetBirth})}function cs(e,r,t){const n=ss(e,r),i=Se.get(t),o=zn(e,r,t);if(!o||!i||i.owner!==e||i.run!==r||i.phase!=="consuming"||!i.admissionRead||n.ended||n.epoch!==o.epoch||n.subject!==o.previous)throw new Error("Replay own issuance is foreign or stale.");n.subject=o.subject}function jn(e,r,t,n){if(!re(e,r))return;if(n){const o=Ke.get(t);return o&&o.owner===e&&o.run===r&&o.phase==="dispatching"&&!o.advanced?o.frame:void 0}const i=Se.get(t);return i&&i.owner===e&&i.run===r&&i.phase==="frames"&&i.dispatching!==void 0&&!i.advanced?i.frames[i.dispatching]:void 0}function ds(e,r,t,n){const i=Xs(e,r,t,n);if(!i||!re(e,r))throw new Error("Replay cursor advance has no genuine core witness.");const o=n?Ke.get(t):Se.get(t);if(!o||o.advanced)throw new Error("Replay frame advance was consumed.");o.advanced=!0,_e(e).advance(i.docSeq)}function fs(e,r){const t=ut.get(r),n=(t==null?void 0:t.lastPage)&&Se.get(t.lastPage);if(!t||t.owner!==e||!re(e,r)||t.target===void 0||!n||n.phase!=="finished"||n.next!==n.frames.length||n.response.events.length>=200&&_e(e).highest<t.target)return;const i=_e(e);return Object.freeze({highest:i.highest,through:i.catchUpThrough,target:t.target})}function ps(e,r){const t=st(e,r);if(!t)throw new Error("Replay notice is foreign or stale.");const n=_e(e),i=t.notification;if(t.mode==="quarantine")n.markThrough(i.type==="canvas_channel_snapshot"?i.snapshot.highWatermark:i.docSeq),i.type!=="canvas_channel_snapshot"&&n.recordGap(i);else{if(t.mode==="gap"&&i.type!=="canvas_channel_snapshot")return n.recordGap(i);t.mode==="event"&&Qs(e,r)}return!1}function hs(e,r){const t=st(e,r);if(!t||t.mode!=="event"||t.notification.type==="canvas_channel_snapshot")throw new Error("Notice cursor advance is foreign.");_e(e).advance(t.notification.docSeq)}function ms(e){const r=fe(e),t=_e(e),n=Object.freeze({}),i={owner:e,subject:r.subject,epoch:r.epoch,revision:r.revision,observation:r.observation,ended:!1,starting:t.highest,succeeded:!1};ut.set(n,i),Fs(e,n);const o=()=>re(e,n),a=()=>fe(e).live?o()?void 0:"restart":"stop";return Object.freeze({async readPage(){if(!o())return null;const l=fe(e),s=t.highest,u=_t(e),c=u.getCanvasChannel;if(!o())return null;const d=await c.call(u,r.documentId,{since:s,limit:200});if(!o())return null;const f=_n(si.parse(d));if(!o())return null;const p=Object.freeze({});return Se.set(p,{owner:e,run:n,response:f,since:s,revision:l.revision,observation:l.observation,phase:"read",admissionRead:!1,frames:[],next:0,advanced:!1}),p},consumePage(l){const s=Se.get(l);return!o()||!s||s.owner!==e||s.run!==n||s.phase!=="read"?{kind:"done"}:(s.phase="consuming",qs(e,n,l)!=="accepted"||!o()?(s.phase="finished",{kind:"done"}):(i.target??(i.target=s.response.highWatermark),i.targetBirth=s.response.incarnation,s.frames=Object.freeze(s.response.events.filter(c=>c.docSeq<=i.target)),s.phase="frames",i.lastPage=l,s.response.resetRequired&&t.advance(s.response.retentionFloor-1),{kind:"frames",count:s.frames.length}))},advancePageFrame(l,s){const u=Se.get(l);if(!o()||!u||u.owner!==e||u.run!==n||u.phase!=="frames"||s!==u.next||!u.frames[s])return!1;u.next=s+1,u.dispatching=s,u.advanced=!1;try{return Br(e,n,l,!1)&&o()}finally{u.dispatching=void 0}},finishPage(l){const s=Se.get(l);if(!o()||!s||s.owner!==e||s.run!==n||s.phase!=="frames"||s.next!==s.frames.length||i.target===void 0)return"done";if(s.phase="finished",s.response.events.length<200||t.highest>=i.target)return t.advance(i.target),!o()||(Lr(e,n),!o())||(i.succeeded=!0),"done";if(t.highest<=s.since)throw new Error("Document replay made no progress.");return"again"},failed(){o()&&Hs(e,n)},beginFinalization(){return a()??(i.succeeded?"drain":"stop")},takePending(){if(!o())return null;const l=t.takeNextContiguous();if(!l||!o())return null;const s=Object.freeze({});return Ke.set(s,{owner:e,run:n,frame:l,phase:"taken",advanced:!1}),s},advancePending(l){const s=Ke.get(l);if(!o()||!s||s.owner!==e||s.run!==n||s.phase!=="taken")return!1;s.phase="dispatching";try{return Br(e,n,l,!0)&&o()}finally{s.phase="finished",Ke.delete(l)}},finishFinalization(){const l=a();if(l)return l;if(t.clearReachedTarget()){const s=a();if(s)return s;Lr(e,n);const u=a();if(u)return u}if(t.pendingCount||t.catchUpThrough>t.highest){const s=fe(e);if(t.highest>i.starting||s.revision>i.revision||s.observation>i.observation)return"restart";Us(e,n)}return a()??"stop"},current:o,end:()=>{i.ended=!0}})}var be,Ut,$e;class Ht{constructor(){gr(this,be);ee(this,"current",null);ee(this,"token",0);ee(this,"retiring",!1);ee(this,"subscribers",new Set);ee(this,"resources",new Map);ee(this,"doc",null);ee(this,"docClaims",new WeakMap);ee(this,"retiringDoc",!1);ee(this,"docResources",new Map);ee(this,"bindings",new WeakSet)}getCurrent(){return this.current}observeHostContext(r){if(this.retiring)return null;if(!r.transportOwner||typeof r.transportOwner!="object"||!Number.isSafeInteger(r.publisherEpoch)||r.publisherEpoch<0)throw new Error("Explicit transport owner and epoch required.");const t=["frame","documentId","resolvedSource","logicalUrl","reloadKey","sessionId","eligibility","exactOrigin","transportOwner","publisherEpoch"];if(t.some(i=>!Object.hasOwn(r,i))||typeof r.documentId!="string"||!r.documentId||typeof r.logicalUrl!="string"||typeof r.reloadKey!="string")throw new Error("Complete host context required.");const n=this.current;return n&&t.every(i=>Object.is(n[i],r[i]))?n:(this.retire(),this.current=Object.freeze({...r,token:this.token,loaded:!1}),this.current)}observeLoaded(r){return this.retiring||this.current!==r||!r.frame?null:(this.retire(),this.current=Object.freeze({...r,token:this.token,loaded:!0}),this.current)}retire(){if(this.retiring)return;const r=this.current;this.current=null;const t=this.doc;this.doc=null,this.token++,this.retiring=!0;const n=[...r?this.resources.get(r)??[]:[],...t?this.docResources.get(t)??[]:[],...this.subscribers];t&&this.docResources.delete(t),r&&this.resources.delete(r);try{for(const i of n)try{const o=i();o&&typeof o.then=="function"&&Promise.resolve(o).catch(()=>{})}catch{}}finally{this.retiring=!1}}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}own(r,t){if(this.retiring||this.current!==r)throw new Error("Frame observation retired.");const n=this.resources.get(r)??new Set;return n.add(t),this.resources.set(r,n),()=>{n.delete(t)}}bindDoc(r,t,n){return xe(this,be,Ut).call(this,r,t,n)}acquireDoc(r,t,n){const i=xe(this,be,Ut).call(this,r,t,n),o=Object.freeze({});this.docClaims.set(i,o);let a=!1;return Object.freeze({binding:i,release:()=>{a||(a=!0,this.docClaims.get(i)===o&&(this.docClaims.delete(i),this.doc===i&&this.bindings.has(i)&&xe(this,be,$e).call(this)))}})}disableDoc(){xe(this,be,$e).call(this)}retireDoc(r){this.doc===r&&this.bindings.has(r)&&xe(this,be,$e).call(this)}ownDoc(r,t){if(!this.isCurrent(r))throw new Error("Doc binding retired.");const n=this.docResources.get(r)??new Set;return n.add(t),this.docResources.set(r,n),()=>{n.delete(t)}}isCurrent(r){return!this.retiring&&!this.retiringDoc&&this.doc===r&&this.bindings.has(r)&&this.current===r.observation}}be=new WeakSet,Ut=function(r,t,n){const i=this.doc,o=this.token,a=os(Ur,t);if(!a)throw this.disableDoc(),new Error("Established server Doc birth required.");const l=a,s=r.exactOrigin,u=r.eligibility==="served-document"?s==="null":r.eligibility==="preview-listener"&&s!==null&&new URL(s).origin===s;if(!r.loaded||!r.frame||typeof r.frame.postMessage!="function"||!r.resolvedSource||!u||r.documentId!==l.documentId||!n||n.length>200)throw new Error("Loaded eligible frame and established Doc birth required.");if(this.retiring||this.retiringDoc||this.current!==r||this.doc!==i||this.token!==o)throw new Error("Frame observation retired during Doc admission.");if(this.doc){if(this.doc.observation!==r)throw new Error("Doc binding belongs to another host load.");if(te(this.doc.incarnation,l)&&this.doc.scope===n)return this.doc;throw this.retire(),new Error("Doc birth changed; a fresh host load is required.")}const c=Object.freeze({observation:r,incarnation:Object.freeze(l),scope:n});try{return this.doc=c,this.bindings.add(c),c}catch(d){throw this.doc===c&&xe(this,be,$e).call(this),d}},$e=function(){if(this.retiringDoc)return;const r=this.doc;this.doc=null,this.retiringDoc=!0;const t=[...r?this.docResources.get(r)??[]:[]];r&&this.docResources.delete(r);try{for(const n of t)try{const i=n();i&&typeof i.then=="function"&&Promise.resolve(i).catch(()=>{})}catch{}}finally{this.retiringDoc=!1}};function vs(e,r,t){if(!t||typeof t.captureOriginal!="function"||typeof t.submit!="function"||typeof t.inspect!="function"||typeof t.isCurrentOwner!="function"||t.owner!==r.observation.transportOwner||t.publisherEpoch!==r.observation.publisherEpoch)throw new Error("Explicit current transport submit and inspect ports required.");const{owner:n,publisherEpoch:i,isCurrentOwner:o,submit:a,inspect:l,captureOriginal:s}=t,u=Object.freeze({expectedGeneration:r.incarnation.generation}),c=()=>{try{return e.isCurrent(r)?o(n,i)===!0&&e.isCurrent(r):!1}catch{return!1}};if(!c())throw new Error("Doc binding unavailable.");const d=()=>{if(!c())throw new Error("Doc binding retired.")};return Object.freeze({binding:r,current:c,captureOriginal:f=>{d();const p=f.id;d();const v=f.bytes;d();const m=Reflect.apply(s,t,[Object.freeze({id:p,bytes:v})]);if(d(),!m)return null;const S=m.id;d();const y=m.bytes;d();const z=m.submit;d();const j=m.inspect;return d(),S!==p||y!==v||typeof z!="function"||typeof j!="function"?null:Object.freeze({id:p,bytes:v,submit:async R=>{d(),R.throwIfAborted();const D=await Reflect.apply(z,m,[R]);return d(),R.throwIfAborted(),D},inspect:async R=>{d(),R.throwIfAborted();const D=await Reflect.apply(j,m,[R]);return d(),R.throwIfAborted(),D}})},retireObservation:()=>{c()&&e.retire()},onRetire:f=>e.ownDoc(r,f),submit:(f,p)=>(d(),p.throwIfAborted(),a(f,u,p)),inspect:(f,p)=>(d(),p.throwIfAborted(),l(f,u,p))})}class gs{constructor(){ee(this,"revision",0);ee(this,"draining",!1);ee(this,"cleanup");ee(this,"subscribers",new Set);ee(this,"retirements",new WeakMap)}captureRetirement(){const r=Object.freeze({}),t=++this.revision,n=this.cleanup;return this.cleanup=void 0,this.retirements.set(r,{revision:t,cleanup:n,callbacks:this.draining?[]:[...this.subscribers]}),r}drainRetirement(r){const t=this.retirements.get(r);if(!t)throw new Error("Frame resource retirement is foreign or consumed.");this.retirements.delete(r);const n=this.draining;this.draining=!0;try{this.drain(t.cleanup);for(const i of t.callbacks)this.drain(i)}finally{this.draining=n}}begin(){const r=this.captureRetirement(),t=this.revision;return this.drainRetirement(r),t}once(r,t,n){let i=!1;return()=>{if(i||(i=!0,!this.current(r)||!t()||!this.current(r)))return null;const o=n();return!this.current(r)||!t()||!this.current(r)?null:o}}drain(r){try{Promise.resolve(r==null?void 0:r()).catch(()=>{})}catch{}}current(r){return this.revision===r}install(r,t){return this.current(r)?(this.cleanup=t,!0):!1}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}}function bs(e,r,t){const n=()=>e.current(r)&&t.current()===!0&&e.current(r),i=e.once(r,n,t.complete);return Object.freeze({completeLoad:()=>{const o=i();return!o||!n()||t.accept(o)!==!0||!n()?null:o}})}function ws(e,r,t){const n=()=>e.current(r)&&t.current()===!0&&e.current(r);if(!n())return null;const i=t.acquire();if(!i)return null;let o=!1,a=null,l;try{const s=i.binding;if(n()&&t.bindingCurrent(s)===!0&&n()){const u=t.createPort(s);n()&&t.portCurrent(u)===!0&&n()&&e.install(r,i.release)&&(o=!0,a=u)}}catch(s){l={cause:s}}if(!o)try{i.release()}catch(s){l??(l={cause:s})}if(l)throw l.cause;return a}function ys(e){const r=()=>Object.assign(new Error("Document actions are unavailable."),{status:409}),t=(i,o)=>{if(o.aborted||!e.current(i)||o.aborted)throw r()},n=(i,o)=>{const a=Zr.parse(o);if(a.receipt.id!==i)throw new Error("Document receipt does not match this action.");return a};return Object.freeze({current:e.current,submit:async(i,o)=>{const a=gt.parse(JSON.parse(JSON.stringify(i))),l=a.id;t("submit",o);const s=await e.submit(a,o);t("read",o);const u=n(l,s);return t("read",o),u},inspect:async(i,o)=>{t("read",o);const a=await e.inspect(i,o);t("read",o);const l=n(i,a);return t("read",o),l},captureOriginal:i=>{const o=gt.parse(JSON.parse(JSON.stringify(i))),a=o.id,l=JSON.stringify(o);if(!e.current("submit"))return null;const s=e.capture(o,l);if(!s||!e.current("submit")||!s.current("submit"))return null;let u=!1;const c=d=>s.current(d)===!0;return Object.freeze({id:a,bytes:l,current:c,submit:async d=>{if(u||d.aborted||!c("submit"))throw r();u=!0;const f=await s.submit(JSON.parse(l),d);if(d.aborted||!c("read"))throw r();const p=n(a,f);if(d.aborted||!c("read"))throw r();return p},inspect:async d=>{if(d.aborted||!c("read"))throw r();const f=await s.inspect(a,d);if(d.aborted||!c("read"))throw r();const p=n(a,f);if(d.aborted||!c("read"))throw r();return p}})}})}function Cs(e){return Object.freeze({id:e.id,bytes:e.bytes,submit:async r=>{try{return{kind:"accepted",receipt:await e.submit(r)}}catch{return{kind:"uncertain"}}},inspect:async r=>{try{return{kind:"accepted",receipt:await e.inspect(r)}}catch{return{kind:"unknown"}}}})}function Ss(e,r,t){const n=gt.parse(JSON.parse(e.bytes));if(n.id!==e.id||JSON.stringify(n)!==e.bytes||!t())return null;const i=r(n);return!t()||!i?null:Cs(i)}const ks=Ht.prototype.acquireDoc,wt=new WeakMap,Zt=new WeakMap;function Ps(e,r){const t=_t(e),n=new WeakMap,i=(a,l)=>r.current(l)&&Te(e,a,!0);return Object.freeze({prepareFrameLoad:(a,l)=>{var f;if(!(a instanceof Ht)||l.loaded)return null;const s=Wr(e),u=s?(f=De(e,s))==null?void 0:f.httpBaseline:void 0,c=r.begin();if(!s||!u||!r.current(c)||!Te(e,s,!0)||a.getCurrent()!==l||l.transportOwner!==t||!i(s,c))return null;let d=null;return bs(r,c,{current:()=>{var p;return Te(e,s,!0)&&((p=De(e,s))==null?void 0:p.httpBaseline)===u&&a.getCurrent()===(d??l)&&r.current(c)&&Te(e,s,!0)},complete:()=>(d=a.observeLoaded(l),d),accept:p=>{var v,m;return!r.current(c)||!Te(e,s,!0)||((v=De(e,s))==null?void 0:v.httpBaseline)!==u||a.getCurrent()!==p||!r.current(c)||!Te(e,s,!0)||((m=De(e,s))==null?void 0:m.httpBaseline)!==u?!1:(n.set(p,{record:s,birth:u.birth}),!0)}})},subscribeInvalidation:a=>r.subscribe(a),attachFrame:(a,l)=>{if(!(a instanceof Ht))return null;const s=Wr(e),u=r.begin();if(!s||!r.current(u)||!Te(e,s,!0)||a.getCurrent()!==l||l.transportOwner!==t||!i(s,u))return null;const c=n.get(l);return!c||c.record!==s||!te(c.birth,De(e,s).birth)?null:ws(r,u,{current:()=>i(s,u),acquire:()=>{const d=ks.call(a,l,De(e,s).birth,De(e,s).birth.documentId);let f=!1,p=null,v;try{i(s,u)&&a.getCurrent()===l&&i(s,u)&&(p=Object.freeze({binding:d.binding,release:d.release}),f=!0)}catch(m){v={cause:m}}if(!f)try{d.release()}catch(m){v??(v={cause:m})}if(v)throw v.cause;return p},bindingCurrent:d=>a.isCurrent(d)&&i(s,u),createPort:d=>vs(a,d,{owner:t,publisherEpoch:l.publisherEpoch,isCurrentOwner:(f,p)=>f===t&&p===l.publisherEpoch&&r.current(u)&&Te(e,s),captureOriginal:f=>Ss(f,p=>{var v;return((v=Ls(e,s))==null?void 0:v.captureOriginal(p))??null},()=>i(s,u)),submit:async()=>({kind:"terminal"}),inspect:async()=>({kind:"unknown"})}),portCurrent:d=>d.current()&&i(s,u)})}})}function Ts(e){if(Ye(e),wt.has(e))throw new Error("Frame owner is already initialized.");const r=new gs,t=Ps(e,r);return wt.set(e,{frames:r,facade:t}),t}function Es(e){var r;return Ye(e),(r=wt.get(e))==null?void 0:r.facade}function Je(e){Ye(e);const r=wt.get(e);if(!r)return;const t=Object.freeze({});return Zt.set(t,{owner:e,frames:r.frames,ticket:r.frames.captureRetirement()}),t}function Qe(e,r){if(!r)return;const t=Zt.get(r);if(!t||t.owner!==e)throw new Error("Frame retirement is foreign or consumed.");Zt.delete(r),t.frames.drainRetirement(t.ticket)}function An(e,r){const t=ye(e,r),n=Ys(e,r);if(!(!t||!n))return{owner:r,verified:t.verified,...ys(n)}}function ge(e,r){return{documentId:e,transport:r,events:[],available:!1}}function Os(e,r,t,n,i,o){var s,u;const a=e.documentId===t&&e.transport===n?e:ge(t,n);if(a.snapshot&&(r.highWatermark<a.snapshot.highWatermark||r.stateRev<a.snapshot.stateRev))return a;const l=new Map((((s=a.snapshot)==null?void 0:s.receipts)??[]).filter(c=>c.receipt.docSeq>=r.receiptRetentionFloor).map(c=>[c.receipt.id,c]));for(const c of r.receipts)l.set(c.receipt.id,c);return{...a,available:o,snapshot:{...r,...i?{}:{routing:(u=a.snapshot)==null?void 0:u.routing},receipts:[...l.values()].sort((c,d)=>d.receipt.docSeq-c.receipt.docSeq).slice(0,400)},events:r.resetRequired?a.events.filter(c=>c.docSeq>=r.retentionFloor):a.events}}function _s(e){var t,n,i,o,a,l,s,u,c,d,f,p;const r=async()=>{throw Object.assign(new Error("Document actions are unavailable."),{status:409})};return{documentId:e.documentId,enabled:e.available&&((t=e.binding)==null?void 0:t.verified)===!0&&((i=(n=e.snapshot)==null?void 0:n.routing)==null?void 0:i.enabled)===!0,submissionOwner:(o=e.binding)==null?void 0:o.owner,current:((a=e.binding)==null?void 0:a.current)??(()=>!1),approvedEventTypes:e.available?((s=(l=e.snapshot)==null?void 0:l.routing)==null?void 0:s.approvedEventTypes)??[]:[],destinationLabel:e.available?((c=(u=e.snapshot)==null?void 0:u.routing)==null?void 0:c.destinationLabel)??"Actions unavailable":"Actions unavailable",...e.snapshot?{snapshot:e.snapshot}:{},submit:((d=e.binding)==null?void 0:d.submit)??r,inspect:((f=e.binding)==null?void 0:f.inspect)??r,captureOriginal:(p=e.binding)==null?void 0:p.captureOriginal}}function js(e,r,t){return!!(e&&r&&t.incarnation&&te(r,t.incarnation)&&(t.highWatermark<e.highWatermark||t.stateRev<e.stateRev))}function Rn(e,r,t,n){const i=e.documentId===t&&e.transport===n?e:ge(t,n);return{...i,events:[...i.events,r].slice(-200)}}function As(e,r){if(e.incarnation&&(e.incarnation.documentId!==r||e.events.some(t=>t.documentId!==r||!t.incarnation||!te(e.incarnation,t.incarnation))))throw new Error("Document replay identity changed.")}const Vt=new WeakMap;function Rs(e,r,t){const n=us(e,r,t);if(n)return Vt.set(t,{owner:e,run:r,witness:n}),n}const xn=new WeakMap,at=new WeakMap,Gt=new WeakMap,$t=new WeakMap;function ke(e,r){Ye(e);const t=r??at.get(e),n=t&&xn.get(t);return n&&n.owner===e&&at.get(e)===t&&n.active?n:void 0}function Q(e){return Ye(e),at.get(e)}function ye(e,r){const t=ke(e,r);return t?Object.freeze({birth:t.birth,httpBaseline:t.httpBaseline,snapshot:t.snapshot,verified:t.verified}):void 0}function Ie(e,r,t=!1){var o,a;const n=ke(e,r),i=fe(e);return!!n&&i.live&&n.verified&&n.transport===_t(e)&&(!t||((a=(o=n.snapshot)==null?void 0:o.routing)==null?void 0:a.enabled)===!0)}function xs(e){const r=ke(e);at.delete(e),r&&(r.active=!1,r.verified=!1)}function Xt(e,r){const t=ke(e,r);t&&(t.verified=!1)}function zs(e,r,t){const n=ke(e,t);return!n||!re(e,r)?!1:(n.verified=!0,re(e,r))}function Ds(e,r,t){const n=Vt.get(t);Vt.delete(t);const i=(n==null?void 0:n.owner)===e&&n.run===r?n.witness:void 0;if(!i||!re(e,r))return!1;const o=i.response.incarnation;let a=ke(e);if(!a&&!o)return re(e,r);if(!a&&o){const l=fe(e),s=()=>{const v=fe(e);return re(e,r)&&v.epoch===l.epoch&&v.observation===l.observation&&Q(e)===l.subject},u=_t(e),c=u.ingestCanvasEvent;if(!s())return!1;const d=Function.prototype.bind.call(c,u),f=u.getCanvasEventReceipt;if(!s())return!1;const p=Function.prototype.bind.call(f,u);if(!s())return!1;a={owner:e,token:Object.freeze({}),birth:Object.freeze({...o}),active:!0,verified:!1,submit:d,inspect:p,transport:u},xn.set(a.token,a),at.set(e,a.token),a.httpBaseline=Object.freeze({birth:a.birth,floor:i.response.receiptRetentionFloor}),Gt.set(t,Object.freeze({owner:e,run:r,epoch:l.epoch,previous:l.subject,subject:a.token}));try{cs(e,r,t)}catch(v){throw ke(e)===a&&Gs(e,r,t),v}finally{Gt.delete(t)}if(!re(e,r))return!1}else if(a){if(!o||!te(a.birth,o))return!1;a.httpBaseline=Object.freeze({birth:a.birth,floor:i.response.receiptRetentionFloor})}return re(e,r)?(a&&(a.verified=$s(e)||a.verified),!0):!1}function sr(e,r,t){const n=lr(e),i=n.subject,o=()=>Mn(e,n,t);if(!i||!Ie(e,i)){const s=Je(e);Qe(e,s)}if(!o())return;const a=i&&An(e,i),l=Es(e);n.dispatch(s=>{var d;if(!o())return s;const u=((d=s.binding)==null?void 0:d.owner)===i?s:ge(n.documentId,n.transport),c=typeof r=="function"?r(u):r;return o()?{...c,...c.snapshot?{snapshot:Object.freeze({...c.snapshot})}:{},binding:a,frameAdmission:l}:s})}function Ns(e,r,t,n,i){const o=lr(e),a=ke(e);Mn(e,o,i)&&(a&&(a.snapshot=r),sr(e,l=>Os(l,r,o.documentId,o.transport,t,n),i))}function Ms(e,r,t,n){const i=jn(e,r,t,n);if(!re(e,r)||!i)return!1;if(i.docSeq<=ar(e).highest)return re(e,r);$t.set(t,{owner:e,run:r,pending:n,frame:i});try{ds(e,r,t,n)}finally{$t.delete(t)}if(!re(e,r))return!1;const o=lr(e);return sr(e,a=>Rn(a,i,o.documentId,o.transport),r),re(e,r)}function Ys(e,r){const t=ke(e,r);if(!t)return;const n=fe(e).documentId;return{current:i=>Ie(e,r,i==="submit"),submit:(i,o)=>t.submit(n,i,{expectedGeneration:t.birth.generation},o),inspect:(i,o)=>t.inspect(n,i,{expectedGeneration:t.birth.generation},o),capture:()=>{const i=t.httpBaseline;return!i||!Ie(e,r,!0)||!te(i.birth,t.birth)?null:Object.freeze({current:o=>Ie(e,r,o==="submit")&&(o==="read"||t.httpBaseline===i),submit:(o,a)=>t.submit(n,o,{expectedGeneration:i.birth.generation},a),inspect:(o,a)=>t.inspect(n,o,{expectedGeneration:i.birth.generation},a)})}}}function zn(e,r,t){const n=Gt.get(t),i=fe(e);return n&&n.owner===e&&n.run===r&&i.epoch===n.epoch&&i.subject===n.subject&&i.live?n:void 0}function Xs(e,r,t,n){const i=$t.get(t);return i&&i.owner===e&&i.run===r&&i.pending===n&&re(e,r)?i.frame:void 0}const Dn=new WeakMap,yt=new WeakMap;function Ws(e){const r=yt.get(e);if(!r)throw new Error("Document construction ticket is foreign or consumed.");return yt.delete(e),r}function Bs(e,r,t){const n=Object.freeze({});yt.set(n,Object.freeze({documentId:e,transport:r,dispatch:t}));try{const i=Js(n);return Dn.set(n,i),n}finally{yt.delete(n)}}function I(e){const r=Dn.get(e);if(!r)throw new Error("Document owner is foreign.");return r}function Ye(e){I(e)}function fe(e){return I(e).facts()}function _t(e){return I(e).transport()}function Wr(e){return I(e).subject()}function De(e,r){return I(e).subjectFacts(r)}function Te(e,r,t=!1){return I(e).subjectCurrent(r,t)}function Ls(e,r){return I(e).binding(r)}function Fs(e,r){I(e).reserve(r)}function re(e,r){return I(e).current(r)}function qs(e,r,t){return I(e).admit(r,t)}function Br(e,r,t,n){return I(e).frame(r,t,n)}function Lr(e,r){return I(e).qualify(r)}function Hs(e,r){I(e).failed(r)}function Us(e,r){I(e).unavailable(r)}function Zs(e,r){I(e).start(r)}function Vs(e){I(e).dispose()}const Nn=new WeakMap;function lr(e){const r=Object.freeze(I(e).projection());return Nn.set(r,Object.freeze({custodyKey:e,capture:r})),r}function Mn(e,r,t){const n=Nn.get(r);return(n==null?void 0:n.custodyKey)===e&&n.capture===r&&I(e).projectionCurrent(r.epoch,r.subject,t)}function Gs(e,r,t){I(e).abortAdmission(r,t)}function $s(e){return I(e).qualified()}const Jt=new WeakMap;function Js(e){const{documentId:r,transport:t,dispatch:n}=Ws(e);let i,o=!1,a;const l={live:!0};let s=0,u,c,d=!1,f,p,v=0;const m=()=>l.live,S=()=>xs(e);let y=0;const z=()=>ar(e),j=C=>{const w=Xr(e,C);return!!w&&!w.ended&&m()&&i===C&&w.epoch===s&&w.subject===Q(e)},R=(C=!1)=>{const w=Je(e);S(),s++,i=void 0,C&&Yr(e),Qe(e,w)},D=(C,w)=>sr(e,C,w),k=C=>{const w=fs(e,C),O=Q(e),A=O&&ye(e,O);return!j(C)||!w||w.through>w.highest||!f||!A||!te(f,A.birth)||!zs(e,C,O)?!1:(f=void 0,D(X=>({...X,available:!0}),C),j(C))},T=(C,w,O)=>{const A=Q(e),X=A&&ye(e,A),Z=s,G=()=>m()&&Z===s&&Q(e)===A&&(!O||j(O));if(!G()||js(X==null?void 0:X.snapshot,X==null?void 0:X.birth,C))return;const se=w?C.routing:c;C={...C,routing:se&&Object.freeze({enabled:se.enabled,destinationLabel:se.destinationLabel,approvedEventTypes:Object.freeze([...se.approvedEventTypes])})},w&&(c=C.routing),!A&&!C.incarnation&&(d=!0),G()&&Ns(e,C,w,f===void 0,O)},M=(C,w)=>{var we;const O=Rs(e,C,w);if(!j(C)||!O)return"discard";const A=O.response;As(A,r);const X=A.incarnation;if((Q(e)||f||p)&&!X)throw new Error("Document replay identity is unavailable.");if(p&&X&&!te(p,X))return R(!0),D(ge(r,t)),"restart";const Z=Q(e),G=(Z&&((we=ye(e,Z))==null?void 0:we.birth))??f;if(X&&(G&&!te(G,X)||!G&&d||O.targetBirth&&!te(O.targetBirth,X)))return f=X,d=!1,c=void 0,u=void 0,R(!0),D(ge(r,t)),"restart";const{events:se,...me}=A,le=Q(e);return!le&&X&&(f=p??X),!Ds(e,C,w)||!j(C)?"discard":(!le&&X&&(p=void 0),T(me,O.revision===y,C),j(C)?"accepted":"discard")},N=(C,w,O)=>{var G;const A=jn(e,C,w,O),X=Q(e),Z=(X&&((G=ye(e,X))==null?void 0:G.birth))??f;return!j(C)||!A||A.documentId!==r||Z&&(!A.incarnation||!te(Z,A.incarnation))?!1:Ms(e,C,w,O)},B=(C,w)=>{const O=Object.freeze({});Jt.set(O,Object.freeze({owner:e,revision:y,observation:v,epoch:s,notification:C,mode:w}));try{return ps(e,O)}finally{Jt.delete(O)}},q=C=>{if(o||!m()||(o=!0,D(ge(r,t)),!m()))return;const w=li(void 0,O=>{if(!m()||O.documentId!==r)return;const A=O.type==="canvas_channel_snapshot"?O.snapshot.incarnation:O.incarnation,X=Q(e);if(!X){if(f&&!p&&(!A||!te(f,A))||!A||A.documentId!==r)return;if(!p||!te(p,A)){const Z=!!p||!!f;if(p=Object.freeze({...A}),v++,c=void 0,u=void 0,d=!1,Z&&(R(!0),D(ge(r,t))),!m()||!p||!te(p,A))return}B(O,"quarantine"),m()&&C();return}if(f&&(!A||!te(f,A))){A&&C();return}if(A&&!te(ye(e,X).birth,A)){f=A,d=!1,c=void 0,u=void 0,R(!0),D(ge(r,t)),m()&&C();return}if(A){if(u!==void 0&&u!==O.scope){const Z=Je(e);if(u=O.scope,Xt(e,X),s++,i=void 0,y++,Qe(e,Z),Q(e)!==X||!m())return;D(G=>({...G,available:!1})),Q(e)===X&&m()&&C();return}u=O.scope,y++,O.type==="canvas_channel_snapshot"?T(O.snapshot,!0):O.docSeq>z().highest+1?(B(O,"gap")&&m()&&D(G=>({...G,available:!1})),m()&&C()):B(O,"event")}},t,()=>{if(!m())return;const O=Je(e),A=Q(e);A&&Xt(e,A),s++,i=void 0,y++,Qe(e,O),D(X=>({...X,available:!1})),m()&&C()});m()?a=w:w(),m()&&C()};return Yn.set(e,C=>{const w=st(e,C);if(!w||w.notification.type==="canvas_channel_snapshot")return;const O=Q(e),A=s;!O||!w.notification.incarnation||!te(ye(e,O).birth,w.notification.incarnation)||(D(X=>Rn(X,w.notification,r,t)),!m()||A!==s||Q(e))}),{facts:()=>Object.freeze({documentId:r,live:m(),epoch:s,revision:y,observation:v,subject:Q(e)}),transport:()=>t,subject:()=>Q(e),subjectFacts:C=>ye(e,C),subjectCurrent:(C,w)=>Ie(e,C,w),binding:C=>An(e,C),qualified:()=>f===void 0,projection:()=>({documentId:r,transport:t,dispatch:n,epoch:s,run:i,subject:Q(e)}),projectionCurrent:(C,w,O)=>m()&&C===s&&w===Q(e)&&(!O||i===O),abortAdmission:(C,w)=>{zn(e,C,w)&&R(!0)},reserve:C=>{const w=Xr(e,C);if(!w||w.ended||!m()||w.epoch!==s||w.subject!==Q(e))throw new Error("Replay run is foreign or stale.");i=C},current:j,admit:M,frame:N,qualify:k,failed:C=>{if(!j(C))return;const w=Q(e);w&&Xt(e,w),D(O=>({...O,available:!1}),C)},unavailable:C=>{j(C)&&D(w=>({...w,available:!1}),C)},start:q,dispose:()=>{if(!m())return;const C=Je(e);l.live=!1,i=void 0;const w=a;a=void 0,S(),s++,Yr(e);try{Qe(e,C)}finally{w==null||w()}}}}function st(e,r){const t=Jt.get(r),n=fe(e);if(!(!t||t.owner!==e||!n.live||n.epoch!==t.epoch||n.revision!==t.revision||n.observation!==t.observation))return t}function Qs(e,r){var l;const t=st(e,r);if(!t||t.notification.type==="canvas_channel_snapshot")return;const n=t.notification,o=fe(e).subject,a=o&&ye(e,o);!a||!n.incarnation||!te(a.birth,n.incarnation)||n.docSeq<=ar(e).highest||(hs(e,r),!(!st(e,r)||fe(e).subject!==o)&&((l=Yn.get(e))==null||l(r)))}const Yn=new WeakMap;function Ks(e,r,t){const n=Bs(e,r,t);ls(n);const i=Ts(n);return Object.freeze({beginRun:()=>ms(n),frameAdmission:i,start:o=>Zs(n,o),dispose:()=>Vs(n)})}function Is(e){let r,t=0;const n=u=>{r===u&&(r=void 0)},i=(u,c)=>{u.settled||(u.settled=!0,c?u.reject(c.cause):u.resolve())},o=()=>{s().catch(()=>{})},a=(u,c)=>{const d=()=>t===u.revision;if(!d())return;const f=c.beginFinalization();if(d()){if(f==="restart"){o();return}if(f==="drain")for(;d();){const p=c.drainOne();if(!d())return;if(p!=="again"){if(p==="restart")o();else if(p==="tail"){const v=c.finishFinalization();d()&&v==="restart"&&o()}return}}}},l=async u=>{let c,d;try{c=e();try{for(;await c.page()==="again";);}catch(f){c.failed(f)}}catch(f){d={cause:f}}finally{n(u);try{c&&a(u,c)}catch(f){d={cause:f}}finally{i(u,d)}}},s=()=>{if(r)return r.promise;let u,c;const d=new Promise((p,v)=>{u=p,c=v}),f={revision:++t,promise:d,resolve:u,reject:c,settled:!1};return r=f,l(f),d};return Object.freeze({request:s})}function el(e,r,t){const n=Ks(e,r,t),i=Is(()=>{const o=n.beginRun();return{async page(){const a=await o.readPage();if(!a)return"done";const l=o.consumePage(a);if(l.kind!=="frames")return l.kind;for(let s=0;s<l.count;s++)if(!o.advancePageFrame(a,s))return"done";return o.finishPage(a)},failed:()=>o.failed(),beginFinalization:()=>{const a=o.beginFinalization();return a!=="drain"&&o.end(),a},drainOne(){if(!o.current())return o.end(),"stop";const a=o.takePending();return a?o.advancePending(a)?"again":(o.end(),"stop"):"tail"},finishFinalization:()=>{try{return o.finishFinalization()}finally{o.end()}}}});return n.start(()=>{i.request().catch(()=>{})}),Object.freeze({dispose:n.dispose})}function tl(e){const r=pe(),[t,n]=g.useState(()=>ge(e,r));g.useLayoutEffect(()=>{const a=el(e,r,n);return()=>a.dispose()},[e,r]);const i=t.documentId===e&&t.transport===r?t:ge(e,r);return{channel:g.useMemo(()=>_s(i),[i]),events:i.events,frameAdmission:i.frameAdmission}}function rl({content:e}){const[r]=Kt();return r?h.jsx("div",{className:"h-full w-full",children:h.jsx(pi,{sessionId:r,serverName:e.serverName,uri:e.uri,title:e.title})}):null}const nl=g.lazy(()=>je(()=>import("./CanvasFileContent-D5egw6o3.js"),__vite__mapDeps([5,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(e=>({default:e.CanvasFileContent}))),il=g.lazy(()=>je(()=>import("./CanvasModel3dContent-BXCQRGHN.js"),__vite__mapDeps([20,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(e=>({default:e.CanvasModel3dContent}))),ol=g.lazy(()=>je(()=>import("./CanvasCsvContent-CgiQWBJA.js"),__vite__mapDeps([21,1,2,22,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(e=>({default:e.CanvasCsvContent}))),al=g.lazy(()=>je(()=>import("./index-CMaIfS_G.js").then(e=>e.u5),__vite__mapDeps([1,2])).then(e=>({default:e.CanvasDiffContent})));function Sl({documentId:e,widgetChannel:r,content:t,onContentChange:n}){switch(t.type){case"url":case"browser":return h.jsx($i,{documentId:e,content:t},`${e}:${t.url}`);case"markdown":return h.jsx(ao,{documentId:e,content:t,onContentChange:n},t.sourcePath??"generated");case"json":return h.jsx(so,{content:t});case"image":return h.jsx(Ka,{content:t});case"pdf":return h.jsx(es,{content:t});case"audio":return h.jsx(ns,{content:t});case"video":return h.jsx(is,{content:t});case"widget":return r?h.jsx(On,{content:t,documentId:e,channel:r}):h.jsx(sl,{documentId:e,content:t});case"mcp_app":return h.jsx(rl,{content:t});case"file":return h.jsx(g.Suspense,{fallback:h.jsx(ht,{}),children:h.jsx(nl,{documentId:e,content:t})});case"model3d":return h.jsx(g.Suspense,{fallback:h.jsx(ht,{}),children:h.jsx(il,{content:t})});case"csv":return h.jsx(g.Suspense,{fallback:h.jsx(ht,{}),children:h.jsx(ol,{content:t})});case"diff":return h.jsx(g.Suspense,{fallback:h.jsx(ht,{}),children:h.jsx(al,{documentId:e,content:t},t.sourcePath)})}}function ht(){return h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"})}function sl({documentId:e,content:r}){const{channel:t}=tl(e);return h.jsx(On,{documentId:e,content:r,channel:t})}const ll=g.lazy(()=>je(()=>import("./BlintzCanvas-B-PoJThg.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.BlintzCanvas})));function kl({roomId:e,document:r,content:t,onSave:n}){const[i,o]=g.useState(null),[a,l]=g.useState(!1),[s,u]=g.useState(null),c=i!==null,d=t.sourcePath===void 0;Di(e,c?r.id:null);const f=async()=>{if(i===null)return;if(i===t.content){o(null),u(null);return}l(!0),u(null);const p=await n(r.id,{...t,content:i});l(!1),p?o(null):u("Couldn’t save. Your words are still here. Try again.")};return h.jsxs("div",{className:"flex h-full flex-col",children:[d&&h.jsxs("div",{className:"flex items-center justify-end gap-2 border-b px-2 py-1",children:[c&&h.jsx("span",{className:"text-muted-foreground text-xs",children:a?"Saving…":"Everyone sees your save."}),h.jsx(mt,{type:"button",size:"xs",variant:"ghost",disabled:a,"aria-label":c?"Save for the room":"Edit this document",onClick:()=>c?void f():o(t.content),children:c?h.jsx(qr,{className:"size-3.5"}):h.jsx(Hr,{className:"size-3.5"})})]}),s!==null&&h.jsx("p",{role:"status",className:"text-destructive border-b px-2 py-1 text-xs",children:s}),h.jsx("div",{className:"flex-1 px-2 pb-6",children:h.jsx(g.Suspense,{fallback:h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"}),children:h.jsx(ll,{value:i??t.content,editable:c,onChange:o},c?"editing":`rev-${r.rev}`)})})]})}const Qt="dorkos-canvas-sessions",ul=1440*60*60*1e3;function Xn(){try{const e=localStorage.getItem(Qt);if(!e)return null;const r=JSON.parse(e);return r===null||typeof r!="object"?null:r}catch{return null}}function Wn(e){try{Object.keys(e).length===0?localStorage.removeItem(Qt):localStorage.setItem(Qt,JSON.stringify(e))}catch{}}function cl(e){return Array.isArray(e.documents)?[...e.documents].sort((r,t)=>(r.openedAt??0)-(t.openedAt??0)).map(r=>r.content).filter(r=>!!r):e.content?[e.content]:[]}function Ct(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(Ct).join(",")}]`:`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>`${JSON.stringify(t)}:${Ct(n)}`).join(",")}}`}function dl(e,r){const t=new Set,n=new Map;for(const o of e){const a=Cr(o.content);if(a!==null){t.add(a);continue}const l=Ct(o.content);n.set(l,(n.get(l)??0)+1)}const i=[];for(const o of r){const a=Cr(o);if(a!==null){t.has(a)||i.push(o);continue}const l=Ct(o),s=n.get(l)??0;s>0?n.set(l,s-1):i.push(o)}return i}const vt=new Set;function Pl(){vt.clear()}function Tl(e,r={}){const t=pe(),n=r.canonical??!0;g.useEffect(()=>{e&&J.getState().loadCanvasForSession(e)},[e]),g.useEffect(()=>{if(!e||!n||vt.has(e))return;const i=Xn();if(!i)return;const o=i[e];if(!o){fl(i);return}vt.add(e),(async()=>{try{const a=cl(o),l=dl(await t.listSessionCanvas(e),a);if(l.length===0){Fr(e);return}for(const s of l)await t.openSessionCanvasDocument(e,s);Fr(e),J.getState().hydrateCanvasFromSnapshot(e,await t.listSessionCanvas(e))}catch{vt.delete(e)}})()},[e,n,t])}function Fr(e){const r=Xn();if(!r)return;const{[e]:t,...n}=r;Wn(n)}function fl(e){const r=Date.now()-ul,t=Object.entries(e).filter(([,n])=>n.accessedAt===void 0||n.accessedAt>=r);t.length!==Object.keys(e).length&&Wn(Object.fromEntries(t))}export{Sl as C,yl as F,kl as R,zi as a,xi as b,Cl as c,On as d,Pl as e,Ai as f,tl as g,Tl as h,En as r,ro as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a8 as n,aa as s,ab as u,az as o,aA as r}from"./index-CMaIfS_G.js";function c(){const a=n(),e=s();return u({mutationKey:o,mutationFn:t=>a.updateConfig(t),onSuccess:()=>{e.invalidateQueries({queryKey:r.current()})}})}export{c as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aa as f,r as n,au as i,av as o}from"./index-CMaIfS_G.js";function s(r,u){return r.findAll(u.filters).map(e=>u.select?u.select(e):e.state)}function x(r={},u){const e=f(u).getMutationCache(),c=n.useRef(r),t=n.useRef(null);return t.current===null&&(t.current=s(e,r)),n.useEffect(()=>{c.current=r}),n.useSyncExternalStore(n.useCallback(l=>e.subscribe(()=>{const a=i(t.current,s(e,c.current));t.current!==a&&(t.current=a,o.schedule(l))}),[e]),()=>t.current,()=>t.current)}export{x as u};
|