@shopware-ag/dive 2.0.2 → 2.1.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 (255) hide show
  1. package/README.md +0 -1
  2. package/build/chunks/{AssetCache-CuVztq_7.cjs → AssetCache-BQRROeKj.cjs} +1 -1
  3. package/build/chunks/{AssetCache-CiC4wZkh.mjs → AssetCache-D-tIG2cD.mjs} +1 -1
  4. package/build/chunks/{AssetLoader-DUhBw4FF.cjs → AssetLoader-CoPAaRfM.cjs} +1 -1
  5. package/build/chunks/{AssetLoader-o_4syRGj.mjs → AssetLoader-Da8hFXRL.mjs} +2 -2
  6. package/build/chunks/FileTypes-B2n185uW.cjs +29 -0
  7. package/build/chunks/FileTypes-CTHWb2IV.mjs +1878 -0
  8. package/build/chunks/PerspectiveCamera-8tnOn5YS.mjs +39 -0
  9. package/build/chunks/PerspectiveCamera-Dp8ElZGj.cjs +1 -0
  10. package/build/chunks/{SelectTool-6ZRGPwYE.mjs → SelectTool-Bcc2oxWf.mjs} +2 -2
  11. package/build/chunks/SelectTool-ut3Qwv63.cjs +1 -0
  12. package/build/{src/components → components}/index.d.ts +1 -0
  13. package/build/{src/components → components}/model/Model.d.ts +3 -2
  14. package/build/dive.cjs +1 -1
  15. package/build/dive.d.ts +1 -1
  16. package/build/dive.mjs +69 -68
  17. package/build/engine/AsciiArt.d.ts +1 -0
  18. package/build/engine/Dive.d.ts +98 -0
  19. package/build/{src/engine → engine}/camera/PerspectiveCamera.d.ts +1 -0
  20. package/build/{src/engine → engine}/clock/Clock.d.ts +1 -4
  21. package/build/{src/engine → engine}/index.d.ts +2 -1
  22. package/build/{src/engine → engine}/renderer/Renderer.d.ts +12 -5
  23. package/build/{src/engine → engine}/resize/ResizeManager.d.ts +5 -2
  24. package/build/engine/scene/Scene.d.ts +41 -0
  25. package/build/{src/engine → engine}/scene/xrroot/XRRoot.d.ts +2 -2
  26. package/build/{src/engine → engine}/scene/xrroot/xrlightroot/XRLightRoot.d.ts +2 -2
  27. package/build/engine/view/View.d.ts +24 -0
  28. package/build/{src/index.d.ts → index.d.ts} +1 -1
  29. package/build/plugins/animation/index.cjs +1 -1
  30. package/build/plugins/animation/index.d.ts +2 -2
  31. package/build/plugins/animation/index.mjs +11 -11
  32. package/build/plugins/ar/index.cjs +1 -1
  33. package/build/plugins/ar/index.d.ts +4 -2
  34. package/build/plugins/ar/index.mjs +27 -27
  35. package/build/{src/plugins → plugins}/ar/src/webxr/WebXR.d.ts +2 -2
  36. package/build/{src/plugins → plugins}/ar/src/webxr/controller/WebXRController.d.ts +2 -2
  37. package/build/{src/plugins → plugins}/ar/src/webxr/origin/WebXROrigin.d.ts +2 -2
  38. package/build/{src/plugins → plugins}/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +2 -2
  39. package/build/{src/plugins → plugins}/ar/src/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +2 -2
  40. package/build/{src/plugins → plugins}/ar/src/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +2 -2
  41. package/build/plugins/assetcache/index.cjs +1 -1
  42. package/build/plugins/assetcache/index.d.ts +1 -2
  43. package/build/plugins/assetcache/index.mjs +1 -1
  44. package/build/plugins/assetconverter/index.d.ts +1 -2
  45. package/build/plugins/assetexporter/index.d.ts +1 -2
  46. package/build/plugins/assetloader/index.cjs +1 -1
  47. package/build/plugins/assetloader/index.d.ts +3 -2
  48. package/build/plugins/assetloader/index.mjs +1 -1
  49. package/build/plugins/mediacreator/index.cjs +1 -1
  50. package/build/plugins/mediacreator/index.d.ts +2 -2
  51. package/build/plugins/mediacreator/index.mjs +8 -8
  52. package/build/{src/plugins → plugins}/mediacreator/src/MediaCreator.d.ts +2 -2
  53. package/build/plugins/orbitcontroller/index.cjs +1 -1
  54. package/build/plugins/orbitcontroller/index.d.ts +1 -2
  55. package/build/plugins/orbitcontroller/index.mjs +1 -1
  56. package/build/plugins/orbitcontroller/src/OrbitController.d.ts +195 -0
  57. package/build/plugins/orbitcontroller/types/OrbitControllerState.types.d.ts +9 -0
  58. package/build/plugins/orbitcontroller/types/index.d.ts +1 -0
  59. package/build/plugins/orientationdisplay/index.cjs +1 -1
  60. package/build/plugins/orientationdisplay/index.d.ts +2 -2
  61. package/build/plugins/orientationdisplay/index.mjs +1 -1
  62. package/build/{src/plugins → plugins}/orientationdisplay/src/OrientationDisplay.d.ts +2 -2
  63. package/build/plugins/quickview/index.cjs +1 -0
  64. package/build/plugins/quickview/index.d.ts +2 -0
  65. package/build/plugins/quickview/index.mjs +28 -0
  66. package/build/plugins/quickview/src/QuickView.d.ts +14 -0
  67. package/build/plugins/quickview/types/QuickViewSettings.d.ts +4 -0
  68. package/build/plugins/quickview/types/index.d.ts +1 -0
  69. package/build/plugins/state/index.cjs +7 -7
  70. package/build/plugins/state/index.d.ts +4 -2
  71. package/build/plugins/state/index.mjs +498 -500
  72. package/build/{src/plugins → plugins}/state/src/State.d.ts +2 -2
  73. package/build/{src/plugins → plugins}/state/src/actions/media/generatemedia.d.ts +1 -1
  74. package/build/{src/plugins → plugins}/state/types/ActionTypes.d.ts +2 -2
  75. package/build/plugins/systeminfo/index.d.ts +2 -2
  76. package/build/plugins/toolbox/index.cjs +1 -1
  77. package/build/plugins/toolbox/index.d.ts +5 -2
  78. package/build/plugins/toolbox/index.mjs +2 -2
  79. package/package.json +6 -1
  80. package/build/chunks/FileTypes-B2VTJIm5.cjs +0 -30
  81. package/build/chunks/FileTypes-C8pTXmiC.mjs +0 -1059
  82. package/build/chunks/MathUtils-CBW56ZuG.cjs +0 -1
  83. package/build/chunks/MathUtils-CFGjHuVF.mjs +0 -159
  84. package/build/chunks/OrbitController-BQ6SV1O_.mjs +0 -1159
  85. package/build/chunks/OrbitController-CpFQ3A1H.cjs +0 -1
  86. package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +0 -1
  87. package/build/chunks/PerspectiveCamera-PMJPzAn3.mjs +0 -34
  88. package/build/chunks/SelectTool-B1awJ9PA.cjs +0 -1
  89. package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +0 -1
  90. package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +0 -8
  91. package/build/chunks/package-AmvzOXm_.cjs +0 -1
  92. package/build/chunks/package-BrpVRfq7.mjs +0 -39
  93. package/build/src/core/Dive.d.ts +0 -58
  94. package/build/src/core/index.d.ts +0 -1
  95. package/build/src/engine/Engine.d.ts +0 -28
  96. package/build/src/engine/scene/Scene.d.ts +0 -19
  97. package/build/src/plugins/animation/index.d.ts +0 -2
  98. package/build/src/plugins/ar/index.d.ts +0 -4
  99. package/build/src/plugins/assetcache/index.d.ts +0 -1
  100. package/build/src/plugins/assetconverter/index.d.ts +0 -1
  101. package/build/src/plugins/assetexporter/index.d.ts +0 -1
  102. package/build/src/plugins/assetloader/index.d.ts +0 -3
  103. package/build/src/plugins/mediacreator/index.d.ts +0 -2
  104. package/build/src/plugins/orbitcontroller/index.d.ts +0 -1
  105. package/build/src/plugins/orbitcontroller/src/OrbitController.d.ts +0 -45
  106. package/build/src/plugins/orientationdisplay/index.d.ts +0 -2
  107. package/build/src/plugins/state/index.d.ts +0 -4
  108. package/build/src/plugins/systeminfo/index.d.ts +0 -2
  109. package/build/src/plugins/toolbox/index.d.ts +0 -5
  110. /package/build/{src/components → components}/boundingbox/BoundingBox.d.ts +0 -0
  111. /package/build/{src/components → components}/floor/Floor.d.ts +0 -0
  112. /package/build/{src/components → components}/gizmo/Gizmo.d.ts +0 -0
  113. /package/build/{src/components → components}/gizmo/handles/AxisHandle.d.ts +0 -0
  114. /package/build/{src/components → components}/gizmo/handles/RadialHandle.d.ts +0 -0
  115. /package/build/{src/components → components}/gizmo/handles/ScaleHandle.d.ts +0 -0
  116. /package/build/{src/components → components}/gizmo/plane/GizmoPlane.d.ts +0 -0
  117. /package/build/{src/components → components}/gizmo/rotate/RotateGizmo.d.ts +0 -0
  118. /package/build/{src/components → components}/gizmo/scale/ScaleGizmo.d.ts +0 -0
  119. /package/build/{src/components → components}/gizmo/translate/TranslateGizmo.d.ts +0 -0
  120. /package/build/{src/components → components}/grid/Grid.d.ts +0 -0
  121. /package/build/{src/components → components}/group/Group.d.ts +0 -0
  122. /package/build/{src/components → components}/light/AmbientLight.d.ts +0 -0
  123. /package/build/{src/components → components}/light/PointLight.d.ts +0 -0
  124. /package/build/{src/components → components}/light/SceneLight.d.ts +0 -0
  125. /package/build/{src/components → components}/light/index.d.ts +0 -0
  126. /package/build/{src/components → components}/node/Node.d.ts +0 -0
  127. /package/build/{src/components → components}/primitive/Primitive.d.ts +0 -0
  128. /package/build/{src/components → components}/root/Root.d.ts +0 -0
  129. /package/build/{src/constants → constants}/AxisHelperColors.d.ts +0 -0
  130. /package/build/{src/constants → constants}/GridColors.d.ts +0 -0
  131. /package/build/{src/constants → constants}/VisibilityLayerMask.d.ts +0 -0
  132. /package/build/{src/constants → constants}/index.d.ts +0 -0
  133. /package/build/{src/error → error}/file-content/file-content-error.d.ts +0 -0
  134. /package/build/{src/error → error}/file-type/file-type-error.d.ts +0 -0
  135. /package/build/{src/error → error}/index.d.ts +0 -0
  136. /package/build/{src/error → error}/network/network-error.d.ts +0 -0
  137. /package/build/{src/error → error}/parse/parse-error.d.ts +0 -0
  138. /package/build/{src/events → events}/dispatcher/EventDispatcher.d.ts +0 -0
  139. /package/build/{src/events → events}/index.d.ts +0 -0
  140. /package/build/{src/helpers → helpers}/applyMixins/applyMixins.d.ts +0 -0
  141. /package/build/{src/helpers → helpers}/deepClone/deepClone.d.ts +0 -0
  142. /package/build/{src/helpers → helpers}/findInterface/findInterface.d.ts +0 -0
  143. /package/build/{src/helpers → helpers}/findSceneRecursive/findSceneRecursive.d.ts +0 -0
  144. /package/build/{src/helpers → helpers}/getFileTypeFromUri/getFileTypeFromUri.d.ts +0 -0
  145. /package/build/{src/helpers → helpers}/getObjectDelta/getObjectDelta.d.ts +0 -0
  146. /package/build/{src/helpers → helpers}/implementsInterface/implementsInterface.d.ts +0 -0
  147. /package/build/{src/helpers → helpers}/index.d.ts +0 -0
  148. /package/build/{src/helpers → helpers}/isFileTypeSupported/isFileTypeSupported.d.ts +0 -0
  149. /package/build/{src/helpers → helpers}/math/ceil/ceilExp.d.ts +0 -0
  150. /package/build/{src/helpers → helpers}/math/degToRad/degToRad.d.ts +0 -0
  151. /package/build/{src/helpers → helpers}/math/floor/floorExp.d.ts +0 -0
  152. /package/build/{src/helpers → helpers}/math/helper/shift.d.ts +0 -0
  153. /package/build/{src/helpers → helpers}/math/index.d.ts +0 -0
  154. /package/build/{src/helpers → helpers}/math/radToDeg/radToDeg.d.ts +0 -0
  155. /package/build/{src/helpers → helpers}/math/round/roundExp.d.ts +0 -0
  156. /package/build/{src/helpers → helpers}/math/signedAngleTo/signedAngleTo.d.ts +0 -0
  157. /package/build/{src/helpers → helpers}/math/toFixed/toFixedExp.d.ts +0 -0
  158. /package/build/{src/helpers → helpers}/math/truncate/truncateExp.d.ts +0 -0
  159. /package/build/{src/interfaces → interfaces}/Draggable.d.ts +0 -0
  160. /package/build/{src/interfaces → interfaces}/Hoverable.d.ts +0 -0
  161. /package/build/{src/interfaces → interfaces}/Movable.d.ts +0 -0
  162. /package/build/{src/interfaces → interfaces}/Rotatable.d.ts +0 -0
  163. /package/build/{src/interfaces → interfaces}/Scalable.d.ts +0 -0
  164. /package/build/{src/interfaces → interfaces}/Selectable.d.ts +0 -0
  165. /package/build/{src/interfaces → interfaces}/index.d.ts +0 -0
  166. /package/build/{src/plugins → plugins}/animation/src/animator/Animator.d.ts +0 -0
  167. /package/build/{src/plugins → plugins}/animation/src/index.d.ts +0 -0
  168. /package/build/{src/plugins → plugins}/animation/src/system/AnimationSystem.d.ts +0 -0
  169. /package/build/{src/plugins → plugins}/animation/src/types/AnimatorParameters.d.ts +0 -0
  170. /package/build/{src/plugins → plugins}/ar/src/ARSystem.d.ts +0 -0
  171. /package/build/{src/plugins → plugins}/ar/src/arquicklook/ARQuickLook.d.ts +0 -0
  172. /package/build/{src/plugins → plugins}/ar/src/error/ar-errors.d.ts +0 -0
  173. /package/build/{src/plugins → plugins}/ar/src/sceneviewer/SceneViewer.d.ts +0 -0
  174. /package/build/{src/plugins → plugins}/ar/src/webxr/crosshair/WebXRCrosshair.d.ts +0 -0
  175. /package/build/{src/plugins → plugins}/ar/src/webxr/overlay/Overlay.d.ts +0 -0
  176. /package/build/{src/plugins → plugins}/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +0 -0
  177. /package/build/{src/plugins → plugins}/assetcache/src/cache/AssetCache.d.ts +0 -0
  178. /package/build/{src/plugins → plugins}/assetcache/src/chunk/Chunk.d.ts +0 -0
  179. /package/build/{src/plugins → plugins}/assetcache/src/index.d.ts +0 -0
  180. /package/build/{src/plugins → plugins}/assetconverter/src/AssetConverter.d.ts +0 -0
  181. /package/build/{src/plugins → plugins}/assetexporter/src/AssetExporter.d.ts +0 -0
  182. /package/build/{src/plugins → plugins}/assetloader/src/draco/DracoLoader.d.ts +0 -0
  183. /package/build/{src/plugins → plugins}/assetloader/src/loader/AssetLoader.d.ts +0 -0
  184. /package/build/{src/plugins → plugins}/mediacreator/types/MediaGenerationById.d.ts +0 -0
  185. /package/build/{src/plugins → plugins}/mediacreator/types/MediaGenerationByPosition.d.ts +0 -0
  186. /package/build/{src/plugins → plugins}/mediacreator/types/MediaGenerationResolution.d.ts +0 -0
  187. /package/build/{src/plugins → plugins}/mediacreator/types/index.d.ts +0 -0
  188. /package/build/{src/plugins → plugins}/orientationdisplay/src/axes/Axes.d.ts +0 -0
  189. /package/build/{src/plugins → plugins}/state/src/ActionRegistry.d.ts +0 -0
  190. /package/build/{src/plugins → plugins}/state/src/actions/action.d.ts +0 -0
  191. /package/build/{src/plugins → plugins}/state/src/actions/ar/index.d.ts +0 -0
  192. /package/build/{src/plugins → plugins}/state/src/actions/ar/launchar.d.ts +0 -0
  193. /package/build/{src/plugins → plugins}/state/src/actions/camera/computeencompassingview.d.ts +0 -0
  194. /package/build/{src/plugins → plugins}/state/src/actions/camera/getcameratransform.d.ts +0 -0
  195. /package/build/{src/plugins → plugins}/state/src/actions/camera/index.d.ts +0 -0
  196. /package/build/{src/plugins → plugins}/state/src/actions/camera/lockcamera.d.ts +0 -0
  197. /package/build/{src/plugins → plugins}/state/src/actions/camera/movecamera.d.ts +0 -0
  198. /package/build/{src/plugins → plugins}/state/src/actions/camera/setcameralayer.d.ts +0 -0
  199. /package/build/{src/plugins → plugins}/state/src/actions/camera/setcameratransform.d.ts +0 -0
  200. /package/build/{src/plugins → plugins}/state/src/actions/camera/zoomcamera.d.ts +0 -0
  201. /package/build/{src/plugins → plugins}/state/src/actions/index.d.ts +0 -0
  202. /package/build/{src/plugins → plugins}/state/src/actions/media/index.d.ts +0 -0
  203. /package/build/{src/plugins → plugins}/state/src/actions/object/addobject.d.ts +0 -0
  204. /package/build/{src/plugins → plugins}/state/src/actions/object/deleteobject.d.ts +0 -0
  205. /package/build/{src/plugins → plugins}/state/src/actions/object/deselectobject.d.ts +0 -0
  206. /package/build/{src/plugins → plugins}/state/src/actions/object/dropit.d.ts +0 -0
  207. /package/build/{src/plugins → plugins}/state/src/actions/object/getallobjects.d.ts +0 -0
  208. /package/build/{src/plugins → plugins}/state/src/actions/object/getobjects.d.ts +0 -0
  209. /package/build/{src/plugins → plugins}/state/src/actions/object/index.d.ts +0 -0
  210. /package/build/{src/plugins → plugins}/state/src/actions/object/modelloaded.d.ts +0 -0
  211. /package/build/{src/plugins → plugins}/state/src/actions/object/placeonfloor.d.ts +0 -0
  212. /package/build/{src/plugins → plugins}/state/src/actions/object/selectobject.d.ts +0 -0
  213. /package/build/{src/plugins → plugins}/state/src/actions/object/setparent.d.ts +0 -0
  214. /package/build/{src/plugins → plugins}/state/src/actions/object/updateobject.d.ts +0 -0
  215. /package/build/{src/plugins → plugins}/state/src/actions/renderer/index.d.ts +0 -0
  216. /package/build/{src/plugins → plugins}/state/src/actions/renderer/startrender.d.ts +0 -0
  217. /package/build/{src/plugins → plugins}/state/src/actions/scene/exportscene.d.ts +0 -0
  218. /package/build/{src/plugins → plugins}/state/src/actions/scene/getallscenedata.d.ts +0 -0
  219. /package/build/{src/plugins → plugins}/state/src/actions/scene/index.d.ts +0 -0
  220. /package/build/{src/plugins → plugins}/state/src/actions/scene/setbackground.d.ts +0 -0
  221. /package/build/{src/plugins → plugins}/state/src/actions/scene/updatescene.d.ts +0 -0
  222. /package/build/{src/plugins → plugins}/state/src/actions/toolbox/index.d.ts +0 -0
  223. /package/build/{src/plugins → plugins}/state/src/actions/toolbox/setgizmomode.d.ts +0 -0
  224. /package/build/{src/plugins → plugins}/state/src/actions/toolbox/setgizmoscalelinked.d.ts +0 -0
  225. /package/build/{src/plugins → plugins}/state/src/actions/toolbox/setgizmovisible.d.ts +0 -0
  226. /package/build/{src/plugins → plugins}/state/src/actions/toolbox/usetool.d.ts +0 -0
  227. /package/build/{src/plugins → plugins}/state/types/StateExportFileType.d.ts +0 -0
  228. /package/build/{src/plugins → plugins}/state/types/StateSceneData.d.ts +0 -0
  229. /package/build/{src/plugins → plugins}/state/types/index.d.ts +0 -0
  230. /package/build/{src/plugins → plugins}/systeminfo/src/SystemInfo.d.ts +0 -0
  231. /package/build/{src/plugins → plugins}/systeminfo/types/index.d.ts +0 -0
  232. /package/build/{src/plugins → plugins}/toolbox/src/BaseTool.d.ts +0 -0
  233. /package/build/{src/plugins → plugins}/toolbox/src/Toolbox.d.ts +0 -0
  234. /package/build/{src/plugins → plugins}/toolbox/src/select/SelectTool.d.ts +0 -0
  235. /package/build/{src/plugins → plugins}/toolbox/src/transform/TransformTool.d.ts +0 -0
  236. /package/build/{src/plugins → plugins}/toolbox/types/ToolType.d.ts +0 -0
  237. /package/build/{src/plugins → plugins}/toolbox/types/index.d.ts +0 -0
  238. /package/build/{src/types → types}/components/DIVELight.d.ts +0 -0
  239. /package/build/{src/types → types}/components/DIVESceneObject.d.ts +0 -0
  240. /package/build/{src/types → types}/components/index.d.ts +0 -0
  241. /package/build/{src/types → types}/file/FileTypes.d.ts +0 -0
  242. /package/build/{src/types → types}/file/index.d.ts +0 -0
  243. /package/build/{src/types → types}/index.d.ts +0 -0
  244. /package/build/{src/types → types}/schema/BaseEntitySchema.d.ts +0 -0
  245. /package/build/{src/types → types}/schema/EntitySchema.d.ts +0 -0
  246. /package/build/{src/types → types}/schema/EntityTypeSchema.d.ts +0 -0
  247. /package/build/{src/types → types}/schema/GeometrySchema.d.ts +0 -0
  248. /package/build/{src/types → types}/schema/GeometryTypeSchema.d.ts +0 -0
  249. /package/build/{src/types → types}/schema/GroupSchema.d.ts +0 -0
  250. /package/build/{src/types → types}/schema/LightSchema.d.ts +0 -0
  251. /package/build/{src/types → types}/schema/MaterialSchema.d.ts +0 -0
  252. /package/build/{src/types → types}/schema/ModelSchema.d.ts +0 -0
  253. /package/build/{src/types → types}/schema/PovSchema.d.ts +0 -0
  254. /package/build/{src/types → types}/schema/PrimitiveSchema.d.ts +0 -0
  255. /package/build/{src/types → types}/schema/index.d.ts +0 -0
