@rr0/ufoathome 0.203.0 → 0.204.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 (242) hide show
  1. package/dist-embed-scene/SceneNames_en--zj8Tlec.js +1 -0
  2. package/dist-embed-scene/SceneNames_es-toWs7p7i.js +1 -0
  3. package/dist-embed-scene/SceneNames_fr-w4Xdplid.js +1 -0
  4. package/dist-embed-scene/SceneNames_it-Cwcscdx7.js +1 -0
  5. package/dist-embed-scene/rr0-scene.mjs +288 -288
  6. package/dist-embed-scene/sightingSchema-DoPVOlCB.js +1 -0
  7. package/dist-embed-sighting/{AdsbLolArchiveProvider-CsuxO9wl.js → AdsbLolArchiveProvider-BSewzrRe.js} +1 -1
  8. package/dist-embed-sighting/{AirshipEditor-DkDCkwGG.js → AirshipEditor-BiG7EYoB.js} +2 -2
  9. package/dist-embed-sighting/{AuroraEditor-C4tY9hXK.js → AuroraEditor-C1Y_zbNW.js} +1 -1
  10. package/dist-embed-sighting/{AuroraSimulation-C7LAHgWM.js → AuroraSimulation-B9GaDXC3.js} +2 -2
  11. package/dist-embed-sighting/{BallesterGuaspAssessor-BPaiHWd9.js → BallesterGuaspAssessor-BAXmW7XL.js} +1 -1
  12. package/dist-embed-sighting/BalloonEditor-D54CC7cn.js +24 -0
  13. package/dist-embed-sighting/{BeamEditor-DDzw-fB_.js → BeamEditor-SHXD10FH.js} +1 -1
  14. package/dist-embed-sighting/{BeamSystem-CsNwl_vM.js → BeamSystem-CP3J9Jgx.js} +1 -1
  15. package/dist-embed-sighting/{BirdEditor-BgNNcdhv.js → BirdEditor-BCit7Rs-.js} +1 -1
  16. package/dist-embed-sighting/{BirdFlock-DBgkxsxp.js → BirdFlock-DhsSOJTg.js} +1 -1
  17. package/dist-embed-sighting/{CaseReportExport--iqqhu1e.js → CaseReportExport-CUy_3oyV.js} +2 -2
  18. package/dist-embed-sighting/{ContrailSystem-Di5w5IVi.js → ContrailSystem-70o5ynhD.js} +1 -1
  19. package/dist-embed-sighting/ControlPasses-DQMrWqA3.js +29 -0
  20. package/dist-embed-sighting/{CoverageAssessor-Cu9wP4ZB.js → CoverageAssessor-BdZ85Hmy.js} +1 -1
  21. package/dist-embed-sighting/{DroneEditor-5nuq52EG.js → DroneEditor-DwQsVj8U.js} +1 -1
  22. package/dist-embed-sighting/{DroneParameters-DHeJ7KyU.js → DroneParameters-91BBY10Y.js} +1 -1
  23. package/dist-embed-sighting/{Flightradar24Provider-p4a3_chL.js → Flightradar24Provider-NbfW-lDQ.js} +1 -1
  24. package/dist-embed-sighting/{GLTFLoader-fbsNsHlp.js → GLTFLoader-CTETHs7e.js} +1 -1
  25. package/dist-embed-sighting/GenerativeKitMessages-hgIQ_sST.js +1 -0
  26. package/dist-embed-sighting/{HeadlightSystem-Ce7sHylX.js → HeadlightSystem-ByKGq-30.js} +1 -1
  27. package/dist-embed-sighting/{HynekAssessor-DWDZGeLY.js → HynekAssessor-O1MFR79v.js} +1 -1
  28. package/dist-embed-sighting/LanternEditor-X0RgF4mn.js +24 -0
  29. package/dist-embed-sighting/{LaunchEditor-BGyLgkGS.js → LaunchEditor-oTKLz_5C.js} +1 -1
  30. package/dist-embed-sighting/{LaunchSimulation-DvexI06i.js → LaunchSimulation-ClRFO1uw.js} +1 -1
  31. package/dist-embed-sighting/{ModuleSession-_kHZ7Tx3.js → ModuleSession-SivjhuIl.js} +3 -3
  32. package/dist-embed-sighting/ModuleThree-TrytNggN.js +1 -0
  33. package/dist-embed-sighting/{NearestApproach-CONyx4c5.js → NearestApproach-BM7B5PuM.js} +1 -1
  34. package/dist-embed-sighting/{ParameterForm-DFHcolwG.js → ParameterForm-BghOJXLP.js} +1 -1
  35. package/dist-embed-sighting/{PoherAssessor-DI86qOCu.js → PoherAssessor-DZMtM2pW.js} +1 -1
  36. package/dist-embed-sighting/PoherMatrix-C2fcLqDH.js +1 -0
  37. package/dist-embed-sighting/PoherSelfCheck-PJvhaWFK.js +1 -0
  38. package/dist-embed-sighting/{RailwaySystem-DcJr9BY_.js → RailwaySystem-Dmx9y4gO.js} +1 -1
  39. package/dist-embed-sighting/{ReentryEditor-C6EJJf4l.js → ReentryEditor-DozmlO_l.js} +1 -1
  40. package/dist-embed-sighting/{ReentrySimulation-BFVBOWrm.js → ReentrySimulation-WXW1IU2E.js} +1 -1
  41. package/dist-embed-sighting/{ReferenceSystem-zTvTqp5y.js → ReferenceSystem-BD7gXBee.js} +1 -1
  42. package/dist-embed-sighting/{RoadMarkings-DvWjbrSf.js → RoadMarkings-Bp07bgso.js} +1 -1
  43. package/dist-embed-sighting/SceneNames_en-BarwWQKA.js +1 -0
  44. package/dist-embed-sighting/SceneNames_es-CEdDjAb4.js +1 -0
  45. package/dist-embed-sighting/SceneNames_fr-m5WHqg-1.js +1 -0
  46. package/dist-embed-sighting/SceneNames_it-D_H_iZnc.js +1 -0
  47. package/dist-embed-sighting/{SearchlightEditor-By5Z3ef7.js → SearchlightEditor-BGmKCBrG.js} +1 -1
  48. package/dist-embed-sighting/{SearchlightSystem-PEMBDW1s.js → SearchlightSystem-5FPRRIkH.js} +1 -1
  49. package/dist-embed-sighting/SightingMessages_en-DKFVZnDu.js +1 -0
  50. package/dist-embed-sighting/SightingMessages_es-DYQlWvm0.js +1 -0
  51. package/dist-embed-sighting/SightingMessages_fr-BygVDDY9.js +1 -0
  52. package/dist-embed-sighting/SightingMessages_it-BI7GnXPz.js +1 -0
  53. package/dist-embed-sighting/{SkyLantern-yYihsrun.js → SkyLantern-1Rqy6fNz.js} +1 -1
  54. package/dist-embed-sighting/{TraceSystem-1K0WblAK.js → TraceSystem-DDlP7sxl.js} +2 -2
  55. package/dist-embed-sighting/{UfoMessages_en-CwRXodRE.js → UfoMessages_en-DvUA0KYR.js} +1 -1
  56. package/dist-embed-sighting/{WaterSystem-1VlNXZnO.js → WaterSystem-Ik6QzyT_.js} +2 -2
  57. package/dist-embed-sighting/rr0-sighting.mjs +335 -316
  58. package/dist-embed-sighting/sightingSchema-DoPVOlCB.js +1 -0
  59. package/dist-embed-sighting/{trafficRuntime-BUvbWOcl.js → trafficRuntime-CjDwU1Lk.js} +1 -1
  60. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-DNYpHE9t.js → AdsbLolArchiveProvider-CNMGHqqx.js} +1 -1
  61. package/dist-embed-sighting-editor/{AirshipEditor-B_TQEcNk.js → AirshipEditor-BVlkWwdL.js} +1 -1
  62. package/dist-embed-sighting-editor/{AirshipFlight-zrtPXNvX.js → AirshipFlight-Cvl6xWPY.js} +1 -1
  63. package/dist-embed-sighting-editor/{Aurora-wHi_XgNK.js → Aurora-DOIRpjiG.js} +1 -1
  64. package/dist-embed-sighting-editor/{AuroraEditor-CHAo9LbG.js → AuroraEditor-B0tCM7E7.js} +1 -1
  65. package/dist-embed-sighting-editor/{AuroraSimulation-CMoKbd0k.js → AuroraSimulation-CX7V0obh.js} +1 -1
  66. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-Bylahnc2.js → BallesterGuaspAssessor-DEJId5n8.js} +1 -1
  67. package/dist-embed-sighting-editor/{BalloonEditor-DOmOj25v.js → BalloonEditor-Drb5evP5.js} +1 -1
  68. package/dist-embed-sighting-editor/{BalloonFlight-DkhpbdZV.js → BalloonFlight-CGXmDbNq.js} +1 -1
  69. package/dist-embed-sighting-editor/{BeamEditor-CwC6pRPq.js → BeamEditor-DP2LNObR.js} +1 -1
  70. package/dist-embed-sighting-editor/{BeamSystem-Zsq9zuJa.js → BeamSystem-BCaOtm3H.js} +1 -1
  71. package/dist-embed-sighting-editor/{BirdEditor-DslUOI4x.js → BirdEditor-CbYZcYyG.js} +1 -1
  72. package/dist-embed-sighting-editor/{BirdFlock-BoXaV-S_.js → BirdFlock-Dv9Awhvf.js} +1 -1
  73. package/dist-embed-sighting-editor/{CaseElement-DFnjs2AU.js → CaseElement-CC4gimF1.js} +2 -2
  74. package/dist-embed-sighting-editor/{CaseReportExport-CX87uNr9.js → CaseReportExport-DmvvH_GH.js} +1 -1
  75. package/dist-embed-sighting-editor/{ContrailSystem-hUtlCEq-.js → ContrailSystem-ChbOVWp-.js} +1 -1
  76. package/dist-embed-sighting-editor/{ControlPasses-C8qq_tSL.js → ControlPasses-Dgz_D6DL.js} +1 -1
  77. package/dist-embed-sighting-editor/{CoverageAssessor-uzQnTEH8.js → CoverageAssessor-CcVuVsG0.js} +1 -1
  78. package/dist-embed-sighting-editor/{DroneEditor-M2V3FKbS.js → DroneEditor-D6k4gYj4.js} +1 -1
  79. package/dist-embed-sighting-editor/{DroneFlight-C1bur42A.js → DroneFlight-D-MWhrXa.js} +1 -1
  80. package/dist-embed-sighting-editor/{DroneParameters-DRfoxMx8.js → DroneParameters-CdQbwFKD.js} +1 -1
  81. package/dist-embed-sighting-editor/{Flightradar24Provider-BJDB9e9p.js → Flightradar24Provider-D_eLiI9k.js} +1 -1
  82. package/dist-embed-sighting-editor/{GLTFLoader-CQrldtm5.js → GLTFLoader-BIk0ozTu.js} +1 -1
  83. package/dist-embed-sighting-editor/{HeadlightSystem-BzXjwGDi.js → HeadlightSystem-C9tLjvpO.js} +1 -1
  84. package/dist-embed-sighting-editor/{HynekAssessor-Bpze0IeH.js → HynekAssessor-B4ej1xgG.js} +1 -1
  85. package/dist-embed-sighting-editor/{InterviewEditorElement-C6y-8Wze.js → InterviewEditorElement-Bo4OG2ig.js} +3 -3
  86. package/dist-embed-sighting-editor/{LanternEditor-6fXL9oHW.js → LanternEditor-Hd-8kmET.js} +1 -1
  87. package/dist-embed-sighting-editor/{LaserBeam-Cl4c8oJt.js → LaserBeam-Ca2QUeCT.js} +1 -1
  88. package/dist-embed-sighting-editor/{LaunchEditor-C9swLaSJ.js → LaunchEditor-BykQEscN.js} +1 -1
  89. package/dist-embed-sighting-editor/{LaunchPlume-CPBS4JLE.js → LaunchPlume-Dos-OyTV.js} +1 -1
  90. package/dist-embed-sighting-editor/{LaunchSimulation-zjImyFHC.js → LaunchSimulation-B0DgOoJM.js} +1 -1
  91. package/dist-embed-sighting-editor/{ModelSource-ZiTya13j.js → ModelSource-szsl2QtY.js} +1 -1
  92. package/dist-embed-sighting-editor/{ModelThumbnails-BKl0Wk33.js → ModelThumbnails-dnCeD6UT.js} +1 -1
  93. package/dist-embed-sighting-editor/{ModelViewer-ZZnOiYz4.js → ModelViewer-BNGSukqO.js} +1 -1
  94. package/dist-embed-sighting-editor/{ModuleConformance-CYQ-Mn8w.js → ModuleConformance-CEXxsL48.js} +2 -2
  95. package/dist-embed-sighting-editor/{ModuleSession-BklqVucx.js → ModuleSession-DOhPD2XZ.js} +2 -2
  96. package/dist-embed-sighting-editor/ModuleThree-BY0cNbGt.js +1 -0
  97. package/dist-embed-sighting-editor/{ModulesPanelElement-MEFltyZr.js → ModulesPanelElement-DTnJICg0.js} +3 -3
  98. package/dist-embed-sighting-editor/{NearestApproach-Bnx9Ld5_.js → NearestApproach-jDpDx7cm.js} +1 -1
  99. package/dist-embed-sighting-editor/{PoherAssessor-CNj_Nyci.js → PoherAssessor-yWlnEcoZ.js} +1 -1
  100. package/dist-embed-sighting-editor/{RailwaySystem-Dn-v2OAb.js → RailwaySystem-CAqOaX1c.js} +1 -1
  101. package/dist-embed-sighting-editor/{ReentryEditor-DPt4At81.js → ReentryEditor-CNLwoAIZ.js} +2 -2
  102. package/dist-embed-sighting-editor/{ReentrySimulation-DwaQrNN5.js → ReentrySimulation-Q-8h8lRK.js} +1 -1
  103. package/dist-embed-sighting-editor/{ReferenceSystem-DlaF5KWz.js → ReferenceSystem-B0tZDQ1-.js} +1 -1
  104. package/dist-embed-sighting-editor/SceneNames_en-CTJiUG-r.js +1 -0
  105. package/dist-embed-sighting-editor/SceneNames_es-DHZMjSqb.js +1 -0
  106. package/dist-embed-sighting-editor/SceneNames_fr-C36uyjbM.js +1 -0
  107. package/dist-embed-sighting-editor/SceneNames_it-BQJQm2rT.js +1 -0
  108. package/dist-embed-sighting-editor/{SearchlightEditor-CdTMwgER.js → SearchlightEditor-sQh92hx7.js} +1 -1
  109. package/dist-embed-sighting-editor/{SearchlightSystem-jipCae7J.js → SearchlightSystem-B_RPbGj4.js} +1 -1
  110. package/dist-embed-sighting-editor/{SightingEditorMessages_en-BmqJK2u_.js → SightingEditorMessages_en-V_dJYjNb.js} +1 -1
  111. package/{dist-embed-ufoathome/SightingEditorMessages_es-avQMqPMq.js → dist-embed-sighting-editor/SightingEditorMessages_es-DauDuhPa.js} +1 -1
  112. package/dist-embed-sighting-editor/{SightingEditorMessages_fr-ClEadK1E.js → SightingEditorMessages_fr-zxTvQa2I.js} +1 -1
  113. package/dist-embed-sighting-editor/{SightingEditorMessages_it-Co5behaA.js → SightingEditorMessages_it-vvaao68O.js} +1 -1
  114. package/dist-embed-sighting-editor/SightingElement-BpYuBmJB.js +694 -0
  115. package/dist-embed-sighting-editor/{SightingFileEditor-Du3A9uZm.js → SightingFileEditor-tIOJTG_y.js} +1 -1
  116. package/dist-embed-sighting-editor/SightingLabels_en-dOsFjVRL.js +1 -0
  117. package/dist-embed-sighting-editor/SightingLabels_es-CKlP2BDO.js +1 -0
  118. package/dist-embed-sighting-editor/{SightingLabels_fr-D69zENbW.js → SightingLabels_fr-Cpkcf5_9.js} +1 -1
  119. package/{dist-embed-ufoathome/SightingLabels_it-COLZ2Qth.js → dist-embed-sighting-editor/SightingLabels_it-3127rMXm.js} +1 -1
  120. package/dist-embed-sighting-editor/{SightingMessages_en-CzICxNU3.js → SightingMessages_en-Drcr3k4V.js} +1 -1
  121. package/dist-embed-sighting-editor/{SightingMessages_es-CiVFZlgA.js → SightingMessages_es-BcaWM7Oy.js} +1 -1
  122. package/dist-embed-sighting-editor/{SightingMessages_fr-nopOVDa1.js → SightingMessages_fr-7IYuW095.js} +1 -1
  123. package/dist-embed-sighting-editor/{SightingMessages_it-Cu0nnPts.js → SightingMessages_it-BhDmZn6p.js} +1 -1
  124. package/dist-embed-sighting-editor/{SkyLantern-CYhqKOnv.js → SkyLantern-Cj60Cn9B.js} +1 -1
  125. package/dist-embed-sighting-editor/{TraceSystem-Bj0G3fL7.js → TraceSystem-BK0y5lRX.js} +2 -2
  126. package/dist-embed-sighting-editor/{WaterSystem-Cv4v7PXz.js → WaterSystem-DMeMEW3i.js} +2 -2
  127. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +455 -434
  128. package/dist-embed-sighting-editor/sightingSchema-DoPVOlCB.js +1 -0
  129. package/dist-embed-sighting-editor/{trafficRuntime-BdBceXei.js → trafficRuntime-eGXY41n0.js} +1 -1
  130. package/dist-embed-ufoathome/{AdsbLolArchiveProvider-D169IKdZ.js → AdsbLolArchiveProvider-Ck345V92.js} +1 -1
  131. package/dist-embed-ufoathome/{Aurora-CP_Xi-9o.js → Aurora-CMORgA2p.js} +1 -1
  132. package/dist-embed-ufoathome/{AuroraEditor-B_Rxo_6I.js → AuroraEditor-CDZgVOlI.js} +1 -1
  133. package/dist-embed-ufoathome/{AuroraSimulation-KHkJyuus.js → AuroraSimulation-DqfSBul6.js} +1 -1
  134. package/dist-embed-ufoathome/{BallesterGuaspAssessor-58lmGHUw.js → BallesterGuaspAssessor-DUNQZ9e8.js} +1 -1
  135. package/dist-embed-ufoathome/{BalloonEditor-CAKXO8DQ.js → BalloonEditor-Cx3fRab8.js} +1 -1
  136. package/dist-embed-ufoathome/{BeamEditor-BOsTgbHL.js → BeamEditor-gxTjO6Pr.js} +1 -1
  137. package/dist-embed-ufoathome/{BeamSystem-C7OL1VWr.js → BeamSystem-C8jjTJtB.js} +1 -1
  138. package/dist-embed-ufoathome/{BodyEditor-DZ9-YBfo.js → BodyEditor-DGaBo74A.js} +1 -1
  139. package/dist-embed-ufoathome/{CaseEditorElement-BgT6HnpX.js → CaseEditorElement-BOp207Tr.js} +64 -61
  140. package/dist-embed-ufoathome/{CaseElement-DVXLO8mr.js → CaseElement-BGO5UZLP.js} +3 -3
  141. package/dist-embed-ufoathome/{CaseReportExport-Dui5KDc5.js → CaseReportExport-6DFaJzfO.js} +3 -3
  142. package/dist-embed-ufoathome/{ColumnResize-CO4e1m-q.js → ColumnResize-DnX89ynB.js} +9 -9
  143. package/dist-embed-ufoathome/{ControlPasses-CJ2jMdlf.js → ControlPasses-CeExr5X1.js} +1 -1
  144. package/dist-embed-ufoathome/{CoverageAssessor-CzhOt6fv.js → CoverageAssessor-BbqRqh0C.js} +1 -1
  145. package/dist-embed-ufoathome/{Flightradar24Provider-TCNh_VXc.js → Flightradar24Provider-MzQcuUHn.js} +1 -1
  146. package/dist-embed-ufoathome/{GLTFLoader-BaIfBICM.js → GLTFLoader-CPUffC65.js} +1 -1
  147. package/dist-embed-ufoathome/{GeoJsonExport-B5AFUVEM.js → GeoJsonExport-D7QhWNRC.js} +1 -1
  148. package/dist-embed-ufoathome/GeographicFigures-BvEeCtxr.js +1 -0
  149. package/dist-embed-ufoathome/HynekAssessor-BwjRkQWT.js +1 -0
  150. package/dist-embed-ufoathome/{InterviewEditorElement-o21YUvNz.js → InterviewEditorElement-CVCOicLD.js} +4 -4
  151. package/dist-embed-ufoathome/{InterviewElement-K_oIXneA.js → InterviewElement-ZI42DKRx.js} +1 -1
  152. package/dist-embed-ufoathome/{KmlExport-BfiqE1s2.js → KmlExport-BX0nxAaA.js} +1 -1
  153. package/dist-embed-ufoathome/{LanternEditor-CepeoImr.js → LanternEditor-BROUv-vx.js} +1 -1
  154. package/dist-embed-ufoathome/{LaserBeam-IRXmv6wc.js → LaserBeam-ChD9aV-N.js} +1 -1
  155. package/dist-embed-ufoathome/LaunchEditor-CM2Wcjv2.js +22 -0
  156. package/dist-embed-ufoathome/{LaunchPlume-CujlF3wZ.js → LaunchPlume-DeVRe05u.js} +1 -1
  157. package/dist-embed-ufoathome/{LaunchSimulation-58_ZZy8q.js → LaunchSimulation-RROdYccW.js} +1 -1
  158. package/dist-embed-ufoathome/{ModelSource-Bz25TN6e.js → ModelSource-nXZ6eIH5.js} +1 -1
  159. package/dist-embed-ufoathome/{ModelThumbnails-CcYlw6gA.js → ModelThumbnails-CRSm49vm.js} +1 -1
  160. package/dist-embed-ufoathome/{ModelViewer-CD90RTYi.js → ModelViewer-BQsl_Nfn.js} +1 -1
  161. package/dist-embed-ufoathome/{ModulesPanelElement-DZxFsuuG.js → ModulesPanelElement-BvzY1GUF.js} +2 -2
  162. package/dist-embed-ufoathome/NearestApproach-DbUpe1iw.js +1 -0
  163. package/dist-embed-ufoathome/{PoherAssessor-BkCJ1UTQ.js → PoherAssessor-Dmro58tC.js} +1 -1
  164. package/dist-embed-ufoathome/PoherMatrix-C2fcLqDH.js +1 -0
  165. package/dist-embed-ufoathome/PoherSelfCheck-pcYj_hQ1.js +1 -0
  166. package/dist-embed-ufoathome/{ReentryEditor-BjyUUZGU.js → ReentryEditor-Di0KzYeZ.js} +1 -1
  167. package/dist-embed-ufoathome/{ReentrySimulation-5VI9Dla4.js → ReentrySimulation-HhdlSVkR.js} +1 -1
  168. package/dist-embed-ufoathome/{ReferenceSystem-C0ZXvatV.js → ReferenceSystem-B30-UBHY.js} +1 -1
  169. package/dist-embed-ufoathome/ScenarioReadings-EAUAsx9t.js +1 -0
  170. package/dist-embed-ufoathome/ScenarioSweep-jTxLjnaW.js +1 -0
  171. package/dist-embed-ufoathome/SceneNames_en-sRbx6EJZ.js +1 -0
  172. package/dist-embed-ufoathome/SceneNames_es-pnfHB-7D.js +1 -0
  173. package/dist-embed-ufoathome/SceneNames_fr-BtTlti4C.js +1 -0
  174. package/dist-embed-ufoathome/SceneNames_it-DQKwdCVD.js +1 -0
  175. package/dist-embed-ufoathome/{SearchlightEditor-DPU1PgfT.js → SearchlightEditor-B6_BW8FD.js} +1 -1
  176. package/dist-embed-ufoathome/{SearchlightSystem-m0a11CEu.js → SearchlightSystem-D_DTpDNC.js} +1 -1
  177. package/dist-embed-ufoathome/{ShareDialogElement-DqCoQwtn.js → ShareDialogElement-C0oFh0X4.js} +150 -132
  178. package/dist-embed-ufoathome/Sighting-BX_CmDY2.js +1 -0
  179. package/dist-embed-ufoathome/{SightingEditorMessages_en-BmqJK2u_.js → SightingEditorMessages_en-V_dJYjNb.js} +1 -1
  180. package/{dist-embed-sighting-editor/SightingEditorMessages_es-avQMqPMq.js → dist-embed-ufoathome/SightingEditorMessages_es-DauDuhPa.js} +1 -1
  181. package/dist-embed-ufoathome/{SightingEditorMessages_fr-ClEadK1E.js → SightingEditorMessages_fr-zxTvQa2I.js} +1 -1
  182. package/dist-embed-ufoathome/{SightingEditorMessages_it-Co5behaA.js → SightingEditorMessages_it-vvaao68O.js} +1 -1
  183. package/dist-embed-ufoathome/SightingElement-DzxTvvLN.js +694 -0
  184. package/dist-embed-ufoathome/{SightingFileEditor-DS1DRU2p.js → SightingFileEditor-D5_GwIsn.js} +1 -1
  185. package/dist-embed-ufoathome/SightingLabels_en-dOsFjVRL.js +1 -0
  186. package/dist-embed-ufoathome/SightingLabels_es-CKlP2BDO.js +1 -0
  187. package/dist-embed-ufoathome/{SightingLabels_fr-D69zENbW.js → SightingLabels_fr-Cpkcf5_9.js} +1 -1
  188. package/{dist-embed-sighting-editor/SightingLabels_it-COLZ2Qth.js → dist-embed-ufoathome/SightingLabels_it-3127rMXm.js} +1 -1
  189. package/dist-embed-ufoathome/{SightingMessages_en-CzICxNU3.js → SightingMessages_en-Drcr3k4V.js} +1 -1
  190. package/dist-embed-ufoathome/{SightingMessages_es-CiVFZlgA.js → SightingMessages_es-BcaWM7Oy.js} +1 -1
  191. package/dist-embed-ufoathome/{SightingMessages_fr-nopOVDa1.js → SightingMessages_fr-7IYuW095.js} +1 -1
  192. package/dist-embed-ufoathome/{SightingMessages_it-Cu0nnPts.js → SightingMessages_it-BhDmZn6p.js} +1 -1
  193. package/dist-embed-ufoathome/{TraceSystem-BLumvnJD.js → TraceSystem-CiBRo1aU.js} +1 -1
  194. package/dist-embed-ufoathome/{VideoButton-hYfTEunC.js → VideoButton-BseBKx2r.js} +1 -1
  195. package/dist-embed-ufoathome/rr0-ufoathome.mjs +10 -10
  196. package/dist-embed-ufoathome/sightingSchema-DoPVOlCB.js +1 -0
  197. package/dist-embed-ufoathome/{surroundingsSources-BWHnZ_qg.js → surroundingsSources-BSh42KUu.js} +1 -1
  198. package/dist-embed-ufoathome/{trafficRuntime-Xpncp71U.js → trafficRuntime-BMTtwn7o.js} +2 -2
  199. package/package.json +1 -1
  200. package/dist-embed-scene/SceneNames_en-BFJsR6Cc.js +0 -1
  201. package/dist-embed-scene/SceneNames_es-BHBTwcJ3.js +0 -1
  202. package/dist-embed-scene/SceneNames_fr-CFsA4XeK.js +0 -1
  203. package/dist-embed-scene/SceneNames_it-DkIgwviv.js +0 -1
  204. package/dist-embed-scene/sightingSchema-9MogCcUd.js +0 -1
  205. package/dist-embed-sighting/BalloonEditor-CaWwqWKK.js +0 -24
  206. package/dist-embed-sighting/ControlPasses-Dr6eP2Mq.js +0 -29
  207. package/dist-embed-sighting/GenerativeKitMessages-NbyGMKAR.js +0 -1
  208. package/dist-embed-sighting/LanternEditor-Be5Io1J-.js +0 -24
  209. package/dist-embed-sighting/ModuleThree-BLNSm2eY.js +0 -1
  210. package/dist-embed-sighting/SceneNames_en-BlRTU7Hq.js +0 -1
  211. package/dist-embed-sighting/SceneNames_es-DMNd9trd.js +0 -1
  212. package/dist-embed-sighting/SceneNames_fr-DlMcv9D0.js +0 -1
  213. package/dist-embed-sighting/SceneNames_it-DqlWMlOE.js +0 -1
  214. package/dist-embed-sighting/SightingMessages_en-D3YVhgUj.js +0 -1
  215. package/dist-embed-sighting/SightingMessages_es-ME6FeTp-.js +0 -1
  216. package/dist-embed-sighting/SightingMessages_fr-BgXYuIq4.js +0 -1
  217. package/dist-embed-sighting/SightingMessages_it-DcE90eAl.js +0 -1
  218. package/dist-embed-sighting/sightingSchema-9MogCcUd.js +0 -1
  219. package/dist-embed-sighting-editor/ModuleThree-jNUgMjnf.js +0 -1
  220. package/dist-embed-sighting-editor/SceneNames_en-c5zNw0Hi.js +0 -1
  221. package/dist-embed-sighting-editor/SceneNames_es-CDjoBwy_.js +0 -1
  222. package/dist-embed-sighting-editor/SceneNames_fr-CoZNmFu3.js +0 -1
  223. package/dist-embed-sighting-editor/SceneNames_it-CVEahBpq.js +0 -1
  224. package/dist-embed-sighting-editor/SightingElement-C6CT6DBZ.js +0 -693
  225. package/dist-embed-sighting-editor/SightingLabels_en-oIpytoq_.js +0 -1
  226. package/dist-embed-sighting-editor/SightingLabels_es-DUh1CTXl.js +0 -1
  227. package/dist-embed-sighting-editor/sightingSchema-9MogCcUd.js +0 -1
  228. package/dist-embed-ufoathome/GeographicFigures-DrlbDt4f.js +0 -1
  229. package/dist-embed-ufoathome/HynekAssessor-DaCcWwTH.js +0 -1
  230. package/dist-embed-ufoathome/LaunchEditor-C4hq0VUw.js +0 -22
  231. package/dist-embed-ufoathome/NearestApproach-DsszB5Rd.js +0 -1
  232. package/dist-embed-ufoathome/ScenarioReadings-CBWjF8TY.js +0 -1
  233. package/dist-embed-ufoathome/ScenarioSweep-MaryBOLs.js +0 -1
  234. package/dist-embed-ufoathome/SceneNames_en-7OZ7peGc.js +0 -1
  235. package/dist-embed-ufoathome/SceneNames_es-P5-Mavdi.js +0 -1
  236. package/dist-embed-ufoathome/SceneNames_fr-qzw0QzD0.js +0 -1
  237. package/dist-embed-ufoathome/SceneNames_it-Sqf8JFOd.js +0 -1
  238. package/dist-embed-ufoathome/Sighting-D-_IYi9n.js +0 -1
  239. package/dist-embed-ufoathome/SightingElement-CUrYpWRD.js +0 -693
  240. package/dist-embed-ufoathome/SightingLabels_en-oIpytoq_.js +0 -1
  241. package/dist-embed-ufoathome/SightingLabels_es-DUh1CTXl.js +0 -1
  242. package/dist-embed-ufoathome/sightingSchema-9MogCcUd.js +0 -1
