@rr0/ufoathome 0.192.1 → 0.193.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.
Files changed (382) hide show
  1. package/dist-embed-interview/rr0-interview.mjs +3 -3
  2. package/dist-embed-scene/rr0-scene.mjs +306 -306
  3. package/dist-embed-sighting/{CaseReportExport-BW8-bkTQ.js → CaseReportExport-CYeoYzU0.js} +1 -1
  4. package/dist-embed-sighting/rr0-sighting.mjs +344 -329
  5. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-BrZzIuec.js → AdsbLolArchiveProvider--KjPxNqw.js} +1 -1
  6. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-CXvIvYxV.js → BallesterGuaspAssessor-BTmq0r-G.js} +1 -1
  7. package/dist-embed-sighting-editor/{BeamEditor-5-OlhNfL.js → BeamEditor-CI8-9VOc.js} +1 -1
  8. package/dist-embed-sighting-editor/{BeamSystem-BGdR-Xez.js → BeamSystem-odg570aR.js} +1 -1
  9. package/dist-embed-sighting-editor/BirdEditor-DV3ndYff.js +16 -0
  10. package/dist-embed-sighting-editor/{BirdFlock-DtshFXGT.js → BirdFlock-O7K_g8y7.js} +1 -1
  11. package/dist-embed-sighting-editor/{BodyEditor-Dn5HrH2t.js → BodyEditor-COLTBHzX.js} +1 -1
  12. package/dist-embed-sighting-editor/{CaseEditorMessages_en-DrJY0M8h.js → CaseEditorMessages_en-CoFukfwf.js} +1 -1
  13. package/dist-embed-sighting-editor/{CaseEditorMessages_es-j8EeOBq6.js → CaseEditorMessages_es-DZptbzB7.js} +1 -1
  14. package/dist-embed-sighting-editor/{CaseEditorMessages_fr-BkwEF9mu.js → CaseEditorMessages_fr-DXl2GNmR.js} +1 -1
  15. package/dist-embed-sighting-editor/{CaseEditorMessages_it-d3Z0PBEw.js → CaseEditorMessages_it-ss10VmRM.js} +1 -1
  16. package/dist-embed-sighting-editor/CaseElement-Bo31UxpS.js +100 -0
  17. package/dist-embed-sighting-editor/CaseMessages_en-BbbbikHH.js +1 -0
  18. package/dist-embed-sighting-editor/CaseMessages_es-AHBxl8Ka.js +1 -0
  19. package/dist-embed-sighting-editor/CaseMessages_fr-CD33PQCH.js +1 -0
  20. package/dist-embed-sighting-editor/CaseMessages_it-DyMACGSU.js +1 -0
  21. package/dist-embed-sighting-editor/{CaseReportExport-BfQWru8L.js → CaseReportExport-DpsJ5_r9.js} +2 -2
  22. package/dist-embed-sighting-editor/{ContrailSystem-BTVyJpmn.js → ContrailSystem-BddkU7fj.js} +1 -1
  23. package/dist-embed-sighting-editor/{ControlPasses-DiQAXMzD.js → ControlPasses-CNlCUT1L.js} +1 -1
  24. package/dist-embed-sighting-editor/{CoverageAssessor-CJQzNdyr.js → CoverageAssessor-DjY8iKp5.js} +1 -1
  25. package/dist-embed-sighting-editor/DroneEditor-DRsM2ash.js +16 -0
  26. package/dist-embed-sighting-editor/{DroneFlight-tXCk1Tg1.js → DroneFlight-Fr4Vgso3.js} +1 -1
  27. package/dist-embed-sighting-editor/{Flightradar24Provider-DUVcPAF2.js → Flightradar24Provider-BxeduRam.js} +1 -1
  28. package/dist-embed-sighting-editor/GLTFLoader-C6nlGTTi.js +1 -0
  29. package/dist-embed-sighting-editor/{GenerativeKitMessages-I8xH2ec9.js → GenerativeKitMessages-B8L7U7gD.js} +1 -1
  30. package/dist-embed-sighting-editor/{GeoExportTexts-DAllttgw.js → GeoExportTexts-DrGdI2OF.js} +1 -1
  31. package/dist-embed-sighting-editor/{GeoJsonExport-_yjIEd4F.js → GeoJsonExport-BZ-0v8fM.js} +1 -1
  32. package/dist-embed-sighting-editor/GeographicFigures-DqhWddS9.js +1 -0
  33. package/dist-embed-sighting-editor/{HeadlightSystem-DRq40K7R.js → HeadlightSystem-DI5wHYZu.js} +1 -1
  34. package/dist-embed-sighting-editor/{HynekAssessor-PxE7JR1h.js → HynekAssessor-DlXalbph.js} +1 -1
  35. package/dist-embed-sighting-editor/InterviewEditorElement-Bbkze5KE.js +240 -0
  36. package/dist-embed-sighting-editor/InterviewElement-B3tm7y49.js +31 -0
  37. package/dist-embed-sighting-editor/{KmlExport-dpml2tIJ.js → KmlExport-Bh4eTycx.js} +1 -1
  38. package/dist-embed-sighting-editor/LanternEditor-M887ltwe.js +24 -0
  39. package/dist-embed-sighting-editor/{LaserBeam-CadJcSMd.js → LaserBeam-Drpkr84G.js} +1 -1
  40. package/dist-embed-sighting-editor/LaunchEditor-BjAk4XZR.js +22 -0
  41. package/dist-embed-sighting-editor/{LaunchPlume-C7My5ccR.js → LaunchPlume-CrzPcqw7.js} +1 -1
  42. package/dist-embed-sighting-editor/{LaunchSimulation-45Z9GUBF.js → LaunchSimulation-C1ZWpKZT.js} +1 -1
  43. package/dist-embed-sighting-editor/{ModelSource-CzGHu4XS.js → ModelSource-Bko_3OJt.js} +1 -1
  44. package/dist-embed-sighting-editor/{ModelThumbnails-CNO_j-KM.js → ModelThumbnails-DSshyLu2.js} +1 -1
  45. package/dist-embed-sighting-editor/{ModelViewer-yfIxofpG.js → ModelViewer-_yhAYvNy.js} +1 -1
  46. package/dist-embed-sighting-editor/{ModuleConformance-C9DED8Lk.js → ModuleConformance-B6iFVb8X.js} +2 -2
  47. package/dist-embed-sighting-editor/{ModuleSession-Cxe0BJue.js → ModuleSession-jKFl1FMo.js} +3 -3
  48. package/dist-embed-sighting-editor/ModuleThree-Fvr5G-Yh.js +1 -0
  49. package/dist-embed-sighting-editor/{ModulesPanelElement-DgbOYqaS.js → ModulesPanelElement-VPRCdjmv.js} +3 -3
  50. package/dist-embed-sighting-editor/{NearestApproach-EbQIYGTt.js → NearestApproach-O8k2n_qL.js} +1 -1
  51. package/dist-embed-sighting-editor/PictureRegistration-DBBH_E6I.js +1 -0
  52. package/dist-embed-sighting-editor/{PoherAssessor-BisQ5ybV.js → PoherAssessor-sTJEnlmb.js} +1 -1
  53. package/dist-embed-sighting-editor/{RailwaySystem-CIAIBvLT.js → RailwaySystem-BZqNSSFA.js} +1 -1
  54. package/dist-embed-sighting-editor/ReentryEditor-DfDGpL5C.js +28 -0
  55. package/dist-embed-sighting-editor/{ReentrySimulation-Crd-CW_o.js → ReentrySimulation-BuUK0niI.js} +1 -1
  56. package/dist-embed-sighting-editor/{ReferenceSystem-DUIJceGg.js → ReferenceSystem-DvcQp167.js} +1 -1
  57. package/dist-embed-sighting-editor/{RoadMarkings-D9-6Cy9S.js → RoadMarkings-BGK7ToZP.js} +1 -1
  58. package/dist-embed-sighting-editor/SightingEditorMessages_en-CTQYcybj.js +12 -0
  59. package/dist-embed-sighting-editor/SightingEditorMessages_es-D-ASD5a3.js +12 -0
  60. package/dist-embed-sighting-editor/SightingEditorMessages_fr-DjUByAq4.js +12 -0
  61. package/dist-embed-sighting-editor/SightingEditorMessages_it-Eat0U-4p.js +12 -0
  62. package/dist-embed-sighting-editor/SightingElement-FJvhqoCj.js +693 -0
  63. package/dist-embed-sighting-editor/SightingLabels_en-oIpytoq_.js +1 -0
  64. package/dist-embed-sighting-editor/SightingLabels_es-DUh1CTXl.js +1 -0
  65. package/dist-embed-sighting-editor/SightingLabels_fr-D69zENbW.js +1 -0
  66. package/dist-embed-sighting-editor/SightingLabels_it-COLZ2Qth.js +1 -0
  67. package/dist-embed-sighting-editor/SightingMessages_en-CYzanHjT.js +1 -0
  68. package/dist-embed-sighting-editor/SightingMessages_es-hjvESK6f.js +1 -0
  69. package/dist-embed-sighting-editor/SightingMessages_fr-BtfWbIP7.js +1 -0
  70. package/dist-embed-sighting-editor/SightingMessages_it-Bqm4pewZ.js +1 -0
  71. package/dist-embed-sighting-editor/{SkyLantern-De_MXfQz.js → SkyLantern-B7UlFgmB.js} +1 -1
  72. package/dist-embed-sighting-editor/{TraceSystem-Ba5H90GB.js → TraceSystem-vZF4B5EC.js} +2 -2
  73. package/dist-embed-sighting-editor/{UfoMessages_en-FAvzKxmR.js → UfoMessages_en-JeMK-39o.js} +1 -1
  74. package/dist-embed-sighting-editor/VideoButton-Kxg7pF1Y.js +1 -0
  75. package/dist-embed-sighting-editor/{WaterSystem-Dpdw46hF.js → WaterSystem-DSWmZbiL.js} +2 -2
  76. package/dist-embed-sighting-editor/{interviewImport-CgWyTdKb.js → interviewImport-BlSMFEw_.js} +1 -1
  77. package/dist-embed-sighting-editor/interviewJson-CsMHIcZ-.js +8 -0
  78. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +439 -392
  79. package/dist-embed-sighting-editor/{surroundingsSources-YIawBCws.js → surroundingsSources-z7680fTA.js} +1 -1
  80. package/dist-embed-sighting-editor/{trafficRuntime-DwnTE9-7.js → trafficRuntime-C5BXL-G6.js} +1 -1
  81. package/dist-embed-ufoathome/Account-C4jhsVtN.js +1 -0
  82. package/dist-embed-ufoathome/AdsbLolArchiveProvider-886uuL_s.js +1 -0
  83. package/dist-embed-ufoathome/AssemblyAiTranscriptionProvider-o2kkPD5o.js +1 -0
  84. package/dist-embed-ufoathome/BallesterGuaspAssessor-BSKybYn0.js +1 -0
  85. package/dist-embed-ufoathome/BeamEditor-U2XQEG_6.js +30 -0
  86. package/dist-embed-ufoathome/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  87. package/dist-embed-ufoathome/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  88. package/dist-embed-ufoathome/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  89. package/dist-embed-ufoathome/BeamEditorMessages_it-DVweRQFi.js +1 -0
  90. package/dist-embed-ufoathome/BeamKindMessages_en-5RezNkyz.js +1 -0
  91. package/dist-embed-ufoathome/BeamKindMessages_es-B5vSWVjK.js +1 -0
  92. package/dist-embed-ufoathome/BeamKindMessages_fr--28-36OI.js +1 -0
  93. package/dist-embed-ufoathome/BeamKindMessages_it-X53Fuf2U.js +1 -0
  94. package/dist-embed-ufoathome/BeamParameterTexts_en-DZB75ouZ.js +1 -0
  95. package/dist-embed-ufoathome/BeamParameterTexts_es-AeZmsufG.js +1 -0
  96. package/dist-embed-ufoathome/BeamParameterTexts_fr-BHG3fW40.js +1 -0
  97. package/dist-embed-ufoathome/BeamParameterTexts_it-CPwmQX-g.js +1 -0
  98. package/dist-embed-ufoathome/BeamSystem-eYdKPRQZ.js +1 -0
  99. package/dist-embed-ufoathome/BirdEditor-6vr7bLHy.js +16 -0
  100. package/dist-embed-ufoathome/BirdEditorMessages_en-CN1OJud9.js +1 -0
  101. package/dist-embed-ufoathome/BirdEditorMessages_es-DDEnjRrz.js +1 -0
  102. package/dist-embed-ufoathome/BirdEditorMessages_fr-hL72V8wm.js +1 -0
  103. package/dist-embed-ufoathome/BirdEditorMessages_it-BmLyiPYp.js +1 -0
  104. package/dist-embed-ufoathome/BirdFlock-ByBkJV35.js +1 -0
  105. package/dist-embed-ufoathome/BirdKindMessages_en-c_-L7frF.js +1 -0
  106. package/dist-embed-ufoathome/BirdKindMessages_es-8Zo2t0o4.js +1 -0
  107. package/dist-embed-ufoathome/BirdKindMessages_fr-C1TuqqEj.js +1 -0
  108. package/dist-embed-ufoathome/BirdKindMessages_it-DQZcrCkf.js +1 -0
  109. package/dist-embed-ufoathome/BirdParameterTexts_en-C6FkYUww.js +1 -0
  110. package/dist-embed-ufoathome/BirdParameterTexts_es-T8JyeNlI.js +1 -0
  111. package/dist-embed-ufoathome/BirdParameterTexts_fr-BiTR-olu.js +1 -0
  112. package/dist-embed-ufoathome/BirdParameterTexts_it-oQY4DX6B.js +1 -0
  113. package/dist-embed-ufoathome/BodyEditor-CRlKW7yl.js +28 -0
  114. package/dist-embed-ufoathome/BodyEditorMessages_en-CckxSS1L.js +1 -0
  115. package/dist-embed-ufoathome/BodyEditorMessages_es-B8GlFFBo.js +1 -0
  116. package/dist-embed-ufoathome/BodyEditorMessages_fr-638ypdqf.js +1 -0
  117. package/dist-embed-ufoathome/BodyEditorMessages_it-SKpMkHFI.js +1 -0
  118. package/dist-embed-ufoathome/BodyParameterTexts_en-CKiFdpaz.js +1 -0
  119. package/dist-embed-ufoathome/BodyParameterTexts_es-DT9XO1Hc.js +1 -0
  120. package/dist-embed-ufoathome/BodyParameterTexts_fr-B5jLsE0g.js +1 -0
  121. package/dist-embed-ufoathome/BodyParameterTexts_it-iyJGx4Ta.js +1 -0
  122. package/dist-embed-ufoathome/BrowserWhisperProvider-Dn44ZE45.js +1 -0
  123. package/dist-embed-ufoathome/CaseEditorElement-Ds4yB5UC.js +3033 -0
  124. package/dist-embed-ufoathome/CaseEditorMessages_en-CoFukfwf.js +1 -0
  125. package/dist-embed-ufoathome/CaseEditorMessages_es-DZptbzB7.js +1 -0
  126. package/dist-embed-ufoathome/CaseEditorMessages_fr-DXl2GNmR.js +1 -0
  127. package/dist-embed-ufoathome/CaseEditorMessages_it-ss10VmRM.js +1 -0
  128. package/dist-embed-ufoathome/CaseElement-fKdvuMAp.js +100 -0
  129. package/dist-embed-ufoathome/CaseExportMessages_en-jHlu58Y7.js +1 -0
  130. package/dist-embed-ufoathome/CaseExportMessages_es-dCQQFgjq.js +1 -0
  131. package/dist-embed-ufoathome/CaseExportMessages_fr-sDfEgjWg.js +1 -0
  132. package/dist-embed-ufoathome/CaseExportMessages_it-BJaglZtP.js +1 -0
  133. package/dist-embed-ufoathome/CaseMessages_en-BbbbikHH.js +1 -0
  134. package/dist-embed-ufoathome/CaseMessages_es-AHBxl8Ka.js +1 -0
  135. package/dist-embed-ufoathome/CaseMessages_fr-CD33PQCH.js +1 -0
  136. package/dist-embed-ufoathome/CaseMessages_it-DyMACGSU.js +1 -0
  137. package/dist-embed-ufoathome/CaseReportExport-Dy1xmhTI.js +66 -0
  138. package/dist-embed-ufoathome/CaseReportTexts_en-DlN7p1pC.js +1 -0
  139. package/dist-embed-ufoathome/CaseReportTexts_es-CncAEaey.js +1 -0
  140. package/dist-embed-ufoathome/CaseReportTexts_fr-B5nP6RlP.js +1 -0
  141. package/dist-embed-ufoathome/CaseReportTexts_it-Dc-oPmXB.js +1 -0
  142. package/dist-embed-ufoathome/CaseTimeline-Dq1H2Ucy.js +142 -0
  143. package/dist-embed-ufoathome/ClaudeNarrativeTexts_en-CBLJZ7b6.js +1 -0
  144. package/dist-embed-ufoathome/ClaudeNarrativeTexts_es-BDV0GimU.js +1 -0
  145. package/dist-embed-ufoathome/ClaudeNarrativeTexts_fr-DiKzTF9T.js +1 -0
  146. package/dist-embed-ufoathome/ClaudeNarrativeTexts_it-DwxjRDVG.js +1 -0
  147. package/dist-embed-ufoathome/CloudEditorMessages_en-SmcRKW1O.js +1 -0
  148. package/dist-embed-ufoathome/CloudEditorMessages_es-DFCuS9Qg.js +1 -0
  149. package/dist-embed-ufoathome/CloudEditorMessages_fr-SvL-CR04.js +1 -0
  150. package/dist-embed-ufoathome/CloudEditorMessages_it-BvfiHWV9.js +1 -0
  151. package/dist-embed-ufoathome/CloudParameterTexts_en-NIa0gfgA.js +1 -0
  152. package/dist-embed-ufoathome/CloudParameterTexts_es-DXu4T30p.js +1 -0
  153. package/dist-embed-ufoathome/CloudParameterTexts_fr-Bv-jc2dq.js +1 -0
  154. package/dist-embed-ufoathome/CloudParameterTexts_it-C3RrkRwI.js +1 -0
  155. package/dist-embed-ufoathome/ContrailGrowth-DwHS8If9.js +1 -0
  156. package/dist-embed-ufoathome/ContrailSystem-pwF1XPex.js +1 -0
  157. package/dist-embed-ufoathome/ControlPasses-ApTdQK9r.js +29 -0
  158. package/dist-embed-ufoathome/CoverageAssessor-DFMo5umu.js +1 -0
  159. package/dist-embed-ufoathome/Decor-Dn-cvniW.js +1 -0
  160. package/dist-embed-ufoathome/DecorParameterTexts_en-idbdHsFG.js +1 -0
  161. package/dist-embed-ufoathome/DecorParameterTexts_es-CIkkLQc2.js +1 -0
  162. package/dist-embed-ufoathome/DecorParameterTexts_fr-D9GeuW_Y.js +1 -0
  163. package/dist-embed-ufoathome/DecorParameterTexts_it-v7TBrnsr.js +1 -0
  164. package/dist-embed-ufoathome/DecoyFlare-DUt1_LcW.js +1 -0
  165. package/dist-embed-ufoathome/DroneEditor-C3SH8yYq.js +16 -0
  166. package/dist-embed-ufoathome/DroneEditorMessages_en-BViHK30c.js +1 -0
  167. package/dist-embed-ufoathome/DroneEditorMessages_es-D6bhIOAa.js +1 -0
  168. package/dist-embed-ufoathome/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
  169. package/dist-embed-ufoathome/DroneEditorMessages_it-CYi-jmVN.js +1 -0
  170. package/dist-embed-ufoathome/DroneFlight-CGNIh9XS.js +1 -0
  171. package/dist-embed-ufoathome/DroneKindMessages_en-CLygXcsv.js +1 -0
  172. package/dist-embed-ufoathome/DroneKindMessages_es-B9XFRYnQ.js +1 -0
  173. package/dist-embed-ufoathome/DroneKindMessages_fr-CAX15_pk.js +1 -0
  174. package/dist-embed-ufoathome/DroneKindMessages_it-CSGsCaJQ.js +1 -0
  175. package/dist-embed-ufoathome/DroneParameterTexts_en-sL1dR2RG.js +1 -0
  176. package/dist-embed-ufoathome/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
  177. package/dist-embed-ufoathome/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
  178. package/dist-embed-ufoathome/DroneParameterTexts_it-DfvWjvoc.js +1 -0
  179. package/dist-embed-ufoathome/FilmChrome-DYiyzoB_.js +1 -0
  180. package/dist-embed-ufoathome/FlareKindMessages_en-j3CY_TxX.js +1 -0
  181. package/dist-embed-ufoathome/FlareKindMessages_es-CZgrFIOO.js +1 -0
  182. package/dist-embed-ufoathome/FlareKindMessages_fr-B2MezoN2.js +1 -0
  183. package/dist-embed-ufoathome/FlareKindMessages_it-CmZmb3RP.js +1 -0
  184. package/dist-embed-ufoathome/Flightradar24Provider-BT0RC4qJ.js +1 -0
  185. package/dist-embed-ufoathome/GLTFLoader-DpXgTKpb.js +1 -0
  186. package/dist-embed-ufoathome/GenerativeKit-BmhvjjzB.js +9 -0
  187. package/dist-embed-ufoathome/GenerativeKitMessages-BwG7cWZX.js +1 -0
  188. package/dist-embed-ufoathome/GenerativeKitMessages_en-BY4B6yas.js +34 -0
  189. package/dist-embed-ufoathome/GenerativeKitMessages_es-_iYkoRhK.js +34 -0
  190. package/dist-embed-ufoathome/GenerativeKitMessages_fr-BY5yUJwK.js +34 -0
  191. package/dist-embed-ufoathome/GenerativeKitMessages_it-DAgB31P1.js +34 -0
  192. package/dist-embed-ufoathome/GeoExportTexts-3a51cuxQ.js +1 -0
  193. package/dist-embed-ufoathome/GeoExportTexts_en-Dq0fSJQp.js +1 -0
  194. package/dist-embed-ufoathome/GeoExportTexts_es-CoVHdOo0.js +1 -0
  195. package/dist-embed-ufoathome/GeoExportTexts_fr-DVAMpZIR.js +1 -0
  196. package/dist-embed-ufoathome/GeoExportTexts_it-Bh1uJBQp.js +1 -0
  197. package/dist-embed-ufoathome/GeoJsonExport-bpBmwqb7.js +2 -0
  198. package/dist-embed-ufoathome/GeoJsonImport-CIftC0ws.js +1 -0
  199. package/dist-embed-ufoathome/GeographicFigures-B0Bqeh10.js +1 -0
  200. package/dist-embed-ufoathome/GhostSearchView-Dlhj3xWa.js +1 -0
  201. package/dist-embed-ufoathome/HeadlightSystem-CMT7XiIH.js +34 -0
  202. package/dist-embed-ufoathome/HynekAssessor-qlHGyZnD.js +1 -0
  203. package/dist-embed-ufoathome/InterviewEditorElement-B33-sGHI.js +240 -0
  204. package/dist-embed-ufoathome/InterviewElement-CiZNhb70.js +31 -0
  205. package/dist-embed-ufoathome/InterviewMedia-CvAxC62V.js +1 -0
  206. package/dist-embed-ufoathome/InterviewMessages_en-ru7GkZlQ.js +1 -0
  207. package/dist-embed-ufoathome/InterviewMessages_es-DkJurNrG.js +1 -0
  208. package/dist-embed-ufoathome/InterviewMessages_fr-DAYgf8Ms.js +1 -0
  209. package/dist-embed-ufoathome/InterviewMessages_it-6lenkmSg.js +1 -0
  210. package/dist-embed-ufoathome/KmlExport-gFuPcL9A.js +19 -0
  211. package/dist-embed-ufoathome/KmlImport-BMAfiqoV.js +1 -0
  212. package/dist-embed-ufoathome/LanternEditor-BaRDgTw-.js +24 -0
  213. package/dist-embed-ufoathome/LanternEditorMessages_en-DaT3UNfD.js +1 -0
  214. package/dist-embed-ufoathome/LanternEditorMessages_es-TDV5lKeJ.js +1 -0
  215. package/dist-embed-ufoathome/LanternEditorMessages_fr-9mByTFMG.js +1 -0
  216. package/dist-embed-ufoathome/LanternEditorMessages_it-MRkJnDQp.js +1 -0
  217. package/dist-embed-ufoathome/LanternKindMessages_en-CQXdJ-k6.js +1 -0
  218. package/dist-embed-ufoathome/LanternKindMessages_es-BOO6kPjs.js +1 -0
  219. package/dist-embed-ufoathome/LanternKindMessages_fr-D7tQa_tQ.js +1 -0
  220. package/dist-embed-ufoathome/LanternKindMessages_it-B8J-29Mj.js +1 -0
  221. package/dist-embed-ufoathome/LanternParameterTexts_en-CcnGd8UH.js +1 -0
  222. package/dist-embed-ufoathome/LanternParameterTexts_es-CUTgNutZ.js +1 -0
  223. package/dist-embed-ufoathome/LanternParameterTexts_fr-P2JwYOUy.js +1 -0
  224. package/dist-embed-ufoathome/LanternParameterTexts_it-CzNnIUrX.js +1 -0
  225. package/dist-embed-ufoathome/LaserBeam-BKuiBaAN.js +1 -0
  226. package/dist-embed-ufoathome/LaunchEditor-CFsq327k.js +22 -0
  227. package/dist-embed-ufoathome/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  228. package/dist-embed-ufoathome/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  229. package/dist-embed-ufoathome/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  230. package/dist-embed-ufoathome/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  231. package/dist-embed-ufoathome/LaunchKindMessages_en-Batvnyw3.js +1 -0
  232. package/dist-embed-ufoathome/LaunchKindMessages_es-KYyQ9gbu.js +1 -0
  233. package/dist-embed-ufoathome/LaunchKindMessages_fr-CoojboIk.js +1 -0
  234. package/dist-embed-ufoathome/LaunchKindMessages_it-9HA3cjgP.js +1 -0
  235. package/dist-embed-ufoathome/LaunchParameterTexts_en-DvrCwbDM.js +1 -0
  236. package/dist-embed-ufoathome/LaunchParameterTexts_es--RUAegVp.js +1 -0
  237. package/dist-embed-ufoathome/LaunchParameterTexts_fr-Bh_1zVzy.js +1 -0
  238. package/dist-embed-ufoathome/LaunchParameterTexts_it-CWDx9nJy.js +1 -0
  239. package/dist-embed-ufoathome/LaunchPlume-p7V7Yg6y.js +1 -0
  240. package/dist-embed-ufoathome/LaunchSimulation-3vTsM_A7.js +1 -0
  241. package/dist-embed-ufoathome/ModelSource-Cd7ByLN1.js +1 -0
  242. package/dist-embed-ufoathome/ModelThumbnails-CASGbavJ.js +1 -0
  243. package/dist-embed-ufoathome/ModelViewer-DEaj6_6R.js +1 -0
  244. package/dist-embed-ufoathome/ModuleConformance-CSg3Ac74.js +2 -0
  245. package/dist-embed-ufoathome/ModuleSession-BaaLmhnz.js +3 -0
  246. package/dist-embed-ufoathome/ModuleThree-DF_JfVBK.js +1 -0
  247. package/dist-embed-ufoathome/ModulesPanelElement-BqF6eK1X.js +15 -0
  248. package/dist-embed-ufoathome/ModulesPanelMessages_en-DuwrY3Pm.js +1 -0
  249. package/dist-embed-ufoathome/ModulesPanelMessages_es-Bq5X-XuT.js +1 -0
  250. package/dist-embed-ufoathome/ModulesPanelMessages_fr-B8cSDc6o.js +1 -0
  251. package/dist-embed-ufoathome/ModulesPanelMessages_it-BdC626aJ.js +1 -0
  252. package/dist-embed-ufoathome/NearestApproach-DnGPayAo.js +1 -0
  253. package/dist-embed-ufoathome/Obstacles-v9SkfBD7.js +1 -0
  254. package/dist-embed-ufoathome/OffThreadTracer-ByPLWaYU.js +6 -0
  255. package/dist-embed-ufoathome/OpenAiTranscriptionProvider-DDW446tK.js +1 -0
  256. package/dist-embed-ufoathome/PanoramaxPictures-CELY3Ecc.js +1 -0
  257. package/dist-embed-ufoathome/ParameterForm-DfpJQGku.js +91 -0
  258. package/dist-embed-ufoathome/PerceptionMessages_en-B2O6DR64.js +1 -0
  259. package/dist-embed-ufoathome/PerceptionMessages_es-BmkP6OqD.js +1 -0
  260. package/dist-embed-ufoathome/PerceptionMessages_fr-B59TnGBC.js +1 -0
  261. package/dist-embed-ufoathome/PerceptionMessages_it-DPlxRmxu.js +1 -0
  262. package/dist-embed-ufoathome/PictureFetch-C3wgf1ZV.js +1 -0
  263. package/dist-embed-ufoathome/PictureRegistration-BFn75haQ.js +1 -0
  264. package/dist-embed-ufoathome/PoherAssessor-DRTvhhZp.js +1 -0
  265. package/dist-embed-ufoathome/RailwaySystem-CUJHpW5y.js +41 -0
  266. package/dist-embed-ufoathome/ReadingCheckTexts_en-eq6teExJ.js +1 -0
  267. package/dist-embed-ufoathome/ReadingCheckTexts_es-CR_JJZMV.js +1 -0
  268. package/dist-embed-ufoathome/ReadingCheckTexts_fr-pcDleIvY.js +1 -0
  269. package/dist-embed-ufoathome/ReadingCheckTexts_it-MFKeoXnq.js +1 -0
  270. package/dist-embed-ufoathome/ReadingSensitivityMessages_en-ChQHFyxb.js +1 -0
  271. package/dist-embed-ufoathome/ReadingSensitivityMessages_es-BbFqHsvR.js +1 -0
  272. package/dist-embed-ufoathome/ReadingSensitivityMessages_fr-Dl4a8udu.js +1 -0
  273. package/dist-embed-ufoathome/ReadingSensitivityMessages_it-CwiJfUo_.js +1 -0
  274. package/dist-embed-ufoathome/RecordingIssue-BlWT8Xsu.js +3 -0
  275. package/dist-embed-ufoathome/ReentryArchive-CeXHrU7L.js +1 -0
  276. package/dist-embed-ufoathome/ReentryEditor-DynYe51Y.js +28 -0
  277. package/dist-embed-ufoathome/ReentryEditorMessages_en-BmTZMr-m.js +1 -0
  278. package/dist-embed-ufoathome/ReentryEditorMessages_es-edid__Jo.js +1 -0
  279. package/dist-embed-ufoathome/ReentryEditorMessages_fr-DHbcY0tN.js +1 -0
  280. package/dist-embed-ufoathome/ReentryEditorMessages_it-CIzkIU4G.js +1 -0
  281. package/dist-embed-ufoathome/ReentryKindMessages_en-BGZgya17.js +1 -0
  282. package/dist-embed-ufoathome/ReentryKindMessages_es--UxzPNfj.js +1 -0
  283. package/dist-embed-ufoathome/ReentryKindMessages_fr-7mer-cdj.js +1 -0
  284. package/dist-embed-ufoathome/ReentryKindMessages_it-BBVQXE1M.js +1 -0
  285. package/dist-embed-ufoathome/ReentryParameterTexts_en-5BOfwCsS.js +1 -0
  286. package/dist-embed-ufoathome/ReentryParameterTexts_es-ze1-U4jB.js +1 -0
  287. package/dist-embed-ufoathome/ReentryParameterTexts_fr-BgUJROXF.js +1 -0
  288. package/dist-embed-ufoathome/ReentryParameterTexts_it-MTb9Vuq0.js +1 -0
  289. package/dist-embed-ufoathome/ReentrySimulation-BTcyhCCG.js +1 -0
  290. package/dist-embed-ufoathome/ReentryTypeNames_en-CBu890Bd.js +1 -0
  291. package/dist-embed-ufoathome/ReentryTypeNames_es-_LnketjJ.js +1 -0
  292. package/dist-embed-ufoathome/ReentryTypeNames_fr-BXq89mrz.js +1 -0
  293. package/dist-embed-ufoathome/ReentryTypeNames_it-Yfq-TDip.js +1 -0
  294. package/dist-embed-ufoathome/ReferenceSystem-WdAT5UCN.js +1 -0
  295. package/dist-embed-ufoathome/ReferenceTimeline-2kBldQeG.js +1 -0
  296. package/dist-embed-ufoathome/RoadMarkings-BsN3rh0W.js +1 -0
  297. package/dist-embed-ufoathome/SaidPosition-CWiVNaNW.js +4 -0
  298. package/dist-embed-ufoathome/SatellitePasses-Pfro2-0Z.js +1 -0
  299. package/dist-embed-ufoathome/SceneNames_en-7OZ7peGc.js +1 -0
  300. package/dist-embed-ufoathome/SceneNames_es-P5-Mavdi.js +1 -0
  301. package/dist-embed-ufoathome/SceneNames_fr-qzw0QzD0.js +1 -0
  302. package/dist-embed-ufoathome/SceneNames_it-Sqf8JFOd.js +1 -0
  303. package/dist-embed-ufoathome/ShareCodeEditor-DyEYu_9d.js +13 -0
  304. package/dist-embed-ufoathome/ShareDialogElement-C3HL-Smq.js +9222 -0
  305. package/dist-embed-ufoathome/ShareMessages_en-B43x8LgJ.js +1 -0
  306. package/dist-embed-ufoathome/ShareMessages_es-DZCJojSc.js +1 -0
  307. package/dist-embed-ufoathome/ShareMessages_fr-CzZyVbbX.js +1 -0
  308. package/dist-embed-ufoathome/ShareMessages_it-C_Z6eDQK.js +1 -0
  309. package/dist-embed-ufoathome/Sighting-CBpJpdm9.js +1 -0
  310. package/dist-embed-ufoathome/SightingEditorMessages_en-CTQYcybj.js +12 -0
  311. package/dist-embed-ufoathome/SightingEditorMessages_es-D-ASD5a3.js +12 -0
  312. package/dist-embed-ufoathome/SightingEditorMessages_fr-DjUByAq4.js +12 -0
  313. package/dist-embed-ufoathome/SightingEditorMessages_it-Eat0U-4p.js +12 -0
  314. package/dist-embed-ufoathome/SightingElement-CexCUTjH.js +693 -0
  315. package/dist-embed-ufoathome/SightingFileEditor-Cllslp2u.js +8 -0
  316. package/dist-embed-ufoathome/SightingLabels_en-oIpytoq_.js +1 -0
  317. package/dist-embed-ufoathome/SightingLabels_es-DUh1CTXl.js +1 -0
  318. package/dist-embed-ufoathome/SightingLabels_fr-D69zENbW.js +1 -0
  319. package/dist-embed-ufoathome/SightingLabels_it-COLZ2Qth.js +1 -0
  320. package/dist-embed-ufoathome/SightingMessages_en-CYzanHjT.js +1 -0
  321. package/dist-embed-ufoathome/SightingMessages_es-hjvESK6f.js +1 -0
  322. package/dist-embed-ufoathome/SightingMessages_fr-BtfWbIP7.js +1 -0
  323. package/dist-embed-ufoathome/SightingMessages_it-Bqm4pewZ.js +1 -0
  324. package/dist-embed-ufoathome/SkyEventEditorStyle-CvY_AhbI.js +1 -0
  325. package/dist-embed-ufoathome/SkyLantern-DJT_Ibzh.js +1 -0
  326. package/dist-embed-ufoathome/TagNames_es-BfnMpc3D.js +1 -0
  327. package/dist-embed-ufoathome/TagNames_fr-Dnqq6HQ5.js +1 -0
  328. package/dist-embed-ufoathome/TagNames_it-n6E4EGYO.js +1 -0
  329. package/dist-embed-ufoathome/TimelineTracks-X_GEZi12.js +35 -0
  330. package/dist-embed-ufoathome/TraceImport-CntRHXoJ.js +2 -0
  331. package/dist-embed-ufoathome/TraceSystem-Bm9JDfkW.js +393 -0
  332. package/dist-embed-ufoathome/TranscriptionAudio-C_xvRUv2.js +5 -0
  333. package/dist-embed-ufoathome/TranscriptionError-D_TCbYbt.js +1 -0
  334. package/dist-embed-ufoathome/UfoAtHomeMessages_en-dlx_C679.js +1 -0
  335. package/dist-embed-ufoathome/UfoAtHomeMessages_es-uLOvtAD0.js +1 -0
  336. package/dist-embed-ufoathome/UfoAtHomeMessages_fr-LR76-eHS.js +1 -0
  337. package/dist-embed-ufoathome/UfoAtHomeMessages_it-CQl4uTnG.js +1 -0
  338. package/dist-embed-ufoathome/UfoMessages_en-D5OYWJ3K.js +1 -0
  339. package/dist-embed-ufoathome/UfoMessages_es-CO-v8Jl6.js +1 -0
  340. package/dist-embed-ufoathome/UfoMessages_fr-CGkQBn5r.js +1 -0
  341. package/dist-embed-ufoathome/UfoMessages_it-BScqxIaH.js +1 -0
  342. package/dist-embed-ufoathome/VideoButton-CH3rw9kX.js +1 -0
  343. package/dist-embed-ufoathome/VideoExport-B8ZhHNnd.js +169 -0
  344. package/dist-embed-ufoathome/VisualAids-DI-hEL46.js +1 -0
  345. package/dist-embed-ufoathome/WaterSystem-CraSRAgB.js +19 -0
  346. package/dist-embed-ufoathome/browser-CltifEM0.js +1 -0
  347. package/dist-embed-ufoathome/caseSchema-ChUB1-9j.js +1 -0
  348. package/dist-embed-ufoathome/index-C8cdeM8E.js +11 -0
  349. package/dist-embed-ufoathome/index-DqGmxMZD.js +42 -0
  350. package/dist-embed-ufoathome/interviewImport-ym5iXO4Z.js +4 -0
  351. package/{dist-embed-sighting-editor/interviewJson-iURHP4Zk.js → dist-embed-ufoathome/interviewJson-D-i14LTf.js} +1 -1
  352. package/dist-embed-ufoathome/interviewSchema-Dk0AWHwc.js +1 -0
  353. package/dist-embed-ufoathome/logo-h2-w4Mwu.png +0 -0
  354. package/dist-embed-ufoathome/lunar-relief.bin-ByThqxUn.gz +0 -0
  355. package/dist-embed-ufoathome/node.browser-AK49Qif5.js +1 -0
  356. package/dist-embed-ufoathome/node.browser-HEqoqodz.js +1 -0
  357. package/dist-embed-ufoathome/rain-BvWZrB9h.ogg +0 -0
  358. package/dist-embed-ufoathome/rr0-ufoathome.mjs +159 -0
  359. package/dist-embed-ufoathome/sightingSchema-CgwoRMl-.js +1 -0
  360. package/dist-embed-ufoathome/stars-mag7.5-9-BLV2tFmZ.bin +0 -0
  361. package/dist-embed-ufoathome/stars-mag7.5-B43R6Wvg.bin +0 -0
  362. package/dist-embed-ufoathome/surroundingsSources-kPwp7ewe.js +1 -0
  363. package/dist-embed-ufoathome/thunder-DA48qs_v.wav +0 -0
  364. package/dist-embed-ufoathome/trafficRuntime-DM6gQGDZ.js +2 -0
  365. package/dist-embed-ufoathome/upperAirSources-BGuLpdwu.js +1 -0
  366. package/dist-embed-ufoathome/wind-BjklexY7.ogg +0 -0
  367. package/package.json +9 -6
  368. package/dist-embed-sighting-editor/BirdEditor-ESUliJEN.js +0 -16
  369. package/dist-embed-sighting-editor/DroneEditor-DDaJO8FS.js +0 -16
  370. package/dist-embed-sighting-editor/GLTFLoader-DdijxzcI.js +0 -1
  371. package/dist-embed-sighting-editor/GeographicFigures-DC6Tw3ja.js +0 -1
  372. package/dist-embed-sighting-editor/InterviewEditorElement-D-UDHU0L.js +0 -270
  373. package/dist-embed-sighting-editor/LanternEditor-DDcI5Kv1.js +0 -24
  374. package/dist-embed-sighting-editor/LaunchEditor-Pkk0K648.js +0 -22
  375. package/dist-embed-sighting-editor/ModuleThree-DSghL4fp.js +0 -1
  376. package/dist-embed-sighting-editor/PictureRegistration-CbfytwCX.js +0 -1
  377. package/dist-embed-sighting-editor/ReentryEditor-NE8z5aZT.js +0 -28
  378. package/dist-embed-sighting-editor/SightingEditorMessages_en-DSPvgYFi.js +0 -12
  379. package/dist-embed-sighting-editor/SightingEditorMessages_es-Bl3DipHr.js +0 -12
  380. package/dist-embed-sighting-editor/SightingEditorMessages_fr-BTmWQX0n.js +0 -12
  381. package/dist-embed-sighting-editor/SightingEditorMessages_it-lzbDsHjx.js +0 -12
  382. package/dist-embed-sighting-editor/VideoButton-CqCZ65oK.js +0 -1