@@ -0,0 +1,1878 @@
1
+ var J = Object.defineProperty;
2
+ var $ = (r, n, t) => n in r ? J(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var i = (r, n, t) => $(r, typeof n != "symbol" ? n + "" : n, t);
4
+ import { WebGLRenderer as j, PCFSoftShadowMap as tt, PCFShadowMap as et, BasicShadowMap as it, MathUtils as E, Object3D as w, AmbientLight as st, PointLight as nt, SphereGeometry as T, MeshBasicMaterial as z, FrontSide as G, Mesh as S, HemisphereLight as at, DirectionalLight as ot, Vector3 as h, Box3 as I, MeshStandardMaterial as L, Raycaster as F, Color as g, CylinderGeometry as rt, BufferGeometry as U, BufferAttribute as V, BoxGeometry as v, ConeGeometry as ht, LineDashedMaterial as lt, Line as dt, PlaneGeometry as ct, GridHelper as ut, Scene as pt, TOUCH as f, MOUSE as m, EventDispatcher as mt, Spherical as A, Vector2 as p, Quaternion as x, AxesHelper as gt, Matrix4 as _t, OrthographicCamera as ft, Vector4 as wt, Box3Helper as yt, Sphere as bt } from "three";
5
+ import { P as _, U as Dt, H as Et, C as y, a as St, D as C } from "./PerspectiveCamera-8tnOn5YS.mjs";
6
+ import M from "three-spritetext";
7
+ class Pt {
8
+ constructor() {
9
+ i(this, "isDIVEClock", !0);
10
+ i(this, "_lastTime", 0);
11
+ i(this, "_isRunning", !1);
12
+ i(this, "_tickers", []);
13
+ }
14
+ start() {
15
+ this._isRunning || (this._isRunning = !0, this._lastTime = performance.now(), requestAnimationFrame(this._tick.bind(this)));
16
+ }
17
+ stop() {
18
+ this._isRunning = !1;
19
+ }
20
+ addTicker(n) {
21
+ this._tickers.find((t) => t.uuid === n.uuid) || this._tickers.push(n);
22
+ }
23
+ hasTicker(n) {
24
+ return this._tickers.find((t) => t.uuid === n.uuid) !== void 0;
25
+ }
26
+ removeTicker(n) {
27
+ const t = this._tickers.findIndex((e) => e.uuid === n.uuid);
28
+ t !== -1 && this._tickers.splice(t, 1);
29
+ }
30
+ dispose() {
31
+ this.stop(), this._tickers = [], this._isRunning = !1, this._lastTime = 0;
32
+ }
33
+ _tick(n) {
34
+ if (!this._isRunning) return;
35
+ const t = (n - this._lastTime) / 1e3;
36
+ this._lastTime = n, this._tickers.forEach((e) => e.tick(t)), requestAnimationFrame(this._tick.bind(this));
37
+ }
38
+ }
39
+ const H = {
40
+ canvas: void 0,
41
+ antialias: !0,
42
+ alpha: !0,
43
+ powerPreference: "high-performance",
44
+ precision: "highp",
45
+ stencil: !1,
46
+ depth: !0,
47
+ logarithmicDepthBuffer: !1,
48
+ shadows: !0,
49
+ shadowQuality: "high"
50
+ };
51
+ class Y {
52
+ constructor(n, t, e) {
53
+ i(this, "isDIVERenderer", !0);
54
+ i(this, "_webglrenderer");
55
+ i(this, "_settings");
56
+ this._scene = n, this._camera = t, this._settings = {
57
+ ...H,
58
+ ...e ?? {}
59
+ }, this._webglrenderer = this._createWebGLRenderer();
60
+ }
61
+ get webglrenderer() {
62
+ return this._webglrenderer;
63
+ }
64
+ get canvas() {
65
+ return this._webglrenderer.domElement;
66
+ }
67
+ render() {
68
+ this._webglrenderer.render(this._scene, this._camera);
69
+ }
70
+ onResize(n, t) {
71
+ this._webglrenderer.setSize(n, t, !1);
72
+ }
73
+ dispose() {
74
+ this._webglrenderer.dispose();
75
+ }
76
+ setCanvas(n) {
77
+ this._webglrenderer.dispose(), this._settings.canvas = n, this._webglrenderer = this._createWebGLRenderer();
78
+ }
79
+ _createWebGLRenderer() {
80
+ const n = new j(this._settings);
81
+ return n.shadowMap.enabled = this._settings.shadows, n.shadowMap.type = this._settings.shadowQuality === "high" ? tt : this._settings.shadowQuality === "medium" ? et : it, n.setPixelRatio(window.devicePixelRatio), n;
82
+ }
83
+ }
84
+ const te = Y;
85
+ class vt {
86
+ constructor(n, t) {
87
+ i(this, "isDIVEResizeManager", !0);
88
+ i(this, "_resizeObserver");
89
+ i(this, "_width", 0);
90
+ i(this, "_height", 0);
91
+ this._renderer = n, this._camera = t, this._resizeObserver = new ResizeObserver((e) => {
92
+ const s = e[0], { width: a, height: o } = s.contentRect;
93
+ a === this._width && o === this._height || (this._renderer.onResize(a, o), this._camera.onResize(a, o), this._width = a, this._height = o);
94
+ }), this._observeCanvas(this._renderer.canvas);
95
+ }
96
+ setCanvas(n) {
97
+ this._resizeObserver.disconnect(), this._observeCanvas(n);
98
+ const { width: t, height: e } = n.getBoundingClientRect();
99
+ this._renderer.onResize(t, e), this._camera.onResize(t, e), this._width = t, this._height = e;
100
+ }
101
+ dispose() {
102
+ this._resizeObserver.disconnect();
103
+ }
104
+ _observeCanvas(n) {
105
+ if (n.parentElement)
106
+ this._resizeObserver.observe(n.parentElement);
107
+ else {
108
+ const t = setInterval(() => {
109
+ n.parentElement && (this._resizeObserver.observe(n.parentElement), clearInterval(t));
110
+ }, 16);
111
+ }
112
+ }
113
+ }
114
+ class O {
115
+ constructor(n, t, e) {
116
+ i(this, "isDIVEView", !0);
117
+ i(this, "uuid", E.generateUUID());
118
+ i(this, "_paused", !1);
119
+ i(this, "_renderer");
120
+ i(this, "_resizeManager");
121
+ this._scene = n, this._camera = t, this._settings = e, this._renderer = new Y(
122
+ this._scene,
123
+ this._camera,
124
+ this._settings
125
+ ), this._resizeManager = new vt(
126
+ this._renderer,
127
+ this._camera
128
+ );
129
+ }
130
+ get renderer() {
131
+ return this._renderer;
132
+ }
133
+ get camera() {
134
+ return this._camera;
135
+ }
136
+ get canvas() {
137
+ return this._renderer.canvas;
138
+ }
139
+ tick() {
140
+ this._paused || this._renderer.render();
141
+ }
142
+ dispose() {
143
+ this._resizeManager.dispose(), this._renderer.dispose();
144
+ }
145
+ onResize(n, t) {
146
+ this._renderer.onResize(n, t), this._camera.onResize(n, t);
147
+ }
148
+ setCanvas(n) {
149
+ this._renderer.setCanvas(n), this._resizeManager.setCanvas(n), this.onResize(
150
+ this._renderer.canvas.clientWidth,
151
+ this._renderer.canvas.clientHeight
152
+ );
153
+ }
154
+ // TODO: add methods to individually pause and resume the view
155
+ pause() {
156
+ this._paused = !0;
157
+ }
158
+ resume() {
159
+ this._paused = !1;
160
+ }
161
+ }
162
+ class Mt extends w {
163
+ constructor() {
164
+ super();
165
+ i(this, "isDIVELight", !0);
166
+ i(this, "isDIVEAmbientLight", !0);
167
+ i(this, "isSelectable", !0);
168
+ i(this, "_light");
169
+ this.name = "DIVEAmbientLight", this._light = new st(16777215, 1), this._light.layers.mask = _, this.add(this._light);
170
+ }
171
+ setColor(t) {
172
+ this._light.color = t;
173
+ }
174
+ setIntensity(t) {
175
+ this._light.intensity = t;
176
+ }
177
+ setEnabled(t) {
178
+ this._light.visible = t;
179
+ }
180
+ }
181
+ class xt extends w {
182
+ constructor() {
183
+ super();
184
+ i(this, "isDIVELight", !0);
185
+ i(this, "isDIVEPointLight", !0);
186
+ i(this, "isMovable", !0);
187
+ i(this, "isSelectable", !0);
188
+ i(this, "gizmo", null);
189
+ i(this, "light");
190
+ i(this, "mesh");
191
+ this.name = "DIVEPointLight", this.light = new nt(16777215, 1), this.light.layers.mask = _, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
192
+ const t = 0.1, e = new T(
193
+ t,
194
+ t * 320,
195
+ t * 320
196
+ ), s = new z({
197
+ color: this.light.color,
198
+ transparent: !0,
199
+ opacity: 0.8,
200
+ side: G
201
+ });
202
+ this.mesh = new S(e, s), this.mesh.layers.mask = Dt, this.add(this.mesh);
203
+ }
204
+ setColor(t) {
205
+ this.light.color = t, this.mesh.material.color = t;
206
+ }
207
+ setIntensity(t) {
208
+ this.light.intensity = t, this.mesh.material.opacity = t > 0.8 ? 0.8 : t * 0.8;
209
+ }
210
+ setEnabled(t) {
211
+ this.light.visible = t;
212
+ }
213
+ onMove() {
214
+ import("../plugins/state/index.mjs").then(({ State: t }) => {
215
+ var e;
216
+ (e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
217
+ id: this.userData.id,
218
+ position: this.position
219
+ });
220
+ });
221
+ }
222
+ onSelect() {
223
+ import("../plugins/state/index.mjs").then(({ State: t }) => {
224
+ var e;
225
+ (e = t.get(this.userData.id)) == null || e.performAction("SELECT_OBJECT", {
226
+ id: this.userData.id
227
+ });
228
+ });
229
+ }
230
+ onDeselect() {
231
+ import("../plugins/state/index.mjs").then(({ State: t }) => {
232
+ var e;
233
+ (e = t.get(this.userData.id)) == null || e.performAction("DESELECT_OBJECT", {
234
+ id: this.userData.id
235
+ });
236
+ });
237
+ }
238
+ }
239
+ class Tt extends w {
240
+ constructor() {
241
+ super();
242
+ i(this, "isDIVELight", !0);
243
+ i(this, "isDIVESceneLight", !0);
244
+ i(this, "isSelectable", !0);
245
+ i(this, "_hemiLight");
246
+ i(this, "_dirLight");
247
+ this.name = "DIVESceneLight", this._hemiLight = new at(16777215, 16777215, 2), this._hemiLight.layers.mask = _, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new ot(16777215, 3), this._dirLight.layers.mask = _, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
248
+ const t = 5;
249
+ this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = t, this._dirLight.shadow.camera.top = t, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
250
+ }
251
+ setColor(t) {
252
+ this._hemiLight.color = t, this._dirLight.color = t;
253
+ }
254
+ setIntensity(t) {
255
+ this._hemiLight.intensity = t * 2, this._dirLight.intensity = t * 3;
256
+ }
257
+ setEnabled(t) {
258
+ this._hemiLight.visible = t, this._dirLight.visible = t;
259
+ }
260
+ }
261
+ const k = (r) => r.parent ? k(r.parent) : r;
262
+ class P extends w {
263
+ constructor() {
264
+ super();
265
+ i(this, "isSelectable", !0);
266
+ i(this, "isMovable", !0);
267
+ i(this, "isDIVENode", !0);
268
+ i(this, "gizmo", null);
269
+ i(this, "_positionWorldBuffer");
270
+ i(this, "_boundingBox");
271
+ this.layers.mask = _, this._positionWorldBuffer = new h(), this._boundingBox = new I();
272
+ }
273
+ setPosition(t) {
274
+ if (!this.parent) {
275
+ this.position.set(t.x, t.y, t.z);
276
+ return;
277
+ }
278
+ const e = new h(t.x, t.y, t.z);
279
+ this.position.copy(this.parent.worldToLocal(e)), "isDIVEGroup" in this.parent && this.parent.updateLineTo(this);
280
+ }
281
+ setRotation(t) {
282
+ this.rotation.set(t.x, t.y, t.z);
283
+ }
284
+ setScale(t) {
285
+ this.scale.set(t.x, t.y, t.z);
286
+ }
287
+ setVisibility(t) {
288
+ this.visible = t;
289
+ }
290
+ setToWorldOrigin() {
291
+ this.position.set(0, 0, 0), import("../plugins/state/index.mjs").then(({ State: t }) => {
292
+ var e;
293
+ (e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
294
+ id: this.userData.id,
295
+ position: this.getWorldPosition(this._positionWorldBuffer),
296
+ rotation: this.rotation,
297
+ scale: this.scale
298
+ });
299
+ });
300
+ }
301
+ /**
302
+ * Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
303
+ */
304
+ onMove() {
305
+ import("../plugins/state/index.mjs").then(({ State: t }) => {
306
+ var e;
307
+ (e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
308
+ id: this.userData.id,
309
+ position: this.getWorldPosition(this._positionWorldBuffer),
310
+ rotation: this.rotation,
311
+ scale: this.scale
312
+ });
313
+ });
314
+ }
315
+ onSelect() {
316
+ import("../plugins/state/index.mjs").then(({ State: t }) => {
317
+ var e;
318
+ (e = t.get(this.userData.id)) == null || e.performAction("SELECT_OBJECT", {
319
+ id: this.userData.id
320
+ });
321
+ });
322
+ }
323
+ onDeselect() {
324
+ import("../plugins/state/index.mjs").then(({ State: t }) => {
325
+ var e;
326
+ (e = t.get(this.userData.id)) == null || e.performAction("DESELECT_OBJECT", {
327
+ id: this.userData.id
328
+ });
329
+ });
330
+ }
331
+ }
332
+ class It extends P {
333
+ constructor() {
334
+ super();
335
+ i(this, "isDIVEModel", !0);
336
+ i(this, "_mesh", null);
337
+ i(this, "_material", null);
338
+ i(this, "_assetLoader", null);
339
+ this.name = "DIVEModel";
340
+ }
341
+ async _getAssetLoader() {
342
+ return this._assetLoader || (this._assetLoader = new (await import("../plugins/assetloader/index.mjs")).AssetLoader()), this._assetLoader;
343
+ }
344
+ async setFromURL(t) {
345
+ const s = await (await this._getAssetLoader()).load(t);
346
+ return this.setFromGLTF(s), import("../plugins/state/index.mjs").then(({ State: a }) => {
347
+ var o;
348
+ (o = a.get(this.userData.id)) == null || o.performAction("MODEL_LOADED", {
349
+ id: this.userData.id
350
+ });
351
+ }), this;
352
+ }
353
+ setFromGLTF(t) {
354
+ return this.clear(), this._boundingBox.makeEmpty(), t.traverse((e) => {
355
+ e.castShadow = !0, e.receiveShadow = !0, e.layers.mask = this.layers.mask, this._boundingBox.expandByObject(e), !this._mesh && "isMesh" in e && (this._mesh = e, this._material ? this._mesh.material = this._material : this._material = e.material);
356
+ }), this.add(t), this;
357
+ }
358
+ setMaterial(t) {
359
+ this._material || (this._material = new L()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
360
+ }
361
+ placeOnFloor() {
362
+ var a, o, l, c;
363
+ const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
364
+ (o = (a = this._mesh) == null ? void 0 : a.geometry) == null || o.computeBoundingBox();
365
+ const s = (c = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : c.boundingBox;
366
+ !s || !this._mesh || (t.y = t.y - this._mesh.localToWorld(s.min.clone()).y, t.y !== e.y && import("../plugins/state/index.mjs").then(({ State: d }) => {
367
+ var u;
368
+ (u = d.get(this.userData.id)) == null || u.performAction("UPDATE_OBJECT", {
369
+ id: this.userData.id,
370
+ position: t,
371
+ rotation: this.rotation,
372
+ scale: this.scale
373
+ });
374
+ }));
375
+ }
376
+ dropIt() {
377
+ if (!this.parent) {
378
+ console.warn(
379
+ "DIVEModel: dropIt() called on a model that is not in the scene.",
380
+ this
381
+ );
382
+ return;
383
+ }
384
+ const t = this._boundingBox.min.y * this.scale.y, e = this.localToWorld(
385
+ this._boundingBox.getCenter(new h()).multiply(this.scale)
386
+ );
387
+ e.y = t + this.position.y;
388
+ const s = new F(e, new h(0, -1, 0));
389
+ s.layers.mask = _;
390
+ const a = s.intersectObjects(
391
+ k(this).root.children,
392
+ !0
393
+ );
394
+ if (a.length > 0) {
395
+ const o = a[0].object;
396
+ o.geometry.computeBoundingBox();
397
+ const l = o.geometry.boundingBox, c = o.localToWorld(l.max.clone()), d = this.position.clone(), u = this.position.clone().setY(c.y).sub(new h(0, t, 0));
398
+ if (this.position.copy(u), this.position.y === d.y) return;
399
+ this.onMove();
400
+ }
401
+ }
402
+ }
403
+ class Lt extends P {
404
+ constructor() {
405
+ super();
406
+ i(this, "isDIVEPrimitive", !0);
407
+ i(this, "_mesh");
408
+ this._mesh = new S(), this._mesh.layers.mask = _, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new L(), this.add(this._mesh);
409
+ }
410
+ setGeometry(t) {
411
+ const e = this.assembleGeometry(t);
412
+ e && (this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
413
+ }
414
+ setMaterial(t) {
415
+ const e = this._mesh.material;
416
+ t.vertexColors !== void 0 && (e.vertexColors = t.vertexColors), t.color !== void 0 && (e.color = new g(t.color)), t.map !== void 0 && (e.map = t.map), t.normalMap !== void 0 && (e.normalMap = t.normalMap), t.roughness !== void 0 && (e.roughness = t.roughness), t.roughnessMap !== void 0 && (e.roughnessMap = t.roughnessMap, e.roughnessMap && (e.roughness = 1)), t.metalness !== void 0 && (e.metalness = t.metalness), t.metalnessMap !== void 0 && (e.metalnessMap = t.metalnessMap, e.metalnessMap && (e.metalness = 0)), this._mesh && (this._mesh.material = e);
417
+ }
418
+ placeOnFloor() {
419
+ var a, o, l, c;
420
+ const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
421
+ (o = (a = this._mesh) == null ? void 0 : a.geometry) == null || o.computeBoundingBox();
422
+ const s = (c = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : c.boundingBox;
423
+ !s || !this._mesh || (t.y = t.y - this._mesh.localToWorld(s.min.clone()).y, t.y !== e.y && import("../plugins/state/index.mjs").then(({ State: d }) => {
424
+ var u;
425
+ (u = d.get(this.userData.id)) == null || u.performAction("UPDATE_OBJECT", {
426
+ id: this.userData.id,
427
+ position: t,
428
+ rotation: this.rotation,
429
+ scale: this.scale
430
+ });
431
+ }));
432
+ }
433
+ dropIt() {
434
+ if (!this.parent) {
435
+ console.warn(
436
+ "DIVEPrimitive: dropIt() called on a model that is not in the scene.",
437
+ this
438
+ );
439
+ return;
440
+ }
441
+ const t = this._boundingBox.min.y * this.scale.y, e = this.localToWorld(
442
+ this._boundingBox.getCenter(new h()).multiply(this.scale)
443
+ );
444
+ e.y = t + this.position.y;
445
+ const s = new F(e, new h(0, -1, 0));
446
+ s.layers.mask = _;
447
+ const a = s.intersectObjects(
448
+ k(this).root.children,
449
+ !0
450
+ );
451
+ if (a.length > 0) {
452
+ const o = a[0].object;
453
+ o.geometry.computeBoundingBox();
454
+ const l = o.geometry.boundingBox, c = o.localToWorld(l.max.clone()), d = this.position.clone(), u = this.position.clone().setY(c.y).sub(new h(0, t, 0));
455
+ if (this.position.copy(u), this.position.y === d.y) return;
456
+ this.onMove();
457
+ }
458
+ }
459
+ assembleGeometry(t) {
460
+ switch (this._mesh.material.flatShading = !1, t.name.toLowerCase()) {
461
+ case "cylinder":
462
+ return this.createCylinderGeometry(t);
463
+ case "sphere":
464
+ return this.createSphereGeometry(t);
465
+ case "pyramid":
466
+ return this._mesh.material.flatShading = !0, this.createPyramidGeometry(t);
467
+ case "cube":
468
+ case "box":
469
+ return this.createBoxGeometry(t);
470
+ case "cone":
471
+ return this.createConeGeometry(t);
472
+ case "wall":
473
+ return this.createWallGeometry(t);
474
+ case "plane":
475
+ return this.createPlaneGeometry(t);
476
+ default:
477
+ return console.warn(
478
+ "DIVEPrimitive.assembleGeometry: Invalid geometry type:",
479
+ t.name.toLowerCase()
480
+ ), null;
481
+ }
482
+ }
483
+ createCylinderGeometry(t) {
484
+ const e = new rt(
485
+ t.width / 2,
486
+ t.width / 2,
487
+ t.height,
488
+ 64
489
+ );
490
+ return e.translate(0, t.height / 2, 0), e;
491
+ }
492
+ createSphereGeometry(t) {
493
+ return new T(t.width / 2, 256, 256);
494
+ }
495
+ createPyramidGeometry(t) {
496
+ const e = new Float32Array([
497
+ -t.width / 2,
498
+ 0,
499
+ -t.depth / 2,
500
+ // 0
501
+ t.width / 2,
502
+ 0,
503
+ -t.depth / 2,
504
+ // 1
505
+ t.width / 2,
506
+ 0,
507
+ t.depth / 2,
508
+ // 2
509
+ -t.width / 2,
510
+ 0,
511
+ t.depth / 2,
512
+ // 3
513
+ 0,
514
+ t.height,
515
+ 0
516
+ ]), s = new Uint16Array([
517
+ 0,
518
+ 1,
519
+ 2,
520
+ 0,
521
+ 2,
522
+ 3,
523
+ 0,
524
+ 4,
525
+ 1,
526
+ 1,
527
+ 4,
528
+ 2,
529
+ 2,
530
+ 4,
531
+ 3,
532
+ 3,
533
+ 4,
534
+ 0
535
+ ]), a = new U();
536
+ return a.setAttribute(
537
+ "position",
538
+ new V(e, 3)
539
+ ), a.setIndex(new V(s, 1)), a.computeVertexNormals(), a.computeBoundingBox(), a.computeBoundingSphere(), a;
540
+ }
541
+ createBoxGeometry(t) {
542
+ const e = new v(
543
+ t.width,
544
+ t.height,
545
+ t.depth
546
+ );
547
+ return e.translate(0, t.height / 2, 0), e;
548
+ }
549
+ createConeGeometry(t) {
550
+ const e = new ht(t.width / 2, t.height, 256);
551
+ return e.translate(0, t.height / 2, 0), e;
552
+ }
553
+ createWallGeometry(t) {
554
+ const e = new v(
555
+ t.width,
556
+ t.height,
557
+ t.depth || 0.05,
558
+ 16
559
+ );
560
+ return e.translate(0, t.height / 2, 0), e;
561
+ }
562
+ createPlaneGeometry(t) {
563
+ const e = new v(
564
+ t.width,
565
+ t.height,
566
+ t.depth
567
+ );
568
+ return e.translate(0, t.height / 2, 0), e;
569
+ }
570
+ }
571
+ class kt extends P {
572
+ // lines to children
573
+ constructor() {
574
+ super();
575
+ i(this, "isDIVEGroup", !0);
576
+ i(this, "_members");
577
+ i(this, "_lines");
578
+ this.name = "DIVEGroup", this._members = [], this._lines = [];
579
+ }
580
+ // children objects
581
+ get members() {
582
+ return this._members;
583
+ }
584
+ setPosition(t) {
585
+ super.setPosition(t), this._members.forEach((e) => {
586
+ "isDIVENode" in e && e.onMove();
587
+ });
588
+ }
589
+ setLinesVisibility(t, e) {
590
+ if (!e) {
591
+ this._lines.forEach((a) => {
592
+ a.visible = t;
593
+ });
594
+ return;
595
+ }
596
+ const s = this._members.indexOf(e);
597
+ s !== -1 && (this._lines[s].visible = t);
598
+ }
599
+ attach(t) {
600
+ if (this._members.includes(t))
601
+ return this;
602
+ const e = this.createLine();
603
+ return this.add(e), this._lines.push(e), super.attach(t), this._members.push(t), this._updateLineTo(e, t), this.setLinesVisibility(!0, t), this;
604
+ }
605
+ /**
606
+ * Removes an object from the group.
607
+ * @param object - The object to remove.
608
+ * @returns The group instance.
609
+ */
610
+ remove(t) {
611
+ const e = this._members.indexOf(t);
612
+ if (e === -1)
613
+ return this;
614
+ const s = this._lines[e];
615
+ return super.remove(s), this._lines.splice(e, 1), super.remove(t), this._members.splice(e, 1), this;
616
+ }
617
+ updateLineTo(t) {
618
+ const e = this._members.indexOf(t);
619
+ e !== -1 && this._updateLineTo(this._lines[e], t);
620
+ }
621
+ /**
622
+ * Creates a line for visualization.
623
+ */
624
+ createLine() {
625
+ const t = new U(), e = new lt({
626
+ color: 6710886,
627
+ dashSize: 0.05,
628
+ gapSize: 0.025
629
+ }), s = new dt(t, e);
630
+ return s.visible = !1, s;
631
+ }
632
+ /**
633
+ * Updates a line to the object.
634
+ */
635
+ _updateLineTo(t, e) {
636
+ const s = [
637
+ new h(0, 0, 0),
638
+ e.position.clone()
639
+ ];
640
+ t.geometry.setFromPoints(s), t.computeLineDistances();
641
+ }
642
+ // public setBoundingBoxVisibility(visible: boolean): void {
643
+ // this._boxMesh.visible = visible;
644
+ // }
645
+ // /**
646
+ // * Recalculates the position of the group based on it's bounding box.
647
+ // * Children's world positions are kept.
648
+ // */
649
+ // private recalculatePosition(): void {
650
+ // // store all children's world positions
651
+ // const childrensWorldPositions: Vector3[] = this.children.map((child) => child.getWorldPosition(new Vector3()));
652
+ // // calculate new center and set it as the group's position
653
+ // const bbcenter = this.updateBB();
654
+ // this.position.copy(bbcenter);
655
+ // // set childrens's positions so their world positions are kept
656
+ // this.children.forEach((child, i) => {
657
+ // if (child.uuid === this._boxMesh.uuid) return;
658
+ // child.position.copy(this.worldToLocal(childrensWorldPositions[i]));
659
+ // });
660
+ // DIVECommunication.get(this.userData.id)?.performAction('UPDATE_OBJECT', { id: this.userData.id, position: this.position });
661
+ // }
662
+ // /**
663
+ // * Updates the bounding box of the group.
664
+ // * @returns {Vector3} The new center of the bounding box.
665
+ // */
666
+ // private updateBB(): Vector3 {
667
+ // this._boundingBox.makeEmpty();
668
+ // if (this.children.length === 1) {
669
+ // // because we always have the box mesh as 1 child
670
+ // return this.position.clone();
671
+ // }
672
+ // this.children.forEach((child) => {
673
+ // if (child.uuid === this._boxMesh.uuid) return;
674
+ // this._boundingBox.expandByObject(child);
675
+ // });
676
+ // return this._boundingBox.getCenter(new Vector3());
677
+ // }
678
+ // private updateBoxMesh(): void {
679
+ // if (this.children.length === 1) {
680
+ // // because we always have the box mesh as 1 child
681
+ // this._boxMesh.visible = false;
682
+ // return;
683
+ // }
684
+ // this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
685
+ // this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
686
+ // this._boxMesh.geometry = new BoxGeometry(this._boundingBox.max.x - this._boundingBox.min.x, this._boundingBox.max.y - this._boundingBox.min.y, this._boundingBox.max.z - this._boundingBox.min.z);
687
+ // this._boxMesh.visible = true;
688
+ // }
689
+ }
690
+ class Rt extends S {
691
+ constructor() {
692
+ const t = new ct(1, 1);
693
+ t.scale(1e3, 1e3, 1), t.rotateX(-Math.PI / 2);
694
+ const e = new L({
695
+ color: new g(16777215),
696
+ side: G
697
+ });
698
+ super(t, e);
699
+ i(this, "isDIVEFloor", !0);
700
+ this.name = "Floor", this.layers.mask = _, this.receiveShadow = !0;
701
+ }
702
+ setVisibility(t) {
703
+ this.visible = t;
704
+ }
705
+ setColor(t) {
706
+ this.material.color = new g(t);
707
+ }
708
+ }
709
+ class Vt extends w {
710
+ constructor() {
711
+ super();
712
+ i(this, "isDIVERoot", !0);
713
+ i(this, "_floor");
714
+ this.name = "Root", this._floor = new Rt(), this.add(this._floor);
715
+ }
716
+ get floor() {
717
+ return this._floor;
718
+ }
719
+ computeSceneBB() {
720
+ const t = new I();
721
+ return this.children.forEach((e) => {
722
+ "isDIVEFloor" in e || e.traverse((s) => {
723
+ "isObject3D" in s && t.expandByObject(s);
724
+ });
725
+ }), t;
726
+ }
727
+ getSceneObject(t) {
728
+ let e;
729
+ return this.traverse((s) => {
730
+ e || s.userData.id === t.id && (e = s);
731
+ }), e;
732
+ }
733
+ addSceneObject(t) {
734
+ let e = this.getSceneObject(t);
735
+ if (e)
736
+ return console.warn(
737
+ `DIVERoot.addSceneObject: Scene object with id ${t.id} already exists`
738
+ ), e;
739
+ switch (t.entityType) {
740
+ case "pov":
741
+ break;
742
+ case "light": {
743
+ switch (t.type) {
744
+ case "scene": {
745
+ e = new Tt();
746
+ break;
747
+ }
748
+ case "ambient": {
749
+ e = new Mt();
750
+ break;
751
+ }
752
+ case "point": {
753
+ e = new xt();
754
+ break;
755
+ }
756
+ default:
757
+ throw new Error(
758
+ `DIVERoot.addSceneObject: Unknown light type: ${t.type}`
759
+ );
760
+ }
761
+ e.name = t.name, e.userData.id = t.id, this.add(e), this._updateLight(e, t);
762
+ break;
763
+ }
764
+ case "model": {
765
+ e = new It(), e.name = t.name, e.userData.id = t.id, e.userData.uri = t.uri, this.add(e), this._updateModel(e, t);
766
+ break;
767
+ }
768
+ case "primitive": {
769
+ e = new Lt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updatePrimitive(e, t);
770
+ break;
771
+ }
772
+ case "group": {
773
+ e = new kt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updateGroup(e, t);
774
+ break;
775
+ }
776
+ default:
777
+ throw new Error(
778
+ `DIVERoot.addSceneObject: Unknown entity type: ${t.entityType}`
779
+ );
780
+ }
781
+ return e;
782
+ }
783
+ updateSceneObject(t) {
784
+ const e = this.getSceneObject(t);
785
+ if (!e) {
786
+ console.warn(
787
+ `DIVERoot.updateSceneObject: Scene object with id ${t.id} does not exist`
788
+ );
789
+ return;
790
+ }
791
+ switch (t.entityType) {
792
+ case "pov":
793
+ break;
794
+ case "light": {
795
+ this._updateLight(e, t);
796
+ break;
797
+ }
798
+ case "model": {
799
+ this._updateModel(e, t);
800
+ break;
801
+ }
802
+ case "primitive": {
803
+ this._updatePrimitive(e, t);
804
+ break;
805
+ }
806
+ case "group": {
807
+ this._updateGroup(e, t);
808
+ break;
809
+ }
810
+ default:
811
+ throw new Error(
812
+ `DIVERoot.updateSceneObject: Unknown entity type: ${t.entityType}`
813
+ );
814
+ }
815
+ }
816
+ deleteSceneObject(t) {
817
+ const e = this.getSceneObject(t);
818
+ if (!e) {
819
+ console.warn(
820
+ `DIVERoot.deleteSceneObject: Object with id ${t.id} not found`
821
+ );
822
+ return;
823
+ }
824
+ switch (t.entityType) {
825
+ case "pov":
826
+ break;
827
+ case "light": {
828
+ this._deleteLight(e);
829
+ break;
830
+ }
831
+ case "model": {
832
+ this._deleteModel(e);
833
+ break;
834
+ }
835
+ case "primitive": {
836
+ this._deletePrimitive(e);
837
+ break;
838
+ }
839
+ case "group": {
840
+ this._deleteGroup(e);
841
+ break;
842
+ }
843
+ default:
844
+ throw new Error(
845
+ `DIVERoot.deleteSceneObject: Unknown entity type: ${t.entityType}`
846
+ );
847
+ }
848
+ }
849
+ _updateLight(t, e) {
850
+ e.name !== void 0 && e.name !== null && (t.name = e.name), e.position !== void 0 && e.position !== null && t.position.set(
851
+ e.position.x,
852
+ e.position.y,
853
+ e.position.z
854
+ ), e.intensity !== void 0 && e.intensity !== null && t.setIntensity(e.intensity), e.enabled !== void 0 && e.enabled !== null && t.setEnabled(e.enabled), e.color !== void 0 && e.color !== null && t.setColor(new g(e.color)), e.visible !== void 0 && e.visible !== null && (t.visible = e.visible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
855
+ }
856
+ _updateModel(t, e) {
857
+ e.uri !== void 0 && t.setFromURL(e.uri), e.name !== void 0 && (t.name = e.name), e.position !== void 0 && t.setPosition(e.position), e.rotation !== void 0 && t.setRotation(e.rotation), e.scale !== void 0 && t.setScale(e.scale), e.visible !== void 0 && t.setVisibility(e.visible), e.material !== void 0 && t.setMaterial(e.material), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
858
+ }
859
+ _updatePrimitive(t, e) {
860
+ e.name !== void 0 && (t.name = e.name), e.geometry !== void 0 && t.setGeometry(e.geometry), e.position !== void 0 && t.setPosition(e.position), e.rotation !== void 0 && t.setRotation(e.rotation), e.scale !== void 0 && t.setScale(e.scale), e.visible !== void 0 && t.setVisibility(e.visible), e.material !== void 0 && t.setMaterial(e.material), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
861
+ }
862
+ _updateGroup(t, e) {
863
+ e.name !== void 0 && (t.name = e.name), e.position !== void 0 && t.setPosition(e.position), e.rotation !== void 0 && t.setRotation(e.rotation), e.scale !== void 0 && t.setScale(e.scale), e.visible !== void 0 && t.setVisibility(e.visible), e.bbVisible !== void 0 && t.setLinesVisibility(e.bbVisible), e.parentId !== void 0 && this._setParent({ ...e, parentId: e.parentId });
864
+ }
865
+ _deleteLight(t) {
866
+ this._detachTransformControls(t), t.parent.remove(t);
867
+ }
868
+ _deleteModel(t) {
869
+ this._detachTransformControls(t), t.parent.remove(t);
870
+ }
871
+ _deletePrimitive(t) {
872
+ this._detachTransformControls(t), t.parent.remove(t);
873
+ }
874
+ _deleteGroup(t) {
875
+ this._detachTransformControls(t);
876
+ for (let e = t.members.length - 1; e >= 0; e--)
877
+ this.attach(t.members[e]);
878
+ t.parent.remove(t);
879
+ }
880
+ _setParent(t) {
881
+ const e = this.getSceneObject(t);
882
+ if (t.parentId !== null) {
883
+ const s = this.getSceneObject({
884
+ id: t.parentId,
885
+ entityType: t.entityType
886
+ });
887
+ if (!s) return;
888
+ s.attach(e);
889
+ } else
890
+ this.attach(e);
891
+ }
892
+ _detachTransformControls(t) {
893
+ this._findScene(t).children.find((e) => {
894
+ "isTransformControls" in e && e.detach();
895
+ });
896
+ }
897
+ _findScene(t) {
898
+ return t.parent !== null ? this._findScene(t.parent) : t;
899
+ }
900
+ }
901
+ const At = "#888888", Ct = "#dddddd";
902
+ class Ot extends w {
903
+ constructor() {
904
+ super(), this.name = "Grid";
905
+ const n = new ut(
906
+ 100,
907
+ 100,
908
+ At,
909
+ Ct
910
+ );
911
+ n.material.depthTest = !1, n.layers.mask = Et, this.add(n);
912
+ }
913
+ setVisibility(n) {
914
+ this.visible = n;
915
+ }
916
+ }
917
+ const D = {
918
+ displayFloor: !1,
919
+ displayGrid: !1,
920
+ backgroundColor: "#ffffff"
921
+ };
922
+ class Bt extends pt {
923
+ constructor(t) {
924
+ super();
925
+ i(this, "isDIVEScene", !0);
926
+ i(this, "_root");
927
+ i(this, "_grid");
928
+ this.background = new g(
929
+ (t == null ? void 0 : t.backgroundColor) ?? D.backgroundColor
930
+ ), this._root = new Vt(), this._root.floor.setVisibility(
931
+ (t == null ? void 0 : t.displayFloor) ?? D.displayFloor
932
+ ), this.add(this._root), this._grid = new Ot(), this._grid.setVisibility(
933
+ (t == null ? void 0 : t.displayGrid) ?? D.displayGrid
934
+ ), this.add(this._grid);
935
+ }
936
+ get root() {
937
+ return this._root;
938
+ }
939
+ get grid() {
940
+ return this._grid;
941
+ }
942
+ setBackground(t) {
943
+ this.background = new g(t);
944
+ }
945
+ computeSceneBB() {
946
+ return this._root.computeSceneBB();
947
+ }
948
+ }
949
+ const zt = {
950
+ enableDamping: !0,
951
+ dampingFactor: 0.05,
952
+ enabled: !0,
953
+ target: new h(),
954
+ minDistance: 0,
955
+ maxDistance: 1 / 0,
956
+ minZoom: 0,
957
+ maxZoom: 1 / 0,
958
+ minPolarAngle: 0,
959
+ maxPolarAngle: Math.PI,
960
+ minAzimuthAngle: -1 / 0,
961
+ maxAzimuthAngle: 1 / 0,
962
+ enableZoom: !0,
963
+ zoomSpeed: 1,
964
+ enableRotate: !0,
965
+ rotateSpeed: 1,
966
+ enablePan: !0,
967
+ panSpeed: 1,
968
+ screenSpacePanning: !0,
969
+ keyPanSpeed: 7,
970
+ autoRotate: !1,
971
+ autoRotateSpeed: 2,
972
+ keys: {
973
+ LEFT: "ArrowLeft",
974
+ UP: "ArrowUp",
975
+ RIGHT: "ArrowRight",
976
+ BOTTOM: "ArrowDown"
977
+ },
978
+ mouseButtons: {
979
+ LEFT: m.ROTATE,
980
+ MIDDLE: m.DOLLY,
981
+ RIGHT: m.PAN
982
+ },
983
+ touches: {
984
+ ONE: f.ROTATE,
985
+ TWO: f.DOLLY_PAN
986
+ }
987
+ }, b = class b extends mt {
988
+ constructor(t, e, s) {
989
+ super();
990
+ // public API
991
+ i(this, "object");
992
+ i(this, "domElements");
993
+ i(this, "enabled", !0);
994
+ i(this, "target", new h());
995
+ i(this, "minDistance", 0);
996
+ i(this, "maxDistance", 1 / 0);
997
+ i(this, "minZoom", 0);
998
+ i(this, "maxZoom", 1 / 0);
999
+ i(this, "minPolarAngle", 0);
1000
+ // radians
1001
+ i(this, "maxPolarAngle", Math.PI);
1002
+ // radians
1003
+ i(this, "minAzimuthAngle", -1 / 0);
1004
+ // radians
1005
+ i(this, "maxAzimuthAngle", 1 / 0);
1006
+ // radians
1007
+ i(this, "enableDamping", !0);
1008
+ i(this, "dampingFactor", 0.05);
1009
+ i(this, "enableZoom", !0);
1010
+ i(this, "zoomSpeed", 1);
1011
+ i(this, "enableRotate", !0);
1012
+ i(this, "rotateSpeed", 1);
1013
+ i(this, "enablePan", !0);
1014
+ i(this, "panSpeed", 1);
1015
+ i(this, "screenSpacePanning", !0);
1016
+ i(this, "keyPanSpeed", 7);
1017
+ i(this, "autoRotate", !1);
1018
+ i(this, "autoRotateSpeed", 2);
1019
+ i(this, "keys", {
1020
+ LEFT: "ArrowLeft",
1021
+ UP: "ArrowUp",
1022
+ RIGHT: "ArrowRight",
1023
+ BOTTOM: "ArrowDown"
1024
+ });
1025
+ i(this, "mouseButtons", {
1026
+ LEFT: m.ROTATE,
1027
+ MIDDLE: m.DOLLY,
1028
+ RIGHT: m.PAN
1029
+ });
1030
+ i(this, "touches", { ONE: f.ROTATE, TWO: f.DOLLY_PAN });
1031
+ i(this, "target0");
1032
+ i(this, "position0");
1033
+ i(this, "zoom0");
1034
+ i(this, "uuid", E.generateUUID());
1035
+ // private state
1036
+ i(this, "state", -1);
1037
+ i(this, "EPS", 1e-6);
1038
+ i(this, "spherical", new A());
1039
+ i(this, "sphericalDelta", new A());
1040
+ i(this, "scale", 1);
1041
+ i(this, "panOffset", new h());
1042
+ i(this, "zoomChanged", !1);
1043
+ i(this, "rotateStart", new p());
1044
+ i(this, "rotateEnd", new p());
1045
+ i(this, "rotateDelta", new p());
1046
+ i(this, "panStart", new p());
1047
+ i(this, "panEnd", new p());
1048
+ i(this, "panDelta", new p());
1049
+ i(this, "dollyStart", new p());
1050
+ i(this, "dollyEnd", new p());
1051
+ i(this, "dollyDelta", new p());
1052
+ i(this, "pointers", []);
1053
+ i(this, "pointerPositions", {});
1054
+ // for update() function
1055
+ i(this, "offset", new h());
1056
+ i(this, "quat");
1057
+ i(this, "quatInverse");
1058
+ i(this, "lastPosition", new h());
1059
+ i(this, "lastQuaternion", new x());
1060
+ i(this, "lastTarget", new h());
1061
+ i(this, "panLeft", (() => {
1062
+ const t = new h();
1063
+ return (e, s) => {
1064
+ t.setFromMatrixColumn(s, 0), t.multiplyScalar(-e), this.panOffset.add(t);
1065
+ };
1066
+ })());
1067
+ i(this, "panUp", (() => {
1068
+ const t = new h();
1069
+ return (e, s) => {
1070
+ this.screenSpacePanning === !0 ? t.setFromMatrixColumn(s, 1) : (t.setFromMatrixColumn(s, 0), t.crossVectors(this.object.up, t)), t.multiplyScalar(e), this.panOffset.add(t);
1071
+ };
1072
+ })());
1073
+ i(this, "onMouseDown", (t) => {
1074
+ let e;
1075
+ switch (t.button) {
1076
+ case 0:
1077
+ e = this.mouseButtons.LEFT;
1078
+ break;
1079
+ case 1:
1080
+ e = this.mouseButtons.MIDDLE;
1081
+ break;
1082
+ case 2:
1083
+ e = this.mouseButtons.RIGHT;
1084
+ break;
1085
+ default:
1086
+ e = -1;
1087
+ }
1088
+ switch (e) {
1089
+ case m.DOLLY:
1090
+ if (this.enableZoom === !1) return;
1091
+ this.handleMouseDownDolly(t), this.state = 1;
1092
+ break;
1093
+ case m.ROTATE:
1094
+ if (t.ctrlKey || t.metaKey || t.shiftKey) {
1095
+ if (this.enablePan === !1) return;
1096
+ this.handleMouseDownPan(t), this.state = 2;
1097
+ } else {
1098
+ if (this.enableRotate === !1) return;
1099
+ this.handleMouseDownRotate(t), this.state = 0;
1100
+ }
1101
+ break;
1102
+ case m.PAN:
1103
+ if (t.ctrlKey || t.metaKey || t.shiftKey) {
1104
+ if (this.enableRotate === !1) return;
1105
+ this.handleMouseDownRotate(t), this.state = 0;
1106
+ } else {
1107
+ if (this.enablePan === !1) return;
1108
+ this.handleMouseDownPan(t), this.state = 2;
1109
+ }
1110
+ break;
1111
+ default:
1112
+ this.state = -1;
1113
+ }
1114
+ this.state !== -1 && this.dispatchEvent({ type: "start" });
1115
+ });
1116
+ i(this, "onMouseMove", (t) => {
1117
+ if (this.enabled !== !1)
1118
+ switch (this.state) {
1119
+ case 0:
1120
+ if (this.enableRotate === !1) return;
1121
+ this.handleMouseMoveRotate(t);
1122
+ break;
1123
+ case 1:
1124
+ if (this.enableZoom === !1) return;
1125
+ this.handleMouseMoveDolly(t);
1126
+ break;
1127
+ case 2:
1128
+ if (this.enablePan === !1) return;
1129
+ this.handleMouseMovePan(t);
1130
+ break;
1131
+ }
1132
+ });
1133
+ i(this, "onMouseWheel", (t) => {
1134
+ this.enabled === !1 || this.enableZoom === !1 || this.state !== -1 || (t.preventDefault(), this.dispatchEvent({ type: "start" }), this.handleMouseWheel(t), this.dispatchEvent({ type: "end" }));
1135
+ });
1136
+ i(this, "onKeyDown", (t) => {
1137
+ this.enabled === !1 || this.enablePan === !1 || this.handleKeyDown(t);
1138
+ });
1139
+ i(this, "onTouchStart", (t) => {
1140
+ switch (this.trackPointer(t), this.pointers.length) {
1141
+ case 1:
1142
+ switch (this.touches.ONE) {
1143
+ case f.ROTATE:
1144
+ if (this.enableRotate === !1) return;
1145
+ this.handleTouchStartRotate(t), this.state = 3;
1146
+ break;
1147
+ case f.PAN:
1148
+ if (this.enablePan === !1) return;
1149
+ this.handleTouchStartPan(t), this.state = 4;
1150
+ break;
1151
+ default:
1152
+ this.state = -1;
1153
+ }
1154
+ break;
1155
+ case 2:
1156
+ switch (this.touches.TWO) {
1157
+ case f.DOLLY_PAN:
1158
+ if (this.enableZoom === !1 && this.enablePan === !1)
1159
+ return;
1160
+ this.handleTouchStartDollyPan(t), this.state = 5;
1161
+ break;
1162
+ case f.DOLLY_ROTATE:
1163
+ if (this.enableZoom === !1 && this.enableRotate === !1)
1164
+ return;
1165
+ this.handleTouchStartDollyRotate(t), this.state = 6;
1166
+ break;
1167
+ default:
1168
+ this.state = -1;
1169
+ }
1170
+ break;
1171
+ default:
1172
+ this.state = -1;
1173
+ }
1174
+ this.state !== -1 && this.dispatchEvent({ type: "start" });
1175
+ });
1176
+ i(this, "onTouchMove", (t) => {
1177
+ switch (this.trackPointer(t), this.state) {
1178
+ case 3:
1179
+ if (this.enableRotate === !1) return;
1180
+ this.handleTouchMoveRotate(t), this.update();
1181
+ break;
1182
+ case 4:
1183
+ if (this.enablePan === !1) return;
1184
+ this.handleTouchMovePan(t), this.update();
1185
+ break;
1186
+ case 5:
1187
+ if (this.enableZoom === !1 && this.enablePan === !1)
1188
+ return;
1189
+ this.handleTouchMoveDollyPan(t), this.update();
1190
+ break;
1191
+ case 6:
1192
+ if (this.enableZoom === !1 && this.enableRotate === !1)
1193
+ return;
1194
+ this.handleTouchMoveDollyRotate(t), this.update();
1195
+ break;
1196
+ default:
1197
+ this.state = -1;
1198
+ }
1199
+ });
1200
+ i(this, "onPointerDown", (t) => {
1201
+ if (this.enabled !== !1) {
1202
+ if (this.pointers.length === 0) {
1203
+ const e = t.currentTarget;
1204
+ e.setPointerCapture(t.pointerId), e.addEventListener("pointermove", this.onPointerMove), e.addEventListener("pointerup", this.onPointerUp);
1205
+ }
1206
+ this.isTrackingPointer(t) || (this.addPointer(t), t.pointerType === "touch" ? this.onTouchStart(t) : this.onMouseDown(t));
1207
+ }
1208
+ });
1209
+ i(this, "onPointerMove", (t) => {
1210
+ this.enabled !== !1 && (t.pointerType === "touch" ? this.onTouchMove(t) : this.onMouseMove(t));
1211
+ });
1212
+ i(this, "onPointerUp", (t) => {
1213
+ if (this.removePointer(t), this.pointers.length === 0) {
1214
+ const e = t.currentTarget;
1215
+ e.releasePointerCapture(t.pointerId), e.removeEventListener("pointermove", this.onPointerMove), e.removeEventListener("pointerup", this.onPointerUp), this.dispatchEvent({ type: "end" }), this.state = -1;
1216
+ }
1217
+ });
1218
+ i(this, "onPointerCancel", (t) => {
1219
+ this.removePointer(t);
1220
+ });
1221
+ i(this, "onContextMenu", (t) => {
1222
+ this.enabled !== !1 && t.preventDefault();
1223
+ });
1224
+ this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, s), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new x().setFromUnitVectors(
1225
+ t.up,
1226
+ new h(0, 1, 0)
1227
+ ), this.quatInverse = this.quat.clone().invert(), this.domElements.forEach((a) => this.addEventListeners(a)), this.update();
1228
+ }
1229
+ get domElement() {
1230
+ return this.domElements[0];
1231
+ }
1232
+ tick() {
1233
+ this.enabled && this.update();
1234
+ }
1235
+ getPolarAngle() {
1236
+ return this.spherical.phi;
1237
+ }
1238
+ getAzimuthalAngle() {
1239
+ return this.spherical.theta;
1240
+ }
1241
+ getDistance() {
1242
+ return this.object.position.distanceTo(this.target);
1243
+ }
1244
+ saveState() {
1245
+ this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
1246
+ }
1247
+ reset() {
1248
+ this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent({ type: "change" }), this.update(), this.state = -1;
1249
+ }
1250
+ update() {
1251
+ return this.offset.copy(this.object.position).sub(this.target), this.offset.applyQuaternion(this.quat), this.spherical.setFromVector3(this.offset), this.autoRotate && this.state === -1 && this.rotateLeft(this.getAutoRotationAngle()), this.enableDamping ? (this.spherical.theta += this.sphericalDelta.theta * this.dampingFactor, this.spherical.phi += this.sphericalDelta.phi * this.dampingFactor) : (this.spherical.theta += this.sphericalDelta.theta, this.spherical.phi += this.sphericalDelta.phi), this.spherical.theta = Math.max(
1252
+ this.minAzimuthAngle,
1253
+ Math.min(this.maxAzimuthAngle, this.spherical.theta)
1254
+ ), this.spherical.phi = Math.max(
1255
+ this.minPolarAngle,
1256
+ Math.min(this.maxPolarAngle, this.spherical.phi)
1257
+ ), this.spherical.makeSafe(), this.spherical.radius *= this.scale, this.spherical.radius = Math.max(
1258
+ this.minDistance,
1259
+ Math.min(this.maxDistance, this.spherical.radius)
1260
+ ), this.enableDamping === !0 ? this.target.addScaledVector(this.panOffset, this.dampingFactor) : this.target.add(this.panOffset), this.offset.setFromSpherical(this.spherical), this.offset.applyQuaternion(this.quatInverse), this.object.position.copy(this.target).add(this.offset), this.object.lookAt(this.target), this.enableDamping === !0 ? (this.sphericalDelta.theta *= 1 - this.dampingFactor, this.sphericalDelta.phi *= 1 - this.dampingFactor, this.panOffset.multiplyScalar(1 - this.dampingFactor)) : (this.sphericalDelta.set(0, 0, 0), this.panOffset.set(0, 0, 0)), this.scale = 1, this.zoomChanged || this.lastPosition.distanceToSquared(this.object.position) > this.EPS || 8 * (1 - this.lastQuaternion.dot(this.object.quaternion)) > this.EPS || this.lastTarget.distanceToSquared(this.target) > this.EPS ? (this.dispatchEvent({ type: "change" }), this.lastPosition.copy(this.object.position), this.lastQuaternion.copy(this.object.quaternion), this.lastTarget.copy(this.target), this.zoomChanged = !1, !0) : !1;
1261
+ }
1262
+ dispose() {
1263
+ this.domElements.forEach(
1264
+ (t) => this.removeEventListeners(t)
1265
+ ), this.dispatchEvent({ type: "dispose" });
1266
+ }
1267
+ addDomElements(...t) {
1268
+ t.forEach((e) => {
1269
+ this.domElements.includes(e) || (this.domElements.push(e), this.addEventListeners(e));
1270
+ });
1271
+ }
1272
+ removeDomElements(...t) {
1273
+ t.forEach((e) => {
1274
+ const s = this.domElements.indexOf(e);
1275
+ s > -1 && (this.removeEventListeners(e), this.domElements.splice(s, 1));
1276
+ });
1277
+ }
1278
+ setDomElements(...t) {
1279
+ this.removeDomElements(...this.domElements), this.domElements = [], this.addDomElements(...t);
1280
+ }
1281
+ computeEncompassingView(t, e = 0) {
1282
+ const s = t.center, o = t.sphere.radius, l = this.object.fov * (Math.PI / 180), c = this.object.aspect, d = l / 2, u = Math.atan(Math.tan(d) * c), X = o / Math.sin(d), q = o / Math.sin(u), K = Math.max(X, q) * (1 + e), R = this.object.position.clone().sub(this.target).normalize(), Q = R.length() > 1e-3 ? R : new h(0, 0, 1);
1283
+ return {
1284
+ position: s.clone().add(Q.multiplyScalar(K)),
1285
+ target: s
1286
+ };
1287
+ }
1288
+ focusObject(t, e = 0) {
1289
+ const s = new Xt(t), a = this.computeEncompassingView(s, e);
1290
+ this.object.position.copy(a.position), this.target.copy(a.target), this.update();
1291
+ }
1292
+ zoomIn(t) {
1293
+ this.dollyIn(Math.pow(0.95, t ?? b.DEFAULT_ZOOM_FACTOR)), this.update();
1294
+ }
1295
+ zoomOut(t) {
1296
+ this.dollyOut(
1297
+ Math.pow(0.95, t ?? b.DEFAULT_ZOOM_FACTOR)
1298
+ ), this.update();
1299
+ }
1300
+ getState() {
1301
+ return {
1302
+ target: this.target.clone(),
1303
+ azimuthalAngle: this.getAzimuthalAngle(),
1304
+ polarAngle: this.getPolarAngle(),
1305
+ distance: this.getDistance(),
1306
+ position: this.object.position.clone(),
1307
+ quaternion: this.object.quaternion.clone()
1308
+ };
1309
+ }
1310
+ setState(t) {
1311
+ this.target.copy(t.target), this.object.position.copy(t.position), this.object.quaternion.copy(t.quaternion), this.update();
1312
+ }
1313
+ //
1314
+ // Private methods
1315
+ //
1316
+ addEventListeners(t) {
1317
+ t.style.touchAction = "none", t.addEventListener("contextmenu", this.onContextMenu), t.addEventListener("pointerdown", this.onPointerDown), t.addEventListener("pointercancel", this.onPointerCancel), t.addEventListener("wheel", this.onMouseWheel, {
1318
+ passive: !1
1319
+ }), t.addEventListener("keydown", this.onKeyDown);
1320
+ }
1321
+ removeEventListeners(t) {
1322
+ t.removeEventListener("contextmenu", this.onContextMenu), t.removeEventListener("pointerdown", this.onPointerDown), t.removeEventListener("pointercancel", this.onPointerCancel), t.removeEventListener("wheel", this.onMouseWheel), t.removeEventListener("keydown", this.onKeyDown), t.removeEventListener("pointermove", this.onPointerMove), t.removeEventListener("pointerup", this.onPointerUp);
1323
+ }
1324
+ getAutoRotationAngle() {
1325
+ return 2 * Math.PI / 60 / 60 * this.autoRotateSpeed;
1326
+ }
1327
+ getZoomScale() {
1328
+ return Math.pow(0.95, this.zoomSpeed);
1329
+ }
1330
+ rotateLeft(t) {
1331
+ this.sphericalDelta.theta -= t;
1332
+ }
1333
+ rotateUp(t) {
1334
+ this.sphericalDelta.phi -= t;
1335
+ }
1336
+ pan(t, e, s) {
1337
+ const a = new h();
1338
+ if ("isPerspectiveCamera" in this.object) {
1339
+ const o = this.object.position;
1340
+ a.copy(o).sub(this.target);
1341
+ let l = a.length();
1342
+ l *= Math.tan(
1343
+ this.object.fov / 2 * Math.PI / 180
1344
+ ), this.panLeft(
1345
+ 2 * t * l / s.clientHeight,
1346
+ this.object.matrix
1347
+ ), this.panUp(
1348
+ 2 * e * l / s.clientHeight,
1349
+ this.object.matrix
1350
+ );
1351
+ } else "isOrthographicCamera" in this.object ? (this.panLeft(
1352
+ t * (this.object.right - this.object.left) / this.object.zoom / s.clientWidth,
1353
+ this.object.matrix
1354
+ ), this.panUp(
1355
+ e * (this.object.top - this.object.bottom) / this.object.zoom / s.clientHeight,
1356
+ this.object.matrix
1357
+ )) : (console.warn(
1358
+ "WARNING: OrbitController encountered an unknown camera type - pan disabled."
1359
+ ), this.enablePan = !1);
1360
+ }
1361
+ dollyIn(t) {
1362
+ "isPerspectiveCamera" in this.object || "isOrthographicCamera" in this.object ? this.scale *= t : (console.warn(
1363
+ "WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."
1364
+ ), this.enableZoom = !1);
1365
+ }
1366
+ dollyOut(t) {
1367
+ "isPerspectiveCamera" in this.object || "isOrthographicCamera" in this.object ? this.scale /= t : (console.warn(
1368
+ "WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."
1369
+ ), this.enableZoom = !1);
1370
+ }
1371
+ // event callbacks
1372
+ handleMouseDownRotate(t) {
1373
+ this.rotateStart.set(t.clientX, t.clientY);
1374
+ }
1375
+ handleMouseDownDolly(t) {
1376
+ this.dollyStart.set(t.clientX, t.clientY);
1377
+ }
1378
+ handleMouseDownPan(t) {
1379
+ this.panStart.set(t.clientX, t.clientY);
1380
+ }
1381
+ handleMouseMoveRotate(t) {
1382
+ this.rotateEnd.set(t.clientX, t.clientY), this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed);
1383
+ const e = t.currentTarget;
1384
+ this.rotateLeft(
1385
+ 2 * Math.PI * this.rotateDelta.x / e.clientHeight
1386
+ ), this.rotateUp(
1387
+ 2 * Math.PI * this.rotateDelta.y / e.clientHeight
1388
+ ), this.rotateStart.copy(this.rotateEnd), this.update();
1389
+ }
1390
+ handleMouseMoveDolly(t) {
1391
+ this.dollyEnd.set(t.clientX, t.clientY), this.dollyDelta.subVectors(this.dollyEnd, this.dollyStart), this.dollyDelta.y > 0 ? this.dollyIn(this.getZoomScale()) : this.dollyDelta.y < 0 && this.dollyOut(this.getZoomScale()), this.dollyStart.copy(this.dollyEnd), this.update();
1392
+ }
1393
+ handleMouseMovePan(t) {
1394
+ const e = t.currentTarget;
1395
+ this.panEnd.set(t.clientX, t.clientY), this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed), this.pan(this.panDelta.x, this.panDelta.y, e), this.panStart.copy(this.panEnd), this.update();
1396
+ }
1397
+ handleMouseWheel(t) {
1398
+ t.deltaY < 0 ? this.dollyIn(this.getZoomScale()) : t.deltaY > 0 && this.dollyOut(this.getZoomScale()), this.update();
1399
+ }
1400
+ handleKeyDown(t) {
1401
+ let e = !1;
1402
+ const s = t.currentTarget;
1403
+ switch (t.code) {
1404
+ case this.keys.UP:
1405
+ this.pan(0, this.keyPanSpeed, s), e = !0;
1406
+ break;
1407
+ case this.keys.BOTTOM:
1408
+ this.pan(0, -this.keyPanSpeed, s), e = !0;
1409
+ break;
1410
+ case this.keys.LEFT:
1411
+ this.pan(this.keyPanSpeed, 0, s), e = !0;
1412
+ break;
1413
+ case this.keys.RIGHT:
1414
+ this.pan(-this.keyPanSpeed, 0, s), e = !0;
1415
+ break;
1416
+ }
1417
+ e && (t.preventDefault(), this.update());
1418
+ }
1419
+ handleTouchStartRotate(t) {
1420
+ if (this.pointers.length === 1)
1421
+ this.rotateStart.set(t.pageX, t.pageY);
1422
+ else {
1423
+ const e = this.getSecondPointer(t), s = 0.5 * (t.pageX + e.pageX), a = 0.5 * (t.pageY + e.pageY);
1424
+ this.rotateStart.set(s, a);
1425
+ }
1426
+ }
1427
+ handleTouchStartPan(t) {
1428
+ if (this.pointers.length === 1)
1429
+ this.panStart.set(t.pageX, t.pageY);
1430
+ else {
1431
+ const e = this.getSecondPointer(t), s = 0.5 * (t.pageX + e.pageX), a = 0.5 * (t.pageY + e.pageY);
1432
+ this.panStart.set(s, a);
1433
+ }
1434
+ }
1435
+ handleTouchStartDolly(t) {
1436
+ const e = this.getSecondPointer(t), s = t.pageX - e.pageX, a = t.pageY - e.pageY, o = Math.sqrt(s * s + a * a);
1437
+ this.dollyStart.set(0, o);
1438
+ }
1439
+ handleTouchStartDollyPan(t) {
1440
+ this.enableZoom && this.handleTouchStartDolly(t), this.enablePan && this.handleTouchStartPan(t);
1441
+ }
1442
+ handleTouchStartDollyRotate(t) {
1443
+ this.enableZoom && this.handleTouchStartDolly(t), this.enableRotate && this.handleTouchStartRotate(t);
1444
+ }
1445
+ handleTouchMoveRotate(t) {
1446
+ if (this.pointers.length === 1)
1447
+ this.rotateEnd.set(t.pageX, t.pageY);
1448
+ else {
1449
+ const s = this.getSecondPointer(t), a = 0.5 * (t.pageX + s.pageX), o = 0.5 * (t.pageY + s.pageY);
1450
+ this.rotateEnd.set(a, o);
1451
+ }
1452
+ const e = t.currentTarget;
1453
+ this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed), this.rotateLeft(
1454
+ 2 * Math.PI * this.rotateDelta.x / e.clientHeight
1455
+ ), this.rotateUp(
1456
+ 2 * Math.PI * this.rotateDelta.y / e.clientHeight
1457
+ ), this.rotateStart.copy(this.rotateEnd);
1458
+ }
1459
+ handleTouchMovePan(t) {
1460
+ if (this.pointers.length === 1)
1461
+ this.panEnd.set(t.pageX, t.pageY);
1462
+ else {
1463
+ const s = this.getSecondPointer(t), a = 0.5 * (t.pageX + s.pageX), o = 0.5 * (t.pageY + s.pageY);
1464
+ this.panEnd.set(a, o);
1465
+ }
1466
+ const e = t.currentTarget;
1467
+ this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed), this.pan(this.panDelta.x, this.panDelta.y, e), this.panStart.copy(this.panEnd);
1468
+ }
1469
+ handleTouchMoveDolly(t) {
1470
+ const e = this.getSecondPointer(t), s = t.pageX - e.pageX, a = t.pageY - e.pageY, o = Math.sqrt(s * s + a * a);
1471
+ this.dollyEnd.set(0, o), this.dollyDelta.set(
1472
+ 0,
1473
+ Math.pow(this.dollyEnd.y / this.dollyStart.y, this.zoomSpeed)
1474
+ ), this.dollyOut(this.dollyDelta.y), this.dollyStart.copy(this.dollyEnd);
1475
+ }
1476
+ handleTouchMoveDollyPan(t) {
1477
+ this.enableZoom && this.handleTouchMoveDolly(t), this.enablePan && this.handleTouchMovePan(t);
1478
+ }
1479
+ handleTouchMoveDollyRotate(t) {
1480
+ this.enableZoom && this.handleTouchMoveDolly(t), this.enableRotate && this.handleTouchMoveRotate(t);
1481
+ }
1482
+ addPointer(t) {
1483
+ this.pointers.push(t);
1484
+ }
1485
+ removePointer(t) {
1486
+ delete this.pointerPositions[t.pointerId];
1487
+ for (let e = 0; e < this.pointers.length; e++)
1488
+ if (this.pointers[e].pointerId == t.pointerId) {
1489
+ this.pointers.splice(e, 1);
1490
+ return;
1491
+ }
1492
+ }
1493
+ trackPointer(t) {
1494
+ let e = this.pointerPositions[t.pointerId];
1495
+ e === void 0 && (e = new p(), this.pointerPositions[t.pointerId] = e), e.set(t.pageX, t.pageY);
1496
+ }
1497
+ getSecondPointer(t) {
1498
+ return this.pointers[0].pointerId === t.pointerId ? this.pointers[1] : this.pointers[0];
1499
+ }
1500
+ isTrackingPointer(t) {
1501
+ return this.pointers.some(
1502
+ (e) => e.pointerId === t.pointerId
1503
+ );
1504
+ }
1505
+ };
1506
+ i(b, "DEFAULT_ZOOM_FACTOR", 1);
1507
+ let B = b;
1508
+ class Gt extends w {
1509
+ constructor() {
1510
+ super();
1511
+ i(this, "_axesHelper");
1512
+ this._axesHelper = new gt(0.5), this._axesHelper.layers.mask = y, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
1513
+ new g(Wt),
1514
+ new g(Zt),
1515
+ new g(Nt)
1516
+ );
1517
+ const t = new M("X", 0.2, W), e = new M("Y", 0.2, Z), s = new M("Z", 0.2, N);
1518
+ t.layers.mask = y, e.layers.mask = y, s.layers.mask = y, t.position.set(0.7, 0, 0), e.position.set(0, 0.7, 0), s.position.set(0, 0, 0.7), this._axesHelper.add(t), this._axesHelper.add(e), this._axesHelper.add(s);
1519
+ }
1520
+ setFromCameraMatrix(t) {
1521
+ this._axesHelper.rotation.setFromRotationMatrix(
1522
+ new _t().extractRotation(t).invert()
1523
+ );
1524
+ }
1525
+ }
1526
+ class Ft {
1527
+ constructor(n, t, e) {
1528
+ i(this, "uuid", E.generateUUID());
1529
+ i(this, "_axes");
1530
+ i(this, "_orthographicCamera");
1531
+ i(this, "_restoreViewport", new wt());
1532
+ this._renderer = n, this._scene = t, this._camera = e, this._orthographicCamera = new ft(
1533
+ -1,
1534
+ 1,
1535
+ 1,
1536
+ -1,
1537
+ 0.1,
1538
+ 100
1539
+ ), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new Gt(), this._scene.add(this._axes);
1540
+ }
1541
+ tick() {
1542
+ const n = this._scene.background;
1543
+ this._scene.background = null, this._renderer.webglrenderer.getViewport(this._restoreViewport), this._renderer.webglrenderer.setViewport(0, 0, 150, 150), this._renderer.webglrenderer.autoClear = !1, this._axes.setFromCameraMatrix(this._camera.matrix), this._renderer.webglrenderer.render(
1544
+ this._scene,
1545
+ this._orthographicCamera
1546
+ ), this._renderer.webglrenderer.setViewport(this._restoreViewport), this._renderer.webglrenderer.autoClear = !0, this._scene.background = n;
1547
+ }
1548
+ dispose() {
1549
+ this._scene.remove(this._axes), this._scene.remove(this._orthographicCamera);
1550
+ }
1551
+ }
1552
+ const Ut = `
1553
+ @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
1554
+ @@@@+-:::::::---------------------==------------------------------=#@@@@
1555
+ @@%=::::.......::---------------------------------------------------------+@@
1556
+ @@+:::...........::-----------------------------------------------------------#@@
1557
+ @@=:::.........::::::-------------------------------------------------------------%@
1558
+ @%:::.......:::::::-----------------------------------------------------------------#@
1559
+ @*:::.....:::::-----------------------------------------------------------------------*@
1560
+ @%::::::.::::---------------------------------------------------------------------------@@
1561
+ @@-:::::::::-----------------------------------------------------------------------------=@
1562
+ @%::::::::--------------------------------------------------------------------------------%@
1563
+ @+::::::::--------------------------------=@@@@@%-----------------------------------------%@
1564
+ @=:::::::--------------------------------*@@ @@+---------------------------------------#@
1565
+ @+:::::::-------------------------------*@ @*--------------------------------------%@
1566
+ @#::::::::-----------------------------=@@ @@=-------------------------------------%@
1567
+ @@-::::::::----------------------------@@ @@------------------------------------=@
1568
+ @%:::::::::--------------------------*@ @*-----------------------------------@@
1569
+ @*:::::::::-------------------------@@ @@----------------------------------%@
1570
+ @#::::::::::----------------------%@ @%--------------------------------%@
1571
+ @#:::::::::::-------------------=@@ @@=------------------------------%@
1572
+ @@-::::::::::::----------------%@ @%----------------------------=@@
1573
+ @@#::::::::::::::------------*@ @*--------------------------#@@
1574
+ @@+::::::::::::::::--------@@ @@------------------------+@@
1575
+ @@*:::::::::::::::::----@@ @@---------------------+@@
1576
+ @@@-:::::::::::::::--#@ @#-----------------=%@@
1577
+ @@%-::::::::::::-%@ @%-------------=%@@
1578
+ @@@@+:::::::#@@ @@*-------*@@@@
1579
+ @@@@@@@ @@@@@@
1580
+ `;
1581
+ window.DIVE = {
1582
+ instances: [],
1583
+ get instance() {
1584
+ return window.DIVE.instances[0];
1585
+ }
1586
+ };
1587
+ const Ht = {
1588
+ autoStart: !0,
1589
+ displayAxes: !1,
1590
+ ...D,
1591
+ ...St,
1592
+ ...H,
1593
+ ...zt
1594
+ };
1595
+ class Yt {
1596
+ constructor(n) {
1597
+ // descriptive members
1598
+ i(this, "_instanceId", E.generateUUID());
1599
+ i(this, "_settings");
1600
+ i(this, "_views");
1601
+ i(this, "_mainView");
1602
+ i(this, "_scene");
1603
+ i(this, "_clock");
1604
+ i(this, "orientationDisplay");
1605
+ this._settings = {
1606
+ ...Ht,
1607
+ ...n ?? {}
1608
+ }, this._clock = new Pt(), this._scene = new Bt();
1609
+ const t = new O(
1610
+ this._scene,
1611
+ new C(),
1612
+ this._settings
1613
+ );
1614
+ this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new Ft(
1615
+ this.mainView.renderer,
1616
+ this.scene,
1617
+ this.mainView.camera
1618
+ ), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.1.0 initialized successfully!"), console.log(Ut), window.DIVE.instances.push(this);
1619
+ }
1620
+ /**
1621
+ * @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
1622
+ */
1623
+ static async QuickView(n, t) {
1624
+ return import("../plugins/quickview/index.mjs").then(
1625
+ ({ QuickView: e }) => e(n, t)
1626
+ );
1627
+ }
1628
+ /**
1629
+ * @deprecated This property will be removed in a future version. Please use properties on the DIVE instance and mainView directly.
1630
+ */
1631
+ get engine() {
1632
+ return Object.assign(this, {
1633
+ camera: this.mainView.camera,
1634
+ renderer: this.mainView.renderer,
1635
+ setCanvas: (n) => {
1636
+ this.mainView.setCanvas(n);
1637
+ },
1638
+ start: () => {
1639
+ this.start();
1640
+ },
1641
+ stop: () => {
1642
+ this.stop();
1643
+ },
1644
+ dispose: () => {
1645
+ this.dispose();
1646
+ }
1647
+ });
1648
+ }
1649
+ get views() {
1650
+ return this._views;
1651
+ }
1652
+ get mainView() {
1653
+ return this._mainView;
1654
+ }
1655
+ get canvas() {
1656
+ return this.mainView.canvas;
1657
+ }
1658
+ get scene() {
1659
+ return this._scene;
1660
+ }
1661
+ get clock() {
1662
+ return this._clock;
1663
+ }
1664
+ start() {
1665
+ this._clock.start();
1666
+ }
1667
+ stop() {
1668
+ this._clock.stop();
1669
+ }
1670
+ async dispose() {
1671
+ return new Promise((n) => {
1672
+ this._views.forEach((t) => {
1673
+ t.dispose();
1674
+ }), this._views = [], this.orientationDisplay && (this._clock.removeTicker(this.orientationDisplay), this.orientationDisplay.dispose()), window.DIVE.instances = window.DIVE.instances.filter(
1675
+ (t) => t._instanceId !== this._instanceId
1676
+ ), n();
1677
+ });
1678
+ }
1679
+ createView(n) {
1680
+ const t = new O(
1681
+ this._scene,
1682
+ n ?? new C(),
1683
+ {
1684
+ ...this._settings,
1685
+ canvas: void 0
1686
+ // instantiate new canvas for created view
1687
+ }
1688
+ );
1689
+ return this._views.push(t), this._clock.addTicker(t), this._views.length === 1 && (this._mainView = t), t;
1690
+ }
1691
+ disposeView(n) {
1692
+ this._views = this._views.filter((t) => t !== n), this._clock.removeTicker(n), this._mainView === n && (this._mainView = this._views[0]), n.dispose();
1693
+ }
1694
+ }
1695
+ const ee = Yt, W = "#c20017", Z = "#00ab26", N = "#0081d4", Wt = W, Zt = Z, Nt = N;
1696
+ class Xt extends P {
1697
+ /**
1698
+ * Creates a new BoundingBox instance for the specified 3D object.
1699
+ *
1700
+ * The constructor computes both a bounding box and bounding sphere for the given object.
1701
+ * It handles complex objects with multiple meshes and nested transformations.
1702
+ *
1703
+ * @param object - The 3D object to compute bounding volumes for
1704
+ * @param axisAligned - Whether to create an axis-aligned bounding box (true) or oriented bounding box (false). Defaults to false.
1705
+ * @param wireframeColor - The color for the wireframe helpers. Can be a hex number or ColorRepresentation. Defaults to green (0x00ff00).
1706
+ *
1707
+ * @example
1708
+ * ```typescript
1709
+ * // Create an oriented bounding box (aligned with object's rotation)
1710
+ * const obb = new BoundingBox(mesh, false, 0x00ff00);
1711
+ *
1712
+ * // Create an axis-aligned bounding box (aligned with world coordinates)
1713
+ * const aabb = new BoundingBox(mesh, true, 0xff0000);
1714
+ *
1715
+ * // Use default green color
1716
+ * const defaultBox = new BoundingBox(mesh);
1717
+ * ```
1718
+ */
1719
+ constructor(t, e = !1, s = 65280) {
1720
+ super();
1721
+ /** The computed bounding box (Box3) */
1722
+ i(this, "_box");
1723
+ /** The computed bounding sphere (Sphere) */
1724
+ i(this, "_sphere");
1725
+ /** The center point of the bounding box */
1726
+ i(this, "_center");
1727
+ /** The radius of the bounding sphere */
1728
+ i(this, "_radius");
1729
+ /** Visual helper for the bounding box wireframe */
1730
+ i(this, "_boxHelper");
1731
+ /** Visual helper for the bounding sphere wireframe */
1732
+ i(this, "_sphereHelper");
1733
+ /** The dimensions (width, height, depth) of the bounding box */
1734
+ i(this, "_size");
1735
+ const a = new I();
1736
+ e ? a.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
1737
+ if (l.isMesh) {
1738
+ const c = l, d = c.geometry.clone();
1739
+ d.applyMatrix4(c.matrixWorld);
1740
+ const u = c.getWorldQuaternion(new x()).invert();
1741
+ d.applyQuaternion(u), d.computeBoundingBox(), d.boundingBox && a.union(d.boundingBox);
1742
+ }
1743
+ })), this.rotation.copy(t.rotation), this._box = a, this._size = a.getSize(new h()), this._center = a.getCenter(new h()), this._boxHelper = new yt(this._box, s), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = a.getBoundingSphere(new bt()), this._radius = this._sphere.radius;
1744
+ const o = new T(this._radius, 32, 32);
1745
+ o.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new S(
1746
+ o,
1747
+ new z({ color: s, wireframe: !0 })
1748
+ ), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
1749
+ }
1750
+ /**
1751
+ * Gets the computed bounding box.
1752
+ * @returns The Box3 instance representing the bounding box
1753
+ */
1754
+ get box() {
1755
+ return this._box;
1756
+ }
1757
+ /**
1758
+ * Gets the computed bounding sphere.
1759
+ * @returns The Sphere instance representing the bounding sphere
1760
+ */
1761
+ get sphere() {
1762
+ return this._sphere;
1763
+ }
1764
+ /**
1765
+ * Gets the center point of the bounding box.
1766
+ * @returns A Vector3 representing the center coordinates
1767
+ */
1768
+ get center() {
1769
+ return this._center;
1770
+ }
1771
+ /**
1772
+ * Gets the radius of the bounding sphere.
1773
+ * @returns The radius as a number
1774
+ */
1775
+ get radius() {
1776
+ return this._radius;
1777
+ }
1778
+ /**
1779
+ * Gets the dimensions of the bounding box.
1780
+ * @returns A Vector3 representing width, height, and depth
1781
+ */
1782
+ get size() {
1783
+ return this._size;
1784
+ }
1785
+ /**
1786
+ * Sets the visibility of the bounding box wireframe helper.
1787
+ *
1788
+ * @param visible - Whether the box helper should be visible
1789
+ *
1790
+ * @example
1791
+ * ```typescript
1792
+ * const boundingBox = new BoundingBox(mesh);
1793
+ *
1794
+ * // Show the bounding box wireframe
1795
+ * boundingBox.setBoxHelperVisible(true);
1796
+ *
1797
+ * // Hide the bounding box wireframe
1798
+ * boundingBox.setBoxHelperVisible(false);
1799
+ * ```
1800
+ */
1801
+ setBoxHelperVisible(t) {
1802
+ this._boxHelper.visible = t;
1803
+ }
1804
+ /**
1805
+ * Sets the visibility of the bounding sphere wireframe helper.
1806
+ *
1807
+ * @param visible - Whether the sphere helper should be visible
1808
+ *
1809
+ * @example
1810
+ * ```typescript
1811
+ * const boundingBox = new BoundingBox(mesh);
1812
+ *
1813
+ * // Show the bounding sphere wireframe
1814
+ * boundingBox.setSphereHelperVisible(true);
1815
+ *
1816
+ * // Hide the bounding sphere wireframe
1817
+ * boundingBox.setSphereHelperVisible(false);
1818
+ * ```
1819
+ */
1820
+ setSphereHelperVisible(t) {
1821
+ this._sphereHelper.visible = t;
1822
+ }
1823
+ }
1824
+ const qt = {
1825
+ glb: {
1826
+ key: "glb",
1827
+ extension: "glb"
1828
+ },
1829
+ gltf: {
1830
+ key: "gltf",
1831
+ extension: "gltf"
1832
+ },
1833
+ usdz: {
1834
+ key: "usdz",
1835
+ extension: "usdz"
1836
+ }
1837
+ }, ie = Object.values(qt).map(
1838
+ (r) => r.extension
1839
+ );
1840
+ export {
1841
+ Wt as A,
1842
+ P as B,
1843
+ Lt as C,
1844
+ Ht as D,
1845
+ Vt as E,
1846
+ Xt as F,
1847
+ At as G,
1848
+ k as H,
1849
+ qt as I,
1850
+ zt as O,
1851
+ ie as S,
1852
+ B as a,
1853
+ Ft as b,
1854
+ Gt as c,
1855
+ Yt as d,
1856
+ Tt as e,
1857
+ It as f,
1858
+ Zt as g,
1859
+ Nt as h,
1860
+ ee as i,
1861
+ Pt as j,
1862
+ H as k,
1863
+ Y as l,
1864
+ te as m,
1865
+ vt as n,
1866
+ D as o,
1867
+ Bt as p,
1868
+ O as q,
1869
+ W as r,
1870
+ Z as s,
1871
+ N as t,
1872
+ Ct as u,
1873
+ Rt as v,
1874
+ Ot as w,
1875
+ kt as x,
1876
+ Mt as y,
1877
+ xt as z
1878
+ };