@rr0/ufoathome 0.172.0 → 0.174.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist-embed-scene/{AdsbLolArchiveProvider-CmrPztlQ.js → AdsbLolArchiveProvider-liG2xlWV.js} +1 -1
  2. package/dist-embed-scene/{BeamEditor-moWuVLT-.js → BeamEditor-DRrVChwI.js} +1 -1
  3. package/dist-embed-scene/{BeamSystem-DXTXXbc7.js → BeamSystem-CEzXZFNu.js} +1 -1
  4. package/dist-embed-scene/{ContrailSystem-CcDlnjiD.js → ContrailSystem-BSbI2jUe.js} +1 -1
  5. package/dist-embed-scene/{Flightradar24Provider-6Yk43zPK.js → Flightradar24Provider-BkhQ2iqB.js} +1 -1
  6. package/dist-embed-scene/GLTFLoader-UnRP5t__.js +1 -0
  7. package/dist-embed-scene/{HeadlightSystem-B0Ubhwxs.js → HeadlightSystem-Dvc4Rbz-.js} +1 -1
  8. package/dist-embed-scene/{LanternEditor-4v_UpY6t.js → LanternEditor-DCP-Wz-Q.js} +1 -1
  9. package/dist-embed-scene/{LaserBeam-DJnJ5Okd.js → LaserBeam-DfUrxrC_.js} +1 -1
  10. package/dist-embed-scene/{LaunchEditor-DKZ1U9ZU.js → LaunchEditor-DzToEZHF.js} +1 -1
  11. package/dist-embed-scene/{LaunchPlume-DwOSrKP_.js → LaunchPlume-D7l6FeNX.js} +1 -1
  12. package/dist-embed-scene/{LaunchSimulation-ClGdZJHr.js → LaunchSimulation-DKpm2Xqs.js} +1 -1
  13. package/dist-embed-scene/{ModuleSession-BGQH5SEC.js → ModuleSession-VVjH7nnr.js} +2 -2
  14. package/dist-embed-scene/ModuleThree-5mmzRPs2.js +1 -0
  15. package/dist-embed-scene/ParameterForm-BDYo2bPV.js +94 -0
  16. package/dist-embed-scene/{ReentryEditor-Rr_H4UZf.js → ReentryEditor-Dk_CUVvM.js} +1 -1
  17. package/dist-embed-scene/{ReentrySimulation-CrhMgBEf.js → ReentrySimulation-D-FR761p.js} +1 -1
  18. package/dist-embed-scene/ReferenceSystem-BUj-6A76.js +1 -0
  19. package/dist-embed-scene/{SceneNames_en-BL9uncGh.js → SceneNames_en-DGqvOiKr.js} +1 -1
  20. package/dist-embed-scene/{SceneNames_es-CH-eXo8N.js → SceneNames_es-CjXqPgH3.js} +1 -1
  21. package/dist-embed-scene/{SceneNames_fr-DcyxwufJ.js → SceneNames_fr-BJqNnvOr.js} +1 -1
  22. package/dist-embed-scene/{SceneNames_it-DT3v8j9C.js → SceneNames_it-BYKERxdw.js} +1 -1
  23. package/{dist-embed-sighting/TimelineTracks-Cuz5LKXi.js → dist-embed-scene/TimelineTracks-BPVmDKpc.js} +1 -1
  24. package/dist-embed-scene/{TraceSystem-D7pxye9d.js → TraceSystem-gVZk_ffU.js} +1 -1
  25. package/dist-embed-scene/{UfoMessages_en-DiW_p05E.js → UfoMessages_en-wpJoNj_d.js} +1 -1
  26. package/dist-embed-scene/rr0-scene.mjs +299 -279
  27. package/dist-embed-scene/sightingSchema-DZXw4x_Q.js +1 -0
  28. package/dist-embed-scene/trafficRuntime-BgM4IVmy.js +2 -0
  29. package/dist-embed-sighting/{AdsbLolArchiveProvider-B7vb8UEW.js → AdsbLolArchiveProvider-CkHzWGQi.js} +1 -1
  30. package/dist-embed-sighting/BallesterGuaspAssessor-C3AZoSYJ.js +1 -0
  31. package/dist-embed-sighting/{BeamEditor-EW6OYCVG.js → BeamEditor-BJNdmRuT.js} +1 -1
  32. package/dist-embed-sighting/{BeamSystem-Bm8JAQ9L.js → BeamSystem-K3DiM1GA.js} +1 -1
  33. package/dist-embed-sighting/{ContrailSystem-Bgre4cLs.js → ContrailSystem-CRHKaUK-.js} +1 -1
  34. package/dist-embed-sighting/CoverageAssessor-BSoRnjHD.js +1 -0
  35. package/dist-embed-sighting/{Flightradar24Provider-DD9gPyCn.js → Flightradar24Provider--mgNvbo7.js} +1 -1
  36. package/dist-embed-sighting/{GLTFLoader-BWnr870a.js → GLTFLoader-NORF7Wya.js} +1 -1
  37. package/dist-embed-sighting/{HeadlightSystem-CmppP6Mm.js → HeadlightSystem-BrccF2M7.js} +1 -1
  38. package/dist-embed-sighting/{HynekAssessor-tNpli5GC.js → HynekAssessor-BNn-J5RL.js} +1 -1
  39. package/dist-embed-sighting/{LanternEditor-BDrPaoos.js → LanternEditor-v7J6meRk.js} +1 -1
  40. package/dist-embed-sighting/{LaserBeam-Dfjpv2LA.js → LaserBeam-CrsVNYnr.js} +1 -1
  41. package/dist-embed-sighting/{LaunchEditor-Dm5CIbfP.js → LaunchEditor-BQKUng5i.js} +2 -2
  42. package/dist-embed-sighting/{LaunchPlume-DH8ZMXrj.js → LaunchPlume-zs7QuS9V.js} +1 -1
  43. package/dist-embed-sighting/{LaunchSimulation-3m1LUs2t.js → LaunchSimulation-Vj5v57hz.js} +1 -1
  44. package/dist-embed-sighting/{ModuleSession-Bg99aje_.js → ModuleSession-BgHWPEDv.js} +2 -2
  45. package/dist-embed-sighting/ModuleThree-cSwqALyP.js +1 -0
  46. package/dist-embed-sighting/{NearestApproach-hO2JFAfU.js → NearestApproach-Dm99M0L8.js} +1 -1
  47. package/dist-embed-sighting/ParameterForm-BEtRCdpW.js +94 -0
  48. package/dist-embed-sighting/{PoherAssessor-CxcKyCRu.js → PoherAssessor-BUqWHdc2.js} +1 -1
  49. package/dist-embed-sighting/{RailwaySystem-C920HhY6.js → RailwaySystem-Bb0sdKJq.js} +1 -1
  50. package/dist-embed-sighting/ReadingCheckTexts_en-eq6teExJ.js +1 -0
  51. package/dist-embed-sighting/ReadingCheckTexts_es-CR_JJZMV.js +1 -0
  52. package/dist-embed-sighting/ReadingCheckTexts_fr-pcDleIvY.js +1 -0
  53. package/dist-embed-sighting/ReadingCheckTexts_it-MFKeoXnq.js +1 -0
  54. package/dist-embed-sighting/{ReentryEditor-iXEKSCu_.js → ReentryEditor-CMnCxTU4.js} +2 -2
  55. package/dist-embed-sighting/ReentrySimulation-B7bV2GTy.js +1 -0
  56. package/dist-embed-sighting/{ReferenceSystem-DJUjnjNZ.js → ReferenceSystem-s-ggwBEd.js} +1 -1
  57. package/dist-embed-sighting/{RoadMarkings-DDNrriGo.js → RoadMarkings-DiBAmqci.js} +1 -1
  58. package/dist-embed-sighting/{SceneNames_en-BCismFgW.js → SceneNames_en-Cy3_acfm.js} +1 -1
  59. package/dist-embed-sighting/{SceneNames_es-u83jdbyr.js → SceneNames_es-VxS6QttN.js} +1 -1
  60. package/dist-embed-sighting/{SceneNames_fr-hA9CGBs-.js → SceneNames_fr-Dg8Zgkb7.js} +1 -1
  61. package/dist-embed-sighting/{SceneNames_it-Bp7twqSK.js → SceneNames_it-Cf-I4HxZ.js} +1 -1
  62. package/dist-embed-sighting/{SightingMessages_en-BcD8zikg.js → SightingMessages_en-BjIUyT4W.js} +1 -1
  63. package/dist-embed-sighting/{SightingMessages_es-MrTWzprC.js → SightingMessages_es-TueslN1u.js} +1 -1
  64. package/dist-embed-sighting/{SightingMessages_fr-CPZ7UIEm.js → SightingMessages_fr-Dfp6mAcU.js} +1 -1
  65. package/dist-embed-sighting/{SightingMessages_it-0JPA_6O9.js → SightingMessages_it-C0VvJY01.js} +1 -1
  66. package/{dist-embed-scene/TimelineTracks-DcYnMVi8.js → dist-embed-sighting/TimelineTracks-D_Oedo7x.js} +1 -1
  67. package/dist-embed-sighting/{TraceSystem-BrpqiAAJ.js → TraceSystem-DW2kF0O_.js} +1 -1
  68. package/dist-embed-sighting/{WaterSystem-D3andNtL.js → WaterSystem-B1eVrX5D.js} +1 -1
  69. package/dist-embed-sighting/rr0-sighting.mjs +3744 -3724
  70. package/dist-embed-sighting/sightingSchema-DZXw4x_Q.js +1 -0
  71. package/dist-embed-sighting/trafficRuntime-D2QZwJQQ.js +2 -0
  72. package/dist-embed-sighting-editor/{AdsbLolArchiveProvider-DS9ev-HU.js → AdsbLolArchiveProvider-CpaPx7Px.js} +1 -1
  73. package/dist-embed-sighting-editor/BallesterGuaspAssessor-BIHqYTXC.js +1 -0
  74. package/dist-embed-sighting-editor/{BeamEditor-DQp2vKdn.js → BeamEditor-8NrnezeZ.js} +1 -1
  75. package/dist-embed-sighting-editor/{BeamSystem-Dd5G0PNW.js → BeamSystem-CaxJaT_y.js} +1 -1
  76. package/dist-embed-sighting-editor/{BodyEditor-CamqX5Xg.js → BodyEditor-Cj7TgjV-.js} +2 -2
  77. package/dist-embed-sighting-editor/{ContrailSystem-DYAYamnm.js → ContrailSystem-CTAB7sqQ.js} +1 -1
  78. package/dist-embed-sighting-editor/CoverageAssessor-CHa6U2A7.js +1 -0
  79. package/dist-embed-sighting-editor/Flightradar24Provider-DAS99x3c.js +1 -0
  80. package/dist-embed-sighting-editor/{GLTFLoader-DQ9JYWIM.js → GLTFLoader-BLpME7vC.js} +1 -1
  81. package/dist-embed-sighting-editor/GeoExportTexts-DAllttgw.js +1 -0
  82. package/dist-embed-sighting-editor/GeoExportTexts_en-Dq0fSJQp.js +1 -0
  83. package/dist-embed-sighting-editor/GeoExportTexts_es-CoVHdOo0.js +1 -0
  84. package/dist-embed-sighting-editor/GeoExportTexts_fr-DVAMpZIR.js +1 -0
  85. package/dist-embed-sighting-editor/GeoExportTexts_it-Bh1uJBQp.js +1 -0
  86. package/dist-embed-sighting-editor/GeoJsonExport-3snOe-2J.js +2 -0
  87. package/dist-embed-sighting-editor/GeoJsonImport-CIftC0ws.js +1 -0
  88. package/dist-embed-sighting-editor/GeographicFigures-CLBS2HJ-.js +1 -0
  89. package/dist-embed-sighting-editor/{HeadlightSystem-FfcayJJX.js → HeadlightSystem-Crmc9zbw.js} +1 -1
  90. package/dist-embed-sighting-editor/{HynekAssessor-CI7wuMYw.js → HynekAssessor-D_UJjt62.js} +1 -1
  91. package/dist-embed-sighting-editor/{InterviewEditorElement-Bwn4BIQi.js → InterviewEditorElement-DtBxBtVw.js} +2 -2
  92. package/dist-embed-sighting-editor/KmlExport-B0SKgn4U.js +19 -0
  93. package/dist-embed-sighting-editor/{LanternEditor-DT2LvlBk.js → LanternEditor-DWIefcSu.js} +1 -1
  94. package/dist-embed-sighting-editor/{LaserBeam-DCfAd_IK.js → LaserBeam-C_5uHg0U.js} +1 -1
  95. package/dist-embed-sighting-editor/{LaunchEditor-hAMtWhby.js → LaunchEditor-ByC2Emjf.js} +1 -1
  96. package/dist-embed-sighting-editor/{LaunchPlume-B1QcGtTl.js → LaunchPlume-CpAzgYlA.js} +1 -1
  97. package/dist-embed-sighting-editor/{LaunchSimulation-Bl72jnqq.js → LaunchSimulation-D4CHeSnk.js} +1 -1
  98. package/dist-embed-sighting-editor/{ModelSource-CE5kDeLL.js → ModelSource-UJizu116.js} +1 -1
  99. package/dist-embed-sighting-editor/{ModelThumbnails-cuvgO3ks.js → ModelThumbnails-C6MY31ux.js} +1 -1
  100. package/dist-embed-sighting-editor/{ModelViewer-DjGC6fMB.js → ModelViewer-vYoh4mVh.js} +1 -1
  101. package/dist-embed-sighting-editor/{ModuleConformance-H7LbISvs.js → ModuleConformance-D6VFY6JB.js} +2 -2
  102. package/dist-embed-sighting-editor/{ModuleSession-BXk5ijvF.js → ModuleSession-Dsi0JKlc.js} +2 -2
  103. package/dist-embed-sighting-editor/ModuleThree-HknjibVQ.js +1 -0
  104. package/dist-embed-sighting-editor/{ModulesPanelElement-B1KHXTpq.js → ModulesPanelElement-CeEA058j.js} +3 -3
  105. package/dist-embed-sighting-editor/NearestApproach-B8jOOhQy.js +1 -0
  106. package/dist-embed-sighting-editor/{PoherAssessor-YeV1i0Lw.js → PoherAssessor-COIGIPYG.js} +1 -1
  107. package/dist-embed-sighting-editor/{RailwaySystem-CuqGInI5.js → RailwaySystem-DPEyve9f.js} +1 -1
  108. package/dist-embed-sighting-editor/ReadingCheckTexts_en-eq6teExJ.js +1 -0
  109. package/dist-embed-sighting-editor/ReadingCheckTexts_es-CR_JJZMV.js +1 -0
  110. package/dist-embed-sighting-editor/ReadingCheckTexts_fr-pcDleIvY.js +1 -0
  111. package/dist-embed-sighting-editor/ReadingCheckTexts_it-MFKeoXnq.js +1 -0
  112. package/dist-embed-sighting-editor/{ReentryEditor-Bt90y2I7.js → ReentryEditor-pBwTz0Zh.js} +2 -2
  113. package/dist-embed-sighting-editor/{ReentrySimulation-DS7Q5nso.js → ReentrySimulation-Dfg-6_Da.js} +1 -1
  114. package/dist-embed-sighting-editor/{ReferenceSystem-D-bNZI8e.js → ReferenceSystem-CGC3BqZJ.js} +1 -1
  115. package/dist-embed-sighting-editor/{RoadMarkings-GIdi730L.js → RoadMarkings-Cr-sSvIY.js} +1 -1
  116. package/dist-embed-sighting-editor/{SceneNames_en-DNhr4wdu.js → SceneNames_en-DggkchR4.js} +1 -1
  117. package/dist-embed-sighting-editor/{SceneNames_es-DP1RW7Iw.js → SceneNames_es-BtXXqtTk.js} +1 -1
  118. package/dist-embed-sighting-editor/{SceneNames_fr-mGHb5j1M.js → SceneNames_fr-I6FOP0oQ.js} +1 -1
  119. package/dist-embed-sighting-editor/{SceneNames_it-fxUdb_jZ.js → SceneNames_it-DrW4eXBX.js} +1 -1
  120. package/dist-embed-sighting-editor/SightingEditorMessages_en-G8-sD56V.js +12 -0
  121. package/dist-embed-sighting-editor/SightingEditorMessages_es-DEmsmIRU.js +12 -0
  122. package/dist-embed-sighting-editor/SightingEditorMessages_fr-D2HXab_N.js +12 -0
  123. package/dist-embed-sighting-editor/SightingEditorMessages_it-LpFdlGY5.js +12 -0
  124. package/dist-embed-sighting-editor/{SightingFileEditor-CXaZ0zyV.js → SightingFileEditor-BymOujPF.js} +1 -1
  125. package/dist-embed-sighting-editor/TraceImport-CL8lefw6.js +2 -0
  126. package/dist-embed-sighting-editor/{TraceSystem-CUMKKQY4.js → TraceSystem-BAZq4Mcs.js} +2 -2
  127. package/dist-embed-sighting-editor/{UfoMessages_en-DVlS5Elx.js → UfoMessages_en-BxhQNf5z.js} +1 -1
  128. package/dist-embed-sighting-editor/{WaterSystem-BBrkl1Y3.js → WaterSystem-1Sp5frNp.js} +1 -1
  129. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +5267 -5235
  130. package/dist-embed-sighting-editor/sightingSchema-CUVU5eOl.js +1 -0
  131. package/dist-embed-sighting-editor/trafficRuntime-C9bT5cO9.js +2 -0
  132. package/package.json +1 -1
  133. package/dist-embed-scene/GLTFLoader-BYBOfwYv.js +0 -1
  134. package/dist-embed-scene/ModuleThree-4waMG8o7.js +0 -1
  135. package/dist-embed-scene/ParameterForm-DTX-QXNh.js +0 -85
  136. package/dist-embed-scene/ReferenceSystem-B8i0qbr6.js +0 -1
  137. package/dist-embed-scene/sightingSchema-9ZtPvUrR.js +0 -1
  138. package/dist-embed-scene/trafficRuntime-cS8H9PlA.js +0 -2
  139. package/dist-embed-sighting/BallesterGuaspAssessor-VMcyGlQb.js +0 -1
  140. package/dist-embed-sighting/CoverageAssessor-C7k3p3iN.js +0 -1
  141. package/dist-embed-sighting/ModuleThree-DTr6m1tj.js +0 -1
  142. package/dist-embed-sighting/ParameterForm-CbQHBPju.js +0 -85
  143. package/dist-embed-sighting/ReadingCheckTexts_en-DMSQIyl-.js +0 -1
  144. package/dist-embed-sighting/ReadingCheckTexts_es-U0mwsu1B.js +0 -1
  145. package/dist-embed-sighting/ReadingCheckTexts_fr-BGsdUnRK.js +0 -1
  146. package/dist-embed-sighting/ReadingCheckTexts_it-BGVlr3JP.js +0 -1
  147. package/dist-embed-sighting/ReentrySimulation-BfkUcIGM.js +0 -1
  148. package/dist-embed-sighting/sightingSchema-9ZtPvUrR.js +0 -1
  149. package/dist-embed-sighting/trafficRuntime-BKg4PEmv.js +0 -2
  150. package/dist-embed-sighting-editor/BallesterGuaspAssessor-Baptv_sO.js +0 -1
  151. package/dist-embed-sighting-editor/CoverageAssessor-C9c1Isxw.js +0 -1
  152. package/dist-embed-sighting-editor/Flightradar24Provider-VG9pYq17.js +0 -1
  153. package/dist-embed-sighting-editor/ModuleThree-DsbRgMxg.js +0 -1
  154. package/dist-embed-sighting-editor/NearestApproach-Bw4UBKQD.js +0 -1
  155. package/dist-embed-sighting-editor/ReadingCheckTexts_en-DMSQIyl-.js +0 -1
  156. package/dist-embed-sighting-editor/ReadingCheckTexts_es-U0mwsu1B.js +0 -1
  157. package/dist-embed-sighting-editor/ReadingCheckTexts_fr-BGsdUnRK.js +0 -1
  158. package/dist-embed-sighting-editor/ReadingCheckTexts_it-BGVlr3JP.js +0 -1
  159. package/dist-embed-sighting-editor/SightingEditorMessages_en-B1i2vZCG.js +0 -12
  160. package/dist-embed-sighting-editor/SightingEditorMessages_es-DLhzlNDm.js +0 -12
  161. package/dist-embed-sighting-editor/SightingEditorMessages_fr-B5jPMP9L.js +0 -12
  162. package/dist-embed-sighting-editor/SightingEditorMessages_it-BJwvaU7I.js +0 -12
  163. package/dist-embed-sighting-editor/sightingSchema-9ZtPvUrR.js +0 -1
  164. package/dist-embed-sighting-editor/trafficRuntime-CBsyESZY.js +0 -2
