@mountaya/elements 0.0.0-stage → 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 +273 -0
- package/LICENCE.fr.txt +280 -0
- package/LICENSE.txt +262 -0
- package/README.md +1510 -2
- package/THIRD-PARTY-NOTICES.txt +103 -0
- package/dist/agent/index.cjs +1211 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +1966 -0
- package/dist/agent/index.d.ts +1966 -0
- package/dist/agent/index.js +1181 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/camera/index.cjs +2512 -0
- package/dist/camera/index.cjs.map +1 -0
- package/dist/camera/index.d.cts +1723 -0
- package/dist/camera/index.d.ts +1723 -0
- package/dist/camera/index.js +2443 -0
- package/dist/camera/index.js.map +1 -0
- package/dist/chunk-5pTPpv4v.d.cts +897 -0
- package/dist/chunk-5pTPpv4v.d.ts +897 -0
- package/dist/chunk-6JzFMFHh.d.ts +119 -0
- 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/chunk-A48H1rDg.d.cts +73 -0
- package/dist/chunk-A48H1rDg.d.ts +73 -0
- package/dist/chunk-B-m1AchR.cjs +57 -0
- package/dist/chunk-B-m1AchR.cjs.map +1 -0
- package/dist/chunk-B-qFTf04.d.ts +216 -0
- 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/chunk-B98mKrdu.d.cts +302 -0
- package/dist/chunk-BB0PmqIM.d.cts +44 -0
- 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/chunk-BNX5LAfN.d.cts +912 -0
- package/dist/chunk-BP6KgA86.js +35 -0
- package/dist/chunk-BP6KgA86.js.map +1 -0
- package/dist/chunk-BRnjQq6K.d.cts +157 -0
- 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/chunk-BZ5KyZXI.d.ts +302 -0
- 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/chunk-Bk0L8g5J.d.cts +77 -0
- package/dist/chunk-Bk0L8g5J.d.ts +77 -0
- 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/chunk-Bq_WHTfd.d.cts +119 -0
- package/dist/chunk-Bqt4LBBz.cjs +648 -0
- package/dist/chunk-Bqt4LBBz.cjs.map +1 -0
- package/dist/chunk-Bqt97zwf.d.cts +54 -0
- package/dist/chunk-Bqt97zwf.d.ts +54 -0
- 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/chunk-BxDQZDXR.d.cts +76 -0
- package/dist/chunk-BxDQZDXR.d.ts +76 -0
- 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/chunk-CAUZnoCs.d.ts +525 -0
- 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/chunk-CFIo021l.d.cts +216 -0
- 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/chunk-CWpqBgkF.d.cts +24 -0
- package/dist/chunk-CWpqBgkF.d.ts +24 -0
- 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/chunk-C_fQFr70.d.cts +159 -0
- package/dist/chunk-C_fQFr70.d.ts +159 -0
- 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/chunk-CeiTuMyt.d.cts +525 -0
- 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/chunk-D-4MxHTt.d.cts +105 -0
- package/dist/chunk-D-4MxHTt.d.ts +105 -0
- 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/chunk-D89E-w70.d.ts +44 -0
- 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/chunk-DJpUw8TN.d.ts +912 -0
- 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/chunk-DWsm3HIW.d.cts +120 -0
- package/dist/chunk-DWsm3HIW.d.ts +120 -0
- 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/chunk-DeSjQXiI.d.ts +157 -0
- 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/chunk-Dr5MCIpS.d.cts +63 -0
- package/dist/chunk-Dr5MCIpS.d.ts +63 -0
- 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/chunk-QKWhxfPv.d.cts +361 -0
- package/dist/chunk-QKWhxfPv.d.ts +361 -0
- 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/chunk-fozLXfHY.d.cts +55 -0
- package/dist/chunk-fozLXfHY.d.ts +55 -0
- 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 +831 -0
- package/dist/collab/index.cjs.map +1 -0
- package/dist/collab/index.d.cts +824 -0
- package/dist/collab/index.d.ts +824 -0
- package/dist/collab/index.js +819 -0
- package/dist/collab/index.js.map +1 -0
- package/dist/data/index.cjs +39 -0
- package/dist/data/index.d.cts +6 -0
- package/dist/data/index.d.ts +6 -0
- package/dist/data/index.js +7 -0
- package/dist/editor/index.cjs +2713 -0
- package/dist/editor/index.cjs.map +1 -0
- package/dist/editor/index.d.cts +10 -0
- package/dist/editor/index.d.ts +10 -0
- package/dist/editor/index.js +2702 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/errors/index.cjs +11 -0
- package/dist/errors/index.d.cts +2 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +1 -0
- package/dist/geo/index.cjs +68 -0
- package/dist/geo/index.d.cts +6 -0
- package/dist/geo/index.d.ts +6 -0
- package/dist/geo/index.js +11 -0
- package/dist/i18n/fr/index.cjs +333 -0
- package/dist/i18n/fr/index.cjs.map +1 -0
- package/dist/i18n/fr/index.d.cts +18 -0
- package/dist/i18n/fr/index.d.ts +18 -0
- package/dist/i18n/fr/index.js +328 -0
- package/dist/i18n/fr/index.js.map +1 -0
- package/dist/i18n/index.cjs +451 -0
- package/dist/i18n/index.cjs.map +1 -0
- package/dist/i18n/index.d.cts +268 -0
- package/dist/i18n/index.d.ts +268 -0
- package/dist/i18n/index.js +430 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/icons/index.cjs +37 -0
- package/dist/icons/index.d.cts +4 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +8 -0
- package/dist/index.cjs +517 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +174 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/layers/index.cjs +83 -0
- package/dist/layers/index.d.cts +3 -0
- package/dist/layers/index.d.ts +3 -0
- package/dist/layers/index.js +5 -0
- package/dist/map-client/index.cjs +5 -0
- package/dist/map-client/index.d.cts +6 -0
- package/dist/map-client/index.d.ts +6 -0
- package/dist/map-client/index.js +0 -0
- package/dist/maplibre-worker.mjs +12 -0
- package/dist/navigation/index.cjs +612 -0
- package/dist/navigation/index.cjs.map +1 -0
- package/dist/navigation/index.d.cts +551 -0
- package/dist/navigation/index.d.ts +551 -0
- package/dist/navigation/index.js +599 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/profile/index.cjs +177 -0
- package/dist/profile/index.d.cts +8 -0
- package/dist/profile/index.d.ts +8 -0
- package/dist/profile/index.js +10 -0
- package/dist/seams/index.cjs +15 -0
- package/dist/seams/index.d.cts +4 -0
- package/dist/seams/index.d.ts +4 -0
- package/dist/seams/index.js +4 -0
- package/dist/search/index.cjs +39 -0
- package/dist/search/index.d.cts +6 -0
- package/dist/search/index.d.ts +6 -0
- package/dist/search/index.js +3 -0
- package/dist/style/index.cjs +34 -0
- package/dist/style/index.d.cts +5 -0
- package/dist/style/index.d.ts +5 -0
- package/dist/style/index.js +5 -0
- package/dist/styles.css +11 -0
- package/dist/testing/index.cjs +444 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +217 -0
- package/dist/testing/index.d.ts +217 -0
- package/dist/testing/index.js +435 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/timezone/index.cjs +1953 -0
- package/dist/timezone/index.cjs.map +1 -0
- package/dist/timezone/index.d.cts +28 -0
- package/dist/timezone/index.d.ts +28 -0
- package/dist/timezone/index.js +1948 -0
- package/dist/timezone/index.js.map +1 -0
- package/dist/units/index.cjs +29 -0
- package/dist/units/index.d.cts +3 -0
- package/dist/units/index.d.ts +3 -0
- package/dist/units/index.js +3 -0
- package/dist/video/index.cjs +1713 -0
- package/dist/video/index.cjs.map +1 -0
- package/dist/video/index.d.cts +846 -0
- package/dist/video/index.d.ts +846 -0
- package/dist/video/index.js +1689 -0
- package/dist/video/index.js.map +1 -0
- package/dist/view/index.cjs +7 -0
- package/dist/view/index.d.cts +3 -0
- package/dist/view/index.d.ts +3 -0
- package/dist/view/index.js +1 -0
- package/package.json +433 -4
- package/src/agent/engines/session.ts +2255 -0
- package/src/agent/index.ts +109 -0
- package/src/agent/rules/agentError.ts +128 -0
- package/src/agent/rules/boundedInputJson.ts +53 -0
- package/src/agent/rules/conversation.ts +629 -0
- package/src/agent/rules/conversationFaults.ts +349 -0
- package/src/agent/rules/conversationHost.ts +390 -0
- package/src/agent/rules/dispatcher.ts +102 -0
- package/src/agent/rules/errorCodes.ts +78 -0
- package/src/agent/rules/errorStatus.ts +65 -0
- package/src/agent/rules/scriptedTransport.ts +390 -0
- package/src/agent/rules/stickToBottom.ts +38 -0
- package/src/agent/rules/toolResultPayload.ts +197 -0
- package/src/auth/rules/clientHeader.ts +22 -0
- package/src/auth/rules/sentCredential.ts +76 -0
- package/src/auth/rules/transformRequest.ts +803 -0
- package/src/camera/engines/videoFlight.ts +1758 -0
- package/src/camera/index.ts +157 -0
- package/src/camera/rules/clearance.ts +1099 -0
- package/src/camera/rules/fit.ts +132 -0
- package/src/camera/rules/modes.ts +1019 -0
- package/src/camera/rules/plan.ts +478 -0
- package/src/camera/rules/planner.ts +129 -0
- package/src/camera/rules/poseRanges.ts +38 -0
- package/src/camera/rules/presets.ts +185 -0
- package/src/camera/rules/profileSamples.ts +243 -0
- package/src/camera/rules/route.ts +596 -0
- package/src/camera/rules/routeContent.ts +105 -0
- package/src/camera/rules/spline.ts +765 -0
- package/src/camera/rules/sweptViewports.ts +39 -0
- package/src/camera/rules/track.ts +1412 -0
- package/src/camera/rules/vocabulary.ts +130 -0
- package/src/camera/rules/zoom.ts +216 -0
- package/src/collab/engines/session.ts +1902 -0
- package/src/collab/engines/trailingThrottle.ts +151 -0
- package/src/collab/index.ts +52 -0
- package/src/collab/rules/dispatch.ts +143 -0
- package/src/collab/rules/peerNames.ts +51 -0
- package/src/collab/rules/scriptedTransport.ts +244 -0
- package/src/compose/engines/baseMapSwitch.ts +1136 -0
- package/src/compose/engines/events.ts +962 -0
- package/src/compose/engines/mountayaMap.ts +5648 -0
- package/src/compose/engines/sentCredentials.ts +146 -0
- package/src/compose/engines/slotRequests.ts +413 -0
- package/src/compose/rules/accessRefusal.ts +109 -0
- package/src/compose/rules/accessStanding.ts +75 -0
- package/src/compose/rules/analysisKinds.ts +331 -0
- package/src/compose/rules/analysisLayers.ts +176 -0
- package/src/compose/rules/cameraMoves.ts +38 -0
- package/src/compose/rules/carriedLayers.ts +87 -0
- package/src/compose/rules/developmentWarnings.ts +167 -0
- package/src/compose/rules/fitBox.ts +67 -0
- package/src/compose/rules/fitCamera.ts +54 -0
- package/src/compose/rules/geoJsonSlot.ts +61 -0
- package/src/compose/rules/geometrySlots.ts +155 -0
- package/src/compose/rules/glyphNode.ts +62 -0
- package/src/compose/rules/layerKeys.ts +92 -0
- package/src/compose/rules/layerOrder.ts +85 -0
- package/src/compose/rules/layersManifest.ts +26 -0
- package/src/compose/rules/mapOptions.ts +300 -0
- package/src/compose/rules/maplibreWorkerVersion.gen.ts +8 -0
- package/src/compose/rules/markerPin.ts +122 -0
- package/src/compose/rules/markerRegistry.ts +85 -0
- package/src/compose/rules/markerSprite.ts +382 -0
- package/src/compose/rules/maxBounds.ts +120 -0
- package/src/compose/rules/overlayLookup.ts +49 -0
- package/src/compose/rules/paintDiff.ts +38 -0
- package/src/compose/rules/panLock.ts +77 -0
- package/src/compose/rules/patch.ts +124 -0
- package/src/compose/rules/queriedFeature.ts +55 -0
- package/src/compose/rules/queryLayers.ts +46 -0
- package/src/compose/rules/searchHighlight.ts +313 -0
- package/src/compose/rules/slotNames.ts +19 -0
- package/src/compose/rules/stripeImage.ts +253 -0
- package/src/compose/rules/swapMarker.ts +66 -0
- package/src/compose/rules/terrainVariant.ts +88 -0
- package/src/compose/rules/types.ts +559 -0
- package/src/compose/rules/urlHash.ts +19 -0
- package/src/compose/rules/viewOptions.ts +451 -0
- package/src/compose/rules/workerUrl.ts +131 -0
- package/src/data/engines/itineraryResource.ts +643 -0
- package/src/data/index.ts +78 -0
- package/src/data/rules/adapt.ts +473 -0
- package/src/data/rules/editModes.ts +51 -0
- package/src/data/rules/itinerary.ts +168 -0
- package/src/data/rules/nullable.ts +63 -0
- package/src/data/rules/roadAccess.ts +169 -0
- package/src/data/rules/segmentGroups.ts +309 -0
- package/src/data/rules/selectors.ts +95 -0
- package/src/data/rules/zones.ts +79 -0
- package/src/draw/engines/boundaryEngine.ts +1003 -0
- package/src/draw/engines/framedAdapter.ts +198 -0
- package/src/draw/engines/pointerCursor.ts +205 -0
- package/src/draw/engines/segmentEngine.ts +1405 -0
- package/src/draw/engines/snapIndex.ts +254 -0
- package/src/draw/engines/waypointEngine.ts +574 -0
- package/src/draw/engines/zoneEngine.ts +1137 -0
- package/src/draw/rules/drawFrame.ts +123 -0
- package/src/draw/rules/insertVertex.ts +226 -0
- package/src/draw/rules/screenSpace.ts +62 -0
- package/src/draw/rules/seeds.ts +185 -0
- package/src/draw/rules/snap.ts +115 -0
- package/src/draw/rules/snapCameraKey.ts +50 -0
- package/src/draw/rules/terraDrawShared.ts +214 -0
- package/src/draw/rules/zoneOutline.ts +213 -0
- package/src/editing/engines/cursor.ts +505 -0
- package/src/editing/engines/draftMarker.ts +149 -0
- package/src/editing/rules/accent.ts +11 -0
- package/src/editing/rules/engine.ts +288 -0
- package/src/editing/rules/placement.ts +22 -0
- package/src/editing/rules/positions.ts +89 -0
- package/src/editing/rules/sources.ts +9 -0
- package/src/editing/rules/types.ts +457 -0
- package/src/editing/rules/vocabulary.ts +10 -0
- package/src/editing/rules/waypointCursor.ts +228 -0
- package/src/editor/engines/directionArrows.ts +459 -0
- package/src/editor/engines/directions.ts +1383 -0
- package/src/editor/engines/editorClient.ts +134 -0
- package/src/editor/engines/eventScope.ts +59 -0
- package/src/editor/engines/frameLoop.ts +159 -0
- package/src/editor/engines/itineraryPreview.ts +272 -0
- package/src/editor/engines/mapLockGuard.ts +66 -0
- package/src/editor/engines/overlayRenderer.ts +2696 -0
- package/src/editor/engines/peerDraft.ts +760 -0
- package/src/editor/engines/poiPick.ts +305 -0
- package/src/editor/engines/pointPick.ts +84 -0
- package/src/editor/engines/roadAccessLine.ts +140 -0
- package/src/editor/engines/searchHighlight.ts +183 -0
- package/src/editor/engines/viewClient.ts +4091 -0
- package/src/editor/engines/zoneBadges.ts +503 -0
- package/src/editor/index.ts +97 -0
- package/src/editor/rules/accentColor.ts +116 -0
- package/src/editor/rules/camera.ts +121 -0
- package/src/editor/rules/contract.ts +120 -0
- package/src/editor/rules/icons.ts +825 -0
- package/src/editor/rules/markerElements.ts +244 -0
- package/src/editor/rules/style.ts +51 -0
- package/src/editor/rules/terrain.ts +98 -0
- package/src/editor/rules/tileWarm.ts +191 -0
- package/src/editor/rules/tilesReload.ts +158 -0
- package/src/editor/rules/zoneBadgePlacement.ts +1832 -0
- package/src/editor/rules/zoneTimeStyling.ts +119 -0
- package/src/errors/index.ts +25 -0
- package/src/errors/rules/errors.ts +158 -0
- package/src/errors/rules/print.ts +129 -0
- package/src/geo/index.ts +89 -0
- package/src/geo/rules/boundaries.ts +105 -0
- package/src/geo/rules/camera.ts +496 -0
- package/src/geo/rules/corridor.ts +242 -0
- package/src/geo/rules/elevationTiles.ts +269 -0
- package/src/geo/rules/formatLngLat.ts +63 -0
- package/src/geo/rules/geodesy.ts +125 -0
- package/src/geo/rules/geometry.ts +362 -0
- package/src/geo/rules/lineWalk.ts +77 -0
- package/src/geo/rules/longitude.ts +99 -0
- package/src/geo/rules/searchLimits.ts +22 -0
- package/src/geo/rules/segmentGeometry.ts +80 -0
- package/src/geo/rules/terrain.ts +107 -0
- package/src/geo/rules/tuples.ts +124 -0
- package/src/geo/rules/types.ts +54 -0
- package/src/geo/rules/webMercator.ts +57 -0
- package/src/i18n/fr/index.ts +17 -0
- package/src/i18n/fr/rules/fr.ts +85 -0
- package/src/i18n/fr/rules/words.gen.ts +277 -0
- package/src/i18n/index.ts +82 -0
- package/src/i18n/rules/bundle.ts +378 -0
- package/src/i18n/rules/config.ts +71 -0
- package/src/i18n/rules/dates.ts +165 -0
- package/src/i18n/rules/endonyms.gen.ts +19 -0
- package/src/i18n/rules/language.ts +92 -0
- package/src/i18n/rules/localizedName.ts +33 -0
- package/src/i18n/rules/merge.ts +106 -0
- package/src/i18n/rules/scope.ts +127 -0
- package/src/i18n/rules/strings.ts +632 -0
- package/src/i18n/rules/videoOverlay.ts +121 -0
- package/src/i18n/rules/wordForms.ts +95 -0
- package/src/i18n/rules/words.gen.ts +277 -0
- package/src/icons/index.ts +54 -0
- package/src/icons/rules/activities.ts +40 -0
- package/src/icons/rules/amenities.ts +250 -0
- package/src/icons/rules/artwork.gen.ts +83 -0
- package/src/icons/rules/artwork.ts +47 -0
- package/src/icons/rules/fallback.ts +21 -0
- package/src/icons/rules/lucideMarkers.gen.ts +112 -0
- package/src/icons/rules/lucideUi.gen.ts +197 -0
- package/src/icons/rules/paint.ts +107 -0
- package/src/icons/rules/parse.ts +475 -0
- package/src/icons/rules/provider.ts +373 -0
- package/src/icons/rules/sprites.ts +54 -0
- package/src/icons/rules/ui.ts +348 -0
- package/src/icons/rules/waypoints.ts +215 -0
- package/src/index.ts +993 -0
- package/src/layers/engines/layersSelection.ts +515 -0
- package/src/layers/engines/readoutEngine.ts +131 -0
- package/src/layers/index.ts +151 -0
- package/src/layers/rules/analysis.ts +135 -0
- package/src/layers/rules/enrichment.ts +30 -0
- package/src/layers/rules/geoJson.ts +270 -0
- package/src/layers/rules/hover.ts +67 -0
- package/src/layers/rules/itineraries.ts +182 -0
- package/src/layers/rules/layersPanel.ts +237 -0
- package/src/layers/rules/order.ts +194 -0
- package/src/layers/rules/overlayInstant.ts +49 -0
- package/src/layers/rules/overlays.ts +52 -0
- package/src/layers/rules/poiPanel.ts +119 -0
- package/src/layers/rules/pois.ts +114 -0
- package/src/layers/rules/readout.ts +340 -0
- package/src/layers/rules/streetView.ts +16 -0
- package/src/layers/rules/tileTimestamp.ts +146 -0
- package/src/layers/rules/timeSlider.ts +192 -0
- package/src/layers/rules/timeWindow.ts +123 -0
- package/src/layers/rules/zones.ts +43 -0
- package/src/layers/rules/zoom.ts +77 -0
- package/src/map-client/index.ts +71 -0
- package/src/map-client/rules/mapClient.ts +1945 -0
- package/src/navigation/engines/navigation.ts +493 -0
- package/src/navigation/index.ts +51 -0
- package/src/navigation/rules/followedRoute.ts +78 -0
- package/src/navigation/rules/instructions.ts +89 -0
- package/src/navigation/rules/itineraryRoute.ts +232 -0
- package/src/navigation/rules/offRoute.ts +41 -0
- package/src/navigation/rules/progress.ts +230 -0
- package/src/navigation/rules/prompts.ts +217 -0
- package/src/navigation/rules/routeRequest.ts +98 -0
- package/src/navigation/rules/status.ts +142 -0
- package/src/navigation/rules/steps.ts +234 -0
- package/src/navigation/rules/types.ts +83 -0
- package/src/profile/index.ts +307 -0
- package/src/profile/rules/amenityBadge.ts +35 -0
- package/src/profile/rules/amenityFilter.ts +74 -0
- package/src/profile/rules/amenityStacks.ts +66 -0
- package/src/profile/rules/axis.ts +89 -0
- package/src/profile/rules/axisCulling.ts +83 -0
- package/src/profile/rules/axisLookup.ts +180 -0
- package/src/profile/rules/climbs.ts +292 -0
- package/src/profile/rules/cursorMarker.ts +122 -0
- package/src/profile/rules/cursorReadout.ts +104 -0
- package/src/profile/rules/curvePlacement.ts +216 -0
- package/src/profile/rules/dock.ts +293 -0
- package/src/profile/rules/elevation.ts +1263 -0
- package/src/profile/rules/instant.ts +89 -0
- package/src/profile/rules/intl.ts +237 -0
- package/src/profile/rules/legEmphasis.ts +53 -0
- package/src/profile/rules/profileColors.ts +66 -0
- package/src/profile/rules/profileLayout.ts +59 -0
- package/src/profile/rules/profileSlices.ts +55 -0
- package/src/profile/rules/routeProfile.ts +475 -0
- package/src/profile/rules/rowMatch.ts +50 -0
- package/src/profile/rules/scale.ts +646 -0
- package/src/profile/rules/scaleFrame.ts +171 -0
- package/src/profile/rules/sectionChips.ts +83 -0
- package/src/profile/rules/sections.ts +923 -0
- package/src/profile/rules/slopeRamp.ts +160 -0
- package/src/profile/rules/statStrip.ts +103 -0
- package/src/profile/rules/steepness.ts +51 -0
- package/src/profile/rules/tableCells.ts +269 -0
- package/src/profile/rules/tableCursor.ts +87 -0
- package/src/profile/rules/unitPatterns.ts +335 -0
- package/src/profile/rules/units.ts +1025 -0
- package/src/profile/rules/waypointCard.ts +590 -0
- package/src/profile/rules/webAddress.ts +130 -0
- package/src/profile/rules/windowSpans.ts +65 -0
- package/src/rules/asciiFold.ts +17 -0
- package/src/rules/inDevelopment.ts +54 -0
- package/src/rules/listeners.ts +62 -0
- package/src/rules/timers.ts +9 -0
- package/src/rules/types.ts +22 -0
- package/src/rules/uuid.ts +87 -0
- package/src/seams/engines/geolocateControl.ts +286 -0
- package/src/seams/index.ts +50 -0
- package/src/seams/rules/clock.ts +169 -0
- package/src/seams/rules/geolocation.ts +165 -0
- package/src/seams/rules/segmentRoute.ts +187 -0
- package/src/search/engines/search.ts +1093 -0
- package/src/search/index.ts +99 -0
- package/src/search/rules/describe.ts +383 -0
- package/src/search/rules/filters.ts +195 -0
- package/src/search/rules/highlight.ts +270 -0
- package/src/search/rules/pick.ts +90 -0
- package/src/search/rules/rows.ts +258 -0
- package/src/search/rules/searchFocus.ts +27 -0
- package/src/search/rules/searchViewport.ts +44 -0
- package/src/search/rules/shown.ts +77 -0
- package/src/search/rules/types.ts +340 -0
- package/src/stream/rules/reconnectSchedule.ts +83 -0
- package/src/style/engines/organizationRead.ts +80 -0
- package/src/style/index.ts +63 -0
- package/src/style/rules/apply.ts +268 -0
- package/src/style/rules/attribution.ts +119 -0
- package/src/style/rules/itineraryLine.ts +142 -0
- package/src/style/rules/language.ts +668 -0
- package/src/style/rules/layout.gen.ts +27 -0
- package/src/style/rules/organization.ts +96 -0
- package/src/style/rules/paint.ts +143 -0
- package/src/style/rules/panelLayout.ts +51 -0
- package/src/style/rules/roadAccessColors.ts +29 -0
- package/src/style/rules/roadAccessLine.ts +267 -0
- package/src/style/rules/segmentColors.ts +207 -0
- package/src/testing/catalogs.ts +103 -0
- package/src/testing/index.ts +30 -0
- package/src/testing/mapClient.ts +241 -0
- package/src/testing/mountayaMap.ts +741 -0
- package/src/timezone/index.ts +14 -0
- package/src/timezone/rules/viewport.ts +875 -0
- package/src/units/index.ts +55 -0
- package/src/units/rules/conversions.ts +620 -0
- package/src/units/rules/preferenceChoices.ts +124 -0
- package/src/units/rules/preferences.ts +77 -0
- package/src/units/rules/rounding.ts +69 -0
- package/src/video/engines/videoRun.ts +654 -0
- package/src/video/engines/viewClient.ts +6 -0
- package/src/video/index.ts +83 -0
- package/src/video/profileOverlay/rules/contract.ts +210 -0
- package/src/video/profileOverlay/rules/curve.ts +216 -0
- package/src/video/profileOverlay/rules/draw.ts +410 -0
- package/src/video/profileOverlay/rules/fonts.ts +54 -0
- package/src/video/profileOverlay/rules/graphDesign.ts +690 -0
- package/src/video/profileOverlay/rules/minimalDesign.ts +144 -0
- package/src/video/profileOverlay/rules/registry.ts +23 -0
- package/src/video/profileOverlay/rules/staticLayer.ts +582 -0
- package/src/video/profileOverlay/rules/stripDesign.ts +327 -0
- package/src/video/profileOverlay/rules/types.ts +78 -0
- package/src/video/rules/videoConstants.ts +250 -0
- package/src/video/rules/videoEncoder.ts +277 -0
- package/src/video/rules/videoFrames.ts +99 -0
- package/src/video/rules/videoPreview.ts +185 -0
- package/src/video/rules/videoRecorder.ts +746 -0
- package/src/video/rules/videoWatermark.ts +155 -0
- package/src/video/rules/watermarkMark.ts +40 -0
- package/src/view/engines/viewClient.ts +6 -0
- package/src/view/index.ts +20 -0
|
@@ -0,0 +1,1093 @@
|
|
|
1
|
+
import type { DataSchema, SearchResult } from "@mountaya/client";
|
|
2
|
+
|
|
3
|
+
import { errorFrom, MountayaElementsError } from "../../errors/rules/errors.js";
|
|
4
|
+
// The declaring module rather than the `geo` barrel, as `../rules/rows.ts` reaches for its two
|
|
5
|
+
// tuple helpers: the barrel is one import that pulls every geo module into this entry's graph, and
|
|
6
|
+
// a search surface drawing no map has no use for the rest of it.
|
|
7
|
+
import { SEARCH_LIMIT_MAX } from "../../geo/rules/searchLimits.js";
|
|
8
|
+
import { viewportBoundsFrom } from "../../geo/rules/tuples.js";
|
|
9
|
+
import type { BoundingBox } from "../../geo/rules/types.js";
|
|
10
|
+
import type { DataLanguage } from "../../i18n/rules/language.js";
|
|
11
|
+
import { notifyListeners, surfaceFault } from "../../rules/listeners.js";
|
|
12
|
+
import { MAX_TIMER_MS } from "../../rules/timers.js";
|
|
13
|
+
import { collectionRow, itineraryRow, placeRow, poiRow, wayRow, zoneRow } from "../rules/rows.js";
|
|
14
|
+
import { searchFocus } from "../rules/searchFocus.js";
|
|
15
|
+
import {
|
|
16
|
+
SECTION_ORDER,
|
|
17
|
+
type SearchRow,
|
|
18
|
+
type SearchSection,
|
|
19
|
+
type SearchSectionState,
|
|
20
|
+
type SearchSnapshot,
|
|
21
|
+
type SearchTargetName,
|
|
22
|
+
type SearchWording,
|
|
23
|
+
} from "../rules/types.js";
|
|
24
|
+
|
|
25
|
+
/** The typing pause before a round fires. */
|
|
26
|
+
export const SEARCH_DEBOUNCE_MS = 150;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The trailing pause after a pan or zoom before a live, area-scoped round re-runs.
|
|
30
|
+
*
|
|
31
|
+
* The camera stream is per-frame, so without this a single gesture would fire a fan-out on every
|
|
32
|
+
* intermediate position. The pause collapses the gesture into one round once it settles.
|
|
33
|
+
*/
|
|
34
|
+
export const SEARCH_VIEWPORT_REFRESH_MS = 350;
|
|
35
|
+
|
|
36
|
+
// Declared with the geo entry's bounds and published from this entry as well, so a contract
|
|
37
|
+
// that needs the ceiling and no engine reads it without this module's graph.
|
|
38
|
+
export { SEARCH_LIMIT_MAX } from "../../geo/rules/searchLimits.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Every branch the contract carries, in the order a round asks them and their sections render:
|
|
42
|
+
* {@link SECTION_ORDER}, under the name an engine's caller reads it by. One array under both
|
|
43
|
+
* names, so the two cannot state two orders.
|
|
44
|
+
*/
|
|
45
|
+
export const SEARCH_TARGETS: readonly SearchTargetName[] = SECTION_ORDER;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* SearchFetch is how one round reaches the API, and it is the seam that keeps two search
|
|
49
|
+
* implementations from existing.
|
|
50
|
+
*
|
|
51
|
+
* The engine has no default: a host hands it the call that reaches the API, a map's `search` or
|
|
52
|
+
* a call through a tool bus of its own, and keeps the whole state machine above it. The abort
|
|
53
|
+
* discipline, the progressive paint, the broaden fallback and the row model are this package's,
|
|
54
|
+
* whoever makes the request.
|
|
55
|
+
*/
|
|
56
|
+
export type SearchFetch = (
|
|
57
|
+
input: DataSchema.SearchInput,
|
|
58
|
+
options: { readonly signal: AbortSignal },
|
|
59
|
+
) => Promise<SearchResult>;
|
|
60
|
+
|
|
61
|
+
/** Unsubscribes a camera listener. */
|
|
62
|
+
export type SearchUnsubscribe = () => void;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* SearchViewport is where an area-scoped round reads its area from.
|
|
66
|
+
*
|
|
67
|
+
* An adapter rather than the map itself, because a surface that owns its own camera state (an
|
|
68
|
+
* application driving the map through its own store) has the answer before the map does.
|
|
69
|
+
*/
|
|
70
|
+
export interface SearchViewport {
|
|
71
|
+
/** The camera to frame against, or null when there is not one yet. */
|
|
72
|
+
readonly read: () => { readonly center: [number, number]; readonly zoom: number } | null;
|
|
73
|
+
/** Subscribes to camera changes. Returns the unsubscribe. */
|
|
74
|
+
readonly subscribe: (listener: () => void) => SearchUnsubscribe;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Everything an engine resolves a round with, all of it replaceable mid-life. */
|
|
78
|
+
export interface SearchConfig {
|
|
79
|
+
/**
|
|
80
|
+
* How a round reaches the API. With none, the engine is inert and every section stays empty.
|
|
81
|
+
*/
|
|
82
|
+
readonly fetch?: SearchFetch | undefined;
|
|
83
|
+
/** The language a round asks the API to answer in. The API's own default applies when omitted. */
|
|
84
|
+
readonly language?: DataLanguage | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Per-target result cap: a whole number from 1 to 50, the range the API takes. The API's own
|
|
87
|
+
* default applies when omitted.
|
|
88
|
+
*/
|
|
89
|
+
readonly limit?: number | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Called once for each branch whose request fails, after its section reads the failure. It is
|
|
92
|
+
* always handed an `Error`: a value a transport rejects with that is none arrives as a
|
|
93
|
+
* `MountayaElementsRejectionError`, with that value as its `cause`. A handler that throws stops
|
|
94
|
+
* no round: its fault reaches the runtime as an uncaught error on a microtask.
|
|
95
|
+
*/
|
|
96
|
+
readonly onError?: ((error: Error) => void) | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* The branches to ask for, whose sections render in the order listed. A branch listed twice is
|
|
99
|
+
* asked once, in the place it is first listed.
|
|
100
|
+
*
|
|
101
|
+
* @default {@link SEARCH_TARGETS}, every branch the contract carries.
|
|
102
|
+
*/
|
|
103
|
+
readonly targets?: readonly SearchTargetName[] | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Where a round reads the camera from: the point results are ranked around, and the area an
|
|
106
|
+
* area-scoped round is restricted to. Without it a round ranks around nothing and scopes
|
|
107
|
+
* nothing.
|
|
108
|
+
*/
|
|
109
|
+
readonly viewport?: SearchViewport | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* How a row's title and second line are worded for the reader: the words its wire values read
|
|
112
|
+
* as, and the units a distance and an elevation are stated in. Without it a row reads as the
|
|
113
|
+
* wire states it, in English titles and metric figures.
|
|
114
|
+
*
|
|
115
|
+
* A change of `units.language` or `units.length` asks a fresh round, since a row holds its
|
|
116
|
+
* second line as text. A replaced `resolveLabel` asks nothing: its words are read when a
|
|
117
|
+
* branch lands.
|
|
118
|
+
*/
|
|
119
|
+
readonly wording?: SearchWording | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* SearchEngineOptions is what a {@link SearchEngine} is built with: its configuration, and the
|
|
124
|
+
* state and pauses it starts at.
|
|
125
|
+
*/
|
|
126
|
+
export interface SearchEngineOptions extends SearchConfig {
|
|
127
|
+
/**
|
|
128
|
+
* The typing pause in milliseconds, from 0 to 2 ** 31 - 1, the longest delay a timer honours.
|
|
129
|
+
* Zero starts the round as the query is typed.
|
|
130
|
+
*
|
|
131
|
+
* @default {@link SEARCH_DEBOUNCE_MS}
|
|
132
|
+
*/
|
|
133
|
+
readonly debounceMs?: number | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the results start visible. See {@link SearchEngine.setOpen}.
|
|
136
|
+
*
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
readonly open?: boolean | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* The query it starts at, already settled: no typing pause is owed for text the user typed
|
|
142
|
+
* before this engine existed.
|
|
143
|
+
*
|
|
144
|
+
* A surface that remembers its query outside itself has one: a tab switched away from and back,
|
|
145
|
+
* a query restored from a URL. Without it such a surface would show a skeleton for the pause
|
|
146
|
+
* length on every mount, for typing that finished minutes ago.
|
|
147
|
+
*/
|
|
148
|
+
readonly query?: string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* The post-gesture pause in milliseconds, from 0 to 2 ** 31 - 1.
|
|
151
|
+
*
|
|
152
|
+
* @default {@link SEARCH_VIEWPORT_REFRESH_MS}
|
|
153
|
+
*/
|
|
154
|
+
readonly viewportRefreshMs?: number | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Whether the round starts restricted to the visible area. See
|
|
157
|
+
* {@link SearchEngine.setViewportScope}.
|
|
158
|
+
*
|
|
159
|
+
* @default false
|
|
160
|
+
*/
|
|
161
|
+
readonly viewportScope?: boolean | undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* SearchRound is what one round holds from the moment it claims the slot: what it asks, where,
|
|
166
|
+
* through what, and the abort controller that says whether it is still the live one.
|
|
167
|
+
*/
|
|
168
|
+
interface SearchRound {
|
|
169
|
+
/**
|
|
170
|
+
* The box an area-scoped round is restricted to. Undefined for a round asked everywhere, and
|
|
171
|
+
* for a scoped one with no camera to read.
|
|
172
|
+
*/
|
|
173
|
+
readonly area: BoundingBox | undefined;
|
|
174
|
+
/** How the round reaches the API: the configuration's `fetch` as it stood when it began. */
|
|
175
|
+
readonly ask: SearchFetch;
|
|
176
|
+
readonly branches: readonly SearchTargetName[];
|
|
177
|
+
readonly controller: AbortController;
|
|
178
|
+
/** The point results are ranked around, as the wire writes one. */
|
|
179
|
+
readonly focus: [number, number] | undefined;
|
|
180
|
+
/** Whether the round follows a pan: it swaps rows in place and never broadens. */
|
|
181
|
+
readonly isRefresh: boolean;
|
|
182
|
+
readonly onError: ((error: Error) => void) | undefined;
|
|
183
|
+
/** The query as a round asks it: trimmed. */
|
|
184
|
+
readonly query: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* pauseFrom reads one of the engine's pauses, refusing a value no timer keeps.
|
|
189
|
+
*
|
|
190
|
+
* @throws {MountayaElementsError} When the pause is not a finite number from 0 to
|
|
191
|
+
* {@link MAX_TIMER_MS}. A timer handed a `NaN`, a negative, an `Infinity` or an oversized delay
|
|
192
|
+
* fires at once, so the pause would hold nothing back while reading as a setting.
|
|
193
|
+
*/
|
|
194
|
+
const pauseFrom = (
|
|
195
|
+
option: "debounceMs" | "viewportRefreshMs",
|
|
196
|
+
pauseMs: number | undefined,
|
|
197
|
+
fallbackMs: number,
|
|
198
|
+
): number => {
|
|
199
|
+
if (pauseMs === undefined) {
|
|
200
|
+
return fallbackMs;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!Number.isFinite(pauseMs) || pauseMs < 0 || pauseMs > MAX_TIMER_MS) {
|
|
204
|
+
throw new MountayaElementsError(
|
|
205
|
+
`SearchEngine: ${option} is ${String(pauseMs)}; pass a number of milliseconds from 0 to ` +
|
|
206
|
+
`${MAX_TIMER_MS}, or omit it for ${fallbackMs}.`,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return pauseMs;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* configFrom reads the configuration a round is asked with: a branch listed twice is read once, in
|
|
215
|
+
* the place it is first listed, and a cap the API would refuse is refused.
|
|
216
|
+
*
|
|
217
|
+
* @throws {MountayaElementsError} When `limit` is not a whole number from 1 to
|
|
218
|
+
* {@link SEARCH_LIMIT_MAX}. Sent on, it is refused once per branch, as an error line in every
|
|
219
|
+
* section, by a round that did nothing wrong.
|
|
220
|
+
*/
|
|
221
|
+
const configFrom = (config: SearchConfig): SearchConfig => {
|
|
222
|
+
const { limit, targets } = config;
|
|
223
|
+
|
|
224
|
+
if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > SEARCH_LIMIT_MAX)) {
|
|
225
|
+
throw new MountayaElementsError(
|
|
226
|
+
`SearchEngine: limit is ${String(limit)}; pass a whole number from 1 to ` +
|
|
227
|
+
`${SEARCH_LIMIT_MAX}, or omit it for the API's default.`,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// A branch is one request and one section, so a branch listed twice is asked once: asked twice,
|
|
232
|
+
// it would pay for its answer twice and render two sections under one id. A `Set` keeps the
|
|
233
|
+
// order of first insertion, which is the place the branch is first listed.
|
|
234
|
+
return targets === undefined ? config : { ...config, targets: [...new Set(targets)] };
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* onlyTarget enables exactly one branch.
|
|
239
|
+
*
|
|
240
|
+
* Every branch is named rather than spread from a computed key, so a target added to the contract
|
|
241
|
+
* fails the build here instead of quietly never being asked for: a gap that would show up as a
|
|
242
|
+
* section that renders and is always empty.
|
|
243
|
+
*/
|
|
244
|
+
const onlyTarget = (target: SearchTargetName): Record<SearchTargetName, boolean> => ({
|
|
245
|
+
collections: target === "collections",
|
|
246
|
+
itineraries: target === "itineraries",
|
|
247
|
+
places: target === "places",
|
|
248
|
+
pois: target === "pois",
|
|
249
|
+
ways: target === "ways",
|
|
250
|
+
zones: target === "zones",
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
const loadingSection = (id: SearchTargetName): SearchSection => ({
|
|
254
|
+
id,
|
|
255
|
+
results: [],
|
|
256
|
+
state: { kind: "loading" },
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
/** What a failed branch states: its message, and the code and the detail where it holds them. */
|
|
260
|
+
interface SectionFailure {
|
|
261
|
+
readonly code?: string | undefined;
|
|
262
|
+
readonly detail?: string | undefined;
|
|
263
|
+
readonly message: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const errorSection = (id: SearchTargetName, failure: SectionFailure): SearchSection => ({
|
|
267
|
+
id,
|
|
268
|
+
results: [],
|
|
269
|
+
state: {
|
|
270
|
+
...(failure.code === undefined ? {} : { code: failure.code }),
|
|
271
|
+
...(failure.detail === undefined ? {} : { detail: failure.detail }),
|
|
272
|
+
kind: "error",
|
|
273
|
+
message: failure.message,
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const settledSection = (id: SearchTargetName, results: SearchRow[]): SearchSection => ({
|
|
278
|
+
id,
|
|
279
|
+
results,
|
|
280
|
+
state: { kind: "settled" },
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* The nothing-asked snapshot for a query: every section settled with nothing, and no round counted
|
|
285
|
+
* yet. It answers a blank query, and a query with no transport to ask it through.
|
|
286
|
+
*/
|
|
287
|
+
const emptySnapshot = (order: readonly SearchTargetName[], query: string): SearchSnapshot => ({
|
|
288
|
+
fallbackActive: false,
|
|
289
|
+
isSearching: false,
|
|
290
|
+
query,
|
|
291
|
+
roundsSettled: 0,
|
|
292
|
+
sections: order.map((id) => settledSection(id, [])),
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
/** The fresh-query snapshot: every section back to its skeleton, for the query the round asks. */
|
|
296
|
+
const loadingSnapshot = (order: readonly SearchTargetName[], query: string): SearchSnapshot => ({
|
|
297
|
+
fallbackActive: false,
|
|
298
|
+
isSearching: true,
|
|
299
|
+
query,
|
|
300
|
+
roundsSettled: 0,
|
|
301
|
+
sections: order.map(loadingSection),
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
/** True while a branch is in flight, which is what derives the whole search's busy flag. */
|
|
305
|
+
const isLoading = (state: SearchSectionState): boolean => state.kind === "loading";
|
|
306
|
+
|
|
307
|
+
/** A section that finished with nothing: the condition the broaden fallback reads. */
|
|
308
|
+
const isSettledEmpty = (section: SearchSection): boolean =>
|
|
309
|
+
section.state.kind === "settled" && section.results.length === 0;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* failureOf reads what a section keeps of the value a transport rejected with.
|
|
313
|
+
*
|
|
314
|
+
* The message is an `Error`'s own, and a fixed sentence for anything else. A `code` and a `detail`
|
|
315
|
+
* are kept where the value holds each as text: a transport over a tool bus rejects with the
|
|
316
|
+
* refusal, whose code and detail are what a surface words for a reader. The value is `unknown`
|
|
317
|
+
* because a `catch` hands over whatever was thrown.
|
|
318
|
+
*/
|
|
319
|
+
const failureOf = (error: unknown): SectionFailure => {
|
|
320
|
+
const held = typeof error === "object" && error !== null ? error : {};
|
|
321
|
+
|
|
322
|
+
return {
|
|
323
|
+
code: "code" in held && typeof held.code === "string" ? held.code : undefined,
|
|
324
|
+
detail: "detail" in held && typeof held.detail === "string" ? held.detail : undefined,
|
|
325
|
+
message: error instanceof Error ? error.message : "unexpected error",
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* mapTargetResult turns one branch's answer into its section.
|
|
331
|
+
*
|
|
332
|
+
* An error the API reported for this branch wins over whatever partial data came with it: the
|
|
333
|
+
* branches degrade independently, so a POI outage reports itself and leaves the itineraries beside
|
|
334
|
+
* it alone. The section holds the API's code beside its sentence, and no failure handler hears of
|
|
335
|
+
* it: the request did not fail, the API answered for that branch.
|
|
336
|
+
*/
|
|
337
|
+
const mapTargetResult = (
|
|
338
|
+
result: SearchResult,
|
|
339
|
+
target: SearchTargetName,
|
|
340
|
+
query: string,
|
|
341
|
+
wording: SearchWording | undefined,
|
|
342
|
+
): SearchSection => {
|
|
343
|
+
const reported = result.errors.find((entry) => entry.target === target.toUpperCase());
|
|
344
|
+
|
|
345
|
+
if (reported !== undefined) {
|
|
346
|
+
return errorSection(target, { code: reported.code, message: reported.message });
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
switch (target) {
|
|
350
|
+
case "places": {
|
|
351
|
+
const rows = (result.places?.places ?? [])
|
|
352
|
+
.map((place) => placeRow(place, query, wording))
|
|
353
|
+
.filter((row): row is SearchRow => row !== null);
|
|
354
|
+
|
|
355
|
+
return settledSection(target, rows);
|
|
356
|
+
}
|
|
357
|
+
case "pois": {
|
|
358
|
+
const rows = (result.pois?.pois ?? [])
|
|
359
|
+
.map((poi) => poiRow(poi, query, wording))
|
|
360
|
+
.filter((row): row is SearchRow => row !== null);
|
|
361
|
+
|
|
362
|
+
return settledSection(target, rows);
|
|
363
|
+
}
|
|
364
|
+
case "ways": {
|
|
365
|
+
const rows = (result.ways?.ways ?? [])
|
|
366
|
+
.map((way) => wayRow(way, query, wording))
|
|
367
|
+
.filter((row): row is SearchRow => row !== null);
|
|
368
|
+
|
|
369
|
+
return settledSection(target, rows);
|
|
370
|
+
}
|
|
371
|
+
case "itineraries": {
|
|
372
|
+
const rows = (result.itineraries?.itineraries ?? [])
|
|
373
|
+
.map((itinerary) => itineraryRow(itinerary, query))
|
|
374
|
+
.filter((row): row is SearchRow => row !== null);
|
|
375
|
+
|
|
376
|
+
return settledSection(target, rows);
|
|
377
|
+
}
|
|
378
|
+
case "collections": {
|
|
379
|
+
const rows = (result.collections?.collections ?? [])
|
|
380
|
+
.map((collection) => collectionRow(collection, query))
|
|
381
|
+
.filter((row): row is SearchRow => row !== null);
|
|
382
|
+
|
|
383
|
+
return settledSection(target, rows);
|
|
384
|
+
}
|
|
385
|
+
case "zones": {
|
|
386
|
+
const rows = (result.zones?.zones ?? [])
|
|
387
|
+
.map((zone) => zoneRow(zone, query))
|
|
388
|
+
.filter((row): row is SearchRow => row !== null);
|
|
389
|
+
|
|
390
|
+
return settledSection(target, rows);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* The whole of a search: debounce, per-branch fan-out, the abort discipline, the broaden
|
|
397
|
+
* fallback, and the snapshot a renderer draws.
|
|
398
|
+
*
|
|
399
|
+
* Every part of it is a state machine rather than framework work (a ref is a field, an effect is
|
|
400
|
+
* a command), and the subtleties it records (a stale round's write being gated on still owning
|
|
401
|
+
* the slot, a pan swapping rows in place rather than reseeding a skeleton, the broaden happening
|
|
402
|
+
* once and never on a pan) are decisions about search BEHAVIOUR that a Vue or Svelte binding
|
|
403
|
+
* would otherwise rediscover by reading a hook and reimplementing it.
|
|
404
|
+
*
|
|
405
|
+
* So the machine is here and a hook is a binding over it. `getSnapshot` and `subscribe` are
|
|
406
|
+
* `useSyncExternalStore`'s two arguments exactly; the commands are what a surface calls. Nothing in
|
|
407
|
+
* this file imports a framework, and `./search` is renderer-free, so this is reachable from a
|
|
408
|
+
* command palette, a server-side suggester, or a package whose barrel reaches files that never
|
|
409
|
+
* draw a map.
|
|
410
|
+
*
|
|
411
|
+
* Four things here are less obvious than they look, and each of them shows on screen when it
|
|
412
|
+
* breaks:
|
|
413
|
+
*
|
|
414
|
+
* - **Every write is gated on the round still being the live one.** `signal.aborted` catches most
|
|
415
|
+
* stale landings; comparing the controller closes the window between a new round claiming the
|
|
416
|
+
* slot and the old signal flipping on the same tick.
|
|
417
|
+
* - **`roundsSettled` rather than "everything settled and empty".** An area-scoped round that finds
|
|
418
|
+
* nothing broadens and asks again, and between round one settling and round two reseeding there
|
|
419
|
+
* is a frame where every section is settled and empty. A renderer branching on that paints
|
|
420
|
+
* "nothing found" and takes it back.
|
|
421
|
+
* - **A move refresh does not reseed.** Panning swaps rows in place, so the list never flashes a
|
|
422
|
+
* skeleton under the pointer, which means no section is ever `loading` during a refresh, which
|
|
423
|
+
* is why the busy flag is held separately for the length of the round instead.
|
|
424
|
+
* - **The broaden happens once, and never on a pan.** A user panning is looking somewhere on
|
|
425
|
+
* purpose; yanking the list out to nearby matches takes that away from them.
|
|
426
|
+
*
|
|
427
|
+
* A round's skeleton is published as the round starts, and its requests leave once the task that
|
|
428
|
+
* started it has run to its end. So a command later in the same task that replaces the round (a
|
|
429
|
+
* second {@link SearchEngine.configure}, StrictMode's teardown and set-up) abandons it before it
|
|
430
|
+
* sends anything, and only the round that replaced it asks.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```ts
|
|
434
|
+
* import { SearchEngine, type SearchFetch, type SearchSnapshot } from "@mountaya/elements/search";
|
|
435
|
+
*
|
|
436
|
+
* declare const transport: SearchFetch;
|
|
437
|
+
* declare const render: (snapshot: SearchSnapshot) => void;
|
|
438
|
+
*
|
|
439
|
+
* const search = new SearchEngine({ fetch: transport });
|
|
440
|
+
* const release = search.subscribe(() => render(search.getSnapshot()));
|
|
441
|
+
*
|
|
442
|
+
* search.setQuery("chamonix");
|
|
443
|
+
* release();
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
export class SearchEngine {
|
|
447
|
+
private config: SearchConfig;
|
|
448
|
+
private readonly debounceMs: number;
|
|
449
|
+
private readonly viewportRefreshMs: number;
|
|
450
|
+
|
|
451
|
+
private snapshot: SearchSnapshot;
|
|
452
|
+
private readonly listeners = new Set<() => void>();
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Whether anything is watching. An engine with no listener does no work: see
|
|
456
|
+
* {@link SearchEngine.subscribe} for why that is the lifecycle rather than a method pair.
|
|
457
|
+
*/
|
|
458
|
+
private parked = true;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* The cleared snapshot, cached so that clearing twice is the same object and {@link commit}
|
|
462
|
+
* recognises it as no change. A resume re-derives the snapshot unconditionally, so without this
|
|
463
|
+
* every mount of an empty search box would hand its renderer a new, identical object.
|
|
464
|
+
*/
|
|
465
|
+
private cleared: SearchSnapshot | null = null;
|
|
466
|
+
private clearedKey = "";
|
|
467
|
+
|
|
468
|
+
/** The query as typed, and the query a round has actually been fired for. */
|
|
469
|
+
private query = "";
|
|
470
|
+
private debounced = "";
|
|
471
|
+
private debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
472
|
+
|
|
473
|
+
private open = false;
|
|
474
|
+
private viewportScope = false;
|
|
475
|
+
|
|
476
|
+
/** Bumped by a settled camera change, and by a retry, which is how a round is told to re-run. */
|
|
477
|
+
private viewportNonce = 0;
|
|
478
|
+
private retryNonce = 0;
|
|
479
|
+
|
|
480
|
+
private run: AbortController | null = null;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* The key of the last round and the nonce it ran at. A round counts as a move refresh only when
|
|
484
|
+
* the key is unchanged AND the nonce advanced: the pairing is what identifies a real pan.
|
|
485
|
+
*/
|
|
486
|
+
private lastKey = "";
|
|
487
|
+
private lastNonce = 0;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Marks an in-flight refresh. No section is ever `loading` during one, so the busy flag cannot be
|
|
491
|
+
* derived from the sections; without this a branch that empties mid-refresh would flip the flag
|
|
492
|
+
* off and trip a renderer's empty state for a frame.
|
|
493
|
+
*/
|
|
494
|
+
private refreshing = false;
|
|
495
|
+
|
|
496
|
+
/** The camera subscription, live only while a live area-scoped search could use it. */
|
|
497
|
+
private cameraUnsubscribe: SearchUnsubscribe | null = null;
|
|
498
|
+
/** Which viewport that subscription is against, so a replaced seam rebinds rather than sticks. */
|
|
499
|
+
private cameraSource: SearchViewport | null = null;
|
|
500
|
+
private cameraTimer: ReturnType<typeof setTimeout> | null = null;
|
|
501
|
+
|
|
502
|
+
private disposed = false;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Constructing one has no effect beyond holding the options: no timer, no request, no
|
|
506
|
+
* subscription. A React binding constructs during a render that React is free to throw away,
|
|
507
|
+
* and a constructor with a side effect would leave the discarded copy running.
|
|
508
|
+
*
|
|
509
|
+
* @throws {MountayaElementsError} When `debounceMs`, `viewportRefreshMs` or `limit` is outside
|
|
510
|
+
* the range its docblock states, naming the option and the value.
|
|
511
|
+
*/
|
|
512
|
+
constructor(options: SearchEngineOptions) {
|
|
513
|
+
const { debounceMs, open, query, viewportRefreshMs, viewportScope, ...config } = options;
|
|
514
|
+
this.config = configFrom(config);
|
|
515
|
+
this.debounceMs = pauseFrom("debounceMs", debounceMs, SEARCH_DEBOUNCE_MS);
|
|
516
|
+
this.viewportRefreshMs = pauseFrom(
|
|
517
|
+
"viewportRefreshMs",
|
|
518
|
+
viewportRefreshMs,
|
|
519
|
+
SEARCH_VIEWPORT_REFRESH_MS,
|
|
520
|
+
);
|
|
521
|
+
// The state a surface already holds, taken up front rather than commanded in afterwards. A
|
|
522
|
+
// surface mounting with a scoped, open search and a query in the box would otherwise fire its
|
|
523
|
+
// first round unscoped and correct itself with a second: two fan-outs for one mount, the first
|
|
524
|
+
// of them asking the wrong question.
|
|
525
|
+
this.open = open ?? false;
|
|
526
|
+
this.viewportScope = viewportScope ?? false;
|
|
527
|
+
this.query = query ?? "";
|
|
528
|
+
this.debounced = this.query;
|
|
529
|
+
this.snapshot = this.clearedSnapshot();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// -----------------------------------------------------------------------------------------
|
|
533
|
+
// State
|
|
534
|
+
// -----------------------------------------------------------------------------------------
|
|
535
|
+
|
|
536
|
+
/** getSnapshot returns the current snapshot, by reference and stable between changes. */
|
|
537
|
+
getSnapshot(): SearchSnapshot {
|
|
538
|
+
return this.snapshot;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* subscribe registers a listener for every change, and returns its own unsubscribe.
|
|
543
|
+
*
|
|
544
|
+
* **The listeners are the lifecycle.** A round fires when there is a query, a transport and
|
|
545
|
+
* somebody to show the answer to; dropping the last listener aborts the round and releases the
|
|
546
|
+
* camera, and subscribing again re-asks. That is what a search with nobody watching should do
|
|
547
|
+
* anyway, and it is the only teardown a React binding can express correctly: React tears an
|
|
548
|
+
* effect down and sets it up again with the same object under StrictMode, so a latch here would
|
|
549
|
+
* leave a live surface bound to a dead engine. {@link SearchEngine.dispose} is the latch,
|
|
550
|
+
* for an owner that is not a component.
|
|
551
|
+
*
|
|
552
|
+
* The park is immediate, because the guarantee it carries is that the request does not outlive
|
|
553
|
+
* the surface that asked for it. A teardown followed by a set-up (StrictMode's double-invoke)
|
|
554
|
+
* therefore parks and resumes, which starts the round again; done in one task, the pair sends
|
|
555
|
+
* one round's requests, since the round the teardown abandons has sent none yet.
|
|
556
|
+
*
|
|
557
|
+
* **A binding must hand its framework a stable `subscribe`.** A fresh closure per render
|
|
558
|
+
* unsubscribes and re-subscribes on every one, and with the lifecycle on this method that is a
|
|
559
|
+
* round aborted and re-fired per render.
|
|
560
|
+
*
|
|
561
|
+
* **A listener that throws stops nothing.** Every listener is told of every change, the round
|
|
562
|
+
* runs to its end, and no command throws what a listener threw: the first fault of a
|
|
563
|
+
* notification reaches the runtime as an uncaught error, on a microtask.
|
|
564
|
+
*/
|
|
565
|
+
subscribe(listener: () => void): () => void {
|
|
566
|
+
// A disposed engine publishes nothing, so it keeps no listener to hold a surface alive by.
|
|
567
|
+
if (this.disposed) {
|
|
568
|
+
return () => {};
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
this.listeners.add(listener);
|
|
572
|
+
|
|
573
|
+
if (this.parked) {
|
|
574
|
+
this.parked = false;
|
|
575
|
+
this.resume();
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
return () => {
|
|
579
|
+
this.listeners.delete(listener);
|
|
580
|
+
|
|
581
|
+
if (this.listeners.size > 0 || this.parked) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
this.parked = true;
|
|
586
|
+
this.park();
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// -----------------------------------------------------------------------------------------
|
|
591
|
+
// Commands
|
|
592
|
+
// -----------------------------------------------------------------------------------------
|
|
593
|
+
|
|
594
|
+
/** setQuery states what the user has typed. Debounced: a round fires once the typing pauses. */
|
|
595
|
+
setQuery(query: string): void {
|
|
596
|
+
if (this.disposed || this.query === query) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
this.query = query;
|
|
601
|
+
|
|
602
|
+
if (this.debounceTimer !== null) {
|
|
603
|
+
clearTimeout(this.debounceTimer);
|
|
604
|
+
this.debounceTimer = null;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
if (this.debounceMs <= 0) {
|
|
608
|
+
this.settleQuery(query);
|
|
609
|
+
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
this.debounceTimer = setTimeout(() => {
|
|
614
|
+
this.debounceTimer = null;
|
|
615
|
+
this.settleQuery(query);
|
|
616
|
+
}, this.debounceMs);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* setOpen states whether the results are being looked at.
|
|
621
|
+
*
|
|
622
|
+
* It gates the live area refresh alone (a closed list does not re-run on a pan), so it changes no
|
|
623
|
+
* snapshot by itself. Closing mid-round leaves the round to land: a user who reopens should not
|
|
624
|
+
* wait for work that was already paid for.
|
|
625
|
+
*/
|
|
626
|
+
setOpen(open: boolean): void {
|
|
627
|
+
if (this.disposed || this.open === open) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
this.open = open;
|
|
632
|
+
this.syncCameraSubscription();
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* setViewportScope states whether the round is restricted to what is on screen.
|
|
637
|
+
*
|
|
638
|
+
* A real round, not a refresh: scoping is the user changing what they asked for, so the skeleton
|
|
639
|
+
* reseeds rather than the rows swapping in place.
|
|
640
|
+
*/
|
|
641
|
+
setViewportScope(scoped: boolean): void {
|
|
642
|
+
if (this.disposed || this.viewportScope === scoped) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
this.viewportScope = scoped;
|
|
647
|
+
this.syncCameraSubscription();
|
|
648
|
+
this.schedule();
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* configure replaces the seams and the round's parameters.
|
|
653
|
+
*
|
|
654
|
+
* All of them, mid-life, because a binding's caller passes them inline: an application rendering
|
|
655
|
+
* the surface re-creates the `fetch` closure and the error handler every render, and an engine
|
|
656
|
+
* that re-ran a round on each of those would never settle. What triggers a round is the round's
|
|
657
|
+
* own PARAMETERS changing (language, limit, targets, whether a transport exists at all), and the
|
|
658
|
+
* key below is what tells those from the rest.
|
|
659
|
+
*
|
|
660
|
+
* @throws {MountayaElementsError} When `limit` is outside the range its docblock states. The
|
|
661
|
+
* configuration it arrived in replaces nothing.
|
|
662
|
+
*/
|
|
663
|
+
configure(config: SearchConfig): void {
|
|
664
|
+
if (this.disposed) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const before = this.roundKey();
|
|
669
|
+
this.config = configFrom(config);
|
|
670
|
+
this.syncCameraSubscription();
|
|
671
|
+
|
|
672
|
+
if (this.roundKey() !== before) {
|
|
673
|
+
this.schedule();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** retry re-runs the current query from the top: what a failed section's retry is wired to. */
|
|
678
|
+
retry(): void {
|
|
679
|
+
if (this.disposed) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
this.retryNonce += 1;
|
|
684
|
+
this.schedule();
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* dispose aborts the round, drops every timer and listener, and releases the camera.
|
|
689
|
+
*
|
|
690
|
+
* Idempotent. After it, a command is a no-op rather than an error: a binding torn down mid-typing
|
|
691
|
+
* should not have to guard every call it already queued. No command arms a timer, {@link
|
|
692
|
+
* configure} refuses nothing, and {@link subscribe} keeps no listener and answers an unsubscribe
|
|
693
|
+
* that does nothing.
|
|
694
|
+
*/
|
|
695
|
+
dispose(): void {
|
|
696
|
+
if (this.disposed) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
this.disposed = true;
|
|
700
|
+
this.parked = true;
|
|
701
|
+
this.park();
|
|
702
|
+
|
|
703
|
+
if (this.debounceTimer !== null) {
|
|
704
|
+
clearTimeout(this.debounceTimer);
|
|
705
|
+
this.debounceTimer = null;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
this.listeners.clear();
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// -----------------------------------------------------------------------------------------
|
|
712
|
+
// Internals
|
|
713
|
+
// -----------------------------------------------------------------------------------------
|
|
714
|
+
|
|
715
|
+
private get order(): readonly SearchTargetName[] {
|
|
716
|
+
return this.config.targets ?? SEARCH_TARGETS;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* park drops everything outstanding: the round, the camera listener, the pending refresh.
|
|
721
|
+
*
|
|
722
|
+
* The typing pause is deliberately left armed. It writes no snapshot while parked ({@link
|
|
723
|
+
* schedule} is the gate), so letting it land keeps `debounced` honest about what was typed,
|
|
724
|
+
* which is what a resume then asks for.
|
|
725
|
+
*/
|
|
726
|
+
private park(): void {
|
|
727
|
+
this.run?.abort();
|
|
728
|
+
this.run = null;
|
|
729
|
+
this.refreshing = false;
|
|
730
|
+
this.releaseCamera();
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* resume re-asks for whatever the parked engine was told while nobody was watching.
|
|
735
|
+
*
|
|
736
|
+
* The round reseeds rather than swapping rows in place: the key is cleared first, so a resumed
|
|
737
|
+
* round cannot be mistaken for a pan by the refresh test in {@link schedule}.
|
|
738
|
+
*/
|
|
739
|
+
private resume(): void {
|
|
740
|
+
this.syncCameraSubscription();
|
|
741
|
+
this.lastKey = "";
|
|
742
|
+
this.schedule();
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* The cleared snapshot for the current branch order and settled query, by identity across calls.
|
|
747
|
+
*
|
|
748
|
+
* Keyed on the order because the branches are a seam a caller can replace, and the sections a
|
|
749
|
+
* cleared snapshot carries are one per branch; and on the query, because a cleared snapshot
|
|
750
|
+
* names the query it answers with nothing.
|
|
751
|
+
*/
|
|
752
|
+
private clearedSnapshot(): SearchSnapshot {
|
|
753
|
+
const branches = this.order;
|
|
754
|
+
const query = this.debounced.trim();
|
|
755
|
+
const key = `${branches.join(",")}\0${query}`;
|
|
756
|
+
|
|
757
|
+
if (this.cleared === null || this.clearedKey !== key) {
|
|
758
|
+
this.cleared = emptySnapshot(branches, query);
|
|
759
|
+
this.clearedKey = key;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return this.cleared;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* The round's identity: everything a change to means a FRESH round rather than a refresh.
|
|
767
|
+
*
|
|
768
|
+
* A retry belongs in it: it is a fresh round by intent, so it must reseed the skeleton rather
|
|
769
|
+
* than swap rows in place the way a pan does.
|
|
770
|
+
*/
|
|
771
|
+
private roundKey(): string {
|
|
772
|
+
return [
|
|
773
|
+
this.debounced.trim(),
|
|
774
|
+
this.viewportScope,
|
|
775
|
+
this.config.language ?? "",
|
|
776
|
+
this.config.limit ?? "",
|
|
777
|
+
this.order.join(","),
|
|
778
|
+
this.config.fetch === undefined ? "inert" : "live",
|
|
779
|
+
this.retryNonce,
|
|
780
|
+
this.config.wording?.units?.language ?? "",
|
|
781
|
+
this.config.wording?.units?.length ?? "",
|
|
782
|
+
].join("\0");
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* commit replaces the snapshot and tells every listener, skipping a snapshot already held.
|
|
787
|
+
*
|
|
788
|
+
* It never throws: every listener is told through {@link notifyListeners}, which surfaces the
|
|
789
|
+
* first fault one of them throws once they all have been. A round, a timer and a command
|
|
790
|
+
* therefore run to their own end whatever a listener does.
|
|
791
|
+
*/
|
|
792
|
+
private commit(snapshot: SearchSnapshot): void {
|
|
793
|
+
// The identity check is what makes clearing idempotent, and clearing has to be: a resume
|
|
794
|
+
// re-derives unconditionally, and a renderer comparing snapshots by reference (every one
|
|
795
|
+
// React drives does) would otherwise re-render on every mount of an empty search box.
|
|
796
|
+
if (this.disposed || snapshot === this.snapshot) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
this.snapshot = snapshot;
|
|
801
|
+
|
|
802
|
+
notifyListeners(this.listeners);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
private settleQuery(query: string): void {
|
|
806
|
+
const asked = this.debounced.trim();
|
|
807
|
+
this.debounced = query;
|
|
808
|
+
|
|
809
|
+
// A round asks the trimmed query and a snapshot names it, so white space typed around the
|
|
810
|
+
// query already settled is the same question: no round, and no skeleton over its answer.
|
|
811
|
+
if (query.trim() === asked) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
this.syncCameraSubscription();
|
|
816
|
+
this.schedule();
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* The camera listener exists only while every condition for a live area refresh holds.
|
|
821
|
+
*
|
|
822
|
+
* A closed, unscoped, query-less or transport-less search carries no listener at all. The
|
|
823
|
+
* transport is part of that: a caller who wires a viewport but no fetch would otherwise wake a
|
|
824
|
+
* search that can never answer, once per settled pan, forever.
|
|
825
|
+
*/
|
|
826
|
+
private syncCameraSubscription(): void {
|
|
827
|
+
const source = this.config.viewport;
|
|
828
|
+
const live =
|
|
829
|
+
!this.disposed &&
|
|
830
|
+
!this.parked &&
|
|
831
|
+
this.config.fetch !== undefined &&
|
|
832
|
+
source !== undefined &&
|
|
833
|
+
this.open &&
|
|
834
|
+
this.viewportScope &&
|
|
835
|
+
this.debounced.trim().length > 0;
|
|
836
|
+
|
|
837
|
+
if (!live) {
|
|
838
|
+
this.releaseCamera();
|
|
839
|
+
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
if (this.cameraUnsubscribe !== null) {
|
|
844
|
+
if (this.cameraSource === source) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
this.releaseCamera();
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
this.cameraSource = source;
|
|
852
|
+
this.cameraUnsubscribe = source.subscribe(() => {
|
|
853
|
+
if (this.cameraTimer !== null) {
|
|
854
|
+
clearTimeout(this.cameraTimer);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
this.cameraTimer = setTimeout(() => {
|
|
858
|
+
this.cameraTimer = null;
|
|
859
|
+
this.viewportNonce += 1;
|
|
860
|
+
this.schedule();
|
|
861
|
+
}, this.viewportRefreshMs);
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
private releaseCamera(): void {
|
|
866
|
+
if (this.cameraTimer !== null) {
|
|
867
|
+
clearTimeout(this.cameraTimer);
|
|
868
|
+
this.cameraTimer = null;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
this.cameraUnsubscribe?.();
|
|
872
|
+
this.cameraUnsubscribe = null;
|
|
873
|
+
this.cameraSource = null;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/** schedule starts a round, or clears to empty when there is nothing to ask. */
|
|
877
|
+
private schedule(): void {
|
|
878
|
+
if (this.disposed || this.parked) {
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
const trimmed = this.debounced.trim();
|
|
883
|
+
const { fetch: run, onError } = this.config;
|
|
884
|
+
const branches = this.order;
|
|
885
|
+
|
|
886
|
+
if (run === undefined || trimmed.length === 0) {
|
|
887
|
+
this.run?.abort();
|
|
888
|
+
this.run = null;
|
|
889
|
+
this.lastKey = "";
|
|
890
|
+
// Clearing the query is the one way out of a refresh that reaches neither settlement below,
|
|
891
|
+
// since both sit behind a liveness check the abort above has just falsified.
|
|
892
|
+
this.refreshing = false;
|
|
893
|
+
this.commit(this.clearedSnapshot());
|
|
894
|
+
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
const controller = new AbortController();
|
|
899
|
+
this.run?.abort();
|
|
900
|
+
this.run = controller;
|
|
901
|
+
|
|
902
|
+
const key = this.roundKey();
|
|
903
|
+
const isRefresh = key === this.lastKey && this.viewportNonce !== this.lastNonce;
|
|
904
|
+
this.lastKey = key;
|
|
905
|
+
this.lastNonce = this.viewportNonce;
|
|
906
|
+
this.refreshing = isRefresh;
|
|
907
|
+
|
|
908
|
+
// A refresh keeps the snapshot's query: it runs only while the round's key, the trimmed query
|
|
909
|
+
// among it, is unchanged.
|
|
910
|
+
if (isRefresh) {
|
|
911
|
+
this.commit({ ...this.snapshot, fallbackActive: false, isSearching: true });
|
|
912
|
+
} else {
|
|
913
|
+
this.commit(loadingSnapshot(branches, trimmed));
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// The camera gives a centre and a zoom; an area-scoped round approximates the square that
|
|
917
|
+
// covers, so the API can prune by area. The focus stays the centre either way, so ranking biases
|
|
918
|
+
// toward what the user is looking at even when the search is not restricted to it. The centre
|
|
919
|
+
// goes out as the wire writes a point, and a camera that names none is one with nothing to
|
|
920
|
+
// read: it scopes nothing and ranks around nothing.
|
|
921
|
+
const camera = this.config.viewport?.read() ?? null;
|
|
922
|
+
const focus = camera === null ? undefined : searchFocus(camera.center);
|
|
923
|
+
const area =
|
|
924
|
+
this.viewportScope && camera !== null && focus !== undefined && Number.isFinite(camera.zoom)
|
|
925
|
+
? viewportBoundsFrom(camera.center, camera.zoom)
|
|
926
|
+
: undefined;
|
|
927
|
+
|
|
928
|
+
void this.runRound({
|
|
929
|
+
area,
|
|
930
|
+
ask: run,
|
|
931
|
+
branches,
|
|
932
|
+
controller,
|
|
933
|
+
focus,
|
|
934
|
+
isRefresh,
|
|
935
|
+
onError,
|
|
936
|
+
query: trimmed,
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/** Whether `round` still owns the slot: no later round claimed it and nothing aborted it. */
|
|
941
|
+
private isLive(round: SearchRound): boolean {
|
|
942
|
+
return this.run === round.controller && !round.controller.signal.aborted;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/** replaceSection writes one branch's section into the snapshot, while its round is live. */
|
|
946
|
+
private replaceSection(round: SearchRound, next: SearchSection): void {
|
|
947
|
+
if (!this.isLive(round)) {
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
const sections = this.snapshot.sections.map((section) =>
|
|
952
|
+
section.id === next.id ? next : section,
|
|
953
|
+
);
|
|
954
|
+
const stillSearching = this.refreshing || sections.some((s) => isLoading(s.state));
|
|
955
|
+
|
|
956
|
+
this.commit({ ...this.snapshot, isSearching: stillSearching, sections });
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* askBranches sends one request per branch of `round`, restricted to `area` when there is one,
|
|
961
|
+
* and writes each section as its answer lands.
|
|
962
|
+
*
|
|
963
|
+
* The requests leave once the current task has run to its end, and only while the round is
|
|
964
|
+
* still the live one, so a round that a later command of that task replaced sends nothing. It
|
|
965
|
+
* resolves once every branch has answered or failed, at once for a round replaced before its
|
|
966
|
+
* requests left, and never rejects: a branch that fails fills its own section and is counted in
|
|
967
|
+
* `hadError`.
|
|
968
|
+
*/
|
|
969
|
+
private async askBranches(
|
|
970
|
+
round: SearchRound,
|
|
971
|
+
area: BoundingBox | undefined,
|
|
972
|
+
): Promise<{ everyEmpty: boolean; hadError: boolean }> {
|
|
973
|
+
// A microtask rather than a timer: the requests still leave before any timer or event the
|
|
974
|
+
// host has queued, and a command later in the task (a second `configure`, StrictMode's
|
|
975
|
+
// teardown and set-up) has had its say. An `await` rather than `queueMicrotask`, a global a
|
|
976
|
+
// host or a test can replace.
|
|
977
|
+
await Promise.resolve();
|
|
978
|
+
|
|
979
|
+
if (!this.isLive(round)) {
|
|
980
|
+
return { everyEmpty: false, hadError: false };
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const { signal } = round.controller;
|
|
984
|
+
const calls = round.branches.map(async (target) => {
|
|
985
|
+
const request: DataSchema.SearchInput = {
|
|
986
|
+
bbox: area === undefined ? undefined : [...area],
|
|
987
|
+
focus: round.focus === undefined ? undefined : [...round.focus],
|
|
988
|
+
language: this.config.language,
|
|
989
|
+
limit: this.config.limit,
|
|
990
|
+
query: round.query,
|
|
991
|
+
targets: onlyTarget(target),
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
try {
|
|
995
|
+
const result = await round.ask(request, { signal });
|
|
996
|
+
|
|
997
|
+
if (!this.isLive(round)) {
|
|
998
|
+
return { errored: true };
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
this.replaceSection(
|
|
1002
|
+
round,
|
|
1003
|
+
mapTargetResult(result, target, round.query, this.config.wording),
|
|
1004
|
+
);
|
|
1005
|
+
|
|
1006
|
+
return { errored: false };
|
|
1007
|
+
} catch (error) {
|
|
1008
|
+
if (!this.isLive(round)) {
|
|
1009
|
+
return { errored: true };
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// The section is written before the host hears of the failure, so it reads its error
|
|
1013
|
+
// whatever the handler does. A handler that throws is the host's own fault, handed to the
|
|
1014
|
+
// runtime on a microtask, and the branch settles as the failure it already is.
|
|
1015
|
+
this.replaceSection(round, errorSection(target, failureOf(error)));
|
|
1016
|
+
|
|
1017
|
+
try {
|
|
1018
|
+
round.onError?.(
|
|
1019
|
+
errorFrom(
|
|
1020
|
+
error,
|
|
1021
|
+
"A search request failed. Check what the search transport rejects with.",
|
|
1022
|
+
),
|
|
1023
|
+
);
|
|
1024
|
+
} catch (fault) {
|
|
1025
|
+
surfaceFault(fault);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
return { errored: true };
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
const settled = await Promise.allSettled(calls);
|
|
1033
|
+
const hadError = settled.some(
|
|
1034
|
+
(entry) =>
|
|
1035
|
+
entry.status === "rejected" || (entry.status === "fulfilled" && entry.value.errored),
|
|
1036
|
+
);
|
|
1037
|
+
|
|
1038
|
+
return { everyEmpty: this.snapshot.sections.every(isSettledEmpty), hadError };
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* runRound asks a round's branches and settles the snapshot, asking once more with no area when
|
|
1043
|
+
* a scoped round found nothing.
|
|
1044
|
+
*
|
|
1045
|
+
* Every write is gated on the round still being the live one, so a round a later one replaced
|
|
1046
|
+
* runs to its end and changes nothing.
|
|
1047
|
+
*/
|
|
1048
|
+
private async runRound(round: SearchRound): Promise<void> {
|
|
1049
|
+
const first = await this.askBranches(round, round.area);
|
|
1050
|
+
|
|
1051
|
+
if (!this.isLive(round)) {
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// Only a scoped round that came back cleanly empty broadens, and only when it was not a pan.
|
|
1056
|
+
// The counter is bumped after the LAST round that will run, so a renderer's empty state cannot
|
|
1057
|
+
// appear between the two.
|
|
1058
|
+
const willBroaden =
|
|
1059
|
+
!round.isRefresh && round.area !== undefined && first.everyEmpty && !first.hadError;
|
|
1060
|
+
|
|
1061
|
+
if (!willBroaden) {
|
|
1062
|
+
this.refreshing = false;
|
|
1063
|
+
this.commit({
|
|
1064
|
+
...this.snapshot,
|
|
1065
|
+
isSearching: false,
|
|
1066
|
+
roundsSettled: this.snapshot.roundsSettled + 1,
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// The scoped round settled empty, which is what sent us here, so it counts.
|
|
1073
|
+
this.commit({
|
|
1074
|
+
...this.snapshot,
|
|
1075
|
+
fallbackActive: true,
|
|
1076
|
+
isSearching: true,
|
|
1077
|
+
roundsSettled: this.snapshot.roundsSettled + 1,
|
|
1078
|
+
sections: round.branches.map(loadingSection),
|
|
1079
|
+
});
|
|
1080
|
+
await this.askBranches(round, undefined);
|
|
1081
|
+
|
|
1082
|
+
if (!this.isLive(round)) {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
this.refreshing = false;
|
|
1087
|
+
this.commit({
|
|
1088
|
+
...this.snapshot,
|
|
1089
|
+
isSearching: false,
|
|
1090
|
+
roundsSettled: this.snapshot.roundsSettled + 1,
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
}
|