@rr0/ufoathome 0.192.1 → 0.193.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/dist-embed-interview/rr0-interview.mjs +3 -3
  2. package/dist-embed-scene/rr0-scene.mjs +306 -306
  3. package/dist-embed-sighting/{CaseReportExport-BW8-bkTQ.js → CaseReportExport-CYeoYzU0.js} +1 -1
  4. package/dist-embed-sighting/rr0-sighting.mjs +344 -329
  5. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-BrZzIuec.js → AdsbLolArchiveProvider--KjPxNqw.js} +1 -1
  6. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-CXvIvYxV.js → BallesterGuaspAssessor-BTmq0r-G.js} +1 -1
  7. package/dist-embed-sighting-editor/{BeamEditor-5-OlhNfL.js → BeamEditor-CI8-9VOc.js} +1 -1
  8. package/dist-embed-sighting-editor/{BeamSystem-BGdR-Xez.js → BeamSystem-odg570aR.js} +1 -1
  9. package/dist-embed-sighting-editor/BirdEditor-DV3ndYff.js +16 -0
  10. package/dist-embed-sighting-editor/{BirdFlock-DtshFXGT.js → BirdFlock-O7K_g8y7.js} +1 -1
  11. package/dist-embed-sighting-editor/{BodyEditor-Dn5HrH2t.js → BodyEditor-COLTBHzX.js} +1 -1
  12. package/dist-embed-sighting-editor/{CaseEditorMessages_en-DrJY0M8h.js → CaseEditorMessages_en-CoFukfwf.js} +1 -1
  13. package/dist-embed-sighting-editor/{CaseEditorMessages_es-j8EeOBq6.js → CaseEditorMessages_es-DZptbzB7.js} +1 -1
  14. package/dist-embed-sighting-editor/{CaseEditorMessages_fr-BkwEF9mu.js → CaseEditorMessages_fr-DXl2GNmR.js} +1 -1
  15. package/dist-embed-sighting-editor/{CaseEditorMessages_it-d3Z0PBEw.js → CaseEditorMessages_it-ss10VmRM.js} +1 -1
  16. package/dist-embed-sighting-editor/CaseElement-Bo31UxpS.js +100 -0
  17. package/dist-embed-sighting-editor/CaseMessages_en-BbbbikHH.js +1 -0
  18. package/dist-embed-sighting-editor/CaseMessages_es-AHBxl8Ka.js +1 -0
  19. package/dist-embed-sighting-editor/CaseMessages_fr-CD33PQCH.js +1 -0
  20. package/dist-embed-sighting-editor/CaseMessages_it-DyMACGSU.js +1 -0
  21. package/dist-embed-sighting-editor/{CaseReportExport-BfQWru8L.js → CaseReportExport-DpsJ5_r9.js} +2 -2
  22. package/dist-embed-sighting-editor/{ContrailSystem-BTVyJpmn.js → ContrailSystem-BddkU7fj.js} +1 -1
  23. package/dist-embed-sighting-editor/{ControlPasses-DiQAXMzD.js → ControlPasses-CNlCUT1L.js} +1 -1
  24. package/dist-embed-sighting-editor/{CoverageAssessor-CJQzNdyr.js → CoverageAssessor-DjY8iKp5.js} +1 -1
  25. package/dist-embed-sighting-editor/DroneEditor-DRsM2ash.js +16 -0
  26. package/dist-embed-sighting-editor/{DroneFlight-tXCk1Tg1.js → DroneFlight-Fr4Vgso3.js} +1 -1
  27. package/dist-embed-sighting-editor/{Flightradar24Provider-DUVcPAF2.js → Flightradar24Provider-BxeduRam.js} +1 -1
  28. package/dist-embed-sighting-editor/GLTFLoader-C6nlGTTi.js +1 -0
  29. package/dist-embed-sighting-editor/{GenerativeKitMessages-I8xH2ec9.js → GenerativeKitMessages-B8L7U7gD.js} +1 -1
  30. package/dist-embed-sighting-editor/{GeoExportTexts-DAllttgw.js → GeoExportTexts-DrGdI2OF.js} +1 -1
  31. package/dist-embed-sighting-editor/{GeoJsonExport-_yjIEd4F.js → GeoJsonExport-BZ-0v8fM.js} +1 -1
  32. package/dist-embed-sighting-editor/GeographicFigures-DqhWddS9.js +1 -0
  33. package/dist-embed-sighting-editor/{HeadlightSystem-DRq40K7R.js → HeadlightSystem-DI5wHYZu.js} +1 -1
  34. package/dist-embed-sighting-editor/{HynekAssessor-PxE7JR1h.js → HynekAssessor-DlXalbph.js} +1 -1
  35. package/dist-embed-sighting-editor/InterviewEditorElement-Bbkze5KE.js +240 -0
  36. package/dist-embed-sighting-editor/InterviewElement-B3tm7y49.js +31 -0
  37. package/dist-embed-sighting-editor/{KmlExport-dpml2tIJ.js → KmlExport-Bh4eTycx.js} +1 -1
  38. package/dist-embed-sighting-editor/LanternEditor-M887ltwe.js +24 -0
  39. package/dist-embed-sighting-editor/{LaserBeam-CadJcSMd.js → LaserBeam-Drpkr84G.js} +1 -1
  40. package/dist-embed-sighting-editor/LaunchEditor-BjAk4XZR.js +22 -0
  41. package/dist-embed-sighting-editor/{LaunchPlume-C7My5ccR.js → LaunchPlume-CrzPcqw7.js} +1 -1
  42. package/dist-embed-sighting-editor/{LaunchSimulation-45Z9GUBF.js → LaunchSimulation-C1ZWpKZT.js} +1 -1
  43. package/dist-embed-sighting-editor/{ModelSource-CzGHu4XS.js → ModelSource-Bko_3OJt.js} +1 -1
  44. package/dist-embed-sighting-editor/{ModelThumbnails-CNO_j-KM.js → ModelThumbnails-DSshyLu2.js} +1 -1
  45. package/dist-embed-sighting-editor/{ModelViewer-yfIxofpG.js → ModelViewer-_yhAYvNy.js} +1 -1
  46. package/dist-embed-sighting-editor/{ModuleConformance-C9DED8Lk.js → ModuleConformance-B6iFVb8X.js} +2 -2
  47. package/dist-embed-sighting-editor/{ModuleSession-Cxe0BJue.js → ModuleSession-jKFl1FMo.js} +3 -3
  48. package/dist-embed-sighting-editor/ModuleThree-Fvr5G-Yh.js +1 -0
  49. package/dist-embed-sighting-editor/{ModulesPanelElement-DgbOYqaS.js → ModulesPanelElement-VPRCdjmv.js} +3 -3
  50. package/dist-embed-sighting-editor/{NearestApproach-EbQIYGTt.js → NearestApproach-O8k2n_qL.js} +1 -1
  51. package/dist-embed-sighting-editor/PictureRegistration-DBBH_E6I.js +1 -0
  52. package/dist-embed-sighting-editor/{PoherAssessor-BisQ5ybV.js → PoherAssessor-sTJEnlmb.js} +1 -1
  53. package/dist-embed-sighting-editor/{RailwaySystem-CIAIBvLT.js → RailwaySystem-BZqNSSFA.js} +1 -1
  54. package/dist-embed-sighting-editor/ReentryEditor-DfDGpL5C.js +28 -0
  55. package/dist-embed-sighting-editor/{ReentrySimulation-Crd-CW_o.js → ReentrySimulation-BuUK0niI.js} +1 -1
  56. package/dist-embed-sighting-editor/{ReferenceSystem-DUIJceGg.js → ReferenceSystem-DvcQp167.js} +1 -1
  57. package/dist-embed-sighting-editor/{RoadMarkings-D9-6Cy9S.js → RoadMarkings-BGK7ToZP.js} +1 -1
  58. package/dist-embed-sighting-editor/SightingEditorMessages_en-CTQYcybj.js +12 -0
  59. package/dist-embed-sighting-editor/SightingEditorMessages_es-D-ASD5a3.js +12 -0
  60. package/dist-embed-sighting-editor/SightingEditorMessages_fr-DjUByAq4.js +12 -0
  61. package/dist-embed-sighting-editor/SightingEditorMessages_it-Eat0U-4p.js +12 -0
  62. package/dist-embed-sighting-editor/SightingElement-FJvhqoCj.js +693 -0
  63. package/dist-embed-sighting-editor/SightingLabels_en-oIpytoq_.js +1 -0
  64. package/dist-embed-sighting-editor/SightingLabels_es-DUh1CTXl.js +1 -0
  65. package/dist-embed-sighting-editor/SightingLabels_fr-D69zENbW.js +1 -0
  66. package/dist-embed-sighting-editor/SightingLabels_it-COLZ2Qth.js +1 -0
  67. package/dist-embed-sighting-editor/SightingMessages_en-CYzanHjT.js +1 -0
  68. package/dist-embed-sighting-editor/SightingMessages_es-hjvESK6f.js +1 -0
  69. package/dist-embed-sighting-editor/SightingMessages_fr-BtfWbIP7.js +1 -0
  70. package/dist-embed-sighting-editor/SightingMessages_it-Bqm4pewZ.js +1 -0
  71. package/dist-embed-sighting-editor/{SkyLantern-De_MXfQz.js → SkyLantern-B7UlFgmB.js} +1 -1
  72. package/dist-embed-sighting-editor/{TraceSystem-Ba5H90GB.js → TraceSystem-vZF4B5EC.js} +2 -2
  73. package/dist-embed-sighting-editor/{UfoMessages_en-FAvzKxmR.js → UfoMessages_en-JeMK-39o.js} +1 -1
  74. package/dist-embed-sighting-editor/VideoButton-Kxg7pF1Y.js +1 -0
  75. package/dist-embed-sighting-editor/{WaterSystem-Dpdw46hF.js → WaterSystem-DSWmZbiL.js} +2 -2
  76. package/dist-embed-sighting-editor/{interviewImport-CgWyTdKb.js → interviewImport-BlSMFEw_.js} +1 -1
  77. package/dist-embed-sighting-editor/interviewJson-CsMHIcZ-.js +8 -0
  78. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +439 -392
  79. package/dist-embed-sighting-editor/{surroundingsSources-YIawBCws.js → surroundingsSources-z7680fTA.js} +1 -1
  80. package/dist-embed-sighting-editor/{trafficRuntime-DwnTE9-7.js → trafficRuntime-C5BXL-G6.js} +1 -1
  81. package/dist-embed-ufoathome/Account-C4jhsVtN.js +1 -0
  82. package/dist-embed-ufoathome/AdsbLolArchiveProvider-886uuL_s.js +1 -0
  83. package/dist-embed-ufoathome/AssemblyAiTranscriptionProvider-o2kkPD5o.js +1 -0
  84. package/dist-embed-ufoathome/BallesterGuaspAssessor-BSKybYn0.js +1 -0
  85. package/dist-embed-ufoathome/BeamEditor-U2XQEG_6.js +30 -0
  86. package/dist-embed-ufoathome/BeamEditorMessages_en-DDvPWAdd.js +1 -0
  87. package/dist-embed-ufoathome/BeamEditorMessages_es-BhCkhUkN.js +1 -0
  88. package/dist-embed-ufoathome/BeamEditorMessages_fr-CtX6uP-x.js +1 -0
  89. package/dist-embed-ufoathome/BeamEditorMessages_it-DVweRQFi.js +1 -0
  90. package/dist-embed-ufoathome/BeamKindMessages_en-5RezNkyz.js +1 -0
  91. package/dist-embed-ufoathome/BeamKindMessages_es-B5vSWVjK.js +1 -0
  92. package/dist-embed-ufoathome/BeamKindMessages_fr--28-36OI.js +1 -0
  93. package/dist-embed-ufoathome/BeamKindMessages_it-X53Fuf2U.js +1 -0
  94. package/dist-embed-ufoathome/BeamParameterTexts_en-DZB75ouZ.js +1 -0
  95. package/dist-embed-ufoathome/BeamParameterTexts_es-AeZmsufG.js +1 -0
  96. package/dist-embed-ufoathome/BeamParameterTexts_fr-BHG3fW40.js +1 -0
  97. package/dist-embed-ufoathome/BeamParameterTexts_it-CPwmQX-g.js +1 -0
  98. package/dist-embed-ufoathome/BeamSystem-eYdKPRQZ.js +1 -0
  99. package/dist-embed-ufoathome/BirdEditor-6vr7bLHy.js +16 -0
  100. package/dist-embed-ufoathome/BirdEditorMessages_en-CN1OJud9.js +1 -0
  101. package/dist-embed-ufoathome/BirdEditorMessages_es-DDEnjRrz.js +1 -0
  102. package/dist-embed-ufoathome/BirdEditorMessages_fr-hL72V8wm.js +1 -0
  103. package/dist-embed-ufoathome/BirdEditorMessages_it-BmLyiPYp.js +1 -0
  104. package/dist-embed-ufoathome/BirdFlock-ByBkJV35.js +1 -0
  105. package/dist-embed-ufoathome/BirdKindMessages_en-c_-L7frF.js +1 -0
  106. package/dist-embed-ufoathome/BirdKindMessages_es-8Zo2t0o4.js +1 -0
  107. package/dist-embed-ufoathome/BirdKindMessages_fr-C1TuqqEj.js +1 -0
  108. package/dist-embed-ufoathome/BirdKindMessages_it-DQZcrCkf.js +1 -0
  109. package/dist-embed-ufoathome/BirdParameterTexts_en-C6FkYUww.js +1 -0
  110. package/dist-embed-ufoathome/BirdParameterTexts_es-T8JyeNlI.js +1 -0
  111. package/dist-embed-ufoathome/BirdParameterTexts_fr-BiTR-olu.js +1 -0
  112. package/dist-embed-ufoathome/BirdParameterTexts_it-oQY4DX6B.js +1 -0
  113. package/dist-embed-ufoathome/BodyEditor-CRlKW7yl.js +28 -0
  114. package/dist-embed-ufoathome/BodyEditorMessages_en-CckxSS1L.js +1 -0
  115. package/dist-embed-ufoathome/BodyEditorMessages_es-B8GlFFBo.js +1 -0
  116. package/dist-embed-ufoathome/BodyEditorMessages_fr-638ypdqf.js +1 -0
  117. package/dist-embed-ufoathome/BodyEditorMessages_it-SKpMkHFI.js +1 -0
  118. package/dist-embed-ufoathome/BodyParameterTexts_en-CKiFdpaz.js +1 -0
  119. package/dist-embed-ufoathome/BodyParameterTexts_es-DT9XO1Hc.js +1 -0
  120. package/dist-embed-ufoathome/BodyParameterTexts_fr-B5jLsE0g.js +1 -0
  121. package/dist-embed-ufoathome/BodyParameterTexts_it-iyJGx4Ta.js +1 -0
  122. package/dist-embed-ufoathome/BrowserWhisperProvider-Dn44ZE45.js +1 -0
  123. package/dist-embed-ufoathome/CaseEditorElement-Ds4yB5UC.js +3033 -0
  124. package/dist-embed-ufoathome/CaseEditorMessages_en-CoFukfwf.js +1 -0
  125. package/dist-embed-ufoathome/CaseEditorMessages_es-DZptbzB7.js +1 -0
  126. package/dist-embed-ufoathome/CaseEditorMessages_fr-DXl2GNmR.js +1 -0
  127. package/dist-embed-ufoathome/CaseEditorMessages_it-ss10VmRM.js +1 -0
  128. package/dist-embed-ufoathome/CaseElement-fKdvuMAp.js +100 -0
  129. package/dist-embed-ufoathome/CaseExportMessages_en-jHlu58Y7.js +1 -0
  130. package/dist-embed-ufoathome/CaseExportMessages_es-dCQQFgjq.js +1 -0
  131. package/dist-embed-ufoathome/CaseExportMessages_fr-sDfEgjWg.js +1 -0
  132. package/dist-embed-ufoathome/CaseExportMessages_it-BJaglZtP.js +1 -0
  133. package/dist-embed-ufoathome/CaseMessages_en-BbbbikHH.js +1 -0
  134. package/dist-embed-ufoathome/CaseMessages_es-AHBxl8Ka.js +1 -0
  135. package/dist-embed-ufoathome/CaseMessages_fr-CD33PQCH.js +1 -0
  136. package/dist-embed-ufoathome/CaseMessages_it-DyMACGSU.js +1 -0
  137. package/dist-embed-ufoathome/CaseReportExport-Dy1xmhTI.js +66 -0
  138. package/dist-embed-ufoathome/CaseReportTexts_en-DlN7p1pC.js +1 -0
  139. package/dist-embed-ufoathome/CaseReportTexts_es-CncAEaey.js +1 -0
  140. package/dist-embed-ufoathome/CaseReportTexts_fr-B5nP6RlP.js +1 -0
  141. package/dist-embed-ufoathome/CaseReportTexts_it-Dc-oPmXB.js +1 -0
  142. package/dist-embed-ufoathome/CaseTimeline-Dq1H2Ucy.js +142 -0
  143. package/dist-embed-ufoathome/ClaudeNarrativeTexts_en-CBLJZ7b6.js +1 -0
  144. package/dist-embed-ufoathome/ClaudeNarrativeTexts_es-BDV0GimU.js +1 -0
  145. package/dist-embed-ufoathome/ClaudeNarrativeTexts_fr-DiKzTF9T.js +1 -0
  146. package/dist-embed-ufoathome/ClaudeNarrativeTexts_it-DwxjRDVG.js +1 -0
  147. package/dist-embed-ufoathome/CloudEditorMessages_en-SmcRKW1O.js +1 -0
  148. package/dist-embed-ufoathome/CloudEditorMessages_es-DFCuS9Qg.js +1 -0
  149. package/dist-embed-ufoathome/CloudEditorMessages_fr-SvL-CR04.js +1 -0
  150. package/dist-embed-ufoathome/CloudEditorMessages_it-BvfiHWV9.js +1 -0
  151. package/dist-embed-ufoathome/CloudParameterTexts_en-NIa0gfgA.js +1 -0
  152. package/dist-embed-ufoathome/CloudParameterTexts_es-DXu4T30p.js +1 -0
  153. package/dist-embed-ufoathome/CloudParameterTexts_fr-Bv-jc2dq.js +1 -0
  154. package/dist-embed-ufoathome/CloudParameterTexts_it-C3RrkRwI.js +1 -0
  155. package/dist-embed-ufoathome/ContrailGrowth-DwHS8If9.js +1 -0
  156. package/dist-embed-ufoathome/ContrailSystem-pwF1XPex.js +1 -0
  157. package/dist-embed-ufoathome/ControlPasses-ApTdQK9r.js +29 -0
  158. package/dist-embed-ufoathome/CoverageAssessor-DFMo5umu.js +1 -0
  159. package/dist-embed-ufoathome/Decor-Dn-cvniW.js +1 -0
  160. package/dist-embed-ufoathome/DecorParameterTexts_en-idbdHsFG.js +1 -0
  161. package/dist-embed-ufoathome/DecorParameterTexts_es-CIkkLQc2.js +1 -0
  162. package/dist-embed-ufoathome/DecorParameterTexts_fr-D9GeuW_Y.js +1 -0
  163. package/dist-embed-ufoathome/DecorParameterTexts_it-v7TBrnsr.js +1 -0
  164. package/dist-embed-ufoathome/DecoyFlare-DUt1_LcW.js +1 -0
  165. package/dist-embed-ufoathome/DroneEditor-C3SH8yYq.js +16 -0
  166. package/dist-embed-ufoathome/DroneEditorMessages_en-BViHK30c.js +1 -0
  167. package/dist-embed-ufoathome/DroneEditorMessages_es-D6bhIOAa.js +1 -0
  168. package/dist-embed-ufoathome/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
  169. package/dist-embed-ufoathome/DroneEditorMessages_it-CYi-jmVN.js +1 -0
  170. package/dist-embed-ufoathome/DroneFlight-CGNIh9XS.js +1 -0
  171. package/dist-embed-ufoathome/DroneKindMessages_en-CLygXcsv.js +1 -0
  172. package/dist-embed-ufoathome/DroneKindMessages_es-B9XFRYnQ.js +1 -0
  173. package/dist-embed-ufoathome/DroneKindMessages_fr-CAX15_pk.js +1 -0
  174. package/dist-embed-ufoathome/DroneKindMessages_it-CSGsCaJQ.js +1 -0
  175. package/dist-embed-ufoathome/DroneParameterTexts_en-sL1dR2RG.js +1 -0
  176. package/dist-embed-ufoathome/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
  177. package/dist-embed-ufoathome/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
  178. package/dist-embed-ufoathome/DroneParameterTexts_it-DfvWjvoc.js +1 -0
  179. package/dist-embed-ufoathome/FilmChrome-DYiyzoB_.js +1 -0
  180. package/dist-embed-ufoathome/FlareKindMessages_en-j3CY_TxX.js +1 -0
  181. package/dist-embed-ufoathome/FlareKindMessages_es-CZgrFIOO.js +1 -0
  182. package/dist-embed-ufoathome/FlareKindMessages_fr-B2MezoN2.js +1 -0
  183. package/dist-embed-ufoathome/FlareKindMessages_it-CmZmb3RP.js +1 -0
  184. package/dist-embed-ufoathome/Flightradar24Provider-BT0RC4qJ.js +1 -0
  185. package/dist-embed-ufoathome/GLTFLoader-DpXgTKpb.js +1 -0
  186. package/dist-embed-ufoathome/GenerativeKit-BmhvjjzB.js +9 -0
  187. package/dist-embed-ufoathome/GenerativeKitMessages-BwG7cWZX.js +1 -0
  188. package/dist-embed-ufoathome/GenerativeKitMessages_en-BY4B6yas.js +34 -0
  189. package/dist-embed-ufoathome/GenerativeKitMessages_es-_iYkoRhK.js +34 -0
  190. package/dist-embed-ufoathome/GenerativeKitMessages_fr-BY5yUJwK.js +34 -0
  191. package/dist-embed-ufoathome/GenerativeKitMessages_it-DAgB31P1.js +34 -0
  192. package/dist-embed-ufoathome/GeoExportTexts-3a51cuxQ.js +1 -0
  193. package/dist-embed-ufoathome/GeoExportTexts_en-Dq0fSJQp.js +1 -0
  194. package/dist-embed-ufoathome/GeoExportTexts_es-CoVHdOo0.js +1 -0
  195. package/dist-embed-ufoathome/GeoExportTexts_fr-DVAMpZIR.js +1 -0
  196. package/dist-embed-ufoathome/GeoExportTexts_it-Bh1uJBQp.js +1 -0
  197. package/dist-embed-ufoathome/GeoJsonExport-bpBmwqb7.js +2 -0
  198. package/dist-embed-ufoathome/GeoJsonImport-CIftC0ws.js +1 -0
  199. package/dist-embed-ufoathome/GeographicFigures-B0Bqeh10.js +1 -0
  200. package/dist-embed-ufoathome/GhostSearchView-Dlhj3xWa.js +1 -0
  201. package/dist-embed-ufoathome/HeadlightSystem-CMT7XiIH.js +34 -0
  202. package/dist-embed-ufoathome/HynekAssessor-qlHGyZnD.js +1 -0
  203. package/dist-embed-ufoathome/InterviewEditorElement-B33-sGHI.js +240 -0
  204. package/dist-embed-ufoathome/InterviewElement-CiZNhb70.js +31 -0
  205. package/dist-embed-ufoathome/InterviewMedia-CvAxC62V.js +1 -0
  206. package/dist-embed-ufoathome/InterviewMessages_en-ru7GkZlQ.js +1 -0
  207. package/dist-embed-ufoathome/InterviewMessages_es-DkJurNrG.js +1 -0
  208. package/dist-embed-ufoathome/InterviewMessages_fr-DAYgf8Ms.js +1 -0
  209. package/dist-embed-ufoathome/InterviewMessages_it-6lenkmSg.js +1 -0
  210. package/dist-embed-ufoathome/KmlExport-gFuPcL9A.js +19 -0
  211. package/dist-embed-ufoathome/KmlImport-BMAfiqoV.js +1 -0
  212. package/dist-embed-ufoathome/LanternEditor-BaRDgTw-.js +24 -0
  213. package/dist-embed-ufoathome/LanternEditorMessages_en-DaT3UNfD.js +1 -0
  214. package/dist-embed-ufoathome/LanternEditorMessages_es-TDV5lKeJ.js +1 -0
  215. package/dist-embed-ufoathome/LanternEditorMessages_fr-9mByTFMG.js +1 -0
  216. package/dist-embed-ufoathome/LanternEditorMessages_it-MRkJnDQp.js +1 -0
  217. package/dist-embed-ufoathome/LanternKindMessages_en-CQXdJ-k6.js +1 -0
  218. package/dist-embed-ufoathome/LanternKindMessages_es-BOO6kPjs.js +1 -0
  219. package/dist-embed-ufoathome/LanternKindMessages_fr-D7tQa_tQ.js +1 -0
  220. package/dist-embed-ufoathome/LanternKindMessages_it-B8J-29Mj.js +1 -0
  221. package/dist-embed-ufoathome/LanternParameterTexts_en-CcnGd8UH.js +1 -0
  222. package/dist-embed-ufoathome/LanternParameterTexts_es-CUTgNutZ.js +1 -0
  223. package/dist-embed-ufoathome/LanternParameterTexts_fr-P2JwYOUy.js +1 -0
  224. package/dist-embed-ufoathome/LanternParameterTexts_it-CzNnIUrX.js +1 -0
  225. package/dist-embed-ufoathome/LaserBeam-BKuiBaAN.js +1 -0
  226. package/dist-embed-ufoathome/LaunchEditor-CFsq327k.js +22 -0
  227. package/dist-embed-ufoathome/LaunchEditorMessages_en-BnzNAYW9.js +1 -0
  228. package/dist-embed-ufoathome/LaunchEditorMessages_es-BE0dEl7I.js +1 -0
  229. package/dist-embed-ufoathome/LaunchEditorMessages_fr-Ds_VOB8c.js +1 -0
  230. package/dist-embed-ufoathome/LaunchEditorMessages_it-DPQaR8HY.js +1 -0
  231. package/dist-embed-ufoathome/LaunchKindMessages_en-Batvnyw3.js +1 -0
  232. package/dist-embed-ufoathome/LaunchKindMessages_es-KYyQ9gbu.js +1 -0
  233. package/dist-embed-ufoathome/LaunchKindMessages_fr-CoojboIk.js +1 -0
  234. package/dist-embed-ufoathome/LaunchKindMessages_it-9HA3cjgP.js +1 -0
  235. package/dist-embed-ufoathome/LaunchParameterTexts_en-DvrCwbDM.js +1 -0
  236. package/dist-embed-ufoathome/LaunchParameterTexts_es--RUAegVp.js +1 -0
  237. package/dist-embed-ufoathome/LaunchParameterTexts_fr-Bh_1zVzy.js +1 -0
  238. package/dist-embed-ufoathome/LaunchParameterTexts_it-CWDx9nJy.js +1 -0
  239. package/dist-embed-ufoathome/LaunchPlume-p7V7Yg6y.js +1 -0
  240. package/dist-embed-ufoathome/LaunchSimulation-3vTsM_A7.js +1 -0
  241. package/dist-embed-ufoathome/ModelSource-Cd7ByLN1.js +1 -0
  242. package/dist-embed-ufoathome/ModelThumbnails-CASGbavJ.js +1 -0
  243. package/dist-embed-ufoathome/ModelViewer-DEaj6_6R.js +1 -0
  244. package/dist-embed-ufoathome/ModuleConformance-CSg3Ac74.js +2 -0
  245. package/dist-embed-ufoathome/ModuleSession-BaaLmhnz.js +3 -0
  246. package/dist-embed-ufoathome/ModuleThree-DF_JfVBK.js +1 -0
  247. package/dist-embed-ufoathome/ModulesPanelElement-BqF6eK1X.js +15 -0
  248. package/dist-embed-ufoathome/ModulesPanelMessages_en-DuwrY3Pm.js +1 -0
  249. package/dist-embed-ufoathome/ModulesPanelMessages_es-Bq5X-XuT.js +1 -0
  250. package/dist-embed-ufoathome/ModulesPanelMessages_fr-B8cSDc6o.js +1 -0
  251. package/dist-embed-ufoathome/ModulesPanelMessages_it-BdC626aJ.js +1 -0
  252. package/dist-embed-ufoathome/NearestApproach-DnGPayAo.js +1 -0
  253. package/dist-embed-ufoathome/Obstacles-v9SkfBD7.js +1 -0
  254. package/dist-embed-ufoathome/OffThreadTracer-ByPLWaYU.js +6 -0
  255. package/dist-embed-ufoathome/OpenAiTranscriptionProvider-DDW446tK.js +1 -0
  256. package/dist-embed-ufoathome/PanoramaxPictures-CELY3Ecc.js +1 -0
  257. package/dist-embed-ufoathome/ParameterForm-DfpJQGku.js +91 -0
  258. package/dist-embed-ufoathome/PerceptionMessages_en-B2O6DR64.js +1 -0
  259. package/dist-embed-ufoathome/PerceptionMessages_es-BmkP6OqD.js +1 -0
  260. package/dist-embed-ufoathome/PerceptionMessages_fr-B59TnGBC.js +1 -0
  261. package/dist-embed-ufoathome/PerceptionMessages_it-DPlxRmxu.js +1 -0
  262. package/dist-embed-ufoathome/PictureFetch-C3wgf1ZV.js +1 -0
  263. package/dist-embed-ufoathome/PictureRegistration-BFn75haQ.js +1 -0
  264. package/dist-embed-ufoathome/PoherAssessor-DRTvhhZp.js +1 -0
  265. package/dist-embed-ufoathome/RailwaySystem-CUJHpW5y.js +41 -0
  266. package/dist-embed-ufoathome/ReadingCheckTexts_en-eq6teExJ.js +1 -0
  267. package/dist-embed-ufoathome/ReadingCheckTexts_es-CR_JJZMV.js +1 -0
  268. package/dist-embed-ufoathome/ReadingCheckTexts_fr-pcDleIvY.js +1 -0
  269. package/dist-embed-ufoathome/ReadingCheckTexts_it-MFKeoXnq.js +1 -0
  270. package/dist-embed-ufoathome/ReadingSensitivityMessages_en-ChQHFyxb.js +1 -0
  271. package/dist-embed-ufoathome/ReadingSensitivityMessages_es-BbFqHsvR.js +1 -0
  272. package/dist-embed-ufoathome/ReadingSensitivityMessages_fr-Dl4a8udu.js +1 -0
  273. package/dist-embed-ufoathome/ReadingSensitivityMessages_it-CwiJfUo_.js +1 -0
  274. package/dist-embed-ufoathome/RecordingIssue-BlWT8Xsu.js +3 -0
  275. package/dist-embed-ufoathome/ReentryArchive-CeXHrU7L.js +1 -0
  276. package/dist-embed-ufoathome/ReentryEditor-DynYe51Y.js +28 -0
  277. package/dist-embed-ufoathome/ReentryEditorMessages_en-BmTZMr-m.js +1 -0
  278. package/dist-embed-ufoathome/ReentryEditorMessages_es-edid__Jo.js +1 -0
  279. package/dist-embed-ufoathome/ReentryEditorMessages_fr-DHbcY0tN.js +1 -0
  280. package/dist-embed-ufoathome/ReentryEditorMessages_it-CIzkIU4G.js +1 -0
  281. package/dist-embed-ufoathome/ReentryKindMessages_en-BGZgya17.js +1 -0
  282. package/dist-embed-ufoathome/ReentryKindMessages_es--UxzPNfj.js +1 -0
  283. package/dist-embed-ufoathome/ReentryKindMessages_fr-7mer-cdj.js +1 -0
  284. package/dist-embed-ufoathome/ReentryKindMessages_it-BBVQXE1M.js +1 -0
  285. package/dist-embed-ufoathome/ReentryParameterTexts_en-5BOfwCsS.js +1 -0
  286. package/dist-embed-ufoathome/ReentryParameterTexts_es-ze1-U4jB.js +1 -0
  287. package/dist-embed-ufoathome/ReentryParameterTexts_fr-BgUJROXF.js +1 -0
  288. package/dist-embed-ufoathome/ReentryParameterTexts_it-MTb9Vuq0.js +1 -0
  289. package/dist-embed-ufoathome/ReentrySimulation-BTcyhCCG.js +1 -0
  290. package/dist-embed-ufoathome/ReentryTypeNames_en-CBu890Bd.js +1 -0
  291. package/dist-embed-ufoathome/ReentryTypeNames_es-_LnketjJ.js +1 -0
  292. package/dist-embed-ufoathome/ReentryTypeNames_fr-BXq89mrz.js +1 -0
  293. package/dist-embed-ufoathome/ReentryTypeNames_it-Yfq-TDip.js +1 -0
  294. package/dist-embed-ufoathome/ReferenceSystem-WdAT5UCN.js +1 -0
  295. package/dist-embed-ufoathome/ReferenceTimeline-2kBldQeG.js +1 -0
  296. package/dist-embed-ufoathome/RoadMarkings-BsN3rh0W.js +1 -0
  297. package/dist-embed-ufoathome/SaidPosition-CWiVNaNW.js +4 -0
  298. package/dist-embed-ufoathome/SatellitePasses-Pfro2-0Z.js +1 -0
  299. package/dist-embed-ufoathome/SceneNames_en-7OZ7peGc.js +1 -0
  300. package/dist-embed-ufoathome/SceneNames_es-P5-Mavdi.js +1 -0
  301. package/dist-embed-ufoathome/SceneNames_fr-qzw0QzD0.js +1 -0
  302. package/dist-embed-ufoathome/SceneNames_it-Sqf8JFOd.js +1 -0
  303. package/dist-embed-ufoathome/ShareCodeEditor-DyEYu_9d.js +13 -0
  304. package/dist-embed-ufoathome/ShareDialogElement-C3HL-Smq.js +9222 -0
  305. package/dist-embed-ufoathome/ShareMessages_en-B43x8LgJ.js +1 -0
  306. package/dist-embed-ufoathome/ShareMessages_es-DZCJojSc.js +1 -0
  307. package/dist-embed-ufoathome/ShareMessages_fr-CzZyVbbX.js +1 -0
  308. package/dist-embed-ufoathome/ShareMessages_it-C_Z6eDQK.js +1 -0
  309. package/dist-embed-ufoathome/Sighting-CBpJpdm9.js +1 -0
  310. package/dist-embed-ufoathome/SightingEditorMessages_en-CTQYcybj.js +12 -0
  311. package/dist-embed-ufoathome/SightingEditorMessages_es-D-ASD5a3.js +12 -0
  312. package/dist-embed-ufoathome/SightingEditorMessages_fr-DjUByAq4.js +12 -0
  313. package/dist-embed-ufoathome/SightingEditorMessages_it-Eat0U-4p.js +12 -0
  314. package/dist-embed-ufoathome/SightingElement-CexCUTjH.js +693 -0
  315. package/dist-embed-ufoathome/SightingFileEditor-Cllslp2u.js +8 -0
  316. package/dist-embed-ufoathome/SightingLabels_en-oIpytoq_.js +1 -0
  317. package/dist-embed-ufoathome/SightingLabels_es-DUh1CTXl.js +1 -0
  318. package/dist-embed-ufoathome/SightingLabels_fr-D69zENbW.js +1 -0
  319. package/dist-embed-ufoathome/SightingLabels_it-COLZ2Qth.js +1 -0
  320. package/dist-embed-ufoathome/SightingMessages_en-CYzanHjT.js +1 -0
  321. package/dist-embed-ufoathome/SightingMessages_es-hjvESK6f.js +1 -0
  322. package/dist-embed-ufoathome/SightingMessages_fr-BtfWbIP7.js +1 -0
  323. package/dist-embed-ufoathome/SightingMessages_it-Bqm4pewZ.js +1 -0
  324. package/dist-embed-ufoathome/SkyEventEditorStyle-CvY_AhbI.js +1 -0
  325. package/dist-embed-ufoathome/SkyLantern-DJT_Ibzh.js +1 -0
  326. package/dist-embed-ufoathome/TagNames_es-BfnMpc3D.js +1 -0
  327. package/dist-embed-ufoathome/TagNames_fr-Dnqq6HQ5.js +1 -0
  328. package/dist-embed-ufoathome/TagNames_it-n6E4EGYO.js +1 -0
  329. package/dist-embed-ufoathome/TimelineTracks-X_GEZi12.js +35 -0
  330. package/dist-embed-ufoathome/TraceImport-CntRHXoJ.js +2 -0
  331. package/dist-embed-ufoathome/TraceSystem-Bm9JDfkW.js +393 -0
  332. package/dist-embed-ufoathome/TranscriptionAudio-C_xvRUv2.js +5 -0
  333. package/dist-embed-ufoathome/TranscriptionError-D_TCbYbt.js +1 -0
  334. package/dist-embed-ufoathome/UfoAtHomeMessages_en-dlx_C679.js +1 -0
  335. package/dist-embed-ufoathome/UfoAtHomeMessages_es-uLOvtAD0.js +1 -0
  336. package/dist-embed-ufoathome/UfoAtHomeMessages_fr-LR76-eHS.js +1 -0
  337. package/dist-embed-ufoathome/UfoAtHomeMessages_it-CQl4uTnG.js +1 -0
  338. package/dist-embed-ufoathome/UfoMessages_en-D5OYWJ3K.js +1 -0
  339. package/dist-embed-ufoathome/UfoMessages_es-CO-v8Jl6.js +1 -0
  340. package/dist-embed-ufoathome/UfoMessages_fr-CGkQBn5r.js +1 -0
  341. package/dist-embed-ufoathome/UfoMessages_it-BScqxIaH.js +1 -0
  342. package/dist-embed-ufoathome/VideoButton-CH3rw9kX.js +1 -0
  343. package/dist-embed-ufoathome/VideoExport-B8ZhHNnd.js +169 -0
  344. package/dist-embed-ufoathome/VisualAids-DI-hEL46.js +1 -0
  345. package/dist-embed-ufoathome/WaterSystem-CraSRAgB.js +19 -0
  346. package/dist-embed-ufoathome/browser-CltifEM0.js +1 -0
  347. package/dist-embed-ufoathome/caseSchema-ChUB1-9j.js +1 -0
  348. package/dist-embed-ufoathome/index-C8cdeM8E.js +11 -0
  349. package/dist-embed-ufoathome/index-DqGmxMZD.js +42 -0
  350. package/dist-embed-ufoathome/interviewImport-ym5iXO4Z.js +4 -0
  351. package/{dist-embed-sighting-editor/interviewJson-iURHP4Zk.js → dist-embed-ufoathome/interviewJson-D-i14LTf.js} +1 -1
  352. package/dist-embed-ufoathome/interviewSchema-Dk0AWHwc.js +1 -0
  353. package/dist-embed-ufoathome/logo-h2-w4Mwu.png +0 -0
  354. package/dist-embed-ufoathome/lunar-relief.bin-ByThqxUn.gz +0 -0
  355. package/dist-embed-ufoathome/node.browser-AK49Qif5.js +1 -0
  356. package/dist-embed-ufoathome/node.browser-HEqoqodz.js +1 -0
  357. package/dist-embed-ufoathome/rain-BvWZrB9h.ogg +0 -0
  358. package/dist-embed-ufoathome/rr0-ufoathome.mjs +159 -0
  359. package/dist-embed-ufoathome/sightingSchema-CgwoRMl-.js +1 -0
  360. package/dist-embed-ufoathome/stars-mag7.5-9-BLV2tFmZ.bin +0 -0
  361. package/dist-embed-ufoathome/stars-mag7.5-B43R6Wvg.bin +0 -0
  362. package/dist-embed-ufoathome/surroundingsSources-kPwp7ewe.js +1 -0
  363. package/dist-embed-ufoathome/thunder-DA48qs_v.wav +0 -0
  364. package/dist-embed-ufoathome/trafficRuntime-DM6gQGDZ.js +2 -0
  365. package/dist-embed-ufoathome/upperAirSources-BGuLpdwu.js +1 -0
  366. package/dist-embed-ufoathome/wind-BjklexY7.ogg +0 -0
  367. package/package.json +9 -6
  368. package/dist-embed-sighting-editor/BirdEditor-ESUliJEN.js +0 -16
  369. package/dist-embed-sighting-editor/DroneEditor-DDaJO8FS.js +0 -16
  370. package/dist-embed-sighting-editor/GLTFLoader-DdijxzcI.js +0 -1
  371. package/dist-embed-sighting-editor/GeographicFigures-DC6Tw3ja.js +0 -1
  372. package/dist-embed-sighting-editor/InterviewEditorElement-D-UDHU0L.js +0 -270
  373. package/dist-embed-sighting-editor/LanternEditor-DDcI5Kv1.js +0 -24
  374. package/dist-embed-sighting-editor/LaunchEditor-Pkk0K648.js +0 -22
  375. package/dist-embed-sighting-editor/ModuleThree-DSghL4fp.js +0 -1
  376. package/dist-embed-sighting-editor/PictureRegistration-CbfytwCX.js +0 -1
  377. package/dist-embed-sighting-editor/ReentryEditor-NE8z5aZT.js +0 -28
  378. package/dist-embed-sighting-editor/SightingEditorMessages_en-DSPvgYFi.js +0 -12
  379. package/dist-embed-sighting-editor/SightingEditorMessages_es-Bl3DipHr.js +0 -12
  380. package/dist-embed-sighting-editor/SightingEditorMessages_fr-BTmWQX0n.js +0 -12
  381. package/dist-embed-sighting-editor/SightingEditorMessages_it-lzbDsHjx.js +0 -12
  382. package/dist-embed-sighting-editor/VideoButton-CqCZ65oK.js +0 -1
@@ -0,0 +1,3033 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DqGmxMZD.js","./rr0-ufoathome.mjs","./ModelThumbnails-CASGbavJ.js","./ShareDialogElement-C3HL-Smq.js","./SaidPosition-CWiVNaNW.js","./Sighting-CBpJpdm9.js","./VisualAids-DI-hEL46.js","./Decor-Dn-cvniW.js","./RecordingIssue-BlWT8Xsu.js","./Obstacles-v9SkfBD7.js","./ModelSource-Cd7ByLN1.js","./ModelViewer-DEaj6_6R.js","./SightingFileEditor-Cllslp2u.js","./index-C8cdeM8E.js","./sightingSchema-CgwoRMl-.js","./surroundingsSources-kPwp7ewe.js","./ModuleSession-BaaLmhnz.js","./ModulesPanelElement-BqF6eK1X.js","./ParameterForm-DfpJQGku.js","./CaseTimeline-Dq1H2Ucy.js","./TimelineTracks-X_GEZi12.js","./ReentryArchive-CeXHrU7L.js","./ReferenceTimeline-2kBldQeG.js","./upperAirSources-BGuLpdwu.js","./Account-C4jhsVtN.js","./PictureRegistration-BFn75haQ.js","./TraceImport-CntRHXoJ.js","./GeoExportTexts-3a51cuxQ.js","./KmlExport-gFuPcL9A.js","./GeographicFigures-B0Bqeh10.js","./GeoJsonExport-bpBmwqb7.js","./BodyEditor-CRlKW7yl.js","./GhostSearchView-Dlhj3xWa.js","./PictureFetch-C3wgf1ZV.js","./interviewJson-D-i14LTf.js","./InterviewEditorElement-B33-sGHI.js","./InterviewMedia-CvAxC62V.js","./InterviewElement-CiZNhb70.js"])))=>i.map(i=>d[i]);
2
+ import{C as ie,F as He,H as Ne,M as $e,_ as M,d as _s,P as li,e as de,f as Je,g as F,h as J,i as U,r as Us,I as ki,s as di,U as hi,S as Ye,O as _e,j as Ct,k as Hs,m as $s,n as Mt,o as Lt,p as ws,b as Ws,c as js,q as pt,t as Gs,u as Ks,v as Vs,R as qs,w as Zs}from"./rr0-ufoathome.mjs";import{P as st,I as D,g as ys,S as ht,l as Ys}from"./SaidPosition-CWiVNaNW.js";import{E as ge,P as nt,a as Ot,r as bi,B as Xe,N as Rt,A as ci,b as Es,W as Fe,c as Si}from"./ParameterForm-DfpJQGku.js";import{C as Pe,b as Js,I as Xs,a as Qs,R as en}from"./CaseTimeline-Dq1H2Ucy.js";import{H as Se,E as rt,k as xi,l as De,W as Q,s as fe,m as K,n as tn,o as Ii,p as jt,q as sn,t as Gt,u as Ti,v as ce,w as V,x as ui,y as Mi,D as ks,a as Ss,z as Kt,F as nn,Z as rn,N as ue,G as Ze,I as Li,J as Di,K as on,L as Ie,Q as xs,U as Dt,V as Ai,X as z,Y as ot,_ as at,$ as Ci,a0 as Oi,a1 as Ri,a2 as an,a3 as ln,a4 as Pi,a5 as le,a6 as pi,a7 as Is,a8 as Ts,a9 as dn,aa as Vt,b as hn,ab as cn,ac as un,ad as pn,ae as mn,af as gn,ag as Ce,ah as mt,A as mi,ai as gt,aj as fn,ak as bn,al as vn,am as Bi,an as qt,ao as Fi,ap as Ni,aq as ae,P as Zt,ar as Yt,as as Ge,i as wn,at as yn,au as ft,av as En,aw as zi,ax as _i,ay as Ui,az as Hi,aA as et,g as $i,e as Wi,aB as kn,aC as ji,aD as Gi,aE as Jt,aF as Xt,aG as Ki,aH as Vi,aI as Sn,aJ as Ke,aK as qi,aL as bt,aM as Qt,f as Zi,aN as ei,aO as Y,aP as xn,aQ as Yi,r as In,S as Ms,c as Tn,d as Ji,B as Mn,h as Ln,R as Dn}from"./ShareDialogElement-C3HL-Smq.js";import{K as An,r as At,a as gi,b as ne,c as X,A as me,m as Ls,d as Cn,e as On,D as ve,s as Pt,I as we,S as Rn,f as Pn,g as Bn,h as Fn,i as Xi,j as Nn,k as zn,p as _n}from"./Sighting-CBpJpdm9.js";import{T as vi}from"./TimelineTracks-X_GEZi12.js";import{H as Un,o as Hn,D as Ds,h as $n,d as As,a as Wn,b as Qi,r as es,c as ts}from"./Decor-Dn-cvniW.js";import{R as jn}from"./ReentryArchive-CeXHrU7L.js";import{R as Oe}from"./ReferenceTimeline-2kBldQeG.js";import{U as Gn}from"./upperAirSources-BGuLpdwu.js";import{S as Kn}from"./Account-C4jhsVtN.js";class re{constructor(e,t){this.json=e,this.url=t,this.tracks=(e.events??[]).filter(i=>i.eventType===ie.SIGHTING_EVENT&&typeof i.url=="string"&&i.url!=="").map(i=>({event:i,url:new URL(i.url,t).href,kind:i.interpretationOf===void 0?"observer":"reading"}))}tracks;caseChanged=!1;transcripts=new Map;static around(e,t,i,s,n){const r=(e.observer?.id??e.id??"observation").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"observation",o={id:e.id??"case",...t!==void 0?{time:t}:{},events:[{type:"event",eventType:ie.SIGHTING_EVENT,...t!==void 0?{time:t}:{},...i!==void 0?{title:i}:{},url:`observer-${r}.json`}]},l=new re(o,new URL("case.json",n).href),a=l.tracks[0];return a.recording=e,a.base={url:s},a.event.id=l.proposedId(a),l.caseChanged=!0,l}accountOf(e){if(e.kind!=="reading")return;const t=[e.event.interpretationOf].flat(),i=this.tracks.filter(s=>s.kind==="observer");return i.find(s=>s.event.id!==void 0&&t.includes(s.event.id))??i.find(s=>s.recording?.id!==void 0&&t.includes(s.recording.id))}get interviews(){return(this.json.events??[]).filter(e=>e.eventType===ie.INTERVIEW_EVENT)}intervieweeOf(e){return this.intervieweesOf(e)[0]}intervieweesOf(e){const t=this.tracks.filter(i=>i.kind==="observer");return[e.interviewOf].flat().filter(i=>typeof i=="string").flatMap(i=>{const s=t.find(n=>n.event.id===i)??t.find(n=>n.recording?.id===i);return s?[s]:[]})}addInterview(e,t,i,s,n){const r=this.eventIds(),o=e?e.event.id??this.proposedId(e):"case";let l=1;for(;r.has(`interview-${o}-${l}`);)l++;const a={type:"event",eventType:ie.INTERVIEW_EVENT,id:`interview-${o}-${l}`,...e?{interviewOf:this.ensureId(e)}:{},time:t,...n!==void 0?{medium:n}:{},...s!==void 0&&s.length>0?{by:s}:{},...i!==void 0?{title:i}:{}};return this.json.events=[...this.json.events??[],a],this.caseChanged=!0,a}transcriptText(e){return this.transcripts.get(e)?.text}keepTranscript(e,t){this.transcripts.set(e,{text:t,loaded:this.transcripts.get(e)?.loaded})}transcriptChanged(e){return e.loaded!==e.text}deleteInterview(e){return this.interviews.includes(e)?(this.json.events=(this.json.events??[]).filter(t=>t!==e),this.transcripts.delete(e),this.caseChanged=!0,!0):!1}static sealed(e){return e.sealed===!0}seal(e,t){t?e.event.sealed=!0:delete e.event.sealed,this.caseChanged=!0}clone(e,t){if(!e.recording)return;const i=e.kind==="reading"?this.accountOf(e):void 0;if(e.kind==="reading"&&!i)return;const s=t??e.event.title;return this.addObservation(structuredClone(e.recording),e.event.time,s,i?{account:i,by:e.event.by}:void 0)}keep(e,t,i=!1){!i&&re.sealed(e.event)||(t=He.recording(t),e.recording=t,i&&(e.loaded=JSON.stringify(t)),e.kind==="reading"&&t.interpretation?.title!==void 0&&(e.event.title=t.interpretation.title))}replaceJson(e){const i=(e.events??[]).filter(n=>n.eventType===ie.SIGHTING_EVENT&&typeof n.url=="string"&&n.url!=="").map(n=>{const r=new URL(n.url,this.url).href,o=n.interpretationOf===void 0?"observer":"reading",l=this.tracks.find(a=>a.url===r);return l?(l.event=n,l.kind=o,l):{event:n,url:r,kind:o}});this.tracks.splice(0,this.tracks.length,...i);const s=new Map;for(const[n,r]of this.transcripts){const o=(e.events??[]).find(l=>l.eventType===ie.INTERVIEW_EVENT&&(n.id!==void 0&&l.id===n.id||n.url!==void 0&&l.url===n.url));o&&s.set(o,r)}this.transcripts.clear();for(const[n,r]of s)this.transcripts.set(n,r);this.json=e,this.caseChanged=!0}touch(){this.caseChanged=!0}get dirty(){return this.caseChanged||this.tracks.some(e=>this.changed(e))||[...this.transcripts.values()].some(e=>this.transcriptChanged(e))}markExported(e){if(this.caseChanged=!1,!!e){for(const t of this.tracks)t.recording&&(t.loaded=JSON.stringify(t.recording));for(const t of this.transcripts.values())t.loaded=t.text}}changed(e){return e.recording!==void 0&&(e.loaded===void 0||JSON.stringify(e.recording)!==e.loaded)}static ID_PATTERN=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;eventIds(e){return new Set((this.json.events??[]).filter(t=>t!==e?.event).map(t=>t.id).filter(t=>t!==void 0))}proposedId(e){const t=o=>(o??"").toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),i=typeof e.event.title=="string"?e.event.title:void 0,s=t(e.recording?.observer?.lastName)||t(e.recording?.observer?.id)||t(i),n=this.eventIds(e);if(s!==""){let o=s;for(let l=2;n.has(o);l++)o=`${s}-${l}`;return o}let r=1;for(;n.has(`sighting-${r}`);)r++;return`sighting-${r}`}ensureId(e){return e.event.id===void 0&&(e.event.id=this.proposedId(e),this.caseChanged=!0),e.event.id}setId(e,t){const i=e.event.id,s=o=>o===i||o===e.recording?.id,n=(this.json.events??[]).filter(o=>o.eventType===ie.SIGHTING_EVENT&&o.interpretationOf!==void 0&&[o.interpretationOf].flat().some(l=>l!==void 0&&s(l))),r=this.interviews.filter(o=>[o.interviewOf].flat().some(l=>l!==void 0&&s(l)));if(t==="")return i===void 0?"ok":n.length>0||r.length>0?"empty":(delete e.event.id,this.caseChanged=!0,"ok");if(!re.ID_PATTERN.test(t))return"invalid";if(this.eventIds(e).has(t))return"taken";if(t===i)return"ok";for(const o of n){const l=[o.interpretationOf].flat().map(a=>s(a)?t:a);o.interpretationOf=Array.isArray(o.interpretationOf)?l:l[0]}for(const o of r){const l=[o.interviewOf].flat().map(a=>a!==void 0&&s(a)?t:a);o.interviewOf=Array.isArray(o.interviewOf)?l:l[0]}return e.event.id=t,this.caseChanged=!0,"ok"}problems(){return ie.problems(this.json,this.tracks.map(e=>e.recording?.id).filter(e=>e!==void 0))}addReading(e,t,i,s){const n=e.recording;if(!n)throw new Error("A reading is added to an account that has been loaded");const r=e.event.url.replace(/^.*\//,"").replace(/^observer-/,"").replace(/\.json$/,""),o=new Set(this.tracks.map(A=>A.event.url)),l=new Set(this.tracks.map(A=>A.recording?.id));let a=this.tracks.filter(A=>A.kind==="reading").length+1;for(;o.has(`interpretation-${r}-${a}.json`)||l.has(`${n.id??r}-interpretation-${a}`);)a++;const d=`interpretation-${r}-${a}.json`,h=e.event.url.includes("/")?e.event.url.replace(/[^/]*$/,""):"",{id:c,version:u,observer:p,account:m,description:f,sources:g,tags:b,timeline:v,milestones:I,interpretation:S,...w}=structuredClone(n),x={version:4,id:`${n.id??r}-interpretation-${a}`,...w,tags:["interpretation"],timeline:{keyframes:[],order:[],groups:[]},interpretation:{...i!==void 0?{title:i}:{},bodies:[]}},C={type:"event",eventType:"sighting",interpretationOf:this.ensureId(e),time:t,...s!==void 0&&s.length>0?{by:s}:{},...i!==void 0?{title:i}:{},url:h+d};this.json.events=[...this.json.events??[],C],this.caseChanged=!0;const B={event:C,url:new URL(C.url,this.url).href,kind:"reading",recording:x};return this.tracks.push(B),B}idsOf(e){return[e.event.id,e.recording?.id].filter(t=>t!==void 0)}readingsOf(e){const t=this.idsOf(e);return this.tracks.filter(i=>i.kind==="reading"&&[i.event.interpretationOf].flat().some(s=>s!==void 0&&t.includes(s)))}addObservation(e,t,i,s){const n=new Set(this.tracks.map(m=>m.event.url)),r=new Set(this.tracks.map(m=>m.recording?.id)),o=(e.id??"observation").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"observation",l=s?"interpretation":"observer";let a=`${l}-${o}.json`,d=e.id??o;for(let m=2;n.has(a)||r.has(d);m++)a=`${l}-${o}-${m}.json`,d=`${e.id??o}-${m}`;const h={...e,id:d},c=this.tracks[0]?.event.url?.includes("/")?this.tracks[0].event.url.replace(/[^/]*$/,""):"",u={type:"event",eventType:"sighting",...s?{interpretationOf:this.ensureId(s.account)}:{},...t!==void 0?{time:t}:{},...s?.by&&s.by.length>0?{by:s.by}:{},...i!==void 0?{title:i}:{},url:c+a};this.json.events=[...this.json.events??[],u],this.caseChanged=!0;const p={event:u,url:new URL(u.url,this.url).href,kind:s?"reading":"observer",recording:h};return this.tracks.push(p),s||(u.id=this.proposedId(p)),p}deleteObservation(e){if(e.kind!=="observer")return{deleted:!1,readings:0};if(re.sealed(e.event))return{deleted:!1,readings:0};const t=this.readingsOf(e).length;if(t>0)return{deleted:!1,readings:t};const i=this.tracks.indexOf(e);return i<0?{deleted:!1,readings:0}:(this.tracks.splice(i,1),this.json.events=(this.json.events??[]).filter(s=>s!==e.event),this.caseChanged=!0,{deleted:!0})}deleteReading(e){if(e.kind!=="reading"||re.sealed(e.event))return!1;const t=this.tracks.indexOf(e);return t<0?!1:(this.tracks.splice(t,1),this.json.events=(this.json.events??[]).filter(i=>i!==e.event),this.caseChanged=!0,!0)}files(e=!0,t=!1){const i=this.url.replace(/[^/]*$/,""),s=l=>l.startsWith(i)?l.slice(i.length):l,n=this.tracks.filter(l=>e&&l.recording!==void 0&&(t||this.changed(l))).map(l=>({path:s(l.url),content:JSON.stringify(l.recording,null,2)+`
3
+ `})),r=decodeURIComponent(this.url.replace(/[?#].*$/,"").replace(/^.*\//,""))||"case.json",o=[...this.transcripts].filter(([l,a])=>e&&l.url!==void 0&&(t||this.transcriptChanged(a))).map(([l,a])=>({path:s(new URL(l.url,this.url).href),content:a.text}));return[{path:r,content:JSON.stringify(this.json,null,2)+`
4
+ `},...n,...o]}}const Bt="rr0-date-input",Vn=`
5
+ rr0-date-input { position: relative; display: inline-flex; align-items: center; gap: .3em; }
6
+ rr0-date-input .edtf-field { position: relative; display: inline-flex; align-items: center; }
7
+ /* As wide as what it says, a date, a time and its doubt (~) at least, with room for the (?) at its end: narrower, the doubt was cut off. */
8
+ rr0-date-input .edtf-field input[type="text"] { padding-right: 2.1em; field-sizing: content; width: auto; min-width: calc(18ch + 3.2em); }
9
+ rr0-date-input .edtf-help { position: absolute; right: .6em; top: 50%; transform: translateY(-50%); box-sizing: border-box; width: 1.2em; height: 1.2em; min-height: 0; min-width: 0; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: none; color: inherit; font-size: .75em; line-height: 1; cursor: help; opacity: .7; }
10
+ rr0-date-input .edtf-helppop { position: absolute; left: 0; bottom: calc(100% + .35em); z-index: 5; max-width: 26em; padding: .35em .6em; border-radius: 4px; background: rgba(0, 0, 0, .88); color: #fff; font-size: .8rem; line-height: 1.35; white-space: normal; pointer-events: none; }
11
+ rr0-date-input .edtf-helppop { pointer-events: auto; min-width: 16em; }
12
+ rr0-date-input .edtf-helppop p { margin: 0 0 .3em; font-weight: 600; }
13
+ rr0-date-input .edtf-helppop ul { margin: 0; padding-left: 1.1em; }
14
+ /* What says how the date is said (precise, imprecise) reads as part of the label: the same font, a link's underline and nothing of a button, and
15
+ it comes before the field, so that a date reads "label, how it is said, field". It stays a button, for the keyboard and for what reads the page. */
16
+ rr0-date-input .edtf-mode { order: -1; font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-decoration: underline; text-underline-offset: .15em; }
17
+ rr0-date-input .edtf-mode:hover { text-decoration-thickness: 2px; }
18
+ rr0-date-input .edtf-mode:focus-visible { outline: 2px solid #4af; outline-offset: 2px; border-radius: 2px; }
19
+ rr0-date-input [hidden] { display: none !important; }
20
+ ${Se.css("rr0-date-input .edtf-helppop")}
21
+ `;class qn extends HTMLElement{dateField;shown;wording;helpPopup;build(){if(this.dateField)return;const e=this.getAttribute("name"),t=this.ownerDocument,i=t.createElement("style");i.textContent=Vn;const s=t.createElement("span");s.className="edtf-field";const n=t.createElement("input");n.type=this.hasAttribute("date-only")?"date":"datetime-local",n.type!=="date"&&(n.step="60");const r=t.createElement("input");r.type="text",r.hidden=!0;const o=t.createElement("button");o.type="button",o.className="edtf-help",o.textContent="?",o.hidden=!0;const l=t.createElement("div");l.className="edtf-helppop",Se.attach(o,l),this.helpPopup=l,e&&(n.id=`${e}-native`,r.id=e),s.append(n,r,o,l);const a=t.createElement("button");a.type="button",a.className="edtf-mode",this.append(i,s,a),this.dateField=new rt({picker:n,text:r,mode:a,help:o},this.wording,d=>this.dispatchEvent(new CustomEvent("datechange",{detail:{time:d},bubbles:!0,composed:!0})),Ne.preferencesFor(this)[0]??"en"),o.addEventListener("click",()=>this.toggleHelp()),this.shown=void 0,this.fillHelp()}connectedCallback(){this.build(),document.addEventListener("pointerdown",this.closeHelpOutside,!0),document.addEventListener("keydown",this.closeHelpOnEscape,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.closeHelpOutside,!0),document.removeEventListener("keydown",this.closeHelpOnEscape,!0)}closeHelpOutside=e=>{this.helpPopup&&!this.helpPopup.hidden&&!e.composedPath().includes(this)&&Se.show(this.helpPopup,!1)};closeHelpOnEscape=e=>{e.key==="Escape"&&this.helpPopup&&Se.show(this.helpPopup,!1)};toggleHelp(){this.helpPopup&&Se.show(this.helpPopup,this.helpPopup.hidden)}fillHelp(){const e=this.helpPopup;if(!e||!this.wording)return;const t=this.ownerDocument.createElement("p");t.textContent=this.wording.dateHelpTitle;const i=this.ownerDocument.createElement("ul");for(const s of this.wording.dateHelpLines.split(`
22
+ `)){const n=this.ownerDocument.createElement("li");n.textContent=s,i.append(n)}e.replaceChildren(t,i)}set hint(e){this.field.setHint(e)}get field(){return this.build(),this.dateField}get time(){return this.shown}set time(e){this.shown=e,this.field.set(e)}setBounds(e){this.field.setBounds(e)}get precise(){return this.field.isPrecise}setPrecise(e){this.field.setPrecise(e)}set messages(e){this.wording=e,this.dateField&&(this.dateField.setMessages(e,Ne.preferencesFor(this)[0]??"en"),this.fillHelp())}}function Cs(){customElements.get(Bt)||customElements.define(Bt,qn)}class is{static of(e,t="whole",i){if(t==="whole"||!e.timeline?.keyframes?.length)return JSON.stringify(e,null,2);const s=An.thin(e.timeline.keyframes,i);return JSON.stringify({...e,timeline:{...e.timeline,keyframes:s}},null,2)}}function Zn(E,e,t,i,s,n){Os(E,e,t,r=>r.map(o=>o.id===i?s(o):o),n)}function Os(E,e,t,i,s){const n=r=>{const o=i(At(r)),l=m=>1-o.filter(f=>f.type==="cirrus"===m).reduce((f,g)=>f*(1-g.coverage),1),a=l(!1),d=l(!0),h=o.filter(m=>m.coverage>0&&m.type!=="cirrus").map(m=>m.baseM),c=o.filter(m=>m.coverage>0||(m.instances?.length??0)>0),u=c.length?Math.max(...c.flatMap(m=>[m.darkness??r.cloudDarkness,...(m.instances??[]).map(f=>f.darkness??m.darkness??r.cloudDarkness)])):0,p=o.filter(m=>m.type==="cirrus"&&m.coverage>0).sort((m,f)=>f.coverage-m.coverage)[0];return{...r,cloudLayers:o,lowerCloudCover:a,highCloudCover:d,cloudDarkness:u,iceCrystalAlignment:p?.iceCrystalAlignment,cloudCover:1-(1-a)*(1-d),cloudBaseM:h.length?Math.min(...h):void 0}};if(s==="instant"||E.allKeyframes.length===0)E.addKeyframe(s==="observation"?0:t,n(E.getInterpolatedWeatherAt(t)??e));else for(const r of[...E.allKeyframes])E.addKeyframe(r.t,n(r.weather))}function Yn(E,e,t){const i=(o,l)=>o.x*l.x+o.y*l.y+o.z*l.z,s=i(t,E),n=i(e,E);if(s<=0||n<=.05)return;const r=s/n;return{x:e.x*r-E.x*s,y:e.y*r-E.y*s,z:e.z*r-E.z*s}}class ss{static html(){const e=$e.none(),t=i=>`<span data-text="${i}">${e[i]}</span>`;return`<div class="cloud-panel">
23
+ <p data-text="intro">${e.intro}</p>
24
+ <div class="cloud-fields">
25
+ <label>${t("editScope")}<select id="cloud-scope"><option value="instant" data-text="scopeInstant">${e.scopeInstant}</option><option value="observation" data-text="scopeObservation">${e.scopeObservation}</option></select></label>
26
+ <div id="cloud-layer-list" class="cloud-list"></div>
27
+ <div id="cloud-layer-parameters" class="cloud-parameters"></div>
28
+ </div>
29
+ <p data-text="editHelp">${e.editHelp}</p>
30
+ <details><summary data-text="individualClouds">${e.individualClouds}</summary><div class="cloud-fields">
31
+ <div id="cloud-instance-list" class="cloud-list"></div>
32
+ <label><input id="cloud-manipulate" type="checkbox">${t("manipulate")}</label>
33
+ <div id="cloud-instance-parameters" class="cloud-parameters"></div>
34
+ </div><p data-text="individualHelp">${e.individualHelp}</p></details>
35
+ <p id="cloud-status" role="status"></p></div>`}static localize(e,t){for(const i of e.querySelectorAll("[data-text]"))i.textContent=t[i.dataset.text]}}const Jn=$e.catalog({en:()=>M(()=>import("./CloudParameterTexts_en-NIa0gfgA.js"),[],import.meta.url).then(E=>E.cloudParameterTexts_en),fr:()=>M(()=>import("./CloudParameterTexts_fr-Bv-jc2dq.js"),[],import.meta.url).then(E=>E.cloudParameterTexts_fr),es:()=>M(()=>import("./CloudParameterTexts_es-DXu4T30p.js"),[],import.meta.url).then(E=>E.cloudParameterTexts_es),it:()=>M(()=>import("./CloudParameterTexts_it-C3RrkRwI.js"),[],import.meta.url).then(E=>E.cloudParameterTexts_it)});class P{static METRES="m";static number(e,t,i,s,n,r={}){return{type:"number",key:e,label:t,min:i,max:s,step:n,...r}}static LAYER={kind:"cloud-layer",title:"cloudLayer",parameters:[{type:"choice",key:"type",required:!0,label:"cloudType",choices:[{value:"cumulus",label:"cumulus"},{value:"stratus",label:"stratus"},{value:"stratocumulus",label:"stratocumulus"},{value:"cirrus",label:"cirrus"},{value:"unknown",label:"unknown"}]},P.number("baseM","base",0,2e4,1,{unit:P.METRES,required:!0}),P.number("thicknessM","thickness",10,8e3,1,{unit:P.METRES,required:!0}),P.number("coverage","coverage",0,100,1,{unit:"%",scale:100,required:!0}),P.number("sizeM","cloudSize",50,2e4,10,{unit:P.METRES,required:!0}),P.number("density","density",0,2,.01,{required:!0}),P.number("darkness","darkness",0,1,.01,{effective:(e,t)=>t?.generalDarkness}),P.number("iceCrystalAlignment","crystalAlignment",0,1,.01,{visibleWhen:e=>e.type==="cirrus",effective:()=>gi}),P.number("windDirectionDeg","layerWindDirection",0,360,.1,{unit:"°",placeholder:"generalWind"}),P.number("windSpeed","layerWindSpeed",0,120,.01,{unit:"m/s",placeholder:"generalWind"}),P.number("seed","patternSeed",0,9999,1)]};static INSTANCE={kind:"cloud-instance",title:"individualCloud",parameters:[{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:1,label:"position"},P.number("baseM","cloudBase",0,2e4,1,{unit:P.METRES,required:!0}),P.number("thicknessM","cloudThickness",10,8e3,1,{unit:P.METRES,required:!0}),P.number("widthM","cloudWidth",50,2e4,10,{unit:P.METRES,required:!0}),P.number("depthM","cloudDepth",50,2e4,10,{unit:P.METRES,required:!0}),P.number("rotationDeg","cloudRotation",-360,360,1,{unit:"°",required:!0}),P.number("density","cloudDensity",0,2,.01,{required:!0}),P.number("darkness","darkness",0,1,.01,{placeholder:"layerDarkness"})]}}function Xn(E,e,t,i,s="en",n){let r=$e.none();E.innerHTML=ss.html();const o=k=>E.querySelector("#"+k),l={},a=new ge({header:E.querySelector("#cloud-layer-list"),body:E.querySelector("#cloud-layer-parameters"),ids:{list:"cloud-layer",remove:"cloud-layer-delete",add:"cloud-layer-add"},onSelect:()=>l.pickLayer(),onAdd:()=>l.addLayer(),onRemove:()=>l.removeLayer()}),d=new ge({header:E.querySelector("#cloud-instance-list"),body:E.querySelector("#cloud-instance-parameters"),ids:{list:"cloud-instance",remove:"cloud-instance-delete",add:"cloud-instance-add"},optional:!0,actions:[{id:"cloud-instance-point",glyph:"🎯",onClick:()=>l.pointAtCloud()}],onSelect:()=>l.pickCloud(),onAdd:()=>l.addCloud(),onRemove:()=>l.removeCloud()}),h=()=>{a.setLabels({list:r.layer,remove:r.deleteLayer,add:r.addLayer,empty:r.emptyLayers}),d.setLabels({list:r.individualCloud,remove:r.deleteCloud,add:r.addIndividualCloud,none:r.none,actions:{"cloud-instance-point":r.pointAtCloud}})};h();const c=E.querySelector("#cloud-status"),u=()=>o("cloud-scope").value,p=()=>{const k=At(ne(e.ufoElement.sighting,e.ufoElement.currentTime));return k.find(T=>T.id===a.value)??k[0]},m=()=>p()?.instances?.find(k=>k.id===d.value),f=E.querySelector("#cloud-layer-parameters"),g=E.querySelector("#cloud-instance-parameters"),b=new nt(f,s,"cloudLayer."),v=new nt(g,s,"cloudInstance."),I=()=>{const k=m();g.hidden=!k,k&&v.sync()};let S=-1;const w=()=>{const k=e.ufoElement.currentTime,T=E.getRootNode().activeElement;if(k===S&&T instanceof HTMLInputElement&&E.contains(T))return;S=k;const L=At(ne(e.ufoElement.sighting,e.ufoElement.currentTime));a.setItems(L.map(($,j)=>({id:$.id,label:`${j+1} · ${$.type} · ${Math.round($.baseM)} m`})),a.value);const H=p();if(f.hidden=!H,!H){d.setItems([],""),I();return}b.sync();const Z=d.value;d.setItems((H.instances??[]).map(($,j)=>({id:$.id,label:`${r.cloud} ${j+1}`})),H.instances?.some($=>$.id===Z)?Z:""),I()},x=(k,T=!0)=>{if(!p())return;e.ufoElement.pause(),t(T);const L=e.ufoElement.currentTime,H=e.ufoElement.sighting;Zn(H.weatherTrack,ne(H,L),L,p().id,k,u()),e.ufoElement.refresh(),c.textContent=u()==="observation"?r.savedAcrossObservation:`${(L/1e3).toFixed(1)} s · ${r.savedAtThisTime}`},C=k=>{b.show(st.resolve(P.LAYER,k),new Ot(()=>p(),(T,L)=>x(H=>{const Z=structuredClone(H);return T(Z),Z},L.key!=="iceCrystalAlignment"),()=>({generalDarkness:ne(e.ufoElement.sighting,e.ufoElement.currentTime).cloudDarkness})),()=>{}),v.show(st.resolve(P.INSTANCE,k),new Ot(()=>m(),T=>{const L=d.value;x(H=>({...H,instances:H.instances?.map(Z=>{if(Z.id!==L)return Z;const $=structuredClone(Z);return T($),$})}))},void 0,n),()=>{})};E.addEventListener("focusin",()=>e.ufoElement.pause()),l.pickLayer=()=>{d.show(""),w()},l.pickCloud=I;const B=k=>{e.ufoElement.pause(),t();const T=e.ufoElement.sighting,L=e.ufoElement.currentTime;Os(T.weatherTrack,ne(T,L),L,k,u()),e.ufoElement.refresh(),w()};l.addLayer=()=>{const k=ne(e.ufoElement.sighting,e.ufoElement.currentTime),T={id:crypto.randomUUID(),type:"cumulus",baseM:1500,thicknessM:800,coverage:.5,sizeM:1400,density:1,darkness:k.cloudDarkness};B(L=>[...L,T]),a.show(T.id),w()},l.removeLayer=()=>{const k=p()?.id;k&&B(T=>T.filter(L=>L.id!==k))};const A=e.ufoElement.canvasElement,ee=o("cloud-manipulate");let q;const Ae=k=>{const T=A.getBoundingClientRect();return{x:(k.clientX-T.left)/T.width*2-1,y:1-(k.clientY-T.top)/T.height*2}};ee.addEventListener("change",()=>{A.style.touchAction=ee.checked?"none":"",A.style.cursor=ee.checked?"crosshair":""}),A.addEventListener("click",k=>{ee.checked&&(k.preventDefault(),k.stopImmediatePropagation())},!0),A.addEventListener("pointerdown",k=>{if(!ee.checked||k.button!==0)return;k.preventDefault(),k.stopImmediatePropagation(),e.ufoElement.pause();const T=Ae(k),L=e.pickCloudAt(T.x,T.y);if(!L){c.textContent=r.noCloudHere;return}a.show(L.layerId),w(),d.show(L.instanceId),I();const Z=(u()==="observation"?e.ufoElement.sighting.weatherTrack.allKeyframes.map($=>$.weather):[ne(e.ufoElement.sighting,e.ufoElement.currentTime)]).flatMap($=>At($).filter(j=>j.id===L.layerId).flatMap(j=>(j.instances??[]).filter(xe=>xe.id===L.instanceId).map(xe=>xe.baseM)));q={minBase:Math.min(...Z),pointerId:k.pointerId,id:L.instanceId,center:L.center,ray:e.cloudDirectionAt(T.x,T.y),delta:{x:0,y:0,z:0}},A.setPointerCapture(k.pointerId),A.style.cursor="grabbing",c.textContent=r.cloudSelected},!0),A.addEventListener("pointermove",k=>{if(!q||k.pointerId!==q.pointerId)return;k.preventDefault(),k.stopImmediatePropagation();const T=Ae(k),L=Yn(q.ray,e.cloudDirectionAt(T.x,T.y),q.center);if(!L)return;L.y=Math.max(L.y,-q.minBase);const H=q.delta,Z=q.id;x($=>({...$,instances:$.instances?.map(j=>j.id!==Z?j:{...j,eastM:j.eastM+L.x-H.x,northM:j.northM-L.z+H.z,baseM:j.baseM+L.y-H.y})})),q.delta=L,I()},!0);const We=k=>{!q||k.pointerId!==q.pointerId||(q=void 0,A.hasPointerCapture(k.pointerId)&&A.releasePointerCapture(k.pointerId),A.style.cursor=ee.checked?"crosshair":"")};return A.addEventListener("pointerup",We),A.addEventListener("pointercancel",We),A.addEventListener("lostpointercapture",We),l.addCloud=()=>{const k=p();if(!k)return;const T=crypto.randomUUID(),L=e.ufoElement.sighting,H=e.ufoElement.currentTime,Z=X(L,H),$=xi(H,L.weatherTrack,ne(L,0),X(L,0),Z,k.id),j=e.cloudDirectionAt(0,0),xe=k.baseM+k.thicknessM*.4-(Z?.elevationM??0)-1.6,je=xe*j.y>0?Math.max(500,Math.min(2e4,xe/j.y)):5e3,ct={id:T,eastM:$.x+j.x*je,northM:-($.z+j.z*je),baseM:k.baseM,thicknessM:k.thicknessM,widthM:1800,depthM:1200,rotationDeg:0,density:1,darkness:k.darkness};x(ut=>({...ut,instances:[...ut.instances??[],ct]})),w(),d.show(T),I(),c.textContent+=r.cloudAdded},l.removeCloud=()=>{const k=d.value;k&&(x(T=>({...T,instances:T.instances?.filter(L=>L.id!==k)})),w())},l.pointAtCloud=()=>{const k=p(),T=k?.instances?.find(ut=>ut.id===d.value);if(!T)return;e.ufoElement.pause();const L=e.ufoElement.sighting,H=e.ufoElement.currentTime,Z=X(L,H),$=xi(H,L.weatherTrack,ne(L,0),X(L,0),Z,k.id),j=T.eastM-$.x,xe=T.northM+$.z,je=Math.hypot(j,xe),ct=T.baseM+T.thicknessM/2-(Z?.elevationM??0)-1.6-je**2/(2*6371e3);je===0&&ct===0||i((Math.atan2(j,xe)*180/Math.PI+360)%360,Math.atan2(ct,je)*180/Math.PI)},Promise.all([_s.load(s),Jn.load(s)]).then(([k,T])=>{r=k,C(T),ss.localize(E,r),h(),S=-1,w()}),{sync:w,stopManipulation(){q=void 0,ee.checked=!1,A.style.touchAction="",A.style.cursor=""},reset(){q=void 0,ee.checked=!1,A.style.cursor="",A.style.touchAction="",d.show(""),S=-1,w()}}}class Rs{static CSS=`
36
+ .form-section:not([data-open], [data-fits]) .adv { display: none !important; }
37
+ .form-section[data-fold="all"]:not([data-open]) > :not(.section-title, .more-toggle) { display: none !important; }
38
+ .more-toggle {
39
+ grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 6px;
40
+ min-height: 0; margin: 0; padding: 2px 0; border: 0; background: none; color: var(--sky, LinkText);
41
+ font: 600 13px/1.4 var(--sans, inherit); cursor: pointer;
42
+ }
43
+ .more-toggle:hover:not(:disabled) { background: none; color: var(--ink, CanvasText); }
44
+ .more-toggle::before { content: "›"; display: inline-block; font-size: 1.2em; line-height: 1; transition: transform .12s ease; }
45
+ .more-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
46
+ .more-toggle[hidden] { display: none; }
47
+ @media (prefers-reduced-motion: reduce) { .more-toggle::before { transition: none; } }
48
+ `;messages;toggles=new Map;constructor(e){for(const t of e.querySelectorAll(".form-section")){if(t.dataset.fold!=="all"&&!t.querySelector(".adv"))continue;const i=document.createElement("button");i.type="button",i.className="more-toggle",i.setAttribute("aria-expanded","false"),i.addEventListener("click",()=>this.setOpen(t,!t.hasAttribute("data-open")));const s=t.querySelector(":scope > .section-title");t.dataset.fold==="all"&&s?s.after(i):t.append(i),this.toggles.set(t,i)}if(typeof ResizeObserver<"u"){const t=new Map,i=new ResizeObserver(s=>{let n=!1;for(const r of s){const o=Math.round(r.contentRect.width);t.get(r.target)!==o&&(t.set(r.target,o),n=!0)}n&&this.refresh()});for(const s of this.toggles.keys())i.observe(s)}}setMessages(e){this.messages=e,this.refresh()}refresh(){const e=this.messages;if(e)for(const[t,i]of this.toggles){const s=this.fits(t,i);t.toggleAttribute("data-fits",s);const n=t.hasAttribute("data-open"),r=t.dataset.fold==="all",o=this.count(t);i.hidden=!r&&o===0||s;const l=r?n?e.hideSettings:o===0?e.showSettingsAny:(o===1?e.showSettingsOne:e.showSettings).replaceAll("{n}",String(o)):n?e.lessSettings:e.moreSettings.replaceAll("{n}",String(o));i.textContent!==l&&(i.textContent=l),i.setAttribute("aria-expanded",String(n))}}fits(e,t){if(e.dataset.fold==="all")return!1;const i=()=>e.getBoundingClientRect().height;if(i()===0)return!1;const s=e.hasAttribute("data-open"),n=t.hidden;e.removeAttribute("data-fits"),t.hidden=!1,e.removeAttribute("data-open");const r=i();e.setAttribute("data-open",""),t.hidden=!0;const o=i()<=r+.5;return e.toggleAttribute("data-open",s),t.hidden=n,o}reveal(e){const t=e.closest(".form-section");t&&this.toggles.has(t)&&!t.hasAttribute("data-open")&&this.setOpen(t,!0)}setOpen(e,t){e.toggleAttribute("data-open",t),this.refresh()}count(e){const t=s=>{for(let n=s;n&&n!==e;n=n.parentElement)if(n.hidden)return!1;return!0};return(e.dataset.fold==="all"?[...e.querySelectorAll(":scope > label, :scope > .field")]:[...e.querySelectorAll(".adv")]).filter(t).length}}class Ps{constructor(e){this.host=e,bi()}static CSS=`${Xe.CSS}${De.CSS}
49
+ :is(label, .field)[data-basis="assumed"] :is(input, .edtf-field input) { font-style: italic; }
50
+ /* ("> .basis-mark" in :has keeps the weight the rule had when the mark was the label's own child, over the form's flex labels.)
51
+ A field with its basis: its name and the mark on the first line, the value and its unit on the next, the law under them. Left to
52
+ the field's own flow, the mark (hidden but for the hover) opened the second line and pushed the value aside. */
53
+ .app .form-section > :is(label, .field):has(> rr0-input-basis > .basis-mark) {
54
+ display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 6px;
55
+ }
56
+ .app .form-section > :is(label, .field):has(> rr0-input-basis > .basis-mark) > :first-child { grid-column: 1; }
57
+ .app .form-section > :is(label, .field):has(> rr0-input-basis > .basis-mark) > rr0-input-basis { grid-column: 2 / -1; justify-self: start; }
58
+ .app .form-section > :is(label, .field) > rr0-input-basis .basis-mark { margin-left: 0; }
59
+ /* What is said of the value (an output: "0.1× the Moon") too: left on the value's line, it got the third track only, and ran under the
60
+ next field. */
61
+ .app .form-section > :is(label, .field):has(> rr0-input-basis > .basis-mark) > :is(.law, output, rr0-date-input, rr0-duration-input) { grid-column: 1 / -1; }
62
+ .law { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font: 400 12px/1.4 var(--sans); color: var(--ink-dim); }
63
+ .law-symbol { color: var(--glow-dim); font-weight: 700; }
64
+ .law-reset { color: var(--glow); }
65
+ .lead-status { user-select: none; padding: 0 7px; border-radius: 6px; font: 600 11px/1.6 var(--sans); color: var(--ink); background: var(--neutral-bg); }
66
+ .lead-status[data-status="individual"] { background: light-dark(rgba(31, 122, 68, .14), rgba(143, 215, 164, .16)); }
67
+ .lead-status:is([data-status="argued"], [data-status="single"]) { background: var(--warn-bg); }
68
+ .lead-status[data-status="contested"] { background: var(--error-bg); }
69
+ .moon-gauge { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: start; grid-column: 1 / -1; }
70
+ .moon-picture { position: relative; width: 150px; height: 150px; border-radius: 10px; background: #0b1020; }
71
+ .moon-picture svg { display: block; }
72
+ .moon-picture span { position: absolute; left: 8px; bottom: 6px; font: 500 10px/1 var(--mono); color: #a3adc2; }
73
+ .moon-side { display: flex; flex-direction: column; gap: 8px; }
74
+ .moon-side .note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--neutral-bg); font-size: 13px; color: var(--ink-dim); }
75
+ .section-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
76
+ .section-head .model-pick { display: inline-flex; align-items: center; gap: 8px; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
77
+ .section-intro { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--ink-dim); }
78
+ .parameter-rows { grid-column: 1 / -1; display: grid; gap: 6px; }
79
+ /* Its own rows only: a ParameterForm names its rows the same, and these, laid on them, crushed a set's label under its ticks (a body's
80
+ "Stands for the shapes"). */
81
+ .parameter-rows > .parameter-row { display: grid; grid-template-columns: minmax(10em, auto) minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; padding: 10px 14px;
82
+ border: 1px solid var(--line-strong); border-radius: 10px; background: var(--ground); }
83
+ .parameter-rows > .parameter-row strong { font-size: 14px; }
84
+ .parameter-rows > .parameter-row .scope { color: var(--ink-faint); font-size: 13px; }
85
+ .extrapolation { grid-column: 1 / -1; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); font-size: 13px; color: var(--ink); }
86
+ @container (max-width: 640px) { .moon-gauge { grid-template-columns: minmax(0, 1fr); } .parameter-rows > .parameter-row { grid-template-columns: minmax(0, 1fr) auto; } }
87
+ `;fields=[];model=Q.MODELS[0];sections=[];observerShown;attach(e){this.fields.push(e);const t=document.createElement(Xe.TAG);t.addEventListener("basischange",n=>this.said(e,n.detail.entry));const i=e.label.firstElementChild;i?i.after(t):e.label.prepend(t);const s=document.createElement("span");s.className="law",e.label.append(s),e.input.addEventListener("input",()=>this.retyped(e)),e.input.addEventListener("change",()=>this.retyped(e))}refresh(){this.refreshFields(),this.renderObserver(),this.host.lawsChanged()}get errorModel(){return this.model}refreshFields(){for(const e of this.fields)this.refreshField(e)}entryOf(e){const t=e.path();return t===void 0?void 0:this.host.sighting.provenance.at(t)}refreshField(e,t){const i=this.host.messages();if(!i)return;const s=this.entryOf(e),n=s?.basis??"stated",r=e.label.querySelector(Xe.TAG);r.hows=Q.HOW[e.kind].map(d=>({value:d,label:i.how[d]??d})),r.messages={title:i.basisTitle,basis:i.basis,basisField:i.basisField,howField:i.howField,rationaleField:i.rationaleField};const o=this.host.valueSources?.();r.sourceMessages=o?.messages,r.choices=o?.choices??{},r.entry=s,r.hidden=e.path()===void 0,e.label.dataset.basis=n;const l=e.label.querySelector(".law");if(t){this.showLaw(l,[Object.assign(document.createElement("span"),{className:"law-reset",textContent:i.basisReset.replace("{basis}",i.basis[t])})]);return}const a=e.value();this.showLaw(l,a===void 0?[]:this.lawNodes(this.model.law({kind:e.kind,value:a,basis:n,how:s?.how},this.conditions),e.kind))}showLaw(e,t){const i=t.map(s=>s instanceof HTMLElement?`${s.className}|${s.textContent}|${s.title}|${s.dataset.status??""}`:s.textContent).join(`
88
+ `);e.dataset.said!==i&&(e.dataset.said=i,e.replaceChildren(...t))}lawNodes(e,t){const i=this.host.messages(),s=Object.assign(document.createElement("span"),{className:"law-symbol",textContent:e.shape==="uninformative"?"∅":"≈"});let n=i.laws[e.note];for(const[l,a]of Object.entries(e.params??{}))n=n.replaceAll(`{${l}}`,this.number(Q.rounded(a)));e.low!==void 0&&(n=n.replaceAll("{low}",this.withUnit(e.low,t))),e.high!==void 0&&(n=n.replaceAll("{high}",this.withUnit(e.high,t)));const r=Object.assign(document.createElement("span"),{textContent:n});e.sources.length>0&&(r.title=i.lawSources.replace("{sources}",e.sources.join(", ")));const o=Object.assign(document.createElement("span"),{className:"lead-status",textContent:i.status[e.status]});return o.dataset.status=e.status,[s,r,o]}number(e){return e.toLocaleString(document.documentElement.lang||void 0,{maximumFractionDigits:Math.abs(e)<1?6:2})}withUnit(e,t){const i=Q.rounded(e);switch(t){case"duration":return i>=90?`${this.number(Q.rounded(i/60))} min`:`${this.number(i)} s`;case"time":return`${this.number(i)} min`;case"distance":return`${this.number(i)} m`;default:return`${this.number(i)}°`}}retyped(e){const t=e.path(),i=t===void 0?void 0:this.host.sighting.provenance.at(t);if(!t||!i||i.basis==="stated"&&i.how===void 0){this.refreshField(e);return}this.host.sighting.provenance.clear(t),this.refreshField(e,i.basis==="stated"?void 0:i.basis),setTimeout(()=>this.refreshField(e),4e3)}said(e,t){const i=e.path();i!==void 0&&(t?this.host.sighting.provenance.set(i,{...t,...e.value()!==void 0?{of:this.valueAt(i)}:{}}):this.host.sighting.provenance.clear(i),this.host.changed(),this.refreshField(e))}valueAt(e){const t=s=>s&&typeof s=="object"&&!Array.isArray(s)&&"value"in s?s.value:s;let i=this.host.recordingJson();for(const s of e.split("."))i=i&&typeof i=="object"?t(i[s]):void 0;return t(i)}get conditions(){return this.host.sighting.account?.conditions}setConditions(e){const t={...this.conditions??{},...e};for(const i of Object.keys(t))t[i]===void 0&&delete t[i];this.host.conditionsChanged(Object.keys(t).length>0?t:void 0),this.host.changed(),this.refresh()}placeObserverSections(e){const t=()=>{const s=document.createElement("div");return s.className="form-section witness-error",this.sections.push(s),s},i=[t(),t(),t(),t()];e.after(...i),this.renderObserver()}renderObserver(){if(this.sections.length===0)return;const e=this.host.messages();if(!e)return;const t=this.conditions??{},i={messages:e,model:this.model,conditions:JSON.stringify([t,this.host.sighting.provenance.at("time")?.how,this.daylight()])},s=this.observerShown;if(s&&s.messages===i.messages&&s.model===i.model&&s.conditions===i.conditions)return;this.observerShown=i;const[n,r,o,l]=this.sections,a=m=>Object.assign(document.createElement("h3"),{className:"section-title",textContent:m}),d=(m,f,g)=>{const b=document.createElement("label");return b.append(Object.assign(document.createElement("span"),{textContent:m}),f),g&&b.append(` ${g}`),b},h=(m,f,g="1")=>{const b=document.createElement("input");return b.type="number",b.min="0",b.step=g,b.value=m===void 0?"":String(m),b.addEventListener("change",()=>f(b.value.trim()===""||!Number.isFinite(Number(b.value))?void 0:Number(b.value))),b},c=(m,f,g)=>{const b=document.createElement("select");return b.append(new Option(e.unknownChoice,""),...f.map(([v,I])=>new Option(I,v))),b.value=m??"",b.addEventListener("change",()=>g(b.value===""?void 0:b.value)),b},u=(m,f,g,b)=>{const v=document.createElement("label"),I=document.createElement("input");return I.type="checkbox",I.checked=f===!0,I.addEventListener("change",()=>g(I.checked?!0:void 0)),v.append(I,` ${m}`),b&&v.append(De.of(b)),v},p=document.createElement("select");p.append(new Option(e.unknownChoice,""),new Option(e.independentYes,"yes"),new Option(e.independentNo,"no")),p.value=t.independent===void 0?"":t.independent?"yes":"no",p.addEventListener("change",()=>this.setConditions({independent:p.value===""?void 0:p.value==="yes"})),n.replaceChildren(a(e.sectionAccountConditions),d(e.delayField,h(t.delayDays,m=>this.setConditions({delayDays:m})),e.delayUnit),d(e.versionField,h(t.version,m=>this.setConditions({version:m}))),d(e.wordField,c(t.word,Object.entries(e.words),m=>this.setConditions({word:m}))),d(e.exposureField,c(t.exposure,Object.entries(e.exposures),m=>this.setConditions({exposure:m}))),d(e.independenceField,p)),r.replaceChildren(a(e.sectionViewing),u(e.darkAdapted,t.darkAdapted,m=>this.setConditions({darkAdapted:m})),u(e.correctedVision,t.correctedVision,m=>this.setConditions({correctedVision:m}),e.correctedVisionHint),u(e.glare,t.glare,m=>this.setConditions({glare:m})),Object.assign(document.createElement("p"),{className:"section-intro",textContent:e.viewingNote})),o.replaceChildren(a(e.sectionMoon),Object.assign(document.createElement("p"),{className:"section-intro",textContent:e.moonIntro}),this.moonGauge(t)),this.renderParameters(l,t)}moonGauge(e){const t=this.host.messages(),i=Q.moonFactor(e),s=document.createElement("div");s.className="moon-gauge";const n=document.createElement("div");n.className="moon-picture";const r=12,o=i===void 0?void 0:Math.min(70,r*i);n.innerHTML=`<svg viewBox="0 0 150 150" width="150" height="150" aria-hidden="true"><circle cx="75" cy="72" r="${r}" fill="#efe9d6"/>${o!==void 0?`<circle cx="75" cy="72" r="${o}" fill="none" stroke="#f5c451" stroke-width="1.5" stroke-dasharray="4 3"/>`:""}</svg>`,n.append(Object.assign(document.createElement("span"),{textContent:t.moonReal}));const l=document.createElement("div");l.className="moon-side";const a=document.createElement("label"),d=document.createElement("input");d.type="number",d.min="0",d.step="0.1",d.placeholder="1,7",d.value=e.moonShownDeg===void 0?"":String(e.moonShownDeg),d.addEventListener("change",()=>this.setConditions({moonShownDeg:d.value.trim()===""||!(Number(d.value)>0)?void 0:Number(d.value)})),a.append(Object.assign(document.createElement("span"),{textContent:t.moonField}),d," °");const h=Object.assign(document.createElement("span"),{className:"section-intro",textContent:t.moonHint}),c=this.model.parameters().find(m=>m.id==="size");let u=t.parameters[c.note];for(const[m,f]of Object.entries(c.params??{}))u=u.replaceAll(`{${m}}`,this.number(f));const p=Object.assign(document.createElement("p"),{className:"note",textContent:i===void 0?t.moonNone.replace("{law}",`${u}, ${t.status[c.status]}`):t.moonFactor.replace("{k}",this.number(Q.rounded(i)))});return l.append(a,h,p),s.append(n,l),s}renderParameters(e,t){const i=this.host.messages(),s=document.createElement("div");s.className="section-head";const n=document.createElement("label");n.className="model-pick";const r=document.createElement("select");for(const d of Q.MODELS)r.append(new Option(i.models[d.id]??d.title,d.id));r.value=this.model.id,r.addEventListener("change",()=>{this.model=Q.byId(r.value),this.refresh()}),n.append(i.errorModelField,r),s.append(Object.assign(document.createElement("h3"),{className:"section-title",textContent:i.sectionErrorParameters}),n);const o=this.host.sighting.provenance.at("time")?.how,l=document.createElement("div");l.className="parameter-rows";for(const d of this.model.parameters(t,o)){const h=document.createElement("div");h.className="parameter-row";let c=i.parameters[d.note];for(const[m,f]of Object.entries(d.params??{}))c=c.replaceAll(`{${m}}`,this.number(Q.rounded(f)));const u=Object.assign(document.createElement("span"),{className:"lead-status",textContent:i.status[d.status]});u.dataset.status=d.status;const p=document.createElement("span");p.append(c,Object.assign(document.createElement("span"),{className:"scope",textContent:` · ${i.parameterScopes[d.id]}`})),h.append(Object.assign(document.createElement("strong"),{textContent:i.parameterNames[d.id]}),p,u),l.append(h)}const a=[s,Object.assign(document.createElement("p"),{className:"section-intro",textContent:i.parametersIntro}),l];this.daylight()&&a.push(Object.assign(document.createElement("p"),{className:"extrapolation",textContent:i.extrapolation})),e.replaceChildren(...a)}daylight(){const e=this.host.sighting.event,t=e.place?.[0];if(!t||!e.time)return!1;const i=fe(e.time,t.lng,e.utcOffsetHours);return i!==void 0&&K("Sun",i,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>0}}class N{constructor(e,t){this.model=e,this.conditions=t}static BOUND_SIGMA=3;static TAIL_SIGMA=2;static POINT_SIZE_DEG=.1;static MOVED_DEG=2;static STILL_DEG=.5;static SWEEP_SIGMA_DEG=5*Math.SQRT2;static STILL_SEEN_MOVING_MAX_DEG=10;static GROWTH=1.5;static BRIGHTENING_MAG=.5;static READING_STATUS={grouped:"consolidated","still-seen-moving":"consolidated","moving-seen-still":"argued","brightening-as-approach":"argued"};static ELEVATION_SIGMA_DEG=5;fit(e,t){const i=this.model.law({kind:"time",value:0,how:e.timeHow},this.conditions),s=Math.max(.5,(i.high??6)/2);let n;const r=24;for(let o=0;o<=r;o++){const l=-3*s+2*N.BOUND_SIGMA*s*o/r,a=t.at(l);if(!a)continue;const d=this.variantAt(e,t,l,s,i.status,a);(!n||d.cost<n.cost)&&(n=d)}return n??{candidate:t.id,label:t.label,verdict:"incompatible",cost:1/0,reason:"never-seen",moved:[],readings:[],parameters:{clockMinutes:0,headingDeg:0,elevationFactor:1,sizeFactor:1},modelId:this.model.id}}search(e,t){const i={consolidated:0,contested:1,incompatible:2};return t.map(s=>this.fit(e,s)).sort((s,n)=>i[s.verdict]-i[n.verdict]||s.cost-n.cost)}variantAt(e,t,i,s,n,r){const o=[];let l;Math.abs(i)>.05&&o.push({field:"time",stated:0,variant:i,parameter:"clock",amount:i,z:i/s,status:n});let a=0,d=1;if(e.aim){const v=this.model.law({kind:"heading",value:e.aim.azimuthDeg,how:e.headingHow},this.conditions),I=((v.high??e.aim.azimuthDeg+45)-e.aim.azimuthDeg)/2;a=((r.aim.azimuthDeg-e.aim.azimuthDeg)%360+540)%360-180,Math.abs(a)>.5&&o.push({field:"heading",stated:e.aim.azimuthDeg,variant:(r.aim.azimuthDeg+360)%360,parameter:"heading",amount:a,z:a/I,status:v.status});const S=e.aim.altitudeDeg,w=this.model.law({kind:"elevation",value:S},this.conditions),x=w.low??S,C=w.high??S,B=r.aim.altitudeDeg,A=B>C?(B-C)/N.ELEVATION_SIGMA_DEG:B<x?(x-B)/N.ELEVATION_SIGMA_DEG:0;d=S>0?B/S:1,Math.abs(B-S)>.5&&o.push({field:"elevation",stated:S,variant:B,parameter:"elevation",amount:d,z:A,status:A>0?"argued":w.status})}let h=1;if(e.widthDeg!==void 0&&e.widthDeg>0){const v=Math.max(r.widthDeg,N.POINT_SIZE_DEG),I=this.model.law({kind:"angularSize",value:e.widthDeg,how:e.sizeHow},this.conditions),S=I.low??e.widthDeg,w=I.high??e.widthDeg,x=v>w?Math.log(v/w)/Math.log(1.5):v<S?Math.log(S/v)/Math.log(1.5):0;h=e.widthDeg/v,Math.abs(Math.log(h))>Math.log(1.1)&&o.push({field:"size",stated:e.widthDeg,variant:v,parameter:"size",amount:h,z:x,status:I.status})}const{readings:c,lacking:u}=this.structural(e,t,i,r);let p;if(!u&&!c.some(v=>v.reading==="still-seen-moving"||v.reading==="moving-seen-still")){const v=this.motionFit(e,t,i,r);v&&(p=v.factor,o.push(...v.moved))}const m=Math.sqrt(o.reduce((v,I)=>v+I.z*I.z,0)),f=o.find(v=>Math.abs(v.z)>N.BOUND_SIGMA);f&&(l=f.field==="size"?"size":f.field==="duration"||f.field==="sweep"?"motion":"direction"),!l&&u&&(l=u);const g=o.some(v=>v.status==="contested"||Math.abs(v.z)>N.TAIL_SIGMA)||c.some(v=>v.status!=="consolidated"),b=l?"incompatible":g?"contested":"consolidated";return{candidate:t.id,label:t.label,verdict:b,cost:Q.rounded(m),moved:o,readings:c,...l?{reason:l}:{},parameters:{clockMinutes:i,headingDeg:a,elevationFactor:d,sizeFactor:h,...p!==void 0?{durationFactor:p}:{}},modelId:this.model.id}}motionFit(e,t,i,s){const n=e.motion;if(!n||n.spanMinutes<=0||n.sweepDeg<N.MOVED_DEG)return;const r=n.spanMinutes*60,o=this.model.law({kind:"duration",value:r},this.conditions),l=Math.log((o.high??r*3)/r)/2;let a;const d=24;for(let c=0;c<=d;c++){const u=Math.exp(l*N.BOUND_SIGMA*(2*c/d-1)),p=t.at(i+n.spanMinutes*u);if(!p)continue;const m=N.separation(s.aim,p.aim),f=Math.log(u)/l,g=(m-n.sweepDeg)/N.SWEEP_SIGMA_DEG;(!a||f**2+g**2<a.zDuration**2+a.zSweep**2)&&(a={factor:u,sweep:m,zDuration:f,zSweep:g})}if(!a||a.sweep<N.STILL_DEG)return;const h=[];return Math.abs(Math.log(a.factor))>Math.log(1.1)&&h.push({field:"duration",stated:r,variant:r*a.factor,parameter:"duration",amount:a.factor,z:a.zDuration,status:o.status}),Math.abs(a.sweep-n.sweepDeg)>1&&h.push({field:"sweep",stated:n.sweepDeg,variant:a.sweep,parameter:"sweep",amount:a.sweep-n.sweepDeg,z:a.zSweep,status:"argued"}),{factor:a.factor,moved:h}}structural(e,t,i,s){const n=t.readings??[],r=[],o=e.motion,l=o&&o.spanMinutes>0?t.at(i+o.spanMinutes):void 0;if(o&&l){const d=N.separation(s.aim,l.aim);if(o.sweepDeg>=N.MOVED_DEG&&d<N.STILL_DEG){if(o.sweepDeg>N.STILL_SEEN_MOVING_MAX_DEG)return{readings:[],lacking:"motion"};r.push(["still-seen-moving","motion"])}else o.sweepDeg<N.STILL_DEG&&d>=N.MOVED_DEG&&r.push(["moving-seen-still","motion"])}if(e.growth!==void 0&&e.growth>=N.GROWTH&&l&&l.widthDeg/Math.max(s.widthDeg,1e-6)<N.GROWTH)if(s.magnitude===void 0||l.magnitude===void 0||s.magnitude-l.magnitude>=N.BRIGHTENING_MAG)r.push(["brightening-as-approach","growth"]);else return{readings:[],lacking:"growth"};const a=n.includes("grouped")?[{reading:"grouped",status:N.READING_STATUS.grouped}]:[];for(const[d,h]of r){if(!n.includes(d))return{readings:a,lacking:h};a.push({reading:d,status:N.READING_STATUS[d]})}return{readings:a}}static separation(e,t){const i=Math.PI/180,s=Math.sin(e.altitudeDeg*i)*Math.sin(t.altitudeDeg*i)+Math.cos(e.altitudeDeg*i)*Math.cos(t.altitudeDeg*i)*Math.cos((e.azimuthDeg-t.azimuthDeg)*i);return Math.acos(Math.max(-1,Math.min(1,s)))/i}}class ze{constructor(e,t){this.reasons=t;for(const i of e){const s=i.knownPhenomenaProbabilities??i.knownPhenomenonProbabilities??{};this.scores.set(i.question,s);for(const n of Object.keys(s))this.phenomena.includes(n)||this.phenomena.push(n)}}static BASE_URL="https://raw.githubusercontent.com/RR0/rr0.org/master/";static VERSIONS={"poher-1977":"time/1/9/7/7/Poher_Matrice/","rr0-2026":"time/2/0/2/6/10/Poher_Matrice_RR0/"};static DEFAULT_VERSION="rr0-2026";scores=new Map;phenomena=[];has(e){return this.scores.has(e)}reason(e,t){return this.reasons?.cells[e]?.[t]}rank(e){const t=e.filter(s=>this.scores.has(s.question));return this.phenomena.map(s=>{const n=[],r=[];let o=0,l=0;for(const a of t){const d=this.scores.get(a.question)[s];d!==void 0&&(l++,o+=d,d===0&&(a.firm?n:r).push(a.question))}return{phenomenon:s,excludedBy:n,doubtedBy:r,mean:l>0?o/l:0,added:this.reasons?.phenomena[s]!==void 0}}).sort((s,n)=>(s.excludedBy.length>0?1:0)-(n.excludedBy.length>0?1:0)||s.excludedBy.length-n.excludedBy.length||n.mean-s.mean)}static async load(e,t,i){const s=["fr","en","it"].includes(t)?t:"en",n=`${ze.BASE_URL}${ze.VERSIONS[e]}`,[r,o,l]=await Promise.all([i(`${n}matrix.json`),i(`${n}Matrix_${s}.json`),e==="poher-1977"?void 0:i(`${n}reasons.json`)]);return{matrix:new ze(r,l),labels:o}}}class wi{constructor(e,t){this.model=e,this.conditions=t}of(e){const t=[],i=(n,r=!0)=>t.push({question:n,firm:r});e.sunAltitudeDeg!==void 0&&i(e.sunAltitudeDeg>0?"Hour.Day":e.sunAltitudeDeg<-6?"Hour.Night":"Hour.Twilight");const s=(n,r,o)=>{if(r===void 0)return;const l=c=>o.find(([u])=>c<u)?.[1]??o[o.length-1][1],a=this.model.law({kind:n,value:r},this.conditions),d=l(r),h=a.shape==="range"&&l(a.low??r)===d&&l(a.high??r)===d;i(d,h)};if(s("duration",e.durationSeconds,[[10,"Duration.LessThan10s"],[3600,"Duration.AFewMn"],[1/0,"Duration.Above1h"]]),s("elevation",e.elevationDeg,[[5,"AngularHeight.LowOnHorizon"],[30,"AngularHeight.LessThan30d"],[1/0,"AngularHeight.HighInSky"]]),s("angularSize",e.widthDeg,[[.2,"ApparentSize.Pointlike"],[1,"ApparentSize.SimilarToMoon30s"],[1/0,"ApparentSize.SeveralDegrees"]]),e.cloudCover!==void 0&&(e.cloudCover<.2?i("WeatherConditions.NiceAndAlmostClearSky"):e.cloudCover>.8&&i("WeatherConditions.Overcast")),e.lightning&&i("WeatherConditions.Thunder"),e.lowVisibility&&i("WeatherConditions.LowVisibility"),e.sweepDeg!==void 0&&(e.sweepDeg<1?i("Path.Stationary",!1):i((e.straysDeg??0)<Math.max(1,e.sweepDeg*.1)?"Path.StraightLineContinuous":"Path.Complex",!1)),e.speedDegPerS!==void 0){const n=e.speedDegPerS;i((e.speedVariation??0)>3?"AngularSpeed.Variable":n<.01?"AngularSpeed.VeryLowOrStationary":n>10?"AngularSpeed.VeryHighStreaking":"AngularSpeed.SlowLikePlaneAtHighAltitude",!1)}if(e.count!==void 0&&i(e.count>1?"ObjectsCount.Several":"ObjectsCount.Single"),e.aligned&&i("Formation.Line"),e.round!==void 0&&i(e.round?"ObjectShape.Round":"ObjectShape.Other",!1),e.colors&&e.colors.length>0){const n=e.colors.length>1?"Color.MutipleLights":wi.colorClass(e.colors[0]);n&&i(n)}return e.brightness!==void 0&&e.brightness>=.5&&i("Luminosity.Intense",!1),e.observers!==void 0&&i(e.observers>1?"IndependentWitnessesCount.Several":"IndependentWitnessesCount.Single",this.conditions?.independent!==!1),e.sound&&i("Noise.Perceived"),e.nakedEye&&i("Detection.NakedEye"),t}static colorClass(e){const t=/^#([0-9a-f]{6})$/i.exec(e);if(!t)return;const i=parseInt(t[1],16),[s,n,r]=[i>>16&255,i>>8&255,i&255],o=Math.max(s,n,r),l=Math.min(s,n,r);return o-l<40?"Color.White":s===o&&n<s*.85&&r<s*.6?"Color.RedOrange":n===o&&s<n*.7?"Color.Green":void 0}}class se{constructor(e,t){this.host=e,this.section=t}static CSS=`
89
+ .candidates { display: grid; gap: 8px; }
90
+ .candidate { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--ground); }
91
+ .candidate-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; min-height: 46px; padding: 0 14px;
92
+ border: 0; border-radius: 10px; background: none; color: var(--ink); font: 600 15px/1.3 var(--sans); text-align: left; }
93
+ .candidate-head:hover:not(:disabled) { background: var(--ground-sunken); }
94
+ .candidate-head::before { content: "›"; color: var(--ink-faint); transition: transform .12s ease; }
95
+ .candidate[open] .candidate-head::before { transform: rotate(90deg); }
96
+ .verdict { user-select: none; padding: 2px 9px; border-radius: 6px; font: 600 12px/1.5 var(--sans); background: var(--neutral-bg); }
97
+ .verdict[data-verdict="consolidated"] { background: light-dark(rgba(31, 122, 68, .14), rgba(143, 215, 164, .16)); }
98
+ .verdict[data-verdict="contested"] { background: var(--warn-bg); }
99
+ .verdict[data-verdict="incompatible"] { background: var(--error-bg); }
100
+ .cost { font-size: 13px; color: var(--ink-faint); font-weight: 400; }
101
+ .candidate-body { display: grid; gap: 6px; padding: 4px 14px 14px; font-size: 14px; }
102
+ .candidate-body[hidden] { display: none; }
103
+ .moved-row { display: grid; grid-template-columns: minmax(8em, auto) minmax(0, auto) minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
104
+ .moved-row s, .variant-value s { color: var(--ink-faint); text-decoration-color: var(--error); }
105
+ .moved-row b, .variant-value b { color: var(--ink); }
106
+ .moved-row .bias { color: var(--ink-dim); }
107
+ .reading-row { grid-template-columns: minmax(8em, auto) minmax(0, 1fr) auto; }
108
+ .candidate-reason { margin: 0; color: var(--ink-dim); }
109
+ .candidates-note { margin: 4px 0 0; font-size: 13px; color: var(--ink-faint); }
110
+ .variant-value { flex: 1 0 100%; font: 400 13px/1.4 var(--sans); }
111
+ .poher-tag { user-select: none; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: var(--neutral-bg); color: var(--ink-dim); font: 600 11px/1.6 var(--sans); }
112
+ .poher-tag[data-excluded="true"] { background: var(--error-bg); }
113
+ .poher-answers { font-size: 13px; color: var(--ink-dim); }
114
+ .poher-answers summary { cursor: pointer; font-weight: 600; }
115
+ .poher-answers ul, .poher-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }
116
+ .poher-answers li[data-firm="false"] { color: var(--ink-faint); }
117
+ .firmness { font-size: 11px; color: var(--ink-faint); }
118
+ .poher-block h4 { margin: 14px 0 2px; font: 600 15px/1.3 var(--serif); }
119
+ .poher-block h5 { margin: 8px 0 0; font: 600 12px/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--glow-dim); }
120
+ .poher-block details summary { margin-top: 8px; cursor: pointer; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
121
+ .poher-list { font-size: 14px; }
122
+ .poher-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; vertical-align: middle;
123
+ background: linear-gradient(90deg, var(--glow-solid) calc(var(--score) * 100%), var(--line) 0); }
124
+ .poher-list .doubt { color: var(--ink-faint); font-size: 12px; }
125
+ .poher-version { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-dim); }
126
+ /* Two of the section's columns: one is narrower than the name of a version ("Poher extended by RR0"). */
127
+ .candidates-section > .poher-version { grid-column: span 2; }
128
+ .candidate-actions { display: flex; flex-wrap: wrap; gap: 8px; }
129
+ .kept-variants h4 { margin: 14px 0 6px; font: 600 15px/1.3 var(--serif); }
130
+ .kept-variant { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; margin-bottom: 6px; border: 1px dashed var(--line-strong); border-radius: 10px; }
131
+ .kept-variant .recomputed { flex: 1 0 100%; font-size: 13px; color: var(--glow); }
132
+ .variant-badge { position: absolute; top: 10px; left: 10px; z-index: 5; display: inline-flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px;
133
+ border-radius: 999px; background: rgba(127, 212, 255, .94); color: #07111c; font: 600 13px/1.3 var(--sans); }
134
+ .variant-badge button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(7, 10, 18, .85); color: #e8ecf4; font: 600 12px/1 var(--sans); }
135
+ `;static PLANETS=["Venus","Mars","Jupiter","Saturn"];static STARS=6;static STAR_MAG=1.5;static SATELLITES=4;static AIRCRAFT=12;static AIRCRAFT_RANGE_KM=80;static SPAN_M=35;static FT_M=.3048;statementT=0;poher;poherState="idle";poherVersion=se.storedVersion();static VERSION_STORAGE="ufoathome.poherMatrixVersion";kindsLoading=new WeakSet;phenomenonOf=new Map;variants=[];shown;open=new Set;statement(){const e=this.host.sighting,t=e.timeline,i=t.sourceIds[0];if(!i)return;const s=t.allKeyframes.find(a=>a.shapes.some(d=>d.sourceId===i))?.t??0;this.statementT=s;const n=t.getInterpolatedShapeAt(s,i);if(!n?.aim)return;const r={aim:n.aim,widthDeg:n.angular?.widthDeg,timeHow:e.provenance.at("time")?.how},o=[...t.allKeyframes].reverse().find(a=>a.t>s&&t.getShapeAt(a.t,i)?.aim),l=o?t.getInterpolatedShapeAt(o.t,i):void 0;if(o&&l?.aim){r.motion={sweepDeg:N.separation(n.aim,l.aim),spanMinutes:(o.t-s)/6e4};const a=n.angular?.widthDeg,d=l.angular?.widthDeg;a&&d&&(r.growth=d/a)}return r}tracks(e){const t=this.host.start();if(!t)return[];const i=this.host.messages().candidates.bodies,s=o=>({id:o,label:i[o]??o,at:l=>{const a=new Date(t.date.getTime()+this.statementT+l*6e4),d=K(o,a,t.observer);if(d.altitudeDeg<0)return;const h=K("Sun",a,t.observer).altitudeDeg,c=o==="Moon"?-10:sn(o,a);if(!(c>this.host.limitAt(h)))return{aim:{azimuthDeg:d.azimuthDeg,altitudeDeg:d.altitudeDeg},widthDeg:o==="Moon"?Q.MOON_DEG:.01,magnitude:c}},readings:["still-seen-moving"]});this.phenomenonOf.clear();const n=[s("Moon")];this.phenomenonOf.set("Moon","Moon");for(const o of se.PLANETS)n.push(s(o)),this.phenomenonOf.set(o,"Planets");n.push(...this.starTracks(t,e));const r=this.host.satellites();if(r){const o=new Map,l=d=>(o.has(d.getTime())||o.set(d.getTime(),r.positionsAt(d)),o.get(d.getTime())),a=[...r.passes].sort((d,h)=>(d.peak.magnitude??99)-(h.peak.magnitude??99)).slice(0,se.SATELLITES);for(const d of a){const h=`satellite-${d.object.norad}`;n.push({id:h,label:d.object.name,at:c=>{const u=l(new Date(t.date.getTime()+this.statementT+c*6e4))?.find(p=>p.object.norad===d.object.norad);if(!(!u||u.altitudeDeg<0||u.sunlitFraction<.5))return{aim:{azimuthDeg:u.azimuthDeg,altitudeDeg:u.altitudeDeg},widthDeg:.01,magnitude:u.magnitude}},readings:["brightening-as-approach"]}),this.phenomenonOf.set(h,"OrbitingSatellites")}}return n.push(...this.burningTracks(t),...this.aircraftTracks(t),...this.interpretationTracks()),n}starTracks(e,t){const i=this.host.messages().candidates,s=h=>new Date(e.date.getTime()+this.statementT+h*6e4),n=h=>K("Sun",h,e.observer).altitudeDeg,r=this.host.limitAt(n(s(0))),o=t.aim,l=Math.PI/180,a=h=>o?Math.acos(Math.min(1,Math.sin(o.altitudeDeg*l)*Math.sin(h.altitudeDeg*l)+Math.cos(o.altitudeDeg*l)*Math.cos(h.altitudeDeg*l)*Math.cos((h.azimuthDeg-o.azimuthDeg)*l)))/l:0;return tn.filter(h=>h.mag<=Math.min(r,se.STAR_MAG)).map(h=>({star:h,position:Ii(h.raHours,h.decDeg,s(0),e.observer)})).filter(({position:h})=>h.altitudeDeg>0).sort((h,c)=>a(h.position)-a(c.position)||h.star.mag-c.star.mag).slice(0,se.STARS).map(({star:h})=>{const c=`star-${h.name}`;return this.phenomenonOf.set(c,"Stars"),{id:c,label:i.star.replace("{name}",this.host.starName(h.name)),at:u=>{const p=s(u),m=Ii(h.raHours,h.decDeg,p,e.observer);if(!(m.altitudeDeg<0||h.mag>this.host.limitAt(n(p))))return{aim:{azimuthDeg:m.azimuthDeg,altitudeDeg:m.altitudeDeg},widthDeg:.01,magnitude:h.mag}},readings:["still-seen-moving"]}})}interpretationTracks(){const e=this.host.messages().candidates,t=this.host.sighting.timeline.sourceIds[0];return this.host.interpretations().flatMap(({id:i,label:s,interpretation:n})=>{const{interpretation:r,phenomenonOf:o,loaded:l}=this.host.computed(n);this.kindsLoading.has(n)||(this.kindsLoading.add(n),l.then(()=>{this.host.interpretations().some(h=>h.interpretation===n)&&this.refresh()}));const a=r.bodies.find(h=>t!==void 0&&h.explains?.includes(t))??r.bodies[0];if(!a)return[];const d=o.get(a.id);return d&&this.phenomenonOf.set(`interpretation-${i}`,d),[{id:`interpretation-${i}`,label:e.interpretation.replace("{name}",s),at:h=>{const c=this.host.projectionAt(a,this.statementT+h*6e4);return c?{aim:c.aim,widthDeg:c.angular.widthDeg}:void 0}}]})}burningTracks(e){const t=this.host.messages().candidates,{reentries:i,fireballs:s}=this.host.burning(),n={lat:e.observer.lat,lng:e.observer.lng,heightM:e.observer.elevationM},r=(o,l)=>{const a=`${l?"fireball":"reentry"}-${o.id}`;this.phenomenonOf.set(a,l?"Meteorits":"AtmosphericSatellitesReentry");const d=o.object?.name??o.id;return{id:a,label:(l?t.fireball:t.reentry).replace("{name}",d),at:h=>{const c=this.statementT+h*6e4,u=jt.viewsAt([o],c,n).filter(g=>g.head.altitudeDeg>=0);if(u.length===0)return;const p=K("Sun",new Date(e.date.getTime()+c),e.observer).altitudeDeg,m=u.reduce((g,b)=>b.magnitude<g.magnitude?b:g);if(m.magnitude>this.host.limitAt(p))return;let f=0;for(const g of u)for(const b of u)f=Math.max(f,Math.hypot(g.head.azimuthDeg-b.head.azimuthDeg,g.head.altitudeDeg-b.head.altitudeDeg));return{aim:{azimuthDeg:m.head.azimuthDeg,altitudeDeg:m.head.altitudeDeg},widthDeg:Math.max(.01,f),magnitude:m.magnitude}},readings:["grouped","brightening-as-approach"]}};return[...i.map(o=>r(o,!1)),...s.map(o=>r(o,!0))]}aircraftTracks(e){const t=this.host.traffic();if(!t)return[];const i=this.host.messages().candidates,s={lat:e.observer.lat,lng:e.observer.lng,heightM:e.observer.elevationM},n=t.startMs+this.statementT,r=(l,a)=>{const d=l.points;if(d.length===0||a<d[0].t||a>d[d.length-1].t)return;let h=0;for(;h<d.length-2&&d[h+1].t<a;)h++;const c=d[h],u=d[Math.min(h+1,d.length-1)],p=u.t>c.t?(a-c.t)/(u.t-c.t):0;return{lat:c.lat+(u.lat-c.lat)*p,lng:c.lng+(u.lng-c.lng)*p,heightM:(c.altitudeFt+(u.altitudeFt-c.altitudeFt)*p)*se.FT_M}};return t.tracks.map(l=>({track:l,point:r(l,n)})).filter(l=>l.point!==void 0).map(l=>({...l,seen:jt.seenFrom(s,l.point)})).filter(l=>l.seen.distanceKm<=se.AIRCRAFT_RANGE_KM).sort((l,a)=>l.seen.distanceKm-a.seen.distanceKm).slice(0,se.AIRCRAFT).map(({track:l,point:a})=>{const d=t.describe(l),h=`aircraft-${l.icao}`;this.phenomenonOf.set(h,d?.category==="A7"?"Helicopters":a.heightM>15e3*se.FT_M?"HighAltitudePlanes":"LowAltitudePlanes");const c=d?.restricted?l.icao.toString(16).toUpperCase():[d?.type,d?.registration].filter(Boolean).join(" ")||l.icao.toString(16).toUpperCase();return{id:h,label:i.aircraft.replace("{name}",c),at:u=>{const p=r(l,n+u*6e4);if(!p)return;const m=jt.seenFrom(s,p);if(m.altitudeDeg<0||m.distanceKm>se.AIRCRAFT_RANGE_KM)return;const f=Math.atan2(se.SPAN_M,m.distanceKm*1e3)*180/Math.PI;return{aim:{azimuthDeg:m.azimuthDeg,altitudeDeg:m.altitudeDeg},widthDeg:f}},readings:["grouped","moving-seen-still","brightening-as-approach"]}})}ranking(){if(!this.poher)return;const e=new wi(this.host.model(),this.host.conditions()).of(this.host.facts()).filter(t=>this.poher.matrix.has(t.question));return{rows:this.poher.matrix.rank(e),answers:e}}languageChanged(){this.poherState!=="loading"&&(this.poherState="idle",this.poher=void 0)}loadPoher(){if(this.poherState!=="idle")return;this.poherState="loading";const e=this.poherVersion;this.host.poher(e).then(t=>{e===this.poherVersion&&(this.poher=t,this.poherState="ready",this.refresh())},()=>{e===this.poherVersion&&(this.poherState="failed",this.refresh())})}refresh(){const e=this.host.messages().candidates,t=this.statement(),i=this.host.start();this.variants=t&&i?new N(this.host.model(),this.host.conditions()).search(t,this.tracks(t)):[];const n=[Object.assign(document.createElement("h3"),{className:"section-title",textContent:e.title})];this.loadPoher();const r=this.ranking();if(n.push(this.versionChoice()),this.poherState==="loading"&&n.push(this.note(e.poherLoading)),this.poherState==="failed"&&n.push(this.note(e.poherFailed)),r&&n.push(this.answersBlock(r.answers)),!t)n.push(this.note(e.noDirection));else if(!i)n.push(this.note(e.noSky));else{const a=document.createElement("div");a.className="candidates",a.append(...this.variants.map(d=>this.row(d,r?.rows.find(h=>h.phenomenon===this.phenomenonOf.get(d.candidate))))),n.push(a,this.note(e.costNote))}const o=this.keptBlock();o&&n.push(o),r&&n.push(this.poherBlock(r.rows)),n.push(this.note(e.scopeNote)),this.section.replaceChildren(...n);const l=this.shown&&this.variants.find(a=>a.candidate===this.shown.candidate);this.show(l&&l.verdict!=="incompatible"?l:void 0)}keep(e){const t=this.phenomenonOf.get(e.candidate),i=e.candidate.startsWith("interpretation-")?this.host.interpretations().find(({id:r})=>`interpretation-${r}`===e.candidate)?.interpretation:void 0,s={title:this.host.messages().candidates.variantLabel.replace("{name}",e.label),bodies:i?structuredClone(i.bodies):[],variant:{candidate:e.candidate,label:e.label,...t?{phenomenon:t}:{},parameters:e.parameters,moved:e.moved.map(r=>({...r})),...e.readings.length>0?{readings:e.readings.map(r=>({...r}))}:{},cost:e.cost,verdict:e.verdict,modelId:e.modelId}},n=this.host.variants().findIndex(r=>r.variant?.candidate===e.candidate&&r.variant?.modelId===e.modelId);n>=0&&this.host.remove(n),this.host.keep(s),this.refresh()}keptBlock(){const e=this.host.variants();if(e.length===0)return;const t=this.host.messages(),i=document.createElement("div");return i.className="kept-variants",i.append(Object.assign(document.createElement("h4"),{textContent:t.candidates.keptTitle.replace("{n}",String(e.length))})),e.forEach((s,n)=>{const r=s.variant;if(!r)return;const o=document.createElement("div");o.className="kept-variant";const l=Object.assign(document.createElement("span"),{className:"verdict",textContent:t.candidates.verdicts[r.verdict]});l.dataset.verdict=r.verdict;const a=Object.assign(document.createElement("span"),{className:"cost",textContent:t.candidates.cost.replace("{x}",this.number(r.cost))}),d=Object.assign(document.createElement("span"),{className:"cost",textContent:t.candidates.keptModel.replace("{model}",t.models[r.modelId]??r.modelId)});o.append(Object.assign(document.createElement("strong"),{textContent:r.label??r.candidate}),l,a,d);const h=this.variants.find(p=>p.candidate===r.candidate);h&&(h.verdict!==r.verdict||Math.abs(h.cost-r.cost)>.05||h.modelId!==r.modelId)&&o.append(Object.assign(document.createElement("span"),{className:"recomputed",textContent:t.candidates.keptRecomputed.replace("{verdict}",t.candidates.verdicts[h.verdict]).replace("{x}",this.number(h.cost))}));const c=document.createElement("button");c.type="button",c.className="pill-btn",c.textContent=t.candidates.seeKept,c.addEventListener("click",()=>this.show({candidate:r.candidate,label:r.label??r.candidate,verdict:r.verdict,cost:r.cost,parameters:r.parameters,moved:r.moved,readings:r.readings??[],modelId:r.modelId}));const u=document.createElement("button");u.type="button",u.className="pill-btn",u.textContent=t.candidates.removeVariant,u.addEventListener("click",()=>{this.host.remove(n),this.refresh()}),o.append(c,u),i.append(o)}),i}static storedVersion(){try{const e=localStorage.getItem(se.VERSION_STORAGE);if(e&&e in ze.VERSIONS)return e}catch{}return ze.DEFAULT_VERSION}versionChoice(){const e=this.host.messages().candidates,t=Object.assign(document.createElement("label"),{className:"poher-version",textContent:e.poherVersion}),i=document.createElement("select");i.style.setProperty("field-sizing","content"),i.style.width="auto",i.style.maxWidth="100%";for(const s of Object.keys(ze.VERSIONS))i.append(Object.assign(document.createElement("option"),{value:s,textContent:e.poherVersions[s],selected:s===this.poherVersion}));return i.addEventListener("change",()=>{this.poherVersion=i.value;try{localStorage.setItem(se.VERSION_STORAGE,this.poherVersion)}catch{}this.poherState="idle",this.poher=void 0,this.refresh()}),t.append(i),t}exclusion(e){const t=this.host.messages().candidates;return t.poherExcludedBy.replace("{list}",e.excludedBy.map(i=>{const s=this.poher?.matrix.reason(e.phenomenon,i);return s?`${this.answerLabel(i)} (${t.poherRr0Reason.replace("{why}",s.why)})`:this.answerLabel(i)}).join(", "))}answerLabel(e){const t=this.poher?.labels??{},i=e.slice(0,e.indexOf("."));return`${t[i]??i} : ${t[e]??e.slice(e.indexOf(".")+1)}`}answersBlock(e){const t=this.host.messages().candidates,i=document.createElement("details");i.className="poher-answers",i.append(Object.assign(document.createElement("summary"),{textContent:t.answersTitle.replace("{n}",String(e.length))}));const s=document.createElement("ul");for(const n of e){const r=document.createElement("li");r.append(this.answerLabel(n.question)," ",Object.assign(document.createElement("span"),{className:"firmness",textContent:n.firm?t.firm:t.soft})),r.dataset.firm=String(n.firm),s.append(r)}return i.append(s),i}poherBlock(e){const t=this.host.messages().candidates,i=this.poher?.labels??{},s=new Set(this.phenomenonOf.values()),n=e.filter(h=>!s.has(h.phenomenon)),r=document.createElement("div");r.className="poher-block",r.append(Object.assign(document.createElement("h4"),{textContent:t.poherTitle.replace("{version}",t.poherVersions[this.poherVersion])}),Object.assign(document.createElement("p"),{className:"candidates-note",textContent:this.poher?.matrix.reasons?t.poherIntroRr0:t.poherIntro}));const o=h=>{const c=document.createElement("li");if(c.append(Object.assign(document.createElement("strong"),{textContent:i[h.phenomenon]??h.phenomenon})),h.added&&c.append(" ",Object.assign(document.createElement("span"),{className:"poher-tag",textContent:t.poherAdded})),h.excludedBy.length>0)c.append(" — ",this.exclusion(h));else{const u=document.createElement("span");u.className="poher-bar",u.style.setProperty("--score",String(h.mean)),c.append(" ",u," ",t.poherScore.replace("{x}",this.number(Q.rounded(h.mean)))),h.doubtedBy.length>0&&c.append(Object.assign(document.createElement("span"),{className:"doubt",textContent:` · ${t.poherDoubted.replace("{list}",h.doubtedBy.map(p=>this.answerLabel(p)).join(", "))}`}))}return c},l=n.filter(h=>h.excludedBy.length===0),a=n.filter(h=>h.excludedBy.length>0),d=document.createElement("ul");if(d.className="poher-list",d.append(...l.map(o)),r.append(Object.assign(document.createElement("h5"),{textContent:t.poherPossible}),d),a.length>0){const h=document.createElement("details");h.append(Object.assign(document.createElement("summary"),{textContent:t.poherExcluded.replace("{n}",String(a.length))}));const c=document.createElement("ul");c.className="poher-list",c.append(...a.map(o)),h.append(c),r.append(h)}return r}note(e){return Object.assign(document.createElement("p"),{className:"candidates-note",textContent:e})}row(e,t){const i=this.host.messages().candidates,s=document.createElement("div");s.className="candidate";const n=document.createElement("button");n.type="button",n.className="candidate-head",n.setAttribute("aria-expanded",String(this.open.has(e.candidate)));const r=Object.assign(document.createElement("span"),{className:"verdict",textContent:i.verdicts[e.verdict]});r.dataset.verdict=e.verdict;const o=Object.assign(document.createElement("span"),{className:"cost",textContent:Number.isFinite(e.cost)?i.cost.replace("{x}",this.number(e.cost)):""}),l=Object.assign(document.createElement("span"),{textContent:e.label});if(t){const d=Object.assign(document.createElement("span"),{className:"poher-tag",textContent:i.poherTag.replace("{state}",t.excludedBy.length>0?i.poherStateExcluded:i.poherStatePossible.replace("{x}",this.number(Q.rounded(t.mean))))});d.dataset.excluded=String(t.excludedBy.length>0),l.append(" ",d)}n.append(l,r,o);const a=document.createElement("div");a.className="candidate-body",a.hidden=!this.open.has(e.candidate),s.toggleAttribute("open",!a.hidden),n.addEventListener("click",()=>{this.open.has(e.candidate)?this.open.delete(e.candidate):this.open.add(e.candidate),a.hidden=!a.hidden,s.toggleAttribute("open",!a.hidden),n.setAttribute("aria-expanded",String(!a.hidden))}),t&&t.excludedBy.length>0&&a.append(Object.assign(document.createElement("p"),{className:"candidate-reason",textContent:`${i.poherTag.replace("{state}",i.poherStateExcluded)} — ${this.exclusion(t)}`})),e.verdict==="incompatible"&&a.append(Object.assign(document.createElement("p"),{className:"candidate-reason",textContent:`${i.reasons[e.reason??"direction"]} ${i.notAgainst}`}));for(const d of e.moved)a.append(this.movedRow(d));for(const d of e.readings)a.append(this.readingRow(d));if(e.verdict!=="incompatible"){const d=document.createElement("button");d.type="button",d.className="pill-btn",d.textContent=i.seeVariant,d.addEventListener("click",()=>this.show(e));const h=document.createElement("button");h.type="button",h.className="pill-btn",h.textContent=i.keepVariant,h.addEventListener("click",()=>this.keep(e));const c=document.createElement("div");c.className="candidate-actions",c.append(d,h),a.append(c)}return s.append(n,a),s}readingRow(e){const t=this.host.messages().candidates,i=document.createElement("div");return i.className="moved-row reading-row",i.append(Object.assign(document.createElement("span"),{textContent:t.readingTitle}),Object.assign(document.createElement("span"),{className:"bias",textContent:t.readings[e.reading]}),this.status(e.status)),i}movedRow(e){const t=this.host.messages(),i=document.createElement("div");i.className="moved-row";const[s,n]=this.values(e),r=document.createElement("span");r.append(Object.assign(document.createElement("s"),{textContent:s})," → ",Object.assign(document.createElement("b"),{textContent:n}));const o=e.parameter==="clock"||e.parameter==="heading"||e.parameter==="sweep"?`${e.amount>0?"+":""}${this.number(Q.rounded(e.amount))}`:this.number(Q.rounded(e.amount));return i.append(Object.assign(document.createElement("span"),{textContent:t.candidates.fields[e.field]}),r,Object.assign(document.createElement("span"),{className:"bias",textContent:t.candidates.biases[e.parameter].replace("{x}",o)}),this.status(e.status)),i}status(e){const t=Object.assign(document.createElement("span"),{className:"lead-status",textContent:this.host.messages().status[e]});return t.dataset.status=e,t}values(e){if(e.field==="time"){const i=this.host.start();if(!i)return["",""];const s=n=>n.toLocaleTimeString(document.documentElement.lang||void 0,{hour:"2-digit",minute:"2-digit"});return[s(i.date),s(new Date(i.date.getTime()+e.variant*6e4))]}if(e.field==="duration"){const i=s=>`${this.number(Q.rounded(s))} s`;return[i(e.stated),i(e.variant)]}const t=i=>`${this.number(Q.rounded(i))}°`;return[t(e.stated),t(e.variant)]}number(e){return e.toLocaleString(document.documentElement.lang||void 0,{maximumFractionDigits:2})}show(e){this.shown=e;const t=this.host.sceneCard();t.querySelector(".variant-badge")?.remove();for(const o of Object.values(this.host.fieldLabels()))o?.querySelector(".variant-value")?.remove();if(!e)return;const i=this.host.messages().candidates,s=document.createElement("div");s.className="variant-badge",s.setAttribute("role","status");const n=document.createElement("button");n.type="button",n.textContent=i.backToAccount,n.addEventListener("click",()=>this.show(void 0)),s.append(i.variantLabel.replace("{name}",e.label),n),t.append(s);const r=this.host.fieldLabels();for(const o of e.moved){const l=r[o.field];if(!l)continue;const[a,d]=this.values(o),h=document.createElement("span");h.className="variant-value",h.append(Object.assign(document.createElement("s"),{textContent:a})," → ",Object.assign(document.createElement("b"),{textContent:d})),l.append(h)}}get variant(){return this.shown}}class Bs{constructor(e,t){this.card=e,this.picture=t,this.layer=document.createElement("div"),this.layer.className="scene-field-overlay",this.layer.hidden=!0,this.layer.setAttribute("aria-hidden","true"),e.append(this.layer)}static CSS=`
136
+ .scene-field-overlay { position: absolute; z-index: 3; pointer-events: none; }
137
+ .scene-field-overlay[hidden] { display: none; }
138
+ .scene-field-overlay > * { position: absolute; }
139
+ .sfo-pill {
140
+ padding: 3px 9px; border-radius: 999px; background: rgba(7, 10, 18, .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
141
+ color: #f5c451; font: 600 12px/1.4 var(--sans, sans-serif); white-space: nowrap;
142
+ }
143
+ .sfo-horizon { left: 0; right: 0; height: 0; border-top: 2px dashed #f5c451; }
144
+ .sfo-horizon > .sfo-pill { position: absolute; left: 10px; top: 4px; }
145
+ .sfo-frame { inset: 0; border: 2px solid #f5c451; box-sizing: border-box; }
146
+ .sfo-frame > .sfo-pill { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); }
147
+ .sfo-measure { aspect-ratio: 1; border: 2px dashed #f5c451; border-radius: 50%; transform: translate(-50%, -50%); box-sizing: border-box; }
148
+ .sfo-measure > .sfo-pill { position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); }
149
+ .sfo-wind { left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; }
150
+ .sfo-heading { left: 50%; top: 10px; transform: translateX(-50%); }
151
+ .scene-field-overlay { overflow: hidden; }
152
+ .sfo-curve { inset: 0; }
153
+ .sfo-curve svg { width: 100%; height: 100%; overflow: visible; }
154
+ .sfo-curve path { fill: none; stroke: #f5c451; stroke-width: 2px; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
155
+ .sfo-horizon-label { left: 10px; margin-top: 4px; }
156
+ /* Standing on the horizon, never across its line. */
157
+ .sfo-compass { transform: translate(-50%, calc(-100% - 5px)); padding: 1px 7px; color: #fff; }
158
+ .sfo-wind svg { transition: transform .15s ease; }
159
+ `;layer;hide(){this.layer.hidden=!0,this.layer.replaceChildren()}horizon(e,t){const i=this.element("sfo-horizon");i.style.top=`${e*100}%`,i.append(this.pill(t)),this.show(i)}frame(e){const t=this.element("sfo-frame");t.append(this.pill(e)),this.show(t)}measure(e,t,i,s){const n=this.element("sfo-measure");n.style.left=`${e*100}%`,n.style.top=`${t*100}%`,n.style.width=`${Math.max(i,.02)*100}%`,s&&n.append(this.pill(s)),this.show(n)}orientation(e,t){const i=[];if(t){const s=this.element("sfo-curve"),n=t.line.filter(o=>o.length>1).map(o=>o.map((l,a)=>`${a===0?"M":"L"}${(l.x*100).toFixed(2)} ${(l.y*100).toFixed(2)}`).join(" ")).join(" ");s.innerHTML=`<svg viewBox="0 0 100 100" preserveAspectRatio="none"><path d="${n}"/></svg>`,i.push(s);const r=t.line.flat().filter(o=>o.x>=0&&o.x<=1&&o.y>=0&&o.y<=1).sort((o,l)=>o.x-l.x)[0];if(r){const o=this.pill(t.label);o.classList.add("sfo-horizon-label"),o.style.top=`${r.y*100}%`,i.push(o)}}if(e){for(const n of e.compass){const r=this.pill(n.label);r.classList.add("sfo-compass"),r.style.left=`${n.x*100}%`,r.style.top=`${n.y*100}%`,i.push(r)}const s=this.pill(e.label);s.classList.add("sfo-heading"),i.push(s)}i.length===0?this.hide():this.show(...i)}wind(e,t){const i=this.pill(t);i.classList.add("sfo-wind"),i.insertAdjacentHTML("afterbegin",`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" style="transform: rotate(${e}deg)"><path d="M8 13.5V2.5"/><path d="M4 6.5 8 2.5l4 4"/></svg>`),this.show(i)}show(...e){const t=this.card.getBoundingClientRect(),i=this.picture().getBoundingClientRect();Object.assign(this.layer.style,{left:`${i.left-t.left}px`,top:`${i.top-t.top}px`,width:`${i.width}px`,height:`${i.height}px`}),this.layer.replaceChildren(...e),this.layer.hidden=!1}element(e){const t=document.createElement("div");return t.className=e,t}pill(e){const t=this.element("sfo-pill");return t.textContent=e,t}}const Qn=[{key:"cars",max:999},{key:"trucks",max:999},{key:"people",max:9999},{key:"talking",max:9999},{key:"withinM",max:9999,unit:"m"}],er=[{key:"distanceM",max:99999,unit:"m"},{key:"vehiclesPerMinute",max:999,unit:"perMinute",step:"0.1"},{key:"trucksPerMinute",max:999,unit:"perMinute",step:"0.1"},{key:"speedKmh",max:200,unit:"km/h"}];class tr{constructor(e,t){this.root=e,this.host=t}messages;basisMessages;localize(e,t){this.messages=e,this.basisMessages=t,this.render()}render(){const e=this.messages;if(!e)return;const t=this.root.querySelector(".section-title");t&&t.replaceChildren(document.createTextNode(e.title)," ",De.of(e.hint));const i=this.root.querySelector(".around-body")??this.root,s=this.host.sighting().around??{},n=document.createElement("div");n.className="around-counted",n.append(this.heading(e.counted));for(const d of Qn){const h=e[d.key==="withinM"?"within":d.key];n.append(this.field(h,`around.${d.key}`,s[d.key],d.max,"1",d.unit??"",c=>this.edit(u=>{c===void 0?delete u[d.key]:u[d.key]=c}),d.key==="withinM"?String(Gt.DEFAULT_WITHIN_M):void 0))}const r=document.createElement("div");r.className="around-roads",r.append(this.heading(e.roads)),(s.roads??[]).forEach((d,h)=>r.append(this.road(d,h,e)));const o=document.createElement("button");o.type="button",o.className="around-add-road",o.textContent=e.addRoad,o.addEventListener("click",()=>this.edit(d=>{d.roads=[...d.roads??[],{distanceM:50,vehiclesPerMinute:5}]},!0)),r.append(o);const l=document.createElement("output");l.className="place-status around-heard";const a=Ti.dbA(this.host.sighting().around);l.textContent=Number.isFinite(a)?e.heard.replace("{level}",a.toFixed(0)):e.quiet,i.replaceChildren(n,r,l),Rt.fit(i)}road(e,t,i){const s=document.createElement("div");s.className="around-road";for(const r of er){const o=r.key==="distanceM"?i.roadDistance:r.key==="speedKmh"?i.speed:i[r.key],l=r.unit==="perMinute"?i.perMinute:r.unit,a=r.key==="distanceM"||r.key==="vehiclesPerMinute";s.append(this.field(o,`around.roads.${t}.${r.key}`,e[r.key],r.max,r.step??"1",l,d=>this.edit(h=>{const c=[...h.roads??[]],u={...c[t]};if(d===void 0){if(a)return;delete u[r.key]}else u[r.key]=d;c[t]=u,h.roads=c}),r.key==="speedKmh"?String(Gt.DEFAULT_SPEED_KMH):void 0))}const n=document.createElement("button");return n.type="button",n.className="around-remove-road",n.title=i.removeRoad,n.setAttribute("aria-label",i.removeRoad),n.textContent="×",n.addEventListener("click",()=>this.edit(r=>{r.roads=(r.roads??[]).filter((a,d)=>d!==t);const o=this.host.sighting().provenance,l=[];for(const a of o.paths()){const d=/^around\.roads\.(\d+)\.(.+)$/.exec(a);if(!d)continue;const h=Number(d[1]),c=o.at(a);o.clear(a),h>t&&c&&l.push([`around.roads.${h-1}.${d[2]}`,c])}for(const[a,d]of l)o.set(a,d)},!0)),s.append(n),s}heading(e){const t=document.createElement("h4");return t.className="around-heading",t.textContent=e,t}field(e,t,i,s,n,r,o,l){const a=document.createElement("label"),d=document.createElement("span");d.textContent=e;const h=document.createElement("input");h.type="number",h.min="0",h.max=String(s),h.step=n,h.dataset.path=t,l&&(h.placeholder=l),h.value=i===void 0?"":String(i);const c=this.basis(t);return c.hidden=i===void 0,h.addEventListener("input",()=>{const u=Number(h.value),p=h.value===""||!Number.isFinite(u)?void 0:u;c.hidden=p===void 0,o(p)}),a.append(d," ",c,h),r&&a.append(` ${r}`),a}basis(e){bi();const t=document.createElement(Xe.TAG);t.anchorKey=e,this.basisMessages&&(t.messages=this.basisMessages);const i=this.host.valueSources?.();return t.sourceMessages=i?.messages,t.choices=i?.choices??{},t.entry=this.host.sighting().provenance.at(e),t.addEventListener("basischange",s=>{const n=s.detail.entry;this.host.editing(),n?this.host.sighting().provenance.set(e,n):this.host.sighting().provenance.clear(e),this.host.changed()}),t}edit(e,t=!1){const i=this.host.sighting();this.host.editing();const s={...i.around??{}};e(s),i.around=Gt.read(s),this.host.changed(),t?this.render():this.refreshHeard()}refreshHeard(){const e=this.root.querySelector(".around-heard"),t=this.messages;if(!e||!t)return;const i=Ti.dbA(this.host.sighting().around);e.textContent=Number.isFinite(i)?t.heard.replace("{level}",i.toFixed(0)):t.quiet}}class ke{constructor(e,t,i,s="observer"){this.root=e,this.host=t,this.actor=s,this.words=i;const n=e.querySelector(".events-body");this.note=document.createElement("p"),this.note.className="events-note",this.reset=document.createElement("button"),this.reset.type="button",this.reset.className="events-reset",this.reset.addEventListener("click",()=>{this.host.editing(),ce.reset(this.host.sighting()),this.host.changed()});const r=document.createElement("div");r.className="events-row",this.fields=document.createElement("div"),this.fields.className="events-fields",n.replaceChildren(this.note,this.reset,r,this.fields);const o=document.createElement("div");o.className="events-timeline",this.empty=document.createElement("p"),this.empty.className="events-empty",this.addButton=document.createElement("button"),this.addButton.type="button",this.addButton.id=`${s}-event-add`,this.addButton.className="events-add",r.append(o,this.empty,this.addButton),this.addMenu=new ci(this.addButton,`${s}-event-kinds`,l=>this.add(l),l=>`${s}-event-kind-${l}`),this.timelineHost=o,this.timeline=new vi(o,l=>this.host.seek(l),{addKeyframeHere:i?.add??"",keyframeHere:i?.add??"",zoomHint:i?.zoomHint??""}),this.deleteButton=document.createElement("button"),this.deleteButton.type="button",this.deleteButton.id=`${s}-event-delete`,this.deleteButton.className="icon-btn events-delete",this.deleteButton.innerHTML=D.TRASH,this.deleteButton.addEventListener("click",()=>this.remove()),i&&this.localizeList()}static CSS=`${Xe.CSS}${De.CSS}
160
+ .events-section[hidden] { display: none; }
161
+ .events-note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--ink-dim); }
162
+ .events-row, .events-fields { grid-column: 1 / -1; min-width: 0; }
163
+ .events-row { display: grid; gap: 6px; }
164
+ .events-row .events-add { justify-self: start; }
165
+ .events-empty { margin: 0; font-size: 13px; color: var(--ink-dim); font-style: italic; }
166
+ /* An event of an instant is a bar too narrow to press: drawn wide enough. */
167
+ .events-timeline .track-lane .span[data-id] { min-width: 8px; }
168
+ .events-delete { justify-self: start; }
169
+ .events-fields { display: grid; gap: 6px; }
170
+ .event-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
171
+ /* A label wraps rather than push its field aside: no wider than a third of the panel. */
172
+ .event-params { display: grid; grid-template-columns: fit-content(33%) minmax(0, 1fr); gap: 4px 12px; align-items: baseline; font-size: 14px; }
173
+ .event-param { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; min-width: 0; }
174
+ .event-param-label { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
175
+ .event-param-label .basis-mark { margin-left: 0; }
176
+ .event-param-label:has(+ .event-param:is(:hover, :focus-within)) .basis-mark { opacity: 1; }
177
+ .event-params input[type="number"] { width: 6em; }
178
+ .event-params input[type="text"] { width: 10em; }
179
+ .event-table { display: grid; justify-items: start; gap: 4px; }
180
+ .event-rows { display: grid; grid-template-columns: repeat(var(--columns, 2), max-content); gap: 2px 8px; align-items: center; }
181
+ .event-row-step { font-size: 13px; white-space: nowrap; }
182
+ .event-direction-point { font-size: 13px; color: var(--ink-dim); }
183
+ .event-direction-look { font-size: 13px; }
184
+ `;static ADDABLE={observer:["look","walk","follow"],phenomenon:["stand","blink","turn","roll","vibrate","spiral","vanish"],bodies:["motion","spin","rise","turn","ride","light","blink","vanish"]};static CHOICES={sizeBy:{values:["","altitude"],absent:"",with:["sizeDeg"]},side:{values:["left","right"],with:[]},seenFrom:{values:["","craft"],absent:"",with:["side","byDeg"]}};static AMONG={target:["shape","group","body","decor"],in:["body","decor"],vehicle:["decor"]};words;get messages(){return this.words}note;reset;fields;timeline;timelineHost;empty;addButton;addMenu;deleteButton;picked;localize(e){this.words=e,this.localizeList(),this.render()}localizeList(){const e=this.messages;this.timeline.setMessages({addKeyframeHere:e.add,keyframeHere:e.add,zoomHint:e.zoomHint}),this.addButton.innerHTML=`${D.PLUS} ${e.add}`,this.addMenu.setKinds(ke.ADDABLE[this.actor].map(t=>({value:t,label:e.kinds[t]??t}))),this.empty.textContent=e.none,this.deleteButton.title=e.remove,this.deleteButton.setAttribute("aria-label",e.remove)}choose(e){this.picked=e;const t=this.host.sighting().events?.[e];t&&this.host.seek(t.t),this.render(),this.host.picked?.()}syncTimeline(e){const t=this.messages,i=d=>t.kinds[d.eventType]??d.eventType,s=e.map(({event:d,index:h})=>({id:String(h),t:d.t,until:Math.max(d.t,d.until??d.t),label:i(d)})),n=s.flatMap(d=>[d.t,d.until]),r=this.host.duration?.()??Math.max(1,...n),o=Math.min(...n),l=Math.max(...n),a=Math.max(500,(l-o)/10);this.timeline.show([{id:this.actor,label:this.titleText(),color:ke.COLOR,times:[],spans:s,selected:this.picked===void 0?void 0:String(this.picked),select:d=>this.choose(Number(d)),open:()=>{},add:()=>this.addButton.click()}],r,this.host.now(),{from:o-a,to:l+a})}setTime(e){this.timeline.setTime(e)}static COLOR="#4f8fd6";shownTheirs;sync(){this.theirs()!==this.shownTheirs&&this.render()}theirs(){const e=this.host.sighting();return this.actor==="observer"?ce.observerTrackIsExpanded(e):this.actor==="phenomenon"?ce.timelineIsExpanded(e):ce.bodiesAreExpanded(e)}who(){const e=this.host.sighting();if(this.actor==="observer")return V.observerId(e);if(this.actor==="bodies")return this.host.currentBody?.();const t=this.host.currentShapes?.();if(t!==void 0)return t;const i=(e.events??[]).find(n=>n.eventType==="stand"&&V.isPhenomenon(e,n));if(i?.who!==void 0)return i.who;const s=V.shapeIds(e);return s.length>0?e.timeline.topOf(s[0]):void 0}events(){const e=this.host.sighting(),t=this.actor==="bodies"?this.host.currentBody?.():void 0,i=s=>this.actor==="observer"?V.isObserver(e,s):this.actor==="phenomenon"?V.isPhenomenon(e,s):t!==void 0&&(s.who===t||V.partOf(s.who)?.element===t);return(e.events??[]).map((s,n)=>({event:s,index:n})).filter(({event:s})=>i(s))}get pickedIndex(){return this.picked}pick(e){this.picked=e,this.render(),this.root.scrollIntoView?.({block:"start"})}titleText(){return this.actor==="observer"?this.messages.title:this.actor==="phenomenon"?this.messages.phenomenonTitle:this.messages.bodyTitle.replace("{body}",this.host.bodyLabel?.(this.who()??"")??this.who()??"")}render(){if(!this.words)return;this.shownTheirs=this.theirs(),this.root.querySelector(".events-title").textContent=this.titleText(),this.root.hidden=this.actor==="bodies"&&this.who()===void 0;const e=this.events();e.some(({index:n})=>n===this.picked)||(this.picked=e[0]?.index);const t=this.shownTheirs;this.note.hidden=e.length===0,this.note.textContent=this.actor==="observer"?t?this.messages.derivedNote:this.messages.overriddenNote:this.actor==="phenomenon"?t?this.messages.derivedShapesNote:this.messages.overriddenShapesNote:t?this.messages.derivedBodiesNote:this.messages.overriddenBodiesNote,this.reset.hidden=e.length===0||t,this.reset.textContent=this.messages.resetToEvents,this.empty.hidden=e.length>0,this.timelineHost.hidden=e.length===0,this.syncTimeline(e);const i=this.picked===void 0?void 0:this.host.sighting().events?.[this.picked],s=i?this.details(i,this.picked):[];s[0]?.append(this.deleteButton),this.fields.replaceChildren(...s)}add(e){const t=this.host.sighting(),i=this.who();if(i===void 0)return;const s=Math.round(this.host.now()),n=t.observerTrack.getInterpolatedPoseAt(s)??t.observerTrack.getLatestPoseAt(s),r=n?.lat!==void 0&&n.lng!==void 0?{lat:n.lat,lng:n.lng}:t.event.place?.[0]&&{lat:t.event.place[0].lat,lng:t.event.place[0].lng},o=t.interpretation?.bodies.find(h=>h.id!==i)?.id??"",l={look:{params:{headingDeg:Math.round(n?.headingDeg??0),pitchDeg:Math.round(n?.pitchDeg??0)}},walk:{until:s+1e4,params:{from:{...r},to:{...r}}},follow:{until:s+5e3,params:{target:o}},stand:{params:{place:{...r},metres:[{t:s,widthM:1,heightM:1}]}},blink:{until:s+5e3,params:{onS:.5,offS:.5,off:{transparency:1}}},vanish:{},motion:{until:s+2e3,params:{motion:"",to:1}},spin:{until:s+5e3,params:{motion:"",turnsPerS:.5}},rise:{until:s+3e3,params:{distanceM:1,angleDeg:0,headingDeg:0,stops:!0}},ride:{params:{in:o,aboveM:0}},turn:{until:s+1e3,params:{headingDeg:0}}};this.actor==="phenomenon"&&Object.assign(l,{turn:{until:s+1e3,params:{byDeg:15,side:"left"}},roll:{until:s+500,params:{toDeg:20}},vibrate:{until:s+1e3,params:{hz:10,amplitudeShare:.1,riseS:.3}},spiral:{until:s+1e3,params:{turns:1,radiusDeg:2,shrink:.5,clockwise:!0,rollDeg:360}}}),this.actor==="bodies"&&Object.assign(l,{blink:{until:s+5e3,params:{onS:.5,offS:.5,cdM2:500}},light:{params:{cdM2:500}}});const a=l[e]??{},d={type:"event",eventType:e,who:i,t:s,...a.until===void 0?{}:{until:a.until},...a.params?{params:a.params}:{}};this.host.editing(),t.events=[...t.events??[],d],this.picked=t.events.length-1,ce.refresh(t),this.host.changed()}remove(){const e=this.host.sighting(),t=this.picked;if(t===void 0||!e.events?.[t])return;this.host.editing();const i=e.provenance,s=[];for(const n of i.paths()){const r=/^events\.(\d+)(\..*)?$/.exec(n);if(!r)continue;const o=Number(r[1]);o>t&&s.push([`events.${o-1}${r[2]??""}`,i.at(n)]),o>=t&&i.clear(n)}for(const[n,r]of s)i.set(n,r);e.events=e.events.filter((n,r)=>r!==t),this.picked=void 0,ce.refresh(e),this.host.changed()}details(e,t){const i=document.createElement("div");i.className="event-head",i.append(this.messages.from,this.seconds(e.t,r=>{e.t=r},`events.${t}.t`)),e.until!==void 0&&i.append(this.messages.to,this.seconds(e.until,r=>{e.until=r},`events.${t}.until`));const s=document.createElement("div");if(s.className="event-params",this.actor==="phenomenon"){const r=document.createElement("span");r.textContent=this.messages.who,s.append(r,this.subject(e))}if(this.actor==="bodies"){const r=document.createElement("span");r.textContent=this.messages.part,s.append(r,this.part(e))}const n=Object.entries(e.params??{});for(const[r,o]of Object.entries(ke.CHOICES))o.absent!==void 0&&o.with.every(l=>e.params?.[l]!==void 0)&&e.params?.[r]===void 0&&n.push([r,o.absent]);for(const[r,o]of n){const l=document.createElement("span");l.className="event-param-label";const a=document.createElement("span");a.className="event-param-name",a.textContent=this.messages.params[r]??r;const d=this.messages.paramHints[r];d&&a.append(De.of(d)),l.append(a,this.basis(`events.${t}.params.${r}`));const h=document.createElement("span");h.className="event-param",h.append(this.value(e,r,o,`events.${t}.params.${r}`)),s.append(l,h)}return[i,s]}subject(e){const t=this.host.sighting(),i=document.createElement("select");i.className="event-who";const s=[...t.timeline.allGroups.map(n=>n.id),...V.shapeIds(t)];e.who!==void 0&&!s.includes(e.who)&&s.unshift(e.who);for(const n of s){const r=document.createElement("option");r.value=n,r.textContent=this.host.shapesLabel?.(n)??n,i.append(r)}return i.value=e.who??"",i.addEventListener("change",()=>{this.host.editing(),e.who=i.value,ce.refresh(t),this.host.changed()}),i}part(e){const t=this.host.sighting(),i=V.partOf(e.who),s=i?.element??e.who??"",n=document.createElement("input");return n.type="text",n.className="event-part",n.value=i?.part??"",n.placeholder=this.messages.wholeBody,n.title=this.messages.partHint,n.addEventListener("change",()=>{const r=n.value.trim().replaceAll("/","");this.host.editing(),e.who=r?`${s}/${r}`:s,ce.refresh(t),this.host.changed()}),n}value(e,t,i,s){const n=e.params,r=ke.CHOICES[t];if(r&&typeof i=="string")return this.choice(t,i,r,l=>{l===r.absent?delete n[t]:n[t]=l},s);const o=ke.AMONG[t];if(o&&typeof i=="string")return this.actorChoice(i,o,l=>{n[t]=l},s);if(typeof i=="string")return this.text(i,l=>{n[t]=l},s);if(typeof i=="boolean")return this.check(i,l=>{n[t]=l},s);if(typeof i=="number"){if(t==="glancesUntil")return this.seconds(i,d=>{n[t]=d},s);const l=t.endsWith("S")&&!t.endsWith("PerS"),a=t.endsWith("Deg")?"°":l?"s":t.endsWith("M")?"m":t==="cdM2"?"cd/m²":t==="hz"?"Hz":"";return this.number(i,d=>{n[t]=d},s,a,t==="pitchShare"||l||t.endsWith("PerS")?.05:t.endsWith("M")?.01:1)}if(Array.isArray(i)&&i.length>0&&i.every(l=>typeof l=="object"&&l!==null&&typeof l.t=="number"))return this.rows(i,s);if(Array.isArray(i)&&i.every(l=>typeof l=="object"&&l!==null&&typeof l.sourceId=="string"))return document.createTextNode(this.messages.parts.replace("{n}",String(i.length)));if(Array.isArray(i)&&i.every(l=>typeof l=="string"))return document.createTextNode(i.join(", "));if(Array.isArray(i))return document.createTextNode(this.messages.points.replace("{n}",String(i.length)));if(typeof i=="object"&&i!==null){const l=i;if(typeof l.lat=="number"&&typeof l.lng=="number"){const a=document.createElement("span");return typeof l.t=="number"&&a.append(this.seconds(l.t,d=>{l.t=d},s,`${this.messages.at} `)," "),a.append(this.position(i,s)),a}return typeof l.x=="number"?document.createTextNode(`${l.x}, ${l.y}, ${l.z} m`):typeof l.azimuthDeg=="number"&&typeof l.altitudeDeg=="number"?this.direction(l,s):document.createTextNode(Object.entries(l).map(([a,d])=>`${a} ${d??"∅"}`).join(", "))}return document.createTextNode(String(i))}choice(e,t,i,s,n){const r=document.createElement("select");for(const o of i.values){const l=document.createElement("option");l.value=o,l.textContent=this.messages.choices[`${e}.${o}`]??o,r.append(l)}return i.values.includes(t)||r.prepend(new Option(t,t)),r.value=t,r.addEventListener("change",()=>this.edited(()=>s(r.value),n)),r}actorChoice(e,t,i,s){const n=document.createElement("select"),r=[...V.ids(this.host.sighting())].filter(([,o])=>o.some(l=>t.includes(l))).map(([o])=>o);r.includes(e)||r.unshift(e);for(const o of r){const l=V.kindOf(this.host.sighting(),o),a=l==="body"?this.host.bodyLabel?.(o):l==="shape"||l==="group"?this.host.shapesLabel?.(o):void 0;n.append(new Option(a??o,o))}return n.value=e,n.addEventListener("change",()=>this.edited(()=>i(n.value),s)),n}direction(e,t){const i=document.createElement("span");i.className="event-direction",i.append(`${this.messages.params.azimuthDeg??"azimuthDeg"} `,this.number(e.azimuthDeg,n=>{e.azimuthDeg=(n%360+360)%360},t,"°",.1));const s=this.host.compassPoint?.(e.azimuthDeg);if(s){const n=document.createElement("span");n.className="event-direction-point",n.textContent=s,i.append(" ",n)}if(i.append(` ${this.messages.params.altitudeDeg??"altitudeDeg"} `,this.number(e.altitudeDeg,n=>{e.altitudeDeg=Math.max(-90,Math.min(90,n))},t,"°",.1)),e.altitudeDeg===90&&i.append(` (${this.messages.zenith})`),this.host.lookedAt){const n=document.createElement("button");n.type="button",n.className="event-direction-look",n.textContent=this.messages.lookedAt,n.title=this.messages.lookedAtHint,n.addEventListener("click",()=>{const r=this.host.lookedAt?.();r&&this.edited(()=>{e.azimuthDeg=Math.round((r.azimuthDeg%360+360)%360*10)/10,e.altitudeDeg=Math.round(r.altitudeDeg*10)/10},t)}),i.append(" ",n)}return i}rows(e,t){const i=Object.keys(e[0]).filter(l=>l!=="t"&&typeof e[0][l]=="number"),s={kmh:"km/h",degPerS:"°/s",widthM:"m",heightM:"m",altitudeM:"m"},n=document.createElement("span");n.className="event-rows",n.style.setProperty("--columns",String(3+i.length)),e.forEach((l,a)=>{n.append(this.seconds(l.t,h=>{l.t=h,e.sort((c,u)=>c.t-u.t)},t,`${this.messages.at} `));for(const h of i)n.append(this.number(l[h],c=>{l[h]=c},t,s[h]??"",h==="divisor"?.05:1));if(a===0)n.append(document.createElement("span"));else{const h=document.createElement("label");h.className="event-row-step",h.title=this.messages.atOnceHint;const c=this.check(l.step===!0,u=>{u?l.step=!0:delete l.step},t);c.title=this.messages.atOnceHint,h.append(c,` ${this.messages.atOnce}`),n.append(h)}const d=document.createElement("button");d.type="button",d.className="icon-btn event-row-remove",d.innerHTML=D.TRASH,d.title=d.ariaLabel=this.messages.removeRow,d.disabled=e.length<2,d.addEventListener("click",()=>this.edited(()=>{e.splice(a,1)},t)),n.append(d)});const r=document.createElement("button");r.type="button",r.className="icon-btn event-row-add",r.innerHTML=D.PLUS,r.title=r.ariaLabel=this.messages.addRow,r.addEventListener("click",()=>this.edited(()=>{const l=e[e.length-1],a={...l,t:l.t+1e3};delete a.step,e.push(a)},t));const o=document.createElement("span");return o.className="event-table",o.append(n,r),o}position(e,t){const i=this.host.positionFrame?.(),s=this.host.positionMessages?.();if(!i||!s){const o=document.createElement("span");return o.append(this.number(e.lat,l=>{e.lat=l},t,"°",1e-6)," ",this.number(e.lng,l=>{e.lng=l},t,"°",1e-6)),o}Es();const n=document.createElement("rr0-input-position");n.setAttribute("native","geo"),n.setAttribute("name",t.replace(/\./g,"-")),n.build(),n.messages=s,n.basisShown=!1,n.frame=i,n.value={lat:e.lat,lng:e.lng},n.said=e.said;let r;return n.addEventListener("positionchange",o=>{r=o.detail}),n.addEventListener("focusout",o=>{if(!r||n.contains(o.relatedTarget))return;const{value:l,said:a}=r;r=void 0,"lat"in l&&this.edited(()=>{e.lat=Math.round(l.lat*1e7)/1e7,e.lng=Math.round(l.lng*1e7)/1e7,a?e.said=a:delete e.said},t)}),n}text(e,t,i){const s=document.createElement("input");return s.type="text",s.value=e,s.addEventListener("change",()=>this.edited(()=>t(s.value.trim()),i)),s}check(e,t,i){const s=document.createElement("input");return s.type="checkbox",s.checked=e,s.addEventListener("change",()=>this.edited(()=>t(s.checked),i)),s}edited(e,t){this.host.editing(),e(),this.host.sighting().provenance.clear(t),ce.refresh(this.host.sighting()),this.host.changed()}seconds(e,t,i,s=""){const n=this.number(e/1e3,o=>t(Math.round(o*1e3)),i,"s",.1);if(!s)return n;const r=document.createElement("span");return r.append(s,n),r}number(e,t,i,s,n){const r=document.createElement("label"),o=document.createElement("input");return o.type="number",o.step=String(n),o.value=String(n<.001?e:Math.round(e*1e3)/1e3),o.addEventListener("change",()=>{const l=Number(o.value);o.value===""||!Number.isFinite(l)||this.edited(()=>t(l),i)}),r.append(o),s&&r.append(` ${s}`),r}basis(e){bi();const t=document.createElement(Xe.TAG);t.anchorKey=e,t.messages={title:this.messages.basisTitle,basis:this.messages.basis,basisField:this.messages.basisField,howField:this.messages.howField,rationaleField:this.messages.rationaleField};const i=this.host.valueSources?.();return t.sourceMessages=i?.messages,t.choices=i?.choices??{},t.entry=this.host.sighting().provenance.at(e),t.addEventListener("basischange",s=>{const n=s.detail.entry;this.host.editing(),n?this.host.sighting().provenance.set(e,n):this.host.sighting().provenance.clear(e),this.host.changed()}),t}}const ir=$e.catalog({en:()=>M(()=>import("./DecorParameterTexts_en-idbdHsFG.js"),[],import.meta.url).then(E=>E.decorParameterTexts_en),fr:()=>M(()=>import("./DecorParameterTexts_fr-D9GeuW_Y.js"),[],import.meta.url).then(E=>E.decorParameterTexts_fr),es:()=>M(()=>import("./DecorParameterTexts_es-CIkkLQc2.js"),[],import.meta.url).then(E=>E.decorParameterTexts_es),it:()=>M(()=>import("./DecorParameterTexts_it-v7TBrnsr.js"),[],import.meta.url).then(E=>E.decorParameterTexts_it)});class R{static MAX_STOPS=12;static METRES_PER_DEGREE=111320;static SAME_TREE_M=1.5;static SAME_BUILDING_M=2.5;static SAME_STRUCTURE_M=5;static stops(e,t){if(e.length===0)return[];const i=e[0],s=Math.cos(i.lat*Math.PI/180),n=e.slice(1).map((p,m)=>Math.hypot((p.lat-e[m].lat)*R.METRES_PER_DEGREE,(p.lng-e[m].lng)*R.METRES_PER_DEGREE*s)),r=n.reduce((p,m)=>p+m,0),o=Math.max(t,r/(R.MAX_STOPS-1)),l=[i];let a=0,d=o;e.slice(1).forEach((p,m)=>{a+=n[m],a>=d&&(l.push(p),d=a+o)});const h=e[e.length-1],c=l[l.length-1];return Math.hypot((h.lat-c.lat)*R.METRES_PER_DEGREE,(h.lng-c.lng)*R.METRES_PER_DEGREE*s)>t/2&&l.length<R.MAX_STOPS&&l.push(h),l}static async fetch(e,t,i,s={}){if(t.length===0)throw new ui("no-coverage","No place to ask about");const n=t[0],r=Math.cos(n.lat*Math.PI/180),o=new Array(t.length).fill(void 0),l=[],a=Math.max(1,s.concurrency??3);let d=0;const h=async()=>{for(;d<t.length;){const m=d++;try{o[m]=await e.getSurroundings(t[m],i)}catch(f){l.push(f)}}};await Promise.all(Array.from({length:Math.min(a,t.length)},h));const c={trees:[],buildings:[],bridges:[],lines:[]};let u=!1;const p={};if(o.forEach((m,f)=>{if(!m)return;u=!0;const g=(t[f].lng-n.lng)*R.METRES_PER_DEGREE*r,b=(t[f].lat-n.lat)*R.METRES_PER_DEGREE,v=S=>S.map(w=>({...w,eastM:Math.round((w.eastM+g)*10)/10,northM:Math.round((w.northM+b)*10)/10})),I=v(m.trees).sort((S,w)=>Math.hypot(S.eastM-g,S.northM-b)-Math.hypot(w.eastM-g,w.northM-b)).slice(0,s.treesPerStop??m.trees.length);R.add(c.trees,I,(S,w)=>Math.hypot(S.eastM-w.eastM,S.northM-w.northM)<R.SAME_TREE_M),R.add(c.buildings,v(m.buildings),(S,w)=>Math.hypot(S.eastM-w.eastM,S.northM-w.northM)<R.SAME_BUILDING_M&&Math.abs(S.widthM-w.widthM)<1.5&&Math.abs(S.lengthM-w.lengthM)<1.5),R.add(c.bridges,v(m.bridges),(S,w)=>Math.hypot(S.eastM-w.eastM,S.northM-w.northM)<R.SAME_STRUCTURE_M),R.add(c.lines,v(m.lines),(S,w)=>Math.hypot(S.eastM-w.eastM,S.northM-w.northM)<R.SAME_STRUCTURE_M&&Math.abs(S.lengthM-w.lengthM)<5),R.addFurniture(c,m,v),m.incomplete&&(c.incomplete=!0);for(const S of["laser","photo","map","lamps"]){const w=m.dates?.[S];w&&(!p[S]||w>p[S])&&(p[S]=w)}}),!u)throw l.find(m=>!(m instanceof ui&&m.reason==="no-coverage"))??l[0];return Object.keys(p).length>0&&(c.dates=p),c}static later(e,t,i){if(!e.later||t.length===0)return;const s=t[0],n=Math.cos(s.lat*Math.PI/180),r=t.map(o=>e.later(o,i)??Promise.reject(new Error("Nothing comes late")));return Promise.allSettled(r).then(o=>{if(!o.some(a=>a.status==="fulfilled"))throw o[0].reason;const l={};return o.forEach((a,d)=>{if(a.status!=="fulfilled")return;const h=(t[d].lng-s.lng)*R.METRES_PER_DEGREE*n,c=(t[d].lat-s.lat)*R.METRES_PER_DEGREE,u=m=>m.map(f=>({...f,eastM:Math.round((f.eastM+h)*10)/10,northM:Math.round((f.northM+c)*10)/10}));R.addFurniture(l,a.value,u);const p=a.value.dates?.lamps;p&&(!l.dates?.lamps||p>l.dates.lamps)&&(l.dates={lamps:p})}),l})}static addFurniture(e,t,i){t.lamps&&R.add(e.lamps??=[],i(t.lamps),(n,r)=>Math.hypot(n.eastM-r.eastM,n.northM-r.northM)<1);const s=(n,r)=>Math.hypot(n.eastM-r.eastM,n.northM-r.northM)<1&&Math.abs((n.headingDeg-r.headingDeg+540)%360-180)<10;t.signals&&R.add(e.signals??=[],i(t.signals),s),t.crossings&&R.add(e.crossings??=[],i(t.crossings),s),t.signs&&R.add(e.signs??=[],i(t.signs),s),t.credits&&R.add(e.credits??=[],t.credits,(n,r)=>n.url===r.url)}static add(e,t,i){for(const s of t)e.some(n=>i(n,s))||e.push(s)}}class Qe{static FLOOR_HEIGHT_M=3;static CROSSING_LENGTH_M=2.5;static of(e,t,i){const{kept:s}=i,n=g=>s.some(b=>b.kind===g),r={tree:n("tree"),building:n("building"),bridge:n("bridge"),wire:n("wire"),streetlight:n("streetlight"),trafficlight:n("trafficlight"),crossing:n("crossing"),roadsign:n("roadsign")},o=[...s,...i.others??[]],l=new Set(o.map(g=>g.id));let a=0;const d=()=>{let g;do g=`${e}-${++a}`;while(l.has(g));return l.add(g),g},h={tree:o.filter(g=>g.kind==="tree").length,building:o.filter(g=>g.kind==="building").length,bridge:o.filter(g=>g.kind==="bridge").length,wire:o.filter(g=>g.kind==="wire").length,streetlight:o.filter(g=>g.kind==="streetlight").length,trafficlight:o.filter(g=>g.kind==="trafficlight").length,crossing:o.filter(g=>g.kind==="crossing").length,roadsign:o.filter(g=>g.kind==="roadsign").length},c=new Set(o.map(g=>typeof g.title=="string"?g.title:"")),u=(g,b)=>{const v=b??`${i.kindName(g)} ${++h[g]}`;let I=v;for(let S=2;c.has(I);S++)I=`${v} (${S})`;return c.add(I),I},p=t.dates??{},m=(...g)=>{const b=g.filter(v=>v!==void 0).sort().at(-1);return b?{surveyedOn:b}:{}},f=[];if(!r.tree)for(const g of t.trees)f.push({id:d(),kind:"tree",title:u("tree",void 0),eastM:g.eastM,northM:g.northM,headingDeg:0,lit:!1,sizeM:{widthM:g.widthM,lengthM:g.widthM,heightM:g.heightM},origin:e,...m(p.laser)});if(!r.building)for(const g of t.buildings)f.push({id:d(),kind:"building",title:u("building",g.name),eastM:g.eastM,northM:g.northM,headingDeg:g.headingDeg,lit:!1,sizeM:{widthM:g.widthM,lengthM:g.lengthM,heightM:g.heightM},...g.style==="church"||g.style==="monument"?{}:{floors:g.floors??Math.max(1,Math.round((g.heightM-(g.roof?.riseM??0))/(g.facade?.storeyM??Qe.FLOOR_HEIGHT_M)))},...g.roof?{roof:g.roof}:{},...g.facade?{facade:g.facade}:{},origin:e,...m(p.map,p.laser,g.roof?.color?p.photo:void 0)});if(!r.bridge)for(const g of t.bridges)f.push({id:d(),kind:"bridge",title:u("bridge",g.name?`${i.kindName("bridge")} (${g.name})`:void 0),eastM:g.eastM,northM:g.northM,headingDeg:g.headingDeg,lit:!1,sizeM:{lengthM:g.lengthM,widthM:g.widthM,heightM:g.heightM},origin:e,...m(p.map,p.laser)});if(!r.wire)for(const g of t.lines)f.push({id:d(),kind:"wire",title:u("wire",`${i.kindName("wire")} (${g.voltage})`),eastM:g.eastM,northM:g.northM,headingDeg:g.headingDeg,lit:!1,sizeM:{lengthM:g.lengthM,heightM:g.heightM},wire:{strands:g.acrossM.map(b=>({heightM:g.heightM,acrossM:b})),poles:"both",poleHeightM:g.poleHeightM},origin:e,...m(p.map,p.laser)});if(!r.streetlight)for(const g of t.lamps??[]){const b={...g.colorTemperatureK?{colorTemperatureK:g.colorTemperatureK}:{},...g.lumens?{lumens:g.lumens}:{},...g.mount==="wall"?{mount:"wall"}:{},...g.supposed?{supposed:!0}:{}};f.push({id:d(),kind:"streetlight",title:u("streetlight",void 0),eastM:g.eastM,northM:g.northM,headingDeg:0,...g.heightM?{sizeM:{heightM:g.heightM}}:{},...Object.keys(b).length>0?{lamp:b}:{},origin:e,...m(p.lamps)})}if(!r.trafficlight)for(const g of t.signals??[])f.push({id:d(),kind:"trafficlight",title:u("trafficlight",void 0),eastM:g.eastM,northM:g.northM,headingDeg:g.headingDeg,lights:g.for==="pedestrians"?Mi.pedestrianLights(g.phase):Mi.vehicleLights(g.phase),origin:e,...m(p.lamps)});if(!r.crossing)for(const g of t.crossings??[])f.push({id:d(),kind:"crossing",title:u("crossing",void 0),eastM:g.eastM,northM:g.northM,headingDeg:g.headingDeg,sizeM:{widthM:g.widthM,lengthM:Qe.CROSSING_LENGTH_M},origin:e,...m(p.lamps)});if(!r.roadsign)for(const g of t.signs??[])f.push({id:d(),kind:"roadsign",title:u("roadsign",void 0),eastM:g.eastM,northM:g.northM,headingDeg:g.headingDeg,sign:{face:g.face,...g.code?{code:g.code}:{},...g.value?{value:g.value}:{}},origin:e,...m(p.lamps)});return{planted:f,handPlaced:Object.values(r).some(Boolean)}}}class te{constructor(e,t,i,s,n={}){this.status=e,this.host=t,this.loadProvider=s,this.messages=i,this.debounceMs=n.debounceMs??te.DEFAULT_DEBOUNCE_MS,this.radiusM=n.radiusM??te.DEFAULT_RADIUS_M}static SAME_PLACE_M=25;static METRES_PER_DEGREE=111320;static DEFAULT_RADIUS_M=100;static DEFAULT_DEBOUNCE_MS=800;static TREES_PER_STOP=80;static WALK_LEAD_S=4;static WALK_LEAD_SHARE=.6;static SAME_BUILDING_M=3;static SAME_OBJECT_M=1.5;messages;debounceMs;radiusM;enabled=!0;surveyedFor;timer;token=0;surveyed="";furnitureSaid="";furnitureCredits=[];asked=[];lastStep;walkSpeedMps=0;setMessages(e){this.messages=e}setEnabled(e){e!==this.enabled&&(this.enabled=e,e||this.cancel())}withdraw(){this.cancel(),this.withdrawPlanted(),this.say("")}placeLoaded(e,t){this.cancel(),this.surveyedFor=e!==void 0&&t!==void 0?{lat:e,lng:t}:void 0,this.say("")}radiusChanged(e,t,i){e!==this.radiusM&&(this.radiusM=e,!(!this.enabled||t===void 0||i===void 0)&&(clearTimeout(this.timer),this.timer=setTimeout(()=>void this.survey(t,i),this.debounceMs)))}placeChanged(e,t){!this.enabled||e===void 0||t===void 0||this.surveyedFor&&this.isSamePlace(this.surveyedFor,e,t)||(clearTimeout(this.timer),this.timer=setTimeout(()=>void this.survey(e,t),this.debounceMs))}walked(e,t,i,s=Date.now()){if(clearTimeout(this.timer),this.timer=void 0,this.surveyedFor={lat:e,lng:t},this.lastStep){const l=(s-this.lastStep.atMs)/1e3,a=this.metresBetween(this.lastStep,e,t);this.walkSpeedMps=l>0&&l<2?.5*this.walkSpeedMps+.5*a/l:0}if(this.lastStep={lat:e,lng:t,atMs:s},!this.enabled)return;const n=Math.min(this.radiusM,Math.max(this.radiusM*te.WALK_LEAD_SHARE,this.walkSpeedMps*te.WALK_LEAD_S)),r=i*Math.PI/180,o={lat:e+Math.cos(r)*n/te.METRES_PER_DEGREE,lng:t+Math.sin(r)*n/(te.METRES_PER_DEGREE*Math.cos(e*Math.PI/180))};this.asked.some(l=>this.metresBetween(l,o.lat,o.lng)<this.radiusM/2)||(this.asked.push(o),this.plantAhead(o))}async plantAhead(e){const t=this.token;try{const i=await this.loadProvider(e.lat,e.lng);if(!i||t!==this.token)return;const s=await i.getSurroundings(e,this.radiusM);if(t!==this.token)return;this.addAhead(i,this.fromCentre(s,e)),(s.incomplete?i.later?.(e,this.radiusM):void 0)?.then(r=>{t===this.token&&this.addAhead(i,this.fromCentre({trees:[],buildings:[],bridges:[],lines:[],...r},e))},()=>{})}catch{this.asked=this.asked.filter(i=>i!==e)}}addAhead(e,t){const i=this.host.decor(),s=i.filter(l=>l.origin===void 0),n=i.filter(l=>l.origin!==void 0),{planted:r}=Qe.of(e.id,t,{kept:s,others:n,kindName:l=>this.host.kindName(l)}),o=r.filter(l=>!n.some(a=>te.same(a,l)));o.length>0&&this.host.setDecor([...i,...o])}static same(e,t){if(e.kind!==t.kind)return!1;const i=Math.hypot(e.eastM-t.eastM,e.northM-t.northM);if(e.kind!=="building")return i<te.SAME_OBJECT_M;const s=n=>[n.sizeM?.widthM??0,n.sizeM?.lengthM??0];return i<te.SAME_BUILDING_M&&s(e).every((n,r)=>Math.abs(n-s(t)[r])<1.5)}fromCentre(e,t){const i=this.host.centre?.();if(!i)return e;const s=(t.lng-i.lng)*te.METRES_PER_DEGREE*Math.cos(i.lat*Math.PI/180),n=(t.lat-i.lat)*te.METRES_PER_DEGREE;if(Math.hypot(s,n)<.01)return e;const r=o=>o?.map(l=>({...l,eastM:Math.round((l.eastM+s)*100)/100,northM:Math.round((l.northM+n)*100)/100}));return{...e,...e.trees?{trees:r(e.trees)}:{},...e.buildings?{buildings:r(e.buildings)}:{},...e.bridges?{bridges:r(e.bridges)}:{},...e.lines?{lines:r(e.lines)}:{},...e.lamps?{lamps:r(e.lamps)}:{},...e.signals?{signals:r(e.signals)}:{},...e.crossings?{crossings:r(e.crossings)}:{},...e.signs?{signs:r(e.signs)}:{}}}metresBetween(e,t,i){const s=(e.lat-t)*te.METRES_PER_DEGREE,n=(e.lng-i)*te.METRES_PER_DEGREE*Math.cos(t*Math.PI/180);return Math.hypot(s,n)}async survey(e,t){const i=++this.token;this.surveyedFor={lat:e,lng:t},this.asked=[{lat:e,lng:t}],this.lastStep=void 0,this.host.busy(!0,this.messages.surveyBusy);try{const s=await this.loadProvider(e,t);if(i!==this.token)return;if(s===void 0){this.withdrawPlanted(),this.say("");return}this.say(this.messages.surveyBusy);const n=R.stops([{lat:e,lng:t},...this.host.track?.()??[]],this.radiusM),r=n.length>1?await R.fetch(s,n,this.radiusM,{treesPerStop:te.TREES_PER_STOP}):await s.getSurroundings({lat:e,lng:t},this.radiusM);if(i!==this.token)return;this.plant(s,this.fromCentre(r,{lat:e,lng:t})),r.incomplete&&this.awaitLate(s,n,i)}catch(s){if(i!==this.token)return;s instanceof ui&&s.reason==="no-coverage"?(this.withdrawPlanted(),this.say("")):this.say(this.messages.surveyUnreachable)}finally{i===this.token&&this.host.busy(!1,"")}}cancel(){clearTimeout(this.timer),this.timer=void 0,this.token++,this.host.busy(!1,"")}withoutPlanted(){return this.host.decor().filter(e=>e.origin===void 0)}withdrawPlanted(){this.host.decor().some(e=>e.origin!==void 0)&&this.host.setDecor(this.withoutPlanted())}plant(e,t){const i=this.withoutPlanted(),{planted:s,handPlaced:n}=Qe.of(e.id,t,{kept:i,kindName:a=>this.host.kindName(a)}),r=a=>s.filter(d=>d.kind===a).length;if((s.length>0||this.host.decor().length!==i.length)&&this.host.setDecor([...i,...s]),s.length===0){this.furnitureSaid="",this.surveyed=n?this.messages.surveyKept:this.messages.surveyNone.replace("{radius}",String(this.radiusM)),this.say(this.surveyed,t.incomplete?this.messages.surveyFurniturePending:"");return}this.host.cite({title:`${e.name}, survey of the surroundings`,url:e.creditUrl,publication:{publisher:e.name}});const o=this.messages.surveyDone.replace("{trees}",String(r("tree"))).replace("{buildings}",String(r("building"))).replace("{bridges}",String(r("bridge"))).replace("{lines}",String(r("wire"))).replace("{source}",e.name),l=this.datesText(t.dates);this.surveyed=[o,l,n?this.messages.surveyKept:""].filter(a=>a!=="").join(" "),this.citeCredits(t),this.furnitureCredits=t.credits??[],this.furnitureSaid=this.furnitureText(s,t),this.say(this.surveyed,[this.furnitureSaid,t.incomplete?this.messages.surveyFurniturePending:""].filter(a=>a!=="").join(" "))}citeCredits(e){for(const t of e.credits??[])this.host.cite({title:t.licence?`${t.name} (${t.licence})`:t.name,url:t.url,publication:{publisher:t.name}})}awaitLate(e,t,i){const s=t.length>1?R.later(e,t,this.radiusM):e.later?.(t[0],this.radiusM);if(!s){this.say(this.surveyed,"");return}this.say(this.surveyed,[this.furnitureSaid,this.messages.surveyFurniturePending].filter(n=>n!=="").join(" ")),s.then(n=>{i===this.token&&this.plantLate(e,this.fromCentre(n,t[0]))},()=>{i===this.token&&this.say(this.surveyed,[this.furnitureSaid,this.messages.surveyFurnitureUnavailable].filter(n=>n!=="").join(" "),{label:this.messages.surveyFurnitureRetry,run:()=>this.awaitLate(e,t,i)})})}plantLate(e,t){const i=this.host.decor(),{planted:s}=Qe.of(e.id,{trees:[],buildings:[],bridges:[],lines:[],...t},{kept:i,kindName:r=>this.host.kindName(r)});s.length>0&&this.host.setDecor([...i,...s]),this.citeCredits(t);const n=i.filter(r=>r.origin===e.id).concat(s);this.furnitureSaid=this.furnitureText(n,{credits:[...this.furnitureCredits,...t.credits??[]]}),this.say(this.surveyed,this.furnitureSaid)}furnitureText(e,t){const i=o=>e.filter(l=>l.kind===o).length;if(!e.some(o=>o.kind==="streetlight"||o.kind==="trafficlight"||o.kind==="crossing"||o.kind==="roadsign"))return"";const s=o=>o.of==="lamps"?i("streetlight")>0:o.of==="signals"?i("trafficlight")>0:!0,r=[...new Set((t.credits??[]).filter(s).map(o=>o.name))].join(" + ")||"OpenStreetMap";return this.messages.surveyFurnitureDone.replace("{source}",r).replace("{lamps}",String(i("streetlight"))).replace("{signals}",String(i("trafficlight"))).replace("{crossings}",String(i("crossing"))).replace("{signs}",String(i("roadsign")))}datesText(e){if(!e)return"";const t=[["laser",this.messages.surveyLaserLabel],["photo",this.messages.surveyPhotoLabel],["map",this.messages.surveyMapLabel],["lamps",this.messages.surveyLampsLabel]].filter(([i])=>e[i]!==void 0).map(([i,s])=>`${s} ${e[i]}`);return t.length>0?this.messages.surveyDated.replace("{dates}",t.join(", ")):""}isSamePlace(e,t,i){return this.metresBetween(e,t,i)<te.SAME_PLACE_M}say(e,t="",i){if(this.status.textContent=[e,t].filter(n=>n!=="").join(" "),!i)return;const s=this.status.ownerDocument.createElement("button");s.type="button",s.className="scenery-retry",s.textContent=i.label,s.addEventListener("click",i.run),this.status.append(" ",s)}}class Ft{static newestSurvey(e){return e.filter(t=>t.origin!==void 0).map(t=>t.surveyedOn).filter(t=>t!==void 0).sort().at(-1)}static latestObservationDay(e){if(!e?.year)return;const t=e.month??12,i=e.day??new Date(Date.UTC(e.year,t,0)).getUTCDate();return`${String(e.year).padStart(4,"0")}-${String(t).padStart(2,"0")}-${String(i).padStart(2,"0")}`}static anachronism(e,t){const i=Ft.newestSurvey(e),s=Ft.latestObservationDay(t);return i&&s&&i>s?{survey:i,observation:s}:void 0}}class pe{static number(e,t,i,s,n,r,o={}){return{type:"number",key:e,label:t,min:i,max:s,step:n,unit:r,required:!0,...o}}static natural(e){return(t,i)=>i?.natural?.[e]}static BASE={kind:"decor-base",title:"object",parameters:[{type:"said",key:"title",required:!0,label:"name"},{type:"position",key:"eastM",secondKey:"northM",saidKey:"saidPosition",native:"local",step:.5,label:"position"},pe.number("altitudeM","altitude",-1e3,3e4,1,"m"),pe.number("headingDeg","heading",0,360,1,"°"),{type:"colour",key:"color",label:"colour",fallback:"#808080",visibleWhen:(e,t)=>t?.traits.color===!0},pe.number("sizeM.widthM","width",.1,1e3,.1,"m",{required:!1,effective:pe.natural("widthM")}),pe.number("sizeM.lengthM","length",.1,1e3,.1,"m",{required:!1,effective:pe.natural("lengthM")}),pe.number("sizeM.heightM","height",.1,1e3,.1,"m",{required:!1,effective:pe.natural("heightM")}),{type:"choice",key:"model.id",label:"n3DModel",choices:[],empty:"noModelBuiltInShape",optionsOf:(e,t)=>[...t?.models??[]],effective:(e,t)=>t?.defaultModelId}]};static HEADLIGHT_LABELS={off:"off",position:"positionLights",dipped:"dippedBeam",main:"mainBeam",fog:"fogLamps"};static STATE={kind:"decor-state",title:"state",parameters:[{type:"boolean",key:"lit",required:!0,label:"lit",visibleWhen:(e,t)=>t?.traits.lit===!0&&t?.traits.headlights!==!0},{type:"choice",key:"headlights",required:!0,label:"headlights",choices:Un.MODES.map(e=>({value:e,label:pe.HEADLIGHT_LABELS[e]})),visibleWhen:(e,t)=>t?.traits.headlights===!0},{type:"choice",key:"lightRig",label:"lights",choices:[],empty:"noLights",optionsOf:(e,t)=>(t?.lightRigs??[]).map(i=>({value:i.value,label:i.label})),visibleWhen:(e,t)=>t?.traits.lights===!0},{type:"choice",key:"observerSide",label:"witnessLocation",choices:[],empty:"notPresent",optionsOf:(e,t)=>[...t?.seats??[]],visibleWhen:(e,t)=>t?.traits.observerSide===!0}]};static seatsFor(e){return Hn(e).map(t=>({value:t,label:ks.sideLabel(t)}))}}class he extends Error{constructor(e,t,i){const s=e==="rejected"&&typeof t=="string"?t:void 0,n=e==="rejected"?i:t;super(s??e,n===void 0?void 0:{cause:n}),this.kind=e,this.name="NarrativeError",this.detail=s}detail}class Nt{static KNOWN_TAGS=["landing","trace","aerial observation","project sign","paralysis","contact","occupants","close encounter","photograph","radar","electromagnetic effect"];static RULES=[{draft:`Sizes are ANGULAR, in degrees, and never metric — the format stores no physical size, because an
185
+ observer perceives an angle and a size only follows from a distance nobody measured. Convert the
186
+ comparisons an account gives: the full Moon and the Sun are both about 0.5 degrees across, a
187
+ thumbnail at arm's length about 1.5, a fist about 10. Where the account gives no comparison, work
188
+ from what a scene implies and say so: something "barring the road" spans a carriageway, so a
189
+ 5-6 m road seen from 20-100 m gives 3 to 15 degrees; take a value in that range and put the
190
+ range in the rationale. That is "derived", not "stated".`,file:`Sizes are ANGULAR, in degrees (\`angular\`: {widthDeg, heightDeg}), never metric: the format stores
191
+ no physical size, because an observer perceives an angle and a size only follows from a distance
192
+ nobody measured. Convert the comparisons an account gives (the full Moon and the Sun about 0.5
193
+ degrees across, a thumbnail at arm's length about 1.5, a one-euro coin about 1.5 at arm's length,
194
+ a tennis ball about 6 if held out at arm's length, a fist about 10), or measure them: a
195
+ drawing made on a photograph of the place, with a known field of view or a landmark of known
196
+ bearing, gives degrees per pixel. Where nothing gives a size, work from what the scene implies
197
+ and put the range in the rationale. Never inflate: an angle below one pixel is invisible, and
198
+ that is a fact about the account to report, not something to enlarge so that the shape shows.
199
+ If another document gives a larger figure (an interview years later), you may take it, but say
200
+ which one you took and why.`},{draft:'Directions are `aim`: `azimuthDeg` clockwise from true north (north 0, east 90, south 180,\n west 270) and `altitudeDeg` above the horizon (horizon 0, zenith 90). Derive them where the\n geography allows — an observer driving towards a named village is looking along that bearing, and a\n phenomenon "barring the road" is on it. Where nothing bears on the altitude, assume something low\n and plausible rather than leaving the phenomenon undrawable, and mark it "assumed".',file:"A shape is PLACED by `aim`, the direction of its centre in the observer's sky: `azimuthDeg`\n clockwise from true north and `altitudeDeg` above the horizon. Not the way the observer faced,\n which is the pose's heading and pitch. `bounds` (pixels) is recomputed on load from `aim` and\n `angular`; leave it out. `angle` tilts the shape, in radians, positive clockwise on screen.\n Derive directions from the geography where it allows (a map, the bearing of a road, a landmark\n the observer named); where nothing bears on the altitude, assume something low and plausible and\n mark it \"assumed\"."},{draft:'`time` (and `endTime`) is EDTF text, as RR0\'s events write it: `"1964-04-24T17:45"`, with EDTF\'s doubt where\n the account has one (`"1965-07-01T05:45~"` about, `"1965-07-01?"` uncertain). `place` is one place, its name fully\n qualified and its coordinates: `{"name": "Socorro, Socorro County, New Mexico, USA", "locations": [{"lat": 34.06, "lng": -106.89}]}`.\n Times are the local legal time at the place. State the IANA `timeZone` the observer\'s own clock\n was on ("Europe/Paris", "America/Denver") and NEVER `utcOffsetHours`: the editor works the\n offset out from that zone\'s own historical rules at that date, out of the platform\'s IANA\n database (see TimeZones.offsetHoursAt), and it is right about summer time as it was then rather\n than as it is now. Anything you computed there would be overwritten, and wrong more often.\n Choosing the zone is the part that needs reading the account, because a zone\'s BOUNDARIES have\n moved: Montgomery, Alabama is "America/Chicago", which observed summer time in 1948 while Alabama\n did not, so the zone that matches the observer is not always the one their coordinates fall in.',file:'`time` and `endTime` are EDTF text (`"1964-04-24T17:45"`, `"1965-07-01T05:45~"`), as RR0\'s events write them;\n `place` is one place: `{"name": "Socorro, Socorro County, New Mexico, USA", "locations": [{"lat": 34.06, "lng": -106.89}]}`.\n Times are the local legal time at the place, as the observer\'s clock read it. Give the IANA\n `timeZone` their clock was on ("Europe/Paris") AND `utcOffsetHours`, the legal offset on that\n date, summer time included (+2 for France in June 2012, +1 in 1965): the player places the sky\n from the number alone, and without it approximates the offset from the longitude, which knows\n nothing of legal time. A time corrected by the investigator (a clock found fast) is "derived".'},{draft:'Duration: `durationSeconds` is the one length the reconstruction is played at, a bare number. When the\n account gives a vague length ("a few minutes", "five to ten"), write what was said in `durationText`,\n an ISO 8601 duration with the doubt EDTF has (`"PT3M~"`, about three minutes) or a range\n (`"PT5M/PT10M"`), AND the length to play at in `durationSeconds` (the duration, or the middle of the\n range), marked "assumed". Or give `endTime`, EDTF like `time`, with the approximation suffix:\n `"1974-05-20T19:02~"`.',file:'Duration: `durationSeconds` is the one length the reconstruction is played at, a bare number. For a\n vague length ("a few minutes"), state it in `durationText` (an ISO 8601 duration with a doubt, `"PT3M~"`, or a\n range, `"PT5M/PT10M"`) and put the length chosen to play at in `durationSeconds`, with its provenance. Use\n `durationSeconds` alone for a length that was timed or bounded.'},{draft:`Give a keyframe only for a moment the account actually distinguishes — where it arrived, where it
201
+ went, when it changed. Two to four is a normal first draft, and one is right for a phenomenon
202
+ that never moved. Interpolation between them is the player's job.`,file:`\`timeline.keyframes\` is [{t, shapes: [{sourceId, shape}]}], t in milliseconds from the start of
203
+ the recording. Give a keyframe only for a moment the account distinguishes (where it arrived,
204
+ when it changed, where it went); the player interpolates between them. A keyframe need only
205
+ restate what changes: every field a shape leaves out is held from the keyframe before. To make a
206
+ shape vanish, keyframe it at \`transparency: 1\`. There is no field for blinking: write a flash as
207
+ keyframes a few milliseconds apart, per \`sourceId\` (interpolation is per source). A rotation of more
208
+ than half a turn between two keyframes needs intermediate keyframes with unrolled angles, or the
209
+ shape turns the short way round. Motion the account calls continuous or slowing down (a landing,
210
+ a take-off) needs a path sampled about every 100 ms and eased, not six keyframes joined by
211
+ straight lines, whose speed jumps at each one. \`milestones\` ([{t, label, note}]) name the
212
+ moments the account itself names ("A", "B"), shown on the seek bar.`},{draft:'For each shape give only `kind` ("oval" or "polygon"), `title` (what the observer called it,\n in their language), `angular` and `aim`. Never a pixel box, a transparency or a halo: those\n are how a drawing is painted, they are derived from the angle and the direction on loading, and\n values for them would be numbers no one observed and no one could check.',file:'A shape is `kind` "oval" or "polygon" (a polygon\'s `points` are stretched with its box: when you leave\n `bounds` out, as you should, write them as FRACTIONS of the box from 0 to 1, e.g.\n {"x": 0.26, "y": 0.98}; values written as pixels (0-100) are multiplied by the box\'s width and\n give a giant shape), `title` (what the observer called it),\n `angular` and `aim`. Add `color`, `haloScale` (a glow around it), `brightness` (0 a light\n you can look at, 1 one you cannot) and `blur` (0 hard edges, 1 none) only when the account\n describes them; left out, they assert nothing. `brightness` above 0 adds a dazzle veil, a large\n ringed halo: leave it at 0 on anything that is not a light.'},{draft:"NEVER write `description`. It is the account you were just given: it is what the observer said,\n it does not change because somebody read it, and anything you would put there instead belongs in\n the numbers the reading produced. Leave the field out of your answer entirely.",file:`\`description\` is the account itself, in prose: what the observer said, in their words where the
213
+ documents quote them, one string or one per language ({"fr": ..., "en": ...}). Not your
214
+ analysis: measurements, contradictions and reasoning belong in the values, their rationales,
215
+ and your report.`},{draft:`\`tags\` are stored in English whatever the account's language, because two recordings that share
216
+ a tag have to match on it. Reuse the vocabulary already in use where it fits — {tags} — and pass
217
+ classification codes and case references through unchanged ("RR3", "NL", "Blue Book 8729"),
218
+ which read the same in every language.`,file:`\`tags\` are stored in English whatever the account's language, because two recordings that share
219
+ a tag have to match on it. Reuse the vocabulary already in use where it fits ({tags}); pass
220
+ classification codes and case references through unchanged ("RR3", "NL", "GEIPAN D1").
221
+ \`paralysis\` changes the replay (the view is held still): use it only when the account says the
222
+ observer could not move.`},{draft:"`decor` is the scenery around the observer, and `eastM`/`northM` are metres from where they\n stand. Something the observer is INSIDE — their own car, their kitchen — goes at 0,0 and carries\n `observerSide` (\"front-left\" for a European driver's seat), which is what puts the viewpoint\n within it. Anything they are NOT inside must be placed away from 0,0, or it is drawn on the lens.\n Give `sizeM` in metres ({widthM, lengthM, heightM}: about 1.7 x 4.2 x 1.4 for a 1970s family\n car) or leave it out for the primitive's own size. Add decor only for what the account names: an\n unmentioned streetlight is scenery nobody reported.",file:`\`decor\` is the scenery the account names, and \`eastM\`/\`northM\` are metres from where the
223
+ observer stood at the start. Something the observer is INSIDE (their car) goes at 0,0 and carries
224
+ \`observerSide\` ("front-left" for a European driver's seat); anything else must be away from
225
+ 0,0, or it is drawn on the lens. Give \`sizeM\` ({widthM, lengthM, heightM}) where known. The
226
+ relief and the roads of the map are drawn for you: add decor for what the account uses (the wood the phenomenon stood before, the car, the other people present, as kind
227
+ "observer"). When the account says the phenomenon went behind something, that object's
228
+ \`occludesSourceIds\` names the shape. The converse is a trap: a decor object that stands on a
229
+ shape's line of sight WITHOUT declaring it is read as "the phenomenon passed in front of it", and the
230
+ distance is capped by its own (a car 5 m away gave "at most 0.05 m" for a 6 m object). A distance is
231
+ an inequality: in front of X is less than X's distance, behind X is at least that. A track's
232
+ \`altitudeM\` is metres above the GROUND under the object, not above the observer (the eye is
233
+ at \`elevationM\` + 1.6 m). Draw only what you can place: never a building or garage whose plan you do
234
+ not have, and no real surroundings when the place is only known to about 0.1 degree; say so
235
+ instead. Roads the map lacks go in \`roads\`. An obstacle that explains why the account describes what it does (a
236
+ tree line the phenomenon went behind) may be added from a survey or open data, with its
237
+ provenance. A decor of kind "entity" counts as seen; a companion who saw nothing is an
238
+ "observer", placed only where the account puts them: someone in another vehicle whose type and
239
+ position are unknown is left out and listed in your report, not drawn as a pedestrian in the road.
240
+ The eye is 1.6 m above the ground plus the pose's \`elevationM\`: for a high seat (a tractor cab, a
241
+ lorry), raise \`elevationM\` by the difference. A seat that is not a car's (a central seat) is
242
+ \`observerSide\` "front". Standing decor sits on the ground; only a \`track\` lifts it.`},{draft:"`observerTrack` is where the observer stood and which way they faced, over time. One pose is\n normally enough. `headingDeg` is the direction they were LOOKING, same convention as `aim`,\n and it is what makes a shape's azimuth mean anything — an observer driving towards a named village\n faces that bearing. `elevationM` is metres above the local ground (0 for someone standing on it;\n the eye's own height is added), `pitchDeg` 0 for someone looking level, `fovDeg` about 60 for\n the naked eye.",file:"`observerTrack` ({keyframes: [{t, pose}]}) is where the observer stood and which way they looked,\n over time: `lat`, `lng`, `elevationM` (metres above the local ground, 0 for someone standing\n on it: the eye's own height is added), `headingDeg` and `pitchDeg` (the direction they LOOKED,\n same conventions as `aim`), `fovDeg` (the vertical field shown, about 60 for the naked eye).\n A walk is a series of poses; a head turned towards the phenomenon is two poses a fraction of a\n second apart, the second where the look comes to rest: the player gives the turn its ease and the\n small swing past and back that ends a human look, so state no extra keyframe for them. An observer who follows a moving phenomenon looks 0.15 to 0.2 s behind it, so keep\n the gaze on the same path, sampled as densely, or it leaves the field. A recording made to show something (a sky test, a\n demonstration) and not to replay an account never holds still: from one keyframe to the next the look keeps moving, a slow pan\n along what is shown, a drift up or down, a few steps, and no stretch of more than about 3 s is the same view (a still view is a\n photograph, not a replay); an observer's own account keeps the stillness it states. `instrument` is \"eye\" unless a camera was used."},{draft:'`account` is about the OBSERVERS and how their account travelled, not about the phenomenon.\n An account naming who was there says it in `observerOccupation` ("boulanger"), in their own\n words and never as a level, and each other person present is a `decor` object of kind\n "observer". But `source` and `followedUp` say how the report was OBTAINED, which no account\n of a sighting can tell you: leave them out rather than guessing, unless the text itself says an\n investigator came, or that it is a press cutting.',file:'`account` is about the observer and how the account travelled: `observerAgeYears` (at the\n time), `observerOccupation` (in their words), `source` (how it reached whoever wrote the\n recording: on-site, interview, telephone, questionnaire, letter, social-media, press) and `followedUp`\n (whether they were gone back to). Where the account can be read goes in `sources`, in the\n shape of an RR0 source: [{type ("book" | "article", none for a web page or a post), title,\n authors, url, publication: {publisher, time}, index}]. Always give the documents you worked from. Each other person present is a `decor` object of kind\n "observer".'},{draft:'Silence is a statement. An observer who says the thing was silent is not an observer who said nothing\n about sound: write a `soundTrack` whose keyframe holds a sound of kind "none", and mark it\n "stated". An account that simply never mentions sound gets no soundTrack at all.',file:'Absent is not zero. An observer who says the thing was silent gets a `soundTrack` whose keyframe\n holds a sound of kind "none"; an account that never mentions sound gets no soundTrack. The same\n holds for the weather: `weatherTrack` states what the observer saw of the sky (cover, rain,\n wind); when it comes from a record (ERA5, a METAR, a station), `weatherSource` names it.'},{draft:`\`lightPollution\` is how bright the night sky of the place is, towns and all: the zenith of a
243
+ moonless night in magnitudes per square arcsecond (22 a natural sky, about 19 a suburb, 17 a city
244
+ centre). Write it only from a figure: a Sky Quality Meter reading the observer gives ("stated"),
245
+ or the World Atlas's "SQM" value for the place (Falchi et al. 2016), marked "derived" with the
246
+ atlas named in the rationale. An observer who says the town's glow hid the stars has not given a
247
+ figure: leave the field out, and say in your report that it should be looked up.`,file:`\`lightPollution\` (a number) is how bright the night sky of the place is, towns and all: the
248
+ zenith of a moonless night in magnitudes per square arcsecond, as a Sky Quality Meter reads it or
249
+ as the World Atlas of artificial sky brightness gives it ("SQM", Falchi et al. 2016). 22 is a
250
+ natural sky, and absent means one. "derived" when looked up in the atlas (name it in the
251
+ rationale), "stated" when the observer measured it. It brightens the sky, hides the Milky Way
252
+ and takes stars away; never write a brighter sky than the source gives.`},{draft:'`around` is what made a noise around the observer, which an aircraft is heard against: `cars`,\n `trucks` (and buses), `people` and how many were `talking`, there at once within `withinM` metres\n (200 if absent), and `roads`, each { distanceM, vehiclesPerMinute, trucksPerMinute, speedKmh }. Write\n what the witness says, as they say it: "a few cars went by on the road fifty metres away" is a road; "there\n were two of us talking" is people. A figure the witness gives is "stated"; one you estimate from a vaguer\n word ("a busy road") is "assumed", with the word in the rationale. A witness who says nothing of it gets no\n `around`: never invent a town\'s traffic.',file:"`around` (an object) is what made a noise around the observer: `cars`, `trucks`, `people`,\n `talking` (numbers, there at once within `withinM` metres, 200 if absent) and `roads` (each\n { distanceM, vehiclesPerMinute, trucksPerMinute?, speedKmh? }, 50 km/h if absent). Its noise is worked out\n from CNOSSOS-EU and added to the weather's: an aircraft is heard against it. Absent means a quiet place."},{file:"A witness who flies says so with `vehicle` (its `kind` an aircraft kind: `light-piston`,\n `airliner-narrow`…): they then hear its cabin, and what is outside through its shell. An aircraft of the\n decor they stand within (a pilot in their cockpit) is taken as the one they ride when `vehicle` is absent,\n and is never heard as one passing them. Give a decor aircraft the `aircraftSound` of its machine when its\n model says none (`airliner-supersonic` for the Concorde, `light-piston` for a single piston engine):\n absent, it sounds like a narrow-body jet."},{file:`The observer's own estimate in metres ("60 m long, 175 m away, 10 m up") is not an observation
253
+ but a conclusion: it goes in \`interpretation\` (bodies in metres, see the format page), never in
254
+ the shapes. When it contradicts the angles the observer measured, keep it anyway and say so in
255
+ your report: the player's comparison is what shows the contradiction.`},{file:`Place the observer from the account's own description (the road, the property, the bearing of a
256
+ landmark), not from the nearest village; when only a town centre is known, mark the place
257
+ "assumed", not "derived". A shape drawn from a description (a crescent "tips down") rather than measured on the observer's
258
+ sketch is "assumed", whole, in its envelope. Check coordinates before trusting them: a file placed 2.4 km from a field
259
+ that photographs showed to be flat sat on an 11 % slope; a memorial is not the place where
260
+ something happened. The \`{value, basis, rationale}\` envelope may wrap the whole \`{lat, lng}\`. When the account gives
261
+ only a distance and a direction from a known point ("2 km west of the village"), move from that
262
+ point by that bearing and distance, mark the result "assumed", and state the offset and the point it
263
+ started from in the rationale: a bare village centre would be wrong, and a shifted one is honest only
264
+ if it says it was shifted.`},{file:`Use the sky the account cites to pin and to check the time (a star at a stated azimuth and
265
+ altitude, the Moon "up" or "down", a sunset), and report the mismatches; if you have no way to
266
+ compute the sky, say the check was approximate or not made, never that it passed; do not correct the
267
+ account to fit the computed sky, and do not delete a value that contradicts it. Check that a
268
+ sentence is testimony before keeping it: "the Sun was still below the horizon" in a summary is not
269
+ something the observer said. With several observers, share one clock and give each their own offset.
270
+ Take the legal offset of THAT year, not today's (a weather service answering with \`timezone=auto\`
271
+ gives today's rules).`},{file:`Do not invent a difference between observers, and do not flatten the ones stated: use a ratio
272
+ an observer annotated on their own drawing for that observer only, and leave out what nobody
273
+ said. The light-pollution atlas dates from 2015: do not apply it to an event decades earlier; omit
274
+ the field and say so. Once written, cross-check your numbers against independent figures in the
275
+ documents (a table of distances, a runway's axis), and report the residuals.`},{file:`Words: the person is an "observer" (a human and their instruments), what they gave is an
276
+ "account", what is seen is a "phenomenon". Never "witness", "testimony", "object", "craft", "flew" or
277
+ "landed" in a title, a summary, a rationale or your report, except in the observer's own words:
278
+ naming an object already concludes there was one, and excludes a halo, a planet or a reflection.`},{file:`Before handing over, project where each shape and decor object should appear and compare with what
279
+ the player draws, before touching any value: "misplaced" and "hidden by something" look alike, and
280
+ a decor 8 m away that looked wrong was right and merely covered. Look at a close-up of the key
281
+ moment instead of concluding from numbers. A grey or black scene is more often "not loaded" or a
282
+ camera inside a wall than a data fault. Then list, in your report, the questions whose answers would
283
+ replace each "assumed" value (height at the start, timed duration, which way the head turned, standing
284
+ point, what was behind), because that list is what an investigator can act on.`}];static text(e){return Nt.RULES.map(t=>t[e]).filter(t=>t!==void 0).map((t,i)=>`${i+1}. ${t.replace("{tags}",Nt.KNOWN_TAGS.join(", "))}`).join(`
285
+ `)}}class zt{static of(e){const{recording:t}=li.strip(e),{timeline:i,...s}=t,n=(i?.keyframes??[]).map(o=>zt.keyframe(o)),r=Object.entries(s).filter(([o,l])=>o!=="version"&&l!==void 0);if(!(r.length===0&&n.every(o=>o.shapes.length===0)))return{...Object.fromEntries(r),...n.length>0?{timeline:{keyframes:n}}:{}}}static keyframe(e){return{t:e.t,shapes:e.shapes.map(t=>zt.shape(t.sourceId,t.shape))}}static shape(e,t){const i=t??{},s=i.angular,n=i.aim;return{sourceId:e,kind:i.kind??"oval",...i.title===void 0?{}:{title:i.title},...s?.widthDeg===void 0||s.heightDeg===void 0?{}:{angular:{widthDeg:s.widthDeg,heightDeg:s.heightDeg}},...n?.azimuthDeg===void 0||n.altitudeDeg===void 0?{}:{aim:{azimuthDeg:n.azimuthDeg,altitudeDeg:n.altitudeDeg}}}}}const sr=$e.catalog({en:()=>M(()=>import("./ClaudeNarrativeTexts_en-CBLJZ7b6.js"),[],import.meta.url).then(E=>E.claudeNarrativeTexts_en),fr:()=>M(()=>import("./ClaudeNarrativeTexts_fr-DiKzTF9T.js"),[],import.meta.url).then(E=>E.claudeNarrativeTexts_fr),es:()=>M(()=>import("./ClaudeNarrativeTexts_es-BDV0GimU.js"),[],import.meta.url).then(E=>E.claudeNarrativeTexts_es),it:()=>M(()=>import("./ClaudeNarrativeTexts_it-DwxjRDVG.js"),[],import.meta.url).then(E=>E.claudeNarrativeTexts_it)}),ns={name:"draft_recording",description:"Record what the account states, what justifies each value, and what it leaves out.",input_schema:{type:"object",properties:{recording:{type:"object",description:"The recording, in the format given above. Partial: only the fields the account actually states."},claims:{type:"array",description:"One entry per value in `recording`. EVERY value needs one: a value with no claim is a value nobody can check.",items:{type:"object",properties:{path:{type:"string",description:'Where the value sits in `recording`, dot-joined, array indices as steps: "time", "place.locations.0.lat", "timeline.keyframes.1.shapes.0.shape.angular.widthDeg".'},basis:{type:"string",enum:["stated","derived","assumed"],description:'"stated": the observer said it. "derived": worked out from what they said plus something checkable. "assumed": chosen so the reconstruction has a value at all, on nothing they said.'},rationale:{type:"string",description:`For "stated", the account's own words, copied verbatim, never a paraphrase. For "derived", the working, with the numbers in it. For "assumed", what the guess was chosen for and how wrong it could be.`}},required:["path","basis","rationale"]}},gaps:{type:"array",description:"What nothing could settle, not even a guess worth making — one short sentence each, in the reader's language. Usually empty.",items:{type:"string"}}},required:["recording","claims","gaps"]}},nr=`You are reading an observer's account of an aerial sighting and reconstructing it in the
286
+ recording format of UFO@home, a tool that replays what an observer reported seeing, from where they
287
+ stood, under the real sky of that moment.
288
+
289
+ The reconstruction has to RUN. A field left empty is a sky that cannot be computed or a phenomenon
290
+ that cannot be drawn, so fill in everything the reconstruction needs — and say, of every single
291
+ value, which of three things it is:
292
+
293
+ - "stated": the observer said it. The rationale is their own words, copied verbatim.
294
+ - "derived": you worked it out from what they said plus something checkable. The rationale is the
295
+ working, with the numbers in it.
296
+ - "assumed": you chose it so the reconstruction would have a value at all, on nothing they said. The
297
+ rationale says what you chose it for and how wrong it could be.
298
+
299
+ Getting that label right matters more than getting the value right. A wrong value marked "assumed"
300
+ is a question for the author to answer; a guess passed off as "stated" is a fabricated account,
301
+ and it is the one thing this format exists to prevent. When in doubt, mark it weaker. In particular
302
+ a PLACE nobody named is "assumed", however carefully you reasoned about which road it must have
303
+ been: the arithmetic that follows from a guessed point is only ever as good as the point.
304
+
305
+ Claim only what a reader could disagree with. Structural fields carry no account and belong in no
306
+ list: never claim \`version\`, an \`id\`, a \`sourceId\`, or anything else that exists to make the
307
+ file load rather than to say what was seen. The "assumed" list is the author's to-do list, and
308
+ padding it with plumbing is how it stops being read.
309
+
310
+ Then:
311
+
312
+ ${Nt.text("draft")}`;class Be{static DEFAULT_MODEL="claude-opus-5-5";get settings(){return this.localizedSettings}localizedSettings=[];async localize(e){this.localizedSettings=Be.settingsIn(await sr.load(e))}static settingsIn(e){return[{id:"key",kind:"secret",label:e.keyLabel,required:!0,remembered:"credential",suspect:t=>t.startsWith("sk-ant-")?void 0:e.keySuspect},{id:"workspace",kind:"text",label:e.workspaceLabel,placeholder:e.workspacePlaceholder,hint:e.workspaceHint,remembered:"credential"},{id:"model",kind:"choice",label:e.modelLabel,choices:[{value:Be.DEFAULT_MODEL,label:"Claude Opus 5.5"},{value:"claude-fable-5-1",label:e.fableChoice},{value:"claude-sonnet-5-5",label:e.sonnetChoice},{value:"claude-haiku-4-5",label:e.haikuChoice}],remembered:"preference"}]}client;clientFor_;format;async draft(e,t){const i=await this.clientFor(e.settings.key,e.settings.workspace),s=this.format??=JSON.stringify((await M(async()=>{const{default:o}=await import("./sightingSchema-CgwoRMl-.js");return{default:o}},[],import.meta.url)).default),n=i.messages.stream({model:e.settings.model||Be.DEFAULT_MODEL,max_tokens:16e3,system:[{type:"text",text:nr},{type:"text",text:`The recording format, every key with what its own declaration says about it:
313
+
314
+ ${s}`,cache_control:{type:"ephemeral"}}],messages:this.messages(e),tools:[ns],tool_choice:{type:"auto",disable_parallel_tool_use:!0}}),r=()=>n.controller.abort();t?.aborted&&r(),t?.addEventListener("abort",r,{once:!0});try{return Be.read(await n.finalMessage())}catch(o){throw await Be.diagnose(o,t)}finally{t?.removeEventListener("abort",r)}}messages(e){return[{role:"user",content:[...(e.images??[]).map(t=>Be.imageBlock(t)),{type:"text",text:this.ask(e)}]}]}ask(e){const t=[];e.language&&t.push(`Write the gaps in ${e.language}.`);const i=e.current?zt.of(e.current):void 0;return i&&t.push(`What the editor already holds, shapes reduced to their stated angle and direction. Do not restate a value here that the account does not itself state:
315
+
316
+ ${JSON.stringify(i)}`),t.push(`The account:
317
+
318
+ ${e.ask}`,"Answer by calling draft_recording."),t.join(`
319
+
320
+ `)}static imageBlock(e){return{type:"image",source:{type:"base64",media_type:e.mediaType,data:e.data}}}async clientFor(e,t){if(!e)throw new he("credential");const i=`${e}\0${t??""}`;if(this.client&&this.clientFor_===i)return this.client;const{default:s}=await M(async()=>{const{default:n}=await import("./index-DqGmxMZD.js").then(r=>r.i);return{default:n}},__vite__mapDeps([0,1]),import.meta.url);return this.client=new s({apiKey:e,...t?{defaultHeaders:{"anthropic-workspace-id":t}}:{},dangerouslyAllowBrowser:!0,maxRetries:1}),this.clientFor_=i,this.client}static read(e){if(e.stop_reason==="refusal")throw new he("refused");const t=e.content.find(s=>s.type==="tool_use"&&s.name===ns.name);if(!t||t.type!=="tool_use")throw new he("malformed");const i=t.input;if(typeof i?.recording!="object"||i.recording===null||Array.isArray(i.recording))throw new he("malformed");return{recording:i.recording,claims:Array.isArray(i.claims)?i.claims.flatMap(s=>{const{path:n,basis:r,rationale:o}=s??{};return typeof n!="string"||typeof o!="string"?[]:[{path:n,basis:r==="derived"||r==="assumed"?r:"stated",rationale:o}]}):[],gaps:Array.isArray(i.gaps)?i.gaps.filter(s=>typeof s=="string"):[]}}static async diagnose(e,t){if(e instanceof he)return e;if(t?.aborted)return new he("cancelled",e);const{default:i}=await M(async()=>{const{default:s}=await import("./index-DqGmxMZD.js").then(n=>n.i);return{default:s}},__vite__mapDeps([0,1]),import.meta.url);return e instanceof i.AuthenticationError||e instanceof i.PermissionDeniedError?new he("credential",e):e instanceof i.RateLimitError?new he("rate-limited",e):e instanceof i.BadRequestError||e instanceof i.NotFoundError?new he("rejected",e.message,e):e instanceof i.APIConnectionError?new he("unreachable",e):new he("malformed",e)}}const vt=de.point("narrative").provide(de.BUILT_IN,[{id:"claude",name:"Claude",credit:"Anthropic",creditUrl:"https://www.anthropic.com/legal/consumer-terms",create:()=>new Be}]);class Ee{static stated(e){return Ee.statedIn(e,[])}static apply(e,t,i){const s=structuredClone(e);for(const n of i){const r=n.split("."),o=Ee.read(t,r);o!==void 0&&Ee.write(s,r,structuredClone(o))}return s}static statedIn(e,t){const i=[];for(const[s,n]of Object.entries(e)){if(n===void 0)continue;const r=[...t,s];Ee.isPlainObject(n)?i.push(...Ee.statedIn(n,r)):i.push(r.join("."))}return i}static isPlainObject(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}static read(e,t){let i=e;for(const s of t){if(!Ee.isPlainObject(i))return;i=i[s]}return i}static write(e,t,i){let s=e;for(const n of t.slice(0,-1)){const r=s[n];Ee.isPlainObject(r)||(s[n]={}),s=s[n]}s[t[t.length-1]]=i}}const rr={x:me.CANVAS_WIDTH_PX/2,y:me.CANVAS_HEIGHT_PX/2,width:1,height:1};class _t{static loadable(e){const t=e.decor?{decor:e.decor.map((s,n)=>_t.decor(s,n))}:{},i=e.timeline?.keyframes;return i?{...e,...t,timeline:{...e.timeline,keyframes:i.map(s=>({t:s.t??0,shapes:(s.shapes??[]).map(n=>({sourceId:n.sourceId,shape:_t.shape(n.shape)}))}))}}:{...e,...t}}static decor(e,t){const i=e.kind??"vehicle";return{...$n(i)?{windows:As(i)}:{},...i==="building"?{floors:Ds}:{},...e,id:e.id??`decor-${t+1}`,kind:i,eastM:e.eastM??0,northM:e.northM??0}}static shape(e){const t=e?.kind==="polygon"?"polygon":"oval";return{...t==="polygon"?{points:[{x:0,y:0},{x:1,y:0},{x:1,y:1},{x:0,y:1}]}:{},...e,kind:t,bounds:{...rr},color:typeof e?.color=="string"?e.color:"#e8e6df",angle:0,transparency:0,haloScale:0,selected:!1}}}class Le{static FREE='input:not([type]), input[type="text"], input[type="url"], input[type="search"], input[type="email"], input[type="tel"], input[type="password"], textarea';static FAMILY="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";static PICKER="select:not([multiple]):not([size]), .rr0-select";static CSS=`
321
+ /* Every field the same size; what is typed freely in a monospaced font (see InputFont). */
322
+ input, textarea, select, .rr0-select { font-size: var(--rr0-input-font-size, 13px); }
323
+ :is(${Le.FREE}) { font-family: ${Le.FAMILY}; }
324
+ /* Every list to pick from alike: room above and below its text, and its arrow drawn apart from its right edge (see InputFont). */
325
+ :is(${Le.PICKER}) {
326
+ -webkit-appearance: none; appearance: none; box-sizing: border-box;
327
+ padding: .3em 1.9em .3em .5em; line-height: 1.2;
328
+ border: 1px solid var(--line-strong, color-mix(in srgb, CanvasText 40%, transparent)); border-radius: var(--rr0-field-radius, 4px);
329
+ background-color: var(--ground, Field); color: var(--ink, FieldText);
330
+ background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
331
+ background-position: calc(100% - 1em) 55%, calc(100% - .65em) 55%;
332
+ background-size: .35em .35em, .35em .35em;
333
+ background-repeat: no-repeat;
334
+ cursor: pointer;
335
+ }
336
+ :is(${Le.PICKER}):disabled { opacity: .55; cursor: default; }
337
+ /* A group of fields framed as a list's frame is (see ElementList.CSS), never lighter than the borders round it: the browser's own is a
338
+ 2 px groove, paler on a dark panel than the fields it holds. A fieldset of no border keeps none (its own rule is the more specific). */
339
+ fieldset { border: 1px solid color-mix(in srgb, CanvasText 30%, transparent); border-radius: 4px; }
340
+ `}const or=`
341
+ <!-- From top to bottom, as the design handoff lays it out: what this recording is and its Save, the scene, the
342
+ sections as a row of chips (only one open at a time, see SightingEditorElement.toggleGroup), and the open section. The header goes
343
+ when another editor holds this one (see embedded): the holder says what is open, saves it, and puts Undo and Redo on its own line. -->
344
+ <div class="app">
345
+ <header class="editor-head" id="editor-head">
346
+ <div class="head-text">
347
+ <span id="label-editor-kicker" class="kicker"></span>
348
+ <h1 id="editor-title" class="editor-title"></h1>
349
+ </div>
350
+ <div class="head-actions">
351
+ <!-- Step back and forward through what was edited, whichever section it was edited in: the File section's text editor keeps the history (see SightingEditorElement.undo). -->
352
+ <span class="history" role="group">
353
+ <button id="undo" type="button" class="icon-btn" disabled><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4 3 7l3 3"/><path d="M3 7h6.5a3.5 3.5 0 0 1 0 7H8"/></svg></button>
354
+ <button id="redo" type="button" class="icon-btn" disabled><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="m10 4 3 3-3 3"/><path d="M13 7H6.5a3.5 3.5 0 0 0 0 7H8"/></svg></button>
355
+ </span>
356
+ <!-- What the editor holding this one adds to its actions, for a recording that is no case's: Read (see CaseEditorElement). -->
357
+ <slot name="head-actions"></slot>
358
+ <!-- The editor on this recording, for somebody else: a link to it, or its element for another page (see ShareDialogElement). Off while
359
+ the recording has no address to give. -->
360
+ <button id="share" type="button" class="pill-btn" aria-haspopup="dialog" disabled><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 3 14 7.5 9.5 12V9.3C5.8 9.2 3.8 10.4 2.5 12.8c.4-3.9 2.4-6.6 7-7.3V3z"/></svg><span id="label-share"></span></button>
361
+ <!-- The one way to keep what was done: the file, downloaded. Nothing is kept in the browser. -->
362
+ <button id="save" type="button" class="pill-btn" disabled><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2.5v8"/><path d="m4.5 7 3.5 3.5L11.5 7"/><path d="M3 13.5h10"/></svg><span id="label-save"></span></button>
363
+ </div>
364
+ </header>
365
+ <!-- Why the recording was not saved, when it would be read back as something else than what is meant (see RecordingActors). -->
366
+ <p id="save-refused" class="save-refused" role="alert" hidden></p>
367
+ <!-- Why the recording asked for was not loaded (see SightingEditorElement.showLoadError). -->
368
+ <p id="load-error" class="save-refused" role="alert" hidden></p>
369
+ <rr0-share-dialog id="share-dialog"></rr0-share-dialog>
370
+ <div class="scene-card">
371
+
372
+ <!-- A case opened for editing: the recordings it lists (the accounts, and the readings of them, which
373
+ are recordings of their own), one open at a time. Hidden for a single recording. Just above the render, as the player puts its own pickers: what
374
+ is picked here is what the render shows. -->
375
+ <div class="render-line">
376
+ <!-- The playback layer's own toggles, taken out of the picture — see UfoElement.hostControls. -->
377
+ <div id="scene-controls" class="scene-controls"></div>
378
+ </div>
379
+ <div id="ufo-slot"></div>
380
+ <!-- What Alt does while the view is turned by a drag (see SightingEditorElement.showViewDragHint). -->
381
+ <p id="view-drag-hint" class="view-drag-hint" role="status" hidden></p>
382
+ <div class="toolbar playback-row">
383
+ <button id="play-pause" type="button" class="icon-btn" data-icon="▶">${D.PLAY}</button>
384
+ <!-- The sound: the player's own button is hidden here with its controls (see SightingEditorElement.syncSoundControls), and stands where the player has it: between play and the time. -->
385
+ <div class="editor-volume">
386
+ <button id="editor-mute" type="button" class="icon-btn" aria-pressed="false"></button>
387
+ <input id="editor-volume" type="range" min="0" max="1" step="0.05" value="1"/>
388
+ </div>
389
+ <span id="time-start" class="time-label">0:00</span>
390
+ <button id="previous-mark" type="button" class="icon-btn">${D.PREVIOUS_MARK}</button>
391
+ <!-- The keyframes of what the open group edits, and the named moments — see TimelineMarks. -->
392
+ <div class="seek-track">
393
+ <input id="seek" type="range" min="0" max="0" value="0" step="1"/>
394
+ <div id="timeline-marks" class="timeline-marks"></div>
395
+ </div>
396
+ <button id="next-mark" type="button" class="icon-btn">${D.NEXT_MARK}</button>
397
+ <span id="time-end" class="time-label">0:00</span>
398
+ <!-- Lays the tracks out after the sections' chips (see TimelineTracks): the timeline then leaves the picture and stays in view. -->
399
+ <button id="toggle-tracks" type="button" class="icon-btn" aria-expanded="false" aria-controls="timeline-tracks"><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/></svg></button>
400
+ </div>
401
+ </div>
402
+ <!-- Drags the scene taller or shorter, which gives the form under it the height it leaves (see SightingEditorElement.resizeScene). -->
403
+ <div id="scene-resize" class="scene-resize" role="separator" aria-orientation="horizontal" tabindex="0"></div>
404
+ <nav id="group-tabs" class="section-chips">
405
+ <button class="group-tab" type="button" aria-controls="group-observation" aria-expanded="false">${D.SUMMARY}<span id="label-observation-group"></span></button>
406
+ <button class="group-tab" type="button" aria-controls="group-observer" aria-expanded="false">${D.WITNESS}<span id="label-observer-group"></span></button>
407
+ <button class="group-tab" type="button" aria-controls="group-location" aria-expanded="false">${D.LOCATION}<span id="label-location-group"></span></button>
408
+ <button class="group-tab" type="button" aria-controls="group-temporal" aria-expanded="false">${D.DATE}<span id="label-temporal-group"></span></button>
409
+ <button class="group-tab" type="button" aria-controls="group-decor" aria-expanded="false">${D.ENVIRONMENT}<span id="label-decor-group"></span></button>
410
+ <button class="group-tab" type="button" aria-controls="group-weather" aria-expanded="false">${D.SKY}<span id="label-weather-group"></span></button>
411
+ <button class="group-tab" type="button" aria-controls="group-shape" aria-expanded="false">${D.PHENOMENON}<span id="label-shape-group"></span></button>
412
+ <button class="group-tab" type="button" aria-controls="group-sound" aria-expanded="false">${D.SOUND}<span id="label-sound-group"></span></button>
413
+ <button class="group-tab" type="button" aria-controls="group-reference" aria-expanded="false">${D.PICTURES}<span id="label-reference-group"></span></button>
414
+ <button class="group-tab" type="button" aria-controls="group-file" aria-expanded="false">${D.FILES}<span id="label-file-group"></span></button>
415
+ <!-- What an element that holds this editor puts after the last tab (see CaseEditorElement): a mark of its own, which takes its room whether it shows or not. -->
416
+ <slot name="tab-status"></slot>
417
+ </nav>
418
+ <!-- The tracks, laid out after the sections' chips rather than under the scene: the chips stay where they are when the tracks unfold. -->
419
+ <div id="timeline-tracks" hidden></div>
420
+ <section class="group-panel" id="group-observation" aria-labelledby="label-observation-group" hidden>
421
+ <!-- One section, its id held back: what a case names this account by, set once (see SectionFolds). -->
422
+ <div class="form-section">
423
+ <div class="toolbar">
424
+ <!-- The observation's own id, not the observer's nor the case's: what a case and the
425
+ interpretations filed in it name this account by (see Sighting.id). -->
426
+ <label class="adv"><span id="label-sighting-id"></span> <input id="sightingId" type="text" placeholder="1964-04-24-ZamoraLonnie"/></label>
427
+ <label><span id="label-tags"></span> <input id="tags" type="text"/></label>
428
+ </div>
429
+ <!-- The account, and the button that reads it.
430
+ One field, not two. The description IS the account: a paragraph in the observer's own words,
431
+ which is what SightingEvent.description has always been documented to hold. What some
432
+ recordings put there instead — how a size was calculated, which relief source was measured —
433
+ belongs in the numbers those calculations produced, and saying it twice is how the two come
434
+ to disagree. So there is nothing to draft FROM but this, and drafting rewrites the rest of the
435
+ recording rather than this.
436
+ Its own row, pulled out of the one-line fields above, because a paragraph among a row of
437
+ one-line fields makes both harder to read. See SightingEditorElement.draftFromDescription. -->
438
+ <div class="toolbar narrative">
439
+ <label class="wide"><span id="label-description"></span>
440
+ <textarea id="description" rows="4"></textarea></label>
441
+ <!-- Which provider drafts, and the settings it declares (a key, a model…), rendered from the
442
+ provider itself: see NarrativeSetting, and SightingEditorElement.renderNarrativeSettings. -->
443
+ <span class="narrative-source"><span id="label-narrative-source"></span> <span id="narrative-source-row"></span></span>
444
+ <span id="narrative-settings" class="narrative-settings"></span>
445
+ <button id="narrative-draft" type="button"></button>
446
+ <button id="narrative-stop" type="button" hidden></button>
447
+ <output id="narrative-status" for="description"></output>
448
+ </div>
449
+ </div>
450
+ <!-- What the draft claims and what it could not: the part that makes the rest usable. Empty (and
451
+ so invisible) until there has been a draft. -->
452
+ <div id="narrative-report" class="narrative-report" hidden></div>
453
+ <!-- Everything this reconstruction actually asserts, on one wrapping strip: only fields that are SET appear (37 of 75 on
454
+ a real case), so it reads as a statement rather than as a second copy of the form. In the Summary section, where the
455
+ design handoff puts what the recording states and what is left to fill in: under the scene it pushed the sections
456
+ out of sight on a real case. Each chip carries its section and its field, so clicking one opens the right section and
457
+ puts the caret in the right input (see SightingEditorElement.refreshParamSummary); a value a data source supplied
458
+ rather than the author is marked, which is the one thing the form itself never showed at a glance. -->
459
+ <!-- Folded by default: the form says the same field by field, and the room is the scene's and the form's (see the chips' count). -->
460
+ <details id="param-summary-fold" class="param-summary-fold">
461
+ <summary id="label-param-summary"></summary>
462
+ <div id="param-summary" class="param-summary"></div>
463
+ </details>
464
+ </section>
465
+ <section class="group-panel" id="group-observer" aria-labelledby="label-observer-group" hidden>
466
+ <div class="toolbar">
467
+ <!-- The observers, laid out as every list of the editor is (see ElementList): the one whose account this is first, then the
468
+ other observers the scene places (decor of the kind "observer"); 🎯, 🗑 and "+" for those; under it, the frame of the one
469
+ picked: this account's own observer fields, or the decor fields of another, moved here while they are edited from this tab
470
+ (see SightingEditorElement.placeDecorItem). -->
471
+ <div id="observer-list-header" class="decor-list-part"></div>
472
+ <div id="observer-item">
473
+ <div id="observer-principal">
474
+ <div class="form-section">
475
+ <h3 class="section-title"><span id="label-section-identity"></span></h3>
476
+ <label class="adv"><span id="label-observer-id"></span> <input id="observerId" type="text"/></label>
477
+ <label><span id="label-observer-title"></span> <input id="observerTitle" type="text"/></label>
478
+ <label><span id="label-observer-last-name"></span> <input id="observerLastName" type="text"/></label>
479
+ <label><span id="label-observer-first-names"></span> <input id="observerFirstNames" type="text"/></label>
480
+ <!-- Who this observer is and how their account travelled — see Account. None of it is about
481
+ the phenomenon, which is why it sits here and not with the shape, and why it had to exist:
482
+ Poher's credibility criteria read these and a recording could state none of them. How MANY
483
+ people saw the thing is not here on purpose: a recording is one person's account, and the
484
+ count belongs to the case that gathers them. Blank means unknown. -->
485
+ <p id="observer-identity-hint" class="file-note"></p>
486
+ </div>
487
+ <div id="profile-section" class="form-section">
488
+ <h3 class="section-title"><span id="label-section-profile"></span></h3>
489
+ <label><span id="label-observer-age"></span> <input id="observerAge" type="number" min="0" max="120" step="1" size="4"/></label>
490
+ <label class="adv"><span id="label-observer-birth"></span> <rr0-date-input name="observer-birth" date-only></rr0-date-input></label>
491
+ <label><span id="label-observer-occupation"></span> <input id="observerOccupation" type="text"/></label>
492
+ </div>
493
+ <div id="testimony-section" class="form-section">
494
+ <h3 class="section-title"><span id="label-section-testimony"></span></h3>
495
+ <label><span id="label-account-source"></span> <select id="accountSource">
496
+ <option id="option-source-unknown" value=""></option>
497
+ <option id="option-source-on-site" value="on-site"></option>
498
+ <option id="option-source-interview" value="interview"></option>
499
+ <option id="option-source-telephone" value="telephone"></option>
500
+ <option id="option-source-questionnaire" value="questionnaire"></option>
501
+ <option id="option-source-letter" value="letter"></option>
502
+ <option id="option-source-social-media" value="social-media"></option>
503
+ <option id="option-source-press" value="press"></option>
504
+ </select></label>
505
+ <label><span id="label-account-url"></span> <input id="accountUrl" type="url" placeholder="https://…"/></label>
506
+ <!-- Three states and not a checkbox: a report that says nothing about follow-up is not a report
507
+ that says none happened, and the methods reading this score the two differently. -->
508
+ <label><span id="label-account-followed-up"></span> <select id="accountFollowedUp">
509
+ <option id="option-followed-unknown" value=""></option>
510
+ <option id="option-followed-yes" value="yes"></option>
511
+ <option id="option-followed-no" value="no"></option>
512
+ </select></label>
513
+ <!-- Everything that is about WHAT THE OBSERVER LOOKED THROUGH, grouped with the picker that names it:
514
+ the filter in front of it and the settings of the device (see below). Which of them show, and
515
+ which are read-only, follows the instrument chosen. -->
516
+ </div>
517
+ <!-- Ballester-Guasp's strangeness factors as the investigators judged them, filled by AccountEvaluationFields. -->
518
+ <div id="strangeness-section" class="form-section"></div>
519
+ <div id="instrument-group" class="instrument-group form-section" role="group" aria-labelledby="label-section-vision">
520
+ <h3 class="section-title"><span id="label-section-vision"></span></h3>
521
+ <div class="field"><span id="label-instrument"></span> <rr0-popover-picker id="instrument" aria-labelledby="label-instrument"></rr0-popover-picker></div>
522
+ <!-- Beside the device, and the device's own: a solar filter is for an eye or a telescope, a solar film for a
523
+ camera, so which ones are offered follows the device (see Filter.usableWith). -->
524
+ <label><span id="label-filter"></span> <select id="filter"></select></label>
525
+ <!-- What the device was SET to, when it could be set at all: the lens's focal length (shown as
526
+ the field of view for an eye, which has no focal length), how far it was stopped down, and
527
+ how long its shutter stayed open. Each falls back to the instrument's own value and each is
528
+ disabled when the device fixes it — an Instamatic's owner had nothing to choose. See
529
+ Instrument.ts and ObserverPose.fNumber/exposureSeconds. -->
530
+ <label><span id="label-focal-length"></span> <input id="focalLength" type="number" min="1" max="2000" step="0.1"/> <span id="unit-focal-length"></span>
531
+ <output id="focal-fov" class="apparent-size inline" for="focalLength"></output></label>
532
+ <label class="adv"><span id="label-f-number"></span> f/<input id="fNumber" type="number" min="0.7" max="64" step="0.1"/></label>
533
+ <label class="adv"><span id="label-exposure"></span> <input id="exposureSeconds" type="text" inputmode="decimal" size="7" placeholder="1/250"/> s</label>
534
+ <label><span id="label-film-stock"></span> <select id="filmStock"></select></label>
535
+ <label class="adv"><span id="label-iso"></span> ISO <input id="iso" type="number" min="1" max="409600" step="1"/></label>
536
+ <label class="adv"><span id="label-metering"></span> <select id="metering">
537
+ <option value="" id="metering-device"></option><option value="average" id="metering-average"></option>
538
+ <option value="highlights" id="metering-highlights"></option></select></label>
539
+ <label class="adv"><span id="label-focus-distance"></span> <input id="focusDistance" type="number" min="0.1" max="30000" step="0.1" placeholder="&#8734;"/> m</label>
540
+ <!-- With the instrument and not with the place: latitude and heading say where the observer
541
+ stood and which way they faced, and this says nothing about either. It is how the device
542
+ was HELD — a camera askew, a head leaned over — which is why it belongs beside the focal
543
+ length and the aperture whose own spikes it turns. -->
544
+ <label class="adv"><span id="label-roll"></span> <input id="roll" type="number" min="-180" max="180" step="1" value="0"/> &deg;</label>
545
+ <!-- How much the body holding it moves the view at rest — see Sighting.sway: 1 a person, 0 a
546
+ tripod. Blank is the default (1, or 0 for a paralysed observer). -->
547
+ <label class="adv"><span id="label-sway"></span> <input id="sway" type="number" min="0" max="3" step="0.1" placeholder="1"/></label>
548
+ <!-- What the picture was taken through besides the lens, and what was on that glass: what lays more ghosts and halos over every light
549
+ of it (see LensStateJson). Shown for an instrument that records a picture only: an eye has no glass of its own. -->
550
+ <label class="adv lens-row"><span id="label-lens-glass"></span> <select id="lens-glass">
551
+ <option value="" id="lens-glass-none"></option><option value="filter" id="lens-glass-filter"></option>
552
+ <option value="window" id="lens-glass-window"></option><option value="windscreen" id="lens-glass-windscreen"></option>
553
+ </select></label>
554
+ <label class="adv lens-row"><span id="label-lens-drops"></span> <input id="lens-drops" type="number" min="0" max="1" step="0.1"/></label>
555
+ <label class="adv lens-row"><span id="label-lens-condensation"></span> <input id="lens-condensation" type="number" min="0" max="1" step="0.1"/></label>
556
+ <label class="adv lens-row"><span id="label-lens-dirt"></span> <input id="lens-dirt" type="number" min="0" max="1" step="0.1"/></label>
557
+ <label class="adv lens-row"><input id="lens-sheltered" type="checkbox"/> <span id="label-lens-sheltered"></span></label>
558
+ </div>
559
+ <div class="form-section" data-fold="all">
560
+ <h3 class="section-title"><span id="label-section-perception"></span></h3>
561
+ <rr0-provider-settings id="observerPerception"></rr0-provider-settings>
562
+ </div>
563
+ </div>
564
+ <div id="observer-decor-host"></div>
565
+ </div>
566
+ </div>
567
+ </section>
568
+ <section class="group-panel" id="group-location" aria-labelledby="label-location-group" hidden>
569
+ <!-- Where the data of this group is read from, one kind at a time (see SightingEditorElement.sourcePickers): out of the way of what
570
+ the group edits, behind the gear at its top right. Who answered is still said where the answer is reported. -->
571
+ <button class="group-settings" type="button" id="location-settings-button" popovertarget="location-settings" style="anchor-name: --location-settings" aria-haspopup="dialog"><svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false"><path fill="currentColor" d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6a3.6 3.6 0 1 1 0-7.2 3.6 3.6 0 0 1 0 7.2z"/></svg></button>
572
+ <div class="group-settings-panel" id="location-settings" popover style="position-anchor: --location-settings" role="dialog" aria-labelledby="label-location-settings">
573
+ <div class="group-settings-title" id="label-location-settings"></div>
574
+ <div id="terrain-source-rows" class="terrain-source-rows"></div>
575
+ </div>
576
+ <div class="toolbar">
577
+ <!-- An account names a place, it doesn't give coordinates ("on the Valensole plateau", never
578
+ 43.8379 / 5.9840) — so the name is what this group asks for first, and the latitude and
579
+ longitude below are what answering it produces. Searched only on Enter or the button, never
580
+ per keystroke: see NominatimPlaceProvider's own doc comment on why that restraint matters. -->
581
+ <div class="place-search-row">
582
+ <label><span id="label-place-name"></span>
583
+ <input id="placeName" type="text" autocomplete="off" class="place-name"/></label>
584
+ <button id="search-place" type="button"></button>
585
+ <label id="place-match-row" hidden><span id="label-place-match"></span> <select id="placeMatch"></select></label>
586
+ <!-- "2 lieux trouvés selon [Nominatim]" — the picker sits where the count is reported, not in
587
+ a settings drawer: who answered is part of the answer. See DataSource.ts. -->
588
+ <output id="place-status" class="place-status" for="placeName"><span id="place-status-text"></span><span id="place-source-row" class="inline-source" hidden></span></output>
589
+ </div>
590
+ <div class="form-section">
591
+ <h3 class="section-title"><span id="label-section-coordinates"></span></h3>
592
+ <!-- As degrees, or from a decor object ("20 m south of the house"): see PositionInputElement. The fields keep the ids lat and lng. -->
593
+ <div class="observer-position"><span id="label-position"></span> <rr0-input-position name="observer" native="geo" lat-id="lat" lng-id="lng"></rr0-input-position></div>
594
+ <label><span id="label-elevation"></span>
595
+ <input id="elevation" type="number" min="-500" max="9000" step="1" value="0"/> m</label>
596
+ <output id="ground-elevation" class="ground-elevation" for="lat lng"></output>
597
+ </div>
598
+ <div class="form-section">
599
+ <h3 class="section-title"><span id="label-section-gaze"></span></h3>
600
+ <label><span id="label-heading"></span> <input id="heading" type="number" min="0" max="360" step="1"/> <span id="heading-unit">&deg;</span></label>
601
+ <label><span id="label-pitch"></span> <input id="pitch" type="number" min="-90" max="90" step="1" value="0"/> &deg;</label>
602
+ <!-- Above SEA LEVEL, not above the ground: "0 m" is simply false for an observer in the Alps, and
603
+ an editor that offers it invites a recording that says so. The ground's own height at the
604
+ location becomes the field's floor and its default the moment the location is known — see
605
+ SightingEditorElement.applyGroundElevation. -->
606
+ <!-- The night sky of the place, towns and all — see Sighting.lightPollution. Blank is a natural
607
+ sky, which is what every recording that says nothing gets. -->
608
+ </div>
609
+ <!-- What the observer did, as events whose values the player works out (see EventsPanel): absent from a recording that states none. -->
610
+ <div class="form-section events-section" id="events-section" hidden>
611
+ <h3 class="section-title"><span id="label-section-events" class="events-title"></span></h3>
612
+ <div class="events-body"></div>
613
+ </div>
614
+ <div class="form-section" data-fold="all">
615
+ <h3 class="section-title"><span id="label-section-night-sky"></span></h3>
616
+ <label><span id="label-light-pollution"></span> <input id="lightPollution" type="number" min="15" max="22" step="0.01" placeholder="22"/> mag/arcsec&sup2;</label>
617
+ <!-- Where that figure came from: "18.79 according to [World Atlas 2015]" while the atlas owns it,
618
+ nothing once the author has typed their own (see SightingEditorElement.lookUpLightPollution). -->
619
+ <output id="light-pollution-status" class="place-status" for="lightPollution"><span id="light-pollution-status-text"></span><span id="light-pollution-source-row" class="inline-source" hidden></span></output>
620
+ </div>
621
+ <!-- What was around the observer that makes a noise — see Around and AroundPanel, which draws its fields. -->
622
+ <div class="form-section around-section" id="around-section" data-fold="all">
623
+ <h3 class="section-title"></h3>
624
+ <div class="around-body"></div>
625
+ </div>
626
+ </div>
627
+ </section>
628
+ <!-- Its own group, no longer a fieldset nested inside Location. What stands around the observer is
629
+ the single largest thing this editor asks for — 34 controls against Location's own 8 — so
630
+ folded in there it made Location the tallest panel by far (313px) and, with one panel open at
631
+ a time, the one that alone still overflowed a phone. Split out, neither half does. The two
632
+ stay adjacent because a decor object is placed RELATIVE to the location above it. -->
633
+ <section class="group-panel" id="group-decor" aria-labelledby="label-decor-group" hidden>
634
+ <!-- Where the data of this group is read from, one kind at a time (see SightingEditorElement.sourcePickers): out of the way of what
635
+ the group edits, behind the gear at its top right. Who answered is still said where the answer is reported. -->
636
+ <button class="group-settings" type="button" id="decor-settings-button" popovertarget="decor-settings" style="anchor-name: --decor-settings" aria-haspopup="dialog"><svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false"><path fill="currentColor" d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6a3.6 3.6 0 1 1 0-7.2 3.6 3.6 0 0 1 0 7.2z"/></svg></button>
637
+ <div class="group-settings-panel" id="decor-settings" popover style="position-anchor: --decor-settings" role="dialog" aria-labelledby="label-decor-settings">
638
+ <div class="group-settings-title" id="label-decor-settings"></div>
639
+ <div id="decor-source-rows" class="terrain-source-rows"></div>
640
+ </div>
641
+ <div class="toolbar">
642
+ <!-- The list of the decor, laid out as every list of the editor is (see ElementList): the picker, 🎯, 🗑, then the kind to add and
643
+ "+", on one line; under it, the frame of everything that is set on the picked object, gone while there is none. -->
644
+ <div id="decor-list-header" class="decor-list-part"></div>
645
+ <div id="decor-item">
646
+ <!-- The base properties — name, place, heading, colour, measures — are drawn from what a decor object says it has (see
647
+ DecorBaseParameterSets and ParameterForm). The model it is drawn as is the last of them: a window of pictures over the same choice. -->
648
+ <div id="decor-base" class="decor-parameters"></div>
649
+ <!-- The properties the kind of this object says it has beyond placement and size — floors, windows, a
650
+ bridge's railing, a line's poles — drawn from what the kind publishes (see DecorParameterSets and
651
+ ParameterForm), so that the editor knows no kind. -->
652
+ <div id="decor-parameters" class="decor-parameters"></div>
653
+ <!-- Lit, lamps, and where the observer sits: drawn the same way, after the properties of the kind. -->
654
+ <div id="decor-state" class="decor-parameters"></div>
655
+ </div>
656
+ <!-- The scenery the editor takes, by itself, from a survey of the place (see SurroundingsPlanter): a choice of the survey it is taken from, or none (the first of the registry by default,
657
+ and kept by the browser, since asking sends the place to a service), and what it says of what it took: how many trees, buildings, bridges
658
+ and lines, or that the survey could not be reached. Empty where no survey covers the place, which is most of the world. It sits
659
+ on a line of its own, below what the list of the decor draws, and is read out by whoever listens to the page. -->
660
+ <div id="scenery" class="decor-scenery form-section">
661
+ <h3 class="section-title"><span id="label-section-survey"></span></h3>
662
+ <span id="scenery-picker"><span id="label-scenery-source" hidden></span><select id="scenery-source"><option value="none" id="option-scenery-none"></option></select>
663
+ <label id="scenery-radius-row"><span id="label-scenery-radius"></span> <input type="number" id="scenery-radius" min="20" max="3000" step="10" value="100"/> m</label>
664
+ <button id="scenery-file-link" type="button" class="source-file-link" hidden></button></span>
665
+ <span id="scenery-status" role="status" aria-live="polite"></span>
666
+ <span id="scenery-warning" class="scenery-warning" role="alert" hidden></span>
667
+ </div>
668
+ </div>
669
+ </section>
670
+ <section class="group-panel" id="group-temporal" aria-labelledby="label-temporal-group" hidden>
671
+ <div class="toolbar">
672
+ <!-- Two ways to say the same thing, and the native picker is the default because a
673
+ reconstruction needs a full instant to compute a sky at all: of the nine recordings that
674
+ exist, eight state one to the minute. The EDTF text field is what the ninth needs, and
675
+ what the wider corpus needs far more often — of 241 case files on rr0.org, 43% state a
676
+ bare year and only 17% a date with a time. So the text field is never removed, only
677
+ folded away.
678
+
679
+ The picker writes THROUGH the text field rather than into the model: it composes an EDTF
680
+ string, puts it here, and goes down the same applyEdtfTimeInput path as a typed one. One
681
+ write path, one parse, one validation — and the stored raw string therefore stays
682
+ canonical whichever control produced it, which matters because formatEdtfTime returns it
683
+ verbatim and would otherwise display a stale string over fresh numbers. -->
684
+ <div class="form-section">
685
+ <h3 class="section-title"><span id="label-section-period"></span></h3>
686
+ <label><span id="label-observation-time"></span>
687
+ <!-- A date is precise (a picker) or said in EDTF (a text: a year, a month, a time with no date, or a doubt: [?~%] at the
688
+ end of the value, or before one of its parts, as @rr0/time reads it: see parseEdtfTime). See DateInputElement
689
+ for the controls it makes (obs-time-native, obs-time) and the button that swaps them. -->
690
+ <rr0-date-input name="obs-time"></rr0-date-input></label>
691
+ <label><span id="label-observation-end-time"></span>
692
+ <rr0-date-input name="obs-end-time"></rr0-date-input></label>
693
+ <!-- Beside the dates it reads, not after the duration, and never held back: a time read in the wrong zone is hours off.
694
+ The zone is the RULE, the number is what that rule produced for this sighting's own date —
695
+ summer time included, and as it was then (see engine/time/TimeZones.ts). Pick a zone and
696
+ the number is derived and read-only; leave it on the manual entry and type the number
697
+ yourself, which is all a recording used to be able to say. -->
698
+ <label><span id="label-utc-offset"></span> <select id="timeZone"></select>
699
+ <input id="utcOffsetHours" type="number" min="-12" max="14" step="0.5"/> UTC&plusmn;h</label>
700
+ <span id="time-zone-warning" class="scenery-warning" role="alert" hidden></span>
701
+ <label><span id="label-duration"></span> <rr0-duration-input name="durationSeconds"></rr0-duration-input></label>
702
+ </div>
703
+ <div class="form-section">
704
+ <!-- The named moments of the account (see Milestone) — in the Moment group, because they are
705
+ instants: they name times of the account, not anything about a shape. Added at
706
+ the playhead, which is the only instant a reader has in mind when they name one. -->
707
+ <!-- Laid out as every list of the editor is (see ElementList): the picker, 🎯, 🗑, "+", then the frame of the picked moment.
708
+ Titled, since this tab is not only its moments. -->
709
+ <h3 class="section-title"><span id="label-milestones"></span></h3>
710
+ <div class="element-list-row" id="milestone-row">
711
+ <label class="element-list-picker"><select id="milestone" aria-labelledby="label-milestones"></select></label>
712
+ <!-- A select says nothing when the moment already shown is picked again, which is the one to go
713
+ back to after playing on past it: this goes there whatever the list shows. -->
714
+ <button id="go-to-milestone" type="button" class="icon-btn">${D.TARGET}</button>
715
+ <button id="delete-milestone" type="button" class="icon-btn">${D.TRASH}</button>
716
+ <span id="milestone-empty" class="element-list-empty"></span>
717
+ <button id="add-milestone" type="button" class="icon-btn element-list-add">${D.PLUS}</button>
718
+ </div>
719
+ <div class="element-list-body" id="milestone-item">
720
+ <label><span id="label-milestone-label"></span> <input id="milestoneLabel" type="text" size="4"/></label>
721
+ <label><span id="label-milestone-note"></span> <input id="milestoneNote" type="text"/></label>
722
+ </div>
723
+ <!-- What the interviews of a case say of this observation's moments, given by the case that holds both (see passages): each its moment,
724
+ which the playhead goes to, and its quotation, which opens the passage. None outside a case. -->
725
+ <ul id="moment-passages" class="moment-passages" hidden></ul>
726
+ </div>
727
+ </div>
728
+ </section>
729
+ <!-- The recording itself, as the file it will be saved as. Last on the strip because it is about the
730
+ whole rather than about any one thing: it is where a recording comes in (a file, an address)
731
+ and goes out (Export), and where it can be read and edited as the text it is, in both
732
+ directions with the form (see SightingEditorElement.loadFileEditor). The editor is a chunk of
733
+ its own, fetched the first time this group is opened — CodeMirror is the heaviest thing the
734
+ component could carry and most authors never need it. -->
735
+ <section class="group-panel" id="group-file" aria-labelledby="label-file-group" hidden>
736
+ <!-- The files the recording is made of, one picked at a time as every list of the editor is (see ElementList): the recording itself, and
737
+ the annexes it carries snapshots beside it so that it plays without asking third parties (see Snapshots, SnapshotsPanel). -->
738
+ <div class="element-list-row" id="file-item-row">
739
+ <label class="element-list-picker"><select id="file-item" aria-labelledby="label-file-group"></select></label>
740
+ </div>
741
+ <p id="file-note" class="file-note" hidden role="status"></p>
742
+ <div class="element-list-body" id="file-recording">
743
+ <div class="toolbar">
744
+ <span class="input-file-row"><span id="label-import-file"></span> <rr0-input-file id="import" name="import" accept="application/json,.json,application/zip,.zip" placeholder="https://…/sighting.json"></rr0-input-file></span>
745
+ <button id="export" type="button"></button>
746
+ <!-- What the reconstruction holds geographically, for Google Earth, SVH or QGIS: see GeographicFigures. -->
747
+ <button id="export-kml" type="button"></button>
748
+ <button id="export-geojson" type="button"></button>
749
+ <!-- How the keyframes are written, in the text below and in the file saved: see RecordingText.of. -->
750
+ <label class="check"><input id="whole-keyframes" type="checkbox"/> <span id="label-whole-keyframes"></span></label>
751
+ </div>
752
+ <!-- A question about what an edit of the text just touched: data the editor reads dynamically (see SightingEditorElement.askAboutWeather). Modal: the author has to say what they mean before anything else is done, and the edit stands meanwhile. Escape is the safe answer, which puts back what was read. -->
753
+ <dialog id="file-ask" class="file-ask" aria-labelledby="file-ask-text">
754
+ <p id="file-ask-text"></p>
755
+ <div class="file-ask-buttons">
756
+ <button id="file-ask-stop" type="button"></button>
757
+ <button id="file-ask-keep" type="button"></button>
758
+ </div>
759
+ </dialog>
760
+ <!-- Asked at Save, the one way a recording leaves the editor, when it names or locates a person (see IdentityGuard). -->
761
+ <dialog id="identity-ask" class="file-ask" aria-labelledby="identity-ask-text">
762
+ <p id="identity-ask-text"></p>
763
+ <ul id="identity-ask-found"></ul>
764
+ <div class="file-ask-buttons">
765
+ <button id="identity-ask-initials" type="button"></button>
766
+ <button id="identity-ask-keep" type="button"></button>
767
+ <button id="identity-ask-back" type="button"></button>
768
+ </div>
769
+ </dialog>
770
+ </div>
771
+ <!-- One annex: where it is (a file of its own, or the recording itself when it is kept inside it), when and from whom it was taken, its text
772
+ when it is one. -->
773
+ <div class="element-list-body snapshot-data" id="snapshot-data" hidden>
774
+ <div class="toolbar">
775
+ <span class="input-file-row"><span id="label-annex-source"></span> <rr0-input-file id="annex-source" name="annex-source" no-button placeholder="https://…"></rr0-input-file></span>
776
+ <button id="annex-export" type="button"></button>
777
+ </div>
778
+ <p class="row"><span id="snapshot-state" class="snapshot-group-state"></span> <button id="snapshot-refresh" type="button"></button></p>
779
+ <p id="snapshot-note" class="snapshot-note" hidden role="status"></p>
780
+ <div id="annex-editor" class="file-editor" hidden></div>
781
+ </div>
782
+ <!-- A part of the recording's own text (its weather, its place, its night sky): inside the recording, or in an annex beside it (see
783
+ SectionFilePanel). Its text is the recording's own. -->
784
+ <div class="element-list-body snapshot-data" id="file-section" hidden>
785
+ <div class="toolbar">
786
+ <span class="input-file-row"><span id="label-section-annex-source"></span> <rr0-input-file id="section-annex-source" name="section-annex-source" no-button accept="application/json,.json" placeholder="https://…/sighting.weather.json"></rr0-input-file></span>
787
+ <button id="section-annex-export" type="button"></button>
788
+ </div>
789
+ <p id="section-annex-state" class="snapshot-group-state"></p>
790
+ <p id="section-annex-note" class="snapshot-note" hidden role="status"></p>
791
+ </div>
792
+ <!-- The modules of the page and those the recording names (see ModulesPanelElement): built the first time it is shown. -->
793
+ <div class="element-list-body" id="file-modules" hidden>
794
+ <rr0-modules-panel id="modules-panel"></rr0-modules-panel>
795
+ </div>
796
+ <!-- The recording as text: the recording's own item, and an item kept inside it, its section shown (see showFileItem). -->
797
+ <div id="file-editor" class="file-editor"></div>
798
+ </section>
799
+ <section class="group-panel" id="group-weather" aria-labelledby="label-weather-group" hidden>
800
+ <!-- Where the data of this group is read from, one kind at a time (see SightingEditorElement.sourcePickers): out of the way of what
801
+ the group edits, behind the gear at its top right. Who answered is still said where the answer is reported. -->
802
+ <button class="group-settings" type="button" id="weather-settings-button" popovertarget="weather-settings" style="anchor-name: --weather-settings" aria-haspopup="dialog"><svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false"><path fill="currentColor" d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.48.48 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.49.49 0 0 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6a3.6 3.6 0 1 1 0-7.2 3.6 3.6 0 0 1 0 7.2z"/></svg></button>
803
+ <div class="group-settings-panel" id="weather-settings" popover style="position-anchor: --weather-settings" role="dialog" aria-labelledby="label-weather-settings">
804
+ <div class="group-settings-title" id="label-weather-settings"></div>
805
+ <div id="weather-source-rows" class="terrain-source-rows"></div>
806
+ </div>
807
+ <div class="toolbar">
808
+ <!-- Weather is the one thing in this editor that isn't account: it's a measurable fact about
809
+ a place at an instant, and the Location and Temporal groups above already state both. So
810
+ it's looked up from a real record by default (see SightingEditorElement.inferWeather) and
811
+ shown read-only on that basis — a reanalysis value is a measurement to report, not a dial
812
+ to tune. Unchecking hands the fields back to the observer, whose account then outranks the
813
+ record and is never overwritten by it (Sighting.weatherSource). -->
814
+ <div class="weather-source-row">
815
+ <!-- Where the weather is read from: a record, asked again whenever the date or the place change, or the recording's own file,
816
+ where the observer's account or a record asked once is kept and never asked again. The box under it is what the editor
817
+ reasons on (see onWeatherInferredToggled): the picker ticks it for a record and unticks it for the file. -->
818
+ <span id="weather-picker"><span id="label-weather-inferred" hidden></span><select id="weatherSource"></select> <a id="weather-credit" class="source-credit" target="_blank" rel="noopener noreferrer"></a><button id="weather-file-link" type="button" class="source-file-link" hidden></button></span>
819
+ <input id="weatherInferred" type="checkbox" checked hidden/>
820
+ <!-- Clamped to one line unless the reader asks for the rest (see #sky-details below). What
821
+ these two lines say is worth saying — which record answered, and what else was up there
822
+ that night — but they say it in prose, and the sky line runs to 575 characters on a night
823
+ with cirrus in it. Left to flow, the two of them were most of this group's height: 550px
824
+ of it on a phone, where the render then no longer fitted under the panel at all. -->
825
+ <output id="weather-source" class="weather-source" for="lat lng obs-time"><span id="weather-source-text"></span><span id="weather-source-row" class="inline-source" hidden></span><a id="weather-source-link" target="_blank" rel="noopener noreferrer" hidden></a></output>
826
+ </div>
827
+ <!-- Not account either, and not even a lookup: a meteor shower is a position in the Earth's
828
+ own orbit and a comet's orbit is a solved problem, so the date and the place alone decide
829
+ both. Read-only on purpose — it states what else was in that patch of sky, and whether that
830
+ explains anything is the reader's conclusion, never the file's claim. See MeteorShowers.ts
831
+ and Comets.ts. -->
832
+ <!-- Ticked, the sky holds what the sources know of that date and place besides what the recording states: the meteors of the
833
+ showers and the sporadics, the fireballs a camera network recorded, the re-entries on record, the satellites tracked. Unticked,
834
+ it is a sky entered by hand, the meteors the witness saw stated as re-entries (see Sighting.skySources). -->
835
+ <label class="check"><input id="sky-sources" type="checkbox" checked/> <span id="label-sky-sources"></span></label>
836
+ <output id="sky-candidates" class="weather-source" for="lat lng obs-time"></output>
837
+ <!-- A shooting star for the meteor and a comet for the comet. The meteor button used to carry
838
+ the comet glyph, which was only ever unambiguous while there was nothing else up there. -->
839
+ <button id="show-meteor" type="button" class="icon-btn" disabled>${D.METEOR}</button>
840
+ <button id="show-comet" type="button" class="icon-btn" disabled>${D.COMET}</button>
841
+ <button id="show-nova" type="button" class="icon-btn" disabled>${D.STAR}</button>
842
+ <button id="show-satellite" type="button" class="icon-btn" disabled>${D.SATELLITE}</button>
843
+ <button id="show-fireball" type="button" class="icon-btn" disabled>${D.FIREBALL}</button>
844
+ </div>
845
+ <!-- The weather in three parts — what falls (first, and open on arrival: the user's own order), the
846
+ clouds, and what blows — as a strip of handles
847
+ inside the group, one part open at a time, the same way the eight groups themselves work:
848
+ a dozen controls in one row read as one undifferentiated dial bank. The storm sits with what
849
+ falls, not with the clouds it is made of: a thunderstorm is what a weather CODE reports
850
+ (Open-Meteo's, where the provider reads it from; METAR's TS beside RA and GR), a discrete
851
+ present-weather event like hail, where a cloud layer is a continuous thing with a height. -->
852
+ <div class="group-tabs" id="weather-tabs">
853
+ <button class="subgroup-tab" type="button" aria-controls="weather-precipitation" aria-expanded="true"><span id="label-precipitation-group"></span></button>
854
+ <button class="subgroup-tab" type="button" aria-controls="weather-clouds" aria-expanded="false"><span id="label-clouds-group"></span></button>
855
+ <button class="subgroup-tab" type="button" aria-controls="weather-wind" aria-expanded="false"><span id="label-wind-group"></span></button>
856
+ <button class="subgroup-tab" type="button" aria-controls="weather-aircraft" aria-expanded="false"><span id="label-aircraft-group"></span></button>
857
+ </div>
858
+ <section class="subgroup-panel" id="weather-precipitation" aria-labelledby="label-precipitation-group">
859
+ <div class="toolbar">
860
+ <label><span id="label-precipitation-type"></span>
861
+ <select id="precipitationType" class="weather-field">
862
+ <option id="option-precipitation-none" value="none"></option>
863
+ <option id="option-precipitation-rain" value="rain"></option>
864
+ <option id="option-precipitation-snow" value="snow"></option>
865
+ <option id="option-precipitation-hail" value="hail"></option>
866
+ </select>
867
+ </label>
868
+ <label><span id="label-precipitation-intensity"></span> <input id="precipitationIntensity" class="weather-field" type="range" min="0" max="1" step="0.05" value="0"/></label>
869
+ <label><span id="label-storm"></span> <input id="storm" class="weather-field" type="checkbox"/></label>
870
+ </div>
871
+ </section>
872
+ <section class="subgroup-panel" id="weather-clouds" aria-labelledby="label-clouds-group" hidden>
873
+ <div class="toolbar">
874
+ <style>#cloud-editor { flex-basis: 100%; min-width: 0; } #cloud-editor .cloud-panel { min-width: 0; } #cloud-editor .cloud-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; } #cloud-editor .cloud-list { grid-column: 1 / -1; min-width: 0; } #cloud-editor button:not(.icon-btn) { width: auto; min-height: 2em; padding: .25em .65em; } #cloud-editor label { display: flex; flex-direction: column; align-items: start; } #cloud-editor label[hidden] { display: none !important; } #cloud-editor input, #cloud-editor select { max-width: 100%; box-sizing: border-box; } #cloud-editor p { font-size: .85em; } #cloud-editor .cloud-parameters { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; } #cloud-editor .cloud-parameters .parameter-group { display: contents; border: 0; padding: 0; margin: 0; } #cloud-editor .cloud-parameters[hidden] { display: none; } #cloud-editor .cloud-parameters label { display: block; } #cloud-editor .cloud-parameters label > span { display: block; } #cloud-editor input.parameter-derived::placeholder { opacity: .65; }</style><div id="cloud-editor"></div>
875
+ <label hidden><span id="label-cloud-cover"></span> <input id="cloudCover" class="weather-field" type="range" min="0" max="1" step="0.05" value="0"/></label>
876
+ <!-- The HIGH deck, kept apart from the total: it is not about how much sky was hidden but about
877
+ whether there were ICE CRYSTALS in it, which is what halos and sundogs need. See
878
+ IceHalos.ts. -->
879
+ <label hidden><span id="label-high-cloud"></span> <input id="highCloudCover" class="weather-field" type="range" min="0" max="1" step="0.05" value="0"/></label>
880
+ <!-- The one weather control that stays live even when a record owns every other one, because no
881
+ record holds it: what the crystals were doing up there was never measured. See
882
+ Weather.iceCrystalAlignment. -->
883
+ <label hidden><span id="label-ice-alignment"></span> <input id="iceCrystalAlignment" class="weather-field" type="range" min="0" max="1" step="0.05" value="0.65"/></label>
884
+ <!-- Stated like the alignment, and for the same reason: nobody counted the crystals. See
885
+ Weather.rareIceCrystals. -->
886
+ <label hidden><span id="label-rare-ice"></span> <input id="rareIceCrystals" class="weather-field" type="range" min="0" max="1" step="0.05" value="0.05"/></label>
887
+ <label hidden><span id="label-cloud-darkness"></span> <input id="cloudDarkness" class="weather-field" type="range" min="0" max="1" step="0.05" value="0"/></label>
888
+ <label hidden><span id="label-cloud-base"></span>
889
+ <input id="cloudBase" class="weather-field" type="number" min="0" max="20000" step="50" placeholder="1000"/> m</label>
890
+ </div>
891
+ </section>
892
+ <section class="subgroup-panel" id="weather-wind" aria-labelledby="label-wind-group" hidden>
893
+ <div class="toolbar">
894
+ <label><span id="label-wind-direction"></span> <input id="windDirection" class="weather-field" type="number" min="0" max="360" step="1" value="0"/> &deg;</label>
895
+ <label><span id="label-wind-speed"></span> <input id="windSpeed" class="weather-field" type="number" min="0" max="30" step="0.5" value="0"/> m/s</label>
896
+ </div>
897
+ </section>
898
+ <!-- The aircraft a record says were around the witness: searched for like the weather, never written into the recording. -->
899
+ <section class="subgroup-panel" id="weather-aircraft" aria-labelledby="label-aircraft-group" hidden>
900
+ <div class="toolbar">
901
+ <div class="aircraft-source"><label for="aircraftSource" id="label-aircraft-source"></label> <span id="aircraft-source-row" class="source-picker"></span></div>
902
+ <div id="aircraft-flights"></div>
903
+ <p class="aircraft-own"><span id="aircraft-own-hint"></span> <button id="add-own-aircraft" type="button"></button></p>
904
+ </div>
905
+ </section>
906
+ <!-- What happened in that sky as facts (see SkyEventsJson), beside the state it was in: neither the decor, which outlasts the
907
+ observation, nor the interpretation, which reads the account. -->
908
+ <!-- The parts of the kinds of events of the sky the registry holds (see SkyEventKind, SightingEditorElement.syncSkyEventParts) go here, before this mark: lanterns, launches, beams, fireballs. -->
909
+ <template id="sky-event-parts"></template>
910
+ </section>
911
+ <!-- Its own group rather than a row of the Shape group below: what the object sounded like is
912
+ keyframed on the very same clock as its shape (a craft silent on the ground and heard only as
913
+ it lifts off is two keyframes), but it belongs to the sighting, not to any one drawn part of
914
+ it — see SoundTrack.ts. The kind dropdown is filled from SOUND_KINDS in script, so adding a
915
+ timbre never means editing markup and element ids (same rule as the data-source pickers). -->
916
+ <section class="group-panel" id="group-sound" aria-labelledby="label-sound-group" hidden>
917
+ <div class="toolbar">
918
+ <div class="form-section">
919
+ <h3 class="section-title"><span id="label-section-heard"></span></h3>
920
+ <label><span id="label-sound-kind"></span> <select id="soundKind" class="sound-field"></select></label>
921
+ <label><span id="label-sound-volume"></span> <input id="soundVolume" class="sound-field" type="range" min="0" max="1" step="0.05" value="0"/></label>
922
+ <label><span id="label-sound-pitch"></span>
923
+ <input id="soundPitch" class="sound-field" type="range" min="30" max="4000" step="10" value="100"/>
924
+ <output id="sound-pitch-value" class="apparent-size" for="soundPitch"></output></label>
925
+ </div>
926
+ <div class="form-section">
927
+ <h3 class="section-title"><span id="label-section-sound-recording"></span></h3>
928
+ <!-- The rare case where the sound was actually captured: it then plays instead of the
929
+ synthesized description (see SightingSound.src), and the embed stops being self-contained,
930
+ which is why nothing defaults to it. -->
931
+ <label><span id="label-sound-src"></span> <input id="soundSrc" class="sound-field" type="url"/></label>
932
+ </div>
933
+ </div>
934
+ </section>
935
+ <!-- Pictures of the place laid over the reconstruction (see SceneReference): one dropdown of them,
936
+ the fields of the selected one, and two ways to add one — an address, or a file from the
937
+ author's own disk, which is embedded in the recording. The registration is typed here for now
938
+ (heading, pitch, roll, field), with the observer's own pose one click away since a picture from
939
+ the observer's spot most often looks where they looked; lining a picture up on the rendered
940
+ relief by dragging it is the next step, not this one. -->
941
+ <section class="group-panel" id="group-reference" aria-labelledby="label-reference-group" hidden>
942
+ <div class="toolbar">
943
+ <!-- Laid out as every list of the editor is (see ElementList): the picker, 🗑, then where the picture to add comes from (an
944
+ address, a file from the author's own disk, embedded in the recording, or street-level pictures near the spot) and "+";
945
+ under it, the frame of the picked picture. -->
946
+ <div class="element-list-row" id="reference-row">
947
+ <label class="element-list-picker"><select id="reference"></select></label>
948
+ <button id="delete-reference" type="button" class="icon-btn">${D.TRASH}</button>
949
+ <span id="reference-empty" class="element-list-empty"></span>
950
+ <button id="add-reference" type="button" class="icon-btn element-list-add">${D.PLUS}</button>
951
+ </div>
952
+ <!-- Street-level pictures somebody took near the observer's spot — see PanoramaxPictures. Each
953
+ comes with where it was taken from and which way it looked, a registration already made. -->
954
+ <div class="decor-add-row">
955
+ <select id="reference-street" hidden></select>
956
+ <button id="reference-street-add" type="button" hidden></button>
957
+ </div>
958
+ <div class="element-list-body" id="reference-item">
959
+ <div class="form-section">
960
+ <h3 class="section-title"><span id="label-section-picture"></span></h3>
961
+ <label><span id="label-reference-title"></span> <input id="referenceTitle" class="reference-field" type="text"/></label>
962
+ <span class="input-file-row"><span id="label-reference-src"></span> <rr0-input-file id="reference-source" name="reference-source" accept="image/*,video/*" no-button placeholder="https://…/photo.jpg"></rr0-input-file></span>
963
+ <!-- Why the picture could not be read, right under where it was asked for (see PictureFailure). -->
964
+ <span id="reference-failure" class="reference-failure" role="alert" hidden></span>
965
+ <label><span id="label-reference-kind"></span>
966
+ <select id="referenceKind" class="reference-field">
967
+ <option value="photo" id="reference-kind-photo"></option>
968
+ <option value="panorama" id="reference-kind-panorama"></option>
969
+ <option value="video" id="reference-kind-video"></option>
970
+ </select></label>
971
+ <label><span id="label-reference-credit"></span> <input id="referenceCredit" class="reference-field" type="text"/></label>
972
+ <label class="adv"><span id="label-reference-credit-url"></span> <input id="referenceCreditUrl" class="reference-field" type="url"/></label>
973
+ <label><span id="label-reference-t"></span> <input id="referenceT" class="reference-field" type="number" min="0" max="86400" step="0.1" placeholder="—"/> s</label>
974
+ <label class="reference-video-field" hidden><span id="label-reference-video-from"></span> <input id="referenceVideoFrom" class="reference-field" type="number" min="0" step="0.01" placeholder="—"/> s</label>
975
+ <label class="reference-video-field" hidden><span id="label-reference-video-to"></span> <input id="referenceVideoTo" class="reference-field" type="number" min="0" step="0.01" placeholder="—"/> s</label>
976
+ <label class="reference-video-field" hidden><span id="label-reference-video-rate"></span> <input id="referenceVideoRate" class="reference-field" type="number" min="0.05" max="16" step="0.01" placeholder="1"/> &times;</label>
977
+ <label><span id="label-reference-drawing"></span> <input id="referenceDrawing" class="reference-field" type="checkbox"/></label>
978
+ <label><span id="label-reference-opacity"></span> <input id="referenceOpacity" class="reference-field" type="range" min="0" max="1" step="0.05" value="0.5"/></label>
979
+ </div>
980
+ <div class="form-section" data-fold="all">
981
+ <h3 class="section-title"><span id="label-section-pose"></span></h3>
982
+ <label><span id="label-reference-heading"></span> <input id="referenceHeading" class="reference-field" type="number" min="0" max="360" step="0.1"/> &deg;</label>
983
+ <label><span id="label-reference-pitch"></span> <input id="referencePitch" class="reference-field" type="number" min="-90" max="90" step="0.1"/> &deg;</label>
984
+ <label><span id="label-reference-roll"></span> <input id="referenceRoll" class="reference-field" type="number" min="-180" max="180" step="0.1"/> &deg;</label>
985
+ <label><span id="label-reference-fov"></span> <input id="referenceFov" class="reference-field" type="number" min="1" max="179" step="0.1"/> &deg;</label>
986
+ <button id="reference-use-pose" type="button"></button>
987
+ <button id="reference-remove-key" type="button" hidden></button>
988
+ <!-- Lining the picture up on the rendered scene, by hand and by landmarks — see
989
+ SightingEditorElement.canvasMode and PictureRegistration. While this group is open the
990
+ canvas belongs to the selected picture: a drag turns it, the wheel changes its field, and
991
+ a click names a landmark on it, then the same landmark in the render. -->
992
+ <button id="reference-adopt-pose" type="button"></button>
993
+ <span id="reference-status" class="apparent-size"></span>
994
+ </div>
995
+ <div class="form-section">
996
+ <!-- The details the picture is lined up on (see PictureLandmark), a list of the picture laid out as every list is: one row
997
+ each in the dropdown with how far it still is from fitting, the selected one bolder on the canvas, its name editable,
998
+ and a "+" that arms the next two clicks to name a new one. -->
999
+ <h3 class="section-title"><span id="label-reference-landmarks"></span></h3>
1000
+ <div class="element-list-row" id="reference-landmark-row">
1001
+ <label class="element-list-picker"><select id="reference-landmarks" aria-labelledby="label-reference-landmarks"></select></label>
1002
+ <button id="delete-reference-landmark" type="button" class="icon-btn">${D.TRASH}</button>
1003
+ <span id="reference-landmark-empty" class="element-list-empty"></span>
1004
+ <button id="add-reference-landmark" type="button" class="icon-btn element-list-add">${D.PLUS}</button>
1005
+ </div>
1006
+ <div class="element-list-body" id="reference-landmark-item">
1007
+ <label><span id="label-reference-landmark-label"></span> <input id="referenceLandmarkLabel" type="text"/></label>
1008
+ </div>
1009
+ </div>
1010
+ <div class="form-section">
1011
+ <!-- The ghosts of the lens in the picture (see GhostFinder): looked for on demand, shown on the picture itself with what each is the
1012
+ ghost of and the lens's axis they lie across. Loaded only when asked for (see GhostSearchView). -->
1013
+ <h3 class="section-title"><span id="label-reference-ghosts"></span></h3>
1014
+ <button id="reference-find-ghosts" type="button"></button>
1015
+ <button id="reference-ghosts-shown" type="button" aria-pressed="true" hidden></button>
1016
+ <span id="reference-ghosts-status" class="apparent-size"></span>
1017
+ </div>
1018
+ </div>
1019
+ <div class="form-section" data-fold="all">
1020
+ <!-- What an investigator drew over the place, from their own file (see InvestigatorTrace): lines
1021
+ of sight, axes, markers. Drawn over the scene as theirs, not as part of the reconstruction. A list of its own, laid out
1022
+ as every list is; its "+" reads a KML, KMZ or GeoJSON file. -->
1023
+ <h3 class="section-title"><span id="label-trace-import"></span></h3>
1024
+ <div class="element-list-row" id="trace-row">
1025
+ <label class="element-list-picker"><select id="trace" aria-labelledby="label-trace-import"></select></label>
1026
+ <button id="delete-trace" type="button" class="icon-btn">${D.TRASH}</button>
1027
+ <span id="trace-empty" class="element-list-empty"></span>
1028
+ <button id="add-trace" type="button" class="icon-btn element-list-add">${D.PLUS}</button>
1029
+ </div>
1030
+ <!-- Where the lines added by "+" are read from: a file of the author's, or an address. -->
1031
+ <span id="trace-import-row" class="input-file-row" hidden><rr0-input-file id="trace-import" name="trace-import" accept=".kml,.kmz,.geojson,.json,application/vnd.google-earth.kml+xml,application/vnd.google-earth.kmz,application/geo+json,application/json" placeholder="https://…/lines.kmz"></rr0-input-file></span>
1032
+ <span id="trace-status" class="apparent-size"></span>
1033
+ <div class="element-list-body" id="trace-item">
1034
+ <label><span id="label-trace-title"></span> <input id="traceTitle" class="trace-field" type="text"/></label>
1035
+ <label><span id="label-trace-source"></span> <input id="traceSource" class="trace-field" type="text"/></label>
1036
+ </div>
1037
+ </div>
1038
+ </div>
1039
+ </section>
1040
+ <section class="group-panel" id="group-shape" aria-labelledby="label-shape-group" hidden>
1041
+ <!-- In two parts: the shapes the observer DREW (angles on their image, the account), and the
1042
+ bodies the observer said those shapes WERE (the 3D interpretation, see BodyEditor). The shapes
1043
+ come first and open on arrival: they are what the rest of this editor draws and records. -->
1044
+ <div class="subtabs-row">
1045
+ <div class="group-tabs" id="shape-tabs">
1046
+ <button class="subgroup-tab" type="button" aria-controls="shape-shapes" aria-expanded="true"><span id="label-shapes-subgroup"></span></button>
1047
+ <button class="subgroup-tab" type="button" aria-controls="shape-bodies" aria-expanded="false"><span id="label-bodies-subgroup"></span></button>
1048
+ </div>
1049
+ <!-- How the account is drawn, and which part of the Phenomenon group edits it: the angles the observer drew (2D, the shapes) or what
1050
+ they said those were, in 3D (the bodies). Follows the panels as they are opened, and opens them when chosen. -->
1051
+ <label id="account-view-row" class="account-view"><span id="label-account-view"></span>
1052
+ <select id="account-view"><option value="shapes"></option><option value="bodies"></option></select></label>
1053
+ <!-- The shapes beside the bodies as outlines (see SceneElement.compareAccount), or the bodies alone: the player's own choice. -->
1054
+ <label id="account-compare-row" class="account-view" hidden><input id="account-compare" type="checkbox" checked/> <span id="label-account-compare"></span></label>
1055
+ </div>
1056
+ <section class="subgroup-panel" id="shape-shapes" aria-labelledby="label-shapes-subgroup">
1057
+ <div class="toolbar">
1058
+ <!-- Laid out as every list of the editor is (see ElementList): the picker, 🗑, "+", then the frame of what is set on the
1059
+ picked shape, gone while there is none. -->
1060
+ <div class="element-list-row" id="shape-row">
1061
+ <label class="element-list-picker"><select id="source"></select></label>
1062
+ <button id="delete-shape" type="button" class="icon-btn">${D.TRASH}</button>
1063
+ <span id="shape-empty" class="element-list-empty"></span>
1064
+ <button id="add-shape" type="button" class="icon-btn element-list-add">${D.PLUS}</button>
1065
+ </div>
1066
+ <div class="element-list-body" id="shape-item">
1067
+ <div class="form-section">
1068
+ <h3 class="section-title"><span id="label-section-appearance"></span></h3>
1069
+ <label><span id="label-shape-title"></span> <input id="shapeTitle" type="text"/></label>
1070
+ <label><span id="label-color"></span> <input id="color" type="color" value="#39ff14"/></label>
1071
+ <label><span id="label-transparency"></span> <input id="transparency" type="range" min="0" max="1" step="0.05" value="0"/></label>
1072
+ <label><span id="label-halo"></span> <input id="haloScale" type="range" min="0" max="3" step="0.1" value="1.5"/></label>
1073
+ <!-- Next to the halo, which it will be confused with, and named for the edge rather than for
1074
+ the light: a halo is a glow AROUND the shape, this is the outline itself losing its
1075
+ position. What it is worth as a distance, through the instrument the recording states, is
1076
+ printed beside the size estimate below. -->
1077
+ <!-- Not a bigger halo: a halo is a coloured fringe, and no fringe reads as painful. This is
1078
+ the light's own behaviour — a veil that washes out the field around it, the spikes its
1079
+ aperture throws, and a core clipped to white. See BaseShape.brightness. -->
1080
+ <label class="adv"><span id="label-brightness"></span> <input id="brightness" type="range" min="0" max="1" step="0.05" value="0"/></label>
1081
+ <label class="adv"><span id="label-blur"></span> <input id="blur" type="range" min="0" max="1" step="0.05" value="0"/></label>
1082
+ </div>
1083
+ <div class="form-section">
1084
+ <h3 class="section-title"><span id="label-section-size"></span></h3>
1085
+ <!-- Three readings of ONE relation, apparent width = f(real width, distance), kept in step.
1086
+ Only the apparent width is the recording's (BaseShape.angular); the real width is derived
1087
+ from it, and the distance is where the scene DRAWS the shape (see PhenomenonDepth), never a
1088
+ statement. Edit any one and one of the other two follows — the held one never moves, and
1089
+ with nothing held the real width is what a thing keeps: a distance edit changes how big it
1090
+ looks, and a width edit changes the other width at the distance it stands (the shape is
1091
+ resized on the canvas, which is what "try a size at a distance" always did). -->
1092
+ <label><span id="label-apparent-width"></span>
1093
+ <input id="apparentWidth" type="number" min="0" max="180" step="0.1"/>°
1094
+ <output id="apparent-size" class="apparent-size inline" for="apparentWidth"></output></label>
1095
+ <label><span id="label-real-width"></span>
1096
+ <input id="realWidth" type="number" min="0" max="30000" step="0.1"/> m</label>
1097
+ <label><span id="label-object-distance"></span>
1098
+ <input id="objectDistance" type="number" min="0" max="30000" step="1"/> m</label>
1099
+ <!-- The shape's turn on the drawing (BaseShape.angle), as its handle sets it: clockwise on screen, in degrees. -->
1100
+ <label><span id="label-shape-rotation"></span>
1101
+ <input id="shapeRotation" type="number" min="-180" max="180" step="1"/> &deg;</label>
1102
+ <label><span id="label-size-lock"></span>
1103
+ <select id="sizeLock">
1104
+ <option id="option-lock-none" value="none"></option>
1105
+ <option id="option-lock-apparent" value="apparent"></option>
1106
+ <option id="option-lock-real" value="real"></option>
1107
+ <option id="option-lock-distance" value="distance"></option>
1108
+ </select></label>
1109
+ <!-- Shown only while a distance of the reader's own is in force — whichever field put it there:
1110
+ the distance itself, or the real width with the apparent width held. -->
1111
+ <button id="clear-distance-hypothesis" type="button"></button>
1112
+ <output id="real-size" class="apparent-size" for="realWidth"></output>
1113
+ <output id="depth-basis" class="apparent-size" for="objectDistance"></output>
1114
+ <!-- The depth of field, read backwards. The scene blurs the WORLD from its distance and leaves
1115
+ the observer's object alone, because that distance is the unknown; a blur the observer
1116
+ STATED runs the geometry the other way and bounds it. See DepthOfField's own doc comment,
1117
+ which says so before anything existed to say it with. -->
1118
+ <output id="blur-bound" class="apparent-size" for="blur"></output>
1119
+ </div>
1120
+ <div class="form-section">
1121
+ <h3 class="section-title"><span id="label-section-path"></span></h3>
1122
+ <div class="record-row">
1123
+ <button id="record" type="button" class="record-btn"></button>
1124
+ <label class="adv"><span id="label-sampling-rate"></span> <input id="samplingRate" type="number" min="1" max="1000" step="1"/> ms</label>
1125
+ </div>
1126
+ </div>
1127
+ </div>
1128
+ </div>
1129
+ <!-- What the phenomenon did, as events whose shapes the player works out (see EventsPanel): after the shapes, whose list it is not. -->
1130
+ <div class="form-section events-section" id="phenomenon-events-section" hidden>
1131
+ <h3 class="section-title"><span id="label-section-phenomenon-events" class="events-title"></span></h3>
1132
+ <div class="events-body"></div>
1133
+ </div>
1134
+ </section>
1135
+ <section class="subgroup-panel" id="shape-bodies" aria-labelledby="label-bodies-subgroup" hidden>
1136
+ <div class="toolbar">
1137
+ <style>#body-editor { flex-basis: 100%; min-width: 0; } #body-editor .body-list, #body-editor .body-keys { flex-basis: 100%; min-width: 0; } #body-editor .body-editor, #body-editor .body-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } #body-editor .body-fields { flex-basis: 100%; min-width: 0; } #body-editor .body-fields[hidden], #body-editor [hidden] { display: none !important; } #body-editor select { min-width: 0; width: 100%; } #body-editor .body-intro { flex-basis: 100%; margin: 0; } #body-editor .body-explains { flex-basis: 100%; min-width: 0; box-sizing: border-box; margin: 0; } #body-editor #body-explains { display: flex; flex-wrap: wrap; gap: .3em 1em; } #body-editor #body-explains label { white-space: normal; } #body-editor .body-track { margin: 0; } #body-editor details { flex-basis: 100%; min-width: 0; } #body-editor details[open] { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } #body-editor details > summary { flex-basis: 100%; } #body-editor input, #body-editor select { max-width: 100%; box-sizing: border-box; } #body-editor input[type="color"] { width: 3em; padding: 0; } #body-editor #body-id, #body-editor #body-outline-node { width: 10em; } #body-editor #body-title, #body-editor #body-interpretation-title { field-sizing: content; min-width: 18em; max-width: 100%; } #body-editor label { min-width: 0; max-width: 100%; } #body-editor .body-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } #body-editor .body-parameters[hidden] { display: none !important; } #body-editor .parameter-group { display: contents; border: 0; padding: 0; margin: 0; } #body-editor .parameter-set { display: flex; flex-wrap: wrap; gap: .3em 1em; } #body-editor .parameter-row { flex-basis: 100%; } #body-editor input.invalid { outline: 2px solid #c33; } #body-editor input[data-key="title"] { field-sizing: content; min-width: 18em; max-width: 100%; } #body-editor input[data-key="id"], #body-editor input[data-key="outlineNode"] { width: 10em; } #body-editor input.parameter-derived::placeholder { opacity: .65; }</style><div id="body-editor"></div>
1138
+ </div>
1139
+ <!-- What the bodies did, as events whose keyframes the player works out (see EventsPanel): the picked body's, after its fields. -->
1140
+ <div class="form-section events-section" id="bodies-events-section" hidden>
1141
+ <h3 class="section-title"><span id="label-section-bodies-events" class="events-title"></span></h3>
1142
+ <div class="events-body"></div>
1143
+ </div>
1144
+ </section>
1145
+ </section>
1146
+ </div>
1147
+ <div id="context-menu" class="context-menu" hidden role="menu">
1148
+ <button id="context-group" type="button" role="menuitem"></button>
1149
+ <button id="context-ungroup" type="button" role="menuitem"></button>
1150
+ <button id="context-duplicate" type="button" role="menuitem"></button>
1151
+ <hr/>
1152
+ <button id="context-bring-to-front" type="button" role="menuitem"></button>
1153
+ <button id="context-send-to-back" type="button" role="menuitem"></button>
1154
+ <hr/>
1155
+ <button id="context-add-vertex" type="button" role="menuitem"></button>
1156
+ <button id="context-delete-vertex" type="button" role="menuitem"></button>
1157
+ <hr/>
1158
+ <button id="context-delete" type="button" role="menuitem" class="context-delete"></button>
1159
+ </div>
1160
+ <div id="decor-context-menu" class="context-menu" hidden role="menu">
1161
+ <button id="context-view-account" type="button" role="menuitem"></button>
1162
+ <div class="submenu-trigger">
1163
+ <span id="label-context-masks" class="submenu-label" role="menuitem" aria-haspopup="true"></span>
1164
+ <div id="context-masks-submenu" class="submenu" role="menu"></div>
1165
+ </div>
1166
+ </div>
1167
+ `,ar=`${Le.CSS}${ge.CSS}${D.CSS}${Fe.CSS}${Rs.CSS}${vi.CSS}${ke.CSS}${Bs.CSS}${Ps.CSS}${se.CSS}
1168
+ :host {
1169
+ color-scheme: light dark;
1170
+ display: block;
1171
+ font-family: sans-serif;
1172
+ }
1173
+ .decor-list-part {
1174
+ display: contents;
1175
+ }
1176
+ /* The fields of the observer of this account keep the toolbar's flow inside the frame; another observer's are on a line of their own. */
1177
+ #observer-principal {
1178
+ display: contents;
1179
+ }
1180
+ #observer-principal[hidden] {
1181
+ display: none;
1182
+ }
1183
+ #observer-decor-host {
1184
+ flex-basis: 100%;
1185
+ min-width: 0;
1186
+ }
1187
+ #observer-decor-host:empty {
1188
+ display: none;
1189
+ }
1190
+ /* Already in the frame of the observer picked: not a second one. */
1191
+ #observer-decor-host > .element-list-body {
1192
+ border: 0;
1193
+ padding: 0;
1194
+ margin: 0;
1195
+ }
1196
+ /* What a list is, above it, where its tab holds more than the list (the moments of the Time tab). */
1197
+ .element-list-title {
1198
+ flex-basis: 100%;
1199
+ font-weight: 600;
1200
+ margin-top: .3em;
1201
+ }
1202
+ /* What the scenery taken from a survey says of itself: quiet, on a line of its own below the decor. */
1203
+ .decor-scenery {
1204
+ flex-basis: 100%;
1205
+ }
1206
+ .decor-scenery {
1207
+ display: flex;
1208
+ align-items: center;
1209
+ flex-wrap: wrap;
1210
+ gap: 0.5em;
1211
+ }
1212
+ /* As wide as the zone it names: America/Denver is not America/Denv. */
1213
+ #timeZone { flex: 0 1 auto; field-sizing: content; min-width: 0; max-width: 100%; }
1214
+ #utcOffsetHours { flex: 1 1 4em; min-width: 4em; }
1215
+ /* A warning, as every message is drawn (see MessageStyle at the end). */
1216
+ .scenery-warning {
1217
+ flex-basis: 100%;
1218
+ }
1219
+ .scenery-warning[hidden] {
1220
+ display: none;
1221
+ }
1222
+
1223
+ #shape-shapes .toolbar > [hidden] { display: none !important; }
1224
+ .toolbar {
1225
+ display: flex;
1226
+ align-items: center;
1227
+ gap: 0.5em;
1228
+ margin-bottom: 0.5em;
1229
+ flex-wrap: wrap;
1230
+ }
1231
+ /* A field as wide as what it holds, from its own min/max/step — see NumberFields, which sets each
1232
+ one's width. What stands here is only what a field with no bounds of its own falls back to, and
1233
+ the colour swatches, which hold no text at all. */
1234
+ /* The instrument and what is set on it, as one box: the picker names the device, and the filter, focal length,
1235
+ aperture, exposure, focus, roll and sway are that device's. */
1236
+ .instrument-group [hidden] { display: none !important; }
1237
+ .toolbar input[type="number"] {
1238
+ width: 7em;
1239
+ }
1240
+ .toolbar input[type="color"] {
1241
+ width: 3em;
1242
+ padding: 0;
1243
+ }
1244
+ .presets {
1245
+ display: flex;
1246
+ gap: 0.25em;
1247
+ }
1248
+ button.preset {
1249
+ cursor: pointer;
1250
+ }
1251
+ button.preset[aria-pressed="true"] {
1252
+ outline: 2px solid #39f;
1253
+ font-weight: bold;
1254
+ }
1255
+ /* Every number field short enough that the browser's own ~14em default was mostly empty space —
1256
+ a sampling rate of 100 in a field wide enough for a paragraph. Six em holds a longitude to six
1257
+ decimals, which is the widest thing in the list. Deliberately NOT here: #durationSeconds and
1258
+ #utcOffsetHours, whose placeholders are sentences ("observation length", "from longitude") that
1259
+ 6em would cut off, and #objectSize/#objectDistance for the same reason. */
1260
+ #lat, #lng, #heading, #pitch, #roll, #elevation, #focalLength, #fNumber, #focusDistance, #samplingRate, #cloudBase, #windDirection, #windSpeed, #decorEast, #decorNorth, #decorHeading, #decorAltitude, #decorWidth, #decorLength, #decorHeight, #decorFloors, #decorOccupiedFloor, #decorWindowFront, #decorWindowBehind, #decorWindowLeft, #decorWindowRight, #decorWindowFrontLeft, #decorWindowFrontRight, #decorWindowBehindLeft, #decorWindowBehindRight {
1261
+ width: 6em;
1262
+ }
1263
+ .time-qualifier {
1264
+ font-size: 0.9em;
1265
+ }
1266
+ /* Stated, not left to the UA sheet: this component has been bitten three times by a class that
1267
+ sets its own display outranking the [hidden] attribute, and these two swap on every mode
1268
+ change. */
1269
+ .time-qualifier[hidden], input[hidden] {
1270
+ display: none;
1271
+ }
1272
+ #obs-time, #obs-end-time {
1273
+ width: 12em;
1274
+ }
1275
+ /* What happens at a moment: the rest of its row, from 22em, a sentence being longer than any fixed width. */
1276
+ #milestone-item label:has(> #milestoneNote) {
1277
+ flex: 1 1 auto;
1278
+ display: flex;
1279
+ align-items: center;
1280
+ gap: 0.3em;
1281
+ }
1282
+ #milestoneNote {
1283
+ flex: 1 1 22em;
1284
+ min-width: 22em;
1285
+ }
1286
+ /* As wide as the name they hold, from 10em: "Cirrus SR20 F-HOBS on final (night circuits)" is not "Cirrus SR20 F-HOBS or". */
1287
+ #observerId, #observerTitle, #observerLastName, #observerFirstNames, #sightingId, #tags, #shapeTitle, #decorTitle {
1288
+ field-sizing: content;
1289
+ min-width: 10em;
1290
+ max-width: 100%;
1291
+ }
1292
+ /* The whole disclosure sits on its own line: five stacked rows inside a row of inline labels
1293
+ would otherwise be laid out beside the field before it. */
1294
+ /* Shared by Duration (no sane default — real playback pacing needs some notion of the
1295
+ observation's length, so an empty value is flagged rather than just left blank) and the two
1296
+ EDTF date fields (rejected text that doesn't parse as EDTF — see SightingEditorElement.
1297
+ applyEdtfTimeInput). Cleared automatically once the field holds a valid/derivable value.
1298
+ Light-mode colors by default (this widget has no fixed background of its own — every other
1299
+ input just inherits the host page's own light/dark styling — so a hardcoded dark fill here
1300
+ read as a stray dark box on a light host page); the dark-mode pair below is what was actually
1301
+ tuned for legibility earlier (white text on dark red), unchanged, just now gated correctly
1302
+ instead of always-on. Mirrors rr0.org's own site-wide theming convention — a light-mode
1303
+ default overridden inside a prefers-color-scheme:dark media query, not a manual toggle (see
1304
+ e.g. rr0.org's own link.css/rr0.css). */
1305
+ :host {
1306
+ /* The colours of the File group's editor: a key, a string, and a number or a word. Said here and
1307
+ not in the editor, so that dark mode redefines three values rather than a theme. */
1308
+ --file-key: #1a5fb4;
1309
+ --file-string: #26662f;
1310
+ --file-literal: #a5321f;
1311
+ /* The one alert colour, said once. input.invalid's border was the only thing wearing it, and the
1312
+ two "something is missing" marks below now wear it too — so a reader learns one colour rather
1313
+ than three, and changing it changes all of them. */
1314
+ --rr0-alert: #c33;
1315
+ }
1316
+ input.invalid {
1317
+ border-color: var(--rr0-alert);
1318
+ background: #fde8e8;
1319
+ color: #611;
1320
+ }
1321
+ @media (prefers-color-scheme: dark) {
1322
+ :host {
1323
+ --file-key: #8cb8ff;
1324
+ --file-string: #8fd39a;
1325
+ --file-literal: #ffa08a;
1326
+ }
1327
+ input.invalid {
1328
+ background: #3a1414;
1329
+ color: #fff;
1330
+ }
1331
+ }
1332
+ /* Reads back what the Real size / Distance pair actually produces on screen — an apparent size in
1333
+ degrees, and in full Moons, the only unit of apparent size most accounts come with. Purely
1334
+ informative (an output, never an input), so it stays visually quieter than the fields it
1335
+ comments on. */
1336
+ /* Never a backtick in here: this whole stylesheet is a template literal, and one would end it.
1337
+ nowrap was a fair rule while these outputs were short — "i.e. 2.2 deg, 4.2x the Moon" wants to
1338
+ stay on one line. Two of them are not short: the real-width estimate is a whole sentence and the
1339
+ blur bound another, and on a phone they ran straight out of the element's own box. They wrap;
1340
+ the short ones still have nothing to wrap. min-width:0 is what lets them, since a flex item
1341
+ otherwise refuses to shrink below its own content. */
1342
+ .apparent-size {
1343
+ min-width: 0;
1344
+ max-width: 100%;
1345
+ overflow-wrap: break-word;
1346
+ /* A line of its own, always. These change on every pointer move of a resize ("i.e. 8 deg" becomes
1347
+ "i.e. 9 deg", the real-width sentence grows a word), and as ordinary flex items their new length
1348
+ re-wrapped the whole toolbar around them: every control below jumped, twice a frame, for as
1349
+ long as the drag lasted. Given the full line outright, a readout can only ever change its own
1350
+ text. Tabular figures keep even that from moving. */
1351
+ flex-basis: 100%;
1352
+ min-height: 1.3em;
1353
+ font-variant-numeric: tabular-nums;
1354
+ }
1355
+ #apparent-size {
1356
+ white-space: nowrap;
1357
+ }
1358
+ /* A readout inside a label, after its field, is not a flex item and takes no line of its own. */
1359
+ .apparent-size.inline {
1360
+ display: inline;
1361
+ flex-basis: auto;
1362
+ min-height: 0;
1363
+ margin-left: 0.4em;
1364
+ }
1365
+
1366
+ /* Record and the sampling rate it records at are one control, not two: grouping them makes them a
1367
+ single flex item of the wrapping toolbar, so they stay on the same line together wherever that
1368
+ line happens to break, instead of the button drifting up next to whatever field precedes it.
1369
+ flex-basis: 100% then gives them that line outright, always — the pair is wider than whatever
1370
+ the appearance fields leave at the end of theirs, so it was going to wrap anyway; taking the
1371
+ whole line makes that a deliberate row rather than a break that moves with the window width. */
1372
+ .scene-controls {
1373
+ display: flex;
1374
+ justify-content: flex-end;
1375
+ align-items: center;
1376
+ gap: 0.3em;
1377
+ margin: 0.3em 0;
1378
+ }
1379
+ .scene-controls [hidden] {
1380
+ display: none;
1381
+ }
1382
+ .scene-controls button {
1383
+ width: 1.8em;
1384
+ height: 1.8em;
1385
+ padding: 0;
1386
+ font-size: 1em;
1387
+ line-height: 1;
1388
+ }
1389
+ .scene-controls button[aria-pressed="true"] {
1390
+ outline: 2px solid #39f;
1391
+ }
1392
+ .scene-controls input[type="range"] {
1393
+ width: 5.5em;
1394
+ margin: 0;
1395
+ }
1396
+ .record-row {
1397
+ display: flex;
1398
+ align-items: center;
1399
+ gap: 0.5em;
1400
+ flex-basis: 100%;
1401
+ }
1402
+ /* Same "one control, its own line" treatment as .record-row above, and for a stronger reason: this
1403
+ row states whether everything below it in the group is the observer's word or a looked-up record,
1404
+ so it has to read as a heading for them rather than as one more field wrapped in among them. */
1405
+ .weather-source-row {
1406
+ display: flex;
1407
+ align-items: center;
1408
+ gap: 0.5em;
1409
+ flex-basis: 100%;
1410
+ flex-wrap: wrap;
1411
+ }
1412
+ /* A picker sitting inside a sentence ("2 places found according to [Nominatim]") rather than in a
1413
+ settings drawer: who answered is part of the answer, and a credit nobody can act on is just fine
1414
+ print. Sized down to the surrounding status text so it reads as part of it. */
1415
+ .inline-source {
1416
+ display: inline-flex;
1417
+ align-items: baseline;
1418
+ gap: 0.35em;
1419
+ }
1420
+ .inline-source select {
1421
+ font: inherit;
1422
+ max-width: 14em;
1423
+ }
1424
+ /* The [hidden] attribute's own display:none (from the UA stylesheet) loses to the plain
1425
+ .inline-source rule above — a class selector outweighs an attribute selector at equal
1426
+ specificity-position — so an inline picker stayed on screen no matter what toggled it: third
1427
+ occurrence of this exact trap, after .icon-btn[hidden] and .context-menu[hidden] (see their own
1428
+ comments). Caught by looking at the rendered toolbar, not by the code: a weather picker still
1429
+ crediting ERA5 while nothing had been asked of it. Any new class that sets its own display and
1430
+ is toggled via [hidden] needs this line too. */
1431
+ .inline-source[hidden] {
1432
+ display: none;
1433
+ }
1434
+ /* Relief and imagery have no sentence to sit in, so they get their own row under the coordinates
1435
+ they describe the ground of. */
1436
+ .terrain-source-rows {
1437
+ display: flex;
1438
+ align-items: center;
1439
+ gap: 1em;
1440
+ flex-basis: 100%;
1441
+ flex-wrap: wrap;
1442
+ font-size: 0.85em;
1443
+ opacity: 0.8;
1444
+ }
1445
+ .terrain-source-rows label {
1446
+ display: inline-flex;
1447
+ align-items: center;
1448
+ gap: 0.35em;
1449
+ }
1450
+ .source-credit {
1451
+ color: inherit;
1452
+ text-decoration: underline dotted;
1453
+ }
1454
+ .aircraft-own {
1455
+ flex-basis: 100%;
1456
+ margin: 0;
1457
+ }
1458
+ #aircraft-flights, .aircraft-source {
1459
+ flex-basis: 100%;
1460
+ min-width: 0;
1461
+ }
1462
+ .aircraft-flights-scroll {
1463
+ max-height: 16em;
1464
+ overflow-y: auto;
1465
+ }
1466
+ .aircraft-flights-table {
1467
+ width: 100%;
1468
+ border-collapse: collapse;
1469
+ font-variant-numeric: tabular-nums;
1470
+ }
1471
+ .aircraft-flights-table th {
1472
+ position: sticky;
1473
+ top: 0;
1474
+ text-align: left;
1475
+ font-weight: 500;
1476
+ background: var(--ground-raised);
1477
+ }
1478
+ .aircraft-flights-table th, .aircraft-flights-table td {
1479
+ padding: 0.2em 0.6em 0.2em 0;
1480
+ white-space: nowrap;
1481
+ }
1482
+ .aircraft-flights-table td:first-child {
1483
+ white-space: normal;
1484
+ }
1485
+ .aircraft-flights-table tbody tr {
1486
+ cursor: pointer;
1487
+ border-top: 1px solid var(--line);
1488
+ }
1489
+ .aircraft-flights-table tbody tr:hover {
1490
+ background: var(--ground-sunken);
1491
+ }
1492
+ .aircraft-flights-table tbody tr[aria-disabled="true"] {
1493
+ cursor: default;
1494
+ }
1495
+ /* An aircraft the recording declares in its decor, among the candidates of a record. */
1496
+ .aircraft-flights-table .flight-basis {
1497
+ font-size: 0.85em;
1498
+ padding: 0 0.4em;
1499
+ border: 1px solid var(--line);
1500
+ border-radius: 0.6em;
1501
+ color: var(--ink-dim);
1502
+ }
1503
+ .aircraft-flights-table tbody tr.absent {
1504
+ opacity: 0.55;
1505
+ }
1506
+ .aircraft-flights-table tbody tr[aria-selected="true"] {
1507
+ box-shadow: inset 2px 0 0 var(--ink);
1508
+ }
1509
+ /* The key of a source that needs one, and what that source says back: each on its own line under the picker. */
1510
+ .source-key {
1511
+ display: flex;
1512
+ align-items: center;
1513
+ gap: 0.35em;
1514
+ margin-top: 0.4em;
1515
+ }
1516
+ .source-status {
1517
+ display: block;
1518
+ margin-top: 0.4em;
1519
+ }
1520
+ .source-key[hidden],
1521
+ .source-status:empty {
1522
+ display: none;
1523
+ }
1524
+ /* Where a source read from the recording's file is: a link to its item of the Files group, as the credit of a source asked live is. */
1525
+ /* The survey's radius means nothing while no survey is asked: the labels of the toolbar are flex, which [hidden] alone does not undo. */
1526
+ #scenery-radius-row[hidden] {
1527
+ display: none;
1528
+ }
1529
+ .source-file-link {
1530
+ font: inherit;
1531
+ color: inherit;
1532
+ background: none;
1533
+ border: 0;
1534
+ padding: 0;
1535
+ cursor: pointer;
1536
+ text-decoration: underline dotted;
1537
+ }
1538
+ /* Same "one control, its own line" treatment as .record-row/.weather-source-row — the name and
1539
+ what searching it resolved to belong together, above the coordinates they produce. */
1540
+ .place-search-row {
1541
+ display: flex;
1542
+ align-items: center;
1543
+ gap: 0.5em;
1544
+ flex-basis: 100%;
1545
+ flex-wrap: wrap;
1546
+ }
1547
+ /* Wide enough for a real place name with its region and country, which is what gets stored (see
1548
+ PlaceMatch.name) — a name short enough to fit a default input is exactly the ambiguous kind. */
1549
+ .place-name {
1550
+ width: 24em;
1551
+ }
1552
+ /* How many places matched, and the credit the data requires — quieter than the field it explains,
1553
+ same role and styling as .weather-source/.apparent-size. */
1554
+ /* What was around the observer (see AroundPanel): its counts on one wrapped line, each road on its own. */
1555
+ .around-counted, .around-road { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25em 1em; }
1556
+ .around-heading { font-size: inherit; font-weight: 600; margin: 0.6em 0 0.2em; flex-basis: 100%; }
1557
+ .around-add-road { margin-top: 0.3em; }
1558
+ .place-status,
1559
+ .ground-elevation {
1560
+ min-width: 0;
1561
+ max-width: 100%;
1562
+ overflow-wrap: break-word;
1563
+ }
1564
+ .ground-elevation:empty { display: none; }
1565
+ /* Says which record the locked fields came from, and when for — quieter than the fields it
1566
+ explains, same role and styling as .apparent-size. The link goes to the exact request that
1567
+ produced them, so the claim stays checkable rather than just asserted. */
1568
+ /* Each said whole, as the information it is (see MessageStyle), on as many lines as it takes. */
1569
+ .weather-source {
1570
+ display: block;
1571
+ min-width: 0;
1572
+ flex: 1 1 100%;
1573
+ }
1574
+ /* Every link this widget draws — the geocoder's attribution, the weather record's, the account
1575
+ reader's. Takes the host page's own text color rather than its link color: this widget has no
1576
+ background of its own (see input.invalid's comment on the same constraint), and a host's link
1577
+ blue against a host's dark page was unreadable — the surrounding label color is legible wherever
1578
+ this is embedded, by construction. The underline is what still reads as a link. */
1579
+ .place-status a,
1580
+ .weather-source a,
1581
+ /* Locked because they were looked up, not because they're unavailable — so they stay exactly as
1582
+ legible as the fields around them, and only the affordance goes away. The UA's own disabled
1583
+ styling (grey text over a translucent grey fill, which on a dark host page turns into grey on
1584
+ near-black) is meant to say "unavailable"; forcing the system Field/FieldText pair back says
1585
+ "read-only" instead. -webkit-text-fill-color is needed alongside the color property: on Blink/WebKit it is
1586
+ what actually paints a disabled control's text. Scoped by .weather-field rather than by the
1587
+ group, since Circumstances also holds Light intensity, a view preference that is never locked. */
1588
+ .weather-field:disabled {
1589
+ opacity: 1;
1590
+ cursor: not-allowed;
1591
+ }
1592
+ input.weather-field[type="number"]:disabled,
1593
+ select.weather-field:disabled {
1594
+ background-color: Field;
1595
+ color: FieldText;
1596
+ -webkit-text-fill-color: FieldText;
1597
+ }
1598
+ /* Wraps rather than scrolls sideways. A horizontally scrolling strip would keep the row to one
1599
+ line on a phone, but at the cost of putting half the groups off-screen with nothing to say they
1600
+ are there — the whole complaint being answered here is exactly that kind of invisibility. Two
1601
+ wrapped lines of 8 handles at 375px is still a twentieth of what the stacked groups cost. */
1602
+ /* Real tabs: a strip sharing one baseline, the open tab raised and joined to the panel below it (same
1603
+ surface, no line between them), the others recessed and lighter. Mixed from CanvasText and Canvas,
1604
+ which this widget's own color-scheme (light dark) makes follow the host page's scheme: a tab that
1605
+ merges with its panel needs a SOLID surface, and a fixed colour read wrong on one of the two schemes. */
1606
+ .group-tabs {
1607
+ --tab-line: color-mix(in srgb, CanvasText 35%, transparent);
1608
+ --tab-surface: color-mix(in srgb, CanvasText 5%, Canvas);
1609
+ --tab-recessed: color-mix(in srgb, CanvasText 11%, Canvas);
1610
+ --tab-accent: #4a9eff;
1611
+ display: flex;
1612
+ flex-wrap: wrap;
1613
+ align-items: flex-end;
1614
+ /* No space between tabs, either way: they touch, sharing their borders (see .group-tab's margins). */
1615
+ gap: 0;
1616
+ margin: 0;
1617
+ padding: 0;
1618
+ border-bottom: 1px solid var(--tab-line);
1619
+ }
1620
+ /* Undo and redo have a place of their own at the right end of the strip, reserved for them: the tabs wrap
1621
+ before it, never into it. As one more item of the wrapping row they dropped onto a line of their own when
1622
+ the tabs filled the width, and left a gap between the tabs and the panel. */
1623
+ #group-tabs {
1624
+ position: relative;
1625
+ /* One button wide: the two are stacked, so the reserve is a column and not a row. */
1626
+ padding-inline-end: 2.4em;
1627
+ /* ...and as tall as the stack (two squares and the margin between them), so that a strip of a single
1628
+ row does not let it climb out of the strip. The tabs stay on the baseline. */
1629
+ min-height: 3.7em;
1630
+ }
1631
+ .history {
1632
+ position: absolute;
1633
+ inset-inline-end: 0.2em;
1634
+ top: 0.2em;
1635
+ display: inline-flex;
1636
+ flex-direction: column;
1637
+ gap: 0.3em;
1638
+ }
1639
+ /* A little wider than tall (the squares read as taller than wide on the author's screen), whatever a host page says of
1640
+ its buttons (a minimum height, a padding): one size on every side. */
1641
+ .history .icon-btn {
1642
+ box-sizing: border-box;
1643
+ flex: none;
1644
+ width: 1.8em;
1645
+ height: 1.55em;
1646
+ min-width: 1.8em;
1647
+ min-height: 1.55em;
1648
+ max-width: 1.8em;
1649
+ max-height: 1.55em;
1650
+ padding: 0;
1651
+ }
1652
+ .history .icon-btn:disabled {
1653
+ opacity: 0.35;
1654
+ cursor: default;
1655
+ }
1656
+ .group-tab, .subgroup-tab {
1657
+ -webkit-user-select: none;
1658
+ user-select: none;
1659
+ font: inherit;
1660
+ font-weight: 600;
1661
+ cursor: pointer;
1662
+ color: color-mix(in srgb, CanvasText 70%, transparent);
1663
+ background: var(--tab-recessed);
1664
+ border: 1px solid var(--tab-line);
1665
+ border-radius: 8px 8px 0 0;
1666
+ padding: 0.4em 0.6em;
1667
+ /* Overlapping its neighbours by one border, and the strip's baseline by one, so that nothing separates
1668
+ two tabs, on a line or from one line to the next. */
1669
+ margin: 0 0 -1px -1px;
1670
+ position: relative;
1671
+ }
1672
+ .group-tab:hover, .subgroup-tab:hover {
1673
+ color: CanvasText;
1674
+ background: color-mix(in srgb, CanvasText 16%, Canvas);
1675
+ }
1676
+ /* The open tab is raised, joined to its panel (the panel has no top border, and this overlaps the baseline
1677
+ with the panel's own surface) and marked by an accent along its top. */
1678
+ .group-tab[aria-expanded="true"], .subgroup-tab[aria-expanded="true"] {
1679
+ color: CanvasText;
1680
+ background: var(--tab-surface);
1681
+ border-bottom-color: var(--tab-surface);
1682
+ box-shadow: inset 0 2px 0 var(--tab-accent);
1683
+ z-index: 1;
1684
+ }
1685
+ .group-tab:focus-visible, .subgroup-tab:focus-visible {
1686
+ outline: 2px solid #4af;
1687
+ outline-offset: -2px;
1688
+ }
1689
+ .group-panel, .subgroup-panel {
1690
+ border: 1px solid var(--tab-line, color-mix(in srgb, CanvasText 35%, transparent));
1691
+ border-top: 0;
1692
+ border-radius: 0 0 4px 4px;
1693
+ background: color-mix(in srgb, CanvasText 5%, Canvas);
1694
+ /* The text goes with the surface it stands on: both from this widget's own color scheme. Left to inherit the
1695
+ host page's colour, labels came out pale on a light panel (and dark on a dark one) whenever the host's text
1696
+ and the system's scheme disagreed. */
1697
+ color: CanvasText;
1698
+ padding: 0.5em 0.75em;
1699
+ margin: 0 0 0.5em;
1700
+ }
1701
+ /* Stated rather than left to the UA sheet's own hidden rule. That rule works only for as long as
1702
+ .group-panel itself never sets a display — the day it becomes a grid or a flex container, that
1703
+ declaration outranks the UA one and every panel is permanently open, with the attribute set and
1704
+ nothing happening. This component has already been bitten by exactly that once (.icon-btn), so
1705
+ the guard is written down. */
1706
+ /* The gear of a group whose data comes from somewhere (see the group-settings buttons): at its top right, the group's fields kept clear of it. */
1707
+ .group-panel { position: relative; }
1708
+ .group-panel > .group-settings {
1709
+ position: absolute; top: 4px; right: 4px; z-index: 1;
1710
+ display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
1711
+ border: 1px solid transparent; border-radius: 4px; background: none; color: inherit; opacity: .7; cursor: pointer;
1712
+ }
1713
+ .group-panel > .group-settings:hover, .group-panel > .group-settings:focus-visible { opacity: 1; border-color: color-mix(in srgb, CanvasText 35%, transparent); }
1714
+ .group-panel:has(> .group-settings) > .toolbar { padding-right: 32px; }
1715
+ .group-settings-panel {
1716
+ padding: .6em .8em; border: 1px solid color-mix(in srgb, CanvasText 30%, transparent); border-radius: 4px;
1717
+ background: Canvas; color: CanvasText; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); max-width: min(32em, 92vw);
1718
+ }
1719
+ .group-settings-panel:popover-open { display: flex; flex-direction: column; gap: .5em; }
1720
+ @supports (position-area: bottom span-left) {
1721
+ .group-settings-panel:popover-open { inset: auto; position-area: bottom span-left; margin: .2em 0 0 0; }
1722
+ }
1723
+ .group-settings-title { font-weight: 600; font-size: .9em; }
1724
+ .group-settings-panel .terrain-source-rows { flex-direction: column; align-items: flex-start; }
1725
+ .group-panel[hidden], .subgroup-panel[hidden] {
1726
+ display: none;
1727
+ }
1728
+ .group-panel > .toolbar, .subgroup-panel > .toolbar {
1729
+ margin-bottom: 0;
1730
+ }
1731
+ /* The rule above flattens every panel toolbar's own spacing, which is right when there is one of
1732
+ them and wrong the moment a panel has two: the Observation panel's account row would sit welded
1733
+ to the fields above it. */
1734
+ .group-panel > .toolbar + .toolbar {
1735
+ margin-top: 0.5em;
1736
+ }
1737
+ /* A paragraph, not a field: it takes the whole line and its label sits above it rather than
1738
+ beside it, which is the only way a four-row textarea reads as one thing with its own name. */
1739
+ .toolbar > label.wide {
1740
+ flex: 1 1 100%;
1741
+ display: flex;
1742
+ flex-direction: column;
1743
+ align-items: stretch;
1744
+ gap: 0.25em;
1745
+ }
1746
+ .toolbar > label.checkbox {
1747
+ gap: 0.35em;
1748
+ }
1749
+ /* A strip of handles inside a panel, the weather's parts: as far from the toolbar above it as the toolbar's rows are from each other. */
1750
+ .group-panel > .group-tabs {
1751
+ margin-top: 14px;
1752
+ }
1753
+ #description {
1754
+ resize: vertical;
1755
+ }
1756
+ /* A provider's own settings sit in the row like any other field; a key is long, a workspace id
1757
+ shorter, a model a list. */
1758
+ .narrative-settings {
1759
+ display: contents;
1760
+ }
1761
+ /* Each beside its name, as every field of the row: a field that is too long for what is left moves to the next line whole. */
1762
+ .narrative-settings > label {
1763
+ display: inline-flex;
1764
+ align-items: center;
1765
+ gap: 0.3em;
1766
+ max-width: 100%;
1767
+ white-space: nowrap;
1768
+ }
1769
+ #narrative-key {
1770
+ width: 16em;
1771
+ }
1772
+ /* As wide as what it says: its value as it is typed, and its placeholder while empty (a minimum set where it is built). */
1773
+ #narrative-workspace {
1774
+ field-sizing: content;
1775
+ max-width: 100%;
1776
+ }
1777
+ /* A failure has to be visible without opening a console. The status line carries three quite
1778
+ different things — working, written, refused — and only the last is a problem, so only the last
1779
+ is coloured. Same palette as an invalid field, and the same reason it is stated rather than left
1780
+ to a system colour: this widget has no background of its own. */
1781
+ /* (Drawn as an error by MessageStyle, at the end of this sheet.) */
1782
+ /* What the draft claims, and what the account never said. A table would be the obvious shape and
1783
+ the wrong one: the quotes are sentences of wildly differing length, and a column sized for the
1784
+ longest of them wastes the width every other row needed. */
1785
+ .narrative-report {
1786
+ display: flex;
1787
+ flex-direction: column;
1788
+ gap: 0.35em;
1789
+ margin-top: 0.5em;
1790
+ max-height: 14em;
1791
+ overflow-y: auto;
1792
+ font-size: 0.9em;
1793
+ }
1794
+ /* Stated, and not left to the UA sheet: this element sets its own display, which outranks the
1795
+ built-in hidden rule and would leave an empty box standing open before the first draft. */
1796
+ .narrative-report[hidden] {
1797
+ display: none;
1798
+ }
1799
+ .narrative-report .claim {
1800
+ display: flex;
1801
+ flex-wrap: wrap;
1802
+ gap: 0.35em;
1803
+ align-items: baseline;
1804
+ }
1805
+ /* Dimmed from whatever the host page's own text colour is, never a fixed one: this widget has no
1806
+ background of its own and sits on light and dark pages alike (see the note above the palette). */
1807
+ .narrative-report .claim code {
1808
+ color: color-mix(in srgb, currentColor 72%, transparent);
1809
+ font-size: 0.95em;
1810
+ }
1811
+ .narrative-report .claim q,
1812
+ .narrative-report .claim span {
1813
+ color: color-mix(in srgb, currentColor 85%, transparent);
1814
+ }
1815
+ /* A guess reads as a guess without having to find its heading again: this group is what an author
1816
+ has to go and check, and it is the one thing in the report that is not evidence. */
1817
+ .narrative-report .claim.assumed code {
1818
+ color: color-mix(in srgb, currentColor 90%, transparent);
1819
+ font-weight: 600;
1820
+ }
1821
+ .narrative-report .claim.assumed span {
1822
+ font-style: italic;
1823
+ }
1824
+ /* A field, or a tab, that would answer a question nothing in the recording does.
1825
+ Deliberately not input.invalid's red: a gap is not a mistake. Nobody typed anything wrong here —
1826
+ the observer said nothing, and the mark is an invitation rather than a complaint. A dashed
1827
+ underline in the host's own text colour says "something is missing here" without claiming
1828
+ anything is broken. */
1829
+ /* Something is missing here. Two marks, one vocabulary: the SOLID one is a value the reconstruction
1830
+ cannot be computed without, the dashed one a question the account simply never answered. Both in
1831
+ the alert colour, because both are the same kind of statement about the record; neither touches
1832
+ the text's own colour or the field's background, because neither is a mistake — nobody typed
1833
+ anything wrong, and input.invalid's red box is reserved for when they did.
1834
+
1835
+ Only the DURATION is solid. Nothing else in this format has to be there: a recording with no date
1836
+ still says what was seen, and a reader who fills it in later gains coverage rather than repairs a
1837
+ fault. But playback has no pacing without a length, so an empty duration is the one blank that
1838
+ stops the reconstruction being one.
1839
+
1840
+ An OUTLINE and not a text-decoration, which is what the first attempt used and why nothing showed:
1841
+ an underline underlines TEXT, and a field that is missing a value is by definition empty, so there
1842
+ was nothing for it to draw under. An outline sits outside the border box and shifts no layout. */
1843
+ .wanted {
1844
+ outline: 1px dashed var(--rr0-alert);
1845
+ outline-offset: 1px;
1846
+ }
1847
+ .missing-required {
1848
+ outline: 2px solid var(--rr0-alert);
1849
+ outline-offset: 1px;
1850
+ }
1851
+ /* How many of a panel's questions it still has no answer for, on its own tab — the only thing a
1852
+ reader sees while that panel is closed. A number rather than a mark, because "three" and "one"
1853
+ send somebody to different panels first and a mark says neither.
1854
+
1855
+ Full strength when one of them is the required blank, faded when they are only what stands
1856
+ between this recording and complete coverage. Opacity rather than a second colour: the two are
1857
+ the same kind of statement at two strengths, and a reader should not have to learn a palette. */
1858
+ .tab-badge {
1859
+ display: inline-block;
1860
+ margin-left: 0.45em;
1861
+ padding: 0 0.4em;
1862
+ border-radius: 999px;
1863
+ background: var(--rr0-alert);
1864
+ color: #fff;
1865
+ font-size: 0.8em;
1866
+ font-weight: 700;
1867
+ font-variant-numeric: tabular-nums;
1868
+ vertical-align: 0.05em;
1869
+ }
1870
+ .tab-badge.optional {
1871
+ opacity: 0.45;
1872
+ }
1873
+ .tab-badge[hidden] {
1874
+ display: none;
1875
+ }
1876
+ /* An assessment about the recording as a whole has nowhere to send a click, so it does not offer
1877
+ the pointer every other chip does. One that names a group it is about keeps it, and leads there
1878
+ (see Assessor.about, and onParamSummaryClick, which ignores a panel of -1). */
1879
+ .param-nest[data-group="assessment"] .param-chip[data-panel="-1"] {
1880
+ cursor: default;
1881
+ }
1882
+ .narrative-report .gaps {
1883
+ margin: 0.35em 0 0;
1884
+ padding-left: 1.2em;
1885
+ }
1886
+ .narrative-report h4 {
1887
+ margin: 0.25em 0 0;
1888
+ font-size: 1em;
1889
+ font-weight: 600;
1890
+ }
1891
+ /* flex-basis:100% on a flex-wrap:wrap container's own child forces it onto a fresh line — nothing
1892
+ else fits beside a 100%-wide item — which is what puts the Add controls below whatever decor
1893
+ properties are currently showing (see SightingEditorElement.syncDecorVisibility), rather than just
1894
+ trailing after them on whatever horizontal space happens to be left. */
1895
+ /* The properties a kind publishes (see DecorParameterSets, ParameterForm): groups side by side, their fields
1896
+ wrapping inside, with room between a unit and the next field. */
1897
+ .decor-parameters {
1898
+ flex-basis: 100%;
1899
+ min-width: 0;
1900
+ display: flex;
1901
+ flex-wrap: wrap;
1902
+ gap: 8px;
1903
+ align-items: flex-start;
1904
+ }
1905
+ .decor-parameters[hidden], .decor-parameters .parameter-group[hidden] { display: none; }
1906
+ .decor-parameters .parameter-group {
1907
+ display: flex;
1908
+ flex-wrap: wrap;
1909
+ gap: 6px 14px;
1910
+ align-items: center;
1911
+ min-width: 0;
1912
+ box-sizing: border-box;
1913
+ margin: 0;
1914
+ }
1915
+ .decor-parameters input.parameter-derived::placeholder { opacity: 0.65; }
1916
+ .decor-add-row {
1917
+ display: flex;
1918
+ flex-basis: 100%;
1919
+ align-items: center;
1920
+ justify-content: flex-end;
1921
+ gap: 0.5em;
1922
+ }
1923
+ .account-view { display: inline-flex; align-items: center; gap: .4em; flex: 1 1 auto; }
1924
+ .account-view[hidden] { display: none; }
1925
+ .render-line { display: flex; flex-wrap: wrap; align-items: center; gap: .25em .75em; }
1926
+ .render-line > .scene-controls { margin: 0 0 0 auto; flex: 0 0 auto; }
1927
+ /* A reading is titled with a sentence: the picker is as wide as the row lets it be and cuts the rest. */
1928
+ #import-url {
1929
+ flex: 1 1 16em;
1930
+ }
1931
+ .file-note {
1932
+ margin: 0.5em 0;
1933
+ }
1934
+ .snapshot-data {
1935
+ margin-bottom: 0.5em;
1936
+ /* Its content starts at the top of the frame, as every list's does: a paragraph's own margins made the first line taller, and the
1937
+ toolbar on it was centred lower in the annexes than in the recording. */
1938
+ align-items: flex-start;
1939
+ }
1940
+ .snapshot-data > p {
1941
+ margin: 0;
1942
+ }
1943
+ .annex-storage {
1944
+ display: flex;
1945
+ flex-wrap: wrap;
1946
+ align-items: center;
1947
+ gap: 0.3em 1em;
1948
+ }
1949
+ .snapshot-note {
1950
+ margin: 0.3em 0 0;
1951
+ }
1952
+ #observer-identity-hint {
1953
+ flex-basis: 100%;
1954
+ margin: 0;
1955
+ }
1956
+ .file-ask {
1957
+ max-width: min(34em, calc(100vw - 2em));
1958
+ padding: 1em 1.2em;
1959
+ border: 1px solid color-mix(in srgb, CanvasText 35%, transparent);
1960
+ border-radius: 8px;
1961
+ background: Canvas;
1962
+ color: CanvasText;
1963
+ box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
1964
+ }
1965
+ .file-ask::backdrop {
1966
+ background: rgba(0, 0, 0, 0.45);
1967
+ }
1968
+ .file-ask p {
1969
+ margin: 0 0 1em;
1970
+ line-height: 1.4;
1971
+ }
1972
+ .file-ask ul {
1973
+ margin: 0 0 1em;
1974
+ padding-left: 1.2em;
1975
+ }
1976
+ .file-ask-buttons {
1977
+ display: flex;
1978
+ flex-wrap: wrap;
1979
+ justify-content: flex-end;
1980
+ gap: 0.5em;
1981
+ }
1982
+ .param-summary {
1983
+ display: flex;
1984
+ flex-wrap: wrap;
1985
+ /* Each chip at its own height, centred on the line: stretched to the height of a boxed group
1986
+ beside it (see .param-nest), a chip kept its text at the top of a taller pill. */
1987
+ align-items: center;
1988
+ gap: 0.3em;
1989
+ margin-top: 0.5em;
1990
+ }
1991
+ .param-summary:empty {
1992
+ display: none;
1993
+ }
1994
+ /* A chip holding chips: everything said about ONE sub-element — the observer, a decor object —
1995
+ boxed under its name, so a Heading inside a box saying Environment needs no prefix to say which
1996
+ heading it is. Drawn as a frame rather than as a filled pill: the members already carry an
1997
+ outline each, and a second solid shape around them would read as a button they sit on. */
1998
+ .param-nest {
1999
+ transition: border-color 0.12s, background-color 0.12s;
2000
+ display: inline-flex;
2001
+ flex-wrap: wrap;
2002
+ align-items: center;
2003
+ gap: 0.3em;
2004
+ border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
2005
+ border-radius: 12px;
2006
+ padding: 0.25em 0.5em;
2007
+ max-width: 100%;
2008
+ /* A flex item is never narrower than its content unless it says so: a nest holding a chip that
2009
+ stays on one line (a long place name) was as wide as that line, past the edge of a phone. */
2010
+ min-width: 0;
2011
+ }
2012
+ /* Hovering anywhere in the box, its name or a member's gap included, lights the whole frame and
2013
+ its name, so the group reads as one thing before one of its chips is picked. */
2014
+ .param-nest:hover {
2015
+ border-color: color-mix(in srgb, currentColor 70%, transparent);
2016
+ background: color-mix(in srgb, currentColor 8%, transparent);
2017
+ }
2018
+ .param-nest:hover ${Ss.CSS}
2019
+ .param-nest-label {
2020
+ color: inherit;
2021
+ }
2022
+ .param-nest-label {
2023
+ font-weight: 600;
2024
+ color: color-mix(in srgb, currentColor 62%, transparent);
2025
+ letter-spacing: 0.02em;
2026
+ text-transform: uppercase;
2027
+ font-size: 0.85em;
2028
+ }
2029
+ /* Deliberately quieter than the fields it summarises: this is meant to be scanned, and 37 chips
2030
+ competing with the render above them would be worse than the scrolling it replaces. */
2031
+ /* Every colour here is a mix of the HOST PAGE's own text colour, never a fixed grey. These chips
2032
+ were written when this element was only ever embedded in a dark page; on a light one, #bbb on
2033
+ white was barely there at all — and it was the only part of the element that went pale, since
2034
+ everything else already inherits. Deriving from currentColor follows whatever page the component
2035
+ is dropped into, which is more than a prefers-color-scheme query can do: that reads the system,
2036
+ and a page is free to disagree with it. */
2037
+ .param-chip {
2038
+ font: inherit;
2039
+ font-size: 0.85em;
2040
+ cursor: pointer;
2041
+ /* Stated, and not left out: a <button> gets "color: buttontext" from the UA sheet, which is
2042
+ black whatever the page around it says — the very dark-on-dark this chip was rewritten to
2043
+ stop doing. */
2044
+ color: inherit;
2045
+ background: transparent;
2046
+ border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
2047
+ border-radius: 999px;
2048
+ padding: 0.1em 0.6em;
2049
+ /* A chip stays on one line — half its value is the shape of it — but a long description on a
2050
+ narrow screen would otherwise push the whole strip past the element's own edge, so it gives
2051
+ up its tail rather than the layout. Clicking it opens the field that holds the whole thing. */
2052
+ white-space: nowrap;
2053
+ max-width: 100%;
2054
+ overflow: hidden;
2055
+ text-overflow: ellipsis;
2056
+ }
2057
+ .param-chip:hover {
2058
+ border-color: color-mix(in srgb, currentColor 70%, transparent);
2059
+ }
2060
+ .param-chip:hover .param-chip-label {
2061
+ color: inherit;
2062
+ }
2063
+ /* The chip keeps the host's own ink; only its LABEL steps back. Fading the whole chip, as this
2064
+ rule used to, made the value unrecoverable: a child asking for currentColor gets the faded
2065
+ colour its parent computed, so the number — the only part worth reading from across the room —
2066
+ came out exactly as pale as the word introducing it. */
2067
+ .param-chip-label {
2068
+ color: color-mix(in srgb, currentColor 78%, transparent);
2069
+ }
2070
+ .param-chip:focus-visible {
2071
+ outline: 2px solid #4af;
2072
+ outline-offset: 1px;
2073
+ }
2074
+ .param-chip .param-chip-value {
2075
+ font-weight: 600;
2076
+ }
2077
+ /* A value nobody typed: read from a record (ERA5's weather, Nominatim's coordinates, the terrain
2078
+ provider's ground height) or computed from one. The form shows this by disabling the field,
2079
+ which is invisible the moment the field is — so the distinction that matters most to this
2080
+ project, what the observer said versus what the archives say, gets its own mark here. */
2081
+ .param-chip.from-source .param-chip-value {
2082
+ /* Blended with the host's own text colour so the blue lightens on a dark page and darkens on a
2083
+ light one; the italic is what carries the distinction where the hue cannot. */
2084
+ color: color-mix(in srgb, #3a9fd8 72%, currentColor);
2085
+ font-weight: normal;
2086
+ font-style: italic;
2087
+ }
2088
+ .param-chip .param-chip-swatch {
2089
+ display: inline-block;
2090
+ width: 0.7em;
2091
+ height: 0.7em;
2092
+ border: 1px solid color-mix(in srgb, currentColor 45%, transparent);
2093
+ border-radius: 2px;
2094
+ vertical-align: -1px;
2095
+ }
2096
+ /* Below the rendered scene, not overlaid on it (unlike <rr0-ufo>'s own internal toolbar, hidden
2097
+ here via showToolbar — see SightingEditorElement's constructor) — its seek bar needs the whole
2098
+ width for scrubbing, which would otherwise intercept shape drags near the bottom of the canvas. */
2099
+ .seek-track {
2100
+ position: relative;
2101
+ flex: 1;
2102
+ display: flex;
2103
+ align-items: center;
2104
+ min-width: 0;
2105
+ }
2106
+ #seek {
2107
+ flex: 1;
2108
+ min-width: 0;
2109
+ }
2110
+ /* Over the bar and transparent to the pointer: the bar itself snaps a press to the nearest mark. */
2111
+ .timeline-marks {
2112
+ position: absolute;
2113
+ inset: 0;
2114
+ pointer-events: none;
2115
+ }
2116
+ .timeline-mark {
2117
+ position: absolute;
2118
+ width: 2px;
2119
+ transform: translateX(-50%);
2120
+ background: currentColor;
2121
+ }
2122
+ /* Under the thumb's track, so the thumb still reads as the playhead. */
2123
+ .timeline-mark.keyframe {
2124
+ bottom: 0;
2125
+ height: 30%;
2126
+ opacity: 0.6;
2127
+ }
2128
+ /* Where an event starts: the observer's colour on the tracks, as tall as a keyframe's. */
2129
+ .timeline-mark.event {
2130
+ bottom: 0;
2131
+ height: 45%;
2132
+ background: #7fd4ff;
2133
+ }
2134
+ .timeline-mark.milestone {
2135
+ top: 10%;
2136
+ bottom: 10%;
2137
+ /* The map's colour for a named moment, and not the bar's own blue, which it would vanish into. */
2138
+ background: #ffd27a;
2139
+ }
2140
+ .time-label.switchable {
2141
+ cursor: pointer;
2142
+ }
2143
+ .time-label.switchable:hover,
2144
+ .time-label.switchable:focus-visible {
2145
+ text-decoration: underline;
2146
+ }
2147
+ .time-label {
2148
+ font-variant-numeric: tabular-nums;
2149
+ font-size: 0.85em;
2150
+ min-width: 3em;
2151
+ text-align: center;
2152
+ }
2153
+ .record-btn {
2154
+ display: inline-flex;
2155
+ align-items: center;
2156
+ justify-content: center;
2157
+ gap: 6px;
2158
+ height: 1.8em;
2159
+ padding: 0 10px;
2160
+ border-radius: 3px;
2161
+ cursor: pointer;
2162
+ font-size: 1em;
2163
+ line-height: 1;
2164
+ color: #e33;
2165
+ }
2166
+ .record-btn .record-label { color: var(--ink); font-weight: 600; }
2167
+ .icon-btn {
2168
+ display: inline-flex;
2169
+ align-items: center;
2170
+ justify-content: center;
2171
+ width: 1.8em;
2172
+ height: 1.8em;
2173
+ padding: 0;
2174
+ border-radius: 3px;
2175
+ cursor: pointer;
2176
+ font-size: 1em;
2177
+ line-height: 1;
2178
+ }
2179
+ .icon-btn:disabled {
2180
+ cursor: default;
2181
+ opacity: 0.4;
2182
+ }
2183
+ /* The pointer lands on the button, never on its glyph: over a DISABLED button the browser shows
2184
+ the tooltip only when the button itself is what is hovered, so the star — whose open middle put
2185
+ the svg under the pointer — said nothing while the others, hovered on their strokes, did. */
2186
+ .icon-btn > .icon {
2187
+ pointer-events: none;
2188
+ }
2189
+ /* The [hidden] attribute's own display:none (from the browser's UA stylesheet) loses to the
2190
+ plain .icon-btn rule above — a class selector outweighs an attribute selector at equal
2191
+ specificity-position — same fix, same reason, as .context-menu[hidden] below (see its own
2192
+ comment): needed once delete-decor (an .icon-btn) started being hidden entirely rather than
2193
+ just disabled when there's no decor object to delete (see SightingEditorElement.
2194
+ syncDecorVisibility). Important, since the shared icon rule button:has(> .icon:only-child)
2195
+ outranks it too, and left every sky button on show, clickable and pointing at nothing. */
2196
+ .icon-btn[hidden] {
2197
+ display: none !important;
2198
+ }
2199
+ /* position:fixed (viewport-relative), left/top set from the triggering pointer event's own
2200
+ clientX/clientY in JS — works the same regardless of which shadow tree this menu lives in or
2201
+ how the page has scrolled, unlike an absolutely-positioned element nested under this host. */
2202
+ .context-menu {
2203
+ position: fixed;
2204
+ z-index: 10;
2205
+ display: flex;
2206
+ flex-direction: column;
2207
+ min-width: 9em;
2208
+ padding: 0.3em 0;
2209
+ background: light-dark(#fff, #1e1f22);
2210
+ color: light-dark(#222, #e6e6e6);
2211
+ border: 1px solid light-dark(#ccc, #4a4c52);
2212
+ border-radius: 4px;
2213
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
2214
+ font-size: 0.9em;
2215
+ }
2216
+ /* The [hidden] attribute's own display:none (from the browser's UA stylesheet) loses to the
2217
+ plain .context-menu rule above — a class selector outweighs an attribute selector at equal
2218
+ specificity-position, so display:flex won every time regardless of the hidden attribute,
2219
+ and the menu could never actually disappear no matter what toggled it (Escape, outside
2220
+ click, ...). This higher-specificity override is what actually lets [hidden] win. */
2221
+ .context-menu[hidden] {
2222
+ display: none;
2223
+ }
2224
+ .context-menu button {
2225
+ display: block;
2226
+ width: 100%;
2227
+ padding: 0.4em 0.8em;
2228
+ border: none;
2229
+ background: none;
2230
+ text-align: left;
2231
+ cursor: pointer;
2232
+ color: inherit;
2233
+ font: inherit;
2234
+ }
2235
+ .context-menu button:hover {
2236
+ background: light-dark(#eef, #3a3d46);
2237
+ }
2238
+ .context-menu button:disabled {
2239
+ cursor: default;
2240
+ opacity: 0.4;
2241
+ }
2242
+ .context-menu button:disabled:hover {
2243
+ background: none;
2244
+ }
2245
+ .context-menu hr {
2246
+ width: 100%;
2247
+ margin: 0.3em 0;
2248
+ border: none;
2249
+ border-top: 1px solid light-dark(#eee, #3a3c42);
2250
+ }
2251
+ .context-delete {
2252
+ color: #c33;
2253
+ }
2254
+ /* "Masks ▸" — a CSS-only hover/focus flyout (no JS show/hide state machine needed) listing every
2255
+ shape/source currently in the recording as a checkbox, for DecorObject.occludesSourceIds (see
2256
+ its own doc comment: which shapes, if any, this decor object sits in front of — a per-shape
2257
+ choice since a recording can have more than one). :focus-within (not hover-only, unlike the
2258
+ playback toolbar's own deliberately hover-only auto-hide — see UfoElement's template) is exactly
2259
+ right here: keeping it open while a checkbox inside has keyboard focus is what makes toggling
2260
+ more than one checkbox by keyboard actually usable, and this menu doesn't auto-hide on any other
2261
+ trigger the way the toolbar does. */
2262
+ .submenu-trigger {
2263
+ position: relative;
2264
+ }
2265
+ .submenu-trigger > .submenu-label {
2266
+ display: block;
2267
+ padding: 0.4em 0.8em;
2268
+ cursor: default;
2269
+ }
2270
+ .submenu-trigger:hover > .submenu-label,
2271
+ .submenu-trigger:focus-within > .submenu-label {
2272
+ background: light-dark(#eef, #3a3d46);
2273
+ }
2274
+ .submenu {
2275
+ display: none;
2276
+ position: absolute;
2277
+ left: 100%;
2278
+ top: 0;
2279
+ min-width: 9em;
2280
+ max-height: 16em;
2281
+ overflow-y: auto;
2282
+ padding: 0.3em 0;
2283
+ background: light-dark(#fff, #1e1f22);
2284
+ color: light-dark(#222, #e6e6e6);
2285
+ border: 1px solid light-dark(#ccc, #4a4c52);
2286
+ border-radius: 4px;
2287
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
2288
+ font-size: 0.9em;
2289
+ }
2290
+ .submenu-trigger:hover > .submenu,
2291
+ .submenu-trigger:focus-within > .submenu {
2292
+ display: block;
2293
+ }
2294
+ .submenu label {
2295
+ display: flex;
2296
+ align-items: center;
2297
+ gap: 0.4em;
2298
+ padding: 0.3em 0.8em;
2299
+ cursor: pointer;
2300
+ white-space: nowrap;
2301
+ }
2302
+ .submenu-empty {
2303
+ display: block;
2304
+ padding: 0.3em 0.8em;
2305
+ color: #888;
2306
+ white-space: nowrap;
2307
+ }
2308
+ .submenu label:hover {
2309
+ background: light-dark(#eef, #3a3d46);
2310
+ }
2311
+ ${F.rules(["#scenery-status",".apparent-size",".place-status",".ground-elevation",".weather-source",".file-note",".snapshot-note",".snapshot-group-state","#observer-identity-hint","#narrative-status","#cloud-status","#body-key-note","#body-editor .body-intro",".launch-intro",".cloud-panel > p",".cloud-panel details > p"],[".scenery-warning"],["#narrative-status.error",".reference-failure",".save-refused"])}
2312
+ /* ---- The design handoff's look (design_handoff_editeurs_ufoathome, README §1–3.1) ----
2313
+ The site's own tokens (site/style.css), each a light-dark() pair: they follow the colour scheme this
2314
+ widget is used in exactly as Canvas and CanvasText do. The scene keeps its own colours in both. */
2315
+ :host {
2316
+ ${Je.TOKENS}
2317
+ --rr0-field-radius: 8px;
2318
+ --rr0-input-font-size: 15px;
2319
+ /* What the layout adapts to: the width this editor is given, never the window's. */
2320
+ container-type: inline-size;
2321
+ font: 400 15px/1.5 var(--sans);
2322
+ -webkit-font-smoothing: antialiased;
2323
+ }
2324
+ .app {
2325
+ max-width: 68rem;
2326
+ margin: 0 auto;
2327
+ background: var(--ground-raised);
2328
+ color: var(--ink);
2329
+ border: 1px solid var(--line-strong);
2330
+ border-radius: 12px;
2331
+ overflow: clip;
2332
+ /* No taller than the screen: the scene and the sections' chips stay in view, and the open section scrolls under them. The scene gives up
2333
+ height before the form does. A section shorter than what is left ends the editor where it ends, with no blank under it. */
2334
+ display: flex;
2335
+ flex-direction: column;
2336
+ box-sizing: border-box;
2337
+ max-height: 100dvh;
2338
+ --rr0-scene-max-height: 50dvh;
2339
+ }
2340
+ .app > :is(.editor-head, .save-refused, .scene-card, #group-tabs, #timeline-tracks) { flex: none; }
2341
+ .save-refused { margin: 0; padding: 4px 24px 8px; }
2342
+ .save-refused[hidden] { display: none; }
2343
+ /* A grip under the scene: a line to drag up or down, wider where the pointer finds it. */
2344
+ .app > .scene-resize { flex: none; position: relative; height: 8px; margin: -4px 0; z-index: 5; cursor: ns-resize; touch-action: none; }
2345
+ .app > .scene-resize::after { content: ""; position: absolute; left: 50%; top: 50%; width: 36px; height: 4px; margin: -2px 0 0 -18px; border-radius: 2px;
2346
+ background: var(--line-strong, rgba(127, 127, 127, .5)); opacity: 0; transition: opacity .15s ease; }
2347
+ .app > .scene-resize:is(:hover, :focus-visible, .dragging)::after { opacity: 1; }
2348
+ .app > .scene-resize:focus-visible { outline: none; }
2349
+ .app > .group-panel { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
2350
+ /* A box to tick in a row of fields stands as tall as they do, its label level with their middle (the toolbars align on their foot). */
2351
+ .app .toolbar > label:has(> input[type="checkbox"]) { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; }
2352
+ /* Held by another editor (see embedded): no card of its own inside that one's. */
2353
+ .app.embedded { border: 0; border-radius: 0; max-width: none; }
2354
+ ${Je.HEAD}
2355
+ .scene-card { background: #0b1020; }
2356
+ .scene-card > .render-line { padding: 6px 12px; background: var(--ground-raised); }
2357
+ .scene-card > .render-line:not(:has(:not(:empty))) { display: none; }
2358
+ .scene-card > .playback-row { margin: 0; padding: 8px 14px; background: var(--ground-raised); border-top: 1px solid var(--line); }
2359
+ #group-observation > .param-summary-fold { margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
2360
+ .param-summary-fold > summary { cursor: pointer; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
2361
+ .param-summary-fold > .param-summary { margin-top: 10px; }
2362
+ /* The sections, as a row of chips that scrolls sideways rather than wrapping. */
2363
+ #group-tabs.section-chips {
2364
+ display: flex;
2365
+ flex-wrap: nowrap;
2366
+ align-items: center;
2367
+ gap: 8px;
2368
+ min-height: 0;
2369
+ margin: 0;
2370
+ padding: 12px 18px;
2371
+ padding-inline-end: 18px;
2372
+ border: 0;
2373
+ border-top: 1px solid var(--line);
2374
+ border-bottom: 1px solid var(--line);
2375
+ overflow-x: auto;
2376
+ scrollbar-width: none;
2377
+ }
2378
+ .section-chips > .group-tab {
2379
+ flex: none;
2380
+ display: inline-flex;
2381
+ align-items: center;
2382
+ gap: 6px;
2383
+ height: 34px;
2384
+ margin: 0;
2385
+ padding: 0 10px;
2386
+ border: 1px solid var(--line-strong);
2387
+ border-radius: 10px;
2388
+ background: var(--ground-raised);
2389
+ color: var(--ink);
2390
+ box-shadow: none;
2391
+ font: 600 14px/1 var(--sans);
2392
+ }
2393
+ .section-chips > .group-tab:hover { background: var(--ground-sunken); color: var(--ink); }
2394
+ /* Its state, as its outline: complete, or with something still to answer, or wrong. */
2395
+ .section-chips > .group-tab { border: 1.5px solid var(--ok); }
2396
+ .section-chips > .group-tab:has(.tab-badge:not([hidden])) { border-color: var(--glow-solid); }
2397
+ .app:has(#group-observation [aria-invalid="true"]) [aria-controls="group-observation"],
2398
+ .app:has(#group-observer [aria-invalid="true"]) [aria-controls="group-observer"],
2399
+ .app:has(#group-location [aria-invalid="true"]) [aria-controls="group-location"],
2400
+ .app:has(#group-temporal [aria-invalid="true"]) [aria-controls="group-temporal"],
2401
+ .app:has(#group-decor [aria-invalid="true"]) [aria-controls="group-decor"],
2402
+ .app:has(#group-weather [aria-invalid="true"]) [aria-controls="group-weather"],
2403
+ .app:has(#group-shape [aria-invalid="true"]) [aria-controls="group-shape"],
2404
+ .app:has(#group-sound [aria-invalid="true"]) [aria-controls="group-sound"],
2405
+ .app:has(#group-reference [aria-invalid="true"]) [aria-controls="group-reference"],
2406
+ .app:has(#group-file [aria-invalid="true"]) [aria-controls="group-file"] { border-color: var(--error); }
2407
+ /* No room for every name: the pictograms alone (see fitGroupTabs). */
2408
+ .section-chips.compact > .group-tab:not([aria-expanded="true"], :hover, :focus-visible) { padding: 0 9px; }
2409
+ /* ...except the open one, which always says what it is, and the one pointed at or reached by keyboard, which says it then. The name folds away rather than vanishing, so that a tab opened grows into
2410
+ its name and the one closed shrinks back to its pictogram, instead of the strip jumping. Still read aloud, folded: only its width goes. */
2411
+ .section-chips > .group-tab { transition: padding 0.2s ease; }
2412
+ .section-chips > .group-tab > span:not(.tab-badge) {
2413
+ display: inline-block;
2414
+ max-width: 12em;
2415
+ overflow: hidden;
2416
+ white-space: nowrap;
2417
+ transition: max-width 0.2s ease, margin 0.2s ease, opacity 0.2s ease;
2418
+ }
2419
+ .section-chips.compact > .group-tab:not([aria-expanded="true"], :hover, :focus-visible) > span:not(.tab-badge) { max-width: 0; margin-inline-start: -6px; opacity: 0; }
2420
+ /* Measured at once, not halfway through a fold (see fitGroupTabs). */
2421
+ .section-chips.measuring > .group-tab, .section-chips.measuring > .group-tab > span { transition: none; }
2422
+ .section-chips > .group-tab[aria-expanded="true"] { background: var(--ink); color: var(--ground-raised); box-shadow: none; }
2423
+ /* The count stays for whoever reads the chip aloud; the outline says it to the eye. */
2424
+ .section-chips .tab-badge { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
2425
+ .app > .group-panel {
2426
+ margin: 0;
2427
+ /* Its top padding is what what sticks at its top (the text's search panel) rises by, to stick at its edge rather than below it. */
2428
+ --group-panel-padding-top: 20px;
2429
+ padding: var(--group-panel-padding-top) 18px 24px;
2430
+ border: 0;
2431
+ border-radius: 0;
2432
+ background: var(--ground-raised);
2433
+ color: var(--ink);
2434
+ }
2435
+ .group-panel > .group-settings { top: 20px; right: 18px; }
2436
+ /* Fields: the label above, 13px, the value under it at 15px, on a grid that fills the width. */
2437
+ .group-panel .toolbar { gap: 14px 16px; align-items: end; }
2438
+ .group-panel .toolbar > label:not(:has(> input[type="checkbox"], > input[type="radio"])) {
2439
+ display: grid;
2440
+ grid-template-columns: minmax(0, 1fr) auto;
2441
+ align-items: center;
2442
+ column-gap: 6px;
2443
+ row-gap: 6px;
2444
+ font: 600 13px/1.3 var(--sans);
2445
+ color: var(--ink-dim);
2446
+ }
2447
+ .group-panel .toolbar > label:not(:has(> input[type="checkbox"], > input[type="radio"])) > :first-child { grid-column: 1 / -1; }
2448
+ .group-panel .toolbar > label > :is(input, select, textarea) { font-weight: 400; }
2449
+ .group-panel .toolbar > label.wide { display: flex; }
2450
+ ${Je.fields(".app")}
2451
+ /* A section's parts: one segmented control, the part open raised in it. */
2452
+ .subtabs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
2453
+ .group-panel .group-tabs:has(> .subgroup-tab) {
2454
+ display: inline-flex;
2455
+ flex-wrap: wrap;
2456
+ gap: 2px;
2457
+ margin-bottom: 16px;
2458
+ padding: 4px;
2459
+ border: 1px solid var(--line-strong);
2460
+ border-radius: 12px;
2461
+ background: var(--ground);
2462
+ }
2463
+ /* As specific as the rule above, which would otherwise push the control up out of the row's middle. */
2464
+ .group-panel .subtabs-row > .group-tabs { margin: 0; }
2465
+ .subgroup-tab {
2466
+ min-height: 34px;
2467
+ margin: 0;
2468
+ padding: 0 16px;
2469
+ border: 0;
2470
+ border-radius: 8px;
2471
+ background: transparent;
2472
+ color: var(--ink-dim);
2473
+ box-shadow: none;
2474
+ font: 600 14px/1 var(--sans);
2475
+ }
2476
+ .subgroup-tab:hover { background: var(--ground-sunken); color: var(--ink); }
2477
+ /* The part open stands out of the control in both themes: the raised ground alone was within a few levels of the control's own in dark. */
2478
+ .subgroup-tab[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 16%, var(--ground-raised)); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0, 0, 0, .18); }
2479
+ .subgroup-panel { margin: 0; padding: 0; border: 0; background: transparent; color: inherit; }
2480
+ .account-view { display: inline-flex; align-items: center; gap: 10px; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
2481
+ .app .element-list-body { border-color: var(--line); border-radius: 0 10px 10px 10px; }
2482
+ .context-menu { background: var(--ground-raised); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
2483
+ .context-menu hr { border: 0; border-top: 1px solid var(--line); }
2484
+ /* A panel's sections: a title in capitals, then its fields on a grid that fills the width, the label above each. */
2485
+ .form-section {
2486
+ flex: 1 1 100%;
2487
+ display: grid;
2488
+ grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
2489
+ gap: 14px 16px;
2490
+ align-items: start;
2491
+ min-width: 0;
2492
+ margin: 0;
2493
+ padding: 18px 0;
2494
+ border: 0;
2495
+ border-top: 1px solid var(--line);
2496
+ }
2497
+ /* The first section of a panel opens it: no rule above it, the chips row stands there. */
2498
+ .group-panel > .toolbar:first-child > .form-section:first-child, .group-panel > .form-section:first-child,
2499
+ #observer-principal > .form-section:first-child, .element-list-body > .form-section:first-child { border-top: 0; padding-top: 4px; }
2500
+ .form-section:last-child { padding-bottom: 0; }
2501
+ .section-title { grid-column: 1 / -1; margin: 0 0 -2px; font: 600 12px/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--glow-dim); }
2502
+ /* What is not a field takes the whole line: a paragraph, a note, a list, a row of buttons, another section's toolbar. */
2503
+ .form-section > :is(.toolbar, p, output, .file-note, .element-list-row, .element-list-body, .record-row, .place-search-row, rr0-provider-settings, .decor-add-row, span:not(.input-file-row), div:not(.field)) { grid-column: 1 / -1; }
2504
+ /* The passages of the case's interviews about the moments: the moment's button and the first line of its quotation on one level. */
2505
+ .moment-passages { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
2506
+ .moment-passages li { display: flex; gap: 10px; align-items: flex-start; }
2507
+ .moment-passages .at { flex: none; box-sizing: border-box; min-height: 0; height: 30px; padding: 0 12px 0 9px; display: inline-flex; align-items: center; gap: 4px;
2508
+ font: 600 13px/1 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
2509
+ .moment-passages .at svg { width: 14px; height: 14px; }
2510
+ .moment-passages .excerpt { min-height: 0; margin: 0; padding: 5px 0 0; border: 0; border-radius: 0; background: none; font: 400 14px/1.45 var(--sans);
2511
+ text-align: left; color: var(--sky, LinkText); text-decoration: underline; text-underline-offset: .15em; cursor: pointer; }
2512
+ /* What has nothing to say takes no line: an empty output kept its row and the grid's gap (three of them under Size, with two shapes selected). */
2513
+ .form-section > :is(output, p):empty { display: none; }
2514
+ .form-section > .toolbar { margin: 0; }
2515
+ /* A field: its label on a line of its own above it, its value under it, filling the column unless it is a number (fitted to its own
2516
+ values, see NumberFields), its unit right after it, and what is said about it (an output) under them. */
2517
+ .form-section > :is(label, .field):not(:has(> input[type="checkbox"], > input[type="radio"])) {
2518
+ display: flex;
2519
+ flex-wrap: wrap;
2520
+ align-items: center;
2521
+ gap: 6px;
2522
+ min-width: 0;
2523
+ font: 600 13px/1.3 var(--sans);
2524
+ color: var(--ink-dim);
2525
+ }
2526
+ .form-section > :is(label, .field):not(:has(> input[type="checkbox"], > input[type="radio"])) > :first-child { flex: 1 0 100%; }
2527
+ /* A file or an address: laid out as a field, but on a line of its own, an address being long, and never over the next field. */
2528
+ .form-section > .input-file-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0;
2529
+ font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
2530
+ .form-section > .input-file-row > :first-child { flex: 1 0 100%; }
2531
+ .form-section > .input-file-row > rr0-input-file { flex: 1 1 0; min-width: 0; font-weight: 400; }
2532
+ .form-section > .input-file-row > rr0-input-file > input:not([type="file"]) { flex: 1 1 auto; width: auto; min-width: 0; }
2533
+ .form-section > :is(label, .field) > :is(input:not([type="checkbox"]):not([type="radio"]):not([type="number"]):not([type="color"]), select, textarea, rr0-popover-picker, rr0-input-file) { flex: 1 1 0; min-width: 0; font-weight: 400; }
2534
+ /* A date or a duration holds its own "precise / imprecise" switch beside its field: as wide as both need. */
2535
+ .form-section > :is(label, .field) > :is(rr0-date-input, rr0-duration-input) { flex: 1 1 auto; flex-wrap: wrap; min-width: 0; max-width: 100%; font-weight: 400; }
2536
+ /* Its field fits the column it is given, never past it into the next one, and never shorter than "dd/mm/yyyy --:--" with its calendar: a
2537
+ section that holds a date and time has columns wide enough for the switch and that beside it. */
2538
+ .form-section :is(rr0-date-input, rr0-duration-input) :is(.edtf-field, .duration-field) { flex: 1 1 10em; min-width: 0; max-width: 100%; }
2539
+ /* Said in EDTF, a date is a text as wide as its value: its field holds it alone, so that the (?) in its corner stays on the text. */
2540
+ .form-section rr0-date-input .edtf-field:has(> input[type="text"]:not([hidden])) { flex: 0 1 auto; }
2541
+ .form-section:has(rr0-date-input:not([date-only])) { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
2542
+ .form-section :is(rr0-date-input, rr0-duration-input) input { box-sizing: border-box; min-width: 0; max-width: 100%; width: 100%; }
2543
+ .form-section > :is(label, .field) > input[type="color"] { flex: 1 1 0; height: 38px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--ground); }
2544
+ .form-section > :is(label, .field) > input[type="number"] { flex: none; font-weight: 400; }
2545
+ .form-section > :is(label, .field) > output { flex: 1 0 100%; font-weight: 400; }
2546
+ .form-section > label:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
2547
+ /* The fields of a row line up on their labels, which a value said under one of them (an output) does not move; a slider stands as tall as
2548
+ a field, so that its track is level with the middle of the fields beside it, and a box to tick on the line of their values. */
2549
+ .app :is(.form-section, .toolbar) > label > input[type="range"] { height: 38px; margin: 0; }
2550
+ .form-section > label:has(> input[type="checkbox"]) { align-self: end; min-height: 38px; }
2551
+ .form-section .record-row { display: flex; flex-wrap: wrap; align-items: end; gap: 14px 16px; }
2552
+ /* The scene, with nothing over it at rest (see the design handoff, §3.2): its toggles and its timeline show while the pointer is
2553
+ over it, while one of them has the focus, and for a moment after a touch (data-shown, see SightingEditorElement.showOverlays). */
2554
+ .scene-card { position: relative; }
2555
+ .scene-card > .view-drag-hint { position: absolute; z-index: 4; top: 10px; left: 10px; max-width: calc(100% - 80px); margin: 0; padding: 4px 9px;
2556
+ border-radius: 6px; background: rgba(0, 0, 0, .62); color: #e8ecf4; font: 500 12px/1.4 var(--sans); pointer-events: none; }
2557
+ .scene-card > .view-drag-hint[data-held] { background: rgba(0, 0, 0, .72); color: #fff; font-weight: 600; }
2558
+ .scene-card > .view-drag-hint[hidden] { display: none; }
2559
+ .scene-card > .render-line, .scene-card > .playback-row {
2560
+ position: absolute; z-index: 4; opacity: 0; pointer-events: none; transition: opacity .15s ease;
2561
+ }
2562
+ .scene-card:is(:hover, :focus-within, [data-shown]) > :is(.render-line, .playback-row) { opacity: 1; pointer-events: auto; }
2563
+ .scene-card > .render-line { top: 10px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding: 0; background: none; }
2564
+ .scene-card > .render-line .scene-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 0; }
2565
+ .scene-card > :is(.render-line, .playback-row) :is(button, input[type="range"]) { color: #e8ecf4; }
2566
+ /* The sound's slider folds beside its button until the pointer or the keyboard is on either, as the player's does. */
2567
+ .editor-volume { display: flex; align-items: center; }
2568
+ .editor-volume input[type="range"] { width: 0; min-width: 0; margin: 0; opacity: 0; transition: width 0.15s ease, margin 0.15s ease, opacity 0.15s ease; }
2569
+ .editor-volume:is(:hover, :focus-within) input[type="range"]:not([hidden]) { width: 4.5em; margin: 0 0.4em; opacity: 1; }
2570
+ .scene-card > .render-line button {
2571
+ background: rgba(7, 10, 18, .66); border: 1px solid rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
2572
+ }
2573
+ .scene-card > .playback-row {
2574
+ left: 0; right: 0; bottom: 0; margin: 0; padding: 8px 14px;
2575
+ background: rgba(7, 10, 18, .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #e8ecf4; border: 0;
2576
+ }
2577
+ .scene-card > .playback-row .icon-btn { background: transparent; border-color: rgba(255, 255, 255, .18); }
2578
+ /* With the tracks laid out, the timeline leaves the picture and stays under it. */
2579
+ .scene-card[data-tracks] > .playback-row {
2580
+ position: static; opacity: 1; pointer-events: auto;
2581
+ background: var(--ground-raised); color: var(--ink); -webkit-backdrop-filter: none; backdrop-filter: none; border-top: 1px solid var(--line);
2582
+ }
2583
+ .scene-card[data-tracks] > .playback-row :is(button, input[type="range"]) { color: var(--ink); }
2584
+ .scene-card[data-tracks] > .playback-row .icon-btn { border-color: var(--line-strong); }
2585
+ #toggle-tracks[aria-expanded="true"] { background: var(--glow-solid); border-color: var(--glow-solid); color: var(--glow-on-solid); }
2586
+ .app > #timeline-tracks { background: var(--ground-raised); color: var(--ink); border-bottom: 1px solid var(--line); }
2587
+ /* What a click in the scene opened, pointed out for a moment. */
2588
+ .flash { background: var(--warn-bg) !important; border-radius: 8px; box-shadow: 0 0 0 6px var(--warn-bg); transition: background .3s ease, box-shadow .3s ease; }
2589
+ @media (prefers-reduced-motion: reduce) { .scene-card > :is(.render-line, .playback-row) { transition: none; } }
2590
+ /* Given the width (the app on a computer): the render in a column of its own, the sections and the one open in the other, the editor the
2591
+ height of the screen and the open section scrolling under its chips. The grip has nothing to share out between the two any more. The
2592
+ width this editor is given, never the window's: held by a case, it is the case's. */
2593
+ @container (min-width: 820px) {
2594
+ .app {
2595
+ /* The screen's height, or what a page that has something above it says is left (see UfoAtHomeElement). */
2596
+ max-width: none; height: var(--rr0-editor-height, 100dvh); max-height: none;
2597
+ display: grid; grid-template-columns: minmax(0, 11fr) minmax(22rem, 9fr);
2598
+ grid-template-rows: auto auto auto auto minmax(0, 1fr);
2599
+ grid-template-areas: "head head" "notes notes" "scene tabs" "scene tracks" "scene panel";
2600
+ }
2601
+ .app > .editor-head { grid-area: head; }
2602
+ .app > .save-refused { grid-area: notes; }
2603
+ .app > .scene-card { grid-area: scene; align-self: start; border-right: 1px solid var(--line); }
2604
+ /* As tall as the screen leaves it under the header, whatever height the grip gave it in one column. */
2605
+ .app > .scene-card { --rr0-scene-max-height: calc(var(--rr0-editor-height, 100dvh) - 6rem); }
2606
+ .app > .scene-resize { display: none; }
2607
+ .app > #group-tabs { grid-area: tabs; }
2608
+ .app > #timeline-tracks { grid-area: tracks; }
2609
+ .app > .group-panel { grid-area: panel; }
2610
+ }
2611
+ @container (max-width: 640px) {
2612
+ .editor-head { flex-wrap: wrap; }
2613
+ .app > .group-panel, #group-tabs.section-chips, .editor-head { padding-left: 14px; padding-right: 14px; }
2614
+ }
2615
+ `;class lt{constructor(e,t){this.seekInput=e,this.layer=t,e.addEventListener("pointerdown",i=>{this.snapArmed=!0,this.nameMarkUnder(i)}),e.addEventListener("pointerup",()=>this.snapArmed=!1),e.addEventListener("pointermove",i=>this.nameMarkUnder(i)),e.addEventListener("pointerleave",()=>e.removeAttribute("title"))}static SNAP_PX=6;marks=[];duration=0;drawn="";snapArmed=!1;show(e,t){const i=t>0?[...e].sort((n,r)=>n.t-r.t):[],s=`${t}|${i.map(n=>`${n.kind}:${n.t}:${n.label}`).join("|")}`;s!==this.drawn&&(this.drawn=s,this.marks=i,this.duration=t,this.layer.replaceChildren(...i.map(n=>{const r=document.createElement("span");return r.className=`timeline-mark ${n.kind}`,r.style.left=`${Math.min(Math.max(n.t/t,0),1)*100}%`,r})))}snap(e){return this.snapArmed?(this.snapArmed=!1,this.markNear(e)?.t??e):e}next(e){return this.marks.find(t=>t.t>e+lt.SAME_INSTANT)?.t}previous(e){return[...this.marks].reverse().find(t=>t.t<e-lt.SAME_INSTANT)?.t}static SAME_INSTANT=.5;markNear(e){const t=this.seekInput.getBoundingClientRect().width;if(this.duration<=0||t<=0)return;const i=lt.SNAP_PX/t*this.duration;let s;for(const n of this.marks)Math.abs(n.t-e)>i||(!s||Math.abs(n.t-e)<Math.abs(s.t-e)||n.t===s.t&&n.kind==="milestone")&&(s=n);return s}nameMarkUnder(e){const t=this.seekInput.getBoundingClientRect();if(t.width<=0||this.duration<=0)return;const i=this.marksNear((e.clientX-t.left)/t.width*this.duration);i?this.seekInput.title=i:this.seekInput.removeAttribute("title")}marksNear(e){const t=this.markNear(e);if(t)return[...new Set(this.marks.filter(i=>i.t===t.t).map(i=>i.label))].join(" · ")}}class lr{constructor(e,t,i){this.container=e,this.aim=t,this.compassPoint=i}rows=new Map;selected;show(e,t,i=!1){const s=e.length===this.rows.size&&e.every(n=>this.rows.has(n.key));(i||!s)&&this.build(e,t);for(const n of e)this.write(this.rows.get(n.key),n,t)}get selectedKey(){return this.selected}select(e,t){this.selected=e;for(const i of this.rows.values())this.write(i,i.flight,t)}build(e,t){if(this.rows=new Map,e.some(u=>u.key===this.selected)||(this.selected=void 0),e.length===0){this.container.replaceChildren();return}const i=document.createElement("p");i.className="message-info",i.textContent=e.every(u=>u.declared)?t.aircraftFlightsDeclaredIntro:t.aircraftFlightsIntro;const s=document.createElement("table");s.className="aircraft-flights-table";const n=s.createTHead().insertRow(),{flight:r,distance:o,direction:l,height:a,altitude:d}=t.aircraftFlightsColumns;for(const u of[r,o,l,a,d]){const p=document.createElement("th");p.scope="col",p.textContent=u,n.append(p)}const h=s.createTBody();for(const u of e){const p=h.insertRow();p.dataset.flight=u.key;const m=p.insertCell(),f={distance:p.insertCell(),direction:p.insertCell(),height:p.insertCell(),altitude:p.insertCell()};p.addEventListener("click",()=>{const g=this.rows.get(u.key)?.flight;g&&this.aim(g)}),this.rows.set(u.key,{row:p,flight:u,label:m,...f})}const c=document.createElement("div");c.className="aircraft-flights-scroll",c.append(s),this.container.replaceChildren(i,c)}write(e,t,i){if(e.flight=t,e.label.textContent=[t.type??i.aircraftFlightUnknown,t.registration].filter(Boolean).join(" · "),t.declared){const h=document.createElement("span");h.className="flight-basis",h.textContent=i.aircraftFlightDeclared,e.label.append(" ",h)}const{row:s}=e,n=t.sky,r=(h,c=0)=>h.toLocaleString(void 0,{maximumFractionDigits:c});e.distance.textContent=n?`${r(n.distanceKm,n.distanceKm<10?1:0)} km`:"",e.direction.textContent=n?`${this.compassPoint(n.azimuthDeg)} ${r(n.azimuthDeg)}°`:"",e.height.textContent=n?`${r(n.altitudeDeg,1)}°`:"",e.altitude.textContent=t.altitudeFt!==void 0?`${r(t.altitudeFt)} ft`:"",s.classList.toggle("absent",!n),s.setAttribute("aria-disabled",String(!n&&t.firstMs===void 0));const o=n?i.aircraftFlightAim:t.firstMs!==void 0?i.aircraftFlightLater:i.aircraftFlightAbsent,l=t.key===this.selected;s.setAttribute("aria-selected",String(l));const a=l?i.aircraftFlightMarked:o,d=t.drawn||t.declared?a:`${a}. ${i.aircraftFlightNotDrawn}`;s.title=t.declared?`${i.aircraftFlightDeclaredHint}. ${d}`:d}}class yi{constructor(e,t,i=yi.TOLERANCE_PX){this.timeline=e,this.clock=t,this.tolerancePx=i}static TOLERANCE_PX=1;currentPointer=null;shapePrototype=null;sourceId="";samples=[];start(e,t){this.sourceId=e,this.shapePrototype=t,this.currentPointer=null,this.samples=[],this.clock.start(i=>this.recordSample(i))}onPointerMove(e,t){this.currentPointer={x:e,y:t}}stop(){this.clock.stop(),this.thin()}thin(){const e=this.samples;if(e.length<=2)return;const t=new Set([0,e.length-1]),i=[[0,e.length-1]];for(;i.length>0;){const[s,n]=i.pop(),r=e[s],o=e[n];let l=0,a=-1;for(let d=s+1;d<n;d++){const h=e[d],c=(h.t-r.t)/(o.t-r.t),u=Math.hypot(r.x+(o.x-r.x)*c-h.x,r.y+(o.y-r.y)*c-h.y);u>l&&(l=u,a=d)}a!==-1&&l>this.tolerancePx&&(t.add(a),i.push([s,a],[a,n]))}e.forEach((s,n)=>{t.has(n)||this.timeline.removeShapeAt(s.t,this.sourceId)}),this.samples=[]}recordSample(e){if(!this.currentPointer||!this.shapePrototype)return;const t=Ls(this.shapePrototype,this.currentPointer.x,this.currentPointer.y);this.timeline.addKeyframe(e,[{sourceId:this.sourceId,shape:t}]),this.samples[this.samples.length-1]?.t===e&&this.samples.pop(),this.samples.push({t:e,x:this.currentPointer.x,y:this.currentPointer.y})}}class dr{constructor(e){this.intervalMs=e}rafId=null;startTime=0;lastTick=0;start(e){this.startTime=performance.now(),this.lastTick=0;const t=()=>{const i=performance.now()-this.startTime;i-this.lastTick>=this.intervalMs&&(this.lastTick=i,e(i)),this.rafId=requestAnimationFrame(t)};this.rafId=requestAnimationFrame(t)}stop(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}}class Te{constructor(e,t,i,s={}){this.id=e,this.aspect=t,this.parts=i,this.minimum=s}static ALL=[new Te("triangle",.9,[{points:[[.5,0],[1,1],[0,1]],fx:0,fy:0,fw:1,fh:1}]),new Te("saucer",.6,[{part:"dome",fx:.28,fy:0,fw:.44,fh:.62},{part:"disc",fx:0,fy:.42,fw:1,fh:.42}]),new Te("cigar",.25,[{fx:0,fy:0,fw:1,fh:1}]),new Te("chevron",.55,[{points:[[.5,0],[1,1],[.5,.6],[0,1]],fx:0,fy:0,fw:1,fh:1}]),new Te("light",1,[{fx:.3,fy:.3,fw:.4,fh:.4}],{haloScale:2.5,brightness:.5})];static byId(e){return Te.ALL.find(t=>t.id===e)}get partNames(){return this.parts.map(e=>e.part)}boundsAt(e){const t=e.width*this.aspect;return{x:e.x,y:e.y+e.height/2-t/2,width:e.width,height:t}}shapesIn(e,t){return this.parts.map(i=>{const s={x:e.x+i.fx*e.width,y:e.y+i.fy*e.height,width:i.fw*e.width,height:i.fh*e.height};return{...i.points?Cn(s,i.points.map(([r,o])=>({x:r*s.width,y:o*s.height})),t.color):On(s,t.color),transparency:t.transparency,haloScale:Math.max(t.haloScale,this.minimum.haloScale??0),blur:t.blur,brightness:Math.max(t.brightness,this.minimum.brightness??0)}})}}const rs="rr0-provider-settings",hr=`
2616
+ rr0-provider-settings { display: block; }
2617
+ rr0-provider-settings .ps-provider { margin: .3em 0; }
2618
+ rr0-provider-settings .ps-heading { font-weight: 600; margin-right: .6em; }
2619
+ rr0-provider-settings .ps-setting { display: inline-flex; align-items: center; gap: .3em; margin-right: .8em; }
2620
+ rr0-provider-settings .ps-also { opacity: .75; font-variant-numeric: tabular-nums; }
2621
+ `;class cr extends HTMLElement{list=[];words={};shown={};set providers(e){this.list=e,this.render()}set labels(e){this.words=e,this.render()}get values(){return this.shown}set values(e){this.shown=structuredClone(e),this.render()}connectedCallback(){this.render()}word(e,t){return this.words[e]??t}current(e,t){return this.shown[e.id]?.[t.id]??t.default}edit(e,t,i){const s={...this.shown[e.id]??{}};i===void 0?delete s[t.id]:s[t.id]=i,this.shown={...this.shown,[e.id]:s},this.dispatchEvent(new Event("settingschange",{bubbles:!0}))}render(){if(!this.isConnected&&this.list.length===0)return;const e=this.ownerDocument,t=e.createElement("style");t.textContent=hr;const i=this.list.map(s=>{const n=e.createElement("div");n.className="ps-provider",n.dataset.provider=s.id;const r=e.createElement("span");return r.className="ps-heading",r.textContent=this.word(s.id,s.id),r.title=this.word(`${s.id}.hint`,""),n.append(r,...s.settings.map(o=>this.control(s,o))),n});this.replaceChildren(t,...i),Rt.fit(this)}control(e,t){const i=this.ownerDocument,s=i.createElement("label");s.className="ps-setting";const n=i.createElement("span");n.textContent=this.word(`${e.id}.${t.id}`,t.id),s.append(n);const r=`${e.id}-${t.id}`;if(t.kind==="choice"){const o=i.createElement("select");o.id=r;for(const l of t.choices??[]){const a=i.createElement("option");a.value=l.id,a.textContent=this.word(`${e.id}.${t.id}.${l.id}`,l.id),o.append(a)}o.value=String(this.current(e,t)),o.addEventListener("change",()=>this.edit(e,t,o.value)),s.append(o)}else{const o=i.createElement("input");o.id=r,o.type="number",t.min!==void 0&&(o.min=String(t.min)),t.max!==void 0&&(o.max=String(t.max)),t.step!==void 0&&(o.step=String(t.step)),o.value=String(this.current(e,t)),o.addEventListener("input",()=>{const a=o.value.trim()===""?void 0:Number(o.value);this.edit(e,t,Number.isFinite(a)?a:void 0)}),s.append(o),t.unit&&s.append(i.createTextNode(` ${t.unit}`));const l=t.also;if(l){const a=i.createElement("span");a.className="ps-also";const d=new Intl.NumberFormat(Ne.preferencesFor(this),{minimumFractionDigits:l.digits??0,maximumFractionDigits:l.digits??0}),h=()=>{const c=Number(o.value);a.textContent=o.value.trim()!==""&&Number.isFinite(c)?`(≈ ${d.format(c*l.factor)} ${l.unit})`:""};o.addEventListener("input",h),h(),s.append(" ",a)}}return s}}function ur(){customElements.get(rs)||customElements.define(rs,cr)}const os="rr0-popover-picker",pr=`
2622
+ rr0-popover-picker { display: inline-block; }
2623
+ rr0-popover-picker .pp-trigger { anchor-name: --rr0-popover-picker; font-family: inherit; text-align: left; max-width: 100%; cursor: pointer; }
2624
+ rr0-popover-picker .pp-panel { padding: .3em 0; border: 1px solid light-dark(#ccc, #4a4c52); border-radius: 4px; background: light-dark(#fff, #1e1f22); color: light-dark(#222, #e6e6e6); max-height: 60vh; overflow-y: auto; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); font-size: .9em; }
2625
+ @supports (position-area: bottom span-right) {
2626
+ rr0-popover-picker .pp-panel:popover-open { position-anchor: --rr0-popover-picker; inset: auto; position-area: bottom span-right; margin: .2em 0 0 0; }
2627
+ }
2628
+ rr0-popover-picker .pp-heading { margin: .4em 0 .1em; padding: 0 .8em 0 calc(.8em + var(--pp-depth, 0) * 1em); font-weight: 600; opacity: .75; font-size: .85em; text-transform: uppercase; letter-spacing: .03em; }
2629
+ rr0-popover-picker .pp-choice { display: block; width: 100%; padding: .25em .8em .25em calc(.8em + var(--pp-depth, 0) * 1em); border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
2630
+ rr0-popover-picker .pp-choice:hover, rr0-popover-picker .pp-choice:focus-visible { background: light-dark(#e8f0fe, #2c3a55); }
2631
+ rr0-popover-picker .pp-choice[aria-selected="true"] { font-weight: 600; }
2632
+ rr0-popover-picker .pp-choice[aria-selected="true"]::before { content: "✓ "; }
2633
+ rr0-popover-picker .pp-choice[aria-disabled="true"] { opacity: .45; cursor: not-allowed; background: none; }
2634
+ `;class Ut extends HTMLElement{tree=[];current="";trigger;panel;stale=!0;build(){if(this.trigger)return;const e=this.ownerDocument,t=e.createElement("style");t.textContent=pr;const i=e.createElement("button");i.type="button",i.className="pp-trigger rr0-select";const s=e.createElement("div");s.className="pp-panel",s.setAttribute("popover",""),s.setAttribute("role","listbox");const n=`${this.id||"rr0-popover-picker"}-panel`;s.id=n,i.setAttribute("popovertarget",n),i.setAttribute("aria-haspopup","listbox"),this.trigger=i,this.panel=s,s.addEventListener("beforetoggle",r=>{r.newState==="open"&&this.drawMenu()}),this.append(t,i,s),this.render()}connectedCallback(){this.build()}set choices(e){this.tree=e,this.build(),this.render()}get choices(){return this.tree}get placeholder(){return this.getAttribute("placeholder")??""}set placeholder(e){this.setAttribute("placeholder",e),this.render()}get value(){return this.current}set value(e){this.current=e,this.build(),this.render()}get selectedLabel(){return Ut.find(this.tree,this.current)?.label}static find(e,t){for(const i of e)if(i.children){const s=Ut.find(i.children,t);if(s)return s}else if(i.id===t)return i}pick(e){e.disabledReason!==void 0||e.id===void 0||(this.panel?.hidePopover?.(),e.id!==this.current&&(this.current=e.id,this.render(),this.dispatchEvent(new Event("change",{bubbles:!0}))))}render(){if(!this.trigger||!this.panel)return;this.trigger.textContent=this.selectedLabel??(this.current||this.placeholder),this.stale=!0;let e=!1;try{e=this.panel.matches(":popover-open")}catch{}e&&this.drawMenu()}drawMenu(){if(!this.panel||!this.stale)return;this.stale=!1;const e=this.ownerDocument,t=(i,s)=>i.flatMap(n=>{if(n.children){const l=e.createElement("div");return l.className="pp-heading",l.setAttribute("role","presentation"),l.style.setProperty("--pp-depth",String(s)),l.textContent=n.label,[l,...t(n.children,s+1)]}const r=e.createElement("button");r.type="button",r.className="pp-choice",r.dataset.id=n.id,r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n.id===this.current)),r.style.setProperty("--pp-depth",String(s)),r.textContent=n.label;const o=n.disabledReason??n.hint;return o&&(r.title=o),n.disabledReason!==void 0&&r.setAttribute("aria-disabled","true"),r.addEventListener("click",()=>this.pick(n)),[r]});this.panel.replaceChildren(...t(this.tree,0))}}function mr(){customElements.get(os)||customElements.define(os,Ut)}const Ht="rr0-duration-input",gr=`
2635
+ rr0-duration-input { position: relative; display: inline-flex; align-items: center; gap: .3em; }
2636
+ rr0-duration-input .duration-field { position: relative; display: inline-flex; align-items: center; gap: .25em; }
2637
+ rr0-duration-input .duration-field input[type="text"] { padding-right: 2.1em; }
2638
+ rr0-duration-input .duration-help { position: absolute; right: .6em; top: 50%; transform: translateY(-50%); box-sizing: border-box; width: 1.2em; height: 1.2em; min-height: 0; min-width: 0; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: none; color: inherit; font-size: .75em; line-height: 1; cursor: help; opacity: .7; }
2639
+ rr0-duration-input .duration-helppop { position: absolute; left: 0; bottom: calc(100% + .35em); z-index: 5; max-width: 26em; padding: .35em .6em; border-radius: 4px; background: rgba(0, 0, 0, .88); color: #fff; font-size: .8rem; line-height: 1.35; white-space: normal; pointer-events: none; }
2640
+ rr0-duration-input .duration-helppop { pointer-events: auto; min-width: 16em; }
2641
+ rr0-duration-input .duration-helppop p { margin: 0 0 .3em; font-weight: 600; }
2642
+ rr0-duration-input .duration-helppop ul { margin: 0; padding-left: 1.1em; }
2643
+ /* As the date's: what says how the duration is said reads as part of the label (same font, a link's underline, no button), before the field. */
2644
+ rr0-duration-input .duration-mode { order: -1; font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-decoration: underline; text-underline-offset: .15em; }
2645
+ rr0-duration-input .duration-mode:hover { text-decoration-thickness: 2px; }
2646
+ rr0-duration-input .duration-mode:focus-visible { outline: 2px solid #4af; outline-offset: 2px; border-radius: 2px; }
2647
+ rr0-duration-input [hidden] { display: none !important; }
2648
+ ${Se.css("rr0-duration-input .duration-helppop")}
2649
+ `;class fr extends HTMLElement{wording;built=!1;precise=!0;numberInput;textInput;modeButton;helpButton;popup;chosen;build(){if(this.built)return;this.built=!0;const e=this.getAttribute("name"),t=this.ownerDocument,i=t.createElement("style");i.textContent=gr;const s=t.createElement("span");s.className="duration-field",this.numberInput=t.createElement("input"),this.numberInput.type="number",this.numberInput.min="0",this.numberInput.max="86400",this.numberInput.step="0.1",this.numberInput.setAttribute("aria-required","true");const n=t.createElement("span");n.className="duration-unit",n.textContent="s",this.textInput=t.createElement("input"),this.textInput.type="text",this.textInput.hidden=!0,this.helpButton=t.createElement("button"),this.helpButton.type="button",this.helpButton.className="duration-help",this.helpButton.textContent="?",this.helpButton.hidden=!0,this.popup=t.createElement("div"),this.popup.className="duration-helppop",Se.attach(this.helpButton,this.popup),this.chosen=t.createElement("span"),this.chosen.className="duration-chosen",this.chosen.hidden=!0,this.modeButton=t.createElement("button"),this.modeButton.type="button",this.modeButton.className="duration-mode",e&&(this.numberInput.id=e,this.textInput.id=`${e}-text`),s.append(this.numberInput,n,this.textInput,this.helpButton,this.popup),this.append(i,s,this.modeButton,this.chosen),this.numberInput.addEventListener("input",()=>{const r=this.numberInput.value;this.tell(r===""?void 0:Number(r),void 0)}),this.textInput.addEventListener("input",()=>this.readText()),this.textInput.addEventListener("focus",()=>this.showDeduction()),this.modeButton.addEventListener("click",()=>this.setPrecise(!this.precise)),this.helpButton.addEventListener("click",()=>Se.show(this.popup,this.popup.hidden)),this.applyWording()}connectedCallback(){this.build(),document.addEventListener("pointerdown",this.closeHelpOutside,!0),document.addEventListener("keydown",this.closeHelpOnEscape,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.closeHelpOutside,!0),document.removeEventListener("keydown",this.closeHelpOnEscape,!0)}closeHelpOutside=e=>{this.popup&&!this.popup.hidden&&!e.composedPath().includes(this)&&Se.show(this.popup,!1)};closeHelpOnEscape=e=>{e.key==="Escape"&&this.popup&&Se.show(this.popup,!1)};get input(){return this.build(),this.numberInput}get textField(){return this.build(),this.textInput}get isPrecise(){return this.build(),this.precise}set messages(e){this.wording=e,this.built&&this.applyWording()}applyWording(){const e=this.wording;if(!e)return;this.modeButton.title=e.durationModeTitle,this.modeButton.setAttribute("aria-label",e.durationModeTitle);const t=this.ownerDocument.createElement("p");t.textContent=e.durationHelpTitle;const i=this.ownerDocument.createElement("ul");for(const s of e.durationHelpLines.split(`
2650
+ `)){const n=this.ownerDocument.createElement("li");n.textContent=s,i.append(n)}this.popup.replaceChildren(t,i),this.setPrecise(this.precise)}setPrecise(e){this.build();const t=this.precise;this.precise=e,this.numberInput.hidden=!e,this.querySelector(".duration-unit").hidden=!e,this.textInput.hidden=e,this.helpButton.hidden=e,this.modeButton.textContent=(e?this.wording?.durationPrecise:this.wording?.durationIso)??"",this.modeButton.setAttribute("aria-pressed",String(!e)),!e&&t&&this.textInput.value===""&&this.numberInput.value!==""&&(this.textInput.value=ve.format(Number(this.numberInput.value))),this.showDeduction(),this.showChosen()}set(e,t){this.build(),this.numberInput.value=e===void 0?"":String(e),this.textInput.value=t??"",this.setPrecise(t===void 0)}readText(){const e=this.textInput.value.trim();if(this.showDeduction(),e===""){this.numberInput.value="",this.showChosen(),this.tell(void 0,void 0);return}const t=ve.parse(e);t&&(this.numberInput.value=String(t.chosenSeconds),this.showChosen(),this.tell(t.chosenSeconds,ve.isExact(e)?void 0:e))}tell(e,t){this.dispatchEvent(new CustomEvent("durationchange",{detail:{seconds:e,text:t},bubbles:!0,composed:!0}))}describe(e){const t=this.wording,i=e.minSeconds===e.maxSeconds?ve.say(e.minSeconds):`${ve.say(e.minSeconds)} – ${ve.say(e.maxSeconds)}`,s=t?e.doubt==="~"?t.timeQualifierApproximate:e.doubt==="?"?t.timeQualifierUncertain:e.doubt==="%"?t.timeQualifierBoth:"":"";return s?`${i} — ${s.toLowerCase()}`:i}showDeduction(){const e=this.textInput.value.trim();if(this.precise||e===""){this.textInput.title="";return}const t=ve.parse(e);this.textInput.title=t?`→ ${this.describe(t)}`:this.wording?.durationInvalid??""}showChosen(){const e=this.precise?void 0:ve.parse(this.textInput.value),t=e!==void 0&&!ve.isExact(this.textInput.value);this.chosen.hidden=!t,this.chosen.textContent=t&&this.wording?this.wording.durationChosen.replace("{value}",ve.say(e.chosenSeconds)):""}}function br(){customElements.get(Ht)||customElements.define(Ht,fr)}class wt{static at(e,t){if(e.year===void 0||t.year===void 0)return;let i=t.year-e.year;const s=(n,r)=>n!==void 0&&r!==void 0;return s(e.month,t.month)&&(t.month<e.month||t.month===e.month&&s(e.day,t.day)&&t.day<e.day)&&i--,i>=0?i:void 0}static birthFor(e,t){if(t.year===void 0)return;const i=t.year-e;return{year:i,raw:`${String(i).padStart(4,"0")}~`}}static isFirm(e){return!/[?~%]/.test(e.raw??"")}}class $t{static easter(e){const t=e%19,i=Math.floor(e/100),s=e%100,n=Math.floor(i/4),r=i%4,o=Math.floor((i+8)/25),l=Math.floor((i-o+1)/3),a=(19*t+i-n-l+15)%30,d=Math.floor(s/4),h=s%4,c=(32+2*r+2*d-a-h)%7,u=Math.floor((t+11*a+22*c)/451),p=Math.floor((a+c-7*u+114)/31),m=(a+c-7*u+114)%31+1;return new Date(Date.UTC(e,p-1,m,12))}static lunation(e){if(e<1583)return;const t=$t.easter(e),i=Kt(0,t,40);if(!i)return;const s=Kt(180,i.date,20),n=Kt(0,new Date(i.date.getTime()+864e5),40);if(!(!s||!n))return{begin:i.date,full:s.date,end:n.date}}static isIn(e){const t=$t.lunation(e.getUTCFullYear());return t!==void 0&&e>=t.begin&&e<t.end}}const vr=[{id:"echo",name:"the Echo balloons",from:"1960-08-12",to:"1969-06-07",peakMagnitude:-1,note:"Echo 1 and 2 were 30- and 40-metre reflective balloons, as bright as the brightest stars and moving slowly enough to be watched — deliberately visible, widely announced in newspapers, and the first objects most people ever saw crossing the night sky. They fall squarely inside the sighting waves this project reconstructs."},{id:"iridium-flares",name:"the Iridium flares",from:"1997-05-05",to:"2019-12-27",peakMagnitude:-8,note:"The original Iridium satellites carried flat, mirror-finish antennas that threw a sunbeam a few kilometres wide across the ground: a still point of sky flaring to magnitude -8 over five seconds and vanishing again. Nothing else in the sky does that."},{id:"iss",name:"the International Space Station",from:"1998-11-20",peakMagnitude:-5.9,note:"Since its first module, and much brighter as it grew: at its best it outshines everything in the sky but the Sun and the Moon, crossing in a straight silent line in about four minutes."},{id:"starlink-trains",name:"the Starlink trains",from:"2019-05-24",peakMagnitude:1,note:"In the days after a launch, satellites still bunched in their deployment string cross as an evenly spaced line of lights — the most reported 'formation of UFOs' of the era. They spread out within weeks, so a train is a fact about the days after a launch rather than about the year."}],wr=23493,as=[2,3,2,1,2,5,4,6,5,6,6,6,6,6,6,6,9,9,9,9,9,9,14,14,15,16,16,16,16,16,18,22,25,24,29,28,29,33,34,35,40,40,42,42,43,46,48,48,49,53,53,54,58,61,70,70,74,78,79,83,92,92,99,97,101,102,109,115,126,125,123,125,127,130,139,153,157,156,161,156,165,174,193,193,201,203,212,215,224,244,255,263,262,281,293,307,312,327,339,336,343,353,359,369,386,396,405,410,421,419,424,434,443,450,460,480,492,504,509,516,519,524,527,530,527,535,543,549,564,571,573,576,582,584,600,600,608,618,625,632,637,642,648,654,661,667,669,667,671,671,697,692,703,697,710,714,724,731,747,755,764,770,782,802,801,815,819,837,846,856,878,881,877,900,906,907,917,932,932,936,954,973,989,986,991,990,1002,1009,1021,1024,1040,1038,1058,1078,1098,1092,1094,1099,1122,1132,1140,1151,1154,1161,1176,1185,1202,1206,1227,1228,1243,1265,1281,1288,1296,1325,1328,1336,1354,1373,1375,1393,1398,1411,1432,1457,1462,1476,1487,1485,1506,1509,1521,1524,1537,1543,1563,1586,1598,1614,1621,1620,1640,1658,1660,1673,1670,1686,1708,1715,1726,1726,1745,1749,1767,1774,1790,1798,1803,1805,1815,1818,1819,1820,1833,1822,1821,1819,1838,1835,1845,1841,1851,1869,1865,1868,1871,1870,1879,1882,1886,1900,1899,1908,1921,1928,1954,1966,1976,1986,1999,2007,2015,2030,2036,2057,2067,2072,2077,2088,2101,2106,2112,2119,2127,2142,2171,2176,2203,2226,2242,2241,2244,2254,2263,2284,2300,2320,2327,2345,2364,2367,2402,2423,2425,2434,2443,2461,2476,2495,2505,2520,2531,2535,2556,2567,2599,2608,2625,2639,2660,2663,2668,2681,2695,2702,2709,2719,2720,2738,2746,2763,2778,2788,2796,2807,2822,2831,2831,2853,2863,2866,2883,2892,2895,2921,2919,2937,2941,2947,2964,2987,2992,2987,2995,3002,3021,3025,3026,3036,3052,3049,3059,3077,3075,3083,3086,3107,3123,3124,3146,3155,3168,3179,3204,3205,3211,3233,3252,3253,3276,3287,3294,3293,3297,3314,3326,3335,3338,3355,3362,3358,3365,3364,3376,3375,3382,3418,3429,3432,3455,3463,3483,3490,3502,3509,3521,3532,3542,3544,3553,3571,3580,3588,3596,3603,3633,3639,3649,3655,3660,3670,3699,3699,3707,3723,3747,3752,3754,3766,3772,3778,3781,3798,3815,3814,3824,3832,3853,3859,3879,3885,3899,3912,3910,3924,3937,3951,3951,3961,3963,3961,3976,3977,3988,4004,4018,4025,4047,4074,4086,4108,4133,4136,4159,4168,4182,4192,4200,4215,4230,4239,4257,4678,4698,4694,4713,4719,4739,4750,4756,4764,4771,4788,4792,4790,4809,4821,4829,4834,4836,4843,4853,4863,4872,4881,4890,4898,4901,4897,4895,4884,4886,4886,4894,4897,4905,4905,4909,4907,4925,4918,4920,4929,4925,4928,4936,4943,4944,4951,4955,4952,4974,4976,4975,4981,4994,4997,5022,5023,5032,5043,5048,5051,5066,5062,5068,5075,5082,5082,5098,5102,5110,5113,5119,5123,5138,5138,5145,5149,5157,5165,5166,5169,5178,5183,5190,5192,5203,5204,5207,5214,5228,5234,5245,5249,5256,5262,5275,5278,5305,5303,5315,5321,5348,5358,5369,5369,5372,5385,5402,5409,5427,5429,5429,5439,5456,5464,5481,5485,5494,5509,5520,5526,5543,5555,5568,5575,5585,5596,5602,5620,5627,5644,5647,5660,5678,5680,5684,5692,5700,5711,5727,5733,5736,5756,5776,5797,5805,5804,5807,5800,5808,5814,5822,5839,5856,5869,5889,5902,5919,5921,5936,5937,5936,5957,5961,5975,5981,6002,6015,6027,6035,6042,6059,6062,6080,6081,6092,6097,6106,6127,6129,6198,6227,6231,6243,6249,6262,6255,6279,6304,6315,6326,6330,6334,6361,6358,6359,6379,6381,6389,6388,6404,6404,6443,6465,6473,6497,6500,6513,6524,6532,6538,6578,6572,6576,6584,6582,6608,6639,6656,6761,6764,6768,6772,6836,6905,6916,6925,6951,6984,7009,7072,7092,7110,7122,7140,7148,7170,7168,7180,7194,7247,7374,7391,7393,7382,7425,7485,7530,7568,7587,7602,7602,7715,7771,7900,8004,8103,8153,8162,8296,8319,8437,8566,8746,8860,8913,9128,9275,9585,9739,10014,10123,10167,10203,10288,10323,10398,10544,10721,10883,11044,11157,11442,11515,11787,12070,12269,12468,12484,12619,12883,13008,13264,13317,13549,13859,14049,14175,14360,14498,14687,14843,14984,15093,15279,15431,15623,15741,15788,15966,16025,16132,16419,16568,16791,16892,17060,17269,17598,17959,18194,18482,18804,19136,19564,19990,20249,20509,20943,21248,21539,21845,22196,22412];class be{static FIRST_ORBIT="1957-10-04";static EARTH_RADIUS_KM=6371;static LOW_ORBIT_KM=500;static shadowHeightKm(e){if(e>=0)return 0;const t=-e*Math.PI/180;return be.EARTH_RADIUS_KM*(1/Math.cos(t)-1)}static isLitOverhead(e,t){return e>be.shadowHeightKm(t)}static classesAt(e){const t=e.getTime();return vr.filter(i=>{const s=Date.parse(`${i.from}T00:00:00Z`),n=i.to===void 0?1/0:Date.parse(`${i.to}T23:59:59Z`);return t>=s&&t<=n})}static trackedInOrbitAt(e){const t=e.getUTCFullYear()*12+e.getUTCMonth()-wr;if(!(t<0))return as[Math.min(t,as.length-1)]}static visibilityAt(e,t){const i=K("Sun",e,t).altitudeDeg;return{sunAltitudeDeg:i,shadowHeightKm:be.shadowHeightKm(i),lowOrbitLit:be.isLitOverhead(be.LOW_ORBIT_KM,i),classes:be.classesAt(e),trackedObjects:be.trackedInOrbitAt(e),anythingInOrbit:e.getTime()>=Date.parse(`${be.FIRST_ORBIT}T00:00:00Z`)}}}const yr="https://ufoathome.org/light-pollution/index.json";class Ue{year=2015;citation="World Atlas of the artificial night sky brightness (Falchi et al. 2016, doi:10.1126/sciadv.1600377; data doi:10.5880/GFZ.1.4.2016.001, CC BY-NC 4.0)";static NATURAL_MCD=.171168;fetchImpl;indexUrls;index;tiles=new Map;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.indexUrls=e.indexUrls??Ue.defaultIndexUrls()}static defaultIndexUrls(){const e=typeof location>"u"?void 0:new URL("/light-pollution/index.json",location.href).href;return[...new Set([e,yr].filter(t=>t!==void 0))]}static magPerArcsec2Of(e){return-2.5*Math.log10((e+Ue.NATURAL_MCD)/108e6)}static mcdOf(e,t){return e===0?0:t.floorMcd*10**((e-1)/t.subdivisions)}async lookUp(e,t){const i=await this.loadIndex();if(!i)return{status:"failed"};const{index:s,base:n,present:r}=i;if(!(e<s.north&&e>=s.south))return{status:"outside"};const o=((t+180)%360+360)%360-180,l=Math.floor((s.north-e)/s.tileDeg),a=Math.floor((o+180)/s.tileDeg),d=l*(360/s.tileDeg)+a;if(!(r[d>>3]&1<<(d&7)))return{status:"natural"};const h=s.north-l*s.tileDeg,c=-180+a*s.tileDeg,u=Ue.nameOf(h-s.tileDeg,c),p=await this.tile(`${n}${u}.bin`);if(!p)return{status:"failed"};const m=s.tileDeg/s.cells,f=Math.min(s.cells-1,Math.floor((h-e)/m)),g=Math.min(s.cells-1,Math.floor((o-c)/m)),b=Ue.mcdOf(p[f*s.cells+g],s);return b===0?{status:"natural"}:{status:"found",lightPollution:Math.round(Ue.magPerArcsec2Of(b)*100)/100,artificialMcdPerM2:b,lat:h-(f+.5)*m,lng:c+(g+.5)*m}}static nameOf(e,t){const i=`${e<0?"S":"N"}${String(Math.abs(e)).padStart(2,"0")}`,s=`${t<0?"W":"E"}${String(Math.abs(t)).padStart(3,"0")}`;return i+s}loadIndex(){return this.index??=(async()=>{for(const e of this.indexUrls)try{const t=await this.fetchImpl(e);if(!t.ok)continue;const i=await t.json(),s=Uint8Array.from(atob(i.present),n=>n.charCodeAt(0));return{index:i,base:new URL(".",e).href,present:s}}catch{}})(),this.index.then(e=>{e||(this.index=void 0)}),this.index}tile(e){let t=this.tiles.get(e);return t||(t=(async()=>{try{const i=await this.fetchImpl(e);if(!i.ok||!i.body)return;const s=i.body.pipeThrough(new DecompressionStream("deflate-raw"));return new Uint8Array(await new Response(s).arrayBuffer())}catch{return}})(),this.tiles.set(e,t),t.then(i=>{i||this.tiles.delete(e)})),t}}const yt=de.point("lightPollution").provide(de.BUILT_IN,[{id:"falchi-2015",name:"World Atlas 2015",credit:"Falchi et al. 2016, CC BY-NC 4.0",creditUrl:"https://doi.org/10.5880/GFZ.1.4.2016.001",create:()=>new Ue}]);class O{static COARSE_STEP_DEG=10;static FINE_STEP_DEG=2;static FINE_SPAN_DEG=10;static LOWEST_DEG=5;static THRESHOLD_CONTRAST=.5;static CONE_SEPARATION_DEG=60;galaxy=new nn;dust=new rn;assess(e,t,i){const s=K("Sun",e,t),n=K("Moon",e,t),r={altitudeDeg:n.altitudeDeg,phaseAngleDeg:ue.phaseAngleOf(Ze(e).illuminatedFraction)},o=Li.galactic(e,t),l=O.unit(o.centre),a=O.unit(o.rotation),d=O.unit(o.pole),h=O.unit(Li.eclipticPole(e,t)),c=O.unit(s),u=O.unit(n),p=O.normalize(O.reject(c,h));let m,f,g=0;const b=(v,I)=>{const S=O.unit({altitudeDeg:v,azimuthDeg:I}),w=O.between(S,c),x=ue.magPerArcsec2({altitudeDeg:s.altitudeDeg,separationDeg:w},{...r,separationDeg:O.between(S,u)},v,i);x>g&&(g=x);const C=Di.fromMagPerArcsec2(x),B=10**(-.4*ue.EXTINCTION_PER_AIR_MASS*(ue.airMass(v)-1)),A=this.galaxy.surfaceBrightnessS10(Math.atan2(O.dot(S,a),O.dot(S,l))*180/Math.PI,Math.asin(Math.max(-1,Math.min(1,O.dot(S,d))))*180/Math.PI)*B;m=O.better(m,A,C,x,v,I,w);const ee=Math.max(-1,Math.min(1,O.dot(S,h))),q=O.normalize(O.reject(S,h)),Ae=this.dust.surfaceBrightnessS10(O.between(q,p),Math.asin(ee)*180/Math.PI)*B;f=O.better(f,Ae,C,x,v,I,w)};for(let v=O.LOWEST_DEG;v<=90;v+=O.COARSE_STEP_DEG)for(let I=0;I<360;I+=O.COARSE_STEP_DEG)b(v,I);for(const v of[m,f]){if(!v)continue;const I=O.FINE_SPAN_DEG,S=O.FINE_STEP_DEG;for(let w=v.altitudeDeg-I;w<=v.altitudeDeg+I;w+=S)if(!(w<O.LOWEST_DEG||w>90))for(let x=v.azimuthDeg-I;x<=v.azimuthDeg+I;x+=S)b(w,(x+360)%360)}return{milkyWay:m&&m.contrast>=O.THRESHOLD_CONTRAST?m:void 0,zodiacal:f&&f.contrast>=O.THRESHOLD_CONTRAST?f:void 0,darkestSkyMagPerArcsec2:g}}static better(e,t,i,s,n,r,o){const l=t/i;return e&&e.contrast>=l?e:{contrast:l,altitudeDeg:n,azimuthDeg:r,magPerArcsec2:Di.toMagPerArcsec2(t),skyMagPerArcsec2:s,sunSeparationDeg:o}}static unit(e){const t=e.altitudeDeg*Math.PI/180,i=e.azimuthDeg*Math.PI/180,s=Math.cos(t);return[s*Math.sin(i),Math.sin(t),-s*Math.cos(i)]}static dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}static between(e,t){return Math.acos(Math.max(-1,Math.min(1,O.dot(e,t))))*180/Math.PI}static reject(e,t){const i=O.dot(e,t);return[e[0]-i*t[0],e[1]-i*t[1],e[2]-i*t[2]]}static normalize(e){const t=Math.hypot(...e)||1;return[e[0]/t,e[1]/t,e[2]/t]}}class _{static MIN_NAME_LENGTH=3;static EMAIL=/[\p{L}\d._%+-]+@[\p{L}\d-]+(?:\.[\p{L}\d-]+)+/u;static PHONE=/(?:\+\d{1,3}[ .-]?|\b0)\d(?:[ .-]?\d{2}){4}\b|\+\d[\d ().-]{8,}\d/;static ADDRESS=new RegExp("\\b\\d{1,4}\\s?(?:bis|ter)?,?\\s+(?:rue|avenue|av\\.|boulevard|bd|chemin|impasse|allée|route|place|street|st\\.|road|rd|lane|drive|via|calle|piazza)\\b","iu");static inspect(e,t){const i=new Set((t?_.all(t):[]).map(s=>`${s.kind}:${s.found}`));return _.all(e).filter(s=>!i.has(`${s.kind}:${s.found}`))}static initialsOf(e){return e.trim().split("-").map(t=>{const i=[...t.trim()][0];return i===void 0?"":`${i.toLocaleUpperCase()}.`}).filter(t=>t!=="").join("-")}static withInitials(e,t,i=!1){let s=e;for(const n of _.usable(t)){const r=_.initialsOf(n);s=s.replace(new RegExp(_.escape(n),"giu"),i?r.replace(/[.-]/g,""):r)}return s}static namesOf(e){const t=e.observer,i=[t?.lastName,...t?.firstNames??[]];return _.usable(i.filter(s=>typeof s=="string"))}static isInitials(e){const t=e.replace(/[^\p{L}]/gu,"");return t.length>0&&t.length<=3&&t===t.toLocaleUpperCase()}static usable(e){return e.map(t=>(t??"").trim()).filter(t=>t.length>=_.MIN_NAME_LENGTH&&!_.isInitials(t))}static all(e){const t=[],i=e.observer,s=_.usable([i?.lastName]),n=_.usable(i?.firstNames??[]);for(const o of s)t.push({kind:"lastName",found:o});for(const o of n)t.push({kind:"firstNames",found:o});const r=[...s,...n];for(const o of[e.id,i?.id])for(const l of r)o&&o.toLocaleLowerCase().includes(l.toLocaleLowerCase())&&t.push({kind:"nameInId",found:`${o}`});for(const o of _.texts(e)){for(const h of r)new RegExp(`(?<![\\p{L}])${_.escape(h)}(?![\\p{L}])`,"iu").test(o)&&t.push({kind:"nameInText",found:h});const l=_.ADDRESS.exec(o)?.[0];l&&t.push({kind:"address",found:l});const a=_.EMAIL.exec(o)?.[0];a&&t.push({kind:"email",found:a});const d=_.PHONE.exec(o)?.[0];d&&t.push({kind:"phone",found:d})}return _.unique(t)}static texts(e){const t=n=>typeof n=="string"?[n]:typeof n=="object"&&n!==null?Object.values(n).filter(r=>typeof r=="string"):[],i=e.place,s=i===void 0?[]:[i.name??i.value?.name];return[...t(e.description),...t(e.summary),...t(e.account?.observerOccupation),...s.flatMap(t)]}static unique(e){const t=new Set;return e.filter(i=>{const s=`${i.kind}:${i.found}`;return t.has(s)?!1:(t.add(s),!0)})}static escape(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}const Er=.5,Et=40,kr=4e5,kt=36e5,ls=25;class tt{constructor(e){this.provider=e}queryOf(e){const t=this.questionOf(e);return t?{points:this.sampleTimings(e,t.start,Pt(e.event)??0).map(s=>this.pointAt(e,s,t.origin))}:void 0}async infer(e){const t=this.questionOf(e);if(!t)return{status:"incomplete"};const{start:i}=t,s=Pt(e.event)??0,n=this.sampleTimings(e,i,s);let r;try{r=await this.provider.getWeather(this.queryOf(e))}catch{return{status:"failed",at:i}}return r?{status:"inferred",at:i,source:r.source,keyframes:r.samples.map((o,l)=>({t:n[l].t,weather:o.weather}))}:{status:"unavailable",at:i}}applyTo(e,t){if(!(t.status!=="inferred"||!t.keyframes||!t.source)){e.weatherTrack.clear();for(const i of t.keyframes)e.weatherTrack.addKeyframe(i.t,i.weather);e.weatherSource=t.source}}sampleTimes(e,t){const i=[e],s=e.getTime()+t;let n=Math.floor(e.getTime()/kt)*kt+kt;for(;n<=s&&i.length<ls;)i.push(new Date(n)),n+=kt;return t>0&&i[i.length-1].getTime()!==s&&i.length<ls&&i.push(new Date(s)),i}sampleTimings(e,t,i){const s=e.timeline.duration>0?e.timeline.duration:i;return i<=0||s<=0?[{time:t,t:0}]:this.sampleTimes(t,i).map(n=>{const r=(n.getTime()-t.getTime())/i;return{time:n,t:Math.round(s*Math.max(0,Math.min(1,r)))}})}canInfer(e){return this.questionOf(e)!==void 0}missingOf(e){const t=e.event.time;return{date:t?.year===void 0||t.month===void 0||t.day===void 0,place:this.originOf(e)===void 0}}questionOf(e){const t=this.originOf(e);if(!t)return;const i=e.event.time;if(i?.year===void 0||i.month===void 0||i.day===void 0)return;const s=fe(i,t.lng,e.event.utcOffsetHours);return s?{origin:t,start:s}:void 0}originOf(e){const t=X(e,0),i=e.event.place?.[0],s=t?.lat??i?.lat,n=t?.lng??i?.lng;return s===void 0||n===void 0?void 0:{lat:s,lng:n}}pointAt(e,t,i){const s=X(e,t.t);return{lat:s?.lat??i.lat,lng:s?.lng??i.lng,time:t.time}}}const Sr=Date.UTC(1940,0,1),ds=36e5,hs=.25,xr=.7,Ir=.45,Tr=.1,Mr=2,Lr=.3,Dr=.2,Ar=8,ti=.125,Cr=.05,cs=125,us=100,ps=2500,ii=3500,si=8e3,Or=95,Rr=99,Pr=[96,99],Br=["cloud_cover","cloud_cover_low","cloud_cover_mid","cloud_cover_high","precipitation","snowfall","weather_code","wind_speed_10m","wind_direction_10m","temperature_2m","dew_point_2m"],Fr=5;class Fs{fetchImpl;baseUrl;forecastUrl;now;cache=new Map;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.baseUrl=e.baseUrl??"https://archive-api.open-meteo.com/v1/archive",this.forecastUrl=e.forecastUrl??"https://api.open-meteo.com/v1/forecast",this.now=e.now??(()=>new Date)}async getWeather(e){if(e.points.length===0)return;const t=e.points.map(d=>d.time.getTime()),i=Math.min(...t);if(i<Sr)return;const s=new Map;for(const d of e.points){const h=this.cellKey(d);s.has(h)||s.set(h,{lat:d.lat,lng:d.lng,index:s.size})}const n=i>=this.now().getTime()-Fr*864e5,r=this.requestUrl([...s.values()],new Date(i),new Date(Math.max(...t)),n);let o=this.cache.get(r);if(!o){const d=await this.fetchImpl(r);if(!d.ok)throw new Error(`Open-Meteo HTTP ${d.status}`);const h=await d.json();if(o=Array.isArray(h)?h:[h],o.length<s.size||o.some(c=>c.error||!c.hourly))return;this.cache.set(r,o)}const l=n?{id:"open-meteo-forecast",name:"Open-Meteo (forecast model)",url:r}:{id:"era5",name:"ERA5 (Open-Meteo)",url:r},a=e.points.map(d=>this.sampleAt(o[s.get(this.cellKey(d)).index].hourly,d.time));if(!a.some(d=>d===void 0))return{samples:a,source:l}}cellKey(e){return`${Math.round(e.lat/hs)},${Math.round(e.lng/hs)}`}requestUrl(e,t,i,s){const n=new URLSearchParams({latitude:e.map(r=>r.lat).join(","),longitude:e.map(r=>r.lng).join(","),start_date:this.isoDate(t),end_date:this.isoDate(i),hourly:Br.join(","),wind_speed_unit:"ms",timezone:"UTC"});return`${s?this.forecastUrl:this.baseUrl}?${n}`}isoDate(e){return e.toISOString().slice(0,10)}sampleAt(e,t){const i=this.recordAt(e,t);return i&&{time:t,weather:this.toWeather(i)}}recordAt(e,t){const i=e.time.map(o=>Date.parse(`${o}Z`)),s=t.getTime();if(i.length===0||s<i[0]-ds||s>i[i.length-1]+ds)return;if(s<=i[0])return this.recordFrom(e,0);if(s>=i[i.length-1])return this.recordFrom(e,i.length-1);let n=0;for(;n+1<i.length&&i[n+1]<=s;)n++;const r=i[n+1]-i[n];return this.blendRecords(this.recordFrom(e,n),this.recordFrom(e,n+1),r>0?(s-i[n])/r:0)}recordFrom(e,t){const i={cloudCover:e.cloud_cover[t]/100,cloudCoverLow:e.cloud_cover_low[t]/100,cloudCoverMid:e.cloud_cover_mid[t]/100,cloudCoverHigh:e.cloud_cover_high[t]/100,precipitationMm:e.precipitation[t],snowfallCm:e.snowfall[t],weatherCode:e.weather_code[t],windSpeedMs:e.wind_speed_10m[t],windFromDeg:e.wind_direction_10m[t],temperatureC:e.temperature_2m[t],dewPointC:e.dew_point_2m[t]};return Object.values(i).some(s=>s===void 0||Number.isNaN(s))?void 0:i}blendRecords(e,t,i){if(!e||!t)return e??t;const s=(r,o)=>r+(o-r)*i,n=((t.windFromDeg-e.windFromDeg)%360+540)%360-180;return{cloudCover:s(e.cloudCover,t.cloudCover),cloudCoverLow:s(e.cloudCoverLow,t.cloudCoverLow),cloudCoverMid:s(e.cloudCoverMid,t.cloudCoverMid),cloudCoverHigh:s(e.cloudCoverHigh,t.cloudCoverHigh),precipitationMm:s(e.precipitationMm,t.precipitationMm),snowfallCm:s(e.snowfallCm,t.snowfallCm),weatherCode:i<.5?e.weatherCode:t.weatherCode,windSpeedMs:s(e.windSpeedMs,t.windSpeedMs),windFromDeg:((e.windFromDeg+n*i)%360+360)%360,temperatureC:s(e.temperatureC,t.temperatureC),dewPointC:s(e.dewPointC,t.dewPointC)}}cloudLayersFrom(e){return[{id:"record-low",type:"unknown",baseM:Math.round(this.clamp(cs*(e.temperatureC-e.dewPointC),us,ps)),thicknessM:650,coverage:this.clamp(e.cloudCoverLow,0,1),sizeM:1400,density:1},{id:"record-mid",type:"unknown",baseM:ii,thicknessM:800,coverage:this.clamp(e.cloudCoverMid,0,1),sizeM:2500,density:1},{id:"record-high",type:"cirrus",baseM:si,thicknessM:400,coverage:this.clamp(e.cloudCoverHigh,0,1),sizeM:2200,density:.35}]}toWeather(e){const t=e.weatherCode>=Or&&e.weatherCode<=Rr,i=this.precipitationTypeFrom(e);return{cloudLayers:this.cloudLayersFrom(e),cloudCover:this.clamp(e.cloudCover,0,1),cloudDarkness:this.cloudDarknessFrom(e,t),cloudBaseM:this.cloudBaseFrom(e),highCloudCover:e.cloudCoverHigh,lowerCloudCover:Math.max(e.cloudCoverLow,e.cloudCoverMid),relativeHumidity:Math.round(on.relativeHumidity(e.temperatureC,e.dewPointC)*100)/100,precipitationType:i,precipitationIntensity:i==="none"?0:this.clamp(Math.sqrt(e.precipitationMm/Ar),0,1),windDirectionDeg:(e.windFromDeg+180)%360,windSpeed:e.windSpeedMs,storm:t}}precipitationTypeFrom(e){return e.snowfallCm>0?"snow":Pr.includes(e.weatherCode)?"hail":e.precipitationMm>0?"rain":"none"}cloudDarknessFrom(e,t){const i=e.cloudCoverLow+e.cloudCoverMid+e.cloudCoverHigh;if(i<=0)return 0;const s=(xr*e.cloudCoverLow+Ir*e.cloudCoverMid+Tr*e.cloudCoverHigh)/i,n=Math.min(1,e.precipitationMm/Mr);return this.clamp(s+Lr*n+(t?Dr:0),0,1)}cloudBaseFrom(e){if(e.cloudCover<Cr)return;const t=this.clamp(cs*(e.temperatureC-e.dewPointC),us,ps);if(e.cloudCoverLow>=ti)return Math.round(t);if(e.cloudCoverMid>=ti)return ii;if(e.cloudCoverHigh>=ti)return si;const i=Math.max(e.cloudCoverLow,e.cloudCoverMid,e.cloudCoverHigh);if(!(i<=0))return i===e.cloudCoverLow?Math.round(t):i===e.cloudCoverMid?ii:si}clamp(e,t,i){return Math.max(t,Math.min(i,e))}}function Nr(){return new Fs}const zr=5;class Ns{attribution={text:"© OpenStreetMap",url:"https://osm.org/copyright"};fetchImpl;baseUrl;reverseUrl;cache=new Map;constructor(e={}){this.fetchImpl=e.fetchImpl??fetch.bind(globalThis),this.baseUrl=e.baseUrl??"https://nominatim.openstreetmap.org/search",this.reverseUrl=e.reverseUrl??"https://nominatim.openstreetmap.org/reverse"}async reverse(e,t,i={}){const s=new URLSearchParams({lat:String(e),lon:String(t),format:"jsonv2"});i.language&&s.set("accept-language",i.language);const n=`${this.reverseUrl}?${s}`,r=this.cache.get(n);if(r)return r[0];const o=await this.fetchImpl(n,{signal:i.signal});if(!o.ok)throw new Error(`Nominatim HTTP ${o.status}`);const l=await o.json(),a=l.error?void 0:this.toMatch(l);return this.cache.set(n,a?[a]:[]),a}async search(e,t={}){const i=e.trim();if(i==="")return[];const s=this.requestUrl(i,t),n=this.cache.get(s);if(n)return n;const r=await this.fetchImpl(s,{signal:t.signal});if(!r.ok)throw new Error(`Nominatim HTTP ${r.status}`);const o=await r.json(),l=(Array.isArray(o)?o:[]).map(a=>this.toMatch(a)).filter(a=>a!==void 0);return this.cache.set(s,l),l}requestUrl(e,t){const i=new URLSearchParams({q:e,format:"jsonv2",limit:String(t.limit??zr)});return t.language&&i.set("accept-language",t.language),`${this.baseUrl}?${i}`}toMatch(e){const t=e.display_name??e.name,i=this.coordinate(e.lat),s=this.coordinate(e.lon);return t&&i!==void 0&&s!==void 0?{name:t,lat:i,lng:s}:void 0}coordinate(e){if(e===void 0||e.trim()==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}}function _r(){return new Ns}const ni=de.point("place").provide(de.BUILT_IN,[{id:"nominatim",name:"Nominatim",credit:"© OpenStreetMap",creditUrl:"https://osm.org/copyright",create:()=>new Ns}]),ye=de.point("weather").provide(de.BUILT_IN,[{id:"era5",name:"Open-Meteo",credit:"© Copernicus/ECMWF",creditUrl:"https://open-meteo.com/en/docs/historical-weather-api",create:()=>new Fs}]),St=E=>E.id==="open-meteo-forecast"||ye.some(e=>e.id===E.id);class ms{static of(e,t){if(!t)return e;let i,s;try{i=new URL(e),s=new URL(t)}catch{return e}if(i.origin!==s.origin||!/^https?:$/.test(i.protocol))return e;const n=s.pathname.split("/").slice(0,-1),r=i.pathname.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const l=n.length-o;return[...Array(l).fill(".."),...r.slice(o)].join("/")+i.search+i.hash}static names(e,t,i){return(e??[]).some(s=>{try{return new URL(s,i??t).href===t}catch{return!1}})}}class dt{constructor(e,t){this.root=e,this.messages=t}static STYLE=`
2651
+ .model-picker-button { display: inline-flex; align-items: center; gap: .5em; cursor: pointer; max-width: 100%; }
2652
+ .model-picker-button img { width: 2em; height: 1.5em; object-fit: contain; }
2653
+ .model-picker-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2654
+ .model-picker-backdrop { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); }
2655
+ .model-picker { color-scheme: light dark; box-sizing: border-box; width: min(56em, 94vw); max-height: 86vh; display: flex; flex-direction: column; background: light-dark(#fff, #1e1f22); color: light-dark(#222, #e6e6e6); border-radius: 6px; box-shadow: 0 4px 24px rgba(0, 0, 0, .5); font-size: .95em; }
2656
+ .model-picker header { display: flex; align-items: center; padding: .6em 1em; border-bottom: 1px solid light-dark(#ddd, #4a4c52); }
2657
+ .model-picker .model-picker-close { width: 2em; height: 2em; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: light-dark(#fff, #1e1f22); color: light-dark(#222, #e6e6e6); border: none; border-radius: 50%; font-size: 1em; line-height: 1; cursor: pointer; }
2658
+ .model-picker .model-picker-close:hover, .model-picker .model-picker-close:focus-visible { background: light-dark(#ddd, #4a4c52); outline: none; }
2659
+ .model-picker .model-picker-add { width: 2em; height: 2em; padding: 0; margin-left: auto; margin-right: .4em; display: inline-flex; align-items: center; justify-content: center; background: light-dark(#fff, #1e1f22); color: light-dark(#222, #e6e6e6); border: none; border-radius: 50%; font-size: 1.2em; line-height: 1; cursor: pointer; }
2660
+ .model-picker .model-picker-add:hover, .model-picker .model-picker-add:focus-visible, .model-picker .model-picker-add[aria-expanded="true"] { background: light-dark(#ddd, #4a4c52); outline: none; }
2661
+ .model-picker .model-picker-address { display: grid; gap: .4em; padding: .6em 1em; border-bottom: 1px solid light-dark(#ddd, #4a4c52); background: light-dark(#f6f6f8, #2c2e33); }
2662
+ .model-picker .model-picker-address[hidden] { display: none; }
2663
+ .model-picker .model-picker-address label { display: grid; grid-template-columns: 11em 1fr; align-items: center; gap: .5em; }
2664
+ .model-picker .model-picker-address input { min-width: 0; }
2665
+ .model-picker input, .model-picker textarea { font-size: var(--rr0-input-font-size, 13px); }
2666
+ .model-picker :is(${Le.FREE}) { font-family: ${Le.FAMILY}; }
2667
+ .model-picker .model-picker-address p { margin: 0; }
2668
+ ${F.rules([],[".model-picker .model-picker-address p"])}
2669
+ .model-picker .model-picker-address .model-picker-use { justify-self: start; }
2670
+ .model-picker h2 { margin: 0; font-size: 1.1em; }
2671
+ .model-picker .model-picker-body { overflow-y: auto; padding: .5em 1em 1em; }
2672
+ .model-picker h3 { margin: .8em 0 .4em; font-size: .95em; color: #555; }
2673
+ .model-picker .model-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10em, 1fr)); gap: .6em; }
2674
+ .model-picker .model-card { display: flex; flex-direction: column; align-items: center; gap: .25em; padding: .5em; text-align: center; background: light-dark(#f6f6f8, #2c2e33); color: inherit; border: 2px solid transparent; border-radius: 4px; cursor: pointer; font: inherit; }
2675
+ .model-picker .model-card:hover, .model-picker .model-card:focus-visible { background: light-dark(#eef, #3a3d52); border-color: light-dark(#99c, #8a8fd0); outline: none; }
2676
+ .model-picker .model-card[aria-pressed="true"] { border-color: light-dark(#46c, #8fa2ff); }
2677
+ .model-picker .model-thumb { position: relative; overflow: hidden; width: 100%; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: #e4e4ea; border-radius: 3px; color: #889; }
2678
+ .model-picker .model-thumb:has(.model-live) > img { visibility: hidden; }
2679
+ .model-picker .model-thumb img { width: 100%; height: 100%; object-fit: contain; }
2680
+ .model-picker .model-name { font-weight: 600; }
2681
+ .model-picker .model-credit { font-size: .8em; color: #666; }
2682
+ `;static async pictureOf(e){if(!e)return;const{ModelThumbnails:t}=await M(async()=>{const{ModelThumbnails:i}=await import("./ModelThumbnails-CASGbavJ.js");return{ModelThumbnails:i}},__vite__mapDeps([2,3,1,4,5,6,7,8,9,10]),import.meta.url);return t.of(e)}enhance(e,t,i){this.ensureStyle();const s=document.createElement("button");s.type="button",s.className="model-picker-button",e.after(s),e.hidden=!0;let n=0,r;const o=()=>{const a=++n,d=e.selectedOptions[0],h=e.value===""?i?.current():void 0,c=JSON.stringify([e.value,d?.textContent,h?.url,h?.title,this.messages().choose,[...e.options].map(m=>m.value).join()]);if(c===r){--n;return}r=c,s.replaceChildren();const u=document.createElement("span");u.textContent=`${h?h.title||h.url:d?.textContent??""} …`,s.title=this.messages().choose,s.append(u);const p=e.value;(h?Promise.resolve({url:h.url}):t(p)).then(m=>dt.pictureOf(m)).then(m=>{if(!m||a!==n)return;const f=new Image;f.src=m,f.alt="",s.prepend(f)})};e.addEventListener("change",o),new MutationObserver(o).observe(e,{childList:!0,subtree:!0});const l=i&&{current:()=>i.current(),apply:a=>{i.apply(a),o()}};s.addEventListener("click",()=>void this.open(e,t,l)),o()}chooseFrom(e,t,i,s){this.ensureStyle(),this.open(e,t,s,i)}ensureStyle(){const e=this.root instanceof ShadowRoot?this.root:this.root.getRootNode(),t=e instanceof ShadowRoot?e:document.head;if(t.querySelector("style[data-model-picker]"))return;const i=document.createElement("style");i.dataset.modelPicker="",i.textContent=dt.STYLE,t.append(i)}open(e,t,i,s){const n=this.messages(),r=document.createElement("div");r.className="model-picker-backdrop";const o=document.createElement("div");o.className="model-picker",o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true");const l=document.createElement("h2");l.textContent=n.title;const a=document.createElement("button");a.type="button",a.className="model-picker-close",a.setAttribute("aria-label",n.close),a.title=n.close,a.innerHTML=D.CLOSE;const d=document.createElement("header");d.append(l,a);const h=document.createElement("div");h.className="model-picker-body",o.append(d,h),r.append(o);const c=()=>{r.remove(),document.removeEventListener("keydown",u,!0),M(async()=>{const{ModelViewer:x}=await import("./ModelViewer-DEaj6_6R.js");return{ModelViewer:x}},__vite__mapDeps([11,3,1,4,5,6,7,8,9,10]),import.meta.url).then(({ModelViewer:x})=>x.end())},u=x=>{x.key==="Escape"&&(x.stopPropagation(),c())},p=i?.current(),m="\0address",f=x=>x===m&&p?Promise.resolve({url:p.url}):t(x),g=x=>{if(c(),s){x!==m&&s(x);return}x===m||x===e.value||(e.value=x,e.dispatchEvent(new Event("change",{bubbles:!0})))};let b;const v=new Map,I=x=>{const C=document.createElement("button");C.type="button",C.className="model-card",C.dataset.value=x.value,C.setAttribute("aria-pressed",String(!s&&(x.value===m||x.value===e.value&&!p)));const B=document.createElement("div");B.className="model-thumb";const A=document.createElement("span");if(A.className="model-name",A.textContent=x.textContent,C.append(B,A),x.title){const k=document.createElement("span");k.className="model-credit",k.textContent=x.title,C.append(k)}f(x.value).then(k=>dt.pictureOf(k)).then(k=>{if(!k)return;const T=new Image;T.src=k,T.alt="",B.append(T)});let ee,q=!1;const Ae=()=>{q&&!(ee&&!ee.active)||(q=!0,Promise.all([f(x.value),M(()=>import("./ModelViewer-DEaj6_6R.js"),__vite__mapDeps([11,3,1,4,5,6,7,8,9,10]),import.meta.url)]).then(([k,{ModelViewer:T}])=>{!k||!q||(ee=T.show(B,k))}).catch(()=>{}))},We=()=>{q=!1,ee?.stop(),ee=void 0};return v.set(C,Ae),C.addEventListener("pointerenter",Ae),C.addEventListener("focus",Ae),C.addEventListener("pointerleave",()=>{document.activeElement!==C&&We()}),C.addEventListener("blur",We),C.addEventListener("click",k=>{if(ee?.consumeDrag()){k.preventDefault();return}g(x.value)}),C},S=()=>(b=document.createElement("div"),b.className="model-picker-grid",h.append(b),b);if(p){const x=new Option(p.title||p.url,m);x.title=[p.author,p.license].filter(Boolean).join(" — "),S().append(I(x))}for(const x of Array.from(e.children))if(x instanceof HTMLOptGroupElement){const C=document.createElement("h3");C.textContent=x.label,h.append(C);const B=S();for(const A of Array.from(x.children))B.append(I(A));b=void 0}else x instanceof HTMLOptionElement&&(b??S()).append(I(x));i&&this.addAddressForm(d,a,o,h,i,n,c),a.addEventListener("click",c),r.addEventListener("click",x=>{x.target===r&&c()}),document.addEventListener("keydown",u,!0),this.root.append(r);const w=o.querySelector('.model-card[aria-pressed="true"]');(w??a).focus(),w&&v.get(w)?.()}addAddressForm(e,t,i,s,n,r,o){const l=document.createElement("button");l.type="button",l.className="model-picker-add",l.textContent="+",l.title=r.address,l.setAttribute("aria-label",r.address),l.setAttribute("aria-expanded","false"),e.insertBefore(l,t);const a=document.createElement("form");a.className="model-picker-address",a.hidden=!0;const d=(v,I,S="")=>{const w=document.createElement("label"),x=document.createElement("span");x.textContent=v;const C=document.createElement("input");return C.type=I,C.placeholder=S,w.append(x,C),a.append(w),C},h=d(r.addressUrl,"url","https://…/model.glb"),c=d(r.addressName,"text"),u=d(r.addressAuthor,"text"),p=d(r.addressLicense,"text","CC0 1.0"),m=d(r.addressSource,"url","https://…"),f=document.createElement("p");f.textContent=r.addressIncomplete;const g=document.createElement("button");g.type="submit",g.className="model-picker-use",g.textContent=r.addressUse,a.append(f,g),i.insertBefore(a,s);const b=()=>{g.disabled=h.value.trim()==="",f.hidden=h.value.trim()===""||c.value.trim()!==""&&p.value.trim()!==""};for(const v of[h,c,u,p,m])v.addEventListener("input",b);l.addEventListener("click",()=>{const v=a.hidden;if(a.hidden=!v,l.setAttribute("aria-expanded",String(v)),!v)return;const I=n.current();h.value=I?.url??"",c.value=I?.title??"",u.value=I?.author??"",p.value=I?.license??"",m.value=I?.source??"",b(),h.focus()}),a.addEventListener("submit",v=>{v.preventDefault(),h.value.trim()!==""&&(n.apply({url:h.value.trim(),title:c.value.trim(),author:u.value.trim(),license:p.value.trim(),source:m.value.trim()}),o())}),b()}}class Ei{constructor(e){this.provider=e}static SPAN_DEG=.002;async at(e,t){const i=Ei.SPAN_DEG;try{const n=(await this.provider.getElevationGrid({south:e-i,north:e+i,west:t-i,east:t+i},{width:2,height:2})).heights[0];return Number.isFinite(n)?n:void 0}catch{return}}}class Ur{formatters=new Map;available(){const e=Intl.supportedValuesOf;return e?[...e.call(Intl,"timeZone")].sort():[]}offsetHoursAt(e,t){if(t.year===void 0)return;const i=Date.UTC(t.year,(t.month??1)-1,t.day??1,t.hour??12,t.minute??0,t.second??0),s=this.zoneOffsetHours(e,new Date(i));if(s!==void 0)return this.zoneOffsetHours(e,new Date(i-s*36e5))??s}zoneOffsetHours(e,t){let i=this.formatters.get(e);if(i===void 0){try{i=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"})}catch{i=null}this.formatters.set(e,i)}if(i===null)return;const s=i.formatToParts(t).find(r=>r.type==="timeZoneName")?.value??"",n=/^GMT(?:([+-])(\d{2}):(\d{2}))?$/.exec(s);if(n)return n[1]?(n[1]==="-"?-1:1)*(Number(n[2])+Number(n[3])/60):0}zonesAt(e,t){const i=t?.year!==void 0?t:{year:new Date().getFullYear(),month:1,day:1,hour:12};return this.available().filter(s=>this.offsetHoursAt(s,i)===e)}}class oe{static STEP_MS=100;static plan(e){const t=oe.routeOf(e),i=Ie.decorReachFor(e.decor,t),s=Math.max(e.observerTrack.duration,e.timeline.duration,0),n=[];let r;const o=new Set,l=(c,u,p,m)=>{if(Math.abs(c.radiusM-m)>=m*.1)return!1;const{x:f,z:g}=ys(u,p,c.lat,c.lng);return Math.hypot(f,g)<Ie.rebuildDistanceFor(m)};for(let c=0;;c=Math.min(s,c+oe.STEP_MS)){const u=X(e,c);if(u?.lat!==void 0&&u.lng!==void 0){const p=Ie.groundRadiusFor(u.elevationM??0),m=Ie.patchRadiusFor(p,u.elevationM??0),f=Math.max(m,i);(!r||!l(r,u.lat,u.lng,f))&&(r=n.find(g=>l(g,u.lat,u.lng,f)),r||n.push(r={lat:u.lat,lng:u.lng,radiusM:f})),f<p&&o.add(r)}if(c>=s)break}const a=e.weatherTrack.allKeyframes.map(c=>c.weather.visibilityKm).filter(c=>c!==void 0),d=Ie.farRingRadiusFor(a.length>0?Math.max(...a):void 0);for(const c of o)n.push({lat:c.lat,lng:c.lng,radiusM:d,far:!0});if(d>Ie.FAR_RING_RADIUS_M)for(const c of[...n])!c.far&&!o.has(c)&&c.radiusM<d&&n.push({lat:c.lat,lng:c.lng,radiusM:d,far:!0});const h=xs.map(c=>Dt.of(c)).filter(c=>c.reachM&&Dt.eventsOf(e.skyEvents,c).length>0);if(h.length>0){const c=u=>Math.max(...h.map(p=>p.reachM(Dt.eventsOf(e.skyEvents,p),u)));for(const u of[...n])u.far||o.has(u)||n.some(p=>p.far&&p.lat===u.lat&&p.lng===u.lng)||Ie.needsFarRing(u.radiusM,0,c(u))&&n.push({lat:u.lat,lng:u.lng,radiusM:d,far:!0})}return n}static routeOf(e){const t=e.observerTrack.allKeyframes.flatMap(i=>i.pose.lat!==void 0&&i.pose.lng!==void 0?[{lat:i.pose.lat,lng:i.pose.lng}]:[]);return t.length>=2?t:void 0}static async freeze(e,t,i,s,n){const r=new Date().toISOString().slice(0,10),o=l=>n?.(l,i.length);switch(e){case"relief":{const l=oe.routeOf(t),a=[];for(const[c,u]of i.entries()){try{const p=await s.elevation.getElevationGrid(at.boundsOf(u),{width:Ri,height:Ri},{route:l});a.push({...u,grid:p})}catch(p){console.warn("Relief not snapshots for a patch:",p)}o(c+1)}if(a.length===0)return;const d=s.elevationCredit;return{bytes:await an.encode({takenOn:r,attribution:d,patches:a}),attribution:d,takenOn:r,answered:a.length,patches:i.length}}case"imagery":{const l=new Ai,a=z(ot,s.imagery),d=a.create(l.fetch);let h=0;for(const[p,m]of i.entries()){try{await d.getImageryTexture(at.boundsOf(m),{width:Ci,height:Ci}),h++}catch(f){console.warn("Imagery not snapshots for a patch:",f)}o(p+1)}if(l.tiles.size===0)return;const c=d.attribution;return{bytes:await Oi.encode({takenOn:r,source:a.id,attribution:c,patches:[...i],tiles:l.tiles}),attribution:c,takenOn:r,answered:h,patches:i.length}}case"roads":return oe.vector(s.roads,i,r,o,(l,a)=>l.getRoads(a),l=>l.contemporary);case"water":return oe.vector(s.water,i,r,o,(l,a)=>l.getWater(a));case"railways":return oe.vector(s.railways,i,r,o,(l,a)=>l.getRailways(a),l=>l.contemporary)}}static mapGround(e){const t=ln.of(e);return t&&Pi.fitted(t,e.traces.flatMap(i=>i.points))}static async freezeMap(e,t){const i=oe.mapGround(e);if(!i)return;const s=new Date().toISOString().slice(0,10),n=new Ai,r=z(ot,t),o=r.create(n.fetch),l=Pi.IMAGERY_PX;try{await o.getImageryTexture(i,{width:l,height:l})}catch(h){console.warn("Map imagery not snapshots:",h);return}const a=o.attribution;return{bytes:await Oi.encode({takenOn:s,source:r.id,attribution:a,patches:[],map:{bounds:i,pixels:l},tiles:n.tiles}),attribution:a,takenOn:s,answered:1,patches:1}}static async vector(e,t,i,s,n,r){if(!e)return;const o=[];for(const[d,h]of t.entries()){if(h.radiusM<=Ie.ROADS_MAX_RADIUS_M)try{o.push({...h,items:await n(e,at.boundsOf(h))})}catch(c){console.warn("Not snapshots for a patch:",c)}s(d+1)}if(o.length===0)return;const l={version:1,takenOn:i,attribution:e.attribution,contemporary:r?.(e),patches:o};return{bytes:new TextEncoder().encode(JSON.stringify(l)),attribution:e.attribution,takenOn:i,answered:o.length,patches:t.length}}}class W{constructor(e,t){this.root=e,this.host=t,this.sourceInput.addEventListener("filepick",i=>void this.replace(this.shown,i.detail)),this.root.querySelector("#snapshot-refresh").addEventListener("click",()=>void this.refresh(this.shown)),this.root.querySelector("#annex-export").addEventListener("click",()=>void this.exportAnnex(this.shown))}messages;busy=!1;shown="relief";editor;editorFor;editTimer;get sourceInput(){return this.root.querySelector("#annex-source")}get editorHost(){return this.root.querySelector("#annex-editor")}get note(){return this.root.querySelector("#snapshot-note")}localize(e){this.messages=e,this.root.title=e.snapshotHint;const t=(i,s)=>{this.root.querySelector(`#${i}`).textContent=s};t("label-annex-source",e.annexSource),t("snapshot-refresh",e.snapshotRefresh),t("annex-export",e.export),this.sourceInput.messages=e,this.render()}itemLabel(e){return this.groupName(e)}where(e){const t=this.annex(e);return this.isLive(e)?this.messages.snapshotLiveState:!t||t.refresh?this.messages.snapshotPending:W.isInline(t.src)?this.messages.annexStorageInline:t.src}isInlineGroup(e){const t=this.annex(e);return t!==void 0&&!this.isLive(e)&&W.isInline(t.src)}annex(e){const t=this.host.sighting().snapshots?.[e];return t?.src!==void 0?t:void 0}isLive(e){return J.isLive(this.host.sighting().snapshots,e)}setLive(e,t){if(this.isLive(e)===t)return;const i={...this.host.sighting().snapshots??{}};if(i.live){delete i.live;for(const n of J.NAMES)i[n]={...i[n]??{},live:!0}}const s={...i[e]??{}};t?s.live=!0:delete s.live,i[e]=Object.keys(s).length>0?s:void 0,this.setSnapshots(i)}show(e){this.shown=e,this.render()}render(){if(!this.messages)return;const e=this.shown,t=this.isLive(e),i=this.annex(e),s=this.root.querySelector("#snapshot-state");s.textContent=t?this.messages.snapshotLiveState:i&&!i.refresh?[this.messages.snapshotTakenOn.replaceAll("{date}",i.takenOn??"?"),i.attribution].filter(Boolean).join(" · "):this.messages.snapshotPending;const n=this.root.querySelector("#snapshot-refresh");n.disabled=this.busy||t;const r=i!==void 0&&!i.refresh&&!t,o=r&&W.isInline(i.src);this.sourceInput.url=r?o?this.host.masterUrl():this.address(i.src):"",r||(this.sourceInput.mode="file"),this.sourceInput.disabled=this.busy||t,this.root.querySelector("#annex-export").disabled=i===void 0||this.busy,this.renderEditor(r&&!o?i:void 0)}async renderEditor(e){const t=this.shown,i=e&&!W.isZip(t)?await this.textOf(e).catch(()=>{}):void 0;if(t!==this.shown||(this.editorHost.hidden=i===void 0,i===void 0))return;const s=`${t}|${e.src}`;if(this.editor&&this.editorFor===s)return;if(this.editorFor=s,this.editor){this.editor.replaceText(i,!1);return}const{SightingFileEditor:n}=await M(async()=>{const{SightingFileEditor:r}=await import("./SightingFileEditor-Cllslp2u.js");return{SightingFileEditor:r}},__vite__mapDeps([12,13,14]),import.meta.url);if(t!==this.shown||!this.editorHost.isConnected){this.editorFor=void 0;return}this.editor??=new n(this.editorHost,i,r=>this.edited(r),this.messages.annexEditorLabel,{schema:{},phrases:this.messages.fileSearchPhrases})}async textOf(e){return JSON.stringify(JSON.parse(new TextDecoder().decode(await this.bytesOf(e))),null,1)}edited(e){const t=this.shown;clearTimeout(this.editTimer),this.editTimer=setTimeout(()=>{let i;try{i=JSON.parse(e)}catch{return}this.write(t,new TextEncoder().encode(JSON.stringify(i)),{keepEditor:!0})},600)}async replace(e,t){if(t.url){if(this.address(t.url)===new URL(this.host.masterUrl(),location.href).href){await this.setStorage(e,!0);return}const s={...this.host.sighting().snapshots??{}};let n;try{n=await this.bytesAt(t.url)}catch{n=void 0}if(n!==void 0)try{s[e]={src:t.url,...await W.describe(e,n)}}catch{F.show(this.note,this.messages.annexUnreadable,"warning");return}else{const r=this.annex(e);if(!r){F.show(this.note,this.messages.snapshotMissing.replaceAll("{file}",t.url),"warning");return}le.hold(this.address(t.url),await this.bytesOf(r)),s[e]={...r,src:t.url}}F.show(this.note,void 0),this.setSnapshots(s);return}const{InputFileElement:i}=await M(async()=>{const{InputFileElement:s}=await import("./rr0-ufoathome.mjs").then(n=>n.J);return{InputFileElement:s}},[],import.meta.url);await this.write(e,await i.bytesOf(t))}async write(e,t,i={}){const s={...this.host.sighting().snapshots??{}},n=this.annex(e);let r;try{r=await W.describe(e,t)}catch{F.show(this.note,this.messages.annexUnreadable,"warning");return}const o=n!==void 0&&W.isInline(n.src),l=o?W.dataUrl(e,t):n?.src??J.annexName(this.host.base(),e);o||le.hold(this.address(l),t),s[e]={...s[e]?.live?{live:!0}:{},src:l,...r},F.show(this.note,void 0),i.keepEditor&&(this.editorFor=`${e}|${l}`),this.setSnapshots(s)}async setStorage(e,t){const i={...this.host.sighting().snapshots??{}},s=this.annex(e);if(!s||W.isInline(s.src)===t)return;const n=await this.bytesOf(s);let r;t?r=W.dataUrl(e,n):(r=J.annexName(this.host.base(),e),le.hold(this.address(r),n)),i[e]={...s,src:r},this.editorFor=`${e}|${r}`,this.setSnapshots(i)}async exportAnnex(e){const t=this.annex(e);if(!t)return;const i=await this.bytesOf(t),s=W.isInline(t.src)?J.annexName(this.host.base(),e):decodeURIComponent(t.src.split("/").pop()??t.src);this.host.download(new Blob([i],{type:W.isZip(e)?"application/zip":"application/json"}),s)}static async describe(e,t){let i;if(W.isZip(e)){const{unzipSync:s}=await M(async()=>{const{unzipSync:n}=await import("./browser-CltifEM0.js");return{unzipSync:n}},[],import.meta.url);i=JSON.parse(new TextDecoder().decode(s(t)["index.json"]))}else i=JSON.parse(new TextDecoder().decode(t));if(typeof i!="object"||i===null)throw new Error("Not an annex");return{takenOn:typeof i.takenOn=="string"?i.takenOn:void 0,attribution:typeof i.attribution=="string"?i.attribution:void 0}}async bytesAt(e){return le.bytes(this.address(e))}static isInline(e){return e.startsWith("data:")}static isZip(e){return e==="relief"||e==="imagery"||e==="map"}static dataUrl(e,t){let i="";for(let s=0;s<t.length;s+=32768)i+=String.fromCharCode(...t.subarray(s,s+32768));return`data:${W.isZip(e)?"application/zip":"application/json"};base64,${btoa(i)}`}async refresh(e){if(this.busy)return;const t={...this.host.sighting().snapshots??{}};if(e==="upperAir"){const i=t.upperAir;i&&(t.upperAir={...i,refresh:!0}),this.setSnapshots(t);return}this.busy=!0,this.render();try{const i=t[e]?.src,s=(i&&!W.isInline(i)?W.baseOf(i):void 0)??this.host.base();(e==="map"?await this.takeMap(t,this.host.sources(),s):await this.take(e,t,oe.plan(this.host.sighting()),this.host.sources(),s))?F.show(this.note,void 0):F.show(this.note,this.messages.snapshotFailed.replaceAll("{group}",this.groupName(e)),"warning")}finally{this.busy=!1}this.setSnapshots(t)}hasWork(){const e=this.host.sighting();return J.isEmpty(e.snapshots)?this.host.upperAirHeard()!==void 0||oe.plan(e).length>0:!0}async prepare(e){const t=this.host.sighting(),i={...t.snapshots??{}},s=new Map;this.busy=!0,this.render();try{const n=h=>J.isLive(i,h),r=h=>i[h]?.src!==void 0?i[h]:void 0;for(const h of J.NAMES)!i.live&&i[h]?.live&&(i[h]={live:!0});const o=oe.plan(t);let l;for(const h of J.TERRAIN){if(n(h))continue;const c=r(h);if(o.length>0&&(!c||c.refresh||!await this.fits(h,c,o))&&await this.take(h,i,o,l??=this.host.sources(),e)){await this.keep(r(h),s);continue}c?.refresh&&(i[h]={...c,refresh:void 0}),r(h)&&await this.keep(r(h),s)}if(!n("map")){const h=r("map");oe.mapGround(t)!==void 0&&(!h||h.refresh||!await this.fitsMap(h))&&await this.takeMap(i,l??=this.host.sources(),e)?await this.keep(r("map"),s):h&&(h.refresh&&(i.map={...h,refresh:void 0}),await this.keep(r("map"),s))}const a=this.host.upperAirHeard(),d=r("upperAir");if(!n("upperAir")&&a&&(!d||d.refresh)){const h=new Date().toISOString().slice(0,10),c={version:1,takenOn:h,attribution:a.answer.source.name,answers:[a]},u=new TextEncoder().encode(JSON.stringify(c)),p=this.place("upperAir",d?.src,e,u);i.upperAir={src:p,takenOn:h,attribution:a.answer.source.name},W.isInline(p)||s.set(p,u)}else d&&!n("upperAir")&&(d.refresh&&(i.upperAir={...d,refresh:void 0}),await this.keep(r("upperAir"),s))}finally{this.busy=!1}return this.setSnapshots(i),s}async take(e,t,i,s,n){const r=this.groupName(e),o=await oe.freeze(e,this.host.sighting(),i,s,(l,a)=>F.show(this.note,this.messages.snapshotTaking.replaceAll("{group}",r).replaceAll("{done}",String(l)).replaceAll("{of}",String(a))));return F.show(this.note,void 0),o?(t[e]={src:this.place(e,t[e]?.src,n,o.bytes),takenOn:o.takenOn,attribution:o.attribution},!0):!1}async takeMap(e,t,i){F.show(this.note,this.messages.snapshotTaking.replaceAll("{group}",this.groupName("map")).replaceAll("{done}","0").replaceAll("{of}","1"));const s=await oe.freezeMap(this.host.sighting(),t.imagery);return F.show(this.note,void 0),s?(e.map={src:this.place("map",e.map?.src,i,s.bytes),takenOn:s.takenOn,attribution:s.attribution},!0):!1}async fitsMap(e){const t=oe.mapGround(this.host.sighting());try{const i=JSON.parse(new TextDecoder().decode((await le.zip(this.address(e.src)))["index.json"]));return t!==void 0&&i.map!==void 0&&at.sameBounds(i.map.bounds,t)}catch{return!1}}async fits(e,t,i){try{const s=this.address(t.src),n=t.src.endsWith(".zip")?JSON.parse(new TextDecoder().decode((await le.zip(s))["index.json"])).patches:(await le.json(s)).patches,r=e==="relief"||e==="imagery"?i:i.filter(o=>o.radiusM<=Ie.ROADS_MAX_RADIUS_M);return at.samePatches(n.map(({lat:o,lng:l,radiusM:a})=>({lat:o,lng:l,radiusM:a})),r)}catch{return!1}}place(e,t,i,s){if(t!==void 0&&W.isInline(t))return W.dataUrl(e,s);const n=t??J.annexName(i,e);return le.hold(this.address(n),s),n}async keep(e,t){if(!W.isInline(e.src))try{t.set(e.src,await this.bytesOf(e))}catch{F.show(this.note,this.messages.snapshotMissing.replaceAll("{file}",e.src),"warning")}}bytesOf(e){return le.bytes(this.address(e.src))}address(e){return le.address(e,this.host.documentUrl())}setSnapshots(e){for(const t of J.NAMES)e[t]===void 0&&delete e[t];this.host.sighting().snapshots=J.isEmpty(e)?void 0:e,this.render(),this.host.changed()}destroy(){clearTimeout(this.editTimer),this.editor?.destroy(),this.editor=void 0,this.editorFor=void 0}static baseOf(e){return e?.match(/^(.*)\.[a-z-]+\.(zip|json)$/)?.[1]}static size(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} kB`:`${(e/1e6).toFixed(1)} MB`}groupName(e){return{relief:this.messages.snapshotRelief,imagery:this.messages.snapshotImagery,roads:this.messages.snapshotRoads,water:this.messages.snapshotWater,railways:this.messages.snapshotRailways,upperAir:this.messages.snapshotUpperAir,map:this.messages.snapshotMap}[e]}}class Wt{constructor(e,t){this.root=e,this.host=t,this.sourceInput.addEventListener("filepick",i=>void this.take(this.shown,i.detail)),this.root.querySelector("#section-annex-export").addEventListener("click",()=>this.exportAnnex(this.shown))}messages;shown="weather";get sourceInput(){return this.root.querySelector("#section-annex-source")}get note(){return this.root.querySelector("#section-annex-note")}localize(e){this.messages=e;const t=(i,s)=>{this.root.querySelector(`#${i}`).textContent=s};t("label-section-annex-source",e.annexSource),t("section-annex-export",e.export),this.sourceInput.messages=e,this.render()}show(e){this.shown=e,F.show(this.note,void 0),this.render()}srcOf(e){return this.host.sighting().snapshots?.[e]?.src}itemLabel(e){const t=this.messages;return t?{weather:t.fileItemWeather,place:t.fileItemPlace,lightPollution:t.fileItemLightPollution,decor:t.fileItemDecor}[e]:""}where(e){return this.srcOf(e)??this.messages?.annexStorageInline??""}isInline(e){return this.srcOf(e)===void 0}static pathOf(e){return[U.KEYS[e][0]]}render(){if(!this.messages)return;const e=this.srcOf(this.shown);this.sourceInput.url=e?this.resolve(e):this.host.masterUrl(),this.root.querySelector("#section-annex-state").textContent=this.state(this.shown)}state(e){const t=this.host.sighting();switch(e){case"weather":return t.weatherSource?.name??this.messages.weatherStatedByObserver;case"place":return t.event.place?.[0]?.name??"";case"lightPollution":return new ht(Ne.preferencesFor(this.root)).read(t.provenance.at("lightPollution")?.rationale)??(t.lightPollution===void 0?"":String(t.lightPollution));case"decor":return""}}setStorage(e,t){const i={...this.host.sighting().snapshots??{}};if(t===(i[e]?.src===void 0))return;const{src:s,...n}=i[e]??{};i[e]=t?n:{...n,src:U.annexName(this.host.base(),e)},this.write(e,i)}annex(e){const t=this.srcOf(e);return t===void 0?void 0:{src:t,bytes:this.bytesOf(e)}}bytesOf(e){const t=pi(this.host.sighting()),{takenOn:i,attribution:s}=this.host.sighting().snapshots?.[e]??{},n={version:He.CURRENT.sighting,takenOn:i,attribution:s,...U.taken(e,t)};return new TextEncoder().encode(JSON.stringify(n))}resolve(e){return new URL(e,this.host.documentUrl()??location.href).href}exportAnnex(e){const t=this.srcOf(e)??U.annexName(this.host.base(),e);this.host.download(new Blob([this.bytesOf(e)],{type:"application/json"}),decodeURIComponent(t.split("/").pop()??t))}async take(e,t){if(t.url&&this.resolve(t.url)===this.resolve(this.host.masterUrl())){this.setStorage(e,!0);return}if(t.url)try{await fetch(this.resolve(t.url),{method:"HEAD"}).then(l=>{if(!l.ok)throw new Error(String(l.status))})}catch{const l={...this.host.sighting().snapshots??{}};l[e]={...l[e]??{},src:t.url},F.show(this.note,void 0),this.write(e,l);return}let i;try{const{InputFileElement:l}=await M(async()=>{const{InputFileElement:d}=await import("./rr0-ufoathome.mjs").then(h=>h.J);return{InputFileElement:d}},[],import.meta.url),a=await l.bytesOf(t.url?{url:this.resolve(t.url)}:t);if(i=He.recording(JSON.parse(new TextDecoder().decode(a))),typeof i!="object"||i===null||U.KEYS[e].every(d=>i[d]===void 0))throw new Error("Not this section")}catch{F.show(this.note,this.messages.annexUnreadable,"warning");return}const s=this.host.sighting(),n={...pi(s)};if(e==="decor")U.put(e,n,"timeline"in i?U.taken(e,i):i);else for(const l of U.KEYS[e])n[l]=i[l];const r=Is(n);Wt.copy(e,r,s);const o={...s.snapshots??{}};t.url?o[e]={...o[e]??{},src:t.url}:o[e]=o[e]??{},F.show(this.note,void 0),this.write(e,o)}write(e,t){this.host.sighting().snapshots=J.isEmpty(t)?void 0:t,this.render(),this.host.changed(e)}static copy(e,t,i){switch(e){case"weather":i.weatherTrack.clear();for(const s of t.weatherTrack.allKeyframes)i.weatherTrack.addKeyframe(s.t,s.weather);i.weatherSource=t.weatherSource;break;case"place":i.event.place=t.event.place;break;case"lightPollution":i.lightPollution=t.lightPollution;break;case"decor":i.decor=t.decor;break}for(const s of U.KEYS[e]){i.provenance.clear(s);for(const n of t.provenance.paths())(n===s||n.startsWith(`${s}.`))&&i.provenance.set(n,t.provenance.at(n))}}}class Hr{constructor(e="https://api.open-meteo.com/v1/forecast"){this.endpoint=e}async zoneAt(e,t){const i=new URL(this.endpoint);i.searchParams.set("latitude",String(e)),i.searchParams.set("longitude",String(t)),i.searchParams.set("timezone","auto"),i.searchParams.set("forecast_days","1");try{const s=await fetch(i.toString());if(!s.ok)return;const n=await s.json();return n.timezone&&n.timezone!=="GMT"?n.timezone:void 0}catch{return}}}const $r=de.point("timeZone").provide(de.BUILT_IN,[{id:"open-meteo",name:"Open-Meteo",credit:"© Open-Meteo",creditUrl:"https://open-meteo.com/en/docs",create:()=>new Hr}]);class ri{static OCCUPATIONS={student:!0,worker:!0,farmer:!0,homemaker:!0,merchant:!0,business:!0,employee:!0,artist:!0,technician:!0,police:!0,pilot:!0,military:!0};static RELATIONS=["friends","family","professional","none"];static ACTIVITIES=["leisure","travelling","cultural","working"]}class G{static READ_FROM_RECORDING=["detection","close","beings"];occupationKind=G.select("observerOccupationKind");graduate=G.select("observerGraduate");enquiryMinutes=Object.assign(document.createElement("input"),{id:"enquiryMinutes",type:"number",min:"0",step:"1",size:5});relation=G.select("observersRelation");activity=G.select("observerActivity");factors=new Map(Kn.map(e=>[e,G.select(`strangeness-${e}`)]));labels=new Map;unit=document.createTextNode(" min");strangenessTitle=document.createElement("span");strangenessIntro=Object.assign(document.createElement("p"),{className:"section-intro"});wording;constructor(e,t,i,s){De.register(),e.append(this.label(this.occupationKind,d=>[d.occupationKind,d.occupationKindHint]),this.label(this.graduate,d=>[d.graduate]));const n=this.label(this.enquiryMinutes,d=>[d.enquiryMinutes,d.enquiryMinutesHint]);n.append(this.unit);const r=t.querySelector("#accountSource")?.closest("label");r?r.after(n):t.append(n),t.append(this.label(this.relation,d=>[d.relation]),this.label(this.activity,d=>[d.activity]));const o=Object.assign(document.createElement("h3"),{className:"section-title"});o.append(this.strangenessTitle),i.append(o,this.strangenessIntro,...[...this.factors].map(([d,h])=>this.label(h,c=>[c.factors[d],c.factorHints[d]])));const l=[["yes","yes"],["no","no"]],a=d=>d.map(h=>[h,h]);G.choices(this.occupationKind,"",a(Object.keys(ri.OCCUPATIONS))),G.choices(this.graduate,"",l),G.choices(this.relation,"",a(ri.RELATIONS)),G.choices(this.activity,"",a(ri.ACTIVITIES));for(const d of this.factors.values())G.choices(d,"",l);for(const d of[this.occupationKind,this.graduate,this.enquiryMinutes,this.relation,this.activity,...this.factors.values()])d.addEventListener("change",s)}set messages(e){this.wording=e;for(const t of this.labels.values())t();this.unit.textContent=` ${e.minutes}`,this.strangenessTitle.textContent=e.strangenessSection,this.strangenessIntro.textContent=e.strangenessIntro,G.choices(this.occupationKind,e.unknown,Object.entries(e.occupationKinds)),G.choices(this.graduate,e.unknown,[["yes",e.yes],["no",e.no]]),G.choices(this.relation,e.unknown,Object.entries(e.relations)),G.choices(this.activity,e.unknown,Object.entries(e.activities));for(const[t,i]of this.factors)G.choices(i,G.READ_FROM_RECORDING.includes(t)?e.fromRecording:e.unknown,[["yes",e.yes],["no",e.no]])}show(e){this.occupationKind.value=e?.observerOccupationKind??"",this.graduate.value=G.yesNo(e?.observerGraduate),this.enquiryMinutes.value=e?.enquiryMinutes?.toString()??"",this.relation.value=e?.observersRelation??"",this.activity.value=e?.activity??"";for(const[t,i]of this.factors)i.value=G.yesNo(e?.strangeness?.[t])}values(){const e=this.enquiryMinutes.value.trim()===""?void 0:Number(this.enquiryMinutes.value),t={};for(const[i,s]of this.factors){const n=G.boolean(s.value);n!==void 0&&(t[i]=n)}return{observerOccupationKind:this.occupationKind.value||void 0,observerGraduate:G.boolean(this.graduate.value),enquiryMinutes:e!==void 0&&Number.isFinite(e)&&e>=0?e:void 0,observersRelation:this.relation.value||void 0,activity:this.activity.value||void 0,strangeness:Object.keys(t).length>0?t:void 0}}label(e,t){const i=document.createElement("label"),s=document.createElement("span");return i.append(s," ",e),this.labels.set(s,()=>{if(!this.wording)return;const[n,r]=t(this.wording);De.say(s,n,r)}),i}static select(e){return Object.assign(document.createElement("select"),{id:e})}static choices(e,t,i){const s=e.value;e.replaceChildren(new Option(t,""),...i.map(([n,r])=>new Option(r,n))),e.value=s}static yesNo(e){return e===void 0?"":e?"yes":"no"}static boolean(e){return e===""?void 0:e==="yes"}}const xt=new Set;Ts();In();Ms.register();const Ve={width:48,height:28},Wr=2500,It=40,Tt=10,jr=30,Gr=10,gs=600,fs=900,qe=2e-4,Kr=900,Vr=-1.46,qr=3,oi=.2,Zr=.5,Yr=3,Jr=.01,Xr=1.6,ai=2e3,Qr=250,bs=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]),eo=1,to=5,io=10,Re=4,it="ufo-1",so={presetId:"oval",color:"#39ff14",transparency:0,haloScale:1.5,blur:0,brightness:0};function no(E){return E.kind==="oval"?"oval":"polygon"}const ro=-6,oo=21;class y extends HTMLElement{shadow;sceneElement;ufoElement;recordButton;samplingRateInput;shapeAddMenu;colorInput;transparencyInput;haloScaleInput;blurInput;brightnessInput;blurBoundOutput;sourceSelect;shapeTitleInput;shapeRotationInput;utcOffsetInput;timeZoneSelect;timeZoneWarning;timeZoneProvider=$r[0].create();timeZoneLookupTimer;timeZoneLookedUpAt;offsetIsAuthors=!1;placeZone;autoFilledTimeZone;timeZones=new Ur;apparentWidthInput;realWidthInput;objectDistanceInput;sizeLockSelect;apparentSizeOutput;realSizeOutput;clearDistanceHypothesisButton;depthBasisOutput;addShapeButton;deleteShapeButton;contextMenu;contextGroupButton;contextUngroupButton;contextDuplicateButton;contextBringToFrontButton;contextSendToBackButton;contextDeleteButton;contextAddVertexButton;contextDeleteVertexButton;decorContextMenu;contextViewAccountButton;contextMasksSubmenu;labelContextMasks;playPauseButton;seekInput;previousMarkButton;nextMarkButton;timelineMarks;timeStartLabel;timeEndLabel;durationInput;accountViewSelect;accountCompareInput;durationElement;exportButton;exportKmlButton;exportGeoJsonButton;saveButton;timelineTracks;tracksToggle;sceneFieldOverlay;activeSceneField;referencesShownForField=!1;overlayTimer;witnessErrorView;saidInterviews;candidatesView;sectionFolds;snapshotsPanel;sectionFilePanel;eventsPanel;aroundPanel;phenomenonEventsPanel;bodiesEventsPanel;fileItemSelect;importInput;narrativeSourceRow;narrativeSettingsBox;narrativeSettingInputs=new Map;aircraftStatus=Object.assign(document.createElement("span"),{className:"source-status"});aircraftFlights;aircraftFlightsShownAt=0;narrativeDraftButton;narrativeStopButton;narrativeStatus;narrativeReport;placeNameInput;searchPlaceButton;placeMatchRow;placeMatchSelect;placeStatusText;placeProvider=_r();placeMatches=[];placeSearchToken=0;placeReverseTimer;namedCoordinates;latInput;lngInput;headingInput;headingUnit;pitchInput;rollInput;swayInput;lensGlassSelect;isoInput;filmStockSelect;meteringSelect;lensDropsInput;lensCondensationInput;lensDirtInput;lensShelteredInput;skySourcesInput;lightPollutionInput;lightPollutionStatusText;lightPollutionSourceRow;elevationInput;groundElevationOutput;weatherFromRecords=!0;groundElevationM;groundElevationFor;groundElevationTimer;groundElevationToken=0;obsTimeInput;startDate;endDate;obsEndTimeInput;observerIdInput;observerTitleInput;observerLastNameInput;observerFirstNamesInput;observerAgeInput;observerOccupationInput;accountSourceSelect;evaluationFields;accountUrlInput;labelAccountUrl;accountFollowedUpSelect;sightingIdInput;descriptionInput;tagsInput;cloudEditor;bodyEditor;bodyEditorLoading;skyParts=new Map;fileEditor;fileEditorLoading;fileEditorHost;fileNote;fileAsk;identityAsk;fileSyncTimer;fileApplyTimer;historySnapshot;historyTimer;historyAnswering=!1;undoButton;redoButton;labelFileGroup;cloudCoverInput;cloudDarknessInput;cloudBaseInput;precipitationTypeSelect;precipitationIntensityInput;windDirectionInput;windSpeedInput;stormInput;weatherInferredInput;weatherSourceText;skyCandidatesOutput;showMeteorButton;showCometButton;showNovaButton;showSatelliteButton;showFireballButton;weatherSourceLink;weatherFields;weatherInference=new tt(Nr());weatherLookupTimer;weatherLookupToken=0;weatherLookupPending=!1;weatherLookupResult;weatherTrackSpan;soundKindSelect;soundVolumeInput;soundPitchInput;soundPitchValue;soundSrcInput;soundFields;soundKindOptions=new Map;soundPreviewTimer;instrumentSelect;filterSelect;labelFilter;focalLengthInput;labelFocalLength;focalFovOutput;unitFocalLength;labelFNumber;labelExposure;labelFocusDistance;fNumberInput;exposureInput;focusDistanceInput;labelColor;labelTransparency;labelHalo;labelBlur;labelBrightness;labelShapeTitle;labelUtcOffset;labelApparentWidth;labelRealWidth;labelObjectDistance;labelSizeLock;labelSamplingRate;labelDuration;placeSourceRow;weatherSourceRow;terrainSourceRows;chosenSourceId=new Map;labelPlaceName;labelPlaceMatch;labelPosition;observerSaid;observerSaidShown;observerPosition;labelHeading;labelPitch;labelRoll;labelSway;labelLightPollution;labelElevation;labelObservationTime;labelObservationEndTime;labelObserverId;labelObserverTitle;labelObserverLastName;labelObserverFirstNames;labelObserverAge;labelObserverBirth;birthDate;perceptionSettings;birth;labelObserverOccupation;labelAccountSource;labelAccountFollowedUp;labelSightingId;labelDescription;labelTags;wholeKeyframesInput;labelImportFile;get reading(){return this.isReading}set reading(e){this.isReading=e,this.syncBodiesShown()}isReading=!1;static FIELDS_OF_PATH={time:["obs-time","obs-time-native"],"place.locations.0.lat":["lat"],"place.locations.0.lng":["lng"]};markBeyondKnown(e){for(const{field:t,title:i}of this.markedBeyondKnown)t.removeAttribute("aria-invalid"),i===null?t.removeAttribute("title"):t.setAttribute("title",i);this.markedBeyondKnown=[];for(const{path:t,why:i}of e)for(const s of y.FIELDS_OF_PATH[t]??[]){const n=this.shadow.getElementById(s);n&&(this.markedBeyondKnown.push({field:n,title:n.getAttribute("title")}),n.setAttribute("aria-invalid","true"),n.setAttribute("title",i))}}setReadingBounds(e){const t=this.shadow.querySelector('rr0-date-input[name="obs-time"]'),i=e.time?dn.boundsOf(e.time):void 0;t?.setBounds(i?{...i,...e.hour?{adjust:e.hour}:{}}:void 0);for(const[s,n]of[["lat",e.lat],["lng",e.lng]]){const r=this.shadow.getElementById(s);if(r&&(this.numberBounds.set(r,n),r.min=n?String(n[0]):"",r.max=n?String(n[1]):"",!this.boundedFields.has(r))){this.boundedFields.add(r);const o=()=>{const l=this.numberBounds.get(r),a=Number(r.value);if(!l||r.value===""||!Number.isFinite(a))return;const d=Math.min(Math.max(a,l[0]),l[1]);d!==a&&(r.value=String(d))};r.addEventListener("change",o,{capture:!0})}}}numberBounds=new WeakMap;boundedFields=new WeakSet;markedBeyondKnown=[];accountShapeIds;labelNarrativeSource;groupTabs;groupPanels;paramSummary;paramSummaryBuilder;paramSummarySignature="";labelShapeGroup;labelTemporalGroup;labelLocationGroup;labelObservationGroup;labelObserverGroup;labelWeatherGroup;labelCloudCover;labelHighCloud;labelIceAlignment;labelRareIce;highCloudCoverInput;iceCrystalAlignmentInput;rareIceCrystalsInput;labelCloudDarkness;labelCloudBase;labelPrecipitationType;labelPrecipitationIntensity;labelWindDirection;labelWindSpeed;labelStorm;labelCloudsGroup;labelShapesSubgroup;labelBodiesSubgroup;labelPrecipitationGroup;labelWindGroup;subgroupTabs;labelWeatherInferred;weatherProviderSelect;weatherFileLink;labelSoundGroup;labelSoundKind;labelSoundVolume;labelSoundPitch;labelSoundSrc;labelInstrument;optionPrecipitationNone;optionPrecipitationRain;optionPrecipitationSnow;optionPrecipitationHail;decorList;observerList;observerShown="principal";static CLICK_SLOP_PX=5;static OBSERVER_PRINCIPAL="principal";surroundings;surroundingsProvider;sceneryStatus;scenerySource;labelScenerySource;sceneryWarning;sceneryRadius;labelSceneryRadius;sceneryChoice;decorModelProvider=new Vt;milestoneSelect;milestoneLabelInput;milestoneNoteInput;addMilestoneButton;deleteMilestoneButton;goToMilestoneButton;currentMilestoneT;decorParameterForm;decorBaseForm;decorStateForm;decorBaseHost;decorStateHost;decorBaseShown=!1;decorParametersHost;decorParametersShownFor;labelDecorGroup;labelMilestones;labelMilestoneLabel;labelMilestoneNote;recorder;isRecording=!1;messages=$e.blank();ready=Promise.resolve();decorParameterTexts={};worded=!1;fieldHints=new Map;currentAppearance={...so};currentSourceId=it;selectedSourceIds=new Set([it]);currentDecorId;currentReferenceId;referenceSelect;deleteReferenceButton;referenceTitleInput;referenceSourceInput;referenceKindSelect;referenceCreditInput;referenceCreditUrlInput;referenceTInput;referenceVideoFromInput;referenceVideoToInput;referenceVideoRateInput;referenceRemoveKeyButton;referenceDrawingInput;referenceOpacityInput;referenceHeadingInput;referencePitchInput;referenceRollInput;referenceFovInput;referenceUsePoseButton;referenceStatus;referenceFailure;addReferenceButton;referenceAddMenu;referenceLandmarksSelect;addReferenceLandmarkButton;deleteReferenceLandmarkButton;referenceLandmarkLabelInput;findGhostsButton;searchingGhosts=!1;ghostsStatus;ghostFinding;ghostsShown=!0;ghostsShownButton;labelReferenceLandmarks;labelReferenceLandmarkLabel;referenceAdoptPoseButton;traceImportInput;traceSelect;deleteTraceButton;traceTitleInput;traceSourceInput;traceStatus;labelTraceImport;addTraceButton;labelTraceTitle;labelTraceSource;currentTraceId;referenceStreetSelect;referenceStreetAddButton;lastCanvasMode="shape";referenceDragState;armingLandmark=!1;pendingLandmark;currentLandmarkId;referenceFit;streetPictures=[];streetPictures$;pictureRegistration;pictureRegistrationLoading;referenceFields;labelReferenceGroup;labelReferenceTitle;labelReferenceSrc;labelReferenceKind;labelReferenceCredit;labelReferenceCreditUrl;labelReferenceT;labelReferenceDrawing;labelReferenceOpacity;labelReferenceHeading;labelReferencePitch;labelReferenceRoll;labelReferenceFov;contextMenuDecorId;contextMenuPoint;dragState;cameraDragState;hoverCursor;indoorLookYawDeg=0;indoorLookPitchDeg=0;lastInhabitedKey;handleKeyDown=e=>{if(e.key==="Escape"&&(this.isRecording&&this.toggleRecording(),(this.armingLandmark||this.pendingLandmark)&&this.disarmLandmark(),this.contextMenu.hidden||this.hideContextMenu(),this.decorContextMenu.hidden||this.hideDecorContextMenu()),(e.ctrlKey||e.metaKey)&&!e.altKey&&["z","y"].includes(e.key.toLowerCase())){const t=e.composedPath()[0];if(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&(t.isContentEditable||t.closest(".cm-editor")))return;e.preventDefault(),e.key.toLowerCase()==="y"||e.shiftKey?this.redo():this.undo();return}if(bs.has(e.key)||e.key==="Delete"||e.key==="Backspace"){const t=e.composedPath()[0];if(t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&(t.isContentEditable||t.closest(".cm-editor")))return;bs.has(e.key)?this.selectedMembers().length===0&&t===this?this.walkOrTurn(e):this.moveOrResizeSelectedShapes(e):this.canvasMode()==="decor"?this.deleteDecor():this.deleteShape()}};handleDragPointerMove=e=>this.onDragPointerMove(e);handleDragPointerUp=()=>{const e=this.cameraDragState&&!this.cameraDragState.moved?this.cameraDragState.pressedDecorId:void 0,t=this.cameraDragState&&!this.cameraDragState.moved?this.cameraDragState.pressedBodyId:void 0;this.endDrag(),t!==void 0&&this.showBody(t),e!==void 0&&(this.selectDecor(e),this.revealDecorPanel(),this.flash(this.shadow.querySelector("#decor-item label, #decor-item .field")))};constructor(){super(),this.shadow=this.attachShadow({mode:"open"});const e=document.createElement("template");e.innerHTML=`<style>${ar}</style>${or}`,this.shadow.appendChild(e.content.cloneNode(!0)),customElements.upgrade(this.shadow);for(const a of this.shadow.querySelectorAll(Bt))a.build();for(const a of this.shadow.querySelectorAll(Ht))a.build();for(const a of this.shadow.querySelectorAll(ki))a.build();for(const a of this.shadow.querySelectorAll(Si))a.build();this.sceneElement=document.createElement(hn),this.sceneElement.addEventListener("observermapchange",a=>{this.ufoElement.sighting.observerMap=a.detail.open,this.dispatchEvent(new CustomEvent("sightingchange"))}),this.sceneElement.accountInTheRound=!1,this.ufoElement=this.sceneElement.ufoElement,this.ufoElement.steadyObserver=!0,this.ufoElement.titleShown=!1,this.sceneElement.ownCredits=!1,this.ufoElement.observerPlacing=!0,this.ufoElement.addEventListener("observerplace",a=>{const{lat:d,lng:h}=a.detail;this.latInput.value=String(Number(d.toFixed(6))),this.lngInput.value=String(Number(h.toFixed(6))),this.updateObserver()}),this.ufoElement.enableClickToPlay=!1,this.ufoElement.showToolbar=!1,this.shadow.getElementById("ufo-slot").replaceWith(this.sceneElement),this.ufoElement.hostControls(this.shadow.getElementById("scene-controls")),this.recordButton=this.shadow.getElementById("record"),this.samplingRateInput=this.shadow.getElementById("samplingRate"),this.colorInput=this.shadow.getElementById("color"),this.transparencyInput=this.shadow.getElementById("transparency"),this.haloScaleInput=this.shadow.getElementById("haloScale"),this.blurInput=this.shadow.getElementById("blur"),this.brightnessInput=this.shadow.getElementById("brightness"),this.blurBoundOutput=this.shadow.getElementById("blur-bound"),this.sourceSelect=this.shadow.getElementById("source"),this.shapeTitleInput=this.shadow.getElementById("shapeTitle"),this.shapeRotationInput=this.shadow.getElementById("shapeRotation"),this.utcOffsetInput=this.shadow.getElementById("utcOffsetHours"),this.timeZoneSelect=this.shadow.getElementById("timeZone"),this.timeZoneWarning=this.shadow.getElementById("time-zone-warning"),this.apparentWidthInput=this.shadow.getElementById("apparentWidth"),this.realWidthInput=this.shadow.getElementById("realWidth"),this.objectDistanceInput=this.shadow.getElementById("objectDistance"),this.sizeLockSelect=this.shadow.getElementById("sizeLock"),this.apparentSizeOutput=this.shadow.getElementById("apparent-size"),this.realSizeOutput=this.shadow.getElementById("real-size"),this.clearDistanceHypothesisButton=this.shadow.getElementById("clear-distance-hypothesis"),this.depthBasisOutput=this.shadow.getElementById("depth-basis"),this.addShapeButton=this.shadow.getElementById("add-shape"),this.deleteShapeButton=this.shadow.getElementById("delete-shape"),this.contextMenu=this.shadow.getElementById("context-menu"),this.contextGroupButton=this.shadow.getElementById("context-group"),this.contextUngroupButton=this.shadow.getElementById("context-ungroup"),this.contextDuplicateButton=this.shadow.getElementById("context-duplicate"),this.contextBringToFrontButton=this.shadow.getElementById("context-bring-to-front"),this.contextSendToBackButton=this.shadow.getElementById("context-send-to-back"),this.contextDeleteButton=this.shadow.getElementById("context-delete"),this.contextAddVertexButton=this.shadow.getElementById("context-add-vertex"),this.contextDeleteVertexButton=this.shadow.getElementById("context-delete-vertex"),this.decorContextMenu=this.shadow.getElementById("decor-context-menu"),this.contextViewAccountButton=this.shadow.getElementById("context-view-account"),this.contextMasksSubmenu=this.shadow.getElementById("context-masks-submenu"),this.labelContextMasks=this.shadow.getElementById("label-context-masks"),this.playPauseButton=this.shadow.getElementById("play-pause"),this.seekInput=this.shadow.getElementById("seek"),this.previousMarkButton=this.shadow.getElementById("previous-mark"),this.nextMarkButton=this.shadow.getElementById("next-mark"),this.timelineMarks=new lt(this.seekInput,this.shadow.getElementById("timeline-marks")),this.timeStartLabel=this.shadow.getElementById("time-start"),this.timeEndLabel=this.shadow.getElementById("time-end");for(const a of[this.timeStartLabel,this.timeEndLabel])a.addEventListener("click",()=>this.switchTimeDisplay()),a.addEventListener("keydown",d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),this.switchTimeDisplay())});this.accountViewSelect=this.shadow.getElementById("account-view"),this.accountCompareInput=this.shadow.getElementById("account-compare"),this.durationElement=this.shadow.querySelector(Ht),this.durationInput=this.durationElement.input,this.exportButton=this.shadow.getElementById("export"),this.exportKmlButton=this.shadow.getElementById("export-kml"),this.exportGeoJsonButton=this.shadow.getElementById("export-geojson"),this.saveButton=this.shadow.getElementById("save"),this.shareButton=this.shadow.getElementById("share"),this.shareDialog=this.shadow.getElementById("share-dialog"),this.shareDialog.subject=this.shareSubject,this.sectionFolds=new Rs(this.shadow);const t=this;this.witnessErrorView=new Ps({get sighting(){return t.ufoElement.sighting},messages:()=>this.worded?this.messages.witnessError:void 0,changed:()=>{this.touch(),this.armHistory(),this.scheduleHistoryRecord()},conditionsChanged:a=>{const d=this.ufoElement.sighting,{conditions:h,...c}=d.account??{},u={...c,...a?{conditions:a}:{}};d.account=Object.values(u).some(p=>p!==void 0)?u:void 0},recordingJson:()=>this.sightingData,valueSources:()=>this.valueSources(),lawsChanged:()=>{this.sceneElement.confrontationTolerance=cn.lawsOf(this.witnessErrorView.errorModel,this.ufoElement.sighting.account?.conditions),this.refreshCandidatesSoon()}}),this.timelineTracks=new vi(this.shadow.getElementById("timeline-tracks"),a=>this.goToMark(a),this.messages),this.tracksToggle=this.shadow.getElementById("toggle-tracks"),this.tracksToggle.addEventListener("click",()=>this.setTracksShown(this.tracksToggle.getAttribute("aria-expanded")!=="true")),this.resizeScene(this.shadow.getElementById("scene-resize")),this.shadow.querySelector(".scene-card").addEventListener("pointerdown",a=>{a.pointerType==="touch"&&this.showOverlays()}),this.sceneFieldOverlay=new Bs(this.shadow.querySelector(".scene-card"),()=>this.ufoElement.canvasElement),this.shadow.addEventListener("focusin",a=>{const d=a.target.id;y.SCENE_LINKED.includes(d)&&this.setActiveSceneField(d)}),this.shadow.addEventListener("focusout",a=>{const d=a.relatedTarget;(!d||!y.SCENE_LINKED.includes(d.id))&&this.setActiveSceneField(void 0)}),this.shadow.addEventListener("input",()=>this.refreshSceneField()),this.importInput=this.shadow.getElementById("import"),this.narrativeSourceRow=this.shadow.getElementById("narrative-source-row"),this.narrativeSettingsBox=this.shadow.getElementById("narrative-settings"),this.narrativeDraftButton=this.shadow.getElementById("narrative-draft"),this.narrativeStopButton=this.shadow.getElementById("narrative-stop"),this.narrativeStatus=this.shadow.getElementById("narrative-status"),this.narrativeReport=this.shadow.getElementById("narrative-report"),this.placeNameInput=this.shadow.getElementById("placeName"),this.searchPlaceButton=this.shadow.getElementById("search-place"),this.placeMatchRow=this.shadow.getElementById("place-match-row"),this.placeMatchSelect=this.shadow.getElementById("placeMatch"),this.placeStatusText=this.shadow.getElementById("place-status-text"),this.latInput=this.shadow.getElementById("lat"),this.lngInput=this.shadow.getElementById("lng"),this.headingInput=this.shadow.getElementById("heading"),this.headingUnit=this.shadow.getElementById("heading-unit"),this.pitchInput=this.shadow.getElementById("pitch"),this.rollInput=this.shadow.getElementById("roll"),this.swayInput=this.shadow.getElementById("sway"),this.lensGlassSelect=this.shadow.getElementById("lens-glass"),this.isoInput=this.shadow.getElementById("iso"),this.filmStockSelect=this.shadow.getElementById("filmStock"),this.meteringSelect=this.shadow.getElementById("metering"),this.lensDropsInput=this.shadow.getElementById("lens-drops"),this.lensCondensationInput=this.shadow.getElementById("lens-condensation"),this.lensDirtInput=this.shadow.getElementById("lens-dirt"),this.lensShelteredInput=this.shadow.getElementById("lens-sheltered"),this.skySourcesInput=this.shadow.getElementById("sky-sources"),this.lightPollutionInput=this.shadow.getElementById("lightPollution"),this.lightPollutionStatusText=this.shadow.getElementById("light-pollution-status-text"),this.lightPollutionSourceRow=this.shadow.getElementById("light-pollution-source-row"),this.elevationInput=this.shadow.getElementById("elevation"),this.groundElevationOutput=this.shadow.getElementById("ground-elevation"),this.obsTimeInput=this.shadow.getElementById("obs-time"),this.obsEndTimeInput=this.shadow.getElementById("obs-end-time"),this.observerIdInput=this.shadow.getElementById("observerId"),this.observerTitleInput=this.shadow.getElementById("observerTitle"),this.observerLastNameInput=this.shadow.getElementById("observerLastName"),this.observerFirstNamesInput=this.shadow.getElementById("observerFirstNames"),this.observerAgeInput=this.shadow.getElementById("observerAge"),this.observerOccupationInput=this.shadow.getElementById("observerOccupation"),this.accountSourceSelect=this.shadow.getElementById("accountSource"),this.accountUrlInput=this.shadow.getElementById("accountUrl"),this.labelAccountUrl=this.shadow.getElementById("label-account-url"),this.accountFollowedUpSelect=this.shadow.getElementById("accountFollowedUp"),this.evaluationFields=new G(this.shadow.getElementById("profile-section"),this.shadow.getElementById("testimony-section"),this.shadow.getElementById("strangeness-section"),()=>this.updateObserverMetadata()),this.sightingIdInput=this.shadow.getElementById("sightingId"),this.descriptionInput=this.shadow.getElementById("description"),this.tagsInput=this.shadow.getElementById("tags"),this.cloudCoverInput=this.shadow.getElementById("cloudCover"),this.highCloudCoverInput=this.shadow.getElementById("highCloudCover"),this.iceCrystalAlignmentInput=this.shadow.getElementById("iceCrystalAlignment"),this.rareIceCrystalsInput=this.shadow.getElementById("rareIceCrystals"),this.cloudDarknessInput=this.shadow.getElementById("cloudDarkness"),this.cloudBaseInput=this.shadow.getElementById("cloudBase"),this.precipitationTypeSelect=this.shadow.getElementById("precipitationType"),this.precipitationIntensityInput=this.shadow.getElementById("precipitationIntensity"),this.windDirectionInput=this.shadow.getElementById("windDirection"),this.windSpeedInput=this.shadow.getElementById("windSpeed"),this.stormInput=this.shadow.getElementById("storm"),this.weatherInferredInput=this.shadow.getElementById("weatherInferred"),this.weatherSourceText=this.shadow.getElementById("weather-source-text"),this.skyCandidatesOutput=this.shadow.getElementById("sky-candidates"),this.showMeteorButton=this.shadow.getElementById("show-meteor"),this.showCometButton=this.shadow.getElementById("show-comet"),this.showNovaButton=this.shadow.getElementById("show-nova"),this.showSatelliteButton=this.shadow.getElementById("show-satellite"),this.showFireballButton=this.shadow.getElementById("show-fireball"),this.weatherSourceLink=this.shadow.getElementById("weather-source-link"),this.weatherFields=[this.cloudCoverInput,this.highCloudCoverInput,this.iceCrystalAlignmentInput,this.rareIceCrystalsInput,this.cloudDarknessInput,this.cloudBaseInput,this.precipitationTypeSelect,this.precipitationIntensityInput,this.windDirectionInput,this.windSpeedInput,this.stormInput],this.soundKindSelect=this.shadow.getElementById("soundKind"),this.soundVolumeInput=this.shadow.getElementById("soundVolume"),this.soundPitchInput=this.shadow.getElementById("soundPitch"),this.soundPitchValue=this.shadow.getElementById("sound-pitch-value"),this.soundSrcInput=this.shadow.getElementById("soundSrc"),this.soundFields=[this.soundKindSelect,this.soundVolumeInput,this.soundPitchInput,this.soundSrcInput],this.buildSoundKindOptions(),this.instrumentSelect=this.shadow.getElementById("instrument"),this.filterSelect=this.shadow.getElementById("filter"),this.labelFilter=this.shadow.getElementById("label-filter"),this.focalLengthInput=this.shadow.getElementById("focalLength"),this.labelFocalLength=this.shadow.getElementById("label-focal-length"),this.focalFovOutput=this.shadow.getElementById("focal-fov"),this.unitFocalLength=this.shadow.getElementById("unit-focal-length"),this.labelFNumber=this.shadow.getElementById("label-f-number"),this.labelExposure=this.shadow.getElementById("label-exposure"),this.fNumberInput=this.shadow.getElementById("fNumber"),this.exposureInput=this.shadow.getElementById("exposureSeconds"),this.focusDistanceInput=this.shadow.getElementById("focusDistance"),this.labelFocusDistance=this.shadow.getElementById("label-focus-distance"),this.refreshInstrumentOptions(),this.refreshFilterOptions(),this.labelColor=this.shadow.getElementById("label-color"),this.labelTransparency=this.shadow.getElementById("label-transparency"),this.labelHalo=this.shadow.getElementById("label-halo"),this.labelBlur=this.shadow.getElementById("label-blur"),this.labelBrightness=this.shadow.getElementById("label-brightness"),this.labelShapeTitle=this.shadow.getElementById("label-shape-title"),this.labelUtcOffset=this.shadow.getElementById("label-utc-offset"),this.labelApparentWidth=this.shadow.getElementById("label-apparent-width"),this.labelRealWidth=this.shadow.getElementById("label-real-width"),this.labelObjectDistance=this.shadow.getElementById("label-object-distance"),this.labelSizeLock=this.shadow.getElementById("label-size-lock"),this.labelSamplingRate=this.shadow.getElementById("label-sampling-rate"),this.labelSoundGroup=this.shadow.getElementById("label-sound-group"),this.labelSoundKind=this.shadow.getElementById("label-sound-kind"),this.labelSoundVolume=this.shadow.getElementById("label-sound-volume"),this.labelSoundPitch=this.shadow.getElementById("label-sound-pitch"),this.labelSoundSrc=this.shadow.getElementById("label-sound-src"),this.labelReferenceGroup=this.shadow.getElementById("label-reference-group"),this.labelReferenceTitle=this.shadow.getElementById("label-reference-title"),this.labelReferenceSrc=this.shadow.getElementById("label-reference-src"),this.labelReferenceKind=this.shadow.getElementById("label-reference-kind"),this.labelReferenceCredit=this.shadow.getElementById("label-reference-credit"),this.labelReferenceCreditUrl=this.shadow.getElementById("label-reference-credit-url"),this.labelReferenceT=this.shadow.getElementById("label-reference-t"),this.labelReferenceDrawing=this.shadow.getElementById("label-reference-drawing"),this.labelReferenceOpacity=this.shadow.getElementById("label-reference-opacity"),this.labelReferenceHeading=this.shadow.getElementById("label-reference-heading"),this.labelReferencePitch=this.shadow.getElementById("label-reference-pitch"),this.labelReferenceRoll=this.shadow.getElementById("label-reference-roll"),this.labelReferenceFov=this.shadow.getElementById("label-reference-fov"),this.labelDuration=this.shadow.getElementById("label-duration"),this.placeSourceRow=this.shadow.getElementById("place-source-row"),this.weatherSourceRow=this.shadow.getElementById("weather-source-row"),this.terrainSourceRows=this.shadow.getElementById("terrain-source-rows"),this.labelPlaceName=this.shadow.getElementById("label-place-name"),this.labelPlaceMatch=this.shadow.getElementById("label-place-match"),this.labelPosition=this.shadow.getElementById("label-position"),this.observerPosition=this.shadow.querySelector(`${Si}[name="observer"]`),this.labelHeading=this.shadow.getElementById("label-heading"),this.labelPitch=this.shadow.getElementById("label-pitch"),this.labelRoll=this.shadow.getElementById("label-roll"),this.labelSway=this.shadow.getElementById("label-sway"),this.labelLightPollution=this.shadow.getElementById("label-light-pollution"),this.labelElevation=this.shadow.getElementById("label-elevation"),this.labelObservationTime=this.shadow.getElementById("label-observation-time"),this.labelObservationEndTime=this.shadow.getElementById("label-observation-end-time"),this.labelObserverId=this.shadow.getElementById("label-observer-id"),this.labelObserverTitle=this.shadow.getElementById("label-observer-title"),this.labelObserverLastName=this.shadow.getElementById("label-observer-last-name"),this.labelObserverFirstNames=this.shadow.getElementById("label-observer-first-names"),this.labelObserverAge=this.shadow.getElementById("label-observer-age"),this.labelObserverBirth=this.shadow.getElementById("label-observer-birth"),this.labelObserverOccupation=this.shadow.getElementById("label-observer-occupation"),this.labelAccountSource=this.shadow.getElementById("label-account-source"),this.labelAccountFollowedUp=this.shadow.getElementById("label-account-followed-up"),this.labelSightingId=this.shadow.getElementById("label-sighting-id"),this.labelDescription=this.shadow.getElementById("label-description"),this.labelTags=this.shadow.getElementById("label-tags"),this.labelImportFile=this.shadow.getElementById("label-import-file"),this.wholeKeyframesInput=this.shadow.getElementById("whole-keyframes");try{this.wholeKeyframesInput.checked=localStorage.getItem(y.WHOLE_KEYFRAMES_STORAGE)==="true"}catch{}this.wholeKeyframesInput.addEventListener("change",()=>this.setKeyframesWritten()),this.labelNarrativeSource=this.shadow.getElementById("label-narrative-source"),this.labelShapeGroup=this.shadow.getElementById("label-shape-group"),this.labelTemporalGroup=this.shadow.getElementById("label-temporal-group"),this.labelFileGroup=this.shadow.getElementById("label-file-group"),this.fileEditorHost=this.shadow.getElementById("file-editor"),this.fileNote=this.shadow.getElementById("file-note"),this.snapshotsPanel=new W(this.shadow.getElementById("snapshot-data"),{sighting:()=>this.ufoElement.sighting,documentUrl:()=>this.sceneElement.documentUrl,sources:()=>this.snapshotSources(),upperAirHeard:()=>this.sceneElement.upperAirHeard,changed:()=>{this.touch(),this.ufoElement.refresh(),this.scheduleFileSync(),this.refreshFileItems()},base:()=>this.fileBase(),masterUrl:()=>this.masterUrl(),download:(a,d)=>this.download(a,d)}),this.sectionFilePanel=new Wt(this.shadow.getElementById("file-section"),{sighting:()=>this.ufoElement.sighting,documentUrl:()=>this.sceneElement.documentUrl,base:()=>this.fileBase(),masterUrl:()=>this.masterUrl(),download:(a,d)=>this.download(a,d),changed:a=>{if(this.touch(),this.ufoElement.refresh(),a==="weather"&&(this.syncWeatherFromTimeline(),this.syncWeatherSourceState()),a==="place"&&this.syncPlaceNameField(),a==="lightPollution"){const d=this.ufoElement.sighting.lightPollution;this.lightPollutionInput.value=d===void 0?"":String(d),this.scheduleLightPollutionLookup()}this.scheduleFileSync(),this.refreshFileItems()}});const i={sighting:()=>this.ufoElement.sighting,editing:()=>this.armHistory(),changed:()=>{this.touch(),this.ufoElement.refresh(),this.scheduleHistoryRecord(),this.refreshTimelineMarks(),this.scheduleFileSync(),this.eventsPanel.render(),this.phenomenonEventsPanel.render(),this.bodiesEventsPanel.render()},seek:a=>this.goToMark(a),now:()=>this.ufoElement.currentTime,duration:()=>this.ufoElement.seekableDuration,currentBody:()=>this.bodyEditor?.selectedId??this.ufoElement.sighting.interpretation?.bodies[0]?.id,currentShapes:()=>{const a=this.ufoElement.sighting.timeline;return a.sourceIds.includes(this.currentSourceId)?a.topOf(this.currentSourceId):void 0},shapesLabel:a=>this.shapesLabel(a),picked:()=>this.refreshTracks(),positionFrame:()=>this.positionFrame(),positionMessages:()=>this.messages,compassPoint:a=>this.naming.point(a),lookedAt:()=>{const a=this.ufoElement.sighting.observerTrack.getInterpolatedPoseAt(this.ufoElement.currentTime);return a?.headingDeg===void 0||a.pitchDeg===void 0?void 0:{azimuthDeg:a.headingDeg,altitudeDeg:a.pitchDeg}},bodyLabel:a=>{const d=this.ufoElement.sighting.interpretation?.bodies.find(h=>h.id===a);return this.said.read(d?.title)??a},valueSources:()=>this.valueSources()};this.eventsPanel=new ke(this.shadow.getElementById("events-section"),i,void 0),this.phenomenonEventsPanel=new ke(this.shadow.getElementById("phenomenon-events-section"),i,void 0,"phenomenon"),this.bodiesEventsPanel=new ke(this.shadow.getElementById("bodies-events-section"),i,void 0,"bodies"),this.aroundPanel=new tr(this.shadow.getElementById("around-section"),{sighting:()=>this.ufoElement.sighting,editing:()=>this.armHistory(),changed:()=>{this.touch(),this.ufoElement.refresh(),this.scheduleHistoryRecord(),this.scheduleFileSync()},valueSources:()=>this.valueSources()}),this.samplingRateInput.addEventListener("change",()=>{const a=Number(this.samplingRateInput.value);i.editing(),this.ufoElement.sighting.sampleMs=Number.isFinite(a)&&a>0?a:void 0,ce.refresh(this.ufoElement.sighting),i.changed()}),this.fileItemSelect=this.shadow.getElementById("file-item"),this.fileItemSelect.addEventListener("change",()=>this.showFileItem(this.fileItemSelect.value)),this.snapshotsPanel.localize(this.messages),this.sectionFilePanel.localize(this.messages),this.refreshFileItems(),this.fileAsk=this.shadow.getElementById("file-ask"),this.identityAsk=this.shadow.getElementById("identity-ask"),this.shadow.getElementById("identity-ask-keep").addEventListener("click",()=>{this.closeIdentityAsk(),this.downloadJson()}),this.shadow.getElementById("identity-ask-back").addEventListener("click",()=>this.closeIdentityAsk()),this.shadow.getElementById("identity-ask-initials").addEventListener("click",()=>{this.closeIdentityAsk(),this.writeNamesAsInitials()}),this.fileAsk.addEventListener("cancel",a=>{a.preventDefault(),this.keepReadingWeather()}),this.shadow.getElementById("file-ask-stop").addEventListener("click",()=>this.stopReadingWeather()),this.shadow.getElementById("file-ask-keep").addEventListener("click",()=>this.keepReadingWeather()),this.labelLocationGroup=this.shadow.getElementById("label-location-group"),this.labelObservationGroup=this.shadow.getElementById("label-observation-group"),this.labelObserverGroup=this.shadow.getElementById("label-observer-group"),this.labelWeatherGroup=this.shadow.getElementById("label-weather-group"),this.labelCloudCover=this.shadow.getElementById("label-cloud-cover"),this.labelHighCloud=this.shadow.getElementById("label-high-cloud"),this.labelIceAlignment=this.shadow.getElementById("label-ice-alignment"),this.labelRareIce=this.shadow.getElementById("label-rare-ice"),this.labelCloudDarkness=this.shadow.getElementById("label-cloud-darkness"),this.labelCloudBase=this.shadow.getElementById("label-cloud-base"),this.labelPrecipitationType=this.shadow.getElementById("label-precipitation-type"),this.labelPrecipitationIntensity=this.shadow.getElementById("label-precipitation-intensity"),this.labelWindDirection=this.shadow.getElementById("label-wind-direction"),this.labelWindSpeed=this.shadow.getElementById("label-wind-speed"),this.labelStorm=this.shadow.getElementById("label-storm"),this.labelCloudsGroup=this.shadow.getElementById("label-clouds-group"),this.labelShapesSubgroup=this.shadow.getElementById("label-shapes-subgroup"),this.labelBodiesSubgroup=this.shadow.getElementById("label-bodies-subgroup"),this.labelPrecipitationGroup=this.shadow.getElementById("label-precipitation-group"),this.labelWindGroup=this.shadow.getElementById("label-wind-group"),this.aircraftFlights=new lr(this.shadow.getElementById("aircraft-flights"),a=>this.aimAtFlight(a),a=>this.naming.point(a)),this.labelWeatherInferred=this.shadow.getElementById("label-weather-inferred"),this.weatherProviderSelect=this.shadow.getElementById("weatherSource"),this.weatherFileLink=this.shadow.getElementById("weather-file-link"),this.labelInstrument=this.shadow.getElementById("label-instrument"),this.optionPrecipitationNone=this.shadow.getElementById("option-precipitation-none"),this.optionPrecipitationRain=this.shadow.getElementById("option-precipitation-rain"),this.optionPrecipitationSnow=this.shadow.getElementById("option-precipitation-snow"),this.optionPrecipitationHail=this.shadow.getElementById("option-precipitation-hail"),this.decorList=new ge({header:this.shadow.getElementById("decor-list-header"),body:this.shadow.getElementById("decor-item"),ids:{list:"decor",remove:"delete-decor",add:"add-decor-building",kinds:"decorKind",kind:a=>`option-decor-${a}`},actions:[{id:"look-at-decor",glyph:"🎯",onClick:()=>this.lookAtDecor()}],onSelect:a=>this.selectDecor(a),onAdd:a=>this.addDecor(a),onRemove:()=>this.deleteDecor()}),this.decorList.setKinds([{value:"building",label:"Building"},{value:"tree",label:"Tree"},{value:"shrub",label:"Shrub"},{value:"bridge",label:"Bridge"},{value:"wire",label:"Overhead line"},{value:"crop",label:"Crop row"},{value:"terrace",label:"Terrace (restanque)"},{value:"mound",label:"Stone heap"},{value:"wall",label:"Dry-stone wall"},{value:"streetlight",label:"Streetlight"},{value:"trafficlight",label:"Traffic light"},{value:"peak",label:"Peak"},{value:"crossing",label:"Pedestrian crossing"},{value:"roadsign",label:"Road sign"},{value:"vehicle",label:"Vehicle"},{value:"aircraft",label:"Aircraft"},{value:"entity",label:"Being"},{value:"observer",label:"Other observer",hidden:!0}]),this.decorList.setLabels({list:"Environment",remove:"Delete decor",add:"Add",empty:"No decor",actions:{"look-at-decor":"Look at it"}}),this.observerList=new ge({header:this.shadow.getElementById("observer-list-header"),body:this.shadow.getElementById("observer-item"),ids:{list:"observer-pick",remove:"delete-observer",add:"add-decor-observer"},actions:[{id:"look-at-observer",glyph:"🎯",onClick:()=>this.lookAtDecor()}],onSelect:a=>this.selectObserver(a),onAdd:()=>this.addDecor("observer"),onRemove:()=>this.deleteDecor()}),this.observerList.setLabels({list:"Observer",remove:"Delete observer",add:"Add observer",actions:{"look-at-observer":"Look at it"}}),this.sceneryStatus=this.shadow.getElementById("scenery-status"),this.sceneryWarning=this.shadow.getElementById("scenery-warning"),this.scenerySource=this.shadow.getElementById("scenery-source"),this.labelScenerySource=this.shadow.getElementById("label-scenery-source"),this.sceneryRadius=this.shadow.getElementById("scenery-radius"),this.labelSceneryRadius=this.shadow.getElementById("label-scenery-radius"),this.sceneryRadius.value=this.readSceneryRadius(),this.surroundings=new te(this.sceneryStatus,{decor:()=>this.ufoElement.sighting.decor,setDecor:a=>this.setPlantedDecor(a),kindName:a=>this.decorList.kindLabel(a),cite:a=>this.citeSource(a),busy:(a,d)=>this.sceneElement.setBusy(a,d),centre:()=>this.plantingCentre(),track:()=>this.ufoElement.sighting.observerTrack.toJSON().keyframes.map(a=>({lat:a.pose.lat,lng:a.pose.lng})).filter(a=>typeof a.lat=="number"&&typeof a.lng=="number")},this.messages,async(a,d)=>this.surroundingsProvider?this.surroundingsProvider.covers(a,d)?this.surroundingsProvider:void 0:(await M(async()=>{const{SurroundingsSources:h}=await import("./surroundingsSources-kPwp7ewe.js");return{SurroundingsSources:h}},__vite__mapDeps([15,1,3,4,5,6,7,8,9]),import.meta.url)).SurroundingsSources.providerFor(this.sceneryChoice,a,d),{radiusM:Number(this.sceneryRadius.value)}),this.sceneryChoice=this.readSceneryChoice(),this.surroundings.setEnabled(this.sceneryAsked()),this.shadow.getElementById("scenery-file-link").addEventListener("click",()=>this.openFileItem("decor")),this.scenerySource.addEventListener("change",()=>{const a=this.scenerySource.value===y.FILE_SOURCE;if(this.setDecorFromFile(a),a){this.syncSceneryPicker();return}if(this.sceneryChoice=this.scenerySource.value,this.writeSceneryChoice(this.sceneryChoice),this.surroundings.setEnabled(this.sceneryAsked()),this.syncSceneryPicker(),this.sceneryChoice===y.NO_SCENERY){this.surroundings.withdraw();return}const d=this.plantingCentre();d&&this.surroundings.survey(d.lat,d.lng)}),this.sceneryRadius.addEventListener("input",()=>{const a=Number(this.sceneryRadius.value);if(!Number.isFinite(a)||a<20)return;this.writeSceneryRadius(this.sceneryRadius.value);const d=this.plantingCentre();this.surroundings.radiusChanged(a,d?.lat,d?.lng)}),this.fillScenerySources(),this.undoButton=this.shadow.getElementById("undo"),this.redoButton=this.shadow.getElementById("redo"),this.referenceSelect=this.shadow.getElementById("reference"),this.deleteReferenceButton=this.shadow.getElementById("delete-reference"),this.referenceTitleInput=this.shadow.getElementById("referenceTitle"),this.referenceSourceInput=this.shadow.getElementById("reference-source"),this.referenceKindSelect=this.shadow.getElementById("referenceKind"),this.referenceCreditInput=this.shadow.getElementById("referenceCredit"),this.referenceCreditUrlInput=this.shadow.getElementById("referenceCreditUrl"),this.referenceTInput=this.shadow.getElementById("referenceT"),this.referenceVideoFromInput=this.shadow.getElementById("referenceVideoFrom"),this.referenceVideoToInput=this.shadow.getElementById("referenceVideoTo"),this.referenceVideoRateInput=this.shadow.getElementById("referenceVideoRate"),this.referenceRemoveKeyButton=this.shadow.getElementById("reference-remove-key"),this.referenceDrawingInput=this.shadow.getElementById("referenceDrawing"),this.referenceOpacityInput=this.shadow.getElementById("referenceOpacity"),this.referenceHeadingInput=this.shadow.getElementById("referenceHeading"),this.referencePitchInput=this.shadow.getElementById("referencePitch"),this.referenceRollInput=this.shadow.getElementById("referenceRoll"),this.referenceFovInput=this.shadow.getElementById("referenceFov"),this.referenceUsePoseButton=this.shadow.getElementById("reference-use-pose"),this.referenceStatus=this.shadow.getElementById("reference-status"),this.referenceFailure=this.shadow.getElementById("reference-failure"),this.addReferenceButton=this.shadow.getElementById("add-reference"),this.referenceAddMenu=new ci(this.addReferenceButton,"reference-add-kind",a=>this.addReferenceOfKind(a),a=>({address:"reference-add-address",file:"reference-add-file-option",street:"reference-add-street"})[a]??`reference-add-${a}`),this.setReferenceAddKinds("From an address","From a file","Street-level pictures nearby"),this.referenceLandmarksSelect=this.shadow.getElementById("reference-landmarks"),this.addReferenceLandmarkButton=this.shadow.getElementById("add-reference-landmark"),this.deleteReferenceLandmarkButton=this.shadow.getElementById("delete-reference-landmark"),this.referenceLandmarkLabelInput=this.shadow.getElementById("referenceLandmarkLabel"),this.findGhostsButton=this.shadow.getElementById("reference-find-ghosts"),this.ghostsStatus=this.shadow.getElementById("reference-ghosts-status"),this.findGhostsButton.addEventListener("click",()=>void this.findGhosts()),this.ghostsShownButton=this.shadow.getElementById("reference-ghosts-shown"),this.ghostsShownButton.addEventListener("click",()=>{this.ghostsShown=!this.ghostsShown,this.syncGhostsShown(),this.ufoElement.refresh()}),this.labelReferenceLandmarks=this.shadow.getElementById("label-reference-landmarks"),this.labelReferenceLandmarkLabel=this.shadow.getElementById("label-reference-landmark-label"),this.referenceAdoptPoseButton=this.shadow.getElementById("reference-adopt-pose"),this.traceImportInput=this.shadow.getElementById("trace-import"),this.traceSelect=this.shadow.getElementById("trace"),this.deleteTraceButton=this.shadow.getElementById("delete-trace"),this.traceTitleInput=this.shadow.getElementById("traceTitle"),this.traceSourceInput=this.shadow.getElementById("traceSource"),this.traceStatus=this.shadow.getElementById("trace-status"),this.labelTraceImport=this.shadow.getElementById("label-trace-import"),this.addTraceButton=this.shadow.getElementById("add-trace"),this.labelTraceTitle=this.shadow.getElementById("label-trace-title"),this.labelTraceSource=this.shadow.getElementById("label-trace-source"),this.referenceStreetSelect=this.shadow.getElementById("reference-street"),this.referenceStreetAddButton=this.shadow.getElementById("reference-street-add"),this.referenceFields=[this.referenceTitleInput,this.referenceKindSelect,this.referenceCreditInput,this.referenceCreditUrlInput,this.referenceTInput,this.referenceVideoFromInput,this.referenceVideoToInput,this.referenceVideoRateInput,this.referenceDrawingInput,this.referenceOpacityInput,this.referenceHeadingInput,this.referencePitchInput,this.referenceRollInput,this.referenceFovInput],this.milestoneSelect=this.shadow.getElementById("milestone"),this.milestoneLabelInput=this.shadow.getElementById("milestoneLabel"),this.milestoneNoteInput=this.shadow.getElementById("milestoneNote"),this.addMilestoneButton=this.shadow.getElementById("add-milestone"),this.deleteMilestoneButton=this.shadow.getElementById("delete-milestone"),this.goToMilestoneButton=this.shadow.getElementById("go-to-milestone"),this.modelPicker=new dt(this.shadow,()=>({title:this.messages.modelPickerTitle,close:this.messages.modelPickerClose,choose:this.messages.modelPickerChoose,address:this.messages.decorModelAdvanced,addressUrl:this.messages.decorModelUrl,addressName:this.messages.decorModelTitle,addressAuthor:this.messages.decorModelAuthor,addressLicense:this.messages.decorModelLicense,addressSource:this.messages.decorModelSource,addressUse:this.messages.modelPickerUse,addressIncomplete:this.messages.modelPickerIncomplete})),this.decorParametersHost=this.shadow.getElementById("decor-parameters"),this.decorParameterForm=new nt(this.decorParametersHost,"en","decorParam.");const s={said:()=>this.said,writingLanguage:()=>this.writingLanguage};this.decorBaseHost=this.shadow.getElementById("decor-base"),this.decorStateHost=this.shadow.getElementById("decor-state"),this.decorBaseForm=new nt(this.decorBaseHost,"en","decorBase.",s,(a,d)=>this.enhanceDecorModelChoice(a,d)),this.decorStateForm=new nt(this.decorStateHost,"en","decorState.",s),this.labelDecorGroup=this.shadow.getElementById("label-decor-group"),this.labelMilestones=this.shadow.getElementById("label-milestones"),this.labelMilestoneLabel=this.shadow.getElementById("label-milestone-label"),this.labelMilestoneNote=this.shadow.getElementById("label-milestone-note"),this.ufoElement.canvasElement.addEventListener("pointerdown",a=>{this.focus({preventScroll:!0}),this.onPointerDown(a)}),this.ufoElement.canvasElement.addEventListener("pointermove",a=>this.onPointerMove(a));let n;this.ufoElement.canvasElement.addEventListener("pointerdown",a=>{n={x:a.clientX,y:a.clientY,playing:this.ufoElement.playbackState==="playing"}}),this.ufoElement.canvasElement.addEventListener("click",a=>{const d=n;n=void 0,!(!d?.playing||this.isRecording||this.ufoElement.playbackState!=="playing")&&(Math.hypot(a.clientX-d.x,a.clientY-d.y)>y.CLICK_SLOP_PX||(this.ufoElement.togglePlayPause(),this.syncPlaybackControls()))}),this.ufoElement.canvasElement.addEventListener("contextmenu",a=>this.onContextMenu(a)),this.contextGroupButton.addEventListener("click",()=>this.groupSelected()),this.contextUngroupButton.addEventListener("click",()=>this.ungroupSelected()),this.contextDuplicateButton.addEventListener("click",()=>this.duplicateSelected()),this.contextBringToFrontButton.addEventListener("click",()=>this.bringSelectedToFront()),this.contextSendToBackButton.addEventListener("click",()=>this.sendSelectedToBack()),this.contextDeleteButton.addEventListener("click",()=>{this.hideContextMenu(),this.deleteShape()}),this.contextAddVertexButton.addEventListener("click",()=>this.addVertexAtContextMenu()),this.contextDeleteVertexButton.addEventListener("click",()=>this.deleteVertexAtContextMenu()),this.contextViewAccountButton.addEventListener("click",()=>this.viewObserverAccount()),this.playPauseButton.addEventListener("click",()=>{this.sceneElement.resumeWeatherAudio(),this.ufoElement.togglePlayPause(),this.syncPlaybackControls()});const r=this.shadow.getElementById("editor-mute"),o=this.shadow.getElementById("editor-volume");r.addEventListener("click",()=>{this.sceneElement.resumeWeatherAudio(),this.ufoElement.toggleMuted()}),o.addEventListener("input",()=>{this.sceneElement.resumeWeatherAudio(),this.ufoElement.volume=Number(o.value)}),this.ufoElement.addEventListener("mutedchange",()=>this.syncSoundControls()),this.seekInput.addEventListener("input",()=>this.ufoElement.currentTime=this.timelineMarks.snap(Number(this.seekInput.value))),this.previousMarkButton.addEventListener("click",()=>this.goToMark(this.timelineMarks.previous(this.ufoElement.currentTime))),this.nextMarkButton.addEventListener("click",()=>this.goToMark(this.timelineMarks.next(this.ufoElement.currentTime))),this.recordButton.addEventListener("click",()=>this.toggleRecording()),this.deleteShapeButton.addEventListener("click",()=>this.deleteShape()),this.exportButton.addEventListener("click",()=>this.exportJson()),this.exportKmlButton.addEventListener("click",()=>void this.exportFigures("kml")),this.exportGeoJsonButton.addEventListener("click",()=>void this.exportFigures("geojson")),this.saveButton.addEventListener("click",()=>this.exportJson()),this.shareButton.addEventListener("click",()=>this.openShare()),this.importInput.addEventListener("filepick",a=>{const d=a.detail;d.file?this.importFromFile(d.file):this.importFromUrl(d.url)}),this.accountSourceSelect.addEventListener("change",()=>this.updateObserverMetadata()),this.accountUrlInput.addEventListener("input",()=>this.updateSourceUrl()),this.accountFollowedUpSelect.addEventListener("change",()=>this.updateObserverMetadata()),this.swayInput.addEventListener("input",()=>{this.ufoElement.sighting.sway=this.numberOrUndefined(this.swayInput.value),this.ufoElement.refresh()});for(const a of[this.lensGlassSelect,this.lensDropsInput,this.lensCondensationInput,this.lensDirtInput,this.lensShelteredInput])a.addEventListener(a instanceof HTMLSelectElement||a.type==="checkbox"?"change":"input",()=>this.updateLens());this.skySourcesInput.addEventListener("change",()=>{this.ufoElement.sighting.skySources=this.skySourcesInput.checked?void 0:!1,this.ufoElement.refresh(),this.refreshSkyCandidates(),this.showAircraftStatus()}),this.lightPollutionInput.addEventListener("input",()=>{const a=this.ufoElement.sighting;a.lightPollution=this.numberOrUndefined(this.lightPollutionInput.value),a.provenance.clear("lightPollution"),this.lightPollutionLookup=void 0,this.ufoElement.refresh(),a.lightPollution===void 0?this.scheduleLightPollutionLookup():this.syncLightPollutionStatus()}),this.narrativeDraftButton.addEventListener("click",()=>this.draftFromDescription()),this.narrativeStopButton.addEventListener("click",()=>this.narrativeAbort?.abort()),this.renderNarrativeSettings(),this.durationElement.addEventListener("durationchange",a=>{const{seconds:d,text:h}=a.detail;this.ufoElement.sighting.event.durationText=h,this.ufoElement.durationSeconds=d,this.ufoElement.sighting.timeline.hasSpan&&this.ufoElement.sighting.timeline.setSpan((d??0)*1e3),this.ufoElement.refresh(),this.updateDurationValidity(),this.scheduleWeatherLookup()}),this.sourceSelect.addEventListener("change",()=>this.selectUnit(this.sourceSelect.value)),this.shapeTitleInput.addEventListener("input",()=>this.updateShapeTitle()),this.shapeRotationInput.addEventListener("input",()=>this.updateShapeRotation()),this.apparentWidthInput.addEventListener("input",()=>this.typing(this.apparentWidthInput,()=>this.onApparentWidthInput())),this.realWidthInput.addEventListener("input",()=>this.typing(this.realWidthInput,()=>this.onRealWidthInput())),this.objectDistanceInput.addEventListener("input",()=>this.typing(this.objectDistanceInput,()=>this.onDistanceInput())),this.sizeLockSelect.addEventListener("change",()=>this.applySizeLock()),this.clearDistanceHypothesisButton.addEventListener("click",()=>this.clearDistanceHypothesis()),this.undoButton.addEventListener("click",()=>this.undo()),this.redoButton.addEventListener("click",()=>this.redo()),this.referenceSelect.addEventListener("change",()=>this.selectReference(this.referenceSelect.value)),this.deleteReferenceButton.addEventListener("click",()=>this.deleteReference());for(const a of this.referenceFields)a.addEventListener("input",()=>this.updateReference());this.referenceUsePoseButton.addEventListener("click",()=>this.useObserverPoseForReference()),this.referenceRemoveKeyButton.addEventListener("click",()=>this.removeReferenceKey()),this.referenceSourceInput.addEventListener("filepick",a=>void this.setReferenceSource(a.detail)),this.addReferenceLandmarkButton.addEventListener("click",()=>this.armLandmark()),this.deleteReferenceLandmarkButton.addEventListener("click",()=>this.deleteLandmark()),this.referenceLandmarksSelect.addEventListener("change",()=>this.selectLandmark(this.referenceLandmarksSelect.value)),this.referenceLandmarkLabelInput.addEventListener("input",()=>this.updateLandmarkLabel()),this.referenceAdoptPoseButton.addEventListener("click",()=>this.adoptReferencePose()),this.addTraceButton.addEventListener("click",()=>{const a=this.shadow.getElementById("trace-import-row");a.hidden=!1,this.traceImportInput.mode==="file"?this.traceImportInput.openPicker():this.traceImportInput.focus()}),this.traceImportInput.addEventListener("filepick",a=>void this.addTraces(a.detail)),this.traceSelect.addEventListener("change",()=>this.selectTrace(this.traceSelect.value)),this.deleteTraceButton.addEventListener("click",()=>this.deleteTrace()),this.traceTitleInput.addEventListener("input",()=>this.writeTraceFields()),this.traceSourceInput.addEventListener("input",()=>this.writeTraceFields()),this.referenceStreetAddButton.addEventListener("click",()=>this.addStreetPicture()),this.ufoElement.canvasElement.addEventListener("wheel",a=>this.onReferenceWheel(a),{passive:!1}),this.ufoElement.canvasElement.addEventListener("wheel",a=>this.onBodyWheel(a),{passive:!1}),this.addMilestoneButton.addEventListener("click",()=>this.addMilestone()),this.deleteMilestoneButton.addEventListener("click",()=>this.deleteMilestone()),this.goToMilestoneButton.addEventListener("click",()=>{this.currentMilestoneT!==void 0&&this.goToMark(this.currentMilestoneT)}),this.milestoneSelect.addEventListener("change",()=>this.selectMilestone(Number(this.milestoneSelect.value)));for(const a of[this.milestoneLabelInput,this.milestoneNoteInput])a.addEventListener("input",()=>this.updateMilestone());this.showMeteorButton.addEventListener("click",()=>this.showNextMeteor()),this.shadow.getElementById("add-own-aircraft").addEventListener("click",()=>this.addOwnAircraft()),this.showCometButton.addEventListener("click",()=>this.lookAtComet()),this.showNovaButton.addEventListener("click",()=>this.lookAtNova()),this.showSatelliteButton.addEventListener("click",()=>this.showNextSatellite()),this.showFireballButton.addEventListener("click",()=>this.showNextFireball()),this.sceneElement.addEventListener(un,()=>this.showAircraftStatus()),this.sceneElement.addEventListener(pn,()=>{const a=this.currentReference();a&&this.syncReferenceStatus(a)}),this.sceneElement.addEventListener(mn,()=>{this.skyCandidatesKey=void 0,this.refreshSkyCandidates()}),this.sceneElement.addEventListener(gn,()=>{this.skyCandidatesKey=void 0,this.refreshSkyCandidates()}),this.ufoElement.addEventListener("timeupdate",()=>{this.onSelectionOrTimeChanged(),this.syncVideoRegistrationFields(),this.syncPlaybackControls(),this.scheduleFileSync(),this.dispatchEvent(new CustomEvent("sightingchange"))}),this.addEventListener("keydown",this.handleKeyDown),this.shapeAddMenu=new ci(this.addShapeButton,"add-shape-kind",a=>{const d=Te.byId(a);if(d){this.addModel(d);return}this.currentAppearance={...this.currentAppearance,presetId:a},this.addShape()},a=>`add-shape-${a}`),this.shapeAddMenu.setKinds(this.shapeAddKinds()),this.colorInput.addEventListener("input",()=>this.setAppearance({color:this.colorInput.value})),this.transparencyInput.addEventListener("input",()=>this.setAppearance({transparency:Number(this.transparencyInput.value)})),this.brightnessInput.addEventListener("input",()=>this.setAppearance({brightness:Number(this.brightnessInput.value)})),this.blurInput.addEventListener("input",()=>{this.setAppearance({blur:Number(this.blurInput.value)}),this.refreshBlurDistanceBound()}),this.haloScaleInput.addEventListener("input",()=>this.setAppearance({haloScale:Number(this.haloScaleInput.value)}));for(const a of[this.latInput,this.lngInput,this.headingInput,this.pitchInput,this.rollInput,this.elevationInput])a.addEventListener("input",()=>this.updateObserver());for(const a of[this.focalLengthInput,this.fNumberInput,this.exposureInput,this.focusDistanceInput])a.addEventListener("input",()=>this.updateObserver());this.isoInput.addEventListener("input",()=>this.updateExposureSettings()),this.filmStockSelect.addEventListener("change",()=>this.updateExposureSettings()),this.meteringSelect.addEventListener("change",()=>this.updateExposureSettings()),this.observerPosition.addEventListener("positionchange",a=>{if(this.observerSaid=a.detail.said,!this.observerPosition.relative)return;const d=this.plantingCentre();this.updateObserver(),this.keepDecorInPlace(d,this.plantingCentre())}),this.observerPosition.addEventListener("basischange",a=>this.writeObserverBasis(a.detail.basis)),this.searchPlaceButton.addEventListener("click",()=>void this.searchPlace()),this.placeNameInput.addEventListener("keydown",a=>{a.key==="Enter"&&(a.preventDefault(),this.searchPlace())}),this.placeMatchSelect.addEventListener("change",()=>this.applyPlaceMatch(this.placeMatchSelect.selectedIndex)),this.placeNameInput.addEventListener("input",()=>this.updatePlaceName()),this.headingInput.addEventListener("input",()=>this.refreshHeadingPoint()),this.filterSelect.addEventListener("change",()=>this.updateObserver()),this.instrumentSelect.addEventListener("change",()=>{const a=this.ufoElement.sighting.instrument;this.ufoElement.sighting.instrumentId=this.instrumentSelect.value;const d=new Map(this.ufoElement.sighting.timeline.allKeyframes.map(h=>[h.t,Ce.fovOf(this.ufoElement.sighting,h.t)]));this.retuneFieldOfView(a),this.retuneExposure(a),Ce.reproject(this.ufoElement.sighting,a,d),this.sceneElement.applyFrameFormat(),this.refreshFilterOptions(),this.syncOpticsFromInstrument(),this.ufoElement.refresh(),this.dispatchEvent(new CustomEvent("sightingchange"))}),this.accountViewSelect.addEventListener("change",()=>this.chooseAccountView(this.accountViewSelect.value==="bodies")),this.accountCompareInput.addEventListener("change",()=>this.syncBodiesShown()),this.utcOffsetInput.addEventListener("input",()=>this.updateUtcOffset()),this.timeZoneSelect.addEventListener("change",()=>{this.autoFilledTimeZone=void 0,this.updateTimeZone()});const l=a=>this.shadow.querySelector(`${Bt}[name="${a}"]`);this.startDate=l("obs-time"),this.endDate=l("obs-end-time"),this.birthDate=l("observer-birth"),this.perceptionSettings=this.shadow.getElementById("observerPerception"),this.perceptionSettings.providers=mt.ALL,this.applyPerceptionLabels(),this.perceptionSettings.addEventListener("settingschange",()=>this.updateObserverMetadata());for(const a of["input","change"])this.shadow.getElementById("obs-time-native")?.addEventListener(a,()=>{this.syncWeatherSourceState(),this.weatherFromRecords&&this.ufoElement.sighting.weatherSource===void 0&&this.weatherInference.canInfer(this.ufoElement.sighting)&&!this.startDateHalfEntered()&&this.scheduleWeatherLookup()});this.startDate.addEventListener("datechange",a=>{const{time:d}=a.detail;this.editDate(()=>{this.ufoElement.sighting.event.time=d}),this.syncAgeFromBirth(!0)}),this.birthDate.addEventListener("datechange",a=>{this.birth=a.detail.time,this.syncAgeFromBirth(!1),this.updateObserverMetadata()}),this.observerAgeInput.addEventListener("input",()=>this.syncBirthFromAge()),this.endDate.addEventListener("datechange",a=>{const{time:d}=a.detail;this.editDate(()=>{this.ufoElement.sighting.event.endTime=d})});for(const a of[this.observerIdInput,this.observerTitleInput,this.observerLastNameInput,this.observerFirstNamesInput,this.observerAgeInput,this.observerOccupationInput,this.sightingIdInput])a.addEventListener("input",()=>{this.updateObserverMetadata(),this.observerList.rename(y.OBSERVER_PRINCIPAL,this.principalObserverLabel())});this.descriptionInput.addEventListener("input",()=>{this.updateDescription(),this.syncNarrativeEnabled()}),this.tagsInput.addEventListener("input",()=>this.updateTags());for(const a of this.weatherFields){if(a===this.iceCrystalAlignmentInput||a===this.rareIceCrystalsInput){a.addEventListener("input",()=>this.applyIceAlignmentAtPlayhead());continue}a.addEventListener("input",()=>this.applyWeatherAtPlayhead())}for(const a of this.soundFields)a.addEventListener("input",()=>this.applySoundAtPlayhead());this.weatherInferredInput.addEventListener("change",()=>this.onWeatherInferredToggled()),this.weatherProviderSelect.addEventListener("change",()=>this.onWeatherProviderChosen()),this.weatherFileLink.addEventListener("click",()=>this.openFileItem("weather")),this.groupTabs=[...this.shadow.querySelectorAll(".group-tab")],this.groupPanels=this.groupTabs.map(a=>this.shadow.getElementById(a.getAttribute("aria-controls")));for(const a of this.groupTabs)a.addEventListener("click",()=>this.toggleGroup(a,!this.isGroupOpen(a)));new ResizeObserver(()=>this.fitGroupTabs()).observe(this.groupTabs[0].parentElement),this.subgroupTabs=[...this.shadow.querySelectorAll(".subgroup-tab")];for(const a of this.subgroupTabs)a.addEventListener("click",()=>this.openSubgroup(a));this.buildSkyParts(),Rt.fit(this.shadow),this.paramSummary=this.shadow.getElementById("param-summary"),this.paramSummary.addEventListener("click",a=>this.onParamSummaryClick(a)),this.toggleGroup(this.groupTabs[this.groupPanels.findIndex(a=>a.id==="group-shape")],!0),this.sectionChosen=!1,this.opensMostLacking=!0,this.attachWitnessErrors(),this.fileEditorHost.addEventListener("focusout",()=>this.leaveFileEditor()),this.setRecordButtonLabel(!1),this.refreshSourceList(),this.currentDecorId=this.ufoElement.sighting.decor[0]?.id,this.refreshDecorList(),this.currentReferenceId=this.ufoElement.sighting.references[0]?.id,this.refreshReferenceList(),this.currentTraceId=this.ufoElement.sighting.traces[0]?.id,this.refreshTraceList(),this.sceneElement.setCloudRendering("volume"),this.cloudEditor=Xn(this.shadow.getElementById("cloud-editor"),this.sceneElement,(a=!0)=>{a&&(this.weatherFromRecords=!1,this.cancelWeatherLookup(),this.ufoElement.sighting.weatherSource=void 0,this.syncWeatherSourceState())},(a,d)=>{this.headingInput.value=String(this.rounded(a)),this.pitchInput.value=String(this.rounded(d)),this.updateObserver()},di(Ne.preferencesFor(this),hi),this.framePlace()),this.currentMilestoneT=this.ufoElement.sighting.milestones[0]?.t,this.refreshMilestoneList(),this.onSelectionOrTimeChanged(),this.syncDurationField(),this.syncPlaybackControls(),this.refreshSourceRows(),this.refreshTimeZoneOptions(),this.syncWeatherSourceState(),this.isConnected&&(this.ready=this.loadLocaleMessages())}static get observedAttributes(){return["src"]}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=-1),Ne.preferencesFor(this).join()!==this.preferences.join()&&(this.ready=this.loadLocaleMessages()),this.shadow.addEventListener("pointerdown",this.armHistory,!0),this.shadow.addEventListener("keydown",this.armHistory,!0);for(const t of["input","change","click","keyup","pointerup"])this.shadow.addEventListener(t,this.scheduleHistoryRecord,!0);this.shadow.addEventListener("input",this.touch,!0),this.shadow.addEventListener("change",this.touch,!0),this.shadow.addEventListener("keydown",this.touchByKey,!0),window.addEventListener("beforeunload",this.warnBeforeLeaving),de.changes.addEventListener("change",this.onModulesChanged),M(async()=>{const{ModuleSession:t}=await import("./ModuleSession-BaaLmhnz.js");return{ModuleSession:t}},__vite__mapDeps([16,1,3,4,5,6,7,8,9]),import.meta.url).then(({ModuleSession:t})=>t.shared.start(),()=>{});const e=this.getAttribute("src");e&&this.importFromUrl(e)}relisters=[];onModulesChanged=e=>{for(const i of this.relisters)i();const t=e.detail;t==="weather"&&(this.followWeatherRecord(),this.fillWeatherProvider()),t==="surroundings"&&this.surveyIds&&this.fillScenerySources(),t==="decorModels"&&this.sceneElement.setDecorModelProvider(this.decorModelProvider),(t==="skyEvents"||t==="interpretations")&&this.buildSkyParts(),t==="perception"&&(this.perceptionSettings.providers=mt.ALL,this.applyPerceptionLabels())};attributeChangedCallback(e,t,i){e==="src"&&i&&i!==t&&this.isConnected&&this.importFromUrl(i)}disconnectedCallback(){window.removeEventListener("beforeunload",this.warnBeforeLeaving),de.changes.removeEventListener("change",this.onModulesChanged),this.shadow.removeEventListener("pointerdown",this.armHistory,!0),this.shadow.removeEventListener("keydown",this.armHistory,!0);for(const e of["input","change","click","keyup","pointerup"])this.shadow.removeEventListener(e,this.scheduleHistoryRecord,!0);clearTimeout(this.historyTimer),clearTimeout(this.moduleNamingTimer),this.shadow.removeEventListener("input",this.touch,!0),this.shadow.removeEventListener("change",this.touch,!0),this.shadow.removeEventListener("keydown",this.touchByKey,!0),this.cloudEditor.stopManipulation(),document.removeEventListener("click",this.handleOutsideContextMenuClick),this.endDrag(),queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor?.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0}setCloudRendering(e){this.sceneElement.setCloudRendering(e)}showWeatherEditor(){const e=this.groupPanels.findIndex(t=>t.id==="group-weather");e>=0&&this.toggleGroup(this.groupTabs[e],!0)}get sightingData(){return this.ufoElement.sightingData}set sightingData(e){const t=He.recording(e);this.sourceUrl=void 0,this.endDrag(),this.ufoElement.sightingData=t,this.sceneElement.requireModules(t.modules),this.sceneElement.applyFrameFormat(),this.cloudEditor.reset(),this.bodyEditor?.sync(),this.syncModulesPanel(),this.syncBodiesShown(),this.isGroupIdOpen("group-shape")&&this.showPhenomenonPartWithContent(),this.eventsPanel.render(),this.phenomenonEventsPanel.render(),this.bodiesEventsPanel.render(),this.aroundPanel.render(),this.currentSourceId=this.ufoElement.sighting.timeline.sourceIds[0]??it,this.selectedSourceIds=new Set([this.currentSourceId]),this.refreshSourceList(),this.currentDecorId=this.ufoElement.sighting.decor[0]?.id,this.refreshDecorList(),this.currentReferenceId=this.ufoElement.sighting.references[0]?.id,this.refreshReferenceList(),this.currentTraceId=this.ufoElement.sighting.traces[0]?.id,this.refreshTraceList(),this.currentMilestoneT=this.ufoElement.sighting.milestones[0]?.t,this.refreshMilestoneList(),this.onSelectionOrTimeChanged(),this.syncDurationField(),this.syncObservationTimeFields(),this.syncObservationEndTimeFields(),this.chooseTimeInputMode(),this.syncObserverMetadataFields(),this.offsetIsAuthors=!1,this.placeZone=void 0,this.timeZoneLookedUpAt=void 0,this.refreshTimeZoneOptions(),this.syncUtcOffsetField(),this.syncPlaceNameField(),this.syncGroundElevationField(),this.scheduleTimeZoneLookup(!1);const i=this.plantingCentre();this.surroundings.placeLoaded(i?.lat,i?.lng),this.syncSceneryPicker(),this.syncWeatherOwnership(),this.snapshotsPanel.render(),this.refreshFileItems(),!this.applyingFileText&&!this.patchingDraft&&this.resetHistory(),this.markClean(),this.sectionChosen||(this.opensMostLacking=!0)}baseline="";touched=!1;guardsLeaving=!0;get dirty(){return this.touched&&this.fileText()!==this.baseline}get edited(){return this.touched}markClean(){this.applyingFileText||(this.baseline=this.fileText(),this.touched=!1,this.savedFileText=this.baseline,this.fileEditor?.markSaved(),this.refreshEditorHead())}set embedded(e){this.shadow.getElementById("editor-head").hidden=e,this.shadow.querySelector(".app").classList.toggle("embedded",e),e||this.shadow.querySelector("#editor-head .head-actions").prepend(this.historyControls)}get historyControls(){return this.undoButton.parentElement}refreshEditorHead(){this.saveButton&&(this.refreshEditorTitle(),this.saveButton.disabled=!this.dirty,this.shareButton.disabled=this.sourceUrl===void 0,this.shareButton.title=this.sourceUrl===void 0?this.shareMessages?.unavailable??"":"")}sourceUrl;get address(){return this.sourceUrl}shareButton;shareDialog;shareMessages;shareSubject={module:"rr0-sighting-editor",link:()=>`${mi.home()}/edit/?file=${encodeURIComponent(this.sourceUrl??"")}`,element:()=>`<rr0-sighting-editor src="${this.sourceUrl??""}"></rr0-sighting-editor>`};openShare(){this.sourceUrl!==void 0&&(this.shareDialog.note=this.dirty?this.shareMessages?.unsaved:void 0,this.shareDialog.open())}refreshEditorTitle(){const e=this.ufoElement.sighting.event,t=e.place?.[0]?.name?.split(",")[0].trim(),i=e.time;let s="";i?.year!==void 0&&(s=i.month!==void 0&&i.day!==void 0?new Date(Date.UTC(i.year,i.month-1,i.day)).toLocaleDateString(this.language,{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"}):String(i.year));const n=[t,s].filter(Boolean).join(", ")||this.sightingIdInput.value||this.messages.stateNew,r=this.shadow.getElementById("editor-title");r.textContent!==n&&(r.textContent=n)}savedFileText;touch=()=>{this.touched=!0};armHistory=()=>{this.historySnapshot??=this.fileText(),this.fileEditor===void 0&&this.loadFileEditor().then(()=>{this.recordHistory(),this.syncHistoryButtons()},()=>{})};scheduleHistoryRecord=()=>{this.scheduleModuleNaming(),this.historySnapshot!==void 0&&(clearTimeout(this.historyTimer),this.historyTimer=setTimeout(()=>this.recordHistory(),350))};recordHistory(){this.historyTimer=void 0;const e=this.fileEditor;if(e===void 0||this.historySnapshot===void 0)return;const t=this.fileText();t!==this.historySnapshot&&(this.historySnapshot=t,this.historyAnswering=!1,e.replaceText(t,this.fileSyncActive()),this.fileTextApplied=e.text,this.syncHistoryButtons(),this.refreshEditorHead())}undo(){this.stepHistory(e=>e.undo(this.fileSyncActive()))}redo(){this.stepHistory(e=>e.redo(this.fileSyncActive()))}stepHistory(e){this.historyTimer!==void 0&&(clearTimeout(this.historyTimer),this.recordHistory());const t=this.fileEditor;t===void 0||this.isRecording||this.ufoElement.playbackState==="playing"||e(t)&&(clearTimeout(this.fileApplyTimer),this.applyFileText(t.text,!0),this.historyAnswering=!0,this.syncHistoryButtons(),this.refreshEditorHead())}syncHistoryButtons(){this.undoButton.disabled=!(this.fileEditor?.canUndo??!1),this.redoButton.disabled=!(this.fileEditor?.canRedo??!1)}resetHistory(){clearTimeout(this.historyTimer),this.historyTimer=void 0,this.historySnapshot=void 0,this.historyAnswering=!1,this.fileEditor?.destroy(),this.fileEditor=void 0,this.fileTextApplied=void 0,this.fileEditorLoading=void 0,this.syncHistoryButtons(),this.isGroupIdOpen("group-file")&&this.loadFileEditor().then(()=>this.syncFileEditor(!1),()=>{})}touchByKey=e=>{(e.key==="Delete"||e.key==="Backspace")&&(this.touched=!0)};warnBeforeLeaving=e=>{!this.guardsLeaving||!this.dirty||(e.preventDefault(),e.returnValue="")};holdLoad(e){return!this.dispatchEvent(new CustomEvent("beforeload",{detail:{proceed:e,dirty:this.dirty},cancelable:!0,bubbles:!0,composed:!0}))}exportJson(){const e=this.shadow.getElementById("save-refused"),t=V.issues(this.ufoElement.sighting);if(F.show(e,t.length===0?void 0:this.messages.saveRefused.replace("{reasons}",t.map(s=>this.actorIssue(s)).join(" ; ")),"error"),t.length>0)return;const i=_.inspect(this.sightingData,this.loadedJson());if(i.length===0){this.downloadJson();return}this.askAboutIdentity(i)}actorIssue(e){const t=this.messages;if(e.kind==="duplicate-id")return t.duplicateId.replace("{id}",e.id).replace("{kinds}",e.path.split(", ").map(n=>t.actorKinds[n]??n).join(", "));const i=Number(e.path.split(".")[1]),s=this.ufoElement.sighting.events?.[i];return t.unknownWho.replace("{n}",String(i+1)).replace("{kind}",(s&&t.events.kinds[s.eventType])??s?.eventType??"").replace("{id}",e.id)}loadedJson(){try{return this.baseline?JSON.parse(this.baseline):void 0}catch{return}}askAboutIdentity(e){const t={lastName:this.messages.identityLastName,firstNames:this.messages.identityFirstNames,nameInId:this.messages.identityNameInId,nameInText:this.messages.identityNameInText,address:this.messages.identityAddress,email:this.messages.identityEmail,phone:this.messages.identityPhone};this.shadow.getElementById("identity-ask-text").textContent=this.messages.identityAsk,this.shadow.getElementById("identity-ask-found").replaceChildren(...e.map(n=>{const r=document.createElement("li");return r.textContent=t[n.kind].replaceAll("{value}",n.found),r}));const s=e.some(n=>["lastName","firstNames","nameInId","nameInText"].includes(n.kind));this.shadow.getElementById("identity-ask-initials").hidden=!s,typeof this.identityAsk.showModal=="function"?this.identityAsk.showModal():this.identityAsk.setAttribute("open","")}closeIdentityAsk(){typeof this.identityAsk.close=="function"?this.identityAsk.close():this.identityAsk.removeAttribute("open")}writeNamesAsInitials(){const e=_.namesOf(this.sightingData);this.observerLastNameInput.value=_.withInitials(this.observerLastNameInput.value,e),this.observerFirstNamesInput.value=this.observerFirstNamesInput.value.split(",").map(t=>_.withInitials(t.trim(),e)).join(", "),this.observerIdInput.value=_.withInitials(this.observerIdInput.value,e,!0),this.sightingIdInput.value=_.withInitials(this.sightingIdInput.value,e,!0),this.descriptionInput.value=_.withInitials(this.descriptionInput.value,e),this.touch(),this.updateObserverMetadata(),this.descriptionInput.dispatchEvent(new Event("input"))}async downloadJson(){const e=this.fileBase();let t=new Map;if(this.snapshotsPanel.hasWork()){this.exportButton.disabled=!0;try{t=await this.snapshotsPanel.prepare(e)}finally{this.exportButton.disabled=!1}}const i=this.sightingData;for(const r of U.NAMES){const o=this.sectionFilePanel.annex(r);o&&(/^[a-z][a-z0-9+.-]*:/i.test(o.src)||t.set(o.src,o.bytes),U.strip(r,i))}const s=`${e}.json`,n=this.writtenText(i);if(t.size===0)this.download(new Blob([n],{type:"application/json"}),s);else{const{zipSync:r,strToU8:o}=await M(async()=>{const{zipSync:d,strToU8:h}=await import("./browser-CltifEM0.js");return{zipSync:d,strToU8:h}},[],import.meta.url),l={[s]:o(n)};for(const[d,h]of t)l[d]=h;const a=r(l,{level:0});this.download(new Blob([a],{type:"application/zip"}),`${e}.zip`),this.showFileNote(this.messages.snapshotExported.replaceAll("{count}",String(t.size)).replaceAll("{size}",W.size(a.length)))}this.markClean()}fileBase(){const e=this.sceneElement.documentUrl?.split(/[?#]/)[0].split("/").pop();return e?.endsWith(".json")&&e.length>5?decodeURIComponent(e.slice(0,-5)):`${this.sightingData.observer?.id??"sighting"}-sighting`}refreshFileItems(){const e=this.fileItemSelect;if(!e||!this.worded)return;this.syncFilePickers();const t=e.value||"recording";e.replaceChildren(new Option(this.messages.fileItemRecording,"recording"),...U.NAMES.map(i=>new Option(this.sectionFilePanel.itemLabel(i),i)),...J.NAMES.map(i=>new Option(this.snapshotsPanel.itemLabel(i),i)),new Option(this.messages.fileItemModules,y.MODULES_ITEM)),e.value=t,this.showFileItem(e.value)}showFileItem(e){const t=J.NAMES.includes(e),i=U.NAMES.includes(e)?e:void 0,s=e===y.MODULES_ITEM;this.shadow.getElementById("file-recording").hidden=t||i!==void 0||s,this.shadow.getElementById("snapshot-data").hidden=!t,this.shadow.getElementById("file-section").hidden=i===void 0,this.shadow.getElementById("file-modules").hidden=!s,s&&this.loadModulesPanel();for(const r of["file-recording","snapshot-data","file-section","file-modules"]){const o=this.shadow.getElementById(r);o.hidden||ge.glue(o)}t&&this.snapshotsPanel.show(e),i&&this.sectionFilePanel.show(i);const n=t&&this.snapshotsPanel.isInlineGroup(e)?["snapshots",e,"src"]:i&&this.sectionFilePanel.isInline(i)?Wt.pathOf(i):void 0;this.fileEditorHost.hidden=(t||i!==void 0||s)&&n===void 0,n&&this.isGroupIdOpen("group-file")&&this.loadFileEditor().then(r=>{this.syncFileEditor(!1),r.reveal(n)},()=>{})}moduleNamingTimer;scheduleModuleNaming(){clearTimeout(this.moduleNamingTimer),this.moduleNamingTimer=setTimeout(()=>void this.nameModulesOfModels(),400)}async nameModulesOfModels(){const e=this.decorModelProvider;if(!(e instanceof Vt)||de.installed().length===0)return;const t=this.ufoElement.sighting,i=new Set([...t.decor.map(r=>r.model?.id),...(t.interpretation?.bodies??[]).map(r=>r.model?.id)].filter(r=>typeof r=="string")),s=this.sceneElement.documentUrl;let n=t.modules;for(const r of i){const o=await e.moduleOf(r),l=o===void 0?void 0:de.installed().find(a=>a.id===o)?.url;!l||ms.names(n,l,s)||(n=[...n??[],ms.of(l,s)])}n===t.modules||this.ufoElement.sighting!==t||(t.modules=n,this.syncModulesPanel(),this.syncFileEditor(!1))}static MODULES_ITEM="modules";modulesPanel;modulesPanelLoading;loadModulesPanel(){return this.modulesPanelLoading??=M(async()=>{const{register:e,ModulesPanelElement:t}=await import("./ModulesPanelElement-BqF6eK1X.js");return{register:e,ModulesPanelElement:t}},__vite__mapDeps([17,1,16,3,4,5,6,7,8,9,18,19,20,21,22,23,24]),import.meta.url).then(({register:e,ModulesPanelElement:t})=>{e();const i=this.shadow.getElementById("modules-panel");this.modulesPanel=i,i.addEventListener("recordingmoduleschange",()=>{const s=i.recordingModules;this.ufoElement.sighting.modules=s.length>0?s:void 0,this.syncFileEditor(!1)}),i.checkContext=()=>({weatherQuery:this.weatherInference.queryOf(this.ufoElement.sighting),interpretation:this.ufoElement.sighting.interpretation}),i.setLanguage(this.language),this.syncModulesPanel()}),this.modulesPanelLoading}syncModulesPanel(){this.modulesPanel&&(this.modulesPanel.base=this.sceneElement.documentUrl,this.modulesPanel.recordingModules=this.ufoElement.sighting.modules)}sectionFromFile(e){return U.fromFile(this.ufoElement.sighting.snapshots,e)}masterUrl(){return this.sceneElement.documentUrl??new URL(`${this.fileBase()}.json`,location.href).href}weatherFileItemLabel(){return this.sectionFilePanel?.itemLabel("weather")??""}download(e,t){const i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=t,s.click(),URL.revokeObjectURL(i)}snapshotSources(){const e=z(gt,this.chosenSourceId.get("elevation"));return{elevation:e.create(),elevationCredit:e.credit,imagery:z(ot,this.chosenSourceId.get("imagery")).id,roads:vn(),water:bn(),railways:fn()}}async importFromFile(e){this.holdLoad(()=>void this.loadFile(e))||await this.loadFile(e)}async loadFile(e){this.showLoadError(void 0);try{const t=new Uint8Array(await new Promise((n,r)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=()=>r(o.error),o.readAsArrayBuffer(e)}));le.release();const i=await this.recordingText(t),s=JSON.parse(i);if(ie.isCase(s)){if(ie.check(s),this.offerCase(s,void 0))return;throw new Error("A case has no recording to edit here")}this.sceneElement.documentUrl=void 0,this.sightingData=s,this.refreshEditorHead(),this.dispatchEvent(new CustomEvent("recordingloaded",{bubbles:!0,composed:!0})),this.importInput.url=""}catch(t){this.showLoadError(t)}}async recordingText(e){if(e[0]!==80||e[1]!==75)return new TextDecoder().decode(e);const{unzipSync:t,strFromU8:i}=await M(async()=>{const{unzipSync:h,strFromU8:c}=await import("./browser-CltifEM0.js");return{unzipSync:h,strFromU8:c}},[],import.meta.url),s=t(e),n=/\.(relief|imagery|map)\.zip$|\.(roads|water|railways|upper-air|weather|place|light-pollution|decor)\.json$/,r=Object.keys(s).find(h=>h.endsWith(".json")&&!n.test(h));if(!r)throw new Error("No recording in this archive");const o=r.includes("/")?r.slice(0,r.lastIndexOf("/")+1):"";for(const[h,c]of Object.entries(s))h!==r&&h.startsWith(o)&&le.hold(le.address(h.slice(o.length),void 0),c);const l=i(s[r]),a=JSON.parse(l);let d=!1;for(const h of U.NAMES){const c=a.snapshots?.[h]?.src,u=c!==void 0?s[o+c]:void 0;if(!u)continue;const p=He.recording(JSON.parse(i(u)));U.put(h,a,p),d=!0}return d?JSON.stringify(a):l}offerCase(e,t){return!this.dispatchEvent(new CustomEvent("caseloaded",{detail:{json:e,url:t},bubbles:!0,composed:!0,cancelable:!0}))}bodyShapeIds(){return this.accountShapeIds?[...this.accountShapeIds]:this.ufoElement.sighting.timeline.sourceIds}set documentUrl(e){this.sceneElement.documentUrl=e}async importFromUrl(e=this.importInput.url){e&&(this.holdLoad(()=>void this.loadUrl(e))||await this.loadUrl(e))}holdForNewScene(e){this.sceneElement.holdForNewScene(e)}async loadUrl(e){this.showLoadError(void 0),this.holdForNewScene();try{const t=await Ye.recording(e);if(ie.isCase(t)){ie.check(t);const s=new URL(e,location.href).href;if(this.offerCase(t,s)){this.importInput.url=s;return}throw new Error("A case has no recording to edit here")}const i=t;le.release(),this.sceneElement.documentUrl=new URL(e,location.href).href,this.sightingData=i,this.sourceUrl=_e.local(e)?void 0:new URL(e,location.href).href,this.importInput.url=new URL(e,location.href).href,this.refreshEditorHead(),this.dispatchEvent(new CustomEvent("recordingloaded",{bubbles:!0,composed:!0}))}catch(t){this.showLoadError(t)}}loadError;showLoadError(e){this.loadError=e===void 0?void 0:{error:e},this.sayLoadError()}sayLoadError(){F.show(this.shadow.getElementById("load-error"),this.loadError&&this.importErrorFor(this.loadError.error),"error")}importErrorFor(e){if(e instanceof Ct)return e.said(this.messages.formatVersionError);if(!(e instanceof Hs))return this.messages.importError;switch(e.kind){case"cors":return this.messages.importErrorCors;case"mixed-content":return this.messages.importErrorMixedContent;case"unreachable":return this.messages.importErrorUnreachable;case"status":return this.messages.importErrorStatus.replace("{status}",String(e.status??""));case"malformed":return this.messages.importErrorMalformed;default:return this.messages.importError}}static NARRATIVE_KEY_STORAGE="rr0-sighting-editor.narrative-key";static NARRATIVE_SCOPE_STORAGE="rr0-sighting-editor.narrative-workspace";static SCENERY_STORAGE="rr0-sighting-editor.surroundings";static SCENERY_RADIUS_STORAGE="rr0-sighting-editor.surroundings-radius";static NO_SCENERY="none";narrativeProvider=vt[0].create();get narrativeSourceId(){return z(vt,this.chosenSourceId.get("narrative")).id}narrativeAbort;async draftFromDescription(){const e=this.descriptionInput.value.trim();if(e===""||this.narrativeAbort)return;const t=this.narrativeAbort=new AbortController;this.setNarrativeBusy(!0);try{const i=await this.narrativeProvider.draft({ask:e,current:this.sightingData,language:y.LANGUAGE_NAMES.of(this.showerLanguage())??"English",settings:this.narrativeSettingValues()},t.signal);this.applyNarrativeDraft(i)}catch(i){const s=i instanceof he&&i.kind==="cancelled";this.narrativeStatus.textContent=s?"":this.narrativeErrorFor(i),this.narrativeStatus.classList.toggle("error",!s)}finally{this.narrativeAbort=void 0,this.setNarrativeBusy(!1)}}applyNarrativeDraft(e){const{description:t,...i}=e.recording,{utcOffsetHours:s,...n}=i,r=i.timeZone?n:i,o=Ee.stated(r);if(o.length>0){const l=this.ufoElement.sighting.provenance,a=Bi(this.ufoElement.sighting);this.patchingDraft=!0;try{this.sightingData=Ee.apply(a,_t.loadable(r),o)}finally{this.patchingDraft=!1}this.ufoElement.sighting.provenance=l,this.recordNarrativeProvenance(e,o),this.ufoElement.sighting.event.timeZone&&this.applyTimeZoneOffset()}this.narrativeStatus.textContent=o.length>0?this.messages.narrativeApplied.replace("{count}",String(o.length)):this.messages.narrativeUnchanged,this.narrativeStatus.classList.remove("error"),this.showNarrativeReport(e),this.syncNarrativeEnabled()}recordNarrativeProvenance(e,t){const i=this.ufoElement.sighting,s=new Set(t);for(const n of e.claims)!s.has(n.path)&&!t.some(r=>n.path.startsWith(`${r}.`))||i.provenance.set(n.path,{basis:n.basis,rationale:n.rationale,of:y.valueAt(Bi(this.ufoElement.sighting),n.path)})}static valueAt(e,t){let i=e;for(const s of t.split(".")){if(typeof i!="object"||i===null)return;i=i[s]}return i}showNarrativeReport(e){this.narrativeReport.replaceChildren();for(const t of["assumed","derived","stated"]){const i=e.claims.filter(s=>s.basis===t);if(i.length!==0){this.narrativeReport.append(this.narrativeHeading(this.messages[ao[t]]));for(const s of i){const n=document.createElement("div");n.className=`claim ${t}`;const r=document.createElement("code");r.textContent=s.path;const o=document.createElement(t==="stated"?"q":"span");o.textContent=s.rationale,n.append(r,o),this.narrativeReport.append(n)}}}if(e.gaps.length>0){this.narrativeReport.append(this.narrativeHeading(this.messages.narrativeGaps));const t=document.createElement("ul");t.className="gaps";for(const i of e.gaps){const s=document.createElement("li");s.textContent=i,t.append(s)}this.narrativeReport.append(t)}this.narrativeReport.hidden=this.narrativeReport.childElementCount===0}narrativeHeading(e){const t=document.createElement("h4");return t.textContent=e,t}setNarrativeBusy(e){this.descriptionInput.disabled=e,this.narrativeStopButton.hidden=!e,e&&(this.narrativeStatus.textContent=this.messages.narrativeWorking,this.narrativeStatus.classList.remove("error")),this.syncNarrativeEnabled()}syncNarrativeEnabled(){const e=z(vt,this.chosenSourceId.get("narrative")).name,t=this.narrativeProvider.settings.find(s=>s.required&&(this.narrativeSettingInputs.get(s.id)?.value.trim()??"")===""),i=this.descriptionInput.value.trim()==="";this.narrativeDraftButton.disabled=!!this.narrativeAbort||t!==void 0||i,this.narrativeDraftButton.title=t?this.messages.narrativeNeedsSetting.replace("{setting}",this.said.read(t.label)??t.id).replace("{source}",e):i?this.messages.narrativeNeedsAsk:"";for(const s of this.narrativeProvider.settings){const n=this.narrativeSettingInputs.get(s.id);if(!n||!s.suspect)continue;const r=n.value.trim(),o=r===""?void 0:s.suspect(r);n.classList.toggle("invalid",o!==void 0),n.title=o?this.said.read(o)??"":this.said.read(s.hint)??""}}renderNarrativeSettings(){const e=this.narrativeSettingValues();this.narrativeSettingInputs=new Map;const t=this.narrativeProvider.settings.map(i=>{const s=document.createElement("label"),n=document.createElement("span");n.textContent=this.said.read(i.label)??i.id;let r;if(i.kind==="choice"){r=document.createElement("select");for(const l of i.choices??[]){const a=document.createElement("option");a.value=l.value,a.textContent=this.said.read(l.label)??l.value,r.appendChild(a)}}else r=document.createElement("input"),r.type=i.kind==="secret"?"password":"text",r.autocomplete="off",r.spellcheck=!1,r.placeholder=this.said.read(i.placeholder)??"",r.placeholder&&(r.style.minWidth=`min(${r.placeholder.length+3}ch, 100%)`);r.id=`narrative-${i.id}`,r.title=this.said.read(i.hint)??"";const o=e[i.id]??this.storedNarrativeSetting(i.id);return o!==void 0&&(r.value=o),r.addEventListener(i.kind==="choice"?"change":"input",()=>{this.rememberNarrativeSettings(),this.syncNarrativeEnabled()}),this.narrativeSettingInputs.set(i.id,r),s.append(n,document.createTextNode(" "),r),s});this.narrativeSettingsBox.replaceChildren(...t),this.forgetStoredCredentials(),this.syncNarrativeEnabled()}narrativeSettingValues(){const e={};for(const[t,i]of this.narrativeSettingInputs){const s=i.value.trim();s!==""&&(e[t]=s)}return e}narrativeErrorFor(e){if(!(e instanceof he))return this.messages.narrativeErrorMalformed;switch(e.kind){case"rejected":return this.messages.narrativeErrorRejected.replace("{detail}",e.detail??"");case"credential":return this.messages.narrativeErrorCredential;case"rate-limited":return this.messages.narrativeErrorRateLimited;case"refused":return this.messages.narrativeErrorRefused;case"unreachable":return this.messages.narrativeErrorUnreachable;default:return this.messages.narrativeErrorMalformed}}static pageCredentials=new Map;static forgetCredentials(){y.pageCredentials.clear(),qt.forget()}rememberNarrativeSettings(){for(const e of this.narrativeProvider.settings){const t=this.narrativeStorageKey(e.id),i=this.narrativeSettingInputs.get(e.id)?.value??"";if(e.remembered==="credential")i!==""?y.pageCredentials.set(t,i):y.pageCredentials.delete(t);else if(e.remembered==="preference")try{i!==""?localStorage.setItem(t,i):localStorage.removeItem(t)}catch{}}}forgetStoredCredentials(){try{for(const e of this.narrativeProvider.settings)e.remembered==="credential"&&localStorage.removeItem(this.narrativeStorageKey(e.id));localStorage.removeItem(y.NARRATIVE_KEY_STORAGE),localStorage.removeItem(y.NARRATIVE_SCOPE_STORAGE)}catch{}}narrativeStorageKey(e){return`rr0-sighting-editor.narrative.${this.narrativeSourceId}.${e}`}storedNarrativeSetting(e){const t=this.narrativeStorageKey(e),i=this.narrativeProvider.settings.find(s=>s.id===e);if(i?.remembered==="credential")return y.pageCredentials.get(t);if(i?.remembered==="preference")try{return localStorage.getItem(t)??void 0}catch{return}}numberOrUndefined(e){return e===""?void 0:Number(e)}stringOrUndefined(e){return e===""?void 0:e}wrapDegrees(e,t){if(e===void 0)return;const i=(e%360+360)%360;return String(i)!==t.value&&(t.value=String(i)),i}refreshSourceRows(){this.relisters.length=0,this.placeSourceRow.replaceChildren(document.createTextNode(`${this.messages.according} `),y.creditLink(z(ni,this.chosenSourceId.get("place")))),this.weatherSourceRow.replaceChildren(),this.fillWeatherProvider(),this.sourcePickers(this.shadow.getElementById("weather-source-rows"),"weather-source-kind","weather",[["weather",this.messages.fileItemWeather,this.shadow.getElementById("weather-picker")],["upper-air",this.messages.snapshotUpperAir,this.sourcePicker("upper-air",Gn,()=>{},this.groupChoice(["upperAir"]))]]),this.lightPollutionSourceRow.replaceChildren(document.createTextNode(`${this.messages.according} `),y.creditLink(z(yt,this.chosenSourceId.get("light-pollution")))),this.narrativeSourceRow.replaceChildren(this.sourcePicker("narrative",vt,e=>{const t=this.narrativeProvider=e.create();this.renderNarrativeSettings(),t.localize?.(this.language).then(()=>{t===this.narrativeProvider&&this.renderNarrativeSettings()})})),this.sourcePickers(this.terrainSourceRows,"source-kind","location",[["place",this.messages.fileItemPlace,this.sourcePicker("place",ni,e=>{this.placeProvider=e.create(),this.refreshSourceCredits()},this.sectionChoice("place",()=>this.schedulePlaceReverse()))],["light-pollution",this.messages.fileItemLightPollution,this.sourcePicker("light-pollution",yt,e=>{this.lightPollutionProvider=e.create(),this.refreshSourceCredits(),this.scheduleLightPollutionLookup()},this.sectionChoice("lightPollution",()=>this.scheduleLightPollutionLookup()))],["elevation",this.messages.sourceElevation,this.sourcePicker("elevation",gt,()=>this.applyTerrainSources(),this.groupChoice(["relief"]))],["imagery",this.messages.sourceImagery,this.sourcePicker("imagery",ot,()=>this.applyTerrainSources(),this.groupChoice(["imagery","map"]))],["roads",this.messages.snapshotRoads,this.sourcePicker("roads",[y.LIVE_ROADS],()=>{},this.groupChoice(["roads"]))],["water",this.messages.snapshotWater,this.sourcePicker("water",[y.LIVE_WATER],()=>{},this.groupChoice(["water"]))],["railways",this.messages.snapshotRailways,this.sourcePicker("railways",[y.LIVE_RAILWAYS],()=>{},this.groupChoice(["railways"]))]]),this.shadow.getElementById("label-aircraft-source").textContent=this.messages.sourceAircraft,this.shadow.getElementById("aircraft-own-hint").textContent=this.messages.aircraftOwnHint,this.shadow.getElementById("add-own-aircraft").textContent=this.messages.addOwnAircraft,this.shadow.getElementById("aircraft-source-row").replaceChildren(this.aircraftPicker()),this.sourcePickers(this.shadow.getElementById("decor-source-rows"),"decor-source-kind","decor",[["scenery",this.messages.fileItemDecor,this.shadow.getElementById("scenery-picker")],["decor-model",this.messages.decorModel,this.sourcePicker("decor-model",Fi,()=>this.applyDecorModelSource())]])}sourcePicker(e,t,i,s){const n=document.createDocumentFragment(),r=document.createElement("select");r.id=`${e}Source`;const o=()=>{r.replaceChildren(...t.map(f=>{const g=document.createElement("option");return g.value=f.id,g.textContent=f.name,g.title=f.credit,g})),s&&r.appendChild(new Option(this.messages.sourceFile,y.FILE_SOURCE))};o();const l=()=>{const f=this.chosenSourceId.get(e);return f!==void 0&&t.some(g=>g.id===f)?f:t[0].id};r.value=s?.fromFile()?y.FILE_SOURCE:l();const a=document.createElement("a");a.className="source-credit",a.target="_blank",a.rel="noopener noreferrer";const d=document.createElement("button");d.type="button",d.className="link source-file-link",d.addEventListener("click",()=>this.openFileItem(s.item));const h=document.createElement("label");h.className="source-key";const c=document.createElement("input");c.type="password",c.id=`${e}SourceKey`,c.autocomplete="off",c.spellcheck=!1,c.title=this.messages.sourceKeyHint;const u=document.createElement("a");u.className="source-credit",u.target="_blank",u.rel="noopener noreferrer",u.textContent=this.messages.sourceKeyGet,h.append(document.createTextNode(`${this.messages.sourceKey} `),c,document.createTextNode(" "),u),c.addEventListener("change",()=>{const f=z(t,r.value);qt.set(f.id,c.value),i(f,!0)});const p=()=>{const f=r.value===y.FILE_SOURCE,g=z(t,f?l():r.value);h.hidden=f||!g.keyUrl,u.href=g.keyUrl??"",c.value=qt.of(g.id)??"",r.title=f?s.where():g.credit,a.hidden=f,a.href=g.creditUrl,a.textContent=g.credit,d.hidden=!f,f&&(d.textContent=s.label(),d.title=s.where())};p(),r.addEventListener("change",()=>{const f=r.value===y.FILE_SOURCE;f||this.chosenSourceId.set(e,r.value),s?.setFromFile(f),p(),f||i(z(t,r.value))}),s&&this.filePickers.set(e,()=>{r.value=s.fromFile()?y.FILE_SOURCE:l(),p()});const m=()=>{const f=r.value,g=this.chosenSourceId.has(e)&&!t.some(b=>b.id===this.chosenSourceId.get(e));g&&this.chosenSourceId.delete(e),o(),r.value=f===y.FILE_SOURCE&&s?f:l(),p(),g&&r.value!==y.FILE_SOURCE&&i(z(t,r.value))};return this.relisters.push(m),n.append(r,document.createTextNode(" "),a,d,h),n}aircraftPicker(){const e=this.sourcePicker("aircraft",Ni,(t,i)=>this.applyAircraftSource(i));return e.append(this.aircraftStatus),this.showAircraftStatus(),e}get aircraftTabOpen(){return this.isGroupIdOpen("group-weather")&&this.shadow.getElementById("weather-aircraft")?.hidden===!1}showAircraftFlights(){if(this.aircraftTabOpen){if(this.ufoElement.playbackState==="playing"){const e=performance.now();if(e-this.aircraftFlightsShownAt<1e3)return;this.aircraftFlightsShownAt=e}this.aircraftFlights.show(this.sceneElement.aircraftFlights,this.messages)}}aimAtFlight(e){if(e.key===this.aircraftFlights.selectedKey){this.aircraftFlights.select(void 0,this.messages),this.sceneElement.markFlight(void 0);return}if(!e.sky&&e.firstMs===void 0)return;const t=e.sky?this.ufoElement.currentTime:e.firstMs;e.sky||this.goToMark(t),this.sceneElement.lookAtFlight(e.key,t),this.aircraftFlights.select(e.key,this.messages),this.sceneElement.markFlight(e.key),this.showAircraftFlights()}showAircraftStatus(){this.showAircraftFlights();const{status:e,problem:t,partial:i,creditsSpent:s,total:n}=this.sceneElement.aircraftState,r=[];e==="loading"&&r.push(this.messages.aircraftLoading),e==="outside"&&r.push(this.messages.aircraftOutside),e==="byHand"&&r.push(this.messages.aircraftByHand),e==="unavailable"&&!t&&r.push(this.messages.aircraftProblems.network),e==="ready"&&n===0&&r.push(this.messages.aircraftNone),i&&r.push(this.messages.aircraftPartial.replace("{traced}",String(i.traced)).replace("{seen}",`${i.seen}${i.moreSeen?"+":""}`).replace("{km}",String(i.withinKm))),s&&r.push(this.messages.aircraftCredits.replace("{credits}",String(s))),t?F.show(this.aircraftStatus,[this.messages.aircraftProblems[t],...r].join(" "),"warning"):F.show(this.aircraftStatus,r.length>0?r.join(" "):void 0,"info")}groupChoice(e){return{item:e[0],fromFile:()=>!this.snapshotsPanel.isLive(e[0]),setFromFile:t=>{for(const i of e)this.snapshotsPanel.setLive(i,!t)},label:()=>this.snapshotsPanel.itemLabel(e[0]),where:()=>this.snapshotsPanel.where(e[0])}}sectionChoice(e,t){return{item:e,fromFile:()=>this.sectionFromFile(e),setFromFile:i=>{const s={...this.ufoElement.sighting.snapshots??{}};i?s[e]=s[e]??{}:delete s[e],this.ufoElement.sighting.snapshots=J.isEmpty(s)?void 0:s,this.touch(),this.scheduleFileSync(),this.refreshFileItems(),i||t()},label:()=>this.sectionFilePanel.itemLabel(e),where:()=>this.sectionFilePanel.where(e)}}static FILE_SOURCE="file";filePickers=new Map;syncFilePickers(){for(const e of this.filePickers.values())e()}openFileItem(e){const t=this.groupTabs.find(i=>i.getAttribute("aria-controls")==="group-file");t&&this.toggleGroup(t,!0),this.fileItemSelect.value=e,this.showFileItem(e)}static LIVE_ROADS={id:"ign-osm",name:"IGN BD TOPO / OpenStreetMap",credit:"© IGN, BD TOPO (Licence Ouverte 2.0) in France; © OpenStreetMap contributors (ODbL) elsewhere",creditUrl:"https://www.openstreetmap.org/copyright",create:()=>{}};static LIVE_WATER=y.LIVE_ROADS;static LIVE_RAILWAYS=y.LIVE_ROADS;sourcePickers(e,t,i,s){const n=document.createElement("label"),r=document.createElement("span");r.id=`label-${t}`,r.textContent=this.messages.sourceKind;const o=document.createElement("select");o.id=t;const l=s.map(([d,h,c])=>{o.append(new Option(h,d));const u=document.createElement("span");return u.className="source-picker",u.dataset.kind=d,u.append(c),u});o.value=this.sourceKindShown.get(i)??s[0][0];const a=()=>{this.sourceKindShown.set(i,o.value);for(const d of l)d.hidden=d.dataset.kind!==o.value};o.addEventListener("change",a),a(),n.append(r,document.createTextNode(" "),o),e.replaceChildren(n,...l)}sourceKindShown=new Map;static creditLink(e){const t=document.createElement("a");return t.className="source-credit",t.target="_blank",t.rel="noopener noreferrer",t.href=e.creditUrl,t.textContent=e.credit,t}refreshSourceCredits(){this.placeSourceRow.replaceChildren(document.createTextNode(`${this.messages.according} `),y.creditLink(z(ni,this.chosenSourceId.get("place")))),this.lightPollutionSourceRow.replaceChildren(document.createTextNode(`${this.messages.according} `),y.creditLink(z(yt,this.chosenSourceId.get("light-pollution"))))}applyTerrainSources(){this.sceneElement.setTerrainProviders({elevation:z(gt,this.chosenSourceId.get("elevation")).create(),imagery:z(ot,this.chosenSourceId.get("imagery")).create()}),this.ufoElement.refresh()}applyAircraftSource(e=!1){this.sceneElement.setAircraftSource(z(Ni,this.chosenSourceId.get("aircraft")),e),this.showAircraftStatus(),this.ufoElement.refresh()}applyDecorModelSource(){this.decorModelProvider=new Vt(z(Fi,this.chosenSourceId.get("decor-model")).id),this.sceneElement.setDecorModelProvider(this.decorModelProvider),this.decorModelEntries=void 0,this.refreshDecorModelOptions(this.ufoElement.sighting.decor.find(e=>e.id===this.currentDecorId)),this.ufoElement.refresh()}get placeSearchLanguage(){return navigator.languages?.[0]}set placeSearchProvider(e){this.placeProvider=e}async searchPlace(){const e=this.placeNameInput.value.trim();if(e===""||this.sectionFromFile("place"))return;const t=++this.placeSearchToken;this.placeStatusText.textContent=this.messages.placeSearching;let i;try{i=await this.placeProvider.search(e,{language:this.placeSearchLanguage})}catch{if(t!==this.placeSearchToken)return;this.placeStatusText.textContent=this.messages.placeSearchFailed;return}t===this.placeSearchToken&&(this.placeMatches=i,this.refreshPlaceMatches(),i.length>0&&this.applyPlaceMatch(0))}refreshPlaceMatches(){this.placeMatchSelect.replaceChildren(...this.placeMatches.map(t=>{const i=document.createElement("option");return i.textContent=t.name,i.title=t.name,i})),this.placeMatchRow.hidden=this.placeMatches.length===0;const e=this.placeMatches.length===1?this.messages.placeMatchFound:this.messages.placeMatchesFound;this.placeStatusText.textContent=this.placeMatches.length===0?this.messages.placeNotFound:`${this.placeMatches.length} ${e} `,this.placeSourceRow.hidden=this.placeMatches.length===0}applyPlaceMatch(e){const t=this.placeMatches[e];t&&(this.placeMatchSelect.selectedIndex=e,this.placeNameInput.value=t.name,this.placeNameInput.title=t.name,this.latInput.value=String(t.lat),this.lngInput.value=String(t.lng),this.namedCoordinates={lat:t.lat,lng:t.lng},this.updateObserver())}updatePlaceName(){this.placeMatches=[],this.placeMatchRow.hidden=!0,this.placeStatusText.textContent="",this.placeSourceRow.hidden=!0,this.placeNameInput.title=this.placeNameInput.value,this.namedCoordinates=void 0,this.updateObserver()}schedulePlaceReverse(){if(!this.namedCoordinates||this.sectionFromFile("place"))return;const e=this.plantingCentre();if(!e)return;const{lat:t,lng:i}=e;Math.abs(t-this.namedCoordinates.lat)<qe&&Math.abs(i-this.namedCoordinates.lng)<qe||(clearTimeout(this.placeReverseTimer),this.placeReverseTimer=setTimeout(()=>void this.reversePlace(t,i),fs))}timeZoneIsStated(){const e=this.ufoElement.sighting.event;return e.timeZone?e.timeZone!==this.autoFilledTimeZone:e.utcOffsetHours!==void 0}scheduleTimeZoneLookup(e=!0){const t=this.numberOrUndefined(this.latInput.value),i=this.numberOrUndefined(this.lngInput.value);if(t===void 0||i===void 0)return;const s=this.timeZoneLookedUpAt;s&&Math.abs(t-s.lat)<qe&&Math.abs(i-s.lng)<qe||(clearTimeout(this.timeZoneLookupTimer),this.timeZoneLookupTimer=setTimeout(()=>void this.lookUpTimeZone(t,i,e),fs))}async lookUpTimeZone(e,t,i){const s={lat:e,lng:t};this.timeZoneLookedUpAt=s;const n=await this.timeZoneProvider.zoneAt(e,t);if(this.timeZoneLookedUpAt===s){if(this.placeZone=n??void 0,!n||!i||this.timeZoneIsStated()||!this.timeZones.available().includes(n)){this.timeZoneSelect.value=this.zoneShown(),this.updateUtcOffsetValidity();return}this.autoFilledTimeZone=n,this.timeZoneSelect.value=n,this.updateTimeZone(),this.dispatchEvent(new CustomEvent("sightingchange"))}}async reversePlace(e,t){const i=++this.placeSearchToken;let s;try{s=await this.placeProvider.reverse(e,t,{language:this.placeSearchLanguage})}catch{return}if(i!==this.placeSearchToken)return;this.namedCoordinates={lat:e,lng:t},this.placeNameInput.value=s?.name??"",this.placeNameInput.title=s?.name??"",this.placeMatches=[],this.placeMatchRow.hidden=!0,this.placeStatusText.textContent=s?"":this.messages.placeNotFound,this.placeSourceRow.hidden=!s;const n=this.ufoElement.sighting.event.place?.[0]??{lat:e,lng:t};this.ufoElement.sighting.event.place=[{lat:n.lat,lng:n.lng,name:this.stringOrUndefined(this.placeNameInput.value.trim())}]}updateObserver(){if(this.refreshHeadingPoint(),this.ufoElement.playbackState==="playing")return;const e=this.numberOrUndefined(this.latInput.value),t=this.numberOrUndefined(this.lngInput.value),i=this.wrapDegrees(this.numberOrUndefined(this.headingInput.value),this.headingInput),s=this.numberOrUndefined(this.pitchInput.value)??0,n=this.numberOrUndefined(this.rollInput.value)??0,r=this.numberOrUndefined(this.elevationInput.value)??this.groundElevationM??0,o=this.ufoElement.sighting.event,l=this.ufoElement.sighting.observerTrack,a=this.ufoElement.currentTime,d=l.getInterpolatedPoseAt(a),h=d?.altitudeM!==void 0?r:void 0,c=h!==void 0?d.elevationM:Math.max(0,r-(this.groundElevationM??0)),u=this.ufoElement.sighting.instrument,p=this.numberOrUndefined(this.focalLengthInput.value),m=(u.frame&&p!==void 0?we.fieldOfViewDegAt(u,p):p)??this.currentFovDeg(),f=this.numberOrUndefined(this.fNumberInput.value),g=this.filterSelect.value,b=ae.byId(l.getLatestPoseAt(a-1)?.filter),v=g===ae.NONE.id||g===""?b===ae.NONE?void 0:ae.NONE.id:g,I=this.statedExposureSeconds(u);this.ufoElement.sighting.exposureSeconds=I===u.exposureSeconds?void 0:I;const S=this.numberOrUndefined(this.focusDistanceInput.value),w=Math.abs(m-we.fieldOfViewDeg(u))>.01||f!==u.fNumber||S!==void 0||v!==void 0;e===void 0&&t===void 0&&i===void 0&&s===0&&n===0&&c===0&&!w?l.removeKeyframeAt(a):l.addKeyframe(a,{lat:e,lng:t,elevationM:c,...h!==void 0?{altitudeM:h}:{},headingDeg:i,pitchDeg:s,rollDeg:n===0?void 0:n,...this.observerSaid&&e!==void 0?{saidPosition:this.observerSaid}:{},fovDeg:m,fNumber:f,focusDistanceM:S,filter:v});const C=this.stringOrUndefined(this.placeNameInput.value.trim()),B=l.getInterpolatedPoseAt(0);o.place=e!==void 0&&t!==void 0?[{lat:B?.lat??e,lng:B?.lng??t,name:C}]:void 0;const A=this.plantingCentre();this.surroundings.placeChanged(A?.lat,A?.lng),this.ufoElement.refresh(),this.scheduleWeatherLookup(),this.scheduleLightPollutionLookup(),this.schedulePlaceReverse(),this.scheduleTimeZoneLookup(),this.scheduleGroundElevation(),this.updateUtcOffsetValidity()}syncAgeFromBirth(e){const t=this.birth,i=this.ufoElement.sighting.event.time;if(!t||!i||e&&!wt.isFirm(t))return;const s=wt.at(t,i);s!==void 0&&(this.observerAgeInput.value=String(s),this.updateObserverMetadata())}syncBirthFromAge(){const e=this.ufoElement.sighting.event.time,t=this.numberOrUndefined(this.observerAgeInput.value);if(!e||t===void 0)return;const i=this.birth;if(i&&wt.at(i,e)===t)return;const s=wt.birthFor(t,e);s&&(this.birthDate.setPrecise(!1),this.birth=s,this.birthDate.time=s,this.updateObserverMetadata())}editDate(e){e(),this.dropDurationOutrankedByDates(),this.ufoElement.sighting.event.timeZone&&this.applyTimeZoneOffset(),this.ufoElement.refresh(),this.refreshSceneryWarning(),this.syncDurationField(),this.scheduleWeatherLookup(),this.scheduleLightPollutionLookup()}dropDurationOutrankedByDates(){const e=this.ufoElement.sighting.event;e.durationSeconds!==void 0&&Pt({...e,durationSeconds:void 0})!==void 0&&(this.ufoElement.sighting.event.durationText=void 0,this.ufoElement.durationSeconds=void 0)}refreshTimeZoneOptions(){let e=this.timeZoneSelect.options[0];if(!e){e=document.createElement("option"),e.value="";const t=this.timeZoneSelect.parentNode,i=this.timeZoneSelect.nextSibling;this.timeZoneSelect.remove(),this.timeZoneSelect.replaceChildren(e,...this.timeZones.available().map(s=>{const n=document.createElement("option");return n.value=s,n.textContent=s,n})),t?.insertBefore(this.timeZoneSelect,i)}e.textContent=this.messages.timeZoneManual,this.timeZoneSelect.value=this.zoneShown()}zoneShown(){const e=this.ufoElement.sighting.event;return e.timeZone?e.timeZone:e.utcOffsetHours===void 0?"":this.zoneKnownToRead(e.utcOffsetHours)??""}updateTimeZone(){const e=this.ufoElement.sighting.event,t=this.stringOrUndefined(this.timeZoneSelect.value);if(e.timeZone=t,this.offsetIsAuthors=!1,t===void 0){e.utcOffsetHours=void 0,this.syncUtcOffsetField(),this.ufoElement.refresh(),this.scheduleWeatherLookup();return}this.applyTimeZoneOffset()}applyTimeZoneOffset(){const e=this.ufoElement.sighting.event;if(this.offsetIsAuthors&&e.utcOffsetHours!==void 0){const t=this.preferredZoneFor(e.utcOffsetHours);e.timeZone=t,this.timeZoneSelect.value=t??""}else{const t=e.timeZone?this.timeZones.offsetHoursAt(e.timeZone,this.timeZoneReference()):void 0;t!==void 0&&(e.utcOffsetHours=t)}this.syncUtcOffsetField(),this.ufoElement.refresh(),this.scheduleWeatherLookup()}timeZoneReference(){const e=this.ufoElement.sighting.event.time;return e?.year!==void 0?e:{year:new Date().getFullYear(),month:1,day:1,hour:12}}preferredZoneFor(e){return this.zoneKnownToRead(e)??this.timeZones.zonesAt(e,this.timeZoneReference())[0]}zoneKnownToRead(e){const t=this.timeZones.zonesAt(e,this.timeZoneReference()),i=this.ufoElement.sighting.event.timeZone;if(i&&t.includes(i))return i;if(this.placeZone&&t.includes(this.placeZone))return this.placeZone;const s=Number.isInteger(e)?e===0?"UTC":`Etc/GMT${e>0?"-":"+"}${Math.abs(e)}`:void 0;return s&&t.includes(s)?s:void 0}updateUtcOffset(){const e=this.ufoElement.sighting.event,t=this.numberOrUndefined(this.utcOffsetInput.value);if(t===void 0)e.utcOffsetHours=void 0,e.timeZone=void 0,this.autoFilledTimeZone=void 0,this.timeZoneSelect.value="";else{const i=this.preferredZoneFor(t);if(i===void 0){this.utcOffsetInput.classList.add("invalid"),this.utcOffsetInput.title=this.messages.utcOffsetNoZone;return}e.utcOffsetHours=t,e.timeZone=i,this.offsetIsAuthors=!0,this.autoFilledTimeZone=void 0,this.timeZoneSelect.value=i}this.updateUtcOffsetValidity(),this.ufoElement.refresh(),this.scheduleWeatherLookup()}updateObserverMetadata(){const e=this.ufoElement.sighting,t=this.observerFirstNamesInput.value.split(",").map(n=>n.trim()).filter(n=>n.length>0),i={id:this.stringOrUndefined(this.observerIdInput.value),title:this.observerTitleInput.value.trim()===""?void 0:this.said.write(e.observer?.title,this.observerTitleInput.value.trim(),this.writingLanguage),lastName:this.stringOrUndefined(this.observerLastNameInput.value),firstNames:t.length>0?t:void 0},s=V.observerId(e);e.observer=Object.values(i).some(n=>n!==void 0)?i:void 0,V.renamed(e,s,V.observerId(e)),e.id=this.stringOrUndefined(this.sightingIdInput.value),this.updateAccount(),this.ufoElement.refresh()}updateAccount(){const e=this.ufoElement.sighting,t=this.accountFollowedUpSelect.value,i={observerAgeYears:this.numberOrUndefined(this.observerAgeInput.value),observerBirth:this.birth,observerPerception:mt.compact(this.perceptionSettings.values),observerOccupation:this.observerOccupationInput.value.trim()===""?void 0:this.said.write(e.account?.observerOccupation,this.observerOccupationInput.value,this.writingLanguage),source:this.stringOrUndefined(this.accountSourceSelect.value),followedUp:t===""?void 0:t==="yes",...this.evaluationFields.values(),conditions:e.account?.conditions};e.account=Object.values(i).some(s=>s!==void 0)?i:void 0}updateSourceUrl(){const e=this.ufoElement.sighting,t=this.accountUrlInput.value.trim(),[i,...s]=e.sources??[],{url:n,...r}=i??{},o=t===""?r:{...r,url:t},l=Object.keys(o).length>0?[o,...s]:s;e.sources=l.length>0?l:void 0}updateDescription(){this.ufoElement.sighting.event.description=this.said.write(this.ufoElement.sighting.event.description,this.descriptionInput.value,this.writingLanguage),this.ufoElement.refresh()}updateTags(){const e=this.tagsInput.value.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>this.tagNames.stored(t));this.ufoElement.sighting.event.tags=e.length>0?e:void 0,this.ufoElement.refresh()}applyWeatherAtPlayhead(){if(this.ufoElement.playbackState==="playing")return;this.sceneElement.resumeWeatherAudio(),this.weatherFromRecords?(this.weatherFromRecords=!1,this.cancelWeatherLookup(),this.ufoElement.sighting.weatherSource=void 0,this.syncWeatherSourceState()):this.ufoElement.sighting.weatherSource!==void 0&&(this.ufoElement.sighting.weatherSource=void 0,this.syncWeatherSourceState());const e={...ne(this.ufoElement.sighting,this.ufoElement.currentTime),cloudCover:Number(this.cloudCoverInput.value),highCloudCover:Number(this.highCloudCoverInput.value),lowerCloudCover:Number(this.cloudCoverInput.value),cloudDarkness:Number(this.cloudDarknessInput.value),cloudBaseM:this.numberOrUndefined(this.cloudBaseInput.value),precipitationType:this.precipitationTypeSelect.value,precipitationIntensity:Number(this.precipitationIntensityInput.value),windDirectionDeg:this.wrapDegrees(this.numberOrUndefined(this.windDirectionInput.value),this.windDirectionInput)??0,windSpeed:Number(this.windSpeedInput.value),storm:this.stormInput.checked};this.ufoElement.sighting.weatherTrack.addKeyframe(this.ufoElement.currentTime,e),this.ufoElement.refresh()}applyIceAlignmentAtPlayhead(){if(this.ufoElement.playbackState==="playing")return;this.sceneElement.resumeWeatherAudio();const e={...ne(this.ufoElement.sighting,this.ufoElement.currentTime),iceCrystalAlignment:Number(this.iceCrystalAlignmentInput.value),rareIceCrystals:Number(this.rareIceCrystalsInput.value)};this.ufoElement.sighting.weatherTrack.addKeyframe(this.ufoElement.currentTime,e),this.ufoElement.refresh()}referenceLabel(e){return this.said.read(e.title)||e.src.replace(/^data:.*$/,"…")||e.id}refreshReferenceList(){const e=this.ufoElement.sighting.references;this.referenceSelect.innerHTML="";for(const t of e){const i=document.createElement("option");i.value=t.id,i.textContent=this.referenceLabel(t),this.referenceSelect.appendChild(i)}this.currentReferenceId!==void 0&&(this.referenceSelect.value=this.currentReferenceId),this.syncReferenceFields()}selectReference(e){this.currentReferenceId=e,this.referenceSelect.value=e,this.disarmLandmark(),this.currentLandmarkId=void 0,this.referenceFit=void 0,this.syncReferenceFields()}syncReferenceFields(){const e=this.ufoElement.sighting.references.find(s=>s.id===this.currentReferenceId),t=e!==void 0;ge.showPresence(this.shadow.getElementById("reference-row"),this.shadow.getElementById("reference-item"),t),this.deleteReferenceButton.disabled=!t,this.referenceUsePoseButton.disabled=!t;for(const s of[this.referenceSelect,...this.referenceFields])s.disabled=!t;if(this.referenceSourceInput.disabled=!t,this.refreshLandmarkList(),this.syncCanvasMode(),!e){this.referenceStatus.textContent="";return}this.referenceTitleInput.value=this.said.read(e.title)??"";const i=e.src.startsWith("data:");this.referenceSourceInput.url=i?"":e.src,this.referenceSourceInput.mode=i?"file":"url",this.referenceKindSelect.value=e.kind,this.referenceCreditInput.value=e.credit??"",this.referenceCreditUrlInput.value=e.creditUrl??"",this.referenceTInput.value=e.t===void 0?"":String(e.t/1e3),this.referenceDrawingInput.checked=e.drawing===!0,this.ghostFinding&&(this.ghostFinding.referenceId!==e.id||this.ghostFinding.src!==e.src)&&(this.ghostFinding=void 0,this.ghostsStatus.textContent="",this.syncGhostsShown(),this.ufoElement.refresh()),this.referenceOpacityInput.value=String(e.opacity),this.syncVideoFields(e),this.showRegistration(this.registrationShown(e)),this.syncReferenceStatus(e)}syncVideoFields(e){const t=e.kind==="video";for(const i of this.shadow.querySelectorAll(".reference-video-field"))i.hidden=!t;this.labelReferenceT.textContent=t?this.messages.referenceVideoT:this.messages.referenceT,this.referenceVideoFromInput.value=e.video?.fromS===void 0?"":String(e.video.fromS),this.referenceVideoToInput.value=e.video?.toS===void 0?"":String(e.video.toS),this.referenceVideoRateInput.value=e.video?.rate===void 0?"":String(e.video.rate),this.syncReferenceKeyButton(e)}syncReferenceKeyButton(e){this.referenceRemoveKeyButton.hidden=e.kind!=="video"||Oe.keyIndexAt(e,this.ufoElement.currentTime)<0}registrationShown(e){if(!e.registrationTrack?.length)return e.registration;const{headingDeg:t,pitchDeg:i,rollDeg:s,fovDeg:n}=Oe.registrationAt(e,this.ufoElement.currentTime);return{headingDeg:this.rounded(t),pitchDeg:this.rounded(i),rollDeg:s===void 0?void 0:this.rounded(s),fovDeg:this.rounded(n)}}showRegistration({headingDeg:e,pitchDeg:t,rollDeg:i,fovDeg:s}){this.referenceHeadingInput.value=String(e),this.referencePitchInput.value=String(t),this.referenceRollInput.value=String(i??0),this.referenceFovInput.value=String(s)}syncVideoRegistrationFields(){if(this.currentReferenceId===void 0)return;const e=this.ufoElement.sighting.references.find(t=>t.id===this.currentReferenceId);e?.kind==="video"&&(this.syncReferenceKeyButton(e),e.registrationTrack?.length&&this.showRegistration(this.registrationShown(e)))}removeReferenceKey(){const e=this.ufoElement.sighting.references.find(i=>i.id===this.currentReferenceId);if(!e)return;const t=Oe.withoutKey(e,this.ufoElement.currentTime);this.ufoElement.sighting.references=this.ufoElement.sighting.references.map(i=>i===e?t:i),this.syncReferenceFields(),this.ufoElement.refresh()}syncReferenceStatus(e){const t=this.sceneElement.referenceFailure(e.src);if(F.show(this.referenceFailure,t?this.pictureFailureText(t):void 0,"error"),this.syncFindGhosts(e),this.canvasMode()==="picture"){this.syncRegisterStatus();return}if(e.src.startsWith("data:")){const i=Math.round(e.src.length*3/4/1024);this.referenceStatus.textContent=e.src.length>kr?this.messages.referenceEmbedded.replace("{kb}",String(i)):"";return}this.referenceStatus.textContent=""}pictureFailureText(e){switch(e.kind){case"notShared":return this.messages.referenceNotShared;case"status":return this.messages.referenceNotFound.replace("{status}",String(e.status));case"notPicture":return this.messages.referenceNotPicture;case"notVideo":return this.messages.referenceNotVideo;default:return this.messages.referenceUnreachable}}updateReference(){if(this.currentReferenceId===void 0)return;const e=this.ufoElement.sighting,t=this.wrapDegrees(Number(this.referenceHeadingInput.value),this.referenceHeadingInput)??0,i=this.referenceTInput.value.trim()===""?void 0:Number(this.referenceTInput.value);e.references=e.references.map(n=>{if(n.id!==this.currentReferenceId)return n;const r=n.src,o={headingDeg:t,pitchDeg:Number(this.referencePitchInput.value)||0,rollDeg:Number(this.referenceRollInput.value)||void 0,fovDeg:Math.min(179,Math.max(1,Number(this.referenceFovInput.value)||Et))},l=this.registrationShown(n),a=o.headingDeg!==l.headingDeg||o.pitchDeg!==l.pitchDeg||o.rollDeg!==l.rollDeg||o.fovDeg!==l.fovDeg,d=this.referenceKindSelect.value;return d==="video"?{...a?Oe.withKey(n,this.ufoElement.currentTime,o):n,kind:d,src:r,title:this.said.write(n.title,this.referenceTitleInput.value,this.writingLanguage),credit:this.stringOrUndefined(this.referenceCreditInput.value),creditUrl:this.stringOrUndefined(this.referenceCreditUrlInput.value),t:i===void 0||Number.isNaN(i)?void 0:Math.round(i*1e3),video:this.videoClipOfFields(),drawing:this.referenceDrawingInput.checked||void 0,opacity:Number(this.referenceOpacityInput.value),from:void 0}:{...n,kind:d,video:void 0,registrationTrack:void 0,src:r,title:this.said.write(n.title,this.referenceTitleInput.value,this.writingLanguage),credit:this.stringOrUndefined(this.referenceCreditInput.value),creditUrl:this.stringOrUndefined(this.referenceCreditUrlInput.value),t:i===void 0||Number.isNaN(i)?void 0:Math.round(i*1e3),drawing:this.referenceDrawingInput.checked||void 0,opacity:Number(this.referenceOpacityInput.value),registration:o,from:a?this.observerPositionNow()??n.from:n.from}});const s=e.references.find(n=>n.id===this.currentReferenceId);this.referenceSelect.options[this.referenceSelect.selectedIndex].textContent=this.referenceLabel(s),this.syncVideoFieldsKeepingInput(s),this.syncReferenceStatus(s),this.ufoElement.refresh()}videoClipOfFields(){const e={fromS:this.numberOrUndefined(this.referenceVideoFromInput.value),toS:this.numberOrUndefined(this.referenceVideoToInput.value),rate:this.numberOrUndefined(this.referenceVideoRateInput.value)};return e.fromS===void 0&&e.toS===void 0&&e.rate===void 0?void 0:e}syncVideoFieldsKeepingInput(e){const t=e.kind==="video";for(const i of this.shadow.querySelectorAll(".reference-video-field"))i.hidden=!t;this.labelReferenceT.textContent=t?this.messages.referenceVideoT:this.messages.referenceT,this.syncReferenceKeyButton(e)}useObserverPoseForReference(){const e=X(this.ufoElement.sighting,this.ufoElement.currentTime);e&&(this.referenceHeadingInput.value=String(this.rounded(e.headingDeg??0)),this.referencePitchInput.value=String(this.rounded(e.pitchDeg)),this.referenceRollInput.value=String(this.rounded(Oe.rollOfPicture(e.rollDeg)??0)),this.referenceFovInput.value=String(this.rounded(e.fovDeg)),this.updateReference())}observerPositionNow(){const e=X(this.ufoElement.sighting,this.ufoElement.currentTime);return e?.lat!==void 0&&e.lng!==void 0?{lat:e.lat,lng:e.lng}:void 0}addReference(e,t,i={}){const s=this.ufoElement.sighting,n=X(this.ufoElement.sighting,this.ufoElement.currentTime),r=`picture-${s.references.length+1}`,o={id:r,kind:"photo",src:e,title:t?this.said.write(void 0,t,this.writingLanguage):void 0,opacity:Er,registration:{headingDeg:n?.headingDeg??0,pitchDeg:n?.pitchDeg??0,fovDeg:Et},from:this.observerPositionNow(),...i};s.references=[...s.references,o],this.currentReferenceId=r,this.refreshReferenceList(),this.ufoElement.refresh()}addReferenceFromAddress(){this.addReference(""),this.referenceSourceInput.mode="url",this.referenceSourceInput.focus()}addReferenceFromFile(){this.addReference(""),this.referenceSourceInput.mode="file",this.referenceSourceInput.openPicker()}async setReferenceSource(e){const t=this.currentReferenceId;if(t===void 0)return;let i;if(e.file){const r=e.file;i=await new Promise((o,l)=>{const a=new FileReader;a.onload=()=>o(a.result),a.onerror=()=>l(a.error),a.readAsDataURL(r)})}else i=e.url;const s=this.ufoElement.sighting,n=Oe.kindOfSource(e.file?{type:e.file.type}:{url:e.url});s.references=s.references.map(r=>r.id!==t?r:{...r,src:i,kind:n==="video"||n==="photo"&&r.kind==="video"?n:r.kind,from:n==="video"?void 0:r.from,title:r.title??(e.file?this.said.write(void 0,e.file.name.replace(/\.[^.]+$/,""),this.writingLanguage):void 0)}),this.touch(),this.refreshReferenceList(),this.ufoElement.refresh()}pictureAspect(e){if(!this.pictureRegistration){this.loadPictureRegistration();return}return this.sceneElement.referenceAspect(e)}loadPictureRegistration(){return this.pictureRegistrationLoading??=M(async()=>{const{PictureRegistration:e}=await import("./PictureRegistration-BFn75haQ.js");return{PictureRegistration:e}},__vite__mapDeps([25,3,1,4,5,6,7,8,9]),import.meta.url).then(({PictureRegistration:e})=>{this.pictureRegistration=e,this.ufoElement.refresh()})}currentReference(){const e=this.ufoElement.sighting.references.find(t=>t.id===this.currentReferenceId);return e?.registrationTrack?.length?{...e,registration:Oe.registrationAt(e,this.ufoElement.currentTime)}:e}currentLandmarks(){return this.currentReference()?.landmarks??[]}writeLandmarks(e){const t=this.ufoElement.sighting;t.references=t.references.map(i=>i.id===this.currentReferenceId?{...i,landmarks:e.length>0?e:void 0}:i)}beginReferenceDrag(e){const t=this.currentReference();if(!t)return;if(this.armingLandmark||this.pendingLandmark){this.nameLandmarkAt(e);return}const i=this.landmarkEndAt(e);if(i){this.selectLandmark(i.landmarkId),this.referenceDragState={kind:"anchor",...i},this.setCanvasCursor("landmark"),this.startDragListening();return}const s=this.pictureAspect(t.id);if(!(s!==void 0&&this.pictureRegistration.picturePointOf(this.directionAtCanvasPoint(e),t.registration,s)!==void 0)){this.beginCameraDrag(e);return}this.referenceDragState={kind:"picture",startPointer:e,startHeadingDeg:t.registration.headingDeg,startPitchDeg:t.registration.pitchDeg,moved:!1},this.setCanvasCursor("panning"),this.startDragListening()}landmarkEndAt(e){const t=this.currentReference(),i=t?this.pictureAspect(t.id):void 0;if(!t||i===void 0)return;const s=8;for(const n of this.currentLandmarks()){const r=this.canvasPointOfDirection(this.pictureRegistration.worldDirectionOf(n.picture,t.registration,i));if(r&&Math.hypot(r.x-e.x,r.y-e.y)<=s)return{landmarkId:n.id,end:"picture"};const o=this.canvasPointOfDirection(this.pictureRegistration.worldDirection(n.scene));if(o&&Math.hypot(o.x-e.x,o.y-e.y)<=s)return{landmarkId:n.id,end:"scene"}}}onReferenceDragPointerMove(e){const t=this.referenceDragState,i=this.canvasPointFromEvent(e);if(!t||!i)return;if(t.kind==="anchor"){this.moveLandmarkEnd(t.landmarkId,t.end,i);return}const s=i.x-t.startPointer.x,n=i.y-t.startPointer.y;if(!t.moved&&Math.hypot(s,n)<3)return;t.moved=!0;const r=this.currentFovDeg()/this.ufoElement.canvasElement.height;this.referenceHeadingInput.value=String(this.rounded(t.startHeadingDeg+s*r)),this.referencePitchInput.value=String(this.rounded(Math.max(-90,Math.min(90,t.startPitchDeg-n*r)))),this.updateReference()}moveLandmarkEnd(e,t,i){const s=this.currentReference(),n=s?this.pictureAspect(s.id):void 0;if(!s||n===void 0)return;const r=this.directionAtCanvasPoint(i);this.writeLandmarks(this.currentLandmarks().map(o=>{if(o.id!==e)return o;if(t==="scene")return{...o,scene:this.pictureRegistration.aimOf(r)};const l=this.pictureRegistration.picturePointOf(r,s.registration,n);return l?{...o,picture:l}:o})),this.ufoElement.refresh()}endReferenceDrag(){const e=this.referenceDragState;this.referenceDragState=void 0,this.setCanvasCursor(this.canvasMode()==="picture"?"pan":this.hoverCursor),document.removeEventListener("pointermove",this.handleDragPointerMove),document.removeEventListener("pointerup",this.handleDragPointerUp),e?.kind==="anchor"&&this.fitReferenceToLandmarks()}onReferenceWheel(e){if(this.canvasMode()!=="picture")return;e.preventDefault();const t=Number(this.referenceFovInput.value)||Et,i=Math.min(179,Math.max(1,t*Math.exp(Math.sign(e.deltaY)*.05)));this.referenceFovInput.value=String(this.rounded(i)),this.updateReference()}directionAtCanvasPoint(e){const t=this.ufoElement.canvasElement;return this.sceneElement.directionAt(e.x/t.width*2-1,-(e.y/t.height*2-1))}armLandmark(){this.currentReference()&&(this.armingLandmark=!0,this.pendingLandmark=void 0,this.setCanvasCursor("landmark"),this.syncRegisterStatus(),this.ufoElement.refresh())}disarmLandmark(){this.armingLandmark=!1,this.pendingLandmark=void 0,this.canvasMode()==="picture"&&(this.setCanvasCursor("pan"),this.syncRegisterStatus()),this.ufoElement.refresh()}nameLandmarkAt(e){const t=this.currentReference();if(!t)return;const i=this.directionAtCanvasPoint(e);if(!this.pendingLandmark){const r=this.pictureAspect(t.id);if(r===void 0){this.referenceStatus.textContent=this.messages.referenceNotLoaded;return}const o=this.pictureRegistration.picturePointOf(i,t.registration,r);if(!o){this.referenceStatus.textContent=this.messages.referenceLandmarkOffPicture;return}this.pendingLandmark=o,this.syncRegisterStatus(),this.ufoElement.refresh();return}const s=this.currentLandmarks(),n=this.nextLandmarkId(s);this.writeLandmarks([...s,{id:n,picture:this.pendingLandmark,scene:this.pictureRegistration.aimOf(i)}]),this.armingLandmark=!1,this.pendingLandmark=void 0,this.currentLandmarkId=n,this.setCanvasCursor("pan"),this.fitReferenceToLandmarks()}nextLandmarkId(e){let t=e.length+1;for(;e.some(i=>i.id===`landmark-${t}`);)t++;return`landmark-${t}`}fitReferenceToLandmarks(){const e=this.currentReference(),t=e?this.pictureAspect(e.id):void 0;if(!e||t===void 0)return;const i=this.currentLandmarks(),s=this.pictureRegistration.solve(i,t,e.registration.fovDeg);s?(this.referenceFit={n:i.length,residualDeg:s.residualDeg},this.referenceHeadingInput.value=String(this.rounded(s.registration.headingDeg)),this.referencePitchInput.value=String(this.rounded(s.registration.pitchDeg)),this.referenceRollInput.value=String(this.rounded(s.registration.rollDeg??0)),this.referenceFovInput.value=String(this.rounded(s.registration.fovDeg)),this.updateReference()):this.referenceFit=void 0,this.refreshLandmarkList(),this.syncRegisterStatus(),this.ufoElement.refresh()}landmarkResidualDeg(e,t,i){return this.pictureRegistration.worldDirectionOf(e.picture,t.registration,i).angleTo(this.pictureRegistration.worldDirection(e.scene))*180/Math.PI}landmarkLabel(e,t){const i=this.said.read(e.label);return i?`${t+1} · ${i}`:String(t+1)}refreshLandmarkList(){const e=this.currentReference(),t=this.currentLandmarks(),i=e?this.pictureAspect(e.id):void 0;this.referenceLandmarksSelect.innerHTML="";for(const[n,r]of t.entries()){const o=document.createElement("option");o.value=r.id;const l=e&&i!==void 0?` · ${this.landmarkResidualDeg(r,e,i).toFixed(1)}°`:"";o.textContent=this.landmarkLabel(r,n)+l,this.referenceLandmarksSelect.appendChild(o)}this.currentLandmarkId!==void 0&&!t.some(n=>n.id===this.currentLandmarkId)&&(this.currentLandmarkId=void 0),this.currentLandmarkId!==void 0&&(this.referenceLandmarksSelect.value=this.currentLandmarkId);const s=t.find(n=>n.id===this.currentLandmarkId);ge.showPresence(this.shadow.getElementById("reference-landmark-row"),this.shadow.getElementById("reference-landmark-item"),t.length>0),this.referenceLandmarksSelect.disabled=t.length===0,this.deleteReferenceLandmarkButton.disabled=s===void 0,this.referenceLandmarkLabelInput.disabled=s===void 0,this.shadow.activeElement!==this.referenceLandmarkLabelInput&&(this.referenceLandmarkLabelInput.value=this.said.read(s?.label)??"")}selectLandmark(e){this.currentLandmarkId=e,this.refreshLandmarkList(),this.ufoElement.refresh()}updateLandmarkLabel(){const e=this.currentLandmarkId;if(e===void 0)return;this.writeLandmarks(this.currentLandmarks().map(o=>o.id===e?{...o,label:this.said.write(o.label,this.referenceLandmarkLabelInput.value,this.writingLanguage)}:o));const t=this.referenceLandmarksSelect.options[this.referenceLandmarksSelect.selectedIndex],i=this.currentLandmarks(),s=i.findIndex(o=>o.id===e),n=this.currentReference(),r=n?this.pictureAspect(n.id):void 0;if(t&&s>=0){const o=n&&r!==void 0?` · ${this.landmarkResidualDeg(i[s],n,r).toFixed(1)}°`:"";t.textContent=this.landmarkLabel(i[s],s)+o}this.ufoElement.refresh()}deleteLandmark(){const e=this.currentLandmarkId;if(e===void 0)return;const t=this.currentLandmarks().filter(i=>i.id!==e);this.writeLandmarks(t),this.currentLandmarkId=t[t.length-1]?.id,this.fitReferenceToLandmarks()}landmarkHint(){const e=this.currentLandmarks().length+1;if(this.pendingLandmark)return this.messages.referenceLandmarkScene.replace("{n}",String(e));if(this.armingLandmark)return this.messages.referenceLandmarkPicture.replace("{n}",String(e))}syncRegisterStatus(){const e=this.landmarkHint();e?this.referenceStatus.textContent=e:this.referenceFit?this.referenceStatus.textContent=this.messages.referenceLandmarksFit.replace("{n}",String(this.referenceFit.n)).replace("{deg}",this.referenceFit.residualDeg.toFixed(1)):this.referenceStatus.textContent=this.messages.referenceRegisterHint}canvasPointOfDirection(e){const t=this.sceneElement.screenPointOf(e);if(!t)return;const i=this.ufoElement.canvasElement;return{x:(t.ndcX+1)/2*i.width,y:(1-t.ndcY)/2*i.height}}paintPictureOverlay=e=>{const t=this.currentReference();if(!t)return;const i=this.pictureAspect(t.id);if(i===void 0)return;const{registration:s}=t,n=[{u:0,v:0},{u:1,v:0},{u:1,v:1},{u:0,v:1}].map(o=>this.canvasPointOfDirection(this.pictureRegistration.worldDirectionOf(o,s,i))),r=this.currentLandmarks().map((o,l)=>({picture:this.canvasPointOfDirection(this.pictureRegistration.worldDirectionOf(o.picture,s,i)),scene:this.canvasPointOfDirection(this.pictureRegistration.worldDirection(o.scene)),label:this.landmarkLabel(o,l),selected:o.id===this.currentLandmarkId,residualDeg:this.landmarkResidualDeg(o,t,i)}));this.pendingLandmark&&r.push({picture:this.canvasPointOfDirection(this.pictureRegistration.worldDirectionOf(this.pendingLandmark,s,i)),scene:void 0,label:String(this.currentLandmarks().length+1),selected:!0,residualDeg:void 0}),e.paintPictureFrame(n.every(o=>o!==void 0)?n:void 0,r.filter(o=>o.picture!==void 0),this.landmarkHint()),this.paintGhostFinding(e,t,i)};paintGhostFinding(e,t,i){const s=this.ghostFinding;if(!s||!this.ghostsShown||s.referenceId!==t.id||s.src!==t.src)return;const{search:n}=s,r=t.registration,o=h=>this.canvasPointOfDirection(this.pictureRegistration.worldDirectionOf({u:h.x/n.width,v:h.y/n.height},r,i)),l=[];for(const h of n.pairs){const c=o(h.ghost),u=o(h.light),p=o({x:h.ghost.x+h.ghost.radius,y:h.ghost.y});!c||!u||l.push({ghost:c,light:u,ghostRadius:p?Math.hypot(p.x-c.x,p.y-c.y):0})}const a=n.centre?o(n.centre):void 0,d=n.cropped?o({x:n.width/2,y:n.height/2}):void 0;e.paintGhosts(l,a,d)}adoptReferencePose(){const e=this.currentReference();if(!e)return;const{headingDeg:t,pitchDeg:i,rollDeg:s}=e.registration;this.headingInput.value=String(this.rounded(t)),this.pitchInput.value=String(this.rounded(i)),this.rollInput.value=String(this.rounded(Oe.rollOfPicture(s)??0)),this.updateObserver();const n=this.ufoElement.currentTime,r=this.ufoElement.sighting.observerTrack.toJSON().keyframes.findIndex(a=>a.t===n);if(r<0)return;const o=this.messages.referenceAdoptRationale.replace("{title}",this.referenceLabel(e)).replace("{n}",String(this.currentLandmarks().length)).replace("{deg}",(this.referenceFit?.residualDeg??0).toFixed(1)),l=[["headingDeg",t],["pitchDeg",i],["rollDeg",s??0]];for(const[a,d]of l)this.ufoElement.sighting.provenance.set(`observerTrack.keyframes.${r}.pose.${a}`,{basis:"derived",rationale:o,of:this.rounded(d)})}syncStreetSearchAvailability(){const e=this.numberOrUndefined(this.latInput.value)!==void 0&&this.numberOrUndefined(this.lngInput.value)!==void 0;this.referenceAddMenu.setDisabled("street",e?void 0:this.messages.referenceStreetNoPlace)}setReferenceAddKinds(e,t,i){const s=this.numberOrUndefined(this.latInput?.value??"")!==void 0&&this.numberOrUndefined(this.lngInput?.value??"")!==void 0;this.referenceAddMenu.setKinds([{value:"address",label:e},{value:"file",label:t},{value:"street",label:i,...s?{}:{disabledReason:this.messages?.referenceStreetNoPlace??""}}])}addReferenceOfKind(e){switch(e){case"file":this.addReferenceFromFile();break;case"street":this.searchStreetPictures();break;default:this.addReferenceFromAddress()}}async searchStreetPictures(){const e=X(this.ufoElement.sighting,0),t=e?.lat??this.numberOrUndefined(this.latInput.value),i=e?.lng??this.numberOrUndefined(this.lngInput.value);if(t===void 0||i===void 0)return;const s=300;this.referenceStatus.textContent=this.messages.referenceStreetSearching,this.addReferenceButton.disabled=!0;try{this.streetPictures$??=new(await M(async()=>{const{PanoramaxPictures:r}=await import("./PanoramaxPictures-CELY3Ecc.js");return{PanoramaxPictures:r}},[],import.meta.url)).PanoramaxPictures,this.streetPictures=await this.streetPictures$.nearby(t,i,s)}catch{this.streetPictures=[],this.referenceStatus.textContent=this.messages.referenceStreetFailed,this.addReferenceButton.disabled=!1;return}this.addReferenceButton.disabled=!1,this.referenceStreetSelect.innerHTML="";for(const[r,o]of this.streetPictures.entries()){const l=document.createElement("option");l.value=String(r),l.textContent=this.streetPictureLabel(o,this.messages.referenceStreetItem),this.referenceStreetSelect.appendChild(l)}const n=this.streetPictures.length>0;this.referenceStreetSelect.hidden=!n,this.referenceStreetAddButton.hidden=!n,this.referenceStatus.textContent=n?"":this.messages.referenceStreetNone.replace("{m}",String(s))}streetPictureLabel(e,t){return t.replace("{distance}",String(Math.round(e.distanceM))).replace("{bearing}",String(Math.round(e.bearingDeg))).replace("{date}",e.takenAt.slice(0,10)).replace("{panorama}",e.panorama?this.messages.referenceStreetPanorama:"")}addStreetPicture(){const e=this.streetPictures[Number(this.referenceStreetSelect.value)];e&&this.addReference(e.src,this.streetPictureLabel(e,this.messages.referenceStreetTitle),{kind:e.panorama?"panorama":"photo",credit:e.credit,creditUrl:e.creditUrl,registration:{headingDeg:e.azimuthDeg??0,pitchDeg:0,fovDeg:Et}})}traceLabel(e){const t=e.kind==="point"?this.messages.traceKindPoint:e.kind==="line"?this.messages.traceKindLine:this.messages.traceKindPolygon,i=this.said.read(e.title);return i?`${i} (${t})`:`${e.id} (${t})`}refreshTraceList(){const e=this.ufoElement.sighting.traces;this.traceSelect.innerHTML="";for(const t of e){const i=document.createElement("option");i.value=t.id,i.textContent=this.traceLabel(t),this.traceSelect.appendChild(i)}e.some(t=>t.id===this.currentTraceId)||(this.currentTraceId=e[0]?.id),this.currentTraceId!==void 0&&(this.traceSelect.value=this.currentTraceId),this.syncTraceFields()}selectTrace(e){this.currentTraceId=e,this.syncTraceFields()}syncTraceFields(){const e=this.ufoElement.sighting.traces.find(i=>i.id===this.currentTraceId),t=e!==void 0;ge.showPresence(this.shadow.getElementById("trace-row"),this.shadow.getElementById("trace-item"),t);for(const i of[this.traceSelect,this.deleteTraceButton,this.traceTitleInput,this.traceSourceInput])i.disabled=!t;this.traceTitleInput.value=this.said.read(e?.title)??"",this.traceSourceInput.value=this.said.read(e?.source)??""}writeTraceFields(){const e=this.ufoElement.sighting;if(this.currentTraceId===void 0)return;e.traces=e.traces.map(s=>s.id!==this.currentTraceId?s:{...s,title:this.said.write(s.title,this.traceTitleInput.value,this.writingLanguage),source:this.said.write(s.source,this.traceSourceInput.value,this.writingLanguage)});const t=Array.from(this.traceSelect.options).find(s=>s.value===this.currentTraceId),i=e.traces.find(s=>s.id===this.currentTraceId);t&&i&&(t.textContent=this.traceLabel(i)),this.ufoElement.refresh()}async addTraces(e){const t=e.file?.name??decodeURIComponent(e.url.split("/").pop()??e.url);let i;try{const{TraceImport:d}=await M(async()=>{const{TraceImport:h}=await import("./TraceImport-CntRHXoJ.js");return{TraceImport:h}},__vite__mapDeps([26,1]),import.meta.url);i=await d.fromBytes(await $s.bytesOf(e))}catch{this.traceStatus.textContent=this.messages.traceFailed;return}if(i.traces.length===0){this.traceStatus.textContent=this.messages.traceNone;return}const s=this.ufoElement.sighting,n=new Set(s.traces.map(d=>d.id));let r=1;const o=this.said.write(void 0,i.documentName??t,this.writingLanguage),l=i.traces.map(d=>{for(;n.has(`trace-${r}`);)r++;const h=`trace-${r}`;return n.add(h),{...d,id:h,title:d.title===void 0?void 0:this.said.write(void 0,d.title,this.writingLanguage),source:o}});s.traces=[...s.traces,...l],this.currentTraceId=l[0].id,this.refreshTraceList();const a=i.skipped.length>0?` ${this.messages.traceSkipped.replace("{what}",i.skipped.join(", "))}`:"";this.traceStatus.textContent=this.messages.traceImported.replace("{n}",String(l.length)).replace("{name}",t)+a,this.ufoElement.refresh()}async exportFigures(e){const t=this.fileBase(),{GEO_EXPORT_TEXTS:i}=await M(async()=>{const{GEO_EXPORT_TEXTS:o}=await import("./GeoExportTexts-3a51cuxQ.js");return{GEO_EXPORT_TEXTS:o}},__vite__mapDeps([27,1]),import.meta.url),s=await i.load(this.writingLanguage);if(e==="kml"){const{KmlExport:o}=await M(async()=>{const{KmlExport:a}=await import("./KmlExport-gFuPcL9A.js");return{KmlExport:a}},__vite__mapDeps([28,29,5,6,1,4,3,7,8,9]),import.meta.url),l=o.of(this.ufoElement.sighting,t,s,this.said);this.download(new Blob([l],{type:"application/vnd.google-earth.kml+xml"}),`${t}.kml`);return}const{GeoJsonExport:n}=await M(async()=>{const{GeoJsonExport:o}=await import("./GeoJsonExport-bpBmwqb7.js");return{GeoJsonExport:o}},__vite__mapDeps([30,29,5,6,1,4,3,7,8,9]),import.meta.url),r=n.of(this.ufoElement.sighting,t,s,this.said);this.download(new Blob([r],{type:"application/geo+json"}),`${t}.geojson`)}deleteTrace(){if(this.currentTraceId===void 0)return;const e=this.ufoElement.sighting;e.traces=e.traces.filter(t=>t.id!==this.currentTraceId),this.currentTraceId=e.traces[0]?.id,this.refreshTraceList(),this.ufoElement.refresh()}deleteReference(){if(this.currentReferenceId===void 0)return;const e=this.ufoElement.sighting;e.references=e.references.filter(t=>t.id!==this.currentReferenceId),this.currentReferenceId=e.references[0]?.id,this.refreshReferenceList(),this.ufoElement.refresh()}buildSoundKindOptions(){for(const e of Rn){const t=document.createElement("option");t.value=e,t.textContent=this.soundKindLabel(e,this.messages),this.soundKindOptions.set(e,t),this.soundKindSelect.appendChild(t)}}soundKindLabel(e,t){switch(e){case"hum":return t.soundHum;case"whistle":return t.soundWhistle;case"rumble":return t.soundRumble;case"crackle":return t.soundCrackle;default:return t.soundNone}}applySoundAtPlayhead(){if(this.ufoElement.playbackState==="playing")return;const e=this.readSound();this.ufoElement.sighting.soundTrack.addKeyframe(this.ufoElement.currentTime,e),this.updateSoundPitchReadout(e.pitchHz),this.updateSoundFieldsDisabledState(e),this.ufoElement.refresh(),this.previewSound(e)}previewSound(e){clearTimeout(this.soundPreviewTimer),this.ufoElement.previewSound(e),this.soundPreviewTimer=setTimeout(()=>this.ufoElement.stopSoundPreview(),Wr)}readSound(){return{kind:this.soundKindSelect.value,volume:Number(this.soundVolumeInput.value),pitchHz:Number(this.soundPitchInput.value),src:this.soundSrcInput.value.trim()||void 0}}syncSoundFromTimeline(){if(this.ufoElement.playbackState==="playing")return;const e=Pn(this.ufoElement.sighting,this.ufoElement.currentTime),t=this.shadow.activeElement;t!==this.soundKindSelect&&(this.soundKindSelect.value=e.kind),t!==this.soundVolumeInput&&(this.soundVolumeInput.value=String(e.volume)),t!==this.soundPitchInput&&(this.soundPitchInput.value=String(e.pitchHz)),t!==this.soundSrcInput&&(this.soundSrcInput.value=e.src??""),this.updateSoundPitchReadout(e.pitchHz),this.updateSoundFieldsDisabledState(e)}updateSoundPitchReadout(e){this.soundPitchValue.textContent=`${Math.round(e)} Hz`}updateSoundFieldsDisabledState(e){const t=e.kind==="none"&&!e.src;this.soundVolumeInput.disabled=t,this.soundSrcInput.disabled=t,this.soundPitchInput.disabled=t||e.src!==void 0}set weatherProvider(e){this.weatherInference=new tt(e),this.scheduleWeatherLookup()}onWeatherProviderChosen(){const e=this.weatherProviderSelect.value===y.FILE_SOURCE;if(!e){const t=z(ye,this.weatherProviderSelect.value);t.id!==this.chosenSourceId.get("weather")&&(this.chosenSourceId.set("weather",t.id),this.weatherInference=new tt(t.create()),this.scheduleWeatherLookup(!0),this.syncWeatherProvider())}if(this.setWeatherFromFile(e),this.weatherInferredInput.checked!==!e){this.weatherInferredInput.checked=!e,this.keepWeatherSource=e;try{this.weatherInferredInput.dispatchEvent(new Event("change"))}finally{this.keepWeatherSource=!1}}}keepWeatherSource=!1;setWeatherFromFile(e){const t=this.ufoElement.sighting;if(U.fromFile(t.snapshots,"weather")===e)return;const i={...t.snapshots??{}};e?i.weather={...i.weather??{},live:void 0}:delete i.weather,i.weather&&i.weather.live===void 0&&delete i.weather.live,t.snapshots=J.isEmpty(i)?void 0:i,this.touch(),this.scheduleFileSync(),this.refreshFileItems()}followWeatherRecord(){const e=ye.find(i=>i.id===this.ufoElement.sighting.weatherSource?.id),t=this.chosenSourceId.get("weather");if(e&&e.id!==z(ye,t).id){if(this.weatherLookupPending)return;this.chosenSourceId.set("weather",e.id),this.weatherInference=new tt(e.create())}else!e&&t!==void 0&&!ye.some(i=>i.id===t)&&(this.chosenSourceId.delete("weather"),this.weatherInference=new tt(z(ye,void 0).create()))}fillWeatherProvider(){this.weatherProviderSelect.replaceChildren(...ye.map(e=>{const t=new Option(e.name,e.id);return t.title=e.credit,t}),new Option(this.messages.sourceFile,y.FILE_SOURCE)),this.syncWeatherProvider()}syncWeatherProvider(){const e=!this.weatherInferredInput.checked,t=this.ufoElement.sighting.weatherSource,i=!e&&t!==void 0&&!St(t)?t:void 0;if(this.weatherProviderSelect.querySelector("option[data-stated]")?.remove(),i){const r=new Option(i.name??i.id,i.id);r.dataset.stated="",this.weatherProviderSelect.add(r,this.weatherProviderSelect.options.length-1)}this.weatherProviderSelect.value=e?y.FILE_SOURCE:i?i.id:z(ye,this.chosenSourceId.get("weather")).id,this.weatherProviderSelect.disabled=this.weatherInferredInput.disabled,this.weatherProviderSelect.title=this.weatherInferredInput.title;const s=z(ye,this.chosenSourceId.get("weather")),n=this.shadow.getElementById("weather-credit");n.hidden=e||i!==void 0,n.href=s.creditUrl,n.textContent=s.credit,this.weatherFileLink.hidden=!e,e&&(this.weatherFileLink.textContent=this.weatherFileItemLabel(),this.weatherFileLink.title=this.sectionFilePanel?.where("weather")??"")}onWeatherInferredToggled(){this.weatherFromRecords=this.weatherInferredInput.checked,this.setWeatherFromFile(!this.weatherFromRecords),this.weatherFromRecords?this.scheduleWeatherLookup(!0):(this.cancelWeatherLookup(),this.keepWeatherSource||(this.ufoElement.sighting.weatherSource=void 0),this.syncWeatherSourceState())}scheduleWeatherLookup(e=!1){if(!this.weatherFromRecords||this.pendingWeatherEdit!==void 0)return;const t=this.ufoElement.sighting.weatherSource;!e&&t!==void 0&&!St(t)||(clearTimeout(this.weatherLookupTimer),this.weatherLookupTimer=setTimeout(()=>void this.inferWeather(),gs))}cancelWeatherLookup(){clearTimeout(this.weatherLookupTimer),this.weatherLookupToken++,this.weatherLookupPending=!1}async inferWeather(){if(!this.weatherFromRecords)return;const e=++this.weatherLookupToken;this.weatherLookupPending=!0,this.syncWeatherSourceState();const t=await this.weatherInference.infer(this.ufoElement.sighting);e!==this.weatherLookupToken||!this.weatherFromRecords||(this.weatherLookupPending=!1,this.weatherLookupResult=t,t.status==="inferred"?(this.weatherInference.applyTo(this.ufoElement.sighting,t),this.weatherTrackSpan=this.ufoElement.seekableDuration,this.ufoElement.refresh(),this.syncWeatherFromTimeline()):this.ufoElement.sighting.weatherSource=void 0,this.syncWeatherSourceState())}ensureWeatherTrackSpan(){const e=this.ufoElement.sighting.weatherSource;if(!this.weatherFromRecords||e===void 0||!St(e))return;const t=this.ufoElement.seekableDuration;this.weatherTrackSpan===void 0||t===this.weatherTrackSpan||(this.weatherTrackSpan=t,this.scheduleWeatherLookup())}syncWeatherSourceState(){const e=this.ufoElement.sighting.weatherSource,t=this.weatherFromRecords;for(const o of this.weatherFields)o.disabled=t&&e!==void 0&&o!==this.iceCrystalAlignmentInput&&o!==this.rareIceCrystalsInput||this.ufoElement.playbackState==="playing",this.ufoElement.playbackState==="playing"?o.title=this.messages.weatherWhilePlaying:o.title===this.messages.weatherWhilePlaying&&(o.title=this.fieldHints.get(o.id)??"");const i=this.weatherInference.canInfer(this.ufoElement.sighting)&&!this.startDateHalfEntered();if(!i&&e!==void 0&&St(e)){this.cancelWeatherLookup(),this.weatherLookupResult=void 0,this.ufoElement.sighting.weatherSource=void 0,this.syncWeatherSourceState();return}this.weatherInferredInput.disabled=!i,this.weatherInferredInput.checked=i&&this.weatherFromRecords;const s=i?this.messages.weatherInferredTitle:this.messages.weatherNeedsDateAndPlace;this.weatherInferredInput.title=s,this.labelWeatherInferred.title=s,this.syncWeatherProvider();const n=t&&e!==void 0;if(this.weatherSourceLink.hidden=!n,n){this.weatherSourceRow.hidden=!1,this.weatherSourceText.textContent="",this.weatherSourceLink.href=e.url,this.weatherSourceLink.textContent=[e.name,this.observationInstantLabel()].filter(Boolean).join(", ");return}const r=i?t?this.weatherStatusMessage():"":this.weatherUnavailableMessage();this.weatherSourceText.textContent=r===""?"":`${r} `,this.weatherSourceRow.hidden=r===""||!i}startDateHalfEntered(){return this.shadow.getElementById("obs-time-native")?.validity.badInput===!0}weatherUnavailableMessage(){const e=this.weatherInference.missingOf(this.ufoElement.sighting);return this.startDateHalfEntered()&&(e.date=!0),e.date&&e.place?this.messages.weatherNeedsDateAndPlace:e.date?this.messages.weatherNeedsDate:this.messages.weatherNeedsPlace}weatherStatusMessage(){if(this.weatherLookupPending)return this.messages.weatherLookingUp;switch(this.weatherLookupResult?.status){case"unavailable":return this.messages.weatherNoRecord;case"failed":return this.messages.weatherLookupFailed;default:return""}}observationInstantLabel(){const e=this.ufoElement.sighting.event,t=e.time&&fe(e.time,e.place?.[0]?.lng??0,e.utcOffsetHours);return t?`${t.toISOString().slice(0,16).replace("T"," ")} UTC`:""}syncWeatherOwnership(){const e=this.ufoElement.sighting;this.cancelWeatherLookup(),this.pendingWeatherEdit=void 0,this.closeFileAsk(),this.weatherLookupResult=void 0,this.followWeatherRecord(),this.weatherFromRecords=!U.fromFile(e.snapshots,"weather")&&(e.weatherSource!==void 0||e.weatherTrack.allKeyframes.length===0),this.syncWeatherSourceState(),this.weatherFromRecords&&e.weatherSource===void 0&&this.scheduleWeatherLookup(),this.lightPollutionToken++,this.lightPollutionLookup=void 0,this.scheduleLightPollutionLookup()}lightPollutionProvider=yt[0].create();lightPollutionTimer;lightPollutionToken=0;lightPollutionLookup;lightPollutionFromRecord(){const e=this.ufoElement.sighting;if(this.sectionFromFile("lightPollution"))return!1;if(e.lightPollution===void 0)return!0;const t=e.provenance.at("lightPollution");return t?.basis==="derived"&&(t.of===void 0||t.of===e.lightPollution)}scheduleLightPollutionLookup(){if(clearTimeout(this.lightPollutionTimer),!this.lightPollutionFromRecord()){this.lightPollutionLookup=void 0,this.syncLightPollutionStatus();return}this.lightPollutionTimer=setTimeout(()=>void this.lookUpLightPollution(),gs)}async lookUpLightPollution(){if(!this.lightPollutionFromRecord())return;const e=this.ufoElement.sighting,t=e.event.place?.[0],i=++this.lightPollutionToken,s=this.lightPollutionProvider,n=e.event.time?.year,r=()=>{e.lightPollution!==void 0&&(e.lightPollution=void 0,e.provenance.clear("lightPollution"),this.lightPollutionInput.value="",this.ufoElement.refresh())};if(!t||t.lat===void 0||t.lng===void 0||n===void 0){this.lightPollutionLookup=void 0,this.syncLightPollutionStatus();return}if(n<s.year){r(),this.lightPollutionLookup={status:"too-early",year:n},this.syncLightPollutionStatus();return}this.lightPollutionLookup={status:"pending"},this.syncLightPollutionStatus();const o=await s.lookUp(t.lat,t.lng);i!==this.lightPollutionToken||!this.lightPollutionFromRecord()||(this.lightPollutionLookup=o,o.status==="found"?(e.lightPollution=o.lightPollution,e.provenance.set("lightPollution",{basis:"derived",rationale:`${s.citation}, at ${o.lat.toFixed(4)}, ${o.lng.toFixed(4)}: ${Math.round(o.artificialMcdPerM2*1e3)} µcd/m² artificial over the natural 171`,of:o.lightPollution}),this.lightPollutionInput.value=String(o.lightPollution),this.ufoElement.refresh()):o.status==="natural"&&r(),this.syncLightPollutionStatus())}syncLightPollutionStatus(){const e=this.lightPollutionLookup,t=this.messages;let i="";switch(e?.status){case"pending":i=t.lightPollutionLookingUp;break;case"found":i=t.lightPollutionFound.replace("{artificial}",Math.round(e.artificialMcdPerM2*1e3).toLocaleString(this.language));break;case"natural":i=t.lightPollutionNatural;break;case"outside":i=t.lightPollutionOutside;break;case"failed":i=t.lightPollutionFailed;break;case"too-early":i=t.lightPollutionTooEarly.replace("{atlasYear}",String(this.lightPollutionProvider.year)).replace("{year}",String(e.year));break}this.lightPollutionStatusText.textContent=i===""?"":`${i} `,this.lightPollutionSourceRow.hidden=!(e?.status==="found"||e?.status==="natural"||e?.status==="outside")}syncDurationField(){const e=this.shadow.activeElement;if(e!==this.durationInput&&e!==this.durationElement.textField){const t=this.ufoElement.sighting.event,i=Pt(t);this.durationElement.set(i!==void 0?i/1e3:void 0,t.durationText)}this.updateDurationValidity()}updateDurationValidity(){const e=this.durationInput.value==="";this.durationInput.classList.toggle("missing-required",e),this.markUnansweredQuestions(),this.durationInput.setAttribute("aria-invalid",String(e));const t=Bn(this.ufoElement.sighting.event);this.durationElement.title=t==="imprecise"?this.messages.durationImprecise:""}syncSoundControls(){const e=this.shadow.getElementById("editor-mute"),t=this.shadow.getElementById("editor-volume");if(!e||!t)return;const i=this.ufoElement.audible,s=!i||this.ufoElement.muted;e.disabled=!i,t.hidden=!i,e.innerHTML=s?Zt.MUTED:Zt.VOLUME;const n=i?this.ufoElement.muted?this.messages.unmute:this.messages.mute:this.messages.noSound;e.title=n??"",e.setAttribute("aria-label",n??""),e.setAttribute("aria-pressed",String(s)),t.title=this.messages.volume??"",t.setAttribute("aria-label",this.messages.volume??""),t.value=String(this.ufoElement.muted?0:this.ufoElement.volume)}syncPlaybackControls(){this.ensureWeatherTrackSpan();const e=this.ufoElement.playbackState==="playing",t=this.ufoElement.seekableDuration>0;this.syncSoundControls(),D.show(this.playPauseButton,e?"⏸":"▶"),this.playPauseButton.disabled=!t;const i=t?e?this.messages.pause:this.messages.play:this.messages.noDuration;this.playPauseButton.title=i,this.playPauseButton.setAttribute("aria-label",i),this.seekInput.max=String(this.ufoElement.seekableDuration),this.shadow.activeElement!==this.seekInput&&(this.seekInput.value=String(this.ufoElement.currentTime)),this.timeStartLabel.textContent=this.ufoElement.positionLabel,this.timeEndLabel.textContent=this.ufoElement.durationLabel,this.syncTimeDisplaySwitch();for(const[s,n]of[[this.previousMarkButton,this.messages.previousKeyframe],[this.nextMarkButton,this.messages.nextKeyframe]])s.title=n,s.setAttribute("aria-label",n);this.refreshTimelineMarks()}switchTimeDisplay(){this.ufoElement.toggleTimeDisplay(),this.timeStartLabel.textContent=this.ufoElement.positionLabel,this.timeEndLabel.textContent=this.ufoElement.durationLabel,this.syncTimeDisplaySwitch()}syncTimeDisplaySwitch(){const e=this.ufoElement.canSwitchTimeDisplay,t=this.ufoElement.showingClockTime?this.messages.switchToElapsed:this.messages.switchToClockTime;for(const[i,s]of[[this.timeStartLabel,this.messages.currentPosition],[this.timeEndLabel,this.messages.duration]])i.title=e?`${s} — ${t}`:s,i.classList.toggle("switchable",e),e?(i.setAttribute("role","button"),i.setAttribute("tabindex","0")):(i.removeAttribute("role"),i.removeAttribute("tabindex"))}chooseTimeInputMode(){const e=this.ufoElement.sighting.event;this.startDate.setPrecise(rt.opensPrecise(e.time)),this.endDate.setPrecise(rt.opensPrecise(e.endTime))}syncObservationTimeFields(){this.startDate.time=this.ufoElement.sighting.event.time}syncObservationEndTimeFields(){this.endDate.time=this.ufoElement.sighting.event.endTime}syncUtcOffsetField(){const e=this.ufoElement.sighting.event.utcOffsetHours;this.utcOffsetInput.value=e===void 0?"":String(e),this.updateUtcOffsetValidity()}updateUtcOffsetValidity(){const e=this.ufoElement.sighting.event.utcOffsetHours,t=this.ufoElement.sighting.event.place?.[0]?.lng,i=t===void 0?void 0:Math.round(t/15),s=e!==void 0&&i!==void 0&&Math.abs(e-i)>qr;this.utcOffsetInput.classList.toggle("invalid",s),this.utcOffsetInput.title=s?this.messages.utcOffsetImplausible.replace("{solar}",i>=0?`+${i}`:String(i)):"",this.showTimeZoneConsistency(s)}showTimeZoneConsistency(e){const t=this.ufoElement.sighting.event,i=this.placeZone&&t.time?.year!==void 0?this.timeZones.offsetHoursAt(this.placeZone,t.time):void 0,s=t.utcOffsetHours??(t.timeZone?this.timeZones.offsetHoursAt(t.timeZone,this.timeZoneReference()):void 0),n=i!==void 0&&s!==void 0&&s!==i;this.timeZoneSelect.classList.toggle("inconsistent",n&&this.timeZoneSelect.value!==""),this.utcOffsetInput.classList.toggle("inconsistent",n&&!e),this.timeZoneWarning.hidden=!n,this.timeZoneWarning.textContent=n?this.messages.utcOffsetInconsistent.replace("{zone}",this.placeZone).replace("{offset}",i>=0?`+${i}`:String(i)):""}scheduleGroundElevation(){const e=this.numberOrUndefined(this.latInput.value),t=this.numberOrUndefined(this.lngInput.value);e===void 0||t===void 0||this.groundElevationFor&&this.isSamePlace(this.groundElevationFor,e,t)||(clearTimeout(this.groundElevationTimer),this.groundElevationTimer=setTimeout(()=>void this.applyGroundElevation(e,t),Kr))}isSamePlace(e,t,i){return Math.abs(e.lat-t)<qe&&Math.abs(e.lng-i)<qe}async applyGroundElevation(e,t){const i=++this.groundElevationToken,s=z(gt,this.chosenSourceId.get("elevation")),n=await new Ei(s.create()).at(e,t);if(i!==this.groundElevationToken||n===void 0)return;this.groundElevationFor={lat:e,lng:t};const r=Math.max(0,(this.numberOrUndefined(this.elevationInput.value)??0)-(this.groundElevationM??0));this.groundElevationM=Math.round(n);const o=this.ufoElement.sighting.observerTrack.getInterpolatedPoseAt(this.ufoElement.currentTime)?.altitudeM;this.syncElevationField(r,o)}syncElevationField(e,t){const i=this.groundElevationM;this.elevationInput.value=String(Math.round(t??(i??0)+e)),this.elevationInput.min=i===void 0?"":String(i),this.elevationInput.title=i===void 0?"":this.messages.altitudeAboveSeaLevel,this.groundElevationOutput.textContent=i===void 0||Math.round(e)===0?"":this.messages.groundAt.replace("{m}",String(i))}syncGroundElevationField(){this.groundElevationToken++,clearTimeout(this.groundElevationTimer),this.groundElevationM=void 0,this.groundElevationFor=void 0;const e=X(this.ufoElement.sighting,0);this.syncElevationField(e?.elevationM??0,e?.altitudeM),this.scheduleGroundElevation()}syncPlaceNameField(){const e=this.ufoElement.sighting.event.place?.[0],t=e?.name??"";this.placeNameInput.value=t,this.placeNameInput.title=t,this.namedCoordinates=e&&t?{lat:e.lat,lng:e.lng}:void 0,this.placeMatches=[],this.placeMatchRow.hidden=!0,this.placeStatusText.textContent=""}syncObserverMetadataFields(){this.witnessErrorView?.refresh();const e=this.ufoElement.sighting;this.observerIdInput.value=e.observer?.id??"",this.observerTitleInput.value=this.said.read(e.observer?.title)??"",this.observerLastNameInput.value=e.observer?.lastName??"",this.observerFirstNamesInput.value=e.observer?.firstNames?.join(", ")??"",this.observerList.rename(y.OBSERVER_PRINCIPAL,this.principalObserverLabel()),this.sightingIdInput.value=e.id??"",this.observerAgeInput.value=e.account?.observerAgeYears?.toString()??"",this.birthDate.setPrecise(rt.opensPreciseDate(e.account?.observerBirth)),this.perceptionSettings.values=e.account?.observerPerception??{},this.birth=e.account?.observerBirth,this.birthDate.time=this.birth,this.observerOccupationInput.value=this.said.read(e.account?.observerOccupation)??"",this.accountSourceSelect.value=e.account?.source??"",this.accountUrlInput.value=e.sources?.[0]?.url??"",this.accountFollowedUpSelect.value=e.account?.followedUp===void 0?"":e.account.followedUp?"yes":"no",this.evaluationFields.show(e.account),this.descriptionInput.value=this.said.read(e.event.description)??"",this.showTags(),this.instrumentSelect.value=e.instrument.id,this.swayInput.value=e.sway?.toString()??"";const t=e.lens;this.lensGlassSelect.value=t?.glass??"",this.lensDropsInput.value=t?.drops?.toString()??"",this.lensCondensationInput.value=t?.condensation?.toString()??"",this.lensDirtInput.value=t?.dirt?.toString()??"",this.lensShelteredInput.checked=t?.sheltered===!0,this.skySourcesInput.checked=e.skySources!==!1,this.lightPollutionInput.value=e.lightPollution?.toString()??""}syncWeatherFromTimeline(){if(this.cloudEditor?.sync(),this.ufoElement.playbackState==="playing")return;const e=ne(this.ufoElement.sighting,this.ufoElement.currentTime),t=this.shadow.activeElement;t!==this.cloudCoverInput&&(this.cloudCoverInput.value=String(e.cloudCover)),t!==this.highCloudCoverInput&&(this.highCloudCoverInput.value=String(e.highCloudCover??0)),t!==this.iceCrystalAlignmentInput&&(this.iceCrystalAlignmentInput.value=String(e.iceCrystalAlignment??gi)),t!==this.rareIceCrystalsInput&&(this.rareIceCrystalsInput.value=String(e.rareIceCrystals??Fn)),t!==this.cloudDarknessInput&&(this.cloudDarknessInput.value=String(e.cloudDarkness)),t!==this.cloudBaseInput&&(this.cloudBaseInput.value=e.cloudBaseM===void 0?"":String(e.cloudBaseM)),t!==this.precipitationTypeSelect&&(this.precipitationTypeSelect.value=e.precipitationType),t!==this.precipitationIntensityInput&&(this.precipitationIntensityInput.value=String(e.precipitationIntensity)),t!==this.windDirectionInput&&(this.windDirectionInput.value=String(Math.round(e.windDirectionDeg))),t!==this.windSpeedInput&&(this.windSpeedInput.value=String(Math.round(e.windSpeed*2)/2)),t!==this.stormInput&&(this.stormInput.checked=e.storm)}syncObserverFromTimeline(){if(this.ufoElement.playbackState==="playing")return;this.syncStreetSearchAvailability();const e=this.ufoElement.sighting,t=e.observerTrack.getInterpolatedPoseAt(this.ufoElement.currentTime),i=e.event.place?.[0],s=this.shadow.activeElement;s!==this.latInput&&(this.latInput.value=t?.lat!==void 0?String(t.lat):i?String(i.lat):""),s!==this.lngInput&&(this.lngInput.value=t?.lng!==void 0?String(t.lng):i?String(i.lng):""),this.syncObserverPosition(),s!==this.headingInput&&(this.headingInput.value=t?.headingDeg!==void 0?String(this.rounded(t.headingDeg)):""),this.refreshHeadingPoint(),s!==this.pitchInput&&(this.pitchInput.value=String(this.rounded(t?.pitchDeg??0)),this.rollInput.value=String(this.rounded(t?.rollDeg??0))),s!==this.elevationInput&&this.syncElevationField(t?.elevationM??0,t?.altitudeM)}get appearance(){return{...this.currentAppearance}}set appearance(e){this.setAppearance(e)}setAppearance(e){const t="presetId"in e;this.currentAppearance={...this.currentAppearance,...e},!(this.isRecording||this.ufoElement.playbackState==="playing")&&this.ufoElement.sighting.timeline.sourceIds.includes(this.currentSourceId)&&this.applyAppearanceAtPlayhead(void 0,t)}applyAppearanceAtPlayhead(e,t=!0){const i=this.ufoElement.sighting.timeline,s=this.ufoElement.currentTime,n=i.getInterpolatedShapeAt(s,this.currentSourceId),r=this.buildAppearanceShape(e??n?.bounds??this.defaultBounds(),n,t);this.commitShapes(s,[{sourceId:this.currentSourceId,shape:r}]),this.ufoElement.refresh()}buildAppearanceShape(e,t,i=!0){if(t&&!i)return{...t,color:this.currentAppearance.color,transparency:this.currentAppearance.transparency,haloScale:this.currentAppearance.haloScale,blur:this.currentAppearance.blur,brightness:this.currentAppearance.brightness};const s=Xi(e,this.currentAppearance);return t?{...s,angle:t.angle,title:t.title,selected:t.selected}:s}isGroupOpen(e){return e.getAttribute("aria-expanded")==="true"}toggleGroup(e,t){this.sectionChosen=!0,this.opensMostLacking=!1,this.cloudEditor?.stopManipulation();for(const[i,s]of this.groupTabs.entries()){const n=s===e&&t;s.setAttribute("aria-expanded",String(n)),this.groupPanels[i].hidden=!n}if(t){const i=e.parentElement.getBoundingClientRect(),s=e.getBoundingClientRect();(s.left<i.left||s.right>i.right)&&(e.parentElement.scrollLeft+=s.left-i.left-(i.width-s.width)/2)}if(t&&e.getAttribute("aria-controls")==="group-decor"){const i=this.decorList.value;i!==""&&i!==this.currentDecorId&&this.selectDecor(i)}t&&e.getAttribute("aria-controls")==="group-observer"&&this.observerShown!==y.OBSERVER_PRINCIPAL&&this.selectDecor(this.observerShown),t&&e.getAttribute("aria-controls")==="group-weather"&&this.syncSkyParts(),t&&e.getAttribute("aria-controls")==="group-shape"&&this.showPhenomenonPartWithContent(),t&&e.getAttribute("aria-controls")==="group-observation"&&this.candidatesView?.refresh(),this.placeDecorItem(),this.syncCanvasMode(),this.refreshTimelineMarks(),t&&this.sectionFolds.refresh(),t&&e.getAttribute("aria-controls")==="group-file"&&this.loadFileEditor().then(()=>{this.syncFileEditor(!1),this.showFileItem(this.fileItemSelect.value)},()=>this.showFileNote(this.messages.importError,"error"))}loadFileEditor(){return this.fileEditorLoading??=(async()=>{this.showFileNote(this.messages.fileLoading);try{const{SightingFileEditor:e}=await M(async()=>{const{SightingFileEditor:t}=await import("./SightingFileEditor-Cllslp2u.js");return{SightingFileEditor:t}},__vite__mapDeps([12,13,14]),import.meta.url);return this.historySnapshot??=this.fileText(),this.fileTextApplied=this.historySnapshot,this.fileEditor=new e(this.fileEditorHost,this.historySnapshot,t=>this.onFileTextEdited(t),this.messages.fileEditorLabel,{baseline:this.touched?this.savedFileText:this.fileText(),phrases:this.messages.fileSearchPhrases,caretMoved:t=>this.onFileCaret(t)}),this.fileEditor}catch(e){throw this.fileEditorLoading=void 0,e}finally{this.showFileNote(void 0)}})(),this.fileEditorLoading}fileSyncActive(){return this.fileEditor!==void 0&&this.isGroupIdOpen("group-file")}fileFocus;caretTimer;followingCaret=!1;onFileCaret(e){clearTimeout(this.caretTimer),this.caretTimer=setTimeout(()=>this.focusFromFile(e),120)}focusFromFile(e){if(!this.fileSyncActive())return;const t=this.ufoElement.sighting;this.followingCaret=!0;try{const i=e[0]==="decor"&&typeof e[1]=="number"?t.decor[e[1]]:void 0;if(i!==void 0){this.fileFocus="decor",this.selectDecor(i.id);return}const s=e[0]==="timeline"&&e[1]==="keyframes"&&typeof e[2]=="number"&&e[3]==="shapes"&&typeof e[4]=="number"?t.timeline.allKeyframes[e[2]]?.shapes[e[4]]:void 0;if(s!==void 0){this.fileFocus="shape",this.selectUnit(s.sourceId),this.syncCanvasMode(),this.ufoElement.refresh();return}this.fileFocus=void 0,this.syncCanvasMode(),this.ufoElement.refresh()}finally{this.followingCaret=!1}}showInFile(e){this.followingCaret||e===void 0||!this.fileSyncActive()||this.fileEditor.reveal(e)}bodyPath(e){try{const i=(JSON.parse(this.fileEditor.text).interpretation?.bodies??[]).findIndex(s=>s.id===e);return i>=0?["interpretation","bodies",i]:void 0}catch{return}}shapePath(e){const t=this.ufoElement.sighting.timeline.allKeyframes;for(const[i,s]of t.entries()){const n=s.shapes.findIndex(r=>r.sourceId===e);if(n>=0)return["timeline","keyframes",i,"shapes",n]}}showFileNote(e,t="info"){F.show(this.fileNote,e,t)}fileText(){return this.writtenText(this.ownJson(this.sightingData))}ownJson(e){const t={...e};for(const i of U.NAMES)this.ufoElement.sighting.snapshots?.[i]?.src!==void 0&&U.strip(i,t);return t}withAnnexed(e){const t=e.snapshots,i=this.sightingData;for(const s of U.NAMES){const n=U.taken(s,e);t?.[s]?.src===void 0||Object.values(n).some(r=>!Array.isArray(r)||r.length>0)||U.put(s,e,U.taken(s,i))}return e}writtenText(e){const t=this.keyframesWritten();return is.of(e,t,t==="thin"?Ce.derivable(this.ufoElement.sighting):void 0)}keyframesWritten(){return this.wholeKeyframesInput.checked?"whole":"thin"}static WHOLE_KEYFRAMES_STORAGE="rr0-sighting-editor.whole-keyframes";setKeyframesWritten(){try{this.wholeKeyframesInput.checked?localStorage.setItem(y.WHOLE_KEYFRAMES_STORAGE,"true"):localStorage.removeItem(y.WHOLE_KEYFRAMES_STORAGE)}catch{}if(this.baseline){const e=Is(JSON.parse(this.baseline)),t=this.keyframesWritten();this.baseline=is.of(this.ownJson(pi(e)),t,t==="thin"?Ce.derivable(e):void 0),this.savedFileText=this.baseline}this.resetHistory()}scheduleFileSync(){this.fileEditor===void 0||this.fileSyncTimer!==void 0||!this.isGroupIdOpen("group-file")||(this.fileSyncTimer=setTimeout(()=>{this.fileSyncTimer=void 0,this.syncFileEditor()},250))}syncFileEditor(e=!0){const t=this.fileEditor;if(!(t===void 0||!this.isGroupIdOpen("group-file")||t.focused)&&!this.historyAnswering){if(t.edited)try{JSON.parse(t.text)}catch{return}t.replaceText(this.fileText(),e),this.fileTextApplied=t.text}}onFileTextEdited(e){this.syncHistoryButtons(),clearTimeout(this.fileApplyTimer),this.fileApplyTimer=setTimeout(()=>this.applyFileText(e),500)}applyFileText(e,t=!1){this.fileApplyTimer=void 0;let i;try{i=JSON.parse(e)}catch{return}if(typeof i!="object"||i===null||Array.isArray(i))return;const s=JSON.stringify(i.weatherTrack);if(i=this.withAnnexed(i),!t&&JSON.stringify(i)===JSON.stringify(this.sightingData))return;const n=this.ufoElement.currentTime,r=!t&&this.fileTextApplied!==void 0&&s!==JSON.stringify(y.weatherOf(this.fileTextApplied)),o={track:this.sightingData.weatherTrack,source:this.sightingData.weatherSource};this.applyingFileText=!0;try{if(this.sightingData=i,this.touched=!0,this.ufoElement.currentTime=n,r&&!this.restoringWeather&&this.weatherFromRecords){const l=this.ufoElement.sighting.weatherSource;l===void 0?(this.weatherFromRecords=!1,this.cancelWeatherLookup(),this.syncWeatherSourceState()):ye.some(a=>a.id===l.id)&&this.askAboutWeather(o,l.name??l.id)}this.showFileNote(void 0),this.historySnapshot=this.fileText()}catch(l){this.showFileNote(l instanceof Ct?l.said(this.messages.formatVersionError):this.messages.importErrorMalformed,"error"),this.fileTextApplied=e}finally{this.applyingFileText=!1}}fileTextApplied;static weatherOf(e){try{return JSON.parse(e).weatherTrack}catch{return}}pendingWeatherEdit;restoringWeather=!1;askAboutWeather(e,t){this.cancelWeatherLookup(),this.pendingWeatherEdit=e,this.shadow.getElementById("file-ask-text").textContent=this.messages.weatherEditedAsk.replaceAll("{source}",t),this.shadow.getElementById("file-ask-stop").textContent=this.messages.weatherEditedStop,this.shadow.getElementById("file-ask-keep").textContent=this.messages.weatherEditedKeep,typeof this.fileAsk.showModal=="function"?this.fileAsk.showModal():this.fileAsk.setAttribute("open","")}closeFileAsk(){typeof this.fileAsk.close=="function"?this.fileAsk.close():this.fileAsk.removeAttribute("open")}stopReadingWeather(){this.pendingWeatherEdit=void 0,this.closeFileAsk(),this.weatherFromRecords=!1,this.cancelWeatherLookup(),this.ufoElement.sighting.weatherSource=void 0,this.syncWeatherSourceState(),this.ufoElement.refresh(),this.syncFileEditor(!1)}keepReadingWeather(){const e=this.pendingWeatherEdit;if(this.pendingWeatherEdit=void 0,this.closeFileAsk(),e!==void 0){this.restoringWeather=!0;try{this.applyFileText(JSON.stringify({...this.sightingData,weatherTrack:e.track,weatherSource:e.source}))}finally{this.restoringWeather=!1}this.syncFileEditor(!1)}}applyingFileText=!1;patchingDraft=!1;leaveFileEditor(){const e=this.fileEditor;e!==void 0&&(this.fileApplyTimer!==void 0&&(clearTimeout(this.fileApplyTimer),this.applyFileText(e.text)),setTimeout(()=>this.syncFileEditor(!1),0))}static SCENE_LINKED=["heading","pitch","focalLength","apparentWidth","realWidth","objectDistance","color","haloScale","cloudCover","windDirection","windSpeed","referenceOpacity"];setActiveSceneField(e){e!==this.activeSceneField&&(this.activeSceneField=e,e==="referenceOpacity"&&!this.ufoElement.referencesShown?(this.ufoElement.toggleReferences(),this.referencesShownForField=!0):e!=="referenceOpacity"&&this.referencesShownForField&&(this.ufoElement.referencesShown&&this.ufoElement.toggleReferences(),this.referencesShownForField=!1),this.refreshSceneField())}static COMPASS_STEP_DEG=45;static HORIZON_STEP_DEG=2;showOrientation(e,t){const i=o=>this.rounded(o).toLocaleString(this.language,{maximumFractionDigits:1}),s=o=>o.x>=-.05&&o.x<=1.05&&o.y>=-.05&&o.y<=1.05;let n;if(e!==void 0){const o=(e%360+360)%360,l=[];for(let a=0;a<360;a+=y.COMPASS_STEP_DEG){const d=this.sceneElement.horizonPointAt(a);d&&s(d)&&l.push({...d,label:this.naming.point(a)})}n={label:this.messages.overlayHeading.replaceAll("{deg}",i(o)).replaceAll("{point}",this.naming.point(o)),compass:l}}let r;if(t!==void 0){const o=[[]];for(let l=0;l<=360;l+=y.HORIZON_STEP_DEG){const a=this.sceneElement.horizonPointAt(l);a&&Math.abs(a.x-.5)<1.5&&Math.abs(a.y-.5)<1.5?o[o.length-1].push(a):o[o.length-1].length>0&&o.push([])}r={line:o,label:this.messages.overlayHorizon.replaceAll("{deg}",i(t))}}this.sceneFieldOverlay.orientation(n,r)}refreshSceneField(){const e=this.sceneFieldOverlay;if(!e)return;const t=this.activeSceneField,i=this.ufoElement.sighting,s=this.ufoElement.currentTime,n=this.ufoElement.canvasElement,r=this.messages,o=a=>this.numberOrUndefined(a.value),l=(a,d=1)=>a===void 0?"?":a.toLocaleString(this.language,{maximumFractionDigits:d});if(t==="pitch")this.showOrientation(void 0,o(this.pitchInput)??0);else if(t==="heading")this.showOrientation(o(this.headingInput)??0,void 0);else if(t==="focalLength"){const a=Ce.fovOf(i,s),h=2*Yt.of(i.instrument,n.height,a).halfWidthAngleDeg(n.width/n.height);e.frame(r.overlayFov.replaceAll("{v}",l(a)).replaceAll("{h}",l(h)))}else if(t==="apparentWidth"||t==="realWidth"||t==="objectDistance"){const a=i.timeline.getInterpolatedShapeAt(s,this.currentSourceId);if(!a){e.hide();return}const d=a.bounds,c=[[o(this.apparentWidthInput),"°",1],[o(this.realWidthInput)," m",1],[o(this.objectDistanceInput)," m",0]].filter(([u])=>u!==void 0).map(([u,p,m])=>`${l(u,m)}${p}`).join(" · ");e.measure((d.x+d.width/2)/n.width,(d.y+d.height/2)/n.height,Math.max(d.width,d.height)*1.3/n.width,c)}else if(t==="windDirection"||t==="windSpeed"){const a=o(this.windDirectionInput)??0,d=a-(o(this.headingInput)??0);e.wind(d,r.overlayWind.replaceAll("{point}",this.naming.point(a)).replaceAll("{speed}",l(o(this.windSpeedInput))))}else e.hide()}attachWitnessErrors(){const e=this,t=()=>this.ufoElement.sighting,i=()=>this.ufoElement.currentTime,s=this.shadow.querySelector('rr0-date-input[name="obs-time"]');this.witnessErrorView.attach({kind:"time",label:s.closest("label"),input:s,path:()=>t().event.time?"time":void 0,value:()=>t().event.time?.hour!==void 0?0:void 0}),this.witnessErrorView.attach({kind:"duration",label:this.durationElement.closest("label"),input:this.durationElement,path:()=>t().event.durationSeconds!==void 0?"durationSeconds":void 0,value:()=>t().event.durationSeconds});const n=a=>{let d=-1;return a.forEach((h,c)=>{h<=i()&&(d=c)}),d===-1&&a.length>0?0:d};this.witnessErrorView.attach({kind:"heading",label:this.headingInput.closest("label"),input:this.headingInput,path:()=>{const a=n(t().observerTrack.allKeyframes.map(d=>d.t));return a===-1||this.headingInput.value===""?void 0:`observerTrack.keyframes.${a}.pose.headingDeg`},value:()=>this.numberOrUndefined(this.headingInput.value)}),this.witnessErrorView.attach({kind:"angularSize",label:this.apparentWidthInput.closest("label"),input:this.apparentWidthInput,path:()=>{const a=t().timeline.allKeyframes,d=n(a.filter(p=>p.shapes.some(m=>m.sourceId===this.currentSourceId)).map(p=>p.t));if(d===-1||this.apparentWidthInput.value==="")return;const h=a.filter(p=>p.shapes.some(m=>m.sourceId===this.currentSourceId))[d],c=a.indexOf(h),u=h.shapes.findIndex(p=>p.sourceId===this.currentSourceId);return`timeline.keyframes.${c}.shapes.${u}.shape.angular`},value:()=>this.numberOrUndefined(this.apparentWidthInput.value)});const r=this.shadow.getElementById("observerPerception").closest(".form-section");this.witnessErrorView.placeObserverSections(r);const o=document.createElement("div");o.className="form-section candidates-section",this.shadow.getElementById("group-observation").append(o);const l=a=>a?.closest("label")??void 0;this.candidatesView=new se({get sighting(){return e.ufoElement.sighting},messages:()=>this.messages.witnessError,model:()=>this.witnessErrorView.errorModel,conditions:()=>this.ufoElement.sighting.account?.conditions,start:()=>{const a=this.ufoElement.sighting.event,d=a.place?.[0];if(!d||a.time?.year===void 0||a.time.hour===void 0)return;const h=fe(a.time,d.lng,a.utcOffsetHours);return h?{date:h,observer:{lat:d.lat,lng:d.lng,elevationM:this.groundElevationM??0}}:void 0},limitAt:a=>Ge(a,this.instrumentGain()),fieldLabels:()=>({time:l(s),heading:l(this.headingInput),size:l(this.apparentWidthInput),duration:l(this.durationInput)}),sceneCard:()=>this.shadow.querySelector(".scene-card"),poher:a=>{const d=`${a}/${this.language}`;return this.poherMatrix?.key!==d&&(this.poherMatrix={key:d,loaded:ze.load(a,this.language,h=>Ye.json(h))}),this.poherMatrix.loaded},facts:()=>this.poherFacts(),satellites:()=>{const a=(this.ufoElement.sighting.event.durationSeconds??0)*1e3||this.ufoElement.seekableDuration,d=this.sceneElement.satellitePassesDuring(a);return d.length>0?{passes:d,positionsAt:h=>this.sceneElement.satellitePositionsAt(h)}:void 0},burning:()=>this.sceneElement.burningCandidates(),traffic:()=>this.sceneElement.trafficCandidates(),interpretations:()=>{const a=this.ufoElement.sighting.interpretation;return[...a&&(a.bodies.length>0||Mt.computes(a,Lt.kinds()))?[{id:"own",label:this.said.read(a.title)??this.principalObserverLabel(),interpretation:a}]:[],...this.readings]},computed:a=>this.sceneElement.computedInterpretation(a),starName:a=>this.naming.star({name:a}),projectionAt:(a,d)=>this.sceneElement.bodyProjectionAt(a,d),variants:()=>this.ufoElement.sighting.variants,keep:a=>this.editVariants(d=>[...d,a]),remove:a=>this.editVariants(d=>d.filter((h,c)=>c!==a))},o)}readings=[];editVariants(e){this.touch(),this.armHistory(),this.ufoElement.sighting.variants=e(this.ufoElement.sighting.variants),this.scheduleHistoryRecord()}poherMatrix;poherFacts(){const e=this.ufoElement.sighting,t={},i=e.event,s=i.place?.[0];if(s&&i.time?.year!==void 0&&i.time.hour!==void 0){const d=fe(i.time,s.lng,i.utcOffsetHours);d&&(t.sunAltitudeDeg=K("Sun",d,{lat:s.lat,lng:s.lng,elevationM:this.groundElevationM??0}).altitudeDeg)}if(i.durationSeconds!==void 0&&(t.durationSeconds=i.durationSeconds),e.weatherTrack.allKeyframes.length>0){const d=ne(e,0);t.cloudCover=d.cloudCover,t.lightning=d.storm,t.lowVisibility=d.precipitationType!=="none"&&d.precipitationIntensity>.3}const n=e.timeline,r=n.sourceIds[0];if(r){const d=n.allKeyframes.filter(u=>u.shapes.some(p=>p.sourceId===r)),h=d.map(u=>({t:u.t,shape:n.getShapeAt(u.t,r)})).filter(u=>u.shape?.aim),c=n.getInterpolatedShapeAt(d[0]?.t??0,r);if(c?.aim&&(t.elevationDeg=c.aim.altitudeDeg),c?.angular){t.widthDeg=c.angular.widthDeg;const u=c.angular.heightDeg>0?c.angular.widthDeg/c.angular.heightDeg:1;t.round=c.kind==="oval"&&u>.8&&u<1.25}if(c?.brightness!==void 0&&(t.brightness=c.brightness),h.length>1){const u=(g,b)=>{const v=Math.PI/180,I=Math.sin(g.altitudeDeg*v)*Math.sin(b.altitudeDeg*v)+Math.cos(g.altitudeDeg*v)*Math.cos(b.altitudeDeg*v)*Math.cos((g.azimuthDeg-b.azimuthDeg)*v);return Math.acos(Math.max(-1,Math.min(1,I)))/v},p=h.slice(1).map((g,b)=>({deg:u(h[b].shape.aim,g.shape.aim),s:(g.t-h[b].t)/1e3}));t.sweepDeg=u(h[0].shape.aim,h[h.length-1].shape.aim);const m=p.reduce((g,b)=>g+b.deg,0);t.straysDeg=Math.max(0,m-t.sweepDeg)/2;const f=(h[h.length-1].t-h[0].t)/1e3;if(f>0){t.speedDegPerS=m/f;const g=Math.max(...p.filter(b=>b.s>0).map(b=>b.deg/b.s));t.speedVariation=t.speedDegPerS>0?g/t.speedDegPerS:0}}}const o=new Set(n.sourceIds.map(d=>n.groupMembers(d)?.[0]??d));o.size>0&&(t.count=o.size);const l=[...o].map(d=>n.getInterpolatedShapeAt(0,d)?.aim).filter(d=>d!==void 0);if(l.length>=3){const d=Math.PI/180,h=l.map(m=>({x:(((m.azimuthDeg-l[0].azimuthDeg)%360+540)%360-180)*Math.cos(m.altitudeDeg*d),y:m.altitudeDeg}));let[c,u]=[h[0],h[1]];for(const m of h)for(const f of h)Math.hypot(m.x-f.x,m.y-f.y)>Math.hypot(c.x-u.x,c.y-u.y)&&([c,u]=[m,f]);const p=Math.hypot(c.x-u.x,c.y-u.y);t.aligned=p>0&&h.every(m=>Math.abs((u.x-c.x)*(c.y-m.y)-(c.x-m.x)*(u.y-c.y))/p<=Math.max(.5,p*.1))}const a=new Set([...o].map(d=>n.getInterpolatedShapeAt(0,d)?.color).filter(d=>d!==void 0));return a.size>0&&(t.colors=[...a]),t.observers=e.observerCount,e.instrument.category==="eye"&&(t.nakedEye=!0),e.soundTrack.allKeyframes.some(d=>d.sound.kind!=="none")&&(t.sound=!0),t}candidatesTimer;refreshCandidatesSoon(){clearTimeout(this.candidatesTimer),this.isGroupIdOpen("group-observation")&&(this.candidatesTimer=setTimeout(()=>this.candidatesView?.refresh(),150))}showOverlays(){const e=this.shadow.querySelector(".scene-card");e.dataset.shown="",clearTimeout(this.overlayTimer),this.overlayTimer=setTimeout(()=>delete e.dataset.shown,3500)}static SCENE_HEIGHT_KEY="rr0-editor-scene-height";resizeScene(e){const t=this.shadow.querySelector(".app"),i=this.sceneElement,s=n=>{n===void 0?t.style.removeProperty("--rr0-scene-max-height"):t.style.setProperty("--rr0-scene-max-height",`${Math.round(Math.min(window.innerHeight*.85,Math.max(120,n)))}px`);try{n===void 0?localStorage.removeItem(y.SCENE_HEIGHT_KEY):localStorage.setItem(y.SCENE_HEIGHT_KEY,t.style.getPropertyValue("--rr0-scene-max-height"))}catch{}};try{const n=localStorage.getItem(y.SCENE_HEIGHT_KEY);n&&/^\d+px$/.test(n)&&t.style.setProperty("--rr0-scene-max-height",n)}catch{}e.addEventListener("pointerdown",n=>{n.preventDefault();const r=n.clientY,o=i.getBoundingClientRect().height;e.setPointerCapture?.(n.pointerId),e.classList.add("dragging");const l=d=>s(o+d.clientY-r),a=()=>{e.classList.remove("dragging"),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",a),e.removeEventListener("pointercancel",a)};e.addEventListener("pointermove",l),e.addEventListener("pointerup",a),e.addEventListener("pointercancel",a)}),e.addEventListener("keydown",n=>{n.key!=="ArrowUp"&&n.key!=="ArrowDown"||(n.preventDefault(),s(i.getBoundingClientRect().height+(n.key==="ArrowUp"?-20:20)))}),e.addEventListener("dblclick",()=>s(void 0))}setTracksShown(e){this.shadow.querySelector(".scene-card").toggleAttribute("data-tracks",e),this.shadow.getElementById("timeline-tracks").hidden=!e,this.tracksToggle.setAttribute("aria-expanded",String(e));const i=e?this.messages.collapseTracks:this.messages.expandTracks;this.tracksToggle.title=i,this.tracksToggle.setAttribute("aria-label",i),this.refreshTracks()}flash(e){e&&(e.classList.add("flash"),setTimeout(()=>e.classList.remove("flash"),1800))}refreshTracks(){if(!this.timelineTracks||this.tracksToggle.getAttribute("aria-expanded")!=="true")return;const e=this.ufoElement.sighting,t=this.messages,i=o=>{const l=this.groupTabs.find(a=>a.getAttribute("aria-controls")===o);l&&this.toggleGroup(l,!0)},s=o=>()=>{this.touch(),this.armHistory(),o(),this.scheduleHistoryRecord(),this.refreshTimelineMarks()},r=[this.showsBodies?{id:"bodies",label:t.bodiesTrack,color:"#f5c451",...this.eventMarks("bodies"),open:()=>this.chooseAccountView(!0),selected:this.pickedEvent(this.bodiesEventsPanel),select:o=>this.pickEvent(Number(o)),add:()=>this.bodyEditor?s(()=>this.bodyEditor.keyframeHere())():this.chooseAccountView(!0)}:{id:"shapes",label:t.shapesTrack,color:"#f5c451",...this.eventMarks("phenomenon"),open:()=>this.revealShapePanel(),selected:this.pickedEvent(this.phenomenonEventsPanel),select:o=>this.pickEvent(Number(o)),add:s(()=>{e.timeline.sourceIds.includes(this.currentSourceId)&&this.applyAppearanceAtPlayhead(void 0,!1)})},{id:"observer",label:t.observerTrack,color:"#7fd4ff",...this.eventMarks("observer"),open:()=>i("group-location"),selected:this.pickedEvent(this.eventsPanel),select:o=>this.pickEvent(Number(o)),add:s(()=>this.updateObserver())},{id:"weather",label:t.weatherTrack,color:"#b9c8d8",times:e.weatherTrack.allKeyframes.map(o=>o.t),open:()=>i("group-weather"),add:s(()=>this.applyWeatherAtPlayhead())},{id:"sound",label:t.soundTrack,color:"#9fd9a8",times:e.soundTrack.allKeyframes.map(o=>o.t),open:()=>i("group-sound"),add:s(()=>this.applySoundAtPlayhead())}];this.timelineTracks.show(r,this.ufoElement.seekableDuration,this.ufoElement.currentTime)}eventMarks(e){const t=this.ufoElement.sighting;if(e==="bodies")return this.bodyMarks();const i=e==="observer"?ce.observerTrackIsExpanded(t):ce.timelineIsExpanded(t),s=e==="observer"?t.observerTrack.allKeyframes:t.timeline.allKeyframes;if(!i)return{times:s.map(d=>d.t)};const n=this.ufoElement.seekableDuration,r=d=>e==="observer"?V.isObserver(t,d):V.isPhenomenon(t,d),o=(t.events??[]).map((d,h)=>({event:d,index:h})).filter(({event:d})=>r(d)),l=new Set(o.map(({event:d})=>d.who)).size>1,a=o.map(({event:d,index:h})=>{const c=this.messages.events.kinds[d.eventType]??d.eventType;return{id:String(h),t:d.t,until:d.until??n,label:e==="phenomenon"&&l?`${this.shapesLabel(d.who??"")} · ${c}`:c}});return{times:[],spans:a}}bodyMarks(){const e=this.ufoElement.sighting,t=e.interpretation?.bodies??[],i=new Set(t.map(l=>l.id)),s=l=>V.partOf(l)?.element??l??"",n=(e.events??[]).map((l,a)=>({event:l,index:a})).filter(({event:l})=>i.has(s(l.who)));if(n.length===0||!ce.bodiesAreExpanded(e))return{times:[...new Set(t.flatMap(l=>l.track.map(a=>a.t)))].sort((l,a)=>l-a)};const r=this.ufoElement.seekableDuration,o=n.map(({event:l,index:a})=>{const d=t.find(p=>p.id===s(l.who)),h=V.partOf(l.who)?.part,c=this.messages.events.kinds[l.eventType]??l.eventType,u=[...t.length>1?[this.said.read(d?.title)??s(l.who)]:[],...h?[h]:[]];return{id:String(a),t:l.t,until:l.until??r,label:[...u,c].join(" · ")}});return{times:[],spans:o}}pickedEvent(e){const t=e?.pickedIndex,i=e===this.eventsPanel?"events-section":e===this.phenomenonEventsPanel?"phenomenon-events-section":"bodies-events-section",s=this.shadow.getElementById(i);return t===void 0||!s||s.closest("[hidden]")?void 0:String(t)}pickEvent(e){const t=this.ufoElement.sighting,i=t.events?.[e];if(!i)return;const s=i.who??V.observerId(t);if(V.isObserver(t,i)){const n=this.groupTabs.find(r=>r.getAttribute("aria-controls")==="group-location");n&&this.toggleGroup(n,!0),this.eventsPanel.pick(e)}else V.isPhenomenon(t,i)?(this.revealShapePanel(),this.phenomenonEventsPanel.pick(e)):(this.chooseAccountView(!0),this.loadBodyEditor().then(n=>{n.show(V.partOf(s)?.element??s),this.bodiesEventsPanel.pick(e),this.refreshTracks()}));this.goToMark(i.t),this.refreshTracks()}shapesLabel(e){const t=this.ufoElement.sighting,i=t.timeline.groupOf(e);if(i)return this.said.read(i.title)??e;const s=t.timeline.allKeyframes.map(n=>n.shapes.find(r=>r.sourceId===e)?.shape.title).find(n=>n!==void 0);return this.said.read(s)??e}get showsBodies(){return this.accountViewSelect.value==="bodies"}refreshTimelineMarks(){const e=this.ufoElement.sighting,t=(l,a)=>[...a].map(d=>({t:d,kind:"keyframe",label:`${this.messages.keyframeMark} (${l})`})),i=l=>{if(this.showsBodies){const d=this.eventMarks("bodies");return d.spans?d.spans.map(h=>({t:h.t,kind:"event",label:h.label})):t(this.messages.bodiesTrack,d.times)}const{spans:a}=this.eventMarks("phenomenon");return a?a.map(d=>({t:d.t,kind:"event",label:d.label})):t(this.messages.shapesTrack,e.timeline.allKeyframes.filter(d=>!l||d.shapes.some(h=>this.selectedSourceIds.has(h.sourceId))).map(d=>d.t))},s=()=>{const{times:l,spans:a}=this.eventMarks("observer");return a?a.map(d=>({t:d.t,kind:"event",label:d.label})):t(this.messages.observerTrack,l)},n=()=>t(this.messages.weatherTrack,e.weatherTrack.allKeyframes.map(l=>l.t)),r=()=>t(this.messages.soundTrack,e.soundTrack.allKeyframes.map(l=>l.t)),o=this.isGroupIdOpen("group-shape")?i(!0):this.isGroupIdOpen("group-observer")||this.isGroupIdOpen("group-location")?s():this.isGroupIdOpen("group-weather")?n():this.isGroupIdOpen("group-sound")?r():[...i(!1),...s(),...n(),...r()];for(const l of e.milestones)o.push({t:l.t,kind:"milestone",label:this.said.read(l.label)??""});this.timelineMarks.show(o,this.ufoElement.seekableDuration),this.refreshTracks(),this.eventsPanel?.sync(),this.phenomenonEventsPanel?.sync(),this.bodiesEventsPanel?.sync(),this.witnessErrorView?.refreshFields(),this.activeSceneField&&this.refreshSceneField()}seekTo(e){this.goToMark(e*1e3)}set passages(e){const t=this.shadow.getElementById("moment-passages");t.replaceChildren(...(e??[]).map(i=>{const s=document.createElement("li"),n=document.createElement("button");n.type="button",n.className="at",n.innerHTML=Zt.PLAY,n.append(i.clock),n.addEventListener("click",()=>this.seekTo(i.at));const r=document.createElement("button");return r.type="button",r.className="excerpt",r.textContent=i.said,r.title=i.where,r.addEventListener("click",()=>i.open()),s.append(n,r),s})),t.hidden=t.childElementCount===0}set interviewSources(e){this.saidInterviews=e,this.witnessErrorView?.refreshFields()}valueSources(){if(!this.worded)return;const e=this.ufoElement.sighting.references.filter(t=>t.kind!=="video").map(t=>({id:t.id,label:this.said.read(t.title)??t.id}));return{messages:this.messages.basisSource,choices:{...this.saidInterviews?.length?{interviews:this.saidInterviews}:{},...e.length>0?{pictures:e}:{}}}}openSection(e){const t=this.groupTabs.find(i=>i.getAttribute("aria-controls")===e);t&&this.toggleGroup(t,!0)}showRender(){this.sceneElement.scrollIntoView?.({block:"center",behavior:"smooth"})}goToMark(e){e!==void 0&&(this.ufoElement.currentTime=e,this.syncPlaybackControls())}isGroupIdOpen(e){const t=this.groupTabs.find(i=>i.getAttribute("aria-controls")===e);return t!==void 0&&this.isGroupOpen(t)}canvasMode(){return this.isGroupIdOpen("group-reference")&&this.currentReferenceId!==void 0?"picture":this.isGroupIdOpen("group-file")?this.fileFocus==="decor"&&this.editableDecor()!==void 0?"decor":this.fileFocus==="shape"&&this.selectedSourceIds.size>0?"shape":"scene":this.isGroupIdOpen("group-shape")&&this.shadow.getElementById("shape-bodies")?.hidden===!1?"body":this.isGroupIdOpen("group-weather")&&this.openSkyParts().some(e=>e.category==="skyEvent")?"scene":this.isGroupIdOpen("group-shape")?"shape":this.isGroupIdOpen("group-decor")&&this.editableDecor()!==void 0?"decor":"scene"}syncCanvasMode(){const e=this.canvasMode(),t=e==="picture",i=this.lastCanvasMode==="picture",s=e!==this.lastCanvasMode;this.lastCanvasMode=e,this.ufoElement.selectionShown=e==="shape",t&&this.currentReference()&&this.loadPictureRegistration(),this.ufoElement.overlayPainter=t?this.paintPictureOverlay:e==="body"?this.paintBodyOverlay:e==="decor"?this.paintDecorOverlay:void 0,s&&this.ufoElement.repaintOverlay(),t!==i&&this.setCanvasCursor(t?"pan":this.hoverCursor),!t&&(this.armingLandmark||this.pendingLandmark)&&this.disarmLandmark();const n=this.currentReference();n&&this.syncReferenceStatus(n),this.syncStreetSearchAvailability(),this.syncBodiesShown()}skyOf(e){const t=Lt.kinds();if(Mt.computes(e,t))return this.skyPart?.of!==e&&(this.skyPart={of:e,sky:{bodies:[],...Mt.computedPart(e,t)}}),this.skyPart.sky}skyPart;syncBodiesShown(){const t=!(this.isGroupIdOpen("group-shape")&&this.shadow.getElementById("shape-shapes")?.hidden===!1)||this.isReading,i=this.ufoElement.sighting.interpretation,s=t?i:this.skyOf(i);this.sceneElement.compareAccount=t&&s!==void 0&&this.accountCompareInput.checked,this.sceneElement.interpretation!==s&&(this.sceneElement.interpretation=s);const n=t&&s!==void 0?"bodies":"shapes",r=this.accountViewSelect.value!==n;this.accountViewSelect.value=n,r&&this.refreshTimelineMarks(),this.syncSkyParts(),this.shadow.getElementById("account-view-row").hidden=this.isReading,this.shadow.getElementById("account-compare-row").hidden=this.isReading||n!=="bodies"}syncSkyParts(){if(this.isGroupIdOpen("group-weather")){this.showAircraftFlights();for(const e of this.openSkyParts())this.loadSkyPartEditor(e)?.then(t=>t.refresh())}}chooseAccountView(e){const t=this.groupTabs.find(s=>s.getAttribute("aria-controls")==="group-shape");t&&this.toggleGroup(t,!0);const i=this.subgroupTabs.find(s=>s.getAttribute("aria-controls")===(e?"shape-bodies":"shape-shapes"));i&&this.openSubgroup(i)}openSubgroup(e){this.sectionChosen=!0,this.opensMostLacking=!1,this.cloudEditor?.stopManipulation();const t=e.parentElement;for(const s of this.subgroupTabs){if(s.parentElement!==t)continue;const n=s===e;s.setAttribute("aria-expanded",String(n)),this.shadow.getElementById(s.getAttribute("aria-controls")).hidden=!n}e.getAttribute("aria-controls")==="shape-bodies"&&this.loadBodyEditor().then(s=>s.sync());const i=[...this.skyParts.values()].find(s=>s.tab===e);i&&this.loadSkyPartEditor(i)?.then(s=>s.sync()),e.getAttribute("aria-controls")==="weather-aircraft"&&this.showAircraftFlights(),this.syncCanvasMode()}showPhenomenonPartWithContent(){const e=this.ufoElement.sighting,t=e.timeline.sourceIds.length>0,i=(e.interpretation?.bodies?.length??0)>0,n=this.shadow.getElementById("shape-bodies")?.hidden===!1?!i&&t?"shape-shapes":void 0:!t&&i?"shape-bodies":void 0,r=n&&this.subgroupTabs.find(a=>a.getAttribute("aria-controls")===n);if(!r)return;const{sectionChosen:o,opensMostLacking:l}=this;this.openSubgroup(r),this.sectionChosen=o,this.opensMostLacking=l}revealSubgroupOf(e){const t=e.closest(".subgroup-panel"),i=t&&this.subgroupTabs.find(s=>s.getAttribute("aria-controls")===t.id);i&&this.openSubgroup(i)}panelOf(e){return(e.getAttribute("aria-controls")??"").replace(/^group-/,"")}panelIndex(e){return this.groupTabs.findIndex(t=>this.panelOf(t)===e)}refreshParamSummary(){if(!this.paramSummaryBuilder)return;const t=this.paramSummaryBuilder.entriesFor(this.ufoElement.sighting,this.ufoElement.currentTime,{decorId:this.currentDecorId,decorPicker:!0,phenomena:!0,groundElevationM:this.groundElevationM??0,roadGradeDeg:this.sceneElement.roadGradeDeg}).map(n=>({...n,panel:this.summaryPanelIndex(n.group)})),i=t.map(n=>`${n.field}=${n.label}=${n.value}${n.unit}${n.full??""}${n.fromSource?"*":""}`).join("|"),s=JSON.stringify(this.ufoElement.sighting.account??null);if(i===this.paramSummarySignature){s!==this.assessedAccount?(this.assessedAccount=s,this.assessSoon()):this.assessmentsOwed&&this.ufoElement.playbackState!=="playing"&&this.assessSoon();return}this.assessedAccount=s,this.paramSummarySignature=i,this.paramChips=t,this.renderParamSummary(),this.assessSoon()}assessmentsOwed=!1;assessSoon(){if(this.ufoElement.playbackState==="playing"){this.assessmentsOwed=!0;return}this.assessmentsOwed=!1,this.runAssessments()}paramChips=[];renderParamSummary(){this.saveButton&&this.refreshEditorTitle();const e=y.NESTED_GROUPS,t=[];let i;for(const s of[...this.paramChips,...this.assessmentChips]){if(i&&i.group!==s.group&&(i=void 0),e.includes(s.group)&&!i){const r=document.createElement("span");r.className="param-nest",r.dataset.group=s.group;const o=document.createElement("span");o.className="param-nest-label",o.textContent=s.group==="assessment"?this.messages.assessmentGroup:s.group==="summary"?this.messages.summaryGroup:y.tabLabel(this.groupTabs[this.summaryPanelIndex(s.group)]),r.append(o),i={group:s.group,element:r},t.push(r)}const n=this.paramChip(s);i?i.element.append(n):t.push(n)}this.paramSummary.replaceChildren(...t),this.shadow.getElementById("label-param-summary").textContent=this.messages.paramSummaryTitle.replace("{n}",String(t.length)),this.syncDescription()}openDescription;syncDescription(){this.openDescription!==void 0&&!this.paramChips.some(e=>e.full===this.openDescription)&&(this.openDescription=void 0),Ss.sync(this.paramSummary,this.openDescription,this.messages.summaryDescription,this.messages.closeDescription,()=>{this.openDescription=void 0,this.syncDescription()})}static NESTED_GROUPS=["summary","observation","observer","location","temporal","weather","sound","decor","phenomenon","assessment"];summaryPanelIndex(e){return this.panelIndex(e==="phenomenon"?"shape":e)}static QUESTION_FIELDS={when:{panel:"temporal",fields:["obs-time","obs-time-native"]},where:{panel:"location",fields:["lat","lng"]},facing:{panel:"location",fields:["heading"]},"apparent-size":{panel:"shape",fields:[]},"sky-position":{panel:"shape",fields:[]},"how-long":{panel:"temporal",fields:["durationSeconds","obs-end-time","obs-end-time-native"]},appearance:{panel:"shape",fields:["shapeTitle","color"]},movement:{panel:"shape",fields:[]},sound:{panel:"sound",fields:["soundKind"]},conditions:{panel:"weather",fields:["cloudCover"]},"bg-information":{panel:"observer",fields:["accountSource"]},"bg-occupation":{panel:"observer",fields:["observerOccupationKind"]},"bg-relation":{panel:"observer",fields:["observersRelation"]},"bg-activity":{panel:"observer",fields:["observerActivity"]},"bg-age":{panel:"observer",fields:["observerAge"]},"bg-appearance":{panel:"observer",fields:["strangeness-appearance"]},"bg-movement":{panel:"observer",fields:["strangeness-movement"]},"bg-incongruity":{panel:"observer",fields:["strangeness-incongruity"]},"bg-close":{panel:"observer",fields:["strangeness-close"]},"bg-traces":{panel:"observer",fields:["strangeness-traces"]},"poher-traces":{panel:"observer",fields:["strangeness-traces"]},"poher-occupants":{panel:"observer",fields:["strangeness-beings"]}};assessmentChips=[];assessmentToken=0;assessedAccount="";async runAssessments(){const e=++this.assessmentToken,t=await new wn(this.messages).read(this.ufoElement.sighting);e!==this.assessmentToken||!this.isConnected||(this.assessmentChips=t.entries.map(i=>({...i,panel:this.panelIndex(i.about??"")})),this.markUnansweredQuestions(t.unanswered),this.openMostLackingGroup(),this.renderParamSummary())}opensMostLacking=!1;sectionChosen=!1;openMostLackingGroup(){if(!this.opensMostLacking)return;this.opensMostLacking=!1;const e=s=>{const n=s.querySelector(".tab-badge");return n&&!n.hidden?Number(n.textContent):0},t=this.groupTabs.find(s=>this.isGroupOpen(s));let i=t&&e(t)>0?t:void 0;for(const s of this.groupTabs)e(s)>(i?e(i):0)&&(i=s);i&&i!==t&&(this.toggleGroup(i,!0),this.sectionChosen=!1)}fitGroupTabs(){const e=this.groupTabs[0]?.parentElement;e&&(e.classList.add("measuring"),e.classList.remove("compact"),e.classList.toggle("compact",e.scrollWidth>e.clientWidth),e.offsetWidth,e.classList.remove("measuring"))}static titleGroupTab(e){e.title=[e.dataset.intro,e.dataset.unanswered].filter(Boolean).join(`
2683
+ `)}static tabLabel(e){return(e.querySelector("span:not(.tab-badge)")??e).textContent.trim()}static badgeOn(e){const t=e.querySelector(".tab-badge");if(t)return t;const i=document.createElement("span");return i.className="tab-badge",i.hidden=!0,e.append(i),i}unansweredQuestions=new Set;markUnansweredQuestions(e=this.unansweredQuestions){this.unansweredQuestions=e;const t=new Set;for(const n of e){const r=y.QUESTION_FIELDS[n];if(r&&!r.fields.some(o=>this.shadow.getElementById(o)?.classList.contains("missing-required")))for(const o of r.fields){const l=this.shadow.getElementById(o);l&&!l.hidden&&l.value===""&&t.add(o)}}for(const[n,r]of Object.entries(y.QUESTION_FIELDS))for(const o of y.QUESTION_FIELDS[n].fields){const l=this.shadow.getElementById(o);if(!l)continue;const a=t.has(o)&&!l.classList.contains("missing-required");l.classList.toggle("wanted",a),(a||l.title===this.messages.questionUnanswered)&&(l.title=a?this.messages.questionUnanswered:this.fieldHints.get(o)??"")}const i=new Map;let s;for(const[n,r]of Object.entries(y.QUESTION_FIELDS))for(const o of r.fields){const l=this.shadow.getElementById(o);if(!l)continue;const a=l.classList.contains("missing-required");!a&&!l.classList.contains("wanted")||(a&&(s=r.panel),i.set(r.panel,(i.get(r.panel)??0)+1))}for(const n of this.groupTabs){const r=this.panelOf(n),o=i.get(r)??0,l=r===s,a=y.badgeOn(n);a.hidden=o===0,a.textContent=String(o),a.classList.toggle("optional",!l);const d=o===0?void 0:l?this.messages.durationRequired:this.messages.questionsUnanswered.replace("{count}",String(o));d?n.dataset.unanswered=d:delete n.dataset.unanswered,y.titleGroupTab(n)}}paramChip(e){const t=document.createElement("button");t.type="button",t.className=e.fromSource?"param-chip from-source":"param-chip",t.dataset.panel=String(e.panel),t.dataset.field=e.field,e.detail&&(t.title=e.detail);const i=document.createElement("span");if(i.className="param-chip-label",i.textContent=`${e.label} `,t.append(i),e.color!==void 0){const n=document.createElement("span");n.className="param-chip-swatch",n.style.background=e.color,t.append(n)}const s=document.createElement("span");return s.className="param-chip-value",s.textContent=e.unit===""?e.value:`${e.value} ${e.unit}`,t.append(s),t}onParamSummaryClick(e){const t=e.target.closest(".param-chip");if(t==null)return;if(t.dataset.field==="description"){this.openDescription=this.paramChips.find(o=>o.field==="description")?.full,this.syncDescription();return}const i=Number(t.dataset.panel);if(i<0)return;const s=this.groupPanels[i];this.toggleGroup(this.groupTabs[i],!0);const n=t.dataset.field;if(n.startsWith("shape:")){this.selectedSourceIds=new Set([n.slice(6)]),this.revealShapePanel(),this.ufoElement.refresh();return}if(n.startsWith("body:")){const o=this.subgroupTabs.find(l=>l.getAttribute("aria-controls")==="shape-bodies");o&&this.openSubgroup(o),this.loadBodyEditor().then(l=>l.show(n.slice(5)));return}if(n.startsWith("decor:")){this.currentDecorId=n.slice(6),this.refreshDecorList(),this.decorList.focus();return}const r=this.shadow.getElementById(n);r===null||!s.contains(r)||(this.revealSubgroupOf(r),this.sectionFolds.reveal(r),r.focus(),r instanceof HTMLInputElement&&r.type!=="checkbox"&&r.type!=="color"&&r.type!=="range"&&r.select(),r.scrollIntoView?.({block:"center"}))}onSelectionOrTimeChanged(){this.showAircraftFlights(),this.shadow.getElementById("shape-bodies")?.hidden===!1&&this.bodyEditor?.syncKeyframe();for(const i of this.openSkyParts())i.editor?.setTime?.(this.ufoElement.currentTime);for(const i of[this.eventsPanel,this.phenomenonEventsPanel,this.bodiesEventsPanel])i?.setTime(this.ufoElement.currentTime);this.syncAppearanceFromTimeline(),this.syncObserverFromTimeline(),this.syncWeatherFromTimeline(),this.syncWeatherSourceState(),this.syncSoundFromTimeline(),this.syncDecorBaseFromTimeline(),this.syncIndoorLookReset(),this.updateAppearanceFieldsDisabledState(),this.updateShapeTitleValidity(),this.refreshRealSize(),this.refreshBlurDistanceBound(),this.refreshSkyCandidates(),this.refreshInstrumentOptions(),this.refreshFilterOptions(),this.syncOpticsFromInstrument(),this.samplingRateInput!==this.shadow.activeElement&&(this.samplingRateInput.value=this.ufoElement.sighting.sampleMs===void 0?"":String(this.ufoElement.sighting.sampleMs)),this.ufoElement.selectedSourceIds=this.selectedSourceIds;const t=this.ufoElement.sighting.timeline.sourceIds.filter(i=>this.selectedSourceIds.has(i)).length;this.deleteShapeButton.disabled=this.isRecording||this.ufoElement.playbackState==="playing"||t===0,this.refreshParamSummary()}updateShapeToolbarVisibility(){const e=this.ufoElement.sighting.timeline.sourceIds.length===0,t=this.shadow.getElementById("shape-row");t&&ge.showPresence(t,this.shadow.getElementById("shape-item")??void 0,!e)}updateAppearanceFieldsDisabledState(){this.updateShapeToolbarVisibility();const e=this.selectedSourceIds.size>1,t=e?this.messages.multipleShapesSelected:"";for(const i of[this.shapeTitleInput,this.colorInput,this.transparencyInput,this.haloScaleInput,this.blurInput,this.brightnessInput,this.apparentWidthInput,this.realWidthInput,this.objectDistanceInput,this.sizeLockSelect,this.clearDistanceHypothesisButton,this.shapeRotationInput])i.disabled=e,i.title=e?t:this.fieldHints.get(i.id)??""}syncAppearanceFromTimeline(){if(this.ufoElement.playbackState==="playing"||this.selectedSourceIds.size>1)return;const e=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,this.currentSourceId);e&&(this.currentAppearance={presetId:no(e),color:e.color,transparency:e.transparency,haloScale:e.haloScale,blur:e.blur??0,brightness:e.brightness??0},this.colorInput.value=this.currentAppearance.color,this.transparencyInput.value=String(this.currentAppearance.transparency),this.haloScaleInput.value=String(this.currentAppearance.haloScale),this.blurInput.value=String(this.currentAppearance.blur),this.brightnessInput.value=String(this.currentAppearance.brightness),this.shadow.activeElement!==this.shapeTitleInput&&(this.shapeTitleInput.value=this.said.read(e.title)??""),this.shadow.activeElement!==this.shapeRotationInput&&(this.shapeRotationInput.value=String(y.rotationDeg(e.angle))),this.refreshApparentSize())}static rotationDeg(e){const t=(e*180/Math.PI%360+540)%360-180;return Math.round((t===-180?180:t)*10)/10}updateShapeRotation(){const e=this.numberOrUndefined(this.shapeRotationInput.value);if(e===void 0)return;const t=this.ufoElement.sighting.timeline,i=this.ufoElement.currentTime,s=t.getInterpolatedShapeAt(i,this.currentSourceId);s&&(this.commitShapes(i,[{sourceId:this.currentSourceId,shape:{...s,angle:e*Math.PI/180}}]),this.ufoElement.refresh())}updateShapeTitle(){const e=this.ufoElement.sighting.timeline,t=this.ufoElement.currentTime,i=e.getInterpolatedShapeAt(t,this.currentSourceId);i&&(this.commitShapes(t,[{sourceId:this.currentSourceId,shape:{...i,title:this.said.write(i.title,this.shapeTitleInput.value,this.writingLanguage)}}]),this.ufoElement.refresh(),this.refreshSourceList(),this.updateShapeTitleValidity())}sizeLock="none";onApparentWidthInput(){const e=this.numberOrUndefined(this.apparentWidthInput.value);if(!(e===void 0||e<=0||this.selectedSourceIds.size!==1)){if(this.sizeLock==="real"){const t=this.numberOrUndefined(this.realWidthInput.value);t!==void 0&&t>0&&this.sceneElement.setDistanceHypothesis(this.currentSourceId,me.distanceMAt(t,e))}this.applyApparentWidth(e)}}onRealWidthInput(){const e=this.numberOrUndefined(this.realWidthInput.value);if(e===void 0||e<=0||this.selectedSourceIds.size!==1)return;if(this.sizeLock==="apparent"){const i=this.currentApparentWidthDeg();i!==void 0&&i>0&&(this.sceneElement.setDistanceHypothesis(this.currentSourceId,me.distanceMAt(e,i)),this.refreshDepth());return}const t=this.currentDistanceM();t!==void 0&&t>0&&this.applyApparentWidth(me.angularWidthDeg({sizeM:e,distanceM:t}))}onDistanceInput(){const e=this.numberOrUndefined(this.objectDistanceInput.value);e===void 0||e<=0||this.applyDistance(e)}applyDistance(e){if(this.selectedSourceIds.size===1){if(this.sizeLock!=="apparent"){const t=this.numberOrUndefined(this.realWidthInput.value);t!==void 0&&t>0&&this.applyApparentWidth(me.angularWidthDeg({sizeM:t,distanceM:e}))}this.sceneElement.setDistanceHypothesis(this.currentSourceId,e),this.refreshDepth()}}applySizeLock(){this.sizeLock=this.sizeLockSelect.value,this.apparentWidthInput.readOnly=this.sizeLock==="apparent",this.realWidthInput.readOnly=this.sizeLock==="real",this.objectDistanceInput.readOnly=this.sizeLock==="distance"}currentApparentWidthDeg(){const e=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,this.currentSourceId);if(e)return e.angular?.widthDeg??this.currentProjection().pxToDeg(e.bounds.width)}currentDistanceM(){return this.sceneElement.depthOf(this.currentSourceId)?.distanceM}applyApparentWidth(e){const t=this.ufoElement.sighting.timeline,i=this.ufoElement.currentTime,s=t.getInterpolatedShapeAt(i,this.currentSourceId);if(!s)return;const n=this.currentProjection(),r=n.degToPx(e),o=s.bounds.height*(s.bounds.width===0?1:r/s.bounds.width),l={x:s.bounds.x+(s.bounds.width-r)/2,y:s.bounds.y+(s.bounds.height-o)/2,width:r,height:o},a=n.ofBounds(l),d=s.kind==="oval"?{...s,bounds:l,angular:a}:{...s,bounds:l,angular:a,points:this.scalePoints(s,l)};this.commitShapes(i,[{sourceId:this.currentSourceId,shape:d}]),this.ufoElement.refresh(),this.refreshApparentSize()}scalePoints(e,t){const i=e.bounds.width===0?1:t.width/e.bounds.width,s=e.bounds.height===0?1:t.height/e.bounds.height;return e.points.map(n=>({x:n.x*i,y:n.y*s}))}refreshFilterOptions(){const e={[ae.NONE.id]:this.messages.filterNone,[ae.SOLAR_VISUAL.id]:this.messages.filterSolarVisual,[ae.SOLAR_PHOTO.id]:this.messages.filterSolarPhoto},t=n=>e[n.id]??n.name,i=[...this.filterSelect.options].map(n=>n.textContent);if(i.length!==ae.ALL.length||ae.ALL.some((n,r)=>i[r]!==t(n))){const n=this.filterSelect.value||ae.NONE.id;this.filterSelect.replaceChildren();for(const r of ae.ALL){const o=document.createElement("option");o.value=r.id,o.textContent=t(r),this.filterSelect.appendChild(o)}this.filterSelect.value=n}const s=this.ufoElement?.sighting?.instrument;for(const n of this.filterSelect.options){const r=!s||ae.usableWith(ae.byId(n.value),s);n.disabled=!r,n.title=r?"":this.messages.filterNotForInstrument}}refreshInstrumentOptions(){const e=this.ufoElement.sighting,t=e.event.time?.year,i=e.instrument,s={eye:this.messages.instrumentCategoryEye,camera:this.messages.instrumentCategoryCamera,dslr:this.messages.instrumentCategoryDslr,phone:this.messages.instrumentCategoryPhone,video:this.messages.instrumentCategoryVideo,binoculars:this.messages.instrumentCategoryBinoculars,telescope:this.messages.instrumentCategoryTelescope},n=r=>{const o=this.naming.instrument(r),l=we.unavailability(r,t);if(!l)return{id:r.id,label:o};const a=(l.kind==="before"?this.messages.instrumentNotYetOnSale:this.messages.instrumentNoLongerOnSale).replace("{year}",String(t)).replace("{from}",String(l.from)).replace("{to}",String(l.to));return r.id===i.id?{id:r.id,label:this.messages.instrumentOutOfPeriod.replace("{name}",o),hint:a}:{id:r.id,label:o,disabledReason:a}};this.instrumentSelect.choices=we.CATEGORIES.map(r=>({label:s[r],children:Nn.filter(o=>o.category===r).map(n)})).filter(r=>r.children.length>0),this.instrumentSelect.value=this.instrumentSelect.value||i.id}static exposureText(e){return e>=1?String(Math.round(e*100)/100):`1/${Math.round(1/e)}`}statedExposureSeconds(e){const t=y.exposureSeconds(this.exposureInput.value),i=e.exposureRangeSeconds;if(!i)return e.exposureSeconds??t;if(t!==void 0)return Math.min(i.max,Math.max(i.min,t))}static exposureSeconds(e){const t=e.trim();if(!t)return;const i=/^(\d*\.?\d+)\s*\/\s*(\d*\.?\d+)$/.exec(t);if(i){const n=Number(i[1]),r=Number(i[2]);return r>0?n/r:void 0}const s=Number(t);return Number.isFinite(s)&&s>0?s:void 0}syncOpticsFromInstrument(){const e=this.ufoElement.sighting,t=e.instrument,i=X(e,this.ufoElement.currentTime),s=t.frame,n=i?.fovDeg??we.fieldOfViewDeg(t),r=s?we.focalLengthMmFor(t,n):n;this.focalLengthInput!==this.shadow.activeElement&&(this.focalLengthInput.value=r===void 0?"":String(Math.round(r*10)/10)),this.unitFocalLength.textContent=s?this.messages.unitMillimetres:this.messages.unitDegrees,this.labelFocalLength.textContent=s?this.messages.focalLength:this.messages.fieldOfView,this.focalLengthInput.disabled=s!==void 0&&s.focalRangeMm===void 0,this.focalLengthInput.min=String(s?s.focalRangeMm?.minMm??1:1),this.focalLengthInput.max=String(s?s.focalRangeMm?.maxMm??2e3:179),Rt.fit(this.focalLengthInput.parentElement??this.shadow),this.focalFovOutput.textContent=s&&n!==void 0?this.messages.fieldOfViewReadout.replace("{deg}",this.plain(n,n<10?1:0)):"";const o=i?.fNumber??t.fNumber;this.fNumberInput!==this.shadow.activeElement&&(this.fNumberInput.value=o===void 0?"":String(o)),this.setRowVisible(this.fNumberInput,t.fNumber!==void 0),this.fNumberInput.disabled=t.fNumberRange===void 0,this.fNumberInput.min=String(t.fNumberRange?.min??.7),this.fNumberInput.max=String(t.fNumberRange?.max??64);const l=e.exposure;this.exposureInput!==this.shadow.activeElement&&(this.exposureInput.value=l===void 0?"":y.exposureText(l)),this.setRowVisible(this.exposureInput,t.exposureSeconds!==void 0);for(const h of[this.lensGlassSelect,this.lensDropsInput,this.lensCondensationInput,this.lensDirtInput,this.lensShelteredInput])this.setRowVisible(h,yn.records(t));this.exposureInput.disabled=t.exposureRangeSeconds===void 0;const a=t.medium;this.isoInput!==this.shadow.activeElement&&(this.isoInput.value=e.iso===void 0?"":String(e.iso)),this.syncFilmStocks(e,t);const d=ft.byId(e.film);this.isoInput.placeholder=a?a.autoExposure?"auto":String(d?.iso??a.iso):"",this.setRowVisible(this.isoInput,a!==void 0),this.meteringSelect.value=e.metering??"",this.setRowVisible(this.meteringSelect,a?.autoExposure===!0),this.meteringSelect.disabled=e.iso!==void 0,this.focusDistanceInput!==this.shadow.activeElement&&(this.focusDistanceInput.value=i?.focusDistanceM===void 0?"":String(i.focusDistanceM)),this.setRowVisible(this.focusDistanceInput,s!==void 0&&t.fNumber!==void 0),this.filterSelect!==this.shadow.activeElement&&(this.filterSelect.value=ae.byId(i?.filter).id),this.ufoElement.playbackState!=="playing"&&this.sectionFolds?.refresh()}retuneFieldOfView(e){const t=this.ufoElement.sighting,i=we.fieldOfViewDeg(e),s=we.fieldOfViewDeg(t.instrument);for(const n of[...t.observerTrack.allKeyframes])Math.abs(n.pose.fovDeg-i)>Jr||t.observerTrack.addKeyframe(n.t,{...n.pose,fovDeg:s})}retuneExposure(e){const t=this.ufoElement.sighting,i=t.exposureSeconds,s=t.instrument.exposureRangeSeconds;if(i===void 0||i===e.exposureSeconds||!s){t.exposureSeconds=void 0;return}t.exposureSeconds=Math.min(s.max,Math.max(s.min,i))}currentFovDeg(){const e=this.ufoElement.sighting;return X(e,this.ufoElement.currentTime)?.fovDeg??we.fieldOfViewDeg(e.instrument)}currentProjection(){return Yt.of(this.ufoElement.sighting.instrument,this.ufoElement.canvasElement.height,this.currentFovDeg())}refreshApparentSize(){const e=this.selectedSourceIds.size===1?this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,this.currentSourceId):void 0;if(!e){this.apparentSizeOutput.textContent="",this.hasFocus(this.apparentWidthInput)||(this.apparentWidthInput.value=""),this.refreshRealSize();return}const t=e.angular?.widthDeg??this.currentProjection().pxToDeg(e.bounds.width),i=me.inMoons(t);this.hasFocus(this.apparentWidthInput)||(this.apparentWidthInput.value=this.plain(t,t<1?2:1)),this.apparentSizeOutput.textContent=this.messages.apparentSize.replace("{moons}",i.toLocaleString(void 0,{maximumFractionDigits:i<10?1:0})),this.refreshRealSize()}hasFocus(e){return this.typingIn===e}typingIn;typing(e,t){this.typingIn=e;try{t()}finally{this.typingIn=void 0}}plain(e,t){return String(Number(e.toFixed(t)))}refreshBlurDistanceBound(){const e=this.currentAppearance.blur;if(e<=0||this.selectedSourceIds.size!==1){this.blurBoundOutput.textContent="";return}const t=this.ufoElement.sighting.instrument,i=t.frame;if(!i){this.blurBoundOutput.textContent=this.messages.blurBoundNoInstrument;return}const s=X(this.ufoElement.sighting,this.ufoElement.currentTime),n=s?.focusDistanceM;if(n!==void 0){this.blurBoundOutput.textContent=this.messages.blurBoundNotAtInfinity.replace("{focus}",this.meters(n));return}const r=(s?we.focalLengthMmFor(t,s.fovDeg):void 0)??i.focalLengthMm,o=s?.fNumber??t.fNumber;if(o===void 0||r<=0){this.blurBoundOutput.textContent="";return}const l=this.ufoElement.canvasElement.height;if(l<=0)return;const a=2*En*e/l*i.heightMm,d=r*r/(o*a)/1e3;this.blurBoundOutput.textContent=this.messages.blurBound.replace("{max}",this.meters(d))}refreshRealSize(){if(this.refreshDepth(),this.selectedSourceIds.size!==1){this.realSizeOutput.textContent="";return}const e=this.currentSourceId;if(this.sceneElement.sizeContradictory(e)){this.realSizeOutput.textContent=this.messages.realSizeContradiction;return}const{minM:t,maxM:i}=this.sceneElement.sizeRangeOf(e);if(t===void 0&&i===void 0){this.realSizeOutput.textContent=this.messages.realSizeUnknown;return}const s=this.numberOrUndefined(this.realWidthInput.value),n=s!==void 0&&(t!==void 0&&s<t||i!==void 0&&s>i)?this.messages.realSizeOutside:"";if(t!==void 0&&i!==void 0){const r=this.sceneElement.distanceRangeAt(e,this.ufoElement.currentTime),o=r.minM===void 0||r.maxM===void 0?"":this.messages.realDistanceHere.replace("{min}",this.meters(r.minM)).replace("{max}",this.meters(r.maxM));this.realSizeOutput.textContent=this.messages.realSizeBetween.replace("{min}",this.meters(t)).replace("{max}",this.meters(i))+o+n;return}this.realSizeOutput.textContent=(t!==void 0?this.messages.realSizeAtLeast.replace("{min}",this.meters(t)):this.messages.realSizeAtMost.replace("{max}",this.meters(i)))+n}decimal(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}clearDistanceHypothesis(){this.selectedSourceIds.size===1&&(this.sceneElement.setDistanceHypothesis(this.currentSourceId,void 0),this.refreshDepth())}newBodyStart(){const e=this.currentSourceId,t=this.ufoElement.currentTime,i=e===void 0?void 0:this.ufoElement.sighting.timeline.getInterpolatedShapeAt(t,e),s=(m,f)=>Number(m.toFixed(f)),n=i?.aim??{azimuthDeg:Number(this.headingInput.value)||0,altitudeDeg:Number(this.pitchInput.value)||0},r=(i?this.sceneElement.depthOf(e)?.distanceM:void 0)??Gr,o=this.sceneElement.groundAlong(n.azimuthDeg,n.altitudeDeg,t),l=o!==void 0&&o<r,a=s(r,1),d=i?.angular?.widthDeg,h=i?.angular?.heightDeg,c=d!==void 0&&h!==void 0&&d>0&&h>0?{widthM:s(me.sizeMAt(a,d),2),lengthM:s(me.sizeMAt(a,d),2),heightM:s(me.sizeMAt(a,h),2)}:void 0,u={azimuthDeg:s(n.azimuthDeg,2),altitudeDeg:s(n.altitudeDeg,2)},p={t,...u,distanceM:a,...l?{onGround:!0}:{},...c?{sizeM:c}:{}};return i?{sourceId:e,label:this.shapeLabel(e),keyframe:p}:{keyframe:p}}loadBodyEditor(){return this.bodyEditorLoading??=M(async()=>{const{BodyEditor:e}=await import("./BodyEditor-CRlKW7yl.js");return{BodyEditor:e}},__vite__mapDeps([31,3,1,4,5,6,7,8,9,18,20]),import.meta.url).then(({BodyEditor:e})=>(this.bodyEditor=new e(this.shadow.getElementById("body-editor"),{sighting:()=>this.ufoElement.sighting,bodySelected:()=>this.bodiesEventsPanel.render(),said:()=>this.said,writingLanguage:()=>this.writingLanguage,positionPlace:()=>this.framePlace(),modelProvider:()=>this.decorModelProvider,modelPicker:()=>this.modelPicker,shapes:()=>this.bodyShapeIds().map(t=>({id:t,label:this.shapeLabel(t)})),changed:()=>{this.ufoElement.refresh(),this.refreshParamSummary(),this.syncBodiesShown()},newBodyStart:()=>this.newBodyStart(),lookAt:t=>this.lookAtBody(t),currentTime:()=>this.ufoElement.currentTime,seekTo:t=>{this.ufoElement.currentTime=t},duration:()=>this.ufoElement.seekableDuration,readingOf:(t,i)=>this.sceneElement.bodyReading(t,i),groundAlong:(t,i,s)=>this.sceneElement.groundAlong(t,i,s)},this.language),this.bodyEditor)),this.bodyEditorLoading}openSkyParts(){return[...this.skyParts.values()].filter(e=>!e.panel.hidden)}wantedSkyParts(){const e=Lt.kinds().filter(i=>i.editor).map(i=>({key:`interpretation:${i.key}`,id:`interpretation-${i.key}`,category:"interpretation",kind:i,titles:i.messages,create:()=>i.editor().then(s=>n=>s(n,{sighting:()=>this.ufoElement.sighting,said:()=>this.said,writingLanguage:()=>this.writingLanguage,positionPlace:()=>this.framePlace(),shapes:()=>this.bodyShapeIds().map(r=>({id:r,label:this.shapeLabel(r)})),currentTime:()=>this.ufoElement.currentTime,duration:()=>this.ufoElement.seekableDuration,seekTo:r=>this.goToMark(r),changed:()=>{this.ufoElement.refresh(),this.refreshParamSummary(),this.syncBodiesShown()}},this.language))})),t=xs.map(i=>Dt.of(i)).filter(i=>i.editor).map(i=>({key:`skyEvent:${i.key}`,id:`sky-event-${i.key}`,category:"skyEvent",kind:i,titles:i.messages,create:()=>i.editor().then(s=>n=>s(n,{sighting:()=>this.ufoElement.sighting,said:()=>this.said,writingLanguage:()=>this.writingLanguage,positionPlace:()=>this.framePlace(),currentTime:()=>this.ufoElement.currentTime,duration:()=>this.ufoElement.seekableDuration,seekTo:r=>this.goToMark(r),pointAt:(r,o)=>{this.headingInput.value=String(this.rounded(r)),this.pitchInput.value=String(this.rounded(o)),this.updateObserver()},changed:()=>{this.ufoElement.refresh(),this.refreshParamSummary(),this.sceneElement.redrawSky()}},this.language))}));return[...e,...t]}buildSkyParts(){const e=this.shadow.getElementById("weather-tabs"),t=this.shadow.getElementById("sky-event-parts");if(!e||!t)return;const i=this.wantedSkyParts();for(const[s,n]of this.skyParts)if(!i.some(r=>r.key===s&&r.kind===n.kind)){if(n.tab.getAttribute("aria-expanded")==="true"){const r=this.subgroupTabs.find(o=>o.parentElement===e&&o!==n.tab);r&&this.openSubgroup(r)}n.tab.remove(),n.panel.remove(),this.subgroupTabs.splice(this.subgroupTabs.indexOf(n.tab),1),this.skyParts.delete(s)}for(const s of i){if(this.skyParts.has(s.key))continue;const n=document.createElement("button");n.className="subgroup-tab",n.type="button",n.setAttribute("aria-controls",s.id),n.setAttribute("aria-expanded","false");const r=document.createElement("span");r.id=`label-${s.id}`,this.nameSkyPart(r,s.titles),n.append(r),n.addEventListener("click",()=>this.openSubgroup(n)),e.append(n),this.subgroupTabs.push(n);const o=document.createElement("section");o.className="subgroup-panel",o.id=s.id,o.hidden=!0,o.setAttribute("aria-labelledby",r.id);const l=document.createElement("div");l.className="toolbar";const a=document.createElement("div");a.id=`${s.id}-editor`,l.append(a),o.append(l),t.before(o),this.skyParts.set(s.key,{...s,tab:n,label:r,panel:o})}for(const s of i){const n=this.skyParts.get(s.key);e.append(n.tab),t.before(n.panel)}}applyPerceptionLabels(){const e=this.decidedLanguage;if(e===void 0)return;const t=[...new Set(mt.ALL.map(i=>i.messages))];Promise.all(t.map(i=>i.load(e))).then(i=>{this.decidedLanguage===e&&(this.perceptionSettings.labels=Object.assign({},...i))},()=>{})}nameSkyPart(e,t){const i=this.decidedLanguage;i!==void 0&&t.load(i).then(s=>{this.decidedLanguage===i&&(e.textContent=s.title)},()=>{})}loadSkyPartEditor(e){return e.loading??=e.create().then(t=>(e.editor=t(e.panel.querySelector(`#${e.id}-editor`)),e.editor)),e.loading}lookAtBody(e){const t=this.sceneElement.directionToBody(e,this.ufoElement.currentTime);t&&(this.headingInput.value=String(Math.round(t.azimuthDeg*10)/10),this.pitchInput.value=String(Math.round(t.altitudeDeg*10)/10),this.updateObserver())}refreshDepth(){const e=this.selectedSourceIds.size===1?this.sceneElement.depthOf(this.currentSourceId):void 0;if(!e){this.depthBasisOutput.textContent="",this.hasFocus(this.objectDistanceInput)||(this.objectDistanceInput.value=""),this.hasFocus(this.realWidthInput)||(this.realWidthInput.value="");return}const t=this.meters(e.distanceM);this.hasFocus(this.objectDistanceInput)||(this.objectDistanceInput.value=this.plain(e.distanceM,e.distanceM<10?1:0));const i=this.currentApparentWidthDeg();if(!this.hasFocus(this.realWidthInput)){const n=i===void 0||i<=0?void 0:me.sizeMAt(e.distanceM,i);this.realWidthInput.value=n===void 0?"":this.plain(n,n<1?2:n<10?1:0)}this.clearDistanceHypothesisButton.hidden=e.basis!=="hypothesis";const s={stated:this.messages.depthStated,hypothesis:this.messages.depthHypothesis,derived:this.messages.depthDerived,bounded:this.messages.depthBounded,conventional:this.messages.depthConventional}[e.basis];this.depthBasisOutput.textContent=s.replace("{m}",t)}commitShapes(e,t){const i=this.ufoElement.sighting,s=Yt.of(i.instrument,me.CANVAS_HEIGHT_PX,Ce.fovOf(i,e)),n=this.ufoElement.seekableDuration;n>i.timeline.duration&&i.timeline.setSpan(n),i.timeline.addKeyframe(e,t.map(r=>{const o=Ce.aimOf(i,e,r.shape.bounds),l=s.ofBounds(r.shape.bounds),{aim:a,...d}=r.shape;return{...r,shape:o?{...d,aim:o,angular:l}:{...d,angular:l}}}))}meters(e){const t=e<1?2:e<10?1:0;return e.toLocaleString(void 0,{maximumFractionDigits:t})}updateShapeTitleValidity(){const e=this.selectedSourceIds.size===1&&this.ufoElement.sighting.timeline.sourceIds.length>0&&this.shapeTitleInput.value==="";this.shapeTitleInput.classList.toggle("invalid",e),this.shapeTitleInput.setAttribute("aria-invalid",String(e))}shapeLabel(e){const t=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,e),i=this.said.read(t?.title);if(i)return i;const s=/^ufo-(\d+)$/.exec(e);return s?`${this.messages.shape} ${s[1]}`:e}addShape(){if(this.isRecording)return;const e=this.ufoElement.sighting.timeline;this.currentSourceId=this.newSourceIds(1)[0],this.selectedSourceIds=new Set([this.currentSourceId]),this.applyAppearanceAtPlayhead(this.offsetDefaultBounds(e.sourceIds.length)),this.shapeTitleInput.value=this.shapeLabel(this.currentSourceId),this.updateShapeTitle()}newSourceIds(e){const t=this.ufoElement.sighting.timeline,i=[];t.sourceIds.length===0&&this.currentSourceId!==void 0&&i.push(this.currentSourceId);const s=new Set([...t.sourceIds,this.currentSourceId]);let n=s.size+1;for(;i.length<e;){for(;s.has(`ufo-${n}`);)n++;i.push(`ufo-${n}`),s.add(`ufo-${n}`)}return i}shapeAddKinds(){const e=this.messages,t={triangle:e.modelTriangle,saucer:e.modelSaucer,cigar:e.modelCigar,chevron:e.modelChevron,light:e.modelLight};return[{value:"oval",label:e.oval},{value:"polygon",label:e.polygon},...Te.ALL.map(i=>({value:i.id,label:t[i.id]}))]}addModel(e){if(this.isRecording||this.ufoElement.playbackState==="playing")return;const t=this.ufoElement.sighting.timeline,i=e.boundsAt(this.offsetDefaultBounds(t.sourceIds.length)),s=e.shapesIn(i,this.currentAppearance),n=this.newSourceIds(s.length),r=this.shapeAddKinds().find(d=>d.value===e.id).label,o=/^ufo-(\d+)$/.exec(n[0])?.[1]??"",l={disc:this.messages.modelPartDisc,dome:this.messages.modelPartDome},a=s.map((d,h)=>{const c=e.partNames[h],u=c?`${r} ${o}, ${l[c]}`:`${r} ${o}`;return{sourceId:n[h],shape:{...d,title:this.said.write(void 0,u,this.writingLanguage)}}});this.commitShapes(this.ufoElement.currentTime,a),n.length>1&&t.group(n),this.currentSourceId=n[n.length-1],this.selectedSourceIds=new Set(n),this.refreshSourceList(),this.ufoElement.refresh()}duplicateSelected(){if(this.hideContextMenu(),this.isRecording||this.ufoElement.playbackState==="playing")return;const e=this.ufoElement.sighting.timeline,t=e.sourceIds.filter(r=>this.selectedSourceIds.has(r));if(t.length===0)return;const i=this.newSourceIds(t.length),s=24;for(const r of e.allKeyframes){const o=r.shapes.filter(l=>t.includes(l.sourceId)).map(l=>{const{bounds:a}=l.shape;return{sourceId:i[t.indexOf(l.sourceId)],shape:{...l.shape,bounds:{...a,x:a.x+s,y:a.y+s}}}});o.length>0&&this.commitShapes(r.t,o)}const n=e.groupMembers(t[0]);t.length>1&&n?.length===t.length&&t.every(r=>n.includes(r))&&e.group(i),this.currentSourceId=i[i.length-1],this.selectedSourceIds=new Set(i),this.refreshSourceList(),this.ufoElement.refresh()}deleteShape(){if(this.isRecording||this.ufoElement.playbackState==="playing")return;const t=this.ufoElement.sighting.timeline.sourceIds.filter(i=>this.selectedSourceIds.has(i));t.length!==0&&this.removeShapes(t)}removeShapes(e){const t=this.ufoElement.sighting.timeline;for(const i of e)t.removeSource(i);this.currentSourceId=t.sourceIds[0]??it,this.selectedSourceIds=new Set([this.currentSourceId]),this.refreshSourceList(),this.ufoElement.refresh()}offsetDefaultBounds(e){const t=this.defaultBounds(),i=24;return{...t,x:t.x+e*i,y:t.y+e*i}}refreshSourceList(){const e=this.ufoElement.sighting.timeline,t=e.sourceIds.length>0?[...new Set([...e.sourceIds,this.currentSourceId])]:[];this.sourceSelect.innerHTML="";for(const i of t){const s=document.createElement("option");s.value=i,s.textContent=this.shapeLabel(i),this.sourceSelect.appendChild(s)}this.sourceSelect.value=this.currentSourceId}decorLabel(e){const t=this.said.read(e.title);if(t)return t;const s=this.ufoElement.sighting.decor.filter(r=>r.kind===e.kind).indexOf(e)+1;return`${this.decorList.kindLabel(e.kind)} ${s}`}addOwnAircraft(){this.addDecor("aircraft"),this.revealDecorPanel()}addDecor(e=this.decorList.pickedKind??"building"){this.observerAdded=e==="observer";const t=this.ufoElement.sighting,s={id:`decor-${t.decor.length+1}`,kind:e,title:this.nextDecorLabel(e),eastM:8*t.decor.length,northM:15,headingDeg:0,lit:!1,...e==="aircraft"?this.defaultAircraft():{},...e==="trafficlight"?{lights:zi.byId("traffic-signal")?.create()}:{},...e==="roadsign"?{sign:{face:"stop"}}:{},...e==="building"?{floors:Ds}:{},windows:As(e)};t.decor=[...t.decor,s],this.currentDecorId=s.id,this.refreshDecorList(),this.ufoElement.refresh(),e!=="building"&&this.adoptDefaultModel(s.id,e)}readSceneryChoice(){try{return localStorage.getItem(y.SCENERY_STORAGE)??void 0}catch{return}}readSceneryRadius(){try{const e=Number(localStorage.getItem(y.SCENERY_RADIUS_STORAGE));if(Number.isFinite(e)&&e>=20&&e<=3e3)return String(e)}catch{}return"100"}writeSceneryRadius(e){try{localStorage.setItem(y.SCENERY_RADIUS_STORAGE,e)}catch{}}writeSceneryChoice(e){try{localStorage.setItem(y.SCENERY_STORAGE,e)}catch{}}async fillScenerySources(){const e=await M(()=>import("./surroundingsSources-kPwp7ewe.js"),__vite__mapDeps([15,1,3,4,5,6,7,8,9]),import.meta.url).catch(()=>{});if(!e)return;const{SURROUNDINGS_SOURCES:t,SurroundingsSources:i}=e;if(!this.isConnected)return;const s=document.createElement("option");s.value=y.NO_SCENERY,s.id="option-scenery-none",s.textContent=this.messages.surveySourceNone;const n=t.map(o=>{const l=document.createElement("option");return l.value=o.id,l.textContent=o.name,l.title=o.credit,l}),r=new Option(this.messages.sourceFile,y.FILE_SOURCE);r.id="option-scenery-file",this.scenerySource.replaceChildren(s,...n,r),this.surveyIds=t.map(o=>o.id),this.defaultSurveyId=i.DEFAULT_ID,this.syncSceneryPicker()}surveyIds;defaultSurveyId;sceneryAsked(){return this.sceneryChoice!==y.NO_SCENERY&&!this.sectionFromFile("decor")}syncSceneryPicker(){const e=this.sectionFromFile("decor");this.surveyIds&&(this.scenerySource.value=e?y.FILE_SOURCE:this.sceneryChoice===y.NO_SCENERY?y.NO_SCENERY:this.surveyIds.includes(this.sceneryChoice??"")?this.sceneryChoice:this.defaultSurveyId??this.surveyIds[0]),this.surroundings.setEnabled(this.sceneryAsked()),this.shadow.getElementById("scenery-radius-row").hidden=e||this.sceneryChoice===y.NO_SCENERY;const t=this.shadow.getElementById("scenery-file-link");t.hidden=!e,e&&(t.textContent=this.sectionFilePanel.itemLabel("decor"),t.title=this.sectionFilePanel.where("decor"))}setDecorFromFile(e){const t=this.ufoElement.sighting;if(this.sectionFromFile("decor")===e)return;const i={...t.snapshots??{}};e?i.decor=i.decor??{}:delete i.decor,t.snapshots=J.isEmpty(i)?void 0:i,this.touch(),this.scheduleFileSync(),this.refreshFileItems()}plantingCentre(){const e=this.ufoElement.sighting,t=e.observerTrack.getInterpolatedPoseAt(0),i=e.event.place?.[0],s=t?.lat??i?.lat,n=t?.lng??i?.lng;return typeof s=="number"&&typeof n=="number"?{lat:s,lng:n}:void 0}setPlantedDecor(e){this.ufoElement.sighting.decor=e,e.some(t=>t.id===this.currentDecorId)||(this.currentDecorId=e[0]?.id),this.refreshDecorList(),this.ufoElement.refresh(),this.scheduleHistoryRecord()}refreshSceneryWarning(){const e=this.ufoElement?.sighting,t=e?Ft.anachronism(e.decor,e.event.time):void 0;this.sceneryWarning.hidden=t===void 0,this.sceneryWarning.textContent=t?this.messages.surveyWarning.replace("{survey}",t.survey).replace("{observation}",t.observation):""}citeSource(e){const t=this.ufoElement.sighting;(t.sources??[]).some(i=>i.url===e.url)||(t.sources=[...t.sources??[],e])}async adoptDefaultModel(e,t){const i=(await this.decorModelProvider.entries(t).catch(()=>[]))[0];if(!i)return;const s=this.ufoElement.sighting.decor.find(n=>n.id===e);!s||s.model||s.sizeM||(this.ufoElement.sighting.decor=this.ufoElement.sighting.decor.map(n=>n.id===e?{...n,model:{id:i.id},sizeM:i.sizeM}:n),this.currentDecorId===e&&this.syncDecorVisibility(),this.refreshDecorList(),this.ufoElement.refresh(),this.scheduleModuleNaming())}defaultAircraft(){const e=2*ai,t=Math.round(e/Qr*1e3);return{lights:zi.byId("airliner")?.create(),track:[{t:0,eastM:-ai,northM:1e3,altitudeM:1500,headingDeg:90},{t,eastM:ai,northM:1e3,altitudeM:1500,headingDeg:90}]}}nextDecorLabel(e){const t=this.ufoElement.sighting.decor.filter(s=>s.kind===e).length;return`${this.decorList.kindLabel(e)} ${t+1}`}deleteDecor(){const t=this.ufoElement.sighting.decor.find(i=>i.id===this.currentDecorId);t!==void 0&&this.removeDecor(t.id)}removeDecor(e){const t=this.ufoElement.sighting;t.decor=t.decor.filter(i=>i.id!==e),this.currentDecorId===e&&(this.currentDecorId=t.decor[0]?.id),this.refreshDecorList(),this.ufoElement.refresh()}selectDecor(e){this.currentDecorId=e,this.isGroupIdOpen("group-file")&&(this.fileFocus="decor"),this.decorList.show(e),this.syncDecorFields(),this.syncCanvasMode(),this.canvasMode()==="decor"&&this.ufoElement.refresh();const t=this.ufoElement.sighting.decor.findIndex(i=>i.id===e);t>=0&&this.showInFile(["decor",t])}updateDecor(e={}){if(this.currentDecorId===void 0)return;const t=this.ufoElement.sighting;t.decor=t.decor.map(i=>i.id!==this.currentDecorId?i:{...i,...e}),this.syncDecorVisibility(),this.ufoElement.refresh()}decorModelEntries;refreshDecorModelOptions(e){if(!e||this.decorModelEntries?.kind===e.kind)return;const t=e.kind;this.decorModelProvider.entries(t).catch(()=>[]).then(i=>{this.decorModelEntries={kind:t,entries:i},this.isConnected&&this.decorBaseForm.sync()})}drawnEntry;drawnEntryAsked;publishedParametersOf(e){const t=Wn(e);if(!(!t?.id||t.url!==void 0)){if(this.drawnEntry?.id===t.id)return this.drawnEntry.parameters;if(this.drawnEntryAsked!==t.id){this.drawnEntryAsked=t.id;const i=t.id;this.decorModelProvider.entry(i).catch(()=>{}).then(s=>{this.drawnEntryAsked!==i||!s||(this.drawnEntry=s,this.isConnected&&this.syncDecorVisibility())})}}}modelPicker;enhanceDecorModelChoice(e,t){e.key==="model.id"&&(t.addEventListener("change",()=>t.dispatchEvent(new Event("input",{bubbles:!0}))),this.modelPicker.enhance(t,async i=>{const s=this.ufoElement.sighting.decor.find(r=>r.id===this.currentDecorId),n=i!==""?i:s?Qi[s.kind]?.id:void 0;return n!==void 0?this.decorModelProvider.entry(n).then(r=>r&&{url:r.url,headingOffsetDeg:r.headingOffsetDeg}):s===void 0?void 0:{decorKind:s.kind}},{current:()=>{const i=this.ufoElement.sighting.decor.find(s=>s.id===this.currentDecorId)?.model;return i?.url===void 0?void 0:{url:i.url,title:i.credit?.title??"",author:i.credit?.author??"",license:i.credit?.license??"",source:i.credit?.sourceUrl??""}},apply:i=>this.commitDecorBase(s=>{const n=this.stringOrUndefined(i.title),r=this.stringOrUndefined(i.license);s.model={url:i.url,credit:n!==void 0&&r!==void 0?{title:n,license:r,author:this.stringOrUndefined(i.author),sourceUrl:this.stringOrUndefined(i.source)}:void 0}},"model")}))}async adoptCatalogueSize(e,t){const[i,s]=await Promise.all([e.model?.id?this.decorModelProvider.entry(e.model.id).catch(()=>{}):void 0,t?this.decorModelProvider.entry(t).catch(()=>{}):void 0]),n=this.ufoElement.sighting.decor.find(l=>l.id===e.id);if(!n||n.model?.id!==t||!s?.sizeM)return;const r=n.sizeM!==void 0&&i?.sizeM!==void 0&&n.sizeM.widthM===i.sizeM.widthM&&n.sizeM.lengthM===i.sizeM.lengthM&&n.sizeM.heightM===i.sizeM.heightM;if(n.sizeM&&!r)return;const o={...n.sizeM,...Object.fromEntries(Object.entries(s.sizeM).filter(([,l])=>l!==void 0).map(([l,a])=>[l,this.roundedMeters(a)]))};this.updateDecor({sizeM:o})}roundedMeters(e){return Math.round(e*100)/100}addMilestone(){const e=Math.round(this.ufoElement.currentTime),t=this.ufoElement.sighting;t.milestones.find(s=>s.t===e)||(t.milestones=_i([...t.milestones,{t:e,label:this.nextMilestoneLabel()}])),this.currentMilestoneT=e,this.refreshMilestoneList(),this.ufoElement.refresh()}nextMilestoneLabel(){const e=new Set(this.ufoElement.sighting.milestones.map(t=>t.label));for(let t=0;t<26;t++){const i=String.fromCharCode(65+t);if(!e.has(i))return i}return String(this.ufoElement.sighting.milestones.length+1)}deleteMilestone(){const e=this.currentMilestoneT;if(e===void 0)return;const t=this.ufoElement.sighting,i=t.milestones.find(s=>s.t===e);i&&(t.milestones=t.milestones.filter(s=>s.t!==i.t),this.currentMilestoneT=t.milestones[0]?.t,this.refreshMilestoneList(),this.ufoElement.refresh())}selectMilestone(e){this.currentMilestoneT=e,this.syncMilestoneFields(),this.goToMark(e)}updateMilestone(){const e=this.currentMilestoneT;if(e===void 0)return;const t=this.ufoElement.sighting;t.milestones=t.milestones.map(i=>i.t===e?{...i,label:this.said.write(i.label,this.milestoneLabelInput.value,this.writingLanguage)??"",note:this.said.write(i.note,this.milestoneNoteInput.value,this.writingLanguage)}:i),this.refreshMilestoneList(),this.ufoElement.refresh()}refreshMilestoneList(){const e=_i(this.ufoElement.sighting.milestones);e.some(t=>t.t===this.currentMilestoneT)||(this.currentMilestoneT=e[0]?.t),this.milestoneSelect.replaceChildren(...e.map(t=>{const i=document.createElement("option");return i.value=String(t.t),i.textContent=`${this.said.read(t.label)??""} — ${this.formatSeconds(t.t)}`,i.title=this.said.read(t.note)??"",i})),this.currentMilestoneT!==void 0&&(this.milestoneSelect.value=String(this.currentMilestoneT)),this.syncMilestoneFields()}formatSeconds(e){return`${(e/1e3).toFixed(1)} s`}syncMilestoneFields(){const e=this.ufoElement.sighting.milestones.find(i=>i.t===this.currentMilestoneT),t=e!==void 0;ge.showPresence(this.shadow.getElementById("milestone-row"),this.shadow.getElementById("milestone-item"),t);for(const i of[this.milestoneSelect,this.goToMilestoneButton,this.deleteMilestoneButton])i.disabled=!t;this.milestoneLabelInput.value=this.said.read(e?.label)??"",this.milestoneNoteInput.value=this.said.read(e?.note)??""}refreshDecorList(){this.decorList.setItems(this.ufoElement.sighting.decor.filter(e=>e.kind!=="observer").map(e=>({id:e.id,label:this.decorLabel(e)})),this.currentDecorId),this.syncDecorFields(),this.syncCanvasMode(),this.refreshSceneryWarning(),this.refreshObserverList()}refreshObserverList(){const e=y.OBSERVER_PRINCIPAL,t=this.ufoElement.sighting.decor.filter(s=>s.kind==="observer");this.currentDecorId!==void 0&&t.some(s=>s.id===this.currentDecorId)&&this.observerAdded&&(this.observerShown=this.currentDecorId),this.observerAdded=!1,t.some(s=>s.id===this.observerShown)||(this.observerShown=e),this.observerList.setItems([{id:e,label:this.principalObserverLabel()},...t.map(s=>({id:s.id,label:this.decorLabel(s)}))],this.observerShown);const i=this.observerShown!==e;this.observerList.setRemoveEnabled(i),this.observerList.setActionEnabled("look-at-observer",i),this.placeDecorItem()}principalObserverLabel(){const e=[this.observerTitleInput.value,this.observerFirstNamesInput.value,this.observerLastNameInput.value].map(t=>t.trim()).filter(Boolean).join(" ");return e===""?this.messages.principalObserver:`${e} (${this.messages.principalObserver.toLowerCase()})`}observerAdded=!1;selectObserver(e){this.observerShown=e,e!==y.OBSERVER_PRINCIPAL&&this.selectDecor(e),this.refreshObserverList()}placeDecorItem(){const e=this.shadow.getElementById("decor-item"),t=this.shadow.getElementById("observer-decor-host"),i=this.shadow.getElementById("observer-principal");if(!e||!t||!i)return;const s=this.observerShown!==y.OBSERVER_PRINCIPAL;if(i.hidden=s,s&&this.isGroupIdOpen("group-observer")){e.parentElement!==t&&t.append(e),e.hidden=!1;return}e.parentElement===t&&this.shadow.getElementById("decor-list-header").after(e),e.hidden=this.decorList.value===""}syncDecorFields(){this.syncDecorVisibility()}async findGhosts(){const e=this.currentReference();if(e?.src){this.searchingGhosts=!0,this.syncFindGhosts(e);try{const{GhostSearchView:t}=await M(async()=>{const{GhostSearchView:r}=await import("./GhostSearchView-Dlhj3xWa.js");return{GhostSearchView:r}},__vite__mapDeps([32,33]),import.meta.url),i=this.messages,s={searching:i.referenceGhostsSearching,found:i.referenceGhostsFound,foundScaled:i.referenceGhostsFoundScaled,low:i.referenceGhostsLow,none:i.referenceGhostsNone,cropped:i.referenceGhostsCropped},n=await new t(this.ghostsStatus,s).search(e.src);this.ghostFinding=n&&n.pairs.length>0?{referenceId:e.id,src:e.src,search:n}:void 0,this.ghostsShown=!0,this.syncGhostsShown(),this.ufoElement.refresh()}finally{this.searchingGhosts=!1,this.syncFindGhosts(this.currentReference())}}}syncGhostsShown(){this.ghostsShownButton.hidden=!this.ghostFinding,this.ghostsShownButton.setAttribute("aria-pressed",String(this.ghostsShown)),this.ghostsShownButton.textContent=this.ghostsShown?this.messages.referenceGhostsHide:this.messages.referenceGhostsShow}syncFindGhosts(e){const t=!e?.src||this.sceneElement.referenceFailure(e.src)!==void 0;this.findGhostsButton.disabled=this.searchingGhosts||t||e?.kind==="video",this.addReferenceLandmarkButton.disabled=t,t&&(this.armingLandmark||this.pendingLandmark)&&this.disarmLandmark()}syncFilmStocks(e,t){const i=ft.forInstrument(t);this.setRowVisible(this.filmStockSelect,i.length>0);const s=e.event.time?.year??void 0,n=`${t.id}|${s}|${e.film}|${this.messages.filmStockAny}`;if(this.filmStockKey===n)return;this.filmStockKey=n,this.filmStockSelect.innerHTML="";const r=(l,a,d=!1)=>{const h=document.createElement("option");h.value=l,h.textContent=a,h.disabled=d,this.filmStockSelect.appendChild(h)};r("",this.messages.filmStockAny);const o=i.map(l=>({stock:l,gap:ft.gap(l,t,s)}));for(const{stock:l}of o.filter(a=>!a.gap))r(l.id,l.name);for(const{stock:l,gap:a}of o.filter(d=>d.gap)){const d=a.kind==="before"?this.messages.filmStockNotYet.replace("{from}",String(a.from)):this.messages.filmStockNoLonger.replace("{to}",String(a.to));r(l.id,`${l.name} (${d})`,l.id!==e.film)}this.filmStockSelect.value=e.film??""}filmStockKey;updateExposureSettings(){const e=this.ufoElement.sighting;e.iso=this.numberOrUndefined(this.isoInput.value),e.film=this.filmStockSelect.value||void 0,this.isoInput.placeholder=String(ft.byId(e.film)?.iso??e.instrument.medium?.iso??"");const t=this.meteringSelect.value;e.metering=t==="average"||t==="highlights"?t:void 0,this.meteringSelect.disabled=e.iso!==void 0,this.ufoElement.refresh()}updateLens(){const e=this.lensGlassSelect.value,t={...e?{glass:e}:{},drops:this.numberOrUndefined(this.lensDropsInput.value),condensation:this.numberOrUndefined(this.lensCondensationInput.value),dirt:this.numberOrUndefined(this.lensDirtInput.value),...this.lensShelteredInput.checked?{sheltered:!0}:{}};for(const i of["drops","condensation","dirt"])t[i]===void 0&&delete t[i];this.ufoElement.sighting.lens=Object.keys(t).length>0?t:void 0,this.ufoElement.refresh()}label(e,t){const i=this.shadow.getElementById(e);i&&(i.textContent=t)}setRowVisible(e,t){const i=e.closest("label")??e;i.hidden=!t}decorBaseShownFor;showDecorBase(e){if(this.decorBaseHost.hidden=e===void 0,this.decorStateHost.hidden=e===void 0,!e){this.decorBaseForm.clear(),this.decorStateForm.clear(),this.decorBaseShown=!1,this.decorBaseShownFor=void 0;return}const t=this.decorBaseShownFor!==e.id;if(this.decorBaseShownFor=e.id,this.decorBaseShown){this.decorBaseForm.sync(t),this.decorStateForm.sync(t);return}this.decorBaseShown=!0;const i=()=>new Ot(()=>{const s=this.ufoElement.sighting.decor.find(n=>n.id===this.currentDecorId);return s?et.viewOf(s,this.ufoElement.currentTime,this.sceneElement.sunAltitudeDeg):void 0},(s,n)=>this.commitDecorBase(s,n.key),()=>this.decorBaseContext(),this.decorPositionPlace());this.decorBaseForm.show(st.resolve(pe.BASE,this.decorParameterTexts),i(),()=>{}),this.decorStateForm.show(st.resolve(pe.STATE,this.decorParameterTexts),i(),()=>{})}decorPositionPlace(){const e=()=>{const t=this.ufoElement.sighting.decor.findIndex(i=>i.id===this.currentDecorId);return t<0?[]:[`decor.${t}.eastM`,`decor.${t}.northM`]};return{frame:()=>this.positionFrame(this.currentDecorId),messages:()=>this.messages,basis:{read:()=>this.ufoElement.sighting.provenance.at(e()[0]??"")?.basis,write:(t,i)=>this.writePositionBasis(e(),i)}}}framePlace(){return{frame:()=>this.positionFrame(),messages:()=>this.messages}}positionFrame(e){const t=this.ufoElement.currentTime,i=[{label:this.messages.positionObserver,eastM:0,northM:0}];for(const s of this.ufoElement.sighting.decor){if(s.id===e)continue;const{eastM:n,northM:r}=es(s,t);i.push({id:s.id,label:this.decorLabel(s),eastM:n,northM:r})}return{origin:this.plantingCentre(),references:i}}syncObserverPosition(){const e=this.ufoElement.sighting,t=this.ufoElement.currentTime;this.observerSaid=e.observerTrack.getLatestPoseAt(t)?.saidPosition;const i=this.positionFrame();this.observerPosition.frame={...i,references:i.references.filter(n=>n.id!==void 0)};const s=JSON.stringify(this.observerSaid??null);s!==this.observerSaidShown&&(this.observerSaidShown=s,this.observerPosition.said=this.observerSaid),this.observerPosition.basis=e.provenance.at(this.observerPositionPaths()[0]??"")?.basis}observerPositionPaths(){const e=this.ufoElement.currentTime,t=this.ufoElement.sighting.observerTrack.toJSON().keyframes.findIndex(i=>i.t===e);return t<0?[]:[`observerTrack.keyframes.${t}.pose.lat`,`observerTrack.keyframes.${t}.pose.lng`]}writeObserverBasis(e){this.observerPositionPaths().length===0&&this.updateObserver(),this.writePositionBasis(this.observerPositionPaths(),e)}writePositionBasis(e,t){const i=this.ufoElement.sighting.provenance;for(const s of e)t===void 0||t==="stated"?i.clear(s):i.set(s,{basis:t});this.dispatchEvent(new CustomEvent("sightingchange"))}decorBaseContext(){const e=this.ufoElement.sighting.decor.find(i=>i.id===this.currentDecorId);if(!e)return;const t=Ui.of(e,this.publishedParametersOf(e));return{kind:e.kind,natural:Hi.naturalSize(e.kind,e.floors),traits:{color:t.color,lit:t.lit,headlights:t.headlights,lights:t.lights,observerSide:t.observerSide},lightRigs:Ui.rigsFor(e.kind,this.publishedParametersOf(e)).map(i=>({value:i.id,label:this.naming.lightRig(i)})),seats:pe.seatsFor(e.kind),models:(this.decorModelEntries?.kind===e.kind?this.decorModelEntries.entries:[]).map(i=>({value:i.id,label:i.name})),defaultModelId:Qi[e.kind]?.id}}placedByAuthor(e){if(!e.lamp?.supposed)return e;const t=this.sceneElement.decorDrawnOffset(e.id),{supposed:i,...s}=e.lamp,n={...e,eastM:e.eastM+(t?.eastM??0),northM:e.northM+(t?.northM??0),...Object.keys(s).length>0?{lamp:s}:{}};Object.keys(s).length===0&&delete n.lamp;const r=this.ufoElement.sighting;return r.decor=r.decor.map(o=>o.id===e.id?n:o),n}commitDecorBase(e,t){const i=this.ufoElement.sighting.decor.find(a=>a.id===this.currentDecorId);if(!i)return;const s=t==="eastM"||t==="northM"?this.placedByAuthor(i):i;if((t==="lit"||t==="headlights")&&this.ufoElement.playbackState==="playing")return;const n=this.ufoElement.currentTime,r=et.viewOf(s,n,this.sceneElement.sunAltitudeDeg);e(r);const o=this.ufoElement.sighting;o.decor=o.decor.map(a=>a.id===s.id?et.apply(a,r,t,n):a),t==="model.id"&&this.adoptCatalogueSize(s,r.model?.id);const l=o.decor.find(a=>a.id===s.id);t==="title"&&this.decorList.rename(l.id,this.decorLabel(l)),this.syncDecorVisibility(),this.ufoElement.refresh(),t==="lightRig"&&this.dispatchEvent(new CustomEvent("sightingchange"))}syncDecorBaseFromTimeline(){this.ufoElement.playbackState==="playing"||!this.decorBaseShown||(this.decorBaseForm.sync(),this.decorStateForm.sync())}showDecorParameters(e){const t=e?ks.of(e,this.publishedParametersOf(e)):void 0,i=t&&st.resolve(t,this.decorParameterTexts);if(!e||!i){this.decorParametersShownFor=void 0,this.decorParameterForm.clear(),this.decorParametersHost.hidden=!0;return}this.decorParametersHost.hidden=!1;const s=`${e.id}|${i.kind}|${i.parameters.map(o=>o.key).join(",")}`;if(s===this.decorParametersShownFor){this.decorParameterForm.sync();return}this.decorParametersShownFor=s;const n=e.id,r=new Ot(()=>this.ufoElement.sighting.decor.find(o=>o.id===n),o=>{const l=this.ufoElement.sighting;l.decor=l.decor.map(a=>{if(a.id!==n)return a;const d=structuredClone(a);return o(d),d})});this.decorParameterForm.show(i,r,()=>{this.syncDecorVisibility(),this.ufoElement.refresh()})}syncDecorParameterVisibility(){this.showDecorParameters(this.ufoElement.sighting.decor.find(e=>e.id===this.currentDecorId))}syncDecorVisibility(){const e=this.ufoElement.sighting.decor.find(t=>t.id===this.currentDecorId);this.refreshDecorModelOptions(e),this.showDecorBase(e),this.syncDecorParameterVisibility()}showNextMeteor(){const e=this.sceneElement.meteorByRank(this.meteorRank++,this.meteorMagnitudeLimit());e&&(this.ufoElement.playbackState==="playing"&&this.ufoElement.togglePlayPause(),this.ufoElement.currentTime=e.t,this.headingInput.value=String(Math.round(e.azimuthDeg*10)/10),this.pitchInput.value=String(Math.round(e.altitudeDeg*10)/10),this.updateObserver())}resetMeteorRankIfSkyChanged(){const e=this.sceneElement.meteorByRank(0,this.meteorMagnitudeLimit()),t=e?`${e.t}`:"";t!==this.meteorRankFor&&(this.meteorRankFor=t,this.meteorRank=0)}meteorRankFor;meteorMagnitudeLimit(){const e=this.ufoElement.sighting,t=this.observerAtStart(),i=e.event.time?.year!==void 0?fe(e.event.time,t.lng,e.event.utcOffsetHours):void 0;if(!i)return Number.POSITIVE_INFINITY;const s=K("Sun",i,t).altitudeDeg;return Ge(s,this.instrumentGain(),this.skyLossAt(i,t))}skyCandidatesKey;static reentryArchive=new jn;reentries;meteorRank=0;showerLanguage(){return this.language}naming=new $i;static LANGUAGE_NAMES=new Intl.DisplayNames(["en"],{type:"language"});said=new ht(["en"]);tagNames=new Wi({});get writingLanguage(){return this.showerLanguage()}refreshSkyCandidates(){if(!this.worded)return;this.resetMeteorRankIfSkyChanged();const e=this.ufoElement.sighting,t=e.event.place?.[0],i=e.event.time,s=t&&t.lat!==void 0&&t.lng!==void 0&&i?.year!==void 0?fe(i,t.lng,e.event.utcOffsetHours):void 0,n=JSON.stringify([s?.getTime(),t?.lat,t?.lng,this.groundElevationM,e.instrumentId,e.exposureSeconds,e.lightPollution,ne(e,0),this.messages.skyLine,this.meteorRankFor,this.sceneElement.satelliteState.status,this.satelliteSpanMs(),this.sceneElement.fireballState.status,this.sceneElement.groundKey,e.skySources]);if(n===this.skyCandidatesKey)return;if(this.skyCandidatesKey=n,!s||!t||t.lat===void 0||t.lng===void 0){this.showMeteorButton.disabled=!0,this.showCometButton.disabled=!0,this.showNovaButton.disabled=!0,this.showSatelliteButton.disabled=!0,this.showFireballButton.disabled=!0,this.skyCandidatesOutput.textContent=this.messages.skyLine.replace("{parts}",this.messages.skyUnknown),this.labelSkyButtons();return}const r={lat:t.lat,lng:t.lng,elevationM:this.groundElevationM??0},o=e.skySources!==!1,l=[this.starsClause(s,r),o?this.showerClause(s,r):this.messages.skyByHand,this.cometClause(s,r),this.novaClause(s,r),this.eclipseClause(s,r),this.moonClause(s,r),o?this.satelliteClause(s,r):void 0,o?this.reentryClause(s,r):void 0,o?this.fireballClause(s,r):void 0,this.opticsClause(s,r),this.rainbowClause(s,r),this.glowClause(s,r)].filter(a=>a!==void 0);o||(this.showMeteorButton.disabled=!0,this.showSatelliteButton.disabled=!0,this.showFireballButton.disabled=!0),this.skyCandidatesOutput.textContent=this.messages.skyLine.replace("{parts}",l.join(" · ")),this.labelSkyButtons()}labelSkyButtons(){const e=this.messages,t=[[this.showMeteorButton,e.showMeteor,e.noMeteor],[this.showCometButton,e.showComet,e.noComet],[this.showNovaButton,e.showNova,e.noNova],[this.showSatelliteButton,e.showSatellite,e.noSatellite],[this.showFireballButton,e.showFireball,e.noFireball]];for(const[i,s,n]of t){const r=i.disabled?n:s;i.title=r,i.setAttribute("aria-label",r)}}instrumentGain(){const e=this.ufoElement.sighting;return kn.gainFor(e.instrument,{fNumber:X(e,0)?.fNumber,fieldOfViewDeg:Ce.fovOf(e,0),exposureSeconds:e.exposure})}starsClause(e,t){const i=K("Sun",e,t).altitudeDeg,s=this.instrumentGain(),n=this.skyLossAt(e,t),r=Ge(i,s,n),o=d=>d.toLocaleString(void 0,{maximumFractionDigits:1});if(r<Vr)return this.messages.skyStarsNone;const l=this.ufoElement.sighting.instrument,a=Math.abs(s)<.1?this.messages.skyStarsEye.replace("{limit}",o(r)):(s>0?this.messages.skyStarsDeeper:this.messages.skyStarsShallower).replace("{limit}",o(r)).replace("{device}",this.naming.instrument(l)).replace("{gain}",o(Math.abs(s))).replace("{eye}",o(Ge(i,0,n)));return r<=ji?a:a+this.messages.skyStarsCatalogue.replace("{catalogue}",o(ji))}showerClause(e,t){const i=Gi.observedRatePerHour(Gi.apexPosition(e,t).altitudeDeg).toLocaleString(void 0,{maximumFractionDigits:1}),s=Jt.activeAt(e);if(s.length===0)return this.showMeteorButton.disabled=!this.sceneElement.meteorByRank(0,this.meteorMagnitudeLimit()),this.messages.skyNothingActive.replace("{sporadic}",i);const n=s.map(r=>{const o=Jt.radiantPosition(r.shower,e,t);return{entry:r,position:o,rate:Jt.observedRatePerHour(r.zhr,o.altitudeDeg,r.shower.populationIndex)}}).sort((r,o)=>o.rate-r.rate)[0];return n.rate<=0?(this.showMeteorButton.disabled=!this.sceneElement.meteorByRank(0,this.meteorMagnitudeLimit()),this.messages.skyShowerBelowHorizon.replace("{name}",this.naming.shower(n.entry.shower))):(this.showMeteorButton.disabled=!this.sceneElement.meteorByRank(0,this.meteorMagnitudeLimit()),this.messages.skyShowerActive.replace("{name}",this.naming.shower(n.entry.shower)).replace("{altitude}",String(Math.round(n.position.altitudeDeg))).replace("{bearing}",this.naming.towards(n.position.azimuthDeg)).replace("{rate}",n.rate.toLocaleString(void 0,{maximumFractionDigits:n.rate<10?1:0})).replace("{sporadic}",i))}cometClause(e,t){const i=Xt.brightestAt(e,t);if(!i||i.magnitude>Ki){this.showCometButton.disabled=!0;return}return this.showCometButton.disabled=this.sceneElement.groundHides(i.position.altitudeDeg,i.position.azimuthDeg),this.cometText(i)}novaClause(e,t){const i=Vi.brightestAt(e,t);if(!i||i.magnitude>Ki){this.showNovaButton.disabled=!0;return}return this.showNovaButton.disabled=this.sceneElement.groundHides(i.position.altitudeDeg,i.position.azimuthDeg),this.novaText(i)}eclipseClause(e,t){const i=Sn.around(e,t);if(!i||i.peakAltitudeDeg<=0)return;const s=K("Sun",i.peak,t),n=r=>r.replace("{altitude}",String(Math.round(s.altitudeDeg))).replace("{bearing}",this.naming.towards(s.azimuthDeg));if(i.totality){const r=Math.floor(i.totality.seconds/60),o=Math.round(i.totality.seconds%60);return n(this.messages.skyEclipseTotal).replace("{time}",this.observerClock(i.totality.begin)).replace("{duration}",`${r} min ${o} s`)}return n(this.messages.skyEclipsePartial).replace("{percent}",String(Math.round(i.obscuration*100))).replace("{time}",this.observerClock(i.peak).replace(/:\d\d$/,""))}moonClause(e,t){const i=K("Moon",e,t);if(i.altitudeDeg<=0||Ze(e).illuminatedFraction<.97)return;const s=[],n=Ke.distanceKm(e,t),r=Ke.relativeToMean(Ke.radiusAtKm(n)),o=n<=Ke.SUPERMOON_DISTANCE_KM?this.messages.skySupermoon:n>=Ke.MICROMOON_DISTANCE_KM?this.messages.skyMicromoon:void 0;return o&&s.push(o.replace("{distance}",(Math.round(n/100)*100).toLocaleString(this.showerLanguage())).replace("{diameter}",this.decimal(Ke.radiusAtKm(n)*2,3)).replace("{percent}",String(Math.round(Math.abs(r)*100)))),$t.isIn(e)&&s.push(this.messages.skyRedMoon.replace("{altitude}",String(Math.round(i.altitudeDeg))).replace("{bearing}",this.naming.towards(i.azimuthDeg))),s.length>0?s.join(" · "):void 0}novaText(e){return(e.position.altitudeDeg<=0?this.messages.skyNovaBelowHorizon:this.messages.skyNova).replace("{name}",this.naming.nova(e.outburst)).replace("{magnitude}",e.magnitude.toLocaleString(void 0,{maximumFractionDigits:1})).replace("{altitude}",String(Math.round(e.position.altitudeDeg))).replace("{bearing}",this.naming.towards(e.position.azimuthDeg))}satelliteClause(e,t){const i=be.visibilityAt(e,t),s=this.realSatelliteClause(i.lowOrbitLit||i.sunAltitudeDeg>=0);if(s!==void 0)return s;if(this.showSatelliteButton.disabled=!0,!i.anythingInOrbit)return i.sunAltitudeDeg<0?this.messages.skySatellitesNotYet:void 0;const n=Ge(i.sunAltitudeDeg,this.instrumentGain(),this.skyLossAt(e,t)),r=i.classes.filter(h=>h.peakMagnitude<=n),o=this.listed(r.map(h=>this.naming.satelliteClass(h)));if(i.sunAltitudeDeg>=0)return r.length===0?void 0:(r.length===1?this.messages.skySatellitesDaylightOne:this.messages.skySatellitesDaylight).replace("{eras}",o);const l=Math.round(i.shadowHeightKm).toLocaleString(),a=(i.trackedObjects??0).toLocaleString(),d=h=>h.replace("{height}",l).replace("{count}",a);return i.lowOrbitLit?r.length===0?d(this.messages.skySatellitesLit):d(this.messages.skySatellitesLitWith).replace("{eras}",o):d(this.messages.skySatellitesShadowed)}reentryClause(e,t){const i=e.getTime(),s=i+this.satelliteSpanMs(),n=[i,s,t.lat.toFixed(3),t.lng.toFixed(3)].join();if(this.reentries?.key!==n){const a={key:n,status:"loading"};this.reentries=a,y.reentryArchive.candidates(i,s,t).then(d=>{a.status=d?"ready":"unavailable",a.candidates=d,this.reentries===a&&(this.skyCandidatesKey=void 0,this.refreshSkyCandidates())});return}if(this.reentries.status!=="ready")return;const r=be.visibilityAt(e,t).sunAltitudeDeg<-6,o=(this.reentries.candidates??[]).filter(a=>a.record.precision==="minute"||r);if(o.length===0)return;const l=o.slice(0,3).map(a=>this.reentryText(a));return o.length>3&&l.push(this.messages.skyReentriesMore.replace("{count}",String(o.length-3))),this.messages.skyReentries.replace("{list}",l.join("; "))}reentryText(e){const{record:t}=e,i=t.cosparId?`${t.name} (${t.cosparId})`:t.name,s=new Date(e.timeMs);if(t.precision==="day"){const o=s.toLocaleDateString(this.showerLanguage(),{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"});return this.messages.skyReentryDay.replace("{name}",i).replace("{date}",o)}const n=this.observerClock(s).replace(/:\d\d$/,"");if(t.precision==="hours")return this.messages.skyReentryPredicted.replace("{name}",i).replace("{time}",n).replace("{hours}",(t.uncertaintyHours??0).toLocaleString(this.showerLanguage()));const r=e.offsetMinutes?this.messages.skyReentryOffset.replace("{minutes}",String(e.offsetMinutes)):"";return t.seenFrom&&e.seenKm!==void 0?this.messages.skyReentrySeen.replace("{name}",i).replace("{time}",n).replace("{place}",t.seenFrom).replace("{distance}",String(Math.round(e.seenKm/10)*10))+r:this.messages.skyReentryObserved.replace("{name}",i).replace("{time}",n)+r}realSatelliteClause(e){const t=this.sceneElement.satelliteState;if(t.status!=="ready")return;if(t.coverage?.every(a=>a.status!=="covered"))return this.showSatelliteButton.disabled=!0,t.coverage.some(a=>a.status==="gap")?this.messages.skySatelliteElementsGap:void 0;const i=this.visibleSatellitePasses();if(this.showSatelliteButton.disabled=this.aimableSatellitePasses(i).length===0,i.length===0)return e?this.messages.skySatellitePassesNone:void 0;const n=i[0].peak,o=(i.length===1?this.messages.skySatellitePassesOne:this.messages.skySatellitePasses).replace("{count}",String(i.length)).replace("{name}",n.object.name).replace("{magnitude}",n.magnitude.toLocaleString(void 0,{maximumFractionDigits:1})).replace("{altitude}",String(Math.round(n.altitudeDeg))).replace("{bearing}",this.naming.towards(n.azimuthDeg)).replace("{time}",this.observerClock(n.date)),l=this.starlinkTrain(i);return l?`${o}, ${l}`:o}visibleSatellitePasses(){const e=this.instrumentGain(),t=this.observerAtStart();return this.sceneElement.satellitePassesDuring(this.satelliteSpanMs()).filter(i=>{const s=i.peak.magnitude;if(s===void 0)return!1;const n=K("Sun",i.peak.date,t);return s<=Ge(n.altitudeDeg,e,this.skyLossAt(i.peak.date,t))}).sort((i,s)=>i.peak.magnitude-s.peak.magnitude)}aimableSatellitePasses(e){return e.filter(t=>this.passTimelineMs(t)<=this.ufoElement.seekableDuration&&!this.sceneElement.groundHides(t.peak.altitudeDeg,t.peak.azimuthDeg))}starlinkTrain(e){const t=new Map;for(const r of e){const{kind:o,launch:l}=r.peak.object;o!=="starlink"||!l||(r.peak.date.getTime()-Date.parse(`${l}T00:00:00Z`))/864e5>60||t.set(l,(t.get(l)??0)+1)}const[i,s]=[...t.entries()].sort((r,o)=>o[1]-r[1])[0]??[];if(!i||!s||s<3)return;const n=new Date(`${i}T00:00:00Z`).toLocaleDateString(this.showerLanguage(),{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"});return this.messages.skySatelliteTrain.replace("{count}",String(s)).replace("{date}",n)}satelliteSpanMs(){const e=(this.ufoElement.sighting.event.durationSeconds??0)*1e3;return Math.max(e,this.ufoElement.seekableDuration)}observerAtStart(){const e=this.ufoElement.sighting.event.place?.[0],t=X(this.ufoElement.sighting,0);return{lat:t?.lat??e?.lat??0,lng:t?.lng??e?.lng??0,elevationM:this.groundElevationM??0}}passTimelineMs(e){const t=this.ufoElement.sighting,i=fe(t.event.time??{},this.observerAtStart().lng,t.event.utcOffsetHours);return i?e.peak.date.getTime()-i.getTime():1/0}observerClock(e){const i=this.ufoElement.sighting.event.utcOffsetHours??Math.round(this.observerAtStart().lng/15);return new Date(e.getTime()+i*36e5).toLocaleTimeString(this.showerLanguage(),{hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:"UTC"})}showNextSatellite(){const e=this.aimableSatellitePasses(this.visibleSatellitePasses());if(e.length===0)return;const t=e.map(s=>`${s.object.norad}@${s.peak.date.getTime()}`).join();t!==this.satelliteRankFor&&(this.satelliteRankFor=t,this.satelliteRank=0);const i=e[this.satelliteRank++%e.length];this.ufoElement.playbackState==="playing"&&this.ufoElement.togglePlayPause(),this.ufoElement.currentTime=this.passTimelineMs(i),this.headingInput.value=String(Math.round(i.peak.azimuthDeg*10)/10),this.pitchInput.value=String(Math.round(i.peak.altitudeDeg*10)/10),this.updateObserver()}satelliteRankFor;satelliteRank=0;strikingFireballs(e,t){return this.sceneElement.fireballState.records.map(i=>qi.seenFrom(i,{lat:t.lat,lng:t.lng,heightM:t.elevationM})).filter(i=>i!==void 0&&i.magnitude<=qi.STRIKING_MAGNITUDE).filter(i=>i.record.t>=e.getTime()).sort((i,s)=>i.magnitude-s.magnitude)}aimableFireballs(e,t){return e.filter(i=>this.fireballTimelineMs(i,t)<=this.ufoElement.seekableDuration&&!this.sceneElement.groundHides(i.peak.altitudeDeg,i.peak.azimuthDeg))}fireballTimelineMs(e,t){const{record:i}=e,s=i.from[2]-i.to[2],n=Math.abs(s)<1e-6?.5:Math.min(1,Math.max(0,(i.from[2]-i.peakHeightKm)/s));return i.t-t.getTime()+n*i.durationS*1e3}fireballClause(e,t){const i=this.sceneElement.fireballState.status==="ready"?this.strikingFireballs(e,t):[];if(this.showFireballButton.disabled=this.aimableFireballs(i,e).length===0,i.length===0)return;const s=i[0];return(i.length===1?this.messages.skyFireballsOne:this.messages.skyFireballs).replace("{count}",String(i.length)).replace("{magnitude}",s.magnitude.toLocaleString(this.showerLanguage(),{maximumFractionDigits:1})).replace("{time}",this.observerClock(new Date(s.record.t))).replace("{altitude}",String(Math.round(s.peak.altitudeDeg))).replace("{bearing}",this.naming.towards(s.peak.azimuthDeg)).replace("{distance}",String(Math.round(s.peak.distanceKm/10)*10)).replace("{stations}",String(s.record.stations??2))}showNextFireball(){const e=this.ufoElement.sighting,t=e.event.place?.[0],i=e.event.time;if(!t||t.lng===void 0||!i)return;const s=fe(i,t.lng,e.event.utcOffsetHours);if(!s)return;const n=this.aimableFireballs(this.strikingFireballs(s,this.observerAtStart()),s);if(n.length===0)return;const r=n[this.fireballRank++%n.length];this.ufoElement.playbackState==="playing"&&this.ufoElement.togglePlayPause(),this.ufoElement.currentTime=this.fireballTimelineMs(r,s),this.headingInput.value=String(Math.round(r.peak.azimuthDeg*10)/10),this.pitchInput.value=String(Math.round(r.peak.altitudeDeg*10)/10),this.updateObserver()}fireballRank=0;opticsClause(e,t){const i=ne(this.ufoElement.sighting,0),s=K("Sun",e,t),n=K("Moon",e,t),r=bt.deckLitUntilDeg(bt.DECK_HEIGHT_M),o=s.altitudeDeg>-r,l=o?s:n;if(l.altitudeDeg<=-r)return;const a=i.highCloudCover;if(a===void 0||a<=0)return this.messages.skyOpticsNoIce;if(bt.strength(a,i.lowerCloudCover??i.cloudCover,l.altitudeDeg,r)<=0)return this.messages.skyOpticsHidden;const d=o?this.messages.skyOpticsSun:this.messages.skyOpticsMoon,h=this.listed(bt.formsAt(l.altitudeDeg,r).map(u=>this.opticsFormName(u))),c=i.iceCrystalAlignment??gi;return this.messages.skyOpticsPossible.replace("{forms}",h).replace("{source}",d)+this.messages.skyOpticsAlignment.replace("{alignment}",String(Math.round(c*100)))}rainbowClause(e,t){const i=ne(this.ufoElement.sighting,0);if(i.precipitationType!=="rain"||i.precipitationIntensity<=0)return;const s=K("Sun",e,t),n=K("Moon",e,t),r=s.altitudeDeg>0,o=r?s:n;if(o.altitudeDeg<=0)return this.messages.skyBowNoSource;const l=i.lowerCloudCover??i.cloudCover;if(Qt.strength(i.precipitationIntensity,l,o.altitudeDeg)<=0)return this.messages.skyBowHidden;const a=Qt.formsAt(o.altitudeDeg);if(a.length===0)return this.messages.skyBowSourceTooHigh.replace("{altitude}",String(Math.round(o.altitudeDeg))).replace("{radius}",String(Math.round(Qt.primary().radiusDeg)));const d=this.listed(a.map(c=>this.bowFormName(c)));if(r)return this.messages.skyBowPossible.replace("{forms}",d);const h=Math.round(Ze(e).illuminatedFraction*100);return this.messages.skyBowMoon.replace("{forms}",d).replace("{lit}",String(h))}glowClause(e,t){const i=K("Sun",e,t);if(i.altitudeDeg>ro)return;const s=this.glows.assess(e,t,this.ufoElement.sighting.lightPollution),n=[];if(s.milkyWay&&n.push(this.messages.skyGlowBand.replace("{contrast}",this.decimal(s.milkyWay.contrast,1)).replace("{altitude}",String(Math.round(s.milkyWay.altitudeDeg))).replace("{bearing}",this.naming.towards(s.milkyWay.azimuthDeg))),s.zodiacal){const u=s.zodiacal.sunSeparationDeg<=O.CONE_SEPARATION_DEG;n.push((u?this.messages.skyGlowCone:this.messages.skyGlowZodiacalBand).replace("{contrast}",this.decimal(s.zodiacal.contrast,1)).replace("{altitude}",String(Math.round(s.zodiacal.altitudeDeg))).replace("{bearing}",this.naming.towards(s.zodiacal.azimuthDeg)).replace("{elongation}",String(Math.round(s.zodiacal.sunSeparationDeg))))}if(n.length>0)return this.listed(n);const r=this.decimal(s.darkestSkyMagPerArcsec2,1),o=K("Moon",e,t),l=s.darkestSkyMagPerArcsec2<oo,a=this.ufoElement.sighting.lightPollution,d=ue.scatteringAt(90-o.altitudeDeg)*ue.moonOutput(ue.phaseAngleOf(Ze(e).illuminatedFraction),o.altitudeDeg)*ue.scatteredFraction(90),h=ue.artificialZenithNanolamberts(a)>d;if(l&&o.altitudeDeg>0&&!h){const u=Math.round(Ze(e).illuminatedFraction*100);return this.messages.skyGlowMoon.replace("{lit}",String(u)).replace("{sky}",r)}const c=ue.artificialZenithNanolamberts(a)>ue.twilightExcessNanolamberts(i.altitudeDeg);return l&&h&&c?this.messages.skyGlowTowns.replace("{sky}",r):l?this.messages.skyGlowTwilight.replace("{sky}",r):this.messages.skyGlowNothingUp.replace("{sky}",r)}skyLossAt(e,t){const i=K("Sun",e,t),s=K("Moon",e,t);return ue.starLossMagnitudes(i.altitudeDeg,{phaseAngleDeg:ue.phaseAngleOf(Ze(e).illuminatedFraction),altitudeDeg:s.altitudeDeg},this.ufoElement.sighting.lightPollution)}glows=new O;bowFormName(e){return(e.id==="primary"?this.messages.skyBowPrimary:this.messages.skyBowSecondary).replace("{radius}",String(Math.round(e.radiusDeg))).replace("{top}",String(Math.round(e.topAltitudeDeg)))}opticsFormName(e){const t=i=>String(Math.round(i??0));switch(e.id){case"halo22":return this.messages.skyOpticsHalo22.replace("{angle}",t(e.angleDeg));case"halo46":return this.messages.skyOpticsHalo46.replace("{angle}",t(e.angleDeg));case"parhelia":return this.messages.skyOpticsParhelia.replace("{angle}",t(e.angleDeg));case"tangentArc":return this.messages.skyOpticsTangentArc;case"parhelicCircle":return this.messages.skyOpticsParhelicCircle;case"circumzenithal":return this.messages.skyOpticsCircumzenithal.replace("{angle}",t(e.angleDeg));case"circumhorizontal":return this.messages.skyOpticsCircumhorizontal;case"pillar":return this.messages.skyOpticsPillar}}listed(e){return new Intl.ListFormat(this.showerLanguage(),{style:"long",type:"conjunction"}).format(e)}cometText(e){const t=this.naming.comet(e.apparition),i=e.magnitude.toLocaleString(void 0,{maximumFractionDigits:1});return e.position.altitudeDeg<=0?this.messages.skyCometBelowHorizon.replace("{name}",t).replace("{magnitude}",i):(e.elongationDeg<Xt.TWILIGHT_ELONGATION_DEG?this.messages.skyCometInDaylight:e.tailLengthDeg===void 0?this.messages.skyCometNoTail:this.messages.skyComet).replace("{name}",t).replace("{magnitude}",i).replace("{altitude}",String(Math.round(e.position.altitudeDeg))).replace("{bearing}",this.naming.towards(e.position.azimuthDeg)).replace("{tail}",String(Math.round(e.tailLengthDeg??0))).replace("{elongation}",String(Math.round(e.elongationDeg)))}lookAtComet(){const e=this.ufoElement.sighting,t=e.event.place?.[0],i=e.event.time;if(!t||t.lat===void 0||t.lng===void 0||i?.year===void 0)return;const s=fe(i,t.lng,e.event.utcOffsetHours);if(!s)return;const n=Xt.brightestAt(s,{lat:t.lat,lng:t.lng,elevationM:this.groundElevationM??0});!n||this.sceneElement.groundHides(n.position.altitudeDeg,n.position.azimuthDeg)||(this.headingInput.value=String(this.rounded(n.position.azimuthDeg)),this.pitchInput.value=String(this.rounded(n.position.altitudeDeg)),this.updateObserver())}lookAtNova(){const e=this.ufoElement.sighting,t=e.event.place?.[0],i=e.event.time;if(!t||t.lat===void 0||t.lng===void 0||i?.year===void 0)return;const s=fe(i,t.lng,e.event.utcOffsetHours);if(!s)return;const n=Vi.brightestAt(s,{lat:t.lat,lng:t.lng,elevationM:this.groundElevationM??0});!n||this.sceneElement.groundHides(n.position.altitudeDeg,n.position.azimuthDeg)||(this.headingInput.value=String(this.rounded(n.position.azimuthDeg)),this.pitchInput.value=String(this.rounded(n.position.altitudeDeg)),this.updateObserver())}refreshHeadingPoint(){const e=this.numberOrUndefined(this.headingInput.value);this.headingUnit.textContent=e===void 0?"°":`° (${this.naming.point(e)})`}rounded(e){return Math.round(e*10)/10}lookAtDecor(){const e=this.ufoElement.sighting.decor.find(a=>a.id===this.currentDecorId);if(!e)return;const t=this.sceneElement.directionToDecor(e.id);if(t){this.headingInput.value=String(Math.round(t.azimuthDeg*10)/10),this.pitchInput.value=String(Math.round(t.altitudeDeg*10)/10),this.updateObserver();return}const{eastM:i,northM:s,altitudeM:n}=es(e,this.ufoElement.currentTime),r=Math.hypot(i,s);if(r===0&&n===0)return;const o=Math.atan2(i,s)*180/Math.PI,l=Math.atan2(n-Xr-(X(this.ufoElement.sighting,this.ufoElement.currentTime)?.elevationM??0),r)*180/Math.PI;this.headingInput.value=String(Math.round(o*10)/10),this.pitchInput.value=String(Math.round(l*10)/10),this.updateObserver()}static DEFAULT_SAMPLE_MS=100;get samplingRate(){return this.ufoElement.sighting.sampleMs??y.DEFAULT_SAMPLE_MS}buildPrototype(e=this.defaultBounds()){return Xi(e,this.currentAppearance)}defaultBounds(){const e=this.ufoElement.canvasElement;return{x:e.width/2-Ve.width/2,y:e.height/2-Ve.height/2,width:Ve.width,height:Ve.height}}toggleRecording(){this.endDrag();const e=this.ufoElement.canvasElement;this.isRecording?(this.recorder?.stop(),this.isRecording=!1,this.setRecordButtonLabel(!1),this.setCanvasCursor(void 0),e.style.touchAction="",this.sourceSelect.disabled=!1,this.addShapeButton.disabled=!1,this.ufoElement.refresh(),this.refreshSourceList()):(this.recorder=new yi(this.ufoElement.sighting.timeline,new dr(this.samplingRate)),this.recorder.start(this.currentSourceId,this.buildPrototype()),this.isRecording=!0,this.setRecordButtonLabel(!0),this.setCanvasCursor("record"),e.style.touchAction="none",this.sourceSelect.disabled=!0,this.addShapeButton.disabled=!0,this.deleteShapeButton.disabled=!0)}setRecordButtonLabel(e){const t=e?this.messages.stop:this.messages.record;this.recordButton.title=t,this.recordButton.setAttribute("aria-label",t),this.recordButton.querySelector(".record-label")||this.recordButton.replaceChildren(Object.assign(document.createElement("span"),{className:"record-icon"}),Object.assign(document.createElement("span"),{className:"record-label"})),D.show(this.recordButton.querySelector(".record-icon"),e?"⏹":"⏺"),this.recordButton.querySelector(".record-label").textContent=t}async loadLocaleMessages(){const e=++this.localeToken,t=Ne.preferencesFor(this);this.preferences=t;const i=di(t,hi),s=this.decidedLanguage===void 0;if(this.decidedLanguage=i,s){for(const h of this.skyParts.values())this.nameSkyPart(h.label,h.titles);this.applyPerceptionLabels()}const n=this.narrativeProvider.localize?.(i),[r,o,l,a]=await Promise.all([ws.load(i),i==="en"?{}:Ws(i),js(i),ir.load(i)]);if(await n,e!==this.localeToken)return;const d=i!==this.language;this.language=i,this.decorParameterTexts=a,this.naming=new $i(l),this.said=new ht(t),this.tagNames=new Wi(o),r!==this.messages?this.applyMessages(r):(this.paramSummaryBuilder=new Zi(r,this.naming,this.said,this.tagNames,{messages:r,locale:this.language},this.decorParameterTexts),this.refreshParamSummary()),d?this.showSaidTexts():this.showTags()}preferences=[];decidedLanguage;language="en";localeToken=0;showSaidTexts(){this.refreshSourceList(),this.refreshDecorList(),this.refreshReferenceList(),this.refreshMilestoneList(),this.onSelectionOrTimeChanged(),this.syncObserverMetadataFields()}showTags(){this.tagsInput.value=this.ufoElement.sighting.event.tags?.map(e=>this.tagNames.name(e)).join(", ")??""}applyMessages(e){this.worded=!0,this.currentSourceId===it&&this.shapeTitleInput.value===`${this.messages.shape} 1`?(this.messages=e,this.shapeTitleInput.value=`${this.messages.shape} 1`,this.updateShapeTitle()):this.messages=e,this.sayLoadError(),this.shapeAddMenu.setKinds(this.shapeAddKinds()),this.contextAddVertexButton.textContent=e.addVertex,this.contextDeleteVertexButton.textContent=e.deleteVertex,this.labelColor.textContent=e.color,this.labelTransparency.textContent=e.transparency,this.labelHalo.textContent=e.halo,this.labelBlur.textContent=e.blur,this.labelBrightness.textContent=e.brightness,this.sourceSelect.setAttribute("aria-label",e.shape),this.shadow.getElementById("shape-empty").textContent=e.emptyShapes,this.labelShapeTitle.textContent=e.shapeTitle,this.labelUtcOffset.textContent=e.utcOffset,this.utcOffsetInput.placeholder=e.utcOffsetPlaceholder;const t=(n,r,o)=>{this.shadow.getElementById(n).setAttribute(r,o),r==="title"&&this.fieldHints.set(n,o)};t("observerAge","placeholder",e.observerAgeUnit),t("observerOccupation","placeholder",e.observerOccupationExample),t("roll","title",e.rollHint),t("utcOffsetHours","title",e.utcOffsetHint),t("highCloudCover","title",e.highCloudCoverHint),t("cloudBase","title",e.cloudBaseHint),t("windDirection","title",e.windDirectionHint),t("soundPitch","title",e.soundPitchHint),t("brightness","title",e.brightnessHint),t("blur","title",e.blurHint),t("apparentWidth","title",e.apparentWidthHint),t("realWidth","title",e.realWidthHint),t("objectDistance","title",e.objectDistanceHint),t("sizeLock","title",e.sizeLockHint),this.labelApparentWidth.textContent=e.apparentWidth,this.labelRealWidth.textContent=e.realWidth,this.labelObjectDistance.textContent=e.distance,this.shadow.getElementById("label-shape-rotation").textContent=e.shapeRotation,this.shapeRotationInput.title=e.shapeRotationTitle,this.labelSizeLock.textContent=e.sizeLock;for(const[n,r]of[["option-lock-none",e.lockNone],["option-lock-apparent",e.lockApparent],["option-lock-real",e.lockReal],["option-lock-distance",e.lockDistance]])this.shadow.getElementById(n).textContent=r;this.clearDistanceHypothesisButton.textContent=e.clearDistanceHypothesis,this.clearDistanceHypothesisButton.title=e.clearDistanceHypothesisTitle,this.refreshApparentSize(),this.labelSamplingRate.textContent=e.samplingRate,this.samplingRateInput.placeholder=String(y.DEFAULT_SAMPLE_MS),this.samplingRateInput.title=e.samplingRateHint.replace("{n}",String(y.DEFAULT_SAMPLE_MS)),this.labelDuration.textContent=e.duration,this.shadow.getElementById("label-account-view").textContent=e.accountView,this.accountViewSelect.options[0].textContent=e.accountView2d,this.accountViewSelect.options[1].textContent=e.accountView3d,this.accountViewSelect.title=e.accountViewHint,this.shadow.getElementById("label-account-compare").textContent=e.accountCompare,this.shadow.getElementById("account-compare-row").title=e.accountCompareHint;const i=this.shadow.getElementById("scene-resize");i&&(i.title=e.resizeScene,i.setAttribute("aria-label",e.resizeScene)),this.durationInput.placeholder=e.durationPlaceholder,this.durationElement.messages=e,this.addShapeButton.title=e.addShape,this.addShapeButton.setAttribute("aria-label",e.addShape),this.deleteShapeButton.title=e.deleteShape,this.deleteShapeButton.setAttribute("aria-label",e.deleteShape),this.contextGroupButton.textContent=e.group,this.contextUngroupButton.textContent=e.ungroup,this.contextDuplicateButton.textContent=e.duplicate,this.contextBringToFrontButton.textContent=e.bringToFront,this.contextSendToBackButton.textContent=e.sendToBack,this.contextDeleteButton.textContent=e.contextMenuDelete,this.exportButton.textContent=e.export,this.exportKmlButton.textContent=e.exportKml,this.exportKmlButton.title=e.exportKmlHint,this.exportGeoJsonButton.textContent=e.exportGeoJson,this.exportGeoJsonButton.title=e.exportGeoJsonHint,this.snapshotsPanel.localize(e),this.sectionFilePanel.localize(e),this.eventsPanel.localize(e.events),this.phenomenonEventsPanel.localize(e.events),this.bodiesEventsPanel.localize(e.events),this.aroundPanel.localize(e.around,{title:e.events.basisTitle,basis:e.events.basis,basisField:e.events.basisField,howField:e.events.howField,rationaleField:e.events.rationaleField}),this.shadow.getElementById("observer-identity-hint").textContent=e.identityHint,this.shadow.getElementById("identity-ask-initials").textContent=e.identityInitials,this.shadow.getElementById("identity-ask-keep").textContent=e.identityKeep,this.shadow.getElementById("identity-ask-back").textContent=e.identityBack,this.labelImportFile.textContent=e.importFile,this.shadow.getElementById("label-whole-keyframes").textContent=e.wholeKeyframes,this.wholeKeyframesInput.closest("label").title=e.wholeKeyframesHint,this.importInput.placeholder=e.importUrlPlaceholder;for(const n of this.shadow.querySelectorAll(ki))n.messages=e;this.labelObserverAge.textContent=e.observerAge,this.labelObserverBirth.textContent=e.observerBirth,this.applyPerceptionLabels(),this.labelObserverOccupation.textContent=e.observerOccupation,this.labelAccountSource.textContent=e.accountSource,De.say(this.labelAccountUrl,e.accountUrl,e.accountUrlHint),this.labelAccountFollowedUp.textContent=e.accountFollowedUp,this.evaluationFields.messages=e.accountEvaluation;for(const[n,r]of[["option-source-unknown",e.accountSourceUnknown],["option-source-on-site",e.accountSourceOnSite],["option-source-interview",e.accountSourceInterview],["option-source-telephone",e.accountSourceTelephone],["option-source-questionnaire",e.accountSourceQuestionnaire],["option-source-letter",e.accountSourceLetter],["option-source-social-media",e.accountSourceSocialMedia],["option-source-press",e.accountSourcePress],["option-followed-unknown",e.accountUnknown],["option-followed-yes",e.accountYes],["option-followed-no",e.accountNo]]){const o=this.shadow.getElementById(n);o&&(o.textContent=r)}this.labelNarrativeSource.textContent=e.narrativeSource,this.renderNarrativeSettings(),this.narrativeStopButton.textContent=e.narrativeStop,this.narrativeDraftButton.textContent=e.narrativeDraft,this.descriptionInput.placeholder=e.narrativePlaceholder,this.syncNarrativeEnabled(),this.refreshSourceRows(),this.refreshTimeZoneOptions(),this.labelPlaceName.textContent=e.placeName,this.placeNameInput.placeholder=e.placeNamePlaceholder,this.searchPlaceButton.textContent=e.searchPlace,this.labelPlaceMatch.textContent=e.placeMatch,this.labelPosition.textContent=e.positionLabel,this.observerPosition.messages=e,this.labelHeading.textContent=e.heading,this.headingInput.placeholder=e.headingPlaceholder,this.labelPitch.textContent=e.pitch,this.labelRoll.textContent=e.roll,this.labelSway.textContent=e.sway,this.swayInput.title=e.swayTitle,this.label("label-iso",e.iso),this.label("label-film-stock",e.filmStock),this.filmStockKey=void 0,this.isoInput.title=e.isoTitle,this.label("label-metering",e.metering),this.meteringSelect.title=e.meteringTitle,this.label("metering-device",e.meteringDevice),this.label("metering-average",e.meteringAverage),this.label("metering-highlights",e.meteringHighlights),this.label("label-lens-glass",e.lensGlass),this.label("label-reference-ghosts",e.referenceGhosts),this.findGhostsButton.textContent=e.referenceFindGhosts,this.syncGhostsShown(),this.label("lens-glass-none",e.lensGlassNone),this.label("lens-glass-filter",e.lensGlassFilter),this.label("lens-glass-window",e.lensGlassWindow),this.label("lens-glass-windscreen",e.lensGlassWindscreen),this.label("label-lens-drops",e.lensDrops),this.lensDropsInput.title=e.lensDropsTitle,this.label("label-lens-condensation",e.lensCondensation),this.lensCondensationInput.title=e.lensCondensationTitle,this.label("label-lens-dirt",e.lensDirt),this.lensDirtInput.title=e.lensDirtTitle,this.label("label-lens-sheltered",e.lensSheltered),this.label("label-sky-sources",e.skySources),this.skySourcesInput.closest("label").title=e.skySourcesHint,this.lensShelteredInput.title=e.lensShelteredTitle,this.labelLightPollution.textContent=e.lightPollution,this.lightPollutionInput.title=e.lightPollutionTitle,this.syncLightPollutionStatus(),this.labelElevation.textContent=e.elevation,this.labelObservationTime.textContent=e.observationTime,this.labelObservationEndTime.textContent=e.observationEndTime,this.obsTimeInput.placeholder=e.edtfPlaceholder,this.startDate.hint=e.observationTimeHint,this.obsEndTimeInput.placeholder=e.edtfPlaceholder,this.endDate.hint=e.observationEndTimeHint,this.shapeAddMenu.panel.setAttribute("aria-label",e.presetsGroupLabel),this.labelDecorGroup.textContent=e.decor,this.decorList.setKinds([{value:"building",label:e.decorBuilding},{value:"tree",label:e.decorTree},{value:"shrub",label:e.decorShrub},{value:"bridge",label:e.decorBridge},{value:"wire",label:e.decorWire},{value:"crop",label:e.decorCrop},{value:"terrace",label:e.decorTerrace},{value:"mound",label:e.decorMound},{value:"wall",label:e.decorWall},{value:"streetlight",label:e.decorStreetlight},{value:"trafficlight",label:e.decorTrafficLight},{value:"peak",label:e.decorPeak},{value:"crossing",label:e.decorCrossing},{value:"roadsign",label:e.decorRoadSign},{value:"vehicle",label:e.decorVehicle},{value:"aircraft",label:e.decorAircraft},{value:"entity",label:e.decorEntity},{value:"observer",label:e.decorObserver,hidden:!0}]),this.decorList.setLabels({list:e.decor,remove:e.deleteDecor,add:e.addDecor,empty:e.emptyDecor,actions:{"look-at-decor":e.lookAtDecor}}),this.labelSkyButtons(),this.undoButton.title=e.undo,this.undoButton.setAttribute("aria-label",e.undo),this.redoButton.title=e.redo,this.redoButton.setAttribute("aria-label",e.redo),this.contextViewAccountButton.textContent=e.viewAccount,this.labelContextMasks.textContent=`${e.masks} ▸`,this.observerList.setLabels({list:e.observerGroup,remove:e.deleteObserver,add:e.addObserver,actions:{"look-at-observer":e.lookAtDecor}}),this.refreshObserverList(),this.surroundings.setMessages(e),this.labelScenerySource.textContent=e.surveySource,this.labelSceneryRadius.textContent=e.surveyRadius,this.sceneryRadius.title=e.surveyRadiusTitle,this.scenerySource.title=e.surveySourceTitle;const s=this.shadow.getElementById("option-scenery-none");s&&(s.textContent=e.surveySourceNone),this.sceneryStatus.setAttribute("aria-label",e.surveyLabel),this.refreshSceneryWarning(),this.labelMilestones.textContent=e.milestones,this.labelMilestoneLabel.textContent=e.milestoneLabel,this.labelMilestoneNote.textContent=e.milestoneNote,this.shadow.getElementById("milestone-empty").textContent=e.emptyMilestones;for(const[n,r]of[[this.addMilestoneButton,e.addMilestone],[this.goToMilestoneButton,e.goToMilestone],[this.deleteMilestoneButton,e.deleteMilestone]])n.title=r,n.setAttribute("aria-label",r);this.decorParameterForm.setLanguage(this.language),this.decorBaseForm.setLanguage(this.language),this.decorStateForm.setLanguage(this.language),this.decorBaseShownFor=void 0,this.decorBaseShown=!1,this.decorParametersShownFor=void 0,this.isConnected&&this.syncDecorVisibility(),this.refreshDecorList(),this.labelObserverId.textContent=e.observerId,this.labelObserverTitle.textContent=e.observerTitle,this.labelObserverLastName.textContent=e.observerLastName,this.labelObserverFirstNames.textContent=e.observerFirstNames,this.observerFirstNamesInput.placeholder=e.tagsPlaceholder,this.labelSightingId.textContent=e.sightingId,this.labelDescription.textContent=e.description,this.labelTags.textContent=e.tags,this.tagsInput.placeholder=e.tagsPlaceholder,this.labelShapeGroup.textContent=e.shapeGroup,this.labelShapesSubgroup.textContent=e.shapesSubgroup,this.labelBodiesSubgroup.textContent=e.bodiesSubgroup;for(const n of this.skyParts.values())this.nameSkyPart(n.label,n.titles);for(const n of["location","decor","weather"]){const r=this.shadow.getElementById(`${n}-settings-button`);r?.setAttribute("title",e.dataSources),r?.setAttribute("aria-label",e.dataSources);const o=this.shadow.getElementById(`label-${n}-settings`);o&&(o.textContent=e.dataSources)}this.bodyEditor?.setLanguage(this.language);for(const n of this.skyParts.values())n.editor?.setLanguage(this.language);this.modulesPanel?.setLanguage(this.language),this.labelTemporalGroup.textContent=e.temporalGroup,this.labelFileGroup.textContent=e.fileGroup,this.labelLocationGroup.textContent=e.locationGroup,this.labelObservationGroup.textContent=e.observationGroup,this.labelObserverGroup.textContent=e.observerTab,this.labelWeatherGroup.textContent=e.sky,this.fitGroupTabs(),this.startDate.messages=e,this.endDate.messages=e,this.birthDate.messages=e,this.paramSummaryBuilder=new Zi(e,this.naming,this.said,this.tagNames,{messages:e,locale:this.language},this.decorParameterTexts),this.refreshParamSummary(),this.labelCloudCover.textContent=e.cloudCover,this.labelHighCloud.textContent=e.highCloudCover,this.labelIceAlignment.textContent=e.iceCrystalAlignment,this.labelRareIce.textContent=e.rareIceCrystals,this.labelFNumber.textContent=e.aperture,this.labelExposure.textContent=e.exposure,this.labelFocusDistance.textContent=e.focusDistance,this.syncOpticsFromInstrument(),this.labelCloudDarkness.textContent=e.cloudDarkness,this.labelCloudBase.textContent=e.cloudBase,this.labelPrecipitationType.textContent=e.precipitationType,this.optionPrecipitationNone.textContent=e.precipitationNone,this.optionPrecipitationRain.textContent=e.precipitationRain,this.optionPrecipitationSnow.textContent=e.precipitationSnow,this.optionPrecipitationHail.textContent=e.precipitationHail,this.labelPrecipitationIntensity.textContent=e.precipitationIntensity,this.labelWindDirection.textContent=e.windDirection,this.labelWindSpeed.textContent=e.windSpeed,this.labelStorm.textContent=e.storm,this.labelCloudsGroup.textContent=e.cloudsGroup,this.labelPrecipitationGroup.textContent=e.precipitationGroup,this.labelWindGroup.textContent=e.windGroup,this.shadow.getElementById("label-aircraft-group").textContent=e.aircraftGroup,this.aircraftFlights.show(this.sceneElement.aircraftFlights,e,!0),this.labelWeatherInferred.textContent=e.weatherInferred,this.syncWeatherSourceState(),this.labelSoundGroup.textContent=e.soundGroup,this.labelSoundKind.textContent=e.soundKind,this.labelSoundVolume.textContent=e.soundVolume,this.labelSoundPitch.textContent=e.soundPitch,this.labelSoundSrc.textContent=e.soundSrc,this.soundSrcInput.placeholder=e.soundSrcPlaceholder,this.labelReferenceGroup.textContent=e.referenceGroup,this.referenceSelect.setAttribute("aria-label",e.reference),this.shadow.getElementById("reference-empty").textContent=e.emptyReferences,this.shadow.getElementById("reference-landmark-empty").textContent=e.emptyReferenceLandmarks,this.shadow.getElementById("trace-empty").textContent=e.emptyTraces,this.labelReferenceTitle.textContent=e.referenceTitle,this.labelReferenceSrc.textContent=e.referenceSrc,this.referenceSourceInput.placeholder=e.referenceSrcPlaceholder,this.labelReferenceKind.textContent=e.referenceKind,this.referenceKindSelect.querySelector("#reference-kind-photo").textContent=e.referencePhoto,this.referenceKindSelect.querySelector("#reference-kind-panorama").textContent=e.referencePanorama,this.referenceKindSelect.querySelector("#reference-kind-video").textContent=e.referenceVideo,this.shadow.getElementById("label-reference-video-from").textContent=e.referenceVideoFrom,this.shadow.getElementById("label-reference-video-to").textContent=e.referenceVideoTo,this.shadow.getElementById("label-reference-video-rate").textContent=e.referenceVideoRate,this.referenceRemoveKeyButton.textContent=e.referenceRemoveKey,this.labelReferenceCredit.textContent=e.referenceCredit,this.labelReferenceCreditUrl.textContent=e.referenceCreditUrl,this.labelReferenceT.textContent=this.currentReference()?.kind==="video"?e.referenceVideoT:e.referenceT,this.labelReferenceDrawing.textContent=e.referenceDrawing,this.labelReferenceOpacity.textContent=e.referenceOpacity,this.labelReferenceHeading.textContent=e.referenceHeading,this.labelReferencePitch.textContent=e.referencePitch,this.labelReferenceRoll.textContent=e.referenceRoll,this.labelReferenceFov.textContent=e.referenceFov,this.referenceUsePoseButton.textContent=e.referenceUsePose,this.setReferenceAddKinds(e.addReferenceUrl,e.addReferenceFile,e.referenceStreetSearch),this.addReferenceButton.title=e.addReference,this.addReferenceButton.setAttribute("aria-label",e.addReference),this.referenceAddMenu.panel.setAttribute("aria-label",e.addReference),this.deleteReferenceButton.title=e.deleteReference,this.deleteReferenceButton.setAttribute("aria-label",e.deleteReference),this.labelReferenceLandmarks.textContent=e.referenceLandmarks,this.addReferenceLandmarkButton.title=e.addReferenceLandmark,this.addReferenceLandmarkButton.setAttribute("aria-label",e.addReferenceLandmark),this.deleteReferenceLandmarkButton.title=e.deleteReferenceLandmark,this.deleteReferenceLandmarkButton.setAttribute("aria-label",e.deleteReferenceLandmark),this.labelReferenceLandmarkLabel.textContent=e.referenceLandmarkLabel,this.referenceLandmarkLabelInput.placeholder=e.referenceLandmarkLabelPlaceholder,this.referenceAdoptPoseButton.textContent=e.referenceAdoptPose,De.say(this.labelTraceImport,e.traceImport,e.traceImportHint),this.traceSelect.setAttribute("aria-label",e.trace),this.addTraceButton.title=`${e.traceImport} (${e.traceImportHint})`,this.addTraceButton.setAttribute("aria-label",e.traceImport),this.labelTraceTitle.textContent=e.traceTitle,this.labelTraceSource.textContent=e.traceSource,this.deleteTraceButton.title=e.deleteTrace,this.deleteTraceButton.setAttribute("aria-label",e.deleteTrace),this.refreshTraceList(),this.referenceStreetAddButton.textContent=e.referenceStreetAdd;for(const[n,r]of this.soundKindOptions)r.textContent=this.soundKindLabel(n,e);this.labelInstrument.textContent=e.instrument,this.labelFilter.textContent=e.filter,this.refreshFilterOptions(),this.setRecordButtonLabel(this.isRecording),this.syncPlaybackControls(),this.labelPanels(e),this.refreshFileItems(),this.refreshSkyCandidates()}labelPanels(e){const t={identity:e.sectionIdentity,profile:e.sectionProfile,testimony:e.sectionTestimony,vision:e.sectionVision,perception:e.sectionPerception,coordinates:e.sectionCoordinates,gaze:e.sectionGaze,"night-sky":e.sectionNightSky,period:e.sectionPeriod,survey:e.sectionSurvey,heard:e.sectionHeard,"sound-recording":e.sectionSoundRecording,picture:e.sectionPicture,pose:e.sectionPose,appearance:e.sectionAppearance,size:e.sectionSize,path:e.sectionPath};for(const[s,n]of Object.entries(t))this.shadow.getElementById(`label-section-${s}`).textContent=n;this.sectionFolds.setMessages(e),this.candidatesView?.languageChanged(),this.witnessErrorView.refresh(),this.timelineTracks.setMessages(e),this.tracksToggle&&this.setTracksShown(this.tracksToggle.getAttribute("aria-expanded")==="true");for(const s of["location-settings","decor-settings","weather-settings"])Fe.popover(this.shadow.getElementById(s),e.close);Fe.dialog(this.identityAsk,e.close,()=>this.closeIdentityAsk()),Fe.dialog(this.fileAsk,e.close,()=>this.keepReadingWeather()),Fe.button(this.contextMenu,e.close,()=>this.hideContextMenu()),Fe.button(this.decorContextMenu,e.close,()=>this.hideDecorContextMenu()),this.shadow.getElementById("label-editor-kicker").textContent=e.editorKicker,this.shadow.getElementById("label-save").textContent=e.save,this.shareDialog.useLanguage(this.language).then(s=>{s&&(this.shareMessages=s,this.shadow.getElementById("label-share").textContent=s.share,this.refreshEditorHead())});const i={observation:e.panelIntroObservation,observer:e.panelIntroObserver,location:e.panelIntroLocation,temporal:e.panelIntroTemporal,decor:e.panelIntroDecor,weather:e.panelIntroWeather,shape:e.panelIntroShape,sound:e.panelIntroSound,reference:e.panelIntroReference,file:e.panelIntroFile};for(const[s,n]of Object.entries(i)){const r=this.shadow.querySelector(`[aria-controls="group-${s}"]`);r.dataset.intro=n,y.titleGroupTab(r)}this.refreshEditorHead()}onPointerDown(e){if(this.isRecording){this.onPointerMove(e);return}const t=this.canvasPointFromEvent(e);if(!t)return;const i=this.canvasMode();if(i==="picture"){this.ufoElement.playbackState!=="playing"&&this.beginReferenceDrag(t);return}if(i==="body"){if(this.ufoElement.playbackState==="playing")return;if(!this.beginBodyHandleDrag(t)&&!this.beginBodyDrag(e)){const h=this.decorMoveAxis(e)==="ground"?this.ndcOf(e):void 0,c=h?this.sceneElement.pickAt(h.x,h.y):void 0;this.beginCameraDrag(t,c?.kind==="decor"?c.id:void 0,c?.kind==="body"?c.id:void 0)}return}const s=this.decorMoveAxis(e);if(i==="decor"&&s&&this.ufoElement.playbackState!=="playing"&&this.beginDecorDrag(e,t,s))return;const n=this.ufoElement.sighting.timeline,r=this.ufoElement.currentTime,o=this.ufoElement.playbackState==="playing",l=i==="shape";if(l)if(this.selectedSourceIds.size>1){const h=new ei(this.selectedMembers()),c=Y.hitTestHandle({bounds:h.bounds(),angle:0},t);if(c==="rotate"){if(o)return;this.dragState={kind:"group-rotate",group:h,startPointer:t},this.startDragListening();return}if(c){if(o)return;this.dragState={kind:"group-resize",group:h,handle:c},this.startDragListening();return}}else{const h=n.getInterpolatedShapeAt(r,this.currentSourceId),c=h?.kind==="polygon"?Y.hitTestVertex(h,t):void 0;if(h?.kind==="polygon"&&c!==void 0){if(o)return;this.dragState={kind:"vertex",sourceId:this.currentSourceId,original:h,vertexIndex:c},this.startDragListening();return}const u=h&&Y.hitTestHandle(h,t);if(h&&u){if(o)return;this.beginDrag(u==="rotate"?"rotate":"resize",this.currentSourceId,h,t,u);return}}const a=this.ufoElement.shapeAt(t.x,t.y,xt);if(!a){const h=s==="ground"?this.ndcOf(e):void 0,c=h?this.sceneElement.pickAt(h.x,h.y):void 0;if(c?.kind==="body"&&c.id!==void 0){o?this.showBody(c.id):this.beginCameraDrag(t,void 0,c.id);return}const u=c?.kind==="decor"?c.id:void 0;if(u!==void 0){o?(this.selectDecor(u),this.revealDecorPanel()):this.beginCameraDrag(t,u);return}o||this.beginCameraDrag(t);return}if(this.revealShapePanel(),this.flash(this.shapeTitleInput.closest("label")),e.shiftKey?this.toggleUnitSelection(a.sourceId):this.selectedSourceIds.has(a.sourceId)||this.selectUnit(a.sourceId),o||!l)return;const d=[...this.selectedSourceIds].map(h=>({sourceId:h,original:h===a.sourceId?a.shape:n.getInterpolatedShapeAt(r,h)??a.shape}));this.dragState={kind:"move",sources:d,startPointer:t},this.startDragListening()}showBody(e){if(this.fileSyncActive()){this.showInFile(this.bodyPath(e));return}this.revealShapePanel();const t=this.subgroupTabs.find(i=>i.getAttribute("aria-controls")==="shape-bodies");t&&this.openSubgroup(t),this.loadBodyEditor().then(i=>i.show(e))}revealDecorPanel(){if(this.fileSyncActive()){this.fileFocus="decor",this.syncCanvasMode();return}const e=this.groupTabs.find(t=>t.getAttribute("aria-controls")==="group-decor");e&&this.toggleGroup(e,!0)}revealShapePanel(){if(this.fileSyncActive()){this.fileFocus="shape",this.syncCanvasMode();return}const e=this.groupTabs.find(i=>i.getAttribute("aria-controls")==="group-shape");e&&this.toggleGroup(e,!0);const t=this.subgroupTabs.find(i=>i.getAttribute("aria-controls")==="shape-shapes");t&&this.openSubgroup(t)}selectedMembers(){const e=this.ufoElement.sighting.timeline,t=this.ufoElement.currentTime;return[...this.selectedSourceIds].map(i=>({sourceId:i,shape:e.getInterpolatedShapeAt(t,i)})).filter(i=>!!i.shape)}selectUnit(e){const t=this.ufoElement.sighting.timeline.groupMembers(e)??[e];t.length===this.selectedSourceIds.size&&t.every(i=>this.selectedSourceIds.has(i))&&e===this.currentSourceId||(this.selectedSourceIds=new Set(t),this.currentSourceId=e,this.isGroupIdOpen("group-file")&&(this.fileFocus="shape"),this.refreshSourceList(),this.onSelectionOrTimeChanged(),this.showInFile(this.shapePath(e)))}toggleUnitSelection(e){const t=this.ufoElement.sighting.timeline,i=t.groupMembers(e)??[e];if(i.every(n=>this.selectedSourceIds.has(n))){if(i.length>=this.selectedSourceIds.size)return;for(const n of i)this.selectedSourceIds.delete(n);if(!this.selectedSourceIds.has(this.currentSourceId)){const n=t.sourceIds;this.currentSourceId=[...this.selectedSourceIds].sort((r,o)=>n.indexOf(r)-n.indexOf(o)).pop()}}else{for(const n of i)this.selectedSourceIds.add(n);this.currentSourceId=e}this.refreshSourceList(),this.onSelectionOrTimeChanged()}onContextMenu(e){if(e.preventDefault(),this.isRecording||this.ufoElement.playbackState==="playing")return;this.hideContextMenu(),this.hideDecorContextMenu();const t=this.canvasPointFromEvent(e);if(!t)return;const i=this.ufoElement.sighting.timeline,s=this.ufoElement.currentTime,n=this.selectedSourceIds.size===1?i.getInterpolatedShapeAt(s,this.currentSourceId):void 0,o=n?.kind==="polygon"&&Y.hitTestVertex(n,t)!==void 0?{sourceId:this.currentSourceId,shape:n}:this.ufoElement.shapeAt(t.x,t.y,xt);if(o){this.selectedSourceIds.has(o.sourceId)||this.selectUnit(o.sourceId),this.currentSourceId=o.sourceId,this.contextMenuPoint=t,this.showContextMenu(e.clientX,e.clientY);return}const l=this.pickDecorAt(e),a=l?this.ufoElement.sighting.decor.find(d=>d.id===l):void 0;a&&this.showDecorContextMenu(e.clientX,e.clientY,a)}pickDecorAt(e){const i=this.ufoElement.canvasElement.getBoundingClientRect();if(i.width===0||i.height===0)return;const s=(e.clientX-i.left)/i.width*2-1,n=-((e.clientY-i.top)/i.height*2-1);return this.sceneElement.pickDecorAt(s,n)}showContextMenu(e,t){this.contextMenu.style.left=`${e}px`,this.contextMenu.style.top=`${t}px`,this.contextMenu.hidden=!1;const i=this.ufoElement.sighting.timeline.sourceIds,s=i.filter(u=>this.selectedSourceIds.has(u)),n=i.length<=s.length,r=s.length>0&&i.slice(i.length-s.length).every(u=>this.selectedSourceIds.has(u)),o=s.length>0&&i.slice(0,s.length).every(u=>this.selectedSourceIds.has(u));this.contextBringToFrontButton.disabled=n||r,this.contextSendToBackButton.disabled=n||o,this.contextBringToFrontButton.title=n?this.messages.onlyOneShape:r?this.messages.alreadyAtFront:"",this.contextSendToBackButton.title=n?this.messages.onlyOneShape:o?this.messages.alreadyAtBack:"",this.contextGroupButton.disabled=this.selectedSourceIds.size<2,this.contextGroupButton.title=this.contextGroupButton.disabled?this.messages.needTwoShapesToGroup:"";const l=this.ufoElement.sighting.timeline.groupMembers(this.currentSourceId)!==void 0;this.contextUngroupButton.disabled=!l,this.contextUngroupButton.title=l?"":this.messages.notGrouped,this.contextDuplicateButton.disabled=this.deleteShapeButton.disabled,this.contextDeleteButton.disabled=this.deleteShapeButton.disabled,this.contextDeleteButton.title="";const a=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(this.ufoElement.currentTime,this.currentSourceId),d=this.selectedSourceIds.size===1&&a?.kind==="polygon";this.contextAddVertexButton.disabled=!d,this.contextAddVertexButton.title=d?"":this.messages.notAPolygon;const h=d&&this.contextMenuPoint?Y.hitTestVertex(a,this.contextMenuPoint):void 0,c=d&&a.points.length<=xn;this.contextDeleteVertexButton.disabled=!d||h===void 0||c,this.contextDeleteVertexButton.title=d?c?this.messages.tooFewVertices:"":this.messages.notAPolygon,document.addEventListener("click",this.handleOutsideContextMenuClick)}hideContextMenu(){this.contextMenu.hidden=!0,this.contextMenuPoint=void 0,document.removeEventListener("click",this.handleOutsideContextMenuClick)}handleOutsideContextMenuClick=e=>{e.composedPath().includes(this.contextMenu)||e.composedPath().includes(this.decorContextMenu)||(this.hideContextMenu(),this.hideDecorContextMenu())};showDecorContextMenu(e,t,i){this.contextMenuDecorId=i.id,this.decorContextMenu.style.left=`${e}px`,this.decorContextMenu.style.top=`${t}px`,this.decorContextMenu.hidden=!1,this.contextViewAccountButton.disabled=!i.sightingUrl,this.contextViewAccountButton.title=i.sightingUrl?"":this.messages.noObserverRecording,this.refreshContextMasksSubmenu(i),document.addEventListener("click",this.handleOutsideContextMenuClick)}hideDecorContextMenu(){this.decorContextMenu.hidden=!0,this.contextMenuDecorId=void 0,document.removeEventListener("click",this.handleOutsideContextMenuClick)}refreshContextMasksSubmenu(e){this.contextMasksSubmenu.innerHTML="";const t=[...this.ufoElement.sighting.timeline.sourceIds],i=this.ufoElement.sighting.interpretation?.bodies??[];if(t.length===0&&i.length===0){const s=document.createElement("span");s.className="submenu-empty",s.textContent=this.messages.masksNone,this.contextMasksSubmenu.appendChild(s)}for(const s of t){const n=document.createElement("label"),r=document.createElement("input");r.type="checkbox",r.checked=e.occludesSourceIds?.includes(s)??!1,r.addEventListener("change",()=>this.updateDecorOccludesShape(e.id,s,r.checked)),n.appendChild(r),n.appendChild(document.createTextNode(this.shapeLabel(s))),this.contextMasksSubmenu.appendChild(n)}for(const s of i){const n=this.sceneElement.bodyMaskedBy(s.id,e.id);if(n===void 0)continue;const r=document.createElement("span");r.className="submenu-empty submenu-fact";const o=this.said.read(s.title)??s.id,l=this.messages;r.textContent=`${o} — ${n>=.995?l.masksBodyFully:n>.005?l.masksBodyPartly.replace("{share}",String(Math.round(n*100))):l.masksBodyNot}`,this.contextMasksSubmenu.appendChild(r)}}updateDecorOccludesShape(e,t,i){const s=this.ufoElement.sighting;s.decor=s.decor.map(n=>{if(n.id!==e)return n;const r=i?[...new Set([...n.occludesSourceIds??[],t])]:(n.occludesSourceIds??[]).filter(o=>o!==t);return{...n,occludesSourceIds:r.length>0?r:void 0}}),this.ufoElement.refresh()}viewObserverAccount(){const e=this.ufoElement.sighting.decor.find(t=>t.id===this.contextMenuDecorId);this.hideDecorContextMenu(),e?.sightingUrl&&this.importFromUrl(e.sightingUrl)}addVertexAtContextMenu(){const e=this.contextMenuPoint;if(this.hideContextMenu(),!e)return;const t=this.ufoElement.currentTime,i=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(t,this.currentSourceId);if(i?.kind!=="polygon")return;const s=Y.insertVertexNear(i,e);this.commitShapes(t,[{sourceId:this.currentSourceId,shape:s}]),this.ufoElement.refresh()}deleteVertexAtContextMenu(){const e=this.contextMenuPoint;if(this.hideContextMenu(),!e)return;const t=this.ufoElement.currentTime,i=this.ufoElement.sighting.timeline.getInterpolatedShapeAt(t,this.currentSourceId);if(i?.kind!=="polygon")return;const s=Y.hitTestVertex(i,e);if(s===void 0)return;const n=Y.deleteVertex(i,s);this.commitShapes(t,[{sourceId:this.currentSourceId,shape:n}]),this.ufoElement.refresh()}bringSelectedToFront(){const e=this.ufoElement.sighting.timeline;for(const t of e.sourceIds.filter(i=>this.selectedSourceIds.has(i)))e.bringToFront(t);this.hideContextMenu(),this.ufoElement.refresh()}sendSelectedToBack(){const e=this.ufoElement.sighting.timeline;for(const t of e.sourceIds.filter(i=>this.selectedSourceIds.has(i)).reverse())e.sendToBack(t);this.hideContextMenu(),this.ufoElement.refresh()}groupSelected(){this.selectedSourceIds.size<2||(this.ufoElement.sighting.timeline.group([...this.selectedSourceIds]),this.hideContextMenu(),this.ufoElement.refresh())}ungroupSelected(){this.ufoElement.sighting.timeline.ungroup(this.currentSourceId),this.selectedSourceIds=new Set([this.currentSourceId]),this.hideContextMenu(),this.ufoElement.refresh()}beginDrag(e,t,i,s,n){this.dragState={kind:e,sourceId:t,original:i,handle:n,startPointer:s},this.startDragListening()}ndcOf(e){const t=this.ufoElement.canvasElement.getBoundingClientRect();if(!(t.width===0||t.height===0))return{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}skyDirectionOf(e){const t=this.ndcOf(e);if(!t)return;const i=this.sceneElement.directionAt(t.x,t.y);return{azimuthDeg:(Math.atan2(i.x,-i.z)*180/Math.PI+360)%360,altitudeDeg:Math.asin(Math.max(-1,Math.min(1,i.y)))*180/Math.PI}}beginBodyDrag(e){const t=this.ndcOf(e),i=this.bodyEditor,s=t&&i?this.sceneElement.pickPlacedBodyAt(t.x,t.y):void 0;if(!s||!i)return!1;i.show(s);const n=i.readingNow(),r=this.skyDirectionOf(e);return!n||!r?!1:(this.dragState={kind:"body",pointerAzimuthDeg:r.azimuthDeg,pointerAltitudeDeg:r.altitudeDeg,bodyAzimuthDeg:n.azimuthDeg,bodyAltitudeDeg:n.altitudeDeg},this.setCanvasCursor("move"),this.startDragListening(),!0)}onBodyDragPointerMove(e){const t=this.dragState;if(t?.kind!=="body")return;const i=this.skyDirectionOf(e);if(!i)return;const s=(i.azimuthDeg-t.pointerAzimuthDeg+540)%360-180;this.bodyEditor?.dragTo(t.bodyAzimuthDeg+s,t.bodyAltitudeDeg+i.altitudeDeg-t.pointerAltitudeDeg)}bodyCanvasBounds(){const e=this.bodyEditor?.currentBodyId;return this.canvasBoundsOf(e===void 0?void 0:this.sceneElement.bodyScreenBox(e))}canvasBoundsOf(e){if(!e)return;const t=this.ufoElement.canvasElement,i=Math.max(It,(e.maxX-e.minX)/2*t.width),s=Math.max(It,(e.maxY-e.minY)/2*t.height),n=((e.minX+e.maxX)/2+1)/2*t.width,r=(1-(e.minY+e.maxY)/2)/2*t.height;return this.withinReach({x:n-i/2,y:r-s/2,width:i,height:s})}withinReach(e){const t=this.ufoElement.canvasElement,i=t.getBoundingClientRect(),s=i.height>0?t.height/i.height:1,r=[this.shadow.querySelector(".playback-row"),this.ufoElement.shadowRoot?.querySelector(".controls")].map(m=>m?.getBoundingClientRect()).filter(m=>m!==void 0&&m.height>0&&m.top<i.bottom&&m.bottom>i.top).reduce((m,f)=>Math.max(m,(i.bottom-f.top)*s),0),o=Tt,l=Tt+jr,a=t.width-Tt,d=t.height-r-Tt,h=Math.max(e.x,o),c=Math.max(e.y,l),u=Math.min(e.x+e.width,a),p=Math.min(e.y+e.height,d);return u-h<It||p-c<It?e:{x:h,y:c,width:u-h,height:p-c}}paintBodyOverlay=e=>{const t=this.bodyCanvasBounds();t&&e.paintGroupHandles(t)};beginFrameDrag(e,t){const i=e.bounds(),s=e.reading();if(!i||!s)return!1;const n=Y.hitTestHandle({bounds:i,angle:0},t);if(!n)return!1;if(n==="rotate")this.dragState={kind:"frame-rotate",target:e,startPointer:t,startAttitude:{...s.attitude}};else{const r={x:i.x+i.width/2,y:i.y+i.height/2};this.dragState={kind:"frame-resize",target:e,handle:n,centre:r,startPointer:t,startSizeM:{...s.sizeM}}}return this.setCanvasCursor(this.cursorForHandle(n,0)),this.startDragListening(),!0}beginBodyHandleDrag(e){return this.beginFrameDrag(this.bodyFrame,e)}onFrameDragPointerMove(e){const t=this.dragState,i=this.canvasPointFromEvent(e);if(!i||!t)return;if(t.kind==="frame-rotate"){const c=(i.x-t.startPointer.x)*t.target.rotateDegPerPx,u=(t.startPointer.y-i.y)*t.target.rotateDegPerPx,p=t.startAttitude;t.target.turnTo(e.shiftKey?{headingDeg:p.headingDeg,pitchDeg:p.pitchDeg+u,rollDeg:p.rollDeg+c}:{headingDeg:p.headingDeg+c,pitchDeg:p.pitchDeg,rollDeg:p.rollDeg});return}if(t.kind!=="frame-resize")return;const{centre:s,startPointer:n,startSizeM:r,handle:o}=t,l=(c,u)=>Math.max(.05,Math.abs(c)/Math.max(1,Math.abs(u))),a=o==="e"||o==="w",d=o==="n"||o==="s",h=a?l(i.x-s.x,n.x-s.x):d?l(i.y-s.y,n.y-s.y):l(Math.hypot(i.x-s.x,i.y-s.y),Math.hypot(n.x-s.x,n.y-s.y));t.target.resize({widthM:d?r.widthM:r.widthM*h,lengthM:d?r.lengthM:r.lengthM*h,heightM:a?r.heightM:r.heightM*h})}bodyFrame={bounds:()=>this.bodyCanvasBounds(),reading:()=>this.bodyEditor?.readingNow(),resize:e=>this.bodyEditor?.resize(e),turnTo:e=>this.bodyEditor?.turnTo(e),rotateDegPerPx:oi};decorFrame={bounds:()=>this.decorCanvasBounds(),reading:()=>this.decorReading(),resize:e=>this.commitDecorBase(t=>{Object.assign(t,{sizeM:{widthM:this.roundedMeters(e.widthM),lengthM:this.roundedMeters(e.lengthM),heightM:this.roundedMeters(e.heightM)}})},"sizeM.widthM"),turnTo:e=>this.commitDecorBase(t=>{t.headingDeg=this.rounded((e.headingDeg%360+360)%360)},"headingDeg"),rotateDegPerPx:Zr};decorReading(){const e=this.editableDecor();if(e===void 0)return;const t=Hi.naturalSize(e.kind,e.floors);return{sizeM:{widthM:e.sizeM?.widthM??t.widthM??1,lengthM:e.sizeM?.lengthM??t.lengthM??1,heightM:e.sizeM?.heightM??t.heightM??1},attitude:{headingDeg:et.viewOf(e,this.ufoElement.currentTime).headingDeg,pitchDeg:0,rollDeg:0}}}onBodyWheel(e){if(this.canvasMode()!=="body"||this.ufoElement.playbackState==="playing")return;const t=this.ndcOf(e),i=this.bodyEditor,s=t&&i?this.sceneElement.pickPlacedBodyAt(t.x,t.y):void 0;!s||!i||(e.preventDefault(),i.show(s),i.scaleDistance(Math.exp(Math.sign(e.deltaY)*.1)))}editableDecor(){const e=this.ufoElement.sighting.decor.find(t=>t.id===this.currentDecorId);return e&&e.observerSide===void 0?e:void 0}decorCanvasBounds(){const e=this.editableDecor();return e?this.canvasBoundsOf(this.sceneElement.decorScreenBox(e.id)):void 0}paintDecorOverlay=e=>{const t=this.decorCanvasBounds();t&&e.paintGroupHandles(t)};decorMoveAxis(e){if(!(e.metaKey||[e.shiftKey,e.altKey,e.ctrlKey].filter(Boolean).length>1))return e.shiftKey?"east":e.altKey?"north":e.ctrlKey?"up":"ground"}grabsDecor(e,t,i){const s=this.pickDecorAt(e);if(s===i.id)return!0;const n=this.decorCanvasBounds();return n!==void 0&&t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height?s===void 0||this.ufoElement.sighting.decor.find(o=>o.id===s)?.kind==="terrace":!1}beginDecorDrag(e,t,i){const s=this.editableDecor();if(!s)return!1;if(this.beginFrameDrag(this.decorFrame,t))return!0;if(this.ufoElement.shapeAt(t.x,t.y,xt)||!this.grabsDecor(e,t,s))return!1;const n=this.ndcOf(e),r=et.viewOf(this.placedByAuthor(s),this.ufoElement.currentTime),o=n?this.sceneElement.decorGrabHeightAt?.(s.id,n.x,n.y)??0:0,l=n&&this.sceneElement.decorGroundPointAt(s.id,n.x,n.y,o);return!n||!l?!1:(this.dragState={kind:"decor-move",id:s.id,startGround:l,grabHeightM:o,axis:i,startAltitudeM:r.altitudeM,startNdcY:n.y,metresPerNdcY:this.sceneElement.decorMetresPerNdcY?.(s.id)??0,startEastM:r.eastM,startNorthM:r.northM},this.setCanvasCursor("move"),this.startDragListening(),!0)}onDecorMovePointerMove(e){const t=this.dragState;if(t?.kind!=="decor-move")return;const i=this.ndcOf(e);if(!i)return;const s=this.sceneElement.decorGroundPointAt(t.id,i.x,i.y,t.grabHeightM);!s&&t.axis!=="up"||this.commitDecorBase(n=>{s&&(t.axis==="ground"||t.axis==="east")&&(n.eastM=this.roundedMeters(t.startEastM+s.x-t.startGround.x)),s&&(t.axis==="ground"||t.axis==="north")&&(n.northM=this.roundedMeters(t.startNorthM-(s.z-t.startGround.z))),t.axis==="up"&&(n.altitudeM=this.roundedMeters(t.startAltitudeM+(i.y-t.startNdcY)*t.metresPerNdcY))},"eastM")}beginCameraDrag(e,t,i){const s=this.isObserverInsideDecor();this.cameraDragState={pressedDecorId:t,pressedBodyId:i,moved:!1,startPointer:e,startHeadingDeg:s?this.indoorLookYawDeg:this.numberOrUndefined(this.headingInput.value)??0,startPitchDeg:s?this.indoorLookPitchDeg:this.numberOrUndefined(this.pitchInput.value)??0,insideDecor:s},this.setCanvasCursor("panning"),this.startDragListening()}isObserverInsideDecor(){return this.ufoElement.sighting.decor.some(e=>e.observerSide!==void 0&&ts(e.kind))}syncIndoorLookReset(){const e=this.ufoElement.sighting.decor.find(i=>i.observerSide!==void 0&&ts(i.kind)),t=e?`${e.id}:${e.observerSide}`:void 0;t!==this.lastInhabitedKey&&(this.lastInhabitedKey=t,this.indoorLookYawDeg=0,this.indoorLookPitchDeg=0,this.sceneElement.setIndoorLook(0,0))}startDragListening(){document.addEventListener("pointermove",this.handleDragPointerMove),document.addEventListener("pointerup",this.handleDragPointerUp)}onDragPointerMove(e){if(this.referenceDragState){this.onReferenceDragPointerMove(e);return}if(this.dragState?.kind==="body"){this.onBodyDragPointerMove(e);return}if(this.dragState?.kind==="frame-resize"||this.dragState?.kind==="frame-rotate"){this.onFrameDragPointerMove(e);return}if(this.dragState?.kind==="decor-move"){this.onDecorMovePointerMove(e);return}if(this.cameraDragState){this.onCameraDragPointerMove(e);return}if(!this.dragState)return;const t=this.canvasPointFromEvent(e);if(!t)return;const i=this.ufoElement.currentTime;if(this.dragState.kind==="move"){const{sources:s,startPointer:n}=this.dragState,r=t.x-n.x,o=t.y-n.y,l=s.map(({sourceId:a,original:d})=>({sourceId:a,shape:{...d,bounds:{...d.bounds,x:d.bounds.x+r,y:d.bounds.y+o}}}));this.commitShapes(i,l)}else if(this.dragState.kind==="group-resize"){const{group:s,handle:n}=this.dragState;this.commitShapes(i,s.resize(n,t))}else if(this.dragState.kind==="group-rotate"){const{group:s,startPointer:n}=this.dragState;this.commitShapes(i,s.rotate(t,n))}else if(this.dragState.kind==="vertex"){const{sourceId:s,original:n,vertexIndex:r}=this.dragState,o=Y.moveVertex(n,r,t);this.commitShapes(i,[{sourceId:s,shape:o}])}else{const{kind:s,sourceId:n,original:r,handle:o}=this.dragState,l=s==="resize"?Y.resizeShape(r,o,t):Y.rotateShape(r,t);this.commitShapes(i,[{sourceId:n,shape:l}])}this.ufoElement.refresh()}onCameraDragPointerMove(e){if(!this.cameraDragState)return;const t=this.canvasPointFromEvent(e);if(!t)return;const{startPointer:i,startHeadingDeg:s,startPitchDeg:n,insideDecor:r}=this.cameraDragState;if(!this.cameraDragState.moved){if(Math.hypot(t.x-i.x,t.y-i.y)<Yr)return;this.cameraDragState.moved=!0}const o=s+(t.x-i.x)*oi,l=Math.max(-90,Math.min(90,n-(t.y-i.y)*oi));if(r){this.indoorLookYawDeg=o,this.indoorLookPitchDeg=l,this.sceneElement.setIndoorLook(o,l),this.ufoElement.refresh();return}this.headingInput.value=String(this.rounded(o)),this.pitchInput.value=String(this.rounded(l)),this.updateObserver(),this.rounded(o)!==this.rounded(s)&&(this.cameraDragState.headingTurned=!0),this.rounded(l)!==this.rounded(n)&&(this.cameraDragState.pitchTurned=!0),this.showOrientation(this.cameraDragState.headingTurned?o:void 0,this.cameraDragState.pitchTurned?l:void 0),this.showViewDragHint(e.altKey);const a=this.ufoElement.sighting.observerTrack,d=this.ufoElement.currentTime,h=a.allKeyframes.find(c=>c.t===d);h&&h.viewOnly===!0!==e.altKey&&(a.setViewOnly(d,e.altKey),this.ufoElement.refresh())}showViewDragHint(e){const t=this.shadow.getElementById("view-drag-hint");t&&(t.hidden=e===void 0,e!==void 0&&(t.textContent=e?this.messages.viewDragHintHeld:this.messages.viewDragHint,t.toggleAttribute("data-held",e)))}endDrag(){if(this.referenceDragState){this.endReferenceDrag();return}if(!this.dragState&&!this.cameraDragState)return;const e=this.cameraDragState&&!this.cameraDragState.insideDecor;this.showViewDragHint(void 0),this.dragState=void 0,this.cameraDragState=void 0,e&&this.refreshSceneField(),this.setCanvasCursor(this.hoverCursor),document.removeEventListener("pointermove",this.handleDragPointerMove),document.removeEventListener("pointerup",this.handleDragPointerUp)}walkOrTurn(e){if(e.preventDefault(),this.isRecording||this.ufoElement.playbackState==="playing"||this.isObserverInsideDecor())return;const t=e.shiftKey?io:1,i=this.numberOrUndefined(this.headingInput.value)??0;if(e.key==="ArrowLeft"||e.key==="ArrowRight"){this.headingInput.value=String(this.rounded(i+(e.key==="ArrowRight"?1:-1)*to*t)),this.updateObserver();return}const s=this.numberOrUndefined(this.latInput.value),n=this.numberOrUndefined(this.lngInput.value);if(s===void 0||n===void 0)return;const r=(e.key==="ArrowUp"?1:-1)*eo*t,o=i*Math.PI/180,l=Ys(Math.sin(o)*r,-Math.cos(o)*r,s,n);this.latInput.value=l.lat.toFixed(7),this.lngInput.value=l.lng.toFixed(7);const a=this.plantingCentre();this.updateObserver(),this.keepDecorInPlace(a,this.plantingCentre()),this.surroundings.walked(l.lat,l.lng,i)}keepDecorInPlace(e,t){if(!e||!t)return;const i=ys(t.lat,t.lng,e.lat,e.lng),s=i.x,n=-i.z;if(Math.hypot(s,n)<1e-6)return;const r=(l,a)=>Math.round((l-a)*1e3)/1e3,o=this.ufoElement.sighting;o.decor=o.decor.map(l=>({...l,eastM:r(l.eastM,s),northM:r(l.northM,n),...l.track?{track:l.track.map(a=>({...a,eastM:r(a.eastM,s),northM:r(a.northM,n)}))}:{}})),this.ufoElement.refresh()}nudgeBounds(e,t){const i={...e};if(t.shiftKey){switch(t.key){case"ArrowLeft":i.width=Math.max(Yi,i.width-Re);break;case"ArrowRight":i.width+=Re;break;case"ArrowUp":i.height=Math.max(Yi,i.height-Re);break;case"ArrowDown":i.height+=Re;break}i.x-=(i.width-e.width)/2,i.y-=(i.height-e.height)/2}else switch(t.key){case"ArrowLeft":i.x-=Re;break;case"ArrowRight":i.x+=Re;break;case"ArrowUp":i.y-=Re;break;case"ArrowDown":i.y+=Re;break}return i}moveOrResizeSelectedShapes(e){if(this.isRecording||this.ufoElement.playbackState==="playing")return;const t=this.ufoElement.currentTime,i=this.selectedMembers();if(i.length!==0){if(e.preventDefault(),i.length===1){const{sourceId:s,shape:n}=i[0];this.commitShapes(t,[{sourceId:s,shape:{...n,bounds:this.nudgeBounds(n.bounds,e)}}])}else{const s=new ei(i),n=this.nudgeBounds(s.bounds(),e);this.commitShapes(t,s.scaleTo(n))}this.ufoElement.refresh()}}updateHoverCursor(e){this.isRecording||this.dragState||this.cameraDragState||(this.hoverCursor=this.hoverCursorAt(e),this.setCanvasCursor(this.hoverCursor))}hoverCursorAt(e){const t=this.canvasPointFromEvent(e);if(!t)return;const i=this.canvasMode(),s=this.ufoElement.sighting.timeline,n=this.ufoElement.currentTime,r=this.ufoElement.playbackState!=="playing";if(i==="picture")return r?"pan":void 0;if(i==="body"){const l=r?this.bodyCanvasBounds():void 0,a=l&&Y.hitTestHandle({bounds:l,angle:0},t);if(a)return this.cursorForHandle(a,0);const d=this.ndcOf(e),h=d&&this.bodyEditor?this.sceneElement.pickPlacedBodyAt(d.x,d.y):void 0;return r&&h?"move":r?"pan":void 0}if(i==="decor"&&r&&this.decorMoveAxis(e)){const l=this.decorCanvasBounds(),a=l&&Y.hitTestHandle({bounds:l,angle:0},t);if(a)return this.cursorForHandle(a,0);const d=this.editableDecor();if(d&&!this.ufoElement.shapeAt(t.x,t.y,xt)&&this.grabsDecor(e,t,d))return"move"}const o=i==="shape";if(r&&o)if(this.selectedSourceIds.size>1){const l=Y.hitTestHandle({bounds:new ei(this.selectedMembers()).bounds(),angle:0},t);if(l)return this.cursorForHandle(l,0)}else{const l=s.getInterpolatedShapeAt(n,this.currentSourceId);if(l?.kind==="polygon"&&Y.hitTestVertex(l,t)!==void 0)return"vertex";const a=l&&Y.hitTestHandle(l,t);if(l&&a)return this.cursorForHandle(a,l.angle)}return s.hitTest(n,t.x,t.y)?r&&o?"move":"select":this.pickDecorAt(e)!==void 0?r?"pan":"select":r?"pan":void 0}cursorForHandle(e,t){return e==="rotate"?"rotate":`resize-${Y.resizeAxisFor(e,t)}`}setCanvasCursor(e){const t=this.ufoElement.canvasElement;e?t.dataset.cursor=e:delete t.dataset.cursor}onPointerMove(e){if(!this.isRecording){this.updateHoverCursor(e);return}const t=this.ufoElement.canvasElement,i=t.getBoundingClientRect(),s=e.clientX-i.left,n=e.clientY-i.top;this.recorder?.onPointerMove(s,n),this.ufoElement.renderer.clear(t.width,t.height),this.ufoElement.renderer.paintShape(Ls(this.buildPrototype({x:0,y:0,width:Ve.width,height:Ve.height}),s,n))}canvasPointFromEvent(e){const t=this.ufoElement.canvasElement,i=t.getBoundingClientRect();if(!(i.width===0||i.height===0))return{x:(e.clientX-i.left)/i.width*t.width,y:(e.clientY-i.top)/i.height*t.height}}}const ao={established:"narrativeStated",measured:"narrativeStated",stated:"narrativeStated",derived:"narrativeDerived",assumed:"narrativeAssumed",fitted:"narrativeAssumed"},vs="rr0-sighting-editor";function zs(){Cs(),Es(),Us(),mr(),ur(),br(),Ts(),customElements.get(vs)||customElements.define(vs,y)}const fi="rr0-case-editor",lo=`
2684
+ <style>
2685
+ /* What the layout adapts to: the width this editor is given, never the window's. */
2686
+ :host { display: block; container-type: inline-size; }
2687
+ /* Hidden while a reader shows what it holds (see ReadEditSwitch): the display above would otherwise keep it on show. */
2688
+ :host([hidden]) { display: none; }
2689
+ ${Fe.CSS}
2690
+ /* The colours of the file's text editor (see SightingFileEditor): a key, a string, a number or a word, and a mistake. Dark mode redefines them. */
2691
+ :host { --file-key: #1a5fb4; --file-string: #26662f; --file-literal: #a5321f; --rr0-alert: #c33; }
2692
+ @media (prefers-color-scheme: dark) { :host { --file-key: #8cb8ff; --file-string: #8fd39a; --file-literal: #ffa08a; } }
2693
+ [hidden] { display: none !important; }
2694
+ /* The case, above: what it is, then its observations and what is done with them. */
2695
+ /* The case is the container the element stands in (the page's own frame, when there is one): it draws none of its own, so that
2696
+ there is one container for the case and one inside it for the observation. */
2697
+ .case-panel { margin-bottom: .6em; }
2698
+ .case-panel h2 { margin: 0 0 .4em; font-size: 1.05em; }
2699
+ .case-panel h3 { margin: .6em 0 .3em; font-size: .95em; }
2700
+ .row { display: flex; align-items: center; gap: .5em; flex-wrap: wrap; margin-bottom: .5em; }
2701
+ .row label, .row .field { display: flex; align-items: center; gap: .4em; }
2702
+ rr0-date-input { display: inline-flex; align-items: center; gap: .3em; flex-wrap: wrap; }
2703
+ .row.recordings label { flex: 1 1 14em; min-width: 0; }
2704
+ .row.recordings select { flex: 1 1 auto; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
2705
+ .row button { white-space: nowrap; }
2706
+ .make-case { margin: .5em 0 0; }
2707
+ button.link { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
2708
+ .icon-btn { width: 1.8em; height: 1.8em; padding: 0; line-height: 1; cursor: pointer; }
2709
+ /* The observation being edited, inside: a frame of its own once there is a case around it. */
2710
+ /* The event picked, in the frame every list of the editor puts its picked element in (see ElementList): its id, then the observation
2711
+ or the interview. A recording alone, not in a case, has no list and no frame. */
2712
+ #event-item { display: block; }
2713
+ #event-item:not(.in-case) { border: 0; padding: 0; margin: 0; }
2714
+ .event-id-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: .5em; }
2715
+ .event-id-row[hidden] { display: none; }
2716
+ .event-id-row > .history-slot { margin-left: auto; }
2717
+ .history-slot[hidden] { display: none; }
2718
+ .history-slot .history { display: inline-flex; gap: 8px; }
2719
+ .history-slot .history .icon-btn { box-sizing: border-box; width: 36px; height: 36px; min-width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
2720
+ .history-slot .history .icon-btn:disabled { opacity: .35; cursor: default; }
2721
+ /* Tabs as the recording's editor has them (see sightingEditorTemplate): a strip on one baseline, the open tab raised and joined to its panel. */
2722
+ .group-tabs { --tab-line: color-mix(in srgb, CanvasText 35%, transparent); --tab-surface: color-mix(in srgb, CanvasText 5%, Canvas);
2723
+ --tab-recessed: color-mix(in srgb, CanvasText 11%, Canvas); --tab-accent: #4a9eff;
2724
+ display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0; margin: 0; padding: 0; border-bottom: 1px solid var(--tab-line); }
2725
+ .group-tab { -webkit-user-select: none; user-select: none; font: inherit; font-weight: 600; cursor: pointer; color: color-mix(in srgb, CanvasText 70%, transparent); background: var(--tab-recessed);
2726
+ border: 1px solid var(--tab-line); border-radius: 8px 8px 0 0; padding: .4em .6em; margin: 0 0 -1px -1px; position: relative; }
2727
+ .group-tab:hover { color: CanvasText; background: color-mix(in srgb, CanvasText 16%, Canvas); }
2728
+ .group-tab[aria-expanded="true"] { color: CanvasText; background: var(--tab-surface); border-bottom-color: var(--tab-surface); box-shadow: inset 0 2px 0 var(--tab-accent); z-index: 1; }
2729
+ .group-tab:focus-visible { outline: 2px solid #4af; outline-offset: -2px; }
2730
+ .group-panel { border: 1px solid var(--tab-line, color-mix(in srgb, CanvasText 35%, transparent)); border-top: 0; border-radius: 0 0 4px 4px;
2731
+ background: color-mix(in srgb, CanvasText 5%, Canvas); padding: .5em .75em; margin: 0 0 .5em; }
2732
+ .group-panel[hidden] { display: none; }
2733
+ .group-panel > .row:last-child { margin-bottom: 0; }
2734
+ /* A recording alone is not in a case: the events panel is then no frame around it. In a case, the tabs touch the panel under them. */
2735
+ #case:not(.in-case) > #group-events { border: 0; padding: 0; margin: 0; background: none; }
2736
+ #case.in-case > .case-panel { margin-bottom: 0; }
2737
+ .file-note { margin: .3em 0; }
2738
+ .file-editor { min-height: 18em; margin-top: .5em; }
2739
+ ${Le.CSS}
2740
+ .toolbar input[type="url"] { width: 18em; max-width: 100%; }
2741
+ dialog { max-width: min(30em, 92vw); }
2742
+ /* Adding an event: a popover under its button, which already says what it is for, rather than a window in the middle of the page. */
2743
+ /* By its id: the rule that makes room for the ✕ (see WindowClose) sets position: relative, and must not win here. */
2744
+ dialog#dialog.anchored { position: fixed; z-index: 30; margin: 0; inset: auto; box-shadow: 0 8px 28px rgba(0, 0, 0, .22); border: 1px solid var(--line, #ccc); border-radius: 10px; }
2745
+ dialog.anchored #dialog-title { display: none; }
2746
+ dialog input:disabled { opacity: .75; }
2747
+ dialog label { display: flex; align-items: center; gap: .5em; margin: .4em 0; }
2748
+ dialog label > span { flex: 0 0 9em; }
2749
+ dialog label.check > span { flex: 1 1 auto; }
2750
+ .row.header { justify-content: space-between; }
2751
+ /* A dot after what it speaks of — the case's title, the recording's last tab. It takes its room whether it shows or not, so that
2752
+ it comes and goes without moving anything. */
2753
+ .title { display: flex; align-items: center; gap: .35em; }
2754
+ .dirty { color: #b45309; line-height: 1; cursor: help; align-self: center; margin-left: .3em; }
2755
+ .dirty[hidden] { display: inline !important; visibility: hidden; }
2756
+ .row.header h2 { margin: 0; }
2757
+ dialog input[type="text"], dialog input[type="date"], dialog input[type="url"], dialog select { flex: 1 1 auto; min-width: 0; }
2758
+ dialog .actions { display: flex; gap: .5em; margin-top: .6em; }
2759
+ .recording-id-error { margin: .2em 0; }
2760
+ ${F.rules([".file-note"],[],["#dialog-error",".recording-id-error"])}
2761
+ ${ge.CSS}
2762
+ /* ---- The design handoff's look (design_handoff_editeurs_ufoathome, §2 and §4) ---- */
2763
+ :host {
2764
+ ${Je.TOKENS}
2765
+ --rr0-field-radius: 8px;
2766
+ --rr0-input-font-size: 15px;
2767
+ container-type: inline-size;
2768
+ font: 400 15px/1.5 var(--sans);
2769
+ -webkit-font-smoothing: antialiased;
2770
+ }
2771
+ ${Je.HEAD}
2772
+ ${Je.fields(".case")}
2773
+ /* A case is a card, as the observation alone is: the observation it holds draws none of its own then (see SightingEditorElement.embedded). */
2774
+ .case.in-case { max-width: 68rem; margin: 0 auto; background: var(--ground-raised); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 12px; overflow: clip; }
2775
+ /* Given the width (the app on a computer), the whole of it: the recording's editor lays itself out in two columns from there. */
2776
+ @container (min-width: 760px) { .case.in-case { max-width: none; } }
2777
+ /* And the case's events stay beside the one open, as the reader's history does (see caseTemplate): the list on the left, kept in sight
2778
+ while the event scrolls, the event on the right. Narrower, it is the one or the other, the way back to the case above the event. */
2779
+ @container (min-width: 760px) {
2780
+ #group-events.one-open { display: grid; grid-template-columns: clamp(15rem, 36%, 22rem) minmax(0, 1fr); column-gap: 18px; align-items: start; }
2781
+ #group-events.one-open > * { grid-column: 2; }
2782
+ #group-events.one-open > #case-overview[hidden] { display: block !important; }
2783
+ #group-events.one-open > #case-overview { grid-column: 1; grid-row: 1 / span 6; position: sticky; top: 0; max-height: var(--rr0-editor-height, 100dvh); overflow: auto; overscroll-behavior: contain; }
2784
+ #group-events.one-open #back-to-case, #group-events.one-open #back-to-case + .crumb-sep { display: none; }
2785
+ }
2786
+ .case-panel { margin: 0; }
2787
+ .editor-head .head-text.title { display: block; }
2788
+ /* The case's title keeps room to be read on a line or two, and the actions go under it when they do not fit beside it: squeezed by them,
2789
+ a title broke into one word a line. */
2790
+ .editor-head { flex-wrap: wrap; row-gap: 10px; }
2791
+ .editor-head .head-text.title { flex: 1 1 14em; }
2792
+ .editor-head .head-actions { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
2793
+ .editor-head .check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-dim); }
2794
+ .editor-head .dirty { display: none !important; }
2795
+ /* Two tabs, underlined. */
2796
+ #case-tabs { display: flex; gap: 6px; padding: 0 18px; border-bottom: 1px solid var(--line); }
2797
+ #case-tabs .group-tab {
2798
+ display: inline-flex; align-items: center; gap: 8px; min-height: 0; margin: 0 0 -1px; padding: 12px 10px;
2799
+ border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; box-shadow: none; color: var(--ink-dim); font: 600 15px/1.2 var(--sans);
2800
+ }
2801
+ #case-tabs .group-tab:hover { background: none; color: var(--ink); }
2802
+ #case-tabs .group-tab[aria-expanded="true"] { color: var(--ink); border-bottom-color: var(--glow-solid); background: none; box-shadow: none; }
2803
+ .count { display: inline-block; min-width: 1.4em; padding: 1px 6px; border-radius: 999px; background: var(--neutral-bg); color: var(--ink-dim); font-size: 12px; text-align: center; }
2804
+ .count:empty { display: none; }
2805
+ .case.in-case > .group-panel { margin: 0; padding: 20px 18px 24px; border: 0; border-radius: 0; background: none; color: var(--ink); }
2806
+ .case.in-case #events-row { display: none !important; }
2807
+ #event-item.in-case { border: 0; padding: 0; margin: 0; }
2808
+ /* The case's own fields: its title the whole width, its date and its id under it. */
2809
+ .case-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
2810
+ .case-fields > :is(label, .field) { display: flex; flex-direction: column; align-items: stretch; gap: 6px; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
2811
+ .case-fields > .wide { grid-column: 1 / -1; }
2812
+ /* How the date is said (precise, imprecise) reads as part of its label, "Date imprécise", on the label's line: under it, it pushed the date's
2813
+ field a line below the id's beside it. */
2814
+ .case-fields > .field { display: grid; grid-template-columns: auto 1fr; column-gap: .35em; row-gap: 6px; align-items: baseline; }
2815
+ .case-fields > .field > rr0-date-input { display: contents; }
2816
+ .case-fields > .field > span { grid-row: 1; grid-column: 1; }
2817
+ .case-fields > .field .edtf-mode { grid-row: 1; grid-column: 2; justify-self: start; min-height: 0; }
2818
+ .case-fields > .field .edtf-field { grid-row: 2; grid-column: 1 / -1; }
2819
+ .case-fields input[type="text"] { box-sizing: border-box; width: 100%; height: 38px; font-weight: 400; }
2820
+ .events-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 18px 0 12px; }
2821
+ .events-head > h3 { margin-right: auto; }
2822
+ #group-readings[aria-pressed="true"] { background: var(--glow-solid); border-color: var(--glow-solid); color: var(--glow-on-solid); }
2823
+ .section-title { margin: 0; font: 600 12px/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--glow-dim); }
2824
+ /* The chronology is common to the case's reader (see CaseTimeline), in the editor's tokens; what follows is the editor's own. */
2825
+ ${Pe.CSS}
2826
+ :host {
2827
+ ${Pe.EDITOR_TOKENS}
2828
+ }
2829
+ /* Clear of the removal, in the corner above it. */
2830
+ /* The room the corner's buttons take, kept clear of the top line alone: 28px each and 2px between them, from 6px off the edge. The card
2831
+ with no clone and no padlock (an interview) keeps room for its removal alone. */
2832
+ .event-main { margin-right: 40px; }
2833
+ .event-card:has(.event-tool) .event-main { margin-right: 100px; }
2834
+ /* The filter over the list: a button per kind, lit while its events are shown, with how many of them the case holds. */
2835
+ .event-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
2836
+ .event-filter[hidden] { display: none; }
2837
+ .filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px;
2838
+ background: none; color: var(--ink-dim); font: 600 12px/1.6 var(--sans); cursor: pointer; }
2839
+ .filter-chip[aria-pressed="true"] { border-color: var(--kind, var(--glow-solid)); color: var(--ink); }
2840
+ .filter-chip[data-kind="interview"] { --kind: var(--sky); }
2841
+ .filter-chip[data-kind="reading"] { --kind: var(--ink-faint); }
2842
+ .filter-chip[aria-pressed="false"] { opacity: .55; }
2843
+ .filter-count { color: var(--ink-faint); font-weight: 400; }
2844
+ /* What a reading's findings come to, as the editor's groups say what their fields do: red when it contradicts what is established, orange
2845
+ when it is not settled, green when it holds (see ReadingVerdict). */
2846
+ .event-card[data-verdict="incompatible"] { border-color: var(--error); }
2847
+ .event-card[data-verdict="unsettled"] { border-color: var(--glow-solid); }
2848
+ .event-card[data-verdict="compatible"] { border-color: var(--ok); }
2849
+ .event-card[data-verdict] { border-width: 1.5px; }
2850
+ .verdict { font-weight: 700; }
2851
+ .event-card[data-verdict="incompatible"] .verdict { color: var(--error); }
2852
+ .event-card[data-verdict="unsettled"] .verdict { color: var(--warn); }
2853
+ .event-card[data-verdict="compatible"] .verdict { color: var(--ok); }
2854
+ .findings { grid-column: 1 / -1; margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 13px; line-height: 1.4; color: var(--ink-dim); }
2855
+ .readings-comparison { margin-top: 14px; }
2856
+ /* The report's export wears the editor's pill, its button being its own (see CaseExportElement). */
2857
+ .report-export::part(button) { height: 36px; gap: 8px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px;
2858
+ background: var(--ground-raised); color: var(--ink); font: 600 14px/1 var(--sans); }
2859
+ /* The readings filtered out of the list are filtered out of their comparison too (see renderFilter). */
2860
+ .readings-comparison[data-filtered] { display: none; }
2861
+ .event-body > rr0-reading-sensitivity { grid-column: 1 / -1; margin-top: 2px; }
2862
+ .findings li { display: grid; grid-template-columns: 1.2em minmax(0, 1fr); column-gap: 4px; }
2863
+ .findings li > .finding-against { grid-column: 2; color: var(--ink-faint); }
2864
+ .finding-mark { font-weight: 700; text-align: center; }
2865
+ .findings li[data-outcome="holds"] .finding-mark { color: var(--ok); }
2866
+ .findings li[data-outcome="fails"] .finding-mark { color: var(--error); }
2867
+ .findings li[data-outcome="untested"] .finding-mark { color: var(--ink-faint); }
2868
+ /* What can be done to the event, in the card's top right corner rather than a column of its own: what the card says has its whole width
2869
+ below it. Cloning and freezing sit beside the removal, in that order: the one that makes a copy, the one that stops the original. */
2870
+ .event-tools { position: absolute; top: 6px; right: 6px; z-index: 1; display: flex; gap: 2px; }
2871
+ .event-delete, .event-tool { display: grid; place-items: center; width: 28px; height: 28px; min-width: 0; min-height: 0;
2872
+ padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ink-dim); }
2873
+ .event-delete:hover:not(:disabled) { color: var(--error); }
2874
+ .event-tool:hover:not(:disabled) { color: var(--ink); }
2875
+ .event-delete:disabled, .event-tool:disabled { opacity: .4; }
2876
+ /* A frozen event: its padlock shut and lit, and its card dimmed on its left edge, so that a list says at a glance which are still worked on. */
2877
+ .event-card[data-sealed] { border-left: 3px solid var(--glow-dim); }
2878
+ .event-card[data-sealed] .event-freeze { color: var(--glow); }
2879
+ .sealed-chip { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--glow); }
2880
+ /* Said over a frozen event's editor, which takes no input while it is frozen. */
2881
+ .frozen-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px;
2882
+ border: 1px solid var(--glow-dim); border-radius: 10px; background: var(--warn-bg); font-size: 14px; }
2883
+ .frozen-note[hidden] { display: none; }
2884
+ /* A field frozen with its event has to LOOK frozen: one that takes nothing while looking as it always did is the silent loss again. */
2885
+ .event-id-row input:disabled { opacity: .5; cursor: not-allowed; }
2886
+ /* The event open: the way back to the case, and the events before and after. */
2887
+ .crumbs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid var(--line); }
2888
+ .crumb-sep { color: var(--ink-faint); }
2889
+ .crumb-title { font: 600 20px/1.3 var(--serif); }
2890
+ .crumb-nav { display: flex; gap: 6px; margin-left: auto; }
2891
+ .cited { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 14px;
2892
+ border: 1px solid var(--glow-dim); border-radius: 10px; background: var(--warn-bg); font-size: 14px; }
2893
+ .cited[hidden] { display: none; }
2894
+ @container (max-width: 640px) {
2895
+ /* Narrow, as the handoff's mobile view: the pill above the title, "Open" beside the title, or under what the event is linked to
2896
+ when it says something; the removal keeps its column. */
2897
+ /* Narrow, the pill is alone on the top line, so it is the one that keeps clear of the buttons. */
2898
+ .event-main, .event-card:has(.event-tool) .event-main { margin-right: 0; }
2899
+ .kind-pill { margin-right: 40px; }
2900
+ .event-card:has(.event-tool) .kind-pill { margin-right: 100px; }
2901
+ .editor-head { flex-wrap: wrap; }
2902
+ .editor-head .head-actions { flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }
2903
+ }
2904
+ </style>
2905
+ <div id="case" class="case">
2906
+ <!-- The case on top (see the design handoff, §4): what it is, with the one Save there is, on while there is something to save, which
2907
+ saves the observations too when asked; then its two tabs. -->
2908
+ <section id="case-panel" class="case-panel" aria-labelledby="case-heading" hidden>
2909
+ <header class="editor-head header">
2910
+ <div class="head-text title">
2911
+ <span id="case-kicker" class="kicker"></span>
2912
+ <h1 id="case-heading" class="editor-title"></h1>
2913
+ <span id="dirty" class="dirty" role="status" hidden></span>
2914
+ </div>
2915
+ <div class="head-actions">
2916
+ <label class="check"><input id="save-also" type="checkbox" checked/> <span id="label-save-also"></span></label>
2917
+ <!-- A report of the case: its readings compared, their findings and sensitivity, as HTML, PDF, JSON or CSV (see CaseExportElement). -->
2918
+ <rr0-case-export id="report-export" class="report-export" variant="pill"></rr0-case-export>
2919
+ <!-- What is edited, read (see ReadEditSwitch): in place on a page that switches, else the player on its address. -->
2920
+ <button id="read-case" type="button" class="pill-btn" hidden><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M5 3.2v9.6L12.5 8z"/></svg><span id="label-read-case"></span></button>
2921
+ <!-- The editor on this case, for somebody else (see ShareDialogElement): off while the case has no address to give. -->
2922
+ <button id="share-case" type="button" class="pill-btn" aria-haspopup="dialog" disabled><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M9.5 3 14 7.5 9.5 12V9.3C5.8 9.2 3.8 10.4 2.5 12.8c.4-3.9 2.4-6.6 7-7.3V3z"/></svg><span id="label-share-case"></span></button>
2923
+ <button id="save-case" type="button" class="pill-btn primary" disabled><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2.5v8"/><path d="m4.5 7 3.5 3.5L11.5 7"/><path d="M3 13.5h10"/></svg><span id="label-save-case"></span></button>
2924
+ </div>
2925
+ </header>
2926
+ <rr0-share-dialog id="share-dialog"></rr0-share-dialog>
2927
+ <div id="case-tabs" class="group-tabs">
2928
+ <button class="group-tab" type="button" aria-controls="group-events" aria-expanded="true"><span id="label-events-group"></span> <span id="events-count" class="count"></span></button>
2929
+ <button class="group-tab" type="button" aria-controls="group-case-file" aria-expanded="false"><span id="label-case-file-group"></span></button>
2930
+ </div>
2931
+ </section>
2932
+ <section class="group-panel" id="group-events" aria-labelledby="label-events-group">
2933
+ <!-- The case itself while no event is open: its title, its date, its id, then its events in the order of time (see renderEvents). -->
2934
+ <div id="case-overview" class="case-overview" hidden>
2935
+ <div class="case-fields">
2936
+ <label class="wide"><span id="label-case-title"></span> <input id="case-title" type="text" size="24"/></label>
2937
+ <div class="field"><span id="label-case-time"></span> <rr0-date-input id="case-date" name="case-time"></rr0-date-input></div>
2938
+ <label><span id="label-case-id"></span> <input id="case-id" type="text" size="18"/></label>
2939
+ </div>
2940
+ <div class="events-head">
2941
+ <h3 id="label-events-in-time" class="section-title"></h3>
2942
+ <button id="group-readings" type="button" class="icon-btn" aria-pressed="false"><svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="4" cy="3.5" r="1.6"/><path d="M4 5.1v7.4M4 8.5h3.5M4 12.5h3.5"/><path d="M9.5 8.5h4M9.5 12.5h4"/></svg></button>
2943
+ <button id="add" type="button" class="pill-btn"><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3v10M3 8h10"/></svg><span id="label-add"></span></button>
2944
+ </div>
2945
+ <!-- What the list shows, by kind: a way of reading the chronology, never written in the case (see renderFilter). -->
2946
+ <div id="event-filter" class="event-filter" role="group" hidden></div>
2947
+ <ol id="event-list" class="event-list"></ol>
2948
+ <rr0-readings-comparison id="readings-comparison" class="readings-comparison"></rr0-readings-comparison>
2949
+ </div>
2950
+ <p id="recording-id-error" class="recording-id-error" role="alert" hidden></p>
2951
+ <p id="case-problems" class="recording-id-error" role="status" hidden></p>
2952
+ <!-- Laid out as every list of the editor is (see ElementList): the picker, 🗑, "+", then the frame of the event picked. -->
2953
+ <div id="events-row" class="element-list-row">
2954
+ <label class="element-list-picker"><select id="track"></select></label>
2955
+ <button id="delete" type="button" class="icon-btn">${D.TRASH}</button>
2956
+ </div>
2957
+ <div id="event-item" class="element-list-body">
2958
+ <!-- The event open, in the case: the way back to it, what kind of event and which, and the events before and after. -->
2959
+ <nav id="event-crumbs" class="crumbs" hidden>
2960
+ <button id="back-to-case" type="button" class="pill-btn"><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.5 5.5 8l4.5 4.5"/></svg><span id="label-back-to-case"></span></button>
2961
+ <span class="crumb-sep" aria-hidden="true">›</span>
2962
+ <span id="crumb-kind" class="kind-pill"></span>
2963
+ <span id="crumb-title" class="crumb-title"></span>
2964
+ <span class="crumb-nav">
2965
+ <button id="previous-event" type="button" class="icon-btn"><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.5 5.5 8l4.5 4.5"/></svg></button>
2966
+ <button id="next-event" type="button" class="icon-btn"><svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="m6 3.5 4.5 4.5L6 12.5"/></svg></button>
2967
+ </span>
2968
+ </nav>
2969
+ <!-- Over the observation opened from an interview's link to one of its moments: where it was quoted, and the way back (§5). -->
2970
+ <div id="cited" class="cited" role="status" hidden>
2971
+ <span id="cited-text"></span>
2972
+ <button id="cited-back" type="button" class="pill-btn"><span id="label-back-to-interview"></span></button>
2973
+ </div>
2974
+ <!-- The event's id, and on its line the observation's Undo and Redo (see SightingEditorElement.historyControls). -->
2975
+ <div class="event-id-row" hidden>
2976
+ <label id="row-recording-id" class="row"><span id="label-recording-id"></span> <input id="recording-id" type="text" size="14" autocomplete="off" spellcheck="false"/></label>
2977
+ <!-- Who made this reading, or held this interview: an account's is its witness, so it has none here (see CaseEventJson.by). -->
2978
+ <label id="row-event-author" class="row" hidden><span id="label-event-author"></span> <input id="event-author" type="text" size="20" autocomplete="off"/></label>
2979
+ <span id="history-slot" class="history-slot"></span>
2980
+ </div>
2981
+ <!-- Over a frozen event: why its editor takes no input, and the way to thaw it (see CaseEventJson.sealed). -->
2982
+ <p id="frozen-note" class="frozen-note" role="status" hidden>
2983
+ <span id="frozen-text"></span>
2984
+ <button id="thaw" type="button" class="pill-btn"><span id="label-thaw"></span></button>
2985
+ </p>
2986
+ <section id="recording" class="recording">
2987
+ <rr0-sighting-editor id="editor"><span id="recording-dirty" slot="tab-status" class="dirty" role="status" hidden>●</span></rr0-sighting-editor>
2988
+ </section>
2989
+ <section id="interview-section" class="recording" hidden>
2990
+ <rr0-interview-editor id="interview"></rr0-interview-editor>
2991
+ </section>
2992
+ </div>
2993
+ </section>
2994
+ <section class="group-panel" id="group-case-file" aria-labelledby="label-case-file-group" hidden>
2995
+ <div class="row toolbar">
2996
+ <span class="input-file-row"><span id="label-import-file"></span> <rr0-input-file id="import" name="import" accept="application/json,.json" placeholder="https://…/case.json"></rr0-input-file></span>
2997
+ <button id="export" type="button"></button>
2998
+ </div>
2999
+ <p id="case-file-note" class="file-note" hidden role="status"></p>
3000
+ <div id="case-file-editor" class="file-editor"></div>
3001
+ </section>
3002
+ <p id="make-case-row" class="make-case"><button id="make-case" type="button" class="link"></button></p>
3003
+ </div>
3004
+ <dialog id="dialog">
3005
+ <form method="dialog" id="form">
3006
+ <h3 id="dialog-title"></h3>
3007
+ <p id="dialog-message" hidden></p>
3008
+ <p id="dialog-error" role="alert" hidden></p>
3009
+ <div id="fields-add">
3010
+ <label><span id="label-kind"></span> <select id="kind"><option value="observation"></option><option value="reading"></option><option value="interview"></option></select></label>
3011
+ <label id="row-of"><span id="label-of"></span> <select id="of"></select></label>
3012
+ <label id="row-source"><span id="label-source"></span> <select id="source">
3013
+ <option value="blank"></option><option value="file"></option>
3014
+ </select></label>
3015
+ <label id="row-witness"><span id="label-witness"></span> <select id="witness"></select></label>
3016
+ <label id="row-medium"><span id="label-medium"></span> <select id="medium"></select></label>
3017
+ <label id="row-observer"><span id="label-observer"></span> <input id="observer" type="text"/></label>
3018
+ <label id="row-title"><span id="label-title"></span> <input id="title" type="text"/></label>
3019
+ <label id="row-author"><span id="label-author"></span> <input id="author" type="text"/></label>
3020
+ <label id="row-date"><span id="label-date"></span> <input id="date" type="date"/></label>
3021
+ <div id="row-file" class="row-input-file"><span id="label-file"></span> <rr0-input-file id="add-source" name="add-source" accept="application/json,.json" no-button keep-file></rr0-input-file></div>
3022
+ </div>
3023
+ <div id="fields-export">
3024
+ <label class="check"><input id="export-recordings" type="checkbox" checked/> <span id="label-export-recordings"></span></label>
3025
+ </div>
3026
+ <div class="actions">
3027
+ <button id="ok" type="submit" value="ok"></button>
3028
+ <button id="cancel" type="button"></button>
3029
+ </div>
3030
+ </form>
3031
+ </dialog>
3032
+ `;class Me extends HTMLElement{shadow=this.attachShadow({mode:"open"});editor;session;current;listShown=!0;currentInterview;interviewElement;interviewReady;group="events";fileEditor;fileEditorLoading;fileApplied="";editorMessages;messages=$e.none();ready=Promise.resolve();said=new ht(["en"]);localeToken=0;language="en";dialogMode="add";pendingLoad;dirtyTimer;caseDate;dateModeFor;constructor(){super(),zs(),Cs(),Ms.register(),this.shadow.innerHTML=lo,customElements.upgrade(this.shadow),this.shadow.getElementById("case-date").build();for(const t of this.shadow.querySelectorAll("rr0-input-file"))t.build();this.editor=this.shadow.getElementById("editor"),this.interviewElement=this.shadow.getElementById("interview"),this.interviewElement.addEventListener(Js,t=>this.interviewChanged(t.detail)),this.interviewElement.addEventListener(Xs,t=>void this.followToObservation(t.detail)),this.editor.addEventListener("caseloaded",t=>{t.preventDefault();const{json:i,url:s}=t.detail;this.openCase(i,s??location.href,s!==void 0&&!_e.local(s))}),this.editor.addEventListener("recordingloaded",()=>this.closeCase()),this.editor.addEventListener("sightingchange",()=>{clearTimeout(this.checkReadingTimer),this.checkReadingTimer=setTimeout(()=>this.checkReading(),Me.CHECK_READING_AFTER_MS)}),this.editor.guardsLeaving=!1,this.editor.addEventListener("beforeload",t=>{this.dirty&&(t.preventDefault(),this.pendingLoad=t.detail.proceed,this.openDialog("discard",this.messages.discardTitle,this.messages.discardQuestion))});for(const t of["input","change","datechange","click","pointerup","keyup"])this.shadow.addEventListener(t,()=>this.scheduleDirtyCheck(),!0);for(const[t,i]of[["case-id","id"],["case-title","title"]])this.input(t).addEventListener("input",()=>this.writeCaseField(i,this.input(t).value));this.caseDate=this.byId("case-date"),this.caseDate.addEventListener("datechange",t=>{const{time:i}=t.detail;this.writeCaseField("time",i?Me.rr0TimeOf(zn(i)):"")}),this.byId("track").addEventListener("change",()=>{this.byId("cited").hidden=!0,this.listShown=!1,this.refreshOverview();const t=this.session?this.items(this.session)[Number(this.byId("track").value)]:void 0;t&&(t.interview?this.showInterview(t.interview):this.showTrack(t.track))});const e=this.input("recording-id");e.addEventListener("input",()=>this.writeRecordingId()),e.addEventListener("blur",()=>{this.showRecordingIdError(void 0),this.refreshRow()});for(const t of this.shadow.querySelectorAll("#case-tabs .group-tab"))t.addEventListener("click",()=>this.openGroup(t.getAttribute("aria-controls")==="group-case-file"?"file":"events"));this.inputFile("import").addEventListener("filepick",t=>{const i=t.detail;i.file?this.importFromFile(i.file):this.importFromUrl(i.url)}),this.byId("add").addEventListener("click",()=>this.askAdd()),this.byId("group-readings").addEventListener("click",()=>{this.grouping=!this.grouping,Pe.rememberGrouping(this.grouping),this.refreshOverview()}),this.byId("cited-back").addEventListener("click",()=>{const t=this.citedFrom;if(!t||!this.session)return;const i=this.items(this.session).findIndex(s=>s.interview===t);i>=0&&this.openEvent(i)}),this.byId("back-to-case").addEventListener("click",()=>{this.listShown=!0,this.refreshRow()}),this.byId("previous-event").addEventListener("click",()=>this.stepEvent(-1)),this.byId("next-event").addEventListener("click",()=>this.stepEvent(1)),this.shareDialog=this.byId("share-dialog"),Qs.register(),this.byId("report-export").source=async()=>{const t=this.session;if(!t)throw new Error("No case");this.commit(),await Promise.all(t.tracks.filter(s=>!s.recording).map(s=>this.loadTrack(s).catch(()=>{})));const i=new Map;for(const s of t.tracks)s.recording&&i.set(s.url,s.recording);return{caseJson:t.json,caseUrl:t.url,recordings:i}},this.shareDialog.subject=this.shareSubject,this.byId("share-case").addEventListener("click",()=>this.openShare()),this.byId("read-case").addEventListener("click",()=>this.read()),this.byId("save-case").addEventListener("click",()=>void this.exportCase(this.input("save-also").checked).then(()=>this.refreshDirty())),this.byId("make-case").addEventListener("click",()=>this.makeCase()),this.byId("delete").addEventListener("click",()=>this.askDelete()),this.byId("event-author").addEventListener("input",()=>this.writeEventAuthor()),this.byId("thaw").addEventListener("click",()=>{const t=this.current;!this.session||!t||(this.session.seal(t,!1),this.refreshRow())}),this.byId("export").addEventListener("click",()=>this.askExport()),this.byId("source").addEventListener("change",()=>this.syncSourceFields()),this.byId("kind").addEventListener("change",()=>this.syncSourceFields()),this.byId("of").addEventListener("change",()=>this.syncSourceFields()),this.byId("cancel").addEventListener("click",()=>this.closeDialog()),this.byId("dialog").addEventListener("close",()=>{this.pendingLoad=void 0}),this.byId("form").addEventListener("submit",t=>{t.preventDefault(),this.submitDialog()})}static get observedAttributes(){return["src",pt]}attributeChangedCallback(e,t,i){e===pt&&(i!==null&&!this.switcher&&new Gs(s=>this.after(s),this,s=>this.dispatchEvent(new CustomEvent(Ks,{detail:s,bubbles:!0,composed:!0}))),this.refreshCaseState()),e==="src"&&i&&this.editor.setAttribute("src",i)}warnBeforeLeaving=e=>{this.leaving||!this.dirty||(e.preventDefault(),e.returnValue="")};disconnectedCallback(){document.removeEventListener("click",this.askBeforeFollowing,!0),window.removeEventListener("beforeunload",this.warnBeforeLeaving),window.clearTimeout(this.dirtyTimer)}get dirty(){return this.session?(this.commit(),this.session.dirty):this.editor.dirty}scheduleDirtyCheck(){window.clearTimeout(this.dirtyTimer),this.dirtyTimer=window.setTimeout(()=>this.refreshDirty(),600)}refreshDirty(){const e=this.session;e&&this.commit(),this.byId("dirty").hidden=!(e&&e.dirty),this.refreshCaseState();const t=e?this.current!==void 0&&e.changed(this.current):this.editor.dirty;this.byId("recording-dirty").hidden=!t}leaving=!1;askBeforeFollowing=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const t=e.composedPath().find(s=>s instanceof HTMLAnchorElement);if(!t||!t.href||t.target&&t.target!=="_self"||t.hasAttribute("download"))return;const i=new URL(t.href,location.href);i.href===location.href||i.origin===location.origin&&i.pathname===location.pathname&&i.search===location.search&&i.hash!==""||this.dirty&&(e.preventDefault(),e.stopPropagation(),this.pendingLoad=()=>{this.leaving=!0,location.assign(i.href)},this.openDialog("discard",this.messages.discardTitle,this.messages.leaveQuestion,this.messages.leaveOk))};connectedCallback(){document.addEventListener("click",this.askBeforeFollowing,!0),window.addEventListener("beforeunload",this.warnBeforeLeaving);const e=this.getAttribute("src");e&&this.editor.getAttribute("src")!==e&&this.editor.setAttribute("src",e),this.ready=this.loadLocale()}get sightingData(){return this.editor.sightingData}set sightingData(e){const t=He.recording(e);this.closeCase(),this.editor.sightingData=t}get sightingEditor(){return this.editor}get caseSession(){return this.session}byId(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=Ne.preferencesFor(this),i=di(t,hi),[s,n,r]=await Promise.all([Vs.load(i),ws.load(i),Tn.load(i)]);if(e!==this.localeToken)return;this.said=new ht(t),this.language=i,this.messages=s,this.readingCheck=new Ji(r),this.bestCases=new Mn(r),this.caseDate.messages=n,this.editorMessages=n,this.applyMessages(),this.refreshRow(),this.showInterviewSources();const o=await this.shareDialog.useLanguage(i);!o||e!==this.localeToken||(this.shareMessages=o,this.byId("label-share-case").textContent=o.share,this.refreshCaseState())}applyMessages(){Fe.dialog(this.dialog,this.messages.cancel,()=>this.closeDialog());const e=this.messages,t=(r,o)=>{this.byId(r).textContent=o};t("case-kicker",e.caseHeading),t("label-back-to-case",e.caseHeading),t("label-events-in-time",e.eventsInTime),t("label-back-to-interview",e.backToInterview),t("label-add",e.addTitle),t("label-save-also",e.exportAlso),t("label-save-case",e.exportButton),t("label-read-case",e.readButton),this.byId("read-case").title=e.readTitle;for(const[r,o]of[["previous-event",e.previousEvent],["next-event",e.nextEvent]])this.byId(r).title=o,this.byId(r).setAttribute("aria-label",o);t("label-case-id",e.caseId),t("label-case-title",e.caseTitle),t("label-case-time",e.caseTime),t("label-events-group",e.eventsTab),t("label-case-file-group",e.fileTab),t("label-import-file",e.importFile),this.byId("track").setAttribute("aria-label",e.event),t("label-kind",e.kindField),t("label-witness",e.witnessField),t("label-medium",e.mediumField),t("label-recording-id",e.recordingId),t("make-case",e.addToCase);for(const r of["dirty","recording-dirty"])this.byId(r).title=e.unsavedChanges,this.byId(r).setAttribute("aria-label",e.unsavedChanges);t("export",e.exportButton),t("label-export-recordings",e.exportAlso),t("label-title",e.titleField),t("label-author",e.authorField),t("label-date",e.caseTime),t("label-of",e.interpretationOf),t("label-source",e.sourceField),t("label-observer",e.observerField),t("label-file",e.fileField);for(const r of this.shadow.querySelectorAll("rr0-input-file"))r.messages=e;t("ok",e.ok),t("cancel",e.cancel);const i=this.byId("source");[e.sourceBlank,e.sourceFile].forEach((r,o)=>{i.options[o].textContent=r});const s=this.byId("kind");[e.kindObservation,e.kindReading,e.kindInterview].forEach((r,o)=>{s.options[o].textContent=r});const n=this.byId("group-readings");n.title=e.groupReadings,n.setAttribute("aria-label",e.groupReadings),this.byId("add").title=e.addHint,this.byId("add").setAttribute("aria-label",e.addHint),this.byId("delete").title=e.deleteRecording,this.byId("label-thaw").textContent=e.thawButton,this.byId("delete").setAttribute("aria-label",e.deleteRecording)}openGroup(e){this.group=e;for(const t of this.shadow.querySelectorAll("#case-tabs .group-tab"))t.setAttribute("aria-expanded",String(t.getAttribute("aria-controls")===(e==="file"?"group-case-file":"group-events")));e==="file"?this.loadFileEditor().then(()=>this.syncFileEditor(),()=>this.showFileNote(this.messages.loadFailed,"error")):this.leaveFile(),this.refreshRow()}applySections(){const e=this.session,t=e===void 0||this.group==="events";this.byId("events-row").hidden=e===void 0,this.byId("group-events").hidden=!t,this.byId("group-case-file").hidden=e===void 0||this.group!=="file",this.byId("recording").hidden=this.currentInterview!==void 0,this.byId("interview-section").hidden=this.currentInterview===void 0,this.byId("history-slot").hidden=this.currentInterview!==void 0}showFileNote(e,t="info"){F.show(this.byId("case-file-note"),e,t)}fileText(){return this.session?JSON.stringify(this.session.json,null,2)+`
3033
+ `:""}loadFileEditor(){return this.fileEditorLoading??=(async()=>{await this.ready,this.showFileNote(this.messages.fileLoading);try{const[{SightingFileEditor:e},{default:t}]=await Promise.all([M(()=>import("./SightingFileEditor-Cllslp2u.js"),__vite__mapDeps([12,13,14]),import.meta.url),M(()=>import("./caseSchema-ChUB1-9j.js"),[],import.meta.url)]),i=this.fileText();return this.fileApplied=i,this.fileEditor=new e(this.byId("case-file-editor"),i,s=>this.onFileEdited(s),this.editorMessages.fileEditorLabel,{baseline:i,phrases:this.editorMessages.fileSearchPhrases,schema:t}),this.fileEditor}catch(e){throw this.fileEditorLoading=void 0,e}finally{this.showFileNote(void 0)}})(),this.fileEditorLoading}syncFileEditor(){if(!this.fileEditor||!this.session)return;this.commit();const e=this.fileText();this.fileApplied=e,this.fileEditor.replaceText(e,!1),this.showFileNote(void 0)}onFileEdited(e){const t=this.session;if(!t)return;if(e===this.fileApplied){this.showFileNote(void 0);return}let i;try{i=JSON.parse(e)}catch{this.showFileNote(this.messages.fileInvalid,"error");return}if(!ie.isCase(i)){this.showFileNote(this.messages.fileInvalid,"error");return}try{ie.check(i)}catch(s){this.showFileNote(s instanceof Ct?s.said(this.messages.formatVersionError):this.messages.fileInvalid,"error");return}this.fileApplied=e,this.showFileNote(void 0),JSON.stringify(i)!==JSON.stringify(t.json)&&(t.replaceJson(i),this.current&&!t.tracks.includes(this.current)&&(this.current=void 0),this.currentInterview&&!t.interviews.includes(this.currentInterview)&&(this.currentInterview=void 0),this.refreshRow(),this.scheduleDirtyCheck())}leaveFile(){const e=this.session;if(e)if(this.current===void 0&&this.currentInterview===void 0){const t=e.tracks.find(i=>i.kind==="observer")??e.tracks[0];t&&this.showTrack(t)}else this.currentInterview&&(this.interviewElement.event=this.currentInterview)}guarded(e){if(!this.dirty){e();return}this.pendingLoad=e,this.openDialog("discard",this.messages.discardTitle,this.messages.discardQuestion)}async importFromFile(e){try{const t=JSON.parse(await e.text());this.guarded(()=>void this.importCase(t,new URL("case.json",location.href).href,!1))}catch{this.showFileNote(this.messages.loadFailed,"error")}}async importFromUrl(e){try{const t=new URL(e,location.href).href,i=await Ye.json(t);this.guarded(()=>void this.importCase(i,t,!0))}catch{this.showFileNote(this.messages.loadFailed,"error")}}async importCase(e,t,i){if(!ie.isCase(e)){this.showFileNote(this.messages.fileNotACase);return}try{await this.openCase(e,t,i)}catch(s){this.showFileNote(s instanceof Ct?s.said(this.messages.formatVersionError):this.messages.fileNotACase);return}this.syncFileEditor(),this.showFileNote(void 0)}async openCase(e,t,i){ie.check(e);const s=new re(e,t);if(this.sourceUrl=i?t:void 0,s.tracks.length===0)throw new Error("A case with no recording has nothing to edit");this.session=s,this.current=void 0;const n=this.getAttribute("track"),r=n?new URL(n,t).href:void 0,o=s.tracks.find(l=>l.url===r)??s.tracks.find(l=>l.kind==="observer")??s.tracks[0];this.listShown=r===void 0,await this.showTrack(o)}closeCase(){this.session&&(this.session=void 0,this.current=void 0,this.currentInterview=void 0,this.editor.reading=!1,this.editor.accountShapeIds=void 0,this.refreshRow())}commit(){this.session&&this.current&&this.editor.edited&&this.session.keep(this.current,this.editor.sightingData)}async loadTrack(e){e.recording||(e.recording=He.recording(await Ye.recording(e.url)),e.loaded=JSON.stringify(e.recording))}async showTrack(e){const t=this.session;if(t){this.commit(),this.currentInterview=void 0,this.editor.passages=void 0,this.editor.holdForNewScene();try{const i=!e.recording;await this.loadTrack(e);const s=t.accountOf(e);s&&await this.loadTrack(s),this.layMostFavourable(e),this.current=e,this.editor.documentUrl=e.base?e.base.url:e.url,this.editor.reading=e.kind==="reading",this.editor.accountShapeIds=e.kind==="reading"&&s?.recording?Me.shapesOf(s.recording):void 0;const n=e.kind==="observer"?t.readingsOf(e):[];for(const r of n)await this.loadTrack(r).catch(()=>{}),this.layMostFavourable(r);this.editor.readings=n.filter(r=>r.recording?.interpretation?.bodies.length||Mt.computes(r.recording?.interpretation,Lt.kinds())).map(r=>({id:r.event.id??t.proposedId(r),label:this.labelOf(r,t.tracks.indexOf(r)),interpretation:r.recording.interpretation})),this.editor.sightingData=structuredClone(e.recording),this.checked=void 0,this.checkReading(),i&&t.keep(e,this.editor.sightingData,!0),s&&s.loaded===void 0&&t.keep(s,s.recording,!0)}catch{this.showError(this.messages.loadFailed)}this.refreshRow(),this.showPassages(e),this.showInterviewSources()}}passagesToken=0;sourcesToken=0;async showInterviewSources(){const e=this.session,t=++this.sourcesToken;if(this.editor.interviewSources=void 0,!e||e.interviews.length===0)return;const{InterviewFile:i}=await M(async()=>{const{InterviewFile:o}=await import("./interviewJson-D-i14LTf.js");return{InterviewFile:o}},__vite__mapDeps([34,1]),import.meta.url),s=this.items(e),n=e.interviews.length===1,r=[];for(const o of e.interviews){const l=await this.transcriptOf(o);if(!l||!Array.isArray(l.segments))continue;const a=o.id;r.push({...n||a===void 0?{}:{id:a},label:this.optionLabel({interview:o},s.findIndex(d=>d.interview===o)),segments:l.segments.map((d,h)=>{const c=i.said(d)??"",u=c.length>80?`${c.slice(0,77)}…`:c;return{index:h,label:c===""?"":`${i.speakerName(l,d.speaker)}${this.messages.colon}${u}`}})})}t!==this.sourcesToken||r.length===0||(this.editor.interviewSources=r)}static CHECK_READING_AFTER_MS=250;checkReadingTimer;checked;checkReading(){clearTimeout(this.checkReadingTimer);const e=this.current,t=e&&this.session?this.session.accountOf(e):void 0;if(!e||e.kind!=="reading"||!t?.recording){this.checked=void 0,this.editor.markBeyondKnown([]),this.editor.setReadingBounds({});return}const i=this.editor.sightingData,s=JSON.stringify(i);if(this.checked&&this.checked.track===e&&this.checked.account===t.recording&&this.checked.text===s)return;this.checked={track:e,account:t.recording,text:s};const n=li.strip(t.recording).provenance,r=c=>n.at(c)?.range,o=r("time"),l=r("place.locations.0.lat"),a=r("place.locations.0.lng"),d=li.strip(t.recording).recording.lighting;this.editor.setReadingBounds({...typeof o=="string"?{time:o}:{},...d?{hour:c=>Ji.nearestLit(d,c,this.editor.sightingData)}:{},...Array.isArray(l)?{lat:l}:{},...Array.isArray(a)?{lng:a}:{}});const h=(this.readingCheck?.findingsOf(t.recording,i)??[]).filter(c=>c.outcome==="fails"&&c.path);this.editor.markBeyondKnown(h.map(c=>({path:c.path==="lighting"?"time":c.path,why:this.said.read(c.text)??""})))}async transcriptOf(e){const t=this.session;if(t)try{const{InterviewFile:i}=await M(async()=>{const{InterviewFile:n}=await import("./interviewJson-D-i14LTf.js");return{InterviewFile:n}},__vite__mapDeps([34,1]),import.meta.url),s=t.transcriptText(e);if(s!==void 0)return i.read(JSON.parse(s));if(e.url)return i.read(await Ye.json(new URL(e.url,t.url??location.href).href))}catch{}}async showPassages(e){const t=this.session,i=++this.passagesToken;if(this.editor.passages=void 0,!t||e.kind!=="observer"||t.interviews.length===0)return;const{InterviewFile:s}=await M(async()=>{const{InterviewFile:l}=await import("./interviewJson-D-i14LTf.js");return{InterviewFile:l}},__vite__mapDeps([34,1]),import.meta.url);if(i!==this.passagesToken)return;const n=e.event.id??t.proposedId(e),r=[];for(const l of t.interviews){const a=await this.transcriptOf(l);if(!a||!Array.isArray(a.segments))continue;const d={...a,interviewOf:a.interviewOf??l.interviewOf};for(const h of s.passagesAbout(d,n))r.push({interview:l,json:a,passage:h})}if(i!==this.passagesToken||this.current!==e||r.length===0)return;const o=this.items(t);this.editor.passages=r.sort((l,a)=>l.passage.at-a.passage.at).map(({interview:l,json:a,passage:d})=>{const h=`${this.messages.passagesHeading} ${this.optionLabel({interview:l},o.findIndex(u=>u.interview===l))}`,c=d.text===void 0?"":d.range?d.text.slice(d.range[0],d.range[1]):d.text;return{at:d.at,clock:s.clock(d.at,!0),said:c===""?h:`${s.speakerName(a,d.speaker)}${this.messages.colon}${this.messages.quoted.replace("{text}",c.length>120?`${c.slice(0,117)}…`:c)}`,where:h,open:()=>void this.showInterview(l).then(()=>this.interviewElement.revealSegment(d.index))}})}async followToObservation(e){const t=this.session;if(!t)return;const i=t.tracks.find(n=>n.kind==="observer"&&(n.event.id??t.proposedId(n))===e.sighting)??t.tracks.find(n=>n.kind==="observer");if(!i)return;const s=this.currentInterview;this.listShown=!1,await this.showTrack(i),this.editor.openSection("group-temporal"),this.editor.seekTo(e.at),this.showCited(s,i,e),this.editor.showRender()}static shapesOf(e){const t=new Set;for(const i of e.timeline?.keyframes??[])for(const s of i.shapes??[])t.add(s.sourceId);return[...t]}items(e){return[...e.tracks.map(t=>({track:t})),...e.interviews.map(t=>({interview:t}))]}optionLabel(e,t){const i=this.session;if(e.interview){const r=i.intervieweesOf(e.interview),o=r.length>0?r.map(d=>this.labelOf(d,i.tracks.indexOf(d))).join(", "):this.said.read(e.interview.title);if(!o)return this.messages.untitledInterview.replace("{n}",String(i.interviews.indexOf(e.interview)+1));const l=e.interview.title?this.said.read(e.interview.title):"";return r.length>0&&i.interviews.some(d=>d!==e.interview&&i.intervieweesOf(d).some(h=>r.includes(h)))&&l?`${this.messages.interviewOf} ${o} (${l})`:`${this.messages.interviewOf} ${o}`}const s=e.track,n=this.labelOf(s,t);return s.kind==="observer"?`${this.messages.accountOf} ${n}`:n}async showInterview(e){const t=this.session;if(t&&(this.commit(),this.current=void 0,this.passagesToken++,this.editor.passages=void 0,this.currentInterview=e,this.refreshRow(),await this.ensureInterview(),this.currentInterview===e)){for(const i of t.intervieweesOf(e))await this.loadTrack(i).catch(()=>{});this.currentInterview===e&&(this.interviewElement.witnesses=t.tracks.filter(i=>i.kind==="observer").map(i=>({id:i.event.id??t.proposedId(i),label:this.labelOf(i,t.tracks.indexOf(i)),moments:this.momentsOf(i)})),this.interviewElement.documentUrl=t.url,this.interviewElement.transcriptText=t.transcriptText(e),this.interviewElement.event=e)}}ensureInterview(){return this.interviewReady??=M(async()=>{const{register:e}=await import("./InterviewEditorElement-B33-sGHI.js");return{register:e}},__vite__mapDeps([35,1,3,4,5,6,7,8,9,36,19,37,34,18,20,21,22,23,24]),import.meta.url).then(({register:e})=>{e(),customElements.upgrade(this.shadow)},e=>{throw this.interviewReady=void 0,e}),this.interviewReady}interviewChanged(e){const{field:t}=e,i=this.session,s=this.currentInterview;if(!(!i||!s)){t==="transcript"&&e.text!==void 0&&i.keepTranscript(s,e.text);for(const n of[s.interviewOf].flat()){const r=i.tracks.find(o=>o.kind==="observer"&&(o.event.id??i.proposedId(o))===n);r&&i.ensureId(r)}i.touch(),this.refreshRow(),this.scheduleDirtyCheck()}}eventsInTime(e){const t=this.items(e);return Pe.inTime(t,{when:i=>String((i.track?.event??i.interview)?.time??""),kind:i=>this.kindOf(i),read:i=>{const s=i.track?.kind==="reading"?e.accountOf(i.track):void 0;return s?[{track:s}]:[]}})}momentsOf(e){return(e.recording?.milestones??[]).map(t=>{const i=this.said.read(t.note);return{at:t.t/1e3,label:this.said.read(t.label)??"",...i?{note:i}:{}}})}citedFrom;showCited(e,t,i){const s=this.byId("cited");if(this.citedFrom=e,!e||!this.session){s.hidden=!0;return}const n=this.momentsOf(t).find(o=>Math.abs(o.at-i.at)<.05),r=(i.quote??"").length>120?`${i.quote.slice(0,117)}…`:i.quote??"";this.byId("cited-text").textContent=this.messages.citedMoment.replace("{k}",n?.label??`${Math.round(i.at)} s`).replace("{title}",this.optionLabel({interview:e},0)).replace("{quote}",r),s.hidden=!1}kindOf(e){return e.interview?"interview":e.track.kind==="reading"?"reading":"observation"}kindLabel(e){return Pe.kindLabel(e,this.messages)}refreshOverview(){const e=this.session,t=this.byId("case-overview"),i=this.byId("event-crumbs");if(t.hidden=!e||!this.listShown,i.hidden=!e||this.listShown,this.byId("event-item").hidden=e!==void 0&&this.listShown,this.byId("group-events").classList.toggle("one-open",e!==void 0&&!this.listShown),this.byId("events-count").textContent=e?String(this.items(e).length):"",this.byId("case-heading").textContent=e&&String(e.json.title??"")||this.messages.caseHeading,!e)return;const s=this.eventsInTime(e);this.renderEvents(e,s),this.compareReadings(e);const n=s.findIndex(({item:o})=>o.interview?o.interview===this.currentInterview:o.track===this.current),r=s[n];if(r){const o=this.kindOf(r.item),l=this.byId("crumb-kind");l.textContent=this.kindLabel(o),l.dataset.kind=o,this.byId("crumb-title").textContent=this.optionLabel(r.item,r.index)}this.byId("previous-event").disabled=n<=0,this.byId("next-event").disabled=n<0||n>=s.length-1}authorName(e){if("people"in e)return e.people;if("org"in e)return e.org;const t=e;return this.said.read(t.title)??t.id??""}authorsText(e){return(e??[]).map(t=>this.authorName(t)).filter(t=>t!=="").join(", ")}authorsSaid(e){const t=(e??[]).map(i=>this.authorName(i)).filter(i=>i!=="");return t.length<2?t.join(""):`${t.slice(0,-1).join(", ")} ${this.messages.linkAnd} ${t[t.length-1]}`}authorsFrom(e,t){const i=e.split(",").map(s=>s.trim()).filter(s=>s!=="");if(i.length!==0)return i.map(s=>(t??[]).find(n=>this.authorName(n)===s)??{title:s})}grouping=Pe.groupingRemembered();folded=new Set;kindsShown=new Set(["observation","interview","reading"]);renderFilter(e){const t=this.messages,i=this.byId("event-filter"),s=["observation","reading","interview"].map(n=>({kind:n,count:e.filter(({item:r})=>this.kindOf(r)===n).length})).filter(({count:n})=>n>0);i.hidden=s.length<2,!i.hidden&&i.replaceChildren(...s.map(({kind:n,count:r})=>{const o=this.kindsShown.has(n),l=document.createElement("button");l.type="button",l.className="filter-chip",l.dataset.kind=n,l.setAttribute("aria-pressed",String(o));const a=document.createElement("span");a.textContent={observation:t.kindObservations,reading:t.kindReadings,interview:t.kindInterviews}[n];const d=document.createElement("span");return d.className="filter-count",d.textContent=String(r),l.append(a,d),l.addEventListener("click",()=>{const h=this.kindsShown.has(n);h&&!s.some(c=>c.kind!==n&&this.kindsShown.has(c.kind))||(h?this.kindsShown.delete(n):this.kindsShown.add(n),this.refreshOverview())}),l}))}renderEvents(e,t){const i=this.messages,s=this.byId("event-list"),n=t.filter(({item:p})=>this.kindsShown.has(this.kindOf(p)));this.renderFilter(t),this.byId("events-count").textContent=String(n.length);const r=p=>{const m=[p.track?.event.interpretationOf].flat().filter(f=>f!==void 0);return n.map(({item:f})=>f).filter(f=>f.track?.kind==="observer"&&m.some(g=>f.track.event.id===g||f.track.recording?.id===g))},o=n.some(({item:p})=>this.kindOf(p)==="reading"),l=this.byId("group-readings");l.hidden=!o,l.setAttribute("aria-pressed",String(this.grouping));const a=this.grouping?Pe.grouped(n,{kind:p=>this.kindOf(p),read:r}):n,d=new Map(n.map(({item:p,index:m})=>[p,m])),h=p=>!this.listShown&&(p.interview?p.interview===this.currentInterview:p.track===this.current),u=a.filter(({item:p,under:m})=>m===void 0||!this.folded.has(d.get(m))||h(p)).map(({item:p,index:m,under:f})=>{const g=this.kindOf(p),b=p.track?.event??p.interview,v={at:m,kind:g,title:this.optionLabel(p,m),meta:[b.time?String(b.time).replace("T"," "):"",b.id??""].filter(Boolean).join(" · "),by:g==="observation"?"":this.authorsSaid(b.by),open:h(p),...f?{nested:!0}:{}},I=this.grouping&&g==="observation"?a.filter(S=>S.under===p).length:0;if(I>0&&(v.readings={count:I,folded:this.folded.has(m)}),p.track?.kind==="observer"){const S=e.interviews.filter(w=>e.intervieweesOf(w).includes(p.track)).map(w=>({at:e.tracks.length+e.interviews.indexOf(w),title:this.optionLabel({interview:w},0)}));S.length>0&&(v.links={heading:i.passagesHeading,to:S})}else if(p.track){const S=[p.track.event.interpretationOf].flat().filter(w=>w!==void 0).map(w=>e.tracks.find(x=>x.kind==="observer"&&(x.event.id===w||x.recording?.id===w))).filter(w=>w!==void 0).filter(w=>w!==f?.track).map(w=>({at:e.tracks.indexOf(w),title:this.labelOf(w,e.tracks.indexOf(w))}));S.length>0&&(v.links={heading:f?i.alsoAbout:i.interpretationOf,to:S})}return v});new Pe(s,p=>this.openEvent(p),p=>this.openEvent(p),void 0,p=>{this.folded.delete(p)||this.folded.add(p),this.refreshOverview()}).render(u,i,(p,{card:m,body:f,links:g})=>this.dress(e,t.find(({index:b})=>b===p.at).item,p.at,m,f,g))}dress(e,t,i,s,n,r){const o=this.messages,l=r.textContent!=="",a=t.track?.kind==="reading"?this.findingsOf(t.track):void 0,d=Ln.of(a);if(d){s.dataset.verdict=d;const p=document.createElement("span");p.className="verdict",p.textContent=o.readingVerdict[d],r.prepend(p,...l?[document.createTextNode(" · ")]:[])}const h=t.track!==void 0&&re.sealed(t.track.event);if(h){const p=r.textContent!=="";s.dataset.sealed="";const m=document.createElement("span");m.className="sealed-chip",m.textContent=o.sealedChip,r.prepend(m,...p?[document.createTextNode(" · ")]:[])}const c=document.createElement("span");if(c.className="event-tools",t.track){const p=document.createElement("button");p.type="button",p.className="icon-btn event-tool event-copy",p.innerHTML=D.COPY,p.title=o.cloneEvent,p.setAttribute("aria-label",o.cloneEvent),p.addEventListener("click",()=>void this.cloneFromList(i));const m=document.createElement("button");m.type="button",m.className="icon-btn event-tool event-freeze",m.innerHTML=h?D.LOCK:D.LOCK_OPEN,m.title=h?o.unfreezeEvent:o.freezeEvent,m.setAttribute("aria-label",m.title),m.setAttribute("aria-pressed",String(h)),m.addEventListener("click",()=>void this.toggleFrozen(i)),c.append(p,m)}const u=document.createElement("button");if(u.type="button",u.className="icon-btn event-delete",u.innerHTML=D.TRASH,u.title=h?o.deleteFrozen:o.deleteRecording,u.setAttribute("aria-label",u.title),u.disabled=h,u.addEventListener("click",()=>void this.deleteFromList(i)),c.append(u),a&&a.length>0&&n.append(this.findingsList(a)),t.track?.kind==="reading"&&t.track.recording){const p=Dn.create();p.show(e.accountOf(t.track)?.recording,t.track.recording),n.append(p)}s.append(c)}findingsOf(e){const t=this.session?.accountOf(e),i=[e,t].filter(r=>r!==void 0&&!r.recording);if(i.length>0){for(const r of i)this.fetchingFindings.has(r)||(this.fetchingFindings.add(r),this.loadTrack(r).then(()=>this.refreshOverview(),()=>{}));if(!e.recording)return}const s=e.recording.interpretation?.findings??[],n=t?.recording&&this.readingCheck?this.readingCheck.findingsOf(t.recording,e.recording):[];return[...s,...n]}fetchingFindings=new WeakSet;readingCheck;bestCases;laid=new WeakSet;layMostFavourable(e){if(e.kind!=="reading"||!e.recording||this.laid.has(e)||!this.bestCases)return;const t=this.session?.accountOf(e)?.recording;if(!t)return;this.laid.add(e);const i=this.bestCases.bestSceneOf(t,e.recording);i&&(e.recording=i,e.loaded=JSON.stringify(i))}findingsList(e){const t=this.messages,i=document.createElement("ul");i.className="findings";for(const s of e){const n=document.createElement("li");n.dataset.outcome=s.outcome;const r=document.createElement("span");r.className="finding-mark",r.textContent={holds:"✓",fails:"✗",untested:"?"}[s.outcome],r.title=t.findingOutcome[s.outcome],r.setAttribute("aria-label",t.findingOutcome[s.outcome]);const o=document.createElement("span");if(o.textContent=this.said.read(s.text)??"",n.append(r,o),s.outcome==="fails"){const l=document.createElement("span");l.className="finding-against",l.textContent=` (${t.findingAgainst[s.against??"established"]})`,n.append(l)}i.append(n)}return i}openEvent(e){const t=this.byId("track");t.value=String(e),t.dispatchEvent(new Event("change")),requestAnimationFrame(()=>this.bringEditorIntoView())}bringEditorIntoView(){const e=this.editor;if(!e.checkVisibility?.())return;const t=e.getBoundingClientRect();Math.abs(t.top)>1&&e.scrollIntoView?.({block:"start",behavior:"smooth"})}async cloneFromList(e){const t=this.session,s=(t?this.items(t)[e]:void 0)?.track;if(!t||!s)return;try{await this.loadTrack(s)}catch{this.showError(this.messages.loadFailed);return}const n=t.clone(s);if(!n)return;this.refreshRow();const r=this.items(t).findIndex(o=>o.track===n);r>=0&&this.openEvent(r)}async toggleFrozen(e){const t=this.session,s=(t?this.items(t)[e]:void 0)?.track;!t||!s||(!re.sealed(s.event)&&this.current===s&&this.commit(),t.seal(s,!re.sealed(s.event)),this.refreshRow())}refreshEventAuthor(){const e=this.currentInterview?void 0:this.current,t=this.currentInterview??(e?.kind==="reading"?e.event:void 0),i=this.byId("row-event-author");if(i.hidden=t===void 0,!t)return;this.byId("label-event-author").textContent=this.currentInterview?this.messages.interviewerField:this.messages.authorField;const s=this.input("event-author");this.shadow.activeElement!==s&&(s.value=this.authorsText(t.by)),s.disabled=e!==void 0&&re.sealed(e.event)}writeEventAuthor(){const e=this.session,t=this.currentInterview?void 0:this.current,i=this.currentInterview??(t?.kind==="reading"?t.event:void 0);if(!e||!i||t&&re.sealed(t.event))return;const s=this.authorsFrom(this.input("event-author").value,i.by);s?i.by=s:delete i.by;const n=t?.recording?.interpretation;n&&(s?n.by=s:delete n.by),e.touch(),this.refreshOverview(),this.refreshDirty()}showFrozen(e){this.byId("frozen-note").hidden=!e,this.byId("frozen-text").textContent=e?this.messages.frozenNote:"",this.editor.toggleAttribute("inert",e)}async deleteFromList(e){const t=this.session,i=t?this.items(t)[e]:void 0;i&&(this.byId("track").value=String(e),i.interview?await this.showInterview(i.interview):await this.showTrack(i.track),this.askDelete())}stepEvent(e){const t=this.session;if(!t)return;const i=this.eventsInTime(t),s=i.findIndex(({item:r})=>r.interview?r.interview===this.currentInterview:r.track===this.current),n=i[s+e];n&&this.openEvent(n.index)}refreshCaseState(){this.byId("save-case").disabled=!(this.session?.dirty??!1);const e=this.byId("share-case");e.disabled=this.sourceUrl===void 0,e.title=this.sourceUrl===void 0?this.shareMessages?.unavailable??"":"";const t=this.byId("read-case");t.hidden=!this.hasAttribute(pt)&&this.readAddress()===void 0,this.session&&t.parentElement!==e.parentElement?e.before(t):!this.session&&t.parentElement!==this.editor&&(t.slot="head-actions",this.editor.append(t))}switcher;readAddress(){return this.session?this.sourceUrl:this.editor.address}read(){const e=this.readAddress();if(this.hasAttribute(pt)){const i=this.holdForReading();if(qs.ask(this,Zs,i))return;_e.releaseCopies()}if(e===void 0)return;const t=this.session?this.sharedTrack:void 0;window.open(`${mi.home()}/play/?file=${encodeURIComponent(e)}${t?`&events=${encodeURIComponent(Me.fileKey(t))}`:""}`,"_blank","noopener")}static fileKey(e){return new URL(e,location.href).pathname.split("/").pop().replace(/\.json$/i,"")}holdForReading(){const e=new Map,t=this.session;if(t){this.commit();const n=this.sourceUrl===void 0;e.set(t.url,{json:t.json,changed:t.dirty,local:n});for(const r of t.tracks)r.recording&&e.set(r.url,{json:r.recording,changed:t.changed(r),local:n});return _e.releaseCopies(),_e.hold(e),{src:t.url,...this.sharedTrack?{track:this.sharedTrack}:{}}}const i=this.editor.address,s=i??new URL("recording.json",location.href).href;return e.set(s,{json:this.editor.sightingData,changed:this.editor.dirty,local:i===void 0}),_e.releaseCopies(),_e.hold(e),{src:s}}askBeforeReplacing(e){this.guarded(()=>{this.leaving=!0,e()})}async openTrack(e){const t=this.session;if(!t)return;const i=new URL(e,location.href).href,s=t.tracks.find(n=>n.url===i);!s||s===this.current&&!this.listShown&&!this.currentInterview||(this.listShown=!1,await this.showTrack(s))}sourceUrl;shareDialog;shareMessages;get sharedTrack(){return this.currentInterview?void 0:this.current?.url}shareSubject={module:"rr0-sighting-editor",link:()=>{const e=this.sharedTrack;return`${mi.home()}/edit/?file=${encodeURIComponent(this.sourceUrl??"")}${e?`&track=${encodeURIComponent(e)}`:""}`},element:()=>{const e=this.sharedTrack;return`<rr0-case-editor src="${this.sourceUrl??""}"${e?` track="${e}"`:""}></rr0-case-editor>`}};openShare(){this.sourceUrl!==void 0&&(this.shareDialog.note=this.session?.dirty?this.shareMessages?.unsaved:void 0,this.shareDialog.open())}compareReadings(e){en.register();const t=this.byId("readings-comparison");t.toggleAttribute("data-filtered",!this.kindsShown.has("reading"));const i=()=>e.tracks.flatMap((s,n)=>{if(s.kind!=="reading")return[];const r=e.accountOf(s);return[{title:this.labelOf(s,n),witness:r?this.labelOf(r,e.tracks.indexOf(r)):"",...s.recording?{reading:s.recording}:{},...r?.recording?{account:r.recording}:{},open:()=>this.openFromTable(e,s)}]});t.show(i(),async()=>{const s=e.tracks.filter(n=>n.kind==="reading").flatMap(n=>[n,e.accountOf(n)]).filter(n=>n!==void 0&&!n.recording);return await Promise.all([...new Set(s)].map(n=>this.loadTrack(n).catch(()=>{}))),i()})}openFromTable(e,t){const i=this.items(e).findIndex(n=>n.track===t);if(i<0)return;const s=this.byId("track");s.value=String(i),s.dispatchEvent(new Event("change"))}labelOf(e,t){const i=this.said.read(e.event.title)??this.said.read(e.recording?.interpretation?.title);if(i)return i;if(e.kind==="observer")return this.said.read(e.recording?.observer?.title)??e.event.url??"";const s=this.session.tracks.filter(n=>n.kind==="reading").indexOf(e)+1;return this.messages.untitledReading.replace("{n}",String(s||t+1))}makeCase(){if(this.session)return;const e=this.editor.sightingData,t=e.time,i=typeof t=="object"?t.value:t,s=i?Me.rr0TimeOf(i):void 0,n=this.said.read(e.observer?.title),r=this.getAttribute("src")?new URL(this.getAttribute("src"),location.href).href:void 0;this.session=re.around(e,s,n,r,location.href),this.listShown=!1,this.current=this.session.tracks[0],this.session.keep(this.current,e),this.dateModeFor=void 0,this.refreshRow()}writeCaseField(e,t){const i=this.session?.json;i&&(t.trim()===""?delete i[e]:i[e]=t,this.session?.touch(),this.scheduleDirtyCheck())}static rr0TimeOf(e){return e.replace(/^(\d{4}-\d\d-\d\d)T/,"$1 ")}static edtfOf(e){return e.replace(/^(\d{4}-\d\d-\d\d) (?=\d)/,"$1T")}showCaseTime(e){const t=String(e.json.time??""),i=t===""?void 0:_n(Me.edtfOf(t));if(this.caseDate.time=i,t!==""&&!i){const s=this.input("case-time");s.value=t}this.dateModeFor!==e&&(this.caseDate.setPrecise(!(t!==""&&!i)&&rt.opensPrecise(i)),this.dateModeFor=e)}refreshRow(){const e=this.session;if(this.applySections(),this.byId("case-panel").hidden=e===void 0,this.refreshOverview(),this.byId("make-case-row").hidden=e!==void 0,this.byId("case").classList.toggle("in-case",e!==void 0),this.byId("event-item").classList.toggle("in-case",e!==void 0),this.holdEditor(e!==void 0),!e){this.refreshDirty();return}const t=this.shadow.activeElement;for(const[o,l]of[["case-id","id"],["case-title","title"]]){const a=this.input(o);a!==t&&(a.value=String(e.json[l]??""))}t?.closest?.("rr0-date-input")||this.showCaseTime(e);const i=this.byId("track"),s=this.items(e);i.replaceChildren(...s.map((o,l)=>new Option(this.optionLabel(o,l),String(l))));const n=this.currentInterview?s.findIndex(o=>o.interview===this.currentInterview):this.current?s.findIndex(o=>o.track===this.current):0;i.value=String(Math.max(0,n));const r=this.currentInterview===void 0&&this.current!==void 0&&re.sealed(this.current.event);this.byId("delete").disabled=r||this.currentInterview===void 0&&e.tracks.length<=1,this.showFrozen(r),this.refreshEventAuthor(),this.refreshRecordingId(e),this.refreshDirty()}holdEditor(e){this.editor.embedded=e,e&&this.byId("history-slot").append(this.editor.historyControls),this.shadow.querySelector(".event-id-row").hidden=!e}refreshRecordingId(e){const t=this.current,i=t!==void 0&&t.kind==="observer";if(this.byId("row-recording-id").hidden=!i,i){const l=this.input("recording-id");this.shadow.activeElement!==l&&(l.value=t.event.id??""),l.placeholder=e.proposedId(t),l.disabled=re.sealed(t.event),l.title=l.disabled?this.messages.frozenNote:""}const{duplicateIds:s,unresolved:n}=e.problems(),r=[...s.map(l=>this.messages.idDuplicated.replace("{id}",l)),...n.map(({reference:l})=>this.messages.readingUnresolved.replace("{id}",l))],o=this.byId("case-problems");o.hidden=r.length===0,o.textContent=r.join(" ")}showRecordingIdError(e){const t=this.byId("recording-id-error");t.textContent=e??"",t.hidden=e===void 0}writeRecordingId(){const e=this.session,t=this.current;if(!e||!t)return;const i=e.setId(t,this.input("recording-id").value.trim());this.showRecordingIdError(i==="ok"?void 0:{empty:this.messages.idNeeded,invalid:this.messages.idInvalid,taken:this.messages.idTaken}[i]),this.scheduleDirtyCheck()}get dialog(){return this.byId("dialog")}openDialog(e,t,i,s,n){this.dialogMode=e,this.byId("dialog-title").textContent=t;const r=this.byId("dialog-message");if(r.textContent=i??"",r.hidden=i===void 0,this.showError(void 0),this.byId("fields-add").hidden=e!=="add",this.byId("fields-export").hidden=e!=="export",this.byId("ok").hidden=!1,this.byId("ok").textContent=s??(e==="discard"?this.messages.discardOk:this.messages.ok),this.dialog.classList.toggle("anchored",n!==void 0),n){const o=n.getBoundingClientRect();this.dialog.style.top=`${Math.round(o.bottom+6)}px`,this.dialog.style.right=`${Math.max(8,Math.round(window.innerWidth-o.right))}px`,this.dialog.style.left="auto",typeof this.dialog.show=="function"?this.dialog.show():this.dialog.setAttribute("open",""),this.beside??=l=>{const a=l.composedPath();(l instanceof KeyboardEvent?l.key==="Escape":!a.includes(this.dialog)&&!a.includes(this.anchor))&&this.closeDialog()},this.anchor=n,document.addEventListener("pointerdown",this.beside,!0),document.addEventListener("keydown",this.beside,!0);return}this.dialog.style.removeProperty("top"),this.dialog.style.removeProperty("right"),this.dialog.style.removeProperty("left"),typeof this.dialog.showModal=="function"?this.dialog.showModal():this.dialog.setAttribute("open","")}beside;anchor;closeDialog(){this.beside&&(document.removeEventListener("pointerdown",this.beside,!0),document.removeEventListener("keydown",this.beside,!0)),this.pendingLoad=void 0,typeof this.dialog.close=="function"?this.dialog.close():this.dialog.removeAttribute("open")}showError(e){const t=this.byId("dialog-error");t.textContent=e??"",t.hidden=e===void 0}input(e){return this.byId(e)}inputFile(e){return this.byId(e)}today(){return new Date().toISOString().slice(0,10)}askAdd(){const e=this.session;if(!e)return;this.openDialog("add",this.messages.addTitle,void 0,void 0,this.byId("add"));const t=this.byId("of");t.replaceChildren(...e.tracks.filter(n=>n.kind==="observer").map(n=>new Option(this.labelOf(n,e.tracks.indexOf(n)),String(e.tracks.indexOf(n)))));const i=this.byId("kind");i.value="observation",i.options[1].disabled=t.options.length===0;const s=e.tracks.filter(n=>n.kind==="observer");this.byId("witness").replaceChildren(...s.map(n=>new Option(this.labelOf(n,e.tracks.indexOf(n)),String(e.tracks.indexOf(n))))),this.byId("medium").replaceChildren(),this.byId("source").value="blank";for(const n of["observer","title","author"])this.input(n).value="";this.inputFile("add-source").clear(),this.input("date").value="",this.syncSourceFields()}async fillMedia(){const{InterviewMedia:e}=await M(async()=>{const{InterviewMedia:i}=await import("./InterviewMedia-CvAxC62V.js");return{InterviewMedia:i}},[],import.meta.url),t=this.byId("medium");t.options.length>0||t.replaceChildren(...e.ALL.map(i=>new Option(e.label(i,this.language),i)))}syncSourceFields(){const e=this.byId("kind").value,t=e==="interview",i=this.byId("source").value,s=e==="reading";this.byId("row-source").hidden=t,this.byId("row-of").hidden=!s,this.byId("row-witness").hidden=!t,this.byId("row-medium").hidden=!t,t&&this.fillMedia(),this.byId("row-file").hidden=t||i!=="file",this.byId("row-observer").hidden=t||s,this.byId("row-title").hidden=!(t||s),this.byId("row-author").hidden=!(t||s),this.byId("label-title").textContent=t?this.messages.plainTitleField:this.messages.titleField,this.byId("label-author").textContent=t?this.messages.interviewerField:this.messages.investigatorField;const n=this.input("date");n.disabled=s,s&&(n.value=this.today())}askExport(){this.session&&(this.openDialog("export",this.messages.exportTitle),this.input("export-recordings").checked=!0)}askDelete(){const e=this.session;if(e&&this.currentInterview){this.openDialog("delete",this.messages.deleteRecording,this.messages.deleteInterviewQuestion);return}const t=this.current;if(!(!e||!t)){if(t.kind==="observer"){const i=e.readingsOf(t).length;if(i>0){this.openDialog("delete",this.messages.deleteRecording,this.messages.deleteRefused.replace("{n}",String(i))),this.byId("ok").hidden=!0;return}}this.openDialog("delete",this.messages.deleteRecording,t.kind==="reading"?this.messages.deleteReadingQuestion:this.messages.deleteObservationQuestion)}}async submitDialog(){switch(this.dialogMode){case"delete":this.closeDialog(),this.deleteCurrent();return;case"discard":{const e=this.pendingLoad;this.closeDialog(),e?.();return}case"export":await this.exportCase(this.input("export-recordings").checked)?this.closeDialog():this.showError(this.messages.loadFailed);return;case"add":await this.addRecording()&&this.closeDialog()}}async addRecording(){const e=this.session;if(!e)return!1;if(this.commit(),this.byId("kind").value==="interview"){const c=e.tracks[Number(this.byId("witness").value)],u=this.input("title").value.trim(),p=this.input("author").value.trim(),m=e.addInterview(c,this.input("date").value||this.today(),u!==""?u:void 0,p!==""?p.split(",").map(f=>({people:f.trim()})).filter(f=>f.people!==""):void 0,this.byId("medium").value);return await this.showInterview(m),!0}const t=this.byId("of").value,i=this.byId("kind").value==="reading"&&t!==""?e.tracks[Number(t)]:void 0,s=this.byId("source").value;if(i&&s==="blank"){if(i.kind!=="observer"||!i.recording)return!1;const c=this.input("title").value.trim(),u=this.input("author").value.trim(),p=e.addReading(i,this.input("date").value||this.today(),c!==""?c:void 0,u!==""?[{title:u}]:void 0);return this.showTrack(p),!0}const n=this.input("observer").value.trim(),r=this.input("date").value.trim();let o;try{if(s==="blank"){const c=(n||"observation").replace(/[^A-Za-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"observation";o={version:4,id:`${r?`${r}-`:""}${c}`,...n?{observer:{title:n}}:{},...r?{time:r}:{},timeline:{keyframes:[],order:[],groups:[]}}}else{const c=await this.readFile();if(ie.isCase(c))return this.showError(this.messages.isACase),!1;o=c,n&&!o.observer?.title&&(o={...o,observer:{...o.observer,title:n}})}}catch{return this.showError(this.messages.loadFailed),!1}const l=(i?this.input("title").value:n).trim(),a=l!==""?l:this.said.read(o.observer?.title),d=this.input("author").value.trim(),h=e.addObservation(o,r!==""?r:void 0,a,i?{account:i,by:d!==""?[{title:d}]:void 0}:void 0);return this.showTrack(h),!0}async readFile(){const e=this.inputFile("add-source").value;if(!e)throw new Error("No file");if(e.url)return Ye.recording(new URL(e.url,location.href).href);const t=e.file,i=await new Promise((s,n)=>{const r=new FileReader;r.onload=()=>s(r.result),r.onerror=()=>n(r.error),r.readAsText(t)});return JSON.parse(i)}deleteCurrent(){const e=this.session,t=this.currentInterview;if(e&&t){if(!e.deleteInterview(t))return;this.currentInterview=void 0;const r=e.tracks.find(o=>o.kind==="observer")??e.tracks[0];r&&this.showTrack(r);return}const i=this.current;if(!e||!i)return;const s=i.kind==="reading"?e.accountOf(i)??e.tracks.find(r=>r.kind==="observer"):e.tracks.find(r=>r!==i);(i.kind==="reading"?e.deleteReading(i):e.deleteObservation(i).deleted)&&(this.current=void 0,s&&this.showTrack(s))}async exportCase(e=!0){const t=this.session;if(!t)return!0;if(this.commit(),e)try{for(const o of t.tracks)await this.loadTrack(o)}catch{return!1}const i=t.files(e,!0);if(t.markExported(e),this.fileEditor?.markSaved(),this.refreshDirty(),i.length===1)return this.download(new Blob([i[0].content],{type:"application/json"}),i[0].path),!0;const{zipSync:s,strToU8:n}=await M(async()=>{const{zipSync:o,strToU8:l}=await import("./browser-CltifEM0.js");return{zipSync:o,strToU8:l}},[],import.meta.url),r={};for(const o of i)r[o.path]=n(o.content);return this.download(new Blob([s(r)],{type:"application/zip"}),`${t.json.id??"case"}.zip`),!0}download(e,t){const i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=t,s.click(),URL.revokeObjectURL(i)}}function ho(){zs(),customElements.get(fi)||customElements.define(fi,Me)}const So=Object.freeze(Object.defineProperty({__proto__:null,CASE_EDITOR_ELEMENT_NAME:fi,CaseEditorElement:Me,register:ho},Symbol.toStringTag,{value:"Module"}));export{So as C,Le as I,ms as M};