@rr0/ufoathome 0.203.0 → 0.204.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/dist-embed-scene/SceneNames_en--zj8Tlec.js +1 -0
  2. package/dist-embed-scene/SceneNames_es-toWs7p7i.js +1 -0
  3. package/dist-embed-scene/SceneNames_fr-w4Xdplid.js +1 -0
  4. package/dist-embed-scene/SceneNames_it-Cwcscdx7.js +1 -0
  5. package/dist-embed-scene/rr0-scene.mjs +296 -296
  6. package/dist-embed-scene/sightingSchema-DoPVOlCB.js +1 -0
  7. package/dist-embed-sighting/{AdsbLolArchiveProvider-CsuxO9wl.js → AdsbLolArchiveProvider-BSewzrRe.js} +1 -1
  8. package/dist-embed-sighting/{AirshipEditor-DkDCkwGG.js → AirshipEditor-BiG7EYoB.js} +2 -2
  9. package/dist-embed-sighting/{AuroraEditor-C4tY9hXK.js → AuroraEditor-C1Y_zbNW.js} +1 -1
  10. package/dist-embed-sighting/{AuroraSimulation-C7LAHgWM.js → AuroraSimulation-B9GaDXC3.js} +2 -2
  11. package/dist-embed-sighting/{BallesterGuaspAssessor-BPaiHWd9.js → BallesterGuaspAssessor-BAXmW7XL.js} +1 -1
  12. package/dist-embed-sighting/BalloonEditor-D54CC7cn.js +24 -0
  13. package/dist-embed-sighting/{BeamEditor-DDzw-fB_.js → BeamEditor-SHXD10FH.js} +1 -1
  14. package/dist-embed-sighting/{BeamSystem-CsNwl_vM.js → BeamSystem-CP3J9Jgx.js} +1 -1
  15. package/dist-embed-sighting/{BirdEditor-BgNNcdhv.js → BirdEditor-BCit7Rs-.js} +1 -1
  16. package/dist-embed-sighting/{BirdFlock-DBgkxsxp.js → BirdFlock-DhsSOJTg.js} +1 -1
  17. package/dist-embed-sighting/{CaseReportExport--iqqhu1e.js → CaseReportExport-Dk3rKiVm.js} +2 -2
  18. package/dist-embed-sighting/{ContrailSystem-Di5w5IVi.js → ContrailSystem-70o5ynhD.js} +1 -1
  19. package/dist-embed-sighting/ControlPasses-DQMrWqA3.js +29 -0
  20. package/dist-embed-sighting/{CoverageAssessor-Cu9wP4ZB.js → CoverageAssessor-BdZ85Hmy.js} +1 -1
  21. package/dist-embed-sighting/{DroneEditor-5nuq52EG.js → DroneEditor-DwQsVj8U.js} +1 -1
  22. package/dist-embed-sighting/{DroneParameters-DHeJ7KyU.js → DroneParameters-91BBY10Y.js} +1 -1
  23. package/dist-embed-sighting/{Flightradar24Provider-p4a3_chL.js → Flightradar24Provider-NbfW-lDQ.js} +1 -1
  24. package/dist-embed-sighting/{GLTFLoader-fbsNsHlp.js → GLTFLoader-CTETHs7e.js} +1 -1
  25. package/dist-embed-sighting/GenerativeKitMessages-hgIQ_sST.js +1 -0
  26. package/dist-embed-sighting/{HeadlightSystem-Ce7sHylX.js → HeadlightSystem-ByKGq-30.js} +1 -1
  27. package/dist-embed-sighting/{HynekAssessor-DWDZGeLY.js → HynekAssessor-O1MFR79v.js} +1 -1
  28. package/dist-embed-sighting/LanternEditor-X0RgF4mn.js +24 -0
  29. package/dist-embed-sighting/{LaunchEditor-BGyLgkGS.js → LaunchEditor-oTKLz_5C.js} +1 -1
  30. package/dist-embed-sighting/{LaunchSimulation-DvexI06i.js → LaunchSimulation-ClRFO1uw.js} +1 -1
  31. package/dist-embed-sighting/{ModuleSession-_kHZ7Tx3.js → ModuleSession-SivjhuIl.js} +3 -3
  32. package/dist-embed-sighting/ModuleThree-TrytNggN.js +1 -0
  33. package/dist-embed-sighting/{NearestApproach-CONyx4c5.js → NearestApproach-BM7B5PuM.js} +1 -1
  34. package/dist-embed-sighting/{ParameterForm-DFHcolwG.js → ParameterForm-BghOJXLP.js} +1 -1
  35. package/dist-embed-sighting/{PoherAssessor-DI86qOCu.js → PoherAssessor-DZMtM2pW.js} +1 -1
  36. package/dist-embed-sighting/PoherMatrix-C2fcLqDH.js +1 -0
  37. package/dist-embed-sighting/PoherSelfCheck-PJvhaWFK.js +1 -0
  38. package/dist-embed-sighting/{RailwaySystem-DcJr9BY_.js → RailwaySystem-Dmx9y4gO.js} +1 -1
  39. package/dist-embed-sighting/{ReentryEditor-C6EJJf4l.js → ReentryEditor-DozmlO_l.js} +1 -1
  40. package/dist-embed-sighting/{ReentrySimulation-BFVBOWrm.js → ReentrySimulation-WXW1IU2E.js} +1 -1
  41. package/dist-embed-sighting/{ReferenceSystem-zTvTqp5y.js → ReferenceSystem-BD7gXBee.js} +1 -1
  42. package/dist-embed-sighting/{RoadMarkings-DvWjbrSf.js → RoadMarkings-Bp07bgso.js} +1 -1
  43. package/dist-embed-sighting/SceneNames_en-BarwWQKA.js +1 -0
  44. package/dist-embed-sighting/SceneNames_es-CEdDjAb4.js +1 -0
  45. package/dist-embed-sighting/SceneNames_fr-m5WHqg-1.js +1 -0
  46. package/dist-embed-sighting/SceneNames_it-D_H_iZnc.js +1 -0
  47. package/dist-embed-sighting/{SearchlightEditor-By5Z3ef7.js → SearchlightEditor-BGmKCBrG.js} +1 -1
  48. package/dist-embed-sighting/{SearchlightSystem-PEMBDW1s.js → SearchlightSystem-5FPRRIkH.js} +1 -1
  49. package/dist-embed-sighting/SightingMessages_en-DKFVZnDu.js +1 -0
  50. package/dist-embed-sighting/SightingMessages_es-DYQlWvm0.js +1 -0
  51. package/dist-embed-sighting/SightingMessages_fr-BygVDDY9.js +1 -0
  52. package/dist-embed-sighting/SightingMessages_it-BI7GnXPz.js +1 -0
  53. package/dist-embed-sighting/{SkyLantern-yYihsrun.js → SkyLantern-1Rqy6fNz.js} +1 -1
  54. package/dist-embed-sighting/{TraceSystem-1K0WblAK.js → TraceSystem-DDlP7sxl.js} +2 -2
  55. package/dist-embed-sighting/{UfoMessages_en-CwRXodRE.js → UfoMessages_en-DvUA0KYR.js} +1 -1
  56. package/dist-embed-sighting/{WaterSystem-1VlNXZnO.js → WaterSystem-Ik6QzyT_.js} +2 -2
  57. package/dist-embed-sighting/rr0-sighting.mjs +344 -325
  58. package/dist-embed-sighting/sightingSchema-DoPVOlCB.js +1 -0
  59. package/dist-embed-sighting/{trafficRuntime-BUvbWOcl.js → trafficRuntime-CjDwU1Lk.js} +1 -1
  60. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-DNYpHE9t.js → AdsbLolArchiveProvider-CNMGHqqx.js} +1 -1
  61. package/dist-embed-sighting-editor/{AirshipEditor-B_TQEcNk.js → AirshipEditor-BVlkWwdL.js} +1 -1
  62. package/dist-embed-sighting-editor/{AirshipFlight-zrtPXNvX.js → AirshipFlight-Cvl6xWPY.js} +1 -1
  63. package/dist-embed-sighting-editor/{Aurora-wHi_XgNK.js → Aurora-DOIRpjiG.js} +1 -1
  64. package/dist-embed-sighting-editor/{AuroraEditor-CHAo9LbG.js → AuroraEditor-B0tCM7E7.js} +1 -1
  65. package/dist-embed-sighting-editor/{AuroraSimulation-CMoKbd0k.js → AuroraSimulation-CX7V0obh.js} +1 -1
  66. package/dist-embed-sighting-editor/{BallesterGuaspAssessor-Bylahnc2.js → BallesterGuaspAssessor-DEJId5n8.js} +1 -1
  67. package/dist-embed-sighting-editor/{BalloonEditor-DOmOj25v.js → BalloonEditor-Drb5evP5.js} +1 -1
  68. package/dist-embed-sighting-editor/{BalloonFlight-DkhpbdZV.js → BalloonFlight-CGXmDbNq.js} +1 -1
  69. package/dist-embed-sighting-editor/{BeamEditor-CwC6pRPq.js → BeamEditor-DP2LNObR.js} +1 -1
  70. package/dist-embed-sighting-editor/{BeamSystem-Zsq9zuJa.js → BeamSystem-BCaOtm3H.js} +1 -1
  71. package/dist-embed-sighting-editor/{BirdEditor-DslUOI4x.js → BirdEditor-CbYZcYyG.js} +1 -1
  72. package/dist-embed-sighting-editor/{BirdFlock-BoXaV-S_.js → BirdFlock-Dv9Awhvf.js} +1 -1
  73. package/dist-embed-sighting-editor/{CaseElement-DFnjs2AU.js → CaseElement-4CRoH54h.js} +2 -2
  74. package/dist-embed-sighting-editor/{CaseReportExport-CX87uNr9.js → CaseReportExport-W1lO4CR3.js} +1 -1
  75. package/dist-embed-sighting-editor/{ContrailSystem-hUtlCEq-.js → ContrailSystem-ChbOVWp-.js} +1 -1
  76. package/dist-embed-sighting-editor/{ControlPasses-C8qq_tSL.js → ControlPasses-Dgz_D6DL.js} +1 -1
  77. package/dist-embed-sighting-editor/{CoverageAssessor-uzQnTEH8.js → CoverageAssessor-CcVuVsG0.js} +1 -1
  78. package/dist-embed-sighting-editor/{DroneEditor-M2V3FKbS.js → DroneEditor-D6k4gYj4.js} +1 -1
  79. package/dist-embed-sighting-editor/{DroneFlight-C1bur42A.js → DroneFlight-D-MWhrXa.js} +1 -1
  80. package/dist-embed-sighting-editor/{DroneParameters-DRfoxMx8.js → DroneParameters-CdQbwFKD.js} +1 -1
  81. package/dist-embed-sighting-editor/{Flightradar24Provider-BJDB9e9p.js → Flightradar24Provider-D_eLiI9k.js} +1 -1
  82. package/dist-embed-sighting-editor/{GLTFLoader-CQrldtm5.js → GLTFLoader-BIk0ozTu.js} +1 -1
  83. package/dist-embed-sighting-editor/{HeadlightSystem-BzXjwGDi.js → HeadlightSystem-C9tLjvpO.js} +1 -1
  84. package/dist-embed-sighting-editor/{HynekAssessor-Bpze0IeH.js → HynekAssessor-B4ej1xgG.js} +1 -1
  85. package/dist-embed-sighting-editor/{InterviewEditorElement-C6y-8Wze.js → InterviewEditorElement-Bo4OG2ig.js} +3 -3
  86. package/dist-embed-sighting-editor/{LanternEditor-6fXL9oHW.js → LanternEditor-Hd-8kmET.js} +1 -1
  87. package/dist-embed-sighting-editor/{LaserBeam-Cl4c8oJt.js → LaserBeam-Ca2QUeCT.js} +1 -1
  88. package/dist-embed-sighting-editor/{LaunchEditor-C9swLaSJ.js → LaunchEditor-BykQEscN.js} +1 -1
  89. package/dist-embed-sighting-editor/{LaunchPlume-CPBS4JLE.js → LaunchPlume-Dos-OyTV.js} +1 -1
  90. package/dist-embed-sighting-editor/{LaunchSimulation-zjImyFHC.js → LaunchSimulation-B0DgOoJM.js} +1 -1
  91. package/dist-embed-sighting-editor/{ModelSource-ZiTya13j.js → ModelSource-szsl2QtY.js} +1 -1
  92. package/dist-embed-sighting-editor/{ModelThumbnails-BKl0Wk33.js → ModelThumbnails-dnCeD6UT.js} +1 -1
  93. package/dist-embed-sighting-editor/{ModelViewer-ZZnOiYz4.js → ModelViewer-BNGSukqO.js} +1 -1
  94. package/dist-embed-sighting-editor/{ModuleConformance-CYQ-Mn8w.js → ModuleConformance-CEXxsL48.js} +2 -2
  95. package/dist-embed-sighting-editor/{ModuleSession-BklqVucx.js → ModuleSession-DOhPD2XZ.js} +2 -2
  96. package/dist-embed-sighting-editor/ModuleThree-BY0cNbGt.js +1 -0
  97. package/dist-embed-sighting-editor/{ModulesPanelElement-MEFltyZr.js → ModulesPanelElement-DTnJICg0.js} +3 -3
  98. package/dist-embed-sighting-editor/{NearestApproach-Bnx9Ld5_.js → NearestApproach-jDpDx7cm.js} +1 -1
  99. package/dist-embed-sighting-editor/{PoherAssessor-CNj_Nyci.js → PoherAssessor-yWlnEcoZ.js} +1 -1
  100. package/dist-embed-sighting-editor/{RailwaySystem-Dn-v2OAb.js → RailwaySystem-CAqOaX1c.js} +1 -1
  101. package/dist-embed-sighting-editor/{ReentryEditor-DPt4At81.js → ReentryEditor-CNLwoAIZ.js} +2 -2
  102. package/dist-embed-sighting-editor/{ReentrySimulation-DwaQrNN5.js → ReentrySimulation-Q-8h8lRK.js} +1 -1
  103. package/dist-embed-sighting-editor/{ReferenceSystem-DlaF5KWz.js → ReferenceSystem-B0tZDQ1-.js} +1 -1
  104. package/dist-embed-sighting-editor/SceneNames_en-CTJiUG-r.js +1 -0
  105. package/dist-embed-sighting-editor/SceneNames_es-DHZMjSqb.js +1 -0
  106. package/dist-embed-sighting-editor/SceneNames_fr-C36uyjbM.js +1 -0
  107. package/dist-embed-sighting-editor/SceneNames_it-BQJQm2rT.js +1 -0
  108. package/dist-embed-sighting-editor/{SearchlightEditor-CdTMwgER.js → SearchlightEditor-sQh92hx7.js} +1 -1
  109. package/dist-embed-sighting-editor/{SearchlightSystem-jipCae7J.js → SearchlightSystem-B_RPbGj4.js} +1 -1
  110. package/dist-embed-sighting-editor/{SightingEditorMessages_en-BmqJK2u_.js → SightingEditorMessages_en-V_dJYjNb.js} +1 -1
  111. package/{dist-embed-ufoathome/SightingEditorMessages_es-avQMqPMq.js → dist-embed-sighting-editor/SightingEditorMessages_es-DauDuhPa.js} +1 -1
  112. package/dist-embed-sighting-editor/{SightingEditorMessages_fr-ClEadK1E.js → SightingEditorMessages_fr-zxTvQa2I.js} +1 -1
  113. package/dist-embed-sighting-editor/{SightingEditorMessages_it-Co5behaA.js → SightingEditorMessages_it-vvaao68O.js} +1 -1
  114. package/dist-embed-sighting-editor/SightingElement-4YMo_us5.js +694 -0
  115. package/dist-embed-sighting-editor/{SightingFileEditor-Du3A9uZm.js → SightingFileEditor-tIOJTG_y.js} +1 -1
  116. package/dist-embed-sighting-editor/SightingLabels_en-dOsFjVRL.js +1 -0
  117. package/dist-embed-sighting-editor/SightingLabels_es-CKlP2BDO.js +1 -0
  118. package/dist-embed-sighting-editor/{SightingLabels_fr-D69zENbW.js → SightingLabels_fr-Cpkcf5_9.js} +1 -1
  119. package/{dist-embed-ufoathome/SightingLabels_it-COLZ2Qth.js → dist-embed-sighting-editor/SightingLabels_it-3127rMXm.js} +1 -1
  120. package/dist-embed-sighting-editor/{SightingMessages_en-CzICxNU3.js → SightingMessages_en-Drcr3k4V.js} +1 -1
  121. package/dist-embed-sighting-editor/{SightingMessages_es-CiVFZlgA.js → SightingMessages_es-BcaWM7Oy.js} +1 -1
  122. package/dist-embed-sighting-editor/{SightingMessages_fr-nopOVDa1.js → SightingMessages_fr-7IYuW095.js} +1 -1
  123. package/dist-embed-sighting-editor/{SightingMessages_it-Cu0nnPts.js → SightingMessages_it-BhDmZn6p.js} +1 -1
  124. package/dist-embed-sighting-editor/{SkyLantern-CYhqKOnv.js → SkyLantern-Cj60Cn9B.js} +1 -1
  125. package/dist-embed-sighting-editor/{TraceSystem-Bj0G3fL7.js → TraceSystem-BK0y5lRX.js} +2 -2
  126. package/dist-embed-sighting-editor/{WaterSystem-Cv4v7PXz.js → WaterSystem-DMeMEW3i.js} +2 -2
  127. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +455 -434
  128. package/dist-embed-sighting-editor/sightingSchema-DoPVOlCB.js +1 -0
  129. package/dist-embed-sighting-editor/{trafficRuntime-BdBceXei.js → trafficRuntime-eGXY41n0.js} +1 -1
  130. package/dist-embed-ufoathome/{AdsbLolArchiveProvider-D169IKdZ.js → AdsbLolArchiveProvider-BJm3HMv9.js} +1 -1
  131. package/dist-embed-ufoathome/{Aurora-CP_Xi-9o.js → Aurora-DooZfol8.js} +1 -1
  132. package/dist-embed-ufoathome/{AuroraEditor-B_Rxo_6I.js → AuroraEditor-COl6Uq7r.js} +1 -1
  133. package/dist-embed-ufoathome/{AuroraSimulation-KHkJyuus.js → AuroraSimulation-8865pkCY.js} +1 -1
  134. package/dist-embed-ufoathome/{BallesterGuaspAssessor-58lmGHUw.js → BallesterGuaspAssessor-CKK5Iybb.js} +1 -1
  135. package/dist-embed-ufoathome/{BalloonEditor-CAKXO8DQ.js → BalloonEditor-BBAtMeVM.js} +1 -1
  136. package/dist-embed-ufoathome/{BeamEditor-BOsTgbHL.js → BeamEditor-D6I1zG9Z.js} +1 -1
  137. package/dist-embed-ufoathome/{BeamSystem-C7OL1VWr.js → BeamSystem-BI4-w_0X.js} +1 -1
  138. package/dist-embed-ufoathome/{BodyEditor-DZ9-YBfo.js → BodyEditor-yBNJy9AC.js} +1 -1
  139. package/dist-embed-ufoathome/{CaseEditorElement-BgT6HnpX.js → CaseEditorElement-CPt1laCe.js} +64 -61
  140. package/dist-embed-ufoathome/{CaseElement-DVXLO8mr.js → CaseElement-CTZ3YIL0.js} +3 -3
  141. package/dist-embed-ufoathome/{CaseReportExport-Dui5KDc5.js → CaseReportExport-UNmAQ_xa.js} +3 -3
  142. package/dist-embed-ufoathome/{ColumnResize-CO4e1m-q.js → ColumnResize-D6vA9JBg.js} +9 -9
  143. package/dist-embed-ufoathome/{ControlPasses-CJ2jMdlf.js → ControlPasses-Bwafi16d.js} +1 -1
  144. package/dist-embed-ufoathome/{CoverageAssessor-CzhOt6fv.js → CoverageAssessor-DINhJJFz.js} +1 -1
  145. package/dist-embed-ufoathome/{Flightradar24Provider-TCNh_VXc.js → Flightradar24Provider-BEVn6h-k.js} +1 -1
  146. package/dist-embed-ufoathome/{GLTFLoader-BaIfBICM.js → GLTFLoader-CqzCNjEl.js} +1 -1
  147. package/dist-embed-ufoathome/{GeoJsonExport-B5AFUVEM.js → GeoJsonExport-B4GBH7Ei.js} +1 -1
  148. package/dist-embed-ufoathome/GeographicFigures-wtF2TmIn.js +1 -0
  149. package/dist-embed-ufoathome/HynekAssessor-De0RmEd0.js +1 -0
  150. package/dist-embed-ufoathome/{InterviewEditorElement-o21YUvNz.js → InterviewEditorElement-BVfNqEBS.js} +4 -4
  151. package/dist-embed-ufoathome/{InterviewElement-K_oIXneA.js → InterviewElement-BBEmBs1S.js} +1 -1
  152. package/dist-embed-ufoathome/{KmlExport-BfiqE1s2.js → KmlExport-C8yk8C7s.js} +1 -1
  153. package/dist-embed-ufoathome/{LanternEditor-CepeoImr.js → LanternEditor-DEeA3Kf_.js} +1 -1
  154. package/dist-embed-ufoathome/{LaserBeam-IRXmv6wc.js → LaserBeam-BGs1pXaE.js} +1 -1
  155. package/dist-embed-ufoathome/LaunchEditor-CBEW_ih2.js +22 -0
  156. package/dist-embed-ufoathome/{LaunchPlume-CujlF3wZ.js → LaunchPlume-BbsUUQE0.js} +1 -1
  157. package/dist-embed-ufoathome/{LaunchSimulation-58_ZZy8q.js → LaunchSimulation-DJJaKJGV.js} +1 -1
  158. package/dist-embed-ufoathome/{ModelSource-Bz25TN6e.js → ModelSource-B2Ie3T9B.js} +1 -1
  159. package/dist-embed-ufoathome/{ModelThumbnails-CcYlw6gA.js → ModelThumbnails-BOfC5SZt.js} +1 -1
  160. package/dist-embed-ufoathome/{ModelViewer-CD90RTYi.js → ModelViewer-CXP4K0sx.js} +1 -1
  161. package/dist-embed-ufoathome/{ModulesPanelElement-DZxFsuuG.js → ModulesPanelElement-DPkBhz-Y.js} +2 -2
  162. package/dist-embed-ufoathome/NearestApproach-D2cz2_44.js +1 -0
  163. package/dist-embed-ufoathome/{PoherAssessor-BkCJ1UTQ.js → PoherAssessor-CNOuLGVz.js} +1 -1
  164. package/dist-embed-ufoathome/PoherMatrix-C2fcLqDH.js +1 -0
  165. package/dist-embed-ufoathome/PoherSelfCheck-DnXcStjH.js +1 -0
  166. package/dist-embed-ufoathome/{ReentryEditor-BjyUUZGU.js → ReentryEditor-BCQM22Ps.js} +1 -1
  167. package/dist-embed-ufoathome/{ReentrySimulation-5VI9Dla4.js → ReentrySimulation-BFhCb4sM.js} +1 -1
  168. package/dist-embed-ufoathome/{ReferenceSystem-C0ZXvatV.js → ReferenceSystem-aZKW97nH.js} +1 -1
  169. package/dist-embed-ufoathome/ScenarioReadings-_IkJEoIB.js +1 -0
  170. package/dist-embed-ufoathome/ScenarioSweep-DOvp2pYT.js +1 -0
  171. package/dist-embed-ufoathome/SceneNames_en-sRbx6EJZ.js +1 -0
  172. package/dist-embed-ufoathome/SceneNames_es-pnfHB-7D.js +1 -0
  173. package/dist-embed-ufoathome/SceneNames_fr-BtTlti4C.js +1 -0
  174. package/dist-embed-ufoathome/SceneNames_it-DQKwdCVD.js +1 -0
  175. package/dist-embed-ufoathome/{SearchlightEditor-DPU1PgfT.js → SearchlightEditor-C8Jwy1VZ.js} +1 -1
  176. package/dist-embed-ufoathome/{SearchlightSystem-m0a11CEu.js → SearchlightSystem-D2TFaVqO.js} +1 -1
  177. package/dist-embed-ufoathome/{ShareDialogElement-DqCoQwtn.js → ShareDialogElement-Dsc4v4jd.js} +150 -132
  178. package/dist-embed-ufoathome/Sighting-C1yj2-s5.js +1 -0
  179. package/dist-embed-ufoathome/{SightingEditorMessages_en-BmqJK2u_.js → SightingEditorMessages_en-V_dJYjNb.js} +1 -1
  180. package/{dist-embed-sighting-editor/SightingEditorMessages_es-avQMqPMq.js → dist-embed-ufoathome/SightingEditorMessages_es-DauDuhPa.js} +1 -1
  181. package/dist-embed-ufoathome/{SightingEditorMessages_fr-ClEadK1E.js → SightingEditorMessages_fr-zxTvQa2I.js} +1 -1
  182. package/dist-embed-ufoathome/{SightingEditorMessages_it-Co5behaA.js → SightingEditorMessages_it-vvaao68O.js} +1 -1
  183. package/dist-embed-ufoathome/SightingElement-CFItfa0b.js +694 -0
  184. package/dist-embed-ufoathome/{SightingFileEditor-DS1DRU2p.js → SightingFileEditor-D5_GwIsn.js} +1 -1
  185. package/dist-embed-ufoathome/SightingLabels_en-dOsFjVRL.js +1 -0
  186. package/dist-embed-ufoathome/SightingLabels_es-CKlP2BDO.js +1 -0
  187. package/dist-embed-ufoathome/{SightingLabels_fr-D69zENbW.js → SightingLabels_fr-Cpkcf5_9.js} +1 -1
  188. package/{dist-embed-sighting-editor/SightingLabels_it-COLZ2Qth.js → dist-embed-ufoathome/SightingLabels_it-3127rMXm.js} +1 -1
  189. package/dist-embed-ufoathome/{SightingMessages_en-CzICxNU3.js → SightingMessages_en-Drcr3k4V.js} +1 -1
  190. package/dist-embed-ufoathome/{SightingMessages_es-CiVFZlgA.js → SightingMessages_es-BcaWM7Oy.js} +1 -1
  191. package/dist-embed-ufoathome/{SightingMessages_fr-nopOVDa1.js → SightingMessages_fr-7IYuW095.js} +1 -1
  192. package/dist-embed-ufoathome/{SightingMessages_it-Cu0nnPts.js → SightingMessages_it-BhDmZn6p.js} +1 -1
  193. package/dist-embed-ufoathome/{TraceSystem-BLumvnJD.js → TraceSystem-_cZ6PZho.js} +1 -1
  194. package/dist-embed-ufoathome/{VideoButton-hYfTEunC.js → VideoButton-CeAdEi2m.js} +1 -1
  195. package/dist-embed-ufoathome/rr0-ufoathome.mjs +10 -10
  196. package/dist-embed-ufoathome/sightingSchema-DoPVOlCB.js +1 -0
  197. package/dist-embed-ufoathome/{surroundingsSources-BWHnZ_qg.js → surroundingsSources-B7gbT2Pb.js} +1 -1
  198. package/dist-embed-ufoathome/{trafficRuntime-Xpncp71U.js → trafficRuntime-BKNJgPC4.js} +2 -2
  199. package/package.json +1 -1
  200. package/dist-embed-scene/SceneNames_en-BFJsR6Cc.js +0 -1
  201. package/dist-embed-scene/SceneNames_es-BHBTwcJ3.js +0 -1
  202. package/dist-embed-scene/SceneNames_fr-CFsA4XeK.js +0 -1
  203. package/dist-embed-scene/SceneNames_it-DkIgwviv.js +0 -1
  204. package/dist-embed-scene/sightingSchema-9MogCcUd.js +0 -1
  205. package/dist-embed-sighting/BalloonEditor-CaWwqWKK.js +0 -24
  206. package/dist-embed-sighting/ControlPasses-Dr6eP2Mq.js +0 -29
  207. package/dist-embed-sighting/GenerativeKitMessages-NbyGMKAR.js +0 -1
  208. package/dist-embed-sighting/LanternEditor-Be5Io1J-.js +0 -24
  209. package/dist-embed-sighting/ModuleThree-BLNSm2eY.js +0 -1
  210. package/dist-embed-sighting/SceneNames_en-BlRTU7Hq.js +0 -1
  211. package/dist-embed-sighting/SceneNames_es-DMNd9trd.js +0 -1
  212. package/dist-embed-sighting/SceneNames_fr-DlMcv9D0.js +0 -1
  213. package/dist-embed-sighting/SceneNames_it-DqlWMlOE.js +0 -1
  214. package/dist-embed-sighting/SightingMessages_en-D3YVhgUj.js +0 -1
  215. package/dist-embed-sighting/SightingMessages_es-ME6FeTp-.js +0 -1
  216. package/dist-embed-sighting/SightingMessages_fr-BgXYuIq4.js +0 -1
  217. package/dist-embed-sighting/SightingMessages_it-DcE90eAl.js +0 -1
  218. package/dist-embed-sighting/sightingSchema-9MogCcUd.js +0 -1
  219. package/dist-embed-sighting-editor/ModuleThree-jNUgMjnf.js +0 -1
  220. package/dist-embed-sighting-editor/SceneNames_en-c5zNw0Hi.js +0 -1
  221. package/dist-embed-sighting-editor/SceneNames_es-CDjoBwy_.js +0 -1
  222. package/dist-embed-sighting-editor/SceneNames_fr-CoZNmFu3.js +0 -1
  223. package/dist-embed-sighting-editor/SceneNames_it-CVEahBpq.js +0 -1
  224. package/dist-embed-sighting-editor/SightingElement-C6CT6DBZ.js +0 -693
  225. package/dist-embed-sighting-editor/SightingLabels_en-oIpytoq_.js +0 -1
  226. package/dist-embed-sighting-editor/SightingLabels_es-DUh1CTXl.js +0 -1
  227. package/dist-embed-sighting-editor/sightingSchema-9MogCcUd.js +0 -1
  228. package/dist-embed-ufoathome/GeographicFigures-DrlbDt4f.js +0 -1
  229. package/dist-embed-ufoathome/HynekAssessor-DaCcWwTH.js +0 -1
  230. package/dist-embed-ufoathome/LaunchEditor-C4hq0VUw.js +0 -22
  231. package/dist-embed-ufoathome/NearestApproach-DsszB5Rd.js +0 -1
  232. package/dist-embed-ufoathome/ScenarioReadings-CBWjF8TY.js +0 -1
  233. package/dist-embed-ufoathome/ScenarioSweep-MaryBOLs.js +0 -1
  234. package/dist-embed-ufoathome/SceneNames_en-7OZ7peGc.js +0 -1
  235. package/dist-embed-ufoathome/SceneNames_es-P5-Mavdi.js +0 -1
  236. package/dist-embed-ufoathome/SceneNames_fr-qzw0QzD0.js +0 -1
  237. package/dist-embed-ufoathome/SceneNames_it-Sqf8JFOd.js +0 -1
  238. package/dist-embed-ufoathome/Sighting-D-_IYi9n.js +0 -1
  239. package/dist-embed-ufoathome/SightingElement-CUrYpWRD.js +0 -693
  240. package/dist-embed-ufoathome/SightingLabels_en-oIpytoq_.js +0 -1
  241. package/dist-embed-ufoathome/SightingLabels_es-DUh1CTXl.js +0 -1
  242. package/dist-embed-ufoathome/sightingSchema-9MogCcUd.js +0 -1