@@ -1 +1 @@
1
- import{aR as F,aS as v,aT as b,aU as Y,ad as H}from"./rr0-sighting-editor.mjs";class K{static MU=398600.4418;static OMEGA=72921159e-12;static EARTH_RADIUS_KM=6371;static STEP_S=1;static DENSITY=[[0,1.225],[20,.0889],[40,.004],[60,31e-5],[80,185e-7],[100,56e-8],[120,222e-10],[150,208e-11],[200,254e-12],[250,607e-13],[300,192e-13],[400,28e-13],[500,522e-15],[600,114e-15],[700,307e-16],[800,114e-16],[900,576e-17],[1e3,356e-17]];static FREE_PATH_TIMES_DENSITY=68e-9;static ICE_DENSITY=917;static airDensity(s){const t=K.DENSITY;if(s<=t[0][0])return t[0][1];let e=0;for(;e<t.length-2&&t[e+1][0]<s;)e++;const[a,i]=t[e],[o,n]=t[e+1];return i*Math.exp(Math.log(n/i)*(s-a)/(o-a))}static dragPerKm(s,t,e,a=.5){const i=K.airDensity(s),o=K.FREE_PATH_TIMES_DENSITY/i/1e3,n=Math.exp(-o/t),p=i*1e9*Math.PI*t*t/Math.max(e,1e-9),d=3*i/(4*a*1e-6*K.ICE_DENSITY)*1e3;return n*p+(1-n)*d}static step(s,t,e,a,i){const[o,n,p,d,R,h]=s,T=Math.hypot(o,n,p),m=K.OMEGA,M=-398600.4418/(T*T*T),y=M*o+2*m*R+m*m*o,U=M*n-2*m*d+m*m*n,I=M*p,E=Math.hypot(d,R,h),c=1/(1+K.dragPerKm(T-K.EARTH_RADIUS_KM,e,a,i)*E*t);s[3]=(d+y*t)*c,s[4]=(R+U*t)*c,s[5]=(h+I*t)*c,s[0]=o+s[3]*t,s[1]=n+s[4]*t,s[2]=p+s[5]*t;const f=Math.hypot(s[0],s[1],s[2]);if(f<K.EARTH_RADIUS_KM){const A=K.EARTH_RADIUS_KM/f;s[0]*=A,s[1]*=A,s[2]*=A,s[3]=s[4]=s[5]=0}}}class _{constructor(s,t,e,a,i=.5){this.massKg=e,this.radiusAt=a,this.particleRadiusUm=i,this.state=Float64Array.of(...s,...t),this.positions=new Float64Array(192),this.positions.set(s,0)}positions;steps=0;state;at(s){const t=K.STEP_S,e=Math.max(0,s/t),a=Math.ceil(e);for(;this.steps<a;){if(K.step(this.state,t,this.radiusAt(this.steps*t),this.massKg,this.particleRadiusUm),this.steps++,3*(this.steps+1)>this.positions.length){const p=new Float64Array(this.positions.length*2);p.set(this.positions),this.positions=p}this.positions.set(this.state.subarray(0,3),3*this.steps)}const i=Math.floor(e),o=e-i,n=this.positions;return o===0||i>=this.steps?[n[3*i],n[3*i+1],n[3*i+2]]:[0,1,2].map(p=>n[3*i+p]+(n[3*i+3+p]-n[3*i+p])*o)}}class r{static EARTH_RADIUS_KM=6371;static SHADOW_RADIUS_KM=r.EARTH_RADIUS_KM+15;static PENUMBRA_KM=10;static SUN_ILLUMINANCE_LUX=127e3;static RAYLEIGH_PER_M=[58e-7,135e-7,331e-7];static SCALE_HEIGHT_M=8e3;static OZONE_GRAZING_DEPTH=[2.4,1.8,.24];static ANISOTROPY=.7;static ALBEDO=.99;static WAVELENGTHS_UM=[.61,.55,.465];static ICE_INDEX=1.31;static DEFAULTS={exhaustKgPerS:273,condensedShare:.065,particleRadiusUm:.5,expansionKmPerS:.15,initialRadiusKm:.5,lifetimeS:420,collarShare:.85,collarExpansionKmPerS:2.5,collarLifetimeS:20};static PROPELLANTS={"rp1-lox":{condensedShare:.065,particleRadiusUm:.5},"methane-lox":{condensedShare:.09,particleRadiusUm:.5},"hydrogen-lox":{condensedShare:.13,particleRadiusUm:.5},hypergolic:{condensedShare:.079,particleRadiusUm:.4},solid:{condensedShare:.27,particleRadiusUm:.8}};static G0=9.80665;static COLLAR_SPREAD_OF_EXHAUST_VELOCITY=.735;static plumeOf(s){const t={},e=s.vehicle?.engine;if(e){const a=e.specificImpulseS===void 0?void 0:e.specificImpulseS*r.G0;e.thrustKN!==void 0&&a&&(t.exhaustKgPerS=e.thrustKN*1e3/a),a&&(t.collarExpansionKmPerS=a/1e3*r.COLLAR_SPREAD_OF_EXHAUST_VELOCITY),e.propellant&&Object.assign(t,r.PROPELLANTS[e.propellant])}return{...r.DEFAULTS,...t,...s.plume}}static PUFF_EVERY_S=.5;static SIGMA_OF_RADIUS=.5;static MAX_PUFFS=320;static DEG=Math.PI/180;static EARTH_ROTATION=72921159e-12;static VENT_DEFAULTS={speedKmPerS:.7,massKgPerS:20,condensedShare:.5,particleRadiusUm:.5,expansionKmPerS:.1,initialRadiusKm:.2,lifetimeS:600};static paths=new WeakMap;static exhaustVelocityKmPerS(s){return(s.vehicle?.engine?.specificImpulseS??348)*r.G0/1e3}static releasesOf(s){const t=[],e=s.jets??[];if(e.length===0||s.burnFromT!==void 0||s.burnUntilT!==void 0){const a=s.track[0]?.t??0,i=s.track[s.track.length-1]?.t??0;t.push(r.engineRelease(s,"burn",{fromT:s.burnFromT??a,untilT:s.burnUntilT??i}))}return e.forEach((a,i)=>t.push(r.releaseOf(s,a,i))),t}static releaseOf(s,t,e){const a=`jet:${t.id??e}`;if((t.kind??"burn")==="burn")return r.engineRelease(s,a,t);const i=r.VENT_DEFAULTS;return{key:a,fromT:t.fromT,untilT:t.untilT,angleDeg:t.angleDeg??0,azimuthDeg:t.azimuthDeg??0,spinPeriodS:t.spinPeriodS,speedKmPerS:t.speedKmPerS??i.speedKmPerS,massKgPerS:t.massKgPerS??i.massKgPerS,condensedShare:t.condensedShare??i.condensedShare,particleRadiusUm:t.particleRadiusUm??i.particleRadiusUm,initialRadiusKm:t.initialRadiusKm??i.initialRadiusKm,populations:[{share:1,expansionKmPerS:t.expansionKmPerS??i.expansionKmPerS,lifetimeS:t.lifetimeS??i.lifetimeS}]}}static engineRelease(s,t,e){const a=r.plumeOf(s);return{key:t,fromT:e.fromT,untilT:e.untilT,angleDeg:e.angleDeg??0,azimuthDeg:e.azimuthDeg??0,spinPeriodS:e.spinPeriodS,speedKmPerS:e.speedKmPerS??r.exhaustVelocityKmPerS(s),massKgPerS:e.massKgPerS??a.exhaustKgPerS,condensedShare:e.condensedShare??a.condensedShare,particleRadiusUm:e.particleRadiusUm??a.particleRadiusUm,initialRadiusKm:e.initialRadiusKm??a.initialRadiusKm,populations:[{share:1-a.collarShare,expansionKmPerS:e.expansionKmPerS??a.expansionKmPerS,lifetimeS:e.lifetimeS??a.lifetimeS},{share:a.collarShare,expansionKmPerS:a.collarExpansionKmPerS,lifetimeS:a.collarLifetimeS}]}}static extinctionEfficiency(s,t){const e=2*Math.PI*s/t,a=r.ICE_INDEX**2,i=8/3*e**4*((a-1)/(a+2))**2,o=2*e*(r.ICE_INDEX-1),n=o<.001?o*o/2:2-4/o*Math.sin(o)+4/(o*o)*(1-Math.cos(o));return Math.min(i,n)}static scatteringColour(s){const t=r.extinctionEfficiency(s,r.WAVELENGTHS_UM[1]);return r.WAVELENGTHS_UM.map(e=>r.extinctionEfficiency(s,e)/t)}static sunDirectionAt(s){const t=new F(0,0,-6378137),e=v(b.Sun,s,t,!0,!0),a=(e.ra-Y(s))*15*r.DEG,i=e.dec*r.DEG;return[Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i)]}static puffsAt(s,t){const e=[];for(const a of s){let i=r.paths.get(a);i||r.paths.set(a,i=new Map);for(const o of r.releasesOf(a)){const n=Math.min(o.untilT,t);if(n<=o.fromT)continue;const p=Math.max(r.PUFF_EVERY_S*1e3,(o.untilT-o.fromT)/r.MAX_PUFFS),d=[];for(let M=o.fromT;M<n;M+=p)d.push(M);d.push(n);const R=o.massKgPerS*(p/1e3),T=3*r.extinctionEfficiency(o.particleRadiusUm,r.WAVELENGTHS_UM[1])/(4*917*o.particleRadiusUm*1e-6),m=r.scatteringColour(o.particleRadiusUm);o.populations.forEach((M,y)=>{if(M.share<=0)return;const U=E=>o.initialRadiusKm+M.expansionKmPerS*E,I=[];for(const E of d){const D=(t-E)/1e3;if(D>M.lifetimeS)continue;const c=E!==n||n===o.untilT,f=`${o.key}|${y}|${E}`;let A=c?i.get(f):void 0;if(!A){if(A=r.launchPuff(a,o,E,R*M.share,U),!A)continue;c&&i.set(f,A)}I.push({ageS:D,position:A.at(D)})}for(let E=I.length-1;E>=0;E--){const{ageS:D,position:c}=I[E],f=I[E-1]??I[E+1],A=f?Math.hypot(c[0]-f.position[0],c[1]-f.position[1],c[2]-f.position[2]):0,l=U(D)+A/2,O=r.SIGMA_OF_RADIUS*l*1e3,N=R*o.condensedShare*M.share*T/(2*Math.PI*O*O),x=Math.max(0,1-(D/M.lifetimeS)**2);N*x<=0||e.push({launchId:a.id,release:o.key,at:r.geoPoint(c),radiusKm:l,opticalDepth:N*x,colour:m,ageS:D})}})}}return e}static viewsAt(s,t,e,a){const i=[];for(const o of r.puffsAt(s,t)){const n=H.seenFrom(e,o.at);if(n.altitudeDeg<0)continue;const p=r.sunlightAt(o.at,a);if(p.lit<=0)continue;const d=r.scatteringPhase(e,o.at,a),R=r.SUN_ILLUMINANCE_LUX*r.ALBEDO*d*o.opticalDepth*p.lit;R<=0||i.push({launchId:o.launchId,release:o.release,heightKm:o.at.heightM/1e3,centre:n,radiusDeg:Math.atan2(o.radiusKm,n.distanceKm)/r.DEG,luminanceCdM2:R,sunTransmittance:p.transmittance,colour:o.colour,lit:p.lit,ageS:o.ageS})}return i}static launchPuff(s,t,e,a,i){const o={id:s.id,track:s.track,fragments:[]},n=H.leadAt(o,e);if(!n)return;const p=s.track[0].t,d=s.track[s.track.length-1].t,R=Math.max(p,e-500),h=Math.min(d,e+500),T=r.earthCentred(n),m=r.earthCentred(H.leadAt(o,R)),M=r.earthCentred(H.leadAt(o,h)),y=Math.max(.001,(h-R)/1e3),U=[0,1,2].map(S=>(M[S]-m[S])/y),I=r.EARTH_ROTATION,E=[U[0]-I*T[1],U[1]+I*T[0],U[2]],D=S=>{const k=Math.hypot(S[0],S[1],S[2])||1;return S.map(w=>w/k)},c=D(E),f=D(T),A=f[0]*c[0]+f[1]*c[1]+f[2]*c[2];let l=[f[0]-A*c[0],f[1]-A*c[1],f[2]-A*c[2]];Math.hypot(l[0],l[1],l[2])<1e-6&&(l=[-c[2]*c[0],-c[2]*c[1],1-c[2]*c[2]]),l=D(l);const O=[c[1]*l[2]-c[2]*l[1],c[2]*l[0]-c[0]*l[2],c[0]*l[1]-c[1]*l[0]],N=t.spinPeriodS?360*((e-t.fromT)/1e3)/t.spinPeriodS:0,x=(t.azimuthDeg+N)*r.DEG,G=t.angleDeg*r.DEG,C=[0,1,2].map(S=>-c[S]*Math.cos(G)+Math.sin(G)*(Math.cos(x)*l[S]+Math.sin(x)*O[S])),P=[0,1,2].map(S=>U[S]+t.speedKmPerS*C[S]);return new _(T,P,a,i,t.particleRadiusUm)}static geoPoint(s){const t=Math.hypot(s[0],s[1],s[2]);return{lat:Math.asin(s[2]/t)/r.DEG,lng:Math.atan2(s[1],s[0])/r.DEG,heightM:(t-K.EARTH_RADIUS_KM)*1e3}}static sunlightAt(s,t){const e=r.earthCentred(s),a=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];if(a>=0)return{lit:1,transmittance:[1,1,1]};const i=Math.hypot(e[0]-a*t[0],e[1]-a*t[1],e[2]-a*t[2]),o=r.PENUMBRA_KM,n=Math.min(1,Math.max(0,(i-(r.SHADOW_RADIUS_KM-o/2))/o));if(n<=0)return{lit:0,transmittance:[0,0,0]};const p=Math.max(0,(i-r.EARTH_RADIUS_KM)*1e3),d=Math.exp(-p/r.SCALE_HEIGHT_M),R=Math.sqrt(2*Math.PI*r.EARTH_RADIUS_KM*1e3*r.SCALE_HEIGHT_M),h=Math.exp(-(((p/1e3-25)/15)**2)),T=[0,1,2].map(m=>Math.exp(-r.RAYLEIGH_PER_M[m]*d*R-r.OZONE_GRAZING_DEPTH[m]*h));return{lit:n,transmittance:T}}static scatteringPhase(s,t,e){const a=r.earthCentred(s),i=r.earthCentred(t),o=[a[0]-i[0],a[1]-i[1],a[2]-i[2]],n=Math.hypot(o[0],o[1],o[2])||1,p=-(o[0]*e[0]+o[1]*e[1]+o[2]*e[2])/n,d=r.ANISOTROPY;return(1-d*d)/(4*Math.PI*(1+d*d-2*d*p)**1.5)}static earthCentred(s){const t=s.lat*r.DEG,e=s.lng*r.DEG,a=r.EARTH_RADIUS_KM+s.heightM/1e3;return[a*Math.cos(t)*Math.cos(e),a*Math.cos(t)*Math.sin(e),a*Math.sin(t)]}}export{r as L};
1
+ import{bk as w,bl as F,bm as v,bn as Y,aI as H}from"./rr0-sighting-editor.mjs";class K{static MU=398600.4418;static OMEGA=72921159e-12;static EARTH_RADIUS_KM=6371;static STEP_S=1;static DENSITY=[[0,1.225],[20,.0889],[40,.004],[60,31e-5],[80,185e-7],[100,56e-8],[120,222e-10],[150,208e-11],[200,254e-12],[250,607e-13],[300,192e-13],[400,28e-13],[500,522e-15],[600,114e-15],[700,307e-16],[800,114e-16],[900,576e-17],[1e3,356e-17]];static FREE_PATH_TIMES_DENSITY=68e-9;static ICE_DENSITY=917;static airDensity(s){const t=K.DENSITY;if(s<=t[0][0])return t[0][1];let e=0;for(;e<t.length-2&&t[e+1][0]<s;)e++;const[a,i]=t[e],[o,n]=t[e+1];return i*Math.exp(Math.log(n/i)*(s-a)/(o-a))}static dragPerKm(s,t,e,a=.5){const i=K.airDensity(s),o=K.FREE_PATH_TIMES_DENSITY/i/1e3,n=Math.exp(-o/t),p=i*1e9*Math.PI*t*t/Math.max(e,1e-9),d=3*i/(4*a*1e-6*K.ICE_DENSITY)*1e3;return n*p+(1-n)*d}static step(s,t,e,a,i){const[o,n,p,d,R,h]=s,S=Math.hypot(o,n,p),T=K.OMEGA,M=-398600.4418/(S*S*S),y=M*o+2*T*R+T*T*o,U=M*n-2*T*d+T*T*n,I=M*p,E=Math.hypot(d,R,h),c=1/(1+K.dragPerKm(S-K.EARTH_RADIUS_KM,e,a,i)*E*t);s[3]=(d+y*t)*c,s[4]=(R+U*t)*c,s[5]=(h+I*t)*c,s[0]=o+s[3]*t,s[1]=n+s[4]*t,s[2]=p+s[5]*t;const f=Math.hypot(s[0],s[1],s[2]);if(f<K.EARTH_RADIUS_KM){const A=K.EARTH_RADIUS_KM/f;s[0]*=A,s[1]*=A,s[2]*=A,s[3]=s[4]=s[5]=0}}}class _{constructor(s,t,e,a,i=.5){this.massKg=e,this.radiusAt=a,this.particleRadiusUm=i,this.state=Float64Array.of(...s,...t),this.positions=new Float64Array(192),this.positions.set(s,0)}positions;steps=0;state;at(s){const t=K.STEP_S,e=Math.max(0,s/t),a=Math.ceil(e);for(;this.steps<a;){if(K.step(this.state,t,this.radiusAt(this.steps*t),this.massKg,this.particleRadiusUm),this.steps++,3*(this.steps+1)>this.positions.length){const p=new Float64Array(this.positions.length*2);p.set(this.positions),this.positions=p}this.positions.set(this.state.subarray(0,3),3*this.steps)}const i=Math.floor(e),o=e-i,n=this.positions;return o===0||i>=this.steps?[n[3*i],n[3*i+1],n[3*i+2]]:[0,1,2].map(p=>n[3*i+p]+(n[3*i+3+p]-n[3*i+p])*o)}}class r{static EARTH_RADIUS_KM=6371;static SHADOW_RADIUS_KM=r.EARTH_RADIUS_KM+15;static PENUMBRA_KM=10;static SUN_ILLUMINANCE_LUX=127e3;static RAYLEIGH_PER_M=[58e-7,135e-7,331e-7];static SCALE_HEIGHT_M=8e3;static OZONE_GRAZING_DEPTH=[2.4,1.8,.24];static ANISOTROPY=.7;static ALBEDO=.99;static WAVELENGTHS_UM=[.61,.55,.465];static ICE_INDEX=1.31;static DEFAULTS={exhaustKgPerS:273,condensedShare:.065,particleRadiusUm:.5,expansionKmPerS:.15,initialRadiusKm:.5,lifetimeS:420,collarShare:.85,collarExpansionKmPerS:2.5,collarLifetimeS:20};static PROPELLANTS={"rp1-lox":{condensedShare:.065,particleRadiusUm:.5},"methane-lox":{condensedShare:.09,particleRadiusUm:.5},"hydrogen-lox":{condensedShare:.13,particleRadiusUm:.5},hypergolic:{condensedShare:.079,particleRadiusUm:.4},solid:{condensedShare:.27,particleRadiusUm:.8}};static G0=9.80665;static COLLAR_SPREAD_OF_EXHAUST_VELOCITY=.735;static plumeOf(s){const t={},e=s.vehicle?.engine;if(e){const a=e.specificImpulseS===void 0?void 0:e.specificImpulseS*r.G0;e.thrustKN!==void 0&&a&&(t.exhaustKgPerS=e.thrustKN*1e3/a),a&&(t.collarExpansionKmPerS=a/1e3*r.COLLAR_SPREAD_OF_EXHAUST_VELOCITY),e.propellant&&Object.assign(t,r.PROPELLANTS[e.propellant])}return{...r.DEFAULTS,...t,...s.plume}}static PUFF_EVERY_S=.5;static SIGMA_OF_RADIUS=.5;static MAX_PUFFS=320;static DEG=Math.PI/180;static EARTH_ROTATION=72921159e-12;static VENT_DEFAULTS={speedKmPerS:.7,massKgPerS:20,condensedShare:.5,particleRadiusUm:.5,expansionKmPerS:.1,initialRadiusKm:.2,lifetimeS:600};static paths=new WeakMap;static exhaustVelocityKmPerS(s){return(s.vehicle?.engine?.specificImpulseS??348)*r.G0/1e3}static releasesOf(s){const t=[],e=s.jets??[];if(e.length===0||s.burnFromT!==void 0||s.burnUntilT!==void 0){const a=s.track[0]?.t??0,i=s.track[s.track.length-1]?.t??0;t.push(r.engineRelease(s,"burn",{fromT:s.burnFromT??a,untilT:s.burnUntilT??i}))}return e.forEach((a,i)=>t.push(r.releaseOf(s,a,i))),t}static releaseOf(s,t,e){const a=`jet:${t.id??e}`;if((t.kind??"burn")==="burn")return r.engineRelease(s,a,t);const i=r.VENT_DEFAULTS;return{key:a,fromT:t.fromT,untilT:t.untilT,angleDeg:t.angleDeg??0,azimuthDeg:t.azimuthDeg??0,spinPeriodS:t.spinPeriodS,speedKmPerS:t.speedKmPerS??i.speedKmPerS,massKgPerS:t.massKgPerS??i.massKgPerS,condensedShare:t.condensedShare??i.condensedShare,particleRadiusUm:t.particleRadiusUm??i.particleRadiusUm,initialRadiusKm:t.initialRadiusKm??i.initialRadiusKm,populations:[{share:1,expansionKmPerS:t.expansionKmPerS??i.expansionKmPerS,lifetimeS:t.lifetimeS??i.lifetimeS}]}}static engineRelease(s,t,e){const a=r.plumeOf(s);return{key:t,fromT:e.fromT,untilT:e.untilT,angleDeg:e.angleDeg??0,azimuthDeg:e.azimuthDeg??0,spinPeriodS:e.spinPeriodS,speedKmPerS:e.speedKmPerS??r.exhaustVelocityKmPerS(s),massKgPerS:e.massKgPerS??a.exhaustKgPerS,condensedShare:e.condensedShare??a.condensedShare,particleRadiusUm:e.particleRadiusUm??a.particleRadiusUm,initialRadiusKm:e.initialRadiusKm??a.initialRadiusKm,populations:[{share:1-a.collarShare,expansionKmPerS:e.expansionKmPerS??a.expansionKmPerS,lifetimeS:e.lifetimeS??a.lifetimeS},{share:a.collarShare,expansionKmPerS:a.collarExpansionKmPerS,lifetimeS:a.collarLifetimeS}]}}static extinctionEfficiency(s,t){const e=2*Math.PI*s/t,a=r.ICE_INDEX**2,i=8/3*e**4*((a-1)/(a+2))**2,o=2*e*(r.ICE_INDEX-1),n=o<.001?o*o/2:2-4/o*Math.sin(o)+4/(o*o)*(1-Math.cos(o));return Math.min(i,n)}static scatteringColour(s){const t=r.extinctionEfficiency(s,r.WAVELENGTHS_UM[1]);return r.WAVELENGTHS_UM.map(e=>r.extinctionEfficiency(s,e)/t)}static sunDirectionAt(s){const t=new w(0,0,-6378137),e=F(v.Sun,s,t,!0,!0),a=(e.ra-Y(s))*15*r.DEG,i=e.dec*r.DEG;return[Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i)]}static puffsAt(s,t){const e=[];for(const a of s){let i=r.paths.get(a);i||r.paths.set(a,i=new Map);for(const o of r.releasesOf(a)){const n=Math.min(o.untilT,t);if(n<=o.fromT)continue;const p=Math.max(r.PUFF_EVERY_S*1e3,(o.untilT-o.fromT)/r.MAX_PUFFS),d=[];for(let M=o.fromT;M<n;M+=p)d.push(M);d.push(n);const R=o.massKgPerS*(p/1e3),S=3*r.extinctionEfficiency(o.particleRadiusUm,r.WAVELENGTHS_UM[1])/(4*917*o.particleRadiusUm*1e-6),T=r.scatteringColour(o.particleRadiusUm);o.populations.forEach((M,y)=>{if(M.share<=0)return;const U=E=>o.initialRadiusKm+M.expansionKmPerS*E,I=[];for(const E of d){const D=(t-E)/1e3;if(D>M.lifetimeS)continue;const c=E!==n||n===o.untilT,f=`${o.key}|${y}|${E}`;let A=c?i.get(f):void 0;if(!A){if(A=r.launchPuff(a,o,E,R*M.share,U),!A)continue;c&&i.set(f,A)}I.push({ageS:D,position:A.at(D)})}for(let E=I.length-1;E>=0;E--){const{ageS:D,position:c}=I[E],f=I[E-1]??I[E+1],A=f?Math.hypot(c[0]-f.position[0],c[1]-f.position[1],c[2]-f.position[2]):0,l=U(D)+A/2,O=r.SIGMA_OF_RADIUS*l*1e3,N=R*o.condensedShare*M.share*S/(2*Math.PI*O*O),x=Math.max(0,1-(D/M.lifetimeS)**2);N*x<=0||e.push({launchId:a.id,release:o.key,at:r.geoPoint(c),radiusKm:l,opticalDepth:N*x,colour:T,ageS:D})}})}}return e}static viewsAt(s,t,e,a){const i=[];for(const o of r.puffsAt(s,t)){const n=H.seenFrom(e,o.at);if(n.altitudeDeg<0)continue;const p=r.sunlightAt(o.at,a);if(p.lit<=0)continue;const d=r.scatteringPhase(e,o.at,a),R=r.SUN_ILLUMINANCE_LUX*r.ALBEDO*d*o.opticalDepth*p.lit;R<=0||i.push({launchId:o.launchId,release:o.release,heightKm:o.at.heightM/1e3,centre:n,radiusDeg:Math.atan2(o.radiusKm,n.distanceKm)/r.DEG,luminanceCdM2:R,sunTransmittance:p.transmittance,colour:o.colour,lit:p.lit,ageS:o.ageS})}return i}static launchPuff(s,t,e,a,i){const o={id:s.id,track:s.track,fragments:[]},n=H.leadAt(o,e);if(!n)return;const p=s.track[0].t,d=s.track[s.track.length-1].t,R=Math.max(p,e-500),h=Math.min(d,e+500),S=r.earthCentred(n),T=r.earthCentred(H.leadAt(o,R)),M=r.earthCentred(H.leadAt(o,h)),y=Math.max(.001,(h-R)/1e3),U=[0,1,2].map(m=>(M[m]-T[m])/y),I=r.EARTH_ROTATION,E=[U[0]-I*S[1],U[1]+I*S[0],U[2]],D=m=>{const b=Math.hypot(m[0],m[1],m[2])||1;return m.map(k=>k/b)},c=D(E),f=D(S),A=f[0]*c[0]+f[1]*c[1]+f[2]*c[2];let l=[f[0]-A*c[0],f[1]-A*c[1],f[2]-A*c[2]];Math.hypot(l[0],l[1],l[2])<1e-6&&(l=[-c[2]*c[0],-c[2]*c[1],1-c[2]*c[2]]),l=D(l);const O=[c[1]*l[2]-c[2]*l[1],c[2]*l[0]-c[0]*l[2],c[0]*l[1]-c[1]*l[0]],N=t.spinPeriodS?360*((e-t.fromT)/1e3)/t.spinPeriodS:0,x=(t.azimuthDeg+N)*r.DEG,G=t.angleDeg*r.DEG,C=[0,1,2].map(m=>-c[m]*Math.cos(G)+Math.sin(G)*(Math.cos(x)*l[m]+Math.sin(x)*O[m])),P=[0,1,2].map(m=>U[m]+t.speedKmPerS*C[m]);return new _(S,P,a,i,t.particleRadiusUm)}static geoPoint(s){const t=Math.hypot(s[0],s[1],s[2]);return{lat:Math.asin(s[2]/t)/r.DEG,lng:Math.atan2(s[1],s[0])/r.DEG,heightM:(t-K.EARTH_RADIUS_KM)*1e3}}static sunlightAt(s,t){const e=r.earthCentred(s),a=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];if(a>=0)return{lit:1,transmittance:[1,1,1]};const i=Math.hypot(e[0]-a*t[0],e[1]-a*t[1],e[2]-a*t[2]),o=r.PENUMBRA_KM,n=Math.min(1,Math.max(0,(i-(r.SHADOW_RADIUS_KM-o/2))/o));if(n<=0)return{lit:0,transmittance:[0,0,0]};const p=Math.max(0,(i-r.EARTH_RADIUS_KM)*1e3),d=Math.exp(-p/r.SCALE_HEIGHT_M),R=Math.sqrt(2*Math.PI*r.EARTH_RADIUS_KM*1e3*r.SCALE_HEIGHT_M),h=Math.exp(-(((p/1e3-25)/15)**2)),S=[0,1,2].map(T=>Math.exp(-r.RAYLEIGH_PER_M[T]*d*R-r.OZONE_GRAZING_DEPTH[T]*h));return{lit:n,transmittance:S}}static scatteringPhase(s,t,e){const a=r.earthCentred(s),i=r.earthCentred(t),o=[a[0]-i[0],a[1]-i[1],a[2]-i[2]],n=Math.hypot(o[0],o[1],o[2])||1,p=-(o[0]*e[0]+o[1]*e[1]+o[2]*e[2])/n,d=r.ANISOTROPY;return(1-d*d)/(4*Math.PI*(1+d*d-2*d*p)**1.5)}static earthCentred(s){const t=s.lat*r.DEG,e=s.lng*r.DEG,a=r.EARTH_RADIUS_KM+s.heightM/1e3;return[a*Math.cos(t)*Math.cos(e),a*Math.cos(t)*Math.sin(e),a*Math.sin(t)]}}export{r as L};
@@ -1 +1 @@
1
- import{L as M}from"./LaunchPlume-C7My5ccR.js";import{ap as T,aH as z,aI as f,as as C,aP as w,aQ as A}from"./rr0-sighting-editor.mjs";class n{static RADIUS=840;static MAX_PUFFS=1e3;static RINGS=[0,.25,.5,.75,1,1.25];static COLUMN=n.RINGS.map(t=>{const i=o=>Math.exp(-((o/M.SIGMA_OF_RADIUS)**2)/2),s=i(n.RINGS[n.RINGS.length-1]);return Math.max(0,(i(t)-s)/(1-s))});static SECTORS=12;static VERTICES_PER_PUFF=n.SECTORS*(3+6*(n.RINGS.length-2));static BRIGHTEST_RELATIVE=6e4;object=new T;mesh;positions=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);colors=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);shown=0;drawn=[];static VISIBLE_CONTRAST=.1;constructor(){this.object.name="plumes";const t=new z;t.setAttribute("position",new f(this.positions,3)),t.setAttribute("color",new f(this.colors,3)),t.setDrawRange(0,0),this.mesh=new C(t,w.material()),this.mesh.frustumCulled=!1,w.track(this.mesh),this.object.add(this.mesh)}get count(){return this.shown}set(t,i,s,o){let a=0,c=0;this.drawn=[];for(const p of t){if(c>=n.MAX_PUFFS)break;const d=o(p.centre);if(d<=0)continue;const h=s(p.centre),r=[0,1,2].map(g=>Math.min(n.BRIGHTEST_RELATIVE,p.luminanceCdM2*(p.colour?.[g]??1)*i*p.sunTransmittance[g]*h[g]*d));Math.max(...r)<=0||(a=this.pushPuff(a,p,r),this.drawn.push({view:p,direction:this.normalise(A(p.centre.altitudeDeg,p.centre.azimuthDeg,1)),radiusRad:p.radiusDeg*Math.PI/180,luminance:.2126*r[0]+.7152*r[1]+.0722*r[2]}),c++)}this.shown=c;const u=this.mesh.geometry;u.setDrawRange(0,a),u.getAttribute("position").needsUpdate=!0,u.getAttribute("color").needsUpdate=!0}pushPuff(t,i,s){const o=A(i.centre.altitudeDeg,i.centre.azimuthDeg,n.RADIUS),a=this.normalise(o),c=this.normalise(this.cross({x:0,y:1,z:0},a)),u=this.cross(a,c),p=n.RADIUS*Math.tan(i.radiusDeg*Math.PI/180),d=(r,g)=>{const e=g/n.SECTORS*2*Math.PI,I=n.RINGS[r]*p,R=Math.cos(e)*I,l=Math.sin(e)*I;return{x:o.x+c.x*R+u.x*l,y:o.y+c.y*R+u.y*l,z:o.z+c.z*R+u.z*l}},h=r=>n.COLUMN[r];for(let r=0;r<n.SECTORS;r++){const g=(r+1)%n.SECTORS;t=this.push(t,o,s,h(0)),t=this.push(t,d(1,r),s,h(1)),t=this.push(t,d(1,g),s,h(1));for(let e=1;e<n.RINGS.length-1;e++){const I=d(e,r),R=d(e,g),l=d(e+1,r),E=d(e+1,g);t=this.push(t,I,s,h(e)),t=this.push(t,R,s,h(e)),t=this.push(t,l,s,h(e+1)),t=this.push(t,R,s,h(e)),t=this.push(t,E,s,h(e+1)),t=this.push(t,l,s,h(e+1))}}return t}pickAt(t,i,s=0){const o=this.normalise(t);let a=0,c;for(const u of this.drawn){const p=Math.max(-1,Math.min(1,o.x*u.direction.x+o.y*u.direction.y+o.z*u.direction.z)),d=Math.max(0,Math.acos(p)-i)/Math.max(u.radiusRad,1e-9),h=u.luminance*n.profile(d);h<=0||(a+=h,(!c||h>c.light)&&(c={view:u.view,light:h}))}return c&&a>=n.VISIBLE_CONTRAST*s?c.view:void 0}static profile(t){const i=n.RINGS;if(t>=i[i.length-1])return 0;let s=0;for(;t>i[s+1];)s++;const o=(t-i[s])/(i[s+1]-i[s]);return n.COLUMN[s]+(n.COLUMN[s+1]-n.COLUMN[s])*o}push(t,i,s,o){const a=t*3;return this.positions[a]=i.x,this.positions[a+1]=i.y,this.positions[a+2]=i.z,this.colors[a]=s[0]*o,this.colors[a+1]=s[1]*o,this.colors[a+2]=s[2]*o,t+1}cross(t,i){return this.normalise({x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x})}normalise(t){const i=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/i,y:t.y/i,z:t.z/i}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.object.removeFromParent()}}class N{inSky=!0;plumes=new n;get object(){return this.plumes.object}get drawnCount(){return this.plumes.count}update(t,i,s){const o=t.length===0||!s.date?[]:M.viewsAt(t,i,s.observer,M.sunDirectionAt(s.date));o.length===0&&this.plumes.count===0||this.plumes.set(o,s.relativeScale,a=>s.transmittanceFromSpace(a),a=>s.cloudTransmission(a))}pick(t,i,s){const o=this.plumes.pickAt(i,s.toleranceRad,s.skyLightTowards(i));return o&&{id:o.launchId,detail:o}}dispose(){this.plumes.dispose()}}export{N as LaunchSimulation};
1
+ import{L as M}from"./LaunchPlume-CrzPcqw7.js";import{aU as T,ba as z,bb as f,aX as C,bi as w,bj as A}from"./rr0-sighting-editor.mjs";class n{static RADIUS=840;static MAX_PUFFS=1e3;static RINGS=[0,.25,.5,.75,1,1.25];static COLUMN=n.RINGS.map(t=>{const i=o=>Math.exp(-((o/M.SIGMA_OF_RADIUS)**2)/2),s=i(n.RINGS[n.RINGS.length-1]);return Math.max(0,(i(t)-s)/(1-s))});static SECTORS=12;static VERTICES_PER_PUFF=n.SECTORS*(3+6*(n.RINGS.length-2));static BRIGHTEST_RELATIVE=6e4;object=new T;mesh;positions=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);colors=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);shown=0;drawn=[];static VISIBLE_CONTRAST=.1;constructor(){this.object.name="plumes";const t=new z;t.setAttribute("position",new f(this.positions,3)),t.setAttribute("color",new f(this.colors,3)),t.setDrawRange(0,0),this.mesh=new C(t,w.material()),this.mesh.frustumCulled=!1,w.track(this.mesh),this.object.add(this.mesh)}get count(){return this.shown}set(t,i,s,o){let a=0,c=0;this.drawn=[];for(const p of t){if(c>=n.MAX_PUFFS)break;const d=o(p.centre);if(d<=0)continue;const h=s(p.centre),r=[0,1,2].map(g=>Math.min(n.BRIGHTEST_RELATIVE,p.luminanceCdM2*(p.colour?.[g]??1)*i*p.sunTransmittance[g]*h[g]*d));Math.max(...r)<=0||(a=this.pushPuff(a,p,r),this.drawn.push({view:p,direction:this.normalise(A(p.centre.altitudeDeg,p.centre.azimuthDeg,1)),radiusRad:p.radiusDeg*Math.PI/180,luminance:.2126*r[0]+.7152*r[1]+.0722*r[2]}),c++)}this.shown=c;const u=this.mesh.geometry;u.setDrawRange(0,a),u.getAttribute("position").needsUpdate=!0,u.getAttribute("color").needsUpdate=!0}pushPuff(t,i,s){const o=A(i.centre.altitudeDeg,i.centre.azimuthDeg,n.RADIUS),a=this.normalise(o),c=this.normalise(this.cross({x:0,y:1,z:0},a)),u=this.cross(a,c),p=n.RADIUS*Math.tan(i.radiusDeg*Math.PI/180),d=(r,g)=>{const e=g/n.SECTORS*2*Math.PI,I=n.RINGS[r]*p,R=Math.cos(e)*I,l=Math.sin(e)*I;return{x:o.x+c.x*R+u.x*l,y:o.y+c.y*R+u.y*l,z:o.z+c.z*R+u.z*l}},h=r=>n.COLUMN[r];for(let r=0;r<n.SECTORS;r++){const g=(r+1)%n.SECTORS;t=this.push(t,o,s,h(0)),t=this.push(t,d(1,r),s,h(1)),t=this.push(t,d(1,g),s,h(1));for(let e=1;e<n.RINGS.length-1;e++){const I=d(e,r),R=d(e,g),l=d(e+1,r),E=d(e+1,g);t=this.push(t,I,s,h(e)),t=this.push(t,R,s,h(e)),t=this.push(t,l,s,h(e+1)),t=this.push(t,R,s,h(e)),t=this.push(t,E,s,h(e+1)),t=this.push(t,l,s,h(e+1))}}return t}pickAt(t,i,s=0){const o=this.normalise(t);let a=0,c;for(const u of this.drawn){const p=Math.max(-1,Math.min(1,o.x*u.direction.x+o.y*u.direction.y+o.z*u.direction.z)),d=Math.max(0,Math.acos(p)-i)/Math.max(u.radiusRad,1e-9),h=u.luminance*n.profile(d);h<=0||(a+=h,(!c||h>c.light)&&(c={view:u.view,light:h}))}return c&&a>=n.VISIBLE_CONTRAST*s?c.view:void 0}static profile(t){const i=n.RINGS;if(t>=i[i.length-1])return 0;let s=0;for(;t>i[s+1];)s++;const o=(t-i[s])/(i[s+1]-i[s]);return n.COLUMN[s]+(n.COLUMN[s+1]-n.COLUMN[s])*o}push(t,i,s,o){const a=t*3;return this.positions[a]=i.x,this.positions[a+1]=i.y,this.positions[a+2]=i.z,this.colors[a]=s[0]*o,this.colors[a+1]=s[1]*o,this.colors[a+2]=s[2]*o,t+1}cross(t,i){return this.normalise({x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x})}normalise(t){const i=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/i,y:t.y/i,z:t.z/i}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.object.removeFromParent()}}class S{inSky=!0;plumes=new n;get object(){return this.plumes.object}get drawnCount(){return this.plumes.count}update(t,i,s){const o=t.length===0||!s.date?[]:M.viewsAt(t,i,s.observer,M.sunDirectionAt(s.date));o.length===0&&this.plumes.count===0||this.plumes.set(o,s.relativeScale,a=>s.transmittanceFromSpace(a),a=>s.cloudTransmission(a))}pick(t,i,s){const o=this.plumes.pickAt(i,s.toleranceRad,s.skyLightTowards(i));return o&&{id:o.launchId,detail:o}}dispose(){this.plumes.dispose()}}export{S as LaunchSimulation};
@@ -1 +1 @@
1
- import{ap as d,aq as c,ar as l,as as f,at as m,au as u,av as w,aw as y,ax as g,ay as M,az as S,aA as v,V as O}from"./rr0-sighting-editor.mjs";class h{static key(e){return"url"in e?`url:${e.url}|${e.headingOffsetDeg??0}`:"shape"in e?`shape:${e.shape}`:`decor:${e.decorKind}`}static async build(e){const a=new d;if("url"in e){const s=await c(e.url);s.rotation.y=-(e.headingOffsetDeg??0)*Math.PI/180,a.add(s)}else"shape"in e?a.add(h.shapeOf(e.shape)):a.add(l.build({id:"preview",kind:e.decorKind,eastM:0,northM:0},!1));return a}static shapeOf(e){if(e==="figure")return l.build({id:"preview",kind:"entity",eastM:0,northM:0},!1);const a=new f(m.unitGeometry(e),new u({color:13158608,roughness:.5,metalness:0}));return e==="ellipsoid"&&a.scale.set(1,.55,1),a}static dispose(e){e.traverse(a=>{const s=a;if(s.isMesh){s.geometry?.dispose();for(const t of[s.material].flat())t.dispose()}})}static stage(e,a){const s=new w().setFromObject(e);if(s.isEmpty())return;const t=s.getBoundingSphere(new y),r=new d;e.position.sub(t.center),r.add(e);const n=new g;n.add(r),n.add(new M(16777215,6715272,1.6));const o=new S(16777215,2.5);o.position.set(1,2,1.5),n.add(o);const i=new v(30,a,t.radius*.05,t.radius*20),p=t.radius/Math.sin(i.fov*Math.PI/360)*1.05;return i.position.copy(new O(.55,.3,-.78).normalize().multiplyScalar(p)),i.lookAt(0,0,0),{scene:n,camera:i,pivot:r}}}export{h as M};
1
+ import{aU as d,aV as c,aW as l,aX as f,aY as m,aZ as u,a_ as w,a$ as g,b0 as y,b1 as M,b2 as b,b3 as S,V as v}from"./rr0-sighting-editor.mjs";class h{static key(e){return"url"in e?`url:${e.url}|${e.headingOffsetDeg??0}`:"shape"in e?`shape:${e.shape}`:`decor:${e.decorKind}`}static async build(e){const a=new d;if("url"in e){const s=await c(e.url);s.rotation.y=-(e.headingOffsetDeg??0)*Math.PI/180,a.add(s)}else"shape"in e?a.add(h.shapeOf(e.shape)):a.add(l.build({id:"preview",kind:e.decorKind,eastM:0,northM:0},!1));return a}static shapeOf(e){if(e==="figure")return l.build({id:"preview",kind:"entity",eastM:0,northM:0},!1);const a=new f(m.unitGeometry(e),new u({color:13158608,roughness:.5,metalness:0}));return e==="ellipsoid"&&a.scale.set(1,.55,1),a}static dispose(e){e.traverse(a=>{const s=a;if(s.isMesh){s.geometry?.dispose();for(const t of[s.material].flat())t.dispose()}})}static stage(e,a){const s=new w().setFromObject(e);if(s.isEmpty())return;const t=s.getBoundingSphere(new g),r=new d;e.position.sub(t.center),r.add(e);const n=new y;n.add(r),n.add(new M(16777215,6715272,1.6));const o=new b(16777215,2.5);o.position.set(1,2,1.5),n.add(o);const i=new S(30,a,t.radius*.05,t.radius*20),p=t.radius/Math.sin(i.fov*Math.PI/360)*1.05;return i.position.copy(new v(.55,.3,-.78).normalize().multiplyScalar(p)),i.lookAt(0,0,0),{scene:n,camera:i,pivot:r}}}export{h as M};
@@ -1 +1 @@
1
- import{ao as o}from"./rr0-sighting-editor.mjs";import{M as i}from"./ModelSource-CzGHu4XS.js";class l{static SIZE_PX={width:192,height:144};static cache=new Map;static queue=Promise.resolve();static pending=0;static renderer;static of(r){const t=i.key(r);let e=this.cache.get(t);return e||(this.pending++,e=this.queue.then(()=>this.draw(r)).catch(()=>{}).finally(()=>{--this.pending===0&&this.release()}),this.queue=e,this.cache.set(t,e)),e}static async draw(r){const t=await i.build(r);try{const{width:e,height:n}=this.SIZE_PX,a=i.stage(t,e/n);if(!a)return;const s=this.renderer??=new o({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});return s.setSize(e,n,!1),s.setClearColor(0,0),s.render(a.scene,a.camera),s.domElement.toDataURL("image/png")}finally{i.dispose(t)}}static release(){this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=void 0}}export{l as ModelThumbnails};
1
+ import{aT as c}from"./rr0-sighting-editor.mjs";import{M as i}from"./ModelSource-Bko_3OJt.js";class l{static SIZE_PX={width:192,height:144};static cache=new Map;static queue=Promise.resolve();static pending=0;static renderer;static of(r){const t=i.key(r);let e=this.cache.get(t);return e||(this.pending++,e=this.queue.then(()=>this.draw(r)).catch(()=>{}).finally(()=>{--this.pending===0&&this.release()}),this.queue=e,this.cache.set(t,e)),e}static async draw(r){const t=await i.build(r);try{const{width:e,height:n}=this.SIZE_PX,a=i.stage(t,e/n);if(!a)return;const s=this.renderer??=new c({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});return s.setSize(e,n,!1),s.setClearColor(0,0),s.render(a.scene,a.camera),s.domElement.toDataURL("image/png")}finally{i.dispose(t)}}static release(){this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=void 0}}export{l as ModelThumbnails};
@@ -1 +1 @@
1
- import{ao as h}from"./rr0-sighting-editor.mjs";import{M as c}from"./ModelSource-CzGHu4XS.js";class a{constructor(t,e){this.container=t,this.source=e,this.canvas=document.createElement("canvas"),this.canvas.className="model-live",this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab;display:none",this.canvas.addEventListener("pointerdown",s=>this.press(s)),this.canvas.addEventListener("pointermove",s=>this.move(s)),this.canvas.addEventListener("pointerup",()=>this.release()),this.canvas.addEventListener("pointercancel",()=>this.release())}static renderer;static SPIN_RAD_PER_S=.7;static DRAG_RAD_PER_PX=.012;static CLICK_TOLERANCE_PX=4;static current;object;stage;frame=0;stopped=!1;last=0;dragging;draggedPastClick=!1;canvas;static show(t,e){a.current?.stop();const s=new a(t,e);return a.current=s,s.start(),s}static end(){a.current?.stop(),a.current=void 0,a.renderer?.dispose(),a.renderer?.forceContextLoss(),a.renderer=void 0}consumeDrag(){const t=this.draggedPastClick;return this.draggedPastClick=!1,t}get active(){return!this.stopped}stop(){this.stopped=!0,cancelAnimationFrame(this.frame),this.canvas.remove(),this.object&&c.dispose(this.object),this.object=void 0,a.current===this&&(a.current=void 0)}async start(){try{const t=await c.build(this.source);if(this.stopped){c.dispose(t);return}this.object=t;const{width:e,height:s}=this.container.getBoundingClientRect(),i=e>0&&s>0?e/s:4/3;if(this.stage=c.stage(t,i),!this.stage)return;(a.renderer??=new h({antialias:!0,alpha:!0})).setClearColor(0,0),this.container.append(this.canvas),this.canvas.style.display="block",this.last=performance.now(),this.tick()}catch{}}tick=()=>{if(this.stopped||!this.stage)return;const t=performance.now(),e=Math.min(.1,(t-this.last)/1e3);this.last=t,this.dragging||(this.stage.pivot.rotation.y+=a.SPIN_RAD_PER_S*e);const s=a.renderer,{width:i,height:n}=this.canvas.getBoundingClientRect(),r=Math.min(2,window.devicePixelRatio||1);(this.canvas.width!==Math.round(i*r)||this.canvas.height!==Math.round(n*r))&&(s.setPixelRatio(r),s.setSize(i,n,!1),this.canvas.width=Math.round(i*r),this.canvas.height=Math.round(n*r),this.stage.camera.aspect=i/Math.max(1,n),this.stage.camera.updateProjectionMatrix()),s.render(this.stage.scene,this.stage.camera);const o=this.canvas.getContext("2d");o?.clearRect(0,0,this.canvas.width,this.canvas.height),o?.drawImage(s.domElement,0,0,this.canvas.width,this.canvas.height),this.frame=requestAnimationFrame(this.tick)};press(t){this.dragging={x:t.clientX,y:t.clientY,moved:!1},this.canvas.setPointerCapture(t.pointerId),this.canvas.style.cursor="grabbing"}move(t){const e=this.dragging;if(!e||!this.stage)return;const s=t.clientX-e.x,i=t.clientY-e.y;!e.moved&&Math.hypot(s,i)<a.CLICK_TOLERANCE_PX||(e.moved=!0,this.draggedPastClick=!0,this.stage.pivot.rotation.y+=s*a.DRAG_RAD_PER_PX,this.stage.pivot.rotation.x=Math.max(-1.4,Math.min(1.4,this.stage.pivot.rotation.x-i*a.DRAG_RAD_PER_PX)),e.x=t.clientX,e.y=t.clientY)}release(){this.dragging=void 0,this.canvas.style.cursor="grab"}}export{a as ModelViewer};
1
+ import{aT as h}from"./rr0-sighting-editor.mjs";import{M as c}from"./ModelSource-Bko_3OJt.js";class a{constructor(t,e){this.container=t,this.source=e,this.canvas=document.createElement("canvas"),this.canvas.className="model-live",this.canvas.style.cssText="position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:grab;display:none",this.canvas.addEventListener("pointerdown",s=>this.press(s)),this.canvas.addEventListener("pointermove",s=>this.move(s)),this.canvas.addEventListener("pointerup",()=>this.release()),this.canvas.addEventListener("pointercancel",()=>this.release())}static renderer;static SPIN_RAD_PER_S=.7;static DRAG_RAD_PER_PX=.012;static CLICK_TOLERANCE_PX=4;static current;object;stage;frame=0;stopped=!1;last=0;dragging;draggedPastClick=!1;canvas;static show(t,e){a.current?.stop();const s=new a(t,e);return a.current=s,s.start(),s}static end(){a.current?.stop(),a.current=void 0,a.renderer?.dispose(),a.renderer?.forceContextLoss(),a.renderer=void 0}consumeDrag(){const t=this.draggedPastClick;return this.draggedPastClick=!1,t}get active(){return!this.stopped}stop(){this.stopped=!0,cancelAnimationFrame(this.frame),this.canvas.remove(),this.object&&c.dispose(this.object),this.object=void 0,a.current===this&&(a.current=void 0)}async start(){try{const t=await c.build(this.source);if(this.stopped){c.dispose(t);return}this.object=t;const{width:e,height:s}=this.container.getBoundingClientRect(),i=e>0&&s>0?e/s:4/3;if(this.stage=c.stage(t,i),!this.stage)return;(a.renderer??=new h({antialias:!0,alpha:!0})).setClearColor(0,0),this.container.append(this.canvas),this.canvas.style.display="block",this.last=performance.now(),this.tick()}catch{}}tick=()=>{if(this.stopped||!this.stage)return;const t=performance.now(),e=Math.min(.1,(t-this.last)/1e3);this.last=t,this.dragging||(this.stage.pivot.rotation.y+=a.SPIN_RAD_PER_S*e);const s=a.renderer,{width:i,height:n}=this.canvas.getBoundingClientRect(),r=Math.min(2,window.devicePixelRatio||1);(this.canvas.width!==Math.round(i*r)||this.canvas.height!==Math.round(n*r))&&(s.setPixelRatio(r),s.setSize(i,n,!1),this.canvas.width=Math.round(i*r),this.canvas.height=Math.round(n*r),this.stage.camera.aspect=i/Math.max(1,n),this.stage.camera.updateProjectionMatrix()),s.render(this.stage.scene,this.stage.camera);const o=this.canvas.getContext("2d");o?.clearRect(0,0,this.canvas.width,this.canvas.height),o?.drawImage(s.domElement,0,0,this.canvas.width,this.canvas.height),this.frame=requestAnimationFrame(this.tick)};press(t){this.dragging={x:t.clientX,y:t.clientY,moved:!1},this.canvas.setPointerCapture(t.pointerId),this.canvas.style.cursor="grabbing"}move(t){const e=this.dragging;if(!e||!this.stage)return;const s=t.clientX-e.x,i=t.clientY-e.y;!e.moved&&Math.hypot(s,i)<a.CLICK_TOLERANCE_PX||(e.moved=!0,this.draggedPastClick=!0,this.stage.pivot.rotation.y+=s*a.DRAG_RAD_PER_PX,this.stage.pivot.rotation.x=Math.max(-1.4,Math.min(1.4,this.stage.pivot.rotation.x-i*a.DRAG_RAD_PER_PX)),e.x=t.clientX,e.y=t.clientY)}release(){this.dragging=void 0,this.canvas.style.cursor="grab"}}export{a as ModelViewer};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-DSghL4fp.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
2
- import{_ as w}from"./rr0-sighting-editor.mjs";class n{static MEMBERS={weather:["getWeather"],place:["attribution","search","reverse"],timeZone:["zoneAt"],narrative:["settings","draft"],assessment:["assess"],lightPollution:["year","citation","lookUp"],aircraft:["citation","between"],upperAir:["between"],elevation:["getElevationGrid"],imagery:["attribution","getImageryTexture"],surroundings:["id","name","attribution","creditUrl","contemporary","covers","getSurroundings"],decorModels:["attribution","entries","entry"],skyEvents:["key","messages","simulation"],interpretations:["key","messages","compute"],perception:["id","messages","sources","settings","perceive"],transcription:["sendsAudio","engine","transcribe"],reentryTypes:["key","nature","messages","template"]};static WEATHER_SHARES=["cloudCover","cloudDarkness","precipitationIntensity","highCloudCover","lowerCloudCover","iceCrystalAlignment","rareIceCrystals","relativeHumidity"];static WEATHER_REQUIRED=["cloudCover","cloudDarkness","precipitationIntensity"];static PRECIPITATIONS=["none","rain","snow","hail"];static HIGH_WIND_MS=60;static TIMEOUT_MS=3e4;static async check(i,a={}){const r=[];i.hasScript&&!i.scriptRun&&r.push({level:"note",code:"scriptNotRun"});for(const[t,s]of Object.entries(i.module.contributes))Object.hasOwn(n.MEMBERS,t)?Array.isArray(s)?await n.checkPoint(t,s,a,r):r.push({level:"failed",code:"notAList",point:t}):r.push({level:"failed",code:"unknownPoint",point:t});return r}static async checkPoint(i,a,r,t){const s=new Set;for(const e of a){const c=(l,d,g="failed")=>{t.push({level:g,code:l,point:i,source:typeof e?.id=="string"?e.id:void 0,detail:d})};if(s.has(e?.id)&&c("duplicateId"),s.add(e?.id),n.checkEntry(e,c),typeof e?.create!="function"){c("createMissing");continue}const o=n.build(e,c);if(o===void 0)continue;const h=n.MEMBERS[i].filter(l=>o[l]===void 0);for(const l of h)c("missingMember",l);h.length>0||(i==="weather"&&await n.checkWeather(e.id,o,r,c),i==="skyEvents"&&await n.checkSkyEventKind(e.id,o,r,c),i==="interpretations"&&await n.checkInterpretationKind(e.id,o,r,c))}}static checkEntry(i,a){for(const r of["id","name","credit","creditUrl"]){const t=i?.[r];(typeof t!="string"||t.trim()==="")&&a("entryField",r)}typeof i?.creditUrl=="string"&&i.creditUrl!==""&&!URL.canParse(i.creditUrl)&&a("entryField","creditUrl")}static build(i,a){let r=!1;const t=(async()=>(r=!0,new Response("",{status:503}))),s=globalThis.fetch;globalThis.fetch=t;try{const e=i.create(t);if(r&&a("createAsked"),e==null){a("createEmpty");return}return e}catch(e){a("createThrew",n.told(e));return}finally{globalThis.fetch=s}}static async checkWeather(i,a,r,t){const s=r.weatherQuery;if(!s){t("weatherNotAsked",void 0,"note");return}let e;try{e=await n.within(a.getWeather(s),r)}catch(l){t("weatherThrew",n.told(l));return}if(e===void 0){t("weatherNoRecord",void 0,"note");return}const c=e?.samples;if(!Array.isArray(c)||c.length!==s.points.length){t("weatherSamples",`${Array.isArray(c)?c.length:0}/${s.points.length}`);return}c.some((l,d)=>l?.time?.getTime?.()!==s.points[d].time.getTime())&&t("weatherOrder");const o=new Set;let h=!1;for(const l of c){const d=l?.weather??{};for(const g of n.WEATHER_SHARES){const u=d[g],p=n.WEATHER_REQUIRED.includes(g);(u!==void 0||p)&&!n.between(u,0,1)&&o.add(`${g} = ${String(u)}`)}n.between(d.windDirectionDeg,0,360)||o.add(`windDirectionDeg = ${String(d.windDirectionDeg)}`),n.between(d.windSpeed,0,1/0)?d.windSpeed>n.HIGH_WIND_MS&&(h=!0):o.add(`windSpeed = ${String(d.windSpeed)}`),n.PRECIPITATIONS.includes(d.precipitationType)||o.add(`precipitationType = ${String(d.precipitationType)}`),typeof d.storm!="boolean"&&o.add(`storm = ${String(d.storm)}`)}for(const l of o)t("weatherValue",l);h&&t("weatherWindHigh",void 0,"note"),e.source?.id!==i&&t("weatherSource","id"),(typeof e.source?.name!="string"||e.source.name==="")&&t("weatherSource","name"),(typeof e.source?.url!="string"||e.source.url==="")&&t("weatherSource","url")}static async checkSkyEventKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title","name"],r,t);let s;try{s=(await n.within(a.simulation(),r))()}catch(o){t("simulationFailed",n.told(o));return}const{MODULE_THREE:e}=await w(async()=>{const{MODULE_THREE:o}=await import("./ModuleThree-DSghL4fp.js");return{MODULE_THREE:o}},__vite__mapDeps([0,1]),import.meta.url);if(!(s?.object instanceof e.Object3D)){t("secondThree");return}try{s.update([],0,n.frame(new e.Vector3)),s.drawnCount!==0&&t("drawnWithoutEvents",String(s.drawnCount))}catch(o){t("updateThrew",n.told(o))}const c=new e.Group;c.add(s.object);try{s.dispose(),s.object.parent===c&&t("disposeLeft")}catch(o){t("disposeThrew",n.told(o))}}static async checkInterpretationKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title"],r,t);const s=r.interpretation?.[a.key];if(!Array.isArray(s)||s.length===0){t("readingNotTried",void 0,"note");return}let e;try{if(e=await n.within(a.compute(),r),typeof e!="function"){t("readingThrew","compute");return}}catch(c){t("readingThrew",n.told(c));return}for(const c of s)try{const o=e(c);Array.isArray(o)||t("readingNotAList")}catch(o){t("readingThrew",n.told(o))}}static async checkTexts(i,a,r,t){for(const s of["en","fr"])try{const e=await n.within(i.load(s),r);for(const c of a)(typeof e?.[c]!="string"||e[c]==="")&&t("kindMessages",`${s}: ${c}`)}catch(e){t("kindMessages",`${s}: ${n.told(e)}`)}}static frame(i){return{reference:{lat:0,lng:0},origin:{x:0,z:0},eastScale:1,siteElevationM:0,eye:i,pixelRad:.001,relativeScale:1,air:{},transmittanceTo:()=>[1,1,1],groundYAt:()=>0,wind:{eastMS:0,northMS:0},observer:{lat:0,lng:0,heightM:0},date:new Date(0),magnitudeLimit:6,cloudTransmission:()=>1,arrivingIlluminance:()=>[0,0,0],transmittanceFromSpace:()=>[1,1,1],lightFrom:()=>{},glareFrom:()=>{}}}static between(i,a,r){return typeof i=="number"&&!Number.isNaN(i)&&i>=a&&i<=r}static told(i){return i instanceof Error?i.message:String(i)}static within(i,a){const r=a.timeoutMs??n.TIMEOUT_MS;let t;const s=new Promise((e,c)=>{t=setTimeout(()=>c(new Error(`> ${r/1e3} s`)),r)});return Promise.race([i,s]).finally(()=>clearTimeout(t))}}export{n as ModuleConformance};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-Fvr5G-Yh.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
2
+ import{_ as w}from"./rr0-sighting-editor.mjs";class n{static MEMBERS={weather:["getWeather"],place:["attribution","search","reverse"],timeZone:["zoneAt"],narrative:["settings","draft"],assessment:["assess"],lightPollution:["year","citation","lookUp"],aircraft:["citation","between"],upperAir:["between"],elevation:["getElevationGrid"],imagery:["attribution","getImageryTexture"],surroundings:["id","name","attribution","creditUrl","contemporary","covers","getSurroundings"],decorModels:["attribution","entries","entry"],skyEvents:["key","messages","simulation"],interpretations:["key","messages","compute"],perception:["id","messages","sources","settings","perceive"],transcription:["sendsAudio","engine","transcribe"],reentryTypes:["key","nature","messages","template"]};static WEATHER_SHARES=["cloudCover","cloudDarkness","precipitationIntensity","highCloudCover","lowerCloudCover","iceCrystalAlignment","rareIceCrystals","relativeHumidity"];static WEATHER_REQUIRED=["cloudCover","cloudDarkness","precipitationIntensity"];static PRECIPITATIONS=["none","rain","snow","hail"];static HIGH_WIND_MS=60;static TIMEOUT_MS=3e4;static async check(i,a={}){const r=[];i.hasScript&&!i.scriptRun&&r.push({level:"note",code:"scriptNotRun"});for(const[t,s]of Object.entries(i.module.contributes))Object.hasOwn(n.MEMBERS,t)?Array.isArray(s)?await n.checkPoint(t,s,a,r):r.push({level:"failed",code:"notAList",point:t}):r.push({level:"failed",code:"unknownPoint",point:t});return r}static async checkPoint(i,a,r,t){const s=new Set;for(const e of a){const c=(l,d,g="failed")=>{t.push({level:g,code:l,point:i,source:typeof e?.id=="string"?e.id:void 0,detail:d})};if(s.has(e?.id)&&c("duplicateId"),s.add(e?.id),n.checkEntry(e,c),typeof e?.create!="function"){c("createMissing");continue}const o=n.build(e,c);if(o===void 0)continue;const h=n.MEMBERS[i].filter(l=>o[l]===void 0);for(const l of h)c("missingMember",l);h.length>0||(i==="weather"&&await n.checkWeather(e.id,o,r,c),i==="skyEvents"&&await n.checkSkyEventKind(e.id,o,r,c),i==="interpretations"&&await n.checkInterpretationKind(e.id,o,r,c))}}static checkEntry(i,a){for(const r of["id","name","credit","creditUrl"]){const t=i?.[r];(typeof t!="string"||t.trim()==="")&&a("entryField",r)}typeof i?.creditUrl=="string"&&i.creditUrl!==""&&!URL.canParse(i.creditUrl)&&a("entryField","creditUrl")}static build(i,a){let r=!1;const t=(async()=>(r=!0,new Response("",{status:503}))),s=globalThis.fetch;globalThis.fetch=t;try{const e=i.create(t);if(r&&a("createAsked"),e==null){a("createEmpty");return}return e}catch(e){a("createThrew",n.told(e));return}finally{globalThis.fetch=s}}static async checkWeather(i,a,r,t){const s=r.weatherQuery;if(!s){t("weatherNotAsked",void 0,"note");return}let e;try{e=await n.within(a.getWeather(s),r)}catch(l){t("weatherThrew",n.told(l));return}if(e===void 0){t("weatherNoRecord",void 0,"note");return}const c=e?.samples;if(!Array.isArray(c)||c.length!==s.points.length){t("weatherSamples",`${Array.isArray(c)?c.length:0}/${s.points.length}`);return}c.some((l,d)=>l?.time?.getTime?.()!==s.points[d].time.getTime())&&t("weatherOrder");const o=new Set;let h=!1;for(const l of c){const d=l?.weather??{};for(const g of n.WEATHER_SHARES){const u=d[g],p=n.WEATHER_REQUIRED.includes(g);(u!==void 0||p)&&!n.between(u,0,1)&&o.add(`${g} = ${String(u)}`)}n.between(d.windDirectionDeg,0,360)||o.add(`windDirectionDeg = ${String(d.windDirectionDeg)}`),n.between(d.windSpeed,0,1/0)?d.windSpeed>n.HIGH_WIND_MS&&(h=!0):o.add(`windSpeed = ${String(d.windSpeed)}`),n.PRECIPITATIONS.includes(d.precipitationType)||o.add(`precipitationType = ${String(d.precipitationType)}`),typeof d.storm!="boolean"&&o.add(`storm = ${String(d.storm)}`)}for(const l of o)t("weatherValue",l);h&&t("weatherWindHigh",void 0,"note"),e.source?.id!==i&&t("weatherSource","id"),(typeof e.source?.name!="string"||e.source.name==="")&&t("weatherSource","name"),(typeof e.source?.url!="string"||e.source.url==="")&&t("weatherSource","url")}static async checkSkyEventKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title","name"],r,t);let s;try{s=(await n.within(a.simulation(),r))()}catch(o){t("simulationFailed",n.told(o));return}const{MODULE_THREE:e}=await w(async()=>{const{MODULE_THREE:o}=await import("./ModuleThree-Fvr5G-Yh.js");return{MODULE_THREE:o}},__vite__mapDeps([0,1]),import.meta.url);if(!(s?.object instanceof e.Object3D)){t("secondThree");return}try{s.update([],0,n.frame(new e.Vector3)),s.drawnCount!==0&&t("drawnWithoutEvents",String(s.drawnCount))}catch(o){t("updateThrew",n.told(o))}const c=new e.Group;c.add(s.object);try{s.dispose(),s.object.parent===c&&t("disposeLeft")}catch(o){t("disposeThrew",n.told(o))}}static async checkInterpretationKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title"],r,t);const s=r.interpretation?.[a.key];if(!Array.isArray(s)||s.length===0){t("readingNotTried",void 0,"note");return}let e;try{if(e=await n.within(a.compute(),r),typeof e!="function"){t("readingThrew","compute");return}}catch(c){t("readingThrew",n.told(c));return}for(const c of s)try{const o=e(c);Array.isArray(o)||t("readingNotAList")}catch(o){t("readingThrew",n.told(o))}}static async checkTexts(i,a,r,t){for(const s of["en","fr"])try{const e=await n.within(i.load(s),r);for(const c of a)(typeof e?.[c]!="string"||e[c]==="")&&t("kindMessages",`${s}: ${c}`)}catch(e){t("kindMessages",`${s}: ${n.told(e)}`)}}static frame(i){return{reference:{lat:0,lng:0},origin:{x:0,z:0},eastScale:1,siteElevationM:0,eye:i,pixelRad:.001,relativeScale:1,air:{},transmittanceTo:()=>[1,1,1],groundYAt:()=>0,wind:{eastMS:0,northMS:0},observer:{lat:0,lng:0,heightM:0},date:new Date(0),magnitudeLimit:6,cloudTransmission:()=>1,arrivingIlluminance:()=>[0,0,0],transmittanceFromSpace:()=>[1,1,1],lightFrom:()=>{},glareFrom:()=>{}}}static between(i,a,r){return typeof i=="number"&&!Number.isNaN(i)&&i>=a&&i<=r}static told(i){return i instanceof Error?i.message:String(i)}static within(i,a){const r=a.timeoutMs??n.TIMEOUT_MS;let t;const s=new Promise((e,c)=>{t=setTimeout(()=>c(new Error(`> ${r/1e3} s`)),r)});return Promise.race([i,s]).finally(()=>clearTimeout(t))}}export{n as ModuleConformance};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-DSghL4fp.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
2
- import{C as g,D as w,_ as b,M as p}from"./rr0-sighting-editor.mjs";class n{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=n.storage()){try{const e=t?.getItem(n.STORAGE_KEY);return e?n.parse(e):n.empty()}catch{return n.empty()}}static write(t,e=n.storage()){try{return e?(t.modules.length===0?e.removeItem(n.STORAGE_KEY):e.setItem(n.STORAGE_KEY,n.text(t)),!0):!1}catch{return!1}}static parse(t){const e=JSON.parse(t);if(e===null||typeof e!="object"||!Array.isArray(e.modules))throw new Error("not a UFO@home module list");if(typeof e.format=="number"&&e.format>n.FORMAT)throw new Error(`format ${e.format} is newer than ${n.FORMAT}`);const r=new Set,s=[];for(const i of e.modules)typeof i?.url!="string"||r.has(i.url)||(r.add(i.url),s.push({url:i.url,enabled:i.enabled!==!1}));return{format:1,modules:s}}static text(t){return JSON.stringify({format:n.FORMAT,modules:t.modules},null,2)+`
3
- `}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,r=>f.tileUrl(this.tileUrlTemplate,r),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-DSghL4fp.js");return{MODULE_THREE:h}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:s,module:d.module(s,t,a),hasScript:i,scriptRun:i&&e.runScript}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=n.empty();started;list(){const t=[...this.states.values()];return[...t.filter(e=>e.addedByPerson),...t.filter(e=>!e.addedByPerson)]}state(t){return this.states.get(t)}start(){return this.started??=this.applyConfig(n.read(this.storage)),this.started}async add(t){await this.start();const e=new URL(t,typeof location>"u"?void 0:location.href).href;return this.config.modules.some(r=>r.url===e)||(this.config={...this.config,modules:[...this.config.modules,{url:e,enabled:!0}]},this.save()),this.reload(e)}async remove(t){this.config={...this.config,modules:this.config.modules.filter(e=>e.url!==t)},this.save(),await this.reload(t)}async setEnabled(t,e){this.config={...this.config,modules:this.config.modules.map(r=>r.url===t?{...r,enabled:e}:r)},this.save(),await this.reload(t)}exportText(){return n.text(this.config)}async importText(t){const e=n.parse(t);await this.start();const r=this.config.modules.map(s=>s.url);this.config=e,this.save(),await Promise.all([...new Set([...r,...e.modules.map(s=>s.url)])].map(s=>this.reload(s)))}async require(t,e){t?.length&&(await this.start(),await Promise.all(t.map(async r=>{let s;try{s=new URL(r,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const i=this.states.get(s);if(i&&i.status!=="off")return i.status==="loading"?this.pending.get(s):void 0;this.named.add(s),await this.reload(s)})))}named=new Set;pending=new Map;async applyConfig(t){this.config=t,await Promise.all(t.modules.map(e=>this.reload(e.url)))}reload(t){const e=this.reloadNow(t);return this.pending.set(t,e),e}async reloadNow(t){const e=this.config.modules.find(a=>a.url===t),r=this.states.get(t);r?.loaded&&p.uninstall(r.loaded.module.id);const s=e!==void 0,i=e?.enabled??!0;if(!s&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:s,enabled:i,status:"off"};if(s&&!i&&!this.named.has(t))return this.set({url:t,addedByPerson:s,enabled:i,status:"off"});this.set({url:t,addedByPerson:s,enabled:i,status:"loading"});try{const a=await this.loader.load(t,{runScript:s&&i});return p.install(a.module),this.set({url:t,addedByPerson:s,enabled:i,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:s,enabled:i,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){n.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-Fvr5G-Yh.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
2
+ import{z as g,C as w,_ as b,M as p}from"./rr0-sighting-editor.mjs";class n{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=n.storage()){try{const e=t?.getItem(n.STORAGE_KEY);return e?n.parse(e):n.empty()}catch{return n.empty()}}static write(t,e=n.storage()){try{return e?(t.modules.length===0?e.removeItem(n.STORAGE_KEY):e.setItem(n.STORAGE_KEY,n.text(t)),!0):!1}catch{return!1}}static parse(t){const e=JSON.parse(t);if(e===null||typeof e!="object"||!Array.isArray(e.modules))throw new Error("not a UFO@home module list");if(typeof e.format=="number"&&e.format>n.FORMAT)throw new Error(`format ${e.format} is newer than ${n.FORMAT}`);const r=new Set,s=[];for(const i of e.modules)typeof i?.url!="string"||r.has(i.url)||(r.add(i.url),s.push({url:i.url,enabled:i.enabled!==!1}));return{format:1,modules:s}}static text(t){return JSON.stringify({format:n.FORMAT,modules:t.modules},null,2)+`
3
+ `}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,r=>f.tileUrl(this.tileUrlTemplate,r),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-Fvr5G-Yh.js");return{MODULE_THREE:h}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:s,module:d.module(s,t,a),hasScript:i,scriptRun:i&&e.runScript}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=n.empty();started;list(){const t=[...this.states.values()];return[...t.filter(e=>e.addedByPerson),...t.filter(e=>!e.addedByPerson)]}state(t){return this.states.get(t)}start(){return this.started??=this.applyConfig(n.read(this.storage)),this.started}async add(t){await this.start();const e=new URL(t,typeof location>"u"?void 0:location.href).href;return this.config.modules.some(r=>r.url===e)||(this.config={...this.config,modules:[...this.config.modules,{url:e,enabled:!0}]},this.save()),this.reload(e)}async remove(t){this.config={...this.config,modules:this.config.modules.filter(e=>e.url!==t)},this.save(),await this.reload(t)}async setEnabled(t,e){this.config={...this.config,modules:this.config.modules.map(r=>r.url===t?{...r,enabled:e}:r)},this.save(),await this.reload(t)}exportText(){return n.text(this.config)}async importText(t){const e=n.parse(t);await this.start();const r=this.config.modules.map(s=>s.url);this.config=e,this.save(),await Promise.all([...new Set([...r,...e.modules.map(s=>s.url)])].map(s=>this.reload(s)))}async require(t,e){t?.length&&(await this.start(),await Promise.all(t.map(async r=>{let s;try{s=new URL(r,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const i=this.states.get(s);if(i&&i.status!=="off")return i.status==="loading"?this.pending.get(s):void 0;this.named.add(s),await this.reload(s)})))}named=new Set;pending=new Map;async applyConfig(t){this.config=t,await Promise.all(t.modules.map(e=>this.reload(e.url)))}reload(t){const e=this.reloadNow(t);return this.pending.set(t,e),e}async reloadNow(t){const e=this.config.modules.find(a=>a.url===t),r=this.states.get(t);r?.loaded&&p.uninstall(r.loaded.module.id);const s=e!==void 0,i=e?.enabled??!0;if(!s&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:s,enabled:i,status:"off"};if(s&&!i&&!this.named.has(t))return this.set({url:t,addedByPerson:s,enabled:i,status:"off"});this.set({url:t,addedByPerson:s,enabled:i,status:"loading"});try{const a=await this.loader.load(t,{runScript:s&&i});return p.install(a.module),this.set({url:t,addedByPerson:s,enabled:i,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:s,enabled:i,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){n.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
@@ -0,0 +1 @@
1
+ import{V as a,bH as e,cT as s,b_ as t,c0 as r,cd as i,bS as o,Q as c,bZ as n,bp as b,cm as l,ce as d,D as m,cU as u,aZ as M,bc as S,aX as B,G,cD as y,cA as f,cE as p,aU as h,cR as D,bM as x,F as E,bd as L,cV as T,cW as g,cX as A,br as C,b$ as P,ba as V,bb as F,cY as U,cc as v,be as H}from"./rr0-sighting-editor.mjs";const Q={AdditiveBlending:H,BackSide:v,BoxGeometry:U,BufferAttribute:F,BufferGeometry:V,CanvasTexture:P,Color:C,ConeGeometry:A,CylinderGeometry:g,DataTexture:T,DoubleSide:L,Euler:E,Float32BufferAttribute:x,FrontSide:D,Group:h,Line:p,LineBasicMaterial:f,LineSegments:y,Matrix4:G,Mesh:B,MeshBasicMaterial:S,MeshStandardMaterial:M,NormalBlending:u,Object3D:m,PlaneGeometry:d,PointLight:l,Points:b,PointsMaterial:n,Quaternion:c,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{Q as MODULE_THREE};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-C9DED8Lk.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
2
- import{o as _,_ as x,H as y,z as L,i as m}from"./rr0-sighting-editor.mjs";import{ModuleSession as C}from"./ModuleSession-Cxe0BJue.js";const P=_.catalog({en:()=>x(()=>import("./ModulesPanelMessages_en-DuwrY3Pm.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_en),fr:()=>x(()=>import("./ModulesPanelMessages_fr-B8cSDc6o.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_fr),es:()=>x(()=>import("./ModulesPanelMessages_es-Bq5X-XuT.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_es),it:()=>x(()=>import("./ModulesPanelMessages_it-BdC626aJ.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_it)}),N="rr0-modules-panel",A=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-B6iFVb8X.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
2
+ import{n as N,_ as x,c as _,y as L,h as m}from"./rr0-sighting-editor.mjs";import{ModuleSession as C}from"./ModuleSession-jKFl1FMo.js";const P=N.catalog({en:()=>x(()=>import("./ModulesPanelMessages_en-DuwrY3Pm.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_en),fr:()=>x(()=>import("./ModulesPanelMessages_fr-B8cSDc6o.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_fr),es:()=>x(()=>import("./ModulesPanelMessages_es-Bq5X-XuT.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_es),it:()=>x(()=>import("./ModulesPanelMessages_it-BdC626aJ.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_it)}),y="rr0-modules-panel",A=`
3
3
  rr0-modules-panel { display: block; }
4
4
  rr0-modules-panel .mp-add { display: flex; gap: .4em; align-items: center; margin: .4em 0; }
5
5
  rr0-modules-panel .mp-add input { flex: 1 1 16em; min-width: 0; }
@@ -12,4 +12,4 @@ rr0-modules-panel .mp-head .mp-remove { margin-left: auto; }
12
12
  rr0-modules-panel .mp-module p { margin: .2em 0; }
13
13
  rr0-modules-panel .mp-findings { margin: .3em 0; padding-left: 1.2em; }
14
14
  rr0-modules-panel .mp-files { display: flex; gap: .6em; flex-wrap: wrap; align-items: center; margin-top: .6em; }
15
- `;class M extends HTMLElement{session=C.shared;messages;languageAsked=!1;named=[];recordingBase;note;languageToken=0;draft="";onChange=()=>this.render();checkContext;checks=new Map;set moduleSession(e){this.session.changes.removeEventListener("change",this.onChange),this.session=e,this.isConnected&&this.session.changes.addEventListener("change",this.onChange),this.render()}get recordingModules(){return[...this.named]}set recordingModules(e){this.named=[...e??[]],this.render()}set base(e){this.recordingBase=e,this.render()}async setLanguage(e){this.languageAsked=!0;const t=++this.languageToken,n=await P.load(e);t===this.languageToken&&(this.messages=n,this.render())}connectedCallback(){this.languageAsked||this.setLanguage(y.preferencesFor(this)[0]??"en"),this.session.changes.addEventListener("change",this.onChange),this.session.start(),this.render()}disconnectedCallback(){this.session.changes.removeEventListener("change",this.onChange)}absolute(e){try{return new URL(e,this.recordingBase??location.href).href}catch{return}}isNamed(e){return this.named.some(t=>this.absolute(t)===e)}setNamed(e,t){t!==this.isNamed(e)&&(this.named=t?[...this.named,L.of(e,this.recordingBase)]:this.named.filter(n=>this.absolute(n)!==e),t&&this.session.require([e]),this.dispatchEvent(new Event("recordingmoduleschange",{bubbles:!0})),this.render())}render(){const e=this.messages;if(!this.isConnected||!this.messages)return;const t=this.ownerDocument,n=t.createElement("style");n.textContent=A;const s=t.createElement("p");s.className=m.INFO,s.textContent=e.intro;const a=t.createElement("form");a.className="mp-add";const i=t.createElement("input");i.type="url",i.id="module-url",i.required=!0,i.placeholder=e.urlPlaceholder,i.value=this.draft,i.addEventListener("input",()=>{this.draft=i.value}),i.setAttribute("aria-label",e.urlPlaceholder);const u=t.createElement("button");u.type="submit",u.textContent=e.add,a.append(i,u),a.addEventListener("submit",r=>{r.preventDefault();const w=i.value.trim();w&&(this.draft="",this.session.add(w))});const l=t.createElement("p");l.className=m.WARNING,l.textContent=e.codeWarning;const c=this.session.list(),h=new Set(c.map(r=>r.url)),v=this.named.map(r=>this.absolute(r)).filter(r=>r!==void 0&&!h.has(r)),g=t.createElement("ul");g.className="mp-list",g.append(...c.map(r=>this.item(r)),...v.map(r=>this.item({url:r,addedByPerson:!1,enabled:!0,status:"loading"})));const k=t.createElement("p");k.className=m.INFO,k.textContent=e.none,k.hidden=g.childElementCount>0;const f=t.createElement("div");f.className="mp-files";const E=t.createElement("button");E.type="button",E.id="modules-export",E.textContent=e.exportConfig,E.disabled=!c.some(r=>r.addedByPerson),E.addEventListener("click",()=>this.download());const p=t.createElement("input");p.type="file",p.id="modules-import",p.accept="application/json,.json",p.hidden=!0;const o=t.createElement("button");o.type="button",o.textContent=e.importConfig,o.addEventListener("click",()=>p.click()),p.addEventListener("change",()=>{const r=p.files?.[0];r&&this.importFile(r),p.value=""}),f.append(E,o,p);const d=t.createElement("p");d.id="modules-note",d.setAttribute("role","status"),m.show(d,this.note?.text,this.note?.kind),this.replaceChildren(n,s,a,l,g,k,f,d)}item(e){const t=this.messages,n=this.ownerDocument,s=e.loaded,a=n.createElement("li");a.className="mp-module",a.dataset.url=e.url;const i=n.createElement("div");if(i.className="mp-head",e.addedByPerson){const o=n.createElement("label"),d=n.createElement("input");d.type="checkbox",d.className="mp-enabled",d.checked=e.enabled,d.addEventListener("change",()=>void this.session.setEnabled(e.url,d.checked)),o.append(d,n.createTextNode(` ${t.enabled}`)),i.append(o)}const u=n.createElement("span");u.className="mp-name",u.textContent=e.loaded?.module.name??e.url,i.append(u);const l=e.loaded?.module.credit;if(l){const o=n.createElement(e.loaded?.module.creditUrl?"a":"span");o.className=m.INFO,o.textContent=l,o instanceof HTMLAnchorElement&&(o.href=e.loaded.module.creditUrl,o.target="_blank",o.rel="noopener noreferrer"),i.append(o)}const c=n.createElement("button");if(c.type="button",c.className="mp-remove",e.addedByPerson?(c.textContent=t.remove,c.addEventListener("click",()=>void this.session.remove(e.url))):(c.textContent=t.addToMine,c.addEventListener("click",()=>void this.session.add(e.url))),e.status==="installed"&&s){const o=n.createElement("button");o.type="button",o.className="mp-check";const d=this.checks.get(e.url),r=d?.of===s&&d.findings===void 0&&d.crash===void 0;o.textContent=r?t.checking:t.check,o.disabled=r,o.addEventListener("click",()=>void this.check(e.url,s)),i.append(o)}i.append(c);const h=n.createElement("p");h.className=`${m.INFO} mp-url`,h.textContent=e.url;const v=n.createElement("p");v.className="mp-status",e.status==="loading"?m.show(v,t.loading):e.status==="failed"?m.show(v,t.failed.replace("{error}",e.error??""),"error"):e.status==="off"?m.show(v,t.off):m.show(v,this.brings(e));const g=n.createElement("p");g.className="mp-code",s?.scriptRun?m.show(g,t.runsCode,"warning"):s?.hasScript?m.show(g,t.codeNotRun,"info"):g.hidden=!0;const k=n.createElement("label");k.title=t.namedByRecordingHint;const f=n.createElement("input");f.type="checkbox",f.className="mp-named",f.checked=this.isNamed(e.url),f.addEventListener("change",()=>this.setNamed(e.url,f.checked)),k.append(f,n.createTextNode(` ${t.namedByRecording}`));const E=n.createElement("p");E.append(k),a.append(i,h,v,g,E);const p=this.checks.get(e.url);return p&&p.of===s&&a.append(...this.checkResult(p)),a}async check(e,t){const n={of:t};this.checks.set(e,n),this.render();try{const{ModuleConformance:s}=await x(async()=>{const{ModuleConformance:a}=await import("./ModuleConformance-C9DED8Lk.js");return{ModuleConformance:a}},__vite__mapDeps([0,1]),import.meta.url);n.findings=await s.check(t,this.checkContext?.())}catch(s){n.crash=s instanceof Error?s.message:String(s)}this.render()}checkResult(e){const t=this.messages,n=this.ownerDocument,s=(l,c)=>{const h=n.createElement("p");return h.className="mp-check-result",h.setAttribute("role","status"),m.show(h,l,c),h};if(e.crash!==void 0)return[s(t.checkCrashed.replace("{error}",()=>e.crash),"error")];if(!e.findings)return[];const a=e.findings.filter(l=>l.level==="failed"),i=e.findings.filter(l=>l.level==="note"),u=[];if(a.length===0&&u.push(s(t.checkPassed,"info")),a.length+i.length>0){const l=n.createElement("ul");l.className="mp-findings";for(const c of[...a,...i]){const h=n.createElement("li");m.show(h,this.finding(c),c.level==="failed"?"error":"info"),l.append(h)}u.push(l)}return u}finding(e){const t=this.messages,n=e.point===void 0?"":t.points[e.point]??e.point,s=t.checks[e.code].replace("{point}",()=>e.point??"").replace("{detail}",()=>e.detail??""),a=e.source??(e.code==="unknownPoint"||e.code==="notAList"?void 0:n);return a?t.checkAbout.replace("{about}",()=>a).replace("{text}",()=>s):s}brings(e){const t=Object.entries(e.loaded?.module.contributes??{}).filter(([,n])=>Array.isArray(n)&&n.length>0).map(([n,s])=>`${this.messages.points[n]??n} (${s.length})`);return t.length>0?this.messages.brings.replace("{points}",t.join(", ")):this.messages.bringsNothing}download(){const e=new Blob([this.session.exportText()],{type:"application/json"}),t=URL.createObjectURL(e),n=this.ownerDocument.createElement("a");n.href=t,n.download="ufoathome-modules.json",n.click(),URL.revokeObjectURL(t)}async importFile(e){try{await this.session.importText(await e.text());const t=this.session.list().filter(n=>n.addedByPerson).length;this.note={text:this.messages.imported.replace("{count}",String(t)),kind:"info"}}catch(t){this.note={text:this.messages.importFailed.replace("{error}",t instanceof Error?t.message:String(t)),kind:"error"}}this.render()}}function B(){customElements.get(N)||customElements.define(N,M)}export{N as MODULES_PANEL_ELEMENT_NAME,M as ModulesPanelElement,B as register};
15
+ `;class M extends HTMLElement{session=C.shared;messages;languageAsked=!1;named=[];recordingBase;note;languageToken=0;draft="";onChange=()=>this.render();checkContext;checks=new Map;set moduleSession(e){this.session.changes.removeEventListener("change",this.onChange),this.session=e,this.isConnected&&this.session.changes.addEventListener("change",this.onChange),this.render()}get recordingModules(){return[...this.named]}set recordingModules(e){this.named=[...e??[]],this.render()}set base(e){this.recordingBase=e,this.render()}async setLanguage(e){this.languageAsked=!0;const t=++this.languageToken,n=await P.load(e);t===this.languageToken&&(this.messages=n,this.render())}connectedCallback(){this.languageAsked||this.setLanguage(_.preferencesFor(this)[0]??"en"),this.session.changes.addEventListener("change",this.onChange),this.session.start(),this.render()}disconnectedCallback(){this.session.changes.removeEventListener("change",this.onChange)}absolute(e){try{return new URL(e,this.recordingBase??location.href).href}catch{return}}isNamed(e){return this.named.some(t=>this.absolute(t)===e)}setNamed(e,t){t!==this.isNamed(e)&&(this.named=t?[...this.named,L.of(e,this.recordingBase)]:this.named.filter(n=>this.absolute(n)!==e),t&&this.session.require([e]),this.dispatchEvent(new Event("recordingmoduleschange",{bubbles:!0})),this.render())}render(){const e=this.messages;if(!this.isConnected||!this.messages)return;const t=this.ownerDocument,n=t.createElement("style");n.textContent=A;const s=t.createElement("p");s.className=m.INFO,s.textContent=e.intro;const a=t.createElement("form");a.className="mp-add";const i=t.createElement("input");i.type="url",i.id="module-url",i.required=!0,i.placeholder=e.urlPlaceholder,i.value=this.draft,i.addEventListener("input",()=>{this.draft=i.value}),i.setAttribute("aria-label",e.urlPlaceholder);const u=t.createElement("button");u.type="submit",u.textContent=e.add,a.append(i,u),a.addEventListener("submit",r=>{r.preventDefault();const w=i.value.trim();w&&(this.draft="",this.session.add(w))});const l=t.createElement("p");l.className=m.WARNING,l.textContent=e.codeWarning;const c=this.session.list(),h=new Set(c.map(r=>r.url)),v=this.named.map(r=>this.absolute(r)).filter(r=>r!==void 0&&!h.has(r)),g=t.createElement("ul");g.className="mp-list",g.append(...c.map(r=>this.item(r)),...v.map(r=>this.item({url:r,addedByPerson:!1,enabled:!0,status:"loading"})));const k=t.createElement("p");k.className=m.INFO,k.textContent=e.none,k.hidden=g.childElementCount>0;const f=t.createElement("div");f.className="mp-files";const E=t.createElement("button");E.type="button",E.id="modules-export",E.textContent=e.exportConfig,E.disabled=!c.some(r=>r.addedByPerson),E.addEventListener("click",()=>this.download());const p=t.createElement("input");p.type="file",p.id="modules-import",p.accept="application/json,.json",p.hidden=!0;const o=t.createElement("button");o.type="button",o.textContent=e.importConfig,o.addEventListener("click",()=>p.click()),p.addEventListener("change",()=>{const r=p.files?.[0];r&&this.importFile(r),p.value=""}),f.append(E,o,p);const d=t.createElement("p");d.id="modules-note",d.setAttribute("role","status"),m.show(d,this.note?.text,this.note?.kind),this.replaceChildren(n,s,a,l,g,k,f,d)}item(e){const t=this.messages,n=this.ownerDocument,s=e.loaded,a=n.createElement("li");a.className="mp-module",a.dataset.url=e.url;const i=n.createElement("div");if(i.className="mp-head",e.addedByPerson){const o=n.createElement("label"),d=n.createElement("input");d.type="checkbox",d.className="mp-enabled",d.checked=e.enabled,d.addEventListener("change",()=>void this.session.setEnabled(e.url,d.checked)),o.append(d,n.createTextNode(` ${t.enabled}`)),i.append(o)}const u=n.createElement("span");u.className="mp-name",u.textContent=e.loaded?.module.name??e.url,i.append(u);const l=e.loaded?.module.credit;if(l){const o=n.createElement(e.loaded?.module.creditUrl?"a":"span");o.className=m.INFO,o.textContent=l,o instanceof HTMLAnchorElement&&(o.href=e.loaded.module.creditUrl,o.target="_blank",o.rel="noopener noreferrer"),i.append(o)}const c=n.createElement("button");if(c.type="button",c.className="mp-remove",e.addedByPerson?(c.textContent=t.remove,c.addEventListener("click",()=>void this.session.remove(e.url))):(c.textContent=t.addToMine,c.addEventListener("click",()=>void this.session.add(e.url))),e.status==="installed"&&s){const o=n.createElement("button");o.type="button",o.className="mp-check";const d=this.checks.get(e.url),r=d?.of===s&&d.findings===void 0&&d.crash===void 0;o.textContent=r?t.checking:t.check,o.disabled=r,o.addEventListener("click",()=>void this.check(e.url,s)),i.append(o)}i.append(c);const h=n.createElement("p");h.className=`${m.INFO} mp-url`,h.textContent=e.url;const v=n.createElement("p");v.className="mp-status",e.status==="loading"?m.show(v,t.loading):e.status==="failed"?m.show(v,t.failed.replace("{error}",e.error??""),"error"):e.status==="off"?m.show(v,t.off):m.show(v,this.brings(e));const g=n.createElement("p");g.className="mp-code",s?.scriptRun?m.show(g,t.runsCode,"warning"):s?.hasScript?m.show(g,t.codeNotRun,"info"):g.hidden=!0;const k=n.createElement("label");k.title=t.namedByRecordingHint;const f=n.createElement("input");f.type="checkbox",f.className="mp-named",f.checked=this.isNamed(e.url),f.addEventListener("change",()=>this.setNamed(e.url,f.checked)),k.append(f,n.createTextNode(` ${t.namedByRecording}`));const E=n.createElement("p");E.append(k),a.append(i,h,v,g,E);const p=this.checks.get(e.url);return p&&p.of===s&&a.append(...this.checkResult(p)),a}async check(e,t){const n={of:t};this.checks.set(e,n),this.render();try{const{ModuleConformance:s}=await x(async()=>{const{ModuleConformance:a}=await import("./ModuleConformance-B6iFVb8X.js");return{ModuleConformance:a}},__vite__mapDeps([0,1]),import.meta.url);n.findings=await s.check(t,this.checkContext?.())}catch(s){n.crash=s instanceof Error?s.message:String(s)}this.render()}checkResult(e){const t=this.messages,n=this.ownerDocument,s=(l,c)=>{const h=n.createElement("p");return h.className="mp-check-result",h.setAttribute("role","status"),m.show(h,l,c),h};if(e.crash!==void 0)return[s(t.checkCrashed.replace("{error}",()=>e.crash),"error")];if(!e.findings)return[];const a=e.findings.filter(l=>l.level==="failed"),i=e.findings.filter(l=>l.level==="note"),u=[];if(a.length===0&&u.push(s(t.checkPassed,"info")),a.length+i.length>0){const l=n.createElement("ul");l.className="mp-findings";for(const c of[...a,...i]){const h=n.createElement("li");m.show(h,this.finding(c),c.level==="failed"?"error":"info"),l.append(h)}u.push(l)}return u}finding(e){const t=this.messages,n=e.point===void 0?"":t.points[e.point]??e.point,s=t.checks[e.code].replace("{point}",()=>e.point??"").replace("{detail}",()=>e.detail??""),a=e.source??(e.code==="unknownPoint"||e.code==="notAList"?void 0:n);return a?t.checkAbout.replace("{about}",()=>a).replace("{text}",()=>s):s}brings(e){const t=Object.entries(e.loaded?.module.contributes??{}).filter(([,n])=>Array.isArray(n)&&n.length>0).map(([n,s])=>`${this.messages.points[n]??n} (${s.length})`);return t.length>0?this.messages.brings.replace("{points}",t.join(", ")):this.messages.bringsNothing}download(){const e=new Blob([this.session.exportText()],{type:"application/json"}),t=URL.createObjectURL(e),n=this.ownerDocument.createElement("a");n.href=t,n.download="ufoathome-modules.json",n.click(),URL.revokeObjectURL(t)}async importFile(e){try{await this.session.importText(await e.text());const t=this.session.list().filter(n=>n.addedByPerson).length;this.note={text:this.messages.imported.replace("{count}",String(t)),kind:"info"}}catch(t){this.note={text:this.messages.importFailed.replace("{error}",t instanceof Error?t.message:String(t)),kind:"error"}}this.render()}}function B(){customElements.get(y)||customElements.define(y,M)}export{y as MODULES_PANEL_ELEMENT_NAME,M as ModulesPanelElement,B as register};
@@ -1 +1 @@
1
- import{b8 as b,B as h}from"./rr0-sighting-editor.mjs";class c{static FLAT={heightAt:()=>0};static of(e){const s=e.timeline.sourceIds.map(n=>b.of(e,n)?.nearestM).filter(n=>n!==void 0);return s.length>0?{m:Math.min(...s),basis:"derived",paths:["timeline","observerTrack"]}:c.interpreted(e)}static interpreted(e){const s=(e.interpretation?.bodies??[]).map((t,i)=>({body:t,index:i})).filter(({body:t})=>Array.isArray(t.track)),n=s.filter(({body:t})=>(t.explains?.length??0)>0),u=n.length>0?n:s,d=c.FLAT,l=t=>h.eyeOf(e,t,d);let o;const p=[];for(const{body:t,index:i}of u){const M=new h(t,d,l);for(const{t:f}of t.track){const r=M.at(f),a=l(f);if(!r||!a)continue;const m=Math.hypot(r.eastM-a.eastM,r.northM-a.northM,r.upM-a.upM);(o===void 0||m<o)&&(o=m)}p.push(`interpretation.bodies.${i}`)}return o===void 0?void 0:{m:o,basis:"assumed",paths:p}}}export{c as N};
1
+ import{bB as b,B as h}from"./rr0-sighting-editor.mjs";class c{static FLAT={heightAt:()=>0};static of(e){const s=e.timeline.sourceIds.map(n=>b.of(e,n)?.nearestM).filter(n=>n!==void 0);return s.length>0?{m:Math.min(...s),basis:"derived",paths:["timeline","observerTrack"]}:c.interpreted(e)}static interpreted(e){const s=(e.interpretation?.bodies??[]).map((t,i)=>({body:t,index:i})).filter(({body:t})=>Array.isArray(t.track)),n=s.filter(({body:t})=>(t.explains?.length??0)>0),u=n.length>0?n:s,d=c.FLAT,l=t=>h.eyeOf(e,t,d);let o;const p=[];for(const{body:t,index:i}of u){const M=new h(t,d,l);for(const{t:f}of t.track){const r=M.at(f),a=l(f);if(!r||!a)continue;const m=Math.hypot(r.eastM-a.eastM,r.northM-a.northM,r.upM-a.upM);(o===void 0||m<o)&&(o=m)}p.push(`interpretation.bodies.${i}`)}return o===void 0?void 0:{m:o,basis:"assumed",paths:p}}}export{c as N};
@@ -0,0 +1 @@
1
+ import{V as z,D as A,F,Q as m,G as O,J as w}from"./rr0-sighting-editor.mjs";const p=Math.PI/180,y=180/Math.PI;class P{static localDirection(t,e,i,o=new z){const n=Math.tan(e/2*p);return o.set((t.u*2-1)*n*i,(1-t.v*2)*n,-1).normalize()}static picturePoint(t,e,i){if(t.z>=0)return;const o=Math.tan(e/2*p),n=t.x/-t.z/(o*i),s=t.y/-t.z/o;return{u:(n+1)/2,v:(1-s)/2}}static worldDirection(t,e=new z){const i=t.azimuthDeg*p,o=t.altitudeDeg*p;return e.set(Math.sin(i)*Math.cos(o),Math.sin(o),-Math.cos(i)*Math.cos(o))}static aimOf(t){const e=Math.hypot(t.x,t.z);return{azimuthDeg:(Math.atan2(t.x,-t.z)*y+360)%360,altitudeDeg:Math.atan2(t.y,e)*y}}static rotationOf(t){const e=new A;return e.rotation.set(t.pitchDeg*p,-t.headingDeg*p,-(t.rollDeg??0)*p,"YXZ"),e.quaternion.clone()}static anglesOf(t){const e=new F().setFromQuaternion(t,"YXZ"),i=(-e.y*y%360+360)%360,o=-e.z*y;return{headingDeg:i,pitchDeg:e.x*y,rollDeg:Math.abs(o)<1e-9?0:o}}static worldDirectionOf(t,e,i,o=new z){return this.localDirection(t,e.fovDeg,i,o).applyQuaternion(this.rotationOf(e))}static picturePointOf(t,e,i){const o=t.clone().applyQuaternion(this.rotationOf(e).invert()),n=this.picturePoint(o,e.fovDeg,i);if(!(!n||n.u<0||n.u>1||n.v<0||n.v>1))return n}static solve(t,e,i,o=t.length>=3){if(t.length<2)return;if(!o)return this.solveAtField(t,e,i);let n=1,s=179;const h=(Math.sqrt(5)-1)/2;let f=s-h*(s-n),c=n+h*(s-n),r=this.solveAtField(t,e,f),a=this.solveAtField(t,e,c);for(let l=0;l<60&&s-n>1e-4;l++){if(!r||!a)return;r.residualDeg<a.residualDeg?(s=c,c=f,a=r,f=s-h*(s-n),r=this.solveAtField(t,e,f)):(n=f,f=c,r=a,c=n+h*(s-n),a=this.solveAtField(t,e,c))}return r&&a?r.residualDeg<a.residualDeg?r:a:r??a}static solveAtField(t,e,i){const o=t.map(c=>this.localDirection(c.picture,i,e)),n=t.map(c=>this.worldDirection(c.scene)),s=this.triad(o,n);if(!s)return;const h=this.refine(s,o,n);return{registration:{...this.anglesOf(h),fovDeg:i},residualDeg:this.residualDeg(h,o,n)}}static triad(t,e){let i=0,o=1,n=-1;for(let r=0;r<t.length;r++)for(let a=r+1;a<t.length;a++){const g=t[r].clone().cross(t[a]).lengthSq();g>n&&(n=g,i=r,o=a)}if(n<1e-12)return;const s=(r,a)=>{const g=r.clone().normalize(),l=r.clone().cross(a).normalize(),u=l.clone().cross(g);return new w().set(g.x,u.x,l.x,g.y,u.y,l.y,g.z,u.z,l.z)},h=s(t[i],t[o]),c=s(e[i],e[o]).multiply(h.transpose());return new m().setFromRotationMatrix(new O().setFromMatrix3(c))}static refine(t,e,i){const o=t.clone(),n=new z;for(let s=0;s<20;s++){const h=new w().set(0,0,0,0,0,0,0,0,0),f=h.elements,c=new z;for(let l=0;l<e.length;l++){n.copy(e[l]).applyQuaternion(o);const u=n,d=[[0,u.z,-u.y],[-u.z,0,u.x],[u.y,-u.x,0]],M=[i[l].x-u.x,i[l].y-u.y,i[l].z-u.z];for(let D=0;D<3;D++){for(let v=0;v<3;v++)for(let x=0;x<3;x++)f[v*3+D]+=d[x][D]*d[x][v];c.setComponent(D,c.getComponent(D)+d[0][D]*M[0]+d[1][D]*M[1]+d[2][D]*M[2])}}for(let l=0;l<3;l++)f[l*3+l]+=1e-9;const r=c.applyMatrix3(h.invert()),a=r.length();if(a<1e-12)break;const g=new m().setFromAxisAngle(r.normalize(),a);if(o.premultiply(g).normalize(),a<1e-10)break}return o}static residualDeg(t,e,i){let o=0;const n=new z;for(let s=0;s<e.length;s++){n.copy(e[s]).applyQuaternion(t);const h=n.angleTo(i[s])*y;o+=h*h}return Math.sqrt(o/e.length)}}export{P as PictureRegistration};
@@ -1 +1 @@
1
- import{ba as u}from"./rr0-sighting-editor.mjs";class o{about="shape";static STEP_DEG=2;static TURN_DEG=60;static ERRATIC_TURNS=3;static OSCILLATIONS=["vibrate","spiral","roll"];async assess(n){const t=this.trajectory(n),s=this.vanish(n),e=this.oscillation(n),a=this.landing(n),c=this.judged(n,"traces"),r=this.occupants(n),h=a.shown&&r.shown?5:a.shown&&c.shown?4:a.shown||t.value==="erratic"||s.shown||e.shown?3:t.value==="abnormal"?2:t.value==="straight"?1:0,i=[{id:"poher-trajectory",basis:t.basis,paths:t.paths,value:o.TRAJECTORIES.indexOf(t.value)},this.criterion("poher-vanish",s),this.criterion("poher-oscillation",e),{...this.criterion("poher-landing",a),unsupported:a.basis===void 0},this.criterion("poher-traces",c),this.criterion("poher-occupants",r)];return{verdict:String(h),criteria:i}}static TRAJECTORIES=["unknown","still","straight","abnormal","erratic"];criterion(n,t){return{id:n,value:t.shown?1:0,basis:t.basis,paths:t.basis===void 0?[]:t.paths}}trajectory(n){let t="unknown";for(const s of n.timeline.sourceIds){const e=this.seen(n,s).filter(i=>i.aim!==void 0).map(i=>i.aim);if(e.length<2)continue;const a=[o.unit(e[0])];for(const i of e.slice(1)){const l=o.unit(i);o.angleDeg(a[a.length-1],l)>=o.STEP_DEG&&a.push(l)}const c=a.length-1;let r=0;for(let i=1;i<a.length-1;i++){const l=o.cross(a[i-1],a[i]),d=o.cross(a[i],a[i+1]);o.angleDeg(l,d)>=o.TURN_DEG&&r++}const h=c===0?"still":r>=o.ERRATIC_TURNS?"erratic":r>0?"abnormal":"straight";o.TRAJECTORIES.indexOf(h)>o.TRAJECTORIES.indexOf(t)&&(t=h)}return t==="unknown"?{value:t,paths:[]}:{value:t,basis:"derived",paths:["timeline"]}}vanish(n){const t=(n.events??[]).findIndex(s=>s.eventType==="vanish"&&u.isPhenomenon(n,s));return t>=0?{shown:!0,basis:"stated",paths:[`events.${t}`]}:{shown:!1,paths:[]}}oscillation(n){const t=new Set((n.interpretation?.bodies??[]).map(e=>e.id)),s=(n.events??[]).findIndex(e=>o.OSCILLATIONS.includes(e.eventType)&&(u.isPhenomenon(n,e)||t.has(e.who?.split("/")[0]??"")));return s>=0?{shown:!0,basis:"stated",paths:[`events.${s}`]}:{shown:!1,paths:[]}}landing(n){const t=e=>!e.onGround&&((e.altitudeAboveGroundM??0)>0||(e.altitudeM??0)>0),s=(n.interpretation?.bodies??[]).findIndex(e=>Array.isArray(e.track)&&e.track.some(a=>a.onGround)&&e.track.some(t));return s>=0?{shown:!0,basis:"assumed",paths:[`interpretation.bodies.${s}`]}:{shown:!1,paths:[]}}occupants(n){const t=n.decor.findIndex(s=>s.kind==="entity");return t>=0?{shown:!0,basis:"stated",paths:[`decor.${t}`]}:this.judged(n,"beings")}judged(n,t){const s=n.account?.strangeness?.[t];return s===void 0?{shown:!1,paths:[]}:{shown:s,basis:"stated",paths:[`account.strangeness.${t}`]}}instants(n,t){return n.timeline.allKeyframes.map(s=>({t:s.t,shape:s.shapes.find(e=>e.sourceId===t)?.shape})).filter(({shape:s})=>s!==void 0).map(({t:s,shape:e})=>({t:s,aim:e.aim,visible:e.transparency<1})).sort((s,e)=>s.t-e.t)}seen(n,t){return this.instants(n,t).filter(s=>s.visible)}static unit(n){const[t,s]=[n.azimuthDeg*Math.PI/180,n.altitudeDeg*Math.PI/180];return[Math.cos(s)*Math.sin(t),Math.cos(s)*Math.cos(t),Math.sin(s)]}static cross(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}static angleDeg(n,t){const s=Math.hypot(...n)*Math.hypot(...t);if(s===0)return 0;const e=(n[0]*t[0]+n[1]*t[1]+n[2]*t[2])/s;return Math.acos(Math.max(-1,Math.min(1,e)))*180/Math.PI}}export{o as PoherAssessor};
1
+ import{bD as u}from"./rr0-sighting-editor.mjs";class o{about="shape";static STEP_DEG=2;static TURN_DEG=60;static ERRATIC_TURNS=3;static OSCILLATIONS=["vibrate","spiral","roll"];async assess(n){const t=this.trajectory(n),s=this.vanish(n),e=this.oscillation(n),a=this.landing(n),c=this.judged(n,"traces"),r=this.occupants(n),h=a.shown&&r.shown?5:a.shown&&c.shown?4:a.shown||t.value==="erratic"||s.shown||e.shown?3:t.value==="abnormal"?2:t.value==="straight"?1:0,i=[{id:"poher-trajectory",basis:t.basis,paths:t.paths,value:o.TRAJECTORIES.indexOf(t.value)},this.criterion("poher-vanish",s),this.criterion("poher-oscillation",e),{...this.criterion("poher-landing",a),unsupported:a.basis===void 0},this.criterion("poher-traces",c),this.criterion("poher-occupants",r)];return{verdict:String(h),criteria:i}}static TRAJECTORIES=["unknown","still","straight","abnormal","erratic"];criterion(n,t){return{id:n,value:t.shown?1:0,basis:t.basis,paths:t.basis===void 0?[]:t.paths}}trajectory(n){let t="unknown";for(const s of n.timeline.sourceIds){const e=this.seen(n,s).filter(i=>i.aim!==void 0).map(i=>i.aim);if(e.length<2)continue;const a=[o.unit(e[0])];for(const i of e.slice(1)){const l=o.unit(i);o.angleDeg(a[a.length-1],l)>=o.STEP_DEG&&a.push(l)}const c=a.length-1;let r=0;for(let i=1;i<a.length-1;i++){const l=o.cross(a[i-1],a[i]),d=o.cross(a[i],a[i+1]);o.angleDeg(l,d)>=o.TURN_DEG&&r++}const h=c===0?"still":r>=o.ERRATIC_TURNS?"erratic":r>0?"abnormal":"straight";o.TRAJECTORIES.indexOf(h)>o.TRAJECTORIES.indexOf(t)&&(t=h)}return t==="unknown"?{value:t,paths:[]}:{value:t,basis:"derived",paths:["timeline"]}}vanish(n){const t=(n.events??[]).findIndex(s=>s.eventType==="vanish"&&u.isPhenomenon(n,s));return t>=0?{shown:!0,basis:"stated",paths:[`events.${t}`]}:{shown:!1,paths:[]}}oscillation(n){const t=new Set((n.interpretation?.bodies??[]).map(e=>e.id)),s=(n.events??[]).findIndex(e=>o.OSCILLATIONS.includes(e.eventType)&&(u.isPhenomenon(n,e)||t.has(e.who?.split("/")[0]??"")));return s>=0?{shown:!0,basis:"stated",paths:[`events.${s}`]}:{shown:!1,paths:[]}}landing(n){const t=e=>!e.onGround&&((e.altitudeAboveGroundM??0)>0||(e.altitudeM??0)>0),s=(n.interpretation?.bodies??[]).findIndex(e=>Array.isArray(e.track)&&e.track.some(a=>a.onGround)&&e.track.some(t));return s>=0?{shown:!0,basis:"assumed",paths:[`interpretation.bodies.${s}`]}:{shown:!1,paths:[]}}occupants(n){const t=n.decor.findIndex(s=>s.kind==="entity");return t>=0?{shown:!0,basis:"stated",paths:[`decor.${t}`]}:this.judged(n,"beings")}judged(n,t){const s=n.account?.strangeness?.[t];return s===void 0?{shown:!1,paths:[]}:{shown:s,basis:"stated",paths:[`account.strangeness.${t}`]}}instants(n,t){return n.timeline.allKeyframes.map(s=>({t:s.t,shape:s.shapes.find(e=>e.sourceId===t)?.shape})).filter(({shape:s})=>s!==void 0).map(({t:s,shape:e})=>({t:s,aim:e.aim,visible:e.transparency<1})).sort((s,e)=>s.t-e.t)}seen(n,t){return this.instants(n,t).filter(s=>s.visible)}static unit(n){const[t,s]=[n.azimuthDeg*Math.PI/180,n.altitudeDeg*Math.PI/180];return[Math.cos(s)*Math.sin(t),Math.cos(s)*Math.cos(t),Math.sin(s)]}static cross(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}static angleDeg(n,t){const s=Math.hypot(...n)*Math.hypot(...t);if(s===0)return 0;const e=(n[0]*t[0]+n[1]*t[1]+n[2]*t[2])/s;return Math.acos(Math.max(-1,Math.min(1,e)))*180/Math.PI}}export{o as PoherAssessor};
@@ -1,4 +1,4 @@
1
- import{ap as F,au as P,aY as H,n as K,aH as w,aI as N,as as U,bk as k}from"./rr0-sighting-editor.mjs";class b{static HOLLOW_M=1;static COVERED_M=3;static WINDOW_M=30;static SAMPLE_M=4;static MAX_GRADE={rail:.025,highSpeed:.035,subway:.04,light_rail:.06,tram:.08,funicular:1/0};static heights(t,s,e){const n=t.map(a=>a.level===0),o=t.map((a,i)=>n[i]?b.targets(a,s,e):[]),c=t.map((a,i)=>n[i]?b.samples(a,o[i]):[]),r=new Map;t.forEach((a,i)=>{if(n[i])for(const h of b.ends(a)){const u=b.key(h),p=r.get(u);p?p.push(i):r.set(u,[i])}});const M=a=>{const i=r.get(b.key(a));if(i)return b.median(i.flatMap(h=>c[h]),a)};return t.map((a,i)=>{if(n[i]){const h=[...new Set([i,...b.ends(a).flatMap(d=>r.get(b.key(d))??[])])].flatMap(d=>c[d]),u=a.centre.map((d,O)=>b.median(h,d)??o[i][O]),[p,A]=b.ends(a);return u[0]=M(p)??u[0],u[u.length-1]=M(A)??u[u.length-1],b.graded(u,a.along,a.highSpeed?b.MAX_GRADE.highSpeed:b.MAX_GRADE[a.kind])}return b.carried(a,s,e,M)})}static targets(t,s,e){return t.centre.map(n=>{const o=s(n.x,n.z);if(e===void 0||n.altitudeM===void 0)return o;const c=n.altitudeM+e;return c-o>b.HOLLOW_M||o-c>b.COVERED_M?c:o})}static samples(t,s){const e=[];let n=0;return t.centre.forEach((o,c)=>{t.along[c]+1e-6<n&&c<t.centre.length-1||(e.push({x:o.x,z:o.z,y:s[c]}),n=t.along[c]+b.SAMPLE_M)}),e}static median(t,s){const e=[];for(const o of t)Math.hypot(o.x-s.x,o.z-s.z)<=b.WINDOW_M&&e.push(o.y);if(e.length===0)return;e.sort((o,c)=>o-c);const n=e.length>>1;return e.length%2===1?e[n]:(e[n-1]+e[n])/2}static graded(t,s,e){if(!Number.isFinite(e)||t.length<3)return t;const n=[...t],o=n.length-1,c=s[o];if(Math.abs(n[o]-n[0])>e*c)return s.map(r=>n[0]+(n[o]-n[0])*r/c);for(let r=1;r<o;r++){const M=e*(s[r]-s[r-1]);n[r]=Math.min(n[r-1]+M,Math.max(n[r-1]-M,n[r]))}for(let r=o-1;r>0;r--){const M=e*(s[r+1]-s[r]);n[r]=Math.min(n[r+1]+M,Math.max(n[r+1]-M,n[r]))}return n}static carried(t,s,e,n){const[o,c]=b.ends(t),r=t.along[t.along.length-1],M=n(o),a=n(c);if(e!==void 0&&t.centre.every(u=>u.altitudeM!==void 0)){const u=t.centre.map(d=>d.altitudeM+e),p=M!==void 0?M-u[0]:0,A=a!==void 0?a-u[u.length-1]:0;return u.map((d,O)=>d+p+(A-p)*t.along[O]/r)}const i=M??s(o.x,o.z),h=a??s(c.x,c.z);return t.along.map(u=>i+(h-i)*u/r)}static ends(t){return[t.centre[0],t.centre[t.centre.length-1]]}static key(t){return`${Math.round(t.x*2)},${Math.round(t.z*2)}`}}class B{positions=[];indices=[];along=[];get vertexCount(){return this.positions.length/3}strip(t,s,e){const n=this.vertexCount;for(let o=0;o<t.length;o++)this.positions.push(t[o].x,t[o].y,t[o].z,s[o].x,s[o].y,s[o].z),e&&this.along.push(e[o],e[o]);for(let o=0;o<t.length-1;o++){const c=n+o*2;this.indices.push(c,c+2,c+1,c+1,c+2,c+3)}}beam(t,s,e,n=!0){const o=s.x-t.x,c=s.y-t.y,r=s.z-t.z,M=Math.hypot(o,c,r);if(M<1e-6)return;const a={x:o/M,y:c/M,z:r/M},i=Math.abs(a.y)>.9?{x:1,y:0,z:0}:{x:0,y:1,z:0},h=a.y*i.z-a.z*i.y,u=a.z*i.x-a.x*i.z,p=a.x*i.y-a.y*i.x,A=Math.hypot(h,u,p),d={x:h/A*e/2,y:u/A*e/2,z:p/A*e/2},O={x:a.y*d.z-a.z*d.y,y:a.z*d.x-a.x*d.z,z:a.x*d.y-a.y*d.x},g=(f,x,E)=>({x:f.x+d.x*x+O.x*E,y:f.y+d.y*x+O.y*E,z:f.z+d.z*x+O.z*E}),_=[[1,1],[-1,1],[-1,-1],[1,-1]];for(let f=0;f<4;f++){const[x,E]=_[f],[z,v]=_[(f+1)%4];this.quad(g(t,x,E),g(t,z,v),g(s,z,v),g(s,x,E))}n&&(this.quad(...[..._].reverse().map(([f,x])=>g(t,f,x))),this.quad(..._.map(([f,x])=>g(s,f,x))))}quad(t,s,e,n){const o=this.vertexCount;this.positions.push(t.x,t.y,t.z,s.x,s.y,s.z,e.x,e.y,e.z,n.x,n.y,n.z),this.indices.push(o,o+1,o+2,o,o+2,o+3)}}class l{static STEP_M=6;static BALLAST_HEIGHT_M=.5;static BALLAST_SLOPE=1.5;static BALLAST_SHOULDER_M=.45;static DECK_DEPTH_M=.8;static BANK_SLOPE=1.5;static SLEEPER_LENGTH_M=2.4;static SLEEPER_WIDTH_M=.29;static SLEEPER_SPACING_M=.6;static RAIL_HEAD_M=.072;static RAIL_HEIGHT_M=.18;static TRAM_RAIL_HEIGHT_M=.03;static LIFT_M=.06;static CATENARY={rail:{contactM:5.5,systemM:1.4,spanM:54,staggerM:.2},highSpeed:{contactM:5.08,systemM:1.4,spanM:63,staggerM:.2},service:{contactM:5.5,systemM:1.2,spanM:45,staggerM:.2},tram:{contactM:6,systemM:0,spanM:30,staggerM:.2}};static MESSENGER_SAG_M=.55;static MAST_SIDE_M=.26;static MAST_OFFSET_M=3.1;static MAST_ABOVE_M=.6;static CONTACT_DIAMETER_M=.012;static MESSENGER_DIAMETER_M=.011;static ARM_SIDE_M=.06;static TRACK_SPACING_M={rail:3.7,highSpeed:4.5,tram:3.1,subway:3.4,light_rail:3.4,funicular:3.2};static BALLAST_ALBEDO=[.17,.16,.15];static BANK_ALBEDO=[.085,.09,.05];static DECK_ALBEDO=[.26,.255,.24];static CONCRETE_ALBEDO=[.36,.35,.33];static WOOD_ALBEDO=[.07,.055,.045];static RUST_ALBEDO=[.085,.068,.058];static STEEL_ALBEDO=[.3,.31,.32];static COPPER_ALBEDO=[.09,.085,.07];static LINE_REACH_M=20;group=new F;stepM=l.STEP_M;drawn=0;laid=[];ballastMaterial=l.pebbled(l.lambert(l.BALLAST_ALBEDO,!0));earthMaterial=l.lambert(l.BANK_ALBEDO,!0);deckMaterial=l.lambert(l.DECK_ALBEDO,!1);concreteSleepers=l.sleeperMaterial(l.CONCRETE_ALBEDO);woodSleepers=l.sleeperMaterial(l.WOOD_ALBEDO);rustMaterial=l.lambert(l.RUST_ALBEDO,!0);headMaterial=new P({color:new H(.62,.62,.62),metalness:1,roughness:.28,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});steelMaterial=l.lambert(l.STEEL_ALBEDO,!1);wireMaterial=l.lambert(l.COPPER_ALBEDO,!1);constructor(){this.group.name="railways"}get count(){return this.drawn}setGroundSpacing(t){this.stepM=Number.isFinite(t)&&t>0?Math.min(l.STEP_M,Math.max(1.5,t/2)):l.STEP_M}set(t,s,e,n,o=1/0){this.clear();const r=t.map(p=>({line:p,path:p.points.map(A=>({...K(A.lat,A.lng,s,e),altitudeM:A.altitudeM}))})).filter(({line:p,path:A})=>p.level>=0&&l.within(A,o)),M=l.altitudeOffset(r,n),a=r.flatMap(({line:p,path:A})=>{const d=this.layoutOf(p,A);return d?[{line:p,layout:d}]:[]}),i=b.heights(a.map(({layout:p})=>p),n,M),h={ballast:new B,earth:new B,deck:new B,concrete:new B,wood:new B,rust:new B,head:new B,steel:new B,wire:new B};a.forEach(({line:p,layout:A},d)=>{this.lay(p,{...A,y:i[d]},n,h),this.laid.push({line:p,centre:A.centre}),this.drawn++});const u=[[h.ballast,this.ballastMaterial,"ballast",!1],[h.earth,this.earthMaterial,"embankments",!1],[h.deck,this.deckMaterial,"decks",!0],[h.concrete,this.concreteSleepers,"sleepers",!1],[h.wood,this.woodSleepers,"sleepers wood",!1],[h.rust,this.rustMaterial,"rails",!1],[h.head,this.headMaterial,"rail heads",!1],[h.steel,this.steelMaterial,"catenary masts",!0],[h.wire,this.wireMaterial,"catenary wires",!1]];for(const[p,A,d,O]of u){const g=l.meshOf(p,A);g&&(g.name=`railways ${d}`,g.castShadow=O,g.receiveShadow=!0,this.group.add(g))}}clear(){for(const t of[...this.group.children])this.group.remove(t),t.geometry?.dispose();this.drawn=0,this.laid=[]}lineAt(t,s){let e;for(const{line:n,centre:o}of this.laid)for(let c=0;c<o.length-1;c++){const r=o[c],M=o[c+1],a=M.x-r.x,i=M.z-r.z,h=a*a+i*i,u=h===0?0:Math.max(0,Math.min(1,((t-r.x)*a+(s-r.z)*i)/h)),p=Math.hypot(t-(r.x+a*u),s-(r.z+i*u));p<=l.LINE_REACH_M&&(!e||p<e.distance)&&(e={line:n,distance:p})}return e?.line}mayMeet(t,s,e,n){const o=Math.hypot(s.x,s.z);if(o<1e-6)return this.lineAt(t.x,t.z)!==void 0;const c=s.x/o,r=s.z/o,M=l.LINE_REACH_M;for(const{centre:a}of this.laid)for(let i=0;i<a.length-1;i++){const h=a[i],u=a[i+1];for(const p of[0,.5,1]){const A=h.x+(u.x-h.x)*p,d=h.z+(u.z-h.z)*p,O=(A-t.x)*c+(d-t.z)*r;if(O<0)continue;const g=Math.abs((A-t.x)*r-(d-t.z)*c),_=Math.hypot(u.x-h.x,u.z-h.z)/2;if(g>M+_)continue;if(t.y+s.y*(O/o)<=e(A,d)+n)return!0}}return!1}contactHeightM(t){if(!(t.electrification!=="overhead"||t.kind==="subway"||t.kind==="funicular"))return l.catenaryOf(t).contactM}static catenaryOf(t){return t.kind==="tram"?l.CATENARY.tram:t.highSpeed?l.CATENARY.highSpeed:t.service?l.CATENARY.service:l.CATENARY.rail}dispose(){this.clear();for(const t of[this.ballastMaterial,this.earthMaterial,this.deckMaterial,this.concreteSleepers,this.woodSleepers,this.rustMaterial,this.headMaterial,this.steelMaterial,this.wireMaterial])t.dispose()}static within(t,s){if(!Number.isFinite(s))return!0;const e=s*1.1+100;return t.some((n,o)=>Math.hypot(n.x,n.z)<=e||o>0&&Math.hypot((n.x+t[o-1].x)/2,(n.z+t[o-1].z)/2)<=e)}static altitudeOffset(t,s){const e=[];for(const{line:n,path:o}of t)if(n.level===0)for(const c of o)c.altitudeM!==void 0&&e.push(s(c.x,c.z)-c.altitudeM);if(!(e.length<5))return e.sort((n,o)=>n-o),e[Math.floor(e.length/2)]}layoutOf(t,s){const e=[];for(let c=0;c<s.length-1;c++){const r=s[c],M=s[c+1],a=Math.max(1,Math.ceil(Math.hypot(M.x-r.x,M.z-r.z)/this.stepM));for(let i=0;i<a;i++){const h=i/a,u=r.altitudeM!==void 0&&M.altitudeM!==void 0?r.altitudeM+(M.altitudeM-r.altitudeM)*h:void 0;e.push({x:r.x+(M.x-r.x)*h,z:r.z+(M.z-r.z)*h,altitudeM:u})}}if(e.push(s[s.length-1]),e.length<2)return;const n=[0];for(let c=1;c<e.length;c++)n.push(n[c-1]+Math.hypot(e[c].x-e[c-1].x,e[c].z-e[c-1].z));if(n[n.length-1]<.5)return;const o=e.map((c,r)=>{const M=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],i=a.x-M.x,h=a.z-M.z,u=Math.hypot(i,h);return u<1e-6?{x:1,z:0}:{x:i/u,z:h/u}});return{kind:t.kind,...t.highSpeed?{highSpeed:!0}:{},level:t.level,centre:e,along:n,dir:o}}lay(t,s,e,n){const o=t.highSpeed?l.TRACK_SPACING_M.highSpeed:l.TRACK_SPACING_M[t.kind],c=Math.min(8,Math.max(1,t.tracks)),r=Array.from({length:c},(g,_)=>(_-(c-1)/2)*o),M=t.kind==="tram",a=M?0:l.BALLAST_HEIGHT_M,i=l.LIFT_M,h=(g,_,f)=>({x:s.centre[g].x-s.dir[g].z*_,y:s.y[g]+f,z:s.centre[g].z+s.dir[g].x*_}),u=s.centre.map((g,_)=>_);if(!M){const g=l.SLEEPER_LENGTH_M/2+l.BALLAST_SHOULDER_M+(r[r.length-1]??0),_=u.map(x=>h(x,g,a+i)),f=u.map(x=>h(x,-g,a+i));if(n.ballast.strip(_,f),t.level===0){const x=g+a*l.BALLAST_SLOPE;for(const E of[1,-1]){const z=[],v=[];let m=!1;for(const L of u){const C=h(L,E*x,i),S=e(C.x,C.z)+i,T=C.y-S;T<0&&(C.y=Math.min(S,s.y[L]+a-.05+i)),z.push(C);const I=h(L,E*(x+Math.max(0,T)*l.BANK_SLOPE),i);I.y=Math.min(e(I.x,I.z)+i,C.y),C.y-I.y>.02&&(m=!0),v.push(I)}const D=E>0?_:f;E>0?n.ballast.strip(z,D):n.ballast.strip(D,z),m&&(E>0?n.earth.strip(v,z):n.earth.strip(z,v))}}else{const x=-l.DECK_DEPTH_M,E=g+.15,z=u.map(L=>h(L,E,a+i+.1)),v=u.map(L=>h(L,-E,a+i+.1)),m=u.map(L=>h(L,E,x)),D=u.map(L=>h(L,-E,x));n.deck.strip(m,z),n.deck.strip(v,D),n.deck.strip(D,m),n.deck.strip(z,u.map(L=>h(L,g,a+i+.1))),n.deck.strip(u.map(L=>h(L,-g,a+i+.1)),v)}}const p=t.service?n.wood:n.concrete,A=t.gaugeMm/2e3+l.RAIL_HEAD_M/2,d=M?l.TRAM_RAIL_HEIGHT_M:l.RAIL_HEIGHT_M,O=a+i;for(const g of r){if(!M){const _=l.SLEEPER_LENGTH_M/2;p.strip(u.map(f=>h(f,g+_,O+.004)),u.map(f=>h(f,g-_,O+.004)),s.along)}for(const _ of[1,-1]){const f=g+_*A,x=l.RAIL_HEAD_M/2,E=u.map(v=>h(v,f+x,O+d)),z=u.map(v=>h(v,f-x,O+d));n.head.strip(E,z),n.rust.strip(u.map(v=>h(v,f+x,O)),E),n.rust.strip(z,u.map(v=>h(v,f-x,O)))}}t.electrification==="overhead"&&t.kind!=="subway"&&t.kind!=="funicular"&&this.catenary(t,s,r,O+d,h,e,n)}catenary(t,s,e,n,o,c,r){const M=l.catenaryOf(t),a=s.along[s.along.length-1],i=Math.max(1,Math.round(a/M.spanM)),h=a/i,u=Array.from({length:i},(E,z)=>(z+.5)*h),p=n+M.contactM,A=p+M.systemM,d=(M.systemM>0?A:p)+l.MAST_ABOVE_M,O=e[e.length-1],g=e.length>2,_=e.length===1?[1]:[1,-1],f=(E,z,v)=>{let m=0,D=s.along.length-2;for(;m<D;){const T=m+D+1>>1;s.along[T]<=E?m=T:D=T-1}const L=Math.min(1,Math.max(0,(E-s.along[m])/Math.max(1e-6,s.along[m+1]-s.along[m]))),C=o(m,z,v),S=o(m+1,z,v);return{x:C.x+(S.x-C.x)*L,y:C.y+(S.y-C.y)*L,z:C.z+(S.z-C.z)*L}};for(const E of u){const z=f(E,0,p);if(!(t.level===0&&c(z.x,z.z)>z.y)){for(const v of _){const m=v*(O+l.MAST_OFFSET_M),D=f(E,m,0);t.level===0&&(D.y=Math.min(D.y,c(D.x,D.z)));const L=f(E,m,d);if(r.steel.beam(D,L,l.MAST_SIDE_M),g)continue;const S=(_.length===1?e[0]:v*O)-v*.6,T=M.systemM>0?A:p+.3;r.steel.beam(f(E,m,T),f(E,S,T),l.ARM_SIDE_M),r.steel.beam(f(E,m,p-.4),f(E,S,T),l.ARM_SIDE_M)}if(g){const v=O+l.MAST_OFFSET_M;r.steel.beam(f(E,v,d-.2),f(E,-v,d-.2),l.MAST_SIDE_M*.8)}}}const x=[0,...u,a];for(const[E,z]of e.entries()){const v=m=>m===0||m===x.length-1?0:((m+E)%2===0?1:-1)*M.staggerM;for(let m=0;m<x.length-1;m++){const D=x[m],L=x[m+1];if(L-D<.1||(r.wire.beam(f(D,z+v(m),p),f(L,z+v(m+1),p),l.CONTACT_DIAMETER_M,!1),M.systemM<=0))continue;const C=4,S=T=>{const I=m===0?.5+T/2:m===x.length-2?T/2:T;return A-l.MESSENGER_SAG_M*4*I*(1-I)};for(let T=0;T<C;T++){const I=T/C,G=(T+1)/C;r.wire.beam(f(D+(L-D)*I,z,S(I)),f(D+(L-D)*G,z,S(G)),l.MESSENGER_DIAMETER_M,!1)}}}}static meshOf(t,s){if(t.indices.length===0)return;const e=new w;return e.setAttribute("position",new N(new Float32Array(t.positions),3)),t.along.length>0&&e.setAttribute("aAlong",new N(new Float32Array(t.along),1)),e.setIndex(new N(new Uint32Array(t.indices),1)),e.computeVertexNormals(),new U(e,s)}static lambert(t,s){return new k({color:new H(...t),...s?{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}:{}})}static pebbled(t){return t.onBeforeCompile=s=>{s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
1
+ import{aU as F,aZ as P,br as H,m as K,ba as w,bb as N,aX as U,bN as k}from"./rr0-sighting-editor.mjs";class D{static HOLLOW_M=1;static COVERED_M=3;static WINDOW_M=30;static SAMPLE_M=4;static MAX_GRADE={rail:.025,highSpeed:.035,subway:.04,light_rail:.06,tram:.08,funicular:1/0};static heights(t,s,e){const n=t.map(a=>a.level===0),o=t.map((a,i)=>n[i]?D.targets(a,s,e):[]),c=t.map((a,i)=>n[i]?D.samples(a,o[i]):[]),r=new Map;t.forEach((a,i)=>{if(n[i])for(const h of D.ends(a)){const u=D.key(h),p=r.get(u);p?p.push(i):r.set(u,[i])}});const M=a=>{const i=r.get(D.key(a));if(i)return D.median(i.flatMap(h=>c[h]),a)};return t.map((a,i)=>{if(n[i]){const h=[...new Set([i,...D.ends(a).flatMap(d=>r.get(D.key(d))??[])])].flatMap(d=>c[d]),u=a.centre.map((d,O)=>D.median(h,d)??o[i][O]),[p,A]=D.ends(a);return u[0]=M(p)??u[0],u[u.length-1]=M(A)??u[u.length-1],D.graded(u,a.along,a.highSpeed?D.MAX_GRADE.highSpeed:D.MAX_GRADE[a.kind])}return D.carried(a,s,e,M)})}static targets(t,s,e){return t.centre.map(n=>{const o=s(n.x,n.z);if(e===void 0||n.altitudeM===void 0)return o;const c=n.altitudeM+e;return c-o>D.HOLLOW_M||o-c>D.COVERED_M?c:o})}static samples(t,s){const e=[];let n=0;return t.centre.forEach((o,c)=>{t.along[c]+1e-6<n&&c<t.centre.length-1||(e.push({x:o.x,z:o.z,y:s[c]}),n=t.along[c]+D.SAMPLE_M)}),e}static median(t,s){const e=[];for(const o of t)Math.hypot(o.x-s.x,o.z-s.z)<=D.WINDOW_M&&e.push(o.y);if(e.length===0)return;e.sort((o,c)=>o-c);const n=e.length>>1;return e.length%2===1?e[n]:(e[n-1]+e[n])/2}static graded(t,s,e){if(!Number.isFinite(e)||t.length<3)return t;const n=[...t],o=n.length-1,c=s[o];if(Math.abs(n[o]-n[0])>e*c)return s.map(r=>n[0]+(n[o]-n[0])*r/c);for(let r=1;r<o;r++){const M=e*(s[r]-s[r-1]);n[r]=Math.min(n[r-1]+M,Math.max(n[r-1]-M,n[r]))}for(let r=o-1;r>0;r--){const M=e*(s[r+1]-s[r]);n[r]=Math.min(n[r+1]+M,Math.max(n[r+1]-M,n[r]))}return n}static carried(t,s,e,n){const[o,c]=D.ends(t),r=t.along[t.along.length-1],M=n(o),a=n(c);if(e!==void 0&&t.centre.every(u=>u.altitudeM!==void 0)){const u=t.centre.map(d=>d.altitudeM+e),p=M!==void 0?M-u[0]:0,A=a!==void 0?a-u[u.length-1]:0;return u.map((d,O)=>d+p+(A-p)*t.along[O]/r)}const i=M??s(o.x,o.z),h=a??s(c.x,c.z);return t.along.map(u=>i+(h-i)*u/r)}static ends(t){return[t.centre[0],t.centre[t.centre.length-1]]}static key(t){return`${Math.round(t.x*2)},${Math.round(t.z*2)}`}}class B{positions=[];indices=[];along=[];get vertexCount(){return this.positions.length/3}strip(t,s,e){const n=this.vertexCount;for(let o=0;o<t.length;o++)this.positions.push(t[o].x,t[o].y,t[o].z,s[o].x,s[o].y,s[o].z),e&&this.along.push(e[o],e[o]);for(let o=0;o<t.length-1;o++){const c=n+o*2;this.indices.push(c,c+2,c+1,c+1,c+2,c+3)}}beam(t,s,e,n=!0){const o=s.x-t.x,c=s.y-t.y,r=s.z-t.z,M=Math.hypot(o,c,r);if(M<1e-6)return;const a={x:o/M,y:c/M,z:r/M},i=Math.abs(a.y)>.9?{x:1,y:0,z:0}:{x:0,y:1,z:0},h=a.y*i.z-a.z*i.y,u=a.z*i.x-a.x*i.z,p=a.x*i.y-a.y*i.x,A=Math.hypot(h,u,p),d={x:h/A*e/2,y:u/A*e/2,z:p/A*e/2},O={x:a.y*d.z-a.z*d.y,y:a.z*d.x-a.x*d.z,z:a.x*d.y-a.y*d.x},g=(f,x,E)=>({x:f.x+d.x*x+O.x*E,y:f.y+d.y*x+O.y*E,z:f.z+d.z*x+O.z*E}),_=[[1,1],[-1,1],[-1,-1],[1,-1]];for(let f=0;f<4;f++){const[x,E]=_[f],[z,v]=_[(f+1)%4];this.quad(g(t,x,E),g(t,z,v),g(s,z,v),g(s,x,E))}n&&(this.quad(...[..._].reverse().map(([f,x])=>g(t,f,x))),this.quad(..._.map(([f,x])=>g(s,f,x))))}quad(t,s,e,n){const o=this.vertexCount;this.positions.push(t.x,t.y,t.z,s.x,s.y,s.z,e.x,e.y,e.z,n.x,n.y,n.z),this.indices.push(o,o+1,o+2,o,o+2,o+3)}}class l{static STEP_M=6;static BALLAST_HEIGHT_M=.5;static BALLAST_SLOPE=1.5;static BALLAST_SHOULDER_M=.45;static DECK_DEPTH_M=.8;static BANK_SLOPE=1.5;static SLEEPER_LENGTH_M=2.4;static SLEEPER_WIDTH_M=.29;static SLEEPER_SPACING_M=.6;static RAIL_HEAD_M=.072;static RAIL_HEIGHT_M=.18;static TRAM_RAIL_HEIGHT_M=.03;static LIFT_M=.06;static CATENARY={rail:{contactM:5.5,systemM:1.4,spanM:54,staggerM:.2},highSpeed:{contactM:5.08,systemM:1.4,spanM:63,staggerM:.2},service:{contactM:5.5,systemM:1.2,spanM:45,staggerM:.2},tram:{contactM:6,systemM:0,spanM:30,staggerM:.2}};static MESSENGER_SAG_M=.55;static MAST_SIDE_M=.26;static MAST_OFFSET_M=3.1;static MAST_ABOVE_M=.6;static CONTACT_DIAMETER_M=.012;static MESSENGER_DIAMETER_M=.011;static ARM_SIDE_M=.06;static TRACK_SPACING_M={rail:3.7,highSpeed:4.5,tram:3.1,subway:3.4,light_rail:3.4,funicular:3.2};static BALLAST_ALBEDO=[.17,.16,.15];static BANK_ALBEDO=[.085,.09,.05];static DECK_ALBEDO=[.26,.255,.24];static CONCRETE_ALBEDO=[.36,.35,.33];static WOOD_ALBEDO=[.07,.055,.045];static RUST_ALBEDO=[.085,.068,.058];static STEEL_ALBEDO=[.3,.31,.32];static COPPER_ALBEDO=[.09,.085,.07];static LINE_REACH_M=20;group=new F;stepM=l.STEP_M;drawn=0;laid=[];ballastMaterial=l.pebbled(l.lambert(l.BALLAST_ALBEDO,!0));earthMaterial=l.lambert(l.BANK_ALBEDO,!0);deckMaterial=l.lambert(l.DECK_ALBEDO,!1);concreteSleepers=l.sleeperMaterial(l.CONCRETE_ALBEDO);woodSleepers=l.sleeperMaterial(l.WOOD_ALBEDO);rustMaterial=l.lambert(l.RUST_ALBEDO,!0);headMaterial=new P({color:new H(.62,.62,.62),metalness:1,roughness:.28,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});steelMaterial=l.lambert(l.STEEL_ALBEDO,!1);wireMaterial=l.lambert(l.COPPER_ALBEDO,!1);constructor(){this.group.name="railways"}get count(){return this.drawn}setGroundSpacing(t){this.stepM=Number.isFinite(t)&&t>0?Math.min(l.STEP_M,Math.max(1.5,t/2)):l.STEP_M}set(t,s,e,n,o=1/0){this.clear();const r=t.map(p=>({line:p,path:p.points.map(A=>({...K(A.lat,A.lng,s,e),altitudeM:A.altitudeM}))})).filter(({line:p,path:A})=>p.level>=0&&l.within(A,o)),M=l.altitudeOffset(r,n),a=r.flatMap(({line:p,path:A})=>{const d=this.layoutOf(p,A);return d?[{line:p,layout:d}]:[]}),i=D.heights(a.map(({layout:p})=>p),n,M),h={ballast:new B,earth:new B,deck:new B,concrete:new B,wood:new B,rust:new B,head:new B,steel:new B,wire:new B};a.forEach(({line:p,layout:A},d)=>{this.lay(p,{...A,y:i[d]},n,h),this.laid.push({line:p,centre:A.centre}),this.drawn++});const u=[[h.ballast,this.ballastMaterial,"ballast",!1],[h.earth,this.earthMaterial,"embankments",!1],[h.deck,this.deckMaterial,"decks",!0],[h.concrete,this.concreteSleepers,"sleepers",!1],[h.wood,this.woodSleepers,"sleepers wood",!1],[h.rust,this.rustMaterial,"rails",!1],[h.head,this.headMaterial,"rail heads",!1],[h.steel,this.steelMaterial,"catenary masts",!0],[h.wire,this.wireMaterial,"catenary wires",!1]];for(const[p,A,d,O]of u){const g=l.meshOf(p,A);g&&(g.name=`railways ${d}`,g.castShadow=O,g.receiveShadow=!0,this.group.add(g))}}clear(){for(const t of[...this.group.children])this.group.remove(t),t.geometry?.dispose();this.drawn=0,this.laid=[]}lineAt(t,s){let e;for(const{line:n,centre:o}of this.laid)for(let c=0;c<o.length-1;c++){const r=o[c],M=o[c+1],a=M.x-r.x,i=M.z-r.z,h=a*a+i*i,u=h===0?0:Math.max(0,Math.min(1,((t-r.x)*a+(s-r.z)*i)/h)),p=Math.hypot(t-(r.x+a*u),s-(r.z+i*u));p<=l.LINE_REACH_M&&(!e||p<e.distance)&&(e={line:n,distance:p})}return e?.line}mayMeet(t,s,e,n){const o=Math.hypot(s.x,s.z);if(o<1e-6)return this.lineAt(t.x,t.z)!==void 0;const c=s.x/o,r=s.z/o,M=l.LINE_REACH_M;for(const{centre:a}of this.laid)for(let i=0;i<a.length-1;i++){const h=a[i],u=a[i+1];for(const p of[0,.5,1]){const A=h.x+(u.x-h.x)*p,d=h.z+(u.z-h.z)*p,O=(A-t.x)*c+(d-t.z)*r;if(O<0)continue;const g=Math.abs((A-t.x)*r-(d-t.z)*c),_=Math.hypot(u.x-h.x,u.z-h.z)/2;if(g>M+_)continue;if(t.y+s.y*(O/o)<=e(A,d)+n)return!0}}return!1}contactHeightM(t){if(!(t.electrification!=="overhead"||t.kind==="subway"||t.kind==="funicular"))return l.catenaryOf(t).contactM}static catenaryOf(t){return t.kind==="tram"?l.CATENARY.tram:t.highSpeed?l.CATENARY.highSpeed:t.service?l.CATENARY.service:l.CATENARY.rail}dispose(){this.clear();for(const t of[this.ballastMaterial,this.earthMaterial,this.deckMaterial,this.concreteSleepers,this.woodSleepers,this.rustMaterial,this.headMaterial,this.steelMaterial,this.wireMaterial])t.dispose()}static within(t,s){if(!Number.isFinite(s))return!0;const e=s*1.1+100;return t.some((n,o)=>Math.hypot(n.x,n.z)<=e||o>0&&Math.hypot((n.x+t[o-1].x)/2,(n.z+t[o-1].z)/2)<=e)}static altitudeOffset(t,s){const e=[];for(const{line:n,path:o}of t)if(n.level===0)for(const c of o)c.altitudeM!==void 0&&e.push(s(c.x,c.z)-c.altitudeM);if(!(e.length<5))return e.sort((n,o)=>n-o),e[Math.floor(e.length/2)]}layoutOf(t,s){const e=[];for(let c=0;c<s.length-1;c++){const r=s[c],M=s[c+1],a=Math.max(1,Math.ceil(Math.hypot(M.x-r.x,M.z-r.z)/this.stepM));for(let i=0;i<a;i++){const h=i/a,u=r.altitudeM!==void 0&&M.altitudeM!==void 0?r.altitudeM+(M.altitudeM-r.altitudeM)*h:void 0;e.push({x:r.x+(M.x-r.x)*h,z:r.z+(M.z-r.z)*h,altitudeM:u})}}if(e.push(s[s.length-1]),e.length<2)return;const n=[0];for(let c=1;c<e.length;c++)n.push(n[c-1]+Math.hypot(e[c].x-e[c-1].x,e[c].z-e[c-1].z));if(n[n.length-1]<.5)return;const o=e.map((c,r)=>{const M=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],i=a.x-M.x,h=a.z-M.z,u=Math.hypot(i,h);return u<1e-6?{x:1,z:0}:{x:i/u,z:h/u}});return{kind:t.kind,...t.highSpeed?{highSpeed:!0}:{},level:t.level,centre:e,along:n,dir:o}}lay(t,s,e,n){const o=t.highSpeed?l.TRACK_SPACING_M.highSpeed:l.TRACK_SPACING_M[t.kind],c=Math.min(8,Math.max(1,t.tracks)),r=Array.from({length:c},(g,_)=>(_-(c-1)/2)*o),M=t.kind==="tram",a=M?0:l.BALLAST_HEIGHT_M,i=l.LIFT_M,h=(g,_,f)=>({x:s.centre[g].x-s.dir[g].z*_,y:s.y[g]+f,z:s.centre[g].z+s.dir[g].x*_}),u=s.centre.map((g,_)=>_);if(!M){const g=l.SLEEPER_LENGTH_M/2+l.BALLAST_SHOULDER_M+(r[r.length-1]??0),_=u.map(x=>h(x,g,a+i)),f=u.map(x=>h(x,-g,a+i));if(n.ballast.strip(_,f),t.level===0){const x=g+a*l.BALLAST_SLOPE;for(const E of[1,-1]){const z=[],v=[];let m=!1;for(const L of u){const C=h(L,E*x,i),S=e(C.x,C.z)+i,T=C.y-S;T<0&&(C.y=Math.min(S,s.y[L]+a-.05+i)),z.push(C);const I=h(L,E*(x+Math.max(0,T)*l.BANK_SLOPE),i);I.y=Math.min(e(I.x,I.z)+i,C.y),C.y-I.y>.02&&(m=!0),v.push(I)}const b=E>0?_:f;E>0?n.ballast.strip(z,b):n.ballast.strip(b,z),m&&(E>0?n.earth.strip(v,z):n.earth.strip(z,v))}}else{const x=-l.DECK_DEPTH_M,E=g+.15,z=u.map(L=>h(L,E,a+i+.1)),v=u.map(L=>h(L,-E,a+i+.1)),m=u.map(L=>h(L,E,x)),b=u.map(L=>h(L,-E,x));n.deck.strip(m,z),n.deck.strip(v,b),n.deck.strip(b,m),n.deck.strip(z,u.map(L=>h(L,g,a+i+.1))),n.deck.strip(u.map(L=>h(L,-g,a+i+.1)),v)}}const p=t.service?n.wood:n.concrete,A=t.gaugeMm/2e3+l.RAIL_HEAD_M/2,d=M?l.TRAM_RAIL_HEIGHT_M:l.RAIL_HEIGHT_M,O=a+i;for(const g of r){if(!M){const _=l.SLEEPER_LENGTH_M/2;p.strip(u.map(f=>h(f,g+_,O+.004)),u.map(f=>h(f,g-_,O+.004)),s.along)}for(const _ of[1,-1]){const f=g+_*A,x=l.RAIL_HEAD_M/2,E=u.map(v=>h(v,f+x,O+d)),z=u.map(v=>h(v,f-x,O+d));n.head.strip(E,z),n.rust.strip(u.map(v=>h(v,f+x,O)),E),n.rust.strip(z,u.map(v=>h(v,f-x,O)))}}t.electrification==="overhead"&&t.kind!=="subway"&&t.kind!=="funicular"&&this.catenary(t,s,r,O+d,h,e,n)}catenary(t,s,e,n,o,c,r){const M=l.catenaryOf(t),a=s.along[s.along.length-1],i=Math.max(1,Math.round(a/M.spanM)),h=a/i,u=Array.from({length:i},(E,z)=>(z+.5)*h),p=n+M.contactM,A=p+M.systemM,d=(M.systemM>0?A:p)+l.MAST_ABOVE_M,O=e[e.length-1],g=e.length>2,_=e.length===1?[1]:[1,-1],f=(E,z,v)=>{let m=0,b=s.along.length-2;for(;m<b;){const T=m+b+1>>1;s.along[T]<=E?m=T:b=T-1}const L=Math.min(1,Math.max(0,(E-s.along[m])/Math.max(1e-6,s.along[m+1]-s.along[m]))),C=o(m,z,v),S=o(m+1,z,v);return{x:C.x+(S.x-C.x)*L,y:C.y+(S.y-C.y)*L,z:C.z+(S.z-C.z)*L}};for(const E of u){const z=f(E,0,p);if(!(t.level===0&&c(z.x,z.z)>z.y)){for(const v of _){const m=v*(O+l.MAST_OFFSET_M),b=f(E,m,0);t.level===0&&(b.y=Math.min(b.y,c(b.x,b.z)));const L=f(E,m,d);if(r.steel.beam(b,L,l.MAST_SIDE_M),g)continue;const S=(_.length===1?e[0]:v*O)-v*.6,T=M.systemM>0?A:p+.3;r.steel.beam(f(E,m,T),f(E,S,T),l.ARM_SIDE_M),r.steel.beam(f(E,m,p-.4),f(E,S,T),l.ARM_SIDE_M)}if(g){const v=O+l.MAST_OFFSET_M;r.steel.beam(f(E,v,d-.2),f(E,-v,d-.2),l.MAST_SIDE_M*.8)}}}const x=[0,...u,a];for(const[E,z]of e.entries()){const v=m=>m===0||m===x.length-1?0:((m+E)%2===0?1:-1)*M.staggerM;for(let m=0;m<x.length-1;m++){const b=x[m],L=x[m+1];if(L-b<.1||(r.wire.beam(f(b,z+v(m),p),f(L,z+v(m+1),p),l.CONTACT_DIAMETER_M,!1),M.systemM<=0))continue;const C=4,S=T=>{const I=m===0?.5+T/2:m===x.length-2?T/2:T;return A-l.MESSENGER_SAG_M*4*I*(1-I)};for(let T=0;T<C;T++){const I=T/C,G=(T+1)/C;r.wire.beam(f(b+(L-b)*I,z,S(I)),f(b+(L-b)*G,z,S(G)),l.MESSENGER_DIAMETER_M,!1)}}}}static meshOf(t,s){if(t.indices.length===0)return;const e=new w;return e.setAttribute("position",new N(new Float32Array(t.positions),3)),t.along.length>0&&e.setAttribute("aAlong",new N(new Float32Array(t.along),1)),e.setIndex(new N(new Uint32Array(t.indices),1)),e.computeVertexNormals(),new U(e,s)}static lambert(t,s){return new k({color:new H(...t),...s?{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}:{}})}static pebbled(t){return t.onBeforeCompile=s=>{s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
2
2
  varying vec3 vBallast;`).replace("#include <begin_vertex>",`#include <begin_vertex>
3
3
  vBallast = position;`),s.fragmentShader=s.fragmentShader.replace("#include <common>",`#include <common>
4
4
  varying vec3 vBallast;
@@ -0,0 +1,28 @@
1
+ import{n as w,_ as I,aI as b,bv as M,bw as E,bx as C,by as O,bz as F,at as S,$ as x,a1 as D,a0 as N,I as k,Y as _,Z as P,aB as L,K as G,bh as H}from"./rr0-sighting-editor.mjs";import{S as K}from"./SkyEventEditorStyle-CvY_AhbI.js";const z=w.catalog({en:()=>I(()=>import("./ReentryParameterTexts_en-5BOfwCsS.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_en),fr:()=>I(()=>import("./ReentryParameterTexts_fr-BgUJROXF.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_fr),es:()=>I(()=>import("./ReentryParameterTexts_es-ze1-U4jB.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_es),it:()=>I(()=>import("./ReentryParameterTexts_it-MTb9Vuq0.js"),[],import.meta.url).then(v=>v.reentryParameterTexts_it)});class g{static NAME="name";static OBJECT="object";static LIGHT="light";static WHEN="when";static SEEN="seenByTheWitness";static EARTH_KM=6371;static placeSeen(t,e,n,i){const s=Math.PI/180,o=g.EARTH_KM,a=n*s,r=-o*Math.sin(a)+Math.sqrt((o*Math.sin(a))**2+(o+i)**2-o**2),d=Math.atan2(r*Math.cos(a),o+r*Math.sin(a)),c=t.lat*s,l=e*s,h=Math.asin(Math.sin(c)*Math.cos(d)+Math.cos(c)*Math.sin(d)*Math.cos(l)),m=t.lng*s+Math.atan2(Math.sin(l)*Math.sin(d)*Math.cos(c),Math.cos(d)-Math.sin(c)*Math.sin(h));return{lat:h/s,lng:(m/s+540)%360-180}}static trackFromSeen(t,e){const n=t.seen,{fromAzimuthDeg:i,fromAltitudeDeg:s,toAzimuthDeg:o,toAltitudeDeg:a,durationS:r}=n??{};if(i===void 0||s===void 0||o===void 0||a===void 0||!r)return;const d=t.track[0],c=t.track[t.track.length-1],l=d?.t??0,h=d?.altitudeKm??100,m=c?.altitudeKm??h;return[{t:l,...g.placeSeen(e,i,s,h),altitudeKm:h},{t:l+Math.round(r*1e3),...g.placeSeen(e,o,a,m),altitudeKm:m}]}static placeAt(t,e){const n=b.leadAt(t,e);if(n)return{t:e,lat:n.lat,lng:n.lng,altitudeKm:n.heightM/1e3};const i=t.track,[s,o]=e<(i[0]?.t??0)?[i[0],i[1]]:[i[i.length-2],i[i.length-1]];if(!s||!o||o.t===s.t){const r=s??o??{lat:0,lng:0,altitudeKm:80};return{t:e,lat:r.lat,lng:r.lng,altitudeKm:r.altitudeKm}}const a=(e-s.t)/(o.t-s.t);return{t:e,lat:s.lat+(o.lat-s.lat)*a,lng:s.lng+(o.lng-s.lng)*a,altitudeKm:Math.max(0,s.altitudeKm+(o.altitudeKm-s.altitudeKm)*a)}}static curvePointAt(t,e){return{t:e,absoluteMagnitude:Math.round(b.absoluteMagnitudeAt(t,e)*10)/10}}static instantsOf(t){return[...t.track.map(e=>e.t),...t.fragments.flatMap(e=>[...e.fromT===void 0?[]:[e.fromT],...e.untilT===void 0?[]:[e.untilT],...(e.lightCurve??[]).map(n=>n.t)])]}static instant(t,e,n,i={}){return{type:"number",key:t,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:e,hint:n,...i}}static mayBeCatalogued(t){return M.of(t.type)?.nature!=="natural"}static SET={kind:"reentry",title:"fireballOrReEntry",parameters:[{type:"said",key:"title",label:g.NAME},{type:"choice",key:"type",label:"type",hint:"whatCameInNaturalOrPut",empty:"notKnown",choices:[],optionsOf:t=>{const e=t.type,n=M.all().map(i=>({value:i.key,label:M.nameOf(i.key)}));return e===void 0||n.some(i=>i.value===e)?n:[...n,{value:e,label:e}]}},{type:"text",key:"object.name",group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"catalogueName",hint:"forAReEntryThePiece"},{type:"text",key:"object.cosparId",group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"cosparId",placeholder:"t1968013c"},{type:"number",key:"object.norad",min:1,max:999999,step:1,group:g.OBJECT,visibleWhen:g.mayBeCatalogued,label:"noradNumber"},{type:"number",key:"seen.fromAzimuthDeg",min:0,max:360,step:1,unit:"°",group:g.SEEN,label:"appearedAzimuth",hint:"fromTheNorthTowardsTheEast"},{type:"number",key:"seen.fromAltitudeDeg",min:-5,max:90,step:1,unit:"°",group:g.SEEN,label:"appearedHeight",hint:"aboveTheHorizon"},{type:"number",key:"seen.toAzimuthDeg",min:0,max:360,step:1,unit:"°",group:g.SEEN,label:"wentOutAzimuth",hint:"fromTheNorthTowardsTheEast"},{type:"number",key:"seen.toAltitudeDeg",min:-5,max:90,step:1,unit:"°",group:g.SEEN,label:"wentOutHeight",hint:"aboveTheHorizon"},{type:"number",key:"seen.durationS",min:.1,max:3600,step:.1,unit:"s",group:g.SEEN,label:"seenFor",hint:"allSaidThePathIsWorkedOut"}]};static PLACE={kind:"reentry-place",title:"pointOfThePath",parameters:[g.instant("t","time","secondsOfTheRecordingNegativeBefore",{required:!0}),{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,rangeM:2e6,label:"position"},{type:"number",key:"altitudeKm",min:0,max:300,step:.1,unit:"km",required:!0,label:"altitude",hint:"aboveTheEllipsoidAMeteorBegins"}]};static trackEnd(t,e){const n=t?.track;if(n?.length)return e==="first"?n[0].t:n[n.length-1].t}static FRAGMENT={kind:"reentry-fragment",title:"piece",parameters:[{type:"text",key:"id",label:"id",validate:(t,e,n)=>!n?.fragments.some(i=>i!==e&&i.id===t)},{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,group:g.LIGHT,label:"absoluteMagnitude",hint:"itsBrightnessSeenFrom100Km"},{type:"colour",key:"color",group:g.LIGHT,fallback:b.DEFAULT_COLOR,label:"colour"},{type:"number",key:"trainS",min:0,max:600,step:.1,unit:"s",group:g.LIGHT,effective:()=>b.DEFAULT_TRAIN_S,label:"train",hint:"howLongAStretchOfIts"},{type:"number",key:"lagS",min:0,max:600,step:.1,unit:"s",group:g.WHEN,effective:()=>0,label:"behindTheLead",hint:"secondsBehindTheLeadingPointAlong"},g.instant("fromT","seenFrom","whenItBreaksOffOrBegins",{group:g.WHEN,effective:(t,e)=>g.trackEnd(e,"first")}),g.instant("untilT","outAt","whenItHasBurnedUpOr",{group:g.WHEN,effective:(t,e)=>g.trackEnd(e,"last")})]};static CURVE_POINT={kind:"reentry-curve-point",title:"pointOfTheLightCurve",parameters:[g.instant("t","time","secondsOfTheRecording",{required:!0}),{type:"number",key:"absoluteMagnitude",min:-40,max:10,step:.1,required:!0,label:"absoluteMagnitude"}]}}const $=w.catalog({en:()=>I(()=>import("./ReentryEditorMessages_en-BmTZMr-m.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_en),fr:()=>I(()=>import("./ReentryEditorMessages_fr-DHbcY0tN.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_fr),es:()=>I(()=>import("./ReentryEditorMessages_es-edid__Jo.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_es),it:()=>I(()=>import("./ReentryEditorMessages_it-CIzkIU4G.js"),[],import.meta.url).then(v=>v.reentryEditorMessages_it)});class u{static TIME_MARGIN_MIN=6;static HEADING_MARGIN_DEG=45;static ELEVATION_LOW_FACTOR=.3;static ELEVATION_SLACK_DEG=5;static DURATION_FACTOR=3;static ARCHIVED_MAGNITUDE=-3;static WATCHED_KM=600;static WATCHED_COUNT=5;static NIGHT_SUN_DEG=-12;static SHOWER_MARGIN_DEG=20;static RADIANT_BELOW_DEG=-10;static FIRST_ORBIT_MS=Date.UTC(1957,9,4);static shared={fireballs:new C,reentries:new E};static viewOf(t,e,n){const i=t.track;if(i.length<2)return;const s=i[0],o=i[i.length-1],a=t.seen,r=m=>b.seenFrom(n,{lat:m.lat,lng:m.lng,heightM:m.altitudeKm*1e3}),d=a?.fromAzimuthDeg!==void 0&&a.fromAltitudeDeg!==void 0?{azimuthDeg:a.fromAzimuthDeg,altitudeDeg:a.fromAltitudeDeg}:r(s),c=a?.toAzimuthDeg!==void 0&&a.toAltitudeDeg!==void 0?{azimuthDeg:a.toAzimuthDeg,altitudeDeg:a.toAltitudeDeg}:r(o),l=a?.durationS??(o.t-s.t)/1e3,h=Math.min(...t.fragments.flatMap(m=>[m.absoluteMagnitude,...(m.lightCurve??[]).map(f=>f.absoluteMagnitude)]));return{startMs:e.getTime()+s.t,durationS:l,from:{azimuthDeg:d.azimuthDeg,altitudeDeg:d.altitudeDeg},to:{azimuthDeg:c.azimuthDeg,altitudeDeg:c.altitudeDeg},peakAbsoluteMagnitude:h}}static azimuthOff(t,e){const n=Math.abs(((t-e)%360+360)%360);return Math.min(n,360-n)}static elevationOff(t,e){const n=Math.max(0,t*u.ELEVATION_LOW_FACTOR)-u.ELEVATION_SLACK_DEG,i=t+u.ELEVATION_SLACK_DEG;return e<n?n-e:e>i?e-i:0}static matchFireball(t,e,n){const i=e.t<t.startMs?t.startMs-e.t:0,s=e.t>t.startMs?e.t-t.startMs:0;if(Math.max(i,s)>u.TIME_MARGIN_MIN*6e4)return;const o=b.seenFrom(n,{lat:e.from[0],lng:e.from[1],heightM:e.from[2]*1e3}),a=b.seenFrom(n,{lat:e.to[0],lng:e.to[1],heightM:e.to[2]*1e3});if(o.altitudeDeg<0&&a.altitudeDeg<0)return;const r=Math.max(u.azimuthOff(t.from.azimuthDeg,o.azimuthDeg),u.azimuthOff(t.to.azimuthDeg,a.azimuthDeg));if(r>u.HEADING_MARGIN_DEG||Math.max(u.elevationOff(t.from.altitudeDeg,o.altitudeDeg),u.elevationOff(t.to.altitudeDeg,a.altitudeDeg))>0)return;const c=u.DURATION_FACTOR;if(!(e.durationS>0&&(t.durationS<e.durationS/c||t.durationS>e.durationS*c)))return{record:e,offsetMinutes:Math.round((i+s)/6e4),headingOffDeg:Math.round(r),altitudeOffDeg:Math.round(Math.abs(a.altitudeDeg-t.to.altitudeDeg))}}static async check(t,e,n,i=u.shared){if(!e||!n)return[{verdict:"unchecked",source:"none",reason:"noDateOrPlace"}];const s=u.viewOf(t,e,n);if(!s)return[{verdict:"unchecked",source:"none",reason:"noDateOrPlace"}];const o=M.of(t.type)?.nature,a=[];if(o!=="artificial"&&a.push(...await u.checkFireballs(s,n,o==="natural",i)),o!=="artificial"){const r=u.showerOf(s,n);r&&(r.verdict==="compatible"||o==="natural")&&a.push(r)}return o!=="natural"&&a.push(...await u.checkCatalogue(t,s,n,o==="artificial",i)),o===void 0&&!a.some(r=>r.verdict==="known"||r.verdict==="possible"||r.verdict==="compatible")?[...a.filter(r=>r.verdict==="unchecked"),{verdict:"uninformative",source:"none",reason:"typeUnknown"}]:a}static vectorOf(t,e){const n=Math.PI/180,i=e*n,s=t*n;return[Math.cos(i)*Math.sin(s),Math.cos(i)*Math.cos(s),Math.sin(i)]}static angleDeg(t,e){return Math.acos(Math.max(-1,Math.min(1,t[0]*e[0]+t[1]*e[1]+t[2]*e[2])))*180/Math.PI}static showerOf(t,e){const n=u.vectorOf(t.from.azimuthDeg,t.from.altitudeDeg),i=u.vectorOf(t.to.azimuthDeg,t.to.altitudeDeg),s=u.angleDeg(n,i);if(s<1)return;const o=[n[1]*i[2]-n[2]*i[1],n[2]*i[0]-n[0]*i[2],n[0]*i[1]-n[1]*i[0]],a=Math.hypot(o[0],o[1],o[2]),r=new Date(t.startMs),d=O.activeAt(r);let c;for(const{shower:l,zhr:h}of d){const m=O.radiantPosition(l,r,{lat:e.lat,lng:e.lng,elevationM:e.heightM});if(m.altitudeDeg<u.RADIANT_BELOW_DEG)continue;const f=u.vectorOf(m.azimuthDeg,m.altitudeDeg),p=Math.asin(Math.min(1,Math.abs((f[0]*o[0]+f[1]*o[1]+f[2]*o[2])/a)))*180/Math.PI,y=u.angleDeg(f,n),A=u.angleDeg(f,i);y>=A||A<=s||p<=u.SHOWER_MARGIN_DEG&&(!c||p<c.offDeg)&&(c={showerId:l.id,offDeg:Math.round(p),zhr:Math.round(h)})}return c?{verdict:"compatible",source:"showers",...c}:{verdict:"sporadic",source:"showers",active:d.length}}static async checkFireballs(t,e,n,i){const s=u.TIME_MARGIN_MIN*6e4;if(!C.mayCover(t.startMs))return n?[{verdict:"uninformative",source:"gmn",reason:"beforeArchive"}]:[];const o=await i.fireballs.between(t.startMs-s,t.startMs+s+t.durationS*1e3);if(o===void 0)return n?[{verdict:"unchecked",source:"gmn",reason:"unreachable"}]:[];const a=o.map(m=>u.matchFireball(t,m,e)).filter(m=>m!==void 0).sort((m,f)=>m.offsetMinutes-f.offsetMinutes||m.headingOffDeg-f.headingOffDeg);if(a.length>0)return[{verdict:"known",source:"gmn",match:a[0]}];if(!n)return[];if(t.peakAbsoluteMagnitude>u.ARCHIVED_MAGNITUDE)return[{verdict:"uninformative",source:"gmn",reason:"faint"}];if(F("Sun",new Date(t.startMs),{lat:e.lat,lng:e.lng,elevationM:0}).altitudeDeg>u.NIGHT_SUN_DEG)return[{verdict:"uninformative",source:"gmn",reason:"daylight"}];const r=new Date(t.startMs),d=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),1),c=Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+1,1)-1,h=(await i.fireballs.between(d,c)??[]).filter(m=>E.distanceKm(e.lat,e.lng,m.from[0],m.from[1])<=u.WATCHED_KM).length;return h<u.WATCHED_COUNT?[{verdict:"uninformative",source:"gmn",reason:"unwatched"}]:[{verdict:"expectedAbsent",source:"gmn",absoluteMagnitude:t.peakAbsoluteMagnitude,watchedCount:h}]}static async checkCatalogue(t,e,n,i,s){if(e.startMs<u.FIRST_ORBIT_MS)return i?[{verdict:"impossible",source:"catalogue"}]:[];const o=u.TIME_MARGIN_MIN*6e4,a=await s.reentries.candidates(e.startMs-o,e.startMs+o+e.durationS*1e3,n);if(a===void 0)return i?[{verdict:"unchecked",source:"catalogue",reason:"unreachable"}]:[];const r=t.object,d=r&&a.find(l=>r.cosparId&&l.record.cosparId===r.cosparId||r.norad!==void 0&&l.record.norad===r.norad);if(d)return[{verdict:"known",source:"catalogue",candidate:d,by:"object"}];const c=a.find(l=>l.record.precision==="minute"&&l.seenKm!==void 0&&(l.offsetMinutes??0)<=u.TIME_MARGIN_MIN);return c?[{verdict:"known",source:"catalogue",candidate:c,by:"seen"}]:a.length>0?a.slice(0,3).map(l=>({verdict:"possible",source:"catalogue",candidate:l})):i?[{verdict:"expectedAbsent",source:"catalogue"}]:[]}}class T{constructor(t,e,n){this.container=t,this.host=e,K.attach(t,"reentry-editor-part",T.STYLE),this.language=n,this.ready=this.setLanguage(n)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;placeForm;placeIndex=0;row="path";fragmentForm;fragmentIndex=0;curveForm;curveIndex=0;language;shown=[];static STYLE='.reentry-editor-part { flex-basis: 100%; min-width: 0; } .reentry-editor-part #reentry-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .reentry-editor-part #reentry-path > .icon-btn, .reentry-editor-part #reentry-curve > .icon-btn { align-self: flex-end; } .reentry-editor-part #reentry-list, .reentry-editor-part #reentry-places, .reentry-editor-part #reentry-fragment-list, .reentry-editor-part #reentry-curve-list { flex-basis: 100%; min-width: 0; } .reentry-editor-part .launch-editor, .reentry-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .reentry-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .reentry-editor-part [hidden] { display: none !important; } .reentry-editor-part .reentry-evidence { flex-basis: 100%; } .reentry-editor-part .evidence-known, .reentry-editor-part .evidence-impossible, .reentry-editor-part .evidence-expectedAbsent { font-weight: 600; } .reentry-editor-part select { min-width: 0; width: 100%; } .reentry-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .reentry-editor-part .launch-track { flex-basis: 100%; margin: 0; } .reentry-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .reentry-editor-part .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .reentry-editor-part input, .reentry-editor-part select { max-width: 100%; box-sizing: border-box; } .reentry-editor-part input[type="text"] { width: 12em; } .reentry-editor-part input[data-key="title"] { width: 18em; } .reentry-editor-part label { min-width: 0; max-width: 100%; } .reentry-editor-part input.parameter-derived::placeholder { opacity: .65; } .reentry-editor-part .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(t){const e=++this.languageToken;this.language=t;const[n,i,,s]=await Promise.all([$.load(t),z.load(t),M.load(t),S(t).catch(()=>{})]);e===this.languageToken&&(this.sceneNames=s,this.messages=n,this.parameterTexts=i,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.reentries;this.shown=[...t],t.some(n=>n.id===this.currentId)||(this.currentId=t[0]?.id),this.list?.setItems(t.map(n=>({id:n.id,label:this.labelOf(n)})),this.currentId),this.list?.setKinds(M.all().map(n=>({value:n.key,label:M.nameOf(n.key)}))),this.syncAddState();const e=this.current;this.element("reentry-fields").hidden=e===void 0,e&&(this.syncPlace(!0),this.syncFragments(e,!0),this.syncEvidence(),this.form??=new x(this.element("reentry-parameters"),this.language,"reentry.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(g.SET),new D(()=>this.current,n=>this.editReentry(i=>{i.object&&(i.object={...i.object}),i.seen&&(i.seen={...i.seen}),n(i),i.object&&Object.values(i.object).every(a=>a===void 0||a==="")&&delete i.object;const s=this.origin(),o=s&&g.trackFromSeen(i,s);o&&(i.track=o)})),()=>this.written()))}refresh(){if(!this.messages)return;this.syncAddState();const t=this.reentries;if(t.length===this.shown.length&&t.every((e,n)=>e.id===this.shown[n].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.origin()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.reentries.find(t=>t.id===this.currentId)}show(t){this.messages&&(this.currentId=t,this.row="path",this.placeIndex=0,this.fragmentIndex=0,this.curveIndex=0,this.sync())}resolved(t){return N.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.evidenceFor=void 0,this.container.innerHTML=`<div class="launch-editor">
2
+ <p class="launch-intro">${t.intro}</p>
3
+ <div id="reentry-list"></div>
4
+ <div id="reentry-fields" class="launch-fields">
5
+ <div id="reentry-parameters" class="launch-parameters"></div>
6
+ <div id="reentry-evidence" class="launch-intro reentry-evidence" aria-live="polite"></div>
7
+ <div id="reentry-timeline"></div>
8
+ <button id="reentry-fragment-add" type="button" title="${t.addFragment}">${k.PLUS} ${t.fragment}</button>
9
+ <p class="launch-intro">${t.timelineNote}</p>
10
+ <fieldset id="reentry-path" class="launch-path">
11
+ <legend>${t.path}</legend>
12
+ <div id="reentry-place-parameters" class="launch-parameters"></div>
13
+ <button id="reentry-place-delete" class="icon-btn" type="button" title="${t.deletePlace}" aria-label="${t.deletePlace}">${k.TRASH}</button>
14
+ </fieldset>
15
+ <fieldset id="reentry-fragments" class="launch-path">
16
+ <legend id="reentry-fragment-legend">${t.fragment}</legend>
17
+ <div id="reentry-fragment-parameters" class="launch-parameters"></div>
18
+ <button id="reentry-fragment-delete" class="icon-btn" type="button" title="${t.deleteFragment}" aria-label="${t.deleteFragment}">${k.TRASH}</button>
19
+ <fieldset id="reentry-curve" class="launch-path">
20
+ <legend>${t.curve}</legend>
21
+ <p id="reentry-curve-empty" class="launch-intro">${t.noCurve}</p>
22
+ <div id="reentry-curve-parameters" class="launch-parameters"></div>
23
+ <button id="reentry-curve-delete" class="icon-btn" type="button" title="${t.deleteCurvePoint}" aria-label="${t.deleteCurvePoint}">${k.TRASH}</button>
24
+ </fieldset>
25
+ </fieldset>
26
+ <p class="launch-intro">${t.derivedNote}</p>
27
+ </div>
28
+ </div>`,this.list=new _({header:this.element("reentry-list"),body:this.element("reentry-fields"),ids:{list:"reentry-select",remove:"reentry-delete",add:"reentry-add",kinds:"reentry-add-kind",kind:e=>`reentry-add-${e}`},onSelect:e=>this.show(e),onAdd:e=>{e&&this.addReentry(e)},onRemove:()=>this.deleteCurrent(),actions:this.host.pointAt?[{id:"reentry-point",glyph:"🎯",onClick:()=>this.pointAtCurrent()}]:[]}),this.list.setLabels({list:t.reentry,remove:t.deleteReentry,add:t.addReentry,empty:t.none,actions:{"reentry-point":t.pointAtReentry}}),this.timeline=new P(this.element("reentry-timeline"),e=>this.host.seekTo(e),{addKeyframeHere:t.addPointHere,keyframeHere:t.pointHere,zoomHint:t.zoomHint}),this.element("reentry-place-delete").addEventListener("click",()=>this.removePlace()),this.element("reentry-curve-delete").addEventListener("click",()=>this.removeCurvePoint()),this.placeForm=void 0,this.element("reentry-fragment-add").addEventListener("click",()=>this.addFragment()),this.element("reentry-fragment-delete").addEventListener("click",()=>this.removeFragment()),this.fragmentForm=void 0,this.curveForm=void 0}written(){const t=this.current;t&&this.list?.rename(t.id,this.labelOf(t)),t?.seen&&this.syncPlace(!0),this.syncEvidence()}sceneNames;evidenceTimer;evidenceFor;syncEvidence(){const t=this.current,e=this.element("reentry-evidence");if(clearTimeout(this.evidenceTimer),!t)return;const n=this.host.sighting(),i=n.event?.place?.[0],s=i?.lng!==void 0&&n.event?.time?L(n.event.time,i.lng,n.event.utcOffsetHours):void 0,o=i?.lat!==void 0&&i.lng!==void 0?{lat:i.lat,lng:i.lng,heightM:0}:void 0,a={reentry:t,at:s?.getTime(),lat:o?.lat,lng:o?.lng},r=this.evidenceFor;r&&r.reentry===a.reentry&&r.at===a.at&&r.lat===a.lat&&r.lng===a.lng||(this.evidenceFor=a,e.textContent=`${this.messages.evidence} — ${this.messages.evidenceChecking}`,this.evidenceTimer=setTimeout(()=>{u.check(t,s,o).then(d=>{if(this.evidenceFor!==a)return;const c=this.messages,l=c.margins.replace("{minutes}",String(u.TIME_MARGIN_MIN)).replace("{heading}",String(u.HEADING_MARGIN_DEG)).replace("{factor}",String(u.DURATION_FACTOR)),h=document.createElement("strong");h.textContent=c.evidence;const m=d.map(p=>{const y=document.createElement("span");return y.className=`evidence-${p.verdict}`,y.textContent=this.findingText(p),y}),f=document.createElement("small");f.textContent=l,e.replaceChildren(h,...m.flatMap(p=>[document.createElement("br"),p]),document.createElement("br"),f)},()=>{this.evidenceFor===a&&(e.textContent="")})},400))}findingText(t){const e=this.messages,n=this.language,i=r=>new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short",timeZone:"UTC"}).format(r)+" UTC",s=r=>new Intl.DateTimeFormat(n,{dateStyle:"long",timeZone:"UTC"}).format(r),o=r=>r.toLocaleString(n,{maximumFractionDigits:1}),a=(r,d)=>Object.entries(d).reduce((c,[l,h])=>c.replaceAll(`{${l}}`,h===void 0?"?":String(h)),r);switch(t.verdict){case"known":if(t.source==="gmn"){const{record:r,offsetMinutes:d,headingOffDeg:c}=t.match;return a(e.knownFireball,{id:r.id,time:i(r.t),offset:d,stations:r.stations,mag:o(r.peakMagnitude),heading:c})}else{const{record:r,timeMs:d,seenKm:c}=t.candidate,l={name:r.name,cospar:r.cosparId??r.norad,time:i(d),when:r.precision==="day"?s(d):i(d),place:r.seenFrom,km:c===void 0?void 0:Math.round(c)};return a(t.by==="object"?e.knownObject:e.knownSeen,l)}case"possible":{const{record:r,timeMs:d,seenKm:c,offsetMinutes:l}=t.candidate,h={name:r.name,cospar:r.cosparId??r.norad,time:i(d),day:s(d),hours:r.uncertaintyHours,place:r.seenFrom,km:c===void 0?void 0:Math.round(c),offset:l};return a(r.precision==="minute"?e.possibleSeen:r.precision==="hours"?e.possibleWindow:e.possibleDay,h)}case"expectedAbsent":return t.source==="gmn"?a(e.expectedFireball,{mag:o(t.absoluteMagnitude),count:t.watchedCount,km:u.WATCHED_KM}):e.expectedCatalogue;case"impossible":return e.impossibleOrbit;case"uninformative":return t.source==="none"?e.typeUnknown:t.reason==="faint"?e.faintFireball:t.reason==="beforeArchive"?e.beforeGmn:t.reason==="daylight"?e.daylightGmn:a(e.unwatchedGmn,{km:u.WATCHED_KM});case"compatible":return a(e.compatibleShower,{shower:this.sceneNames?.showers[t.showerId]??t.showerId,off:t.offDeg,zhr:t.zhr,margin:u.SHOWER_MARGIN_DEG});case"sporadic":return t.active===0?e.sporadicNoShower:a(e.sporadicShower,{count:t.active});case"unchecked":return t.reason==="noDateOrPlace"?e.noDateOrPlace:t.source==="gmn"?e.unreachableGmn:e.unreachableCatalogue}}syncTimeline(){const t=this.current;if(!this.timeline||!t)return;const e=this.messages,n=t.track[0]?.t??0,i=t.track[t.track.length-1]?.t??0,s={id:"path",label:e.path,color:T.PATH_COLOR,times:t.track.map(l=>l.t),active:this.row==="path",selectedTime:this.row==="path"?t.track[this.placeIndex]?.t:void 0,open:()=>this.selectPlace(this.placeIndex),pressed:(l,h)=>{const m=h===void 0?-1:(this.current?.track??[]).findIndex(f=>f.t===h);this.selectPlace(m>=0?m:this.placeIndex)},move:(l,h)=>this.movePlace(l,h),add:()=>this.addPlaceAt(this.host.currentTime())},o=t.fragments.map((l,h)=>{const m=l.lightCurve??[];return{id:`fragment-${h}`,label:this.fragmentLabel(l,h),color:T.PIECE_COLOR,times:m.map(f=>f.t),spans:[{t:l.fromT??n,until:l.untilT??i,label:""}],active:this.row==="fragment"&&h===this.fragmentIndex,selectedTime:this.row==="fragment"&&h===this.fragmentIndex?m[this.curveIndex]?.t:void 0,open:()=>this.selectFragment(h),pressed:(f,p)=>{const y=p===void 0?-1:(this.current?.fragments[h]?.lightCurve??[]).findIndex(A=>A.t===p);this.selectFragment(h,y>=0?y:void 0)},move:(f,p)=>this.moveCurvePoint(h,f,p),add:()=>this.addCurvePointAt(h,this.host.currentTime())}}),a=g.instantsOf(t),r=Math.min(...a),d=Math.max(...a),c=Math.max(500,(d-r)/10);this.timeline.show([s,...o],this.host.duration(),this.host.currentTime(),{from:r-c,to:d+c})}static PATH_COLOR="#e08a1e";static PIECE_COLOR="#c0581b";static MIN_PLACES=2;syncPlace(t=!1){const e=this.current?.track??[];this.placeIndex=Math.max(0,Math.min(this.placeIndex,e.length-1)),this.element("reentry-place-delete").disabled=e.length<=T.MIN_PLACES,this.placeForm?this.placeForm.sync(t):(this.placeForm=new x(this.element("reentry-place-parameters"),this.language,"reentryPlace."),this.placeForm.show(this.resolved(g.PLACE),new D(()=>this.current?.track[this.placeIndex],n=>this.editPlace(this.placeIndex,n),void 0,this.host.positionPlace?.()),()=>{})),this.syncTimeline()}selectPlace(t){this.row="path",this.placeIndex=t,this.syncDetail(),this.syncPlace(!0)}syncDetail(){this.element("reentry-path").hidden=this.row!=="path",this.element("reentry-fragments").hidden=this.row!=="fragment";const t=this.currentFragment;this.element("reentry-fragment-legend").textContent=t?`${this.messages.fragment} ${this.fragmentLabel(t,this.fragmentIndex)}`:this.messages.fragment}editPlace(t,e){let n;this.editReentry(i=>{n={...i.track[t]},e(n),i.track=i.track.map((s,o)=>o===t?n:s).sort((s,o)=>s.t-o.t)}),n&&(this.placeIndex=this.current?.track.indexOf(n)??0),this.syncPlace()}movePlace(t,e){const n=this.current?.track.findIndex(i=>i.t===t)??-1;n<0||(this.editPlace(n,i=>{i.t=e}),this.syncPlace(!0))}addPlaceAt(t){const e=this.current;if(!e)return;const n=e.track.findIndex(s=>Math.abs(s.t-t)<1);if(n>=0){this.selectPlace(n);return}const i=g.placeAt(e,t);this.editReentry(s=>{s.track=[...s.track,i].sort((o,a)=>o.t-a.t)}),this.selectPlace(this.current?.track.indexOf(i)??0)}removePlace(){if((this.current?.track.length??0)<=T.MIN_PLACES)return;const t=this.placeIndex;this.editReentry(e=>{e.track=e.track.filter((n,i)=>i!==t)}),this.syncPlace(!0)}static MIN_FRAGMENTS=1;fragmentLabel(t,e){return t.id??String(e+1)}syncFragments(t,e=!1){const n=t.fragments;this.fragmentIndex=Math.max(0,Math.min(this.fragmentIndex,n.length-1)),this.element("reentry-fragment-delete").disabled=n.length<=T.MIN_FRAGMENTS,this.syncDetail(),this.fragmentForm?this.fragmentForm.sync(e):(this.fragmentForm=new x(this.element("reentry-fragment-parameters"),this.language,"reentryFragment."),this.fragmentForm.show(this.resolved(g.FRAGMENT),new D(()=>this.currentFragment,i=>this.editFragment(s=>i(s)),()=>this.current),()=>{})),this.syncCurve(e)}selectFragment(t,e){const n=t!==this.fragmentIndex;this.row="fragment",this.fragmentIndex=t,e!==void 0?this.curveIndex=e:n&&(this.curveIndex=0),this.current&&this.syncFragments(this.current,!0)}get currentFragment(){return this.current?.fragments[this.fragmentIndex]}editFragment(t,e=this.fragmentIndex){this.editReentry(n=>{const i={...n.fragments[e]};i.lightCurve&&(i.lightCurve=[...i.lightCurve]),t(i),n.fragments=n.fragments.map((s,o)=>o===e?i:s)}),this.syncDetail(),this.syncTimeline()}addFragment(){const t=this.current;if(!t)return;const e=t.fragments[t.fragments.length-1];let n=t.fragments.length+1;for(;t.fragments.some(s=>s.id===`piece-${n}`);)n++;const i={id:`piece-${n}`,lagS:(e?.lagS??0)+1,absoluteMagnitude:(e?.absoluteMagnitude??-4)+1};this.editReentry(s=>{s.fragments=[...s.fragments,i]}),this.selectFragment((this.current?.fragments.length??1)-1)}removeFragment(){if((this.current?.fragments.length??0)<=T.MIN_FRAGMENTS)return;const t=this.fragmentIndex;this.editReentry(e=>{e.fragments=e.fragments.filter((n,i)=>i!==t)}),this.curveIndex=0,this.selectFragment(Math.min(t,(this.current?.fragments.length??1)-1))}syncCurve(t=!1){const e=this.currentFragment?.lightCurve??[];this.curveIndex=Math.max(0,Math.min(this.curveIndex,e.length-1)),this.element("reentry-curve-empty").hidden=e.length>0,this.element("reentry-curve-parameters").hidden=e.length===0,this.element("reentry-curve-delete").hidden=e.length===0,this.curveForm?this.curveForm.sync(t):(this.curveForm=new x(this.element("reentry-curve-parameters"),this.language,"reentryCurve."),this.curveForm.show(this.resolved(g.CURVE_POINT),new D(()=>this.currentFragment?.lightCurve?.[this.curveIndex],n=>this.editCurvePoint(this.fragmentIndex,this.curveIndex,n)),()=>{})),this.syncTimeline()}editCurvePoint(t,e,n){let i;this.editFragment(s=>{const o=s.lightCurve??[];i={...o[e]},n(i),s.lightCurve=o.map((a,r)=>r===e?i:a).sort((a,r)=>a.t-r.t)},t),i&&(this.curveIndex=this.current?.fragments[t]?.lightCurve?.indexOf(i)??0),this.syncCurve()}moveCurvePoint(t,e,n){const i=this.current?.fragments[t]?.lightCurve?.findIndex(s=>s.t===e)??-1;i<0||(this.fragmentIndex=t,this.editCurvePoint(t,i,s=>{s.t=n}),this.syncFragments(this.current,!0))}addCurvePointAt(t,e){const n=this.current?.fragments[t];if(!n)return;const i=(n.lightCurve??[]).findIndex(o=>Math.abs(o.t-e)<1);if(i>=0){this.selectFragment(t,i);return}const s=g.curvePointAt(n,e);this.editFragment(o=>{o.lightCurve=[...o.lightCurve??[],s].sort((a,r)=>a.t-r.t)},t),this.selectFragment(t,this.current?.fragments[t]?.lightCurve?.indexOf(s)??0)}removeCurvePoint(){if(!this.currentFragment?.lightCurve?.length)return;const t=this.curveIndex;this.editFragment(e=>{const n=(e.lightCurve??[]).filter((i,s)=>s!==t);n.length?e.lightCurve=n:delete e.lightCurve}),this.syncCurve(!0)}editReentry(t){const e=this.current;if(!e)return;const n={...e,track:[...e.track],fragments:[...e.fragments]};t(n),this.writeReentries(this.reentries.map(i=>i===e?n:i)),this.host.changed()}pointAtCurrent(){const t=this.current,e=t?.track;if(!t||!e||e.length<2||!this.host.pointAt)return;const n=e[0].t,i=e[e.length-1].t;let s=this.host.currentTime();(s<n||s>i)&&(s=Math.round(n+Math.min(1e3,(i-n)/2)),this.host.seekTo(s));const o=this.host.sighting(),a=G(o,s),r=o.event?.place?.[0],d=a?.lat??r?.lat,c=a?.lng??r?.lng,l=b.leadAt(t,s);if(d===void 0||c===void 0||!l)return;const h=b.seenFrom({lat:d,lng:c,heightM:a?.elevationM??0},l);this.host.pointAt(h.azimuthDeg,h.altitudeDeg)}origin(){const t=this.host.sighting(),e=t.event?.place?.[0];if(!(e?.lat===void 0||e.lng===void 0))return{lat:e.lat,lng:e.lng,headingRad:(t.observerTrack?.getInterpolatedPoseAt(0)?.headingDeg??0)*Math.PI/180}}newOf(t){const e=this.origin(),n=M.of(t);if(!e||!n)return;const{distanceKm:i,speedKmS:s,durationS:o,fromAltitudeKm:a,toAltitudeKm:r,fragments:d}=n.template,c=Math.round(this.host.currentTime()),l=Math.max(.05,Math.cos(e.lat*Math.PI/180)),h=(f,p)=>{const y=f*Math.cos(e.headingRad)-p*Math.sin(e.headingRad),A=f*Math.sin(e.headingRad)+p*Math.cos(e.headingRad);return{lat:e.lat+y/111.32,lng:e.lng+A/(111.32*l)}},m=s*o/2;return{type:t,track:[{t:c,...h(i,-m),altitudeKm:a},{t:c+o*1e3,...h(i,m),altitudeKm:r}],fragments:d.map(f=>({...f,...f.sheds?{sheds:[...f.sheds]}:{}}))}}addReentry(t){const e=this.newOf(t);if(!e)return;let n=this.reentries.length+1;for(;this.reentries.some(s=>s.id===`${t}-${n}`);)n++;const i={id:`${t}-${n}`,...e};this.writeReentries([...this.reentries,i]),this.host.changed(),this.show(i.id)}deleteCurrent(){const t=this.current;t&&(this.currentId=void 0,this.writeReentries(this.reentries.filter(e=>e!==t)),this.host.changed(),this.sync())}writeReentries(t){const e=this.host.sighting();e.skyEvents=H.written({...e.skyEvents,reentries:t})}labelOf(t){const e=this.host.said().read(t.title)||t.object?.name||(t.type===void 0?"":M.nameOf(t.type));return e?`${e} (${t.id})`:t.id}get reentries(){return this.host.sighting().skyEvents?.reentries??[]}element(t){return this.container.querySelector(`#${t}`)}}export{T as ReentryEditor};
@@ -1 +1 @@
1
- import{ap as S,aV as _,aW as G,aH as M,aX as f,aI as w,as as F,aP as R,aQ as m,V as H,aY as N,aZ as y,a_ as C,a$ as P,ad as L}from"./rr0-sighting-editor.mjs";class h{static RADIUS=840;static MAX_SEGMENTS=1024;static VERTICES_PER_SEGMENT=12;static MIN_HALF_WIDTH_DEG=.1;static BRIGHT_HALF_WIDTH_DEG=.22;static TRAIN_SHARE=.9;static TRAIN_FALLOFF=1.2;object=new S;tiers;trains;positions;colors;shown=0;drawn=[];constructor(){this.object.name="reentries",this.tiers=_.map(i=>{const o=new G(new M,f.material(i.size,!1));return f.track(o),o.frustumCulled=!1,this.object.add(o),o});const s=h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT;this.positions=new Float32Array(s*3),this.colors=new Float32Array(s*3);const t=new M;t.setAttribute("position",new w(this.positions,3)),t.setAttribute("color",new w(this.colors,3)),t.setDrawRange(0,0),this.trains=new F(t,R.material()),this.trains.frustumCulled=!1,R.track(this.trains),this.object.add(this.trains)}nearest(s,t){let i,o=t;for(const e of this.drawn){const n=e.direction.dot(s);(n>o||i&&n===o&&e.magnitude<i.magnitude)&&(o=n,i=e)}return i}static directionOf(s){const{x:t,y:i,z:o}=m(s.altitudeDeg,s.azimuthDeg,1);return new H(t,i,o)}get count(){return this.shown}set(s,t,i,o){const e=this.tiers.map(()=>[]);let n=0,E=0;const r=new N;this.drawn=[];for(const a of s){const u=i(a.head);if(u<=0)continue;const c=a.magnitude-2.5*Math.log10(u);if(c>t)continue;E++,this.drawn.push({direction:h.directionOf(a.head),view:a,magnitude:c}),r.set(a.color);const d=y(c,t)*a.fade,{x:I,y:A,z:p}=m(a.head.altitudeDeg,a.head.azimuthDeg,h.RADIUS),[l,T,z]=o(a.head,c),D=a.fade,b=Math.max(r.r,r.g,r.b)||1;e[C(d)].push({x:I,y:A,z:p,r:l*r.r*D/b,g:T*r.g*D/b,b:z*r.b*D/b}),n=this.pushTrain(n,a.train,d,r)}this.shown=E,this.tiers.forEach((a,u)=>{const c=e[u],d=new Float32Array(c.length*3),I=new Float32Array(c.length*3);c.forEach((p,l)=>{d.set([p.x,p.y,p.z],l*3),I.set([p.r,p.g,p.b],l*3)}),a.geometry.dispose();const A=new M;A.setAttribute("position",new w(d,3)),A.setAttribute("color",new w(I,3)),a.geometry=A});const g=this.trains.geometry;g.setDrawRange(0,n),g.getAttribute("position").needsUpdate=!0,g.getAttribute("color").needsUpdate=!0}pushTrain(s,t,i,o){const e=t.length-1;for(let n=0;n<e;n++){if(s+h.VERTICES_PER_SEGMENT>h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT)return s;const E=1-n/e,r=1-(n+1)/e,g=m(t[n].altitudeDeg,t[n].azimuthDeg,h.RADIUS),a=m(t[n+1].altitudeDeg,t[n+1].azimuthDeg,h.RADIUS),u=d=>h.RADIUS*((h.MIN_HALF_WIDTH_DEG+h.BRIGHT_HALF_WIDTH_DEG*i*d)*Math.PI/180),c=d=>h.TRAIN_SHARE*i*d**h.TRAIN_FALLOFF;s=this.pushRibbon(s,g,a,u(E),u(r),c(E),c(r),o)}return s}pushRibbon(s,t,i,o,e,n,E,r){const g={x:i.x-t.x,y:i.y-t.y,z:i.z-t.z};if(Math.hypot(g.x,g.y,g.z)<1e-9)return s;const a=this.normalise(this.cross(this.normalise(t),this.normalise(g)));for(const[u,c]of[[-1,0],[0,1]]){const d=this.across(t,a,o,u),I=this.across(i,a,e,u),A=this.across(t,a,o,c),p=this.across(i,a,e,c),l=(T,z)=>T===0?z:0;s=this.push(s,d,l(u,n),r),s=this.push(s,I,l(u,E),r),s=this.push(s,A,l(c,n),r),s=this.push(s,I,l(u,E),r),s=this.push(s,p,l(c,E),r),s=this.push(s,A,l(c,n),r)}return s}across(s,t,i,o){return{x:s.x+t.x*i*o,y:s.y+t.y*i*o,z:s.z+t.z*i*o}}push(s,t,i,o){const e=s*3;this.positions[e]=t.x,this.positions[e+1]=t.y,this.positions[e+2]=t.z;const n=P.relativeOfResponse(Math.max(0,Math.min(1,i)));return this.colors[e]=n*o.r,this.colors[e+1]=n*o.g,this.colors[e+2]=n*o.b,s+1}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){for(const s of this.tiers)s.geometry.dispose(),s.material.dispose();this.trains.geometry.dispose(),this.trains.material.dispose(),this.object.removeFromParent()}}class B{inSky=!0;hiddenFromEye=!0;pieces=new h;get object(){return this.pieces.object}get drawnCount(){return this.pieces.count}update(s,t,i){const o=s.length===0?[]:L.viewsAt(s,t,i.observer);o.length===0&&this.pieces.count===0||(this.pieces.set(o,i.magnitudeLimit,e=>i.cloudTransmission(e),(e,n)=>i.arrivingIlluminance(e,n,1)),i.lightFrom(o.map(e=>({position:e.head,magnitude:e.magnitude}))),i.glareFrom(o.map(e=>({key:`${e.reentryId}:${e.fragmentId}`,position:e.head,magnitude:e.magnitude,fade:e.fade}))))}pick(s,t,i){const o=this.pieces.nearest(t,i.nearestCos);return o&&{id:o.view.reentryId,detail:o}}dispose(){this.pieces.dispose()}}export{B as ReentrySimulation};
1
+ import{aU as S,bo as G,bp as _,ba as M,bq as f,bb as I,aX as F,bi as R,bj as w,V as N,br as y,bs as H,bt as C,bu as j,aI as L}from"./rr0-sighting-editor.mjs";class h{static RADIUS=840;static MAX_SEGMENTS=1024;static VERTICES_PER_SEGMENT=12;static MIN_HALF_WIDTH_DEG=.1;static BRIGHT_HALF_WIDTH_DEG=.22;static TRAIN_SHARE=.9;static TRAIN_FALLOFF=1.2;object=new S;tiers;trains;positions;colors;shown=0;drawn=[];constructor(){this.object.name="reentries",this.tiers=G.map(i=>{const o=new _(new M,f.material(i.size,!1));return f.track(o),o.frustumCulled=!1,this.object.add(o),o});const s=h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT;this.positions=new Float32Array(s*3),this.colors=new Float32Array(s*3);const t=new M;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,3)),t.setDrawRange(0,0),this.trains=new F(t,R.material()),this.trains.frustumCulled=!1,R.track(this.trains),this.object.add(this.trains)}nearest(s,t){let i,o=t;for(const e of this.drawn){const n=e.direction.dot(s);(n>o||i&&n===o&&e.magnitude<i.magnitude)&&(o=n,i=e)}return i}static directionOf(s){const{x:t,y:i,z:o}=w(s.altitudeDeg,s.azimuthDeg,1);return new N(t,i,o)}get count(){return this.shown}set(s,t,i,o){const e=this.tiers.map(()=>[]);let n=0,E=0;const r=new y;this.drawn=[];for(const a of s){const u=i(a.head);if(u<=0)continue;const c=a.magnitude-2.5*Math.log10(u);if(c>t)continue;E++,this.drawn.push({direction:h.directionOf(a.head),view:a,magnitude:c}),r.set(a.color);const d=H(c,t)*a.fade,{x:A,y:b,z:p}=w(a.head.altitudeDeg,a.head.azimuthDeg,h.RADIUS),[l,m,T]=o(a.head,c),z=a.fade,D=Math.max(r.r,r.g,r.b)||1;e[C(d)].push({x:A,y:b,z:p,r:l*r.r*z/D,g:m*r.g*z/D,b:T*r.b*z/D}),n=this.pushTrain(n,a.train,d,r)}this.shown=E,this.tiers.forEach((a,u)=>{const c=e[u],d=new Float32Array(c.length*3),A=new Float32Array(c.length*3);c.forEach((p,l)=>{d.set([p.x,p.y,p.z],l*3),A.set([p.r,p.g,p.b],l*3)}),a.geometry.dispose();const b=new M;b.setAttribute("position",new I(d,3)),b.setAttribute("color",new I(A,3)),a.geometry=b});const g=this.trains.geometry;g.setDrawRange(0,n),g.getAttribute("position").needsUpdate=!0,g.getAttribute("color").needsUpdate=!0}pushTrain(s,t,i,o){const e=t.length-1;for(let n=0;n<e;n++){if(s+h.VERTICES_PER_SEGMENT>h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT)return s;const E=1-n/e,r=1-(n+1)/e,g=w(t[n].altitudeDeg,t[n].azimuthDeg,h.RADIUS),a=w(t[n+1].altitudeDeg,t[n+1].azimuthDeg,h.RADIUS),u=d=>h.RADIUS*((h.MIN_HALF_WIDTH_DEG+h.BRIGHT_HALF_WIDTH_DEG*i*d)*Math.PI/180),c=d=>h.TRAIN_SHARE*i*d**h.TRAIN_FALLOFF;s=this.pushRibbon(s,g,a,u(E),u(r),c(E),c(r),o)}return s}pushRibbon(s,t,i,o,e,n,E,r){const g={x:i.x-t.x,y:i.y-t.y,z:i.z-t.z};if(Math.hypot(g.x,g.y,g.z)<1e-9)return s;const a=this.normalise(this.cross(this.normalise(t),this.normalise(g)));for(const[u,c]of[[-1,0],[0,1]]){const d=this.across(t,a,o,u),A=this.across(i,a,e,u),b=this.across(t,a,o,c),p=this.across(i,a,e,c),l=(m,T)=>m===0?T:0;s=this.push(s,d,l(u,n),r),s=this.push(s,A,l(u,E),r),s=this.push(s,b,l(c,n),r),s=this.push(s,A,l(u,E),r),s=this.push(s,p,l(c,E),r),s=this.push(s,b,l(c,n),r)}return s}across(s,t,i,o){return{x:s.x+t.x*i*o,y:s.y+t.y*i*o,z:s.z+t.z*i*o}}push(s,t,i,o){const e=s*3;this.positions[e]=t.x,this.positions[e+1]=t.y,this.positions[e+2]=t.z;const n=j.relativeOfResponse(Math.max(0,Math.min(1,i)));return this.colors[e]=n*o.r,this.colors[e+1]=n*o.g,this.colors[e+2]=n*o.b,s+1}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){for(const s of this.tiers)s.geometry.dispose(),s.material.dispose();this.trains.geometry.dispose(),this.trains.material.dispose(),this.object.removeFromParent()}}class k{inSky=!0;hiddenFromEye=!0;pieces=new h;get object(){return this.pieces.object}get drawnCount(){return this.pieces.count}update(s,t,i){const o=s.length===0?[]:L.viewsAt(s,t,i.observer);o.length===0&&this.pieces.count===0||(this.pieces.set(o,i.magnitudeLimit,e=>i.cloudTransmission(e),(e,n)=>i.arrivingIlluminance(e,n,1)),i.lightFrom(o.map(e=>({position:e.head,magnitude:e.magnitude}))),i.glareFrom(o.map(e=>({key:`${e.reentryId}:${e.fragmentId}`,position:e.head,magnitude:e.magnitude,fade:e.fade}))))}pick(s,t,i){const o=this.pieces.nearest(t,i.nearestCos);return o&&{id:o.view.reentryId,detail:o}}dispose(){this.pieces.dispose()}}export{k as ReentrySimulation};
@@ -1 +1 @@
1
- import{n as w,Q as M,bH as d,bI as y,bJ as g,bh as c,bK as b,as as k,aJ as O,bL as T,bM as E,bN as I,G as D}from"./rr0-sighting-editor.mjs";import{P as m,a as f}from"./PictureFetch-C3wgf1ZV.js";const v=3,u=800,l=Math.PI/180;class r{constructor(t,i,s=r.fetchImage,e=r.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=e}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=w(i.lat,i.lng,t.from.lat,t.from.lng),a=(Math.hypot(s.x,s.z)-r.PRESENT_WITHIN_M)/(r.GONE_BEYOND_M-r.PRESENT_WITHIN_M),o=Math.min(Math.max(a,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const e=new Set(t.map(a=>a.id));for(const[a,o]of this.meshes)e.has(a)||(this.dispose(o),this.meshes.delete(a),this.signatures.delete(a));for(const[a,o]of this.images){const n=t.find(p=>p.id===a);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;r.release(o),this.images.delete(a);const h=this.meshes.get(a);h&&(this.dispose(h),this.meshes.delete(a),this.signatures.delete(a))}for(const a of t){const o=this.images.get(a.id);if(!o){this.load(a);continue}this.build(a,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=v;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const e=i?.get(s);e&&s.quaternion.copy(this.cameraTurn).multiply(e),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new M;get furthestM(){return this.meshes.size>0?u:0}directionOfPixel(t,i,s,e){const a=this.images.get(t.id),o=a?a.width/a.height:1,n=d.registrationAt(t,this.clock.t),h=Math.tan(n.fovDeg/2*l),p=h*o;return e.set((i*2-1)*p,(1-s*2)*h,-1).normalize(),e.applyQuaternion(r.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&r.point(i,t,d.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=d.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const e=d.command(i.currentTime,s,this.clock.playing,d.rateOf(t));i.playbackRate=e.rate,e.seekS!==void 0&&!i.seeking&&(i.currentTime=e.seekS),e.play&&i.paused&&i.play().catch(()=>{}),!e.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",a=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(h=>h.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){r.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,m.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,a)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,e)=>{const a=document.createElement("video");a.crossOrigin="anonymous",a.muted=!0,a.playsInline=!0,a.preload="auto",a.addEventListener("loadeddata",()=>{const o=new y(a);o.colorSpace=g,o.minFilter=c,o.magFilter=c,o.generateMipmaps=!1,a.addEventListener("seeked",i);const n=()=>{a.paused&&i(),a.src&&a.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in a&&a.requestVideoFrameCallback(n),s({texture:o,width:a.videoWidth,height:a.videoHeight,video:a})},{once:!0}),a.addEventListener("error",()=>{m.whyVideoUnread(t).then(o=>e(new f(t,o)))},{once:!0}),a.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await m.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new f(t,{kind:"notPicture"})}),e=new b(s);return e.flipY=!1,e.colorSpace=g,e.minFilter=c,e.magFilter=c,e.generateMipmaps=!1,e.needsUpdate=!0,{texture:e,width:s.width,height:s.height}}build(t,i){const s=r.signatureOf(t,i);let e=this.meshes.get(t.id);if(e&&this.signatures.get(t.id)===s){this.applyOpacity(e,t.id);return}e&&(this.dispose(e),this.meshes.delete(t.id)),e=new k(r.geometryOf(t,i),new O({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(e.material.side=T),e.frustumCulled=!1,e.layers.set(v),e.userData.id=t.id,r.point(e,t,d.registrationAt(t,this.clock.t)),this.scene.add(e),this.meshes.set(t.id,e),this.signatures.set(t.id,s),this.applyOpacity(e,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new E(u,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let h=0;h<n.count;h++)n.setX(h,1-n.getX(h));return n.needsUpdate=!0,o}const s=2*u*Math.tan(t.registration.fovDeg/2*l),e=s*(i.width/Math.max(i.height,1)),a=new I(e,s);return a.translate(0,0,-u),a}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const e=new D;return e.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),e.quaternion}static point(t,i,s){if(t.quaternion.copy(r.orientation(s)),i.kind==="panorama")return;const e=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(e,e,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return d.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(a=>a.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),e=i?r.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*e}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:e,rollDeg:a,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,e,a??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())r.release(t);this.images.clear()}}export{v as REFERENCE_LAYER,r as ReferenceSystem};
1
+ import{m as w,Q as M,c8 as d,c9 as y,ca as g,bK as l,cb as k,aX as b,bc as O,cc as T,cd as E,ce as D,D as I}from"./rr0-sighting-editor.mjs";import{P as m,a as f}from"./PictureFetch-C3wgf1ZV.js";const v=3,u=800,c=Math.PI/180;class r{constructor(t,i,s=r.fetchImage,e=r.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=e}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=w(i.lat,i.lng,t.from.lat,t.from.lng),a=(Math.hypot(s.x,s.z)-r.PRESENT_WITHIN_M)/(r.GONE_BEYOND_M-r.PRESENT_WITHIN_M),o=Math.min(Math.max(a,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const e=new Set(t.map(a=>a.id));for(const[a,o]of this.meshes)e.has(a)||(this.dispose(o),this.meshes.delete(a),this.signatures.delete(a));for(const[a,o]of this.images){const n=t.find(p=>p.id===a);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;r.release(o),this.images.delete(a);const h=this.meshes.get(a);h&&(this.dispose(h),this.meshes.delete(a),this.signatures.delete(a))}for(const a of t){const o=this.images.get(a.id);if(!o){this.load(a);continue}this.build(a,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=v;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const e=i?.get(s);e&&s.quaternion.copy(this.cameraTurn).multiply(e),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new M;get furthestM(){return this.meshes.size>0?u:0}directionOfPixel(t,i,s,e){const a=this.images.get(t.id),o=a?a.width/a.height:1,n=d.registrationAt(t,this.clock.t),h=Math.tan(n.fovDeg/2*c),p=h*o;return e.set((i*2-1)*p,(1-s*2)*h,-1).normalize(),e.applyQuaternion(r.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&r.point(i,t,d.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=d.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const e=d.command(i.currentTime,s,this.clock.playing,d.rateOf(t));i.playbackRate=e.rate,e.seekS!==void 0&&!i.seeking&&(i.currentTime=e.seekS),e.play&&i.paused&&i.play().catch(()=>{}),!e.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",a=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(h=>h.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){r.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,m.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,a)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,e)=>{const a=document.createElement("video");a.crossOrigin="anonymous",a.muted=!0,a.playsInline=!0,a.preload="auto",a.addEventListener("loadeddata",()=>{const o=new y(a);o.colorSpace=g,o.minFilter=l,o.magFilter=l,o.generateMipmaps=!1,a.addEventListener("seeked",i);const n=()=>{a.paused&&i(),a.src&&a.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in a&&a.requestVideoFrameCallback(n),s({texture:o,width:a.videoWidth,height:a.videoHeight,video:a})},{once:!0}),a.addEventListener("error",()=>{m.whyVideoUnread(t).then(o=>e(new f(t,o)))},{once:!0}),a.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await m.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new f(t,{kind:"notPicture"})}),e=new k(s);return e.flipY=!1,e.colorSpace=g,e.minFilter=l,e.magFilter=l,e.generateMipmaps=!1,e.needsUpdate=!0,{texture:e,width:s.width,height:s.height}}build(t,i){const s=r.signatureOf(t,i);let e=this.meshes.get(t.id);if(e&&this.signatures.get(t.id)===s){this.applyOpacity(e,t.id);return}e&&(this.dispose(e),this.meshes.delete(t.id)),e=new b(r.geometryOf(t,i),new O({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(e.material.side=T),e.frustumCulled=!1,e.layers.set(v),e.userData.id=t.id,r.point(e,t,d.registrationAt(t,this.clock.t)),this.scene.add(e),this.meshes.set(t.id,e),this.signatures.set(t.id,s),this.applyOpacity(e,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new E(u,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let h=0;h<n.count;h++)n.setX(h,1-n.getX(h));return n.needsUpdate=!0,o}const s=2*u*Math.tan(t.registration.fovDeg/2*c),e=s*(i.width/Math.max(i.height,1)),a=new D(e,s);return a.translate(0,0,-u),a}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const e=new I;return e.rotation.set(i*c,-t*c,-(s??0)*c,"YXZ"),e.quaternion}static point(t,i,s){if(t.quaternion.copy(r.orientation(s)),i.kind==="panorama")return;const e=Math.tan(s.fovDeg/2*c)/Math.tan(i.registration.fovDeg/2*c);t.scale.set(e,e,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return d.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(a=>a.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),e=i?r.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*e}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:e,rollDeg:a,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,e,a??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())r.release(t);this.images.clear()}}export{v as REFERENCE_LAYER,r as ReferenceSystem};
@@ -1 +1 @@
1
- import{n as D}from"./rr0-sighting-editor.mjs";class M{static MIN_ROAD_M=5.5;static WIDE_ROAD_M=9;static LINE_WIDTH_M=.12;static DASH_M=3;static GAP_M=10;static RIVE_DASH_M=2.5;static RIVE_GAP_M=3.5;static MIN_DASH_M=.5;static LANE_M=3.5;static SHOULDER_MIN_M=1.5;static SOLID_EDGE_FROM_M=7;static SOLID_EDGE_FROM_KMH=80;static BEND_RADIUS_M=300;static EDGE_SETBACK_M=.4;static PAINT_RADIUS_M=450;static LIFT_M=.015;static BARRIER_MAX_AXES_M=40;static BARRIER_MIN_AXES_M=5;static BARRIER_HEIGHT_M=.8;static BARRIER_HALF_WIDTH_M=.2;static BARRIER_STEP_M=4;static painted(t){return t.surface==="paved"&&t.widthM>=M.MIN_ROAD_M&&t.kind!=="roundabout"}static plan(t){if(!M.painted(t))return[];const u=t.widthM,l=u/2,i=M.EDGE_SETBACK_M;if(!(t.direction!==void 0&&t.lanes!==void 0)){const I=[{offsetM:l-i,pattern:"solid"},{offsetM:-(l-i),pattern:"solid"}],A=u>=M.WIDE_ROAD_M?[-u/4,u/4]:[0];for(const x of A)I.push({offsetM:x,pattern:"dashed"});return I}const s=t.lanes,n=u>=M.SOLID_EDGE_FROM_M||(t.speedKmh??0)>=M.SOLID_EDGE_FROM_KMH?"solid":"rive";if(t.direction==="both"){if(s<2)return[];const I=[{offsetM:l-i,pattern:n},{offsetM:-(l-i),pattern:n}];if(s>=4){I.push({offsetM:.1,pattern:"solid"},{offsetM:-.1,pattern:"solid"});const A=Math.floor(s/2),x=u/s;for(let z=1;z<A;z++)I.push({offsetM:z*x,pattern:"dashed"},{offsetM:-z*x,pattern:"dashed"})}else I.push({offsetM:0,pattern:"dashed",solidInBends:!0});return I}const r=t.direction==="backward"?-1:1,o=I=>r*(l-I),c=Math.min(M.LANE_M,u/Math.max(s,1)),h=s*c,d=u-h,_=(t.kind==="motorway"||t.kind==="dual")&&d>=M.SHOULDER_MIN_M,E=[{offsetM:o(i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n}];E.push({offsetM:o(_?h:u-i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n});for(let I=1;I<s;I++)E.push({offsetM:o(I*c),pattern:"dashed"});return E}static lay(t,u,l,i){let e=0;const s=(f,n)=>{i(f,M.LINE_WIDTH_M,{offsetM:n,liftM:M.LIFT_M,minHalfM:M.LINE_WIDTH_M/2}),e++};for(const f of t){const n=M.plan(f);if(n.length===0)continue;const r=f.points.map(o=>D(o.lat,o.lng,u,l));for(const o of M.near(r,M.PAINT_RADIUS_M))for(const c of n){if(c.pattern==="solid"){s(o,c.offsetM);continue}const[h,d]=c.pattern==="dashed"?[M.DASH_M,M.GAP_M]:[M.RIVE_DASH_M,M.RIVE_GAP_M];for(const _ of c.solidInBends?M.byBends(o):[{path:o,bend:!1}])if(_.bend)s(_.path,c.offsetM);else for(const E of M.dashes(_.path,h,d))s(E,c.offsetM)}}return e}static byBends(t){if(t.length<3)return[{path:t,bend:!1}];const u=(e,s)=>Math.atan2(s.x-e.x,-(s.z-e.z)),l=new Array(t.length-1).fill(!1);for(let e=1;e<t.length-1;e++){const s=Math.hypot(t[e].x-t[e-1].x,t[e].z-t[e-1].z),f=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6||f<1e-6)continue;let n=Math.abs(u(t[e],t[e+1])-u(t[e-1],t[e]));n>Math.PI&&(n=2*Math.PI-n),(s+f)/2/Math.max(n,1e-6)<M.BEND_RADIUS_M&&(l[e-1]=!0,l[e]=!0)}const i=[];for(let e=0;e<l.length;e++){const s=i.at(-1);s&&s.bend===l[e]?s.path.push(t[e+1]):i.push({path:[t[e],t[e+1]],bend:l[e]})}return i}static barriers(t,u,l){const i=t.filter(n=>(n.kind==="motorway"||n.kind==="dual")&&(n.direction==="forward"||n.direction==="backward")),e=i.map(n=>{const r=n.points.map(o=>D(o.lat,o.lng,u,l));return n.direction==="backward"?[...r].reverse():r}),s=[],f=M.BARRIER_STEP_M;return i.forEach((n,r)=>{for(const o of M.near(e[r],M.PAINT_RADIUS_M)){let c=[];for(const h of M.resample(o,f)){const d=M.midwayToOpposite(h,r,i,e);d?c.push(d):c.length>0&&(c.length>=2&&s.push(c),c=[])}c.length>=2&&s.push(c)}}),s}static midwayToOpposite(t,u,l,i){let e;for(let s=0;s<i.length;s++){if(s===u||l[s].id<l[u].id)continue;const f=i[s];for(let n=0;n<f.length-1;n++){const r=f[n+1].x-f[n].x,o=f[n+1].z-f[n].z,c=r*r+o*o;if(c<1e-9||(r*t.dx+o*t.dz)/Math.sqrt(c)>-.9)continue;const h=Math.max(0,Math.min(1,((t.x-f[n].x)*r+(t.z-f[n].z)*o)/c)),d={x:f[n].x+r*h,z:f[n].z+o*h},_=Math.hypot(t.x-d.x,t.z-d.z);_<M.BARRIER_MIN_AXES_M||_>M.BARRIER_MAX_AXES_M||(!e||_<e.distance)&&(e={distance:_,point:d})}}return e?{x:(t.x+e.point.x)/2,z:(t.z+e.point.z)/2}:void 0}static resample(t,u){const l=[];for(let e=0;e<t.length-1;e++){const s=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6)continue;const f=(t[e+1].x-t[e].x)/s,n=(t[e+1].z-t[e].z)/s;for(let r=0;r<s;r+=u)l.push({x:t[e].x+f*r,z:t[e].z+n*r,dx:f,dz:n})}const i=l.at(-1);return i&&l.push({...t[t.length-1],dx:i.dx,dz:i.dz}),l}static barrierGeometry(t,u){const l=[],i=[],e=M.BARRIER_HALF_WIDTH_M;for(const s of t){if(s.length<2)continue;const f=l.length/3;for(let n=0;n<s.length;n++){const r=s[Math.max(0,n-1)],o=s[Math.min(s.length-1,n+1)],c=Math.hypot(o.x-r.x,o.z-r.z)||1,h=-(o.z-r.z)/c*e,d=(o.x-r.x)/c*e,_=u(s[n].x,s[n].z);l.push(s[n].x+h,_,s[n].z+d,s[n].x+h,_+M.BARRIER_HEIGHT_M,s[n].z+d,s[n].x-h,_+M.BARRIER_HEIGHT_M,s[n].z-d,s[n].x-h,_,s[n].z-d)}for(let n=0;n<s.length-1;n++){const r=f+n*4,o=r+4;for(let c=0;c<3;c++)i.push(r+c,o+c,r+c+1,r+c+1,o+c,o+c+1)}}return{positions:l,indices:i}}static near(t,u){const l=[];let i;for(let e=0;e<t.length-1;e++)Math.min(Math.hypot(t[e].x,t[e].z),Math.hypot(t[e+1].x,t[e+1].z))<=u||Math.hypot((t[e].x+t[e+1].x)/2,(t[e].z+t[e+1].z)/2)<=u?(i||(i=[t[e]]),i.push(t[e+1])):i&&(l.push(i),i=void 0);return i&&l.push(i),l}static dashes(t,u,l){const i=[],e=u+l;let s=0,f;const n=(o,c)=>({x:t[o].x+(t[o+1].x-t[o].x)*c,z:t[o].z+(t[o+1].z-t[o].z)*c});for(let o=0;o<t.length-1;o++){const c=Math.hypot(t[o+1].x-t[o].x,t[o+1].z-t[o].z);if(c<1e-6)continue;let h=0;for(;h<c;){const d=(s+h)%e,_=d<u,E=_?u-d:e-d,I=Math.min(c,h+E);_&&(f||(f=[n(o,h/c)]),f.push(n(o,I/c)),I-h>=E-1e-9&&(i.push(f),f=void 0)),h=I}s+=c}f&&f.length>=2&&i.push(f);const r=o=>o.slice(1).reduce((c,h,d)=>c+Math.hypot(h.x-o[d].x,h.z-o[d].z),0);return i.filter(o=>o.length>=2&&r(o)>=M.MIN_DASH_M)}}export{M as RoadMarkings};
1
+ import{m as D}from"./rr0-sighting-editor.mjs";class M{static MIN_ROAD_M=5.5;static WIDE_ROAD_M=9;static LINE_WIDTH_M=.12;static DASH_M=3;static GAP_M=10;static RIVE_DASH_M=2.5;static RIVE_GAP_M=3.5;static MIN_DASH_M=.5;static LANE_M=3.5;static SHOULDER_MIN_M=1.5;static SOLID_EDGE_FROM_M=7;static SOLID_EDGE_FROM_KMH=80;static BEND_RADIUS_M=300;static EDGE_SETBACK_M=.4;static PAINT_RADIUS_M=450;static LIFT_M=.015;static BARRIER_MAX_AXES_M=40;static BARRIER_MIN_AXES_M=5;static BARRIER_HEIGHT_M=.8;static BARRIER_HALF_WIDTH_M=.2;static BARRIER_STEP_M=4;static painted(t){return t.surface==="paved"&&t.widthM>=M.MIN_ROAD_M&&t.kind!=="roundabout"}static plan(t){if(!M.painted(t))return[];const u=t.widthM,l=u/2,i=M.EDGE_SETBACK_M;if(!(t.direction!==void 0&&t.lanes!==void 0)){const I=[{offsetM:l-i,pattern:"solid"},{offsetM:-(l-i),pattern:"solid"}],A=u>=M.WIDE_ROAD_M?[-u/4,u/4]:[0];for(const x of A)I.push({offsetM:x,pattern:"dashed"});return I}const s=t.lanes,n=u>=M.SOLID_EDGE_FROM_M||(t.speedKmh??0)>=M.SOLID_EDGE_FROM_KMH?"solid":"rive";if(t.direction==="both"){if(s<2)return[];const I=[{offsetM:l-i,pattern:n},{offsetM:-(l-i),pattern:n}];if(s>=4){I.push({offsetM:.1,pattern:"solid"},{offsetM:-.1,pattern:"solid"});const A=Math.floor(s/2),x=u/s;for(let z=1;z<A;z++)I.push({offsetM:z*x,pattern:"dashed"},{offsetM:-z*x,pattern:"dashed"})}else I.push({offsetM:0,pattern:"dashed",solidInBends:!0});return I}const r=t.direction==="backward"?-1:1,o=I=>r*(l-I),c=Math.min(M.LANE_M,u/Math.max(s,1)),h=s*c,d=u-h,_=(t.kind==="motorway"||t.kind==="dual")&&d>=M.SHOULDER_MIN_M,E=[{offsetM:o(i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n}];E.push({offsetM:o(_?h:u-i),pattern:t.kind==="motorway"||t.kind==="dual"?"solid":n});for(let I=1;I<s;I++)E.push({offsetM:o(I*c),pattern:"dashed"});return E}static lay(t,u,l,i){let e=0;const s=(f,n)=>{i(f,M.LINE_WIDTH_M,{offsetM:n,liftM:M.LIFT_M,minHalfM:M.LINE_WIDTH_M/2}),e++};for(const f of t){const n=M.plan(f);if(n.length===0)continue;const r=f.points.map(o=>D(o.lat,o.lng,u,l));for(const o of M.near(r,M.PAINT_RADIUS_M))for(const c of n){if(c.pattern==="solid"){s(o,c.offsetM);continue}const[h,d]=c.pattern==="dashed"?[M.DASH_M,M.GAP_M]:[M.RIVE_DASH_M,M.RIVE_GAP_M];for(const _ of c.solidInBends?M.byBends(o):[{path:o,bend:!1}])if(_.bend)s(_.path,c.offsetM);else for(const E of M.dashes(_.path,h,d))s(E,c.offsetM)}}return e}static byBends(t){if(t.length<3)return[{path:t,bend:!1}];const u=(e,s)=>Math.atan2(s.x-e.x,-(s.z-e.z)),l=new Array(t.length-1).fill(!1);for(let e=1;e<t.length-1;e++){const s=Math.hypot(t[e].x-t[e-1].x,t[e].z-t[e-1].z),f=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6||f<1e-6)continue;let n=Math.abs(u(t[e],t[e+1])-u(t[e-1],t[e]));n>Math.PI&&(n=2*Math.PI-n),(s+f)/2/Math.max(n,1e-6)<M.BEND_RADIUS_M&&(l[e-1]=!0,l[e]=!0)}const i=[];for(let e=0;e<l.length;e++){const s=i.at(-1);s&&s.bend===l[e]?s.path.push(t[e+1]):i.push({path:[t[e],t[e+1]],bend:l[e]})}return i}static barriers(t,u,l){const i=t.filter(n=>(n.kind==="motorway"||n.kind==="dual")&&(n.direction==="forward"||n.direction==="backward")),e=i.map(n=>{const r=n.points.map(o=>D(o.lat,o.lng,u,l));return n.direction==="backward"?[...r].reverse():r}),s=[],f=M.BARRIER_STEP_M;return i.forEach((n,r)=>{for(const o of M.near(e[r],M.PAINT_RADIUS_M)){let c=[];for(const h of M.resample(o,f)){const d=M.midwayToOpposite(h,r,i,e);d?c.push(d):c.length>0&&(c.length>=2&&s.push(c),c=[])}c.length>=2&&s.push(c)}}),s}static midwayToOpposite(t,u,l,i){let e;for(let s=0;s<i.length;s++){if(s===u||l[s].id<l[u].id)continue;const f=i[s];for(let n=0;n<f.length-1;n++){const r=f[n+1].x-f[n].x,o=f[n+1].z-f[n].z,c=r*r+o*o;if(c<1e-9||(r*t.dx+o*t.dz)/Math.sqrt(c)>-.9)continue;const h=Math.max(0,Math.min(1,((t.x-f[n].x)*r+(t.z-f[n].z)*o)/c)),d={x:f[n].x+r*h,z:f[n].z+o*h},_=Math.hypot(t.x-d.x,t.z-d.z);_<M.BARRIER_MIN_AXES_M||_>M.BARRIER_MAX_AXES_M||(!e||_<e.distance)&&(e={distance:_,point:d})}}return e?{x:(t.x+e.point.x)/2,z:(t.z+e.point.z)/2}:void 0}static resample(t,u){const l=[];for(let e=0;e<t.length-1;e++){const s=Math.hypot(t[e+1].x-t[e].x,t[e+1].z-t[e].z);if(s<1e-6)continue;const f=(t[e+1].x-t[e].x)/s,n=(t[e+1].z-t[e].z)/s;for(let r=0;r<s;r+=u)l.push({x:t[e].x+f*r,z:t[e].z+n*r,dx:f,dz:n})}const i=l.at(-1);return i&&l.push({...t[t.length-1],dx:i.dx,dz:i.dz}),l}static barrierGeometry(t,u){const l=[],i=[],e=M.BARRIER_HALF_WIDTH_M;for(const s of t){if(s.length<2)continue;const f=l.length/3;for(let n=0;n<s.length;n++){const r=s[Math.max(0,n-1)],o=s[Math.min(s.length-1,n+1)],c=Math.hypot(o.x-r.x,o.z-r.z)||1,h=-(o.z-r.z)/c*e,d=(o.x-r.x)/c*e,_=u(s[n].x,s[n].z);l.push(s[n].x+h,_,s[n].z+d,s[n].x+h,_+M.BARRIER_HEIGHT_M,s[n].z+d,s[n].x-h,_+M.BARRIER_HEIGHT_M,s[n].z-d,s[n].x-h,_,s[n].z-d)}for(let n=0;n<s.length-1;n++){const r=f+n*4,o=r+4;for(let c=0;c<3;c++)i.push(r+c,o+c,r+c+1,r+c+1,o+c,o+c+1)}}return{positions:l,indices:i}}static near(t,u){const l=[];let i;for(let e=0;e<t.length-1;e++)Math.min(Math.hypot(t[e].x,t[e].z),Math.hypot(t[e+1].x,t[e+1].z))<=u||Math.hypot((t[e].x+t[e+1].x)/2,(t[e].z+t[e+1].z)/2)<=u?(i||(i=[t[e]]),i.push(t[e+1])):i&&(l.push(i),i=void 0);return i&&l.push(i),l}static dashes(t,u,l){const i=[],e=u+l;let s=0,f;const n=(o,c)=>({x:t[o].x+(t[o+1].x-t[o].x)*c,z:t[o].z+(t[o+1].z-t[o].z)*c});for(let o=0;o<t.length-1;o++){const c=Math.hypot(t[o+1].x-t[o].x,t[o+1].z-t[o].z);if(c<1e-6)continue;let h=0;for(;h<c;){const d=(s+h)%e,_=d<u,E=_?u-d:e-d,I=Math.min(c,h+E);_&&(f||(f=[n(o,h/c)]),f.push(n(o,I/c)),I-h>=E-1e-9&&(i.push(f),f=void 0)),h=I}s+=c}f&&f.length>=2&&i.push(f);const r=o=>o.slice(1).reduce((c,h,d)=>c+Math.hypot(h.x-o[d].x,h.z-o[d].z),0);return i.filter(o=>o.length>=2&&r(o)>=M.MIN_DASH_M)}}export{M as RoadMarkings};