@@ -1 +1 @@
1
- import{bk as X}from"./rr0-sighting-editor.mjs";class a{static SAMPLE_MS=1e3;static MAX_KEYFRAMES=6e3;static STEP_S=.05;static G=9.80665;static R=8.314462;static AIR_KG_MOL=.0289644;static R_AIR=a.R/a.AIR_KG_MOL;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static GUST_GROUND_M=2;static MAX_FLAMES=9;static TETHER_M=30;static CRUISE_M=300;static PILOT_MS=2;static TITLES={"hot-air":{en:"Hot-air balloon",fr:"Montgolfière",es:"Globo aerostático",it:"Mongolfiera"},party:{en:"Party balloon",fr:"Ballon de baudruche",es:"Globo de fiesta",it:"Palloncino"},led:{en:"LED balloon",fr:"Ballon lumineux à LED",es:"Globo de LED",it:"Palloncino a LED"},foil:{en:"Foil balloon",fr:"Ballon métallisé",es:"Globo metalizado",it:"Palloncino metallizzato"},pilot:{en:"Pilot balloon",fr:"Ballon pilote",es:"Globo piloto",it:"Pallone pilota"},weather:{en:"Weather balloon",fr:"Ballon-sonde",es:"Globo sonda",it:"Pallone sonda"},stratospheric:{en:"Stratospheric balloon",fr:"Ballon stratosphérique",es:"Globo estratosférico",it:"Pallone stratosferico"},"stratospheric-large":{en:"Large stratospheric balloon",fr:"Grand ballon stratosphérique",es:"Gran globo estratosférico",it:"Grande pallone stratosferico"},superpressure:{en:"Superpressure balloon",fr:"Ballon pressurisé",es:"Globo presurizado",it:"Pallone pressurizzato"},infrared:{en:"Infrared hot-air balloon",fr:"Montgolfière infrarouge",es:"Globo infrarrojo",it:"Mongolfiera infrarossa"},"prank-candles":{en:"Prank balloon",fr:"Ballon farceur",es:"Globo de broma",it:"Pallone scherzo"},"prank-flares":{en:"Prank balloon with a flare",fr:"Ballon farceur à feu de détresse",es:"Globo de broma con bengala",it:"Pallone scherzo con razzo"},"anti-hail":{en:"Anti-hail balloon",fr:"Ballon anti-grêle",es:"Globo antigranizo",it:"Pallone antigrandine"},solar:{en:"Solar balloon",fr:"Ballon solaire",es:"Globo solar",it:"Pallone solare"},captive:{en:"Captive balloon",fr:"Ballon captif",es:"Globo cautivo",it:"Pallone frenato"}};static computed=new Map;static bodiesOf(e){const n=JSON.stringify(e);let r=a.computed.get(n);if(!r){const t=a.releasesOf(e);r=t.flatMap((c,o)=>a.balloonBodies(e,c,o,t.length)),a.computed.set(n,r),a.computed.size>16&&a.computed.delete(a.computed.keys().next().value)}return r}static typeOf(e){const n=e.balloon,r=typeof n=="string"?n:n?.id,t=X.byId(r)??X.ALL[0],c=t.shapes?t.shapes[e.shape??"round"]??Object.values(t.shapes)[0]:void 0,o=c?{...t,...c}:t;return typeof n=="string"?o:{...o,...n,id:o.id}}static flamesOf(e,n){return n.flames?Math.max(1,Math.min(9,Math.round(e.flames??n.flames.count))):0}static flameShare(e,n){const r=e.flames?.burnS;if(r===void 0||n<0||n>=r)return 0;const t=r*.75;return n<=t?1:(r-n)/(r-t)}static releasesOf(e){const n=[...e.releases??[]],r=e.group;if(r&&r.count>0){const t=a.randomFrom(r.seed??1),c=r.count>1?(r.untilT-r.fromT)/(r.count-1):0,o=r.radiusM??10,d=r.fillSpread??.1;for(let i=0;i<r.count;i++){const f=r.fromT+c*i+(t()-.5)*c,p=o*Math.sqrt(t()),u=2*Math.PI*t();n.push({t:Math.round(Math.min(r.untilT,Math.max(r.fromT,f))),eastM:Math.round(p*Math.sin(u)*10)/10,northM:Math.round(p*Math.cos(u)*10)/10,fill:Math.round((2*t()-1)*d*1e3)/1e3,...r.colors?.length?{color:r.colors[i%r.colors.length]}:{},seed:Math.floor(t()*4294967296)})}}return n.length>0?n:[{t:0}]}static airAt(e,n=0,r=0){const t=a.LAYERS,c=Math.max(-500,Math.min(a.EARTH_RADIUS_M*e/(a.EARTH_RADIUS_M+e),47e3));let o=t[0];for(const M of t)c>=M.fromM&&(o=M);const d=c-o.fromM,i=o.baseK+o.lapseKM*d,f=a.G*a.AIR_KG_MOL/a.R,p=o.lapseKM===0?o.basePa*Math.exp(-f*d/o.baseK):o.basePa*Math.pow(o.baseK/i,f/o.lapseKM),u=Math.max(0,1-Math.max(0,e-r)/11e3);return{pressurePa:p,temperatureK:i+n*u}}static EARTH_RADIUS_M=6356766;static LAYERS=[{fromM:0,baseK:288.15,basePa:101325,lapseKM:-.0065},{fromM:11e3,baseK:216.65,basePa:22632.06,lapseKM:0},{fromM:2e4,baseK:216.65,basePa:5474.889,lapseKM:.001},{fromM:32e3,baseK:228.65,basePa:868.0187,lapseKM:.0028}];static windAt(e,n){const r=[{atM:0,...e.wind??{towardDeg:0,speedMS:0}},...[...e.windsAloft??[]].sort((c,o)=>c.atM-o.atM)],t=c=>({x:Math.sin(c.towardDeg*Math.PI/180)*c.speedMS,y:Math.cos(c.towardDeg*Math.PI/180)*c.speedMS});if(n<=r[0].atM||r.length===1)return t(r[0]);for(let c=1;c<r.length;c++){if(n>r[c].atM)continue;const o=t(r[c-1]),d=t(r[c]),i=(n-r[c-1].atM)/Math.max(1e-6,r[c].atM-r[c-1].atM);return{x:o.x+(d.x-o.x)*i,y:o.y+(d.y-o.y)*i}}return t(r[r.length-1])}static planAt(e,n){const r=[...e.plan??[]].sort((c,o)=>c.t-o.t);if(r.length===0)return a.CRUISE_M;let t=r[0].altitudeM;for(const c of r)c.t<=n&&(t=c.altitudeM);return t}static widthOf(e,n){return e.widthM!==void 0?e.widthM:Math.cbrt(6*n/Math.PI)}static trajectory(e,n,r=a.SAMPLE_MS){const t=a.typeOf(e),c=e.site,o=c.altitudeM??0,d=c.originElevationM??0,i=d+o,f=(e.airTemperatureC??15)+273.15-a.airAt(i).temperatureK,p=t.gasMolarMassKgMol??X.HELIUM_KG_MOL,u=e.durationS??t.durationS,M=a.STEP_S,v=Math.ceil(u/M);r=Math.max(r,Math.ceil(u*1e3/a.MAX_KEYFRAMES/500)*500);const x=Math.max(1,Math.round(r/1e3/M)),K={x:c.eastM+(n.eastM??0),y:c.northM+(n.northM??0)},E=t.tethered?e.tetherM??a.TETHER_M:void 0,T=a.flamesOf(e,t),O=t.flames?(t.insideExcessK??0)*T/t.flames.count:0,A=l=>{const{pressurePa:m,temperatureK:b}=a.airAt(l+d,f,i);return{p:m,T:b,rho:m/(a.R_AIR*b)}},D=1+(n.fill??0),V=t.launchVolumeM3*D*101325*p/(a.R*288.15),z=n.altitudeM??o,s={x:K.x,y:K.y,z,vx:0,vy:0,vz:0,gasKg:V,excessK:0,burnUntilS:-1,ballastKg:t.ballastKg??0,floated:!1};if(t.envelope==="open"){const l=A(z);s.excessK=t.burner?Math.max(0,l.T*t.massKg/(l.rho*t.maxVolumeM3-t.massKg)):t.flames?O*a.flameShare(t,0):t.insideExcessK??0}const S=l=>{if(t.envelope==="sealed")return t.maxVolumeM3;if(t.envelope==="open")return t.launchVolumeM3>=t.maxVolumeM3?t.maxVolumeM3:Math.min(t.maxVolumeM3,t.launchVolumeM3*D*(101325/288.15)/(l.p/l.T));const m=s.gasKg*a.R*l.T/(l.p*p);return t.envelope==="elastic"?m:Math.min(m,t.maxVolumeM3)},P=A(z),y=[{t:n.t,x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,S(P)),burning:!1,flame:a.flameShare(t,0)}],k=a.gusts(e.turbulence??a.TURBULENCE,a.seedOf(n),M);let w="time",q=0,Y=-1/0;for(let l=1;l<=v;l++){const m=l*M,b=A(s.z);let R=S(b);if(t.torch&&s.z-o>=(e.triggerM??t.torch.aboveM)){w="lit",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,R),burning:!1,flame:0});break}if(t.envelope==="elastic"&&R>=t.maxVolumeM3){w="burst",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,t.maxVolumeM3),burning:!1,flame:0});break}if(t.envelope==="vented"){const h=t.maxVolumeM3*b.p*p/(a.R*b.T);s.gasKg>=h&&(s.gasKg=h,s.floated=!0),R=S(b)}const G=t.burner;let I=!1;if(G){const h=a.planAt(e,n.t+m*1e3),F=h<=0?-Math.min(1,Math.max(.5,(s.z-o)/40))*a.PILOT_MS/2:Math.max(-a.PILOT_MS,Math.min(a.PILOT_MS,(h+o-s.z)/40)),ee=h<=0,ce=ee?-2.5:F-.3,ie=ee?-.3:F+.8;m>=s.burnUntilS&&s.vz<ce&&m-Y>2&&s.excessK<G.maxExcessK&&(s.burnUntilS=m+G.blastS),I=m<s.burnUntilS,!I&&s.burnUntilS>0&&m-M<s.burnUntilS&&(Y=m),I&&(s.excessK=Math.min(G.maxExcessK,s.excessK+G.heatingKS*M)),s.excessK-=s.excessK/G.coolingS*M,!I&&s.vz>ie&&(s.excessK-=.5*M),s.excessK=Math.max(0,s.excessK)}const j=a.flameShare(t,m);t.flames&&(s.excessK+=(O*j-s.excessK)*Math.min(1,M/t.flames.coolingS));const Z=t.envelope==="open"?b.p*R/(a.R_AIR*(b.T+s.excessK)):s.gasKg,N=(b.rho*R-Z)*a.G;let U=t.massKg-((t.ballastKg??0)-s.ballastKg);if(s.floated&&s.ballastKg>0&&N<U*a.G){const h=Math.min(s.ballastKg,U-N/a.G);s.ballastKg-=h,U-=h}const te=U*a.G,W=U+Z+.5*b.rho*R,H=a.widthOf(t,R),se=Math.PI*H*H/4*(t.depthRatio!==void 0?(1+t.depthRatio)/2:1),J=s.z-o,Q=a.windAt(e,J),$=k(),ae=Math.max(0,Math.min(1,J/a.GUST_GROUND_M)),C={x:Q.x+$.x,y:Q.y+$.y,z:$.z*ae},re=s.vx-C.x,oe=s.vy-C.y,ne=s.vz-C.z,L=.5*b.rho*t.dragCoefficient*se*Math.hypot(re,oe,ne)/W;s.vx=(s.vx+L*M*C.x)/(1+L*M),s.vy=(s.vy+L*M*C.y)/(1+L*M),s.vz=(s.vz+L*M*C.z+(N-te)/W*M)/(1+L*M);const g=s.z<=o+1e-6&&s.vz<=0;g&&(s.vx=0,s.vy=0,s.vz=0),s.x+=s.vx*M,s.y+=s.vy*M,s.z=Math.max(o,s.z+s.vz*M),E!==void 0&&a.heldBy(s,K,o,E),q=g&&m>10?q+M:0;const _=q>30&&!t.tethered,B=y.length>0&&y[y.length-1].burning!==I;if(l%x===0||l===v||B||_){const h=n.t+Math.round(m*1e3);B&&y.push({t:h-1,x:s.x,y:s.y,z:s.z,widthM:H,burning:!I,flame:j}),y.push({t:h,x:s.x,y:s.y,z:s.z,widthM:H,burning:I,flame:j})}if(_){w="landed";break}}return{samples:y,end:w}}static heldBy(e,n,r,t){const c=e.x-n.x,o=e.y-n.y,d=e.z-r,i=Math.hypot(c,o,d);if(i<=t||i===0)return;const f=c/i,p=o/i,u=d/i;e.x=n.x+f*t,e.y=n.y+p*t,e.z=r+u*t;const M=e.vx*f+e.vy*p+e.vz*u;M>0&&(e.vx-=M*f,e.vy-=M*p,e.vz-=M*u)}static balloonBodies(e,n,r,t){const{samples:c,end:o}=a.trajectory(e,n),d=a.balloonBody(e,n,r,t,c),i=a.typeOf(e);return o==="lit"&&i.torch?[d,a.torchBody(e,n,d.id,c[c.length-1],i.torch)]:[d]}static torchBody(e,n,r,t,c){const o=e.site.altitudeM??0,d=a.TORCH_FLAME_M/2,i=[];let f=t.x,p=t.y,u=t.z;const M=a.randomFrom(a.seedOf(n)^1374496523),v={degrees:4+4*M(),periodS:2+2*M(),phase:2*Math.PI*M()};for(let x=0;;x++){const K=x<c.burnS*.9?1:x<c.burnS?(c.burnS-x)/(c.burnS*.1):0,E=2*Math.PI*x/v.periodS+v.phase;if(i.push({t:t.t+x*1e3,eastM:a.round(f),northM:a.round(p),altitudeM:a.round(u),...x===0?{sizeM:a.TORCH_SIZE,present:!0,appearance:{color:"#d8d2c4",albedo:.6}}:{},attitude:{pitchDeg:a.round(v.degrees*Math.sin(E),10),rollDeg:a.round(v.degrees*Math.cos(E),10)},lights:{"light-flame":a.round(c.candela*K/(Math.PI*d*d),1)}}),u<=o)break;const T=a.windAt(e,u-o);f+=T.x,p+=T.y,u=Math.max(o,u-c.fallMS)}return i.push({t:i[i.length-1].t+1,present:!1}),{id:`${r}-torch`,title:a.TORCH_TITLE,...e.explains?{explains:e.explains}:{},model:{id:"ufoathome-balloon-torch"},modelParameters:{flameColor:c.color},track:i}}static TORCH_SIZE={widthM:1.2,lengthM:1.2,heightM:1.6};static TORCH_FLAME_M=.2;static TORCH_TITLE={en:"Hygroscopic torch",fr:"Torche hygroscopique",es:"Antorcha higroscópica",it:"Torcia igroscopica"};static balloonBody(e,n,r,t,c){const o=a.typeOf(e),d=n.color??e.color??(o.glow?o.glow.color:o.color),i=o.depthRatio??1,f=e.lit&&o.lamp?o.lamp:void 0,p=s=>o.glow?o.glow.candela/(Math.PI*s*s/4):0,u=a.randomFrom(a.seedOf(n)^2654435769),M=o.spins?(5+15*u())*(u()<.5?-1:1):0,v=360*u(),x=o.sways?{degrees:3+4*u(),periodS:3+3*u(),phase:2*Math.PI*u()}:void 0,K=s=>{if(M===0&&!x)return;const S=(s-n.t)/1e3,P=x?2*Math.PI*S/x.periodS+x.phase:0;return{...M!==0?{headingDeg:a.round(((v+M*S)%360+360)%360,10)}:{},...x?{pitchDeg:a.round(x.degrees*Math.sin(P),10),rollDeg:a.round(x.degrees*Math.cos(P*.83),10)}:{}}},E=a.flamesOf(e,o),T=e.partColors?.flame??o.flames?.color;let O=-1;const A=c.map((s,S)=>{const P=Math.abs(s.widthM-O)>O*.005;P&&(O=s.widthM);const y={widthM:a.round(s.widthM,1e3),lengthM:a.round(s.widthM*i,1e3),heightM:a.round(s.widthM*o.aspect,1e3)},k={t:s.t,eastM:a.round(s.x),northM:a.round(s.y),altitudeM:a.round(s.z),...S===0?{present:!0}:{},...P?{sizeM:y}:{},...K(s.t)?{attitude:K(s.t)}:{},...S===0?{appearance:{color:d,albedo:o.albedo,...o.finish?{finish:o.finish}:{},...o.glow?{luminanceCdM2:p(s.widthM)}:{}}}:o.glow&&P?{appearance:{color:d,luminanceCdM2:a.round(p(s.widthM),100)}}:{}},w=a.lightsOf(o,s.burning,f,s.widthM,E,s.flame);return w&&(k.lights=w),k});A.push({t:c[c.length-1].t+1,present:!1});const D=e.title??a.TITLES[o.id],V=e.explainsEach?e.explainsEach[r]!==void 0?{explains:[e.explainsEach[r]]}:{}:{...e.explains?{explains:e.explains}:{},...t>1?{ensemble:e.id}:{}},z={envelopeColor:d};o.stripeColor&&(z.stripeColor=o.stripeColor),f&&(z.lampColor=f.color),T&&(z.flameColor=T);for(const[s,S]of Object.entries(e.partColors??{}))z[`${s}Color`]=S;return{id:t>1?`${e.id}-${r+1}`:e.id,title:D,...V,model:{id:o.modelId},modelParameters:z,...o.id==="hot-air"?{sound:{kind:"balloon"}}:{},altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:A}}static lightsOf(e,n,r,t,c=0,o=0){if(e.flames){const d=t/50,i={};for(let f=1;f<=a.MAX_FLAMES;f++)i[`light-flame-${f}`]=f<=c?a.round(e.flames.candela*o/(Math.PI*d*d),1):0;return i.envelope=a.round(e.flames.candela*c*o*.5/(Math.PI*t/2*t*e.aspect/2),1e3),i}if(e.burner){const d=n?e.burner.envelopeCdM2:0;return{flame:n?e.burner.flameCdM2:0,envelope:d,"envelope-stripe":d}}if(e.modelId==="ufoathome-balloon-latex"){const d=t/40;return{"light-lamp":r?a.round(r.candela/(Math.PI*d*d),1):0}}}static seedOf(e){return e.seed!==void 0?e.seed:Math.round(e.t)*2654435761+Math.round((e.eastM??0)*100)*40503+Math.round((e.northM??0)*100)>>>0}static gusts(e,n,r){const t=a.randomFrom(n),c=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,t())))*Math.cos(2*Math.PI*t()),o=e.timescaleS>0?Math.exp(-r/e.timescaleS):0,d=Math.sqrt(1-o*o),i={x:e.horizontalMS*c(),y:e.horizontalMS*c(),z:e.verticalMS*c()};return()=>(i.x=o*i.x+d*e.horizontalMS*c(),i.y=o*i.y+d*e.horizontalMS*c(),i.z=o*i.z+d*e.verticalMS*c(),i)}static randomFrom(e){let n=e>>>0;return()=>{n=n+1831565813>>>0;let r=n;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}static round(e,n=100){return Math.round(e*n)/n}}export{a as BalloonFlight};
1
+ import{bl as X}from"./rr0-sighting-editor.mjs";class a{static SAMPLE_MS=1e3;static MAX_KEYFRAMES=6e3;static STEP_S=.05;static G=9.80665;static R=8.314462;static AIR_KG_MOL=.0289644;static R_AIR=a.R/a.AIR_KG_MOL;static TURBULENCE={horizontalMS:.8,verticalMS:.3,timescaleS:30};static GUST_GROUND_M=2;static MAX_FLAMES=9;static TETHER_M=30;static CRUISE_M=300;static PILOT_MS=2;static TITLES={"hot-air":{en:"Hot-air balloon",fr:"Montgolfière",es:"Globo aerostático",it:"Mongolfiera"},party:{en:"Party balloon",fr:"Ballon de baudruche",es:"Globo de fiesta",it:"Palloncino"},led:{en:"LED balloon",fr:"Ballon lumineux à LED",es:"Globo de LED",it:"Palloncino a LED"},foil:{en:"Foil balloon",fr:"Ballon métallisé",es:"Globo metalizado",it:"Palloncino metallizzato"},pilot:{en:"Pilot balloon",fr:"Ballon pilote",es:"Globo piloto",it:"Pallone pilota"},weather:{en:"Weather balloon",fr:"Ballon-sonde",es:"Globo sonda",it:"Pallone sonda"},stratospheric:{en:"Stratospheric balloon",fr:"Ballon stratosphérique",es:"Globo estratosférico",it:"Pallone stratosferico"},"stratospheric-large":{en:"Large stratospheric balloon",fr:"Grand ballon stratosphérique",es:"Gran globo estratosférico",it:"Grande pallone stratosferico"},superpressure:{en:"Superpressure balloon",fr:"Ballon pressurisé",es:"Globo presurizado",it:"Pallone pressurizzato"},infrared:{en:"Infrared hot-air balloon",fr:"Montgolfière infrarouge",es:"Globo infrarrojo",it:"Mongolfiera infrarossa"},"prank-candles":{en:"Prank balloon",fr:"Ballon farceur",es:"Globo de broma",it:"Pallone scherzo"},"prank-flares":{en:"Prank balloon with a flare",fr:"Ballon farceur à feu de détresse",es:"Globo de broma con bengala",it:"Pallone scherzo con razzo"},"anti-hail":{en:"Anti-hail balloon",fr:"Ballon anti-grêle",es:"Globo antigranizo",it:"Pallone antigrandine"},solar:{en:"Solar balloon",fr:"Ballon solaire",es:"Globo solar",it:"Pallone solare"},captive:{en:"Captive balloon",fr:"Ballon captif",es:"Globo cautivo",it:"Pallone frenato"}};static computed=new Map;static bodiesOf(e){const n=JSON.stringify(e);let r=a.computed.get(n);if(!r){const t=a.releasesOf(e);r=t.flatMap((c,o)=>a.balloonBodies(e,c,o,t.length)),a.computed.set(n,r),a.computed.size>16&&a.computed.delete(a.computed.keys().next().value)}return r}static typeOf(e){const n=e.balloon,r=typeof n=="string"?n:n?.id,t=X.byId(r)??X.ALL[0],c=t.shapes?t.shapes[e.shape??"round"]??Object.values(t.shapes)[0]:void 0,o=c?{...t,...c}:t;return typeof n=="string"?o:{...o,...n,id:o.id}}static flamesOf(e,n){return n.flames?Math.max(1,Math.min(9,Math.round(e.flames??n.flames.count))):0}static flameShare(e,n){const r=e.flames?.burnS;if(r===void 0||n<0||n>=r)return 0;const t=r*.75;return n<=t?1:(r-n)/(r-t)}static releasesOf(e){const n=[...e.releases??[]],r=e.group;if(r&&r.count>0){const t=a.randomFrom(r.seed??1),c=r.count>1?(r.untilT-r.fromT)/(r.count-1):0,o=r.radiusM??10,d=r.fillSpread??.1;for(let i=0;i<r.count;i++){const f=r.fromT+c*i+(t()-.5)*c,p=o*Math.sqrt(t()),u=2*Math.PI*t();n.push({t:Math.round(Math.min(r.untilT,Math.max(r.fromT,f))),eastM:Math.round(p*Math.sin(u)*10)/10,northM:Math.round(p*Math.cos(u)*10)/10,fill:Math.round((2*t()-1)*d*1e3)/1e3,...r.colors?.length?{color:r.colors[i%r.colors.length]}:{},seed:Math.floor(t()*4294967296)})}}return n.length>0?n:[{t:0}]}static airAt(e,n=0,r=0){const t=a.LAYERS,c=Math.max(-500,Math.min(a.EARTH_RADIUS_M*e/(a.EARTH_RADIUS_M+e),47e3));let o=t[0];for(const M of t)c>=M.fromM&&(o=M);const d=c-o.fromM,i=o.baseK+o.lapseKM*d,f=a.G*a.AIR_KG_MOL/a.R,p=o.lapseKM===0?o.basePa*Math.exp(-f*d/o.baseK):o.basePa*Math.pow(o.baseK/i,f/o.lapseKM),u=Math.max(0,1-Math.max(0,e-r)/11e3);return{pressurePa:p,temperatureK:i+n*u}}static EARTH_RADIUS_M=6356766;static LAYERS=[{fromM:0,baseK:288.15,basePa:101325,lapseKM:-.0065},{fromM:11e3,baseK:216.65,basePa:22632.06,lapseKM:0},{fromM:2e4,baseK:216.65,basePa:5474.889,lapseKM:.001},{fromM:32e3,baseK:228.65,basePa:868.0187,lapseKM:.0028}];static windAt(e,n){const r=[{atM:0,...e.wind??{towardDeg:0,speedMS:0}},...[...e.windsAloft??[]].sort((c,o)=>c.atM-o.atM)],t=c=>({x:Math.sin(c.towardDeg*Math.PI/180)*c.speedMS,y:Math.cos(c.towardDeg*Math.PI/180)*c.speedMS});if(n<=r[0].atM||r.length===1)return t(r[0]);for(let c=1;c<r.length;c++){if(n>r[c].atM)continue;const o=t(r[c-1]),d=t(r[c]),i=(n-r[c-1].atM)/Math.max(1e-6,r[c].atM-r[c-1].atM);return{x:o.x+(d.x-o.x)*i,y:o.y+(d.y-o.y)*i}}return t(r[r.length-1])}static planAt(e,n){const r=[...e.plan??[]].sort((c,o)=>c.t-o.t);if(r.length===0)return a.CRUISE_M;let t=r[0].altitudeM;for(const c of r)c.t<=n&&(t=c.altitudeM);return t}static widthOf(e,n){return e.widthM!==void 0?e.widthM:Math.cbrt(6*n/Math.PI)}static trajectory(e,n,r=a.SAMPLE_MS){const t=a.typeOf(e),c=e.site,o=c.altitudeM??0,d=c.originElevationM??0,i=d+o,f=(e.airTemperatureC??15)+273.15-a.airAt(i).temperatureK,p=t.gasMolarMassKgMol??X.HELIUM_KG_MOL,u=e.durationS??t.durationS,M=a.STEP_S,v=Math.ceil(u/M);r=Math.max(r,Math.ceil(u*1e3/a.MAX_KEYFRAMES/500)*500);const l=Math.max(1,Math.round(r/1e3/M)),K={x:c.eastM+(n.eastM??0),y:c.northM+(n.northM??0)},E=t.tethered?e.tetherM??a.TETHER_M:void 0,T=a.flamesOf(e,t),O=t.flames?(t.insideExcessK??0)*T/t.flames.count:0,A=x=>{const{pressurePa:m,temperatureK:b}=a.airAt(x+d,f,i);return{p:m,T:b,rho:m/(a.R_AIR*b)}},D=1+(n.fill??0),V=t.launchVolumeM3*D*101325*p/(a.R*288.15),z=n.altitudeM??o,s={x:K.x,y:K.y,z,vx:0,vy:0,vz:0,gasKg:V,excessK:0,burnUntilS:-1,ballastKg:t.ballastKg??0,floated:!1};if(t.envelope==="open"){const x=A(z);s.excessK=t.burner?Math.max(0,x.T*t.massKg/(x.rho*t.maxVolumeM3-t.massKg)):t.flames?O*a.flameShare(t,0):t.insideExcessK??0}const S=x=>{if(t.envelope==="sealed")return t.maxVolumeM3;if(t.envelope==="open")return t.launchVolumeM3>=t.maxVolumeM3?t.maxVolumeM3:Math.min(t.maxVolumeM3,t.launchVolumeM3*D*(101325/288.15)/(x.p/x.T));const m=s.gasKg*a.R*x.T/(x.p*p);return t.envelope==="elastic"?m:Math.min(m,t.maxVolumeM3)},P=A(z),y=[{t:n.t,x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,S(P)),burning:!1,flame:a.flameShare(t,0)}],k=a.gusts(e.turbulence??a.TURBULENCE,a.seedOf(n),M);let w="time",q=0,Y=-1/0;for(let x=1;x<=v;x++){const m=x*M,b=A(s.z);let R=S(b);if(t.torch&&s.z-o>=(e.triggerM??t.torch.aboveM)){w="lit",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,R),burning:!1,flame:0});break}if(t.envelope==="elastic"&&R>=t.maxVolumeM3){w="burst",y.push({t:n.t+Math.round(m*1e3),x:s.x,y:s.y,z:s.z,widthM:a.widthOf(t,t.maxVolumeM3),burning:!1,flame:0});break}if(t.envelope==="vented"){const h=t.maxVolumeM3*b.p*p/(a.R*b.T);s.gasKg>=h&&(s.gasKg=h,s.floated=!0),R=S(b)}const G=t.burner;let I=!1;if(G){const h=a.planAt(e,n.t+m*1e3),F=h<=0?-Math.min(1,Math.max(.5,(s.z-o)/40))*a.PILOT_MS/2:Math.max(-a.PILOT_MS,Math.min(a.PILOT_MS,(h+o-s.z)/40)),ee=h<=0,ce=ee?-2.5:F-.3,ie=ee?-.3:F+.8;m>=s.burnUntilS&&s.vz<ce&&m-Y>2&&s.excessK<G.maxExcessK&&(s.burnUntilS=m+G.blastS),I=m<s.burnUntilS,!I&&s.burnUntilS>0&&m-M<s.burnUntilS&&(Y=m),I&&(s.excessK=Math.min(G.maxExcessK,s.excessK+G.heatingKS*M)),s.excessK-=s.excessK/G.coolingS*M,!I&&s.vz>ie&&(s.excessK-=.5*M),s.excessK=Math.max(0,s.excessK)}const j=a.flameShare(t,m);t.flames&&(s.excessK+=(O*j-s.excessK)*Math.min(1,M/t.flames.coolingS));const Z=t.envelope==="open"?b.p*R/(a.R_AIR*(b.T+s.excessK)):s.gasKg,N=(b.rho*R-Z)*a.G;let U=t.massKg-((t.ballastKg??0)-s.ballastKg);if(s.floated&&s.ballastKg>0&&N<U*a.G){const h=Math.min(s.ballastKg,U-N/a.G);s.ballastKg-=h,U-=h}const te=U*a.G,W=U+Z+.5*b.rho*R,H=a.widthOf(t,R),se=Math.PI*H*H/4*(t.depthRatio!==void 0?(1+t.depthRatio)/2:1),J=s.z-o,Q=a.windAt(e,J),$=k(),ae=Math.max(0,Math.min(1,J/a.GUST_GROUND_M)),C={x:Q.x+$.x,y:Q.y+$.y,z:$.z*ae},re=s.vx-C.x,oe=s.vy-C.y,ne=s.vz-C.z,L=.5*b.rho*t.dragCoefficient*se*Math.hypot(re,oe,ne)/W;s.vx=(s.vx+L*M*C.x)/(1+L*M),s.vy=(s.vy+L*M*C.y)/(1+L*M),s.vz=(s.vz+L*M*C.z+(N-te)/W*M)/(1+L*M);const g=s.z<=o+1e-6&&s.vz<=0;g&&(s.vx=0,s.vy=0,s.vz=0),s.x+=s.vx*M,s.y+=s.vy*M,s.z=Math.max(o,s.z+s.vz*M),E!==void 0&&a.heldBy(s,K,o,E),q=g&&m>10?q+M:0;const _=q>30&&!t.tethered,B=y.length>0&&y[y.length-1].burning!==I;if(x%l===0||x===v||B||_){const h=n.t+Math.round(m*1e3);B&&y.push({t:h-1,x:s.x,y:s.y,z:s.z,widthM:H,burning:!I,flame:j}),y.push({t:h,x:s.x,y:s.y,z:s.z,widthM:H,burning:I,flame:j})}if(_){w="landed";break}}return{samples:y,end:w}}static heldBy(e,n,r,t){const c=e.x-n.x,o=e.y-n.y,d=e.z-r,i=Math.hypot(c,o,d);if(i<=t||i===0)return;const f=c/i,p=o/i,u=d/i;e.x=n.x+f*t,e.y=n.y+p*t,e.z=r+u*t;const M=e.vx*f+e.vy*p+e.vz*u;M>0&&(e.vx-=M*f,e.vy-=M*p,e.vz-=M*u)}static balloonBodies(e,n,r,t){const{samples:c,end:o}=a.trajectory(e,n),d=a.balloonBody(e,n,r,t,c),i=a.typeOf(e);return o==="lit"&&i.torch?[d,a.torchBody(e,n,d.id,c[c.length-1],i.torch)]:[d]}static torchBody(e,n,r,t,c){const o=e.site.altitudeM??0,d=a.TORCH_FLAME_M/2,i=[];let f=t.x,p=t.y,u=t.z;const M=a.randomFrom(a.seedOf(n)^1374496523),v={degrees:4+4*M(),periodS:2+2*M(),phase:2*Math.PI*M()};for(let l=0;;l++){const K=l<c.burnS*.9?1:l<c.burnS?(c.burnS-l)/(c.burnS*.1):0,E=2*Math.PI*l/v.periodS+v.phase;if(i.push({t:t.t+l*1e3,eastM:a.round(f),northM:a.round(p),altitudeM:a.round(u),...l===0?{sizeM:a.TORCH_SIZE,present:!0,appearance:{color:"#d8d2c4",albedo:.6}}:{},attitude:{pitchDeg:a.round(v.degrees*Math.sin(E),10),rollDeg:a.round(v.degrees*Math.cos(E),10)},lights:{"light-flame":a.round(c.candela*K/(Math.PI*d*d),1)}}),u<=o)break;const T=a.windAt(e,u-o);f+=T.x,p+=T.y,u=Math.max(o,u-c.fallMS)}return i.push({t:i[i.length-1].t+1,present:!1}),{id:`${r}-torch`,title:a.TORCH_TITLE,...e.explains?{explains:e.explains}:{},model:{id:"ufoathome-balloon-torch"},modelParameters:{flameColor:c.color},track:i}}static TORCH_SIZE={widthM:1.2,lengthM:1.2,heightM:1.6};static TORCH_FLAME_M=.2;static TORCH_TITLE={en:"Hygroscopic torch",fr:"Torche hygroscopique",es:"Antorcha higroscópica",it:"Torcia igroscopica"};static balloonBody(e,n,r,t,c){const o=a.typeOf(e),d=n.color??e.color??(o.glow?o.glow.color:o.color),i=o.depthRatio??1,f=e.lit&&o.lamp?o.lamp:void 0,p=s=>o.glow?o.glow.candela/(Math.PI*s*s/4):0,u=a.randomFrom(a.seedOf(n)^2654435769),M=o.spins?(5+15*u())*(u()<.5?-1:1):0,v=360*u(),l=o.sways?{degrees:3+4*u(),periodS:3+3*u(),phase:2*Math.PI*u()}:void 0,K=s=>{if(M===0&&!l)return;const S=(s-n.t)/1e3,P=l?2*Math.PI*S/l.periodS+l.phase:0;return{...M!==0?{headingDeg:a.round(((v+M*S)%360+360)%360,10)}:{},...l?{pitchDeg:a.round(l.degrees*Math.sin(P),10),rollDeg:a.round(l.degrees*Math.cos(P*.83),10)}:{}}},E=a.flamesOf(e,o),T=e.partColors?.flame??o.flames?.color;let O=-1;const A=c.map((s,S)=>{const P=Math.abs(s.widthM-O)>O*.005;P&&(O=s.widthM);const y={widthM:a.round(s.widthM,1e3),lengthM:a.round(s.widthM*i,1e3),heightM:a.round(s.widthM*o.aspect,1e3)},k={t:s.t,eastM:a.round(s.x),northM:a.round(s.y),altitudeM:a.round(s.z),...S===0?{present:!0}:{},...P?{sizeM:y}:{},...K(s.t)?{attitude:K(s.t)}:{},...S===0?{appearance:{color:d,albedo:o.albedo,...o.finish?{finish:o.finish}:{},...o.glow?{luminanceCdM2:p(s.widthM)}:{}}}:o.glow&&P?{appearance:{color:d,luminanceCdM2:a.round(p(s.widthM),100)}}:{}},w=a.lightsOf(o,s.burning,f,s.widthM,E,s.flame);return w&&(k.lights=w),k});A.push({t:c[c.length-1].t+1,present:!1});const D=e.title??a.TITLES[o.id],V=e.explainsEach?e.explainsEach[r]!==void 0?{explains:[e.explainsEach[r]]}:{}:{...e.explains?{explains:e.explains}:{},...t>1?{ensemble:e.id}:{}},z={envelopeColor:d};o.stripeColor&&(z.stripeColor=o.stripeColor),f&&(z.lampColor=f.color),T&&(z.flameColor=T);for(const[s,S]of Object.entries(e.partColors??{}))z[`${s}Color`]=S;return{id:t>1?`${e.id}-${r+1}`:e.id,title:D,...V,model:{id:o.modelId},modelParameters:z,...o.id==="hot-air"?{sound:{kind:"balloon"}}:{},altitudeFrom:{eastM:c[0].x,northM:c[0].y},track:A}}static lightsOf(e,n,r,t,c=0,o=0){if(e.flames){const d=t/50,i={};for(let f=1;f<=a.MAX_FLAMES;f++)i[`light-flame-${f}`]=f<=c?a.round(e.flames.candela*o/(Math.PI*d*d),1):0;return i.envelope=a.round(e.flames.candela*c*o*.5/(Math.PI*t/2*t*e.aspect/2),1e3),i}if(e.burner){const d=n?e.burner.envelopeCdM2:0;return{flame:n?e.burner.flameCdM2:0,envelope:d,"envelope-stripe":d}}if(e.modelId==="ufoathome-balloon-latex"){const d=t/40;return{"light-lamp":r?a.round(r.candela/(Math.PI*d*d),1):0}}}static seedOf(e){return e.seed!==void 0?e.seed:Math.round(e.t)*2654435761+Math.round((e.eastM??0)*100)*40503+Math.round((e.northM??0)*100)>>>0}static gusts(e,n,r){const t=a.randomFrom(n),c=()=>Math.sqrt(-2*Math.log(Math.max(1e-12,t())))*Math.cos(2*Math.PI*t()),o=e.timescaleS>0?Math.exp(-r/e.timescaleS):0,d=Math.sqrt(1-o*o),i={x:e.horizontalMS*c(),y:e.horizontalMS*c(),z:e.verticalMS*c()};return()=>(i.x=o*i.x+d*e.horizontalMS*c(),i.y=o*i.y+d*e.horizontalMS*c(),i.z=o*i.z+d*e.verticalMS*c(),i)}static randomFrom(e){let n=e>>>0;return()=>{n=n+1831565813>>>0;let r=n;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}static round(e,n=100){return Math.round(e*n)/n}}export{a as BalloonFlight};
@@ -1,4 +1,4 @@
1
- import{x as T,_ as c,bf as I,a9 as p,aa as L,I as x,a7 as w,a8 as E,ab as f,bu as M}from"./rr0-sighting-editor.mjs";import{L as u}from"./LaserBeam-Cl4c8oJt.js";import{S as _}from"./SkyEventEditorStyle-CvY_AhbI.js";const O=T.catalog({en:()=>c(()=>import("./BeamParameterTexts_en-DZB75ouZ.js"),[],import.meta.url).then(l=>l.beamParameterTexts_en),fr:()=>c(()=>import("./BeamParameterTexts_fr-BHG3fW40.js"),[],import.meta.url).then(l=>l.beamParameterTexts_fr),es:()=>c(()=>import("./BeamParameterTexts_es-AeZmsufG.js"),[],import.meta.url).then(l=>l.beamParameterTexts_es),it:()=>c(()=>import("./BeamParameterTexts_it-CPwmQX-g.js"),[],import.meta.url).then(l=>l.beamParameterTexts_it)});class h{static LIGHT_TITLE="light";static BEAM="beam";static WHEN="when";static nextPlace(e){const t=e[e.length-1]??{lat:0,lng:0,altitudeM:0},i=e[e.length-2];return i?{lat:2*t.lat-i.lat,lng:2*t.lng-i.lng,altitudeM:2*t.altitudeM-i.altitudeM}:{lat:t.lat,lng:t.lng+500/(111320*Math.max(.05,Math.cos(t.lat*Math.PI/180))),altitudeM:t.altitudeM}}static instant(e,t,i,s=!1){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:i,...s?{required:s}:{}}}static SET={kind:"beam",title:"beam",parameters:[{type:"said",key:"title",label:"name",group:h.BEAM},{type:"number",key:"divergenceMrad",min:.001,max:1e3,step:.001,unit:"mrad",group:h.BEAM,effective:()=>u.DEFAULT_DIVERGENCE_MRAD,label:"divergence",hint:"howFastItWidensFullAngle"},{type:"number",key:"apertureM",min:.001,max:10,step:.001,unit:"m",group:h.BEAM,effective:()=>u.DEFAULT_APERTURE_M,label:"widthAtTheEmitter"},{type:"number",key:"patchiness",min:0,max:100,step:1,unit:"%",scale:100,group:h.BEAM,effective:()=>u.DEFAULT_PATCHINESS,label:"unevenHaze",hint:"howUnevenlyTheHazeItCrosses"}]};static WAVELENGTH_HINT="itsColour532ForTheGreen";static POWER_HINT="theOpticalPowerItCarriesIts";static WAVELENGTH_LABEL="wavelength";static POWER_LABEL="power";static LIGHT={kind:"beam-light",title:h.LIGHT_TITLE,parameters:[{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",required:!0,label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",required:!0,label:h.POWER_LABEL,hint:h.POWER_HINT}]};static LIGHT_KEY={kind:"beam-light-key",title:h.LIGHT_TITLE,parameters:[h.instant("t","time","secondsOfTheRecording",!0),{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT,effective:(e,t)=>t?.wavelengthNm},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",label:h.POWER_LABEL,hint:h.POWER_HINT,effective:(e,t)=>t?.powerW}]};static ON={kind:"beam-on",title:h.WHEN,parameters:[h.instant("fromT","onFrom","secondsOfTheRecordingEmptyFrom"),h.instant("untilT","offAt","secondsOfTheRecordingEmptyUntil")]};static MOVE_KEY={kind:"beam-move-key",title:"pathAtAnInstant",parameters:[h.instant("t","time","secondsOfTheRecording",!0)]};static hexOf(e){const t=u.colourOf(e),i=Math.max(...t,1e-9),s=n=>{const o=Math.min(1,Math.max(0,n/i)),a=o<=.0031308?12.92*o:1.055*o**(1/2.4)-.055;return Math.round(a*255).toString(16).padStart(2,"0")};return`#${t.map(s).join("")}`}static wavelengthOf(e){const t=h.hueOf(e);let i=532,s=1/0;for(let n=400;n<=700;n++){const o=Math.abs((h.hueOf(h.hexOf(n))-t+540)%360-180);o<s&&(s=o,i=n)}return i}static hueOf(e){const t=Number.parseInt(e.replace("#",""),16),[i,s,n]=[t>>16&255,t>>8&255,t&255].map(b=>b/255),o=Math.max(i,s,n),a=Math.min(i,s,n);if(o===a)return 0;const r=o-a;return((o===i?(s-n)/r%6:o===s?(n-i)/r+2:(i-s)/r+4)*60+360)%360}static PLACE={kind:"beam-place",title:"pointOfThePath",parameters:[{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:.1,label:"position"},{type:"number",key:"altitudeM",min:-500,max:1e5,step:.1,unit:"m",required:!0,label:"altitude",hint:"aboveTheSeaNotTheGround"}]};static publish(){I.publish(h.SET)}}const A=T.catalog({en:()=>c(()=>import("./BeamEditorMessages_en-DDvPWAdd.js"),[],import.meta.url).then(l=>l.beamEditorMessages_en),fr:()=>c(()=>import("./BeamEditorMessages_fr-CtX6uP-x.js"),[],import.meta.url).then(l=>l.beamEditorMessages_fr),es:()=>c(()=>import("./BeamEditorMessages_es-BhCkhUkN.js"),[],import.meta.url).then(l=>l.beamEditorMessages_es),it:()=>c(()=>import("./BeamEditorMessages_it-DVweRQFi.js"),[],import.meta.url).then(l=>l.beamEditorMessages_it)});class g{constructor(e,t,i){this.container=e,this.host=t,this.language=i,_.attach(e,"beam-editor",g.STYLE),I.of("beam")||h.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="on";onForm;lightForm;lightKeyForm;lightIndex;moveKeyForm;moveIndex;places;placeForm;placeIndex=0;language;shown=[];static STYLE='.beam-editor { flex-basis: 100%; min-width: 0; } .beam-editor #beam-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .beam-editor #beam-list, .beam-editor #beam-places { flex-basis: 100%; min-width: 0; } .beam-editor .launch-editor, .beam-editor .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .beam-editor .launch-fields { flex-basis: 100%; min-width: 0; } .beam-editor [hidden] { display: none !important; } .beam-editor select { min-width: 0; width: 100%; } .beam-editor .launch-intro { flex-basis: 100%; margin: 0; } .beam-editor .launch-track { flex-basis: 100%; margin: 0; } .beam-editor .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .beam-editor .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; } .beam-editor input, .beam-editor select { max-width: 100%; box-sizing: border-box; } .beam-editor input[type="text"] { width: 12em; } .beam-editor #launch-title { width: 18em; } .beam-editor label { min-width: 0; max-width: 100%; } .beam-editor input.parameter-derived::placeholder { opacity: .65; } .beam-editor .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([A.load(e),O.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.beams;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("beam-fields").hidden=t===void 0,!t)return;const i={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.form??=new p(this.element("beam-parameters"),this.language,"beam.",i),this.form.show(this.resolved(h.SET),this.targetOfBeam(),()=>this.written()),this.syncDetail(!0)}refresh(){if(!this.messages)return;this.syncAddState();const e=this.beams;if(e.length===this.shown.length&&e.every((t,i)=>t.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.pathOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addBeamNowhere)}get current(){return this.beams.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="on",this.lightIndex=void 0,this.moveIndex=void 0,this.placeIndex=0,this.sync())}resolved(e){return L.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
1
+ import{x as T,_ as c,bg as I,a9 as p,aa as L,I as x,a7 as w,a8 as E,ab as f,bv as M}from"./rr0-sighting-editor.mjs";import{L as u}from"./LaserBeam-Ca2QUeCT.js";import{S as _}from"./SkyEventEditorStyle-CvY_AhbI.js";const O=T.catalog({en:()=>c(()=>import("./BeamParameterTexts_en-DZB75ouZ.js"),[],import.meta.url).then(l=>l.beamParameterTexts_en),fr:()=>c(()=>import("./BeamParameterTexts_fr-BHG3fW40.js"),[],import.meta.url).then(l=>l.beamParameterTexts_fr),es:()=>c(()=>import("./BeamParameterTexts_es-AeZmsufG.js"),[],import.meta.url).then(l=>l.beamParameterTexts_es),it:()=>c(()=>import("./BeamParameterTexts_it-CPwmQX-g.js"),[],import.meta.url).then(l=>l.beamParameterTexts_it)});class h{static LIGHT_TITLE="light";static BEAM="beam";static WHEN="when";static nextPlace(e){const t=e[e.length-1]??{lat:0,lng:0,altitudeM:0},i=e[e.length-2];return i?{lat:2*t.lat-i.lat,lng:2*t.lng-i.lng,altitudeM:2*t.altitudeM-i.altitudeM}:{lat:t.lat,lng:t.lng+500/(111320*Math.max(.05,Math.cos(t.lat*Math.PI/180))),altitudeM:t.altitudeM}}static instant(e,t,i,s=!1){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t,hint:i,...s?{required:s}:{}}}static SET={kind:"beam",title:"beam",parameters:[{type:"said",key:"title",label:"name",group:h.BEAM},{type:"number",key:"divergenceMrad",min:.001,max:1e3,step:.001,unit:"mrad",group:h.BEAM,effective:()=>u.DEFAULT_DIVERGENCE_MRAD,label:"divergence",hint:"howFastItWidensFullAngle"},{type:"number",key:"apertureM",min:.001,max:10,step:.001,unit:"m",group:h.BEAM,effective:()=>u.DEFAULT_APERTURE_M,label:"widthAtTheEmitter"},{type:"number",key:"patchiness",min:0,max:100,step:1,unit:"%",scale:100,group:h.BEAM,effective:()=>u.DEFAULT_PATCHINESS,label:"unevenHaze",hint:"howUnevenlyTheHazeItCrosses"}]};static WAVELENGTH_HINT="itsColour532ForTheGreen";static POWER_HINT="theOpticalPowerItCarriesIts";static WAVELENGTH_LABEL="wavelength";static POWER_LABEL="power";static LIGHT={kind:"beam-light",title:h.LIGHT_TITLE,parameters:[{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",required:!0,label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",required:!0,label:h.POWER_LABEL,hint:h.POWER_HINT}]};static LIGHT_KEY={kind:"beam-light-key",title:h.LIGHT_TITLE,parameters:[h.instant("t","time","secondsOfTheRecording",!0),{type:"number",key:"wavelengthNm",min:380,max:780,step:1,unit:"nm",label:h.WAVELENGTH_LABEL,hint:h.WAVELENGTH_HINT,effective:(e,t)=>t?.wavelengthNm},{type:"number",key:"powerW",min:.001,max:1e5,step:.001,unit:"W",label:h.POWER_LABEL,hint:h.POWER_HINT,effective:(e,t)=>t?.powerW}]};static ON={kind:"beam-on",title:h.WHEN,parameters:[h.instant("fromT","onFrom","secondsOfTheRecordingEmptyFrom"),h.instant("untilT","offAt","secondsOfTheRecordingEmptyUntil")]};static MOVE_KEY={kind:"beam-move-key",title:"pathAtAnInstant",parameters:[h.instant("t","time","secondsOfTheRecording",!0)]};static hexOf(e){const t=u.colourOf(e),i=Math.max(...t,1e-9),s=n=>{const o=Math.min(1,Math.max(0,n/i)),a=o<=.0031308?12.92*o:1.055*o**(1/2.4)-.055;return Math.round(a*255).toString(16).padStart(2,"0")};return`#${t.map(s).join("")}`}static wavelengthOf(e){const t=h.hueOf(e);let i=532,s=1/0;for(let n=400;n<=700;n++){const o=Math.abs((h.hueOf(h.hexOf(n))-t+540)%360-180);o<s&&(s=o,i=n)}return i}static hueOf(e){const t=Number.parseInt(e.replace("#",""),16),[i,s,n]=[t>>16&255,t>>8&255,t&255].map(b=>b/255),o=Math.max(i,s,n),a=Math.min(i,s,n);if(o===a)return 0;const r=o-a;return((o===i?(s-n)/r%6:o===s?(n-i)/r+2:(i-s)/r+4)*60+360)%360}static PLACE={kind:"beam-place",title:"pointOfThePath",parameters:[{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:.1,label:"position"},{type:"number",key:"altitudeM",min:-500,max:1e5,step:.1,unit:"m",required:!0,label:"altitude",hint:"aboveTheSeaNotTheGround"}]};static publish(){I.publish(h.SET)}}const A=T.catalog({en:()=>c(()=>import("./BeamEditorMessages_en-DDvPWAdd.js"),[],import.meta.url).then(l=>l.beamEditorMessages_en),fr:()=>c(()=>import("./BeamEditorMessages_fr-CtX6uP-x.js"),[],import.meta.url).then(l=>l.beamEditorMessages_fr),es:()=>c(()=>import("./BeamEditorMessages_es-BhCkhUkN.js"),[],import.meta.url).then(l=>l.beamEditorMessages_es),it:()=>c(()=>import("./BeamEditorMessages_it-DVweRQFi.js"),[],import.meta.url).then(l=>l.beamEditorMessages_it)});class g{constructor(e,t,i){this.container=e,this.host=t,this.language=i,_.attach(e,"beam-editor",g.STYLE),I.of("beam")||h.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="on";onForm;lightForm;lightKeyForm;lightIndex;moveKeyForm;moveIndex;places;placeForm;placeIndex=0;language;shown=[];static STYLE='.beam-editor { flex-basis: 100%; min-width: 0; } .beam-editor #beam-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .beam-editor #beam-list, .beam-editor #beam-places { flex-basis: 100%; min-width: 0; } .beam-editor .launch-editor, .beam-editor .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .beam-editor .launch-fields { flex-basis: 100%; min-width: 0; } .beam-editor [hidden] { display: none !important; } .beam-editor select { min-width: 0; width: 100%; } .beam-editor .launch-intro { flex-basis: 100%; margin: 0; } .beam-editor .launch-track { flex-basis: 100%; margin: 0; } .beam-editor .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .beam-editor .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; } .beam-editor input, .beam-editor select { max-width: 100%; box-sizing: border-box; } .beam-editor input[type="text"] { width: 12em; } .beam-editor #launch-title { width: 18em; } .beam-editor label { min-width: 0; max-width: 100%; } .beam-editor input.parameter-derived::placeholder { opacity: .65; } .beam-editor .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([A.load(e),O.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.beams;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("beam-fields").hidden=t===void 0,!t)return;const i={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.form??=new p(this.element("beam-parameters"),this.language,"beam.",i),this.form.show(this.resolved(h.SET),this.targetOfBeam(),()=>this.written()),this.syncDetail(!0)}refresh(){if(!this.messages)return;this.syncAddState();const e=this.beams;if(e.length===this.shown.length&&e.every((t,i)=>t.id===this.shown[i].id)){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.pathOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addBeamNowhere)}get current(){return this.beams.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="on",this.lightIndex=void 0,this.moveIndex=void 0,this.placeIndex=0,this.sync())}resolved(e){return L.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
2
2
  <p class="launch-intro">${e.intro}</p>
3
3
  <div id="beam-list"></div>
4
4
  <div id="beam-fields" class="launch-fields">
@@ -1 +1 @@
1
- import{b2 as C,bn as V,bo as L,b5 as W,bp as X,bq as k,br as q,bs as N}from"./rr0-sighting-editor.mjs";import{L as w}from"./LaserBeam-Cl4c8oJt.js";class M{static laser(s){const t=w.colourOf(s),e=w.efficacy(s);return{scatteredAt:(h,n,i,c)=>{const r=w.coefficientsAt(h,s,n),y=e*w.phasedScattering({...r,aerosolPerM:r.aerosolPerM*i},c);return[y*t[0],y*t[1],y*t[2]]}}}static white(s){return{scatteredAt:(t,e,h,n)=>{const i=N.rayleighDensity(e),c=N.aerosolDensity(e)*h;return[0,1,2].map(r=>s[r]*w.phasedScattering({rayleighPerM:t.rayleigh[r]*i,aerosolPerM:t.aerosol[r]*c},n))}}}static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new C;mesh;positions=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);colors=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new V;s.setAttribute("position",new L(this.positions,3)),s.setAttribute("color",new L(this.colors,3)),s.setDrawRange(0,0),this.mesh=new W(s,new X({vertexColors:!0,transparent:!0,blending:q,depthWrite:!1,fog:!1,side:k})),this.mesh.frustumCulled=!1,this.mesh.renderOrder=8,this.mesh.name="beams",this.group.name="beams",this.group.add(this.mesh)}get segmentCount(){return this.segments}get object(){return this.group}get drawnCount(){return this.segments}pick(s,t,e){return this.pickAt(s,t,e.toleranceRad)}update(s,t,e){this.drawLines(this.viewsOf(s,t,e).map(h=>({id:h.id,points:this.place(h,t,e),spectrum:M.laser(h.wavelengthNm)})),e)}get material(){return this.mesh.material}drawLines(s,t){let e=0;this.segments=0,this.drawn=[];for(const n of s){const i=n.points;this.drawn.push({id:n.id,points:i});for(let c=0;c+1<i.length&&!(this.segments>=M.MAX_SEGMENTS);c++){const r=this.pushSegment(e,i[c],i[c+1],n.spectrum,t);r>e&&this.segments++,e=r}}const h=this.mesh.geometry;h.setDrawRange(0,e);for(const n of["position","color"]){const i=h.getAttribute(n);i.clearUpdateRanges(),e>0&&i.addUpdateRange(0,e*3),i.needsUpdate=!0}}viewsOf(s,t,e){const{lat:h,lng:n}=e.reference;(!this.cut||this.cut.lat!==h||this.cut.lng!==n||this.cut.air!==e.air)&&(this.cut={lat:h,lng:n,air:e.air,views:new Map});const i=this.cut.views,c=new Set(s);return w.onAt(s,t).map(r=>{if(!c.has(r))return w.viewOf(r,e.reference,e.air);let y=i.get(r);return y||i.set(r,y=w.viewOf(r,e.reference,e.air)),y})}place(s,t,e){const h=[],n=e.wind??{eastMS:0,northMS:0};for(const i of s.samples){const c=e.origin.x+i.eastM*e.eastScale,r=e.origin.z-i.northM,y=i.upM-e.siteElevationM;if(h.length>0&&y<e.groundYAt(c,r))break;const u=n.eastMS*i.dirEast+n.northMS*i.dirNorth,z=n.eastMS*i.dirNorth-n.northMS*i.dirEast,O=w.patchAt(i.fromSourceM,t,{windAlongMS:u,windAcrossMS:z,patchiness:s.patchiness});h.push({x:c,y,z:r,altitudeM:i.altitudeM,widthM:i.widthM,powerW:i.powerW,haze:O})}return h}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,e,h,n,i=0){const c={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z},r=Math.hypot(c.x,c.y,c.z);if(r<1e-6)return s;const y={x:c.x/r,y:c.y/r,z:c.z/r};if(Math.hypot((t.x+e.x)/2-n.eye.x,(t.y+e.y)/2-n.eye.y,(t.z+e.z)/2-n.eye.z)<.001)return s;const u=o=>{const l={x:n.eye.x-o.x,y:n.eye.y-o.y,z:n.eye.z-o.z},p=Math.hypot(l.x,l.y,l.z)||.001,d=(y.x*l.x+y.y*l.y+y.z*l.z)/p,a=Math.sqrt(Math.max(0,1-d*d)),A=h.scatteredAt(n.air,o.altitudeM,o.haze,d);return{sinTurn:a,scattered:A,through:n.transmittanceTo(o.x,o.y,o.z)}},z=o=>M.MIN_PIXELS*n.pixelRad*Math.hypot(o.x-n.eye.x,o.y-n.eye.y,o.z-n.eye.z),O=o=>Math.hypot(o.x-n.eye.x,o.y-n.eye.y,o.z-n.eye.z),S=o=>Math.max(o.widthM,M.HALO_RAD*O(o)),T=o=>{const l=S(o)/z(o),p=Math.min(1,Math.max(0,l-1));return M.HALO_SHARE*p*p*(3-2*p)},G=new Map([t,e].map(o=>[o,u(o)])),f=(o,l,p)=>{const d=Math.max(l,z(o)),{sinTurn:a,scattered:A,through:E}=G.get(o),I=2*p*o.powerW/(d*Math.max(a,.001)),P=A.map((_,D)=>Math.min(M.BRIGHTEST_RELATIVE,I*_*n.relativeScale*E[D])),H={x:n.eye.x-o.x,y:n.eye.y-o.y,z:n.eye.z-o.z},m=this.normalise(this.cross(y,H));return{point:o,half:d/2,level:P,across:m}},R=[[f(t,t.widthM,1-T(t)),f(e,e.widthM,1-T(e))],[f(t,S(t),T(t)),f(e,S(e),T(e))]],[x,g]=R[0].map(o=>Math.max(...o.level));if(i<M.MAX_HALVINGS&&Math.max(x,g)>M.SMOOTH_RATIO*Math.max(Math.min(x,g),1e-12)){const o={x:(t.x+e.x)/2,y:(t.y+e.y)/2,z:(t.z+e.z)/2,altitudeM:(t.altitudeM+e.altitudeM)/2,widthM:(t.widthM+e.widthM)/2,powerW:Math.sqrt(t.powerW*e.powerW),haze:(t.haze+e.haze)/2};return this.pushSegment(this.pushSegment(s,t,o,h,n,i+1),o,e,h,n,i+1)}if((s+M.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const o of R){if(o.every(a=>Math.max(...a.level)<=0))continue;const l=(a,A)=>{const E=s*3;this.positions[E]=a.point.x+a.across.x*a.half*A,this.positions[E+1]=a.point.y+a.across.y*a.half*A,this.positions[E+2]=a.point.z+a.across.z*a.half*A;const I=A===0?1:0;this.colors[E]=a.level[0]*I,this.colors[E+1]=a.level[1]*I,this.colors[E+2]=a.level[2]*I,s++},[p,d]=o;for(const a of[-1,1])l(p,a),l(p,0),l(d,a),l(p,0),l(d,0),l(d,a)}return s}pickAt(s,t,e){let h;for(const[n,i]of this.drawn.entries())for(let c=0;c+1<i.points.length;c++){const r=i.points[c],y=i.points[c+1],u={x:y.x-r.x,y:y.y-r.y,z:y.z-r.z},z={x:r.x-s.x,y:r.y-s.y,z:r.z-s.z},O=u.x*u.x+u.y*u.y+u.z*u.z,S=u.x*t.x+u.y*t.y+u.z*t.z,T=u.x*z.x+u.y*z.y+u.z*z.z,G=t.x*z.x+t.y*z.y+t.z*z.z,f=O-S*S,R=f>1e-9?Math.min(1,Math.max(0,(S*G-T)/f)):0,x={x:r.x+u.x*R,y:r.y+u.y*R,z:r.z+u.z*R},g=(x.x-s.x)*t.x+(x.y-s.y)*t.y+(x.z-s.z)*t.z;if(g<=0)continue;const o=Math.hypot(x.x-s.x-t.x*g,x.y-s.y-t.y*g,x.z-s.z-t.z*g),l=Math.atan2(o,g);l<=e&&(!h||l<h.angle)&&(h={id:i.id,distanceM:Math.hypot(x.x-s.x,x.y-s.y,x.z-s.z),angle:l,line:n})}return h&&{id:h.id,distanceM:h.distanceM,line:h.line}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{M as BeamSystem};
1
+ import{b3 as C,bo as V,bp as L,b6 as W,bq as X,br as k,bs as q,bt as N}from"./rr0-sighting-editor.mjs";import{L as w}from"./LaserBeam-Ca2QUeCT.js";class M{static laser(s){const t=w.colourOf(s),e=w.efficacy(s);return{scatteredAt:(h,n,i,c)=>{const r=w.coefficientsAt(h,s,n),y=e*w.phasedScattering({...r,aerosolPerM:r.aerosolPerM*i},c);return[y*t[0],y*t[1],y*t[2]]}}}static white(s){return{scatteredAt:(t,e,h,n)=>{const i=N.rayleighDensity(e),c=N.aerosolDensity(e)*h;return[0,1,2].map(r=>s[r]*w.phasedScattering({rayleighPerM:t.rayleigh[r]*i,aerosolPerM:t.aerosol[r]*c},n))}}}static MAX_SEGMENTS=12e3;static MIN_PIXELS=2;static VERTICES_PER_SEGMENT=24;static HALO_RAD=.002;static HALO_SHARE=.15;static BRIGHTEST_RELATIVE=6e4;group=new C;mesh;positions=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);colors=new Float32Array(M.MAX_SEGMENTS*M.VERTICES_PER_SEGMENT*3);segments=0;drawn=[];cut;constructor(){const s=new V;s.setAttribute("position",new L(this.positions,3)),s.setAttribute("color",new L(this.colors,3)),s.setDrawRange(0,0),this.mesh=new W(s,new X({vertexColors:!0,transparent:!0,blending:q,depthWrite:!1,fog:!1,side:k})),this.mesh.frustumCulled=!1,this.mesh.renderOrder=8,this.mesh.name="beams",this.group.name="beams",this.group.add(this.mesh)}get segmentCount(){return this.segments}get object(){return this.group}get drawnCount(){return this.segments}pick(s,t,e){return this.pickAt(s,t,e.toleranceRad)}update(s,t,e){this.drawLines(this.viewsOf(s,t,e).map(h=>({id:h.id,points:this.place(h,t,e),spectrum:M.laser(h.wavelengthNm)})),e)}get material(){return this.mesh.material}drawLines(s,t){let e=0;this.segments=0,this.drawn=[];for(const n of s){const i=n.points;this.drawn.push({id:n.id,points:i});for(let c=0;c+1<i.length&&!(this.segments>=M.MAX_SEGMENTS);c++){const r=this.pushSegment(e,i[c],i[c+1],n.spectrum,t);r>e&&this.segments++,e=r}}const h=this.mesh.geometry;h.setDrawRange(0,e);for(const n of["position","color"]){const i=h.getAttribute(n);i.clearUpdateRanges(),e>0&&i.addUpdateRange(0,e*3),i.needsUpdate=!0}}viewsOf(s,t,e){const{lat:h,lng:n}=e.reference;(!this.cut||this.cut.lat!==h||this.cut.lng!==n||this.cut.air!==e.air)&&(this.cut={lat:h,lng:n,air:e.air,views:new Map});const i=this.cut.views,c=new Set(s);return w.onAt(s,t).map(r=>{if(!c.has(r))return w.viewOf(r,e.reference,e.air);let y=i.get(r);return y||i.set(r,y=w.viewOf(r,e.reference,e.air)),y})}place(s,t,e){const h=[],n=e.wind??{eastMS:0,northMS:0};for(const i of s.samples){const c=e.origin.x+i.eastM*e.eastScale,r=e.origin.z-i.northM,y=i.upM-e.siteElevationM;if(h.length>0&&y<e.groundYAt(c,r))break;const u=n.eastMS*i.dirEast+n.northMS*i.dirNorth,z=n.eastMS*i.dirNorth-n.northMS*i.dirEast,O=w.patchAt(i.fromSourceM,t,{windAlongMS:u,windAcrossMS:z,patchiness:s.patchiness});h.push({x:c,y,z:r,altitudeM:i.altitudeM,widthM:i.widthM,powerW:i.powerW,haze:O})}return h}static SMOOTH_RATIO=1.08;static MAX_HALVINGS=6;pushSegment(s,t,e,h,n,i=0){const c={x:e.x-t.x,y:e.y-t.y,z:e.z-t.z},r=Math.hypot(c.x,c.y,c.z);if(r<1e-6)return s;const y={x:c.x/r,y:c.y/r,z:c.z/r};if(Math.hypot((t.x+e.x)/2-n.eye.x,(t.y+e.y)/2-n.eye.y,(t.z+e.z)/2-n.eye.z)<.001)return s;const u=o=>{const l={x:n.eye.x-o.x,y:n.eye.y-o.y,z:n.eye.z-o.z},p=Math.hypot(l.x,l.y,l.z)||.001,d=(y.x*l.x+y.y*l.y+y.z*l.z)/p,a=Math.sqrt(Math.max(0,1-d*d)),A=h.scatteredAt(n.air,o.altitudeM,o.haze,d);return{sinTurn:a,scattered:A,through:n.transmittanceTo(o.x,o.y,o.z)}},z=o=>M.MIN_PIXELS*n.pixelRad*Math.hypot(o.x-n.eye.x,o.y-n.eye.y,o.z-n.eye.z),O=o=>Math.hypot(o.x-n.eye.x,o.y-n.eye.y,o.z-n.eye.z),S=o=>Math.max(o.widthM,M.HALO_RAD*O(o)),T=o=>{const l=S(o)/z(o),p=Math.min(1,Math.max(0,l-1));return M.HALO_SHARE*p*p*(3-2*p)},G=new Map([t,e].map(o=>[o,u(o)])),f=(o,l,p)=>{const d=Math.max(l,z(o)),{sinTurn:a,scattered:A,through:E}=G.get(o),I=2*p*o.powerW/(d*Math.max(a,.001)),P=A.map((_,D)=>Math.min(M.BRIGHTEST_RELATIVE,I*_*n.relativeScale*E[D])),H={x:n.eye.x-o.x,y:n.eye.y-o.y,z:n.eye.z-o.z},m=this.normalise(this.cross(y,H));return{point:o,half:d/2,level:P,across:m}},R=[[f(t,t.widthM,1-T(t)),f(e,e.widthM,1-T(e))],[f(t,S(t),T(t)),f(e,S(e),T(e))]],[x,g]=R[0].map(o=>Math.max(...o.level));if(i<M.MAX_HALVINGS&&Math.max(x,g)>M.SMOOTH_RATIO*Math.max(Math.min(x,g),1e-12)){const o={x:(t.x+e.x)/2,y:(t.y+e.y)/2,z:(t.z+e.z)/2,altitudeM:(t.altitudeM+e.altitudeM)/2,widthM:(t.widthM+e.widthM)/2,powerW:Math.sqrt(t.powerW*e.powerW),haze:(t.haze+e.haze)/2};return this.pushSegment(this.pushSegment(s,t,o,h,n,i+1),o,e,h,n,i+1)}if((s+M.VERTICES_PER_SEGMENT)*3>this.positions.length)return s;for(const o of R){if(o.every(a=>Math.max(...a.level)<=0))continue;const l=(a,A)=>{const E=s*3;this.positions[E]=a.point.x+a.across.x*a.half*A,this.positions[E+1]=a.point.y+a.across.y*a.half*A,this.positions[E+2]=a.point.z+a.across.z*a.half*A;const I=A===0?1:0;this.colors[E]=a.level[0]*I,this.colors[E+1]=a.level[1]*I,this.colors[E+2]=a.level[2]*I,s++},[p,d]=o;for(const a of[-1,1])l(p,a),l(p,0),l(d,a),l(p,0),l(d,0),l(d,a)}return s}pickAt(s,t,e){let h;for(const[n,i]of this.drawn.entries())for(let c=0;c+1<i.points.length;c++){const r=i.points[c],y=i.points[c+1],u={x:y.x-r.x,y:y.y-r.y,z:y.z-r.z},z={x:r.x-s.x,y:r.y-s.y,z:r.z-s.z},O=u.x*u.x+u.y*u.y+u.z*u.z,S=u.x*t.x+u.y*t.y+u.z*t.z,T=u.x*z.x+u.y*z.y+u.z*z.z,G=t.x*z.x+t.y*z.y+t.z*z.z,f=O-S*S,R=f>1e-9?Math.min(1,Math.max(0,(S*G-T)/f)):0,x={x:r.x+u.x*R,y:r.y+u.y*R,z:r.z+u.z*R},g=(x.x-s.x)*t.x+(x.y-s.y)*t.y+(x.z-s.z)*t.z;if(g<=0)continue;const o=Math.hypot(x.x-s.x-t.x*g,x.y-s.y-t.y*g,x.z-s.z-t.z*g),l=Math.atan2(o,g);l<=e&&(!h||l<h.angle)&&(h={id:i.id,distanceM:Math.hypot(x.x-s.x,x.y-s.y,x.z-s.z),angle:l,line:n})}return h&&{id:h.id,distanceM:h.distanceM,line:h.line}}cross(s,t){return{x:s.y*t.z-s.z*t.y,y:s.z*t.x-s.x*t.z,z:s.x*t.y-s.y*t.x}}normalise(s){const t=Math.hypot(s.x,s.y,s.z)||1;return{x:s.x/t,y:s.y/t,z:s.z/t}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.group.removeFromParent()}}export{M as BeamSystem};
@@ -1,4 +1,4 @@
1
- import{x as k,_ as c,bi as u,bf as y,a9 as O,ab as x,aa as T,I as w,a7 as M,a8 as I,n as F,ac 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-BoXaV-S_.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">
1
+ import{x as k,_ as c,bj as u,bg as y,a9 as O,ab as x,aa as T,I as w,a7 as M,a8 as I,n as F,ac 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-Dv9Awhvf.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
2
  <p class="launch-intro">${t.intro}</p>
3
3
  <div id="bird-list"></div>
4
4
  <div id="bird-fields" class="launch-fields">
@@ -1 +1 @@
1
- import{be as jt}from"./rr0-sighting-editor.mjs";class V{static G=9.81;static BUILDS={gull:{lengthM:.6,wingspanM:1.4,restM:{widthM:1.4,heightM:.14,lengthM:.653},colours:{upperColor:"#a9b1b9",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e6bd35"}},pelican:{lengthM:1.2,wingspanM:2.1,restM:{widthM:2.147,heightM:.281,lengthM:1.299},colours:{upperColor:"#7d7468",underColor:"#4f4840",tipColor:"#3b3631",headColor:"#e9dfb5",neckColor:"#5a3a2a",billColor:"#8d8778"}},goose:{lengthM:.95,wingspanM:1.6,restM:{widthM:1.6,heightM:.22,lengthM:1.003},colours:{upperColor:"#6b5d4f",underColor:"#cfc6b8",tipColor:"#3a332c",headColor:"#1d1c1b",neckColor:"#1d1c1b",billColor:"#1d1c1b"}},duck:{lengthM:.58,wingspanM:.9,restM:{widthM:.9,heightM:.15,lengthM:.633},colours:{upperColor:"#6d6457",underColor:"#b9b2a6",tipColor:"#4d463d",headColor:"#1f5a35",neckColor:"#ece9e1",billColor:"#d9b23a"}},plover:{lengthM:.27,wingspanM:.68,restM:{widthM:.68,heightM:.07,lengthM:.291},colours:{upperColor:"#6f6650",underColor:"#e8e4da",tipColor:"#3b362c",headColor:"#6f6650",neckColor:"#e8e4da",billColor:"#1d1c1b"}}};static ALL=[{id:"herring-gull",name:"Herring gull",build:"gull",lengthM:.6,wingspanM:1.4,massKg:1,wingAreaM2:.2,flight:{kind:"flapping"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"ring-billed-gull",name:"Ring-billed gull",build:"gull",lengthM:.48,wingspanM:1.2,massKg:.5,wingAreaM2:.14,flight:{kind:"flapping"},colours:{upperColor:"#b3bbc3"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"black-headed-gull",name:"Black-headed gull",build:"gull",lengthM:.37,wingspanM:1,massKg:.28,wingAreaM2:.1,flight:{kind:"flapping"},colours:{upperColor:"#c3c9cf",headColor:"#3d2b24",billColor:"#8f1d1d"},plumage:{color:"#e8eaec",albedo:.6}},{id:"brown-pelican",name:"Brown pelican",build:"pelican",lengthM:1.2,wingspanM:2.1,massKg:3.5,wingAreaM2:.55,flight:{kind:"bursts",beats:5,glideS:3},plumage:{color:"#7d7468",albedo:.25}},{id:"american-white-pelican",name:"American white pelican",build:"pelican",lengthM:1.5,wingspanM:2.7,massKg:7,wingAreaM2:.9,flight:{kind:"bursts",beats:6,glideS:3},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e89a3c"}},{id:"canada-goose",name:"Canada goose",build:"goose",lengthM:.95,wingspanM:1.6,massKg:4,wingAreaM2:.3,flight:{kind:"flapping"},plumage:{color:"#8a7c6c",albedo:.25}},{id:"snow-goose",name:"Snow goose",build:"goose",lengthM:.75,wingspanM:1.45,massKg:2.6,wingAreaM2:.25,flight:{kind:"flapping"},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#d9898a"}},{id:"mallard",name:"Mallard",build:"duck",lengthM:.58,wingspanM:.9,massKg:1.1,wingAreaM2:.095,flight:{kind:"flapping"},plumage:{color:"#8a8074",albedo:.3}},{id:"american-golden-plover",name:"American golden plover",build:"plover",lengthM:.26,wingspanM:.68,massKg:.145,wingAreaM2:.038,flight:{kind:"flapping"},plumage:{color:"#8a8070",albedo:.3}},{id:"killdeer",name:"Killdeer",build:"plover",lengthM:.25,wingspanM:.6,massKg:.09,wingAreaM2:.03,flight:{kind:"flapping"},colours:{upperColor:"#7a6249",headColor:"#7a6249"},plumage:{color:"#9a8a72",albedo:.3}}];static byId(t){return V.ALL.find(a=>a.id===t)}static wingbeatHz(t,a=1.225){return t.massKg**(3/8)*Math.sqrt(V.G)*t.wingspanM**(-23/24)*t.wingAreaM2**(-1/3)*a**(-3/8)}static airDensityAt(t){return 1.225*((288.15-.0065*t)/288.15)**4.2559}static colourOf(t,a){return t.colours?.[a]??V.BUILDS[t.build].colours[a]}static sizeOf(t){const a=V.BUILDS[t.build],e=t.wingspanM/a.wingspanM,o=t.lengthM/a.lengthM;return{widthM:a.restM.widthM*e,lengthM:a.restM.lengthM*o,heightM:a.restM.heightM*o}}}class l{static STEP_S=.05;static NEIGHBOURS=7;static MAX_BANK_DEG=60;static INFORMED_SHARE=.2;static BLIND_HALF_DEG=30;static TURN_LAG_S=.25;static SEPARATION=4;static ALIGNMENT=1;static TURN_FOLLOWING=.8;static COHESION=.6;static EDGE_COHESION=1;static VERTICAL_COHESION=.1;static LEAD=.6;static FOLLOWER_LEAD=.3;static LOOK_AHEAD_S=3;static SPEED_RATE=1.5;static SPEED_COHESION=.5;static STEERING=2;static NOISE=1.5;static OWN_SPEED=.5;static AVOIDANCE=6;static AVOID_AHEAD_S=1;static OVER_WITHIN_M=6;static MAX_RINGS=6;static run(t){const{path:a,count:e,species:o,random:n,sampleMs:r}=t,h=t.obstacles?.empty===!1?t.obstacles:void 0,f=new It(a),g=a[0].t,A=a[a.length-1].t,u=D=>{const S=f.velocityAt(D);return Math.max(Math.hypot(S.east,S.north,S.up),10)},c=t.spacing*o.wingspanM,d=p.slotsOf({kind:"cluster",spacing:t.spacing},e,o.wingspanM,n),w=f.velocityAt(g),M=Math.atan2(w.east,w.north),b=f.at(g),i=e,m=new Float64Array(i),y=new Float64Array(i),E=new Float64Array(i),O=new Float64Array(i),N=new Float64Array(i),I=new Float64Array(i),z=new Float64Array(i),T=new Float64Array(i),P=new Float64Array(i),v=new Float64Array(i),et=new Float64Array(i),at=new Float64Array(i),nt=new Float64Array(i),Ct=new Float64Array(i),Mt=new Uint8Array(i);d.forEach((D,S)=>{m[S]=b.eastM+Math.sin(M)*D.forwardM+Math.cos(M)*D.rightM,y[S]=b.northM+Math.cos(M)*D.forwardM-Math.sin(M)*D.rightM,E[S]=b.upM+D.upM,nt[S]=1+(n()-.5)*.08,O[S]=Math.sin(M)*u(g)*nt[S],N[S]=Math.cos(M)*u(g)*nt[S]});const Ut=Math.max(0,Math.min(1,t.informedShare??l.INFORMED_SHARE)),Vt=i===1?1:Math.min(i,Math.max(2,Math.round(i*Ut)));for(let D=0;D<Vt;){const S=Math.floor(n()*i);Mt[S]||(Mt[S]=1,D++)}const xt=d.map(()=>[]),Wt=d.map(()=>({x:0,y:0,z:0})),Dt=new Yt(i,Math.max(c*1.5,.1)),lt=Math.min(l.NEIGHBOURS,i-1),Nt=new Int32Array(Math.max(lt,1)),st=9.81*Math.tan(l.MAX_BANK_DEG*Math.PI/180),Xt=-Math.cos(l.BLIND_HALF_DEG*Math.PI/180),U=l.STEP_S,ct=Math.min(1,U/l.TURN_LAG_S);let gt=g;for(let D=g;D<=A+1e-6;D+=U*1e3){if(D>=gt-1e-6){for(let s=0;s<i;s++)xt[s].push({t:gt,eastM:m[s],northM:y[s],upM:E[s],headingDeg:0,pitchDeg:0,rollDeg:0});gt+=r}const S=f.at(D),dt=f.velocityAt(D),pt=u(D);Dt.fill(m,y,E);for(let s=0;s<i;s++){const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=lt>0?Dt.nearest(s,m,y,E,lt,l.MAX_RINGS,Nt,(C,x,K,G)=>(C*X+x*j+K*Y)/G>Xt):0;let Q=0,H=0,ut=0,St=0,Lt=0,zt=0,ft=0,At=0,wt=0,vt=0,Tt=0,Rt=0,Pt=0,Gt=0,Ht=0;for(let C=0;C<L;C++){const x=Nt[C],K=m[x]-m[s],G=y[x]-y[s],q=E[x]-E[s],R=Math.max(Math.hypot(K,G,q),.001);if(R<c){const J=(1-R/c)/R;Q-=K*J,H-=G*J,ut-=q*J}St+=m[x],Lt+=y[x],zt+=E[x],ft+=O[x],At+=N[x],wt+=I[x],vt+=z[x],Tt+=T[x],Rt+=P[x],Pt+=K/R,Gt+=G/R,Ht+=q/R}let _=0,B=0,Z=0,F=nt[s]*pt;const tt=Math.hypot(Q,H,ut);if(tt>0){const C=Math.min(1,tt*c);_+=Q/tt*l.SEPARATION*C,B+=H/tt*l.SEPARATION*C,Z+=ut/tt*l.SEPARATION*C}if(L>0){const C=St/L-m[s],x=Lt/L-y[s],K=zt/L-E[s],G=Math.max(Math.hypot(C,x,K),.001),q=Math.hypot(Pt,Gt,Ht)/L,R=(Math.min(1,G/(2*c))+l.EDGE_COHESION*q)*l.COHESION;_+=C/G*R,B+=x/G*R,Z+=K/G*R;const J=Math.max(Math.hypot(ft,At,wt)/L,.001);Z*=l.VERTICAL_COHESION,_+=ft/L/J*l.ALIGNMENT,B+=At/L/J*l.ALIGNMENT,Z+=wt/L/J*l.ALIGNMENT,F=J+(F-J)*l.OWN_SPEED,F+=(C*X+x*j+K*Y)*l.SPEED_COHESION}if(h){const C=h.inside(m[s]+O[s]*l.AVOID_AHEAD_S,y[s]+N[s]*l.AVOID_AHEAD_S,E[s]+I[s]*l.AVOID_AHEAD_S,c)??h.inside(m[s],y[s],E[s],c);C&&(_+=C.nx*l.AVOIDANCE,B+=C.ny*l.AVOIDANCE,C.belowTopM<l.OVER_WITHIN_M&&(Z+=l.AVOIDANCE))}{const C=l.LOOK_AHEAD_S,x=S.eastM+dt.east*C-m[s],K=S.northM+dt.north*C-y[s],G=S.upM+dt.up*C-E[s],q=Math.max(Math.hypot(x,K,G),.001),R=Mt[s]||L===0?l.LEAD:l.FOLLOWER_LEAD;_+=x/q*R,B+=K/q*R,Z+=G/q*R}const k=Math.hypot(_,B,Z);F=Math.max(.7*pt,Math.min(1.4*pt,F));const bt=l.STEERING*W;let ot=k>1e-6?(_/k-X)*bt:0,rt=k>1e-6?(B/k-j)*bt:0,ht=k>1e-6?(Z/k-Y)*bt:0;L>0&&(ot+=(vt/L-z[s])*l.TURN_FOLLOWING,rt+=(Tt/L-T[s])*l.TURN_FOLLOWING,ht+=(Rt/L-P[s])*l.TURN_FOLLOWING);const $=Wt[s];$.x+=((n()-.5)*2*l.NOISE-$.x)*U,$.y+=((n()-.5)*2*l.NOISE-$.y)*U,$.z+=((n()-.5)*l.NOISE-$.z)*U,ot+=$.x,rt+=$.y,ht+=$.z;const mt=ot*X+rt*j+ht*Y;let Et=ot-mt*X,yt=rt-mt*j,Ot=ht-mt*Y;const it=Math.hypot(Et,yt,Ot);it>st&&(Et*=st/it,yt*=st/it,Ot*=st/it),v[s]=Et,et[s]=yt,at[s]=Ot,Ct[s]=Math.max(-3,Math.min(3,(F-W)*l.SPEED_RATE))}for(let s=0;s<i;s++){z[s]+=(v[s]-z[s])*ct,T[s]+=(et[s]-T[s])*ct,P[s]+=(at[s]-P[s])*ct;const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=z[s]*X+T[s]*j+P[s]*Y;z[s]-=L*X,T[s]-=L*j,P[s]-=L*Y;const Q=Ct[s];if(O[s]+=(z[s]+X*Q)*U,N[s]+=(T[s]+j*Q)*U,I[s]+=(P[s]+Y*Q)*U,m[s]+=O[s]*U,y[s]+=N[s]*U,E[s]+=I[s]*U,h){const H=h.inside(m[s],y[s],E[s]);H&&(H.belowTopM<H.depthM?E[s]+=H.belowTopM:(m[s]+=H.nx*H.depthM,y[s]+=H.ny*H.depthM))}}}return xt.map(D=>(p.attitudes(D),{samples:D,delayS:0}))}}class Yt{constructor(t,a){this.n=t,this.cellM=a;let e=16;for(;e<t*2;)e*=2;this.size=e,this.start=new Int32Array(e+1),this.counts=new Int32Array(e),this.members=new Int32Array(t),this.slotOf=new Int32Array(t),this.seen=new Int32Array(e),this.distances=new Float64Array(t)}size;start;counts;members;slotOf;seen;search=0;distances;cell(t){return Math.floor(t/this.cellM)}slot(t,a,e){return(Math.imul(t,73856093)^Math.imul(a,19349663)^Math.imul(e,83492791))&this.size-1}fill(t,a,e){this.counts.fill(0);for(let n=0;n<this.n;n++){const r=this.slot(this.cell(t[n]),this.cell(a[n]),this.cell(e[n]));this.slotOf[n]=r,this.counts[r]++}this.start[0]=0;for(let n=0;n<this.size;n++)this.start[n+1]=this.start[n]+this.counts[n];const o=this.start.slice(0,this.size);for(let n=0;n<this.n;n++)this.members[o[this.slotOf[n]]++]=n}nearest(t,a,e,o,n,r,h,f){const g=++this.search,A=this.cell(a[t]),u=this.cell(e[t]),c=this.cell(o[t]);let d=0;const w=this.distances;for(let M=0;M<=r;M++){for(let b=A-M;b<=A+M;b++)for(let i=u-M;i<=u+M;i++)for(let m=c-M;m<=c+M;m++){if(Math.max(Math.abs(b-A),Math.abs(i-u),Math.abs(m-c))!==M)continue;const y=this.slot(b,i,m);if(this.seen[y]!==g){this.seen[y]=g;for(let E=this.start[y];E<this.start[y+1];E++){const O=this.members[E];if(O===t)continue;const N=a[O]-a[t],I=e[O]-e[t],z=o[O]-o[t],T=N*N+I*I+z*z;if(d===n&&T>=w[n-1])continue;const P=Math.sqrt(T);if(P>0&&!f(N,I,z,P))continue;let v=Math.min(d,n-1);for(;v>0&&w[v-1]>T;)w[v]=w[v-1],h[v]=h[v-1],v--;w[v]=T,h[v]=O,d<n&&d++}}}if(d===n&&w[n-1]<=(M*this.cellM)**2)break}return d}}class p{static SAMPLE_MS=100;static MAX_KEYFRAMES=6e4;static computed=new Map;static bodiesOf(t,a=jt.NONE){const e=JSON.stringify(t)+a.signature;let o=p.computed.get(e);return o||(o=p.compute(t,a),p.computed.set(e,o),p.computed.size>16&&p.computed.delete(p.computed.keys().next().value)),o}static speciesOf(t){return V.byId(t.species)??V.ALL[0]}static compute(t,a){const e=p.pathOf(t);if(e.length===0)return[];const o=p.speciesOf(t),n=Math.max(1,Math.floor(t.count??1)),r=p.randomFrom(t.seed??1),h=t.wingbeatHz??V.wingbeatHz(o,V.airDensityAt((t.originElevationM??0)+e[0].upM)),f=t.flight??o.flight,g=e[0].t,A=e[e.length-1].t,u=p.sampleMs(n,A-g),c=t.formation?.kind==="flock"?l.run({path:e,count:n,species:o,spacing:t.formation.spacing??1.5,informedShare:t.formation.informed,obstacles:a,random:r,sampleMs:u}):p.arranged(t,e,o,n,r,u),d=V.sizeOf(o),w={...o.colours,...t.colours};return c.map((M,b)=>{const i=h*(1+(r()-.5)*.06),m=r(),y=M.delayS,E=f.kind==="path"?p.flapsAlong(M.samples,i,f,m):void 0,O=M.samples.map((I,z)=>({t:Math.round(I.t),eastM:p.round(I.eastM),northM:p.round(I.northM),altitudeM:p.round(I.upM-d.heightM/2),...z===0?{sizeM:d,appearance:{color:o.plumage.color,albedo:o.plumage.albedo}}:{},attitude:{headingDeg:p.round(I.headingDeg),pitchDeg:p.round(I.pitchDeg),rollDeg:p.round(I.rollDeg)},motions:{flap:p.round(E?E[z]:p.beatsAt((I.t-g)/1e3-y,i,f,m),1e3)}}));return{id:n>1?`${t.id}-${b+1}`:t.id,...t.title?{title:t.title}:{},...t.explainsEach?t.explainsEach[b]!==void 0?{explains:[t.explainsEach[b]]}:{}:{...t.explains?{explains:t.explains}:{},...n>1?{ensemble:t.id}:{}},model:{id:`ufoathome-bird-${o.build}`},shadow:!1,...Object.keys(w).length>0?{modelParameters:w}:{},...t.lightFromBelow?{lightFromBelow:t.lightFromBelow}:{},track:O}})}static beatsAt(t,a,e,o){if(e.kind==="flapping")return Math.max(0,t*a+o);const r=e.beats/a+e.glideS,h=Math.max(0,t+o*r),f=Math.floor(h/r),g=h-f*r;return f*e.beats+Math.min(e.beats,g*a)}static CLIMB_FLAPS_MS=.3;static DESCENT_GLIDES_MS=-.8;static flapsAlong(t,a,e,o){let n=o,r=!0,h=Math.floor(n),f=0;return t.map((g,A)=>{if(A===0)return n;const u=t[A-1],c=(g.t-u.t)/1e3;if(c<=0)return n;const d=(g.upM-u.upM)/c,w=r?n-h<e.beats:(g.t-f)/1e3>=e.glideS,M=d>p.CLIMB_FLAPS_MS?!0:d<p.DESCENT_GLIDES_MS?!1:w;if(r){const b=n+a*c;!M&&Math.floor(b)>Math.floor(n)?(n=Math.floor(b),r=!1,f=g.t):n=b}else M&&(r=!0,h=n);return n})}static sampleMs(t,a){const e=t*(a/p.SAMPLE_MS+1);return e<=p.MAX_KEYFRAMES?p.SAMPLE_MS:Math.ceil(p.SAMPLE_MS*e/p.MAX_KEYFRAMES/50)*50}static pathOf(t){return[...t.path].sort((a,e)=>a.t-e.t).map(a=>{if("eastM"in a)return{t:a.t,eastM:a.eastM,northM:a.northM,upM:a.altitudeM};const e=a.azimuthDeg*Math.PI/180,o=a.altitudeDeg*Math.PI/180,n=a.distanceM*Math.cos(o);return{t:a.t,eastM:n*Math.sin(e),northM:n*Math.cos(e),upM:(a.eyeHeightM??1.6)+a.distanceM*Math.sin(o)}})}static arranged(t,a,e,o,n,r){const h=t.formation??{kind:o>1?"cluster":"single"},f=p.slotsOf(h,o,e.wingspanM,n),g=h.kind==="v"||h.kind==="j"||h.kind==="echelon"||h.kind==="column",A=(h.wander??(g?.15:.4))*e.wingspanM,u=new It(a),c=Math.max(u.meanSpeedMS(),1);return f.map(d=>{const w=g?Math.max(0,-d.forwardM)/c:0,M=p.swayFrom(n,A),b=[];for(let i=a[0].t;i<=a[a.length-1].t+1e-6;i+=r){const m=(i-a[0].t)/1e3,y=i-w*1e3,E=u.at(y),O=u.velocityAt(y),N=Math.atan2(O.east,O.north),[I,z,T]=M(m),P=g?I:d.forwardM+I,v=d.rightM+z,et=E.eastM+Math.sin(N)*P+Math.cos(N)*v,at=E.northM+Math.cos(N)*P-Math.sin(N)*v;b.push({t:i,eastM:et,northM:at,upM:E.upM+d.upM+T,headingDeg:0,pitchDeg:0,rollDeg:0})}return p.attitudes(b),{samples:b,delayS:w}})}static slotsOf(t,a,e,o){const n=[],r=t.kind;if(r==="single"||a===1)return[{forwardM:0,rightM:0,upM:0}];if(r==="v"||r==="j"||r==="echelon"||r==="column"){const c=(t.spacing??1)*e*(r==="column"?0:1),d=(t.angleDeg??70)/2*Math.PI/180,w=r==="column"?(t.spacing??1)*e:c/Math.tan(d),M=r==="v"?.5:r==="echelon"||r==="column"?1:t.asymmetry??.7;n.push({forwardM:0,rightM:0,upM:0});const b=Math.round(M*(a-1));let i=0,m=0;for(let y=1;y<a;y++){const E=m>=a-1-b||i<b&&i/Math.max(b,1)<=m/Math.max(a-1-b,1),O=E?++i:++m;n.push({forwardM:-w*O,rightM:(E?1:-1)*c*O,upM:-.05*e*O*o()})}return n}const h=(t.spacing??1.5)*e;if(r==="front"){for(let c=0;c<a;c++)n.push({forwardM:(o()-.5)*h*1.2,rightM:(c-(a-1)/2)*h,upM:(o()-.5)*h*.4});return n}const f=a*h**3,g=Math.cbrt(f/(4/3*Math.PI*1*2.8*5.6)),A={up:g,across:2.8*g,along:5.6*g};let u=0;for(;n.length<a&&u<a*200;){u++;const c=2*o()-1,d=2*o()-1,w=2*o()-1;if(c*c+d*d+w*w>1)continue;const M={forwardM:c*A.along,rightM:d*A.across,upM:w*A.up};n.some(b=>(b.forwardM-M.forwardM)**2+(b.rightM-M.rightM)**2+(b.upM-M.upM)**2<(h/2)**2)||n.push(M)}for(;n.length<a;)n.push({forwardM:(o()-.5)*A.along,rightM:(o()-.5)*A.across,upM:0});return n}static swayFrom(t,a){const e=[0,1,2].map(o=>[0,1].map(()=>({period:3+t()*7,phase:t()*2*Math.PI,share:(o===2?.4:o===1?.7:1)*(.4+.6*t())})));return o=>e.map(n=>n.reduce((r,h)=>r+a*h.share*.5*Math.sin(2*Math.PI*o/h.period+h.phase),0))}static attitudes(t){const a=t.length;if(!(a<2)){for(let e=0;e<a;e++){const o=t[Math.max(0,e-1)],n=t[Math.min(a-1,e+1)],r=(n.t-o.t)/1e3,h=(n.eastM-o.eastM)/r,f=(n.northM-o.northM)/r,g=(n.upM-o.upM)/r,A=Math.hypot(h,f),u=t[e];u.headingDeg=A>.05?(Math.atan2(h,f)*180/Math.PI+360)%360:e>0?t[e-1].headingDeg:0,u.pitchDeg=Math.atan2(g,Math.max(A,.5))*180/Math.PI}for(let e=0;e<a;e++){const o=t[Math.max(0,e-2)],n=t[Math.min(a-1,e+2)],r=(n.t-o.t)/1e3;let h=n.headingDeg-o.headingDeg;h=(h+540)%360-180;const f=t[e],g=t[Math.max(0,e-1)],A=t[Math.min(a-1,e+1)],u=Math.hypot(A.eastM-g.eastM,A.northM-g.northM)/Math.max((A.t-g.t)/1e3,.001),c=r>0?h*Math.PI/180/r:0,d=Math.atan(u*c/V.G)*180/Math.PI;f.rollDeg=Math.max(-70,Math.min(70,d))}}}static randomFrom(t){let a=t>>>0;return()=>{a=a+1831565813>>>0;let e=a;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}static round(t,a=100){return Math.round(t*a)/a}}class It{constructor(t){this.points=t}at(t){const a=this.points;if(a.length===1||t<=a[0].t)return this.extrapolated(t,0);if(t>=a[a.length-1].t)return this.extrapolated(t,a.length-1);let e=0;for(;e<a.length-2&&t>a[e+1].t;)e++;const o=a[Math.max(0,e-1)],n=a[e],r=a[e+1],h=a[Math.min(a.length-1,e+2)],f=(t-n.t)/(r.t-n.t),g=(u,c,d)=>(c[d]-u[d])/Math.max(c.t-u.t,1)*(r.t-n.t),A=u=>{const c=g(o,r,u),d=g(n,h,u),w=f*f,M=w*f;return(2*M-3*w+1)*n[u]+(M-2*w+f)*c+(-2*M+3*w)*r[u]+(M-w)*d};return{t,eastM:A("eastM"),northM:A("northM"),upM:A("upM")}}extrapolated(t,a){const e=this.points,o=e[a];if(e.length<2)return{...o,t};const n=a===0?e[0]:e[e.length-2],r=a===0?e[1]:e[e.length-1],h=(t-o.t)/Math.max(r.t-n.t,1);return{t,eastM:o.eastM+(r.eastM-n.eastM)*h,northM:o.northM+(r.northM-n.northM)*h,upM:o.upM+(r.upM-n.upM)*h}}velocityAt(t){const a=this.at(t-50),e=this.at(t+50);return{east:(e.eastM-a.eastM)/.1,north:(e.northM-a.northM)/.1,up:(e.upM-a.upM)/.1}}meanSpeedMS(){const t=this.points;if(t.length<2)return 0;let a=0;for(let e=1;e<t.length;e++)a+=Math.hypot(t[e].eastM-t[e-1].eastM,t[e].northM-t[e-1].northM,t[e].upM-t[e-1].upM);return a/Math.max((t[t.length-1].t-t[0].t)/1e3,.001)}}const qt=Object.freeze(Object.defineProperty({__proto__:null,BirdFlock:p,FlightPath:It},Symbol.toStringTag,{value:"Module"}));export{p as B,l as F,V as a,qt as b};
1
+ import{bf as jt}from"./rr0-sighting-editor.mjs";class V{static G=9.81;static BUILDS={gull:{lengthM:.6,wingspanM:1.4,restM:{widthM:1.4,heightM:.14,lengthM:.653},colours:{upperColor:"#a9b1b9",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e6bd35"}},pelican:{lengthM:1.2,wingspanM:2.1,restM:{widthM:2.147,heightM:.281,lengthM:1.299},colours:{upperColor:"#7d7468",underColor:"#4f4840",tipColor:"#3b3631",headColor:"#e9dfb5",neckColor:"#5a3a2a",billColor:"#8d8778"}},goose:{lengthM:.95,wingspanM:1.6,restM:{widthM:1.6,heightM:.22,lengthM:1.003},colours:{upperColor:"#6b5d4f",underColor:"#cfc6b8",tipColor:"#3a332c",headColor:"#1d1c1b",neckColor:"#1d1c1b",billColor:"#1d1c1b"}},duck:{lengthM:.58,wingspanM:.9,restM:{widthM:.9,heightM:.15,lengthM:.633},colours:{upperColor:"#6d6457",underColor:"#b9b2a6",tipColor:"#4d463d",headColor:"#1f5a35",neckColor:"#ece9e1",billColor:"#d9b23a"}},plover:{lengthM:.27,wingspanM:.68,restM:{widthM:.68,heightM:.07,lengthM:.291},colours:{upperColor:"#6f6650",underColor:"#e8e4da",tipColor:"#3b362c",headColor:"#6f6650",neckColor:"#e8e4da",billColor:"#1d1c1b"}}};static ALL=[{id:"herring-gull",name:"Herring gull",build:"gull",lengthM:.6,wingspanM:1.4,massKg:1,wingAreaM2:.2,flight:{kind:"flapping"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"ring-billed-gull",name:"Ring-billed gull",build:"gull",lengthM:.48,wingspanM:1.2,massKg:.5,wingAreaM2:.14,flight:{kind:"flapping"},colours:{upperColor:"#b3bbc3"},plumage:{color:"#e6e8ea",albedo:.6}},{id:"black-headed-gull",name:"Black-headed gull",build:"gull",lengthM:.37,wingspanM:1,massKg:.28,wingAreaM2:.1,flight:{kind:"flapping"},colours:{upperColor:"#c3c9cf",headColor:"#3d2b24",billColor:"#8f1d1d"},plumage:{color:"#e8eaec",albedo:.6}},{id:"brown-pelican",name:"Brown pelican",build:"pelican",lengthM:1.2,wingspanM:2.1,massKg:3.5,wingAreaM2:.55,flight:{kind:"bursts",beats:5,glideS:3},plumage:{color:"#7d7468",albedo:.25}},{id:"american-white-pelican",name:"American white pelican",build:"pelican",lengthM:1.5,wingspanM:2.7,massKg:7,wingAreaM2:.9,flight:{kind:"bursts",beats:6,glideS:3},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#e89a3c"}},{id:"canada-goose",name:"Canada goose",build:"goose",lengthM:.95,wingspanM:1.6,massKg:4,wingAreaM2:.3,flight:{kind:"flapping"},plumage:{color:"#8a7c6c",albedo:.25}},{id:"snow-goose",name:"Snow goose",build:"goose",lengthM:.75,wingspanM:1.45,massKg:2.6,wingAreaM2:.25,flight:{kind:"flapping"},plumage:{color:"#f3f2ec",albedo:.8},colours:{upperColor:"#f3f2ec",underColor:"#f3f2ec",tipColor:"#1b1c1f",headColor:"#f3f2ec",neckColor:"#f3f2ec",billColor:"#d9898a"}},{id:"mallard",name:"Mallard",build:"duck",lengthM:.58,wingspanM:.9,massKg:1.1,wingAreaM2:.095,flight:{kind:"flapping"},plumage:{color:"#8a8074",albedo:.3}},{id:"american-golden-plover",name:"American golden plover",build:"plover",lengthM:.26,wingspanM:.68,massKg:.145,wingAreaM2:.038,flight:{kind:"flapping"},plumage:{color:"#8a8070",albedo:.3}},{id:"killdeer",name:"Killdeer",build:"plover",lengthM:.25,wingspanM:.6,massKg:.09,wingAreaM2:.03,flight:{kind:"flapping"},colours:{upperColor:"#7a6249",headColor:"#7a6249"},plumage:{color:"#9a8a72",albedo:.3}}];static byId(t){return V.ALL.find(a=>a.id===t)}static wingbeatHz(t,a=1.225){return t.massKg**(3/8)*Math.sqrt(V.G)*t.wingspanM**(-23/24)*t.wingAreaM2**(-1/3)*a**(-3/8)}static airDensityAt(t){return 1.225*((288.15-.0065*t)/288.15)**4.2559}static colourOf(t,a){return t.colours?.[a]??V.BUILDS[t.build].colours[a]}static sizeOf(t){const a=V.BUILDS[t.build],e=t.wingspanM/a.wingspanM,o=t.lengthM/a.lengthM;return{widthM:a.restM.widthM*e,lengthM:a.restM.lengthM*o,heightM:a.restM.heightM*o}}}class l{static STEP_S=.05;static NEIGHBOURS=7;static MAX_BANK_DEG=60;static INFORMED_SHARE=.2;static BLIND_HALF_DEG=30;static TURN_LAG_S=.25;static SEPARATION=4;static ALIGNMENT=1;static TURN_FOLLOWING=.8;static COHESION=.6;static EDGE_COHESION=1;static VERTICAL_COHESION=.1;static LEAD=.6;static FOLLOWER_LEAD=.3;static LOOK_AHEAD_S=3;static SPEED_RATE=1.5;static SPEED_COHESION=.5;static STEERING=2;static NOISE=1.5;static OWN_SPEED=.5;static AVOIDANCE=6;static AVOID_AHEAD_S=1;static OVER_WITHIN_M=6;static MAX_RINGS=6;static run(t){const{path:a,count:e,species:o,random:n,sampleMs:r}=t,h=t.obstacles?.empty===!1?t.obstacles:void 0,f=new It(a),g=a[0].t,A=a[a.length-1].t,u=D=>{const S=f.velocityAt(D);return Math.max(Math.hypot(S.east,S.north,S.up),10)},c=t.spacing*o.wingspanM,d=p.slotsOf({kind:"cluster",spacing:t.spacing},e,o.wingspanM,n),w=f.velocityAt(g),M=Math.atan2(w.east,w.north),b=f.at(g),i=e,m=new Float64Array(i),y=new Float64Array(i),E=new Float64Array(i),O=new Float64Array(i),N=new Float64Array(i),I=new Float64Array(i),z=new Float64Array(i),T=new Float64Array(i),P=new Float64Array(i),v=new Float64Array(i),et=new Float64Array(i),at=new Float64Array(i),nt=new Float64Array(i),Ct=new Float64Array(i),Mt=new Uint8Array(i);d.forEach((D,S)=>{m[S]=b.eastM+Math.sin(M)*D.forwardM+Math.cos(M)*D.rightM,y[S]=b.northM+Math.cos(M)*D.forwardM-Math.sin(M)*D.rightM,E[S]=b.upM+D.upM,nt[S]=1+(n()-.5)*.08,O[S]=Math.sin(M)*u(g)*nt[S],N[S]=Math.cos(M)*u(g)*nt[S]});const Ut=Math.max(0,Math.min(1,t.informedShare??l.INFORMED_SHARE)),Vt=i===1?1:Math.min(i,Math.max(2,Math.round(i*Ut)));for(let D=0;D<Vt;){const S=Math.floor(n()*i);Mt[S]||(Mt[S]=1,D++)}const xt=d.map(()=>[]),Wt=d.map(()=>({x:0,y:0,z:0})),Dt=new Yt(i,Math.max(c*1.5,.1)),lt=Math.min(l.NEIGHBOURS,i-1),Nt=new Int32Array(Math.max(lt,1)),st=9.81*Math.tan(l.MAX_BANK_DEG*Math.PI/180),Xt=-Math.cos(l.BLIND_HALF_DEG*Math.PI/180),U=l.STEP_S,ct=Math.min(1,U/l.TURN_LAG_S);let gt=g;for(let D=g;D<=A+1e-6;D+=U*1e3){if(D>=gt-1e-6){for(let s=0;s<i;s++)xt[s].push({t:gt,eastM:m[s],northM:y[s],upM:E[s],headingDeg:0,pitchDeg:0,rollDeg:0});gt+=r}const S=f.at(D),dt=f.velocityAt(D),pt=u(D);Dt.fill(m,y,E);for(let s=0;s<i;s++){const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=lt>0?Dt.nearest(s,m,y,E,lt,l.MAX_RINGS,Nt,(C,x,K,G)=>(C*X+x*j+K*Y)/G>Xt):0;let Q=0,H=0,ut=0,St=0,Lt=0,zt=0,ft=0,At=0,wt=0,vt=0,Tt=0,Rt=0,Pt=0,Gt=0,Ht=0;for(let C=0;C<L;C++){const x=Nt[C],K=m[x]-m[s],G=y[x]-y[s],q=E[x]-E[s],R=Math.max(Math.hypot(K,G,q),.001);if(R<c){const J=(1-R/c)/R;Q-=K*J,H-=G*J,ut-=q*J}St+=m[x],Lt+=y[x],zt+=E[x],ft+=O[x],At+=N[x],wt+=I[x],vt+=z[x],Tt+=T[x],Rt+=P[x],Pt+=K/R,Gt+=G/R,Ht+=q/R}let _=0,B=0,Z=0,F=nt[s]*pt;const tt=Math.hypot(Q,H,ut);if(tt>0){const C=Math.min(1,tt*c);_+=Q/tt*l.SEPARATION*C,B+=H/tt*l.SEPARATION*C,Z+=ut/tt*l.SEPARATION*C}if(L>0){const C=St/L-m[s],x=Lt/L-y[s],K=zt/L-E[s],G=Math.max(Math.hypot(C,x,K),.001),q=Math.hypot(Pt,Gt,Ht)/L,R=(Math.min(1,G/(2*c))+l.EDGE_COHESION*q)*l.COHESION;_+=C/G*R,B+=x/G*R,Z+=K/G*R;const J=Math.max(Math.hypot(ft,At,wt)/L,.001);Z*=l.VERTICAL_COHESION,_+=ft/L/J*l.ALIGNMENT,B+=At/L/J*l.ALIGNMENT,Z+=wt/L/J*l.ALIGNMENT,F=J+(F-J)*l.OWN_SPEED,F+=(C*X+x*j+K*Y)*l.SPEED_COHESION}if(h){const C=h.inside(m[s]+O[s]*l.AVOID_AHEAD_S,y[s]+N[s]*l.AVOID_AHEAD_S,E[s]+I[s]*l.AVOID_AHEAD_S,c)??h.inside(m[s],y[s],E[s],c);C&&(_+=C.nx*l.AVOIDANCE,B+=C.ny*l.AVOIDANCE,C.belowTopM<l.OVER_WITHIN_M&&(Z+=l.AVOIDANCE))}{const C=l.LOOK_AHEAD_S,x=S.eastM+dt.east*C-m[s],K=S.northM+dt.north*C-y[s],G=S.upM+dt.up*C-E[s],q=Math.max(Math.hypot(x,K,G),.001),R=Mt[s]||L===0?l.LEAD:l.FOLLOWER_LEAD;_+=x/q*R,B+=K/q*R,Z+=G/q*R}const k=Math.hypot(_,B,Z);F=Math.max(.7*pt,Math.min(1.4*pt,F));const bt=l.STEERING*W;let ot=k>1e-6?(_/k-X)*bt:0,rt=k>1e-6?(B/k-j)*bt:0,ht=k>1e-6?(Z/k-Y)*bt:0;L>0&&(ot+=(vt/L-z[s])*l.TURN_FOLLOWING,rt+=(Tt/L-T[s])*l.TURN_FOLLOWING,ht+=(Rt/L-P[s])*l.TURN_FOLLOWING);const $=Wt[s];$.x+=((n()-.5)*2*l.NOISE-$.x)*U,$.y+=((n()-.5)*2*l.NOISE-$.y)*U,$.z+=((n()-.5)*l.NOISE-$.z)*U,ot+=$.x,rt+=$.y,ht+=$.z;const mt=ot*X+rt*j+ht*Y;let Et=ot-mt*X,yt=rt-mt*j,Ot=ht-mt*Y;const it=Math.hypot(Et,yt,Ot);it>st&&(Et*=st/it,yt*=st/it,Ot*=st/it),v[s]=Et,et[s]=yt,at[s]=Ot,Ct[s]=Math.max(-3,Math.min(3,(F-W)*l.SPEED_RATE))}for(let s=0;s<i;s++){z[s]+=(v[s]-z[s])*ct,T[s]+=(et[s]-T[s])*ct,P[s]+=(at[s]-P[s])*ct;const W=Math.max(Math.hypot(O[s],N[s],I[s]),.001),X=O[s]/W,j=N[s]/W,Y=I[s]/W,L=z[s]*X+T[s]*j+P[s]*Y;z[s]-=L*X,T[s]-=L*j,P[s]-=L*Y;const Q=Ct[s];if(O[s]+=(z[s]+X*Q)*U,N[s]+=(T[s]+j*Q)*U,I[s]+=(P[s]+Y*Q)*U,m[s]+=O[s]*U,y[s]+=N[s]*U,E[s]+=I[s]*U,h){const H=h.inside(m[s],y[s],E[s]);H&&(H.belowTopM<H.depthM?E[s]+=H.belowTopM:(m[s]+=H.nx*H.depthM,y[s]+=H.ny*H.depthM))}}}return xt.map(D=>(p.attitudes(D),{samples:D,delayS:0}))}}class Yt{constructor(t,a){this.n=t,this.cellM=a;let e=16;for(;e<t*2;)e*=2;this.size=e,this.start=new Int32Array(e+1),this.counts=new Int32Array(e),this.members=new Int32Array(t),this.slotOf=new Int32Array(t),this.seen=new Int32Array(e),this.distances=new Float64Array(t)}size;start;counts;members;slotOf;seen;search=0;distances;cell(t){return Math.floor(t/this.cellM)}slot(t,a,e){return(Math.imul(t,73856093)^Math.imul(a,19349663)^Math.imul(e,83492791))&this.size-1}fill(t,a,e){this.counts.fill(0);for(let n=0;n<this.n;n++){const r=this.slot(this.cell(t[n]),this.cell(a[n]),this.cell(e[n]));this.slotOf[n]=r,this.counts[r]++}this.start[0]=0;for(let n=0;n<this.size;n++)this.start[n+1]=this.start[n]+this.counts[n];const o=this.start.slice(0,this.size);for(let n=0;n<this.n;n++)this.members[o[this.slotOf[n]]++]=n}nearest(t,a,e,o,n,r,h,f){const g=++this.search,A=this.cell(a[t]),u=this.cell(e[t]),c=this.cell(o[t]);let d=0;const w=this.distances;for(let M=0;M<=r;M++){for(let b=A-M;b<=A+M;b++)for(let i=u-M;i<=u+M;i++)for(let m=c-M;m<=c+M;m++){if(Math.max(Math.abs(b-A),Math.abs(i-u),Math.abs(m-c))!==M)continue;const y=this.slot(b,i,m);if(this.seen[y]!==g){this.seen[y]=g;for(let E=this.start[y];E<this.start[y+1];E++){const O=this.members[E];if(O===t)continue;const N=a[O]-a[t],I=e[O]-e[t],z=o[O]-o[t],T=N*N+I*I+z*z;if(d===n&&T>=w[n-1])continue;const P=Math.sqrt(T);if(P>0&&!f(N,I,z,P))continue;let v=Math.min(d,n-1);for(;v>0&&w[v-1]>T;)w[v]=w[v-1],h[v]=h[v-1],v--;w[v]=T,h[v]=O,d<n&&d++}}}if(d===n&&w[n-1]<=(M*this.cellM)**2)break}return d}}class p{static SAMPLE_MS=100;static MAX_KEYFRAMES=6e4;static computed=new Map;static bodiesOf(t,a=jt.NONE){const e=JSON.stringify(t)+a.signature;let o=p.computed.get(e);return o||(o=p.compute(t,a),p.computed.set(e,o),p.computed.size>16&&p.computed.delete(p.computed.keys().next().value)),o}static speciesOf(t){return V.byId(t.species)??V.ALL[0]}static compute(t,a){const e=p.pathOf(t);if(e.length===0)return[];const o=p.speciesOf(t),n=Math.max(1,Math.floor(t.count??1)),r=p.randomFrom(t.seed??1),h=t.wingbeatHz??V.wingbeatHz(o,V.airDensityAt((t.originElevationM??0)+e[0].upM)),f=t.flight??o.flight,g=e[0].t,A=e[e.length-1].t,u=p.sampleMs(n,A-g),c=t.formation?.kind==="flock"?l.run({path:e,count:n,species:o,spacing:t.formation.spacing??1.5,informedShare:t.formation.informed,obstacles:a,random:r,sampleMs:u}):p.arranged(t,e,o,n,r,u),d=V.sizeOf(o),w={...o.colours,...t.colours};return c.map((M,b)=>{const i=h*(1+(r()-.5)*.06),m=r(),y=M.delayS,E=f.kind==="path"?p.flapsAlong(M.samples,i,f,m):void 0,O=M.samples.map((I,z)=>({t:Math.round(I.t),eastM:p.round(I.eastM),northM:p.round(I.northM),altitudeM:p.round(I.upM-d.heightM/2),...z===0?{sizeM:d,appearance:{color:o.plumage.color,albedo:o.plumage.albedo}}:{},attitude:{headingDeg:p.round(I.headingDeg),pitchDeg:p.round(I.pitchDeg),rollDeg:p.round(I.rollDeg)},motions:{flap:p.round(E?E[z]:p.beatsAt((I.t-g)/1e3-y,i,f,m),1e3)}}));return{id:n>1?`${t.id}-${b+1}`:t.id,...t.title?{title:t.title}:{},...t.explainsEach?t.explainsEach[b]!==void 0?{explains:[t.explainsEach[b]]}:{}:{...t.explains?{explains:t.explains}:{},...n>1?{ensemble:t.id}:{}},model:{id:`ufoathome-bird-${o.build}`},shadow:!1,...Object.keys(w).length>0?{modelParameters:w}:{},...t.lightFromBelow?{lightFromBelow:t.lightFromBelow}:{},track:O}})}static beatsAt(t,a,e,o){if(e.kind==="flapping")return Math.max(0,t*a+o);const r=e.beats/a+e.glideS,h=Math.max(0,t+o*r),f=Math.floor(h/r),g=h-f*r;return f*e.beats+Math.min(e.beats,g*a)}static CLIMB_FLAPS_MS=.3;static DESCENT_GLIDES_MS=-.8;static flapsAlong(t,a,e,o){let n=o,r=!0,h=Math.floor(n),f=0;return t.map((g,A)=>{if(A===0)return n;const u=t[A-1],c=(g.t-u.t)/1e3;if(c<=0)return n;const d=(g.upM-u.upM)/c,w=r?n-h<e.beats:(g.t-f)/1e3>=e.glideS,M=d>p.CLIMB_FLAPS_MS?!0:d<p.DESCENT_GLIDES_MS?!1:w;if(r){const b=n+a*c;!M&&Math.floor(b)>Math.floor(n)?(n=Math.floor(b),r=!1,f=g.t):n=b}else M&&(r=!0,h=n);return n})}static sampleMs(t,a){const e=t*(a/p.SAMPLE_MS+1);return e<=p.MAX_KEYFRAMES?p.SAMPLE_MS:Math.ceil(p.SAMPLE_MS*e/p.MAX_KEYFRAMES/50)*50}static pathOf(t){return[...t.path].sort((a,e)=>a.t-e.t).map(a=>{if("eastM"in a)return{t:a.t,eastM:a.eastM,northM:a.northM,upM:a.altitudeM};const e=a.azimuthDeg*Math.PI/180,o=a.altitudeDeg*Math.PI/180,n=a.distanceM*Math.cos(o);return{t:a.t,eastM:n*Math.sin(e),northM:n*Math.cos(e),upM:(a.eyeHeightM??1.6)+a.distanceM*Math.sin(o)}})}static arranged(t,a,e,o,n,r){const h=t.formation??{kind:o>1?"cluster":"single"},f=p.slotsOf(h,o,e.wingspanM,n),g=h.kind==="v"||h.kind==="j"||h.kind==="echelon"||h.kind==="column",A=(h.wander??(g?.15:.4))*e.wingspanM,u=new It(a),c=Math.max(u.meanSpeedMS(),1);return f.map(d=>{const w=g?Math.max(0,-d.forwardM)/c:0,M=p.swayFrom(n,A),b=[];for(let i=a[0].t;i<=a[a.length-1].t+1e-6;i+=r){const m=(i-a[0].t)/1e3,y=i-w*1e3,E=u.at(y),O=u.velocityAt(y),N=Math.atan2(O.east,O.north),[I,z,T]=M(m),P=g?I:d.forwardM+I,v=d.rightM+z,et=E.eastM+Math.sin(N)*P+Math.cos(N)*v,at=E.northM+Math.cos(N)*P-Math.sin(N)*v;b.push({t:i,eastM:et,northM:at,upM:E.upM+d.upM+T,headingDeg:0,pitchDeg:0,rollDeg:0})}return p.attitudes(b),{samples:b,delayS:w}})}static slotsOf(t,a,e,o){const n=[],r=t.kind;if(r==="single"||a===1)return[{forwardM:0,rightM:0,upM:0}];if(r==="v"||r==="j"||r==="echelon"||r==="column"){const c=(t.spacing??1)*e*(r==="column"?0:1),d=(t.angleDeg??70)/2*Math.PI/180,w=r==="column"?(t.spacing??1)*e:c/Math.tan(d),M=r==="v"?.5:r==="echelon"||r==="column"?1:t.asymmetry??.7;n.push({forwardM:0,rightM:0,upM:0});const b=Math.round(M*(a-1));let i=0,m=0;for(let y=1;y<a;y++){const E=m>=a-1-b||i<b&&i/Math.max(b,1)<=m/Math.max(a-1-b,1),O=E?++i:++m;n.push({forwardM:-w*O,rightM:(E?1:-1)*c*O,upM:-.05*e*O*o()})}return n}const h=(t.spacing??1.5)*e;if(r==="front"){for(let c=0;c<a;c++)n.push({forwardM:(o()-.5)*h*1.2,rightM:(c-(a-1)/2)*h,upM:(o()-.5)*h*.4});return n}const f=a*h**3,g=Math.cbrt(f/(4/3*Math.PI*1*2.8*5.6)),A={up:g,across:2.8*g,along:5.6*g};let u=0;for(;n.length<a&&u<a*200;){u++;const c=2*o()-1,d=2*o()-1,w=2*o()-1;if(c*c+d*d+w*w>1)continue;const M={forwardM:c*A.along,rightM:d*A.across,upM:w*A.up};n.some(b=>(b.forwardM-M.forwardM)**2+(b.rightM-M.rightM)**2+(b.upM-M.upM)**2<(h/2)**2)||n.push(M)}for(;n.length<a;)n.push({forwardM:(o()-.5)*A.along,rightM:(o()-.5)*A.across,upM:0});return n}static swayFrom(t,a){const e=[0,1,2].map(o=>[0,1].map(()=>({period:3+t()*7,phase:t()*2*Math.PI,share:(o===2?.4:o===1?.7:1)*(.4+.6*t())})));return o=>e.map(n=>n.reduce((r,h)=>r+a*h.share*.5*Math.sin(2*Math.PI*o/h.period+h.phase),0))}static attitudes(t){const a=t.length;if(!(a<2)){for(let e=0;e<a;e++){const o=t[Math.max(0,e-1)],n=t[Math.min(a-1,e+1)],r=(n.t-o.t)/1e3,h=(n.eastM-o.eastM)/r,f=(n.northM-o.northM)/r,g=(n.upM-o.upM)/r,A=Math.hypot(h,f),u=t[e];u.headingDeg=A>.05?(Math.atan2(h,f)*180/Math.PI+360)%360:e>0?t[e-1].headingDeg:0,u.pitchDeg=Math.atan2(g,Math.max(A,.5))*180/Math.PI}for(let e=0;e<a;e++){const o=t[Math.max(0,e-2)],n=t[Math.min(a-1,e+2)],r=(n.t-o.t)/1e3;let h=n.headingDeg-o.headingDeg;h=(h+540)%360-180;const f=t[e],g=t[Math.max(0,e-1)],A=t[Math.min(a-1,e+1)],u=Math.hypot(A.eastM-g.eastM,A.northM-g.northM)/Math.max((A.t-g.t)/1e3,.001),c=r>0?h*Math.PI/180/r:0,d=Math.atan(u*c/V.G)*180/Math.PI;f.rollDeg=Math.max(-70,Math.min(70,d))}}}static randomFrom(t){let a=t>>>0;return()=>{a=a+1831565813>>>0;let e=a;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}static round(t,a=100){return Math.round(t*a)/a}}class It{constructor(t){this.points=t}at(t){const a=this.points;if(a.length===1||t<=a[0].t)return this.extrapolated(t,0);if(t>=a[a.length-1].t)return this.extrapolated(t,a.length-1);let e=0;for(;e<a.length-2&&t>a[e+1].t;)e++;const o=a[Math.max(0,e-1)],n=a[e],r=a[e+1],h=a[Math.min(a.length-1,e+2)],f=(t-n.t)/(r.t-n.t),g=(u,c,d)=>(c[d]-u[d])/Math.max(c.t-u.t,1)*(r.t-n.t),A=u=>{const c=g(o,r,u),d=g(n,h,u),w=f*f,M=w*f;return(2*M-3*w+1)*n[u]+(M-2*w+f)*c+(-2*M+3*w)*r[u]+(M-w)*d};return{t,eastM:A("eastM"),northM:A("northM"),upM:A("upM")}}extrapolated(t,a){const e=this.points,o=e[a];if(e.length<2)return{...o,t};const n=a===0?e[0]:e[e.length-2],r=a===0?e[1]:e[e.length-1],h=(t-o.t)/Math.max(r.t-n.t,1);return{t,eastM:o.eastM+(r.eastM-n.eastM)*h,northM:o.northM+(r.northM-n.northM)*h,upM:o.upM+(r.upM-n.upM)*h}}velocityAt(t){const a=this.at(t-50),e=this.at(t+50);return{east:(e.eastM-a.eastM)/.1,north:(e.northM-a.northM)/.1,up:(e.upM-a.upM)/.1}}meanSpeedMS(){const t=this.points;if(t.length<2)return 0;let a=0;for(let e=1;e<t.length;e++)a+=Math.hypot(t[e].eastM-t[e-1].eastM,t[e].northM-t[e-1].northM,t[e].upM-t[e-1].upM);return a/Math.max((t[t.length-1].t-t[0].t)/1e3,.001)}}const qt=Object.freeze(Object.defineProperty({__proto__:null,BirdFlock:p,FlightPath:It},Symbol.toStringTag,{value:"Module"}));export{p as B,l as F,V as a,qt as b};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./InterviewElement-Ala811KB.js","./rr0-sighting-editor.mjs","./interviewJson-BJF9C-Rb.js"])))=>i.map(i=>d[i]);
2
- import{ai as f,aj as p,a as S,ak as $,al as C,am as H,i as k,k as U,an as q,ao as P,ae as V,ap as O,aq as z,ar as B,as as G,s as D,U as F,c as K,at as W,C as x,_ as Y,I as J}from"./rr0-sighting-editor.mjs";import{SHOW_INFO_ATTRIBUTE as N,OBSERVER_ATTRIBUTE as m,registerSighting as Z,HIDE_PICKERS_ATTRIBUTE as R,SIGHTING_ELEMENT_NAME as c,INTERPRETATION_ATTRIBUTE as v,CASE_NAMED_ATTRIBUTE as Q,OBSERVER_CHANGE_EVENT as M,INTERPRETATION_CHANGE_EVENT as X}from"./SightingElement-C6CT6DBZ.js";const ee=`
2
+ import{ai as f,aj as p,a as S,ak as $,al as C,am as H,i as k,k as U,an as q,ao as P,ae as V,ap as O,aq as z,ar as B,as as G,s as D,U as F,c as K,at as W,C as x,_ as Y,I as J}from"./rr0-sighting-editor.mjs";import{SHOW_INFO_ATTRIBUTE as N,OBSERVER_ATTRIBUTE as m,registerSighting as Z,HIDE_PICKERS_ATTRIBUTE as R,SIGHTING_ELEMENT_NAME as c,INTERPRETATION_ATTRIBUTE as v,CASE_NAMED_ATTRIBUTE as Q,OBSERVER_CHANGE_EVENT as M,INTERPRETATION_CHANGE_EVENT as X}from"./SightingElement-BpYuBmJB.js";const ee=`
3
3
  <header class="case-head">
4
4
  <div class="case-bar">
5
5
  <p id="case-kind" class="case-kind"></p>
@@ -129,4 +129,4 @@ ${f.CSS}
129
129
  .case-timeline > :not(.event-list) { display: none !important; }
130
130
  .case-timeline > .event-list { padding-left: 30px; }
131
131
  }
132
- `,g="rr0-case",w="show-timeline",y="open-events",se="openchange";class u extends HTMLElement{static get observedAttributes(){return["src","show-labels",N,w,y,m]}static PASSED_ON=["show-labels"];shadow;openEvents;timeline;shown=new Map;messages;said=new S(["en"]);json;url;shareMessages;entries=[];grouping=!1;query="";folded=new Set;columns;constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=te;const s=document.createElement("div");s.innerHTML=ee,this.shadow.append(e,s),Z(),this.timeline=new p(this.byId("case-events"),n=>void this.only(n),n=>void this.only(n),n=>void this.toggle(n),n=>{this.folded.delete(n)||this.folded.add(n),this.draw()}),this.grouping=p.groupingRemembered(),this.columns=new f(this.byId("column-resize"),this.shadow.querySelector(".case-layout"),()=>this.shadow.querySelector(".case-timeline"),f.CASE_HISTORY_KEY,f.PROPERTY,44),this.byId("events-search").addEventListener("input",n=>{this.query=n.target.value,this.draw()}),this.byId("group-readings").addEventListener("click",()=>{this.grouping=!this.grouping,p.rememberGrouping(this.grouping),this.order(),this.draw()}),$.register(),C.register(),H.register(),this.byId("export").source=async()=>{const n=this.json,o=new Map;return await Promise.all(this.entries.filter(a=>a.kind!=="interview"&&a.url).map(async a=>{try{o.set(a.url,await k.recording(a.url))}catch{}})),{caseJson:n,caseUrl:this.url,recordings:o}},this.openEvents=this.byId("open-events"),this.openEvents.addEventListener(U,n=>{const{at:o,sighting:a}=n.detail;this.seekObservation(o,a)}),this.openEvents.addEventListener(q,n=>{const o=n.target?.closest?.(".open-event");this.followReplay(o??void 0)}),P.register();const t=this.byId("share");t.innerHTML=V.SHARE;const i=this.byId("share-dialog");i.subject=this.shareSubject,t.addEventListener("click",()=>{this.url&&(i.note=O.changed(this.url,...this.entries.map(n=>n.url))?this.shareMessages?.unsaved:void 0,i.open())}),this.byId("edit").addEventListener("click",()=>{if(this.url&&z.ask(this,B,{src:this.url}))return;const n=this.editorUrl();n&&window.open(n,"_blank","noopener")}),this.byId("info").addEventListener("click",()=>this.showSummary(this.byId("case-summary").hidden)),this.byId("timeline-button").addEventListener("click",()=>{this.showTimeline(this.byId("case-events").parentElement.hidden)})}shareSubject={module:"rr0-sighting",link:()=>{const e=this.openKeys();return`${G.home()}/play/?file=${encodeURIComponent(this.url??"")}${e?`&events=${encodeURIComponent(e)}`:""}`+(this.timelineShown()?"":"&timeline=0")},element:()=>{const e=this.openKeys();return`<${g} src="${this.url??""}"${e?` ${y}="${e}"`:""}${this.timelineShown()?"":` ${w}="false"`}></${g}>`}};timelineShown(){return!this.byId("case-events").parentElement.hidden}openKeys(){const e=[...this.shown.keys()].sort((s,t)=>s-t);return e.length===1&&e[0]===this.firstObservation()?"":e.map(s=>u.keyOf(this.entries[s])).join(",")}static keyOf(e){return e.event.id??u.fileNameOf(e)}static fileNameOf(e){return(e.url??"").split("/").pop().replace(/[.]json$/i,"")}asked(e){if(e===null)return[];if(e.trim()==="all")return this.entries.map((t,i)=>i);const s=e.split(",").map(t=>t.trim().replace(/[.]json$/i,"")).filter(t=>t!=="");return this.entries.map((t,i)=>({entry:t,at:i})).filter(({entry:t})=>s.some(i=>i===t.event.id||i===u.fileNameOf(t))).map(({at:t})=>t)}firstObservation(){return this.entries.findIndex(e=>e.kind!=="interview")}byId(e){return this.shadow.getElementById(e)}showSummary(e){this.byId("case-summary").hidden=!e,this.byId("info").setAttribute("aria-expanded",String(e))}showTimeline(e){this.byId("case-events").parentElement.hidden=!e,this.byId("timeline-button").setAttribute("aria-pressed",String(e));for(const s of this.players())s.toggleAttribute(R,e)}connectedCallback(){this.loadMessages(),this.showTimeline(this.getAttribute(w)!=="false"),this.showSummary(this.hasAttribute(N));const e=this.getAttribute("src");e&&this.load(e).catch(s=>console.warn(`<${g}> could not read ${e}:`,s))}attributeChangedCallback(e,s,t){if(!(!this.isConnected||t===s))if(e==="src"&&t)this.load(t);else if(e===w)this.showTimeline(t!=="false");else if(e===y)for(const i of this.asked(t))this.open(i);else for(const i of this.players())t===null?i.removeAttribute(e):i.setAttribute(e,t)}async loadMessages(){const e=D(K.preferencesFor(this),F);this.said=new S([e,"en"]),this.messages=await W(e),this.shareMessages=await this.byId("share-dialog").useLanguage(e),this.draw()}async load(e){this.url=new URL(e,location.href).href;const s=await k.recording(this.url);if(!x.isCase(s))throw new Error(`${e} is not a case: <${g}> reads a case.json`);this.json=s,this.fetched.clear(),this.byId("share").hidden=O.local(this.url),this.entries=u.inTime((s.events??[]).map(r=>this.entryOf(r)).filter(r=>r!==void 0)),this.shown.clear(),this.folded.clear(),this.openEvents.replaceChildren(),this.draw(),this.compareReadings();const t=this.asked(this.getAttribute(y));if(t.length>0){for(const r of t)await this.open(r);return}const i=this.firstObservation();i>=0&&this.open(i)}static inTime(e){const s=new Map(e.filter(t=>t.event.id!==void 0).map(t=>[t.event.id,t]));return p.inTime(e,{when:t=>t.when,kind:t=>t.kind,read:t=>[t.event.interpretationOf].flat().map(i=>i===void 0?void 0:s.get(i)).filter(i=>i!==void 0)}).map(({item:t})=>t)}entryOf(e){if(typeof e.url!="string"||e.url==="")return;const s=e.eventType===x.INTERVIEW_EVENT?"interview":e.eventType===x.SIGHTING_EVENT?e.interpretationOf===void 0?"observation":"reading":void 0;if(s)return{event:e,kind:s,url:new URL(e.url,this.url??location.href).href,title:this.said.read(e.title)??e.id??"",when:String(e.time??"")}}compareReadings(){const e=this.byId("readings-comparison"),s=r=>this.recordingAt(r),t=async r=>Promise.all(this.entries.flatMap((n,o)=>{if(n.kind!=="reading")return[];const a=this.accountOf(n);return[(async()=>({title:n.title,witness:a?.title??"",...r&&a?.url&&n.url?{account:await s(a.url),reading:await s(n.url)}:{},open:()=>void this.only(o).then(()=>this.shown.get(o)?.scrollIntoView({block:"start",behavior:"smooth"}))}))()]}));t(!1).then(r=>e.show(r,()=>t(!0)));const i=this.json;i&&this.byId("hvs").show({caseJson:()=>i,recording:r=>this.recordingOfEvent(r),open:r=>{const n=this.entries.findIndex(o=>o.event.id===r);n>=0&&this.only(n).then(()=>this.shown.get(n)?.scrollIntoView({block:"start",behavior:"smooth"}))}})}fetched=new Map;recordingAt(e){let s=this.fetched.get(e);return s||(s=k.recording(e).then(t=>t,()=>{}),this.fetched.set(e,s)),s}recordingOfEvent(e){const s=this.entries.find(t=>t.event.id===e);return s?.url?this.recordingAt(s.url):Promise.resolve(void 0)}accountOf(e){return this.accountsOf(e)[0]}accountsOf(e){const s=[e.event.interpretationOf].flat().filter(t=>t!==void 0);return this.entries.filter(t=>t.kind==="observation"&&s.includes(t.event.id??""))}editorUrl(){if(!this.url)return;const e=new URL("/edit/",location.href);return e.searchParams.set("file",this.url),e.href}async only(e){const s=this.turn(e);for(const t of[...this.shown.keys()])t!==e&&this.shut(t);s||await this.open(e)}turn(e){const s=this.entries[e];if(!s?.url||this.shown.has(e)||s.kind!=="observation"&&s.kind!=="reading")return!1;const[t,i]=[...this.shown.entries()].find(([n,o])=>{const a=this.entries[n]?.kind;return(a==="observation"||a==="reading")&&o.querySelector(c)})??[],r=i?.querySelector(c);return t===void 0||!i||!r?!1:(this.shown.delete(t),this.shown.set(e,i),i.dataset.at=String(e),s.kind==="reading"?(r.setAttribute(v,s.url),r.setAttribute(m,this.accountOf(s)?.url??s.url)):(r.setAttribute(m,s.url),r.removeAttribute(v)),this.order(),this.draw(),window.setTimeout(()=>this.markCitedMoments(),300),this.announceOpen(),!0)}async toggle(e){this.shown.has(e)?this.shut(e):await this.open(e)}async open(e){const s=this.entries[e];if(!s||!s.url||this.shown.has(e))return;const t=document.createElement("section");if(t.className="open-event",t.dataset.at=String(e),s.kind==="interview"){const i=document.createElement("p");i.className="open-title",i.textContent=s.title,t.append(i)}if(s.kind==="interview"){const{register:i}=await Y(async()=>{const{register:n}=await import("./InterviewElement-Ala811KB.js");return{register:n}},__vite__mapDeps([0,1,2]),import.meta.url);i();const r=document.createElement("rr0-interview");r.setAttribute("src",s.url),t.append(r),window.setTimeout(()=>{this.followReplay(),this.markCitedMoments()},300)}else{const i=document.createElement(c);i.setAttribute(Q,""),i.toggleAttribute(R,!this.byId("case-events").parentElement.hidden),i.setAttribute("src",this.url??"");const r=s.kind==="reading"?this.accountOf(s):void 0;i.setAttribute(m,(r??s).url??""),s.kind==="reading"&&i.setAttribute(v,s.url),queueMicrotask(()=>{for(const o of u.PASSED_ON){const a=this.getAttribute(o);a!==null&&i.setAttribute(o,a)}}),i.addEventListener(M,o=>{this.dispatchEvent(new CustomEvent(M,{detail:o.detail})),this.follow(t,i)}),i.addEventListener(X,()=>this.follow(t,i)),t.append(i);const n=this.json;if(s.kind==="observation"&&s.event.id!==void 0&&n&&((n.elements?.length??0)>0||(n.hvs?.hypotheses?.length??0)>0)){const o=document.createElement(C.TAG);o.className="open-hvs",t.append(o),o.show({caseJson:()=>n,recording:a=>this.recordingOfEvent(a),account:s.event.id})}}this.shown.set(e,t),this.order(),this.draw(),s.kind!=="interview"&&window.setTimeout(()=>this.markCitedMoments(),300),this.announceOpen()}follow(e,s){const t=Number(e.dataset.at),i=s.shownReadingUrl,r=s.shownRecordingUrl,n=(h,b)=>h!==void 0&&b!==void 0&&new URL(h,this.url??location.href).href===new URL(b,this.url??location.href).href,o=i?this.entries.findIndex(h=>h.kind==="reading"&&n(h.url,i)):this.entries.findIndex(h=>h.kind==="observation"&&n(h.url,r));if(o<0||o===t||this.shown.get(t)!==e||this.shown.has(o))return;this.shown.delete(t),this.shown.set(o,e),e.dataset.at=String(o);const a=this.entries[o];a.kind==="reading"?s.setAttribute(v,a.url):(s.removeAttribute(v),a.url&&s.setAttribute(m,a.url)),this.order(),this.draw(),this.announceOpen()}announceOpen(){this.dispatchEvent(new CustomEvent(se,{detail:{events:this.openKeys()}}))}followReplay(e){const s=e??[...this.shown.values()].find(n=>n.querySelector(c)),t=s?Number(s.dataset.at):NaN,i=Number.isNaN(t)?void 0:this.entries[t],r=s?.querySelector(c);if(!(!i||!r)){for(const[n,o]of this.shown){if(this.entries[n]?.kind!=="interview")continue;o.querySelector("rr0-interview")?.revealAt?.(r.playedSeconds,i.event.id)}return s}}markCitedMoments(){for(const[e,s]of this.shown){const t=this.entries[e],i=s.querySelector(c);if(!t||!i)continue;const r=[];for(const[n,o]of this.shown){if(this.entries[n]?.kind!=="interview")continue;const a=o.querySelector("rr0-interview");r.push(...a?.momentsCited?.(t.event.id)??[])}i.citedMoments=r.sort((n,o)=>n.at-o.at)}}shut(e){this.shown.get(e)?.remove(),this.shown.delete(e),this.markCitedMoments(),this.draw(),this.announceOpen()}order(){const e=new Map(this.listed().map(({index:t},i)=>[t,i])),s=[...this.shown.entries()].sort(([t],[i])=>(e.get(t)??t)-(e.get(i)??i)).map(([,t])=>t);s.length===this.openEvents.children.length&&s.every((t,i)=>this.openEvents.children[i]===t)||this.openEvents.replaceChildren(...s)}listed(){const e=this.entries.map((s,t)=>({item:s,index:t}));return this.grouping?p.grouped(e,{kind:s=>s.kind,read:s=>this.accountsOf(s)}):e}async seekObservation(e,s){const t=this.entries.findIndex(n=>n.kind!=="interview"&&(n.event.id===s||s!==void 0&&n.url?.endsWith(`/${s}.json`))),i=t>=0?t:this.entries.findIndex(n=>n.kind!=="interview");if(i<0)return;this.shown.has(i)||await this.open(i),this.shown.get(i)?.querySelector(c)?.seekTo(e,s),this.shown.get(i)?.scrollIntoView({block:"nearest",behavior:"smooth"})}authors(e){const s=this.messages,t=(e??[]).map(i=>"people"in i?i.people:"org"in i?i.org:this.said.read(i.title)??"").filter(i=>i!=="");return t.length<2||!s?t.join(", "):`${t.slice(0,-1).join(", ")} ${s.linkAnd} ${t[t.length-1]}`}linkedTo(e){const s=this.messages;if(s){if(e.kind==="reading"){const t=[e.event.interpretationOf].flat().filter(r=>r!==void 0),i=this.entries.map((r,n)=>t.includes(r.event.id??"")?n:-1).filter(r=>r>=0);return i.length>0?{heading:s.interpretationOf,to:i}:void 0}if(e.kind==="observation"){const t=this.entries.map((i,r)=>i.kind==="interview"&&[i.event.interviewOf].flat().includes(e.event.id)?r:-1).filter(i=>i>=0);return t.length>0?{heading:s.passagesHeading,to:t}:void 0}}}draw(){const e=this.messages,s=this.json;if(!e||!s)return;this.byId("case-kind").textContent=e.caseHeading,this.byId("case-title").textContent=this.said.read(s.title)??s.id??"";const t=this.said.read(s.summary)??"",i=this.byId("case-summary");i.textContent=t;const r=this.byId("info");r.hidden=t==="",r.title=e.caseSummary,r.setAttribute("aria-label",e.caseSummary),t===""&&this.showSummary(!1),this.byId("events-heading").textContent=e.eventsHeading,this.byId("events-icon").innerHTML=J.CLOCK;const n=this.byId("share");n.title=e.shareCase,n.setAttribute("aria-label",e.shareCase);const o=this.byId("edit");o.title=e.editCase,o.setAttribute("aria-label",e.editCase);const a=this.byId("group-readings");a.title=e.groupReadings,a.setAttribute("aria-label",e.groupReadings),this.columns.label(e.resizeColumns),a.setAttribute("aria-pressed",String(this.grouping)),a.hidden=!this.entries.some(d=>d.kind==="reading");const h=this.listed(),b=d=>h.filter(({under:l})=>l===d).length,_=new Map(this.entries.map((d,l)=>[d,l]));this.timeline.render(h.filter(({index:d,under:l})=>l===void 0||this.query.trim()!==""||!this.folded.has(_.get(l))||this.shown.has(d)).map(({item:d,index:l,under:j})=>{const I=this.card(d,l,j),A=this.grouping&&d.kind==="observation"?b(d):0;return A>0?{...I,readings:{count:A,folded:this.folded.has(l)}}:I}),e);const E=this.byId("events-search");E.placeholder=e.searchEvents,E.setAttribute("aria-label",e.searchEvents),E.hidden=this.entries.length<5;const L=this.timeline.search(this.query),T=this.byId("events-none");T.textContent=e.noEventFound,T.hidden=this.query.trim()===""||L>0}card(e,s,t){const i=this.linkedTo(e),r=(i?.to??[]).filter(o=>this.entries[o]!==t),n=t?this.messages.alsoAbout:i?.heading??"";return{at:s,kind:e.kind,title:e.title,meta:e.when.replace("T"," "),open:this.shown.has(s),...r.length>0?{links:{heading:n,to:r.map(o=>({at:o,title:this.entries[o].title}))}}:{},by:e.kind==="observation"?"":this.authors(e.event.by),...t?{nested:!0}:{}}}async loadFromSrc(e){await this.load(e),await this.player?.loaded}get scene(){return this.players()[0]?.scene}players(){return[...this.shown.entries()].sort(([e],[s])=>e-s).map(([,e])=>e.querySelector(c)).filter(e=>e!==null)}get sightingData(){return this.players()[0]?.sightingData}get player(){return this.players()[0]}}function re(){customElements.get(g)||customElements.define(g,u)}export{g as CASE_ELEMENT_NAME,u as CaseElement,se as OPEN_CHANGE_EVENT,y as OPEN_EVENTS_ATTRIBUTE,w as SHOW_TIMELINE_ATTRIBUTE,re as register};
132
+ `,g="rr0-case",w="show-timeline",y="open-events",se="openchange";class u extends HTMLElement{static get observedAttributes(){return["src","show-labels",N,w,y,m]}static PASSED_ON=["show-labels"];shadow;openEvents;timeline;shown=new Map;messages;said=new S(["en"]);json;url;shareMessages;entries=[];grouping=!1;query="";folded=new Set;columns;constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=te;const s=document.createElement("div");s.innerHTML=ee,this.shadow.append(e,s),Z(),this.timeline=new p(this.byId("case-events"),n=>void this.only(n),n=>void this.only(n),n=>void this.toggle(n),n=>{this.folded.delete(n)||this.folded.add(n),this.draw()}),this.grouping=p.groupingRemembered(),this.columns=new f(this.byId("column-resize"),this.shadow.querySelector(".case-layout"),()=>this.shadow.querySelector(".case-timeline"),f.CASE_HISTORY_KEY,f.PROPERTY,44),this.byId("events-search").addEventListener("input",n=>{this.query=n.target.value,this.draw()}),this.byId("group-readings").addEventListener("click",()=>{this.grouping=!this.grouping,p.rememberGrouping(this.grouping),this.order(),this.draw()}),$.register(),C.register(),H.register(),this.byId("export").source=async()=>{const n=this.json,o=new Map;return await Promise.all(this.entries.filter(a=>a.kind!=="interview"&&a.url).map(async a=>{try{o.set(a.url,await k.recording(a.url))}catch{}})),{caseJson:n,caseUrl:this.url,recordings:o}},this.openEvents=this.byId("open-events"),this.openEvents.addEventListener(U,n=>{const{at:o,sighting:a}=n.detail;this.seekObservation(o,a)}),this.openEvents.addEventListener(q,n=>{const o=n.target?.closest?.(".open-event");this.followReplay(o??void 0)}),P.register();const t=this.byId("share");t.innerHTML=V.SHARE;const i=this.byId("share-dialog");i.subject=this.shareSubject,t.addEventListener("click",()=>{this.url&&(i.note=O.changed(this.url,...this.entries.map(n=>n.url))?this.shareMessages?.unsaved:void 0,i.open())}),this.byId("edit").addEventListener("click",()=>{if(this.url&&z.ask(this,B,{src:this.url}))return;const n=this.editorUrl();n&&window.open(n,"_blank","noopener")}),this.byId("info").addEventListener("click",()=>this.showSummary(this.byId("case-summary").hidden)),this.byId("timeline-button").addEventListener("click",()=>{this.showTimeline(this.byId("case-events").parentElement.hidden)})}shareSubject={module:"rr0-sighting",link:()=>{const e=this.openKeys();return`${G.home()}/play/?file=${encodeURIComponent(this.url??"")}${e?`&events=${encodeURIComponent(e)}`:""}`+(this.timelineShown()?"":"&timeline=0")},element:()=>{const e=this.openKeys();return`<${g} src="${this.url??""}"${e?` ${y}="${e}"`:""}${this.timelineShown()?"":` ${w}="false"`}></${g}>`}};timelineShown(){return!this.byId("case-events").parentElement.hidden}openKeys(){const e=[...this.shown.keys()].sort((s,t)=>s-t);return e.length===1&&e[0]===this.firstObservation()?"":e.map(s=>u.keyOf(this.entries[s])).join(",")}static keyOf(e){return e.event.id??u.fileNameOf(e)}static fileNameOf(e){return(e.url??"").split("/").pop().replace(/[.]json$/i,"")}asked(e){if(e===null)return[];if(e.trim()==="all")return this.entries.map((t,i)=>i);const s=e.split(",").map(t=>t.trim().replace(/[.]json$/i,"")).filter(t=>t!=="");return this.entries.map((t,i)=>({entry:t,at:i})).filter(({entry:t})=>s.some(i=>i===t.event.id||i===u.fileNameOf(t))).map(({at:t})=>t)}firstObservation(){return this.entries.findIndex(e=>e.kind!=="interview")}byId(e){return this.shadow.getElementById(e)}showSummary(e){this.byId("case-summary").hidden=!e,this.byId("info").setAttribute("aria-expanded",String(e))}showTimeline(e){this.byId("case-events").parentElement.hidden=!e,this.byId("timeline-button").setAttribute("aria-pressed",String(e));for(const s of this.players())s.toggleAttribute(R,e)}connectedCallback(){this.loadMessages(),this.showTimeline(this.getAttribute(w)!=="false"),this.showSummary(this.hasAttribute(N));const e=this.getAttribute("src");e&&this.load(e).catch(s=>console.warn(`<${g}> could not read ${e}:`,s))}attributeChangedCallback(e,s,t){if(!(!this.isConnected||t===s))if(e==="src"&&t)this.load(t);else if(e===w)this.showTimeline(t!=="false");else if(e===y)for(const i of this.asked(t))this.open(i);else for(const i of this.players())t===null?i.removeAttribute(e):i.setAttribute(e,t)}async loadMessages(){const e=D(K.preferencesFor(this),F);this.said=new S([e,"en"]),this.messages=await W(e),this.shareMessages=await this.byId("share-dialog").useLanguage(e),this.draw()}async load(e){this.url=new URL(e,location.href).href;const s=await k.recording(this.url);if(!x.isCase(s))throw new Error(`${e} is not a case: <${g}> reads a case.json`);this.json=s,this.fetched.clear(),this.byId("share").hidden=O.local(this.url),this.entries=u.inTime((s.events??[]).map(r=>this.entryOf(r)).filter(r=>r!==void 0)),this.shown.clear(),this.folded.clear(),this.openEvents.replaceChildren(),this.draw(),this.compareReadings();const t=this.asked(this.getAttribute(y));if(t.length>0){for(const r of t)await this.open(r);return}const i=this.firstObservation();i>=0&&this.open(i)}static inTime(e){const s=new Map(e.filter(t=>t.event.id!==void 0).map(t=>[t.event.id,t]));return p.inTime(e,{when:t=>t.when,kind:t=>t.kind,read:t=>[t.event.interpretationOf].flat().map(i=>i===void 0?void 0:s.get(i)).filter(i=>i!==void 0)}).map(({item:t})=>t)}entryOf(e){if(typeof e.url!="string"||e.url==="")return;const s=e.eventType===x.INTERVIEW_EVENT?"interview":e.eventType===x.SIGHTING_EVENT?e.interpretationOf===void 0?"observation":"reading":void 0;if(s)return{event:e,kind:s,url:new URL(e.url,this.url??location.href).href,title:this.said.read(e.title)??e.id??"",when:String(e.time??"")}}compareReadings(){const e=this.byId("readings-comparison"),s=r=>this.recordingAt(r),t=async r=>Promise.all(this.entries.flatMap((n,o)=>{if(n.kind!=="reading")return[];const a=this.accountOf(n);return[(async()=>({title:n.title,witness:a?.title??"",...r&&a?.url&&n.url?{account:await s(a.url),reading:await s(n.url)}:{},open:()=>void this.only(o).then(()=>this.shown.get(o)?.scrollIntoView({block:"start",behavior:"smooth"}))}))()]}));t(!1).then(r=>e.show(r,()=>t(!0)));const i=this.json;i&&this.byId("hvs").show({caseJson:()=>i,recording:r=>this.recordingOfEvent(r),open:r=>{const n=this.entries.findIndex(o=>o.event.id===r);n>=0&&this.only(n).then(()=>this.shown.get(n)?.scrollIntoView({block:"start",behavior:"smooth"}))}})}fetched=new Map;recordingAt(e){let s=this.fetched.get(e);return s||(s=k.recording(e).then(t=>t,()=>{}),this.fetched.set(e,s)),s}recordingOfEvent(e){const s=this.entries.find(t=>t.event.id===e);return s?.url?this.recordingAt(s.url):Promise.resolve(void 0)}accountOf(e){return this.accountsOf(e)[0]}accountsOf(e){const s=[e.event.interpretationOf].flat().filter(t=>t!==void 0);return this.entries.filter(t=>t.kind==="observation"&&s.includes(t.event.id??""))}editorUrl(){if(!this.url)return;const e=new URL("/edit/",location.href);return e.searchParams.set("file",this.url),e.href}async only(e){const s=this.turn(e);for(const t of[...this.shown.keys()])t!==e&&this.shut(t);s||await this.open(e)}turn(e){const s=this.entries[e];if(!s?.url||this.shown.has(e)||s.kind!=="observation"&&s.kind!=="reading")return!1;const[t,i]=[...this.shown.entries()].find(([n,o])=>{const a=this.entries[n]?.kind;return(a==="observation"||a==="reading")&&o.querySelector(c)})??[],r=i?.querySelector(c);return t===void 0||!i||!r?!1:(this.shown.delete(t),this.shown.set(e,i),i.dataset.at=String(e),s.kind==="reading"?(r.setAttribute(v,s.url),r.setAttribute(m,this.accountOf(s)?.url??s.url)):(r.setAttribute(m,s.url),r.removeAttribute(v)),this.order(),this.draw(),window.setTimeout(()=>this.markCitedMoments(),300),this.announceOpen(),!0)}async toggle(e){this.shown.has(e)?this.shut(e):await this.open(e)}async open(e){const s=this.entries[e];if(!s||!s.url||this.shown.has(e))return;const t=document.createElement("section");if(t.className="open-event",t.dataset.at=String(e),s.kind==="interview"){const i=document.createElement("p");i.className="open-title",i.textContent=s.title,t.append(i)}if(s.kind==="interview"){const{register:i}=await Y(async()=>{const{register:n}=await import("./InterviewElement-Ala811KB.js");return{register:n}},__vite__mapDeps([0,1,2]),import.meta.url);i();const r=document.createElement("rr0-interview");r.setAttribute("src",s.url),t.append(r),window.setTimeout(()=>{this.followReplay(),this.markCitedMoments()},300)}else{const i=document.createElement(c);i.setAttribute(Q,""),i.toggleAttribute(R,!this.byId("case-events").parentElement.hidden),i.setAttribute("src",this.url??"");const r=s.kind==="reading"?this.accountOf(s):void 0;i.setAttribute(m,(r??s).url??""),s.kind==="reading"&&i.setAttribute(v,s.url),queueMicrotask(()=>{for(const o of u.PASSED_ON){const a=this.getAttribute(o);a!==null&&i.setAttribute(o,a)}}),i.addEventListener(M,o=>{this.dispatchEvent(new CustomEvent(M,{detail:o.detail})),this.follow(t,i)}),i.addEventListener(X,()=>this.follow(t,i)),t.append(i);const n=this.json;if(s.kind==="observation"&&s.event.id!==void 0&&n&&((n.elements?.length??0)>0||(n.hvs?.hypotheses?.length??0)>0)){const o=document.createElement(C.TAG);o.className="open-hvs",t.append(o),o.show({caseJson:()=>n,recording:a=>this.recordingOfEvent(a),account:s.event.id}),i.hvs=()=>o.weigh()}}this.shown.set(e,t),this.order(),this.draw(),s.kind!=="interview"&&window.setTimeout(()=>this.markCitedMoments(),300),this.announceOpen()}follow(e,s){const t=Number(e.dataset.at),i=s.shownReadingUrl,r=s.shownRecordingUrl,n=(h,b)=>h!==void 0&&b!==void 0&&new URL(h,this.url??location.href).href===new URL(b,this.url??location.href).href,o=i?this.entries.findIndex(h=>h.kind==="reading"&&n(h.url,i)):this.entries.findIndex(h=>h.kind==="observation"&&n(h.url,r));if(o<0||o===t||this.shown.get(t)!==e||this.shown.has(o))return;this.shown.delete(t),this.shown.set(o,e),e.dataset.at=String(o);const a=this.entries[o];a.kind==="reading"?s.setAttribute(v,a.url):(s.removeAttribute(v),a.url&&s.setAttribute(m,a.url)),this.order(),this.draw(),this.announceOpen()}announceOpen(){this.dispatchEvent(new CustomEvent(se,{detail:{events:this.openKeys()}}))}followReplay(e){const s=e??[...this.shown.values()].find(n=>n.querySelector(c)),t=s?Number(s.dataset.at):NaN,i=Number.isNaN(t)?void 0:this.entries[t],r=s?.querySelector(c);if(!(!i||!r)){for(const[n,o]of this.shown){if(this.entries[n]?.kind!=="interview")continue;o.querySelector("rr0-interview")?.revealAt?.(r.playedSeconds,i.event.id)}return s}}markCitedMoments(){for(const[e,s]of this.shown){const t=this.entries[e],i=s.querySelector(c);if(!t||!i)continue;const r=[];for(const[n,o]of this.shown){if(this.entries[n]?.kind!=="interview")continue;const a=o.querySelector("rr0-interview");r.push(...a?.momentsCited?.(t.event.id)??[])}i.citedMoments=r.sort((n,o)=>n.at-o.at)}}shut(e){this.shown.get(e)?.remove(),this.shown.delete(e),this.markCitedMoments(),this.draw(),this.announceOpen()}order(){const e=new Map(this.listed().map(({index:t},i)=>[t,i])),s=[...this.shown.entries()].sort(([t],[i])=>(e.get(t)??t)-(e.get(i)??i)).map(([,t])=>t);s.length===this.openEvents.children.length&&s.every((t,i)=>this.openEvents.children[i]===t)||this.openEvents.replaceChildren(...s)}listed(){const e=this.entries.map((s,t)=>({item:s,index:t}));return this.grouping?p.grouped(e,{kind:s=>s.kind,read:s=>this.accountsOf(s)}):e}async seekObservation(e,s){const t=this.entries.findIndex(n=>n.kind!=="interview"&&(n.event.id===s||s!==void 0&&n.url?.endsWith(`/${s}.json`))),i=t>=0?t:this.entries.findIndex(n=>n.kind!=="interview");if(i<0)return;this.shown.has(i)||await this.open(i),this.shown.get(i)?.querySelector(c)?.seekTo(e,s),this.shown.get(i)?.scrollIntoView({block:"nearest",behavior:"smooth"})}authors(e){const s=this.messages,t=(e??[]).map(i=>"people"in i?i.people:"org"in i?i.org:this.said.read(i.title)??"").filter(i=>i!=="");return t.length<2||!s?t.join(", "):`${t.slice(0,-1).join(", ")} ${s.linkAnd} ${t[t.length-1]}`}linkedTo(e){const s=this.messages;if(s){if(e.kind==="reading"){const t=[e.event.interpretationOf].flat().filter(r=>r!==void 0),i=this.entries.map((r,n)=>t.includes(r.event.id??"")?n:-1).filter(r=>r>=0);return i.length>0?{heading:s.interpretationOf,to:i}:void 0}if(e.kind==="observation"){const t=this.entries.map((i,r)=>i.kind==="interview"&&[i.event.interviewOf].flat().includes(e.event.id)?r:-1).filter(i=>i>=0);return t.length>0?{heading:s.passagesHeading,to:t}:void 0}}}draw(){const e=this.messages,s=this.json;if(!e||!s)return;this.byId("case-kind").textContent=e.caseHeading,this.byId("case-title").textContent=this.said.read(s.title)??s.id??"";const t=this.said.read(s.summary)??"",i=this.byId("case-summary");i.textContent=t;const r=this.byId("info");r.hidden=t==="",r.title=e.caseSummary,r.setAttribute("aria-label",e.caseSummary),t===""&&this.showSummary(!1),this.byId("events-heading").textContent=e.eventsHeading,this.byId("events-icon").innerHTML=J.CLOCK;const n=this.byId("share");n.title=e.shareCase,n.setAttribute("aria-label",e.shareCase);const o=this.byId("edit");o.title=e.editCase,o.setAttribute("aria-label",e.editCase);const a=this.byId("group-readings");a.title=e.groupReadings,a.setAttribute("aria-label",e.groupReadings),this.columns.label(e.resizeColumns),a.setAttribute("aria-pressed",String(this.grouping)),a.hidden=!this.entries.some(d=>d.kind==="reading");const h=this.listed(),b=d=>h.filter(({under:l})=>l===d).length,_=new Map(this.entries.map((d,l)=>[d,l]));this.timeline.render(h.filter(({index:d,under:l})=>l===void 0||this.query.trim()!==""||!this.folded.has(_.get(l))||this.shown.has(d)).map(({item:d,index:l,under:j})=>{const I=this.card(d,l,j),A=this.grouping&&d.kind==="observation"?b(d):0;return A>0?{...I,readings:{count:A,folded:this.folded.has(l)}}:I}),e);const E=this.byId("events-search");E.placeholder=e.searchEvents,E.setAttribute("aria-label",e.searchEvents),E.hidden=this.entries.length<5;const L=this.timeline.search(this.query),T=this.byId("events-none");T.textContent=e.noEventFound,T.hidden=this.query.trim()===""||L>0}card(e,s,t){const i=this.linkedTo(e),r=(i?.to??[]).filter(o=>this.entries[o]!==t),n=t?this.messages.alsoAbout:i?.heading??"";return{at:s,kind:e.kind,title:e.title,meta:e.when.replace("T"," "),open:this.shown.has(s),...r.length>0?{links:{heading:n,to:r.map(o=>({at:o,title:this.entries[o].title}))}}:{},by:e.kind==="observation"?"":this.authors(e.event.by),...t?{nested:!0}:{}}}async loadFromSrc(e){await this.load(e),await this.player?.loaded}get scene(){return this.players()[0]?.scene}players(){return[...this.shown.entries()].sort(([e],[s])=>e-s).map(([,e])=>e.querySelector(c)).filter(e=>e!==null)}get sightingData(){return this.players()[0]?.sightingData}get player(){return this.players()[0]}}function re(){customElements.get(g)||customElements.define(g,u)}export{g as CASE_ELEMENT_NAME,u as CaseElement,se as OPEN_CHANGE_EVENT,y as OPEN_EVENTS_ATTRIBUTE,w as SHOW_TIMELINE_ATTRIBUTE,re as register};
@@ -62,4 +62,4 @@ ${o.join(`
62
62
  `)}
63
63
  </body>
64
64
  </html>
65
- `}static comparedTable(t,n){const a=n.texts.columns,s=z.escape;return z.table([a.reading,a.reads,a.reproduced,a.gap,a.robustness,a.supposedCount],t.readings.map(i=>{const e=n.robustness(i.sensitivity);return[s(i.title),s(i.reads),`<span class="n">${n.reproduced(i.sensitivity)}</span>`,n.degrees(i.sensitivity?.medianSeparationDeg),`<span class="${e.kind}">${s(e.text)}</span>`,String(i.supposed.length)]}),[2,3,5])}static witness(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h3>${e(a.fill(s.witnessHeading,{witness:t.title}))}</h3>`],o=[[s.columns.time,t.time??""],[s.place,t.place??""],[s.duration,t.durationSeconds!==void 0?a.instant(t.durationSeconds*1e3):""],[s.instrument,t.instrument??""]].filter(([,m])=>m!=="");o.length&&r.push(`<dl class="facts">${o.map(([m,d])=>`<dt>${e(m)}</dt><dd>${e(d)}</dd>`).join("")}</dl>`),t.description&&r.push(`<h4>${e(s.account)}</h4>`,`<blockquote>${e(t.description)}</blockquote>`),t.sources.length&&r.push(`<h4>${e(s.sources)}</h4>`,`<ul class="sources">${t.sources.map(m=>`<li>${[m.authors?.join(", "),m.title?`<em>${e(m.title)}</em>`:"",m.publisher,m.time,m.index].filter(Boolean).map(g=>g.startsWith("<em>")?g:e(g)).join(", ")}${m.url?` <a href="${e(m.url)}">${e(m.url)}</a>`:""}</li>`).join("")}</ul>`);const u=S.svg(t,a);u&&r.push(`<figure>${u}<figcaption>${e(s.timelineCaption)}</figcaption></figure>`),n=n.filter(m=>m.comparisons.length>0);const p=D.svg(t,n,a);if(p){const m=[`<li><svg viewBox="0 0 14 14" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4" fill="#111827"/></svg>${e(s.saidLegend)}</li>`,...n.map((d,g)=>`<li>${D.legendMark(g)}${e(d.title)}</li>`)];r.push(`<figure>${p}<ul class="legend">${m.join("")}</ul><figcaption>${e(s.figureCaption)}</figcaption></figure>`)}if(t.pictures?.length){const m=t.pictures[0].views.map(d=>d.label);r.push(`<h4>${e(s.pictures)}</h4>`,`<div class="scroll"><table class="pictures"><thead><tr><th scope="col">${e(s.columns.instant)}</th>${m.map(d=>`<th scope="col">${e(d)}</th>`).join("")}</tr></thead><tbody>${t.pictures.map(d=>`<tr><td class="n">${a.instant(d.t)}</td>${d.views.map(g=>`<td>${g.image?`<img src="${g.image}" alt="${e(g.label)}, ${a.instant(d.t)}">`:`<span class="nothing">${e(s.noPicture)}</span>`}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`,`<p class="caption">${e(s.picturesCaption)}</p>`)}r.push(`<h4>${e(s.indications)}</h4>`),t.indications.length===0?r.push(`<p>${e(s.noIndication)}</p>`):r.push(z.table([i.instant,i.phenomenon,i.azimuth,i.altitude,i.uncertainty,i.size,i.basis,i.rests],t.indications.map(m=>{const d=m.uncertainty;return[a.instant(m.t),e(m.phenomenon??m.sourceId),m.directionSaid?a.azimuth(m.aim?.azimuthDeg):"",m.directionSaid?a.degrees(m.aim?.altitudeDeg):"",d?`${a.azimuth(d.azimuthDeg[0])} … ${a.azimuth(d.azimuthDeg[1])} ; ${a.degrees(d.altitudeDeg[0])} … ${a.degrees(d.altitudeDeg[1])}`:"",m.sizeSaid?a.degrees(m.angular?.widthDeg):"",m.basis?e(s.bases[m.basis]):"",e(a.rests(m))]}),[0,2,3,5]));const l=t.values.filter(m=>!/^timeline\.keyframes\.\d+\.shapes\.\d+\.shape\.(aim|angular)/.test(m.path));return l.length>0&&r.push(`<h4>${e(s.values)}</h4>`,z.valuesTable(l,a)),r}static reading(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h2>${e(a.fill(s.readingHeading,{title:t.title,witness:t.reads}))}</h2>`],c=[t.by.length?a.fill(s.by,{names:t.by.join(", ")}):"",t.time?a.fill(s.made,{time:t.time}):""].filter(Boolean).join(" ");c&&r.push(`<p class="meta">${e(c)}</p>`),t.description&&r.push(`<blockquote>${e(t.description)}</blockquote>`),r.push(`<h4>${e(s.supposed)}</h4>`,t.supposed.length?z.valuesTable(t.supposed,a):`<p>${e(s.noneSupposed)}</p>`),r.push(`<h4>${e(s.findings)}</h4>`),r.push(t.findings.length?z.table([i.finding,i.outcome,i.against,i.origin],t.findings.map(u=>[e(u.text),`<span class="${u.outcome}">${e(s.outcomes[u.outcome])}</span>`,u.outcome==="fails"?e(s.grounds[u.against??"established"]):"",e(s.origins[u.written?"written":"computed"])])):`<p>${e(s.noFinding)}</p>`);const o=t.sensitivity;if(o){const u=a.robustness(o);if(r.push(`<h4>${e(s.sensitivity)}</h4>`,`<p>${e(i.reproduced)} : ${a.reproduced(o)||"–"} · ${e(i.gap)} : ${a.degrees(o.medianSeparationDeg)||"–"} · <span class="${u.kind}">${e(u.text)}</span></p>`),u.kind!=="too-few"&&u.kind!=="nothing"&&o.margins.length>0&&r.push(z.table([i.knob,i.from,i.to,i.reference,i.covered],o.margins.map(p=>{const l=a.ends(p),m=p.reference?`${a.amount(p.knob,p.reference.lower)} … ${a.amount(p.knob,p.reference.upper)}`:s.noLaw;return[e(s.knobs[p.knob]),l.from,l.to,e(m),p.coverage===void 0?"":`${Math.round(p.coverage*100)} %`]}),[1,2,4])),o.better){const{knob:p,amount:l,agreement:m}=o.better;r.push(`<p class="fine-tuned">${e(a.fill(s.better,{knob:s.knobs[p],amount:a.amount(p,l),agreed:String(Math.round(m*o.compared)),compared:String(o.compared)}))}</p>`)}}return t.comparisons.length>0&&r.push(`<h4>${e(s.comparisons)}</h4>`,z.table([i.instant,i.phenomenon,`${i.said} (${i.azimuth}, ${i.altitude})`,`${i.read} (${i.azimuth}, ${i.altitude})`,i.separation,i.agrees],t.comparisons.map(u=>[a.instant(u.t),e(n?.phenomena?.[u.sourceId]??u.sourceId),u.said?`${a.azimuth(u.said.azimuthDeg)}, ${a.degrees(u.said.altitudeDeg)}`:"",`${a.azimuth(u.predicted.azimuthDeg)}, ${a.degrees(u.predicted.altitudeDeg)}`,a.degrees(u.separationDeg),`<span class="${u.agrees?"holds":"fails"}">${e(u.agrees?s.yes:s.no)}</span>`]),[0,4])),r}static valuesTable(t,n){const a=n.texts,s=a.columns,i=z.escape;return z.table([s.path,s.value,s.basis,s.rests],t.map(e=>[`<code>${i(e.path)}</code>`,i(n.value(e)),i(a.bases[e.basis]),i(n.rests(e))]))}static table(t,n,a=[]){const s=z.escape,i=`<tr>${t.map(r=>`<th scope="col">${s(r)}</th>`).join("")}</tr>`,e=n.map(r=>`<tr>${r.map((c,o)=>`<td${a.includes(o)?' class="n"':""}>${c}</td>`).join("")}</tr>`);return`<div class="scroll"><table><thead>${i}</thead><tbody>${e.join("")}</tbody></table></div>`}static escape(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}const _=P.catalog({en:()=>Z(()=>import("./CaseReportTexts_en-DlN7p1pC.js"),[],import.meta.url).then(N=>N.caseReportTexts_en),fr:()=>Z(()=>import("./CaseReportTexts_fr-B5nP6RlP.js"),[],import.meta.url).then(N=>N.caseReportTexts_fr),es:()=>Z(()=>import("./CaseReportTexts_es-CncAEaey.js"),[],import.meta.url).then(N=>N.caseReportTexts_es),it:()=>Z(()=>import("./CaseReportTexts_it-Dc-oPmXB.js"),[],import.meta.url).then(N=>N.caseReportTexts_it)});class U{static async make(t,n,a,s,i=!1,e){const[r,c]=await Promise.all([_.load(a),J.load(a)]),o=A.of(n.caseJson,n.caseUrl,n.recordings,new C([...s]),new F(c));i&&t!=="csv"&&await U.pictures(o,n,r,e);const u=`${n.caseJson.id??"case"}-report`;switch(t){case"html":U.download(new Blob([z.of(o,r,a,"0.203.0")],{type:"text/html"}),`${u}.html`);return;case"print":U.print(z.of(o,r,a,"0.203.0"));return;case"json":U.download(new Blob([T.json(o,"0.203.0")],{type:"application/json"}),`${u}.json`);return;case"csv":{const{zipSync:p,strToU8:l}=await Z(async()=>{const{zipSync:d,strToU8:g}=await import("./browser-CltifEM0.js");return{zipSync:d,strToU8:g}},[],import.meta.url),m=Object.fromEntries(Object.entries(T.csv(o,r,a)).map(([d,g])=>[d,l(`\uFEFF${g}`)]));U.download(new Blob([p(m)],{type:"application/zip"}),`${u}-tables.zip`)}}}static PICTURED_INSTANTS=3;static async pictures(t,n,a,s){const{registerScene:i,SCENE_ELEMENT_NAME:e}=await Z(async()=>{const{registerScene:p,SCENE_ELEMENT_NAME:l}=await import("./rr0-sighting-editor.mjs").then(m=>m.dg);return{registerScene:p,SCENE_ELEMENT_NAME:l}},[],import.meta.url);i();const r=t.witnesses.map(p=>{const l=p.indications.filter(f=>f.directionSaid).map(f=>f.t),m=l.length<=U.PICTURED_INSTANTS?l:[l[0],l[Math.floor(l.length/2)],l[l.length-1]],d=t.readings.filter(f=>f.reads===p.title&&f.comparisons.length>0),g=[{label:a.accountView,url:p.url,reading:void 0},...d.map(f=>({label:f.title,url:p.url,reading:f.url}))];return{witness:p,instants:[...new Set(m)],recordings:g}}).filter(p=>p.instants.length>0),c=r.reduce((p,l)=>p+l.instants.length*l.recordings.length,0);if(c===0)return;const o=document.createElement(e);o.setAttribute("max-pixel-ratio","1"),o.setAttribute("always-live",""),Object.assign(o.style,{position:"fixed",left:"-10000px",top:"0",width:"640px",height:"360px",visibility:"hidden",pointerEvents:"none"}),document.body.appendChild(o);let u=0;s?.(u,c);try{for(const p of r){const l=p.instants.map(d=>({t:d,views:[]})),m=n.recordings.get(p.witness.url);m&&(o.documentUrl=p.witness.url,o.sightingData=m);for(const d of p.recordings){const g=m,f=d.reading?n.recordings.get(d.reading):void 0;for(const w of l){let b;g&&(!d.reading||f)&&(w===l[0]&&(o.interpretation=U.bodiesOf(f??g,d.reading??p.witness.url)),b=await o.pictureAt(w.t,480).catch(()=>{})),w.views.push({label:d.label,...b?{image:b}:{}}),s?.(++u,c)}}p.witness.pictures=l}}finally{o.remove()}}static bodiesOf(t,n){const a=W.strip(t).recording.interpretation;if(a)return{...a,bodies:a.bodies.map(s=>s.model?.url?{...s,model:{...s.model,url:new URL(s.model.url,n).href}}:s)}}static print(t){const n=document.createElement("iframe");n.setAttribute("aria-hidden","true"),n.style.cssText="position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0",n.addEventListener("load",()=>{const a=n.contentWindow;a&&(a.addEventListener("afterprint",()=>n.remove()),a.focus(),a.print(),window.setTimeout(()=>n.remove(),6e4))},{once:!0}),n.srcdoc=t,document.body.append(n)}static download(t,n){const a=URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download=n,s.click(),window.setTimeout(()=>URL.revokeObjectURL(a),1e3)}}export{U as CaseReportExport};
65
+ `}static comparedTable(t,n){const a=n.texts.columns,s=z.escape;return z.table([a.reading,a.reads,a.reproduced,a.gap,a.robustness,a.supposedCount],t.readings.map(i=>{const e=n.robustness(i.sensitivity);return[s(i.title),s(i.reads),`<span class="n">${n.reproduced(i.sensitivity)}</span>`,n.degrees(i.sensitivity?.medianSeparationDeg),`<span class="${e.kind}">${s(e.text)}</span>`,String(i.supposed.length)]}),[2,3,5])}static witness(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h3>${e(a.fill(s.witnessHeading,{witness:t.title}))}</h3>`],o=[[s.columns.time,t.time??""],[s.place,t.place??""],[s.duration,t.durationSeconds!==void 0?a.instant(t.durationSeconds*1e3):""],[s.instrument,t.instrument??""]].filter(([,m])=>m!=="");o.length&&r.push(`<dl class="facts">${o.map(([m,d])=>`<dt>${e(m)}</dt><dd>${e(d)}</dd>`).join("")}</dl>`),t.description&&r.push(`<h4>${e(s.account)}</h4>`,`<blockquote>${e(t.description)}</blockquote>`),t.sources.length&&r.push(`<h4>${e(s.sources)}</h4>`,`<ul class="sources">${t.sources.map(m=>`<li>${[m.authors?.join(", "),m.title?`<em>${e(m.title)}</em>`:"",m.publisher,m.time,m.index].filter(Boolean).map(g=>g.startsWith("<em>")?g:e(g)).join(", ")}${m.url?` <a href="${e(m.url)}">${e(m.url)}</a>`:""}</li>`).join("")}</ul>`);const u=S.svg(t,a);u&&r.push(`<figure>${u}<figcaption>${e(s.timelineCaption)}</figcaption></figure>`),n=n.filter(m=>m.comparisons.length>0);const p=D.svg(t,n,a);if(p){const m=[`<li><svg viewBox="0 0 14 14" width="14" height="14" aria-hidden="true"><circle cx="7" cy="7" r="4" fill="#111827"/></svg>${e(s.saidLegend)}</li>`,...n.map((d,g)=>`<li>${D.legendMark(g)}${e(d.title)}</li>`)];r.push(`<figure>${p}<ul class="legend">${m.join("")}</ul><figcaption>${e(s.figureCaption)}</figcaption></figure>`)}if(t.pictures?.length){const m=t.pictures[0].views.map(d=>d.label);r.push(`<h4>${e(s.pictures)}</h4>`,`<div class="scroll"><table class="pictures"><thead><tr><th scope="col">${e(s.columns.instant)}</th>${m.map(d=>`<th scope="col">${e(d)}</th>`).join("")}</tr></thead><tbody>${t.pictures.map(d=>`<tr><td class="n">${a.instant(d.t)}</td>${d.views.map(g=>`<td>${g.image?`<img src="${g.image}" alt="${e(g.label)}, ${a.instant(d.t)}">`:`<span class="nothing">${e(s.noPicture)}</span>`}</td>`).join("")}</tr>`).join("")}</tbody></table></div>`,`<p class="caption">${e(s.picturesCaption)}</p>`)}r.push(`<h4>${e(s.indications)}</h4>`),t.indications.length===0?r.push(`<p>${e(s.noIndication)}</p>`):r.push(z.table([i.instant,i.phenomenon,i.azimuth,i.altitude,i.uncertainty,i.size,i.basis,i.rests],t.indications.map(m=>{const d=m.uncertainty;return[a.instant(m.t),e(m.phenomenon??m.sourceId),m.directionSaid?a.azimuth(m.aim?.azimuthDeg):"",m.directionSaid?a.degrees(m.aim?.altitudeDeg):"",d?`${a.azimuth(d.azimuthDeg[0])} … ${a.azimuth(d.azimuthDeg[1])} ; ${a.degrees(d.altitudeDeg[0])} … ${a.degrees(d.altitudeDeg[1])}`:"",m.sizeSaid?a.degrees(m.angular?.widthDeg):"",m.basis?e(s.bases[m.basis]):"",e(a.rests(m))]}),[0,2,3,5]));const l=t.values.filter(m=>!/^timeline\.keyframes\.\d+\.shapes\.\d+\.shape\.(aim|angular)/.test(m.path));return l.length>0&&r.push(`<h4>${e(s.values)}</h4>`,z.valuesTable(l,a)),r}static reading(t,n,a){const s=a.texts,i=s.columns,e=z.escape,r=[`<h2>${e(a.fill(s.readingHeading,{title:t.title,witness:t.reads}))}</h2>`],c=[t.by.length?a.fill(s.by,{names:t.by.join(", ")}):"",t.time?a.fill(s.made,{time:t.time}):""].filter(Boolean).join(" ");c&&r.push(`<p class="meta">${e(c)}</p>`),t.description&&r.push(`<blockquote>${e(t.description)}</blockquote>`),r.push(`<h4>${e(s.supposed)}</h4>`,t.supposed.length?z.valuesTable(t.supposed,a):`<p>${e(s.noneSupposed)}</p>`),r.push(`<h4>${e(s.findings)}</h4>`),r.push(t.findings.length?z.table([i.finding,i.outcome,i.against,i.origin],t.findings.map(u=>[e(u.text),`<span class="${u.outcome}">${e(s.outcomes[u.outcome])}</span>`,u.outcome==="fails"?e(s.grounds[u.against??"established"]):"",e(s.origins[u.written?"written":"computed"])])):`<p>${e(s.noFinding)}</p>`);const o=t.sensitivity;if(o){const u=a.robustness(o);if(r.push(`<h4>${e(s.sensitivity)}</h4>`,`<p>${e(i.reproduced)} : ${a.reproduced(o)||"–"} · ${e(i.gap)} : ${a.degrees(o.medianSeparationDeg)||"–"} · <span class="${u.kind}">${e(u.text)}</span></p>`),u.kind!=="too-few"&&u.kind!=="nothing"&&o.margins.length>0&&r.push(z.table([i.knob,i.from,i.to,i.reference,i.covered],o.margins.map(p=>{const l=a.ends(p),m=p.reference?`${a.amount(p.knob,p.reference.lower)} … ${a.amount(p.knob,p.reference.upper)}`:s.noLaw;return[e(s.knobs[p.knob]),l.from,l.to,e(m),p.coverage===void 0?"":`${Math.round(p.coverage*100)} %`]}),[1,2,4])),o.better){const{knob:p,amount:l,agreement:m}=o.better;r.push(`<p class="fine-tuned">${e(a.fill(s.better,{knob:s.knobs[p],amount:a.amount(p,l),agreed:String(Math.round(m*o.compared)),compared:String(o.compared)}))}</p>`)}}return t.comparisons.length>0&&r.push(`<h4>${e(s.comparisons)}</h4>`,z.table([i.instant,i.phenomenon,`${i.said} (${i.azimuth}, ${i.altitude})`,`${i.read} (${i.azimuth}, ${i.altitude})`,i.separation,i.agrees],t.comparisons.map(u=>[a.instant(u.t),e(n?.phenomena?.[u.sourceId]??u.sourceId),u.said?`${a.azimuth(u.said.azimuthDeg)}, ${a.degrees(u.said.altitudeDeg)}`:"",`${a.azimuth(u.predicted.azimuthDeg)}, ${a.degrees(u.predicted.altitudeDeg)}`,a.degrees(u.separationDeg),`<span class="${u.agrees?"holds":"fails"}">${e(u.agrees?s.yes:s.no)}</span>`]),[0,4])),r}static valuesTable(t,n){const a=n.texts,s=a.columns,i=z.escape;return z.table([s.path,s.value,s.basis,s.rests],t.map(e=>[`<code>${i(e.path)}</code>`,i(n.value(e)),i(a.bases[e.basis]),i(n.rests(e))]))}static table(t,n,a=[]){const s=z.escape,i=`<tr>${t.map(r=>`<th scope="col">${s(r)}</th>`).join("")}</tr>`,e=n.map(r=>`<tr>${r.map((c,o)=>`<td${a.includes(o)?' class="n"':""}>${c}</td>`).join("")}</tr>`);return`<div class="scroll"><table><thead>${i}</thead><tbody>${e.join("")}</tbody></table></div>`}static escape(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}const _=P.catalog({en:()=>Z(()=>import("./CaseReportTexts_en-DlN7p1pC.js"),[],import.meta.url).then(N=>N.caseReportTexts_en),fr:()=>Z(()=>import("./CaseReportTexts_fr-B5nP6RlP.js"),[],import.meta.url).then(N=>N.caseReportTexts_fr),es:()=>Z(()=>import("./CaseReportTexts_es-CncAEaey.js"),[],import.meta.url).then(N=>N.caseReportTexts_es),it:()=>Z(()=>import("./CaseReportTexts_it-Dc-oPmXB.js"),[],import.meta.url).then(N=>N.caseReportTexts_it)});class U{static async make(t,n,a,s,i=!1,e){const[r,c]=await Promise.all([_.load(a),J.load(a)]),o=A.of(n.caseJson,n.caseUrl,n.recordings,new C([...s]),new F(c));i&&t!=="csv"&&await U.pictures(o,n,r,e);const u=`${n.caseJson.id??"case"}-report`;switch(t){case"html":U.download(new Blob([z.of(o,r,a,"0.204.0")],{type:"text/html"}),`${u}.html`);return;case"print":U.print(z.of(o,r,a,"0.204.0"));return;case"json":U.download(new Blob([T.json(o,"0.204.0")],{type:"application/json"}),`${u}.json`);return;case"csv":{const{zipSync:p,strToU8:l}=await Z(async()=>{const{zipSync:d,strToU8:g}=await import("./browser-CltifEM0.js");return{zipSync:d,strToU8:g}},[],import.meta.url),m=Object.fromEntries(Object.entries(T.csv(o,r,a)).map(([d,g])=>[d,l(`\uFEFF${g}`)]));U.download(new Blob([p(m)],{type:"application/zip"}),`${u}-tables.zip`)}}}static PICTURED_INSTANTS=3;static async pictures(t,n,a,s){const{registerScene:i,SCENE_ELEMENT_NAME:e}=await Z(async()=>{const{registerScene:p,SCENE_ELEMENT_NAME:l}=await import("./rr0-sighting-editor.mjs").then(m=>m.dh);return{registerScene:p,SCENE_ELEMENT_NAME:l}},[],import.meta.url);i();const r=t.witnesses.map(p=>{const l=p.indications.filter(f=>f.directionSaid).map(f=>f.t),m=l.length<=U.PICTURED_INSTANTS?l:[l[0],l[Math.floor(l.length/2)],l[l.length-1]],d=t.readings.filter(f=>f.reads===p.title&&f.comparisons.length>0),g=[{label:a.accountView,url:p.url,reading:void 0},...d.map(f=>({label:f.title,url:p.url,reading:f.url}))];return{witness:p,instants:[...new Set(m)],recordings:g}}).filter(p=>p.instants.length>0),c=r.reduce((p,l)=>p+l.instants.length*l.recordings.length,0);if(c===0)return;const o=document.createElement(e);o.setAttribute("max-pixel-ratio","1"),o.setAttribute("always-live",""),Object.assign(o.style,{position:"fixed",left:"-10000px",top:"0",width:"640px",height:"360px",visibility:"hidden",pointerEvents:"none"}),document.body.appendChild(o);let u=0;s?.(u,c);try{for(const p of r){const l=p.instants.map(d=>({t:d,views:[]})),m=n.recordings.get(p.witness.url);m&&(o.documentUrl=p.witness.url,o.sightingData=m);for(const d of p.recordings){const g=m,f=d.reading?n.recordings.get(d.reading):void 0;for(const w of l){let b;g&&(!d.reading||f)&&(w===l[0]&&(o.interpretation=U.bodiesOf(f??g,d.reading??p.witness.url)),b=await o.pictureAt(w.t,480).catch(()=>{})),w.views.push({label:d.label,...b?{image:b}:{}}),s?.(++u,c)}}p.witness.pictures=l}}finally{o.remove()}}static bodiesOf(t,n){const a=W.strip(t).recording.interpretation;if(a)return{...a,bodies:a.bodies.map(s=>s.model?.url?{...s,model:{...s.model,url:new URL(s.model.url,n).href}}:s)}}static print(t){const n=document.createElement("iframe");n.setAttribute("aria-hidden","true"),n.style.cssText="position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0",n.addEventListener("load",()=>{const a=n.contentWindow;a&&(a.addEventListener("afterprint",()=>n.remove()),a.focus(),a.print(),window.setTimeout(()=>n.remove(),6e4))},{once:!0}),n.srcdoc=t,document.body.append(n)}static download(t,n){const a=URL.createObjectURL(t),s=document.createElement("a");s.href=a,s.download=n,s.click(),window.setTimeout(()=>URL.revokeObjectURL(a),1e3)}}export{U as CaseReportExport};
@@ -1 +1 @@
1
- import{b2 as b,bn as F,bo as I,b5 as m,bp as X,bq as D}from"./rr0-sighting-editor.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new b;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new F;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new m(t,new X({vertexColors:!0,transparent:!0,depthWrite:!1,side:D})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
1
+ import{b3 as b,bo as F,bp as I,b6 as m,bq as X,br as D}from"./rr0-sighting-editor.mjs";import{C as x}from"./ContrailGrowth-DwHS8If9.js";class h{static MAX_SEGMENTS=8e3;static MIN_PIXELS=2;static UNRESOLVED_CONTRAST=.5;static STATIONS=[0,.5,1,1.5,2.25];static VERTICES_PER_SEGMENT=12*(h.STATIONS.length-1);static ICE_ASYMMETRY=.75;static phase(t){const s=h.ICE_ASYMMETRY;return(1-s*s)/(1+s*s-2*s*t)**1.5}object;group=new b;trails=[];positions=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*3);colors=new Float32Array(h.MAX_SEGMENTS*h.VERTICES_PER_SEGMENT*4);segments=0;constructor(){const t=new F;t.setAttribute("position",new I(this.positions,3)),t.setAttribute("color",new I(this.colors,4)),t.setDrawRange(0,0),this.object=new m(t,new X({vertexColors:!0,transparent:!0,depthWrite:!1,side:D})),this.object.frustumCulled=!1,this.object.name="contrails",this.group.name="contrails",this.group.add(this.object)}get segmentCount(){return this.segments}set(t){this.trails=t}update(t,s,c){let p=0;this.segments=0;for(const o of this.trails){const u=this.samplesOf(o,t,s),i=c(o.id);for(let a=0;a+1<u.length;a++){const n=u[a],M=u[a+1];if(!n.forms||!M.forms)continue;if(this.segments>=h.MAX_SEGMENTS)break;const d=this.pushSegment(p,n,M,o.spanM,i,s);d>p&&this.segments++,p=d}}const y=this.object.geometry;y.setDrawRange(0,p);for(const[o,u]of[["position",3],["color",4]]){const i=y.getAttribute(o);i.clearUpdateRanges(),p>0&&i.addUpdateRange(0,p*u),i.needsUpdate=!0}}samplesOf(t,s,c){const p=s-x.FORMATION_S*1e3,y=[],o=(n,M,d,T,l,N)=>({x:M+n.driftEastMs*l+c.origin.x,y:T,z:-(d+n.driftNorthMs*l)+c.origin.z,age:l,forms:N,point:n});let u=-1;t.points.forEach((n,M)=>{n.tMs>p||(u=M,y.push(o(n,n.eastM,n.northM,n.upM,(s-n.tMs)/1e3,n.forms)))});const i=t.points[u],a=t.points[u+1];if(i&&a){const n=(p-i.tMs)/(a.tMs-i.tMs),M=(d,T)=>d+(T-d)*n;y.push(o(i,M(i.eastM,a.eastM),M(i.northM,a.northM),M(i.upM,a.upM),x.FORMATION_S,i.forms&&a.forms))}return y}pushSegment(t,s,c,p,y,o){const u=e=>({persistent:e.point.persistent,lifetimeS:e.point.lifetimeS,spanM:p,shearPerS:e.point.shearPerS,saturatedForS:e.point.saturatedForS}),i=x.opacity(s.age,u(s)),a=x.opacity(c.age,u(c));if(i<=0&&a<=0)return t;const n={x:c.x-s.x,y:c.y-s.y,z:c.z-s.z};if(Math.hypot(n.x,n.y,n.z)<1e-6)return t;const M={x:(s.x+c.x)/2-o.eye.x,y:(s.y+c.y)/2-o.eye.y,z:(s.z+c.z)/2-o.eye.z},d=this.normalise(this.cross(n,M)),T=e=>{if(!o.sun)return y;const r={x:e.x-o.eye.x,y:e.y-o.eye.y,z:e.z-o.eye.z},E=h.phase((o.sun.x*r.x+o.sun.y*r.y+o.sun.z*r.z)/(Math.hypot(r.x,r.y,r.z)||1));return[y[0]*E,y[1]*E,y[2]*E]},l=(e,r)=>{const E=Math.hypot(e.x-o.eye.x,e.y-o.eye.y,e.z-o.eye.z),A=x.widthM(p,e.age,e.point.shearPerS),g=Math.max(A,h.MIN_PIXELS*o.pixelRad*E),z=r*(A/g)**h.UNRESOLVED_CONTRAST,S=x.profileExponent(e.age),G=h.STATIONS.map((j,P)=>P===h.STATIONS.length-1?0:z*Math.exp(-Math.LN2*j**S));return{half:g/2,profile:G,scattered:T(e)}},N=[{sample:s,...l(s,i)},{sample:c,...l(c,a)}],w=h.STATIONS.length-1,f=(e,r,E)=>{const A=h.STATIONS[r],g=e.half*A*E,z=t*3;this.positions[z]=e.sample.x+d.x*g,this.positions[z+1]=e.sample.y+d.y*g,this.positions[z+2]=e.sample.z+d.z*g;const S=t*4;this.colors[S]=e.scattered[0],this.colors[S+1]=e.scattered[1],this.colors[S+2]=e.scattered[2],this.colors[S+3]=e.profile[r],t++},[R,O]=N;for(const e of[-1,1])for(let r=0;r<w;r++)f(R,r+1,e),f(R,r,e),f(O,r+1,e),f(R,r,e),f(O,r,e),f(O,r+1,e);return t}cross(t,s){return{x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x}}normalise(t){const s=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/s,y:t.y/s,z:t.z/s}}dispose(){this.object.geometry.dispose(),this.object.material.dispose(),this.group.removeFromParent()}}export{h as ContrailSystem};
@@ -1,4 +1,4 @@
1
- import{bd as b,b$ as A,cm as D,c1 as E,cn as M,co as F,cp as R,b5 as P,bE as U,cq as k,bN as S}from"./rr0-sighting-editor.mjs";class w{target;wideCamera=new b;materials=new Map;draw(t){const{renderer:s,camera:r,equidistant:a}=t,o=s.getDrawingBufferSize(new A),n=o.x,i=o.y,e=n/i;if(a&&!D.supports(r.fov,e))throw new Error(`A field of ${r.fov}° is drawn through a cube, which the control passes do not follow yet: export through a narrower field.`);const c=this.sourceCamera(r,a?a.sourceFovDeg(r.fov,e):r.fov),d=this.usableTarget(n,i),l=this.drawDistance(t,c,d),u=this.drawPhenomenon(t,c,d),f=Math.tan(c.fov*Math.PI/360),p=new Float32Array(n*i),h=new Uint8Array(n*i);for(let v=0;v<i;v++)for(let g=0;g<n;g++){const m=this.sourcePixel(g,v,n,i,r.fov,e,f,a);if(m<0)continue;const x=v*n+g;p[x]=l[m*4];const y=u[m*4],T=u[m*4+1],C=u[m*4+2],_=u[m*4+3];h[x]=Math.max(y,T,C,_)>w.LIGHT_THRESHOLD?255:0}return{width:n,height:i,distanceM:p,phenomenon:h}}dispose(){this.target?.dispose();for(const t of this.materials.values())t.dispose();this.materials.clear()}static LIGHT_THRESHOLD=1e-6;sourcePixel(t,s,r,a,o,n,i,e){if(!e)return(a-1-s)*r+t;const c=(t+.5)/r*2-1,d=1-(s+.5)/a*2,l=e.directionFor(c,d,o);if(l.z>=0)return-1;const u=l.x/-l.z/(i*n),f=l.y/-l.z/i,p=Math.floor((u+1)/2*r),h=Math.floor((f+1)/2*a);return p<0||p>=r||h<0||h>=a?-1:h*r+p}sourceCamera(t,s){const r=this.wideCamera.copy(t);return r.fov=s,r.clearViewOffset(),r.updateProjectionMatrix(),r.updateMatrixWorld(),r}usableTarget(t,s){return this.target?(this.target.width!==t||this.target.height!==s)&&this.target.setSize(t,s):this.target=new E(t,s,{type:R,format:F,minFilter:M,magFilter:M,depthBuffer:!0}),this.target}drawDistance(t,s,r){const{renderer:a,scene:o}=t,n=[],i=[];for(const e of t.sky)e.visible&&(e.visible=!1,n.push(e));o.traverseVisible(e=>{if(e instanceof P){if(t.isSolid(e)){i.push({mesh:e,material:e.material}),e.material=Array.isArray(e.material)?e.material.map(c=>this.distanceMaterial(c)):this.distanceMaterial(e.material);return}}else if(!e.isPoints&&!e.isLine&&!e.isSprite)return;n.push(e)});for(const e of n)e.visible=!1;try{return this.drawInto(t,r,()=>a.render(o,s))}finally{for(const e of n)e.visible=!0;for(const{mesh:e,material:c}of i)e.material=c}}drawPhenomenon(t,s,r){return this.drawInto(t,r,()=>t.drawPhenomena(s))}drawInto(t,s,r){const{renderer:a,scene:o}=t,n=a.getRenderTarget(),i=a.autoClear,e=a.shadowMap.autoUpdate,c=o.fog,d=o.background,l=a.getClearAlpha(),u=a.getClearColor(new U);o.fog=null,o.background=null,a.shadowMap.autoUpdate=!1,a.setRenderTarget(s),a.setClearColor(0,0),a.clear(!0,!0,!0),a.autoClear=!1;try{r();const f=new Float32Array(s.width*s.height*4);return k.now(a,s,0,0,s.width,s.height,f),f}finally{a.autoClear=i,a.shadowMap.autoUpdate=e,a.setRenderTarget(n),a.setClearColor(u,l),o.fog=c,o.background=d}}distanceMaterial(t){const s=t.alphaTest??0,r=t.map??t.alphaMap??null,a=s>0&&r!==null,o=`${t.side}:${a?`${r.uuid}:${s}`:"-"}`;let n=this.materials.get(o);return n||(n=new S({defines:a?{CUTOUT:"",USE_UV:""}:{},uniforms:{cutoutMap:{value:r},cutoutAlpha:{value:s}},vertexShader:w.VERTEX,fragmentShader:w.FRAGMENT,side:t.side}),this.materials.set(o,n)),n}static VERTEX=`
1
+ import{be as A,c0 as b,cn as F,c2 as D,co as M,cp as R,cq as E,b6 as P,bF as U,cr as k,bO as S}from"./rr0-sighting-editor.mjs";class w{target;wideCamera=new A;materials=new Map;draw(t){const{renderer:s,camera:r,equidistant:a}=t,o=s.getDrawingBufferSize(new b),n=o.x,i=o.y,e=n/i;if(a&&!F.supports(r.fov,e))throw new Error(`A field of ${r.fov}° is drawn through a cube, which the control passes do not follow yet: export through a narrower field.`);const c=this.sourceCamera(r,a?a.sourceFovDeg(r.fov,e):r.fov),d=this.usableTarget(n,i),l=this.drawDistance(t,c,d),u=this.drawPhenomenon(t,c,d),f=Math.tan(c.fov*Math.PI/360),p=new Float32Array(n*i),h=new Uint8Array(n*i);for(let v=0;v<i;v++)for(let g=0;g<n;g++){const m=this.sourcePixel(g,v,n,i,r.fov,e,f,a);if(m<0)continue;const x=v*n+g;p[x]=l[m*4];const y=u[m*4],T=u[m*4+1],C=u[m*4+2],_=u[m*4+3];h[x]=Math.max(y,T,C,_)>w.LIGHT_THRESHOLD?255:0}return{width:n,height:i,distanceM:p,phenomenon:h}}dispose(){this.target?.dispose();for(const t of this.materials.values())t.dispose();this.materials.clear()}static LIGHT_THRESHOLD=1e-6;sourcePixel(t,s,r,a,o,n,i,e){if(!e)return(a-1-s)*r+t;const c=(t+.5)/r*2-1,d=1-(s+.5)/a*2,l=e.directionFor(c,d,o);if(l.z>=0)return-1;const u=l.x/-l.z/(i*n),f=l.y/-l.z/i,p=Math.floor((u+1)/2*r),h=Math.floor((f+1)/2*a);return p<0||p>=r||h<0||h>=a?-1:h*r+p}sourceCamera(t,s){const r=this.wideCamera.copy(t);return r.fov=s,r.clearViewOffset(),r.updateProjectionMatrix(),r.updateMatrixWorld(),r}usableTarget(t,s){return this.target?(this.target.width!==t||this.target.height!==s)&&this.target.setSize(t,s):this.target=new D(t,s,{type:E,format:R,minFilter:M,magFilter:M,depthBuffer:!0}),this.target}drawDistance(t,s,r){const{renderer:a,scene:o}=t,n=[],i=[];for(const e of t.sky)e.visible&&(e.visible=!1,n.push(e));o.traverseVisible(e=>{if(e instanceof P){if(t.isSolid(e)){i.push({mesh:e,material:e.material}),e.material=Array.isArray(e.material)?e.material.map(c=>this.distanceMaterial(c)):this.distanceMaterial(e.material);return}}else if(!e.isPoints&&!e.isLine&&!e.isSprite)return;n.push(e)});for(const e of n)e.visible=!1;try{return this.drawInto(t,r,()=>a.render(o,s))}finally{for(const e of n)e.visible=!0;for(const{mesh:e,material:c}of i)e.material=c}}drawPhenomenon(t,s,r){return this.drawInto(t,r,()=>t.drawPhenomena(s))}drawInto(t,s,r){const{renderer:a,scene:o}=t,n=a.getRenderTarget(),i=a.autoClear,e=a.shadowMap.autoUpdate,c=o.fog,d=o.background,l=a.getClearAlpha(),u=a.getClearColor(new U);o.fog=null,o.background=null,a.shadowMap.autoUpdate=!1,a.setRenderTarget(s),a.setClearColor(0,0),a.clear(!0,!0,!0),a.autoClear=!1;try{r();const f=new Float32Array(s.width*s.height*4);return k.now(a,s,0,0,s.width,s.height,f),f}finally{a.autoClear=i,a.shadowMap.autoUpdate=e,a.setRenderTarget(n),a.setClearColor(u,l),o.fog=c,o.background=d}}distanceMaterial(t){const s=t.alphaTest??0,r=t.map??t.alphaMap??null,a=s>0&&r!==null,o=`${t.side}:${a?`${r.uuid}:${s}`:"-"}`;let n=this.materials.get(o);return n||(n=new S({defines:a?{CUTOUT:"",USE_UV:""}:{},uniforms:{cutoutMap:{value:r},cutoutAlpha:{value:s}},vertexShader:w.VERTEX,fragmentShader:w.FRAGMENT,side:t.side}),this.materials.set(o,n)),n}static VERTEX=`
2
2
  #include <common>
3
3
  #include <uv_pars_vertex>
4
4
  #include <batching_pars_vertex>
@@ -1 +1 @@
1
- import{bV as o}from"./rr0-sighting-editor.mjs";const l=[{id:"when",paths:["time"]},{id:"where",paths:["place.locations.*.lat","place.locations.*.lng","observerTrack.keyframes.*.pose.lat","observerTrack.keyframes.*.pose.lng"]},{id:"facing",paths:["observerTrack.keyframes.*.pose.headingDeg"]},{id:"apparent-size",paths:["timeline.keyframes.*.shapes.*.shape.angular.widthDeg","timeline.keyframes.*.shapes.*.shape.angular.heightDeg"]},{id:"sky-position",paths:["timeline.keyframes.*.shapes.*.shape.aim.azimuthDeg","timeline.keyframes.*.shapes.*.shape.aim.altitudeDeg"]},{id:"how-long",paths:["durationSeconds","endTime"]},{id:"appearance",paths:["timeline.keyframes.*.shapes.*.shape.kind","timeline.keyframes.*.shapes.*.shape.title","timeline.keyframes.*.shapes.*.shape.color","timeline.keyframes.*.shapes.*.shape.brightness"]},{id:"movement",paths:["timeline.keyframes.1.t","observerTrack.keyframes.1.t"]},{id:"sound",paths:["soundTrack.keyframes.*.sound.kind"]},{id:"conditions",paths:["weatherTrack.keyframes.*.weather.*","weather.*"]}],d=["fitted","assumed","derived","stated","measured","established"];class p{about="observer";async assess(a){const i=o(a,!0),s=l.map(e=>p.answer(e,i,a));return{score:s.filter(e=>e.basis==="stated").length/s.length,criteria:s}}static answer(a,i,s){const e=a.paths.flatMap(t=>p.resolve(t,i));if(e.length===0)return{id:a.id,paths:[]};const r=e.map(t=>p.basisAt(t,s)??"stated");return{id:a.id,basis:d.find(t=>r.includes(t)),paths:e}}static basisAt(a,i){const s=a.split(".");for(let e=s.length;e>0;e--){const r=i.provenance.at(s.slice(0,e).join("."))?.basis;if(r)return r}}static resolve(a,i){let s=[{path:[],value:i}];for(const e of a.split("."))s=s.flatMap(({path:r,value:t})=>{if(typeof t!="object"||t===null)return[];if(e!=="*"){const n=t[e];return n===void 0?[]:[{path:[...r,e],value:n}]}return Object.entries(t).filter(([,n])=>n!==void 0).map(([n,h])=>({path:[...r,n],value:h}))});return s.filter(({value:e})=>e!==null&&e!==""&&!(Array.isArray(e)&&e.length===0)).map(({path:e})=>e.join("."))}}export{p as CoverageAssessor};
1
+ import{bW as o}from"./rr0-sighting-editor.mjs";const l=[{id:"when",paths:["time"]},{id:"where",paths:["place.locations.*.lat","place.locations.*.lng","observerTrack.keyframes.*.pose.lat","observerTrack.keyframes.*.pose.lng"]},{id:"facing",paths:["observerTrack.keyframes.*.pose.headingDeg"]},{id:"apparent-size",paths:["timeline.keyframes.*.shapes.*.shape.angular.widthDeg","timeline.keyframes.*.shapes.*.shape.angular.heightDeg"]},{id:"sky-position",paths:["timeline.keyframes.*.shapes.*.shape.aim.azimuthDeg","timeline.keyframes.*.shapes.*.shape.aim.altitudeDeg"]},{id:"how-long",paths:["durationSeconds","endTime"]},{id:"appearance",paths:["timeline.keyframes.*.shapes.*.shape.kind","timeline.keyframes.*.shapes.*.shape.title","timeline.keyframes.*.shapes.*.shape.color","timeline.keyframes.*.shapes.*.shape.brightness"]},{id:"movement",paths:["timeline.keyframes.1.t","observerTrack.keyframes.1.t"]},{id:"sound",paths:["soundTrack.keyframes.*.sound.kind"]},{id:"conditions",paths:["weatherTrack.keyframes.*.weather.*","weather.*"]}],d=["fitted","assumed","derived","stated","measured","established"];class p{about="observer";async assess(a){const i=o(a,!0),s=l.map(e=>p.answer(e,i,a));return{score:s.filter(e=>e.basis==="stated").length/s.length,criteria:s}}static answer(a,i,s){const e=a.paths.flatMap(t=>p.resolve(t,i));if(e.length===0)return{id:a.id,paths:[]};const r=e.map(t=>p.basisAt(t,s)??"stated");return{id:a.id,basis:d.find(t=>r.includes(t)),paths:e}}static basisAt(a,i){const s=a.split(".");for(let e=s.length;e>0;e--){const r=i.provenance.at(s.slice(0,e).join("."))?.basis;if(r)return r}}static resolve(a,i){let s=[{path:[],value:i}];for(const e of a.split("."))s=s.flatMap(({path:r,value:t})=>{if(typeof t!="object"||t===null)return[];if(e!=="*"){const n=t[e];return n===void 0?[]:[{path:[...r,e],value:n}]}return Object.entries(t).filter(([,n])=>n!==void 0).map(([n,h])=>({path:[...r,n],value:h}))});return s.filter(({value:e})=>e!==null&&e!==""&&!(Array.isArray(e)&&e.length===0)).map(({path:e})=>e.join("."))}}export{p as CoverageAssessor};
@@ -1,4 +1,4 @@
1
- import{x as g,_ as h,bf as x,a9 as m,ab as f,aa as v,I as P,a7 as _,a8 as w,n as T,ac as O}from"./rr0-sighting-editor.mjs";import{S as b}from"./SkyEventEditorStyle-CvY_AhbI.js";import{D as p}from"./DroneParameters-DRfoxMx8.js";import"./DroneFlight-C1bur42A.js";const I=g.catalog({en:()=>h(()=>import("./DroneParameterTexts_en-sL1dR2RG.js"),[],import.meta.url).then(o=>o.droneParameterTexts_en),fr:()=>h(()=>import("./DroneParameterTexts_fr-B8Ym7Yz6.js"),[],import.meta.url).then(o=>o.droneParameterTexts_fr),es:()=>h(()=>import("./DroneParameterTexts_es-Bg8_8XVE.js"),[],import.meta.url).then(o=>o.droneParameterTexts_es),it:()=>h(()=>import("./DroneParameterTexts_it-DfvWjvoc.js"),[],import.meta.url).then(o=>o.droneParameterTexts_it)}),y=g.catalog({en:()=>h(()=>import("./DroneEditorMessages_en-BViHK30c.js"),[],import.meta.url).then(o=>o.droneEditorMessages_en),fr:()=>h(()=>import("./DroneEditorMessages_fr-CvV0RyOT.js"),[],import.meta.url).then(o=>o.droneEditorMessages_fr),es:()=>h(()=>import("./DroneEditorMessages_es-D6bhIOAa.js"),[],import.meta.url).then(o=>o.droneEditorMessages_es),it:()=>h(()=>import("./DroneEditorMessages_it-CYi-jmVN.js"),[],import.meta.url).then(o=>o.droneEditorMessages_it)});class d{constructor(t,i,e){this.container=t,this.host=i,b.attach(t,"drone-editor-part",d.STYLE),this.language=e,x.of("drones")||p.publish(),this.ready=this.setLanguage(e)}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 i=++this.languageToken;this.language=t;const[e,s]=await Promise.all([y.load(t),I.load(t)]);i===this.languageToken&&(this.messages=e,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flights;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 i=this.current;if(this.element("drone-fields").hidden=i===void 0,!i)return;const e=this.element("drone-each");e.hidden=i.explainsEach===void 0,e.textContent=this.messages.explainsEachNote.replace("{n}",String(i.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(p.SET),new f(()=>this.current,s=>this.editFlight(n=>s(n)),()=>({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.flights;if(t.length===this.shown.length&&t.every((i,e)=>i.id===this.shown[e].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 v.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">
1
+ import{x as g,_ as h,bg as x,a9 as m,ab as f,aa as v,I as P,a7 as _,a8 as w,n as T,ac as O}from"./rr0-sighting-editor.mjs";import{S as b}from"./SkyEventEditorStyle-CvY_AhbI.js";import{D as p}from"./DroneParameters-CdQbwFKD.js";import"./DroneFlight-D-MWhrXa.js";const I=g.catalog({en:()=>h(()=>import("./DroneParameterTexts_en-sL1dR2RG.js"),[],import.meta.url).then(o=>o.droneParameterTexts_en),fr:()=>h(()=>import("./DroneParameterTexts_fr-B8Ym7Yz6.js"),[],import.meta.url).then(o=>o.droneParameterTexts_fr),es:()=>h(()=>import("./DroneParameterTexts_es-Bg8_8XVE.js"),[],import.meta.url).then(o=>o.droneParameterTexts_es),it:()=>h(()=>import("./DroneParameterTexts_it-DfvWjvoc.js"),[],import.meta.url).then(o=>o.droneParameterTexts_it)}),y=g.catalog({en:()=>h(()=>import("./DroneEditorMessages_en-BViHK30c.js"),[],import.meta.url).then(o=>o.droneEditorMessages_en),fr:()=>h(()=>import("./DroneEditorMessages_fr-CvV0RyOT.js"),[],import.meta.url).then(o=>o.droneEditorMessages_fr),es:()=>h(()=>import("./DroneEditorMessages_es-D6bhIOAa.js"),[],import.meta.url).then(o=>o.droneEditorMessages_es),it:()=>h(()=>import("./DroneEditorMessages_it-CYi-jmVN.js"),[],import.meta.url).then(o=>o.droneEditorMessages_it)});class d{constructor(t,i,e){this.container=t,this.host=i,b.attach(t,"drone-editor-part",d.STYLE),this.language=e,x.of("drones")||p.publish(),this.ready=this.setLanguage(e)}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 i=++this.languageToken;this.language=t;const[e,s]=await Promise.all([y.load(t),I.load(t)]);i===this.languageToken&&(this.messages=e,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const t=this.flights;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 i=this.current;if(this.element("drone-fields").hidden=i===void 0,!i)return;const e=this.element("drone-each");e.hidden=i.explainsEach===void 0,e.textContent=this.messages.explainsEachNote.replace("{n}",String(i.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(p.SET),new f(()=>this.current,s=>this.editFlight(n=>s(n)),()=>({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.flights;if(t.length===this.shown.length&&t.every((i,e)=>i.id===this.shown[e].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 v.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
2
  <p class="launch-intro">${t.intro}</p>
3
3
  <div id="drone-list"></div>
4
4
  <div id="drone-fields" class="launch-fields">