@@ -1 +1 @@
1
- import{aQ as Le,aR as Q,aS as he,aT as Me,aU as v,aV as de,ag as b,j as pe,C as F,aW as w,z as U,aN as Se,t as ye,u as be,a2 as K,aX as we,V as C,Q as me,aY as Ne,ac as ge,aZ as Ie,a_ as Oe,x as V,a$ as Ce,$ as Te,b0 as Fe,b1 as Pe,b2 as He,L as J,r as Re,b as Z,b3 as ke,e as De,q as Ge,aj as X,aC as ve,ae as Ee,T as Ue,K as G,b4 as Ke,w as Be,b5 as je,M as Ve,aB as Xe,aD as ze,b6 as qe,J as We,I as z,aa as Ye,aM as Qe,n as Je,b7 as Ze,b8 as $e,b9 as en,ba as nn,bb as xe,aH as tn,aP as ne,bc as te,bd as se,be as ie,bf as re,au as sn,bg as rn,a8 as on,av as an}from"./three.module-CbaHqYFq.js";import{b7 as cn}from"./ShareDialogElement-DqCoQwtn.js";import"./rr0-ufoathome.mjs";import"./Sighting-D-_IYi9n.js";import"./VisualAids-DI-hEL46.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class $n extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new Sn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new yn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===_e){try{r[g.KHR_BINARY_GLTF]=new bn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function A(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new be(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ye(u),c.distance=l;break;case"spot":c=new Se(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),y(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],w),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],w)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class Sn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class yn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,_=new C(1,1,1),x=new we(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&_.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,_));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const _e="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class bn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==_e)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,w,h)})})}}class Nn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class Ae extends rn{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,_=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=_*L+x*N+m*S+T*k}return i}}const On=new me;class Cn extends Ae{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:nn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:sn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function y(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),y(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),_="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(_);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(_,x)),m=new tn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,_=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new _(r[1],x,t.sparse.count*T),N=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,k=L.length;S<k;S++){const P=L[S];if(m.setX(P,N[S*o]),o>=2&&m.setY(P,N[S*o+1]),o>=3&&m.setZ(P,N[S*o+2]),o>=4&&m.setW(P,N[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),y(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],w),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],w)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),y(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const _=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,_):new Ve(R,_),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,_);else if(m.mode===M.LINE_STRIP)T=new ze(R,_);else if(m.mode===M.LINE_LOOP)T=new qe(R,_);else if(m.mode===M.POINTS)T=new We(R,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),y(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),y(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,_=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",_)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],N=d[x],S=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const _=new $e(i,void 0,T);return y(_,t),_})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),y(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),y(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(cn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:Ae;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new on;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new an;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),y(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{$n as GLTFLoader};
1
+ import{aQ as Le,aR as Q,aS as he,aT as Me,aU as v,aV as de,ag as b,j as pe,C as F,aW as w,z as U,aN as Se,t as ye,u as be,a2 as K,aX as we,V as C,Q as me,aY as Ne,ac as ge,aZ as Ie,a_ as Oe,x as V,a$ as Ce,$ as Te,b0 as Fe,b1 as Pe,b2 as He,L as J,r as Re,b as Z,b3 as ke,e as De,q as Ge,aj as X,aC as ve,ae as Ee,T as Ue,K as G,b4 as Ke,w as Be,b5 as je,M as Ve,aB as Xe,aD as ze,b6 as qe,J as We,I as z,aa as Ye,aM as Qe,n as Je,b7 as Ze,b8 as $e,b9 as en,ba as nn,bb as xe,aH as tn,aP as ne,bc as te,bd as se,be as ie,bf as re,au as sn,bg as rn,a8 as on,av as an}from"./three.module-CbaHqYFq.js";import{b8 as cn}from"./ShareDialogElement-Dsc4v4jd.js";import"./rr0-ufoathome.mjs";import"./Sighting-C1yj2-s5.js";import"./VisualAids-DI-hEL46.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class $n extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new Sn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new yn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===_e){try{r[g.KHR_BINARY_GLTF]=new bn(n)}catch(l){t&&t(l);return}i=JSON.parse(r[g.KHR_BINARY_GLTF].content)}else i=JSON.parse(o.decode(n));else i=n;if(i.asset===void 0||i.asset.version[0]<2){t&&t(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Un(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const l=i.extensionsUsed[u],h=i.extensionsRequired||[];switch(l){case g.KHR_MATERIALS_UNLIT:r[l]=new fn;break;case g.KHR_DRACO_MESH_COMPRESSION:r[l]=new wn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new Nn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function A(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],w);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new be(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new ye(u),c.distance=l;break;case"spot":c=new Se(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),y(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+n),t=Promise.resolve(c),e.cache.add(s,t),t}getDependency(n,e){if(n==="light")return this._loadLight(e)}createNodeAttachment(n){const e=this,s=this.parser,i=s.json.nodes[n],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return s._getNodeRef(e.cache,a,o)})}}class fn{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return G}extendParams(n,e,s){const t=[];n.color=new F(1,1,1),n.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const r=i.baseColorFactor;n.color.setRGB(r[0],r[1],r[2],w),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],w)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],w),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],w),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return A(this.parser,n,this.name)!==null?b:null}extendMaterialParams(n,e){const s=A(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class Sn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class yn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,_=new C(1,1,1),x=new we(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&_.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,_));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new Ne(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const _e="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class bn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==_e)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class wn{constructor(n,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=n,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(n,e){const s=this.json,t=this.dracoLoader,i=n.extensions[this.name].bufferView,r=n.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=$[u]||u.toLowerCase();a[l]=r[u]}for(const u in n.attributes){const l=$[u]||u.toLowerCase();if(r[u]!==void 0){const h=s.accessors[n.attributes[u]],d=H[h.componentType];c[l]=d.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",i).then(function(u){return new Promise(function(l,h){t.decodeDracoFile(u,function(d){for(const p in d.attributes){const R=d.attributes[p],m=o[p];m!==void 0&&(R.normalized=m)}l(d)},a,c,w,h)})})}}class Nn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class Ae extends rn{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,_=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],N=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=_*L+x*N+m*S+T*k}return i}}const On=new me;class Cn extends Ae{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:nn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:sn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function y(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),y(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),_="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(_);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(_,x)),m=new tn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,_=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new _(r[1],x,t.sparse.count*T),N=new c(r[2],E,t.sparse.count*o);a!==null&&(m=new V(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,k=L.length;S<k;S++){const P=L[S];if(m.setX(P,N[S*o]),o>=2&&m.setY(P,N[S*o+1]),o>=3&&m.setZ(P,N[S*o+2]),o>=4&&m.setW(P,N[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=p}return m})}loadTexture(n){const e=this.json,s=this.options,i=e.textures[n].source,r=e.images[i];let a=this.textureLoader;if(r.uri){const o=s.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(n,i,a)}loadTextureImage(n,e,s){const t=this,i=this.json,r=i.textures[n],a=i.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(i.samplers||{})[r.sampler]||{};return u.magFilter=ue[h.magFilter]||J,u.minFilter=ue[h.minFilter]||Te,u.wrapS=le[h.wrapS]||Z,u.wrapT=le[h.wrapT]||Z,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==Re&&u.minFilter!==J,t.associations.set(u,{textures:n}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(n,e){const s=this,t=this.json,i=this.options;if(this.sourceCache[n]!==void 0)return this.sourceCache[n].then(l=>l.clone());const r=t.images[n],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=s.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+n+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,d){let p=h;e.isImageBitmapLoader===!0&&(p=function(R){const m=new ne(R);m.needsUpdate=!0,h(m)}),e.load(v.resolveURL(l,i.path),p,void 0,d)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),y(l,r),l.userData.mimeType=r.mimeType||Gn(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[n]=u,u}assignTexture(n,e,s,t){const i=this;return this.getDependency("texture",s.index).then(function(r){if(!r)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(r=r.clone(),r.channel=s.texCoord),i.extensions[g.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=i.associations.get(r);r=i.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),i.associations.set(r,o)}}return t!==void 0&&(r.colorSpace=t),n[e]=r,r})}assignFinalMaterial(n){const e=n.geometry;let s=n.material;const t=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(n.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new Ge,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(n.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new ve,X.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(t||i||r){let a="ClonedMaterial:"+s.uuid+":";t&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),i&&(o.vertexColors=!0),r&&(o.flatShading=!0),t&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(s))),s=o}n.material=s}getMaterialType(){return Ee}loadMaterial(n){const e=this,s=this.json,t=this.extensions,i=s.materials[n];let r;const a={},o=i.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){const l=t[g.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,i,e))}else{const l=i.pbrMetallicRoughness||{};if(a.color=new F(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],w),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,U)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(n)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(n,a)})))}i.doubleSided===!0&&(a.side=Ue);const u=i.alphaMode||W.OPAQUE;if(u===W.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===W.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new pe(1,1),i.normalTexture.scale!==void 0)){const l=i.normalTexture.scale;a.normalScale.set(l,l)}if(i.occlusionTexture!==void 0&&r!==G&&(c.push(e.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&r!==G){const l=i.emissiveFactor;a.emissive=new F().setRGB(l[0],l[1],l[2],w)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),y(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const _=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,_):new Ve(R,_),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,_);else if(m.mode===M.LINE_STRIP)T=new ze(R,_);else if(m.mode===M.LINE_LOOP)T=new qe(R,_);else if(m.mode===M.POINTS)T=new We(R,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),y(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),y(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,_=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",_)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],N=d[x],S=p[x],k=R[x],P=m[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const B=s._createAnimationTracks(L,N,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const _=new $e(i,void 0,T);return y(_,t),_})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),y(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),y(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(cn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:Ae;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new on;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new an;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==w&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),y(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{$n as GLTFLoader};
@@ -1,2 +1,2 @@
1
- import{G as e}from"./GeographicFigures-DrlbDt4f.js";import"./Sighting-D-_IYi9n.js";import"./VisualAids-DI-hEL46.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./ShareDialogElement-DqCoQwtn.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class n{static of(o,r,t,i){const p=e.of(o,t,i),c={type:"FeatureCollection",name:e.fill(t.document,{name:r}),description:`${t.documentNote} ${t.heightNote}`,features:p.map(m=>n.feature(m))};return`${JSON.stringify(c,void 0,2)}
1
+ import{G as e}from"./GeographicFigures-wtF2TmIn.js";import"./Sighting-C1yj2-s5.js";import"./VisualAids-DI-hEL46.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./ShareDialogElement-Dsc4v4jd.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class n{static of(o,r,t,i){const p=e.of(o,t,i),c={type:"FeatureCollection",name:e.fill(t.document,{name:r}),description:`${t.documentNote} ${t.heightNote}`,features:p.map(m=>n.feature(m))};return`${JSON.stringify(c,void 0,2)}
2
2
  `}static feature(o){return{type:"Feature",properties:{name:o.name,...o.note?{description:o.note}:{},group:o.group,folder:o.groupName,heights:o.heights,...o.color?{stroke:o.color,...o.kind==="polygon"?{fill:o.color}:{},...o.kind==="point"?{"marker-color":o.color}:{}}:{}},geometry:n.geometry(o)}}static geometry(o){const r=o.points.map(t=>n.position(t.lng,t.lat,t.altM));switch(o.kind){case"point":return{type:"Point",coordinates:r[0]};case"line":return{type:"LineString",coordinates:r};case"polygon":return{type:"Polygon",coordinates:[[...r,r[0]]]}}}static position(o,r,t){return[Number(e.round(o,7)),Number(e.round(r,7)),Number(e.round(t,2))]}}export{n as GeoJsonExport};
@@ -0,0 +1 @@
1
+ import{c as p}from"./Sighting-C1yj2-s5.js";import{S as k}from"./SaidPosition-OJEYhVKN.js";import{aT as v}from"./ShareDialogElement-Dsc4v4jd.js";const b=Math.PI/180;class l{static SIGHT_LINE_M=5e3;static FLAT={heightAt:()=>0};static of(n,t,e){return[...l.observer(n,t),...l.sightLines(n,t,e),...l.bodies(n,t,e),...l.traces(n,t,e)]}static observer(n,t){const e=[];for(const r of n.observerTrack.allKeyframes){const s=p(n,r.t);if(s?.lat===void 0||s.lng===void 0)continue;const d=s.elevationM??0;e.push({t:r.t,at:{lat:s.lat,lng:s.lng,altM:d+v.EYE_HEIGHT_M},...s.headingDeg===void 0?{}:{headingDeg:s.headingDeg},elevationM:d})}if(e.length===0)return[];const o=e[0],a=[{group:"observer",groupName:t.folderObserver,name:l.fill(t.observerPoint,{s:l.seconds(o.t)}),note:l.fill(t.observerNote,{elevation:l.round(o.elevationM,1),heading:o.headingDeg===void 0?"—":l.round(o.headingDeg,0)}),kind:"point",points:[o.at],heights:"observer-ground"}];return e.some(r=>r.at.lat!==o.at.lat||r.at.lng!==o.at.lng)&&a.push({group:"observer",groupName:t.folderObserver,name:t.observerPath,kind:"line",points:e.map(r=>r.at),heights:"observer-ground"}),a}static sightLines(n,t,e){const o=[];for(const a of n.timeline.allKeyframes){const i=p(n,a.t);if(i?.lat===void 0||i.lng===void 0)continue;const r={lat:i.lat,lng:i.lng,altM:(i.elevationM??0)+v.EYE_HEIGHT_M};for(const s of a.shapes){const d=s.shape.aim;d&&o.push({group:"sight-line",groupName:t.folderSightLines,name:l.fill(t.sightLine,{what:l.nameOf(e.read(s.shape.title),s.sourceId,t),s:l.seconds(a.t)}),note:l.fill(t.sightLineNote,{azimuth:l.round(d.azimuthDeg,1),altitude:l.round(d.altitudeDeg,1),km:l.round(l.SIGHT_LINE_M/1e3,0)}),kind:"line",points:[r,l.along(r,d.azimuthDeg,d.altitudeDeg)],heights:"observer-ground"})}}return o}static along(n,t,e){const o=l.SIGHT_LINE_M*Math.cos(e*b),a=k.toGeo({eastM:Math.sin(t*b)*o,northM:Math.cos(t*b)*o},n);return{lat:a.lat,lng:a.lng,altM:n.altM+l.SIGHT_LINE_M*Math.sin(e*b)}}static bodies(n,t,e){const o=n.interpretation?.bodies??[],a=p(n,0);if(o.length===0||a?.lat===void 0||a.lng===void 0)return[];const i={lat:a.lat,lng:a.lng},r=[];for(const s of o){const d=new v(s,l.FLAT,h=>v.eyeOf(n,h,l.FLAT)),f=[];for(const h of[...s.track].sort((c,m)=>c.t-m.t)){const c=d.at(h.t);if(!c)continue;const m=k.toGeo({eastM:c.eastM,northM:c.northM},i),u={lat:m.lat,lng:m.lng,altM:c.upM},M=f[f.length-1];M&&M.lat===u.lat&&M.lng===u.lng&&M.altM===u.altM||f.push(u)}if(f.length===0)continue;const y=l.nameOf(e.read(s.title),s.id,t);r.push({group:"body",groupName:t.folderBodies,name:l.fill(f.length===1?t.bodyPoint:t.bodyPath,{what:y}),note:t.bodyNote,kind:f.length===1?"point":"line",points:f,heights:"observer-ground"})}return r}static traces(n,t,e){return n.traces.map(o=>({group:"trace",groupName:t.folderTraces,name:e.read(o.title)??o.id,...e.read(o.source)?{note:e.read(o.source)}:{},kind:o.kind,points:o.points.map(a=>({lat:a.lat,lng:a.lng,altM:a.altM??0})),heights:o.altitude??"ground",...o.color?{color:o.color}:{}}))}static nameOf(n,t,e){return n&&n.trim()?n.trim():l.fill(e.unnamed,{id:t})}static seconds(n){return l.round(n/1e3,1)}static round(n,t){const e=10**t;return String(Math.round(n*e)/e)}static fill(n,t){return Object.entries(t).reduce((e,[o,a])=>e.replaceAll(`{${o}}`,a),n)}}export{l as G};
@@ -0,0 +1 @@
1
+ import{s as d,n}from"./ShareDialogElement-Dsc4v4jd.js";import{N as c}from"./NearestApproach-D2cz2_44.js";import"./rr0-ufoathome.mjs";import"./Sighting-C1yj2-s5.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";const m=-6,l=150;class r{about="temporal";async assess(e){const t=r.daylight(e),o=e.decor.map((a,p)=>({object:a,index:p})).filter(({object:a})=>a.kind==="entity"),i=c.of(e),s=i!==void 0&&i.m<=l;return{verdict:o.length>0?"ce3":s?"ce1":t===void 0?void 0:t?"dd":"nl",criteria:[{id:"entities",basis:o.length>0?"stated":void 0,paths:o.map(({index:a})=>`decor.${a}`)},{id:"traces",paths:[],unsupported:!0},{id:"proximity",basis:i?.basis,paths:i?.paths??[]},{id:"radar",paths:[],unsupported:!0},{id:"daylight",basis:t===void 0?void 0:"derived",paths:t===void 0?[]:["time","place"]}]}}static daylight(e){const t=e.event.place?.[0],o=e.event.time;if(!t||!o)return;const i=d(o,t.lng,e.event.utcOffsetHours);if(i)return n("Sun",i,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>m}}export{r as HynekAssessor};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BrowserWhisperProvider-Dn44ZE45.js","./TranscriptionAudio-C_xvRUv2.js","./TranscriptionError-D_TCbYbt.js","./OpenAiTranscriptionProvider-DDW446tK.js","./AssemblyAiTranscriptionProvider-o2kkPD5o.js","./QuestionnaireForm-vT3C3qXt.js","./rr0-ufoathome.mjs","./interviewJson-D-i14LTf.js","./interviewImport-ym5iXO4Z.js","./SightingFileEditor-DS1DRU2p.js","./index-C8cdeM8E.js","./sightingSchema-9MogCcUd.js","./QuestionnaireImport-BlTDOHWj.js"])))=>i.map(i=>d[i]);
2
- import{g as P,_ as w,r as V,S as $,h as C,H as z,s as J,U as j,Y as G,i as y,I as M,a as I,Z as K}from"./rr0-ufoathome.mjs";import{ao as A,H as O,Y as L}from"./ShareDialogElement-DqCoQwtn.js";import{InterviewMedia as N}from"./InterviewMedia-CGVsMdje.js";import{c as S,Q as Y,d as X}from"./ColumnResize-CO4e1m-q.js";import{I as Le}from"./ColumnResize-CO4e1m-q.js";import{register as Z}from"./InterviewElement-K_oIXneA.js";import{InterviewFile as v}from"./interviewJson-D-i14LTf.js";import{I as x}from"./SaidPosition-OJEYhVKN.js";import{W as B,A as F}from"./ParameterForm-XbqxCLRn.js";import{I as ee}from"./CaseEditorElement-BgT6HnpX.js";import"./Sighting-D-_IYi9n.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./GeoProjection-DvqDbRIx.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";import"./TimelineTracks-Daaqw9ly.js";import"./ReentryArchive-CeXHrU7L.js";import"./ReferenceTimeline-2kBldQeG.js";import"./upperAirSources-BU0pD84c.js";import"./Account-C4jhsVtN.js";class b{static partsOf(e){return e.parts?e.parts:e.redacted?[]:[{text:e.text??""}]}static shownRanges(e){const t=[];let r="",i=0;return e.forEach((s,n)=>{const a="redacted"in s?"▮":v.plain(s.text);/[\p{L}\p{N}.,;:!?)»”…▮]$/u.test(r)&&/^[\p{L}\p{N}(«“▮]/u.test(a)&&(i+=1);const o="redacted"in s?0:a.length;t.push({part:n,from:i,to:i+o}),i+=o,r=a}),t}static words(e){return e.trim()===""?0:e.trim().split(/\s+/u).length}static redact(e,t,r,i){const s=[...b.partsOf(e)],n=b.shownRanges(s).find(g=>!("redacted"in s[g.part])&&t>=g.from&&r<=g.to);if(!n)return;const a=v.plain(s[n.part].text),o=/[\p{L}\p{N}'’-]/u;let p=t-n.from,d=r-n.from;for(;p>0&&o.test(a[p-1])&&o.test(a[p]);)p--;for(;d<a.length&&o.test(a[d])&&o.test(a[d-1]);)d++;const h=a.slice(p,d);if(h.trim()==="")return;const l=a.slice(0,p).trimEnd(),c=a.slice(d).trimStart(),u=[...l!==""?[{text:l}]:[],{redacted:{reason:i,words:b.words(h)}},...c!==""?[{text:c}]:[]],m=s.slice(0,n.part).filter(g=>"redacted"in g).length;return s.splice(n.part,1,...u),b.setParts(e,s),{text:h.trim(),nth:m}}static redactWhole(e,t){const r=JSON.stringify({text:e.text,parts:e.parts}),i=b.partsOf(e).reduce((s,n)=>s+("redacted"in n?n.redacted.words??0:b.words(v.plain(n.text))),0);if(delete e.text,delete e.parts,e.redacted={reason:t,...i>0?{words:i}:{}},e.refs)for(const s of e.refs)delete s.range;return r}static restoreWhole(e,t){const{text:r,parts:i}=JSON.parse(t);delete e.redacted,i?e.parts=i:e.text=r??""}static restorePart(e,t,r){const i=[...b.partsOf(e)];let s=-1;const n=i.findIndex(a=>"redacted"in a&&++s===t);n!==-1&&(i.splice(n,1,{text:r}),b.setParts(e,i))}static raw(e,t=()=>{}){let r=-1,i="",s="";for(const n of b.partsOf(e)){const a="redacted"in n?`⟦${t(++r)??"…"}⟧`:n.text;i!==""&&!/\s$/u.test(s)&&!/^\s/u.test(a)&&(i+=" "),i+=a,s=a}return i}static fromRaw(e,t,r){const i=b.partsOf(e).filter(o=>"redacted"in o),s=[],n=new Map;let a=-1;return t.split(/⟦([^⟧]*)⟧/u).forEach((o,p)=>{if(p%2===0){o.trim()!==""&&s.push({text:o.trim()});return}a++;const d=o.trim();d===""||d==="…"||d==="..."?s.push({redacted:i[a]?.redacted??{reason:r}}):(s.push({redacted:{reason:r,words:b.words(d)}}),n.set(a,d))}),delete e.redacted,b.setParts(e,s),n}static setParts(e,t){const r=[];for(const i of t){const s=r[r.length-1],n=!("redacted"in i)&&/^[,.;:!?)»”…]/u.test(i.text)?"":" ";s&&!("redacted"in s)&&!("redacted"in i)?r[r.length-1]={text:`${s.text}${n}${i.text}`.replace(/\s+/gu," ").trim()}:r.push(i)}if(r.some(i=>"redacted"in i)){if(e.parts=r,delete e.text,e.refs)for(const i of e.refs)delete i.range}else e.text=r.map(i=>i.text).join(" "),delete e.parts}}class D{constructor(e,t,r){this.host=t,this.messages=r,e.classList.add("player"),e.innerHTML=`<div class="player-video" hidden></div>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BrowserWhisperProvider-Dn44ZE45.js","./TranscriptionAudio-C_xvRUv2.js","./TranscriptionError-D_TCbYbt.js","./OpenAiTranscriptionProvider-DDW446tK.js","./AssemblyAiTranscriptionProvider-o2kkPD5o.js","./QuestionnaireForm-vT3C3qXt.js","./rr0-ufoathome.mjs","./interviewJson-D-i14LTf.js","./interviewImport-ym5iXO4Z.js","./SightingFileEditor-D5_GwIsn.js","./index-C8cdeM8E.js","./sightingSchema-DoPVOlCB.js","./QuestionnaireImport-BlTDOHWj.js"])))=>i.map(i=>d[i]);
2
+ import{g as P,_ as w,r as V,S as $,h as C,H as z,s as J,U as j,Y as G,i as y,I as M,a as I,Z as K}from"./rr0-ufoathome.mjs";import{ao as A,H as O,Y as L}from"./ShareDialogElement-Dsc4v4jd.js";import{InterviewMedia as N}from"./InterviewMedia-CGVsMdje.js";import{c as S,Q as Y,d as X}from"./ColumnResize-D6vA9JBg.js";import{I as Ce}from"./ColumnResize-D6vA9JBg.js";import{register as Z}from"./InterviewElement-BBEmBs1S.js";import{InterviewFile as v}from"./interviewJson-D-i14LTf.js";import{I as x}from"./SaidPosition-OJEYhVKN.js";import{W as B,A as F}from"./ParameterForm-XbqxCLRn.js";import{I as ee}from"./CaseEditorElement-CPt1laCe.js";import"./Sighting-C1yj2-s5.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./GeoProjection-DvqDbRIx.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";import"./PoherSelfCheck-DnXcStjH.js";import"./PoherMatrix-C2fcLqDH.js";import"./TimelineTracks-Daaqw9ly.js";import"./ReentryArchive-CeXHrU7L.js";import"./ReferenceTimeline-2kBldQeG.js";import"./upperAirSources-BU0pD84c.js";import"./Account-C4jhsVtN.js";class b{static partsOf(e){return e.parts?e.parts:e.redacted?[]:[{text:e.text??""}]}static shownRanges(e){const t=[];let r="",i=0;return e.forEach((s,n)=>{const a="redacted"in s?"▮":v.plain(s.text);/[\p{L}\p{N}.,;:!?)»”…▮]$/u.test(r)&&/^[\p{L}\p{N}(«“▮]/u.test(a)&&(i+=1);const o="redacted"in s?0:a.length;t.push({part:n,from:i,to:i+o}),i+=o,r=a}),t}static words(e){return e.trim()===""?0:e.trim().split(/\s+/u).length}static redact(e,t,r,i){const s=[...b.partsOf(e)],n=b.shownRanges(s).find(g=>!("redacted"in s[g.part])&&t>=g.from&&r<=g.to);if(!n)return;const a=v.plain(s[n.part].text),o=/[\p{L}\p{N}'’-]/u;let p=t-n.from,d=r-n.from;for(;p>0&&o.test(a[p-1])&&o.test(a[p]);)p--;for(;d<a.length&&o.test(a[d])&&o.test(a[d-1]);)d++;const h=a.slice(p,d);if(h.trim()==="")return;const l=a.slice(0,p).trimEnd(),c=a.slice(d).trimStart(),u=[...l!==""?[{text:l}]:[],{redacted:{reason:i,words:b.words(h)}},...c!==""?[{text:c}]:[]],m=s.slice(0,n.part).filter(g=>"redacted"in g).length;return s.splice(n.part,1,...u),b.setParts(e,s),{text:h.trim(),nth:m}}static redactWhole(e,t){const r=JSON.stringify({text:e.text,parts:e.parts}),i=b.partsOf(e).reduce((s,n)=>s+("redacted"in n?n.redacted.words??0:b.words(v.plain(n.text))),0);if(delete e.text,delete e.parts,e.redacted={reason:t,...i>0?{words:i}:{}},e.refs)for(const s of e.refs)delete s.range;return r}static restoreWhole(e,t){const{text:r,parts:i}=JSON.parse(t);delete e.redacted,i?e.parts=i:e.text=r??""}static restorePart(e,t,r){const i=[...b.partsOf(e)];let s=-1;const n=i.findIndex(a=>"redacted"in a&&++s===t);n!==-1&&(i.splice(n,1,{text:r}),b.setParts(e,i))}static raw(e,t=()=>{}){let r=-1,i="",s="";for(const n of b.partsOf(e)){const a="redacted"in n?`⟦${t(++r)??"…"}⟧`:n.text;i!==""&&!/\s$/u.test(s)&&!/^\s/u.test(a)&&(i+=" "),i+=a,s=a}return i}static fromRaw(e,t,r){const i=b.partsOf(e).filter(o=>"redacted"in o),s=[],n=new Map;let a=-1;return t.split(/⟦([^⟧]*)⟧/u).forEach((o,p)=>{if(p%2===0){o.trim()!==""&&s.push({text:o.trim()});return}a++;const d=o.trim();d===""||d==="…"||d==="..."?s.push({redacted:i[a]?.redacted??{reason:r}}):(s.push({redacted:{reason:r,words:b.words(d)}}),n.set(a,d))}),delete e.redacted,b.setParts(e,s),n}static setParts(e,t){const r=[];for(const i of t){const s=r[r.length-1],n=!("redacted"in i)&&/^[,.;:!?)»”…]/u.test(i.text)?"":" ";s&&!("redacted"in s)&&!("redacted"in i)?r[r.length-1]={text:`${s.text}${n}${i.text}`.replace(/\s+/gu," ").trim()}:r.push(i)}if(r.some(i=>"redacted"in i)){if(e.parts=r,delete e.text,e.refs)for(const i of e.refs)delete i.range}else e.text=r.map(i=>i.text).join(" "),delete e.parts}}class D{constructor(e,t,r){this.host=t,this.messages=r,e.classList.add("player"),e.innerHTML=`<div class="player-video" hidden></div>
3
3
  <div class="player-bar">
4
4
  <button type="button" class="icon-btn player-play" disabled>${x.PLAY}</button>
5
5
  <span class="player-time">0:00</span>
@@ -288,7 +288,7 @@ import{g as P,_ as w,r as V,S as $,h as C,H as z,s as J,U as j,Y as G,i as y,I a
288
288
  <div id="file-editor" class="file-editor"></div>
289
289
  </section>
290
290
  </div>
291
- `;class f extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages;said=new $(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;ready=Promise.resolve();player;drawn;takenOut=new Map;redactTarget;exchangesShown=Promise.resolve();lastReason;static transcriptionSourceId=T[0].id;transcribing;constructor(){super(),this.shadow.innerHTML=te,customElements.upgrade(this.shadow),this.importInput.build();for(const r of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(r).addEventListener(r==="witness"||r==="medium"?"change":"input",()=>this.write(r));for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.addEventListener("click",()=>this.openGroup(f.GROUPS[r.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",r=>{const i=r.detail;i.file?this.importFromFile(i.file):this.importFromUrl(i.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.shadow.getElementById("form-feed").addEventListener("click",()=>this.feedObservation()),this.shadow.getElementById("form-send").addEventListener("click",()=>this.sendQuestionnaire()),this.shadow.getElementById("transcribe-start").addEventListener("click",()=>void this.transcribe()),this.shadow.getElementById("transcribe-stop").addEventListener("click",()=>this.transcribing?.abort()),this.shadow.getElementById("transcribe-source").addEventListener("change",r=>{f.transcriptionSourceId=r.target.value,this.transcribeOutcome=void 0,this.renderTranscribe()}),this.shadow.getElementById("transcribe-key").addEventListener("input",r=>{A.set(f.transcriptionSourceId,r.target.value),this.renderTranscribeStart()});const e=this.shadow.getElementById("exchanges");e.addEventListener("pointerup",()=>setTimeout(()=>this.selectionMade(),0)),e.addEventListener("keyup",r=>{r.shiftKey&&this.selectionMade()}),e.addEventListener("click",r=>{const i=r.target.closest(".bar.redacted-label");i&&this.openBar(i)}),e.addEventListener("keydown",r=>{const i=r.target.closest(".bar.redacted-label");i&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.openBar(i))}),this.shadow.getElementById("redact-take").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("redact-restore").addEventListener("click",()=>{const r=this.redactTarget;this.closeRedactPop(),r?.kind==="bar"&&r.restorable&&this.restore(r.restorable)});const t=this.field("redact-reason");t.addEventListener("change",()=>{this.redactTarget?.kind==="bar"&&this.changeReason()}),t.addEventListener("keydown",r=>{r.key==="Escape"&&this.closeRedactPop(),r.key==="Enter"&&(r.preventDefault(),this.redactTarget?.kind==="selection"?this.redactSelection():this.changeReason().then(()=>this.closeRedactPop()))})}static GROUPS={"group-summary":"summary","group-form":"form","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.ready=this.loadLocale(),document.addEventListener("pointerdown",this.pressedElsewhere,!0)}pressedElsewhere=e=>{const t=this.shadow.getElementById("redact-pop");t&&!t.hidden&&!e.composedPath().includes(t)&&this.closeRedactPop()};disconnectedCallback(){document.removeEventListener("pointerdown",this.pressedElsewhere,!0),queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){const t=e!==this.current;t&&(this.shownFor=void 0),this.current=e,this.render(),t&&this.heldThroughQuestionnaire?this.openGroup("form"):this.group==="form"&&(this.formShown=this.showForm()),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=z.preferencesFor(this),r=J(t,j),i=await G.load(r);e===this.localeToken&&(this.language=r,this.said=new $(t),this.messages=i,this.player||(this.player=new D(this.shadow.getElementById("player"),{timeChanged:s=>this.markCurrentTurn(s),recordingsChanged:s=>void this.editTranscript(n=>{s.length===0?delete n.recordings:n.recordings=s})},i),this.render()),this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e,this.renderTranscribe()}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages;if(!e)return;const t=(l,c)=>{this.shadow.getElementById(l).textContent=c};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-form-group",e.questionnaireTab),t("form-feed",e.feed),O.say(this.shadow.getElementById("form-feed-hint"),"",e.feedHint);const r=this.shadow.getElementById("form-tab");r.hidden=!this.heldThroughQuestionnaire,!this.heldThroughQuestionnaire&&this.group==="form"&&this.openGroup("summary"),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),O.say(this.shadow.getElementById("label-import-file"),e.importFile,e.importFileHint),t("redact-take",e.redactSelection),t("redact-restore",e.redactRestore),t("label-redact-reason",e.redactReasonLabel);const i=this.field("redact-reason");i.placeholder=e.redactReason,i.title=e.redactReasonHint,t("transcribe-start",e.transcribe),this.shadow.getElementById("transcribe-hint").replaceChildren(O.of(e.transcribeHint)),t("label-transcribe-with",e.transcribeWith),t("label-transcribe-key",e.transcribeKey),t("transcribe-key-get",e.transcribeKeyGet),t("transcribe-stop",e.transcribeStop),this.field("transcribe-key").title=e.transcribeKeyHint,this.renderTranscribe(),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const s=this.current,n=this.shadow.activeElement,a=(l,c)=>{this.field(l)!==n&&(this.field(l).value=c)};a("title",this.said.read(s?.title)??""),a("time",s?.time??""),a("by",f.byText(s?.by)),a("url",s?.url??""),a("summary",this.said.read(s?.summary)??"");const o=[s?.interviewOf].flat().filter(l=>typeof l=="string"),p=this.shadow.getElementById("witness"),d=[...this.options,...o.filter(l=>!this.options.some(c=>c.id===l)).map(l=>({id:l,label:l}))];p.replaceChildren(p.querySelector("legend"),...d.map(l=>{const c=document.createElement("label"),u=document.createElement("input");return u.type="checkbox",u.value=l.id,u.checked=o.includes(l.id),c.append(u,l.label),c}));const h=this.shadow.getElementById("medium");if(h.replaceChildren(...N.ALL.map(l=>new Option(N.label(l,this.language),l))),s?.medium!==void 0&&!N.ALL.includes(s.medium)&&h.append(new Option(String(s.medium),String(s.medium))),s?.medium===void 0){const l=new Option(e.witnessNone,"");l.disabled=!0,l.hidden=!0,h.prepend(l)}h.value=s?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const i=this.said.write(t.title,r,this.language);i===void 0?delete t.title:t.title=i;break}case"summary":{const i=this.said.write(t.summary,r,this.language);i===void 0?delete t.summary:t.summary=i;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const i=r.split(",").map(s=>s.trim()).filter(s=>s!=="");i.length===0?delete t.by:t.by=i.map(s=>({people:s}));break}case"witness":{const i=[...this.shadow.querySelectorAll("#witness input:checked")].map(s=>s.value);if(i.length===0){this.render();return}t.interviewOf=i.length===1?i[0]:i;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",form:"group-form",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,i]of Object.entries(t))this.shadow.getElementById(i).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges(),e==="form"&&(this.formShown=this.showForm())}form;formToken=0;formShown=Promise.resolve();get heldThroughQuestionnaire(){return this.current?.medium==="questionnaire"}async showForm(){const e=this.current;if(!e||!this.heldThroughQuestionnaire)return;const t=++this.formToken,[{QuestionnaireForm:r},{QuestionnaireTemplates:i},s]=await Promise.all([w(()=>import("./QuestionnaireForm-vT3C3qXt.js"),__vite__mapDeps([5,6,7]),import.meta.url),w(()=>import("./rr0-ufoathome.mjs").then(u=>u.a6),[],import.meta.url),this.transcriptJson(e)]);await this.ready;const n=s?.questionnaire?.id??"",a=n?await i.load(n):void 0;if(t!==this.formToken||this.current!==e)return;const o=this.messages,p=this.shadow.getElementById("form-note");y.show(p,a?void 0:n?o.unknownQuestionnaire.replace("{id}",n):o.noQuestionnaire,"warning"),this.form??=new r(this.shadow.getElementById("form-fields"),(u,m,g)=>void this.answerField(u,m,g),(u,m,g)=>void this.giveFiles(u,m,g));const d=this.transcriptUrl(e)??new URL(`${e.id??"interview"}.json`,this.base??location.href).href;this.form.show(a??{id:n,title:n,sections:[]},s,o.questionnaire,this.language,this.hasAttribute("readonly"),u=>this.confidentialAnswers.get(this.confidentialKey(e,u)),{add:u=>M.add(u,d),shown:u=>M.shown(u,d),messages:o});const h=this.shadow.getElementById("form-feed");h.disabled=this.hasAttribute("readonly"),this.formRecipient=s?.questionnaire?.recipient,this.formTitle=a?i.text(a.title,this.language):n;const l=this.shadow.getElementById("form-send"),c=this.formRecipient?this.said.read(this.formRecipient.name)??"":void 0;l.textContent=c?o.send.replace("{name}",c):o.sendPrepare,l.disabled=this.hasAttribute("readonly"),O.say(this.shadow.getElementById("form-send-hint"),"",c&&this.formRecipient?.email?o.sendHint.replace("{email}",this.formRecipient.email):o.sendPrepareHint)}async answerField(e,t,r,i){const{QuestionnaireTemplates:s}=await w(async()=>{const{QuestionnaireTemplates:l}=await import("./rr0-ufoathome.mjs").then(c=>c.a6);return{QuestionnaireTemplates:l}},[],import.meta.url),n=this.current;if(!n)return;const a=await this.transcriptJson(n),o=a?.questionnaire?.id,p=o?await s.load(o):void 0,d=p?s.field(p,e)?.confidential:void 0;let h;if(d){const l=this.confidentialKey(n,e),c=t.trim();if(c==="")this.confidentialAnswers.delete(l);else{this.confidentialAnswers.set(l,c);const u=a?.questionnaire?.recipient,{QuestionnaireSeal:m}=await w(async()=>{const{QuestionnaireSeal:g}=await import("./QuestionnaireSeal-DpZYUhnf.js");return{QuestionnaireSeal:g}},[],import.meta.url);h={reason:d.reason,...u?{sealed:await m.seal(c,u)}:{}}}}await this.editTranscript(l=>{if(p&&!l.segments.some(c=>c.field!==void 0)){const c=s.interview(p);l.segments=c.segments,l.questionnaire=c.questionnaire,c.language&&!l.language&&(l.language=c.language);for(const[u,m]of Object.entries(c.speakers))l.speakers[u]??=m}l.medium="questionnaire",i?i(l):s.answer(l,e,t,r,h)})}async giveFiles(e,t,r){const{QuestionnaireTemplates:i}=await w(async()=>{const{QuestionnaireTemplates:s}=await import("./rr0-ufoathome.mjs").then(n=>n.a6);return{QuestionnaireTemplates:s}},[],import.meta.url);this.current&&await this.answerField(e,"",r,s=>i.answerFiles(s,e,t,r))}static openers=new Map;static openerFor(e){for(const t of P.point("sealed").sources){let r=f.openers.get(t);if(r||f.openers.set(t,r=t.create()),r.recipient===e)return{source:t,opener:r}}}offerOpening(e,t,r){const i=f.openerFor(r.for),s=this.current;if(!i||!s)return;const n=this.messages,a=t.field!==void 0?this.confidentialKey(s,t.field):void 0,o=document.createElement("div");o.className="sealed-open";const p=h=>{const l=document.createElement("p");l.className="opened",l.textContent=h;const c=document.createElement("p");c.className="opened-note",c.textContent=n.sealOpened.replace("{name}",i.source.name),o.replaceChildren(l,c)},d=a!==void 0?this.confidentialAnswers.get(a):void 0;if(d!==void 0)p(d);else{const h=document.createElement("button");h.type="button",h.className="pill-btn",h.textContent=n.sealOpen.replace("{name}",i.source.name),h.addEventListener("click",()=>{i.opener.open(r).then(c=>{c!==void 0&&(a!==void 0&&this.confidentialAnswers.set(a,c),p(c))},()=>y.show(l,n.sealFailed,"error"))});const l=document.createElement("p");l.className="opened-note",o.replaceChildren(h,l)}e.append(o)}confidentialAnswers=new Map;confidentialKey(e,t){return`${e.id??e.url??""}\0${t}`}formRecipient;formTitle="";sendQuestionnaire(){const e=this.messages,t=this.formRecipient,r=t?this.said.read(t.name)??"":"",i=this.shadow.getElementById("form-sent"),s={...t?.email?{email:t.email}:{},subject:e.sendSubject.replace("{title}",this.formTitle),body:e.sendBody.replace("{title}",this.formTitle)+(t?`
291
+ `;class f extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages;said=new $(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;ready=Promise.resolve();player;drawn;takenOut=new Map;redactTarget;exchangesShown=Promise.resolve();lastReason;static transcriptionSourceId=T[0].id;transcribing;constructor(){super(),this.shadow.innerHTML=te,customElements.upgrade(this.shadow),this.importInput.build();for(const r of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(r).addEventListener(r==="witness"||r==="medium"?"change":"input",()=>this.write(r));for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.addEventListener("click",()=>this.openGroup(f.GROUPS[r.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",r=>{const i=r.detail;i.file?this.importFromFile(i.file):this.importFromUrl(i.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.shadow.getElementById("form-feed").addEventListener("click",()=>this.feedObservation()),this.shadow.getElementById("form-send").addEventListener("click",()=>this.sendQuestionnaire()),this.shadow.getElementById("transcribe-start").addEventListener("click",()=>void this.transcribe()),this.shadow.getElementById("transcribe-stop").addEventListener("click",()=>this.transcribing?.abort()),this.shadow.getElementById("transcribe-source").addEventListener("change",r=>{f.transcriptionSourceId=r.target.value,this.transcribeOutcome=void 0,this.renderTranscribe()}),this.shadow.getElementById("transcribe-key").addEventListener("input",r=>{A.set(f.transcriptionSourceId,r.target.value),this.renderTranscribeStart()});const e=this.shadow.getElementById("exchanges");e.addEventListener("pointerup",()=>setTimeout(()=>this.selectionMade(),0)),e.addEventListener("keyup",r=>{r.shiftKey&&this.selectionMade()}),e.addEventListener("click",r=>{const i=r.target.closest(".bar.redacted-label");i&&this.openBar(i)}),e.addEventListener("keydown",r=>{const i=r.target.closest(".bar.redacted-label");i&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.openBar(i))}),this.shadow.getElementById("redact-take").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("redact-restore").addEventListener("click",()=>{const r=this.redactTarget;this.closeRedactPop(),r?.kind==="bar"&&r.restorable&&this.restore(r.restorable)});const t=this.field("redact-reason");t.addEventListener("change",()=>{this.redactTarget?.kind==="bar"&&this.changeReason()}),t.addEventListener("keydown",r=>{r.key==="Escape"&&this.closeRedactPop(),r.key==="Enter"&&(r.preventDefault(),this.redactTarget?.kind==="selection"?this.redactSelection():this.changeReason().then(()=>this.closeRedactPop()))})}static GROUPS={"group-summary":"summary","group-form":"form","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.ready=this.loadLocale(),document.addEventListener("pointerdown",this.pressedElsewhere,!0)}pressedElsewhere=e=>{const t=this.shadow.getElementById("redact-pop");t&&!t.hidden&&!e.composedPath().includes(t)&&this.closeRedactPop()};disconnectedCallback(){document.removeEventListener("pointerdown",this.pressedElsewhere,!0),queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){const t=e!==this.current;t&&(this.shownFor=void 0),this.current=e,this.render(),t&&this.heldThroughQuestionnaire?this.openGroup("form"):this.group==="form"&&(this.formShown=this.showForm()),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=z.preferencesFor(this),r=J(t,j),i=await G.load(r);e===this.localeToken&&(this.language=r,this.said=new $(t),this.messages=i,this.player||(this.player=new D(this.shadow.getElementById("player"),{timeChanged:s=>this.markCurrentTurn(s),recordingsChanged:s=>void this.editTranscript(n=>{s.length===0?delete n.recordings:n.recordings=s})},i),this.render()),this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e,this.renderTranscribe()}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages;if(!e)return;const t=(l,c)=>{this.shadow.getElementById(l).textContent=c};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-form-group",e.questionnaireTab),t("form-feed",e.feed),O.say(this.shadow.getElementById("form-feed-hint"),"",e.feedHint);const r=this.shadow.getElementById("form-tab");r.hidden=!this.heldThroughQuestionnaire,!this.heldThroughQuestionnaire&&this.group==="form"&&this.openGroup("summary"),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),O.say(this.shadow.getElementById("label-import-file"),e.importFile,e.importFileHint),t("redact-take",e.redactSelection),t("redact-restore",e.redactRestore),t("label-redact-reason",e.redactReasonLabel);const i=this.field("redact-reason");i.placeholder=e.redactReason,i.title=e.redactReasonHint,t("transcribe-start",e.transcribe),this.shadow.getElementById("transcribe-hint").replaceChildren(O.of(e.transcribeHint)),t("label-transcribe-with",e.transcribeWith),t("label-transcribe-key",e.transcribeKey),t("transcribe-key-get",e.transcribeKeyGet),t("transcribe-stop",e.transcribeStop),this.field("transcribe-key").title=e.transcribeKeyHint,this.renderTranscribe(),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const s=this.current,n=this.shadow.activeElement,a=(l,c)=>{this.field(l)!==n&&(this.field(l).value=c)};a("title",this.said.read(s?.title)??""),a("time",s?.time??""),a("by",f.byText(s?.by)),a("url",s?.url??""),a("summary",this.said.read(s?.summary)??"");const o=[s?.interviewOf].flat().filter(l=>typeof l=="string"),p=this.shadow.getElementById("witness"),d=[...this.options,...o.filter(l=>!this.options.some(c=>c.id===l)).map(l=>({id:l,label:l}))];p.replaceChildren(p.querySelector("legend"),...d.map(l=>{const c=document.createElement("label"),u=document.createElement("input");return u.type="checkbox",u.value=l.id,u.checked=o.includes(l.id),c.append(u,l.label),c}));const h=this.shadow.getElementById("medium");if(h.replaceChildren(...N.ALL.map(l=>new Option(N.label(l,this.language),l))),s?.medium!==void 0&&!N.ALL.includes(s.medium)&&h.append(new Option(String(s.medium),String(s.medium))),s?.medium===void 0){const l=new Option(e.witnessNone,"");l.disabled=!0,l.hidden=!0,h.prepend(l)}h.value=s?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const i=this.said.write(t.title,r,this.language);i===void 0?delete t.title:t.title=i;break}case"summary":{const i=this.said.write(t.summary,r,this.language);i===void 0?delete t.summary:t.summary=i;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const i=r.split(",").map(s=>s.trim()).filter(s=>s!=="");i.length===0?delete t.by:t.by=i.map(s=>({people:s}));break}case"witness":{const i=[...this.shadow.querySelectorAll("#witness input:checked")].map(s=>s.value);if(i.length===0){this.render();return}t.interviewOf=i.length===1?i[0]:i;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",form:"group-form",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,i]of Object.entries(t))this.shadow.getElementById(i).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges(),e==="form"&&(this.formShown=this.showForm())}form;formToken=0;formShown=Promise.resolve();get heldThroughQuestionnaire(){return this.current?.medium==="questionnaire"}async showForm(){const e=this.current;if(!e||!this.heldThroughQuestionnaire)return;const t=++this.formToken,[{QuestionnaireForm:r},{QuestionnaireTemplates:i},s]=await Promise.all([w(()=>import("./QuestionnaireForm-vT3C3qXt.js"),__vite__mapDeps([5,6,7]),import.meta.url),w(()=>import("./rr0-ufoathome.mjs").then(u=>u.a7),[],import.meta.url),this.transcriptJson(e)]);await this.ready;const n=s?.questionnaire?.id??"",a=n?await i.load(n):void 0;if(t!==this.formToken||this.current!==e)return;const o=this.messages,p=this.shadow.getElementById("form-note");y.show(p,a?void 0:n?o.unknownQuestionnaire.replace("{id}",n):o.noQuestionnaire,"warning"),this.form??=new r(this.shadow.getElementById("form-fields"),(u,m,g)=>void this.answerField(u,m,g),(u,m,g)=>void this.giveFiles(u,m,g));const d=this.transcriptUrl(e)??new URL(`${e.id??"interview"}.json`,this.base??location.href).href;this.form.show(a??{id:n,title:n,sections:[]},s,o.questionnaire,this.language,this.hasAttribute("readonly"),u=>this.confidentialAnswers.get(this.confidentialKey(e,u)),{add:u=>M.add(u,d),shown:u=>M.shown(u,d),messages:o});const h=this.shadow.getElementById("form-feed");h.disabled=this.hasAttribute("readonly"),this.formRecipient=s?.questionnaire?.recipient,this.formTitle=a?i.text(a.title,this.language):n;const l=this.shadow.getElementById("form-send"),c=this.formRecipient?this.said.read(this.formRecipient.name)??"":void 0;l.textContent=c?o.send.replace("{name}",c):o.sendPrepare,l.disabled=this.hasAttribute("readonly"),O.say(this.shadow.getElementById("form-send-hint"),"",c&&this.formRecipient?.email?o.sendHint.replace("{email}",this.formRecipient.email):o.sendPrepareHint)}async answerField(e,t,r,i){const{QuestionnaireTemplates:s}=await w(async()=>{const{QuestionnaireTemplates:l}=await import("./rr0-ufoathome.mjs").then(c=>c.a7);return{QuestionnaireTemplates:l}},[],import.meta.url),n=this.current;if(!n)return;const a=await this.transcriptJson(n),o=a?.questionnaire?.id,p=o?await s.load(o):void 0,d=p?s.field(p,e)?.confidential:void 0;let h;if(d){const l=this.confidentialKey(n,e),c=t.trim();if(c==="")this.confidentialAnswers.delete(l);else{this.confidentialAnswers.set(l,c);const u=a?.questionnaire?.recipient,{QuestionnaireSeal:m}=await w(async()=>{const{QuestionnaireSeal:g}=await import("./QuestionnaireSeal-DpZYUhnf.js");return{QuestionnaireSeal:g}},[],import.meta.url);h={reason:d.reason,...u?{sealed:await m.seal(c,u)}:{}}}}await this.editTranscript(l=>{if(p&&!l.segments.some(c=>c.field!==void 0)){const c=s.interview(p);l.segments=c.segments,l.questionnaire=c.questionnaire,c.language&&!l.language&&(l.language=c.language);for(const[u,m]of Object.entries(c.speakers))l.speakers[u]??=m}l.medium="questionnaire",i?i(l):s.answer(l,e,t,r,h)})}async giveFiles(e,t,r){const{QuestionnaireTemplates:i}=await w(async()=>{const{QuestionnaireTemplates:s}=await import("./rr0-ufoathome.mjs").then(n=>n.a7);return{QuestionnaireTemplates:s}},[],import.meta.url);this.current&&await this.answerField(e,"",r,s=>i.answerFiles(s,e,t,r))}static openers=new Map;static openerFor(e){for(const t of P.point("sealed").sources){let r=f.openers.get(t);if(r||f.openers.set(t,r=t.create()),r.recipient===e)return{source:t,opener:r}}}offerOpening(e,t,r){const i=f.openerFor(r.for),s=this.current;if(!i||!s)return;const n=this.messages,a=t.field!==void 0?this.confidentialKey(s,t.field):void 0,o=document.createElement("div");o.className="sealed-open";const p=h=>{const l=document.createElement("p");l.className="opened",l.textContent=h;const c=document.createElement("p");c.className="opened-note",c.textContent=n.sealOpened.replace("{name}",i.source.name),o.replaceChildren(l,c)},d=a!==void 0?this.confidentialAnswers.get(a):void 0;if(d!==void 0)p(d);else{const h=document.createElement("button");h.type="button",h.className="pill-btn",h.textContent=n.sealOpen.replace("{name}",i.source.name),h.addEventListener("click",()=>{i.opener.open(r).then(c=>{c!==void 0&&(a!==void 0&&this.confidentialAnswers.set(a,c),p(c))},()=>y.show(l,n.sealFailed,"error"))});const l=document.createElement("p");l.className="opened-note",o.replaceChildren(h,l)}e.append(o)}confidentialAnswers=new Map;confidentialKey(e,t){return`${e.id??e.url??""}\0${t}`}formRecipient;formTitle="";sendQuestionnaire(){const e=this.messages,t=this.formRecipient,r=t?this.said.read(t.name)??"":"",i=this.shadow.getElementById("form-sent"),s={...t?.email?{email:t.email}:{},subject:e.sendSubject.replace("{title}",this.formTitle),body:e.sendBody.replace("{title}",this.formTitle)+(t?`
292
292
 
293
293
  ${e.sendSealed.replace("{name}",r)}`:""),attach:e.sendAttach,report:(n,a)=>y.show(i,(n==="shared"?e.sent:n==="prepared"?e.sendPrepared:e.sendFailed).replace("{file}",a).replace("{error}",a),n==="failed"?"error":"info")};this.dispatchEvent(new CustomEvent(Y,{bubbles:!0,composed:!0,detail:s}))}feedObservation(){const e=this.current;e&&this.transcriptJson(e).then(t=>{const r=this.shadow.getElementById("form-fed"),i=s=>y.show(r,s>0?this.messages.fed.replace("{n}",String(s)):this.messages.fedNothing,s>0?"info":"warning");if(!t){i(0);return}this.dispatchEvent(new CustomEvent(X,{bubbles:!0,composed:!0,detail:{event:e,json:t,report:i}}))})}exchangesToken=0;async transcriptJson(e){try{const t=this.fileEditor?.text??this.text;if(t!==void 0)return v.read(JSON.parse(t));const r=this.transcriptUrl(e);if(r!==void 0)return v.read(await I.json(r))}catch{}}async showExchanges(){const e=this.current;if(!e)return;const t=++this.exchangesToken,r=await this.transcriptJson(e);await this.ready,!(t!==this.exchangesToken||this.current!==e)&&this.drawExchanges(r)}drawExchanges(e){const t=this.shadow.getElementById("exchanges");t.documentUrl=this.current?this.transcriptUrl(this.current):void 0,t.interview=e,this.drawn=e,this.player?.show(e,this.current?this.transcriptUrl(this.current):void 0),this.renderReview(e),this.renderRedactReasons(e),this.decorateExchanges(e),this.renderTranscribe()}async editTranscript(e){const t=this.current;if(!t||this.hasAttribute("readonly"))return;const r=await this.transcriptJson(t)??JSON.parse(this.template(t));Array.isArray(r.segments)||(r.segments=[]),e(r);const i=f.pretty(f.withEventFields(r,t));this.fileEditor?.replaceText(i,!1),this.onEdited(i),await this.exchangesShown}get redactReason(){return this.reasonOf(this.lastReason)}reasonOf(e){e=e?.trim()||this.messages.redactReason;const t=this.givenReasons(this.drawn).find(r=>this.said.read(r)===e);return t!==void 0?typeof t=="string"?t:{...t}:this.said.write(void 0,e,this.language)??e}givenReasons(e){const t=new Map;for(const r of e?.segments??[])for(const i of[r.redacted,...(r.parts??[]).map(s=>"redacted"in s?s.redacted:void 0)]){if(!i)continue;const s=JSON.stringify(i.reason),n=t.get(s);n?n.n++:t.set(s,{reason:i.reason,n:1})}return[...t.values()].sort((r,i)=>i.n-r.n).map(r=>r.reason)}renderRedactReasons(e){const t=this.messages;if(!t)return;const r=this.givenReasons(e).map(n=>this.said.read(n)??"").filter(n=>n!==""),i=t.redactReasons.filter(n=>!r.some(a=>a.toLowerCase().startsWith(n.toLowerCase()))),s=[...new Set([...r,...i])];this.shadow.getElementById("redact-reasons").replaceChildren(...s.map(n=>new Option(n,n)))}speakerLabel(e,t){const r=v.speakerName(e,t),i=e.speakers?.[t]?.role;return i===v.UNATTRIBUTED&&e.speakers[t].title?this.messages.voiceNamed.replace("{name}",r):r===i&&i in this.messages.roles?this.messages.roles[i]:r}renderReview(e){const t=this.shadow.getElementById("review"),r=Object.entries(e?.speakers??{}).filter(([,o])=>o.role!==v.UNATTRIBUTED).map(([o])=>o);if(t.hidden=!e||r.length===0,!e||r.length===0)return;const i=o=>["approved","covered"].includes(e.proofreading?.[o]?.status??""),s=r.filter(o=>!i(o)),n=document.createElement("span");n.textContent=s.length===0?this.messages.proofreadAll:this.messages.proofreadPending.replace("{names}",s.map(o=>this.speakerLabel(e,o)).join(", ")),t.toggleAttribute("data-done",s.length===0);const a=document.createElement("span");a.className="review-boxes";for(const o of r){const p=document.createElement("label"),d=document.createElement("input");d.type="checkbox",d.checked=i(o),d.disabled=this.hasAttribute("readonly"),d.addEventListener("change",()=>void this.editTranscript(h=>{h.proofreading??={},d.checked?h.proofreading[o]={status:"approved",date:new Date().toISOString().slice(0,10)}:h.proofreading[o]={status:"pending"}})),p.append(d,this.messages.reviewedBy.replace("{name}",this.speakerLabel(e,o))),a.append(p)}t.replaceChildren(n,a)}momentsOf(e,t){const r=e.speakers?.[t]?.of??v.sightingsOf(e)[0];return this.options.find(i=>i.id===r)?.moments??this.options.flatMap(i=>i.moments??[])}decorateExchanges(e){if(!e)return;const t=this.messages,r=this.hasAttribute("readonly");for(const i of this.shadow.querySelectorAll("#exchanges .turn[data-segment]")){const s=Number(i.dataset.segment),n=e.segments[s];if(!n)continue;if(n.start!==void 0){const d=document.createElement("button");d.type="button",d.className="turn-time",d.textContent=v.clock(n.start),d.addEventListener("click",()=>this.player?.seek(n.start)),i.prepend(d)}const a=n.redacted?[n.redacted]:b.partsOf(n).flatMap(d=>"redacted"in d?[d.redacted]:[]);i.querySelectorAll(".bar").forEach((d,h)=>{const l=a[h]?.words;d.textContent=l!==void 0?t.redactedWords.replace("{n}",String(l)):t.redacted,d.classList.add("redacted-label");const c=n.redacted?`${s}:all`:`${s}:${h}`;this.takenOut.has(c)&&(d.dataset.restorable=c)});const o=n.redacted?.sealed;o&&this.offerOpening(i,n,o);const p=this.momentsOf(e,n.speaker);i.querySelectorAll(".ref").forEach((d,h)=>{const l=n.refs?.[h];if(!l)return;const c=p.find(m=>Math.abs(m.at-l.at)<.05);if(c){const m=document.createElement("span");m.className="moment-letter",m.textContent=c.label.slice(0,2),d.replaceChildren(m,t.momentLabel.replace("{k}",c.label).replace("{text}",c.note??v.clock(l.at)))}if(r)return;const u=document.createElement("button");u.type="button",u.className="ref-unlink",u.textContent="×",u.title=t.unlinkMoment,u.setAttribute("aria-label",t.unlinkMoment),u.addEventListener("click",()=>void this.editTranscript(m=>{m.segments[s].refs?.splice(h,1),m.segments[s].refs?.length===0&&delete m.segments[s].refs})),d.after(u)}),r||i.append(this.turnTools(e,s,n,p))}}turnTools(e,t,r,i){const s=this.messages,n=document.createElement("div");n.className="turn-tools";const a=(d,h)=>{const l=document.createElement("button");return l.type="button",l.textContent=d,l.addEventListener("click",h),l};if(e.speakers?.[r.speaker]?.role==="witness"&&!r.redacted){const d=a(s.linkMoment,()=>{});n.append(d),new F(d,`moment-menu-${t}`,l=>void this.editTranscript(c=>{const u=c.segments[t].refs??[];u.some(m=>Math.abs(m.at-Number(l))<.05)||u.push({at:Number(l)}),c.segments[t].refs=u}),l=>`moment-${t}-${l}`).setKinds(i.length>0?i.map(l=>({value:String(l.at),label:s.momentLabel.replace("{k}",l.label).replace("{text}",l.note??v.clock(l.at))})):[{value:"",label:s.noMoments,disabledReason:s.noMoments}])}if(r.redacted||n.append(a(s.editTurn,()=>this.editTurn(t))),!r.redacted&&!this.hasAttribute("readonly")){const d=a(s.whoSpeaks,()=>{});n.append(d),new F(d,`speaker-menu-${t}`,l=>void w(async()=>{const{InterviewImport:c}=await import("./interviewImport-ym5iXO4Z.js");return{InterviewImport:c}},__vite__mapDeps([8,7,6]),import.meta.url).then(({InterviewImport:c})=>this.editTranscript(u=>{c.attribute(u,t,l)})),l=>`speaker-${t}-${l}`).setKinds(Object.keys(e.speakers??{}).map(l=>({value:l,label:this.speakerLabel(e,l),...l===r.speaker?{disabledReason:this.speakerLabel(e,l)}:{}})))}const o=this.takenOut.has(`${t}:all`)||[...this.takenOut.keys()].some(d=>d.startsWith(`${t}:`));if(r.redacted||r.parts&&o){const d=a(s.restoreAll,()=>void this.restoreAll(t));d.disabled=!o,n.append(d)}else n.append(a(s.redactAll,()=>void this.editTranscript(d=>{this.forget(t),this.takenOut.set(`${t}:all`,b.redactWhole(d.segments[t],this.redactReason))}).then(()=>{const d=this.shadow.querySelector(`#exchanges .turn[data-segment="${t}"] .bar.redacted-label`);d&&this.openBar(d)})));const p=a("",()=>void this.editTranscript(d=>{d.segments.splice(t,1),this.shiftTakenOut(t)}));return p.className="icon-btn",p.innerHTML=x.TRASH,p.title=s.deleteTurn,p.setAttribute("aria-label",s.deleteTurn),n.append(p),n}selectionMade(){const e=this.messages;if(!e||this.hasAttribute("readonly"))return;const t=this.shadow.getSelection?.()??document.getSelection(),r=t&&t.rangeCount>0?t.getRangeAt(0):void 0,i=this.shadow.getElementById("exchanges");if(!r||r.collapsed||!i.contains(r.startContainer)||!i.contains(r.endContainer))return;const s=l=>l instanceof Element?l:l.parentElement,n=s(r.startContainer)?.closest(".said");if(!n&&!s(r.endContainer)?.closest(".said"))return;const a=n&&s(r.endContainer)?.closest(".said")===n&&!s(r.startContainer)?.closest(".bar")&&!s(r.endContainer)?.closest(".bar"),o=r.getBoundingClientRect();if(!a){this.openRedactPop({kind:"selection",index:-1,from:0,to:0},o,e.selectionOnePassage);return}const p=Number(n.closest(".turn").dataset.segment),d=f.offsetIn(n,r.startContainer,r.startOffset),h=f.offsetIn(n,r.endContainer,r.endOffset);this.openRedactPop({kind:"selection",index:p,from:Math.min(d,h),to:Math.max(d,h)},o),f.markPending(r)}static PENDING="rr0-redact-pending";static markPending(e){const t=globalThis.CSS?.highlights,r=globalThis.Highlight;!t||!r||(e?t.set(f.PENDING,new r(e.cloneRange())):t.delete(f.PENDING))}openBar(e){if(this.hasAttribute("readonly"))return;const t=e.closest(".turn");if(!t)return;const r=Number(t.dataset.segment),i=[...t.querySelectorAll(".bar")].indexOf(e),s=this.drawn?.segments[r];if(!s)return;const n=s.redacted?"all":i,a=`${r}:${n}`;this.openRedactPop({kind:"bar",index:r,nth:n,restorable:this.takenOut.has(a)?a:void 0},e.getBoundingClientRect())}openRedactPop(e,t,r){const i=this.shadow.getElementById("redact-pop"),s=this.field("redact-reason");f.markPending(),this.redactTarget=e;const n=this.shadow.getElementById("redact-take"),a=this.shadow.getElementById("redact-restore");n.hidden=e.kind!=="selection",n.disabled=!!r,a.hidden=e.kind!=="bar"||!e.restorable,s.disabled=!!r,s.value=e.kind==="bar"?this.said.read(this.redactionAt(this.drawn,e.index,e.nth)?.reason)??"":this.lastReason??"";const o=this.shadow.getElementById("redact-note");o.textContent=r??"",o.classList.toggle("error",!!r),i.hidden=!1,typeof i.showPopover=="function"&&i.isConnected&&(i.setAttribute("popover","manual"),i.matches(":popover-open")||i.showPopover());const p=i.offsetWidth||320,d=i.offsetHeight||120,h=t.bottom+6+d<=window.innerHeight;i.style.top=`${Math.max(8,h?t.bottom+6:t.top-6-d)}px`,i.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-p-8))}px`,r||s.focus({preventScroll:!0})}closeRedactPop(){const e=this.shadow.getElementById("redact-pop");this.redactTarget=void 0,f.markPending(),typeof e.hidePopover=="function"&&e.matches?.(":popover-open")&&e.hidePopover(),e.hidden=!0}redactionAt(e,t,r){const i=e?.segments[t];if(i)return r==="all"?i.redacted:b.partsOf(i).flatMap(s=>"redacted"in s?[s.redacted]:[])[r]}async changeReason(){const e=this.redactTarget;if(e?.kind!=="bar")return;const t=this.reasonOf(this.field("redact-reason").value),r=this.redactionAt(this.drawn,e.index,e.nth);!r||JSON.stringify(r.reason)===JSON.stringify(t)||await this.editTranscript(i=>{if(e.nth!=="all"){const n=this.redactionAt(i,e.index,e.nth);n&&(n.reason=t);return}const s=JSON.stringify(i.segments[e.index].redacted?.reason);for(let n=e.index;n<i.segments.length;n++){const a=i.segments[n].redacted;if(!a||n>e.index&&JSON.stringify(a.reason)!==s)break;a.reason=t}})}async redactSelection(){const e=this.messages,t=this.redactTarget;if(t?.kind!=="selection"||t.index<0)return;this.lastReason=this.field("redact-reason").value.trim()||void 0;const r=this.redactReason;let i=!1;if(await this.editTranscript(s=>{const n=b.redact(s.segments[t.index],t.from,t.to,r);n&&(i=!0,this.shiftParts(t.index,n.nth),this.takenOut.set(`${t.index}:${n.nth}`,n.text))}),!i){const s=this.shadow.getElementById("redact-note");s.textContent=e.selectionOnePassage,s.classList.add("error");return}this.closeRedactPop(),(this.shadow.getSelection?.()??document.getSelection())?.removeAllRanges()}static offsetIn(e,t,r){let i=0;const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:n=>n.parentElement?.closest(".bar")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let n=s.nextNode();n;n=s.nextNode()){if(n===t)return i+r;if(t.contains(n)&&t!==n){const o=[...t.childNodes].slice(0,r);return i+o.reduce((p,d)=>p+(d instanceof Element&&d.closest(".bar")?0:(d.textContent??"").length),0)}i+=(n.textContent??"").length}return i}async restore(e){const t=this.takenOut.get(e);if(t===void 0)return;const[r,i]=e.split(":"),s=Number(r);await this.editTranscript(n=>{i==="all"?b.restoreWhole(n.segments[s],t):(b.restorePart(n.segments[s],Number(i),t),this.shiftParts(s,Number(i),-1)),this.takenOut.delete(e)})}async restoreAll(e){if(this.takenOut.has(`${e}:all`)){await this.restore(`${e}:all`);return}const t=[...this.takenOut.keys()].filter(r=>r.startsWith(`${e}:`)).map(r=>Number(r.split(":")[1])).sort((r,i)=>i-r);for(const r of t)await this.restore(`${e}:${r}`)}editTurn(e){const r=this.drawn?.segments[e],i=this.shadow.querySelector(`#exchanges .turn[data-segment="${e}"] .said`);if(!r||!i)return;const s=this.messages,n=document.createElement("div");n.className="turn-edit";const a=document.createElement("textarea");a.value=b.raw(r,l=>this.takenOut.get(`${e}:${l}`));const o=document.createElement("span");o.className="hint",o.textContent=s.turnEditHint;const p=document.createElement("div");p.className="buttons";const d=document.createElement("button");d.type="button",d.className="pill-btn primary",d.textContent=s.saveTurn,d.addEventListener("click",()=>void this.editTranscript(l=>{const c=b.fromRaw(l.segments[e],a.value,this.redactReason);this.forget(e);for(const[u,m]of c)this.takenOut.set(`${e}:${u}`,m)}));const h=document.createElement("button");h.type="button",h.className="pill-btn",h.textContent=s.cancelTurn,h.addEventListener("click",()=>this.drawExchanges(this.drawn)),p.append(d,h),n.append(a,o,p),i.replaceWith(n),a.focus()}forget(e){for(const t of[...this.takenOut.keys()])t.startsWith(`${e}:`)&&this.takenOut.delete(t)}shiftParts(e,t,r=1){const i=[...this.takenOut].filter(([s])=>s.startsWith(`${e}:`)&&s!==`${e}:all`&&Number(s.split(":")[1])>=t+(r<0?1:0));for(const[s]of i)this.takenOut.delete(s);for(const[s,n]of i)this.takenOut.set(`${e}:${Number(s.split(":")[1])+r}`,n)}shiftTakenOut(e){const t=[...this.takenOut];this.takenOut.clear();for(const[r,i]of t){const[s,n]=r.split(":"),a=Number(s);a<e?this.takenOut.set(r,i):a>e&&this.takenOut.set(`${a-1}:${n}`,i)}}markCurrentTurn(e){const t=this.drawn?.segments??[];let r=-1;t.forEach((n,a)=>{n.start!==void 0&&n.start<=e&&(r=a)});for(const n of this.shadow.querySelectorAll("#exchanges .turn.current"))n.classList.remove("current");const i=this.shadow.querySelector(`#exchanges .turn[data-segment="${r}"]`);if(!i)return;i.classList.add("current");const s=i.closest(".rr0-interview-turns");s&&(i.offsetTop<s.scrollTop||i.offsetTop>s.scrollTop+s.clientHeight-i.offsetHeight)&&s.scrollTo({top:i.offsetTop-s.clientHeight/3,behavior:"smooth"})}async revealSegment(e){this.openGroup("exchanges"),await this.showExchanges(),this.shadow.getElementById("exchanges").revealSegment(e)}transcribeOutcome;renderTranscribe(){this.shadow.getElementById("transcribe").hidden=this.hasAttribute("readonly")||!this.transcribing&&!this.player?.recordingUrl();const e=this.messages;if(!e)return;const t=this.shadow.getElementById("transcribe-source");[...t.options].map(d=>d.value).join()!==T.map(d=>d.id).join()&&t.replaceChildren(...T.map(d=>{const h=new Option(d.name,d.id);return h.title=d.credit,h}));const r=L(T,f.transcriptionSourceId);t.value=r.id;const i=this.shadow.getElementById("transcribe-credit");i.href=r.creditUrl,i.textContent=r.credit,this.shadow.getElementById("transcribe-key-row").hidden=!r.keyUrl,this.shadow.getElementById("transcribe-key-get").href=r.keyUrl??"";const s=this.field("transcribe-key");if(s!==this.shadow.activeElement&&(s.value=A.of(r.id)??""),this.transcribing)return;const n=this.player?.recordingUrl();this.renderTranscribeStart();const a=this.shadow.getElementById("transcribe-note");if(this.transcribeOutcome){y.show(a,this.transcribeOutcome.text,this.transcribeOutcome.kind);return}if(!n){y.show(a,e.transcribeNoRecording);return}const o=r.create(),p=[o.sendsAudio?e.transcribeSends.replace("{name}",r.name):e.transcribeLocal.replace("{mb}",String(Math.round((o.downloadBytes??0)/1e6)))];(this.drawn?.segments?.length??0)>0&&p.push(e.transcribeReplaces),y.show(a,p.join(" "),o.sendsAudio?"warning":"info")}renderTranscribeStart(){if(this.transcribing||!this.messages)return;const e=L(T,f.transcriptionSourceId),t=this.shadow.getElementById("transcribe-start");t.disabled=!!e.keyUrl&&!A.of(e.id),t.title=t.disabled?this.messages.transcribeErrors.noKey:""}showTranscribing(e){this.shadow.getElementById("transcribe-start").disabled=e,this.shadow.getElementById("transcribe-stop").hidden=!e,this.shadow.getElementById("transcribe-source").disabled=e,this.field("transcribe-key").disabled=e,this.shadow.getElementById("transcribe-progress").hidden=!e}showProgress(e){const t=this.messages,r=this.shadow.getElementById("transcribe-note"),i=this.shadow.getElementById("transcribe-progress"),s=n=>String(Math.round(n/1e6));if(e==="reading")i.removeAttribute("value"),y.show(r,t.transcribeReading);else if(e.stage==="loading")e.total?(i.max=e.total,i.value=e.loaded,y.show(r,t.transcribeLoading.replace("{loaded}",s(e.loaded)).replace("{total}",s(e.total)))):(i.removeAttribute("value"),y.show(r,t.transcribeLoadingSoFar.replace("{loaded}",s(e.loaded))));else if(e.stage==="sending"||e.stage==="waiting"){i.removeAttribute("value");const n=L(T,f.transcriptionSourceId).name;y.show(r,(e.stage==="sending"?t.transcribeSending:t.transcribeWaiting).replace("{name}",n))}else i.max=e.total,i.value=e.done,y.show(r,t.transcribeProgress.replace("{done}",v.clock(Math.round(e.done))).replace("{total}",v.clock(Math.round(e.total))))}async transcribe(){const e=this.messages,t=this.current,r=this.player?.recordingUrl();if(!e||!t||this.transcribing||this.hasAttribute("readonly"))return;if(!r){this.player?.showWindow();return}const i=L(T,f.transcriptionSourceId),s=i.create(),n=this.transcribing=new AbortController;this.transcribeOutcome=void 0,this.showTranscribing(!0),this.showProgress("reading");try{const[{TranscriptionAudio:a},{TranscriptionError:o},{InterviewImport:p}]=await Promise.all([w(()=>import("./TranscriptionAudio-C_xvRUv2.js"),[],import.meta.url),w(()=>import("./TranscriptionError-D_TCbYbt.js"),[],import.meta.url),w(()=>import("./interviewImport-ym5iXO4Z.js"),__vite__mapDeps([8,7,6]),import.meta.url)]),d=await fetch(r,{signal:n.signal});if(!d.ok)throw new o("failed",`HTTP ${d.status}`);if(Number(d.headers.get("content-length")??0)>a.MAX_BYTES)throw new o("tooLarge");const h=await d.arrayBuffer();if(h.byteLength>a.MAX_BYTES)throw new o("tooLarge");const l=await a.decode(h).catch(()=>{throw new o("failed",e.loadFailed)}),c=this.drawn?.language??this.language,u=await s.transcribe({samples:l,language:c,signal:n.signal,progress:k=>this.showProgress(k)}),m=[t.interviewOf].flat().filter(k=>typeof k=="string"),g=p.transcribed(u,{by:(t.by??[]).flatMap(k=>"people"in k?[k.people]:[]),witnesses:this.options.filter(k=>m.length===0||m.includes(k.id)).map(({id:k,label:Q})=>({id:k,label:Q}))});if(!g)throw new o("failed",e.exchangesEmpty);if(n.signal.aborted||this.current!==t)throw new DOMException("Aborted","AbortError");const{anonymization:re,...W}=await this.transcriptJson(t)??{};await this.take({...W,...g,language:c,transcription:{method:"automatic",engine:s.engine,note:`Transcribed in UFO@home by ${s.engine}: whose each voice is was not known, to be attributed, then proofread.`}}),this.transcribeOutcome={text:e.transcribeDone.replace("{engine}",i.name),kind:"info"}}catch(a){const o=a;n.signal.aborted||o?.name==="AbortError"?this.transcribeOutcome={text:e.transcribeStopped,kind:"info"}:o?.name==="TranscriptionError"&&o.code?this.transcribeOutcome={text:e.transcribeErrors[o.code].replace("{detail}",o.detail??""),kind:"error"}:this.transcribeOutcome={text:e.transcribeErrors.failed.replace("{detail}",String(o?.message??a)),kind:"error"}}finally{this.transcribing=void 0,this.showTranscribing(!1),this.renderTranscribe()}}note(e,t="info"){y.show(this.shadow.getElementById("file-note"),e,t)}transcriptUrl(e){return e.url?new URL(e.url,this.base??location.href).href:void 0}static pretty(e){return JSON.stringify(e,null,2)+`
294
- `}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of f.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const s of f.SHARED)t[s]===void 0?delete r[s]:r[s]=structuredClone(t[s]);const i=r.speakers;if(typeof i=="object"&&i!==null){const s={...i},n=(a,o,p)=>{p.forEach((d,h)=>{const l=h===0?a:`${a}${h+1}`;s[l]?s[l]={...s[l],[o]:d}:h>0&&(s[l]={role:a,[o]:d})})};n("interviewer","by",t.by??[]),n("witness","of",f.witnessesOf(t.interviewOf)),r.speakers=s}return f.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const i=JSON.stringify(f.SHARED.map(a=>r[a])),s=a=>typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a),n={title:s,summary:s,time:a=>typeof a=="string",medium:a=>typeof a=="string",by:a=>Array.isArray(a),interviewOf:a=>typeof a=="string"||Array.isArray(a)};for(const a of f.SHARED){const o=e[a];o!==void 0&&n[a](o)?r[a]=structuredClone(o):t&&delete r[a]}return JSON.stringify(f.SHARED.map(a=>r[a]))!==i}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const i=f.pretty(f.withEventFields(r,e));i!==t&&(this.text=i,this.fileEditor?.replaceText(i,!1),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:i}})))}template(e){return f.pretty(f.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},i]=await Promise.all([w(()=>import("./SightingFileEditor-DS1DRU2p.js"),__vite__mapDeps([9,10,11]),import.meta.url),w(()=>import("./interviewSchema-r5bW7skq.js"),[],import.meta.url),K(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,s=>this.onEdited(s),this.messages.editorLabel,{baseline:e,phrases:i.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const i=await I.json(r);this.current===e&&typeof i=="object"&&i!==null&&!Array.isArray(i)?(this.applyFileToEvent(i,!1)&&this.fileChangedEvent(),t=f.pretty(f.withEventFields(i,e))):t=f.pretty(i)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const i=this.current;if(r&&i&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),i&&!i.url&&e.trim()!==""){const s=i.id??"1";i.url=`${s.startsWith("interview")?s:`interview-${s}`}.json`,this.field("url").value=i.url,this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"url",event:i}}))}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:i,text:e}})),this.exchangesShown=this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=f.pretty(t?f.withEventFields(e,t):e);await this.loadFileEditor(r).then(i=>i.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}const i=this.importHints();if(this.isQuestionnaire(r)){await this.takeQuestionnaire(r??t,e.name);return}if(typeof r!="object"||r===null){const{InterviewImport:s}=await w(async()=>{const{InterviewImport:a}=await import("./interviewImport-ym5iXO4Z.js");return{InterviewImport:a}},__vite__mapDeps([8,7,6]),import.meta.url),n=s.parse(t,i);r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}importHints(){const e=this.current,t=[e?.interviewOf].flat().filter(r=>typeof r=="string");return{by:(e?.by??[]).map(r=>f.byText([r])).filter(r=>r!==""),witnesses:this.options.filter(r=>t.length===0||t.includes(r.id))}}isQuestionnaire(e){const t=typeof e=="object"&&e!==null&&Array.isArray(e.segments);return this.current?.medium==="questionnaire"&&!t}async takeQuestionnaire(e,t){const[{QuestionnaireImport:r},{QuestionnaireTemplates:i}]=await Promise.all([w(()=>import("./QuestionnaireImport-BlTDOHWj.js"),__vite__mapDeps([12,7,6]),import.meta.url),w(()=>import("./rr0-ufoathome.mjs").then(p=>p.a6),[],import.meta.url)]),n=(this.current?await this.transcriptJson(this.current):void 0)?.questionnaire?.id,a=n?await i.load(n):void 0,o=r.parse(e,this.importHints(),a);if(!o){this.note(this.messages.notAQuestionnaire,"error");return}await this.take({...o,transcription:{method:"manual",note:`Imported from ${t}: one question and its answer per field, as the witness filled it in.`}})}async importFromUrl(e){try{const t=new URL(e,this.base??location.href).href,r=await I.json(t);this.isQuestionnaire(r)?await this.takeQuestionnaire(r,t.split("/").pop()??t):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),i=document.createElement("a");i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}}function Ae(){Z(),V(),customElements.get(H)||customElements.define(H,f)}export{S as INTERVIEW_CHANGE_EVENT,H as INTERVIEW_EDITOR_ELEMENT_NAME,Le as INTERVIEW_SEEK_EVENT,f as InterviewEditorElement,Ae as register};
294
+ `}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of f.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const s of f.SHARED)t[s]===void 0?delete r[s]:r[s]=structuredClone(t[s]);const i=r.speakers;if(typeof i=="object"&&i!==null){const s={...i},n=(a,o,p)=>{p.forEach((d,h)=>{const l=h===0?a:`${a}${h+1}`;s[l]?s[l]={...s[l],[o]:d}:h>0&&(s[l]={role:a,[o]:d})})};n("interviewer","by",t.by??[]),n("witness","of",f.witnessesOf(t.interviewOf)),r.speakers=s}return f.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const i=JSON.stringify(f.SHARED.map(a=>r[a])),s=a=>typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a),n={title:s,summary:s,time:a=>typeof a=="string",medium:a=>typeof a=="string",by:a=>Array.isArray(a),interviewOf:a=>typeof a=="string"||Array.isArray(a)};for(const a of f.SHARED){const o=e[a];o!==void 0&&n[a](o)?r[a]=structuredClone(o):t&&delete r[a]}return JSON.stringify(f.SHARED.map(a=>r[a]))!==i}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const i=f.pretty(f.withEventFields(r,e));i!==t&&(this.text=i,this.fileEditor?.replaceText(i,!1),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:i}})))}template(e){return f.pretty(f.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},i]=await Promise.all([w(()=>import("./SightingFileEditor-D5_GwIsn.js"),__vite__mapDeps([9,10,11]),import.meta.url),w(()=>import("./interviewSchema-r5bW7skq.js"),[],import.meta.url),K(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,s=>this.onEdited(s),this.messages.editorLabel,{baseline:e,phrases:i.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const i=await I.json(r);this.current===e&&typeof i=="object"&&i!==null&&!Array.isArray(i)?(this.applyFileToEvent(i,!1)&&this.fileChangedEvent(),t=f.pretty(f.withEventFields(i,e))):t=f.pretty(i)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const i=this.current;if(r&&i&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),i&&!i.url&&e.trim()!==""){const s=i.id??"1";i.url=`${s.startsWith("interview")?s:`interview-${s}`}.json`,this.field("url").value=i.url,this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"url",event:i}}))}this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"transcript",event:i,text:e}})),this.exchangesShown=this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(S,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=f.pretty(t?f.withEventFields(e,t):e);await this.loadFileEditor(r).then(i=>i.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}const i=this.importHints();if(this.isQuestionnaire(r)){await this.takeQuestionnaire(r??t,e.name);return}if(typeof r!="object"||r===null){const{InterviewImport:s}=await w(async()=>{const{InterviewImport:a}=await import("./interviewImport-ym5iXO4Z.js");return{InterviewImport:a}},__vite__mapDeps([8,7,6]),import.meta.url),n=s.parse(t,i);r=n&&{...n,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}importHints(){const e=this.current,t=[e?.interviewOf].flat().filter(r=>typeof r=="string");return{by:(e?.by??[]).map(r=>f.byText([r])).filter(r=>r!==""),witnesses:this.options.filter(r=>t.length===0||t.includes(r.id))}}isQuestionnaire(e){const t=typeof e=="object"&&e!==null&&Array.isArray(e.segments);return this.current?.medium==="questionnaire"&&!t}async takeQuestionnaire(e,t){const[{QuestionnaireImport:r},{QuestionnaireTemplates:i}]=await Promise.all([w(()=>import("./QuestionnaireImport-BlTDOHWj.js"),__vite__mapDeps([12,7,6]),import.meta.url),w(()=>import("./rr0-ufoathome.mjs").then(p=>p.a7),[],import.meta.url)]),n=(this.current?await this.transcriptJson(this.current):void 0)?.questionnaire?.id,a=n?await i.load(n):void 0,o=r.parse(e,this.importHints(),a);if(!o){this.note(this.messages.notAQuestionnaire,"error");return}await this.take({...o,transcription:{method:"manual",note:`Imported from ${t}: one question and its answer per field, as the witness filled it in.`}})}async importFromUrl(e){try{const t=new URL(e,this.base??location.href).href,r=await I.json(t);this.isQuestionnaire(r)?await this.takeQuestionnaire(r,t.split("/").pop()??t):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),i=document.createElement("a");i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}}function Oe(){Z(),V(),customElements.get(H)||customElements.define(H,f)}export{S as INTERVIEW_CHANGE_EVENT,H as INTERVIEW_EDITOR_ELEMENT_NAME,Ce as INTERVIEW_SEEK_EVENT,f as InterviewEditorElement,Oe as register};
@@ -1,4 +1,4 @@
1
- import{S as x,a as T,H as I,s as L,U as S,Y as A,I as b}from"./rr0-ufoathome.mjs";import{I as j}from"./ColumnResize-CO4e1m-q.js";import{InterviewFile as p}from"./interviewJson-D-i14LTf.js";import{P as C}from"./ShareDialogElement-DqCoQwtn.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Sighting-D-_IYi9n.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";const N="rr0-interview",R=`
1
+ import{S as x,a as T,H as I,s as L,U as S,Y as A,I as b}from"./rr0-ufoathome.mjs";import{I as j}from"./ColumnResize-D6vA9JBg.js";import{InterviewFile as p}from"./interviewJson-D-i14LTf.js";import{P as C}from"./ShareDialogElement-Dsc4v4jd.js";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./Sighting-C1yj2-s5.js";import"./VisualAids-DI-hEL46.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";const N="rr0-interview",R=`
2
2
  rr0-interview { display: block; --rr0-interview-line: color-mix(in srgb, currentColor 35%, transparent); }
3
3
  rr0-interview [hidden] { display: none !important; }
4
4
  rr0-interview .rr0-interview-status { font-size: .85em; opacity: .85; margin: 0 0 .5em; }
@@ -1,4 +1,4 @@
1
- import{G as s}from"./GeographicFigures-DrlbDt4f.js";import"./Sighting-D-_IYi9n.js";import"./VisualAids-DI-hEL46.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./ShareDialogElement-DqCoQwtn.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class t{static GROUPS=["observer","sight-line","body","trace"];static of(o,e,i,l){const n=s.of(o,i,l),c=t.GROUPS.map(r=>n.filter(a=>a.group===r)).filter(r=>r.length>0).map(r=>t.folder(r[0].groupName,r.map(a=>t.placemark(a))));return`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{G as s}from"./GeographicFigures-wtF2TmIn.js";import"./Sighting-C1yj2-s5.js";import"./VisualAids-DI-hEL46.js";import"./rr0-ufoathome.mjs";import"./SaidPosition-OJEYhVKN.js";import"./GeoProjection-DvqDbRIx.js";import"./ShareDialogElement-Dsc4v4jd.js";import"./three.module-CbaHqYFq.js";import"./Decor-Dn-cvniW.js";import"./RecordingIssue-BlWT8Xsu.js";import"./xyzImageryRaster-Dhxs0B26.js";import"./Obstacles-v9SkfBD7.js";class t{static GROUPS=["observer","sight-line","body","trace"];static of(o,e,i,l){const n=s.of(o,i,l),c=t.GROUPS.map(r=>n.filter(a=>a.group===r)).filter(r=>r.length>0).map(r=>t.folder(r[0].groupName,r.map(a=>t.placemark(a))));return`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <kml xmlns="http://www.opengis.net/kml/2.2">
3
3
  <Document>
4
4
  <name>${t.xml(s.fill(i.document,{name:e}))}</name>
@@ -1,4 +1,4 @@
1
- import{M as u,_ as h,q as g,t as f}from"./rr0-ufoathome.mjs";import{b as p,P as y}from"./SaidPosition-OJEYhVKN.js";import{S as b}from"./SkyEventEditorStyle-CvY_AhbI.js";import{SkyLantern as o}from"./SkyLantern-DJT_Ibzh.js";import{s as T,b as w}from"./Sighting-D-_IYi9n.js";import{P as A,a as E,E as v}from"./ParameterForm-XbqxCLRn.js";import"./GeoProjection-DvqDbRIx.js";import"./Obstacles-v9SkfBD7.js";import"./VisualAids-DI-hEL46.js";const x=u.catalog({en:()=>h(()=>import("./LanternParameterTexts_en-CcnGd8UH.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_en),fr:()=>h(()=>import("./LanternParameterTexts_fr-P2JwYOUy.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_fr),es:()=>h(()=>import("./LanternParameterTexts_es-CUTgNutZ.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_es),it:()=>h(()=>import("./LanternParameterTexts_it-CzNnIUrX.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_it)});class i{static RELEASE="letGo";static LANTERNS="lanterns";static AIR="air";static LANTERN="eachLantern";static instant(e,t,n){return{type:"number",key:e,min:-36e3,max:36e3,step:1,unit:"s",scale:.001,required:!0,label:t,hint:n,group:i.LANTERNS}}static wind(e,t,n,s){return[{type:"number",key:`${e}.towardDeg`,min:0,max:360,step:1,unit:"°",group:i.AIR,hint:s,label:t},{type:"number",key:`${e}.speedMS`,min:0,max:60,step:.1,unit:"m/s",group:i.AIR,label:n}]}static SET={kind:"lantern",title:"skyLanterns",parameters:[{type:"said",key:"title",label:"name",group:i.RELEASE},{type:"position",key:"site.eastM",secondKey:"site.northM",saidKey:"site.saidPosition",native:"local",step:1,rangeM:1e5,group:i.RELEASE,label:"whereTheyAreLetGo",hint:"whereTheyAreLetGoFrom"},{type:"number",key:"site.altitudeM",min:-1e3,max:5e3,step:.1,unit:"m",group:i.RELEASE,effective:()=>0,label:"heightAboveThePlaceSGround",hint:"aGardenOnAHillAbove"},{type:"number",key:"site.originElevationM",min:-500,max:6e3,step:1,unit:"m",group:i.RELEASE,effective:()=>0,label:"thePlaceSGroundAboveThe",hint:"whatSetsHowThinTheAir"},{type:"number",key:"group.count",min:1,max:200,step:1,required:!0,group:i.LANTERNS,label:"howMany"},i.instant("group.fromT","firstLetGoAt","secondsOfTheRecordingBeforeIts"),i.instant("group.untilT","lastLetGoAt","secondsOfTheRecordingTheOthers"),{type:"number",key:"group.radiusM",min:0,max:5e3,step:1,unit:"m",group:i.LANTERNS,effective:()=>20,label:"letGoWithin",hint:"aCrowdLetsThemGoA"},{type:"number",key:"group.burnS.min",min:10,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>480,label:"burnsAtLeast",hint:"howLongEachBurnsFromWhen"},{type:"number",key:"group.burnS.max",min:10,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>900,label:"burnsAtMost"},{type:"number",key:"group.insideExcessK.min",min:10,max:400,step:1,unit:"K",group:i.LANTERNS,effective:()=>125,label:"hotterThanTheAirAtLeast",hint:"howMuchHotterThanTheAir"},{type:"number",key:"group.insideExcessK.max",min:10,max:400,step:1,unit:"K",group:i.LANTERNS,effective:()=>175,label:"hotterThanTheAirAtMost"},{type:"number",key:"group.burnedS",min:0,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>0,label:"alreadyBurntWhenLetGo",hint:"forLanternsTheAccountOnlyHas"},{type:"number",key:"group.seed",min:0,max:4294967295,step:1,group:i.LANTERNS,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFromAnother"},{type:"set",key:"group.explains",group:i.LANTERNS,label:"standForTheShapes",options:(e,t)=>{const n=t?.shapes??[],s=(e.group?.explains??[]).filter(r=>!n.some(l=>l.value===r));return[...n,...s.map(r=>({value:r,label:r}))]},empty:"noShape"},...i.wind("wind","windAtTheGroundTowards","windAtTheGroundSpeed","whereItBlowsTowardsWhichIs"),...i.wind("windAloft","windAloftTowards","windAloftSpeed","theWindHigherUpBlendedWith"),{type:"number",key:"windAloft.atM",min:10,max:1e4,step:10,unit:"m",group:i.AIR,label:"windAloftAt",hint:"metresAboveWhereTheyAreLet"},{type:"number",key:"airTemperatureC",min:-60,max:50,step:.5,unit:"°C",group:i.AIR,effective:()=>10,label:"airTemperature",hint:"atTheGroundFallingBy6"},{type:"number",key:"turbulence.horizontalMS",min:0,max:10,step:.1,unit:"m/s",group:i.AIR,effective:()=>o.TURBULENCE.horizontalMS,label:"gustsAcross",hint:"howFarTheAirSSpeed"},{type:"number",key:"turbulence.verticalMS",min:0,max:10,step:.1,unit:"m/s",group:i.AIR,effective:()=>o.TURBULENCE.verticalMS,label:"gustsUpAndDown"},{type:"number",key:"turbulence.timescaleS",min:1,max:600,step:1,unit:"s",group:i.AIR,effective:()=>o.TURBULENCE.timescaleS,label:"aGustLasts"},{type:"number",key:"lantern.luminousIntensityCd",min:.1,max:1e3,step:.1,unit:"cd",group:i.LANTERN,effective:()=>o.COMMON.luminousIntensityCd,label:"light",hint:"itsFlameSLightThroughThe"},{type:"choice",key:"lantern.shape",group:i.LANTERN,effective:()=>o.COMMON.shape,label:"shape",choices:[{value:"classic",label:"roundAtTheMouthSquareAt"},{value:"balloon",label:"balloonLobedTop"}]},{type:"colour",key:"lantern.paperColor",group:i.LANTERN,fallback:o.COMMON.paperColor,label:"paperColour",hint:"whatItLooksLikeByDay"},{type:"colour",key:"lantern.color",group:i.LANTERN,fallback:o.COMMON.color,label:"flameLight",hint:"itsFlameSLightThroughWhite"},{type:"number",key:"lantern.envelopeVolumeM3",min:.01,max:10,step:.01,unit:"m³",group:i.LANTERN,effective:()=>o.COMMON.envelopeVolumeM3,label:"airItHolds"},{type:"number",key:"lantern.massKg",min:.005,max:5,step:.001,unit:"kg",group:i.LANTERN,effective:()=>o.COMMON.massKg,label:"weightWhenLetGo"}]};static publish(){p.publish(i.SET)}}const S=u.catalog({en:()=>h(()=>import("./LanternEditorMessages_en-DaT3UNfD.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_en),fr:()=>h(()=>import("./LanternEditorMessages_fr-9mByTFMG.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_fr),es:()=>h(()=>import("./LanternEditorMessages_es-TDV5lKeJ.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_es),it:()=>h(()=>import("./LanternEditorMessages_it-MRkJnDQp.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_it)});class m{constructor(e,t,n){this.container=e,this.host=t,b.attach(e,"lantern-editor-part",m.STYLE),this.language=n,p.of("lantern")||i.publish(),this.ready=this.setLanguage(n)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;language;shown=[];static STYLE=`
1
+ import{M as u,_ as h,q as g,t as f}from"./rr0-ufoathome.mjs";import{b as p,P as y}from"./SaidPosition-OJEYhVKN.js";import{S as b}from"./SkyEventEditorStyle-CvY_AhbI.js";import{SkyLantern as o}from"./SkyLantern-DJT_Ibzh.js";import{s as T,b as w}from"./Sighting-C1yj2-s5.js";import{P as A,a as E,E as v}from"./ParameterForm-XbqxCLRn.js";import"./GeoProjection-DvqDbRIx.js";import"./Obstacles-v9SkfBD7.js";import"./VisualAids-DI-hEL46.js";const x=u.catalog({en:()=>h(()=>import("./LanternParameterTexts_en-CcnGd8UH.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_en),fr:()=>h(()=>import("./LanternParameterTexts_fr-P2JwYOUy.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_fr),es:()=>h(()=>import("./LanternParameterTexts_es-CUTgNutZ.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_es),it:()=>h(()=>import("./LanternParameterTexts_it-CzNnIUrX.js"),[],import.meta.url).then(a=>a.lanternParameterTexts_it)});class i{static RELEASE="letGo";static LANTERNS="lanterns";static AIR="air";static LANTERN="eachLantern";static instant(e,t,n){return{type:"number",key:e,min:-36e3,max:36e3,step:1,unit:"s",scale:.001,required:!0,label:t,hint:n,group:i.LANTERNS}}static wind(e,t,n,s){return[{type:"number",key:`${e}.towardDeg`,min:0,max:360,step:1,unit:"°",group:i.AIR,hint:s,label:t},{type:"number",key:`${e}.speedMS`,min:0,max:60,step:.1,unit:"m/s",group:i.AIR,label:n}]}static SET={kind:"lantern",title:"skyLanterns",parameters:[{type:"said",key:"title",label:"name",group:i.RELEASE},{type:"position",key:"site.eastM",secondKey:"site.northM",saidKey:"site.saidPosition",native:"local",step:1,rangeM:1e5,group:i.RELEASE,label:"whereTheyAreLetGo",hint:"whereTheyAreLetGoFrom"},{type:"number",key:"site.altitudeM",min:-1e3,max:5e3,step:.1,unit:"m",group:i.RELEASE,effective:()=>0,label:"heightAboveThePlaceSGround",hint:"aGardenOnAHillAbove"},{type:"number",key:"site.originElevationM",min:-500,max:6e3,step:1,unit:"m",group:i.RELEASE,effective:()=>0,label:"thePlaceSGroundAboveThe",hint:"whatSetsHowThinTheAir"},{type:"number",key:"group.count",min:1,max:200,step:1,required:!0,group:i.LANTERNS,label:"howMany"},i.instant("group.fromT","firstLetGoAt","secondsOfTheRecordingBeforeIts"),i.instant("group.untilT","lastLetGoAt","secondsOfTheRecordingTheOthers"),{type:"number",key:"group.radiusM",min:0,max:5e3,step:1,unit:"m",group:i.LANTERNS,effective:()=>20,label:"letGoWithin",hint:"aCrowdLetsThemGoA"},{type:"number",key:"group.burnS.min",min:10,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>480,label:"burnsAtLeast",hint:"howLongEachBurnsFromWhen"},{type:"number",key:"group.burnS.max",min:10,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>900,label:"burnsAtMost"},{type:"number",key:"group.insideExcessK.min",min:10,max:400,step:1,unit:"K",group:i.LANTERNS,effective:()=>125,label:"hotterThanTheAirAtLeast",hint:"howMuchHotterThanTheAir"},{type:"number",key:"group.insideExcessK.max",min:10,max:400,step:1,unit:"K",group:i.LANTERNS,effective:()=>175,label:"hotterThanTheAirAtMost"},{type:"number",key:"group.burnedS",min:0,max:3600,step:1,unit:"s",group:i.LANTERNS,effective:()=>0,label:"alreadyBurntWhenLetGo",hint:"forLanternsTheAccountOnlyHas"},{type:"number",key:"group.seed",min:0,max:4294967295,step:1,group:i.LANTERNS,effective:()=>1,label:"draw",hint:"whatTheDrawsStartFromAnother"},{type:"set",key:"group.explains",group:i.LANTERNS,label:"standForTheShapes",options:(e,t)=>{const n=t?.shapes??[],s=(e.group?.explains??[]).filter(r=>!n.some(l=>l.value===r));return[...n,...s.map(r=>({value:r,label:r}))]},empty:"noShape"},...i.wind("wind","windAtTheGroundTowards","windAtTheGroundSpeed","whereItBlowsTowardsWhichIs"),...i.wind("windAloft","windAloftTowards","windAloftSpeed","theWindHigherUpBlendedWith"),{type:"number",key:"windAloft.atM",min:10,max:1e4,step:10,unit:"m",group:i.AIR,label:"windAloftAt",hint:"metresAboveWhereTheyAreLet"},{type:"number",key:"airTemperatureC",min:-60,max:50,step:.5,unit:"°C",group:i.AIR,effective:()=>10,label:"airTemperature",hint:"atTheGroundFallingBy6"},{type:"number",key:"turbulence.horizontalMS",min:0,max:10,step:.1,unit:"m/s",group:i.AIR,effective:()=>o.TURBULENCE.horizontalMS,label:"gustsAcross",hint:"howFarTheAirSSpeed"},{type:"number",key:"turbulence.verticalMS",min:0,max:10,step:.1,unit:"m/s",group:i.AIR,effective:()=>o.TURBULENCE.verticalMS,label:"gustsUpAndDown"},{type:"number",key:"turbulence.timescaleS",min:1,max:600,step:1,unit:"s",group:i.AIR,effective:()=>o.TURBULENCE.timescaleS,label:"aGustLasts"},{type:"number",key:"lantern.luminousIntensityCd",min:.1,max:1e3,step:.1,unit:"cd",group:i.LANTERN,effective:()=>o.COMMON.luminousIntensityCd,label:"light",hint:"itsFlameSLightThroughThe"},{type:"choice",key:"lantern.shape",group:i.LANTERN,effective:()=>o.COMMON.shape,label:"shape",choices:[{value:"classic",label:"roundAtTheMouthSquareAt"},{value:"balloon",label:"balloonLobedTop"}]},{type:"colour",key:"lantern.paperColor",group:i.LANTERN,fallback:o.COMMON.paperColor,label:"paperColour",hint:"whatItLooksLikeByDay"},{type:"colour",key:"lantern.color",group:i.LANTERN,fallback:o.COMMON.color,label:"flameLight",hint:"itsFlameSLightThroughWhite"},{type:"number",key:"lantern.envelopeVolumeM3",min:.01,max:10,step:.01,unit:"m³",group:i.LANTERN,effective:()=>o.COMMON.envelopeVolumeM3,label:"airItHolds"},{type:"number",key:"lantern.massKg",min:.005,max:5,step:.001,unit:"kg",group:i.LANTERN,effective:()=>o.COMMON.massKg,label:"weightWhenLetGo"}]};static publish(){p.publish(i.SET)}}const S=u.catalog({en:()=>h(()=>import("./LanternEditorMessages_en-DaT3UNfD.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_en),fr:()=>h(()=>import("./LanternEditorMessages_fr-9mByTFMG.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_fr),es:()=>h(()=>import("./LanternEditorMessages_es-TDV5lKeJ.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_es),it:()=>h(()=>import("./LanternEditorMessages_it-MRkJnDQp.js"),[],import.meta.url).then(a=>a.lanternEditorMessages_it)});class m{constructor(e,t,n){this.container=e,this.host=t,b.attach(e,"lantern-editor-part",m.STYLE),this.language=n,p.of("lantern")||i.publish(),this.ready=this.setLanguage(n)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;language;shown=[];static STYLE=`
2
2
  .lantern-editor-part, .lantern-editor-part #lantern-list, .lantern-editor-part .launch-fields { flex-basis: 100%; min-width: 0; }
3
3
  .lantern-editor-part .launch-editor, .lantern-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
4
4
  .lantern-editor-part [hidden] { display: none !important; }
@@ -1 +1 @@
1
- import{t as O,b8 as D,b9 as y}from"./ShareDialogElement-DqCoQwtn.js";class l{static DEFAULT_DIVERGENCE_MRAD=.1;static DEFAULT_APERTURE_M=.01;static AEROSOL_SINGLE_SCATTERING_ALBEDO=.9;static AEROSOL_ASYMMETRY=.7;static DEFAULT_PATCHINESS=.35;static PATCH_M=120;static STEP_M=25;static MAX_SAMPLES=2e3;static viewsAt(n,o,t,s){return l.onAt(n,o).map(c=>l.viewOf(c,t,s))}static viewOf(n,o,t){return{id:n.id,wavelengthNm:n.wavelengthNm,patchiness:n.patchiness??l.DEFAULT_PATCHINESS,samples:l.samplesOf(n,o,t)}}static onAt(n,o){return n.filter(t=>(t.fromT===void 0||o>=t.fromT)&&(t.untilT===void 0||o<=t.untilT)).map(t=>l.stateAt(t,o)).filter(t=>t.path.length>=2)}static stateAt(n,o){if(!n.light?.length&&!n.moves?.length)return n;const t={...n};if(n.light?.length){const s=l.joined(n.light.filter(e=>e.wavelengthNm!==void 0),o,e=>e.wavelengthNm),c=l.joined(n.light.filter(e=>e.powerW!==void 0),o,e=>e.powerW);s!==void 0&&(t.wavelengthNm=s),c!==void 0&&(t.powerW=c)}return n.moves?.length&&(t.path=l.pathAt(n.moves,o)),t}static joined(n,o,t){if(n.length===0)return;const s=[...n].sort((a,i)=>a.t-i.t);if(o<=s[0].t)return t(s[0]);const c=s[s.length-1];if(o>=c.t)return t(c);const e=s.findIndex(a=>a.t>o),r=s[e-1],h=s[e],M=(o-r.t)/(h.t-r.t);return t(r)+(t(h)-t(r))*M}static pathAt(n,o){const t=[...n].sort((a,i)=>a.t-i.t);if(o<=t[0].t)return t[0].path;const s=t[t.length-1];if(o>=s.t)return s.path;const c=t.findIndex(a=>a.t>o),e=t[c-1],r=t[c];if(e.path.length!==r.path.length)return e.path;const h=(o-e.t)/(r.t-e.t),M=(a,i)=>a+(i-a)*h;return e.path.map((a,i)=>({lat:M(a.lat,r.path[i].lat),lng:M(a.lng,r.path[i].lng),altitudeM:M(a.altitudeM,r.path[i].altitudeM)}))}static patchAt(n,o,t){if(t.patchiness<=0)return 1;const s=o/1e3,c=(r,h)=>{const M=(n-t.windAlongMS*s)/r,a=(Math.abs(t.windAcrossMS)+.3)*s/r+h;return l.valueNoise(M,a)},e=(2*c(l.PATCH_M,0)+c(l.PATCH_M/3,17.3))/3;return 1+t.patchiness*(2*e-1)}static valueNoise(n,o){const t=Math.floor(n),s=Math.floor(o),c=n-t,e=o-s,r=i=>i*i*(3-2*i),h=(i,g)=>{const v=Math.sin(i*127.1+g*311.7)*43758.5453;return v-Math.floor(v)},M=h(t,s)+(h(t+1,s)-h(t,s))*r(c),a=h(t,s+1)+(h(t+1,s+1)-h(t,s+1))*r(c);return M+(a-M)*r(e)}static samplesOf(n,o,t){const s=O.ecef({lat:o.lat,lng:o.lng,heightM:0}),c=o.lat*Math.PI/180,e=o.lng*Math.PI/180,r=u=>{const p=u[0]-s[0],A=u[1]-s[1],f=u[2]-s[2];return[-Math.sin(e)*p+Math.cos(e)*A,-Math.sin(c)*Math.cos(e)*p-Math.sin(c)*Math.sin(e)*A+Math.cos(c)*f,Math.cos(c)*Math.cos(e)*p+Math.cos(c)*Math.sin(e)*A+Math.sin(c)*f]},h=(n.divergenceMrad??l.DEFAULT_DIVERGENCE_MRAD)/1e3,M=n.apertureM??l.DEFAULT_APERTURE_M,a=[];let i=0,g=n.powerW,v=0;for(let u=0;u+1<n.path.length;u++){const p=n.path[u],A=n.path[u+1],f=O.ecef({lat:p.lat,lng:p.lng,heightM:p.altitudeM}),w=O.ecef({lat:A.lat,lng:A.lng,heightM:A.altitudeM}),d=Math.hypot(w[0]-f[0],w[1]-f[1],w[2]-f[2]),[C,S]=(()=>{const[E,R]=r(f),[N,T]=r(w);return[(N-E)/(d||1),(T-R)/(d||1)]})(),I=Math.max(1,Math.min(l.MAX_SAMPLES,Math.ceil(d/l.STEP_M)));for(let E=u===0?0:1;E<=I;E++){const R=E/I,N=[0,1,2].map(P=>f[P]+(w[P]-f[P])*R),T=R*d,x=p.altitudeM+(A.altitudeM-p.altitudeM)*R+l.bulgeM(T,d);if(E>0){const P=a[a.length-1],W=T+i-P.fromSourceM,H=l.extinctionAt(t,n.wavelengthNm,(P.altitudeM+x)/2);v+=H*W,g=n.powerW*Math.exp(-v)}const[U,F,G]=r(N);a.push({eastM:U,northM:F,upM:G,altitudeM:x,fromSourceM:i+T,dirEast:C,dirNorth:S,widthM:M+h*(i+T),powerW:g})}i+=d}return a}static bulgeM(n,o){return n*(o-n)/(2*6371e3)}static extinctionAt(n,o,t){const{rayleighPerM:s,aerosolPerM:c}=l.coefficientsAt(n,o,t);return s+c}static coefficientsAt(n,o,t){const s=D.rayleighAt(o)*D.rayleighDensity(t),c=n.aerosol[1]*(o/550)**-1.3*D.aerosolDensity(t);return{rayleighPerM:s,aerosolPerM:c}}static phasedScattering(n,o){const t=3/(16*Math.PI)*(1+o*o),s=l.AEROSOL_ASYMMETRY,c=(1-s*s)/(4*Math.PI*(1+s*s-2*s*o)**1.5);return n.rayleighPerM*t+n.aerosolPerM*l.AEROSOL_SINGLE_SCATTERING_ALBEDO*c}static efficacy(n){return 683*Math.max(0,y.colourMatching(n)[1])}static colourOf(n){const[o,t,s]=y.colourMatching(n);if(t<=0)return[0,0,0];const c=y.linearSrgbOf([o/t,1,s/t]).map(r=>Math.max(0,r)),e=.2126*c[0]+.7152*c[1]+.0722*c[2];return c.map(r=>r/e)}static luminanceCdM2(n,o,t,s,c){return l.efficacy(o)*n*t/(s*Math.max(c,.001))}}export{l as L};
1
+ import{t as O,b9 as D,ba as y}from"./ShareDialogElement-Dsc4v4jd.js";class l{static DEFAULT_DIVERGENCE_MRAD=.1;static DEFAULT_APERTURE_M=.01;static AEROSOL_SINGLE_SCATTERING_ALBEDO=.9;static AEROSOL_ASYMMETRY=.7;static DEFAULT_PATCHINESS=.35;static PATCH_M=120;static STEP_M=25;static MAX_SAMPLES=2e3;static viewsAt(n,o,t,s){return l.onAt(n,o).map(c=>l.viewOf(c,t,s))}static viewOf(n,o,t){return{id:n.id,wavelengthNm:n.wavelengthNm,patchiness:n.patchiness??l.DEFAULT_PATCHINESS,samples:l.samplesOf(n,o,t)}}static onAt(n,o){return n.filter(t=>(t.fromT===void 0||o>=t.fromT)&&(t.untilT===void 0||o<=t.untilT)).map(t=>l.stateAt(t,o)).filter(t=>t.path.length>=2)}static stateAt(n,o){if(!n.light?.length&&!n.moves?.length)return n;const t={...n};if(n.light?.length){const s=l.joined(n.light.filter(e=>e.wavelengthNm!==void 0),o,e=>e.wavelengthNm),c=l.joined(n.light.filter(e=>e.powerW!==void 0),o,e=>e.powerW);s!==void 0&&(t.wavelengthNm=s),c!==void 0&&(t.powerW=c)}return n.moves?.length&&(t.path=l.pathAt(n.moves,o)),t}static joined(n,o,t){if(n.length===0)return;const s=[...n].sort((a,i)=>a.t-i.t);if(o<=s[0].t)return t(s[0]);const c=s[s.length-1];if(o>=c.t)return t(c);const e=s.findIndex(a=>a.t>o),r=s[e-1],h=s[e],M=(o-r.t)/(h.t-r.t);return t(r)+(t(h)-t(r))*M}static pathAt(n,o){const t=[...n].sort((a,i)=>a.t-i.t);if(o<=t[0].t)return t[0].path;const s=t[t.length-1];if(o>=s.t)return s.path;const c=t.findIndex(a=>a.t>o),e=t[c-1],r=t[c];if(e.path.length!==r.path.length)return e.path;const h=(o-e.t)/(r.t-e.t),M=(a,i)=>a+(i-a)*h;return e.path.map((a,i)=>({lat:M(a.lat,r.path[i].lat),lng:M(a.lng,r.path[i].lng),altitudeM:M(a.altitudeM,r.path[i].altitudeM)}))}static patchAt(n,o,t){if(t.patchiness<=0)return 1;const s=o/1e3,c=(r,h)=>{const M=(n-t.windAlongMS*s)/r,a=(Math.abs(t.windAcrossMS)+.3)*s/r+h;return l.valueNoise(M,a)},e=(2*c(l.PATCH_M,0)+c(l.PATCH_M/3,17.3))/3;return 1+t.patchiness*(2*e-1)}static valueNoise(n,o){const t=Math.floor(n),s=Math.floor(o),c=n-t,e=o-s,r=i=>i*i*(3-2*i),h=(i,g)=>{const v=Math.sin(i*127.1+g*311.7)*43758.5453;return v-Math.floor(v)},M=h(t,s)+(h(t+1,s)-h(t,s))*r(c),a=h(t,s+1)+(h(t+1,s+1)-h(t,s+1))*r(c);return M+(a-M)*r(e)}static samplesOf(n,o,t){const s=O.ecef({lat:o.lat,lng:o.lng,heightM:0}),c=o.lat*Math.PI/180,e=o.lng*Math.PI/180,r=u=>{const p=u[0]-s[0],A=u[1]-s[1],f=u[2]-s[2];return[-Math.sin(e)*p+Math.cos(e)*A,-Math.sin(c)*Math.cos(e)*p-Math.sin(c)*Math.sin(e)*A+Math.cos(c)*f,Math.cos(c)*Math.cos(e)*p+Math.cos(c)*Math.sin(e)*A+Math.sin(c)*f]},h=(n.divergenceMrad??l.DEFAULT_DIVERGENCE_MRAD)/1e3,M=n.apertureM??l.DEFAULT_APERTURE_M,a=[];let i=0,g=n.powerW,v=0;for(let u=0;u+1<n.path.length;u++){const p=n.path[u],A=n.path[u+1],f=O.ecef({lat:p.lat,lng:p.lng,heightM:p.altitudeM}),w=O.ecef({lat:A.lat,lng:A.lng,heightM:A.altitudeM}),d=Math.hypot(w[0]-f[0],w[1]-f[1],w[2]-f[2]),[C,S]=(()=>{const[E,R]=r(f),[N,T]=r(w);return[(N-E)/(d||1),(T-R)/(d||1)]})(),I=Math.max(1,Math.min(l.MAX_SAMPLES,Math.ceil(d/l.STEP_M)));for(let E=u===0?0:1;E<=I;E++){const R=E/I,N=[0,1,2].map(P=>f[P]+(w[P]-f[P])*R),T=R*d,x=p.altitudeM+(A.altitudeM-p.altitudeM)*R+l.bulgeM(T,d);if(E>0){const P=a[a.length-1],W=T+i-P.fromSourceM,H=l.extinctionAt(t,n.wavelengthNm,(P.altitudeM+x)/2);v+=H*W,g=n.powerW*Math.exp(-v)}const[U,F,G]=r(N);a.push({eastM:U,northM:F,upM:G,altitudeM:x,fromSourceM:i+T,dirEast:C,dirNorth:S,widthM:M+h*(i+T),powerW:g})}i+=d}return a}static bulgeM(n,o){return n*(o-n)/(2*6371e3)}static extinctionAt(n,o,t){const{rayleighPerM:s,aerosolPerM:c}=l.coefficientsAt(n,o,t);return s+c}static coefficientsAt(n,o,t){const s=D.rayleighAt(o)*D.rayleighDensity(t),c=n.aerosol[1]*(o/550)**-1.3*D.aerosolDensity(t);return{rayleighPerM:s,aerosolPerM:c}}static phasedScattering(n,o){const t=3/(16*Math.PI)*(1+o*o),s=l.AEROSOL_ASYMMETRY,c=(1-s*s)/(4*Math.PI*(1+s*s-2*s*o)**1.5);return n.rayleighPerM*t+n.aerosolPerM*l.AEROSOL_SINGLE_SCATTERING_ALBEDO*c}static efficacy(n){return 683*Math.max(0,y.colourMatching(n)[1])}static colourOf(n){const[o,t,s]=y.colourMatching(n);if(t<=0)return[0,0,0];const c=y.linearSrgbOf([o/t,1,s/t]).map(r=>Math.max(0,r)),e=.2126*c[0]+.7152*c[1]+.0722*c[2];return c.map(r=>r/e)}static luminanceCdM2(n,o,t,s,c){return l.efficacy(o)*n*t/(s*Math.max(c,.001))}}export{l as L};