@@ -1 +0,0 @@
1
- import{aa as Le,ab as Q,ac as he,ad as Me,ae as v,af as de,c as w,V as pe,C as F,ag as N,Y as U,K as Se,ah as ye,ai as we,v as K,aj as Ne,o as C,Q as me,ak as be,a3 as ge,al as Ie,am as Oe,h as V,an as Ce,ao as Te,ap as Fe,aq as Pe,ar as He,Z as J,as as Re,at as Z,au as ke,av as De,P as Ge,aw as X,ax as ve,e as Ee,J as Ue,H as G,ay as Ke,B as Be,az as je,d as Ve,aA as Xe,aB as ze,aC as qe,x as We,G as z,aD as Ye,w as Qe,aE as Je,aF as Ze,aG as $e,aH as en,aI as nn,aJ as tn,aK as xe,k as sn,$ as ne,aL as te,aM as se,aN as ie,aO as re,aP as rn,aQ as on,m as an,n as cn}from"./rr0-scene.mjs";function oe(f,n){if(n===Le)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(n===Q||n===he){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const s=e.count-2,t=[];if(n===Q)for(let r=1;r<=s;r++)t.push(e.getX(0)),t.push(e.getX(r)),t.push(e.getX(r+1));else for(let r=0;r<s;r++)r%2===0?(t.push(e.getX(r)),t.push(e.getX(r+1)),t.push(e.getX(r+2))):(t.push(e.getX(r+2)),t.push(e.getX(r+1)),t.push(e.getX(r)));t.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=f.clone();return i.setIndex(t),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",n),f}class jn extends Me{constructor(n){super(n),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new dn(e)}),this.register(function(e){return new pn(e)}),this.register(function(e){return new Ln(e)}),this.register(function(e){return new Mn(e)}),this.register(function(e){return new Sn(e)}),this.register(function(e){return new gn(e)}),this.register(function(e){return new Tn(e)}),this.register(function(e){return new Rn(e)}),this.register(function(e){return new En(e)}),this.register(function(e){return new hn(e)}),this.register(function(e){return new xn(e)}),this.register(function(e){return new mn(e)}),this.register(function(e){return new _n(e)}),this.register(function(e){return new An(e)}),this.register(function(e){return new ln(e)}),this.register(function(e){return new ae(e,g.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ae(e,g.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new yn(e)})}load(n,e,s,t){const i=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=v.extractUrlBase(n);r=v.resolveURL(c,this.path)}else r=v.extractUrlBase(n);this.manager.itemStart(n);const a=function(c){t?t(c):console.error(c),i.manager.itemError(n),i.manager.itemEnd(n)},o=new de(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(n,function(c){try{i.parse(c,r,function(u){e(u),i.manager.itemEnd(n)},a)}catch(u){a(u)}},s,a)}setDRACOLoader(n){return this.dracoLoader=n,this}setKTX2Loader(n){return this.ktx2Loader=n,this}setMeshoptDecoder(n){return this.meshoptDecoder=n,this}register(n){return this.pluginCallbacks.indexOf(n)===-1&&this.pluginCallbacks.push(n),this}unregister(n){return this.pluginCallbacks.indexOf(n)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(n),1),this}parse(n,e,s,t){let i;const r={},a={},o=new TextDecoder;if(typeof n=="string")i=JSON.parse(n);else if(n instanceof ArrayBuffer)if(o.decode(new Uint8Array(n,0,4))===Ae){try{r[g.KHR_BINARY_GLTF]=new wn(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 Nn(i,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:r[l]=new bn;break;case g.KHR_MESH_QUANTIZATION:r[l]=new In;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(s,t)}parseAsync(n,e){const s=this;return new Promise(function(t,i){s.parse(n,e,t,i)})}}function un(){let f={};return{get:function(n){return f[n]},add:function(n,e){f[n]=e},remove:function(n){delete f[n]},removeAll:function(){f={}}}}function _(f,n,e){const s=f.json.materials[n];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ln{constructor(n){this.parser=n,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const n=this.parser,e=this.parser.json.nodes||[];for(let s=0,t=e.length;s<t;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&n._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(n){const e=this.parser,s="light:"+n;let t=e.cache.get(s);if(t)return t;const i=e.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[n];let c;const u=new F(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],N);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new we(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],N),n.opacity=r[3]}i.baseColorTexture!==void 0&&t.push(s.assignTexture(n,"map",i.baseColorTexture,U))}return Promise.all(t)}}class hn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||s.emissiveStrength!==void 0&&(e.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class dn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(t.push(this.parser.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new pe(i,i)}return Promise.all(t)}}class pn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_DISPERSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class mn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(e.iridescenceIOR=s.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(t)}}class gn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];if(e.sheenColor=new F(0,0,0),e.sheenRoughness=0,e.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;e.sheenColor.setRGB(i[0],i[1],i[2],N)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenColorMap",s.sheenColorTexture,U)),s.sheenRoughnessTexture!==void 0&&t.push(this.parser.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(t)}}class Tn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&t.push(this.parser.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(t)}}class Rn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&t.push(this.parser.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return e.attenuationColor=new F().setRGB(i[0],i[1],i[2],N),Promise.all(t)}}class En{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_IOR}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);return s===null||(e.ior=s.ior!==void 0?s.ior:1.5,e.ior===0&&(e.ior=1e3)),Promise.resolve()}}class xn{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return e.specularColor=new F().setRGB(i[0],i[1],i[2],N),s.specularColorTexture!==void 0&&t.push(this.parser.assignTexture(e,"specularColorMap",s.specularColorTexture,U)),Promise.all(t)}}class An{constructor(n){this.parser=n,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&t.push(this.parser.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(t)}}class _n{constructor(n){this.parser=n,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(n){return _(this.parser,n,this.name)!==null?w:null}extendMaterialParams(n,e){const s=_(this.parser,n,this.name);if(s===null)return Promise.resolve();const t=[];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&t.push(this.parser.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(t)}}class Ln{constructor(n){this.parser=n,this.name=g.KHR_TEXTURE_BASISU}loadTexture(n){const e=this.parser,s=e.json,t=s.textures[n];if(!t.extensions||!t.extensions[this.name])return null;const i=t.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(n,i.source,r)}}class Mn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_WEBP}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class Sn{constructor(n){this.parser=n,this.name=g.EXT_TEXTURE_AVIF}loadTexture(n){const e=this.name,s=this.parser,t=s.json,i=t.textures[n];if(!i.extensions||!i.extensions[e])return null;const r=i.extensions[e],a=t.images[r.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(n,r.source,o)}}class ae{constructor(n,e){this.name=e,this.parser=n}loadBufferView(n){const e=this.parser.json,s=e.bufferViews[n];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const o=t.byteOffset||0,c=t.byteLength||0,u=t.count,l=t.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,t.mode,t.filter).then(function(d){return d.buffer}):r.ready.then(function(){const d=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(d),u,l,h,t.mode,t.filter),d})})}else return null}}class yn{constructor(n){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=n}createNodeMesh(n){const e=this.parser.json,s=e.nodes[n];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const t=e.meshes[s.mesh];for(const c of t.primitives)if(c.mode!==M.TRIANGLES&&c.mode!==M.TRIANGLE_STRIP&&c.mode!==M.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=s.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(n)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,d=[];for(const p of l){const R=new K,m=new C,T=new me,A=new C(1,1,1),x=new Ne(p.geometry,p.material,h);for(let E=0;E<h;E++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,E),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,E),o.SCALE&&A.fromBufferAttribute(o.SCALE,E),x.setMatrixAt(E,R.compose(m,T,A));for(const E in o)if(E==="_COLOR_0"){const L=o[E];x.instanceColor=new be(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&p.geometry.setAttribute(E,o[E]);ge.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),d.push(x)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const Ae="glTF",D=12,ce={JSON:1313821514,BIN:5130562};class wn{constructor(n){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(n,0,D),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(n.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ae)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const t=this.header.length-D,i=new DataView(n,D);let r=0;for(;r<t;){const a=i.getUint32(r,!0);r+=4;const o=i.getUint32(r,!0);if(r+=4,o===ce.JSON){const c=new Uint8Array(n,D+r,a);this.content=s.decode(c)}else if(o===ce.BIN){const c=D+r;this.body=n.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Nn{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,N,h)})})}}class bn{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(n,e){return(e.texCoord===void 0||e.texCoord===n.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(n=n.clone(),e.texCoord!==void 0&&(n.channel=e.texCoord),e.offset!==void 0&&n.offset.fromArray(e.offset),e.rotation!==void 0&&(n.rotation=e.rotation),e.scale!==void 0&&n.repeat.fromArray(e.scale),n.needsUpdate=!0),n}}class In{constructor(){this.name=g.KHR_MESH_QUANTIZATION}}class _e extends on{constructor(n,e,s,t){super(n,e,s,t)}copySampleValue_(n){const e=this.resultBuffer,s=this.sampleValues,t=this.valueSize,i=n*t*3+t;for(let r=0;r!==t;r++)e[r]=s[i+r];return e}interpolate_(n,e,s,t){const i=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=t-e,l=(s-e)/u,h=l*l,d=h*l,p=n*c,R=p-c,m=-2*d+3*h,T=d-h,A=1-m,x=T-h+l;for(let E=0;E!==a;E++){const L=r[R+E+a],b=r[R+E+o]*u,S=r[p+E+a],k=r[p+E]*u;i[E]=A*L+x*b+m*S+T*k}return i}}const On=new me;class Cn extends _e{interpolate_(n,e,s,t){const i=super.interpolate_(n,e,s,t);return On.fromArray(i).normalize().toArray(i),i}}const M={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:Re,9729:J,9984:He,9985:Pe,9986:Fe,9987:Te},le={33071:De,33648:ke,10497:Z},q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Fn={CUBICSPLINE:void 0,LINEAR:xe,STEP:tn},W={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Pn(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new Ee({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:rn})),f.DefaultMaterial}function O(f,n,e){for(const s in e.extensions)f[s]===void 0&&(n.userData.gltfExtensions=n.userData.gltfExtensions||{},n.userData.gltfExtensions[s]=e.extensions[s])}function y(f,n){n.extras!==void 0&&(typeof n.extras=="object"?Object.assign(f.userData,n.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+n.extras))}function Hn(f,n,e){let s=!1,t=!1,i=!1;for(let c=0,u=n.length;c<u;c++){const l=n[c];if(l.POSITION!==void 0&&(s=!0),l.NORMAL!==void 0&&(t=!0),l.COLOR_0!==void 0&&(i=!0),s&&t&&i)break}if(!s&&!t&&!i)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=n.length;c<u;c++){const l=n[c];if(s){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(t){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(i){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return s&&(f.morphAttributes.position=u),t&&(f.morphAttributes.normal=l),i&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function kn(f,n){if(f.updateMorphTargets(),n.weights!==void 0)for(let e=0,s=n.weights.length;e<s;e++)f.morphTargetInfluences[e]=n.weights[e];if(n.extras&&Array.isArray(n.extras.targetNames)){const e=n.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let s=0,t=e.length;s<t;s++)f.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Dn(f){let n;const e=f.extensions&&f.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?n="draco:"+e.bufferView+":"+e.indices+":"+Y(e.attributes):n=f.indices+":"+Y(f.attributes)+":"+f.mode,f.targets!==void 0)for(let s=0,t=f.targets.length;s<t;s++)n+=":"+Y(f.targets[s]);return n}function Y(f){let n="";const e=Object.keys(f).sort();for(let s=0,t=e.length;s<t;s++)n+=e[s]+":"+f[e[s]]+";";return n}function ee(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Gn(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vn=new K;class Un{constructor(n={},e={}){this.json=n,this.extensions={},this.plugins={},this.options=e,this.cache=new un,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,t=-1,i=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);t=s&&o?parseInt(o[1],10):-1,i=a.indexOf("Firefox")>-1,r=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&t<17||i&&r<98?this.textureLoader=new Ie(this.options.manager):this.textureLoader=new Oe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new de(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(n){this.extensions=n}setPlugins(n){this.plugins=n}parse(n,e){const s=this,t=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(r){const a={scene:r[0][t.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:t.asset,parser:s,userData:{}};return O(i,a,t),y(a,t),Promise.all(s._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();n(a)})}).catch(e)}_markDefs(){const n=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let t=0,i=e.length;t<i;t++){const r=e[t].joints;for(let a=0,o=r.length;a<o;a++)n[r[a]].isBone=!0}for(let t=0,i=n.length;t<i;t++){const r=n[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(s[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(n,e){e!==void 0&&(n.refs[e]===void 0&&(n.refs[e]=n.uses[e]=0),n.refs[e]++)}_getNodeRef(n,e,s){if(n.refs[e]<=1)return s;const t=s.clone(),i=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())i(u,a.children[c])};return i(s,t),t.name+="_instance_"+n.uses[e]++,t}_invokeOne(n){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const t=n(e[s]);if(t)return t}return null}_invokeAll(n){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let t=0;t<e.length;t++){const i=n(e[t]);i&&s.push(i)}return s}getDependency(n,e){const s=n+":"+e;let t=this.cache.get(s);if(!t){switch(n){case"scene":t=this.loadScene(e);break;case"node":t=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":t=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":t=this.loadAccessor(e);break;case"bufferView":t=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":t=this.loadBuffer(e);break;case"material":t=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":t=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":t=this.loadSkin(e);break;case"animation":t=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":t=this.loadCamera(e);break;default:if(t=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(n,e)}),!t)throw new Error("Unknown type: "+n);break}this.cache.add(s,t)}return t}getDependencies(n){let e=this.cache.get(n);if(!e){const s=this,t=this.json[n+(n==="mesh"?"es":"s")]||[];e=Promise.all(t.map(function(i,r){return s.getDependency(n,r)})),this.cache.add(n,e)}return e}loadBuffer(n){const e=this.json.buffers[n],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&n===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);const t=this.options;return new Promise(function(i,r){s.load(v.resolveURL(e.uri,t.path),i,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(n){const e=this.json.bufferViews[n];return this.getDependency("buffer",e.buffer).then(function(s){const t=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+t)})}loadAccessor(n){const e=this,s=this.json,t=this.json.accessors[n];if(t.bufferView===void 0&&t.sparse===void 0){const r=q[t.type],a=H[t.componentType],o=t.normalized===!0,c=new a(t.count*r);return Promise.resolve(new V(c,r,o))}const i=[];return t.bufferView!==void 0?i.push(this.getDependency("bufferView",t.bufferView)):i.push(null),t.sparse!==void 0&&(i.push(this.getDependency("bufferView",t.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",t.sparse.values.bufferView))),Promise.all(i).then(function(r){const a=r[0],o=q[t.type],c=H[t.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=t.byteOffset||0,d=t.bufferView!==void 0?s.bufferViews[t.bufferView].byteStride:void 0,p=t.normalized===!0;let R,m;if(d&&d!==l){const T=Math.floor(h/d),A="InterleavedBuffer:"+t.bufferView+":"+t.componentType+":"+T+":"+t.count;let x=e.cache.get(A);x||(R=new c(a,T*d,t.count*d/u),x=new Ce(R,d/u),e.cache.add(A,x)),m=new sn(x,o,h%d/u,p)}else a===null?R=new c(t.count*o):R=new c(a,h,t.count*o),m=new V(R,o,p);if(t.sparse!==void 0){const T=q.SCALAR,A=H[t.sparse.indices.componentType],x=t.sparse.indices.byteOffset||0,E=t.sparse.values.byteOffset||0,L=new A(r[1],x,t.sparse.count*T),b=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,b[S*o]),o>=2&&m.setY(P,b[S*o+1]),o>=3&&m.setZ(P,b[S*o+2]),o>=4&&m.setW(P,b[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],N),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],N)}return i.emissiveTexture!==void 0&&r!==G&&c.push(e.assignTexture(a,"emissiveMap",i.emissiveTexture,U)),Promise.all(c).then(function(){const l=new r(a);return i.name&&(l.name=i.name),y(l,i),e.associations.set(l,{materials:n}),i.extensions&&O(t,l,i),l})}createUniqueName(n){const e=Ke.sanitizeNodeName(n||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(n){const e=this,s=this.extensions,t=this.primitiveCache;function i(a){return s[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return fe(o,a,e)})}const r=[];for(let a=0,o=n.length;a<o;a++){const c=n[a],u=Dn(c),l=t[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?h=i(c):h=fe(new Be,c,e),t[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(n){const e=this,s=this.json,t=this.extensions,i=s.meshes[n],r=i.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Pn(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let d=0,p=u.length;d<p;d++){const R=u[d],m=r[d];let T;const A=c[d];if(m.mode===M.TRIANGLES||m.mode===M.TRIANGLE_STRIP||m.mode===M.TRIANGLE_FAN||m.mode===void 0)T=i.isSkinnedMesh===!0?new je(R,A):new Ve(R,A),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===M.TRIANGLE_STRIP?T.geometry=oe(T.geometry,he):m.mode===M.TRIANGLE_FAN&&(T.geometry=oe(T.geometry,Q));else if(m.mode===M.LINES)T=new Xe(R,A);else if(m.mode===M.LINE_STRIP)T=new ze(R,A);else if(m.mode===M.LINE_LOOP)T=new qe(R,A);else if(m.mode===M.POINTS)T=new We(R,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&kn(T,i),T.name=e.createUniqueName(i.name||"mesh_"+n),y(T,i),m.extensions&&O(t,T,m),e.assignFinalMaterial(T),l.push(T)}for(let d=0,p=l.length;d<p;d++)e.associations.set(l[d],{meshes:n,primitives:d});if(l.length===1)return i.extensions&&O(t,l[0],i),l[0];const h=new z;i.extensions&&O(t,h,i),e.associations.set(h,{meshes:n});for(let d=0,p=l.length;d<p;d++)h.add(l[d]);return h})}loadCamera(n){let e;const s=this.json.cameras[n],t=s[s.type];if(!t){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new Ye(Qe.radToDeg(t.yfov),t.aspectRatio||1,t.znear||1,t.zfar||2e6):s.type==="orthographic"&&(e=new Je(-t.xmag,t.xmag,t.ymag,-t.ymag,t.znear,t.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),y(e,s),Promise.resolve(e)}loadSkin(n){const e=this.json.skins[n],s=[];for(let t=0,i=e.joints.length;t<i;t++)s.push(this._loadNodeShallow(e.joints[t]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(t){const i=t.pop(),r=t,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new K;i!==null&&h.fromArray(i.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Ze(a,o)})}loadAnimation(n){const e=this.json,s=this,t=e.animations[n],i=t.name?t.name:"animation_"+n,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=t.channels.length;l<h;l++){const d=t.channels[l],p=t.samplers[d.sampler],R=d.target,m=R.node,T=t.parameters!==void 0?t.parameters[p.input]:p.input,A=t.parameters!==void 0?t.parameters[p.output]:p.output;R.node!==void 0&&(r.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",A)),c.push(p),u.push(R))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],d=l[1],p=l[2],R=l[3],m=l[4],T=[];for(let x=0,E=h.length;x<E;x++){const L=h[x],b=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,b,S,k,P);if(B)for(let j=0;j<B.length;j++)T.push(B[j])}const A=new $e(i,void 0,T);return y(A,t),A})}createNodeMesh(n){const e=this.json,s=this,t=e.nodes[n];return t.mesh===void 0?null:s.getDependency("mesh",t.mesh).then(function(i){const r=s._getNodeRef(s.meshCache,t.mesh,i);return t.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=t.weights.length;o<c;o++)a.morphTargetInfluences[o]=t.weights[o]}),r})}loadNode(n){const e=this.json,s=this,t=e.nodes[n],i=s._loadNodeShallow(n),r=[],a=t.children||[];for(let c=0,u=a.length;c<u;c++)r.push(s.getDependency("node",a[c]));const o=t.skin===void 0?Promise.resolve(null):s.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(h,vn)});for(let d=0,p=l.length;d<p;d++)u.add(l[d]);if(u.userData.pivot!==void 0&&l.length>0){const d=u.userData.pivot,p=l[0];u.pivot=new C().fromArray(d),u.position.x-=d[0],u.position.y-=d[1],u.position.z-=d[2],p.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(n){const e=this.json,s=this.extensions,t=this;if(this.nodeCache[n]!==void 0)return this.nodeCache[n];const i=e.nodes[n],r=i.name?t.createUniqueName(i.name):"",a=[],o=t._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(n)});return o&&a.push(o),i.camera!==void 0&&a.push(t.getDependency("camera",i.camera).then(function(c){return t._getNodeRef(t.cameraCache,i.camera,c)})),t._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(n)}).forEach(function(c){a.push(c)}),this.nodeCache[n]=Promise.all(a).then(function(c){let u;if(i.isBone===!0?u=new en:c.length>1?u=new z:c.length===1?u=c[0]:u=new ge,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(i.name&&(u.userData.name=i.name,u.name=r),y(u,i),i.extensions&&O(s,u,i),i.matrix!==void 0){const l=new K;l.fromArray(i.matrix),u.applyMatrix4(l)}else i.translation!==void 0&&u.position.fromArray(i.translation),i.rotation!==void 0&&u.quaternion.fromArray(i.rotation),i.scale!==void 0&&u.scale.fromArray(i.scale);if(!t.associations.has(u))t.associations.set(u,{});else if(i.mesh!==void 0&&t.meshCache.refs[i.mesh]>1){const l=t.associations.get(u);t.associations.set(u,{...l})}return t.associations.get(u).nodes=n,u}),this.nodeCache[n]}loadScene(n){const e=this.extensions,s=this.json.scenes[n],t=this,i=new z;s.name&&(i.name=t.createUniqueName(s.name)),y(i,s),s.extensions&&O(e,i,s);const r=s.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(t.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++){const h=o[u];h.parent!==null?i.add(nn(h)):i.add(h)}const c=u=>{const l=new Map;for(const[h,d]of t.associations)(h instanceof X||h instanceof ne)&&l.set(h,d);return u.traverse(h=>{const d=t.associations.get(h);d!=null&&l.set(h,d)}),l};return t.associations=c(i),i})}_createAnimationTracks(n,e,s,t,i){const r=[],a=n.name?n.name:n.uuid,o=[];function c(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}I[i.path]===I.weights?(c(n),n.isGroup&&n.children.forEach(c)):o.push(a);let u;switch(I[i.path]){case I.weights:u=se;break;case I.rotation:u=ie;break;case I.translation:case I.scale:u=te;break;default:switch(s.itemSize){case 1:u=se;break;case 2:case 3:default:u=te;break}break}const l=t.interpolation!==void 0?Fn[t.interpolation]:xe,h=this._getArrayFromAccessor(s);for(let d=0,p=o.length;d<p;d++){const R=new u(o[d]+"."+I[i.path],e.array,h,l);t.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(R),r.push(R)}return r}_getArrayFromAccessor(n){let e=n.array;if(n.normalized){const s=ee(e.constructor),t=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)t[i]=e[i]*s;e=t}return e}_createCubicSplineTrackInterpolant(n){n.createInterpolant=function(s){const t=this instanceof ie?Cn:_e;return new t(this.times,this.values,this.getValueSize()/3,s)},n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Kn(f,n,e){const s=n.attributes,t=new an;if(s.POSITION!==void 0){const a=e.json.accessors[s.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(t.set(new C(o[0],o[1],o[2]),new C(c[0],c[1],c[2])),a.normalized){const u=ee(H[a.componentType]);t.min.multiplyScalar(u),t.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=n.targets;if(i!==void 0){const a=new C,o=new C;for(let c=0,u=i.length;c<u;c++){const l=i[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],d=h.min,p=h.max;if(d!==void 0&&p!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(p[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(p[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(p[2]))),h.normalized){const R=ee(H[h.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}t.expandByVector(a)}f.boundingBox=t;const r=new cn;t.getCenter(r.center),r.radius=t.min.distanceTo(t.max)/2,f.boundingSphere=r}function fe(f,n,e){const s=n.attributes,t=[];function i(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in s){const a=$[r]||r.toLowerCase();a in f.attributes||t.push(i(s[r],a))}if(n.indices!==void 0&&!f.index){const r=e.getDependency("accessor",n.indices).then(function(a){f.setIndex(a)});t.push(r)}return re.workingColorSpace!==N&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${re.workingColorSpace}" not supported.`),y(f,n),Kn(f,n,e),Promise.all(t).then(function(){return n.targets!==void 0?Hn(f,n.targets,e):f})}export{jn as GLTFLoader};
@@ -1 +0,0 @@
1
- import{o as a,V as e,ba as s,y as t,E as r,a1 as i,p as o,Q as n,P as l,x as d,ah as b,a2 as u,a3 as m,bb as B,e as M,H as y,d as G,v as S,aA as c,ax as f,aB as h,G as p,aP as x,F as P,bc as g,J as C,bd as E,be as L,bf as A,C as D,z as T,B as v,h as F,bg as O,a0 as V,O as H}from"./rr0-scene.mjs";const j={AdditiveBlending:H,BackSide:V,BoxGeometry:O,BufferAttribute:F,BufferGeometry:v,CanvasTexture:T,Color:D,ConeGeometry:A,CylinderGeometry:L,DataTexture:E,DoubleSide:C,Euler:g,Float32BufferAttribute:P,FrontSide:x,Group:p,Line:h,LineBasicMaterial:f,LineSegments:c,Matrix4:S,Mesh:G,MeshBasicMaterial:y,MeshStandardMaterial:M,NormalBlending:B,Object3D:m,PlaneGeometry:u,PointLight:b,Points:d,PointsMaterial:l,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{j as MODULE_THREE};
@@ -1,85 +0,0 @@
1
- import{b8 as p,b9 as G}from"./rr0-scene.mjs";class m{static read(t,e){let i=t;for(const n of e.split(".")){if(i=m.bare(i),i===null||typeof i!="object")return;i=i[n]}return m.bare(i)}static write(t,e,i){const n=e.split("."),s=[];let o=t;for(let a=0;a<n.length-1;a++){let r=m.bare(o[n[a]]);if(r===null||typeof r!="object"||Array.isArray(r)){if(i===void 0)return;r={}}o[n[a]]=r,s.push({owner:o,part:n[a]}),o=r}const l=n[n.length-1];i===void 0?delete o[l]:o[l]=i;for(let a=s.length-1;a>=0;a--){const r=s[a].owner[s[a].part];if(Object.keys(r).length>0)break;delete s[a].owner[s[a].part]}}static stated(t,e){return m.read(t,e)!==void 0}static bare(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&"value"in t&&"basis"in t?t.value:t}}class C{static sets=new Map;static publish(t){C.sets.set(t.kind,t)}static of(t){return C.sets.get(t)}static kinds(){return[...C.sets.keys()]}}class T{static resolved=new WeakMap;static resolve(t,e){let i=T.resolved.get(t);i||T.resolved.set(t,i=new WeakMap);let n=i.get(e);if(!n){const s=e,o=a=>{if(typeof a!="string")return a;if(typeof s[a]=="string")return s[a];const r=a.split(" ");return r.length>1&&r.every(c=>typeof s[c]=="string")?r.map(c=>s[c]).join(" "):a},l=a=>a.map(r=>({...r,label:o(r.label)}));n={...t,title:o(t.title),parameters:t.parameters.map(a=>{const r={...a,label:o(a.label),hint:o(a.hint),summary:o(a.summary),group:o(a.group),..."placeholder"in a?{placeholder:o(a.placeholder)}:{},..."empty"in a?{empty:o(a.empty)}:{}};if(r.type==="choice"){const c=r.optionsOf;return{...r,choices:l(r.choices),...c?{optionsOf:(d,u)=>l(c(d,u))}:{}}}if(r.type==="set"){const c=r.options;return{...r,options:(d,u)=>l(c(d,u))}}return r})},i.set(e,n)}return n}static missing(t,e){const i=e,n=new Set,s=o=>{if(typeof o=="string")for(const l of o.split(" "))/^[a-z][A-Za-z0-9]*$/.test(l)&&i[l]===void 0&&n.add(l)};s(t.title);for(const o of t.parameters)if(s(o.label),s(o.hint),s(o.summary),s(o.group),"placeholder"in o&&s(o.placeholder),"empty"in o&&s(o.empty),o.type==="choice")for(const l of o.choices)s(l.label);return[...n]}}class X{static attach(t,e,i){t.classList.add(e);const n=`${e}-style`;if(t.parentElement?.querySelector(`:scope > style.${n}`))return;const s=t.ownerDocument.createElement("style");s.className=n,s.textContent=i,t.before(s)}}class q{constructor(t,e,i,n){this.button=t,this.onPick=i,this.idOf=n;const s=this.panel=t.ownerDocument.createElement("div");s.id=e,s.className="add-menu",s.setAttribute("popover",""),s.setAttribute("role","menu");const o=`--add-menu-${e}`;t.style.setProperty("anchor-name",o),s.style.setProperty("position-anchor",o),t.setAttribute("popovertarget",e),t.setAttribute("aria-haspopup","menu"),t.after(s)}static CSS=`
2
- .add-menu { padding: .3em 0; border: 1px solid color-mix(in srgb, CanvasText 30%, transparent); border-radius: 4px; background: Canvas; color: CanvasText;
3
- box-shadow: 0 2px 8px rgba(0, 0, 0, .25); max-height: 60vh; overflow-y: auto; font-size: .9em; }
4
- @supports (position-area: bottom span-left) {
5
- .add-menu:popover-open { inset: auto; position-area: bottom span-left; margin: .2em 0 0 0; }
6
- }
7
- .add-menu-choice { display: block; width: 100%; padding: .25em .9em; border: 0; background: none; color: inherit; font: inherit; text-align: left;
8
- cursor: pointer; white-space: nowrap; }
9
- .add-menu-choice:hover, .add-menu-choice:focus-visible { background: color-mix(in srgb, CanvasText 12%, transparent); }
10
- .add-menu-choice[aria-disabled="true"] { opacity: .45; cursor: not-allowed; background: none; }
11
- .add-menu-choice[hidden] { display: none; }
12
- `;panel;kinds=[];last;setKinds(t){this.kinds=t;const e=this.button.ownerDocument;this.panel.replaceChildren(...t.map(i=>{const n=e.createElement("button");return n.type="button",n.className="add-menu-choice",n.setAttribute("role","menuitem"),this.idOf&&(n.id=this.idOf(i.value)),n.dataset.value=i.value,n.textContent=i.label,n.hidden=i.hidden===!0,i.disabledReason&&(n.setAttribute("aria-disabled","true"),n.title=i.disabledReason),n.addEventListener("click",()=>{n.getAttribute("aria-disabled")!=="true"&&(this.close(),this.last=i.value,this.onPick(i.value))}),n}))}setDisabled(t,e){this.kinds=this.kinds.map(n=>n.value===t?{...n,disabledReason:e}:n);const i=[...this.panel.children].find(n=>n.dataset.value===t);i&&(e?(i.setAttribute("aria-disabled","true"),i.title=e):(i.removeAttribute("aria-disabled"),i.title=""))}labelOf(t){return this.kinds.find(e=>e.value===t)?.label??t}get lastPicked(){return this.last}close(){if(typeof this.panel.hidePopover=="function")try{this.panel.matches(":popover-open")&&this.panel.hidePopover()}catch{}}}class h{static draw(t,e="none"){return`<svg class="icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" fill="${e}" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`}static TRASH=h.draw('<path d="M2.5 4.5h11"/><path d="M6 4.5V3h4v1.5"/><path d="M4 4.5l.7 9h6.6l.7-9"/><path d="M6.8 7v4.5M9.2 7v4.5"/>');static TARGET=h.draw('<circle cx="8" cy="8" r="5"/><circle cx="8" cy="8" r="1.6"/><path d="M8 1v2.2M8 12.8V15M1 8h2.2M12.8 8H15"/>');static PLAY=h.draw('<path d="M5 3.2v9.6L12.6 8z"/>',"currentColor");static PAUSE=h.draw('<path d="M5.5 3.5v9M10.5 3.5v9"/>');static RECORD=h.draw('<circle cx="8" cy="8" r="4.2" fill="var(--error, #d93025)" stroke="none"/>');static STOP=h.draw('<rect x="4" y="4" width="8" height="8" rx="1.2"/>',"currentColor");static PREVIOUS_MARK=h.draw('<path d="M6.5 4 2.5 8l4 4"/><path d="M11 5.2 13.8 8 11 10.8 8.2 8z"/>');static NEXT_MARK=h.draw('<path d="M9.5 4l4 4-4 4"/><path d="M5 5.2 7.8 8 5 10.8 2.2 8z"/>');static CLOSE=h.draw('<path d="M4 4l8 8M12 4l-8 8"/>');static PLUS=h.draw('<path d="M8 3v10M3 8h10"/>');static METEOR=h.draw('<path d="M2.5 2.5l7 7"/><path d="M5.5 2.5l5 5"/><circle cx="11.5" cy="11.5" r="2"/>');static COMET=h.draw('<circle cx="11" cy="11" r="2.4"/><path d="M9.3 9.3 2.5 2.5M9 11.2 3 7M11.2 9 7 3"/>');static STAR=h.draw('<path d="M8 2.2l1.7 3.6 3.9.5-2.9 2.7.8 3.9L8 11l-3.5 1.9.8-3.9-2.9-2.7 3.9-.5z"/>');static SATELLITE=h.draw('<rect x="6.3" y="6.3" width="3.4" height="3.4" transform="rotate(45 8 8)"/><path d="M5.4 5.4 3 3M10.6 10.6 13 13"/><path d="M1.8 4.2 4.2 1.8M11.8 14.2l2.4-2.4"/><path d="M10.5 3.5a3 3 0 0 1 2 2"/>');static FIREBALL=h.draw('<circle cx="10.5" cy="10.5" r="2.6"/><path d="M8.6 8.6 3 3M8 10.6 4.5 8.5M10.6 8 8.5 4.5"/>');static SUMMARY=h.draw('<rect x="3" y="2" width="10" height="12" rx="1.5"/><path d="M5.5 5.5h5M5.5 8h5M5.5 10.5h3"/>');static WITNESS=h.draw('<circle cx="8" cy="5" r="2.6"/><path d="M2.8 14c.6-3 2.6-4.6 5.2-4.6s4.6 1.6 5.2 4.6"/>');static LOCATION=h.draw('<path d="M8 14.3s4.5-4.3 4.5-7.8a4.5 4.5 0 0 0-9 0c0 3.5 4.5 7.8 4.5 7.8z"/><circle cx="8" cy="6.5" r="1.6"/>');static DATE=h.draw('<rect x="2.3" y="3.3" width="11.4" height="10.4" rx="1.5"/><path d="M2.3 6.6h11.4M5.3 1.8v2.8M10.7 1.8v2.8"/>');static ENVIRONMENT=h.draw('<path d="M1.5 14h13"/><path d="M2.8 14V8.3L6.3 5.5l3.5 2.8V14"/><path d="M12.2 14V9.4"/><circle cx="12.2" cy="7.4" r="2.1"/>');static SKY=h.draw('<path d="M4.6 12.5h7a2.6 2.6 0 0 0 .3-5.2 3.8 3.8 0 0 0-7.3-.6 2.9 2.9 0 0 0 0 5.8z"/>');static PHENOMENON=h.draw('<ellipse cx="8" cy="9" rx="6.3" ry="2.1"/><path d="M4.6 7.8a3.4 3.4 0 0 1 6.8 0"/><path d="M5 13.4l.6-1.4M11 13.4l-.6-1.4M8 14v-1.4"/>');static SOUND=h.draw('<path d="M2.5 6.2h2.3L8 3.5v9L4.8 9.8H2.5z"/><path d="M10.5 6a2.8 2.8 0 0 1 0 4M12.3 4.2a5.4 5.4 0 0 1 0 7.6"/>');static PICTURES=h.draw('<rect x="2" y="3" width="12" height="10" rx="1.5"/><circle cx="5.8" cy="6.4" r="1.2"/><path d="M2.5 12l3.8-3.6 2.4 2.2 2.2-1.8 2.6 2.5"/>');static FILES=h.draw('<path d="M4 1.8h5.2L12.5 5v9.2H4z"/><path d="M9 1.8V5.2h3.5"/>');static BY_GLYPH={"🗑":h.TRASH,"🎯":h.TARGET,"+":h.PLUS,"✕":h.CLOSE,"▶":h.PLAY,"⏸":h.PAUSE,"⏺":h.RECORD,"⏹":h.STOP};static show(t,e){if(t.dataset.icon===e&&t.firstChild)return;const i=h.BY_GLYPH[e];i?t.innerHTML=i:t.textContent=e,t.dataset.icon=e}static CSS=`
13
- .icon { display: block; flex: none; }
14
- button:has(> .icon:only-child) { display: inline-flex; align-items: center; justify-content: center; }
15
- `}class L{constructor(t){this.options=t,this.row=document.createElement("div"),this.row.className="element-list-row",this.pickerRow=document.createElement("label"),this.pickerRow.className="element-list-picker",this.select=document.createElement("select"),this.select.id=t.ids.list,this.select.addEventListener("change",()=>t.onSelect(this.select.value)),this.pickerRow.append(this.select),t.header.append(this.row),this.row.append(this.pickerRow);const e=t.navigation;e&&(this.previousButton=this.iconButton(`${t.ids.list}-previous`,"▲"),this.nextButton=this.iconButton(`${t.ids.list}-next`,"▼"),this.previousButton.addEventListener("click",()=>e.onStep(-1)),this.nextButton.addEventListener("click",()=>e.onStep(1)),this.row.append(this.previousButton,this.nextButton),e.scope.addEventListener("keydown",i=>{if(!i.altKey||i.ctrlKey||i.metaKey||i.shiftKey||i.key!=="ArrowUp"&&i.key!=="ArrowDown"||this.pickerRow.closest("[hidden]")||!this.pickerRow.isConnected)return;i.preventDefault(),i.stopPropagation();const n=i.key==="ArrowUp"?this.previousButton:this.nextButton;n&&!n.disabled&&e.onStep(i.key==="ArrowUp"?-1:1)}));for(const i of t.actions??[]){const n=this.iconButton(i.id,i.glyph);n.addEventListener("click",()=>i.onClick()),this.actionButtons.set(i.id,n),this.row.append(n)}this.removeButton=this.iconButton(t.ids.remove,"🗑"),this.removeButton.addEventListener("click",()=>t.onRemove()),this.emptyText=document.createElement("span"),this.emptyText.className="element-list-empty",this.addButton=this.iconButton(t.ids.add,"+"),this.addButton.classList.add("element-list-add"),this.row.append(this.removeButton,this.emptyText,this.addButton),t.ids.kinds?this.kindMenu=new q(this.addButton,t.ids.kinds,i=>t.onAdd(i),t.ids.kind):this.addButton.addEventListener("click",()=>t.onAdd(void 0)),t.body&&t.body.classList.add("element-list-body")}static CSS=`
16
- .element-list-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .4em; flex: 1 1 100%; min-width: 0; }
17
- .element-list-picker { flex: 1 1 10em; min-width: 0; display: flex; }
18
- .element-list-picker select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
19
- .element-list-empty { align-self: center; opacity: .75; font-style: italic; }
20
- /* The fields of the picked element unroll from its picker: the frame starts where the picker ends, with no space between (the gap of the
21
- container both stand in is taken back, see glue), its corner under the picker square. The row is aligned on its bottom so that the
22
- picker's lower edge is the row's, whatever the height of the buttons beside it. */
23
- .element-list-body { flex: 1 1 100%; min-width: 0; box-sizing: border-box; border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
24
- border-radius: 0 6px 6px 6px; padding: .5em .6em; margin: 0 0 .3em; display: flex; flex-wrap: wrap;
25
- align-items: center; gap: .5em; }
26
- .element-list-picker select { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
27
- .element-list-row [hidden], .element-list-body[hidden] { display: none !important; }
28
- ${q.CSS}`;static showPresence(t,e,i,n=!1){for(const s of t.children)if(!s.matches(".element-list-add, .add-menu, .add-reason")){if(s.matches(".element-list-empty")){s.hidden=i||n;continue}if(s.matches(".element-list-picker")){s.hidden=!i&&!n;continue}s.hidden=!i&&!n,s instanceof HTMLButtonElement&&!i&&(s.disabled=!0)}e&&(e.hidden=!i,i&&!L.glued.has(e)&&L.glue(e))}static glued=new WeakSet;static glue(t){const e=t.parentElement,i=t.ownerDocument.defaultView;if(!e||!i)return;const n=i.getComputedStyle(e),s=/flex|grid/.test(n.display)&&parseFloat(n.rowGap)||0;t.style.marginTop=`${-s}px`,n.display!=="none"&&L.glued.add(t)}select;row;pickerRow;emptyText;removeButton;addButton;addReason;kindMenu;previousButton;nextButton;actionButtons=new Map;items=[];noneLabel="—";addLabel="";removeEnabled=!0;actionEnabled=new Map;iconButton(t,e){const i=document.createElement("button");return i.type="button",i.className="icon-btn",i.id=t,h.show(i,e),i}setLabels(t){if(this.previousButton&&this.nextButton)for(const[e,i,n]of[[this.previousButton,t.previous??"","Alt+↑"],[this.nextButton,t.next??"","Alt+↓"]]){const s=i===""?n:`${i} (${n})`;e.title=s,e.setAttribute("aria-label",i||s),e.setAttribute("aria-keyshortcuts",n.replace("↑","ArrowUp").replace("↓","ArrowDown"))}this.select.setAttribute("aria-label",t.list),this.emptyText.textContent=t.empty??"",this.noneLabel=t.none??this.noneLabel,this.addLabel=t.add,this.kindMenu?.panel.setAttribute("aria-label",t.add),this.options.optional&&this.listed(this.items,this.select.value);for(const[e,i]of[[this.removeButton,t.remove],[this.addButton,t.add],...[...this.actionButtons].map(([n,s])=>[s,t.actions?.[n]??""])])e.title=i,e.setAttribute("aria-label",i)}setKinds(t){this.kindMenu?.setKinds(t)}kindLabel(t){return this.kindMenu?.labelOf(t)??t}get pickedKind(){return this.kindMenu?.lastPicked}setItems(t,e){this.items=t,this.listed(t,e)}listed(t,e){this.select.replaceChildren(...this.options.optional?[new Option(this.noneLabel,"")]:[],...t.map(i=>new Option(i.label,i.id))),e!==void 0&&(this.select.value=e),this.select.selectedIndex<0&&(this.select.selectedIndex=0),this.setPresent(this.options.optional?this.select.value!=="":t.length>0)}setStepState(t,e){this.previousButton&&(this.previousButton.disabled=!t),this.nextButton&&(this.nextButton.disabled=!e)}setActionEnabled(t,e){const i=this.actionButtons.get(t);i&&(i.disabled=!e||this.select.disabled),this.actionEnabled.set(t,e)}setRemoveEnabled(t){this.removeEnabled=t,this.removeButton.disabled=!t||this.select.value===""&&this.options.optional===!0}get value(){return this.select.value}setAddState(t,e){this.addButton.disabled=!t;const i=e??this.addLabel;this.addButton.title=i,this.addButton.setAttribute("aria-label",i),this.addReason||(this.addReason=this.addButton.ownerDocument.createElement("span"),this.addReason.className="add-reason",this.addReason.style.cssText="font-size: .85em; opacity: .8; align-self: center;",this.row.append(this.addReason)),this.addReason.textContent=!t&&e?e:"",this.addReason.hidden=t||!e}rename(t,e){const i=[...this.select.options].find(n=>n.value===t);i&&(i.textContent=e)}show(t){this.select.value=t,this.options.optional&&this.setPresent(this.select.value!=="")}setPresent(t){const e=this.options.optional===!0;if(L.showPresence(this.row,this.options.body,t,e),this.select.disabled=!t&&!e,!!t){this.removeButton.disabled=!this.removeEnabled;for(const[i,n]of this.actionButtons)n.disabled=this.actionEnabled.get(i)===!1}}focus(){this.select.focus()}}class f{static CHROME="2.6em";static UNBOUNDED=9999;static fit(t){const e=[...t.querySelectorAll('input[type="number"]')];for(const i of e)i.style.width=`calc(${f.charsFor(i)}ch + ${f.CHROME})`,f.hold(i,!f.isFocused(i)),i.dataset.held!==""&&(i.dataset.held="",i.addEventListener("input",()=>f.hold(i)),i.addEventListener("change",()=>f.hold(i,!0)));return e.length}static hold(t,e=!1){const i=f.heldValue(t.value,t,e);i!==t.value&&(t.value=i,t.dispatchEvent(new Event("input",{bubbles:!0})))}static isFocused(t){return t.getRootNode().activeElement===t}static heldValue(t,e,i=!1){if(t===""||!/^-?\d+(\.\d+)?$/.test(t))return t;const n=f.wholeOnly(e.step)?0:f.decimalsOf(e.step),s=t.indexOf("."),o=s>=0&&t.length-s-1>n?n===0?t.slice(0,s):t.slice(0,s+n+1):t,l=Number(o),a=e.min===""?void 0:Number(e.min),r=e.max===""?void 0:Number(e.max);return r!==void 0&&l>r?String(r):i&&a!==void 0&&l<a?String(a):o}static charsFor(t){const e=l=>l===""?void 0:Math.abs(Number(l)),i=Math.max(e(t.max)??f.UNBOUNDED,e(t.min)??0),n=String(Math.floor(Number.isFinite(i)?i:f.UNBOUNDED)).length,s=t.min!==""&&Number(t.min)<0?1:0,o=f.wholeOnly(t.step)?0:f.decimalsOf(t.step);return n+s+(o>0?o+1:0)}static decimalsOf(t){if(t===""||t==="any")return 2;const e=t.indexOf(".");return Math.max(2,e<0?0:t.length-e-1)}static wholeOnly(t){return t!==""&&t!=="any"&&!t.includes(".")}}class x{static CSS=`
29
- .window-close {
30
- position: absolute; top: 8px; right: 8px; z-index: 1;
31
- display: inline-flex; align-items: center; justify-content: center;
32
- width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0;
33
- border: 0; border-radius: 8px; background: none; color: inherit; opacity: .7; cursor: pointer;
34
- }
35
- .window-close:hover, .window-close:focus-visible { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
36
- :is(dialog, [popover], .context-menu):has(> .window-close) { position: relative; padding-right: 44px; }
37
- .context-menu:has(> .window-close) { position: fixed; }
38
- `;static button(t,e,i){const n=t.querySelector(":scope > .window-close");if(n)return x.label(n,e),n;const s=document.createElement("button");return s.type="button",s.className="window-close",s.innerHTML=h.CLOSE,x.label(s,e),s.addEventListener("click",o=>{o.stopPropagation(),i()}),t.prepend(s),s}static popover(t,e){return x.button(t,e,()=>{typeof t.hidePopover=="function"&&t.matches(":popover-open")&&t.hidePopover()})}static dialog(t,e,i){if(!t.dataset.closesBeside){t.dataset.closesBeside="true";let n=!1;t.addEventListener("pointerdown",s=>n=s.target===t),t.addEventListener("click",s=>{s.target===t&&n&&x.outside(t,s)&&i()})}return x.button(t,e,i)}static outside(t,e){const i=t.getBoundingClientRect();return e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom}static label(t,e){t.title=e,t.setAttribute("aria-label",e)}}class k extends HTMLElement{static TAG="rr0-input-basis";static CSS=`
39
- rr0-input-basis { display: inline-block; }
40
- rr0-input-basis[hidden] { display: none; }
41
- .basis-mark {
42
- display: inline-block; margin-left: 8px; padding: 0 8px; border: 1px solid var(--glow-dim); border-radius: 999px;
43
- font: 600 11px/1.6 var(--sans); color: var(--glow); cursor: pointer; vertical-align: .05em; user-select: none;
44
- }
45
- /* Always there, so that nothing moves when it shows: "stated", the default, said quietly, and fully on the hover of its field. */
46
- .basis-mark[data-basis="stated"] { border-style: dashed; opacity: .55; }
47
- :is(label, .field, .event-param-label):is(:hover, :focus-within) .basis-mark, .basis-mark:is(:hover, :focus-visible) { opacity: 1; }
48
- .basis-mark[data-basis="assumed"], .basis-mark[data-basis="derived"] { font-style: italic; }
49
- .basis-window { width: min(26em, 92vw); padding: 18px 20px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--ground-raised); color: var(--ink); box-shadow: 0 12px 32px rgba(0, 0, 0, .3); }
50
- .basis-window h3 { margin: 0 0 12px; font: 600 19px/1.3 var(--serif); }
51
- .basis-window label { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; font: 600 13px/1.3 var(--sans); color: var(--ink-dim); }
52
- .basis-window :is(select, textarea) { box-sizing: border-box; width: 100%; font-weight: 400; }
53
- /* Beside its pill, under it or above it where there is room (anchored, see open); centred where anchors are not known. Fixed, against a
54
- window's own rule (WindowClose), which makes a popover with a ✕ relative, and so drawn at the top of the page. */
55
- .basis-window.basis-window:popover-open { position: fixed; inset: auto; margin: 6px 0; max-height: calc(100vh - 24px); overflow: auto;
56
- position-area: bottom span-right; position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline; }
57
- @supports not (position-area: bottom) { .basis-window.basis-window:popover-open { inset: 0; margin: auto; height: fit-content; } }
58
- .basis-window textarea { min-height: 8em; font: 400 14px/1.45 var(--sans, sans-serif); resize: vertical; }
59
- `;hows=[];rationaleKept=!0;wording;shown;mark;window;static count=0;anchor=`--rr0-basis-${++k.count}`;set anchorKey(t){this.anchor=`--rr0-basis-${t.replace(/[^a-zA-Z0-9_-]/g,"-")}`,this.mark?.style.setProperty("anchor-name",this.anchor)}build(){if(this.mark)return;const t=document.createElement("span");t.className="basis-mark",t.setAttribute("role","button"),t.tabIndex=0,t.style.setProperty("anchor-name",this.anchor);const e=i=>{i.preventDefault(),i.stopPropagation(),this.open()};t.addEventListener("click",e),t.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&e(i)}),this.append(t),this.mark=t,this.say()}connectedCallback(){this.build()}set messages(t){this.wording=t,this.say()}get entry(){return this.shown}set entry(t){this.shown=t&&(t.basis!=="stated"||t.how!==void 0||t.rationale!==void 0)?{...t}:void 0,this.say()}get pill(){return this.build(),this.mark}say(){const t=this.mark,e=this.wording;if(!t||!e)return;const i=this.shown?.basis??"stated";t.dataset.basis=i,this.dataset.basis=i,t.textContent!==e.basis[i]&&(t.textContent=e.basis[i]),t.title=this.shown?.rationale?`${e.title} : ${this.shown.rationale}`:e.title,t.setAttribute("aria-label",`${e.title} : ${e.basis[i]}`)}open(){const t=this.wording;if(!t)return;const e=Object.assign(document.createElement("h3"),{textContent:t.title}),i=document.createElement("select");for(const r of["measured","stated","derived","assumed"])i.append(new Option(t.basis[r],r));i.value=this.shown?.basis??"stated";const n=document.createElement("select");n.append(new Option("—",""));for(const r of this.hows)n.append(new Option(r.label,r.value));n.value=this.shown?.how??"";const s=document.createElement("textarea");s.value=this.shown?.rationale??"";const o=()=>{this.entry={basis:i.value,...n.value?{how:n.value}:{},...s.value.trim()?{rationale:s.value.trim()}:{}},this.dispatchEvent(new CustomEvent("basischange",{detail:{entry:this.shown},bubbles:!0,composed:!0}))};for(const r of[i,n])r.addEventListener("change",o);s.addEventListener("change",o);const l=(r,c)=>{const d=document.createElement("label");return d.append(Object.assign(document.createElement("span"),{textContent:r}),c),d},a=this.windowElement();a.replaceChildren(e,l(t.basisField,i),...this.hows.length>0?[l(t.howField,n)]:[],...this.rationaleKept?[l(t.rationaleField,s)]:[]),x.popover(a,t.title),typeof a.showPopover=="function"&&a.isConnected?a.showPopover():a.hidden=!1}windowElement(){if(this.window)return this.window;const t=document.createElement("div");t.className="basis-window",t.setAttribute("popover",""),t.setAttribute("role","dialog"),t.style.setProperty("position-anchor",this.anchor),t.addEventListener("toggle",i=>{i.newState==="closed"&&(t.remove(),this.window=void 0)});const e=this.getRootNode();return e instanceof ShadowRoot?e.append(t):(e instanceof Document?e.body:this).append(t),this.window=t,t}get openWindow(){return this.window}}function U(){customElements.get(k.TAG)||customElements.define(k.TAG,k)}const K="rr0-input-position",j={positionRelative:"relative",positionAbsolute:"absolute",positionModeHint:"Click to say it the other way: from something else, or as a latitude and a longitude",positionNoPlace:"The recording has no place yet: give the observer a latitude and a longitude first",positionFrom:"from",positionObserver:"the observer",positionEast:"East",positionNorth:"North",positionLatitude:"Latitude",positionLongitude:"Longitude",positionLabel:"Position",positionBasisHint:"Where this position comes from",positionBasisStated:"stated",positionBasisMeasured:"measured",positionBasisDerived:"derived",positionBasisAssumed:"assumed",positionBasisField:"Basis"},z=`${k.CSS}
60
- rr0-input-position { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3em .5em; }
61
- /* As the date's own switch (see DateInputElement): it reads as part of the label, before the fields. */
62
- rr0-input-position .position-mode { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-decoration: underline; text-underline-offset: .15em; }
63
- rr0-input-position .position-mode:hover:not(:disabled) { text-decoration-thickness: 2px; }
64
- rr0-input-position .position-mode:disabled { cursor: default; text-decoration: none; opacity: .75; }
65
- rr0-input-position .position-mode:focus-visible { outline: 2px solid #4af; outline-offset: 2px; border-radius: 2px; }
66
- rr0-input-position .position-axis { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; }
67
- /* East and North are two fields, each with its unit: room between the unit of one and the name of the next. */
68
- rr0-input-position :is(.position-local, .position-geo) { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3em 1em; }
69
- rr0-input-position .position-from { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; }
70
- rr0-input-position .position-from select { width: auto; max-width: 14em; }
71
- rr0-input-position input[type="number"] { width: 7em; }
72
- rr0-input-position .position-geo input[type="number"] { width: 9.5em; }
73
- /* What it stands on (see BasisInputElement): before the switch, as a date's. */
74
- rr0-input-position .position-basis { order: -2; }
75
- rr0-input-position .position-mode { order: -1; }
76
- rr0-input-position [hidden] { display: none !important; }
77
- `;class v extends HTMLElement{modeButton;fromRow;fromSelect;localRow;geoRow;eastField;northField;latField;lngField;basisSelect;eastLabel;northLabel;latLabel;lngLabel;wording=j;shownFrame={references:[]};shownValue;shownBasis;relativeShown=!0;referenceId;build(){if(this.modeButton)return;const t=this.getAttribute("name")??"position",e=this.ownerDocument,i=e.createElement("style");i.textContent=z;const n=e.createElement("button");n.type="button",n.className="position-mode",n.addEventListener("click",()=>this.setRelative(!this.relativeShown));const s=e.createElement("span");s.className="position-from";const o=e.createElement("span");o.className="position-from-text";const l=e.createElement("select");l.id=`${t}-from`,l.addEventListener("input",()=>this.pickReference(l.value)),s.append(o,l);const a=this.getAttribute("step")??"0.1",r=(w,E,S,O)=>{const y=e.createElement("input");return y.type="number",y.id=w,y.min=String(E),y.max=String(S),y.step=O,y.autocomplete="off",y},c=(w,E)=>{const S=e.createElement("label");S.className="position-axis";const O=e.createElement("span");return S.append(O,w,E),{row:S,label:O}},d=Number(this.getAttribute("range")??3e4),u=r(this.getAttribute("east-id")??`${t}-east`,-d,d,a),b=r(this.getAttribute("north-id")??`${t}-north`,-d,d,a),N=r(this.getAttribute("lat-id")??`${t}-lat`,-90,90,"0.000001"),$=r(this.getAttribute("lng-id")??`${t}-lng`,-180,180,"0.000001"),A=e.createElement("span");A.className="position-local";const F=c(u,"m"),P=c(b,"m");A.append(F.row,P.row);const B=e.createElement("span");B.className="position-geo";const D=c(N,"°"),V=c($,"°");B.append(D.row,V.row);for(const w of[u,b])w.addEventListener("input",()=>this.typedLocal());for(const w of[N,$])w.addEventListener("input",()=>this.typedGeo());U();const g=e.createElement(k.TAG);g.id=`${t}-basis`,g.className="position-basis",g.rationaleKept=!1,g.anchorKey=`${t}-basis`,g.addEventListener("basischange",w=>{w.stopPropagation();const E=w.detail.entry;this.shownBasis=E?.basis==="stated"?void 0:E?.basis,this.dispatchEvent(new CustomEvent("basischange",{detail:{basis:this.shownBasis},bubbles:!0,composed:!0}))}),this.append(i,n,s,A,B,g),this.modeButton=n,this.fromRow=s,this.fromSelect=l,this.localRow=A,this.geoRow=B,this.eastField=u,this.northField=b,this.latField=N,this.lngField=$,this.basisSelect=g,this.eastLabel=F.label,this.northLabel=P.label,this.latLabel=D.label,this.lngLabel=V.label,this.relativeShown=!this.isGeo,this.word(),this.show()}connectedCallback(){this.build()}get isGeo(){return this.getAttribute("native")==="geo"}get eastInput(){return this.build(),this.eastField}get northInput(){return this.build(),this.northField}get latInput(){return this.build(),this.latField}get lngInput(){return this.build(),this.lngField}get frame(){return this.shownFrame}set frame(t){this.shownFrame=t,this.build(),this.pullDegrees(),this.show()}get value(){return this.shownValue}set value(t){if(this.shownValue=t,this.build(),this.isGeo){const e=t;this.latField.value=e?String(p.degrees(e.lat)):"",this.lngField.value=e?String(p.degrees(e.lng)):""}this.show()}set said(t){this.build(),this.pullDegrees(),p.isRelative(t)?(this.relativeShown=!0,this.referenceId=t.relativeTo):p.isAbsolute(t)?this.relativeShown=!1:(this.relativeShown=!this.isGeo,this.referenceId=void 0),this.show()}get said(){const t=this.localValue();if(t)return p.restated(this.relativeShown?p.relative(0,0,this.referenceId):{lat:0,lng:0},t,this.shownFrame)}get relative(){return this.relativeShown}get basis(){return this.shownBasis}set basis(t){this.shownBasis=t==="stated"?void 0:t,this.build(),this.markBasis()}set basisShown(t){this.build(),this.basisSelect.hidden=!t}set messages(t){this.wording=t,this.modeButton&&(this.word(),this.show())}setRelative(t){!this.shownFrame.origin||this.references().length===0||(this.pullDegrees(),this.relativeShown=t,this.show())}pullDegrees(){if(!this.isGeo||!this.latField)return;const t=v.typed(this.latField),e=v.typed(this.lngField);this.shownValue=t!==void 0&&e!==void 0?{lat:t,lng:e}:this.latField.value===""&&this.lngField.value===""?void 0:this.shownValue}word(){const t=this.wording;this.eastLabel.textContent=t.positionEast,this.northLabel.textContent=t.positionNorth,this.latLabel.textContent=t.positionLatitude,this.lngLabel.textContent=t.positionLongitude,this.fromRow.querySelector(".position-from-text").textContent=t.positionFrom,this.basisSelect.messages={title:t.positionBasisHint,basisField:t.positionBasisField,howField:"",rationaleField:"",basis:{stated:t.positionBasisStated,measured:t.positionBasisMeasured,derived:t.positionBasisDerived,assumed:t.positionBasisAssumed}},this.markBasis()}markBasis(){this.basisSelect&&(this.basisSelect.entry=this.shownBasis?{basis:this.shownBasis}:void 0)}references(){const t=this.shownFrame.references;return t.length>0||this.isGeo?t:[{label:this.wording.positionObserver,eastM:0,northM:0}]}reference(){const t=this.references();return t.find(e=>e.id===this.referenceId)??t[0]??{label:"",eastM:0,northM:0}}localValue(){const t=this.shownValue;if(!t)return;if(!this.isGeo)return t;const e=this.shownFrame.origin;return e?p.toLocal(t,e):void 0}geoValue(){const t=this.shownValue;if(!t)return;if(this.isGeo)return t;const e=this.shownFrame.origin;return e?p.toGeo(t,e):void 0}show(){if(!this.modeButton)return;const t=this.wording,e=this.shownFrame.origin!==void 0&&this.references().length>0;e||(this.relativeShown=!this.isGeo);const i=this.modeButton;i.textContent=this.relativeShown?t.positionRelative:t.positionAbsolute,i.disabled=!e,i.title=e?t.positionModeHint:t.positionNoPlace;const n=this.references(),s=this.fromSelect,o=n.map(u=>u.id??"");([...s.options].map(u=>u.value).join(`
78
- `)!==o.join(`
79
- `)||[...s.options].map(u=>u.text).join(`
80
- `)!==n.map(u=>u.label).join(`
81
- `))&&s.replaceChildren(...n.map(u=>new Option(u.label,u.id??""))),this.referenceId!==void 0&&!n.some(u=>u.id===this.referenceId)&&(this.referenceId=void 0),s.value=this.referenceId??o[0]??"",this.fromRow.hidden=!this.relativeShown,this.localRow.hidden=!this.relativeShown,this.geoRow.hidden=this.relativeShown;const l=this.getRootNode().activeElement,a=(u,b)=>{u!==l&&(u.value=b===void 0?"":String(b))},r=this.localValue(),c=this.reference();if(a(this.eastField,r?p.metres(r.eastM-c.eastM):void 0),a(this.northField,r?p.metres(r.northM-c.northM):void 0),this.isGeo&&!this.relativeShown)return;const d=this.geoValue();a(this.latField,d?p.degrees(d.lat):void 0),a(this.lngField,d?p.degrees(d.lng):void 0)}pickReference(t){this.pullDegrees(),this.referenceId=t===""?void 0:t,this.show();const e=this.said;e&&this.shownValue&&this.tell(this.shownValue,e)}static typed(t){const e=t.value.trim(),i=e===""?NaN:Number(e);return Number.isFinite(i)?i:void 0}typedLocal(){const t=v.typed(this.eastField),e=v.typed(this.northField);if(t===void 0||e===void 0)return;const i=this.reference(),n={eastM:i.eastM+t,northM:i.northM+e};let s=n;if(this.isGeo){const o=this.shownFrame.origin;if(!o)return;s=p.toGeo(n,o)}this.shownValue=s,this.tell(s,p.relative(t,e,this.referenceId))}typedGeo(){const t=v.typed(this.latField),e=v.typed(this.lngField);if(t===void 0||e===void 0)return;let i={lat:t,lng:e};if(!this.isGeo){const n=this.shownFrame.origin;if(!n)return;i=p.toLocal({lat:t,lng:e},n)}this.shownValue=i,this.tell(i,{lat:t,lng:e})}tell(t,e){this.show();const i=this.isGeo?p.isAbsolute(e):p.isRelative(e)&&e.relativeTo===void 0;this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,said:i?void 0:e},bubbles:!0,composed:!0}))}}function Y(){customElements.get(K)||customElements.define(K,v)}class R{constructor(t,e,i=()=>{},n){this.read=t,this.edit=e,this.context=i,this.place=n}static inPlace(t){return new R(()=>t,e=>e(t))}}class M{constructor(t,e,i="",n,s){this.container=t,this.idPrefix=i,this.values=n,this.enhance=s,this.said=new G([e,"en"])}set;target;changed=()=>{};said;setLanguage(t){this.said=new G([t,"en"]),this.set&&this.target&&this.show(this.set,this.target,this.changed)}show(t,e,i){this.set=t,this.target=e instanceof R?e:R.inPlace(e),this.changed=i,this.container.replaceChildren();const n=new Map;for(const s of t.parameters){const o=this.read(s.group)??"";let l=n.get(o);if(!l){if(l=document.createElement("fieldset"),l.className="parameter-group",o!==""){const a=document.createElement("legend");a.textContent=o,l.append(a)}else l.classList.add("parameter-group-untitled"),l.style.border="0",l.style.padding="0",l.style.marginInline="0";n.set(o,l),this.container.append(l)}l.append(this.fieldOf(s))}f.fit(this.container),this.sync()}clear(){this.set=void 0,this.target=void 0,this.container.replaceChildren()}field(t){return this.container.querySelector(`[data-key="${t}"]`)??void 0}sync(t=!1){const e=this.target?.read();if(!this.set||!e)return;const i=this.target.context(),n=t?null:this.container.getRootNode().activeElement;for(const s of this.set.parameters){const o=s.type==="position"?this.positionOf(s):this.field(s.key);if(!o)continue;const l=o.closest("label, .parameter-row")??o;l.hidden=s.visibleWhen!==void 0&&!s.visibleWhen(e,i);const a=m.read(e,s.key);if(s.type==="number"){const r=o;r!==n&&(r.value=typeof a=="number"?M.shown(a,s):"");const c=M.boundsOf(s,e,i);r.min=String(c.min),r.max=String(c.max);const d=s.effective?.(e,i);r.placeholder=d!==void 0?M.shown(d,s):this.read(s.placeholder)??"",r.classList.toggle("parameter-derived",a===void 0)}else if(s.type==="choice"){const r=o,c=s.optionsOf?.(e,i)??s.choices;if([...r.options].filter(d=>d.value!=="").map(d=>d.value).join(`
82
- `)!==c.map(d=>d.value).join(`
83
- `)&&r.replaceChildren(...s.required?[]:[new Option("—","")],...c.map(d=>new Option(this.read(d.label)??d.value,d.value))),r!==n&&(r.value=typeof a=="string"&&c.some(d=>d.value===a)?a:s.required?r.options[0]?.value??"":""),!s.required){const d=s.effective?.(e,i),u=c.find(b=>b.value===d);r.options[0].textContent=u?this.read(u.label)??u.value:this.read(s.empty)??"—"}}else if(s.type==="boolean"){const r=o;r.checked=a===!0}else if(s.type==="colour"){const r=o;r!==n&&(r.value=M.swatchOf(a,s.fallback??"#808080"))}else if(s.type==="set")this.syncSet(s,o,e,i);else if(s.type==="position")this.syncPosition(s,o,e);else if(s.type==="said"){const r=o;r!==n&&(r.value=this.values?.said().read(m.read(e,s.key))??""),this.markMissing(s,r)}else{const r=o;r!==n&&(r.value=typeof a=="string"?a:"",r.classList.remove("invalid"),r.removeAttribute("aria-invalid"))}}for(const s of this.container.querySelectorAll("fieldset.parameter-group"))s.hidden=[...s.querySelectorAll("label, .parameter-row")].filter(o=>o.parentElement===s).every(o=>o.hidden)}fieldOf(t){const e=document.createElement("label"),i=this.read(t.hint);i&&(e.title=i);const n=document.createElement("span");n.textContent=this.read(t.label)??t.key,e.append(n," ");let s;if(t.type==="choice"){const o=document.createElement("select");this.identify(o,t),t.required||o.append(new Option("—","")),o.append(...t.choices.map(l=>new Option(this.read(l.label)??l.value,l.value))),o.addEventListener("input",()=>this.write(t,o.value===""?void 0:o.value)),e.append(o),this.enhance?.(t,o)}else{if(t.type==="position")return this.setRow(t,this.positionFieldOf(t));if(t.type==="set"){const o=document.createElement("div");return this.identify(o,t),o.className="parameter-set",o.addEventListener("input",()=>{const l=[...o.querySelectorAll("input:checked")].map(a=>a.value);this.write(t,l.length>0?l:void 0)}),this.setRow(t,o)}else if(t.type==="boolean"){const o=document.createElement("input");o.type="checkbox",this.identify(o,t),o.addEventListener("input",()=>this.write(t,o.checked?!0:t.required?!1:void 0)),e.prepend(o),e.append(" ")}else{const o=document.createElement("input");this.identify(o,t),o.autocomplete="off",t.type==="number"?(o.type="number",o.min=String(t.min),o.max=String(t.max),o.step=String(t.step),s=t.unit,o.addEventListener("input",()=>{const l=o.value.trim();if(l==="")return t.required?void 0:this.write(t,void 0);const a=Number(l);Number.isFinite(a)&&this.write(t,a)})):t.type==="colour"?(o.type="color",o.addEventListener("input",()=>this.write(t,o.value))):t.type==="said"?(o.type="text",o.placeholder=this.read(t.placeholder)??"",o.addEventListener("input",()=>{const l=this.target?.read(),a=this.values;!l||!a||(this.write(t,a.said().write(m.read(l,t.key),o.value,a.writingLanguage())),this.markMissing(t,o))})):(o.type="text",o.placeholder=this.read(t.placeholder)??"",o.addEventListener("input",()=>{const l=t.required||t.validate?o.value.trim():o.value,a=this.target?.read(),r=a!==void 0&&(t.required===!0&&l===""||l!==""&&t.validate?.(l,a,this.target.context())===!1);o.classList.toggle("invalid",r),r?o.setAttribute("aria-invalid","true"):o.removeAttribute("aria-invalid"),!r&&this.write(t,l===""?void 0:l)}),o.addEventListener("change",()=>{if(!o.classList.contains("invalid"))return;o.classList.remove("invalid"),o.removeAttribute("aria-invalid");const l=this.target?.read(),a=l===void 0?void 0:m.read(l,t.key);o.value=typeof a=="string"?a:""})),e.append(o)}}return s&&e.append(` ${s}`),e}markMissing(t,e){t.type!=="said"||!t.required||(e.classList.toggle("invalid",e.value===""),e.setAttribute("aria-invalid",String(e.value==="")))}positionFieldOf(t){Y();const e=document.createElement("rr0-input-position"),i=`${this.idPrefix}${t.key}`;e.setAttribute("name",i),t.native==="geo"&&e.setAttribute("native","geo"),t.step!==void 0&&e.setAttribute("step",String(t.step)),t.rangeM!==void 0&&e.setAttribute("range",String(t.rangeM));const n=t.native==="geo"?["lat-id","lng-id"]:["east-id","north-id"];this.idPrefix!==""&&(e.setAttribute(n[0],`${this.idPrefix}${t.key}`),e.setAttribute(n[1],`${this.idPrefix}${t.secondKey}`)),e.dataset.position=t.key,e.build();const[s,o]=t.native==="geo"?[e.latInput,e.lngInput]:[e.eastInput,e.northInput];s.dataset.key=t.key,o.dataset.key=t.secondKey;const l=this.target?.place;return l&&(e.messages=l.messages()),e.basisShown=l?.basis!==void 0,e.addEventListener("positionchange",a=>{const{value:r,said:c}=a.detail;this.writePosition(t,r,c)}),e.addEventListener("basischange",a=>this.target?.place?.basis?.write(t,a.detail.basis)),e}positionOf(t){return this.container.querySelector(`rr0-input-position[data-position="${t.key}"]`)??void 0}syncPosition(t,e,i){const n=this.target?.place;n&&(e.messages=n.messages(),e.frame=n.frame());const s=m.read(i,t.key),o=m.read(i,t.secondKey),l=typeof s=="number"&&typeof o=="number";e.value=l?t.native==="geo"?{lat:s,lng:o}:{eastM:s,northM:o}:void 0;const a=m.read(i,t.saidKey),r=JSON.stringify(a??null);e.dataset.said!==r&&(e.dataset.said=r,e.said=a),e.basis=n?.basis?.read(t)}writePosition(t,e,i){const n=this.target;if(!n)return;const[s,o]="lat"in e?[e.lat,e.lng]:[e.eastM,e.northM],l=t.native==="geo"?a=>Math.round(a*1e7)/1e7:a=>Math.round(a*1e3)/1e3;this.positionOf(t)?.setAttribute("data-said",JSON.stringify(i??null)),n.edit(a=>{m.write(a,t.key,l(s)),m.write(a,t.secondKey,l(o)),m.write(a,t.saidKey,i)},t),this.changed(),this.sync()}setRow(t,e){const i=document.createElement("div");i.className="parameter-row";const n=this.read(t.hint);n&&(i.title=n);const s=document.createElement("span");return s.textContent=this.read(t.label)??t.key,i.append(s," ",e),i}syncSet(t,e,i,n){if(t.type!=="set")return;const s=m.read(i,t.key),o=new Set(Array.isArray(s)?s:[]),l=t.options(i,n);if(l.length===0){e.textContent=this.read(t.empty)??"";return}[...e.querySelectorAll("input")].map(r=>r.value).join(`
84
- `)===l.map(r=>r.value).join(`
85
- `)||e.replaceChildren(...l.map(r=>{const c=document.createElement("label"),d=document.createElement("input");return d.type="checkbox",d.value=r.value,c.append(d," ",r.label),c}));for(const r of e.querySelectorAll("input"))r.checked=o.has(r.value)}identify(t,e){t.dataset.key=e.key,this.idPrefix!==""&&(t.id=`${this.idPrefix}${e.key}`)}write(t,e){const i=this.target;if(!i)return;let n=e;if(t.type==="number"&&typeof e=="number"){const s=i.read();if(s){const o=M.boundsOf(t,s,i.context());n=Math.max(o.min,Math.min(o.max,e))/(t.scale??1)}}i.edit(s=>m.write(s,t.key,n),t),this.changed(),this.sync()}read(t){return this.said.read(t)}static boundsOf(t,e,i){const n=t.bounds?.(e,i);return{min:n?.min??t.min,max:n?.max??t.max}}static swatchOf(t,e){if(typeof t!="string")return e;const i=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);return i?`#${i[1]}${i[1]}${i[2]}${i[2]}${i[3]}${i[3]}`.toLowerCase():/^#[0-9a-f]{6}$/i.test(t)?t.toLowerCase():e}static shown(t,e){const i=Math.max(2,Math.min(6,(String(e.step).split(".")[1]??"").length));return String(Number((t*(e.scale??1)).toFixed(i)))}static choicesOf(t){return t.choices.map(e=>e.value)}}export{L as E,h as I,C as P,X as S,M as a,T as b,R as c};
@@ -1 +0,0 @@
1
- import{g as D,Q as A,X as b,Y as M,Z as p,$ as O,d as I,H as x,a0 as T,a1 as S,a2 as N,a3 as F}from"./rr0-scene.mjs";class h{static SEEK_BEYOND_S=.25;static SAME_FRAME_S=1/60;static CATCH_UP_SHARE=.1;static MIN_RATE=.0625;static MAX_RATE=16;static rollOfPicture(t){return t&&-t}static kindOfSource(t){if(t.type?.startsWith("video/"))return"video";if(t.type?.startsWith("image/"))return"photo";const i=t.url??"";if(i.startsWith("data:video/")||/\.(mp4|m4v|webm|ogv|mov)(?:[?#].*)?$/i.test(i))return"video";if(i.startsWith("data:image/")||/\.(jpe?g|png|gif|webp|avif)(?:[?#].*)?$/i.test(i))return"photo"}static mediaSecondsAt(t,i,s,a){const e=t.video?.fromS??0,o=t.video?.toS??a??Number.POSITIVE_INFINITY,n=i-(t.t??0);if(n<0)return;const r=e+n/(h.positive(s)*1e3)*h.rateOf(t);return r<=o?r:void 0}static rateOf(t){return h.positive(t.video?.rate??1)}static registrationAt(t,i){const s=t.registration,a=t.registrationTrack;if(!a||a.length===0)return s;let e=a.findIndex(E=>E.t>i);e===-1&&(e=a.length);const o=a[Math.max(e-1,0)],n=a[Math.min(e,a.length-1)],r=n.t>o.t?Math.min(Math.max((i-o.t)/(n.t-o.t),0),1):0,c=((n.headingDeg-o.headingDeg)%360+540)%360-180,f=o.rollDeg??0,y=n.rollDeg??0,v=f+(y-f)*r,w=o.fovDeg??s.fovDeg;return{headingDeg:((o.headingDeg+c*r)%360+360)%360,pitchDeg:o.pitchDeg+(n.pitchDeg-o.pitchDeg)*r,rollDeg:v===0?void 0:v,fovDeg:w+((n.fovDeg??s.fovDeg)-w)*r}}static keyIndexAt(t,i){return(t.registrationTrack??[]).findIndex(s=>Math.abs(s.t-i)<20)}static withKey(t,i,s){const a={t:i,...s},e=h.keyIndexAt(t,i),n=[...(t.registrationTrack??[]).filter((r,c)=>c!==e),e>=0?{...a,t:t.registrationTrack[e].t}:a].sort((r,c)=>r.t-c.t);return{...t,registrationTrack:n,registration:h.plainOf(n[0],t.registration)}}static withoutKey(t,i){const s=h.keyIndexAt(t,i);if(s<0)return t;const a=t.registrationTrack.filter((e,o)=>o!==s);return a.length===0?{...t,registrationTrack:void 0}:{...t,registrationTrack:a,registration:h.plainOf(a[0],t.registration)}}static plainOf(t,i){return{headingDeg:t.headingDeg,pitchDeg:t.pitchDeg,rollDeg:t.rollDeg,fovDeg:t.fovDeg??i.fovDeg}}static command(t,i,s,a){const e=Math.min(Math.max(a,h.MIN_RATE),h.MAX_RATE),o=i-t;if(!s)return{seekS:Math.abs(o)>h.SAME_FRAME_S?i:void 0,play:!1,rate:e};if(Math.abs(o)>h.SEEK_BEYOND_S)return{seekS:i,play:!0,rate:e};const n=Math.min(Math.max(o/h.SEEK_BEYOND_S,-1),1)*h.CATCH_UP_SHARE;return{play:!0,rate:Math.min(Math.max(e*(1+n),h.MIN_RATE),h.MAX_RATE)}}static positive(t){return t>0?t:1}}class u extends Error{constructor(t,i){super(`${t}: ${i.kind==="status"?i.status:i.kind}`),this.src=t,this.failure=i}}class g{static async blob(t){let i;try{i=await fetch(t)}catch{throw new u(t,await g.whyUnread(t))}if(!i.ok)throw new u(t,{kind:"status",status:i.status});const s=await i.blob();if(s.type&&!s.type.startsWith("image/"))throw new u(t,{kind:"notPicture"});return s}static failureOf(t){return t instanceof u?t.failure:{kind:"notPicture"}}static async whyVideoUnread(t){if(t.startsWith("data:")||t.startsWith("blob:"))return{kind:"notVideo"};let i;try{i=await fetch(t,{method:"HEAD"})}catch{return g.whyUnread(t)}return i.ok?{kind:"notVideo"}:{kind:"status",status:i.status}}static async whyUnread(t){try{return await fetch(t,{mode:"no-cors"}),{kind:"notShared"}}catch{return{kind:"unreachable"}}}}const k=3,m=800,l=Math.PI/180;class d{constructor(t,i,s=d.fetchImage,a=d.openVideo){this.scene=t,this.onImageLoaded=i,this.loadImage=s,this.loadVideo=a}meshes=new Map;signatures=new Map;images=new Map;loading=new Map;failed=new Map;references=[];views=new Map;shown=!0;observerAt;clock={t:0,playing:!1,timeScale:1};static PRESENT_WITHIN_M=2;static GONE_BEYOND_M=20;static presenceAt(t,i){if(!t.from||!i)return 1;const s=D(i.lat,i.lng,t.from.lat,t.from.lng),e=(Math.hypot(s.x,s.z)-d.PRESENT_WITHIN_M)/(d.GONE_BEYOND_M-d.PRESENT_WITHIN_M),o=Math.min(Math.max(e,0),1);return 1-o*o*(3-2*o)}set(t,i=this.views,s){this.references=t,this.observerAt=s,this.views=i;const a=new Set(t.map(e=>e.id));for(const[e,o]of this.meshes)a.has(e)||(this.dispose(o),this.meshes.delete(e),this.signatures.delete(e));for(const[e,o]of this.images){const n=t.find(c=>c.id===e);if(n&&n.src===o.texture.userData.src&&n.kind==="video"==(o.video!==void 0))continue;d.release(o),this.images.delete(e);const r=this.meshes.get(e);r&&(this.dispose(r),this.meshes.delete(e),this.signatures.delete(e))}for(const e of t){const o=this.images.get(e.id);if(!o){this.load(e);continue}this.build(e,o)}this.follow()}setTime(t){this.clock=t,this.follow()}setShown(t){this.shown=t;for(const i of this.meshes.values())i.visible=t&&this.opacityOf(i.userData.id)>0}setView(t,i){this.views.set(t,i);const s=this.meshes.get(t);s&&this.applyOpacity(s,t)}layer=k;get any(){for(const t of this.meshes.values())if(t.visible)return!0;return!1}place(t){const i=this.held;i&&t.getWorldQuaternion(this.cameraTurn);for(const s of this.meshes.values()){if(!s.visible)continue;s.position.copy(t.position);const a=i?.get(s);a&&s.quaternion.copy(this.cameraTurn).multiply(a),s.updateMatrixWorld()}}hold(t){t.getWorldQuaternion(this.cameraTurn);const i=this.cameraTurn.clone().invert();this.held=new Map([...this.meshes.values()].map(s=>[s,i.clone().multiply(s.quaternion)])),this.registered=new Map([...this.meshes.values()].map(s=>[s,s.quaternion.clone()]))}release(){if(this.held){for(const[t,i]of this.registered??[])t.quaternion.copy(i);this.held=void 0,this.registered=void 0}}registered;held;cameraTurn=new A;get furthestM(){return this.meshes.size>0?m:0}directionOfPixel(t,i,s,a){const e=this.images.get(t.id),o=e?e.width/e.height:1,n=h.registrationAt(t,this.clock.t),r=Math.tan(n.fovDeg/2*l),c=r*o;return a.set((i*2-1)*c,(1-s*2)*r,-1).normalize(),a.applyQuaternion(d.orientation(n))}aspectOf(t){const i=this.images.get(t);return i?i.width/i.height:void 0}failureOf(t){return this.failed.get(t)}follow(){for(const t of this.references){const i=this.meshes.get(t.id),s=this.images.get(t.id)?.video;s&&this.sync(t,s),i&&(t.registrationTrack?.length&&d.point(i,t,h.registrationAt(t,this.clock.t)),t.kind==="video"&&this.applyOpacity(i,t.id))}}sync(t,i){const s=h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,Number.isFinite(i.duration)?i.duration:void 0);if(s===void 0){i.paused||i.pause();return}const a=h.command(i.currentTime,s,this.clock.playing,h.rateOf(t));i.playbackRate=a.rate,a.seekS!==void 0&&!i.seeking&&(i.currentTime=a.seekS),a.play&&i.paused&&i.play().catch(()=>{}),!a.play&&!i.paused&&i.pause()}load(t){const i=t.src;if(this.loading.has(t.id)||this.failed.has(i))return;const s=t.kind==="video",e=(s?this.loadVideo(i,()=>this.onVideoFrame()):this.loadImage(i)).then(o=>{this.loading.delete(t.id);const n=this.references.find(r=>r.id===t.id);if(!n||n.src!==i||n.kind==="video"!==s){d.release(o);return}o.texture.userData.src=i,this.images.set(t.id,o),this.build(n,o),this.follow(),this.onImageLoaded()},o=>{this.loading.delete(t.id),this.failed.set(i,g.failureOf(o)),this.onImageLoaded()});this.loading.set(t.id,e)}onVideoFrame(){this.follow(),this.onFrame?.()}onFrame;static openVideo(t,i){return new Promise((s,a)=>{const e=document.createElement("video");e.crossOrigin="anonymous",e.muted=!0,e.playsInline=!0,e.preload="auto",e.addEventListener("loadeddata",()=>{const o=new b(e);o.colorSpace=M,o.minFilter=p,o.magFilter=p,o.generateMipmaps=!1,e.addEventListener("seeked",i);const n=()=>{e.paused&&i(),e.src&&e.requestVideoFrameCallback(n)};"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(n),s({texture:o,width:e.videoWidth,height:e.videoHeight,video:e})},{once:!0}),e.addEventListener("error",()=>{g.whyVideoUnread(t).then(o=>a(new u(t,o)))},{once:!0}),e.src=t})}static release(t){t.texture.dispose();const i=t.video;i&&(i.pause(),i.removeAttribute?.("src"),i.load?.())}static async fetchImage(t){const i=await g.blob(t),s=await createImageBitmap(i,{imageOrientation:"flipY"}).catch(()=>{throw new u(t,{kind:"notPicture"})}),a=new O(s);return a.flipY=!1,a.colorSpace=M,a.minFilter=p,a.magFilter=p,a.generateMipmaps=!1,a.needsUpdate=!0,{texture:a,width:s.width,height:s.height}}build(t,i){const s=d.signatureOf(t,i);let a=this.meshes.get(t.id);if(a&&this.signatures.get(t.id)===s){this.applyOpacity(a,t.id);return}a&&(this.dispose(a),this.meshes.delete(t.id)),a=new I(d.geometryOf(t,i),new x({map:i.texture,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1})),t.kind==="panorama"&&(a.material.side=T),a.frustumCulled=!1,a.layers.set(k),a.userData.id=t.id,d.point(a,t,h.registrationAt(t,this.clock.t)),this.scene.add(a),this.meshes.set(t.id,a),this.signatures.set(t.id,s),this.applyOpacity(a,t.id)}static geometryOf(t,i){if(t.kind==="panorama"){const o=new S(m,64,32,Math.PI/2,Math.PI*2),n=o.attributes.uv;for(let r=0;r<n.count;r++)n.setX(r,1-n.getX(r));return n.needsUpdate=!0,o}const s=2*m*Math.tan(t.registration.fovDeg/2*l),a=s*(i.width/Math.max(i.height,1)),e=new N(a,s);return e.translate(0,0,-m),e}static orientation({headingDeg:t,pitchDeg:i,rollDeg:s}){const a=new F;return a.rotation.set(i*l,-t*l,-(s??0)*l,"YXZ"),a.quaternion}static point(t,i,s){if(t.quaternion.copy(d.orientation(s)),i.kind==="panorama")return;const a=Math.tan(s.fovDeg/2*l)/Math.tan(i.registration.fovDeg/2*l);t.scale.set(a,a,1)}inTime(t){if(t.kind!=="video")return!0;const i=this.images.get(t.id)?.video?.duration;return h.mediaSecondsAt(t,this.clock.t,this.clock.timeScale,i!==void 0&&Number.isFinite(i)?i:void 0)!==void 0}opacityOf(t){const i=this.references.find(e=>e.id===t);if(i&&!this.inTime(i))return 0;const s=this.views.get(t),a=i?d.presenceAt(i,this.observerAt):1;return(s?.opacity??i?.opacity??0)*a}applyOpacity(t,i){const s=this.opacityOf(i);t.material.opacity=s,t.visible=this.shown&&s>0}static signatureOf(t,i){const{headingDeg:s,pitchDeg:a,rollDeg:e,fovDeg:o}=t.registration;return[t.kind,t.src,i.width,i.height,s,a,e??0,o].join("|")}dispose(t){this.scene.remove(t),t.geometry.dispose(),t.material.dispose()}disposeAll(){for(const t of this.meshes.values())this.dispose(t);this.meshes.clear(),this.signatures.clear();for(const t of this.images.values())d.release(t);this.images.clear()}}export{k as REFERENCE_LAYER,d as ReferenceSystem};