@mountaya/elements 0.1.0 → 0.2.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/CHANGELOG.md +38 -0
- package/README.md +4 -3
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/agent/index.cjs +1152 -1905
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +1152 -1202
- package/dist/agent/index.d.ts +1152 -1202
- package/dist/agent/index.js +1147 -1903
- package/dist/agent/index.js.map +1 -1
- package/dist/camera/index.cjs +2470 -3435
- package/dist/camera/index.cjs.map +1 -1
- package/dist/camera/index.d.cts +716 -744
- package/dist/camera/index.d.ts +716 -744
- package/dist/camera/index.js +2438 -3323
- package/dist/camera/index.js.map +1 -1
- package/dist/{units-D9mBrusY.d.cts → chunk-5pTPpv4v.d.cts} +38 -41
- package/dist/{units-D9mBrusY.d.ts → chunk-5pTPpv4v.d.ts} +38 -41
- package/dist/{order-BLhsGsH8.d.ts → chunk-6JzFMFHh.d.ts} +15 -28
- package/dist/chunk-6qyuJVvt.d.ts +513 -0
- package/dist/chunk-9fp0lDic.cjs +583 -0
- package/dist/chunk-9fp0lDic.cjs.map +1 -0
- package/dist/{zones-B05QA8fy.d.ts → chunk-A48H1rDg.d.cts} +2 -4
- package/dist/{zones-B05QA8fy.d.cts → chunk-A48H1rDg.d.ts} +2 -4
- package/dist/chunk-B-m1AchR.cjs +57 -0
- package/dist/chunk-B-m1AchR.cjs.map +1 -0
- package/dist/{bundle-xYrrbJTH.d.ts → chunk-B-qFTf04.d.ts} +51 -57
- package/dist/chunk-B0YROiZh.d.cts +1475 -0
- package/dist/chunk-B14wgOvH.d.cts +68 -0
- package/dist/chunk-B19l3j9r.cjs +150 -0
- package/dist/chunk-B19l3j9r.cjs.map +1 -0
- package/dist/chunk-B2PtjVKg.cjs +86 -0
- package/dist/chunk-B2PtjVKg.cjs.map +1 -0
- package/dist/chunk-B56Oyb7W.cjs +70 -0
- package/dist/chunk-B56Oyb7W.cjs.map +1 -0
- package/dist/chunk-B5WGMQwK.cjs +113 -0
- package/dist/chunk-B5WGMQwK.cjs.map +1 -0
- package/dist/{types-nO2joeRk.d.ts → chunk-B98mKrdu.d.cts} +103 -122
- package/dist/{videoOverlay-Dh_D5_Zs.d.ts → chunk-BB0PmqIM.d.cts} +10 -10
- package/dist/chunk-BBikve0Z.cjs +269 -0
- package/dist/chunk-BBikve0Z.cjs.map +1 -0
- package/dist/chunk-BHeXmM0X.js +37 -0
- package/dist/chunk-BHeXmM0X.js.map +1 -0
- package/dist/chunk-BI8WZLpU.cjs +281 -0
- package/dist/chunk-BI8WZLpU.cjs.map +1 -0
- package/dist/chunk-BIEc_SkR.cjs +29 -0
- package/dist/chunk-BIEc_SkR.cjs.map +1 -0
- package/dist/chunk-BJ6L6_W9.cjs +553 -0
- package/dist/chunk-BJ6L6_W9.cjs.map +1 -0
- package/dist/chunk-BJ91UCbB.js +11 -0
- package/dist/chunk-BJ91UCbB.js.map +1 -0
- package/dist/chunk-BJEZWTKj.cjs +166 -0
- package/dist/chunk-BJEZWTKj.cjs.map +1 -0
- package/dist/chunk-BJz54mfg.cjs +10 -0
- package/dist/chunk-BJz54mfg.cjs.map +1 -0
- package/dist/{sections-CVlc2Inr.d.cts → chunk-BNX5LAfN.d.cts} +289 -330
- package/dist/chunk-BP6KgA86.js +35 -0
- package/dist/chunk-BP6KgA86.js.map +1 -0
- package/dist/{segmentRoute-C5UL_5bp.d.ts → chunk-BRnjQq6K.d.cts} +44 -59
- package/dist/chunk-BSiMEwPS.js +46 -0
- package/dist/chunk-BSiMEwPS.js.map +1 -0
- package/dist/chunk-BTPjDw_y.cjs +16 -0
- package/dist/chunk-BTPjDw_y.cjs.map +1 -0
- package/dist/chunk-BTUUABGI.js +17 -0
- package/dist/chunk-BTUUABGI.js.map +1 -0
- package/dist/chunk-BUeL9y7s.cjs +45 -0
- package/dist/chunk-BUeL9y7s.cjs.map +1 -0
- package/dist/chunk-BWMuCNc9.cjs +172 -0
- package/dist/chunk-BWMuCNc9.cjs.map +1 -0
- package/dist/chunk-BWjRfhpF.js +126 -0
- package/dist/chunk-BWjRfhpF.js.map +1 -0
- package/dist/{types-CTQwbSdA.d.cts → chunk-BZ5KyZXI.d.ts} +103 -122
- package/dist/chunk-B_4SVmvh.js +94 -0
- package/dist/chunk-B_4SVmvh.js.map +1 -0
- package/dist/chunk-BcTUuZQ3.js +95 -0
- package/dist/chunk-BcTUuZQ3.js.map +1 -0
- package/dist/chunk-BdkqSsJe.cjs +140 -0
- package/dist/chunk-BdkqSsJe.cjs.map +1 -0
- package/dist/chunk-BfktMVmI.js +70 -0
- package/dist/chunk-BfktMVmI.js.map +1 -0
- package/dist/chunk-BfzQb0EK.cjs +6 -0
- package/dist/chunk-BhWfT-22.d.cts +808 -0
- package/dist/chunk-BjJcqX5J.cjs +60 -0
- package/dist/chunk-BjJcqX5J.cjs.map +1 -0
- package/dist/{geodesy-543qXKtI.d.ts → chunk-Bk0L8g5J.d.cts} +3 -4
- package/dist/{geodesy-543qXKtI.d.cts → chunk-Bk0L8g5J.d.ts} +3 -4
- package/dist/chunk-Bl4_uVa6.cjs +11 -0
- package/dist/chunk-Bl4_uVa6.cjs.map +1 -0
- package/dist/chunk-BlKF4lrp.js +43 -0
- package/dist/chunk-BlKF4lrp.js.map +1 -0
- package/dist/chunk-Bm1FieGR.js +4 -0
- package/dist/chunk-Bm1FieGR.js.map +1 -0
- package/dist/chunk-Bn6ZbxkS.cjs +27 -0
- package/dist/chunk-BpN3hr6a.cjs +541 -0
- package/dist/chunk-BpN3hr6a.cjs.map +1 -0
- package/dist/{order-BZkUwMou.d.cts → chunk-Bq_WHTfd.d.cts} +15 -28
- package/dist/chunk-Bqt4LBBz.cjs +648 -0
- package/dist/chunk-Bqt4LBBz.cjs.map +1 -0
- package/dist/{language-CEWQ5uYw.d.cts → chunk-Bqt97zwf.d.cts} +3 -18
- package/dist/{language-CEWQ5uYw.d.ts → chunk-Bqt97zwf.d.ts} +3 -18
- package/dist/chunk-BsBiN4w6.d.cts +245 -0
- package/dist/chunk-BvTpOUoC.cjs +207 -0
- package/dist/chunk-BvTpOUoC.cjs.map +1 -0
- package/dist/chunk-BwK6Hl3q.cjs +446 -0
- package/dist/chunk-BwK6Hl3q.cjs.map +1 -0
- package/dist/{elevationTiles-pmsb9wnU.d.cts → chunk-BxDQZDXR.d.cts} +26 -27
- package/dist/{elevationTiles-pmsb9wnU.d.ts → chunk-BxDQZDXR.d.ts} +26 -27
- package/dist/chunk-BxUio8kX.js +20 -0
- package/dist/chunk-BxUio8kX.js.map +1 -0
- package/dist/chunk-BxaocpFi.d.cts +1 -0
- package/dist/chunk-Bywi0K1N.js +36 -0
- package/dist/chunk-Bywi0K1N.js.map +1 -0
- package/dist/chunk-C-IlmkDl.js +59 -0
- package/dist/chunk-C-IlmkDl.js.map +1 -0
- package/dist/chunk-C5PtVewq.d.ts +389 -0
- package/dist/chunk-C5dpC7mQ.js +19 -0
- package/dist/chunk-C5dpC7mQ.js.map +1 -0
- package/dist/chunk-C5q1sgSa.js +46 -0
- package/dist/chunk-C5q1sgSa.js.map +1 -0
- package/dist/chunk-C6fU9G5I.cjs +221 -0
- package/dist/chunk-C6fU9G5I.cjs.map +1 -0
- package/dist/chunk-C71dpWUK.js +5 -0
- package/dist/chunk-C71dpWUK.js.map +1 -0
- package/dist/chunk-C82N1gQX.d.ts +1831 -0
- package/dist/chunk-C8HdaHpu.js +118 -0
- package/dist/chunk-C8HdaHpu.js.map +1 -0
- package/dist/chunk-C8ZGryck.js +236 -0
- package/dist/chunk-C8ZGryck.js.map +1 -0
- package/dist/chunk-C95NG0oD.cjs +43 -0
- package/dist/chunk-C95NG0oD.cjs.map +1 -0
- package/dist/chunk-C9aR8DXb.js +9 -0
- package/dist/chunk-C9aR8DXb.js.map +1 -0
- package/dist/{camera-C48Ykaxv.d.ts → chunk-CAUZnoCs.d.ts} +135 -159
- package/dist/chunk-CBXWWuM9.cjs +82 -0
- package/dist/chunk-CBXWWuM9.cjs.map +1 -0
- package/dist/chunk-CC_Kquu7.d.cts +125 -0
- package/dist/chunk-CC_Kquu7.d.ts +125 -0
- package/dist/chunk-CCp85vXg.cjs +60 -0
- package/dist/chunk-CCp85vXg.cjs.map +1 -0
- package/dist/chunk-CEcB1_uK.js +39 -0
- package/dist/chunk-CEcB1_uK.js.map +1 -0
- package/dist/{bundle-Je5zsRFg.d.cts → chunk-CFIo021l.d.cts} +51 -57
- package/dist/chunk-CH_IZoJE.js +33 -0
- package/dist/chunk-CH_IZoJE.js.map +1 -0
- package/dist/chunk-CHrasH_g.cjs +25 -0
- package/dist/chunk-CHrasH_g.cjs.map +1 -0
- package/dist/chunk-CJVoSaAE.cjs +3 -0
- package/dist/chunk-CJp8nGcb.js +96 -0
- package/dist/chunk-CJp8nGcb.js.map +1 -0
- package/dist/chunk-CJwUtkOt.js +112 -0
- package/dist/chunk-CJwUtkOt.js.map +1 -0
- package/dist/chunk-CKhCOVIf.d.cts +751 -0
- package/dist/chunk-CKiVSRYg.js +50 -0
- package/dist/chunk-CKiVSRYg.js.map +1 -0
- package/dist/chunk-CKtd19eD.cjs +59 -0
- package/dist/chunk-CKtd19eD.cjs.map +1 -0
- package/dist/chunk-CL92KE3j.d.ts +3188 -0
- package/dist/chunk-CLqUlkAe.js +54 -0
- package/dist/chunk-CLqUlkAe.js.map +1 -0
- package/dist/chunk-CMG5OV0q.cjs +4741 -0
- package/dist/chunk-CMG5OV0q.cjs.map +1 -0
- package/dist/chunk-CN_TKSgm.js +10 -0
- package/dist/chunk-CN_TKSgm.js.map +1 -0
- package/dist/chunk-CNe6MtqV.cjs +29 -0
- package/dist/chunk-CNe6MtqV.cjs.map +1 -0
- package/dist/chunk-COQkDTC5.js +83 -0
- package/dist/chunk-COQkDTC5.js.map +1 -0
- package/dist/chunk-CPBl6K4M.cjs +168 -0
- package/dist/chunk-CPBl6K4M.cjs.map +1 -0
- package/dist/chunk-CPx0ZYFB.d.ts +3 -0
- package/dist/chunk-CQQhcP_C.d.ts +197 -0
- package/dist/chunk-CTNoajFh.d.cts +389 -0
- package/dist/chunk-CTd-qgJc.cjs +384 -0
- package/dist/chunk-CTd-qgJc.cjs.map +1 -0
- package/dist/chunk-CW80YYtU.cjs +1056 -0
- package/dist/chunk-CW80YYtU.cjs.map +1 -0
- package/dist/{searchLimits-j99-NTXR.d.ts → chunk-CWpqBgkF.d.cts} +2 -2
- package/dist/{searchLimits-j99-NTXR.d.cts → chunk-CWpqBgkF.d.ts} +2 -2
- package/dist/chunk-CXjRArgy.d.ts +3 -0
- package/dist/chunk-CXonfH3-.cjs +14 -0
- package/dist/chunk-CXonfH3-.cjs.map +1 -0
- package/dist/chunk-CYcouGXN.d.ts +825 -0
- package/dist/chunk-CZDAzEBw.cjs +1621 -0
- package/dist/chunk-CZDAzEBw.cjs.map +1 -0
- package/dist/{amenities-B3-qAjxu.d.cts → chunk-C_fQFr70.d.cts} +40 -41
- package/dist/{amenities-B3-qAjxu.d.ts → chunk-C_fQFr70.d.ts} +40 -41
- package/dist/chunk-CbOtHnnB.cjs +359 -0
- package/dist/chunk-CbOtHnnB.cjs.map +1 -0
- package/dist/chunk-CdA6ZMGk.d.cts +825 -0
- package/dist/chunk-Ce1_thm7.js +146 -0
- package/dist/chunk-Ce1_thm7.js.map +1 -0
- package/dist/chunk-CeD8Hw0j.d.cts +3188 -0
- package/dist/{camera-BrFLU1DH.d.cts → chunk-CeiTuMyt.d.cts} +135 -159
- package/dist/chunk-Ch1OLzLi.js +1 -0
- package/dist/chunk-Cizu_j1N.cjs +87 -0
- package/dist/chunk-Cizu_j1N.cjs.map +1 -0
- package/dist/chunk-CjDe9z6A.d.cts +427 -0
- package/dist/chunk-Cl1etdlu.js +63 -0
- package/dist/chunk-Cl1etdlu.js.map +1 -0
- package/dist/chunk-CmoVJDoz.js +4 -0
- package/dist/chunk-CmoVJDoz.js.map +1 -0
- package/dist/chunk-CnLucxjG.cjs +197 -0
- package/dist/chunk-CnLucxjG.cjs.map +1 -0
- package/dist/chunk-CsWjBmdi.cjs +56 -0
- package/dist/chunk-CsWjBmdi.cjs.map +1 -0
- package/dist/chunk-CuseO5MZ.d.cts +3 -0
- package/dist/chunk-CvMHibbA.d.ts +427 -0
- package/dist/chunk-CwDeiN5U.js +870 -0
- package/dist/chunk-CwDeiN5U.js.map +1 -0
- package/dist/chunk-Cwdmx4tG.js +1 -0
- package/dist/{geolocation-DDkQdWMN.d.cts → chunk-D-4MxHTt.d.cts} +33 -34
- package/dist/{geolocation-DDkQdWMN.d.ts → chunk-D-4MxHTt.d.ts} +33 -34
- package/dist/chunk-D0LF-99V.js +1093 -0
- package/dist/chunk-D0LF-99V.js.map +1 -0
- package/dist/chunk-D1fe-0c_.js +367 -0
- package/dist/chunk-D1fe-0c_.js.map +1 -0
- package/dist/chunk-D21fEI6A.d.ts +1926 -0
- package/dist/chunk-D39gAxya.cjs +89 -0
- package/dist/chunk-D39gAxya.cjs.map +1 -0
- package/dist/chunk-D6KdIW5e.cjs +228 -0
- package/dist/chunk-D6KdIW5e.cjs.map +1 -0
- package/dist/chunk-D6qHYbgW.d.cts +36 -0
- package/dist/{videoOverlay-Dh_D5_Zs.d.cts → chunk-D89E-w70.d.ts} +10 -10
- package/dist/chunk-D8bdTysL.js +552 -0
- package/dist/chunk-D8bdTysL.js.map +1 -0
- package/dist/chunk-D96QJT24.cjs +109 -0
- package/dist/chunk-D96QJT24.cjs.map +1 -0
- package/dist/chunk-DAmkQl-i.js +119 -0
- package/dist/chunk-DAmkQl-i.js.map +1 -0
- package/dist/chunk-DEfsb2lc.cjs +10 -0
- package/dist/chunk-DEfsb2lc.cjs.map +1 -0
- package/dist/chunk-DIFjT5-V.d.cts +66 -0
- package/dist/{sections-CmtaduLc.d.ts → chunk-DJpUw8TN.d.ts} +289 -330
- package/dist/chunk-DK6lm2IZ.cjs +11 -0
- package/dist/chunk-DK6lm2IZ.cjs.map +1 -0
- package/dist/chunk-DKqgr31j.cjs +61 -0
- package/dist/chunk-DKqgr31j.cjs.map +1 -0
- package/dist/chunk-DLZ0QYm9.js +37 -0
- package/dist/chunk-DLZ0QYm9.js.map +1 -0
- package/dist/chunk-DLjS0uaC.js +4 -0
- package/dist/chunk-DLjS0uaC.js.map +1 -0
- package/dist/chunk-DMokwmOV.cjs +49 -0
- package/dist/chunk-DMokwmOV.cjs.map +1 -0
- package/dist/chunk-DMvWgBZL.d.cts +1831 -0
- package/dist/chunk-DNfGfIF3.js +31 -0
- package/dist/chunk-DNfGfIF3.js.map +1 -0
- package/dist/chunk-DQbSRe8D.d.ts +245 -0
- package/dist/chunk-DSGkP8_y.js +45 -0
- package/dist/chunk-DSGkP8_y.js.map +1 -0
- package/dist/chunk-DTctvfSd.d.cts +197 -0
- package/dist/chunk-DWe7igyw.cjs +206 -0
- package/dist/chunk-DWe7igyw.cjs.map +1 -0
- package/dist/chunk-DWsMP5JR.d.ts +68 -0
- package/dist/{provider-DM71XnLX.d.cts → chunk-DWsm3HIW.d.cts} +37 -38
- package/dist/{provider-DM71XnLX.d.ts → chunk-DWsm3HIW.d.ts} +37 -38
- package/dist/chunk-DXABHjLa.cjs +3 -0
- package/dist/chunk-D_BeqSbc.cjs +42 -0
- package/dist/chunk-D_BeqSbc.cjs.map +1 -0
- package/dist/chunk-D_svQNdW.d.ts +66 -0
- package/dist/chunk-Dav4xWrp.js +330 -0
- package/dist/chunk-Dav4xWrp.js.map +1 -0
- package/dist/chunk-DbCPhepL.js +293 -0
- package/dist/chunk-DbCPhepL.js.map +1 -0
- package/dist/chunk-DcrTy-y2.cjs +43 -0
- package/dist/chunk-DcrTy-y2.cjs.map +1 -0
- package/dist/chunk-Ddv484ld.js +487 -0
- package/dist/chunk-Ddv484ld.js.map +1 -0
- package/dist/chunk-De0bjnhY.cjs +88 -0
- package/dist/chunk-De0bjnhY.cjs.map +1 -0
- package/dist/chunk-De2FmNPu.cjs +32 -0
- package/dist/chunk-De2FmNPu.cjs.map +1 -0
- package/dist/{segmentRoute-CIo6dR8Y.d.cts → chunk-DeSjQXiI.d.ts} +44 -59
- package/dist/chunk-Den0Ta6C.js +132 -0
- package/dist/chunk-Den0Ta6C.js.map +1 -0
- package/dist/chunk-DiDKEeEa.js +8 -0
- package/dist/chunk-DiDKEeEa.js.map +1 -0
- package/dist/chunk-Dj60k5PU.js +197 -0
- package/dist/chunk-Dj60k5PU.js.map +1 -0
- package/dist/chunk-DjnYQBCN.js +4705 -0
- package/dist/chunk-DjnYQBCN.js.map +1 -0
- package/dist/chunk-Dk9VKvyq.d.ts +1 -0
- package/dist/chunk-Dor1ERI9.cjs +85 -0
- package/dist/chunk-Dor1ERI9.cjs.map +1 -0
- package/dist/chunk-DpMouOoH.js +451 -0
- package/dist/chunk-DpMouOoH.js.map +1 -0
- package/dist/chunk-DposgdNL.cjs +52 -0
- package/dist/chunk-DposgdNL.cjs.map +1 -0
- package/dist/chunk-DqLTG_5Q.d.cts +3 -0
- package/dist/{roadAccess-D_rOE4xW.d.cts → chunk-Dr5MCIpS.d.cts} +5 -28
- package/dist/{roadAccess-D_rOE4xW.d.ts → chunk-Dr5MCIpS.d.ts} +5 -28
- package/dist/chunk-DrudttCC.cjs +4 -0
- package/dist/chunk-DsDYVJQC.js +173 -0
- package/dist/chunk-DsDYVJQC.js.map +1 -0
- package/dist/chunk-Dw8ur6FJ.js +27 -0
- package/dist/chunk-Dw8ur6FJ.js.map +1 -0
- package/dist/chunk-DwG6M_0v.js +64 -0
- package/dist/chunk-DwG6M_0v.js.map +1 -0
- package/dist/chunk-Dy9a5ibO.js +284 -0
- package/dist/chunk-Dy9a5ibO.js.map +1 -0
- package/dist/chunk-DyayZlQJ.js +157 -0
- package/dist/chunk-DyayZlQJ.js.map +1 -0
- package/dist/chunk-DyhJZC2i.js +126 -0
- package/dist/chunk-DyhJZC2i.js.map +1 -0
- package/dist/chunk-F9zBzmmG.cjs +45 -0
- package/dist/chunk-F9zBzmmG.cjs.map +1 -0
- package/dist/chunk-FyCYofv2.js +116 -0
- package/dist/chunk-FyCYofv2.js.map +1 -0
- package/dist/chunk-GHJRjAk2.js +1 -0
- package/dist/chunk-H14isiSf.d.ts +751 -0
- package/dist/chunk-HIJzXoN4.js +7 -0
- package/dist/chunk-HIJzXoN4.js.map +1 -0
- package/dist/chunk-Id_8kRtu.d.ts +36 -0
- package/dist/chunk-KN60yxBQ.js +5 -0
- package/dist/chunk-KN60yxBQ.js.map +1 -0
- package/dist/chunk-NM5yg6bh.cjs +82 -0
- package/dist/chunk-NM5yg6bh.cjs.map +1 -0
- package/dist/chunk-OXr3zJfM.cjs +119 -0
- package/dist/chunk-OXr3zJfM.cjs.map +1 -0
- package/dist/chunk-QGqgNC4z.d.ts +928 -0
- package/dist/chunk-QJBtJrZ0.js +36 -0
- package/dist/chunk-QJBtJrZ0.js.map +1 -0
- package/dist/{routeProfile-BsSUABXv.d.cts → chunk-QKWhxfPv.d.cts} +196 -45
- package/dist/{routeProfile-BKfSfxx6.d.ts → chunk-QKWhxfPv.d.ts} +196 -45
- package/dist/chunk-QXW7b4Ev.d.cts +410 -0
- package/dist/chunk-RHZrxUrM.cjs +39 -0
- package/dist/chunk-RHZrxUrM.cjs.map +1 -0
- package/dist/chunk-RTxe2i66.js +91 -0
- package/dist/chunk-RTxe2i66.js.map +1 -0
- package/dist/chunk-RrKkJb6P.js +16 -0
- package/dist/chunk-RrKkJb6P.js.map +1 -0
- package/dist/chunk-VOJqpcnM.cjs +181 -0
- package/dist/chunk-VOJqpcnM.cjs.map +1 -0
- package/dist/chunk-VljGTrid.js +1 -0
- package/dist/chunk-X3UVwUEK.d.cts +513 -0
- package/dist/chunk-X9K2WChn.cjs +28 -0
- package/dist/chunk-X9K2WChn.cjs.map +1 -0
- package/dist/chunk-YrtOx6oy.js +251 -0
- package/dist/chunk-YrtOx6oy.js.map +1 -0
- package/dist/chunk-bY7ySujI.d.cts +928 -0
- package/dist/chunk-bYf1sBz5.d.cts +11 -0
- package/dist/chunk-bYf1sBz5.d.ts +11 -0
- package/dist/chunk-blfknWoM.d.cts +1926 -0
- package/dist/chunk-blqsohAb.js +113 -0
- package/dist/chunk-blqsohAb.js.map +1 -0
- package/dist/chunk-cDMCjodI.cjs +58 -0
- package/dist/chunk-cDMCjodI.cjs.map +1 -0
- package/dist/chunk-cWjE3qd6.cjs +10 -0
- package/dist/chunk-cWjE3qd6.cjs.map +1 -0
- package/dist/chunk-dfOgV3fu.js +26 -0
- package/dist/chunk-dfOgV3fu.js.map +1 -0
- package/dist/chunk-f9cTwUX1.cjs +125 -0
- package/dist/chunk-f9cTwUX1.cjs.map +1 -0
- package/dist/chunk-fHVYEZs4.cjs +28 -0
- package/dist/chunk-fHVYEZs4.cjs.map +1 -0
- package/dist/chunk-fWRUMgRI.js +22 -0
- package/dist/chunk-fWRUMgRI.js.map +1 -0
- package/dist/{types-BEv8V_8V.d.cts → chunk-fozLXfHY.d.cts} +8 -8
- package/dist/{types-BEv8V_8V.d.ts → chunk-fozLXfHY.d.ts} +8 -8
- package/dist/chunk-gWmB1l3A.cjs +3122 -0
- package/dist/chunk-gWmB1l3A.cjs.map +1 -0
- package/dist/chunk-gbj2R-_w.js +58 -0
- package/dist/chunk-gbj2R-_w.js.map +1 -0
- package/dist/chunk-iIWxsAXd.js +59 -0
- package/dist/chunk-iIWxsAXd.js.map +1 -0
- package/dist/chunk-lItIuOIS.cjs +137 -0
- package/dist/chunk-lItIuOIS.cjs.map +1 -0
- package/dist/chunk-m6Rh4PCe.cjs +798 -0
- package/dist/chunk-m6Rh4PCe.cjs.map +1 -0
- package/dist/chunk-o3IRANDf.cjs +99 -0
- package/dist/chunk-o3IRANDf.cjs.map +1 -0
- package/dist/chunk-obUcg3Sk.d.ts +808 -0
- package/dist/chunk-ohsf-6Rn.js +600 -0
- package/dist/chunk-ohsf-6Rn.js.map +1 -0
- package/dist/chunk-pBleU6Nv.js +3061 -0
- package/dist/chunk-pBleU6Nv.js.map +1 -0
- package/dist/chunk-px4e99cy.js +71 -0
- package/dist/chunk-px4e99cy.js.map +1 -0
- package/dist/chunk-qwYDLeXc.cjs +99 -0
- package/dist/chunk-qwYDLeXc.cjs.map +1 -0
- package/dist/chunk-rF_859Qk.cjs +101 -0
- package/dist/chunk-rF_859Qk.cjs.map +1 -0
- package/dist/chunk-rLJkqJ5j.d.ts +1475 -0
- package/dist/chunk-twQItIRg.cjs +338 -0
- package/dist/chunk-twQItIRg.cjs.map +1 -0
- package/dist/chunk-vnPrMVjY.js +10 -0
- package/dist/chunk-vnPrMVjY.js.map +1 -0
- package/dist/chunk-ws3bVwaS.d.ts +410 -0
- package/dist/chunk-xh3UkuVs.cjs +246 -0
- package/dist/chunk-xh3UkuVs.cjs.map +1 -0
- package/dist/chunk-yMzRr26E.js +153 -0
- package/dist/chunk-yMzRr26E.js.map +1 -0
- package/dist/collab/index.cjs +802 -1254
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.cts +518 -544
- package/dist/collab/index.d.ts +518 -544
- package/dist/collab/index.js +797 -1252
- package/dist/collab/index.js.map +1 -1
- package/dist/data/index.cjs +39 -132
- package/dist/data/index.d.cts +6 -468
- package/dist/data/index.d.ts +6 -468
- package/dist/data/index.js +7 -15
- package/dist/editor/index.cjs +2631 -4424
- package/dist/editor/index.cjs.map +1 -1
- package/dist/editor/index.d.cts +10 -59
- package/dist/editor/index.d.ts +10 -59
- package/dist/editor/index.js +2619 -4403
- package/dist/editor/index.js.map +1 -1
- package/dist/errors/index.cjs +11 -28
- package/dist/errors/index.d.cts +2 -125
- package/dist/errors/index.d.ts +2 -125
- package/dist/errors/index.js +1 -3
- package/dist/geo/index.cjs +68 -232
- package/dist/geo/index.d.cts +6 -821
- package/dist/geo/index.d.ts +6 -821
- package/dist/geo/index.js +11 -15
- package/dist/i18n/fr/index.cjs +329 -334
- package/dist/i18n/fr/index.cjs.map +1 -1
- package/dist/i18n/fr/index.d.cts +3 -10
- package/dist/i18n/fr/index.d.ts +3 -10
- package/dist/i18n/fr/index.js +324 -332
- package/dist/i18n/fr/index.js.map +1 -1
- package/dist/i18n/index.cjs +434 -447
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +152 -111
- package/dist/i18n/index.d.ts +152 -111
- package/dist/i18n/index.js +420 -420
- package/dist/i18n/index.js.map +1 -1
- package/dist/icons/index.cjs +37 -116
- package/dist/icons/index.d.cts +4 -457
- package/dist/icons/index.d.ts +4 -457
- package/dist/icons/index.js +8 -11
- package/dist/index.cjs +515 -1867
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -121
- package/dist/index.d.ts +44 -121
- package/dist/index.js +52 -65
- package/dist/index.js.map +1 -1
- package/dist/layers/index.cjs +83 -318
- package/dist/layers/index.d.cts +3 -1555
- package/dist/layers/index.d.ts +3 -1555
- package/dist/layers/index.js +5 -17
- package/dist/map-client/index.cjs +5 -4
- package/dist/map-client/index.d.cts +6 -1856
- package/dist/map-client/index.d.ts +6 -1856
- package/dist/map-client/index.js +0 -3
- package/dist/maplibre-worker.mjs +4 -4
- package/dist/navigation/index.cjs +584 -671
- package/dist/navigation/index.cjs.map +1 -1
- package/dist/navigation/index.d.cts +191 -272
- package/dist/navigation/index.d.ts +191 -272
- package/dist/navigation/index.js +579 -669
- package/dist/navigation/index.js.map +1 -1
- package/dist/profile/index.cjs +177 -675
- package/dist/profile/index.d.cts +8 -2086
- package/dist/profile/index.d.ts +8 -2086
- package/dist/profile/index.js +10 -18
- package/dist/seams/index.cjs +15 -39
- package/dist/seams/index.d.cts +4 -254
- package/dist/seams/index.d.ts +4 -254
- package/dist/seams/index.js +4 -6
- package/dist/search/index.cjs +39 -147
- package/dist/search/index.d.cts +6 -888
- package/dist/search/index.d.ts +6 -888
- package/dist/search/index.js +3 -14
- package/dist/style/index.cjs +34 -116
- package/dist/style/index.d.cts +5 -538
- package/dist/style/index.d.ts +5 -538
- package/dist/style/index.js +5 -11
- package/dist/testing/index.cjs +432 -617
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +61 -109
- package/dist/testing/index.d.ts +61 -109
- package/dist/testing/index.js +427 -615
- package/dist/testing/index.js.map +1 -1
- package/dist/timezone/index.cjs +1946 -752
- package/dist/timezone/index.cjs.map +1 -1
- package/dist/timezone/index.d.cts +4 -29
- package/dist/timezone/index.d.ts +4 -29
- package/dist/timezone/index.js +1941 -750
- package/dist/timezone/index.js.map +1 -1
- package/dist/units/index.cjs +29 -99
- package/dist/units/index.d.cts +3 -75
- package/dist/units/index.d.ts +3 -75
- package/dist/units/index.js +3 -6
- package/dist/video/index.cjs +1684 -2169
- package/dist/video/index.cjs.map +1 -1
- package/dist/video/index.d.cts +386 -413
- package/dist/video/index.d.ts +386 -413
- package/dist/video/index.js +1678 -2162
- package/dist/video/index.js.map +1 -1
- package/dist/view/index.cjs +6 -42
- package/dist/view/index.d.cts +3 -836
- package/dist/view/index.d.ts +3 -836
- package/dist/view/index.js +1 -34
- package/package.json +12 -12
- package/src/auth/rules/clientHeader.ts +1 -1
- package/src/camera/rules/modes.ts +38 -42
- package/src/camera/rules/routeContent.ts +1 -0
- package/src/collab/index.ts +1 -5
- package/src/compose/engines/mountayaMap.ts +16 -42
- package/src/compose/rules/developmentWarnings.ts +4 -3
- package/src/compose/rules/fitBox.ts +67 -0
- package/src/compose/rules/maplibreWorkerVersion.gen.ts +1 -1
- package/src/compose/rules/maxBounds.ts +5 -5
- package/src/compose/rules/types.ts +4 -11
- package/src/compose/rules/workerUrl.ts +41 -6
- package/src/editing/rules/engine.ts +4 -2
- package/src/editor/engines/viewClient.ts +8 -0
- package/src/editor/rules/contract.ts +1 -6
- package/src/errors/rules/errors.ts +1 -0
- package/src/geo/index.ts +1 -6
- package/src/i18n/index.ts +1 -0
- package/src/i18n/rules/dates.ts +165 -0
- package/src/index.ts +5 -24
- package/src/map-client/rules/mapClient.ts +4 -2
- package/src/profile/rules/scale.ts +1 -5
- package/src/profile/rules/waypointCard.ts +8 -11
- package/src/search/index.ts +3 -18
- package/src/video/index.ts +1 -1
- package/src/video/profileOverlay/rules/contract.ts +1 -3
- package/src/video/rules/videoEncoder.ts +1 -1
- package/dist/accentColor-GNKBD2CW.js +0 -4
- package/dist/accentColor-GNKBD2CW.js.map +0 -1
- package/dist/accentColor-VX2JSMGE.cjs +0 -17
- package/dist/accentColor-VX2JSMGE.cjs.map +0 -1
- package/dist/chunk-23PFRRB6.js +0 -3
- package/dist/chunk-23PFRRB6.js.map +0 -1
- package/dist/chunk-2GI5SAH2.js +0 -71
- package/dist/chunk-2GI5SAH2.js.map +0 -1
- package/dist/chunk-2MQK6A74.js +0 -39
- package/dist/chunk-2MQK6A74.js.map +0 -1
- package/dist/chunk-2RE7R4LD.js +0 -73
- package/dist/chunk-2RE7R4LD.js.map +0 -1
- package/dist/chunk-3JZQKN4O.js +0 -6
- package/dist/chunk-3JZQKN4O.js.map +0 -1
- package/dist/chunk-3NDXVUUI.js +0 -50
- package/dist/chunk-3NDXVUUI.js.map +0 -1
- package/dist/chunk-3R4GFTUM.cjs +0 -59
- package/dist/chunk-3R4GFTUM.cjs.map +0 -1
- package/dist/chunk-3RVUQ6JN.cjs +0 -22
- package/dist/chunk-3RVUQ6JN.cjs.map +0 -1
- package/dist/chunk-4F6BJMJC.cjs +0 -49
- package/dist/chunk-4F6BJMJC.cjs.map +0 -1
- package/dist/chunk-4NWQD4BX.js +0 -132
- package/dist/chunk-4NWQD4BX.js.map +0 -1
- package/dist/chunk-5K2MH3R6.js +0 -10
- package/dist/chunk-5K2MH3R6.js.map +0 -1
- package/dist/chunk-6ACRNQQQ.cjs +0 -8
- package/dist/chunk-6ACRNQQQ.cjs.map +0 -1
- package/dist/chunk-6D26E3IA.js +0 -66
- package/dist/chunk-6D26E3IA.js.map +0 -1
- package/dist/chunk-6ESAW35P.cjs +0 -80
- package/dist/chunk-6ESAW35P.cjs.map +0 -1
- package/dist/chunk-6LIW2A5M.cjs +0 -1176
- package/dist/chunk-6LIW2A5M.cjs.map +0 -1
- package/dist/chunk-6OTTWVCA.js +0 -57
- package/dist/chunk-6OTTWVCA.js.map +0 -1
- package/dist/chunk-6VROJ4UG.js +0 -862
- package/dist/chunk-6VROJ4UG.js.map +0 -1
- package/dist/chunk-6Y7FTGO4.js +0 -23
- package/dist/chunk-6Y7FTGO4.js.map +0 -1
- package/dist/chunk-75I4CG64.js +0 -104
- package/dist/chunk-75I4CG64.js.map +0 -1
- package/dist/chunk-7CUBXHAH.cjs +0 -14
- package/dist/chunk-7CUBXHAH.cjs.map +0 -1
- package/dist/chunk-7GTCURVY.js +0 -52
- package/dist/chunk-7GTCURVY.js.map +0 -1
- package/dist/chunk-7IWOL6AM.cjs +0 -100
- package/dist/chunk-7IWOL6AM.cjs.map +0 -1
- package/dist/chunk-7QN7M667.cjs +0 -151
- package/dist/chunk-7QN7M667.cjs.map +0 -1
- package/dist/chunk-A6KQDKLM.cjs +0 -1197
- package/dist/chunk-A6KQDKLM.cjs.map +0 -1
- package/dist/chunk-A77EA67G.js +0 -354
- package/dist/chunk-A77EA67G.js.map +0 -1
- package/dist/chunk-AFKOABJ4.cjs +0 -7194
- package/dist/chunk-AFKOABJ4.cjs.map +0 -1
- package/dist/chunk-AG6JV5Z2.cjs +0 -183
- package/dist/chunk-AG6JV5Z2.cjs.map +0 -1
- package/dist/chunk-APBK7NMS.js +0 -30
- package/dist/chunk-APBK7NMS.js.map +0 -1
- package/dist/chunk-AWO5YA7A.cjs +0 -33
- package/dist/chunk-AWO5YA7A.cjs.map +0 -1
- package/dist/chunk-AZATU6QW.js +0 -108
- package/dist/chunk-AZATU6QW.js.map +0 -1
- package/dist/chunk-BD2U3WST.cjs +0 -623
- package/dist/chunk-BD2U3WST.cjs.map +0 -1
- package/dist/chunk-BHBEOU6L.cjs +0 -65
- package/dist/chunk-BHBEOU6L.cjs.map +0 -1
- package/dist/chunk-CNOSNYNE.js +0 -8
- package/dist/chunk-CNOSNYNE.js.map +0 -1
- package/dist/chunk-CW3EFR4O.js +0 -12
- package/dist/chunk-CW3EFR4O.js.map +0 -1
- package/dist/chunk-DASVRNBK.js +0 -7187
- package/dist/chunk-DASVRNBK.js.map +0 -1
- package/dist/chunk-DJ6LCKYP.js +0 -42
- package/dist/chunk-DJ6LCKYP.js.map +0 -1
- package/dist/chunk-E5FHQAIO.cjs +0 -45
- package/dist/chunk-E5FHQAIO.cjs.map +0 -1
- package/dist/chunk-EOML5OTY.cjs +0 -360
- package/dist/chunk-EOML5OTY.cjs.map +0 -1
- package/dist/chunk-EP5CASHL.js +0 -613
- package/dist/chunk-EP5CASHL.js.map +0 -1
- package/dist/chunk-EP5OEEVZ.cjs +0 -14
- package/dist/chunk-EP5OEEVZ.cjs.map +0 -1
- package/dist/chunk-EUXI3FGQ.js +0 -150
- package/dist/chunk-EUXI3FGQ.js.map +0 -1
- package/dist/chunk-EWFSHCOS.js +0 -40
- package/dist/chunk-EWFSHCOS.js.map +0 -1
- package/dist/chunk-EX2C5K2T.cjs +0 -25
- package/dist/chunk-EX2C5K2T.cjs.map +0 -1
- package/dist/chunk-FEXWDQIZ.cjs +0 -8
- package/dist/chunk-FEXWDQIZ.cjs.map +0 -1
- package/dist/chunk-FEYBFY7H.cjs +0 -358
- package/dist/chunk-FEYBFY7H.cjs.map +0 -1
- package/dist/chunk-FRGAV6N6.cjs +0 -34
- package/dist/chunk-FRGAV6N6.cjs.map +0 -1
- package/dist/chunk-G5DHP5VF.js +0 -6
- package/dist/chunk-G5DHP5VF.js.map +0 -1
- package/dist/chunk-G5W2UHV2.js +0 -99
- package/dist/chunk-G5W2UHV2.js.map +0 -1
- package/dist/chunk-G7OP7O2C.cjs +0 -39
- package/dist/chunk-G7OP7O2C.cjs.map +0 -1
- package/dist/chunk-GE6CFCAM.cjs +0 -25
- package/dist/chunk-GE6CFCAM.cjs.map +0 -1
- package/dist/chunk-GIFALLHI.cjs +0 -111
- package/dist/chunk-GIFALLHI.cjs.map +0 -1
- package/dist/chunk-GLFET5GM.js +0 -129
- package/dist/chunk-GLFET5GM.js.map +0 -1
- package/dist/chunk-GQ6UFPFM.js +0 -22
- package/dist/chunk-GQ6UFPFM.js.map +0 -1
- package/dist/chunk-GQJWVMXS.js +0 -129
- package/dist/chunk-GQJWVMXS.js.map +0 -1
- package/dist/chunk-GVVJPUKC.js +0 -80
- package/dist/chunk-GVVJPUKC.js.map +0 -1
- package/dist/chunk-GZ2HOCQ2.cjs +0 -134
- package/dist/chunk-GZ2HOCQ2.cjs.map +0 -1
- package/dist/chunk-HCBOHXWP.js +0 -37
- package/dist/chunk-HCBOHXWP.js.map +0 -1
- package/dist/chunk-IBQJDVHF.cjs +0 -281
- package/dist/chunk-IBQJDVHF.cjs.map +0 -1
- package/dist/chunk-ISLB6Y5Q.cjs +0 -106
- package/dist/chunk-ISLB6Y5Q.cjs.map +0 -1
- package/dist/chunk-J55CRR4F.js +0 -105
- package/dist/chunk-J55CRR4F.js.map +0 -1
- package/dist/chunk-JBG6Z6MQ.cjs +0 -28
- package/dist/chunk-JBG6Z6MQ.cjs.map +0 -1
- package/dist/chunk-K3RQOZRU.js +0 -61
- package/dist/chunk-K3RQOZRU.js.map +0 -1
- package/dist/chunk-KDJYS4GB.cjs +0 -703
- package/dist/chunk-KDJYS4GB.cjs.map +0 -1
- package/dist/chunk-KMCAHUZM.cjs +0 -4
- package/dist/chunk-KMCAHUZM.cjs.map +0 -1
- package/dist/chunk-KUCBNPC6.js +0 -87
- package/dist/chunk-KUCBNPC6.js.map +0 -1
- package/dist/chunk-KV6UE5A4.js +0 -50
- package/dist/chunk-KV6UE5A4.js.map +0 -1
- package/dist/chunk-L6TZ2HQR.cjs +0 -18
- package/dist/chunk-L6TZ2HQR.cjs.map +0 -1
- package/dist/chunk-L7QHHGG2.cjs +0 -141
- package/dist/chunk-L7QHHGG2.cjs.map +0 -1
- package/dist/chunk-LHK3Y2AL.js +0 -271
- package/dist/chunk-LHK3Y2AL.js.map +0 -1
- package/dist/chunk-LO5RYRBH.cjs +0 -6317
- package/dist/chunk-LO5RYRBH.cjs.map +0 -1
- package/dist/chunk-LS5SJMUO.cjs +0 -194
- package/dist/chunk-LS5SJMUO.cjs.map +0 -1
- package/dist/chunk-LUGTMZFN.cjs +0 -42
- package/dist/chunk-LUGTMZFN.cjs.map +0 -1
- package/dist/chunk-LVUQU6D5.js +0 -32
- package/dist/chunk-LVUQU6D5.js.map +0 -1
- package/dist/chunk-M2QRC2GZ.js +0 -166
- package/dist/chunk-M2QRC2GZ.js.map +0 -1
- package/dist/chunk-M6QJYQIM.cjs +0 -53
- package/dist/chunk-M6QJYQIM.cjs.map +0 -1
- package/dist/chunk-MGCPH5EO.js +0 -12
- package/dist/chunk-MGCPH5EO.js.map +0 -1
- package/dist/chunk-MLVUWEZR.cjs +0 -474
- package/dist/chunk-MLVUWEZR.cjs.map +0 -1
- package/dist/chunk-MTAMJMZL.cjs +0 -707
- package/dist/chunk-MTAMJMZL.cjs.map +0 -1
- package/dist/chunk-MXL5AT3N.js +0 -48
- package/dist/chunk-MXL5AT3N.js.map +0 -1
- package/dist/chunk-MYEQSESM.cjs +0 -75
- package/dist/chunk-MYEQSESM.cjs.map +0 -1
- package/dist/chunk-N3VPF6ZD.js +0 -427
- package/dist/chunk-N3VPF6ZD.js.map +0 -1
- package/dist/chunk-N6VUAIGI.js +0 -7
- package/dist/chunk-N6VUAIGI.js.map +0 -1
- package/dist/chunk-N6XRLUN6.js +0 -6286
- package/dist/chunk-N6XRLUN6.js.map +0 -1
- package/dist/chunk-NOGDOZIT.cjs +0 -114
- package/dist/chunk-NOGDOZIT.cjs.map +0 -1
- package/dist/chunk-NUWXEISH.cjs +0 -10
- package/dist/chunk-NUWXEISH.cjs.map +0 -1
- package/dist/chunk-NZCZHXYN.cjs +0 -161
- package/dist/chunk-NZCZHXYN.cjs.map +0 -1
- package/dist/chunk-ODROSWQX.cjs +0 -53
- package/dist/chunk-ODROSWQX.cjs.map +0 -1
- package/dist/chunk-OE36AYKG.cjs +0 -82
- package/dist/chunk-OE36AYKG.cjs.map +0 -1
- package/dist/chunk-OLON7MO6.cjs +0 -437
- package/dist/chunk-OLON7MO6.cjs.map +0 -1
- package/dist/chunk-PBUOR2IT.js +0 -277
- package/dist/chunk-PBUOR2IT.js.map +0 -1
- package/dist/chunk-PC2ELXFF.cjs +0 -225
- package/dist/chunk-PC2ELXFF.cjs.map +0 -1
- package/dist/chunk-PCSGXLOC.js +0 -71
- package/dist/chunk-PCSGXLOC.js.map +0 -1
- package/dist/chunk-PFNMP6FQ.js +0 -56
- package/dist/chunk-PFNMP6FQ.js.map +0 -1
- package/dist/chunk-PIWSZTIP.js +0 -690
- package/dist/chunk-PIWSZTIP.js.map +0 -1
- package/dist/chunk-PKWHJ2GI.js +0 -136
- package/dist/chunk-PKWHJ2GI.js.map +0 -1
- package/dist/chunk-PLMVBX2A.cjs +0 -76
- package/dist/chunk-PLMVBX2A.cjs.map +0 -1
- package/dist/chunk-PM3XCD2G.cjs +0 -113
- package/dist/chunk-PM3XCD2G.cjs.map +0 -1
- package/dist/chunk-QAL4GZO7.cjs +0 -143
- package/dist/chunk-QAL4GZO7.cjs.map +0 -1
- package/dist/chunk-QDB2SEA2.js +0 -74
- package/dist/chunk-QDB2SEA2.js.map +0 -1
- package/dist/chunk-QOV7UNUN.js +0 -25
- package/dist/chunk-QOV7UNUN.js.map +0 -1
- package/dist/chunk-QQUWYLSF.cjs +0 -50
- package/dist/chunk-QQUWYLSF.cjs.map +0 -1
- package/dist/chunk-QUMBH3U4.cjs +0 -9
- package/dist/chunk-QUMBH3U4.cjs.map +0 -1
- package/dist/chunk-R4KA7OFQ.js +0 -12
- package/dist/chunk-R4KA7OFQ.js.map +0 -1
- package/dist/chunk-RBSGAZQQ.js +0 -17
- package/dist/chunk-RBSGAZQQ.js.map +0 -1
- package/dist/chunk-RM5YJWZI.js +0 -46
- package/dist/chunk-RM5YJWZI.js.map +0 -1
- package/dist/chunk-ROKNKXA4.cjs +0 -8
- package/dist/chunk-ROKNKXA4.cjs.map +0 -1
- package/dist/chunk-RQG6D546.cjs +0 -75
- package/dist/chunk-RQG6D546.cjs.map +0 -1
- package/dist/chunk-SG4YDD5L.cjs +0 -74
- package/dist/chunk-SG4YDD5L.cjs.map +0 -1
- package/dist/chunk-SNRCA7EO.js +0 -56
- package/dist/chunk-SNRCA7EO.js.map +0 -1
- package/dist/chunk-SO75R4WW.cjs +0 -22
- package/dist/chunk-SO75R4WW.cjs.map +0 -1
- package/dist/chunk-SP34NHFI.js +0 -45
- package/dist/chunk-SP34NHFI.js.map +0 -1
- package/dist/chunk-SSKSSBWJ.cjs +0 -179
- package/dist/chunk-SSKSSBWJ.cjs.map +0 -1
- package/dist/chunk-TB5663C2.js +0 -1108
- package/dist/chunk-TB5663C2.js.map +0 -1
- package/dist/chunk-TGH4NRES.js +0 -220
- package/dist/chunk-TGH4NRES.js.map +0 -1
- package/dist/chunk-TJ6ZPNID.js +0 -189
- package/dist/chunk-TJ6ZPNID.js.map +0 -1
- package/dist/chunk-U45T35N2.cjs +0 -90
- package/dist/chunk-U45T35N2.cjs.map +0 -1
- package/dist/chunk-UKVOPEZ2.js +0 -442
- package/dist/chunk-UKVOPEZ2.js.map +0 -1
- package/dist/chunk-UTB4NROA.cjs +0 -887
- package/dist/chunk-UTB4NROA.cjs.map +0 -1
- package/dist/chunk-UTW33B5V.js +0 -6
- package/dist/chunk-UTW33B5V.js.map +0 -1
- package/dist/chunk-UYUBSD2V.cjs +0 -33
- package/dist/chunk-UYUBSD2V.cjs.map +0 -1
- package/dist/chunk-V3JEP5AG.cjs +0 -59
- package/dist/chunk-V3JEP5AG.cjs.map +0 -1
- package/dist/chunk-VFAGJXHR.js +0 -18
- package/dist/chunk-VFAGJXHR.js.map +0 -1
- package/dist/chunk-VMEE57E5.cjs +0 -58
- package/dist/chunk-VMEE57E5.cjs.map +0 -1
- package/dist/chunk-VQVBEX3Y.cjs +0 -113
- package/dist/chunk-VQVBEX3Y.cjs.map +0 -1
- package/dist/chunk-VZDXX7TT.cjs +0 -64
- package/dist/chunk-VZDXX7TT.cjs.map +0 -1
- package/dist/chunk-WE5ZTI4D.js +0 -346
- package/dist/chunk-WE5ZTI4D.js.map +0 -1
- package/dist/chunk-WEFUVABP.js +0 -19
- package/dist/chunk-WEFUVABP.js.map +0 -1
- package/dist/chunk-WMU4LRKC.js +0 -28
- package/dist/chunk-WMU4LRKC.js.map +0 -1
- package/dist/chunk-WQ24RRHL.cjs +0 -354
- package/dist/chunk-WQ24RRHL.cjs.map +0 -1
- package/dist/chunk-WW4CGS7G.cjs +0 -26
- package/dist/chunk-WW4CGS7G.cjs.map +0 -1
- package/dist/chunk-WXE5WCTM.js +0 -1144
- package/dist/chunk-WXE5WCTM.js.map +0 -1
- package/dist/chunk-X23BGIYA.cjs +0 -37
- package/dist/chunk-X23BGIYA.cjs.map +0 -1
- package/dist/chunk-XEW4FTR2.js +0 -98
- package/dist/chunk-XEW4FTR2.js.map +0 -1
- package/dist/chunk-XIOI4IYW.js +0 -167
- package/dist/chunk-XIOI4IYW.js.map +0 -1
- package/dist/chunk-XLVPJ37V.cjs +0 -44
- package/dist/chunk-XLVPJ37V.cjs.map +0 -1
- package/dist/chunk-XOHAXXZA.cjs +0 -51
- package/dist/chunk-XOHAXXZA.cjs.map +0 -1
- package/dist/chunk-Y4NRIHK6.cjs +0 -313
- package/dist/chunk-Y4NRIHK6.cjs.map +0 -1
- package/dist/chunk-Y4YMMKL3.js +0 -23
- package/dist/chunk-Y4YMMKL3.js.map +0 -1
- package/dist/chunk-YJNYBVE3.cjs +0 -14
- package/dist/chunk-YJNYBVE3.cjs.map +0 -1
- package/dist/chunk-Z762QNQP.cjs +0 -60
- package/dist/chunk-Z762QNQP.cjs.map +0 -1
- package/dist/chunk-ZG5KMBOF.js +0 -669
- package/dist/chunk-ZG5KMBOF.js.map +0 -1
- package/dist/chunk-ZKONQEFA.js +0 -344
- package/dist/chunk-ZKONQEFA.js.map +0 -1
- package/dist/chunk-ZR5X7QMH.js +0 -39
- package/dist/chunk-ZR5X7QMH.js.map +0 -1
- package/dist/chunk-ZW4BJQ26.js +0 -84
- package/dist/chunk-ZW4BJQ26.js.map +0 -1
- package/dist/climbs-BhlWuu0x.d.ts +0 -70
- package/dist/climbs-DgBFwySV.d.cts +0 -70
- package/dist/data/index.cjs.map +0 -1
- package/dist/data/index.js.map +0 -1
- package/dist/errors/index.cjs.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/geo/index.cjs.map +0 -1
- package/dist/geo/index.js.map +0 -1
- package/dist/icons/index.cjs.map +0 -1
- package/dist/icons/index.js.map +0 -1
- package/dist/itinerary-Dp2ZnqgD.d.cts +0 -178
- package/dist/itinerary-Dp2ZnqgD.d.ts +0 -178
- package/dist/layers/index.cjs.map +0 -1
- package/dist/layers/index.js.map +0 -1
- package/dist/map-client/index.cjs.map +0 -1
- package/dist/map-client/index.js.map +0 -1
- package/dist/markerSprite-DGBQF6PO.cjs +0 -49
- package/dist/markerSprite-DGBQF6PO.cjs.map +0 -1
- package/dist/markerSprite-DZLTR6F6.js +0 -8
- package/dist/markerSprite-DZLTR6F6.js.map +0 -1
- package/dist/mountayaMap-C9mxRFib.d.cts +0 -3277
- package/dist/mountayaMap-DgnlQ2fE.d.ts +0 -3277
- package/dist/paint-BgUcj8l7.d.cts +0 -118
- package/dist/paint-Dx_qGNE_.d.ts +0 -118
- package/dist/profile/index.cjs.map +0 -1
- package/dist/profile/index.js.map +0 -1
- package/dist/seams/index.cjs.map +0 -1
- package/dist/seams/index.js.map +0 -1
- package/dist/search/index.cjs.map +0 -1
- package/dist/search/index.js.map +0 -1
- package/dist/searchHighlight-DFE7LVIL.cjs +0 -33
- package/dist/searchHighlight-DFE7LVIL.cjs.map +0 -1
- package/dist/searchHighlight-MHAQZVWG.js +0 -12
- package/dist/searchHighlight-MHAQZVWG.js.map +0 -1
- package/dist/strings-30RSdIat.d.cts +0 -552
- package/dist/strings-DPTIbzT5.d.ts +0 -552
- package/dist/stripeImage-CQUXM2YI.js +0 -14
- package/dist/stripeImage-CQUXM2YI.js.map +0 -1
- package/dist/stripeImage-R43OPA6U.cjs +0 -39
- package/dist/stripeImage-R43OPA6U.cjs.map +0 -1
- package/dist/style/index.cjs.map +0 -1
- package/dist/style/index.js.map +0 -1
- package/dist/types-B034JMjl.d.ts +0 -973
- package/dist/types-B2NDLxQA.d.cts +0 -21
- package/dist/types-B2NDLxQA.d.ts +0 -21
- package/dist/types-C8aX5KMU.d.cts +0 -973
- package/dist/units/index.cjs.map +0 -1
- package/dist/units/index.js.map +0 -1
- package/dist/view/index.cjs.map +0 -1
- package/dist/view/index.js.map +0 -1
package/dist/collab/index.js
CHANGED
|
@@ -1,1274 +1,819 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { surfaceFault } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
// src/collab/engines/trailingThrottle.ts
|
|
1
|
+
import { i as retryAfterDelayMs, n as statusOf, r as reconnectDelayMs, t as retryAfterMsOf } from "../chunk-C5dpC7mQ.js";
|
|
2
|
+
import { n as MountayaElementsForbiddenError, t as MountayaElementsError } from "../chunk-Cl1etdlu.js";
|
|
3
|
+
import { n as surfaceFault } from "../chunk-BTUUABGI.js";
|
|
4
|
+
import { t as MAX_TIMER_MS } from "../chunk-DLjS0uaC.js";
|
|
7
5
|
var TrailingThrottle = class {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.flush(value);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.pending = { value };
|
|
54
|
-
this.open();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* cancel drops the open window and any pending value with it.
|
|
58
|
-
*
|
|
59
|
-
* A disposed session or a cleared draft leaves no trailing send to fire after teardown, and
|
|
60
|
-
* the next push starts a fresh burst, which is what makes `cancel()` the right thing to call
|
|
61
|
-
* when the SUBJECT changes rather than when the throttle is being thrown away.
|
|
62
|
-
*/
|
|
63
|
-
cancel() {
|
|
64
|
-
if (this.timer !== null) {
|
|
65
|
-
clearTimeout(this.timer);
|
|
66
|
-
this.timer = null;
|
|
67
|
-
}
|
|
68
|
-
this.pending = null;
|
|
69
|
-
}
|
|
70
|
-
/** open starts a window that ends one interval from now. */
|
|
71
|
-
open() {
|
|
72
|
-
this.timer = setTimeout(() => this.fire(), this.intervalMs);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* fire ends the window, flushing what it gathered. A leading throttle's window runs from a
|
|
76
|
-
* flush, so the flush that ends one window opens the next: a push inside it waits for the rest
|
|
77
|
-
* of that window rather than for a fresh interval on top of the time already spent.
|
|
78
|
-
*/
|
|
79
|
-
fire() {
|
|
80
|
-
this.timer = null;
|
|
81
|
-
const pending = this.pending;
|
|
82
|
-
this.pending = null;
|
|
83
|
-
if (pending === null) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (this.leading) {
|
|
87
|
-
this.open();
|
|
88
|
-
}
|
|
89
|
-
this.flush(pending.value);
|
|
90
|
-
}
|
|
6
|
+
intervalMs;
|
|
7
|
+
flush;
|
|
8
|
+
pending = null;
|
|
9
|
+
timer = null;
|
|
10
|
+
leading;
|
|
11
|
+
constructor(intervalMs, flush, options = {}) {
|
|
12
|
+
this.intervalMs = intervalMs;
|
|
13
|
+
this.flush = flush;
|
|
14
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 0 || intervalMs > MAX_TIMER_MS) throw new MountayaElementsError(`TrailingThrottle: intervalMs is ${String(intervalMs)}; pass a number of milliseconds from 0 to ${MAX_TIMER_MS}.`);
|
|
15
|
+
this.leading = options.leading ?? false;
|
|
16
|
+
}
|
|
17
|
+
push(value) {
|
|
18
|
+
if (this.timer !== null) {
|
|
19
|
+
this.pending = { value };
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (this.leading) {
|
|
23
|
+
this.open();
|
|
24
|
+
this.flush(value);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.pending = { value };
|
|
28
|
+
this.open();
|
|
29
|
+
}
|
|
30
|
+
cancel() {
|
|
31
|
+
if (this.timer !== null) {
|
|
32
|
+
clearTimeout(this.timer);
|
|
33
|
+
this.timer = null;
|
|
34
|
+
}
|
|
35
|
+
this.pending = null;
|
|
36
|
+
}
|
|
37
|
+
open() {
|
|
38
|
+
this.timer = setTimeout(() => this.fire(), this.intervalMs);
|
|
39
|
+
}
|
|
40
|
+
fire() {
|
|
41
|
+
this.timer = null;
|
|
42
|
+
const pending = this.pending;
|
|
43
|
+
this.pending = null;
|
|
44
|
+
if (pending === null) return;
|
|
45
|
+
if (this.leading) this.open();
|
|
46
|
+
this.flush(pending.value);
|
|
47
|
+
}
|
|
91
48
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var RECONNECT_MAX_MS = 15e3;
|
|
99
|
-
var reconnectSchedule = {
|
|
100
|
-
baseMs: COLLAB_RECONNECT_BASE_MS,
|
|
101
|
-
maxMs: RECONNECT_MAX_MS
|
|
49
|
+
const CHANGE_COALESCE_MS = 200;
|
|
50
|
+
const SELECTION_THROTTLE_MS = 150;
|
|
51
|
+
const LIVE_SEGMENT_THROTTLE_MS = 60;
|
|
52
|
+
const reconnectSchedule = {
|
|
53
|
+
baseMs: 500,
|
|
54
|
+
maxMs: 15e3
|
|
102
55
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return status === void 0 || status >= 500 || status === 408 || status === 429;
|
|
56
|
+
const releaseRetrySchedule = {
|
|
57
|
+
baseMs: 1e3,
|
|
58
|
+
maxMs: 3e4
|
|
107
59
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
]
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
60
|
+
const unsettledFailure = (error) => {
|
|
61
|
+
const status = statusOf(error);
|
|
62
|
+
return status === void 0 || status >= 500 || status === 408 || status === 429;
|
|
63
|
+
};
|
|
64
|
+
const lockKey = (entity) => `${entity.kind}:${entity.id}`;
|
|
65
|
+
const OWED_ECHO_SNAPSHOTS = 2;
|
|
66
|
+
const OPENING_SNAPSHOTS = ["presence.snapshot", "lock.snapshot"];
|
|
67
|
+
const itineraryLessKinds = /* @__PURE__ */ new Set(["collection", "zone"]);
|
|
68
|
+
const changeApplyInput = (event, bustToken) => ({
|
|
69
|
+
action: event.action,
|
|
70
|
+
bustToken,
|
|
71
|
+
id: event.id,
|
|
72
|
+
itineraryId: itineraryLessKinds.has(event.kind) ? null : event.itinerary_id,
|
|
73
|
+
kind: event.kind
|
|
121
74
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
75
|
+
const foldChange = (pending, next) => pending.action === "created" && next.action === "updated" ? {
|
|
76
|
+
...next,
|
|
77
|
+
action: "created"
|
|
78
|
+
} : next;
|
|
79
|
+
const dispatchContained = (bus, ctx, name, input) => {
|
|
80
|
+
try {
|
|
81
|
+
Promise.resolve(bus.dispatchUnsafe(ctx, name, input)).catch(surfaceFault);
|
|
82
|
+
} catch (fault) {
|
|
83
|
+
surfaceFault(fault);
|
|
84
|
+
}
|
|
129
85
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
86
|
+
const toEpochMs = (connectedAt) => {
|
|
87
|
+
const parsed = connectedAt?.getTime();
|
|
88
|
+
return parsed !== void 0 && !Number.isNaN(parsed) ? parsed : Date.now();
|
|
133
89
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
90
|
+
const isDurableChange = (event) => event.type === "itinerary.changed" || event.type === "segment.changed" || event.type === "waypoint.changed" || event.type === "zone.changed" || event.type === "collection.changed";
|
|
91
|
+
const sleep = (ms, signal) => new Promise((resolve) => {
|
|
92
|
+
if (signal.aborted) {
|
|
93
|
+
resolve();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const onAbort = () => {
|
|
97
|
+
clearTimeout(timer);
|
|
98
|
+
resolve();
|
|
99
|
+
};
|
|
100
|
+
const timer = setTimeout(() => {
|
|
101
|
+
signal.removeEventListener("abort", onAbort);
|
|
102
|
+
resolve();
|
|
103
|
+
}, ms);
|
|
104
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
149
105
|
});
|
|
150
106
|
var Coalescer = class {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
* no coalesced dispatch to fire after teardown.
|
|
178
|
-
*/
|
|
179
|
-
cancel() {
|
|
180
|
-
for (const timer of this.timers.values()) {
|
|
181
|
-
clearTimeout(timer);
|
|
182
|
-
}
|
|
183
|
-
this.timers.clear();
|
|
184
|
-
this.pending.clear();
|
|
185
|
-
}
|
|
186
|
-
fire(key) {
|
|
187
|
-
this.timers.delete(key);
|
|
188
|
-
const value = this.pending.get(key);
|
|
189
|
-
this.pending.delete(key);
|
|
190
|
-
if (value !== void 0) {
|
|
191
|
-
this.flush(value);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
107
|
+
delayMs;
|
|
108
|
+
flush;
|
|
109
|
+
fold;
|
|
110
|
+
pending = /* @__PURE__ */ new Map();
|
|
111
|
+
timers = /* @__PURE__ */ new Map();
|
|
112
|
+
constructor(delayMs, flush, fold = (_pending, next) => next) {
|
|
113
|
+
this.delayMs = delayMs;
|
|
114
|
+
this.flush = flush;
|
|
115
|
+
this.fold = fold;
|
|
116
|
+
}
|
|
117
|
+
push(key, value) {
|
|
118
|
+
const pending = this.pending.get(key);
|
|
119
|
+
this.pending.set(key, pending === void 0 ? value : this.fold(pending, value));
|
|
120
|
+
if (!this.timers.has(key)) this.timers.set(key, setTimeout(() => this.fire(key), this.delayMs));
|
|
121
|
+
}
|
|
122
|
+
cancel() {
|
|
123
|
+
for (const timer of this.timers.values()) clearTimeout(timer);
|
|
124
|
+
this.timers.clear();
|
|
125
|
+
this.pending.clear();
|
|
126
|
+
}
|
|
127
|
+
fire(key) {
|
|
128
|
+
this.timers.delete(key);
|
|
129
|
+
const value = this.pending.get(key);
|
|
130
|
+
this.pending.delete(key);
|
|
131
|
+
if (value !== void 0) this.flush(value);
|
|
132
|
+
}
|
|
194
133
|
};
|
|
195
134
|
var StreamLoop = class {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
failure === void 0 ? { progressed, reconnect, terminal: false, waitMs } : { error: failure.error, progressed, terminal: true }
|
|
330
|
-
);
|
|
331
|
-
};
|
|
332
|
-
const onAbort = () => finish();
|
|
333
|
-
if (signal.aborted) {
|
|
334
|
-
finish();
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
338
|
-
const handlers = {
|
|
339
|
-
onClose: (reason) => finish(void 0, reason === "reconnect"),
|
|
340
|
-
// A transient error settles the attempt like a close: run() reopens at once after an
|
|
341
|
-
// attempt that made progress and after a wait otherwise. A terminal error settles it
|
|
342
|
-
// carrying the failure, so run() stops the loop and surfaces it. A transient stream
|
|
343
|
-
// drop is background noise the session recovers from silently.
|
|
344
|
-
onError: (error, options) => options?.terminal === true ? finish({ error }) : finish(void 0, false, retryAfterMsOf(error)),
|
|
345
|
-
onFrame: (frame) => {
|
|
346
|
-
if (settled) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (!opening.delete(frame.event.type) && !this.isOwnArrival(frame.event, member)) {
|
|
350
|
-
progressed = true;
|
|
351
|
-
}
|
|
352
|
-
if (frame.id && isDurableChange(frame.event)) {
|
|
353
|
-
this.lastEventId = frame.id;
|
|
354
|
-
}
|
|
355
|
-
try {
|
|
356
|
-
this.config.onFrame(frame.event, frame.id === "" ? void 0 : frame.id);
|
|
357
|
-
} catch {
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
// A record that names a position and carries no event moves the cursor too. No frame
|
|
361
|
-
// carries that position, so there is no event for the gate above to read, and none that
|
|
362
|
-
// could be an ephemeral one. A settled attempt's report is stale, like its frames.
|
|
363
|
-
onLastEventId: (lastEventId) => {
|
|
364
|
-
if (!settled) {
|
|
365
|
-
this.lastEventId = lastEventId;
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
onOpen: (open) => {
|
|
369
|
-
if (!settled) {
|
|
370
|
-
member = open.userId;
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
// A frame the transport skips, a kind this build does not know or data it cannot read, is
|
|
374
|
-
// none of those every open begins with, so the stream delivered something past them.
|
|
375
|
-
onSkippedFrame: () => {
|
|
376
|
-
if (!settled) {
|
|
377
|
-
progressed = true;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
this.config.onOpen?.();
|
|
382
|
-
try {
|
|
383
|
-
handle = this.config.subscribe(handlers, {
|
|
384
|
-
lastEventId: this.lastEventId,
|
|
385
|
-
signal
|
|
386
|
-
});
|
|
387
|
-
} catch (error) {
|
|
388
|
-
finish({ error });
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
if (settled) {
|
|
392
|
-
release();
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
this.unsubscribe = release;
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* isOwnArrival asks the session whether a frame is its own member's arrival
|
|
400
|
-
* ({@link StreamLoopConfig.isOwnArrival}), and reads an answer that throws as yes: a frame the
|
|
401
|
-
* session cannot attribute is no evidence that the stream stays up. Thrown on, the fault would
|
|
402
|
-
* reach the transport as the subscriber's own, which ends the stream for good, where the same
|
|
403
|
-
* fault met as the frame is applied loses that frame alone.
|
|
404
|
-
*/
|
|
405
|
-
isOwnArrival(event, member) {
|
|
406
|
-
try {
|
|
407
|
-
return this.config.isOwnArrival?.(event, member) === true;
|
|
408
|
-
} catch {
|
|
409
|
-
return true;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
135
|
+
config;
|
|
136
|
+
disposed = false;
|
|
137
|
+
lastEventId;
|
|
138
|
+
lifecycle = new AbortController();
|
|
139
|
+
streamAbort = null;
|
|
140
|
+
unsubscribe = null;
|
|
141
|
+
started = false;
|
|
142
|
+
constructor(config) {
|
|
143
|
+
this.config = config;
|
|
144
|
+
}
|
|
145
|
+
start() {
|
|
146
|
+
if (this.started || this.disposed) return;
|
|
147
|
+
this.started = true;
|
|
148
|
+
this.run();
|
|
149
|
+
}
|
|
150
|
+
dispose() {
|
|
151
|
+
if (this.disposed) return;
|
|
152
|
+
this.disposed = true;
|
|
153
|
+
this.lifecycle.abort();
|
|
154
|
+
this.teardownStream();
|
|
155
|
+
}
|
|
156
|
+
teardownStream() {
|
|
157
|
+
const unsubscribe = this.unsubscribe;
|
|
158
|
+
this.unsubscribe = null;
|
|
159
|
+
this.streamAbort?.abort();
|
|
160
|
+
unsubscribe?.();
|
|
161
|
+
}
|
|
162
|
+
async run() {
|
|
163
|
+
let failures = 0;
|
|
164
|
+
let named;
|
|
165
|
+
while (!this.disposed) {
|
|
166
|
+
if (failures > 0 || named !== void 0) {
|
|
167
|
+
const wait = named === void 0 ? reconnectDelayMs(failures, reconnectSchedule) : retryAfterDelayMs(named);
|
|
168
|
+
await sleep(wait, this.lifecycle.signal);
|
|
169
|
+
if (this.disposed) return;
|
|
170
|
+
}
|
|
171
|
+
const abort = new AbortController();
|
|
172
|
+
this.streamAbort = abort;
|
|
173
|
+
const attempt = await this.consume(abort.signal);
|
|
174
|
+
if (this.disposed || abort.signal.aborted) return;
|
|
175
|
+
if (attempt.terminal) {
|
|
176
|
+
this.dispose();
|
|
177
|
+
try {
|
|
178
|
+
this.config.onError?.(attempt.error);
|
|
179
|
+
} catch (fault) {
|
|
180
|
+
surfaceFault(fault);
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
failures = attempt.progressed || attempt.reconnect ? 0 : failures + 1;
|
|
185
|
+
named = attempt.waitMs;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
consume(signal) {
|
|
189
|
+
return new Promise((resolve) => {
|
|
190
|
+
let progressed = false;
|
|
191
|
+
let settled = false;
|
|
192
|
+
const opening = new Set(OPENING_SNAPSHOTS);
|
|
193
|
+
let member;
|
|
194
|
+
let handle;
|
|
195
|
+
const release = () => {
|
|
196
|
+
const pending = handle;
|
|
197
|
+
handle = void 0;
|
|
198
|
+
pending?.();
|
|
199
|
+
};
|
|
200
|
+
const finish = (failure, reconnect = false, waitMs) => {
|
|
201
|
+
if (settled) return;
|
|
202
|
+
settled = true;
|
|
203
|
+
signal.removeEventListener("abort", onAbort);
|
|
204
|
+
if (this.unsubscribe === release) this.unsubscribe = null;
|
|
205
|
+
release();
|
|
206
|
+
resolve(failure === void 0 ? {
|
|
207
|
+
progressed,
|
|
208
|
+
reconnect,
|
|
209
|
+
terminal: false,
|
|
210
|
+
waitMs
|
|
211
|
+
} : {
|
|
212
|
+
error: failure.error,
|
|
213
|
+
progressed,
|
|
214
|
+
terminal: true
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
const onAbort = () => finish();
|
|
218
|
+
if (signal.aborted) {
|
|
219
|
+
finish();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
223
|
+
const handlers = {
|
|
224
|
+
onClose: (reason) => finish(void 0, reason === "reconnect"),
|
|
225
|
+
onError: (error, options) => options?.terminal === true ? finish({ error }) : finish(void 0, false, retryAfterMsOf(error)),
|
|
226
|
+
onFrame: (frame) => {
|
|
227
|
+
if (settled) return;
|
|
228
|
+
if (!opening.delete(frame.event.type) && !this.isOwnArrival(frame.event, member)) progressed = true;
|
|
229
|
+
if (frame.id && isDurableChange(frame.event)) this.lastEventId = frame.id;
|
|
230
|
+
try {
|
|
231
|
+
this.config.onFrame(frame.event, frame.id === "" ? void 0 : frame.id);
|
|
232
|
+
} catch {}
|
|
233
|
+
},
|
|
234
|
+
onLastEventId: (lastEventId) => {
|
|
235
|
+
if (!settled) this.lastEventId = lastEventId;
|
|
236
|
+
},
|
|
237
|
+
onOpen: (open) => {
|
|
238
|
+
if (!settled) member = open.userId;
|
|
239
|
+
},
|
|
240
|
+
onSkippedFrame: () => {
|
|
241
|
+
if (!settled) progressed = true;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
this.config.onOpen?.();
|
|
245
|
+
try {
|
|
246
|
+
handle = this.config.subscribe(handlers, {
|
|
247
|
+
lastEventId: this.lastEventId,
|
|
248
|
+
signal
|
|
249
|
+
});
|
|
250
|
+
} catch (error) {
|
|
251
|
+
finish({ error });
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (settled) {
|
|
255
|
+
release();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
this.unsubscribe = release;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
isOwnArrival(event, member) {
|
|
262
|
+
try {
|
|
263
|
+
return this.config.isOwnArrival?.(event, member) === true;
|
|
264
|
+
} catch {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
412
268
|
};
|
|
413
269
|
var CollabEngine = class {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
return;
|
|
811
|
-
}
|
|
812
|
-
owed.asking = Math.max(0, owed.asking - 1);
|
|
813
|
-
if (!granted) {
|
|
814
|
-
owed.frames = Math.max(0, owed.frames - 1);
|
|
815
|
-
}
|
|
816
|
-
this.dropPaidEcho(key, owed);
|
|
817
|
-
}
|
|
818
|
-
/** dropPaidEcho forgets a debt that owes no frame and waits on no acquire. */
|
|
819
|
-
dropPaidEcho(key, owed) {
|
|
820
|
-
if (owed.frames === 0 && owed.asking === 0) {
|
|
821
|
-
this.owedEchoes.delete(key);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* ageOwedEchoes counts one lock snapshot against every debt whose lock the session neither holds
|
|
826
|
-
* nor asks for, and forgets each once its count reaches {@link OWED_ECHO_SNAPSHOTS}. A lock held
|
|
827
|
-
* or asked for starts its count again.
|
|
828
|
-
*/
|
|
829
|
-
ageOwedEchoes() {
|
|
830
|
-
for (const [key, owed] of [...this.owedEchoes]) {
|
|
831
|
-
if (this.heldLocks.has(key) || owed.asking > 0) {
|
|
832
|
-
owed.snapshots = 0;
|
|
833
|
-
continue;
|
|
834
|
-
}
|
|
835
|
-
owed.snapshots += 1;
|
|
836
|
-
if (owed.snapshots >= OWED_ECHO_SNAPSHOTS) {
|
|
837
|
-
this.owedEchoes.delete(key);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* beginOpen runs as each open of the stream begins: the watch over the member's `lock.acquired`
|
|
843
|
-
* frames ends, since the frames sent until the new read opens are never delivered, and every
|
|
844
|
-
* debt goes but those of the acquires still on the wire, whose frames may yet come to it.
|
|
845
|
-
*/
|
|
846
|
-
beginOpen() {
|
|
847
|
-
this.lockWatch = null;
|
|
848
|
-
for (const [key, owed] of [...this.owedEchoes]) {
|
|
849
|
-
owed.frames = Math.min(owed.frames, owed.asking);
|
|
850
|
-
owed.snapshots = 0;
|
|
851
|
-
this.dropPaidEcho(key, owed);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* maySignal reports whether the local user may send a signal now, as the host's
|
|
856
|
-
* {@link CollabEngineConfig.canEdit} answers it: every signal where the host states no answer,
|
|
857
|
-
* and none where its answer throws, whose fault reaches the program on a microtask.
|
|
858
|
-
*/
|
|
859
|
-
maySignal() {
|
|
860
|
-
const canEdit = this.config.canEdit;
|
|
861
|
-
if (canEdit === void 0) {
|
|
862
|
-
return true;
|
|
863
|
-
}
|
|
864
|
-
try {
|
|
865
|
-
return canEdit() === true;
|
|
866
|
-
} catch (fault) {
|
|
867
|
-
surfaceFault(fault);
|
|
868
|
-
return false;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* sendEditSignal sends one of the local user's edit signals (a lock or a draft) and reads its
|
|
873
|
-
* outcome for the write role: an answer clears the refusal latch, a contention included, since
|
|
874
|
-
* the API judges a contention only for a member it lets edit, and a 403 is reported through
|
|
875
|
-
* {@link CollabEngineConfig.onEditRefused}. The outcome is handed back as it came, a rejection
|
|
876
|
-
* included.
|
|
877
|
-
*/
|
|
878
|
-
async sendEditSignal(signal) {
|
|
879
|
-
try {
|
|
880
|
-
const result = await this.config.transport.sendSignal(this.config.resource, signal);
|
|
881
|
-
this.editRefused = false;
|
|
882
|
-
return result;
|
|
883
|
-
} catch (error) {
|
|
884
|
-
if (statusOf(error) === 403) {
|
|
885
|
-
this.reportEditRefused(error, signal.entity);
|
|
886
|
-
}
|
|
887
|
-
throw error;
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* reportEditRefused tells the host that an edit signal was refused for want of the write role,
|
|
892
|
-
* once for a run of refusals. A session the host disposed reports nothing: the edit it would
|
|
893
|
-
* close is gone with it.
|
|
894
|
-
*/
|
|
895
|
-
reportEditRefused(error, entity) {
|
|
896
|
-
if (this.editRefused || this.disposed) {
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
this.editRefused = true;
|
|
900
|
-
try {
|
|
901
|
-
this.config.onEditRefused?.(error, entity);
|
|
902
|
-
} catch (fault) {
|
|
903
|
-
surfaceFault(fault);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* applyFrame routes one received editor frame to a LOCAL tool dispatch. A durable
|
|
908
|
-
* change is coalesced per entity and reconciled through change.apply (never
|
|
909
|
-
* actor-filtered: a second tab of the SAME user must reconcile too). An ephemeral
|
|
910
|
-
* frame is dropped when it echoes the local user's own signal, and otherwise
|
|
911
|
-
* reflects a peer's transient state through the matching peer tool. An unknown
|
|
912
|
-
* frame type never reaches here: the transport drops it at decode.
|
|
913
|
-
*
|
|
914
|
-
* Each family has its own method: a durable change here, a snapshot in
|
|
915
|
-
* {@link applySnapshot}, and every other frame in {@link applyPeerFrame}, whose parameter is
|
|
916
|
-
* stated by exclusion so that a kind the contract gains has to be given an arm there.
|
|
917
|
-
*/
|
|
918
|
-
applyFrame(event, frameId) {
|
|
919
|
-
if (isDurableChange(event)) {
|
|
920
|
-
this.changeCoalescer.push(`${event.kind}:${event.id}`, changeApplyInput(event, frameId));
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
if (event.type === "presence.snapshot" || event.type === "lock.snapshot") {
|
|
924
|
-
this.applySnapshot(event);
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
if (event.type === "reconnect") {
|
|
928
|
-
return;
|
|
929
|
-
}
|
|
930
|
-
this.applyPeerFrame(event);
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* applySnapshot applies a frame that states a whole set at once, the roster or the held locks,
|
|
934
|
-
* with the local user's own entries left out. The frame is applied whoever is in it: it
|
|
935
|
-
* replaces what the local side holds.
|
|
936
|
-
*/
|
|
937
|
-
applySnapshot(event) {
|
|
938
|
-
if (event.type === "presence.snapshot") {
|
|
939
|
-
const peers = event.members.filter((member) => !this.isSelf(member.user_id)).map((member) => ({
|
|
940
|
-
connectedAt: toEpochMs(member.connected_at),
|
|
941
|
-
userId: member.user_id
|
|
942
|
-
}));
|
|
943
|
-
this.dispatch(this.config.tools.presenceSnapshot, {
|
|
944
|
-
peers,
|
|
945
|
-
resource: this.config.resource
|
|
946
|
-
});
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
this.reconcileReleasedLocks(event.locks);
|
|
950
|
-
this.ageOwedEchoes();
|
|
951
|
-
if (this.lockWatch === null) {
|
|
952
|
-
this.lockWatches += 1;
|
|
953
|
-
this.lockWatch = this.lockWatches;
|
|
954
|
-
}
|
|
955
|
-
const locks = event.locks.filter((lock) => !this.isSelf(lock.user_id)).map((lock) => ({
|
|
956
|
-
id: lock.entity.id,
|
|
957
|
-
kind: lock.entity.kind,
|
|
958
|
-
userId: lock.user_id
|
|
959
|
-
}));
|
|
960
|
-
this.dispatch(this.config.tools.lockSnapshot, { locks, resource: this.config.resource });
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* applyPeerFrame reflects one member's transient state through the matching peer tool, and
|
|
964
|
-
* drops the frame when it echoes the local user's own signal. A `lock.acquired` of the local
|
|
965
|
-
* member is read before it is dropped, by {@link readOwnLockAcquired}.
|
|
966
|
-
*/
|
|
967
|
-
applyPeerFrame(event) {
|
|
968
|
-
if (this.isSelf(event.user_id)) {
|
|
969
|
-
if (event.type === "lock.acquired") {
|
|
970
|
-
this.readOwnLockAcquired(event.entity);
|
|
971
|
-
}
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
switch (event.type) {
|
|
975
|
-
case "presence.join":
|
|
976
|
-
this.dispatch(this.config.tools.presenceSet, {
|
|
977
|
-
connectedAt: toEpochMs(event.connected_at),
|
|
978
|
-
resource: this.config.resource,
|
|
979
|
-
userId: event.user_id
|
|
980
|
-
});
|
|
981
|
-
return;
|
|
982
|
-
case "presence.leave":
|
|
983
|
-
this.dispatch(this.config.tools.presenceClear, {
|
|
984
|
-
resource: this.config.resource,
|
|
985
|
-
userId: event.user_id
|
|
986
|
-
});
|
|
987
|
-
return;
|
|
988
|
-
case "selection":
|
|
989
|
-
this.dispatch(this.config.tools.peerSelectionSet, {
|
|
990
|
-
resource: this.config.resource,
|
|
991
|
-
selection: event.selection,
|
|
992
|
-
userId: event.user_id
|
|
993
|
-
});
|
|
994
|
-
return;
|
|
995
|
-
case "cursor":
|
|
996
|
-
return;
|
|
997
|
-
case "lock.acquired":
|
|
998
|
-
this.dispatch(this.config.tools.lockSet, {
|
|
999
|
-
id: event.entity.id,
|
|
1000
|
-
kind: event.entity.kind,
|
|
1001
|
-
resource: this.config.resource,
|
|
1002
|
-
userId: event.user_id
|
|
1003
|
-
});
|
|
1004
|
-
return;
|
|
1005
|
-
case "lock.released":
|
|
1006
|
-
this.dispatch(this.config.tools.lockClear, {
|
|
1007
|
-
id: event.entity.id,
|
|
1008
|
-
kind: event.entity.kind,
|
|
1009
|
-
resource: this.config.resource
|
|
1010
|
-
});
|
|
1011
|
-
return;
|
|
1012
|
-
case "draft.update":
|
|
1013
|
-
this.dispatch(
|
|
1014
|
-
this.config.tools.peerDraftSet,
|
|
1015
|
-
event.entity.kind === "zone" ? {
|
|
1016
|
-
id: event.entity.id,
|
|
1017
|
-
kind: "zone",
|
|
1018
|
-
resource: this.config.resource,
|
|
1019
|
-
userId: event.user_id,
|
|
1020
|
-
zone: event.draft
|
|
1021
|
-
} : {
|
|
1022
|
-
id: event.entity.id,
|
|
1023
|
-
kind: "segment",
|
|
1024
|
-
resource: this.config.resource,
|
|
1025
|
-
segment: event.draft,
|
|
1026
|
-
userId: event.user_id
|
|
1027
|
-
}
|
|
1028
|
-
);
|
|
1029
|
-
return;
|
|
1030
|
-
case "draft.clear":
|
|
1031
|
-
this.dispatch(this.config.tools.peerDraftClear, {
|
|
1032
|
-
id: event.entity.id,
|
|
1033
|
-
kind: event.entity.kind,
|
|
1034
|
-
resource: this.config.resource
|
|
1035
|
-
});
|
|
1036
|
-
return;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* isSelf reports whether a frame's user id is the local user's, read live off the
|
|
1041
|
-
* viewer seam so a session built before the viewer hydrates self-filters correctly
|
|
1042
|
-
* once it does.
|
|
1043
|
-
*/
|
|
1044
|
-
isSelf(userId) {
|
|
1045
|
-
return userId === this.config.ctx.viewer.getUserId();
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* dispatch applies a received frame by running a LOCAL tool through the bus, without waiting
|
|
1049
|
-
* and whatever the dispatcher does with it ({@link dispatchContained}).
|
|
1050
|
-
*/
|
|
1051
|
-
dispatch(name, input) {
|
|
1052
|
-
dispatchContained(this.config.bus, this.config.ctx, name, input);
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* postSignal sends one upstream signal, best-effort: a failed send is swallowed
|
|
1056
|
-
* rather than surfaced, because presence, selection and draft self-heal on the next
|
|
1057
|
-
* movement and a dropped frame is not worth interrupting the user for. It resolves
|
|
1058
|
-
* once the signal has been answered, either way, and never rejects or throws: a
|
|
1059
|
-
* draft signal chained behind it must leave whatever became of this one.
|
|
1060
|
-
*
|
|
1061
|
-
* Nothing is sent while {@link CollabEngineConfig.canEdit} answers false, since the API refuses
|
|
1062
|
-
* every signal of a member who only watches. The swallow stays for the role that changes
|
|
1063
|
-
* between that answer and the API's: a signal on its way when the write role went is refused
|
|
1064
|
-
* and dropped. A draft signal is an edit signal, so a 403 refusing one still reaches the host
|
|
1065
|
-
* through {@link CollabEngineConfig.onEditRefused}: the user lost the write role, which no next
|
|
1066
|
-
* movement heals.
|
|
1067
|
-
*/
|
|
1068
|
-
postSignal(signal) {
|
|
1069
|
-
if (!this.maySignal()) {
|
|
1070
|
-
return Promise.resolve();
|
|
1071
|
-
}
|
|
1072
|
-
try {
|
|
1073
|
-
const sent = signal.type === "draft.update" || signal.type === "draft.clear" ? this.sendEditSignal(signal) : this.config.transport.sendSignal(this.config.resource, signal);
|
|
1074
|
-
return sent.then(
|
|
1075
|
-
() => void 0,
|
|
1076
|
-
() => void 0
|
|
1077
|
-
);
|
|
1078
|
-
} catch {
|
|
1079
|
-
return Promise.resolve();
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
/**
|
|
1083
|
-
* postDraftUpdate sends one draft update, once the last clear has been answered when one has
|
|
1084
|
-
* not been ({@link clearDraft}), and records it as on the wire until it is answered. An update
|
|
1085
|
-
* whose turn comes after dispose() is dropped.
|
|
1086
|
-
*/
|
|
1087
|
-
postDraftUpdate(signal) {
|
|
1088
|
-
const send = () => this.disposed ? Promise.resolve() : this.postSignal(signal);
|
|
1089
|
-
const pendingClear = this.draftClearInFlight;
|
|
1090
|
-
const sent = pendingClear === null ? send() : pendingClear.then(send);
|
|
1091
|
-
this.draftUpdatesInFlight.add(sent);
|
|
1092
|
-
void sent.then(() => {
|
|
1093
|
-
this.draftUpdatesInFlight.delete(sent);
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
270
|
+
config;
|
|
271
|
+
changeCoalescer;
|
|
272
|
+
draftThrottle;
|
|
273
|
+
loop;
|
|
274
|
+
selectionThrottle;
|
|
275
|
+
draftUpdatesInFlight = /* @__PURE__ */ new Set();
|
|
276
|
+
draftClearInFlight = null;
|
|
277
|
+
disposed = false;
|
|
278
|
+
editRefused = false;
|
|
279
|
+
heldLocks = /* @__PURE__ */ new Set();
|
|
280
|
+
releasedLocks = /* @__PURE__ */ new Map();
|
|
281
|
+
releasesInFlight = /* @__PURE__ */ new Set();
|
|
282
|
+
releaseRetries = /* @__PURE__ */ new Set();
|
|
283
|
+
owedEchoes = /* @__PURE__ */ new Map();
|
|
284
|
+
lockWatch = null;
|
|
285
|
+
lockWatches = 0;
|
|
286
|
+
lifecycle = new AbortController();
|
|
287
|
+
constructor(config) {
|
|
288
|
+
this.config = config;
|
|
289
|
+
this.changeCoalescer = new Coalescer(CHANGE_COALESCE_MS, (input) => this.dispatch(this.config.tools.changeApply, input), foldChange);
|
|
290
|
+
this.selectionThrottle = new TrailingThrottle(SELECTION_THROTTLE_MS, (selection) => {
|
|
291
|
+
this.postSignal({
|
|
292
|
+
selection,
|
|
293
|
+
type: "selection"
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
this.draftThrottle = new TrailingThrottle(60, ({ draft, entity }) => this.postDraftUpdate({
|
|
297
|
+
draft,
|
|
298
|
+
entity,
|
|
299
|
+
type: "draft.update"
|
|
300
|
+
}));
|
|
301
|
+
this.loop = new StreamLoop({
|
|
302
|
+
isOwnArrival: (event, member) => event.type === "presence.join" && event.user_id === (member ?? this.config.ctx.viewer.getUserId()),
|
|
303
|
+
onError: (error) => this.config.onError?.(error),
|
|
304
|
+
onFrame: (event, frameId) => this.applyFrame(event, frameId),
|
|
305
|
+
onOpen: () => this.beginOpen(),
|
|
306
|
+
subscribe: (handlers, options) => this.config.transport.subscribeEditor(this.config.resource, handlers, options)
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
start() {
|
|
310
|
+
this.loop.start();
|
|
311
|
+
}
|
|
312
|
+
dispose() {
|
|
313
|
+
this.disposed = true;
|
|
314
|
+
this.lifecycle.abort();
|
|
315
|
+
this.loop.dispose();
|
|
316
|
+
this.changeCoalescer.cancel();
|
|
317
|
+
this.selectionThrottle.cancel();
|
|
318
|
+
this.draftThrottle.cancel();
|
|
319
|
+
}
|
|
320
|
+
sendSelection(selection) {
|
|
321
|
+
if (this.disposed) return;
|
|
322
|
+
this.selectionThrottle.push(selection);
|
|
323
|
+
}
|
|
324
|
+
sendDraft(entity, draft) {
|
|
325
|
+
if (this.disposed) return;
|
|
326
|
+
this.draftThrottle.push({
|
|
327
|
+
draft,
|
|
328
|
+
entity
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
clearDraft(entity) {
|
|
332
|
+
if (this.disposed) return;
|
|
333
|
+
this.draftThrottle.cancel();
|
|
334
|
+
const signal = {
|
|
335
|
+
entity,
|
|
336
|
+
type: "draft.clear"
|
|
337
|
+
};
|
|
338
|
+
const earlier = [...this.draftUpdatesInFlight];
|
|
339
|
+
if (this.draftClearInFlight !== null) earlier.push(this.draftClearInFlight);
|
|
340
|
+
const cleared = earlier.length === 0 ? this.postSignal(signal) : Promise.all(earlier).then(() => this.postSignal(signal));
|
|
341
|
+
this.draftClearInFlight = cleared;
|
|
342
|
+
cleared.then(() => {
|
|
343
|
+
if (this.draftClearInFlight === cleared) this.draftClearInFlight = null;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
async acquireLock(entity) {
|
|
347
|
+
if (!this.maySignal()) throw new MountayaElementsForbiddenError(`CollabEngine.acquireLock: the local user holds no write role on ${this.config.resource.kind} ${this.config.resource.id}, as canEdit answers, so no lock on ${entity.kind} ${entity.id} is asked for: the API refuses every signal of a member who only watches. Begin an edit only where canEdit answers true, and read the member's roles again where it should.`);
|
|
348
|
+
const key = lockKey(entity);
|
|
349
|
+
const givenBack = this.releasedLocks.get(key);
|
|
350
|
+
this.heldLocks.add(key);
|
|
351
|
+
this.releasedLocks.delete(key);
|
|
352
|
+
this.oweEcho(key);
|
|
353
|
+
let result;
|
|
354
|
+
try {
|
|
355
|
+
result = await this.sendEditSignal({
|
|
356
|
+
entity,
|
|
357
|
+
type: "lock.acquire"
|
|
358
|
+
});
|
|
359
|
+
} catch (error) {
|
|
360
|
+
this.heldLocks.delete(key);
|
|
361
|
+
const unsettled = unsettledFailure(error);
|
|
362
|
+
this.answerEcho(key, unsettled);
|
|
363
|
+
const record = givenBack ?? (unsettled ? {
|
|
364
|
+
entity,
|
|
365
|
+
watch: null
|
|
366
|
+
} : void 0);
|
|
367
|
+
if (record !== void 0 && !this.releasedLocks.has(key)) {
|
|
368
|
+
this.releasedLocks.set(key, record);
|
|
369
|
+
this.retryRelease(key, entity, false, retryAfterMsOf(error));
|
|
370
|
+
}
|
|
371
|
+
throw error;
|
|
372
|
+
}
|
|
373
|
+
this.answerEcho(key, result.ok);
|
|
374
|
+
if (result.ok) return { acquired: true };
|
|
375
|
+
this.heldLocks.delete(key);
|
|
376
|
+
return result.holderId === void 0 ? { acquired: false } : {
|
|
377
|
+
acquired: false,
|
|
378
|
+
holderId: result.holderId
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
async releaseLock(entity) {
|
|
382
|
+
const key = lockKey(entity);
|
|
383
|
+
this.heldLocks.delete(key);
|
|
384
|
+
if (!this.maySignal()) return;
|
|
385
|
+
const record = {
|
|
386
|
+
entity,
|
|
387
|
+
watch: this.lockWatch
|
|
388
|
+
};
|
|
389
|
+
this.releasedLocks.set(key, record);
|
|
390
|
+
this.releasesInFlight.add(key);
|
|
391
|
+
try {
|
|
392
|
+
await this.sendEditSignal({
|
|
393
|
+
entity,
|
|
394
|
+
type: "lock.release"
|
|
395
|
+
});
|
|
396
|
+
} catch (error) {
|
|
397
|
+
if (unsettledFailure(error)) this.retryRelease(key, entity, false, retryAfterMsOf(error));
|
|
398
|
+
else if (this.releasedLocks.get(key) === record) this.releasedLocks.delete(key);
|
|
399
|
+
throw error;
|
|
400
|
+
} finally {
|
|
401
|
+
this.releasesInFlight.delete(key);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
stillToRelease(key) {
|
|
405
|
+
return !this.disposed && this.releasedLocks.has(key) && !this.heldLocks.has(key) && this.maySignal();
|
|
406
|
+
}
|
|
407
|
+
retryRelease(key, entity, immediate = false, namedMs) {
|
|
408
|
+
if (this.releaseRetries.has(key) || !this.stillToRelease(key)) return;
|
|
409
|
+
this.releaseRetries.add(key);
|
|
410
|
+
this.runReleaseRetries(key, entity, immediate ? 0 : 1, namedMs).finally(() => {
|
|
411
|
+
this.releaseRetries.delete(key);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
async runReleaseRetries(key, entity, failed, namedMs) {
|
|
415
|
+
let failures = failed;
|
|
416
|
+
let named = namedMs;
|
|
417
|
+
while (this.stillToRelease(key)) {
|
|
418
|
+
if (failures > 0) {
|
|
419
|
+
const wait = named === void 0 ? reconnectDelayMs(failures, releaseRetrySchedule) : retryAfterDelayMs(named);
|
|
420
|
+
await sleep(wait, this.lifecycle.signal);
|
|
421
|
+
if (!this.stillToRelease(key)) return;
|
|
422
|
+
}
|
|
423
|
+
const record = this.releasedLocks.get(key);
|
|
424
|
+
if (record !== void 0) record.watch = this.lockWatch;
|
|
425
|
+
this.releasesInFlight.add(key);
|
|
426
|
+
try {
|
|
427
|
+
await this.sendEditSignal({
|
|
428
|
+
entity,
|
|
429
|
+
type: "lock.release"
|
|
430
|
+
});
|
|
431
|
+
} catch (error) {
|
|
432
|
+
if (!unsettledFailure(error)) {
|
|
433
|
+
if (this.releasedLocks.get(key) === record) this.releasedLocks.delete(key);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
failures += 1;
|
|
437
|
+
named = retryAfterMsOf(error);
|
|
438
|
+
continue;
|
|
439
|
+
} finally {
|
|
440
|
+
this.releasesInFlight.delete(key);
|
|
441
|
+
}
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
reconcileReleasedLocks(locks) {
|
|
446
|
+
if (this.releasedLocks.size === 0) return;
|
|
447
|
+
const listed = new Set(locks.filter((lock) => this.isSelf(lock.user_id)).map((lock) => lockKey(lock.entity)));
|
|
448
|
+
for (const [key, record] of [...this.releasedLocks]) {
|
|
449
|
+
if (this.releasesInFlight.has(key)) continue;
|
|
450
|
+
if (!listed.has(key)) {
|
|
451
|
+
this.releasedLocks.delete(key);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (this.releaseRetries.has(key)) continue;
|
|
455
|
+
if (record.watch !== null && record.watch === this.lockWatch) this.retryRelease(key, record.entity, true);
|
|
456
|
+
else this.releasedLocks.delete(key);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
readOwnLockAcquired(entity) {
|
|
460
|
+
const key = lockKey(entity);
|
|
461
|
+
const owed = this.owedEchoes.get(key);
|
|
462
|
+
if (owed !== void 0 && owed.frames > 0) {
|
|
463
|
+
owed.frames -= 1;
|
|
464
|
+
this.dropPaidEcho(key, owed);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
this.releasedLocks.delete(key);
|
|
468
|
+
}
|
|
469
|
+
oweEcho(key) {
|
|
470
|
+
const owed = this.owedEchoes.get(key) ?? {
|
|
471
|
+
asking: 0,
|
|
472
|
+
frames: 0,
|
|
473
|
+
snapshots: 0
|
|
474
|
+
};
|
|
475
|
+
owed.asking += 1;
|
|
476
|
+
owed.frames += 1;
|
|
477
|
+
owed.snapshots = 0;
|
|
478
|
+
this.owedEchoes.set(key, owed);
|
|
479
|
+
}
|
|
480
|
+
answerEcho(key, granted) {
|
|
481
|
+
const owed = this.owedEchoes.get(key);
|
|
482
|
+
if (owed === void 0) return;
|
|
483
|
+
owed.asking = Math.max(0, owed.asking - 1);
|
|
484
|
+
if (!granted) owed.frames = Math.max(0, owed.frames - 1);
|
|
485
|
+
this.dropPaidEcho(key, owed);
|
|
486
|
+
}
|
|
487
|
+
dropPaidEcho(key, owed) {
|
|
488
|
+
if (owed.frames === 0 && owed.asking === 0) this.owedEchoes.delete(key);
|
|
489
|
+
}
|
|
490
|
+
ageOwedEchoes() {
|
|
491
|
+
for (const [key, owed] of [...this.owedEchoes]) {
|
|
492
|
+
if (this.heldLocks.has(key) || owed.asking > 0) {
|
|
493
|
+
owed.snapshots = 0;
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
owed.snapshots += 1;
|
|
497
|
+
if (owed.snapshots >= OWED_ECHO_SNAPSHOTS) this.owedEchoes.delete(key);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
beginOpen() {
|
|
501
|
+
this.lockWatch = null;
|
|
502
|
+
for (const [key, owed] of [...this.owedEchoes]) {
|
|
503
|
+
owed.frames = Math.min(owed.frames, owed.asking);
|
|
504
|
+
owed.snapshots = 0;
|
|
505
|
+
this.dropPaidEcho(key, owed);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
maySignal() {
|
|
509
|
+
const canEdit = this.config.canEdit;
|
|
510
|
+
if (canEdit === void 0) return true;
|
|
511
|
+
try {
|
|
512
|
+
return canEdit() === true;
|
|
513
|
+
} catch (fault) {
|
|
514
|
+
surfaceFault(fault);
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
async sendEditSignal(signal) {
|
|
519
|
+
try {
|
|
520
|
+
const result = await this.config.transport.sendSignal(this.config.resource, signal);
|
|
521
|
+
this.editRefused = false;
|
|
522
|
+
return result;
|
|
523
|
+
} catch (error) {
|
|
524
|
+
if (statusOf(error) === 403) this.reportEditRefused(error, signal.entity);
|
|
525
|
+
throw error;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
reportEditRefused(error, entity) {
|
|
529
|
+
if (this.editRefused || this.disposed) return;
|
|
530
|
+
this.editRefused = true;
|
|
531
|
+
try {
|
|
532
|
+
this.config.onEditRefused?.(error, entity);
|
|
533
|
+
} catch (fault) {
|
|
534
|
+
surfaceFault(fault);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
applyFrame(event, frameId) {
|
|
538
|
+
if (isDurableChange(event)) {
|
|
539
|
+
this.changeCoalescer.push(`${event.kind}:${event.id}`, changeApplyInput(event, frameId));
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (event.type === "presence.snapshot" || event.type === "lock.snapshot") {
|
|
543
|
+
this.applySnapshot(event);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (event.type === "reconnect") return;
|
|
547
|
+
this.applyPeerFrame(event);
|
|
548
|
+
}
|
|
549
|
+
applySnapshot(event) {
|
|
550
|
+
if (event.type === "presence.snapshot") {
|
|
551
|
+
const peers = event.members.filter((member) => !this.isSelf(member.user_id)).map((member) => ({
|
|
552
|
+
connectedAt: toEpochMs(member.connected_at),
|
|
553
|
+
userId: member.user_id
|
|
554
|
+
}));
|
|
555
|
+
this.dispatch(this.config.tools.presenceSnapshot, {
|
|
556
|
+
peers,
|
|
557
|
+
resource: this.config.resource
|
|
558
|
+
});
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
this.reconcileReleasedLocks(event.locks);
|
|
562
|
+
this.ageOwedEchoes();
|
|
563
|
+
if (this.lockWatch === null) {
|
|
564
|
+
this.lockWatches += 1;
|
|
565
|
+
this.lockWatch = this.lockWatches;
|
|
566
|
+
}
|
|
567
|
+
const locks = event.locks.filter((lock) => !this.isSelf(lock.user_id)).map((lock) => ({
|
|
568
|
+
id: lock.entity.id,
|
|
569
|
+
kind: lock.entity.kind,
|
|
570
|
+
userId: lock.user_id
|
|
571
|
+
}));
|
|
572
|
+
this.dispatch(this.config.tools.lockSnapshot, {
|
|
573
|
+
locks,
|
|
574
|
+
resource: this.config.resource
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
applyPeerFrame(event) {
|
|
578
|
+
if (this.isSelf(event.user_id)) {
|
|
579
|
+
if (event.type === "lock.acquired") this.readOwnLockAcquired(event.entity);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
switch (event.type) {
|
|
583
|
+
case "presence.join":
|
|
584
|
+
this.dispatch(this.config.tools.presenceSet, {
|
|
585
|
+
connectedAt: toEpochMs(event.connected_at),
|
|
586
|
+
resource: this.config.resource,
|
|
587
|
+
userId: event.user_id
|
|
588
|
+
});
|
|
589
|
+
return;
|
|
590
|
+
case "presence.leave":
|
|
591
|
+
this.dispatch(this.config.tools.presenceClear, {
|
|
592
|
+
resource: this.config.resource,
|
|
593
|
+
userId: event.user_id
|
|
594
|
+
});
|
|
595
|
+
return;
|
|
596
|
+
case "selection":
|
|
597
|
+
this.dispatch(this.config.tools.peerSelectionSet, {
|
|
598
|
+
resource: this.config.resource,
|
|
599
|
+
selection: event.selection,
|
|
600
|
+
userId: event.user_id
|
|
601
|
+
});
|
|
602
|
+
return;
|
|
603
|
+
case "cursor": return;
|
|
604
|
+
case "lock.acquired":
|
|
605
|
+
this.dispatch(this.config.tools.lockSet, {
|
|
606
|
+
id: event.entity.id,
|
|
607
|
+
kind: event.entity.kind,
|
|
608
|
+
resource: this.config.resource,
|
|
609
|
+
userId: event.user_id
|
|
610
|
+
});
|
|
611
|
+
return;
|
|
612
|
+
case "lock.released":
|
|
613
|
+
this.dispatch(this.config.tools.lockClear, {
|
|
614
|
+
id: event.entity.id,
|
|
615
|
+
kind: event.entity.kind,
|
|
616
|
+
resource: this.config.resource
|
|
617
|
+
});
|
|
618
|
+
return;
|
|
619
|
+
case "draft.update":
|
|
620
|
+
this.dispatch(this.config.tools.peerDraftSet, event.entity.kind === "zone" ? {
|
|
621
|
+
id: event.entity.id,
|
|
622
|
+
kind: "zone",
|
|
623
|
+
resource: this.config.resource,
|
|
624
|
+
userId: event.user_id,
|
|
625
|
+
zone: event.draft
|
|
626
|
+
} : {
|
|
627
|
+
id: event.entity.id,
|
|
628
|
+
kind: "segment",
|
|
629
|
+
resource: this.config.resource,
|
|
630
|
+
segment: event.draft,
|
|
631
|
+
userId: event.user_id
|
|
632
|
+
});
|
|
633
|
+
return;
|
|
634
|
+
case "draft.clear":
|
|
635
|
+
this.dispatch(this.config.tools.peerDraftClear, {
|
|
636
|
+
id: event.entity.id,
|
|
637
|
+
kind: event.entity.kind,
|
|
638
|
+
resource: this.config.resource
|
|
639
|
+
});
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
isSelf(userId) {
|
|
644
|
+
return userId === this.config.ctx.viewer.getUserId();
|
|
645
|
+
}
|
|
646
|
+
dispatch(name, input) {
|
|
647
|
+
dispatchContained(this.config.bus, this.config.ctx, name, input);
|
|
648
|
+
}
|
|
649
|
+
postSignal(signal) {
|
|
650
|
+
if (!this.maySignal()) return Promise.resolve();
|
|
651
|
+
try {
|
|
652
|
+
return (signal.type === "draft.update" || signal.type === "draft.clear" ? this.sendEditSignal(signal) : this.config.transport.sendSignal(this.config.resource, signal)).then(() => void 0, () => void 0);
|
|
653
|
+
} catch {
|
|
654
|
+
return Promise.resolve();
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
postDraftUpdate(signal) {
|
|
658
|
+
const send = () => this.disposed ? Promise.resolve() : this.postSignal(signal);
|
|
659
|
+
const pendingClear = this.draftClearInFlight;
|
|
660
|
+
const sent = pendingClear === null ? send() : pendingClear.then(send);
|
|
661
|
+
this.draftUpdatesInFlight.add(sent);
|
|
662
|
+
sent.then(() => {
|
|
663
|
+
this.draftUpdatesInFlight.delete(sent);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
1096
666
|
};
|
|
1097
667
|
var CollabListEngine = class {
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
}
|
|
1132
|
-
/**
|
|
1133
|
-
* applyFrame routes one received list frame. Only durable changes ride this stream
|
|
1134
|
-
* (it carries no ephemeral peer state), so a non-durable frame is ignored. An
|
|
1135
|
-
* itinerary change coalesces into one grouped-listing invalidation; any other
|
|
1136
|
-
* durable change (a zone, a collection) reconciles through change.apply.
|
|
1137
|
-
*/
|
|
1138
|
-
applyFrame(event, frameId) {
|
|
1139
|
-
if (!isDurableChange(event)) {
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
if (event.kind === "itinerary") {
|
|
1143
|
-
this.listCoalescer.push("list", {});
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
this.changeCoalescer.push(`${event.kind}:${event.id}`, changeApplyInput(event, frameId));
|
|
1147
|
-
}
|
|
1148
|
-
/** dispatch runs one local tool through the bus, as {@link CollabEngine} does. */
|
|
1149
|
-
dispatch(name, input) {
|
|
1150
|
-
dispatchContained(this.config.bus, this.config.ctx, name, input);
|
|
1151
|
-
}
|
|
668
|
+
config;
|
|
669
|
+
changeCoalescer;
|
|
670
|
+
listCoalescer;
|
|
671
|
+
loop;
|
|
672
|
+
constructor(config) {
|
|
673
|
+
this.config = config;
|
|
674
|
+
this.changeCoalescer = new Coalescer(CHANGE_COALESCE_MS, (input) => this.dispatch(this.config.tools.changeApply, input), foldChange);
|
|
675
|
+
this.listCoalescer = new Coalescer(CHANGE_COALESCE_MS, () => this.dispatch(this.config.tools.listApply, {}));
|
|
676
|
+
this.loop = new StreamLoop({
|
|
677
|
+
onError: (error) => this.config.onError?.(error),
|
|
678
|
+
onFrame: (event, frameId) => this.applyFrame(event, frameId),
|
|
679
|
+
subscribe: (handlers, options) => this.config.transport.subscribeList(this.config.organizationId, handlers, options)
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
start() {
|
|
683
|
+
this.loop.start();
|
|
684
|
+
}
|
|
685
|
+
dispose() {
|
|
686
|
+
this.loop.dispose();
|
|
687
|
+
this.changeCoalescer.cancel();
|
|
688
|
+
this.listCoalescer.cancel();
|
|
689
|
+
}
|
|
690
|
+
applyFrame(event, frameId) {
|
|
691
|
+
if (!isDurableChange(event)) return;
|
|
692
|
+
if (event.kind === "itinerary") {
|
|
693
|
+
this.listCoalescer.push("list", {});
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
this.changeCoalescer.push(`${event.kind}:${event.id}`, changeApplyInput(event, frameId));
|
|
697
|
+
}
|
|
698
|
+
dispatch(name, input) {
|
|
699
|
+
dispatchContained(this.config.bus, this.config.ctx, name, input);
|
|
700
|
+
}
|
|
1152
701
|
};
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
// src/collab/rules/peerNames.ts
|
|
1158
|
-
var emailLocalPart = (email) => {
|
|
1159
|
-
const at = email.indexOf("@");
|
|
1160
|
-
return at === -1 ? email : email.slice(0, at);
|
|
702
|
+
const COLLAB_RESOURCE_KINDS = ["itineraries", "zones"];
|
|
703
|
+
const emailLocalPart = (email) => {
|
|
704
|
+
const at = email.indexOf("@");
|
|
705
|
+
return at === -1 ? email : email.slice(0, at);
|
|
1161
706
|
};
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
return source.slice(0, 2).toUpperCase() || "?";
|
|
707
|
+
const peerLabelSegmentSplit = /[^a-zA-Z0-9]+/;
|
|
708
|
+
const peerLabelNonAlnum = /[^a-zA-Z0-9]/g;
|
|
709
|
+
const peerDraftInitials = (userId) => {
|
|
710
|
+
const initials = userId.split(peerLabelSegmentSplit).filter(Boolean).slice(0, 2).map((segment) => segment.charAt(0)).join("");
|
|
711
|
+
return (initials.length >= 2 ? initials : userId.replace(peerLabelNonAlnum, "")).slice(0, 2).toUpperCase() || "?";
|
|
1168
712
|
};
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
}
|
|
1224
|
-
})();
|
|
1225
|
-
return unsubscribe;
|
|
1226
|
-
}
|
|
1227
|
-
};
|
|
713
|
+
const resourceKey = (resource) => `${resource.kind}/${resource.id}`;
|
|
714
|
+
const createScriptedStream = () => {
|
|
715
|
+
const buffer = [];
|
|
716
|
+
let closed = false;
|
|
717
|
+
let wake = null;
|
|
718
|
+
const bump = () => {
|
|
719
|
+
const resume = wake;
|
|
720
|
+
wake = null;
|
|
721
|
+
resume?.();
|
|
722
|
+
};
|
|
723
|
+
return {
|
|
724
|
+
close: () => {
|
|
725
|
+
closed = true;
|
|
726
|
+
bump();
|
|
727
|
+
},
|
|
728
|
+
push: (frames) => {
|
|
729
|
+
buffer.push(...frames);
|
|
730
|
+
bump();
|
|
731
|
+
},
|
|
732
|
+
subscribe: (handlers, signal) => {
|
|
733
|
+
let active = true;
|
|
734
|
+
closed = false;
|
|
735
|
+
const release = () => {
|
|
736
|
+
signal?.removeEventListener("abort", unsubscribe);
|
|
737
|
+
};
|
|
738
|
+
const unsubscribe = () => {
|
|
739
|
+
active = false;
|
|
740
|
+
release();
|
|
741
|
+
bump();
|
|
742
|
+
};
|
|
743
|
+
if (signal) {
|
|
744
|
+
if (signal.aborted) active = false;
|
|
745
|
+
else signal.addEventListener("abort", unsubscribe, { once: true });
|
|
746
|
+
}
|
|
747
|
+
(async () => {
|
|
748
|
+
while (active) {
|
|
749
|
+
const frame = buffer.shift();
|
|
750
|
+
if (frame) {
|
|
751
|
+
handlers.onFrame(frame);
|
|
752
|
+
continue;
|
|
753
|
+
}
|
|
754
|
+
if (closed) {
|
|
755
|
+
release();
|
|
756
|
+
handlers.onClose("ended");
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
await new Promise((resolve) => {
|
|
760
|
+
wake = resolve;
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
})();
|
|
764
|
+
return unsubscribe;
|
|
765
|
+
}
|
|
766
|
+
};
|
|
1228
767
|
};
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
768
|
+
const createCollabScriptedTransport = () => {
|
|
769
|
+
const editorStreams = /* @__PURE__ */ new Map();
|
|
770
|
+
const listStream = createScriptedStream();
|
|
771
|
+
const signals = [];
|
|
772
|
+
const editorSubscribes = [];
|
|
773
|
+
const listSubscribes = [];
|
|
774
|
+
let responder = () => ({ ok: true });
|
|
775
|
+
const editorStreamFor = (resource) => {
|
|
776
|
+
const key = resourceKey(resource);
|
|
777
|
+
const existing = editorStreams.get(key);
|
|
778
|
+
if (existing) return existing;
|
|
779
|
+
const stream = createScriptedStream();
|
|
780
|
+
editorStreams.set(key, stream);
|
|
781
|
+
return stream;
|
|
782
|
+
};
|
|
783
|
+
return {
|
|
784
|
+
closeEditor: (resource) => editorStreamFor(resource).close(),
|
|
785
|
+
closeList: () => listStream.close(),
|
|
786
|
+
editorSubscribes,
|
|
787
|
+
listSubscribes,
|
|
788
|
+
pushEditor: (resource, frames) => editorStreamFor(resource).push(frames),
|
|
789
|
+
pushList: (frames) => listStream.push(frames),
|
|
790
|
+
sendSignal: async (resource, signal) => {
|
|
791
|
+
signals.push({
|
|
792
|
+
resource,
|
|
793
|
+
signal
|
|
794
|
+
});
|
|
795
|
+
return responder(signal);
|
|
796
|
+
},
|
|
797
|
+
setSignalResponder: (next) => {
|
|
798
|
+
responder = next;
|
|
799
|
+
},
|
|
800
|
+
signals,
|
|
801
|
+
subscribeEditor: (resource, handlers, options) => {
|
|
802
|
+
editorSubscribes.push({
|
|
803
|
+
lastEventId: options?.lastEventId,
|
|
804
|
+
target: resourceKey(resource)
|
|
805
|
+
});
|
|
806
|
+
return editorStreamFor(resource).subscribe(handlers, options?.signal);
|
|
807
|
+
},
|
|
808
|
+
subscribeList: (organizationId, handlers, options) => {
|
|
809
|
+
listSubscribes.push({
|
|
810
|
+
lastEventId: options?.lastEventId,
|
|
811
|
+
target: organizationId
|
|
812
|
+
});
|
|
813
|
+
return listStream.subscribe(handlers, options?.signal);
|
|
814
|
+
}
|
|
815
|
+
};
|
|
1270
816
|
};
|
|
1271
|
-
|
|
1272
817
|
export { COLLAB_RESOURCE_KINDS, CollabEngine, CollabListEngine, LIVE_SEGMENT_THROTTLE_MS, TrailingThrottle, createCollabScriptedTransport, emailLocalPart, peerDraftInitials };
|
|
1273
|
-
|
|
818
|
+
|
|
1274
819
|
//# sourceMappingURL=index.js.map
|