@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
@@ -0,0 +1 @@
1
+ import{e as B}from"./rr0-ufoathome.mjs";import{x as V,cP as tt,cQ as q,y as j,cR as C,cS as X,cT as et}from"./ShareDialogElement-C3HL-Smq.js";import{l as ot}from"./SaidPosition-CWiVNaNW.js";import"./Sighting-CBpJpdm9.js";import"./VisualAids-DI-hEL46.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";class I{constructor(t){this.survey=t}static CACHE_NAME="rr0-surroundings";static MAX_AGE_MS=720*3600*1e3;static FORMAT=8;static MAX_STORED=400;static asked=new Map;get id(){return this.survey.id}get name(){return this.survey.name}get attribution(){return this.survey.attribution}get creditUrl(){return this.survey.creditUrl}get contemporary(){return this.survey.contemporary}covers(t,e){return this.survey.covers(t,e)}async getSurroundings(t,e){const s=I.key(this.survey.id,t,e);let o=I.asked.get(s);return o===void 0&&(o=this.recalled(s,t,e),I.asked.set(s,o),o.catch(()=>I.asked.delete(s))),structuredClone(await o)}later(t,e){const s=this.survey.later?.(t,e);if(!s)return;const o=I.key(this.survey.id,t,e);return s.then(n=>{const a=I.partial.get(o);if(a){I.partial.delete(o);const{incomplete:r,...i}=a,h=[...a.credits??[],...n.credits??[]].filter((l,f,M)=>M.findIndex(d=>d.url===l.url)===f),c={...i,...n,dates:{...a.dates,...n.dates},...h.length>0?{credits:h}:{}};I.asked.set(o,Promise.resolve(c)),I.openCache().then(l=>l&&I.store(l,I.request(o),c))}return structuredClone(n)})}static partial=new Map;static forget(){I.partial.clear(),I.asked.clear()}static key(t,e,s){return`${t}/v${I.FORMAT}/${e.lat.toFixed(5)}/${e.lng.toFixed(5)}/${Math.round(s)}`}async recalled(t,e,s){const o=await I.openCache(),n=I.request(t);if(o)try{const r=await o.match(n);if(r){const{savedAt:i,surroundings:h}=await r.json();if(Date.now()-i<I.MAX_AGE_MS)return h;await o.delete(n)}}catch{}const a=await this.survey.getSurroundings(e,s);return a.incomplete?(I.asked.delete(t),I.partial.set(t,structuredClone(a)),a):(o&&I.store(o,n,a),a)}static async store(t,e,s){try{const o={savedAt:Date.now(),surroundings:s};await t.put(e,new Response(JSON.stringify(o),{headers:{"Content-Type":"application/json"}}));const n=await t.keys();for(const a of n.slice(0,Math.max(0,n.length-I.MAX_STORED)))await t.delete(a)}catch{}}static async openCache(){try{return typeof caches>"u"?void 0:await caches.open(I.CACHE_NAME)}catch{return}}static request(t){const e=typeof location>"u"?"http://localhost":location.origin;return new Request(`${e}/__surroundings__/${encodeURIComponent(t)}`)}}class st{constructor(t){if(this.candidates=t,t.length===0)throw new Error("A survey needs at least one candidate");this.current=t[0]}current;get id(){return this.current.id}get name(){return this.current.name}get attribution(){return this.current.attribution}get creditUrl(){return this.current.creditUrl}get contemporary(){return this.current.contemporary}covers(t,e){return this.candidates.some(s=>s.covers(t,e))}async getSurroundings(t,e){let s;for(const o of this.candidates)if(o.covers(t.lat,t.lng))try{const n=await o.getSurroundings(t,e);return this.current=o,n}catch(n){if(s??=n,!(n instanceof V))throw n}throw s??new V("no-coverage","No survey reaches this place")}later(t,e){return this.current.later?.(t,e)}}class D{constructor(t,e,s,o){this.heights=t,this.building=e,this.width=s,this.height=o}static ROOF_PERCENTILE=.9;static STEP_M=.9;static RECTANGLE_FILL=.72;static MIN_DEPTH_M=2.5;static MAX_PARTS=24;static MAX_CELLS=640;buildings(t){const e=t.metresPerPixel,s=t.minAreaM2??12,o=new Uint8Array(this.width*this.height),n=[];for(let a=0;a<this.building.length;a++){if(!this.building[a]||o[a])continue;const r=this.patchFrom(a,o);if(!(r.length*e*e<s))for(const i of this.buildingsOf(r,e,s))Math.hypot(i.eastM,i.northM)<=t.radiusM&&n.push(i)}return n.sort((a,r)=>Math.hypot(a.eastM,a.northM)-Math.hypot(r.eastM,r.northM)),n.slice(0,t.maxBuildings??60)}patchFrom(t,e){const s=[],o=[t];for(e[t]=1;o.length>0;){const n=o.pop();s.push(n);const a=n%this.width,r=Math.floor(n/this.width);for(const[i,h]of[[1,0],[-1,0],[0,1],[0,-1]]){const c=a+i,l=r+h;if(c<0||l<0||c>=this.width||l>=this.height)continue;const f=l*this.width+c;this.building[f]&&!e[f]&&Math.abs(this.heights[f]-this.heights[n])<=D.STEP_M&&(e[f]=1,o.push(f))}}return s}buildingsOf(t,e,s){const o=this.width/2,n=this.height/2,a=[],r=[],i=[];for(const h of t){const c=h%this.width,l=Math.floor(h/this.width);a.push((c+.5-o)*e),r.push((n-l-.5)*e),i.push(this.heights[h])}return D.ofPoints(a,r,i,e,s)}static ofPoints(t,e,s,o,n,a=D.RECTANGLE_FILL,r=[]){const i=[];for(let m=0;m<t.length;m++)for(const[E,v]of[[-.5,-.5],[.5,-.5],[-.5,.5],[.5,.5]])i.push([t[m]+E*o,e[m]+v*o]);const h=D.hull(i),{angle:c,rectangle:l}=D.smallestRectangle(h),f=t.length*o*o,M=(l.maxU-l.minU)*(l.maxV-l.minV);if(f/M>=a||f<4*n)return[D.building(l,c,D.roof(s))];const d=h.map((m,E)=>({from:{east:m[0],north:m[1]},to:{east:h[(E+1)%h.length][0],north:h[(E+1)%h.length][1]}})),g=D.dominantAngles([...r,...d]);return D.parts(t,e,s,g.length>0?g:[c],o,n)}static dominantAngles(t,e=3){const s=new Map;for(const o of t){const n=Math.hypot(o.to.east-o.from.east,o.to.north-o.from.north);if(n<1e-6)continue;const a=(Math.atan2(o.to.north-o.from.north,o.to.east-o.from.east)%(Math.PI/2)+Math.PI/2)%(Math.PI/2),r=Math.round(a/(Math.PI/60));s.set(r,(s.get(r)??0)+n)}return[...s.entries()].sort((o,n)=>n[1]-o[1]).slice(0,e).map(([o])=>o*Math.PI/60)}static parts(t,e,s,o,n,a){let r=t.map((h,c)=>c);const i=[];for(let h=0;h<D.MAX_PARTS&&r.length>0;h++){let c;for(const M of o){const d=D.largestIn(t,e,r,M,n);d&&(c===void 0||d.area>c.area)&&(c=d)}if(c===void 0||c.area<a)break;const l=c.covered;Math.min(c.rectangle.maxU-c.rectangle.minU,c.rectangle.maxV-c.rectangle.minV)>=D.MIN_DEPTH_M&&i.push(D.building(c.rectangle,c.angle,D.roof([...l].map(M=>s[M])))),r=r.filter(M=>!l.has(M))}return i}static largestIn(t,e,s,o,n){const a=Math.cos(o),r=Math.sin(o);let i=1/0,h=-1/0,c=1/0,l=-1/0;const f=[],M=[];for(const A of s){const y=t[A]*a+e[A]*r,N=-t[A]*r+e[A]*a;f.push(y),M.push(N),i=Math.min(i,y),h=Math.max(h,y),c=Math.min(c,N),l=Math.max(l,N)}const d=Math.max(n*Math.SQRT2,Math.max(h-i,l-c)/D.MAX_CELLS),g=Math.max(1,Math.ceil((h-i)/d+1e-9)),m=Math.max(1,Math.ceil((l-c)/d+1e-9)),E=new Uint8Array(g*m),v=s.map((A,y)=>{const N=Math.min(g-1,Math.max(0,Math.floor((f[y]-i)/d))),x=Math.min(m-1,Math.max(0,Math.floor((M[y]-c)/d)));return E[x*g+N]=1,x*g+N}),w=D.largestRectangle(E,g,m);if(w===void 0)return;const p=new Set;return s.forEach((A,y)=>{const N=v[y]%g,x=Math.floor(v[y]/g);N>=w.column&&N<w.column+w.columns&&x>=w.row&&x<w.row+w.rows&&p.add(A)}),{area:w.area*d*d,angle:o,covered:p,rectangle:{minU:i+w.column*d,maxU:i+(w.column+w.columns)*d,minV:c+w.row*d,maxV:c+(w.row+w.rows)*d}}}static largestRectangle(t,e,s){const o=new Array(e).fill(0);let n;for(let a=0;a<s;a++){for(let i=0;i<e;i++)o[i]=t[a*e+i]?o[i]+1:0;const r=[];for(let i=0;i<=e;i++){const h=i===e?0:o[i];for(;r.length>0&&o[r[r.length-1]]>=h;){const c=r.pop(),l=r.length===0?i:i-r[r.length-1]-1,f=o[c]*l;(n===void 0||f>n.area)&&(n={column:i-l,row:a-o[c]+1,columns:l,rows:o[c],area:f})}r.push(i)}}return n}static roof(t){const e=[...t].sort((s,o)=>s-o);return Math.max(2,e[Math.min(e.length-1,Math.floor(e.length*D.ROOF_PERCENTILE))])}static building(t,e,s){const o=Math.cos(e),n=Math.sin(e),a=t.maxU-t.minU,r=t.maxV-t.minV,i=(t.minU+t.maxU)/2,h=(t.minV+t.maxV)/2,l=((90-(a<r?e:e+Math.PI/2)*180/Math.PI)%180+180)%180;return{eastM:D.tenth(i*o-h*n),northM:D.tenth(i*n+h*o),widthM:D.tenth(Math.max(a,r)),lengthM:D.tenth(Math.min(a,r)),heightM:D.tenth(s),headingDeg:Math.round(l*10)/10}}static smallestRectangle(t){let e={area:1/0,angle:0,rectangle:{minU:0,maxU:0,minV:0,maxV:0}};for(let s=0;s<Math.max(1,t.length);s++){const[o,n]=t[s]??[0,0],[a,r]=t[(s+1)%t.length]??[1,0],i=Math.atan2(r-n,a-o),h=Math.cos(i),c=Math.sin(i);let l=1/0,f=-1/0,M=1/0,d=-1/0;for(const[m,E]of t){const v=m*h+E*c,w=-m*c+E*h;l=Math.min(l,v),f=Math.max(f,v),M=Math.min(M,w),d=Math.max(d,w)}const g=(f-l)*(d-M);g<e.area&&(e={area:g,angle:i,rectangle:{minU:l,maxU:f,minV:M,maxV:d}})}return e}static hull(t){const e=[...t].sort((r,i)=>r[0]-i[0]||r[1]-i[1]),s=e.filter((r,i)=>i===0||r[0]!==e[i-1][0]||r[1]!==e[i-1][1]);if(s.length<3)return s;const o=(r,i,h)=>(i[0]-r[0])*(h[1]-r[1])-(i[1]-r[1])*(h[0]-r[0]),n=[];for(const r of s){for(;n.length>=2&&o(n[n.length-2],n[n.length-1],r)<=0;)n.pop();n.push(r)}const a=[];for(const r of[...s].reverse()){for(;a.length>=2&&o(a[a.length-2],a[a.length-1],r)<=0;)a.pop();a.push(r)}return[...n.slice(0,-1),...a.slice(0,-1)]}static tenth(t){return Math.round(t*10)/10}}class H{constructor(t,e,s,o){this.heights=t,this.vegetation=e,this.width=s,this.height=o}static SUMMIT_RADIUS_M=2.5;static CROWN_REACH_M=8;static MAX_WIDTH_M=16;static MIN_WIDTH_M=2;static tenth(t){return Math.round(t*10)/10}trees(t){const e=t.metresPerPixel,s=t.minHeightM??4,o=t.eyeM??1.6,n=t.minElevationDeg??2,a=Math.max(1,Math.round(H.SUMMIT_RADIUS_M/e)),r=Math.round(H.CROWN_REACH_M/e),i=this.width/2,h=this.height/2,c=[];for(let l=0;l<this.height;l++)for(let f=0;f<this.width;f++){const M=this.canopy(f,l);if(M<s)continue;const d=(f+.5-i)*e,g=(h-l-.5)*e,m=Math.hypot(d,g);if(m>t.radiusM||!this.isSummit(f,l,M,a))continue;const E=Math.atan2(M-o,Math.max(m,1))*180/Math.PI;E<n||c.push({tree:{eastM:H.tenth(d),northM:H.tenth(g),heightM:H.tenth(M),widthM:H.tenth(this.crownWidth(f,l,M,e,r))},elevation:E})}return c.sort((l,f)=>f.elevation-l.elevation),c.slice(0,t.maxTrees??150).map(l=>l.tree)}canopy(t,e){if(t<0||e<0||t>=this.width||e>=this.height)return 0;const s=e*this.width+t;return this.vegetation[s]?this.heights[s]:0}isSummit(t,e,s,o){for(let n=-o;n<=o;n++)for(let a=-o;a<=o;a++){if(a===0&&n===0)continue;const r=this.canopy(t+a,e+n);if(r>s||r===s&&(n<0||n===0&&a<0))return!1}return!0}crownWidth(t,e,s,o,n){let a=0;for(let i=-n;i<=n;i++)for(let h=-n;h<=n;h++)Math.hypot(h,i)*o<=H.CROWN_REACH_M&&this.canopy(t+h,e+i)>=s*.5&&a++;const r=2*Math.sqrt(a*o*o/Math.PI);return Math.max(H.MIN_WIDTH_M,Math.min(r,H.MAX_WIDTH_M))}}class _{static WALLS={1:"stone",2:"meuliere",3:"concrete",4:"brick",5:"block",6:"wood",9:"other"};static ROOFS={1:"tile",2:"slate",3:"zinc",4:"concrete",9:"other"};static WALL_COLOURS={stone:"#b9ae9b",meuliere:"#b8a78a",concrete:"#b4b2ac",brick:"#a65f48",block:"#d0c6b2",wood:"#7d5c3e",other:"#c9c0ae"};static PLASTER="#d3cab8";static ROOF_COLOURS={tile:"#a0583f",slate:"#4a5059",zinc:"#8d969c",concrete:"#8f8e8a",other:"#7a7872"};static VARIATION=.12;static OLD_ROOF="#7d858c";static OLD_STOREY_M=3.6;static GRAND_STOREY_M=4.5;static MIN_STOREY_M=2.4;static MAX_STOREY_M=6;static of(t,e){const s=String(t??"").trim();if(!/^\d{1,2}$/.test(s))return;const o=Number(s),n=o%10!==0?o%10:Math.floor(o/10);return(e==="wall"?_.WALLS:_.ROOFS)[String(n)]}static roofColor(t){return t?_.ROOF_COLOURS[t]:void 0}static fit(t){return t.map(e=>{const s=e.style,o={...e.facade,color:e.facade?.color??_.wallColor(e)};s==="church"?o.openings="lancet":s==="monument"||s==="works"?o.openings="plain":(s==="old"||s==="grand")&&(o.openings="tall"),e.closedAtNight&&o.openings!=="plain"&&(o.closedAtNight=!0);const n=_.storeyOf(e);n!==void 0&&s!=="church"&&s!=="monument"&&(o.storeyM=n);const a=s==="old"&&e.roof?.color===void 0?{shape:"flat",riseM:0,...e.roof,color:_.OLD_ROOF}:e.roof;return{...e,facade:o,...a?{roof:a}:{}}})}static storeyOf(t){const e=t.heightM-(t.roof?.riseM??0);if(t.floors&&t.floors>0){const s=e/t.floors;if(s>=_.MIN_STOREY_M&&s<=_.MAX_STOREY_M)return Math.round(s*100)/100}return t.style==="old"?_.OLD_STOREY_M:t.style==="grand"?_.GRAND_STOREY_M:void 0}static wallColor(t){const e=t.style==="church"||t.style==="monument"||t.style==="old",s=t.wallMaterial?_.WALL_COLOURS[t.wallMaterial]:e?_.WALL_COLOURS.stone:_.PLASTER,o=Math.sin(t.eastM*12.9898+t.northM*78.233)*43758.5453,n=1+(o-Math.floor(o)-.5)*2*_.VARIATION,a=r=>Math.max(0,Math.min(255,Math.round(parseInt(s.slice(r,r+2),16)*n))).toString(16).padStart(2,"0");return`#${a(1)}${a(3)}${a(5)}`}}class R{static MIN_RISE_M=1.2;static MIN_EAVES_M=2.5;static MIN_SEEN=.35;static NO_DATA=-9999;static BANDS=7;static INSET_M=.9;static LIFT=1.18;static PEAK=.3;static LEVEL=.45;static fit(t,e,s){return!e&&!s&&!t.some(o=>o.roofMaterial)?t:t.map(o=>{const n=e?R.shapeOf(o,e):void 0,a=(s?R.colorOf(o,s):void 0)??_.roofColor(o.roofMaterial);if(!n&&!a)return o;const r={shape:n?.shape??"flat",...n?.ridge==="depth"?{ridge:"depth"}:{},riseM:n?.riseM??0,...a?{color:a}:{}},i=n&&n.shape!=="flat"?n.topM:o.heightM;return{...o,heightM:i,roof:r}})}static world(t,e,s){const o=t.headingDeg*Math.PI/180;return{east:t.eastM+e*Math.cos(o)+s*Math.sin(o),north:t.northM-e*Math.sin(o)+s*Math.cos(o)}}static shapeOf(t,e){const s=R.BANDS,o=Math.max(e.metresPerPixel,.5),n=t.widthM/2-R.INSET_M,a=t.lengthM/2-R.INSET_M;if(n<=0||a<=0)return;const r=[],i=Array.from({length:s},()=>({sum:0,n:0})),h=Array.from({length:s},()=>({sum:0,n:0}));let c=0;for(let y=-n;y<=n;y+=o)for(let N=-a;N<=a;N+=o){c++;const{east:x,north:$}=R.world(t,y,N),z=Math.floor(x/e.metresPerPixel+e.size/2),Y=Math.floor(e.size/2-$/e.metresPerPixel);if(z<0||Y<0||z>=e.size||Y>=e.size)continue;const k=Y*e.size+z,P=e.heights[k];if(e.vegetation[k]||P===R.NO_DATA||!(P>0))continue;r.push(P);const J=i[Math.min(s-1,Math.floor((y+n)/(2*n)*s))],Q=h[Math.min(s-1,Math.floor((N+a)/(2*a)*s))];J.sum+=P,J.n++,Q.sum+=P,Q.n++}if(c===0||r.length/c<R.MIN_SEEN)return;r.sort((y,N)=>y-N);const l=R.percentile(r,.08),f=R.percentile(r,.92),M=f-l;if(l<R.MIN_EAVES_M||M>Math.min(t.widthM,t.lengthM))return;if(M<R.MIN_RISE_M)return{shape:"flat",riseM:0,topM:f};const d=R.profile(i),g=R.profile(h);if(!d||!g)return;const m=R.peak(g)/M,E=R.peak(d)/M,v=R.spread(d)/M,w=R.spread(g)/M,p=m>=R.PEAK&&v<=R.LEVEL,A=E>=R.PEAK&&w<=R.LEVEL;if(p&&(!A||m>=E))return{shape:"gable",ridge:"width",riseM:M,topM:f};if(A)return{shape:"gable",ridge:"depth",riseM:M,topM:f};if(m>=R.PEAK&&E>=R.PEAK/2)return{shape:"hip",ridge:"width",riseM:M,topM:f}}static profile(t){const e=t.map(s=>s.n>0?s.sum/s.n:NaN);return e.filter(Number.isFinite).length>=t.length-1?e.map((s,o)=>Number.isFinite(s)?s:R.neighbour(e,o)):void 0}static neighbour(t,e){return Number.isFinite(t[e-1])?t[e-1]:t[e+1]}static peak(t){const e=Math.max(1,Math.floor(t.length/3)),s=n=>n.reduce((a,r)=>a+r,0)/n.length,o=[...t.slice(0,e),...t.slice(t.length-e)];return s(t.slice(e,t.length-e))-s(o)}static spread(t){return Math.max(...t)-Math.min(...t)}static percentile(t,e){return t[Math.min(t.length-1,Math.floor(t.length*e))]}static colorOf(t,e){const s=Math.max(e.metresPerPixel,.5),o=Math.max(t.widthM/2-R.INSET_M,s),n=Math.max(t.lengthM/2-R.INSET_M,s),a=[],r=[],i=[];for(let l=-o;l<=o;l+=s)for(let f=-n;f<=n;f+=s){const{east:M,north:d}=R.world(t,l,f),g=Math.floor(M/e.metresPerPixel+e.size/2),m=Math.floor(e.size/2-d/e.metresPerPixel);if(g<0||m<0||g>=e.size||m>=e.size)continue;const E=(m*e.size+g)*e.samples,v=e.values[E],w=e.values[E+1],p=e.values[E+2];w>v&&w>p||(a.push(v),r.push(w),i.push(p))}if(a.length===0)return;const h=l=>l.sort((f,M)=>f-M)[Math.floor(l.length/2)],c=l=>Math.min(255,Math.round(l*R.LIFT)).toString(16).padStart(2,"0");return`#${c(h(a))}${c(h(r))}${c(h(i))}`}}class G{static DEFAULT_HEIGHT_M=6;static METRES_PER_DEGREE=111320;static STREET_SPACING_M=35;static KERB_OFFSET_M=1;static DEFAULT_WIDTH_M=5.5;static PATIENCE_MS=15e3;static MAX=150;static lampsFrom(t,e,s){const o=[],n=new Set;for(const r of t.elements??[]){if(r.id!==void 0){const l=`${r.type}/${r.id}`;if(n.has(l))continue;n.add(l)}if(r.type==="way"){r.tags?.lit==="yes"&&G.alongStreet(r,e,o);continue}if(r.tags?.highway!=="street_lamp"||typeof r.lat!="number"||typeof r.lon!="number")continue;const i=(r.lon-e.lng)*G.METRES_PER_DEGREE*Math.cos(e.lat*Math.PI/180),h=(r.lat-e.lat)*G.METRES_PER_DEGREE;if(Math.hypot(i,h)>s)continue;const c=Number.parseFloat(r.tags?.height??"");o.push({eastM:Math.round(i*10)/10,northM:Math.round(h*10)/10,...Number.isFinite(c)&&c>=2&&c<=20?{heightM:c}:{}})}const a=o.filter(r=>Math.hypot(r.eastM,r.northM)<=s);return o.length=0,o.push(...a),o.sort((r,i)=>Math.hypot(r.eastM,r.northM)-Math.hypot(i.eastM,i.northM)),o.slice(0,G.MAX)}static alongStreet(t,e,s){const o=t.geometry;if(!o||o.length<2)return;const n=d=>[(d.lon-e.lng)*G.METRES_PER_DEGREE*Math.cos(e.lat*Math.PI/180),(d.lat-e.lat)*G.METRES_PER_DEGREE],a=o.map(n),r=Number.parseFloat(t.tags?.width??""),i=Number.parseInt(t.tags?.lanes??"",10),c=(Number.isFinite(r)&&r>0?r:Number.isFinite(i)&&i>0?i*3.5:G.DEFAULT_WIDTH_M)/2+G.KERB_OFFSET_M;let l=1,f=G.STREET_SPACING_M/2,M=0;for(let d=1;d<a.length;d++){const[g,m]=a[d-1],[E,v]=a[d],w=Math.hypot(E-g,v-m);if(w===0)continue;const p=(E-g)/w,A=(v-m)/w;for(;f<=M+w;f+=G.STREET_SPACING_M){const y=f-M;s.push({eastM:Math.round((g+p*y+A*c*l)*10)/10,northM:Math.round((m+A*y-p*c*l)*10)/10,supposed:!0}),l=-l}M+=w}}}class u{constructor(t={},e=[],s=[]){this.lampSources=e,this.signalSources=s,this.client=new tt(t)}static METRES_PER_DEGREE=111320;static KERB_OFFSET_M=.6;static SETBACK_M=.5;static MIN_CROSSING_M=3;static MAX_CROSSING_M=30;static SAME_CROSSING_M=5;static SAME_HEAD_M=2.5;static SAME_HEAD_DEG=45;static MAX_SIGNALS=160;static MAX_CROSSINGS=150;static MAX_SIGNS=100;static ROADS=new Set([...q.DRIVABLE,"living_street","busway","road"]);static ON_ROAD="^(traffic_signals|crossing|stop|give_way)$";static CREDIT={name:"OpenStreetMap",url:"https://www.openstreetmap.org/copyright",licence:"ODbL"};client;local(t,e){const s=u.boxOf(t,e),o=(r,i)=>{if(!r)return Promise.resolve(void 0);const h=`${r.credit.url} ${s}`;let c=u.localPending.get(h);return c||(c=i().then(l=>({credit:r.credit,found:l}),()=>{u.localPending.delete(h)}),u.localPending.set(h,c)),c},n=this.lampSources.find(r=>r.covers(t.lat,t.lng)),a=this.signalSources.find(r=>r.covers(t.lat,t.lng));return Promise.all([o(n,()=>n.lampsNear(t,e)),o(a,()=>a.signalsNear(t,e))]).then(([r,i])=>({lamps:r,signals:i}))}static localPending=new Map;static withLocal(t,e){const s=e?.lamps?e.lamps.found:t.lamps,o=e?.signals?e.signals.found:t.signals,a=[...u.found({crossings:t.crossings,signs:t.signs,...e?.lamps?{}:{lamps:s},...e?.signals?{}:{signals:o}})?[u.CREDIT]:[],...e?.lamps&&e.lamps.found.length>0?[e.lamps.credit]:[],...e?.signals&&e.signals.found.length>0?[e.signals.credit]:[]],{lamps:r,signals:i,credits:h,...c}=t;return{...c,...s?.length?{lamps:s}:{},...o?.length?{signals:o}:{},...a.length>0?{credits:a}:{}}}static today(){return new Date().toISOString().slice(0,10)}static later(t,e,s){return t?.answered(e,s).then(o=>({...o,...u.found(o)?{dates:{lamps:u.today()}}:{}}))}static found(t){return!!(t?.lamps?.length||t?.signals?.length||t?.crossings?.length||t?.signs?.length)}static query(t){const e=u.ON_ROAD;return`[out:json][timeout:25];(node["highway"="street_lamp"](${t});way["highway"]["lit"="yes"](${t});node["highway"~"${e}"](${t});node["traffic_sign"](${t});way["footway"="crossing"](${t}););out geom;(node._["highway"~"${e}"];node._["traffic_sign"];)->.kerb;way(bn.kerb)["highway"];out geom;`}static pending=new Map;async near(t,e){const s=this.ask(u.boxOf(t,e)),o=this.local(t,e);let n;const a=Symbol("late"),r=new Promise(i=>{n=setTimeout(()=>i(a),G.PATIENCE_MS)});try{const[i,h]=await Promise.all([Promise.race([s,r]),Promise.race([o,r])]),c=h===a?void 0:h;return i===a||i===void 0?{...u.withLocal({},c),incomplete:!0}:u.withLocal(u.from(i,t,e),c)}finally{clearTimeout(n)}}static RETRY_DELAYS_MS=[15e3,6e4,18e4,6e5];async answered(t,e){const s=u.boxOf(t,e);for(let o=0;;o++){const n=await this.ask(s);if(n)return u.withLocal(u.from(n,t,e),await this.local(t,e));if(o>=u.RETRY_DELAYS_MS.length)throw new Error("Overpass did not answer");await new Promise(a=>setTimeout(a,u.RETRY_DELAYS_MS[o]))}}ask(t){let e=u.pending.get(t);return e||(e=this.client.query(u.query(t)).catch(()=>{u.pending.delete(t)}),u.pending.set(t,e)),e}static boxOf(t,e){const s=e/u.METRES_PER_DEGREE,o=e/(u.METRES_PER_DEGREE*Math.cos(t.lat*Math.PI/180));return[t.lat-s,t.lng-o,t.lat+s,t.lng+o].map(n=>n.toFixed(6)).join(",")}static forget(){u.pending.clear(),u.localPending.clear()}static from(t,e,s){const o=G.lampsFrom(t,e,s),n=Math.cos(e.lat*Math.PI/180),a=(p,A)=>[(A-e.lng)*u.METRES_PER_DEGREE*n,(p-e.lat)*u.METRES_PER_DEGREE],r=(p,A)=>`${p.toFixed(7)},${A.toFixed(7)}`,i=new Map,h=new Set,c=[],l=[];for(const p of t.elements??[]){if(p.type==="node"){typeof p.lat=="number"&&typeof p.lon=="number"&&l.push(p);continue}if(p.type!=="way"||!p.geometry||p.geometry.length<2)continue;if(p.id!==void 0){if(h.has(p.id))continue;h.add(p.id)}const A=p.tags??{};if(A.footway==="crossing"&&c.push(p),!u.ROADS.has(A.highway??""))continue;const y=p.geometry.map(N=>a(N.lat,N.lon));p.geometry.forEach((N,x)=>{const $=r(N.lat,N.lon);i.set($,[...i.get($)??[],{way:p,points:y,index:x}])})}const f=[],M=[],d=[],g=new Set;for(const p of l){if(p.id!==void 0){if(g.has(p.id))continue;g.add(p.id)}const A=p.tags??{},y=a(p.lat,p.lon),N=i.get(r(p.lat,p.lon))??[],x=A.highway;if(x==="traffic_signals")for(const k of u.approaches(N,u.directionOf(A),!1))f.push(u.head(y,k,"vehicles"));if(x==="crossing"||x==="traffic_signals"&&A.crossing!==void 0){const k=N[0];if(k&&u.marked(A)){const P=u.directionAt(k);P&&M.push({eastM:u.round(y[0]),northM:u.round(y[1]),headingDeg:u.heading(P),widthM:q.widthOf(k.way.tags??{})}),P&&(A.crossing==="traffic_signals"||A["crossing:signals"]==="yes")&&f.push(...u.pedestrianHeads(y,P,k))}}if(x==="traffic_signals")continue;const $=x==="stop"?{face:"stop"}:x==="give_way"?{face:"give-way"}:u.faceOf(A);if(!$)continue;const z=A.traffic_sign?{code:A.traffic_sign}:{};if(N.length>0){const k=u.approaches(N,u.directionOf(A),!0)[0];if(k){const P=u.head(y,k,"vehicles");d.push({eastM:P.eastM,northM:P.northM,headingDeg:P.headingDeg,...$,...z})}continue}const Y=u.compassOf(A.direction);Y!==void 0&&d.push({eastM:u.round(y[0]),northM:u.round(y[1]),headingDeg:(Y+180)%360,...$,...z})}for(const p of c){const A=u.crossingAlong(p,a);A&&!M.some(y=>Math.hypot(y.eastM-A.eastM,y.northM-A.northM)<u.SAME_CROSSING_M)&&M.push(A)}const m=f.filter((p,A)=>!f.slice(0,A).some(y=>y.for===p.for&&Math.hypot(y.eastM-p.eastM,y.northM-p.northM)<u.SAME_HEAD_M&&Math.abs((y.headingDeg-p.headingDeg+540)%360-180)<u.SAME_HEAD_DEG)),E=(p,A)=>p.filter(y=>Math.hypot(y.eastM,y.northM)<=s).sort((y,N)=>Math.hypot(y.eastM,y.northM)-Math.hypot(N.eastM,N.northM)).slice(0,A),v={};o.length>0&&(v.lamps=o);const w={signals:E(m,u.MAX_SIGNALS),crossings:E(M,u.MAX_CROSSINGS),signs:E(d,u.MAX_SIGNS)};return w.signals.length>0&&(v.signals=w.signals),w.crossings.length>0&&(v.crossings=w.crossings),w.signs.length>0&&(v.signs=w.signs),v}static approaches(t,e,s){const o=[];for(const a of t){const r=a.way.tags??{},i=r.oneway==="yes"||r.oneway==="true"||r.oneway==="1"||r.junction==="roundabout"||r.highway==="motorway",h=r.oneway==="-1",{points:c,index:l}=a,f=(d,g)=>{let m=0;for(let E=Math.min(d,g);E<Math.max(d,g);E++)m+=Math.hypot(c[E+1][0]-c[E][0],c[E+1][1]-c[E][1]);return m},M=d=>{const g=c[l][0]-c[d][0],m=c[l][1]-c[d][1],E=Math.hypot(g,m);return E>0?[g/E,m/E]:void 0};if(l>0&&!h){const d=M(l-1);d&&o.push({approach:{unit:d,road:a},toEndM:f(l,c.length-1),forward:!0})}if(l<c.length-1&&!i){const d=M(l+1);d&&o.push({approach:{unit:d,road:a},toEndM:f(0,l),forward:!1})}}const n=e!==void 0&&t.length===1?o.filter(a=>a.forward===(e==="forward")):o;return!s||n.length<=1?n.map(a=>a.approach):[n.reduce((a,r)=>r.toEndM<a.toEndM?r:a).approach]}static head(t,e,s){const[o,n]=e.unit,a=q.widthOf(e.road.way.tags??{})/2+u.KERB_OFFSET_M,r=u.SETBACK_M,i=u.heading(e.unit);return{eastM:u.round(t[0]-o*r+n*a),northM:u.round(t[1]-n*r-o*a),headingDeg:(i+180)%360,for:s,phase:j.phaseOf(i)}}static pedestrianHeads(t,e,s){const o=q.widthOf(s.way.tags??{})/2+u.KERB_OFFSET_M,n=u.heading(e),a=j.phaseOf(n);return[1,-1].map(r=>({eastM:u.round(t[0]+e[1]*o*r),northM:u.round(t[1]-e[0]*o*r),headingDeg:(n+(r===1?270:90))%360,for:"pedestrians",phase:a}))}static crossingAlong(t,e){if(!u.marked(t.tags??{}))return;const s=t.geometry.map(h=>e(h.lat,h.lon)),[o,n]=s[0],[a,r]=s[s.length-1],i=Math.hypot(a-o,r-n);if(!(i<u.MIN_CROSSING_M))return{eastM:u.round((o+a)/2),northM:u.round((n+r)/2),headingDeg:(u.heading([(a-o)/i,(r-n)/i])+90)%360,widthM:Math.round(Math.min(i,u.MAX_CROSSING_M)*10)/10}}static marked(t){const e=t.crossing;return e!=="unmarked"&&e!=="no"&&e!=="informal"&&t["crossing:markings"]!=="no"}static directionAt(t){const{points:e,index:s}=t,[o,n]=s<e.length-1?[e[s],e[s+1]]:[e[s-1],e[s]],a=Math.hypot(n[0]-o[0],n[1]-o[1]);return a>0?[(n[0]-o[0])/a,(n[1]-o[1])/a]:void 0}static directionOf(t){const e=t["traffic_signals:direction"]??t["traffic_sign:direction"]??t.direction;return e==="forward"||e==="backward"?e:void 0}static compassOf(t){if(t===void 0)return;const e=Number.parseFloat(t);if(Number.isFinite(e)&&/^\s*-?\d/.test(t))return(e%360+360)%360;const o=["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"].indexOf(t.trim().toUpperCase());return o<0?void 0:o*22.5}static faceOf(t){const e=t.traffic_sign;if(!e||e==="no"||e==="none")return;const s=e.split(/[;,]/).map(o=>o.trim());if(s.some(o=>/stop|:AB4\b|:206\b|:R1-1\b|:B2\b/i.test(o)))return{face:"stop"};if(s.some(o=>/give_way|yield|:AB3a\b|:205\b|:R1-2\b|:B1\b/i.test(o)))return{face:"give-way"};for(const o of s){const n=/maxspeed|:B14\b|:274\b|:C14\b|:R2-1\b/i.test(o)?Number.parseInt(/\[(\d+)\]/.exec(o)?.[1]??t.maxspeed??"",10):Number.NaN;if(Number.isFinite(n)&&n>0)return{face:"speed-limit",value:n}}return{face:"other"}}static heading([t,e]){return Math.round((Math.atan2(t,e)*180/Math.PI+360)%360*10)/10}static round(t){return Math.round(t*10)/10}}class nt{id="ign-lidar-hd";name="IGN LiDAR HD";attribution="Canopy and roofs © IGN, LiDAR HD (Licence Ouverte 2.0), as surveyed on a day the service does not give";creditUrl="https://geoservices.ign.fr/lidarhd";contemporary=!0;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","The LiDAR HD survey covers France only");const s=C.lidarRadius(e),[o,n,a,r,i]=await Promise.all([this.platform.lidar(t,s),this.platform.photo(t,s).catch(()=>{}),this.furniture?.near(t,e),this.platform.laserDate(t),this.platform.photoDate(t)]);return{trees:new H(o.heights,o.vegetation,o.size,o.size).trees({metresPerPixel:o.metresPerPixel,radiusM:s}),buildings:_.fit(R.fit(new D(o.heights,o.building,o.size,o.size).buildings({metresPerPixel:o.metresPerPixel,radiusM:s,maxBuildings:300}),o,n)),bridges:[],lines:[],...a,dates:{...r?{laser:r}:{},...n&&i?{photo:i}:{},...u.found(a)?{lamps:u.today()}:{}}}}}class O{static MAP_NATURES={Eglise:"church",Chapelle:"church",Monument:"monument","Tour, donjon":"monument","Fort, blockhaus, casemate":"monument","Arc de triomphe":"monument","Arène ou théâtre antique":"monument",Château:"old","Industriel, agricole ou commercial":"works",Serre:"works",Silo:"works"};static MAP_WORKS=new Set(["Industriel","Agricole","Annexe"]);static MAP_CLOSED_AT_NIGHT=new Set(["Commercial et services","Sportif"]);static OSM_CLOSED_AT_NIGHT=new Set(["retail","commercial","office","supermarket","kiosk","sports_hall","sports_centre","stadium","school","university","college","kindergarten","public","civic","government","train_station","transportation"]);static OSM_BUILDINGS={cathedral:"church",church:"church",chapel:"church",basilica:"church",temple:"church",mosque:"church",synagogue:"church",shrine:"church",religious:"church",castle:"old",palace:"old",fortress:"monument",bunker:"monument",triumphal_arch:"monument",industrial:"works",warehouse:"works",barn:"works",farm_auxiliary:"works",shed:"works",hangar:"works",garage:"works",garages:"works",greenhouse:"works",silo:"works",storage_tank:"works",cowshed:"works",stable:"works",sty:"works",manufacture:"works"};static OSM_HISTORIC={church:"church",chapel:"church",monastery:"old",castle:"old",manor:"old",fort:"monument",tower:"monument",monument:"monument",memorial:"monument",city_gate:"monument"};static OLD_BEFORE=1900;static GRAND_FROM_M=15;static GRAND_UP_TO_M=40;static TOWER_SLENDERNESS=2;static CHURCH_PITCH=.7;static CHURCH_ROOF_OF_WALLS=.35;static CHURCH_ROOF_COLOUR="#5a6068";static ofMap(t){const e=O.year(t.date_d_apparition),o=O.MAP_NATURES[String(t.nature??"")]??(t.usage_1==="Religieux"?"church":void 0)??(O.MAP_WORKS.has(String(t.usage_1??""))?"works":void 0)??O.ofYear(e)??O.grand(t),n=O.MAP_CLOSED_AT_NIGHT.has(String(t.usage_1??""));return{...o?{style:o}:{},...e!==void 0?{builtYear:e}:{},...n?{closedAtNight:!0}:{}}}static ofOsm(t){const e=O.year(t.start_date),s=t.historic&&t.historic!=="no"?O.OSM_HISTORIC[t.historic]??"old":void 0,o=t.amenity==="place_of_worship"?"church":void 0,n=O.OSM_BUILDINGS[t.building??""]??s??o??O.ofYear(e),a=O.OSM_CLOSED_AT_NIGHT.has(t.building??"")||t.shop!==void 0&&t.shop!=="no";return{...n?{style:n}:{},...e!==void 0?{builtYear:e}:{},...a?{closedAtNight:!0}:{}}}static year(t){const e=Number(/\b(\d{4})\b/.exec(String(t??""))?.[1]);return Number.isFinite(e)&&e>=1e3&&e<=2100?e:void 0}static fit(t){return t.map(e=>e.style==="church"?O.church(e):e)}static isTower(t){return t.heightM>=O.TOWER_SLENDERNESS*Math.max(t.widthM,t.lengthM)}static church(t){const e=t.roof?.color??O.CHURCH_ROOF_COLOUR;if(O.isTower(t))return{...t,roof:{shape:"flat",riseM:0,color:e}};if(t.roof&&t.roof.shape!=="flat")return t;const s=Math.round(Math.min(O.CHURCH_PITCH*t.lengthM,O.CHURCH_ROOF_OF_WALLS*t.heightM)*10)/10,o={shape:"gable",riseM:s,color:e};return{...t,heightM:Math.round((t.heightM+s)*10)/10,roof:o}}static ofYear(t){return t!==void 0&&t<O.OLD_BEFORE?"old":void 0}static grand(t){const e=Number(t.hauteur),s=Number(t.nombre_d_etages);if(!(Number.isFinite(s)&&s>0)&&!(t.usage_1==="Résidentiel"||t.date_d_apparition))return e>=O.GRAND_FROM_M&&e<=O.GRAND_UP_TO_M?"grand":void 0}}class b{static METRES_PER_DEGREE=111320;static NAMED_NATURES={Silo:"Silo"};static DEFAULT_HEIGHT_M=6;static FLOOR_HEIGHT_M=3;static FINE_M=.5;static COARSE_M=1;static MAX_CELLS=4e4;static RECTANGLE_FILL=.9;static buildings(t,e,s,o=12,n=300,a=[]){const r=[];for(const h of b.reached(t,a,e,s)){const c=h.feature,l=Number(c.properties.nombre_d_etages),f=Number(c.properties.hauteur),M=Number.isFinite(f)&&f>0?f:Number.isFinite(l)&&l>0?l*b.FLOOR_HEIGHT_M:b.DEFAULT_HEIGHT_M,{style:d,builtYear:g,closedAtNight:m}=O.ofMap(c.properties);for(const E of b.rectanglesOf(h.rings,M,o)){const v=_.of(c.properties.materiaux_des_murs,"wall"),w=_.of(c.properties.materiaux_de_la_toiture,"roof"),p=b.NAMED_NATURES[String(c.properties.nature??"")];r.push({...E,...p?{name:p}:{},...Number.isFinite(l)&&l>0?{floors:l}:{},...v?{wallMaterial:v}:{},...w?{roofMaterial:w}:{},...d?{style:d}:{},...g!==void 0?{builtYear:g}:{},...m?{closedAtNight:m}:{}})}}const i=h=>Math.hypot(h.eastM,h.northM);if(r.length>n){const h=c=>(c.heightM+6)*Math.sqrt(c.widthM*c.lengthM)/Math.max(i(c),50);r.sort((c,l)=>h(l)-h(c)),r.length=n}return r.sort((h,c)=>i(h)-i(c)),r}static named(t,e,s){const o=e.map(n=>({name:typeof n.properties.toponyme=="string"?n.properties.toponyme:"",rings:b.rings(n,s)})).filter(n=>n.name.length>0&&n.rings.length>0);return o.length===0?t:t.map(n=>{const a=o.find(r=>b.inside(n.eastM,n.northM,r.rings));return a?{...n,name:a.name}:n})}static reached(t,e,s,o){const n=t.map(i=>({feature:i,rings:b.rings(i,s)})).filter(i=>i.rings.length>0),a=n.map(i=>b.reach(i.rings)<=o),r=e.filter(i=>typeof i.properties.toponyme=="string"&&i.properties.toponyme.length>0).map(i=>b.rings(i,s)).filter(i=>i.length>0);if(r.length>0){const i=n.map(c=>{const l=c.rings[0],f=l.reduce((d,g)=>d+g.east,0)/l.length,M=l.reduce((d,g)=>d+g.north,0)/l.length;return r.findIndex(d=>b.inside(f,M,d))}),h=new Set(i.filter((c,l)=>c>=0&&a[l]));i.forEach((c,l)=>{h.has(c)&&(a[l]=!0)})}return n.filter((i,h)=>a[h])}static reach(t){if(b.inside(0,0,t))return 0;let e=1/0;for(const s of t)for(let o=0;o+1<s.length;o++){const n=s[o],a=s[o+1],r=a.east-n.east,i=a.north-n.north,h=r*r+i*i>0?Math.max(0,Math.min(1,-(n.east*r+n.north*i)/(r*r+i*i))):0;e=Math.min(e,Math.hypot(n.east+h*r,n.north+h*i))}return e}static inside(t,e,s){let o=0;for(const n of s)for(let a=0;a+1<n.length;a++){const r=n[a],i=n[a+1];r.north<=e!=i.north<=e&&r.east+(e-r.north)/(i.north-r.north)*(i.east-r.east)>t&&o++}return o%2===1}static rings(t,e){const s=t.geometry,o=s.type==="Polygon"?[s.coordinates]:s.type==="MultiPolygon"?s.coordinates:[],n=Math.cos(e.lat*Math.PI/180),a=[];for(const r of o)for(const i of r)a.push(i.map(([h,c])=>({east:(h-e.lng)*b.METRES_PER_DEGREE*n,north:(c-e.lat)*b.METRES_PER_DEGREE})));return a}static rectanglesOf(t,e,s){let o=1/0,n=-1/0,a=1/0,r=-1/0;for(const f of t)for(const M of f)o=Math.min(o,M.east),n=Math.max(n,M.east),a=Math.min(a,M.north),r=Math.max(r,M.north);let i=b.FINE_M;(n-o)*(r-a)/(i*i)>b.MAX_CELLS&&(i=b.COARSE_M);const h=[],c=[];for(let f=a+i/2;f<r;f+=i){const M=[];for(const d of t)for(let g=0;g+1<d.length;g++){const m=d[g],E=d[g+1];m.north<=f!=E.north<=f&&M.push(m.east+(f-m.north)/(E.north-m.north)*(E.east-m.east))}M.sort((d,g)=>d-g);for(let d=0;d+1<M.length;d+=2)for(let g=Math.ceil((M[d]-i/2)/i)*i+i/2;g<M[d+1];g+=i)h.push(g),c.push(f)}if(h.length*i*i<s)return[];const l=t.flatMap(f=>f.slice(0,-1).map((M,d)=>({from:M,to:f[d+1]})));return D.ofPoints(h,c,new Array(h.length).fill(e),i,s,b.RECTANGLE_FILL,l)}}class F{id="ign-lidar-topo";name="IGN LiDAR HD + BD TOPO";attribution="Canopy © IGN, LiDAR HD; buildings, bridges and lines © IGN, BD TOPO (Licence Ouverte 2.0), as surveyed on days the services do not give";creditUrl="https://geoservices.ign.fr/lidarhd";contemporary=!0;static BRIDGE_MARGIN_M=30;static MAX_BRIDGE_WINDOWS=8;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","The IGN's surveys cover France only");const s=C.radius(e),[o,n,a,r,i,h]=await Promise.allSettled([this.platform.lidar(t,s),this.platform.vectors(t,s,!0),this.platform.photo(t,s),this.furniture?.near(t,e)??Promise.resolve(void 0),this.platform.laserDate(t),this.platform.photoDate(t)]),c=C.lidarRadius(s);if(o.status==="rejected"&&n.status==="rejected")throw o.reason;const l=o.status==="fulfilled"?o.value:void 0,f=n.status==="fulfilled"?n.value:void 0,M=f!==void 0&&f.buildings.length===0&&f.bridges.length===0&&f.lines.length===0;if(o.status==="rejected"&&o.reason instanceof V&&o.reason.reason==="no-coverage"&&M)throw o.reason;return{trees:l?new H(l.heights,l.vegetation,l.size,l.size).trees({metresPerPixel:l.metresPerPixel,radiusM:c}):[],buildings:this.roofed(this.buildings(l,f,t,s),l,a.status==="fulfilled"?a.value:void 0),bridges:f?await this.bridges(f,t,s,l?.structures,c):[],lines:f?X.lines(f,t,s,l?.structures):[],...r.status==="fulfilled"?r.value:{},dates:{...o.status==="fulfilled"&&i.status==="fulfilled"&&i.value?{laser:i.value}:{},...a.status==="fulfilled"&&h.status==="fulfilled"&&h.value?{photo:h.value}:{},...f?.mapDate?{map:f.mapDate}:{},...r.status==="fulfilled"&&u.found(r.value)?{lamps:u.today()}:{}}}}async bridges(t,e,s,o,n){const a=X.bridges(t,e,s,o);let r=0;return Promise.all(a.map(async i=>{if(o!==void 0&&Math.hypot(i.eastM,i.northM)+i.lengthM/2<=n)return i;const h=i.lengthM/2+F.BRIDGE_MARGIN_M;if(r++>=F.MAX_BRIDGE_WINDOWS)return i;const c=ot(i.eastM,-i.northM,e.lat,e.lng);try{const l=await this.platform.lidar(c,h),f=X.bridges(t,c,h,l.structures).sort((M,d)=>Math.hypot(M.eastM,M.northM)-Math.hypot(d.eastM,d.northM))[0];return!f||Math.hypot(f.eastM,f.northM)>i.lengthM/2?i:{...f,eastM:X.tenth(f.eastM+i.eastM),northM:X.tenth(f.northM+i.northM)}}catch{return i}}))}roofed(t,e,s){return _.fit(O.fit(R.fit(t,e,s)))}buildings(t,e,s,o){const n=e?b.buildings(e.buildings,s,o,void 0,void 0,e.zones):[],a=n.length>0||t===void 0?n:new D(t.heights,t.building,t.size,t.size).buildings({metresPerPixel:t.metresPerPixel,radiusM:C.lidarRadius(o),maxBuildings:300});return e?b.named(a,e.zones,s):a}}class at{id="ign-bd-topo";name="IGN BD TOPO";attribution="Buildings, bridges and lines © IGN, BD TOPO (Licence Ouverte 2.0), as drawn on a day the service does not give";creditUrl="https://geoservices.ign.fr/bdtopo";contemporary=!0;platform;furniture;constructor(t={},e){this.platform=new C(t),this.furniture=e}covers(t,e){return C.covers(t,e)}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){if(!this.covers(t.lat,t.lng))throw new V("no-coverage","BD TOPO covers France only");const s=C.radius(e),[o,n,a,r]=await Promise.all([this.platform.vectors(t,s,!0),this.platform.photo(t,s).catch(()=>{}),this.furniture?.near(t,e),this.platform.photoDate(t)]);return{trees:[],buildings:_.fit(O.fit(R.fit(b.named(b.buildings(o.buildings,t,s,void 0,void 0,o.zones),o.zones,t),void 0,n))),bridges:X.bridges(o,t,s,void 0),lines:X.lines(o,t,s,void 0),...a,dates:{...o.mapDate?{map:o.mapDate}:{},...n&&r?{photo:r}:{},...u.found(a)?{lamps:u.today()}:{}}}}}class S{static ROOF_SHAPES={flat:"flat",gabled:"gable",gambrel:"gable",saltbox:"gable","half-hipped":"hip",hipped:"hip",pyramidal:"hip",mansard:"hip",round:"gable",dome:"dome",onion:"dome"};static WALL_MATERIALS={brick:"brick",stone:"stone",granite:"stone",sandstone:"stone",limestone:"stone",concrete:"concrete",cement_block:"block",block:"block",wood:"wood",timber_framing:"wood"};static ROOF_MATERIALS={roof_tiles:"tile",tiles:"tile",tile:"tile",slate:"slate",metal:"zinc",zinc:"zinc",tin:"zinc",copper:"zinc",concrete:"concrete",eternit:"other"};static COLOURS={white:"#e8e6e0",grey:"#8c8c8a",gray:"#8c8c8a",black:"#3a3a3a",red:"#a8483a",brown:"#6e4f38",beige:"#d6c9a8",yellow:"#d8c070",orange:"#c9773a",green:"#5f7a52",blue:"#506a8a",tan:"#c0a37a",cream:"#e6dcc0",pink:"#c99a96",silver:"#b4b6b6"};static height(t){const e=Number.parseFloat((t??"").replace(",","."));return Number.isFinite(e)&&e>=2&&e<=500?e:void 0}static levels(t){const e=Number.parseInt(t??"",10);return Number.isFinite(e)&&e>=1&&e<=150?e:void 0}static roofShape(t){return S.ROOF_SHAPES[(t??"").trim().toLowerCase()]}static wallMaterial(t){return S.WALL_MATERIALS[(t??"").trim().toLowerCase()]}static roofMaterial(t){return S.ROOF_MATERIALS[(t??"").trim().toLowerCase()]}static colour(t){const e=(t??"").trim().toLowerCase();return/^#[0-9a-f]{6}$/.test(e)?e:/^#[0-9a-f]{3}$/.test(e)?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:S.COLOURS[e]}}class W{id="osm-buildings";name="OpenStreetMap buildings";attribution="Buildings © OpenStreetMap contributors (ODbL), as drawn on the day of the data, which a recording is not";creditUrl="https://www.openstreetmap.org/copyright";contemporary=!0;static MAX_RADIUS_M=1500;static MIN_AREA_M2=12;static MAX_BUILDINGS=300;client;furniture;constructor(t={},e){this.client=new tt(t),this.furniture=e}covers(){return!0}later(t,e){return u.later(this.furniture,t,e)}async getSurroundings(t,e){const s=Math.min(e,W.MAX_RADIUS_M);let o;try{o=await this.client.query(`[out:json][timeout:30];(way["building"](around:${s},${t.lat},${t.lng});relation["building"]["type"="multipolygon"](around:${s},${t.lat},${t.lng}););out geom;`)}catch(r){throw new V("unreachable",r instanceof Error?r.message:String(r))}const n=await this.furniture?.near(t,e),a=(o.osm3s?.timestamp_osm_base??"").slice(0,10);return{trees:[],buildings:_.fit(O.fit(W.buildings(o,t,s))),bridges:[],lines:[],...n,dates:{.../^\d{4}-\d{2}-\d{2}$/.test(a)?{map:a}:{},...u.found(n)?{lamps:u.today()}:{}}}}static buildings(t,e,s){const o=[];for(const n of t.elements??[]){const a=W.ringsOf(n);if(a.length===0)continue;const r=n.tags??{},i=S.levels(r["building:levels"]),h=S.height(r.height),c={geometry:{type:"Polygon",coordinates:a},properties:{...h?{hauteur:h}:{},...i?{nombre_d_etages:i}:{}}};for(const l of b.buildings([c],e,s,W.MIN_AREA_M2,50))o.push(W.described(l,r,h!==void 0))}return o.sort((n,a)=>Math.hypot(n.eastM,n.northM)-Math.hypot(a.eastM,a.northM)),o.slice(0,W.MAX_BUILDINGS)}static ringsOf(t){const e=o=>{if(!o||o.length<4)return;const n=o.map(i=>[i.lon,i.lat]),a=n[0],r=n[n.length-1];return a[0]===r[0]&&a[1]===r[1]?n:void 0};if(t.type==="way"){const o=e(t.geometry);return o?[o]:[]}return(t.members??[]).filter(o=>o.role==="outer").map(o=>e(o.geometry)).filter(o=>o!==void 0).slice(0,1)}static described(t,e,s){const o=S.wallMaterial(e["building:material"]),n=S.roofMaterial(e["roof:material"]),a=S.colour(e["building:colour"]),r=S.colour(e["roof:colour"])??_.roofColor(n),i=S.roofShape(e["roof:shape"]),h=a?{color:a}:void 0;let c,l=t.heightM;if(i==="gable"||i==="hip"||i==="dome"){const g=S.height(e["roof:height"]),m=Math.round((g??Math.min(5,Math.max(1.5,.29*Math.min(t.widthM,t.lengthM))))*10)/10;s||(l=Math.round((t.heightM+m)*10)/10),c={shape:i,riseM:m,...e["roof:orientation"]==="across"?{ridge:"depth"}:{},...r?{color:r}:{}}}else(i==="flat"||r)&&(c={shape:"flat",riseM:0,...r?{color:r}:{}});const{style:f,builtYear:M,closedAtNight:d}=O.ofOsm(e);return{...t,heightM:l,...f?{style:f}:{},...M!==void 0?{builtYear:M}:{},...d?{closedAtNight:d}:{},...e.name?{name:e.name}:{},...o?{wallMaterial:o}:{},...n?{roofMaterial:n}:{},...h?{facade:h}:{},...c?{roof:c}:{}}}}class L{credit={name:"Ville de Paris, Éclairage public",url:"https://opendata.paris.fr/explore/dataset/eclairage-public/",licence:"ODbL",of:"lamps"};static BOUNDS={south:48.8156,north:48.9022,west:2.2241,east:2.4698};static ENDPOINT="https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/eclairage-public/records";static PAGE=100;static MAX=150;static MAX_PAGES=4;static METRES_PER_DEGREE=111320;static SAME_COLUMN_M=.5;static MIN_HEIGHT_M=2;fetchImpl;constructor(t){this.fetchImpl=t??fetch.bind(globalThis)}covers(t,e){const s=L.BOUNDS;return t>=s.south&&t<=s.north&&e>=s.west&&e<=s.east}async lampsNear(t,e){const s=[];let o=[];for(let n=0;n<L.MAX_PAGES&&o.length<L.MAX;n++){const a=await this.fetchImpl(L.query(t,e,L.PAGE,n*L.PAGE));if(!a.ok)throw new Error(`opendata.paris.fr refused (${a.status})`);const r=(await a.json()).results??[];if(s.push(...r),o=L.lampsFrom(s,t),r.length<L.PAGE)break}return o.slice(0,L.MAX)}static query(t,e,s,o){const n=`geom'POINT(${t.lng.toFixed(6)} ${t.lat.toFixed(6)})'`,a=new URLSearchParams({select:"geo_point_2d,lib_ouvrag,lampe_temperature_couleur,lampe_flux,support_hauteur",where:`within_distance(geo_point_2d,${n},${Math.round(e)}m)`,order_by:`distance(geo_point_2d,${n})`,limit:String(s),offset:String(o)});return`${L.ENDPOINT}?${a}`}static lampsFrom(t,e){const s=Math.cos(e.lat*Math.PI/180),o=a=>{const r=typeof a=="number"?a:Number.parseFloat(a??"");return Number.isFinite(r)&&r>0?r:void 0},n=[];for(const a of t){const r=a.geo_point_2d;if(!r||a.lib_ouvrag==="Projecteur")continue;const i=Math.round((r.lon-e.lng)*L.METRES_PER_DEGREE*s*10)/10,h=Math.round((r.lat-e.lat)*L.METRES_PER_DEGREE*10)/10,c=o(a.lampe_flux),l=n.find(d=>Math.hypot(d.eastM-i,d.northM-h)<L.SAME_COLUMN_M);if(l){c!==void 0&&(l.lumens=(l.lumens??0)+c);continue}const f=o(a.lampe_temperature_couleur),M=o(a.support_hauteur);n.push({eastM:i,northM:h,...M!==void 0&&M>=L.MIN_HEIGHT_M?{heightM:M}:{},...f!==void 0?{colorTemperatureK:f}:{},...c!==void 0?{lumens:c}:{},...a.lib_ouvrag==="Console"?{mount:"wall"}:{}})}return n}}class T{constructor(t,e){this.roads=t,this.fetchImpl=e??fetch.bind(globalThis)}credit={name:"Ville de Paris, Signalisation lumineuse tricolore",url:"https://opendata.paris.fr/explore/dataset/signalisation-tricolore/",licence:"ODbL",of:"signals"};static BOUNDS={south:48.8156,north:48.9022,west:2.2241,east:2.4698};static ENDPOINT="https://opendata.paris.fr/api/explore/v2.1/catalog/datasets/signalisation-tricolore/records";static PAGE=100;static MAX_PAGES=5;static MAX=160;static METRES_PER_DEGREE=111320;static SAME_POST_M=.8;static SEARCH_M=15;static PEDESTRIAN_ALONG_M=.4;fetchImpl;covers(t,e){const s=T.BOUNDS;return t>=s.south&&t<=s.north&&e>=s.west&&e<=s.east}async signalsNear(t,e){const s=(e+T.SEARCH_M)/T.METRES_PER_DEGREE,o=s/Math.cos(t.lat*Math.PI/180),[n,a]=await Promise.all([this.lenses(t,e),this.roads.getRoads({south:t.lat-s,north:t.lat+s,west:t.lng-o,east:t.lng+o})]);return T.signalsFrom(n,a,t)}async lenses(t,e){const s=[];for(let o=0;o<T.MAX_PAGES;o++){const n=await this.fetchImpl(T.query(t,e,T.PAGE,o*T.PAGE));if(!n.ok)throw new Error(`opendata.paris.fr refused (${n.status})`);const a=(await n.json()).results??[];if(s.push(...a),a.length<T.PAGE)break}return s}static query(t,e,s,o){const n=`geom'POINT(${t.lng.toFixed(6)} ${t.lat.toFixed(6)})'`,a=new URLSearchParams({select:"geo_point_2d,lib_regime",where:`within_distance(geo_point_2d,${n},${Math.round(e)}m)`,order_by:`distance(geo_point_2d,${n})`,limit:String(s),offset:String(o)});return`${T.ENDPOINT}?${a}`}static signalsFrom(t,e,s){const o=Math.cos(s.lat*Math.PI/180),n=(h,c)=>[(c-s.lng)*T.METRES_PER_DEGREE*o,(h-s.lat)*T.METRES_PER_DEGREE],a=[];for(const h of t){if(!h.geo_point_2d)continue;const c=n(h.geo_point_2d.lat,h.geo_point_2d.lon),l=(h.lib_regime??"").toUpperCase(),f=/ROUGE|JAUNE|VERT/.test(l),M=/PASSEZ|ATTENDEZ/.test(l);if(!f&&!M)continue;let d=a.find(g=>Math.hypot(g.at[0]-c[0],g.at[1]-c[1])<T.SAME_POST_M);d||a.push(d={at:c,vehicles:0,pedestrians:0}),f&&d.vehicles++,M&&d.pedestrians++}const r=e.map(h=>({way:h,points:h.points.map(c=>n(c.lat,c.lng))})),i=[];for(const h of a){const c=T.nearestRoad(h.at,r);if(!c)continue;const[l,f]=c.unit,M=T.heading(c.unit),d=(h.at[0]-c.foot[0])*f-(h.at[1]-c.foot[1])*l>=0,g=c.way.direction,m=g==="forward"?M:g==="backward"?(M+180)%360:d?M:(M+180)%360,E=w=>Math.round(w*10)/10,v=w=>E((w%360+360)%360);if(h.vehicles>0&&i.push({eastM:E(h.at[0]),northM:E(h.at[1]),headingDeg:v(m+180),for:"vehicles",phase:j.phaseOf(m)}),h.pedestrians>0){const w=T.heading([c.foot[0]-h.at[0],c.foot[1]-h.at[1]]),p=h.vehicles>0?T.PEDESTRIAN_ALONG_M:0;i.push({eastM:E(h.at[0]+l*p),northM:E(h.at[1]+f*p),headingDeg:v(Number.isNaN(w)?M+90:w),for:"pedestrians",phase:j.phaseOf(M)})}}return i.sort((h,c)=>Math.hypot(h.eastM,h.northM)-Math.hypot(c.eastM,c.northM)).slice(0,T.MAX)}static nearestRoad(t,e){let s;for(const{way:o,points:n}of e)for(let a=1;a<n.length;a++){const[r,i]=n[a-1],[h,c]=n[a],l=Math.hypot(h-r,c-i);if(l===0)continue;const f=[(h-r)/l,(c-i)/l],M=Math.max(0,Math.min(l,(t[0]-r)*f[0]+(t[1]-i)*f[1])),d=[r+f[0]*M,i+f[1]*M],g=Math.hypot(t[0]-d[0],t[1]-d[1]);g<=T.SEARCH_M&&(!s||g<s.distance)&&(s={way:o,unit:f,foot:d,distance:g})}return s}static heading([t,e]){return t===0&&e===0?Number.NaN:Math.round((Math.atan2(t,e)*180/Math.PI+360)%360*10)/10}}const K=B.point("surroundings").provide(B.BUILT_IN,[{id:"ign-lidar-topo",name:"IGN LiDAR HD + BD TOPO",credit:"© IGN, LiDAR HD and BD TOPO, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/lidarhd",create:()=>new I(new F({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"ign-lidar-hd",name:"IGN LiDAR HD",credit:"© IGN, LiDAR HD, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/lidarhd",create:()=>new I(new nt({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"ign-bd-topo",name:"IGN BD TOPO",credit:"© IGN, BD TOPO, Licence Ouverte 2.0; street lamps © OpenStreetMap contributors",creditUrl:"https://geoservices.ign.fr/bdtopo",create:()=>new I(new at({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))},{id:"osm-buildings",name:"OpenStreetMap buildings",credit:"Buildings and street lamps © OpenStreetMap contributors (ODbL)",creditUrl:"https://www.openstreetmap.org/copyright",create:()=>new I(new W({},new u({},U.TOWN_LAMPS,U.TOWN_SIGNALS)))}]);class U{static DEFAULT_ID=K[0].id;static WORLD_ID="osm-buildings";static TOWN_LAMPS=[new L];static TOWN_SIGNALS=[new T(new et)];static NONE="none";static byId(t){return t===U.NONE?void 0:K.find(e=>e.id===t)??K[0]}static providerFor(t,e,s){const o=U.byId(t)?.create();if(t!==void 0&&t!==U.DEFAULT_ID)return o?.covers(e,s)?o:void 0;const n=K.find(r=>r.id===U.WORLD_ID).create(),a=[o,n].filter(r=>r!==void 0&&r.covers(e,s));return a.length>1?new st(a):a[0]}}export{K as SURROUNDINGS_SOURCES,U as SurroundingsSources};
@@ -0,0 +1,2 @@
1
+ import{aT as et,aU as g,aV as It,aW as Z,p as j,aX as N,aY as Dt,aZ as st,a_ as it}from"./ShareDialogElement-C3HL-Smq.js";import{C as ot}from"./ContrailGrowth-DwHS8If9.js";import{U as Ae}from"./upperAirSources-BGuLpdwu.js";import{p as V,r as Tt}from"./Decor-Dn-cvniW.js";import{l as at}from"./SaidPosition-CWiVNaNW.js";import"./rr0-ufoathome.mjs";import"./Sighting-CBpJpdm9.js";import"./VisualAids-DI-hEL46.js";import"./RecordingIssue-BlWT8Xsu.js";import"./Obstacles-v9SkfBD7.js";const Rt=.25,rt=.4,ct=6,X=12,Bt=3,lt=.2,vt=.2,ht=24,Nt=3,Ct=24,ut=1,_t=.7,Ht=1.5,wt=.8,yt=1.3,dt=.02,Pt=700,kt=-30,pt=.9,mt=5,Lt=25,Ft=.5,jt=.12,Mt=[.13,.31],Gt=.16,Ut=1.6,Kt=2,zt=3.6,At=1.1,Wt=.3,Vt=1e3,gt=.7,Xt=.7;class Y{context;constructor(t){this.context=t}noiseBuffer;roughBuffers=new Map;voices=new Map;bus;reverb;reverbOut;level=1;master;paused=!0;requested=[];headingDeg=0;resume(){if(!this.context){if(typeof AudioContext>"u")return;try{this.context=new AudioContext}catch(t){console.warn("AircraftAudio: Web Audio unavailable, aircraft stay silent:",t);return}}et.isLive(this.context)&&et.unlock(this.context),this.apply()}setLevel(t){this.level=t,this.master&&(this.master.gain.value=t)}setPaused(t){t!==this.paused&&(this.paused=t,this.apply())}setVoices(t,e=0){this.requested=t,this.headingDeg=e,this.apply()}dispose(){for(const t of[...this.voices.keys()])this.release(t);et.isLive(this.context)&&this.context.close(),this.context=void 0,this.master=void 0,this.bus=void 0}apply(){const t=this.context;if(!t)return;const e=this.paused?[]:this.requested,a=new Set(e.map(n=>n.id));for(const n of[...this.voices.keys()])a.has(n)||this.release(n);for(const n of e){const s=this.voices.get(n.id)??this.build(t,n);this.retarget(t,s,n)}}build(t,e){const a=t.createGain();a.gain.value=0;let n;const s=this.busOf(t);typeof t.createStereoPanner=="function"?(n=t.createStereoPanner(),a.connect(n).connect(s)):a.connect(s);const i=t.createGain(),o=e.character?.modulationDepth??0;i.gain.value=1-o/2;const r=t.createOscillator();r.type="sine";const l=t.createGain();l.gain.value=o/2,r.connect(l).connect(i.gain),i.connect(a);const c=t.createBufferSource();c.buffer=this.noise(t),c.loop=!0,c.loopStart=Math.random()*ct*.5;const u=[],d=[],h=[];for(const D of g.OCTAVES){const I=t.createBiquadFilter();I.type="bandpass",I.frequency.value=D,I.Q.value=ut;const H=t.createBiquadFilter();H.type="bandpass",H.frequency.value=D,H.Q.value=ut;const P=t.createGain();P.gain.value=0,c.connect(I).connect(H).connect(P).connect(i),u.push(I),d.push(H),h.push(P)}const p=[];for(const[D,I]of[[e.character?.toneHz,e.character?.toneShare],[e.character?.humHz,e.character?.humShare]])if(D!==void 0)for(let H=1;H<=Nt;H++){const P=t.createOscillator();P.type="sine",P.frequency.value=D*H;const tt=t.createGain();tt.gain.value=0,P.connect(tt).connect(a),p.push({oscillator:P,gain:tt,harmonic:H,baseHz:D,share:I??0})}const m=t.createGain();m.gain.value=0,m.connect(a.gain);const E=Mt.map(D=>{const I=t.createOscillator();return I.type="sine",I.frequency.value=D,I.connect(m),I}),O=t.createGain();O.gain.value=e.character?.roughness??lt;const B=t.createBufferSource();B.buffer=this.roughTable(t,Bt),B.loop=!0,B.loopStart=Math.random()*X*.5,B.connect(O).connect(i.gain);const v=t.createGain();v.gain.value=(e.character?.roughness??lt)*vt;const S=t.createBufferSource();S.buffer=this.roughTable(t,ht),S.loop=!0,S.loopStart=Math.random()*X*.5,S.connect(v).connect(i.gain);let F;const x=this.busOf(t)&&this.reverb;x&&(F=t.createGain(),F.gain.value=0,a.connect(F).connect(x));let L,_;if(!e.inside&&typeof t.createDelay=="function"){const D=t.createDelay(dt);D.delayTime.value=0;const I=t.createBiquadFilter();I.type="highshelf",I.frequency.value=Pt,I.gain.value=0;const H=t.createGain();H.gain.value=0,a.connect(D).connect(I).connect(H).connect(n??s);const P=t.createGain();P.gain.value=0,_=t.createBufferSource(),_.buffer=this.roughTable(t,ht),_.loop=!0,_.loopStart=Math.random()*X*.5,_.connect(P).connect(D.delayTime),L={delay:D,jitter:P,shelf:I,gain:H}}const k=[c,B,S,r,...p.map(D=>D.oscillator),...E,..._?[_]:[]];for(const D of k)D.start();const $={nodes:[a,i,l,O,v,m,...L?[L.delay,L.jitter,L.shelf,L.gain]:[],...p.map(D=>D.gain),...u,...d,...h,...F?[F]:[],...n?[n]:[],...k],sources:k,filters:u,seconds:d,gains:h,tones:p,lfo:r,lfoDepth:l,wander:E,wanderDepth:m,roughDepth:O,crackleDepth:v,beat:i,output:a,panner:n,send:F,echo:L};return this.voices.set(e.id,$),$}retarget(t,e,a){const n=t.currentTime,s=(p,m)=>p.setTargetAtTime(m,n,Rt),i=Math.min(Ht,Math.max(_t,a.dopplerRatio)),o=Math.min(yt,Math.max(wt,Math.sqrt(a.dopplerRatio))),r=t.sampleRate*.45,l=a.bandAmplitudes.map((p,m)=>p*Y.unweighting(g.OCTAVES[m])),c=Math.sqrt(l.reduce((p,m)=>p+m*m,0)),u=Math.min(1,Math.max(0,(a.distanceKm-mt)/(Lt-mt)));g.OCTAVES.forEach((p,m)=>{s(e.filters[m].frequency,Math.min(r,p*o)),s(e.seconds[m].frequency,Math.min(r,p*o)),s(e.gains[m].gain,l[m]*Math.sqrt(Vt/p))});const d=a.character;for(const{oscillator:p,gain:m,harmonic:E,baseHz:O,share:B}of e.tones){const v=O*E;s(p.frequency,v*i);const S=v*i;s(m.gain,S<r?B*Gt*l[Y.bandOf(S)]/E:0)}d?.modulationHz!==void 0&&s(e.lfo.frequency,d.modulationHz*i);const h=c>0?Y.saturated(c)/c:1;if(s(e.output.gain,h*(1-Wt*u)),s(e.wanderDepth.gain,h*jt*u/Mt.length),e.send&&s(e.send.gain,Y.reverbSend(a.distanceKm)),e.echo){const p=a.groundEcho;s(e.echo.gain.gain,p?.lowGain??0),p&&(s(e.echo.delay.delayTime,Math.min(dt,p.delayS)),s(e.echo.jitter.gain,p.jitterS),s(e.echo.shelf.gain,p.lowGain>0?Math.max(kt,20*Math.log10(Math.max(p.highGain,1e-6)/p.lowGain)):0))}if(e.panner){const p=(a.azimuthDeg-this.headingDeg)*Math.PI/180,m=a.inside?0:Math.max(-pt,Math.min(pt,Math.sin(p)))*(1-Ft*u);s(e.panner.pan,m)}}static saturated(t){const e=Xt*gt;if(t<=e)return t;const a=gt-e;return e+a*(1-Math.exp(-(t-e)/a))}static reverbSend(t){return Math.min(Ut,Math.sqrt(Math.max(0,t)/Kt))}static unweighting(t){return 10**(Math.min(Ct,Math.max(0,-g.aWeightingDb(t)))/20)}static bandOf(t){let e=0;return g.OCTAVES.forEach((a,n)=>{Math.abs(Math.log(t/a))<Math.abs(Math.log(t/g.OCTAVES[e]))&&(e=n)}),e}roughTable(t,e){const a=this.roughBuffers.get(e);if(a)return a;const n=Math.floor(t.sampleRate*X),s=t.createBuffer(1,n,t.sampleRate),i=s.getChannelData(0),o=Array.from({length:X*e},()=>(Math.random()*2-1)**3),r=t.sampleRate/e;for(let l=0;l<i.length;l++){const c=l/r,u=Math.floor(c),d=c-u,h=d*d*(3-2*d);i[l]=o[u%o.length]*(1-h)+o[(u+1)%o.length]*h}return this.roughBuffers.set(e,s),s}roomImpulse(t){const e=Math.floor(t.sampleRate*zt),a=t.createBuffer(2,e,t.sampleRate);for(let n=0;n<2;n++){const s=a.getChannelData(n);let i=0;for(let o=0;o<e;o++){const r=o/t.sampleRate,l=.6*Math.exp(-r/(At*2))+.04;i+=l*(Math.random()*2-1-i),s[o]=i*Math.exp(-r/At)}}return a}busOf(t){if(this.bus)return this.bus;const e=t.createGain();if(e.gain.value=this.level,e.connect(t.destination),this.master=e,typeof t.createConvolver=="function"){const a=t.createConvolver();a.buffer=this.roomImpulse(t);const n=t.createGain();n.gain.value=.9,a.connect(n),this.reverb=a,this.reverbOut=n}if(typeof t.createDynamicsCompressor=="function"){const a=t.createDynamicsCompressor();a.threshold.value=-6,a.knee.value=3,a.ratio.value=4,a.attack.value=.005,a.release.value=.25,a.connect(e),this.bus=a}else this.bus=e;return this.reverbOut?.connect(this.bus),this.bus}release(t){const e=this.voices.get(t);if(!e)return;this.voices.delete(t);const a=this.context;a&&(e.output.gain.setTargetAtTime(0,a.currentTime,rt/3),setTimeout(()=>{for(const n of e.sources)try{n.stop()}catch{}for(const n of e.nodes)n.disconnect()},rt*1e3*3))}noise(t){if(this.noiseBuffer)return this.noiseBuffer;const e=t.createBuffer(1,t.sampleRate*ct,t.sampleRate),a=e.getChannelData(0);for(let n=0;n<a.length;n++)a[n]=Math.random()*2-1;return this.noiseBuffer=e,e}}class U{static TYPES={A318:["Airbus A318","airliner-narrow",34.1,31.4],A319:["Airbus A319","airliner-narrow",34.1,33.8],A320:["Airbus A320","airliner-narrow",34.1,37.6],A321:["Airbus A321","airliner-narrow",34.1,44.5],A19N:["Airbus A319neo","airliner-narrow",35.8,33.8],A20N:["Airbus A320neo","airliner-narrow",35.8,37.6],A21N:["Airbus A321neo","airliner-narrow",35.8,44.5],B737:["Boeing 737-700","airliner-narrow",34.3,33.6],B738:["Boeing 737-800","airliner-narrow",35.8,39.5],B739:["Boeing 737-900","airliner-narrow",35.8,42.1],B38M:["Boeing 737 MAX 8","airliner-narrow",35.9,39.5],B39M:["Boeing 737 MAX 9","airliner-narrow",35.9,42.2],B752:["Boeing 757-200","airliner-narrow",38,47.3],B753:["Boeing 757-300","airliner-narrow",38,54.4],B762:["Boeing 767-200","airliner-wide",47.6,48.5],B763:["Boeing 767-300","airliner-wide",47.6,54.9],B764:["Boeing 767-400","airliner-wide",51.9,61.4],B772:["Boeing 777-200","airliner-wide",60.9,63.7],B77L:["Boeing 777-200LR","airliner-wide",64.8,63.7],B77W:["Boeing 777-300ER","airliner-wide",64.8,73.9],B788:["Boeing 787-8","airliner-wide",60.1,56.7],B789:["Boeing 787-9","airliner-wide",60.1,62.8],B78X:["Boeing 787-10","airliner-wide",60.1,68.3],B744:["Boeing 747-400","airliner-wide",64.4,70.7],B748:["Boeing 747-8","airliner-wide",68.4,76.3],A306:["Airbus A300-600","airliner-wide",44.8,54.1],A310:["Airbus A310","airliner-wide",43.9,46.7],A332:["Airbus A330-200","airliner-wide",60.3,58.8],A333:["Airbus A330-300","airliner-wide",60.3,63.7],A338:["Airbus A330-800","airliner-wide",64,58.8],A339:["Airbus A330-900","airliner-wide",64,63.7],A343:["Airbus A340-300","airliner-wide",60.3,63.7],A346:["Airbus A340-600","airliner-wide",63.5,75.4],A359:["Airbus A350-900","airliner-wide",64.8,66.8],A35K:["Airbus A350-1000","airliner-wide",64.8,73.8],A388:["Airbus A380-800","airliner-wide",79.8,72.7],CONC:["Concorde","airliner-supersonic",25.6,61.7],DC3:["Douglas DC-3","piston-heavy",29,19.7],DC4:["Douglas DC-4","piston-heavy",35.8,28.6],P51:["North American P-51 Mustang","piston-heavy",11.3,9.8],E170:["Embraer 170","regional-jet",26,29.9],E75L:["Embraer 175","regional-jet",26,31.7],E75S:["Embraer 175","regional-jet",26,31.7],E190:["Embraer 190","regional-jet",28.7,36.2],E195:["Embraer 195","regional-jet",28.7,38.7],E290:["Embraer 190-E2","regional-jet",33.7,36.2],E295:["Embraer 195-E2","regional-jet",33.7,41.5],CRJ2:["Bombardier CRJ200","regional-jet",21.2,26.8],CRJ7:["Bombardier CRJ700","regional-jet",23.2,32.3],CRJ9:["Bombardier CRJ900","regional-jet",24.9,36.2],CRJX:["Bombardier CRJ1000","regional-jet",26.2,39.1],AT72:["ATR 72","regional-turboprop",27.1,27.2],AT76:["ATR 72-600","regional-turboprop",27.1,27.2],AT45:["ATR 42","regional-turboprop",24.6,22.7],DH8D:["Dash 8 Q400","regional-turboprop",28.4,32.8],DH8C:["Dash 8-300","regional-turboprop",27.4,25.7],SF34:["Saab 340","regional-turboprop",21.4,19.7],B190:["Beechcraft 1900","regional-turboprop",17.7,17.6],C25A:["Cessna CitationJet CJ2","business-jet",14.3,14.4],C56X:["Cessna Citation Excel","business-jet",17.2,16],C68A:["Cessna Citation Latitude","business-jet",22,18.9],C550:["Cessna Citation II","business-jet",15.8,14.4],E55P:["Embraer Phenom 300","business-jet",15.9,15.6],E50P:["Embraer Phenom 100","business-jet",12.3,12.8],GLF5:["Gulfstream G550","business-jet",28.5,29.4],FA7X:["Dassault Falcon 7X","business-jet",26.2,23.4],CL60:["Bombardier Challenger 600","business-jet",19.6,20.9],LJ45:["Learjet 45","business-jet",14.6,17.7],H25B:["Hawker 800","business-jet",15.7,15.6],C172:["Cessna 172","light-piston",11,8.3],C152:["Cessna 152","light-piston",10.2,7.3],C182:["Cessna 182","light-piston",10.9,8.8],P28A:["Piper Cherokee","light-piston",10.7,7.2],PA34:["Piper Seneca","light-piston",11.8,8.7],SR20:["Cirrus SR20","light-piston",10.9,7.9],SR22:["Cirrus SR22","light-piston",11.7,7.9],S22T:["Cirrus SR22T","light-piston",11.7,7.9],DA40:["Diamond DA40","light-piston",11.6,8.1],DA42:["Diamond DA42","light-piston",13.4,8.6],BE20:["Beechcraft King Air 200","turboprop-light",16.6,13.3],BE58:["Beechcraft Baron","light-piston",11.5,9.1],C208:["Cessna Caravan","turboprop-light",15.9,11.5],PC12:["Pilatus PC-12","turboprop-light",16.3,14.4],TBM9:["Daher TBM 900","turboprop-light",12.8,10.7],EC35:["Airbus H135","helicopter-light",10.2,12.1],EC45:["Airbus H145","helicopter-medium",11,13.6],AS50:["Airbus H125","helicopter-light",10.7,12.9],EC30:["Airbus H130","helicopter-light",10.7,12.6],B407:["Bell 407","helicopter-light",10.7,12.7],B06:["Bell 206","helicopter-light",10.2,12],B429:["Bell 429","helicopter-medium",10.9,13],B505:["Bell 505","helicopter-light",10.4,11.9],R44:["Robinson R44","helicopter-light",10.1,11.7],R22:["Robinson R22","helicopter-light",7.7,8.8],A109:["Agusta A109","helicopter-medium",11,13],A139:["Leonardo AW139","helicopter-medium",13.8,16.7],S92:["Sikorsky S-92","helicopter-heavy",17.2,20.9],H60:["Sikorsky UH-60 Black Hawk","helicopter-heavy",16.4,19.8],T38:["Northrop T-38 Talon","military-jet",7.7,14.1],HAWK:["BAE Hawk","military-jet",9.4,11.9],GLID:["Glider","glider",17,7],BALL:["Balloon","balloon",15,20],ULAC:["Ultralight","ultralight",9.5,6],C42:["Ikarus C42","ultralight",9.4,6.3],DRON:["Drone","unmanned",1,.6]};static CATEGORIES={A1:["Light aircraft","light-piston",11,8.3],A2:["Small aircraft","business-jet",15,15],A3:["Large aircraft","airliner-narrow",34.1,37.6],A4:["High-vortex large aircraft","airliner-narrow",38,47.3],A5:["Heavy aircraft","airliner-wide",60.3,63.7],A6:["High-performance aircraft","military-jet",8,14],A7:["Rotorcraft","helicopter-medium",10.7,12.7],B1:["Glider","glider",17,7],B2:["Lighter-than-air","balloon",15,20],B4:["Ultralight","ultralight",9.5,6],B6:["Unmanned aircraft","unmanned",1.5,1]};static GENERIC={name:"Airliner",kind:"airliner-narrow",spanM:34.1,lengthM:37.6,basis:"nothing"};static of(t){const e=t?.type?.toUpperCase(),a=e?U.TYPES[e]:void 0;if(a)return{code:e,name:a[0],kind:a[1],spanM:a[2],lengthM:a[3],basis:"type"};const n=t?.category?U.CATEGORIES[t.category]:void 0;return n?{name:n[0],kind:n[1],spanM:n[2],lengthM:n[3],basis:"category"}:{...U.GENERIC}}static isHelicopter(t){return t.kind.startsWith("helicopter")}}class C{static DUSK_SUN_ELEVATION_DEG=-.83;static ALWAYS=new Set(["airliner-narrow","airliner-wide","airliner-supersonic","regional-turboprop","regional-jet","business-jet"]);static NONE=new Set(["glider","balloon"]);static BRIGHTNESS={"light-piston":[.5,.2,.5],"turboprop-light":[.7,.4,.8],ultralight:[.4,.2,.4],unmanned:[0,.05,0],"helicopter-light":[1,1,1],"helicopter-medium":[1,1,1],"helicopter-heavy":[1,1,1],"military-jet":[1,1,1]};static LANDING_LIGHTS_BELOW_FT=1e4;static LANDING_INTENSITY=600;static LANDING_BEAM_DEG=10;static LANDING_COLOR="#fff1dc";static LANDING_BRIGHTNESS={"airliner-narrow":1,"airliner-wide":1,"airliner-supersonic":1,"regional-jet":.6,"regional-turboprop":.6,"business-jet":.4,"turboprop-light":.2,"light-piston":.1,ultralight:.05,"helicopter-light":.1,"helicopter-medium":.2,"helicopter-heavy":.2};static lampsOn(t,e){if(C.NONE.has(t))return{navigation:!1,beacon:!1,strobes:!1};if(C.ALWAYS.has(t))return{navigation:!0,beacon:!0,strobes:!0};const a=e<C.DUSK_SUN_ELEVATION_DEG;return t==="unmanned"?{navigation:!1,beacon:!1,strobes:a}:{navigation:a,beacon:a,strobes:a}}static lights(t,e){const a=C.lampsOn(t.kind,e),n=t.kind.startsWith("helicopter"),s=It.find(h=>h.id===(n?"helicopter":"airliner")).create(),[i,o]=n?[5,7]:[17,18],r=t.spanM/2/i,l=t.lengthM/2/o,[c,u,d]=C.BRIGHTNESS[t.kind]??[1,1,1];return s.filter(h=>h.id.startsWith("nav")?a.navigation:h.id.startsWith("strobe")?a.strobes:h.id.startsWith("beacon")?a.beacon:!0).filter(h=>!(h.id.startsWith("beacon")&&!a.beacon)).map(h=>{const p=h.id.startsWith("nav")?c:h.id.startsWith("strobe")?u:d;return{...h,offsetM:{x:h.offsetM.x*r,y:h.offsetM.y,z:h.offsetM.z*l},intensity:(h.intensity??1)*p}}).filter(h=>(h.intensity??1)>0)}static landingLights(t,e,a){const n=C.LANDING_BRIGHTNESS[t.kind]??0;if(n===0||!C.lampsOn(t.kind,e).navigation)return[];const s=c=>c<C.LANDING_LIGHTS_BELOW_FT;if(!a.some(c=>s(c.altitudeFt)))return[];const i=C.LANDING_INTENSITY*n,o=a.flatMap((c,u)=>u>0&&s(c.altitudeFt)!==s(a[u-1].altitudeFt)?[{t:c.t,intensity:s(c.altitudeFt)?i:0}]:[]),r=t.spanM/34,l=t.lengthM/36;return[-1,1].map(c=>({id:c<0?"landing-left":"landing-right",offsetM:{x:c*5*r,y:-1,z:3*l},color:C.LANDING_COLOR,intensity:s(a[0].altitudeFt)?i:0,pattern:{kind:"steady"},beamDeg:C.LANDING_BEAM_DEG,keyframes:o}))}static bodyColor(t){return t.kind==="military-jet"?"#8a8e94":t.kind.startsWith("helicopter")?"#c8ccd1":t.kind==="unmanned"?"#2c2e33":"#dde0e4"}}class J{static FAMILIES={"amvlab-a320":["A318","A319","A320","A321","A19N","A20N","A21N"],"amvlab-b737":["B732","B733","B734","B735","B736","B737","B738","B739","B37M","B38M","B39M","B3XM"],"amvlab-a350":["A359","A35K"],"amvlab-a380":["A388"],"amvlab-b787":["B788","B789","B78X"]};static BY_TYPE=new Map(Object.entries(J.FAMILIES).flatMap(([t,e])=>e.map(a=>[a,t])));static idOf(t){return t?J.BY_TYPE.get(t.toUpperCase()):void 0}}class R{static ID_PREFIX=Z.ID_PREFIX;static MAX_OBJECTS=40;static FT_TO_M=.3048;static DEG=Math.PI/180;static from(t,e,a,n=R.MAX_OBJECTS,s={}){return new Yt(t,e,a,n,s).build()}static idOf(t,e){return Z.idOf(t,e)}static keyOf(t){return Z.keyOf(t)}static HEIGHT_OVER_LENGTH=.29;static sizeOf(t){return{widthM:t.spanM,lengthM:t.lengthM,heightM:t.lengthM*R.HEIGHT_OVER_LENGTH}}static offsetOf(t,e){const a=j.seenFrom(t,{lat:e.lat,lng:e.lng,heightM:e.altitudeFt*R.FT_TO_M}),n=a.distanceKm*1e3,s=n*Math.cos(a.altitudeDeg*R.DEG);return{eastM:s*Math.sin(a.azimuthDeg*R.DEG),northM:s*Math.cos(a.azimuthDeg*R.DEG),upM:n*Math.sin(a.altitudeDeg*R.DEG),altitudeDeg:a.altitudeDeg,distanceKm:a.distanceKm}}static segments(t){const e=[];let a=[];for(const n of t.points){const s=a[a.length-1];s&&n.t-s.t>N.MAX_GAP_S*1e3&&(e.push(a),a=[]),a.push(n)}return e.push(a),e.filter(n=>n.length>=2)}static bearingDeg(t,e){return(Math.atan2(e.eastM-t.eastM,e.northM-t.northM)/R.DEG+360)%360}}class Yt{constructor(t,e,a,n,s){this.tracks=t,this.observer=e,this.startMs=a,this.maxObjects=n,this.options=s}build(){const t=[];for(const a of this.tracks){const n=R.keyOf(a),s=this.options.models?.get(n)??U.of(void 0);R.segments(a).forEach((i,o)=>{const r=i.map(h=>({point:h,at:R.offsetOf(this.observer,h)}));if(!r.some(h=>h.at.altitudeDeg>=0))return;const l=r.map((h,p)=>({t:h.point.t-this.startMs,eastM:h.at.eastM,northM:h.at.northM,altitudeM:h.at.upM,headingDeg:h.point.trackDeg??(p+1<r.length?R.bearingDeg(h.at,r[p+1].at):R.bearingDeg(r[p-1].at,h.at))})),c=R.idOf(a,o),u=r[Math.floor(r.length/2)].point,d=this.options.sunElevationAt?.(u)??90;t.push({object:{id:c,kind:"aircraft",eastM:l[0].eastM,northM:l[0].northM,headingDeg:l[0].headingDeg,sizeM:R.sizeOf(s),model:J.idOf(s.code)?{id:J.idOf(s.code)}:void 0,color:C.bodyColor(s),lights:[...C.lights(s,d),...C.landingLights(s,d,i.map(h=>({t:h.t-this.startMs,altitudeFt:h.altitudeFt})))],track:l},presence:{fromMs:l[0].t,untilMs:l[l.length-1].t},flight:{icao:a.icao,nonIcao:a.nonIcao,points:i},closestKm:Math.min(...r.map(h=>h.at.distanceKm))})})}t.sort((a,n)=>a.closestKm-n.closestKm);const e=t.slice(0,this.maxObjects);return{objects:e.map(a=>a.object),presence:new Map(e.map(a=>[a.object.id,a.presence])),flights:new Map(e.map(a=>[a.object.id,a.flight])),total:t.length,shown:e.length}}}const qt=[[20,0],[120,0],[130,1.5],[140,4],[150,7.5],[160,7.5]],Jt=[[20,1.5],[40,1],[60,1],[80,0],[120,0],[130,1],[140,1],[150,-3],[160,-6.5],[170,-12]],bt=.16,xt=1,$t=[[0,-2],[10,-1],[20,0],[40,0],[50,-2],[60,-4.5],[70,-7.5],[80,-11],[90,-15],[100,-19.5],[110,-25]],Zt=[[60,-15.8],[70,-11.5],[80,-8],[90,-5],[100,-2.7],[110,-1.2],[120,-.3],[130,0],[140,-2],[150,-6],[160,-10],[170,-15],[180,-20]],Qt=1.5,Et=-40,te=1.5,ee={takeoff:{jetMps:300,flightMps:80,jetShare:[1,1,.9,.6,.3,.1,0,0]},overflight:{jetMps:280,flightMps:130,jetShare:[1,1,.9,.6,.3,.1,0,0]},approach:{jetMps:180,flightMps:70,jetShare:[.6,.5,.4,.2,.1,0,0,0]}};class w{static bandsDb(t,e,a=340){const n=ee[e],s=w.fan(t)-w.fan(90),i=.62*Math.max(0,n.jetMps-n.flightMps)/a,o=-30*Math.log10(1+i/(1+i**5)**.2*Math.cos(t*Math.PI/180));return g.OCTAVES.map((r,l)=>{const c=o+w.jetRemainder(t,r*te/n.jetMps),u=n.jetShare[l];return 10*Math.log10(u*10**(c/10)+(1-u)*10**(s/10))})}static loudestDb(t){const e=w.loudest.get(t);if(e)return e;const a=g.OCTAVES.map(()=>-1/0);for(let n=0;n<=180;n+=5)w.bandsDb(n,t).forEach((s,i)=>a[i]=Math.max(a[i],s));return w.loudest.set(t,a),a}static loudest=new Map;static angleDeg(t,e){const a=t.reduce((s,i,o)=>s+i*e[o],0),n=Math.hypot(...t)*Math.hypot(...e);return n===0?90:Math.acos(Math.min(1,Math.max(-1,a/n)))*180/Math.PI}static fan(t){const e=w.read($t,t,!0),a=w.read(Zt,t,!0)+Qt;return 10*Math.log10(10**(e/10)+10**(a/10))}static jetRemainder(t,e){const a=Math.min(1,Math.max(0,Math.log(e/bt)/Math.log(xt/bt)));return(1-a)*w.read(qt,t)+a*w.read(Jt,t)}static read(t,e,a=!1){const[n,s]=[t[0],t[1]],[i,o]=[t[t.length-2],t[t.length-1]];if(e<=n[0])return a?Math.max(Et,n[1]+(s[1]-n[1])/(s[0]-n[0])*(e-n[0])):n[1];if(e>=o[0])return a?Math.max(Et,o[1]+(o[1]-i[1])/(o[0]-i[0])*(e-o[0])):o[1];for(let r=1;r<t.length;r++){const[l,c]=[t[r-1],t[r]];if(e<=c[0])return l[1]+(c[1]-l[1])*(e-l[0])/(c[0]-l[0])}return o[1]}}class A{static GRASS={flowResistivityKPa:200,earHeightM:1.6};static COHERENCE=.4;static JITTER_S=1e-4;static ECHO_UNDER_S=5e-4;static ECHO_FROM_S=.0015;static LOW_HZ=125;static HIGH_HZ=2e3;static AIR_DENSITY=1.2;static reflection(t,e,a=A.GRASS){const[n,s]=A.impedance(t,a);return A.reflected(n,s,Math.sin(Math.max(0,e)*Math.PI/180))}static impedance(t,e=A.GRASS){const a=A.AIR_DENSITY*t/(e.flowResistivityKPa*1e3);return[1+.0571*a**-.754,-.087*a**-.732]}static reflected(t,e,a){const[n,s,i,o]=[t*a-1,e*a,t*a+1,e*a],r=i*i+o*o;return{re:(n*i+s*o)/r,im:(s*i-n*o)/r}}static delayS(t,e=A.GRASS,a=340){return 2*e.earHeightM*Math.sin(Math.max(0,t)*Math.PI/180)/a}static excessDb(t,e=A.GRASS,a=340){const n=`${e.flowResistivityKPa}|${e.earHeightM}|${a}`;let s=A.overheads.get(n);return s||A.overheads.set(n,s=A.bandsDb(90,e,a)),A.bandsDb(t,e,a).map((i,o)=>i-s[o])}static echo(t,e=A.GRASS,a=340){const n=A.delayS(t,e,a);if(n<=A.ECHO_UNDER_S)return;const s=Math.min(1,(n-A.ECHO_UNDER_S)/(A.ECHO_FROM_S-A.ECHO_UNDER_S)),i=s*s*(3-2*s),o=r=>{const l=A.reflection(r,t,e);return i*A.COHERENCE*Math.hypot(l.re,l.im)};return{delayS:n,lowGain:o(A.LOW_HZ),highGain:o(A.HIGH_HZ),jitterS:A.JITTER_S}}static overheads=new Map;static thirds=g.OCTAVES.map(t=>[-1,0,1].map(e=>{const a=t*2**(e/3);return{middle:a,from:a*2**(-1/6),to:a*2**(1/6)}}));static impedances=new Map;static bandsDb(t,e,a){const n=A.delayS(t,e,a),s=A.COHERENCE,i=Math.sin(Math.max(0,t)*Math.PI/180);let o=A.impedances.get(e.flowResistivityKPa);return o||A.impedances.set(e.flowResistivityKPa,o=A.thirds.map(r=>r.map(l=>A.impedance(l.middle,e)))),A.thirds.map((r,l)=>{let c=0;return r.forEach((u,d)=>{const h=A.reflected(o[l][d][0],o[l][d][1],i),p=2*Math.PI*n*(u.to-u.from),[m,E]=p<1e-9?[1,0]:[(Math.sin(2*Math.PI*u.to*n)-Math.sin(2*Math.PI*u.from*n))/p,(Math.cos(2*Math.PI*u.from*n)-Math.cos(2*Math.PI*u.to*n))/p];c+=1+h.re*h.re+h.im*h.im+2*s*(h.re*m+h.im*E)}),10*Math.log10(c/r.length)})}}const q={takeoff:{shapeDb:[10,3,-3,-2,-2,-2,5,4],levelDb:0},approach:{shapeDb:[0,0,0,0,0,0,0,0],levelDb:-8}},ae={takeoff:{shapeDb:[0,0,0,0,0,0,0,0],levelDb:0},approach:{shapeDb:[0,0,0,0,0,0,0,0],levelDb:-8}},Ot=[{id:"turbofan-narrow-body",name:"Turbofan airliner, narrow-body",kinds:["airliner-narrow"],totalDbA:148,shapeDb:[-32,-17,-9,-6,-5,-7,-12,-22],character:{toneHz:1800,toneShare:.3,humHz:90,humShare:.7},regimes:q},{id:"turbojet-supersonic",name:"Supersonic turbojet airliner",kinds:["airliner-supersonic"],totalDbA:169.5,shapeDb:[-22,-13,-9,-6,-6,-9,-15,-25],character:{humHz:100,humShare:.7},regimes:ae},{id:"turbofan-wide-body",name:"Turbofan airliner, wide-body",kinds:["airliner-wide"],totalDbA:151,shapeDb:[-28,-14,-7,-4,-3,-6,-12,-22],character:{toneHz:1200,toneShare:.3,humHz:70,humShare:.7},regimes:q},{id:"regional-jet",name:"Regional jet",kinds:["regional-jet"],totalDbA:144,shapeDb:[-32,-17,-9,-5,-4,-6,-11,-21],character:{toneHz:1900,toneShare:.3,humHz:95,humShare:.7},regimes:q},{id:"business-jet",name:"Business jet",kinds:["business-jet"],totalDbA:141,shapeDb:[-30,-15,-8,-4,-3,-4,-9,-19],character:{toneHz:2500,toneShare:.25,humHz:110,humShare:.7},regimes:q},{id:"turboprop",name:"Turboprop",kinds:["regional-turboprop","turboprop-light"],totalDbA:138,shapeDb:[-14,-9,-8,-6,-8,-13,-20,-28],character:{toneHz:80,toneShare:.5}},{id:"light-piston",name:"Light piston aircraft",kinds:["light-piston"],totalDbA:130,shapeDb:[-20,-10,-3,-6,-10,-20,-27,-42],character:{toneHz:80,toneShare:.4,modulationHz:80,modulationDepth:.4}},{id:"piston-heavy",name:"Heavy piston aircraft",kinds:["piston-heavy"],totalDbA:140,shapeDb:[-31,-12,-11,-9,-7,-6,-7,-11],character:{toneHz:84,toneShare:.4,modulationHz:84,modulationDepth:.36}},{id:"ultralight",name:"Ultralight",kinds:["ultralight"],totalDbA:124,shapeDb:[-16,-8,-5,-4,-9,-15,-23,-31],character:{toneHz:140,toneShare:.4}},{id:"helicopter-light",name:"Light helicopter",kinds:["helicopter-light"],totalDbA:134,shapeDb:[-15,-8,-4,-3,-6,-10,-16,-24],character:{modulationHz:20,modulationDepth:.5}},{id:"helicopter-medium",name:"Medium helicopter",kinds:["helicopter-medium"],totalDbA:138,shapeDb:[-14,-7,-4,-3,-6,-10,-16,-24],character:{modulationHz:22,modulationDepth:.5}},{id:"helicopter-heavy",name:"Heavy helicopter",kinds:["helicopter-heavy"],totalDbA:144,shapeDb:[-12,-6,-4,-4,-7,-11,-17,-25],character:{modulationHz:17,modulationDepth:.5}},{id:"military-jet",name:"Military jet",kinds:["military-jet"],totalDbA:152,shapeDb:[-26,-12,-6,-3,-2,-3,-7,-15]},{id:"glider",name:"Glider",kinds:["glider"],totalDbA:85,shapeDb:[-30,-22,-15,-10,-8,-8,-14,-22]},{id:"balloon",name:"Hot-air balloon",kinds:["balloon"],totalDbA:100,shapeDb:[-25,-15,-9,-5,-3,-6,-12,-20]},{id:"unmanned",name:"Unmanned aircraft",kinds:["unmanned"],totalDbA:88,shapeDb:[-40,-30,-20,-12,-6,-3,-3,-8],character:{toneHz:450,toneShare:1}}],ft=(b,t)=>b.map(e=>e+t-g.sumDb(b));function ne(b,t){if(!b)return;const e=t.toneRatio??1,a=t.toneGain??1;return{...b,...b.toneHz!==void 0?{toneHz:b.toneHz*e,toneShare:Math.min(1,(b.toneShare??0)*a)}:{},...b.humHz!==void 0?{humHz:b.humHz*e,humShare:Math.min(1,(b.humShare??0)*a)}:{}}}const St=Ot.map(b=>{const t=b.regimes===q?"turbofan":void 0,e={id:b.id,name:b.name,soundPowerA:ft(b.shapeDb,b.totalDbA),character:b.character,directivity:t};if(!b.regimes)return e;const a={overflight:e};for(const[n,s]of Object.entries(b.regimes))a[n]={id:`${b.id}-${n}`,name:`${b.name}, ${n}`,soundPowerA:ft(b.shapeDb.map((i,o)=>i+s.shapeDb[o]),b.totalDbA+s.levelDb),character:ne(b.character,s),directivity:t};return{...e,regimes:a}});class M{static DEFAULT_AMBIENT_DB_A=35;static DETECTION_MARGIN_DB=3;static AMBIENT_SHAPE_DB=Dt.OUTDOOR_SHAPE_DB;static HEARING_FLOOR_DB_A=0;static ITERATIONS=30;static CONVERGED_MS=.5;static VELOCITY_STEP_MS=500;static CLIMB_MPS=2.5;static DESCENT_MPS=1.5;static LOW_M=3e3;static CLIMB_SPAN_MS=3e4;static noiseOfKind(t){const e=Ot.find(a=>a.kinds.includes(t));return St.find(a=>a.id===(e?.id??"turbofan-narrow-body"))}static bandsAt(t,e,a=g.STANDARD){const n=20*Math.log10(Math.max(e*1e3,1))+11;return g.OCTAVES.map((s,i)=>t.soundPowerA[i]-n-g.absorptionDbPerKm(s,a)*e)}static couldBeHeard(t,e,a=M.DEFAULT_AMBIENT_DB_A,n=g.STANDARD,s){const i=M.ambientBands(a,s);return Object.entries(t.regimes??{overflight:t}).some(([r,l])=>M.bandsAt(l,e,n).map((c,u)=>c+(l.directivity==="turbofan"?w.loudestDb(r)[u]:0)).some((c,u)=>c>=Math.max(i[u]+M.DETECTION_MARGIN_DB,M.HEARING_FLOOR_DB_A)))}static ambientBands(t,e=M.AMBIENT_SHAPE_DB){const a=g.sumDb(e);return e.map(n=>t+n-a)}static heardAt(t,e,a,n={}){const s=n.air??g.STANDARD,i=g.speedOfSound(s.temperatureC),o=t.points[t.points.length-1]?.t;if(o===void 0)return;let r=Math.min(a,o),l=N.positionAt(t,r);if(!l)return;let c=j.seenFrom(e,l.geo);for(let _=0;_<M.ITERATIONS;_++){const k=a-c.distanceKm*1e3*1e3/i,$=Math.abs(k-r);if(r=k,l=N.positionAt(t,r),!l)return;if(c=j.seenFrom(e,l.geo),$<M.CONVERGED_MS)break}const u=N.positionAt(t,a),d=u?j.seenFrom(e,u.geo):c,h=M.regimeAt(t,r,e),p=M.inRegime(n.noise??St[0],h),m=n.ambientDbA??M.DEFAULT_AMBIENT_DB_A,E=M.ambientBands(m,n.ambientShapeDb),O=M.emissionAngle(t,e,r),B=p.directivity==="turbofan"?w.bandsDb(O,h,i):void 0,v=n.ground===null?g.OCTAVES.map(()=>0):A.excessDb(c.altitudeDeg,n.ground,i),S=M.bandsAt(p,c.distanceKm,s).map((_,k)=>_+(B?.[k]??0)+v[k]),F=S.map((_,k)=>_>=Math.max(E[k]+M.DETECTION_MARGIN_DB,M.HEARING_FLOOR_DB_A)),x=S.indexOf(Math.max(...S)),L=F.lastIndexOf(!0);return{track:t,audible:F.some(Boolean),levelDbA:g.sumDb(S),bandsDbA:S,ambientDbA:m,delayS:(a-r)/1e3,emittedAtMs:r,sound:c,seen:d,lagDeg:M.angleBetween(c,d),dopplerRatio:M.doppler(t,e,r,i),dominantHz:g.OCTAVES[x],cutoffHz:L<0?void 0:g.OCTAVES[L],regime:h,noise:p,emissionAngleDeg:O}}static emissionAngle(t,e,a){const n=M.VELOCITY_STEP_MS,s=N.positionAt(t,a-n),i=N.positionAt(t,a+n),o=N.positionAt(t,a);if(!s||!i||!o)return 90;const r=d=>{const h=j.seenFrom(e,d),p=h.altitudeDeg*Math.PI/180,m=h.azimuthDeg*Math.PI/180,E=h.distanceKm*1e3;return[E*Math.cos(p)*Math.sin(m),E*Math.cos(p)*Math.cos(m),E*Math.sin(p)]},[l,c,u]=[r(s.geo),r(i.geo),r(o.geo)];return w.angleDeg(c.map((d,h)=>d-l[h]),u.map(d=>-d))}static regimeAt(t,e,a){const n=M.CLIMB_SPAN_MS,s=N.positionAt(t,e-n)??N.positionAt(t,e),i=N.positionAt(t,e+n)??N.positionAt(t,e),o=N.positionAt(t,e);if(!s||!i||!o)return"overflight";const r=(Math.min(e+n,t.points[t.points.length-1].t)-Math.max(e-n,t.points[0].t))/1e3;if(r<=0)return"overflight";const l=(i.altitudeFt-s.altitudeFt)*.3048/r;return o.altitudeFt*.3048-a.heightM>M.LOW_M?"overflight":l>M.CLIMB_MPS?"takeoff":l<-1.5?"approach":"overflight"}static inRegime(t,e){return t.regimes?.[e]??t}static profile(t,e,a,n,s=2e3,i={}){const o=[];let r,l,c=a;for(let u=a;u<=n;u+=s){const d=M.heardAt(t,e,u,i);d&&(!l||d.levelDbA>l.levelDbA)&&(l=d,c=u),d?.audible?r?r.untilMs=u:o.push(r={fromMs:u,untilMs:u}):r=void 0}return{track:t,audible:o,peakDbA:l?.levelDbA??-1/0,peakAtMs:c,peakDelayS:l?.delayS??0}}static angleBetween(t,e){const a=c=>{const u=c.altitudeDeg*Math.PI/180,d=c.azimuthDeg*Math.PI/180;return[Math.cos(u)*Math.sin(d),Math.cos(u)*Math.cos(d),Math.sin(u)]},[n,s,i]=a(t),[o,r,l]=a(e);return Math.acos(Math.min(1,Math.max(-1,n*o+s*r+i*l)))*180/Math.PI}static doppler(t,e,a,n){const s=M.VELOCITY_STEP_MS,i=N.positionAt(t,a-s),o=N.positionAt(t,a+s);if(!i||!o)return 1;const r=j.seenFrom(e,i.geo).distanceKm*1e3,l=j.seenFrom(e,o.geo).distanceKm*1e3;return 1/(1-(r-l)/(2*s/1e3)/n)}}class pe{static at(t,e,a,n,s={}){const i=N.seenFrom(t,a,n);if(!i)return;const o=U.of(e),r=M.heardAt(t,a,n,{noise:M.noiseOfKind(o.kind),...s});return{hex:`${t.nonIcao?"~":""}${t.icao.toString(16).padStart(6,"0")}`,registration:e?.registration,typeCode:o.code??e?.type,name:o.basis==="nothing"?void 0:o.name,kind:o.kind,basis:o.basis,military:e?.military===!0,restricted:e?.restricted===!0,altitudeFt:i.altitudeFt,groundSpeedKt:i.groundSpeedKt,trackDeg:i.trackDeg,sky:i.sky,angularRateDegPerS:i.angularRateDegPerS,hearing:r&&{audible:r.audible,levelDbA:r.levelDbA,ambientDbA:r.ambientDbA,delayS:r.delayS,lagDeg:r.lagDeg,dopplerRatio:r.dopplerRatio,cutoffHz:r.cutoffHz,dominantHz:r.dominantHz}}}}class T{static REFERENCE_AMPLITUDE=.02;static MASKING_RANGE_DB=6;static KNEE_DB=20;static COMPRESSION_RATIO=1;static EXPANSION_RATIO=1.8;static HEADROOM_DB=Dt.HEADROOM_DB;static DEFAULT_MAX_VOICES=4;static candidates(t,e,a,n,s={}){const i=new Set;for(const[o,r]of t){const l=M.noiseOfKind(U.of(e.get(a(r))).kind);let c=1/0;for(const u of r.points)c=Math.min(c,j.seenFrom(n,{lat:u.lat,lng:u.lng,heightM:u.altitudeFt*.3048}).distanceKm);M.couldBeHeard(l,c,s.ambientDbA,s.air,s.ambientShapeDb)&&i.add(o)}return i}static voices(t,e,a,n,s,i,o={}){const r=[];for(const l of t){const c=e.get(l);if(!c||o.only?.(l)===!1)continue;const u=o.kindOf?.(l)??U.of(a.get(n(c))).kind,d=o.noiseOf?.(l)??M.noiseOfKind(u),h=M.heardAt(c,s,i,{...o,noise:d});if(!h?.audible)continue;const p=o.throughDb,m=p?h.bandsDbA.map((E,O)=>E-(p[O]??0)):h.bandsDbA;p&&!T.noticed(m,h.ambientDbA,o.ambientShapeDb)||r.push({id:l,kind:u,bandAmplitudes:T.bandAmplitudes(m,h.ambientDbA,o.referenceAmplitude,{ambientShapeDb:o.ambientShapeDb,expandUnderKnee:o.expandUnderKnee}),levelDbA:p?g.sumDb(m):h.levelDbA,distanceKm:h.sound.distanceKm,dopplerRatio:h.dopplerRatio,azimuthDeg:h.sound.azimuthDeg,elevationDeg:h.sound.altitudeDeg,character:h.noise.character,groundEcho:o.ground===null?void 0:A.echo(h.sound.altitudeDeg,o.ground,g.speedOfSound((o.air??g.STANDARD).temperatureC))})}return r.sort((l,c)=>c.levelDbA-l.levelDbA).slice(0,o.maxVoices??T.DEFAULT_MAX_VOICES)}static noticed(t,e,a){const n=M.ambientBands(e,a);return t.some((s,i)=>s>=n[i]+M.DETECTION_MARGIN_DB)}static bandAmplitudes(t,e,a=T.REFERENCE_AMPLITUDE,n={}){const s=M.ambientBands(e,n.ambientShapeDb),i=n.expandUnderKnee===!1?1:T.EXPANSION_RATIO,o=M.DETECTION_MARGIN_DB,r=g.sumDb(t),l=r-e,c=l>=T.KNEE_DB?T.KNEE_DB+(l-T.KNEE_DB)/T.COMPRESSION_RATIO:T.KNEE_DB-(T.KNEE_DB-l)*i,u=a*10**((c-T.HEADROOM_DB)/20);return t.map((d,h)=>{const p=Math.min(1,Math.max(0,(d-s[h]-o+T.MASKING_RANGE_DB)/(2*T.MASKING_RANGE_DB)));return p*p*(3-2*p)*u*10**((d-r)/20)})}static BANDS_HZ=g.OCTAVES}class Q{static RUMBLE_BELOW_HZ=500;static DULL_BELOW_HZ=2e3;static PITCH_NOTICED=.03;static text(t,e,a,n){const s=(d,h=0)=>d.toLocaleString(n,{maximumFractionDigits:h}),i=(d,h)=>d.replace(/\{(\w+)\}/g,(p,m)=>h[m]??`{${m}}`),o=[],r=[t.registration,t.name].filter(Boolean).join(" · ");o.push(r||i(e.unnamed,{hex:t.hex}));const l=[i(e.altitude,{value:s(Math.round(t.altitudeFt/100)*100)}),t.groundSpeedKt===void 0?void 0:i(e.speed,{value:s(Math.round(t.groundSpeedKt))}),t.trackDeg===void 0?void 0:i(e.heading,{value:s(Math.round(t.trackDeg))})].filter(Boolean);o.push(l.join(" · ")),o.push(i(e.position,{distance:s(t.sky.distanceKm,t.sky.distanceKm<10?1:0),elevation:s(Math.round(t.sky.altitudeDeg)),bearing:a(t.sky.azimuthDeg)}));const c=t.hearing;if(!c)o.push(e.soundUnknown);else if(!c.audible)o.push(i(e.inaudible,{level:s(Math.round(c.levelDbA)),ambient:s(Math.round(c.ambientDbA))}));else{const d=c.cutoffHz??0,h=d<=Q.RUMBLE_BELOW_HZ?e.rumble:d<=Q.DULL_BELOW_HZ?e.muffled:e.broad,p=c.dopplerRatio-1,m=Math.abs(p)<Q.PITCH_NOTICED?"":i(p>0?e.pitchHigher:e.pitchLower,{percent:s(Math.round(Math.abs(p)*100))});o.push(i(e.heard,{level:s(Math.round(c.levelDbA)),delay:s(Math.round(c.delayS)),lag:s(Math.round(c.lagDeg)),character:i(h,{cutoff:s(d)}),pitch:m}))}t.contrail&&o.push(i(t.contrail.persistent?e.contrailPersistent:e.contrailShort,{rhi:s(Math.round(t.contrail.iceRelativeHumidity*100))}));const u=[t.military?e.military:void 0,t.restricted?e.restricted:void 0].filter(Boolean);return u.length>0&&o.push(u.join(" · ")),o.push(e.candidate),o.join(`
2
+ `)}}class nt{static EFFICIENCY={"airliner-narrow":.34,"airliner-wide":.38,"regional-jet":.32,"business-jet":.3,"military-jet":.22,unknown:.34};static efficiencyOf(t){return nt.EFFICIENCY[t]}}class f{static EMISSION_INDEX_WATER=1.25;static COMBUSTION_HEAT=432e5;static AIR_HEAT_CAPACITY=1004;static MOLAR_MASS_RATIO=.622;static FT_TO_M=.3048;static TROPOPAUSE_M=11e3;static TROPOPAUSE_HPA=226.32;static ISOTHERMAL_SCALE_HEIGHT_M=6341.62;static pressureAtAltitudeFt(t){const e=t*f.FT_TO_M;return e<=f.TROPOPAUSE_M?1013.25*(1-225577e-10*e)**5.25588:f.TROPOPAUSE_HPA*Math.exp(-(e-f.TROPOPAUSE_M)/f.ISOTHERMAL_SCALE_HEIGHT_M)}static saturationOverWaterPa(t){const e=t+273.15;return Math.exp(54.842763-6763.22/e-4.21*Math.log(e)+367e-6*e+Math.tanh(.0415*(e-218.8))*(53.878-1331.22/e-9.44523*Math.log(e)+.014025*e))}static saturationOverIcePa(t){const e=t+273.15;return Math.exp(9.550426-5723.265/e+3.53068*Math.log(e)-.00728332*e)}static iceRelativeHumidity(t,e){return e*f.saturationOverWaterPa(t)/f.saturationOverIcePa(t)}static mixingSlope(t,e){return f.EMISSION_INDEX_WATER*f.AIR_HEAT_CAPACITY*t*100/(f.MOLAR_MASS_RATIO*f.COMBUSTION_HEAT*(1-e))}static criticalTemperatureC(t,e){const a=Math.log(f.mixingSlope(t,e)-.053);return-46.46+9.43*a+.72*a*a}static requiredHumidity(t,e,a){const n=f.criticalTemperatureC(t,e);return(f.mixingSlope(t,e)*(a-n)+f.saturationOverWaterPa(n))/f.saturationOverWaterPa(a)}static evaluate(t,e){const a=f.criticalTemperatureC(t.pressureHpa,e),n=f.requiredHumidity(t.pressureHpa,e,t.temperatureC),s=f.iceRelativeHumidity(t.temperatureC,t.relativeHumidity),i=t.temperatureC<a&&t.relativeHumidity>=n;return{forms:i,persistent:i&&s>=1,criticalTemperatureC:a,requiredHumidity:n,iceRelativeHumidity:s}}}class G{static HOLD_MS=36e5;static DEG=Math.PI/180;static GAS_CONSTANT_OVER_GRAVITY=287.05/9.80665;static at(t,e,a){if(t.length===0)return;const n=t[0],s=t[t.length-1];if(e<n.t-G.HOLD_MS||e>s.t+G.HOLD_MS)return;const i=t.findIndex(h=>h.t>e),o=i===0?t[0]:t[(i===-1?t.length:i)-1],r=i===-1||i===0?o:t[i],l=G.atLevel(o,a),c=G.atLevel(r,a);if(!l||!c)return;const u=r.t>o.t?Math.min(1,Math.max(0,(e-o.t)/(r.t-o.t))):0,d=(h,p)=>h+(p-h)*u;return{pressureHpa:a,temperatureC:d(l.temperatureC,c.temperatureC),relativeHumidity:d(l.relativeHumidity,c.relativeHumidity),driftEastMs:d(l.driftEastMs,c.driftEastMs),driftNorthMs:d(l.driftNorthMs,c.driftNorthMs),shearPerS:d(l.shearPerS,c.shearPerS)}}static atLevel(t,e){const a=t.levels;for(let n=0;n+1<a.length;n++){const s=a[n],i=a[n+1];if(e>s.pressureHpa||e<i.pressureHpa)continue;const o=(Math.log(s.pressureHpa)-Math.log(e))/(Math.log(s.pressureHpa)-Math.log(i.pressureHpa)),r=(h,p)=>h+(p-h)*o,l=h=>{const p=h.windFromDeg*G.DEG;return{east:-h.windSpeedMs*Math.sin(p),north:-h.windSpeedMs*Math.cos(p)}},c=l(s),u=l(i),d=G.GAS_CONSTANT_OVER_GRAVITY*((s.temperatureC+i.temperatureC)/2+273.15)*Math.log(s.pressureHpa/i.pressureHpa);return{pressureHpa:e,temperatureC:r(s.temperatureC,i.temperatureC),relativeHumidity:r(s.relativeHumidity,i.relativeHumidity),driftEastMs:r(c.east,u.east),driftNorthMs:r(c.north,u.north),shearPerS:Math.hypot(u.east-c.east,u.north-c.north)/d}}}}class K{static MIN_ALTITUDE_FT=2e4;static DENSE_MS=3e5;static SPARSE_STEP_MS=6e4;static SATURATION_HORIZON_MS=3*36e5;static SATURATION_STEP_MS=6e5;static PRESSURE_STEP_HPA=5;static plan(t,e,a,n){if(a.length===0)return[];const s=[],i=new Map,o=(r,l,c)=>{const u=Math.round(l/K.PRESSURE_STEP_HPA)*K.PRESSURE_STEP_HPA,d=K.SATURATION_STEP_MS,h=Math.floor(r/d)*d,p=`${u}|${h}`,m=i.get(p);if(m!==void 0)return m+(h-r)/1e3;let E=1/0;for(let O=d;O<=K.SATURATION_HORIZON_MS;O+=d){const B=G.at(a,h+O,u);if(!B)break;if(f.evaluate(B,c).iceRelativeHumidity<1){E=O/1e3;break}}return i.set(p,E),E+(h-r)/1e3};for(const r of t.objects){const l=t.flights.get(r.id),c=r.track;if(!l||!c||c.length!==l.points.length)continue;const u=e?.get(Z.keyOf(l))??U.of(void 0),d=nt.efficiencyOf(u.kind);if(d===void 0)continue;const h=[];let p=-1/0;c.forEach((m,E)=>{if(m.t<-K.DENSE_MS&&E+1<c.length&&m.t-p<K.SPARSE_STEP_MS)return;p=m.t;const O=l.points[E],B=f.pressureAtAltitudeFt(O.altitudeFt),v=G.at(a,n+m.t,B),S=v&&f.evaluate(v,d);h.push({tMs:m.t,eastM:m.eastM,northM:m.northM,upM:m.altitudeM??0,forms:S?.forms??!1,persistent:S?.persistent??!1,lifetimeS:S?ot.lifetimeS(S.iceRelativeHumidity):0,driftEastMs:v?.driftEastMs??0,driftNorthMs:v?.driftNorthMs??0,shearPerS:v?.shearPerS??ot.TYPICAL_SHEAR_PER_S,iceRelativeHumidity:S?.iceRelativeHumidity??0,saturatedForS:S?.persistent?o(n+m.t,B,d):0})}),h.some((m,E)=>m.forms&&h[E+1]?.forms)&&s.push({id:r.id,spanM:u.spanM,points:h})}return s}}class y{static DEFAULT_KIND=V.DEFAULT_KIND;static STEP_MS=1e3;static LEAD_MS=12e4;static FT_PER_M=1/.3048;static ID_PREFIX="decor:";tracks=new Map;static kindOf(t,e){return V.kindOf(t,e)}static flies(t){return V.flies(t)}static ridden(t,e,a,n=()=>{}){const s=st.originOf(t);if(s)for(const i of t.decor){const o=V.kindOf(i,n(i));if(!o)continue;const r=i.sizeM,l=Math.max(r?.widthM??0,r?.lengthM??0,r?.heightM??0)/2;if(l<=0)continue;const c=y.pointAt(i,e,s),{distanceKm:u}=j.seenFrom(a,{lat:c.lat,lng:c.lng,heightM:c.altitudeFt/y.FT_PER_M});if(u*1e3<=l)return{decor:i,kind:o}}}voices(t,e,a,n={},s=()=>{}){const i=st.originOf(t);if(!i)return[];const o=new Map,r=new Map,l=Math.max(t.observerTrack.duration,(t.event.durationSeconds??0)*1e3),c=y.ridden(t,e,a,s)?.decor;for(const u of t.decor){const d=u===c?void 0:V.kindOf(u,s(u));if(!d)continue;const h=`${y.ID_PREFIX}${u.id}`;o.set(h,this.trackOf(u,h,i,l)),r.set(h,d)}for(const u of this.tracks.keys())o.has(u)||this.tracks.delete(u);return o.size===0?[]:T.voices(new Set(o.keys()),o,new Map,u=>String(u.icao),a,e,{...n,kindOf:u=>r.get(u)})}trackOf(t,e,a,n){const s=JSON.stringify([t.track,t.eastM,t.northM,t.headingDeg,a.lat,a.lng,n]),i=this.tracks.get(e);if(i?.key===s)return i.track;const o=[];for(let d=0;d<=n;d+=y.STEP_MS)o.push(y.pointAt(t,d,a));(o.length===0||o[o.length-1].t<n)&&o.push(y.pointAt(t,n,a));const r=o[0],l=o[1]??r,c=d=>(l[d]-r[d])/(l.t-r.t||1);for(let d=y.STEP_MS*10;d<=y.LEAD_MS;d+=y.STEP_MS*10)o.unshift({t:-d,lat:r.lat-c("lat")*d,lng:r.lng-c("lng")*d,altitudeFt:Math.max(0,r.altitudeFt-c("altitudeFt")*d)});const u={icao:y.hash(e),nonIcao:!0,points:o};return this.tracks.set(e,{key:s,track:u}),u}static pointAt(t,e,a){const n=Tt(t,e),s=at(n.eastM,-n.northM,a.lat,a.lng);return{t:e,lat:s.lat,lng:s.lng,altitudeFt:n.altitudeM*y.FT_PER_M}}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}class z{static CABIN_DB_A={"airliner-wide":76,"airliner-narrow":78,"regional-jet":78,"business-jet":82,"regional-turboprop":84,"turboprop-light":88,"light-piston":92,"piston-heavy":90,"military-jet":95,ultralight:95,"helicopter-light":95,"helicopter-medium":96,"helicopter-heavy":98,glider:70,balloon:60};static JET_CABINS=["airliner-narrow","airliner-wide","airliner-supersonic","regional-jet","business-jet"];static JET_CABIN_SHAPE_DB=[-3,-4,-13,-24,-33,-36,-42,-55];static DEFAULT_DB_A=78;static voice(t,e={}){const a=it.aircraftOf(t);if(!a)return;const n=M.noiseOfKind(a),s=it.insulationDb(t),i=z.JET_CABINS.includes(a)&&t?.windowsOpen!==!0?z.JET_CABIN_SHAPE_DB.map((c,u)=>c+g.aWeightingDb(g.OCTAVES[u])):n.soundPowerA.map((c,u)=>c-s[u]),o=g.sumDb(i),r=z.levelDbA(a,t?.noise),l=i.map(c=>c-o+r);return{id:"observer:cabin",kind:a,bandAmplitudes:T.bandAmplitudes(l,e.ambientDbA??0,e.referenceAmplitude,{ambientShapeDb:e.ambientShapeDb,expandUnderKnee:e.expandUnderKnee}),levelDbA:r,inside:!0,distanceKm:0,dopplerRatio:1,azimuthDeg:0,elevationDeg:0,character:n.character}}static levelDbA(t,e){return(z.CABIN_DB_A[t]??z.DEFAULT_DB_A)+20*Math.log10(Math.max(e??1,.01))}}class W{static STEP_MS=250;static FT_PER_M=1/.3048;static ID_PREFIX="body:";tracks=new Map;static noiseOf(t){const e=M.noiseOfKind(t.kind),a=t.quieterDb??0;return a===0?e:{...e,id:`${e.id}-${a}dB`,soundPowerA:e.soundPowerA.map(n=>n-a)}}voices(t,e,a,n,s,i,o={}){const r=new Map,l=new Map,c=new Map;for(const d of t){if(!d.sound)continue;const h=`${W.ID_PREFIX}${d.id}`,p=this.trackOf(d,h,e,n,i);p&&(r.set(h,p),l.set(h,d.sound.kind),c.set(h,W.noiseOf(d.sound)))}for(const d of this.tracks.keys())r.has(d)||this.tracks.delete(d);if(r.size===0)return[];const u=at(a.eastM,-a.northM,n.lat,n.lng);return T.voices(new Set(r.keys()),r,new Map,d=>String(d.icao),{lat:u.lat,lng:u.lng,heightM:a.upM},s,{...o,kindOf:d=>l.get(d),noiseOf:d=>c.get(d)})}trackOf(t,e,a,n,s){const i=`${n.lat},${n.lng},${s}`,o=this.tracks.get(e);if(o&&o.body===t&&o.origin===i)return o.track;const r=[];for(let c=-12e4;c<=s;c+=W.STEP_MS){const u=a(t,c);if(!u)continue;const d=at(u.eastM,-u.northM,n.lat,n.lng);r.push({t:c,lat:d.lat,lng:d.lng,altitudeFt:u.upM*W.FT_PER_M})}if(r.length<2)return;const l={icao:W.hash(e),nonIcao:!0,points:r};return this.tracks.set(e,{body:t,origin:i,track:l}),l}static hash(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)>>>0;return e}}export{Y as AircraftAudio,K as AircraftContrails,U as AircraftModels,Dt as AmbientNoise,W as BodyHearing,z as CabinHearing,y as DecorAircraftHearing,R as TrafficDecor,pe as TrafficInfos,T as TrafficSound,Q as TrafficTooltip,Ae as UPPER_AIR_SOURCES};
@@ -0,0 +1 @@
1
+ import{e as m}from"./rr0-ufoathome.mjs";const f=[500,400,300,250,200,150],w=["temperature","relative_humidity","wind_speed","wind_direction"],y="2022-01-01",_=.25;class S{fetchImpl;baseUrl;cache=new Map;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.baseUrl=t.baseUrl??"https://historical-forecast-api.open-meteo.com/v1/forecast"}between(t,n,r){const o=new Date(n).toISOString().slice(0,10);if(o<y)return Promise.resolve({status:"outside"});const i=new Date(r).toISOString().slice(0,10),s=`${`${Math.round(t.lat/_)},${Math.round(t.lng/_)}`}|${o}|${i}`;let e=this.cache.get(s);return e||(e=this.read(t,o,i),this.cache.set(s,e),e.then(a=>{a.status==="failed"&&this.cache.delete(s)})),e}async read(t,n,r){const o=f.flatMap(s=>w.map(e=>`${e}_${s}hPa`)),i=new URLSearchParams({latitude:String(t.lat),longitude:String(t.lng),start_date:n,end_date:r,hourly:o.join(","),wind_speed_unit:"ms",timezone:"UTC"}),c=`${this.baseUrl}?${i}`;try{const s=await this.fetchImpl(c);if(!s.ok)return{status:"failed"};const e=await s.json();return this.decode(e,{id:"open-meteo-forecast",name:"Open-Meteo (historical forecast)",url:c})}catch{return{status:"failed"}}}decode(t,n){const r=t.hourly;if(!r?.time)return{status:"outside"};const o=[];return r.time.forEach((i,c)=>{const s=[];for(const e of f){const a=d=>r[`${d}_${e}hPa`]?.[c],l=a("temperature"),h=a("relative_humidity"),u=a("wind_speed"),p=a("wind_direction");if([l,h,u,p].some(d=>d==null))return;s.push({pressureHpa:e,temperatureC:l,relativeHumidity:h/100,windSpeedMs:u,windFromDeg:p})}o.push({t:Date.parse(`${i}Z`),levels:s})}),o.length>0?{status:"found",samples:o,source:n}:{status:"outside"}}}const U=m.point("upperAir").provide(m.BUILT_IN,[{id:"open-meteo-forecast",name:"Open-Meteo (historical forecast)",credit:"Weather data by Open-Meteo.com, CC BY 4.0",creditUrl:"https://open-meteo.com/en/docs/historical-forecast-api",create:()=>new S}]);export{U};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rr0/ufoathome",
3
3
  "type": "module",
4
- "version": "0.192.1",
4
+ "version": "0.193.0",
5
5
  "description": "UFO@home — record and replay a UFO sighting's shape, movement and appearance",
6
6
  "author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
7
7
  "license": "MIT",
@@ -17,13 +17,15 @@
17
17
  "./scene": "./dist-embed-scene/rr0-scene.mjs",
18
18
  "./sighting": "./dist-embed-sighting/rr0-sighting.mjs",
19
19
  "./editor": "./dist-embed-sighting-editor/rr0-sighting-editor.mjs",
20
- "./interview": "./dist-embed-interview/rr0-interview.mjs"
20
+ "./interview": "./dist-embed-interview/rr0-interview.mjs",
21
+ "./app": "./dist-embed-ufoathome/rr0-ufoathome.mjs"
21
22
  },
22
23
  "files": [
23
24
  "dist-embed-scene",
24
25
  "dist-embed-sighting",
25
26
  "dist-embed-sighting-editor",
26
- "dist-embed-interview"
27
+ "dist-embed-interview",
28
+ "dist-embed-ufoathome"
27
29
  ],
28
30
  "scripts": {
29
31
  "predev": "npm run build:schema",
@@ -33,13 +35,14 @@
33
35
  "build:embed-scene": "tsc --noEmit && vite build --config vite.embed-scene.config.ts",
34
36
  "build:embed-sighting": "tsc --noEmit && vite build --config vite.embed-sighting.config.ts",
35
37
  "build:embed-interview": "vite build --config vite.embed-interview.config.ts",
36
- "build:all": "npm run build:schema && npm run build && npm run build:embed-sighting-editor && npm run build:embed-scene && npm run build:embed-sighting && npm run build:embed-interview",
37
- "build:site": "npm run build:schema && npm run build:embed-sighting-editor && npm run build:embed-scene && npm run build:embed-sighting && npm run build:embed-interview && vite build --config vite.site.config.ts && tsx site/build.ts",
38
+ "build:embed-ufoathome": "vite build --config vite.embed-ufoathome.config.ts",
39
+ "build:all": "npm run build:schema && npm run build && npm run build:embed-sighting-editor && npm run build:embed-scene && npm run build:embed-sighting && npm run build:embed-interview && npm run build:embed-ufoathome",
40
+ "build:site": "npm run build:schema && npm run build:embed-sighting-editor && npm run build:embed-scene && npm run build:embed-sighting && npm run build:embed-interview && npm run build:embed-ufoathome && vite build --config vite.site.config.ts && tsx site/build.ts",
38
41
  "site": "tsx site/build.ts",
39
42
  "site:watch": "node --watch-path=./site --watch-path=./public/demo-data --import tsx site/build.ts",
40
43
  "deploy:site": "npm run build:site && npx netlify deploy --prod --dir dist-site --no-build --site 90e69d49-ac43-433a-9829-3cb861a623ef",
41
44
  "site:serve": "vite preview --outDir dist-site --port 5181 --strictPort",
42
- "prepublishOnly": "npm run build:schema && npm run build:embed-sighting-editor && npm run build:embed-scene && npm run build:embed-sighting && npm run build:embed-interview && npm test",
45
+ "prepublishOnly": "npm run build:schema && npm run build:embed-sighting-editor && npm run build:embed-scene && npm run build:embed-sighting && npm run build:embed-interview && npm run build:embed-ufoathome && npm test",
43
46
  "preview": "vite preview",
44
47
  "test": "vitest run",
45
48
  "test:watch": "vitest",
@@ -1,16 +0,0 @@
1
- import{o as k,_ as c,aF as u,aC as y,a1 as O,a3 as x,a2 as T,c as w,$ as M,a0 as I,a4 as F,a5 as A}from"./rr0-sighting-editor.mjs";import{S}from"./SkyEventEditorStyle-CvY_AhbI.js";import{B as v,a as m,F as E}from"./BirdFlock-DtshFXGT.js";const L=k.catalog({en:()=>c(()=>import("./BirdParameterTexts_en-C6FkYUww.js"),[],import.meta.url).then(l=>l.birdParameterTexts_en),fr:()=>c(()=>import("./BirdParameterTexts_fr-BiTR-olu.js"),[],import.meta.url).then(l=>l.birdParameterTexts_fr),es:()=>c(()=>import("./BirdParameterTexts_es-T8JyeNlI.js"),[],import.meta.url).then(l=>l.birdParameterTexts_es),it:()=>c(()=>import("./BirdParameterTexts_it-oQY4DX6B.js"),[],import.meta.url).then(l=>l.birdParameterTexts_it)});class n{static FLOCK="flock";static FORMATION="formation";static FLIGHT="flight";static LOOK="look";static speciesOf(t){return v.speciesOf(t)}static speciesLabel(t){return t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}static formationOf(t){const e=u.read(t,"formation.kind");return typeof e=="string"?e:n.formationUnstated(t)}static formationUnstated(t){return(u.read(t,"count")??1)>1?"cluster":"single"}static flightOf(t){const e=u.read(t,"flight.kind");return typeof e=="string"?e:n.speciesOf(t).flight.kind}static burstOf(t,e){const i=u.read(t,`flight.${e}`);if(typeof i=="number")return i;const s=n.speciesOf(t).flight;return s.kind==="flapping"?n.BURST[e]:s[e]}static BURST={beats:4,glideS:2};static colour(t,e,i){return{type:"colour",key:`colours.${t}`,group:n.LOOK,label:e,...i?{hint:i}:{},effective:s=>m.colourOf(n.speciesOf(s),t)}}static SET={kind:"birds",title:"birds",parameters:[{type:"said",key:"title",label:"name",group:n.FLOCK},{type:"choice",key:"species",required:!0,group:n.FLOCK,label:"species",choices:m.ALL.map(t=>({value:t.id,label:n.speciesLabel(t.id)}))},{type:"number",key:"count",min:1,max:2e3,step:1,group:n.FLOCK,effective:()=>1,label:"howMany"},{type:"set",key:"explains",group:n.FLOCK,label:"standForTheShapes",hint:"theWholeFlockTakenForOne",visibleWhen:t=>t.explainsEach===void 0,options:(t,e)=>{const i=e?.shapes??[],s=(t.explains??[]).filter(o=>!i.some(a=>a.value===o));return[...i,...s.map(o=>({value:o,label:o}))]},empty:"noShape"},{type:"number",key:"seed",min:0,max:4294967295,step:1,group:n.FLOCK,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFrom"},{type:"choice",key:"formation.kind",group:n.FORMATION,label:"pattern",effective:t=>n.formationUnstated(t),choices:[{value:"single",label:"oneBird"},{value:"v",label:"inAV"},{value:"j",label:"inAJ"},{value:"echelon",label:"inEchelon"},{value:"column",label:"inAColumn"},{value:"front",label:"abreast"},{value:"cluster",label:"aLooseCrowd"},{value:"flock",label:"aFlockThatFliesItself"}]},{type:"number",key:"formation.angleDeg",min:5,max:180,step:1,unit:"°",group:n.FORMATION,effective:()=>70,label:"angleBetweenTheArms",hint:"aGooseVMeasures",visibleWhen:t=>["v","j"].includes(n.formationOf(t))},{type:"number",key:"formation.asymmetry",min:0,max:100,step:5,unit:"%",scale:100,group:n.FORMATION,effective:()=>.7,label:"onTheRightArm",visibleWhen:t=>n.formationOf(t)==="j"},{type:"number",key:"formation.spacing",min:.2,max:20,step:.1,group:n.FORMATION,effective:t=>["v","j","echelon","column"].includes(n.formationOf(t))?1:1.5,label:"spacingInWingspans",hint:"betweenNeighbours",visibleWhen:t=>n.formationOf(t)!=="single"},{type:"number",key:"formation.wander",min:0,max:5,step:.05,group:n.FORMATION,effective:t=>["v","j","echelon","column"].includes(n.formationOf(t))?.15:.4,label:"strayInWingspans",hint:"howMuchEachBirdStrays",visibleWhen:t=>!["single","flock"].includes(n.formationOf(t))},{type:"number",key:"formation.informed",min:0,max:100,step:1,unit:"%",scale:100,group:n.FORMATION,effective:()=>E.INFORMED_SHARE,label:"informed",hint:"aFewKnowWhereTheFlockIsGoing",visibleWhen:t=>n.formationOf(t)==="flock"},{type:"number",key:"wingbeatHz",min:.5,max:30,step:.01,unit:"Hz",group:n.FLIGHT,effective:t=>{const e=t,i=v.pathOf(e)[0]?.upM??0;return Math.round(m.wingbeatHz(n.speciesOf(t),m.airDensityAt((e.originElevationM??0)+i))*100)/100},label:"wingbeat",hint:"predictedFromItsSpecies"},{type:"choice",key:"flight.kind",group:n.FLIGHT,label:"howTheyFly",effective:t=>n.speciesOf(t).flight.kind,choices:[{value:"flapping",label:"flappingAllTheTime"},{value:"bursts",label:"inBurstsAndGlides"},{value:"path",label:"asTheirPathAsks"}]},{type:"number",key:"flight.beats",min:1,max:50,step:1,group:n.FLIGHT,label:"wingbeatsABurst",effective:t=>n.burstOf(t,"beats"),visibleWhen:t=>n.flightOf(t)!=="flapping"},{type:"number",key:"flight.glideS",min:0,max:60,step:.1,unit:"s",group:n.FLIGHT,label:"glideBetween",effective:t=>n.burstOf(t,"glideS"),visibleWhen:t=>n.flightOf(t)!=="flapping"},{type:"number",key:"originElevationM",min:-500,max:6e3,step:1,unit:"m",group:n.FLIGHT,effective:()=>0,label:"thePlaceSGroundAboveTheSea",hint:"whatSetsHowThinTheAir"},n.colour("upperColor","upperSide","theBackAndTheUpperSide"),n.colour("underColor","underSide","theBellyAndTheUnderSide"),n.colour("tipColor","wingTips"),n.colour("headColor","head"),n.colour("neckColor","neck"),n.colour("billColor","bill"),{type:"number",key:"lightFromBelow.lux",min:0,max:1e4,step:.1,unit:"lx",group:n.LOOK,effective:()=>0,label:"litFromBelow",hint:"theLampsOfATown"},{type:"colour",key:"lightFromBelow.color",group:n.LOOK,fallback:"#ffd7a0",label:"lightFromBelowColour",visibleWhen:t=>typeof u.read(t,"lightFromBelow.lux")=="number"}]};static angular(t){return typeof t.azimuthDeg=="number"}static WAYPOINT={kind:"birds-waypoint",title:"pointOfThePath",parameters:[{type:"number",key:"t",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecording"},{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:1,rangeM:1e5,label:"position",visibleWhen:t=>!n.angular(t)},{type:"number",key:"altitudeM",min:-500,max:1e4,step:.1,unit:"m",required:!0,label:"height",hint:"aboveTheGroundOfThePlace",visibleWhen:t=>!n.angular(t)},{type:"number",key:"azimuthDeg",min:0,max:360,step:.1,unit:"°",required:!0,label:"azimuth",visibleWhen:t=>n.angular(t)},{type:"number",key:"altitudeDeg",min:-90,max:90,step:.1,unit:"°",required:!0,label:"elevation",visibleWhen:t=>n.angular(t)},{type:"number",key:"distanceM",min:0,max:1e5,step:1,unit:"m",required:!0,label:"distance",visibleWhen:t=>n.angular(t)},{type:"number",key:"eyeHeightM",min:0,max:1e4,step:.1,unit:"m",effective:()=>1.6,label:"eyeHeight",visibleWhen:t=>n.angular(t)}]};static waypointAt(t,e){const i=v.pathOf(t),s=g=>Math.round(g*10)/10;if(i.length===0)return{t:e,eastM:0,northM:0,altitudeM:0};const o=i.findIndex(g=>g.t>=e),[a,r]=o<=0?[i[Math.max(o,0)],i[Math.max(o,0)]]:[i[o-1],i[o]],h=o<0?i[i.length-1]:void 0,p=h||r.t===a.t?0:(e-a.t)/(r.t-a.t),d=h??a,b=h??r;return{t:Math.round(e),eastM:s(d.eastM+(b.eastM-d.eastM)*p),northM:s(d.northM+(b.northM-d.northM)*p),altitudeM:s(d.upM+(b.upM-d.upM)*p)}}static publish(){y.publish(n.SET),y.publish(n.WAYPOINT)}}const R=k.catalog({en:()=>c(()=>import("./BirdEditorMessages_en-CN1OJud9.js"),[],import.meta.url).then(l=>l.birdEditorMessages_en),fr:()=>c(()=>import("./BirdEditorMessages_fr-hL72V8wm.js"),[],import.meta.url).then(l=>l.birdEditorMessages_fr),es:()=>c(()=>import("./BirdEditorMessages_es-DDEnjRrz.js"),[],import.meta.url).then(l=>l.birdEditorMessages_es),it:()=>c(()=>import("./BirdEditorMessages_it-BmLyiPYp.js"),[],import.meta.url).then(l=>l.birdEditorMessages_it)});class f{constructor(t,e,i){this.container=t,this.host=e,S.attach(t,"bird-editor-part",f.STYLE),this.language=i,y.of("birds")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;pointForm;pointIndex=0;language;shown=[];static STYLE='.bird-editor-part { flex-basis: 100%; min-width: 0; } .bird-editor-part #bird-list, .bird-editor-part #bird-timeline { flex-basis: 100%; min-width: 0; } .bird-editor-part #bird-timeline { padding: 4px 0; } .bird-editor-part #bird-path > .icon-btn { align-self: flex-end; } .bird-editor-part .launch-editor, .bird-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .bird-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .bird-editor-part [hidden] { display: none !important; } .bird-editor-part select { min-width: 0; width: 100%; } .bird-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .bird-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .bird-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; } .bird-editor-part input, .bird-editor-part select { max-width: 100%; box-sizing: border-box; } .bird-editor-part input[type="text"] { width: 12em; } .bird-editor-part label { min-width: 0; max-width: 100%; } .bird-editor-part input.parameter-derived::placeholder { opacity: .65; } .bird-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; }';static PATH_COLOR="#3b82c4";async setLanguage(t){const e=++this.languageToken;this.language=t;const[i,s]=await Promise.all([R.load(t),L.load(t)]);e===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flocks;this.shown=[...t],t.some(s=>s.id===this.currentId)||(this.currentId=t[0]?.id),this.list?.setItems(t.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const e=this.current;if(this.element("bird-fields").hidden=e===void 0,!e)return;const i=this.element("bird-each");i.hidden=e.explainsEach===void 0,i.textContent=this.messages.explainsEachNote.replace("{n}",String(e.explainsEach?.length??0)),this.form??=new O(this.element("bird-parameters"),this.language,"birds.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(n.SET),new x(()=>this.current,s=>this.editFlock(o=>s(o)),()=>({shapes:this.host.shapes().map(s=>({value:s.id,label:s.label}))}),this.host.positionPlace?.()),()=>this.written()),this.syncPoint(!0)}refresh(){if(!this.messages)return;this.syncAddState();const t=this.flocks;if(t.length===this.shown.length&&t.every((e,i)=>e.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.frontOfObserver()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.flocks.find(t=>t.id===this.currentId)}resolved(t){return T.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.pointForm=void 0,this.container.innerHTML=`<div class="launch-editor">
2
- <p class="launch-intro">${t.intro}</p>
3
- <div id="bird-list"></div>
4
- <div id="bird-fields" class="launch-fields">
5
- <div id="bird-parameters" class="launch-parameters"></div>
6
- <p id="bird-each" class="launch-intro" hidden></p>
7
- <div id="bird-timeline"></div>
8
- <p class="launch-intro">${t.timelineNote}</p>
9
- <fieldset id="bird-path" class="launch-path">
10
- <legend>${this.parameterTexts.pointOfThePath}</legend>
11
- <div id="bird-point-parameters" class="launch-parameters"></div>
12
- <button id="bird-point-delete" class="icon-btn" type="button" title="${t.deletePoint}" aria-label="${t.deletePoint}">${w.TRASH}</button>
13
- </fieldset>
14
- <p class="launch-intro">${t.derivedNote}</p>
15
- </div>
16
- </div>`,this.list=new M({header:this.element("bird-list"),body:this.element("bird-fields"),ids:{list:"bird-select",remove:"bird-delete",add:"bird-add"},onSelect:e=>this.show(e),onAdd:()=>this.addFlock(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:t.flock,remove:t.deleteFlock,add:t.addFlock,empty:t.none}),this.timeline=new I(this.element("bird-timeline"),e=>this.host.seekTo?.(e),{addKeyframeHere:t.addPointHere,keyframeHere:t.pointHere,zoomHint:t.zoomHint}),this.element("bird-point-delete").addEventListener("click",()=>this.removePoint())}show(t){this.messages&&(this.currentId=t,this.pointIndex=0,this.sync())}written(){const t=this.current;t&&this.list?.rename(t.id,this.labelOf(t)),this.syncPoint()}pathOf(t){return[...t?.path??[]].sort((e,i)=>e.t-i.t)}static MIN_POINTS=1;syncTimeline(){const t=this.current;if(!this.timeline||!t)return;const e=this.pathOf(t),i={id:"path",label:this.messages.path,color:f.PATH_COLOR,times:e.map(r=>r.t),active:!0,selectedTime:e[this.pointIndex]?.t,open:()=>this.selectPoint(this.pointIndex),pressed:(r,h)=>{const p=h===void 0?-1:this.pathOf(this.current).findIndex(d=>d.t===h);this.selectPoint(p>=0?p:this.pointIndex)},move:(r,h)=>this.movePoint(r,h),add:()=>this.addPointAt(this.host.currentTime?.()??0)},s=e[0]?.t??0,o=e[e.length-1]?.t??0,a=Math.max(500,(o-s)/10);this.timeline.show([i],this.host.duration?.()??o,this.host.currentTime?.()??0,{from:s-a,to:o+a})}syncPoint(t=!1){const e=this.pathOf(this.current);this.pointIndex=Math.max(0,Math.min(this.pointIndex,e.length-1)),this.element("bird-point-delete").disabled=e.length<=f.MIN_POINTS,this.pointForm?this.pointForm.sync(t):(this.pointForm=new O(this.element("bird-point-parameters"),this.language,"birdsPoint."),this.pointForm.show(this.resolved(n.WAYPOINT),new x(()=>this.pathOf(this.current)[this.pointIndex],i=>this.editPoint(this.pointIndex,i),void 0,this.host.positionPlace?.()),()=>{})),this.syncTimeline()}selectPoint(t){this.pointIndex=t;const e=this.pathOf(this.current)[t];e&&this.host.seekTo?.(e.t),this.syncPoint(!0)}editPoint(t,e){let i;this.editFlock(s=>{const o=this.pathOf(s);i={...o[t]},e(i),s.path=o.map((a,r)=>r===t?i:a).sort((a,r)=>a.t-r.t)}),i&&(this.pointIndex=this.current?.path.indexOf(i)??0),this.syncPoint()}movePoint(t,e){const i=this.pathOf(this.current).findIndex(s=>s.t===t);i<0||(this.editPoint(i,s=>{s.t=Math.round(e)}),this.syncPoint(!0))}addPointAt(t){const e=this.current;if(!e)return;const i=this.pathOf(e).findIndex(o=>Math.abs(o.t-t)<1);if(i>=0){this.selectPoint(i);return}const s=n.waypointAt(e,t);this.editFlock(o=>{o.path=[...this.pathOf(o),s].sort((a,r)=>a.t-r.t)}),this.selectPoint(this.current?.path.indexOf(s)??0)}removePoint(){const t=this.pathOf(this.current);if(t.length<=f.MIN_POINTS)return;const e=this.pointIndex;this.editFlock(i=>{i.path=t.filter((s,o)=>o!==e)}),this.syncPoint(!0)}editFlock(t){const e=this.current;if(!e)return;const i=structuredClone(e);t(i),i.formation&&i.formation.kind===void 0&&(Object.entries(i.formation).some(([a,r])=>a!=="kind"&&r!==void 0)?i.formation.kind=e.formation?.kind??((i.count??1)>1?"cluster":"single"):delete i.formation);const s=i.flight;if(s){if(s.kind===void 0)delete i.flight;else if(s.kind!=="flapping"){const o=e.flight?.kind!=="flapping"?e.flight:void 0,a=n.BURST;s.beats??=o?.beats??a.beats,s.glideS??=o?.glideS??a.glideS}}this.writeFlocks(this.flocks.map(o=>o===e?i:o)),this.host.changed()}frontOfObserver(){const t=this.host.sighting(),e=t.event?.place?.[0];if(e?.lat===void 0||e.lng===void 0)return;const i=t.observerTrack?.getInterpolatedPoseAt(this.host.currentTime?.()??0),s=111320,o=i?.lng!==void 0?(i.lng-e.lng)*s*Math.cos(e.lat*Math.PI/180):0,a=i?.lat!==void 0?(i.lat-e.lat)*s:0;return{eastM:o,northM:a,headingRad:(i?.headingDeg??0)*Math.PI/180}}addFlock(){const t=this.frontOfObserver();if(!t)return;let e=this.flocks.length+1;for(;this.flocks.some(a=>a.id===`birds-${e}`);)e++;const i=Math.round(this.host.currentTime?.()??0),s=(a,r,h)=>({t:a,eastM:Math.round(t.eastM+r*Math.sin(t.headingRad)+h*Math.cos(t.headingRad)),northM:Math.round(t.northM+r*Math.cos(t.headingRad)-h*Math.sin(t.headingRad)),altitudeM:60}),o={id:`birds-${e}`,species:"herring-gull",count:12,formation:{kind:"cluster"},path:[s(i,300,-120),s(i+2e4,300,120)],seed:e};this.writeFlocks([...this.flocks,o]),this.host.changed(),this.show(o.id)}deleteCurrent(){const t=this.current;t&&(this.currentId=void 0,this.writeFlocks(this.flocks.filter(e=>e!==t)),this.host.changed(),this.sync())}writeFlocks(t){const e=this.host.sighting(),i={...e.interpretation??{bodies:[]},birds:t.length>0?t:void 0};i.birds===void 0&&delete i.birds;const s=F.saysNothing(i,A.kinds());e.interpretation=s?void 0:i}labelOf(t){const e=this.host.said().read(t.title);return e?`${e} (${t.id})`:t.id}get flocks(){return this.host.sighting().interpretation?.birds??[]}element(t){return this.container.querySelector(`#${t}`)}}export{f as BirdEditor};
@@ -1,16 +0,0 @@
1
- import{o as v,_ as l,aF as p,aC as f,a1 as m,a3 as b,a2 as w,c as O,$ as T,a0 as I,a4 as M,a5 as k}from"./rr0-sighting-editor.mjs";import{S as L}from"./SkyEventEditorStyle-CvY_AhbI.js";import{D as y,a as c,b as E}from"./DroneFlight-tXCk1Tg1.js";const S=v.catalog({en:()=>l(()=>import("./DroneParameterTexts_en-sL1dR2RG.js"),[],import.meta.url).then(h=>h.droneParameterTexts_en),fr:()=>l(()=>import("./DroneParameterTexts_fr-B8Ym7Yz6.js"),[],import.meta.url).then(h=>h.droneParameterTexts_fr),es:()=>l(()=>import("./DroneParameterTexts_es-Bg8_8XVE.js"),[],import.meta.url).then(h=>h.droneParameterTexts_es),it:()=>l(()=>import("./DroneParameterTexts_it-DfvWjvoc.js"),[],import.meta.url).then(h=>h.droneParameterTexts_it)});class s{static DRONE="drone";static FLIGHT="flight";static LOOK="look";static LIGHT_NAMES=[...new Set(y.ALL.flatMap(t=>Object.keys(t.lights)))];static textKey(t){return t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}static flightOf(t){return t}static ownLight(t,e){return c.airframeOf(s.flightOf(t)).lights[e]}static formationUnstated(t){return(p.read(t,"count")??1)>1?"cluster":"single"}static formationOf(t){const e=p.read(t,"formation.kind");return typeof e=="string"?e:s.formationUnstated(t)}static hovers(t){return c.airframeOf(s.flightOf(t)).hovers}static light(t){const e=s.textKey(t),i=o=>s.ownLight(o,t)!==void 0,n=o=>{const a=s.flightOf(o).lights?.[t];return a===!1?!0:typeof a?.off=="boolean"?a.off:s.ownLight(o,t)?.off===!0},r=o=>i(o)&&!n(o);return[{type:"boolean",key:`lights.${t}.off`,group:e,label:"switchedOff",visibleWhen:i,effective:o=>s.flightOf(o).lights?.[t]===!1||s.ownLight(o,t)?.off===!0},{type:"colour",key:`lights.${t}.color`,group:e,label:"colour",visibleWhen:r,effective:o=>s.ownLight(o,t)?.color},{type:"number",key:`lights.${t}.candela`,min:0,max:1e5,step:.1,unit:"cd",group:e,label:"intensity",hint:"eachLed",visibleWhen:r,effective:o=>s.ownLight(o,t)?.candela},{type:"number",key:`lights.${t}.hz`,min:0,max:50,step:.05,unit:"Hz",group:e,label:"flashesASecond",hint:"steadyAtNought",visibleWhen:r,effective:o=>s.ownLight(o,t)?.hz??0},{type:"number",key:`lights.${t}.flashS`,min:.001,max:60,step:.001,unit:"s",group:e,label:"eachFlashLasts",visibleWhen:o=>r(o)&&(p.read(o,`lights.${t}.hz`)??s.ownLight(o,t)?.hz??0)>0,effective:o=>{const a=s.ownLight(o,t),d=p.read(o,`lights.${t}.hz`)??a?.hz??0;return a?.flashS??(d>0?Math.round(500/d)/1e3:void 0)}}]}static SET={kind:"drones",title:"drones",parameters:[{type:"said",key:"title",label:"name",group:s.DRONE},{type:"choice",key:"airframe",required:!0,group:s.DRONE,label:"airframe",choices:y.ALL.map(t=>({value:t.id,label:s.textKey(t.id)}))},{type:"number",key:"count",min:1,max:2e3,step:1,group:s.DRONE,effective:()=>1,label:"howMany"},{type:"set",key:"explains",group:s.DRONE,label:"standForTheShapes",hint:"theWholeGroupTakenForOne",visibleWhen:t=>s.flightOf(t).explainsEach===void 0,options:(t,e)=>{const i=e?.shapes??[],n=(s.flightOf(t).explains??[]).filter(r=>!i.some(o=>o.value===r));return[...i,...n.map(r=>({value:r,label:r}))]},empty:"noShape"},{type:"number",key:"seed",min:0,max:4294967295,step:1,group:s.DRONE,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFrom"},{type:"choice",key:"formation.kind",group:s.FLIGHT,label:"pattern",effective:t=>s.formationUnstated(t),choices:[{value:"single",label:"oneDrone"},{value:"cluster",label:"aLooseGroup"},{value:"line",label:"abreast"}],visibleWhen:t=>(p.read(t,"count")??1)>1},{type:"number",key:"formation.spacingM",min:.5,max:1e3,step:.5,unit:"m",group:s.FLIGHT,effective:t=>s.formationOf(t)==="line"?5:10,label:"spacing",hint:"betweenNeighbours",visibleWhen:t=>(p.read(t,"count")??1)>1&&s.formationOf(t)!=="single"},{type:"number",key:"headingDeg",min:0,max:360,step:1,unit:"°",group:s.FLIGHT,label:"noseTowards",hint:"emptyItFacesWhereItGoes",placeholder:"whereItGoes",visibleWhen:s.hovers},{type:"number",key:"wind.fromDeg",min:0,max:360,step:1,unit:"°",group:s.FLIGHT,label:"windFrom",effective:()=>0,hint:"whatItLeansInto"},{type:"number",key:"wind.speedMS",min:0,max:60,step:.1,unit:"m/s",group:s.FLIGHT,label:"windSpeed",effective:()=>0},{type:"boolean",key:"silent",group:s.FLIGHT,label:"silent",hint:"notEvenItsRotors"},{type:"number",key:"quieterDb",min:0,max:60,step:1,unit:"dB",group:s.FLIGHT,label:"quieter",hint:"thanItsClass",effective:()=>0,visibleWhen:t=>p.read(t,"silent")!==!0},{type:"colour",key:"bodyColor",group:s.LOOK,label:"hull",effective:t=>c.airframeOf(s.flightOf(t)).bodyColor},...s.LIGHT_NAMES.flatMap(t=>s.light(t))]};static angular(t){return typeof t.azimuthDeg=="number"}static WAYPOINT={kind:"drones-waypoint",title:"pointOfThePath",parameters:[{type:"number",key:"t",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecording"},{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:1,rangeM:1e5,label:"position",visibleWhen:t=>!s.angular(t)},{type:"number",key:"altitudeM",min:-500,max:2e4,step:.1,unit:"m",required:!0,label:"height",hint:"aboveTheGroundOfThePlace",visibleWhen:t=>!s.angular(t)},{type:"number",key:"azimuthDeg",min:0,max:360,step:.1,unit:"°",required:!0,label:"azimuth",visibleWhen:t=>s.angular(t)},{type:"number",key:"altitudeDeg",min:-90,max:90,step:.1,unit:"°",required:!0,label:"elevation",visibleWhen:t=>s.angular(t)},{type:"number",key:"distanceM",min:0,max:1e5,step:1,unit:"m",required:!0,label:"distance",visibleWhen:t=>s.angular(t)},{type:"number",key:"eyeHeightM",min:0,max:1e4,step:.1,unit:"m",effective:()=>1.6,label:"eyeHeight",visibleWhen:t=>s.angular(t)}]};static waypointAt(t,e){const i=c.pathOf(t);if(i.length===0)return{t:Math.round(e),eastM:0,northM:0,altitudeM:0};const n=new E(i,c.airframeOf(t).hovers).at(e),r=o=>Math.round(o*10)/10;return{t:Math.round(e),eastM:r(n.eastM),northM:r(n.northM),altitudeM:r(n.upM)}}static publish(){f.publish(s.SET),f.publish(s.WAYPOINT)}}const A=v.catalog({en:()=>l(()=>import("./DroneEditorMessages_en-BViHK30c.js"),[],import.meta.url).then(h=>h.droneEditorMessages_en),fr:()=>l(()=>import("./DroneEditorMessages_fr-CvV0RyOT.js"),[],import.meta.url).then(h=>h.droneEditorMessages_fr),es:()=>l(()=>import("./DroneEditorMessages_es-D6bhIOAa.js"),[],import.meta.url).then(h=>h.droneEditorMessages_es),it:()=>l(()=>import("./DroneEditorMessages_it-CYi-jmVN.js"),[],import.meta.url).then(h=>h.droneEditorMessages_it)});class u{constructor(t,e,i){this.container=t,this.host=e,L.attach(t,"drone-editor-part",u.STYLE),this.language=i,f.of("drones")||s.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;pointForm;pointIndex=0;language;shown=[];static STYLE='.drone-editor-part { flex-basis: 100%; min-width: 0; } .drone-editor-part #drone-list, .drone-editor-part #drone-timeline { flex-basis: 100%; min-width: 0; } .drone-editor-part #drone-timeline { padding: 4px 0; } .drone-editor-part #drone-path > .icon-btn { align-self: flex-end; } .drone-editor-part .launch-editor, .drone-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .drone-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .drone-editor-part [hidden] { display: none !important; } .drone-editor-part select { min-width: 0; width: 100%; } .drone-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .drone-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .drone-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; } .drone-editor-part input, .drone-editor-part select { max-width: 100%; box-sizing: border-box; } .drone-editor-part input[type="text"] { width: 12em; } .drone-editor-part label { min-width: 0; max-width: 100%; } .drone-editor-part input.parameter-derived::placeholder { opacity: .65; } .drone-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; }';static PATH_COLOR="#3b82c4";async setLanguage(t){const e=++this.languageToken;this.language=t;const[i,n]=await Promise.all([A.load(t),S.load(t)]);e===this.languageToken&&(this.messages=i,this.parameterTexts=n,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flights;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.syncAddState();const e=this.current;if(this.element("drone-fields").hidden=e===void 0,!e)return;const i=this.element("drone-each");i.hidden=e.explainsEach===void 0,i.textContent=this.messages.explainsEachNote.replace("{n}",String(e.explainsEach?.length??0)),this.form??=new m(this.element("drone-parameters"),this.language,"drones.",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(this.resolved(s.SET),new b(()=>this.current,n=>this.editFlight(r=>n(r)),()=>({shapes:this.host.shapes().map(n=>({value:n.id,label:n.label}))}),this.host.positionPlace?.()),()=>this.written()),this.syncPoint(!0)}refresh(){if(!this.messages)return;this.syncAddState();const t=this.flights;if(t.length===this.shown.length&&t.every((e,i)=>e.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(t){this.messages&&this.timeline?.setTime(t)}syncAddState(){const t=this.frontOfObserver()!==void 0;this.list?.setAddState(t,t?void 0:this.messages.addNowhere)}get current(){return this.flights.find(t=>t.id===this.currentId)}resolved(t){return w.resolve(t,this.parameterTexts)}render(){if(!this.messages)return;const t=this.messages;this.form=void 0,this.pointForm=void 0,this.container.innerHTML=`<div class="launch-editor">
2
- <p class="launch-intro">${t.intro}</p>
3
- <div id="drone-list"></div>
4
- <div id="drone-fields" class="launch-fields">
5
- <div id="drone-parameters" class="launch-parameters"></div>
6
- <p id="drone-each" class="launch-intro" hidden></p>
7
- <div id="drone-timeline"></div>
8
- <p class="launch-intro">${t.timelineNote}</p>
9
- <fieldset id="drone-path" class="launch-path">
10
- <legend>${this.parameterTexts.pointOfThePath}</legend>
11
- <div id="drone-point-parameters" class="launch-parameters"></div>
12
- <button id="drone-point-delete" class="icon-btn" type="button" title="${t.deletePoint}" aria-label="${t.deletePoint}">${O.TRASH}</button>
13
- </fieldset>
14
- <p class="launch-intro">${t.derivedNote}</p>
15
- </div>
16
- </div>`,this.list=new T({header:this.element("drone-list"),body:this.element("drone-fields"),ids:{list:"drone-select",remove:"drone-delete",add:"drone-add"},onSelect:e=>this.show(e),onAdd:()=>this.addDrone(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:t.drone,remove:t.deleteDrone,add:t.addDrone,empty:t.none}),this.timeline=new I(this.element("drone-timeline"),e=>this.host.seekTo?.(e),{addKeyframeHere:t.addPointHere,keyframeHere:t.pointHere,zoomHint:t.zoomHint}),this.element("drone-point-delete").addEventListener("click",()=>this.removePoint())}show(t){this.messages&&(this.currentId=t,this.pointIndex=0,this.sync())}written(){const t=this.current;t&&this.list?.rename(t.id,this.labelOf(t)),this.syncPoint()}pathOf(t){return[...t?.path??[]].sort((e,i)=>e.t-i.t)}static MIN_POINTS=1;syncTimeline(){const t=this.current;if(!this.timeline||!t)return;const e=this.pathOf(t),i={id:"path",label:this.messages.path,color:u.PATH_COLOR,times:e.map(a=>a.t),active:!0,selectedTime:e[this.pointIndex]?.t,open:()=>this.selectPoint(this.pointIndex),pressed:(a,d)=>{const g=d===void 0?-1:this.pathOf(this.current).findIndex(x=>x.t===d);this.selectPoint(g>=0?g:this.pointIndex)},move:(a,d)=>this.movePoint(a,d),add:()=>this.addPointAt(this.host.currentTime?.()??0)},n=e[0]?.t??0,r=e[e.length-1]?.t??0,o=Math.max(500,(r-n)/10);this.timeline.show([i],this.host.duration?.()??r,this.host.currentTime?.()??0,{from:n-o,to:r+o})}syncPoint(t=!1){const e=this.pathOf(this.current);this.pointIndex=Math.max(0,Math.min(this.pointIndex,e.length-1)),this.element("drone-point-delete").disabled=e.length<=u.MIN_POINTS,this.pointForm?this.pointForm.sync(t):(this.pointForm=new m(this.element("drone-point-parameters"),this.language,"dronesPoint."),this.pointForm.show(this.resolved(s.WAYPOINT),new b(()=>this.pathOf(this.current)[this.pointIndex],i=>this.editPoint(this.pointIndex,i),void 0,this.host.positionPlace?.()),()=>{})),this.syncTimeline()}selectPoint(t){this.pointIndex=t;const e=this.pathOf(this.current)[t];e&&this.host.seekTo?.(e.t),this.syncPoint(!0)}editPoint(t,e){let i;this.editFlight(n=>{const r=this.pathOf(n);i={...r[t]},e(i),n.path=r.map((o,a)=>a===t?i:o).sort((o,a)=>o.t-a.t)}),i&&(this.pointIndex=this.current?.path.indexOf(i)??0),this.syncPoint()}movePoint(t,e){const i=this.pathOf(this.current).findIndex(n=>n.t===t);i<0||(this.editPoint(i,n=>{n.t=Math.round(e)}),this.syncPoint(!0))}addPointAt(t){const e=this.current;if(!e)return;const i=this.pathOf(e).findIndex(r=>Math.abs(r.t-t)<1);if(i>=0){this.selectPoint(i);return}const n=s.waypointAt(e,t);this.editFlight(r=>{r.path=[...this.pathOf(r),n].sort((o,a)=>o.t-a.t)}),this.selectPoint(this.current?.path.indexOf(n)??0)}removePoint(){const t=this.pathOf(this.current);if(t.length<=u.MIN_POINTS)return;const e=this.pointIndex;this.editFlight(i=>{i.path=t.filter((n,r)=>r!==e)}),this.syncPoint(!0)}editFlight(t){const e=this.current;if(!e)return;const i=structuredClone(e);if(i.lights)for(const[n,r]of Object.entries(i.lights))r===!1&&(i.lights[n]={off:!0});if(t(i),i.formation&&i.formation.kind===void 0&&(Object.entries(i.formation).some(([r,o])=>r!=="kind"&&o!==void 0)?i.formation.kind=e.formation?.kind??((i.count??1)>1?"cluster":"single"):delete i.formation),i.wind&&(i.wind.fromDeg===void 0&&i.wind.speedMS===void 0?delete i.wind:(i.wind.fromDeg??=0,i.wind.speedMS??=0)),i.lights){for(const[n,r]of Object.entries(i.lights))r!==!1&&Object.keys(r).length===0&&delete i.lights[n];Object.keys(i.lights).length===0&&delete i.lights}this.writeFlights(this.flights.map(n=>n===e?i:n)),this.host.changed()}frontOfObserver(){const t=this.host.sighting(),e=t.event?.place?.[0];if(e?.lat===void 0||e.lng===void 0)return;const i=t.observerTrack?.getInterpolatedPoseAt(this.host.currentTime?.()??0),n=111320,r=i?.lng!==void 0?(i.lng-e.lng)*n*Math.cos(e.lat*Math.PI/180):0,o=i?.lat!==void 0?(i.lat-e.lat)*n:0;return{eastM:r,northM:o,headingRad:(i?.headingDeg??0)*Math.PI/180}}addDrone(){const t=this.frontOfObserver();if(!t)return;let e=this.flights.length+1;for(;this.flights.some(o=>o.id===`drone-${e}`);)e++;const i=Math.round(this.host.currentTime?.()??0),n=o=>({t:o,eastM:Math.round(t.eastM+150*Math.sin(t.headingRad)),northM:Math.round(t.northM+150*Math.cos(t.headingRad)),altitudeM:60}),r={id:`drone-${e}`,airframe:"quadcopter",path:[n(i),n(i+2e4)],seed:e};this.writeFlights([...this.flights,r]),this.host.changed(),this.show(r.id)}deleteCurrent(){const t=this.current;t&&(this.currentId=void 0,this.writeFlights(this.flights.filter(e=>e!==t)),this.host.changed(),this.sync())}writeFlights(t){const e=this.host.sighting(),i={...e.interpretation??{bodies:[]},drones:t.length>0?t:void 0};i.drones===void 0&&delete i.drones;const n=M.saysNothing(i,k.kinds());e.interpretation=n?void 0:i}labelOf(t){const e=this.host.said().read(t.title);return e?`${e} (${t.id})`:t.id}get flights(){return this.host.sighting().interpretation?.drones??[]}element(t){return this.container.querySelector(`#${t}`)}}export{u as DroneEditor};
@@ -1 +0,0 @@
1
- import{bO as Le,bP as Q,bQ as he,bR as Me,bS as v,bT as de,bb as b,be as pe,aY as F,bU as w,bJ as U,bA as Se,bV as ye,az as be,K,bW as we,V as C,Q as me,bX as Ne,G as ge,bY as Ie,bZ as Oe,aI as V,b_ as Ce,b$ as Te,c0 as Fe,c1 as Pe,c2 as He,bh as J,bD as Re,c3 as Z,c4 as ke,c5 as De,bw as Ge,c6 as X,c7 as ve,au as Ee,aK as Ue,aJ as G,c8 as Ke,aH as Be,c9 as je,as as Ve,ca as Xe,cb as ze,cc as qe,aW as We,ap as z,aA as Ye,bu as Qe,cd as Je,ce as Ze,cf as $e,cg as en,ch as nn,ci as tn,cj as xe,bn as sn,bK as ne,ck as te,cl as se,cm as ie,cn as re,co as rn,cp as on,av as an,aw as cn}from"./rr0-sighting-editor.mjs";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class jn extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new Sn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new yn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===Ae){try{r[g.KHR_BINARY_GLTF]=new bn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function _(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new be(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ye(u),c.distance=l;break;case"spot":c=new Se(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),y(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],w),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],w)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return _(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class Sn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class yn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,A=new C(1,1,1),x=new we(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&A.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,A));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const Ae="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class bn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ae)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,w,h)})})}}class Nn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class _e extends on{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,A=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=A*L+x*N+m*S+T*k}return i}}const On=new me;class Cn extends _e{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:tn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:rn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function y(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),y(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),A="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(A);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(A,x)),m=new sn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,A=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new A(r[1],x,t.sparse.count*T),N=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,k=L.length;S<k;S++){const P=L[S];if(m.setX(P,N[S*o]),o>=2&&m.setY(P,N[S*o+1]),o>=3&&m.setZ(P,N[S*o+2]),o>=4&&m.setW(P,N[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),y(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],w),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],w)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),y(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const A=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,A):new Ve(R,A),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,A);else if(m.mode===M.LINE_STRIP)T=new ze(R,A);else if(m.mode===M.LINE_LOOP)T=new qe(R,A);else if(m.mode===M.POINTS)T=new We(R,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),y(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),y(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,A=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",A)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],N=d[x],S=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const A=new $e(i,void 0,T);return y(A,t),A})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),y(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),y(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(nn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:_e;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new an;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new cn;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),y(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
@@ -1 +0,0 @@
1
- import{N,B as v,X as k}from"./rr0-sighting-editor.mjs";const b=Math.PI/180;class l{static SIGHT_LINE_M=5e3;static FLAT={heightAt:()=>0};static of(n,t,e){return[...l.observer(n,t),...l.sightLines(n,t,e),...l.bodies(n,t,e),...l.traces(n,t,e)]}static observer(n,t){const e=[];for(const r of n.observerTrack.allKeyframes){const s=N(n,r.t);if(s?.lat===void 0||s.lng===void 0)continue;const d=s.elevationM??0;e.push({t:r.t,at:{lat:s.lat,lng:s.lng,altM:d+v.EYE_HEIGHT_M},...s.headingDeg===void 0?{}:{headingDeg:s.headingDeg},elevationM:d})}if(e.length===0)return[];const o=e[0],a=[{group:"observer",groupName:t.folderObserver,name:l.fill(t.observerPoint,{s:l.seconds(o.t)}),note:l.fill(t.observerNote,{elevation:l.round(o.elevationM,1),heading:o.headingDeg===void 0?"—":l.round(o.headingDeg,0)}),kind:"point",points:[o.at],heights:"observer-ground"}];return e.some(r=>r.at.lat!==o.at.lat||r.at.lng!==o.at.lng)&&a.push({group:"observer",groupName:t.folderObserver,name:t.observerPath,kind:"line",points:e.map(r=>r.at),heights:"observer-ground"}),a}static sightLines(n,t,e){const o=[];for(const a of n.timeline.allKeyframes){const i=N(n,a.t);if(i?.lat===void 0||i.lng===void 0)continue;const r={lat:i.lat,lng:i.lng,altM:(i.elevationM??0)+v.EYE_HEIGHT_M};for(const s of a.shapes){const d=s.shape.aim;d&&o.push({group:"sight-line",groupName:t.folderSightLines,name:l.fill(t.sightLine,{what:l.nameOf(e.read(s.shape.title),s.sourceId,t),s:l.seconds(a.t)}),note:l.fill(t.sightLineNote,{azimuth:l.round(d.azimuthDeg,1),altitude:l.round(d.altitudeDeg,1),km:l.round(l.SIGHT_LINE_M/1e3,0)}),kind:"line",points:[r,l.along(r,d.azimuthDeg,d.altitudeDeg)],heights:"observer-ground"})}}return o}static along(n,t,e){const o=l.SIGHT_LINE_M*Math.cos(e*b),a=k.toGeo({eastM:Math.sin(t*b)*o,northM:Math.cos(t*b)*o},n);return{lat:a.lat,lng:a.lng,altM:n.altM+l.SIGHT_LINE_M*Math.sin(e*b)}}static bodies(n,t,e){const o=n.interpretation?.bodies??[],a=N(n,0);if(o.length===0||a?.lat===void 0||a.lng===void 0)return[];const i={lat:a.lat,lng:a.lng},r=[];for(const s of o){const d=new v(s,l.FLAT,h=>v.eyeOf(n,h,l.FLAT)),f=[];for(const h of[...s.track].sort((c,m)=>c.t-m.t)){const c=d.at(h.t);if(!c)continue;const m=k.toGeo({eastM:c.eastM,northM:c.northM},i),u={lat:m.lat,lng:m.lng,altM:c.upM},M=f[f.length-1];M&&M.lat===u.lat&&M.lng===u.lng&&M.altM===u.altM||f.push(u)}if(f.length===0)continue;const y=l.nameOf(e.read(s.title),s.id,t);r.push({group:"body",groupName:t.folderBodies,name:l.fill(f.length===1?t.bodyPoint:t.bodyPath,{what:y}),note:t.bodyNote,kind:f.length===1?"point":"line",points:f,heights:"observer-ground"})}return r}static traces(n,t,e){return n.traces.map(o=>({group:"trace",groupName:t.folderTraces,name:e.read(o.title)??o.id,...e.read(o.source)?{note:e.read(o.source)}:{},kind:o.kind,points:o.points.map(a=>({lat:a.lat,lng:a.lng,altM:a.altM??0})),heights:o.altitude??"ground",...o.color?{color:o.color}:{}}))}static nameOf(n,t,e){return n&&n.trim()?n.trim():l.fill(e.unnamed,{id:t})}static seconds(n){return l.round(n/1e3,1)}static round(n,t){const e=10**t;return String(Math.round(n*e)/e)}static fill(n,t){return Object.entries(t).reduce((e,[o,a])=>e.replaceAll(`{${o}}`,a),n)}}export{l as G};