@shopware-ag/dive 2.2.4 → 2.2.6

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 (32) hide show
  1. package/build/chunks/{AssetCache-BQFuZyej.mjs → AssetCache-3ouLCwG8.mjs} +1 -1
  2. package/build/chunks/{AssetCache-BNppFVgO.cjs → AssetCache-DhgU13Qu.cjs} +1 -1
  3. package/build/chunks/{AssetLoader-E2Xdqd44.mjs → AssetLoader-MNABEWSP.mjs} +2 -2
  4. package/build/chunks/{AssetLoader-rt-Pr_wb.cjs → AssetLoader-Y1WUrflq.cjs} +1 -1
  5. package/build/chunks/AxisHelperColors-BrGqktN5.cjs +1 -0
  6. package/build/chunks/AxisHelperColors-JLBHYQDi.mjs +9 -0
  7. package/build/chunks/{FileTypes-C6ZTNzXM.mjs → FileTypes-B5EJOgeX.mjs} +172 -221
  8. package/build/chunks/FileTypes-CsaIrcSz.cjs +29 -0
  9. package/build/chunks/{SelectTool-B6qvhxVy.mjs → SelectTool-BrK1C-h9.mjs} +14 -13
  10. package/build/chunks/SelectTool-COXzVZGs.cjs +1 -0
  11. package/build/dive.cjs +1 -1
  12. package/build/dive.mjs +61 -60
  13. package/build/engine/Dive.d.ts +1 -1
  14. package/build/plugins/ar/index.cjs +1 -1
  15. package/build/plugins/ar/index.mjs +1 -1
  16. package/build/plugins/assetcache/index.cjs +1 -1
  17. package/build/plugins/assetcache/index.mjs +1 -1
  18. package/build/plugins/assetloader/index.cjs +1 -1
  19. package/build/plugins/assetloader/index.mjs +1 -1
  20. package/build/plugins/orbitcontroller/index.cjs +1 -1
  21. package/build/plugins/orbitcontroller/index.mjs +1 -1
  22. package/build/plugins/orientationdisplay/index.cjs +1 -1
  23. package/build/plugins/orientationdisplay/index.mjs +54 -3
  24. package/build/plugins/quickview/index.cjs +1 -1
  25. package/build/plugins/quickview/index.mjs +6 -6
  26. package/build/plugins/state/index.cjs +1 -1
  27. package/build/plugins/state/index.mjs +2 -2
  28. package/build/plugins/toolbox/index.cjs +1 -1
  29. package/build/plugins/toolbox/index.mjs +2 -2
  30. package/package.json +1 -1
  31. package/build/chunks/FileTypes-CXhRE6Gs.cjs +0 -29
  32. package/build/chunks/SelectTool-L7SsQpDR.cjs +0 -1
@@ -0,0 +1,29 @@
1
+ "use strict";var N=Object.defineProperty;var Z=(h,a,e)=>a in h?N(h,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[a]=e;var i=(h,a,e)=>Z(h,typeof a!="symbol"?a+"":a,e);const s=require("three"),c=require("./PerspectiveCamera-iAsZqrnY.cjs");class T{constructor(){i(this,"isDIVEClock",!0);i(this,"_lastTime",0);i(this,"_isRunning",!1);i(this,"_tickers",[])}start(){this._isRunning||(this._isRunning=!0,this._lastTime=performance.now(),requestAnimationFrame(this._tick.bind(this)))}stop(){this._isRunning=!1}addTicker(a){this._tickers.find(e=>e.uuid===a.uuid)||this._tickers.push(a)}hasTicker(a){return this._tickers.find(e=>e.uuid===a.uuid)!==void 0}removeTicker(a){const e=this._tickers.findIndex(t=>t.uuid===a.uuid);e!==-1&&this._tickers.splice(e,1)}dispose(){this.stop(),this._tickers=[],this._isRunning=!1,this._lastTime=0}_tick(a){if(!this._isRunning)return;const e=(a-this._lastTime)/1e3;this._lastTime=a,this._tickers.forEach(t=>t.tick(e)),requestAnimationFrame(this._tick.bind(this))}}const P={canvas:void 0,antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp",stencil:!1,depth:!0,logarithmicDepthBuffer:!1,shadows:!0,shadowQuality:"high"};class M{constructor(a,e,t){i(this,"isDIVERenderer",!0);i(this,"_webglrenderer");i(this,"_settings");this._scene=a,this._camera=e,this._settings={...P,...t??{}},this._webglrenderer=this._createWebGLRenderer()}get webglrenderer(){return this._webglrenderer}get canvas(){return this._webglrenderer.domElement}render(){this._webglrenderer.render(this._scene,this._camera)}onResize(a,e){this._webglrenderer.setSize(a,e,!1)}dispose(){this._webglrenderer.dispose()}setCanvas(a){this._webglrenderer.dispose(),this._settings.canvas=a,this._webglrenderer=this._createWebGLRenderer()}_createWebGLRenderer(){const a=new s.WebGLRenderer(this._settings);return a.shadowMap.enabled=this._settings.shadows,a.shadowMap.type=this._settings.shadowQuality==="high"?s.PCFSoftShadowMap:this._settings.shadowQuality==="medium"?s.PCFShadowMap:s.BasicShadowMap,a.setPixelRatio(window.devicePixelRatio),a}}const X=M;class V{constructor(a,e){i(this,"isDIVEResizeManager",!0);i(this,"_resizeObserver");i(this,"_width",0);i(this,"_height",0);this._renderer=a,this._camera=e,this._resizeObserver=new ResizeObserver(t=>{const n=t[0],{width:r,height:o}=n.contentRect;r===this._width&&o===this._height||(this._camera.onResize(r,o),this._renderer.onResize(r,o),this._width=r,this._height=o,this._renderer.render())}),this._observeCanvas(this._renderer.canvas)}setCanvas(a){this._resizeObserver.disconnect(),this._observeCanvas(a);const{width:e,height:t}=a.getBoundingClientRect();this._camera.onResize(e,t),this._renderer.onResize(e,t),this._width=e,this._height=t,this._renderer.render()}dispose(){this._resizeObserver.disconnect()}_observeCanvas(a){if(a.parentElement)this._resizeObserver.observe(a.parentElement);else{const e=setInterval(()=>{a.parentElement&&(this._resizeObserver.observe(a.parentElement),clearInterval(e))},16)}}}class b{constructor(a,e,t){i(this,"isDIVEView",!0);i(this,"uuid",s.MathUtils.generateUUID());i(this,"_paused",!1);i(this,"_renderer");i(this,"_resizeManager");this._scene=a,this._camera=e,this._settings=t,this._renderer=new M(this._scene,this._camera,this._settings),this._resizeManager=new V(this._renderer,this._camera)}get renderer(){return this._renderer}get camera(){return this._camera}get canvas(){return this._renderer.canvas}tick(){this._paused||this._renderer.render()}dispose(){this._resizeManager.dispose(),this._renderer.dispose()}onResize(a,e){this._renderer.onResize(a,e),this._camera.onResize(a,e)}setCanvas(a){this._renderer.setCanvas(a),this._resizeManager.setCanvas(a),this.onResize(this._renderer.canvas.clientWidth,this._renderer.canvas.clientHeight)}pause(){this._paused=!0}resume(){this._paused=!1}}class R extends s.Object3D{constructor(){super();i(this,"isDIVELight",!0);i(this,"isDIVEAmbientLight",!0);i(this,"isSelectable",!0);i(this,"_light");this.name="DIVEAmbientLight",this._light=new s.AmbientLight(16777215,1),this._light.layers.mask=c.PRODUCT_LAYER_MASK,this.add(this._light)}setColor(e){this._light.color=e}setIntensity(e){this._light.intensity=e}setEnabled(e){this._light.visible=e}}class x extends s.Object3D{constructor(){super();i(this,"isDIVELight",!0);i(this,"isDIVEPointLight",!0);i(this,"isMovable",!0);i(this,"isSelectable",!0);i(this,"gizmo",null);i(this,"light");i(this,"mesh");this.name="DIVEPointLight",this.light=new s.PointLight(16777215,1),this.light.layers.mask=c.PRODUCT_LAYER_MASK,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const e=.1,t=new s.SphereGeometry(e,e*320,e*320),n=new s.MeshBasicMaterial({color:this.light.color,transparent:!0,opacity:.8,side:s.FrontSide});this.mesh=new s.Mesh(t,n),this.mesh.layers.mask=c.UI_LAYER_MASK,this.add(this.mesh)}setColor(e){this.light.color=e,this.mesh.material.color=e}setIntensity(e){this.light.intensity=e,this.mesh.material.opacity=e>.8?.8:e*.8}setEnabled(e){this.light.visible=e}onMove(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})})}onSelect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class k extends s.Object3D{constructor(){super();i(this,"isDIVELight",!0);i(this,"isDIVESceneLight",!0);i(this,"isSelectable",!0);i(this,"_hemiLight");i(this,"_dirLight");this.name="DIVESceneLight",this._hemiLight=new s.HemisphereLight(16777215,16777215,2),this._hemiLight.layers.mask=c.PRODUCT_LAYER_MASK,this._hemiLight.position.set(0,50,0),this._hemiLight.visible=!0,this.add(this._hemiLight),this._dirLight=new s.DirectionalLight(16777215,3),this._dirLight.layers.mask=c.PRODUCT_LAYER_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;const e=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=e,this._dirLight.shadow.camera.top=e,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}setColor(e){this._hemiLight.color=e,this._dirLight.color=e}setIntensity(e){this._hemiLight.intensity=e*2,this._dirLight.intensity=e*3}setEnabled(e){this._hemiLight.visible=e,this._dirLight.visible=e}}const I=h=>h.parent?I(h.parent):h;class D extends s.Object3D{constructor(){super();i(this,"isSelectable",!0);i(this,"isMovable",!0);i(this,"isDIVENode",!0);i(this,"gizmo",null);i(this,"_positionWorldBuffer");i(this,"_boundingBox");this.layers.mask=c.PRODUCT_LAYER_MASK,this._positionWorldBuffer=new s.Vector3,this._boundingBox=new s.Box3}setPosition(e){if(!this.parent){this.position.set(e.x,e.y,e.z);return}const t=new s.Vector3(e.x,e.y,e.z);this.position.copy(this.parent.worldToLocal(t)),"isDIVEGroup"in this.parent&&this.parent.updateLineTo(this)}setRotation(e){this.rotation.set(e.x,e.y,e.z)}setScale(e){this.scale.set(e.x,e.y,e.z)}setVisibility(e){this.visible=e}setToWorldOrigin(){this.position.set(0,0,0),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onMove(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})})}onSelect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("SELECT_OBJECT",{id:this.userData.id})})}onDeselect(){Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:e})=>{var t;(t=e.get(this.userData.id))==null||t.performAction("DESELECT_OBJECT",{id:this.userData.id})})}}class y extends D{constructor(e,t=!1,n=65280){super();i(this,"_box");i(this,"_sphere");i(this,"_center");i(this,"_radius");i(this,"_boxHelper");i(this,"_sphereHelper");i(this,"_size");const r=new s.Box3;t?r.setFromObject(e):(e.updateWorldMatrix(!0,!0),e.traverse(l=>{if(l.isMesh){const d=l,u=d.geometry.clone();u.applyMatrix4(d.matrixWorld);const g=d.getWorldQuaternion(new s.Quaternion).invert();u.applyQuaternion(g),u.computeBoundingBox(),u.boundingBox&&r.union(u.boundingBox)}})),this.rotation.copy(e.rotation),this._box=r,this._size=r.getSize(new s.Vector3),this._center=r.getCenter(new s.Vector3),this._boxHelper=new s.Box3Helper(this._box,n),this._boxHelper.visible=!1,this.add(this._boxHelper),this._sphere=r.getBoundingSphere(new s.Sphere),this._radius=this._sphere.radius;const o=new s.SphereGeometry(this._radius,32,32);o.translate(this._center.x,this._center.y,this._center.z),this._sphereHelper=new s.Mesh(o,new s.MeshBasicMaterial({color:n,wireframe:!0})),this._sphereHelper.visible=!1,this.add(this._sphereHelper)}get box(){return this._box}get sphere(){return this._sphere}get center(){return this._center}get radius(){return this._radius}get size(){return this._size}setBoxHelperVisible(e){this._boxHelper.visible=e}setSphereHelperVisible(e){this._sphereHelper.visible=e}}class v extends D{constructor(){super();i(this,"isDIVEModel",!0);i(this,"_gltf",null);i(this,"_mesh",null);i(this,"_material",null);i(this,"_assetLoader",null);this.name="DIVEModel"}async _getAssetLoader(){return this._assetLoader||(this._assetLoader=new(await Promise.resolve().then(()=>require("../plugins/assetloader/index.cjs"))).AssetLoader),this._assetLoader}async setFromURL(e){const n=await(await this._getAssetLoader()).load(e);return this.setFromGLTF(n),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:r})=>{var o;(o=r.get(this.userData.id))==null||o.performAction("MODEL_LOADED",{id:this.userData.id})}),this}setFromGLTF(e){return this.clear(),this._boundingBox.makeEmpty(),this._gltf=e,this._gltf.name="GLTF",this._gltf.traverse(t=>{t.castShadow=!0,t.receiveShadow=!0,t.layers.mask=this.layers.mask,this._boundingBox.expandByObject(t),!this._mesh&&"isMesh"in t&&(this._mesh=t,this._material?this._mesh.material=this._material:this._material=t.material)}),this.add(this._gltf),this}setMaterial(e){this._material||(this._material=new s.MeshStandardMaterial),e.vertexColors!==void 0&&(this._material.vertexColors=e.vertexColors),e.color!==void 0&&this._material.color.set(e.color),e.map!==void 0&&(this._material.map=e.map),e.normalMap!==void 0&&(this._material.normalMap=e.normalMap),e.roughness!==void 0&&(this._material.roughness=e.roughness),e.roughnessMap!==void 0&&(this._material.roughnessMap=e.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),e.metalness!==void 0&&(this._material.metalness=e.metalness),e.metalnessMap!==void 0&&(this._material.metalnessMap=e.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}placeOnFloor(){this.updateWorldMatrix(!0,!0);const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone(),n=new s.Box3;this.children.forEach(o=>{o instanceof y||n.expandByObject(o,!0)});const r=-n.min.y;Math.abs(r)<1e-9||(e.y+=r,e.y!==t.y&&(this.setPosition(e),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:o})=>{var l;(l=o.get(this.userData.id))==null||l.performAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})}),this.onMove()))}dropIt(){if(!this.parent){console.warn("DIVEModel: dropIt() called on a model that is not in the scene.",this);return}const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone(),n=new s.Box3;this.children.forEach(d=>{d instanceof y||n.expandByObject(d,!0)});const r=n.getCenter(new s.Vector3);r.y=n.min.y;const o=new s.Raycaster(r,new s.Vector3(0,-1,0));o.layers.mask=c.PRODUCT_LAYER_MASK;const l=o.intersectObjects(I(this).root.children,!0);if(l.length>0){const d=l[0].object,f=new s.Box3().setFromObject(d).max.y-n.min.y;if(Math.abs(f)<1e-9||(e.y+=f,e.y===t.y))return;this.setPosition(e),Promise.resolve().then(()=>require("../plugins/state/index.cjs")).then(({State:E})=>{var w;(w=E.get(this.userData.id))==null||w.performAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})}),this.onMove()}else this.placeOnFloor()}}class O extends v{constructor(){super();i(this,"isDIVEPrimitive",!0);i(this,"_mesh");i(this,"_material");this._mesh=new s.Mesh,this._mesh.name="PrimitiveMesh",this._mesh.layers.mask=c.PRODUCT_LAYER_MASK,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this.add(this._mesh),this._material=new s.MeshStandardMaterial,this._mesh.material=this._material}setGeometry(e){const t=this.assembleGeometry(e);t&&(t.computeVertexNormals(),t.computeBoundingBox(),t.computeBoundingSphere(),this._mesh.geometry=t,this._boundingBox.setFromObject(this._mesh))}assembleGeometry(e){switch(this._material.flatShading=!1,e.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(e);case"sphere":return this.createSphereGeometry(e);case"pyramid":return this._material.flatShading=!0,this.createPyramidGeometry(e);case"cube":case"box":return this.createBoxGeometry(e);case"cone":return this.createConeGeometry(e);case"wall":return this.createWallGeometry(e);case"plane":return this.createPlaneGeometry(e);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",e.name.toLowerCase()),null}}createCylinderGeometry(e){const t=new s.CylinderGeometry(e.width/2,e.width/2,e.height,64);return t.translate(0,e.height/2,0),t}createSphereGeometry(e){return new s.SphereGeometry(e.width/2,256,256)}createPyramidGeometry(e){const t=new Float32Array([-e.width/2,0,-e.depth/2,e.width/2,0,-e.depth/2,e.width/2,0,e.depth/2,-e.width/2,0,e.depth/2,0,e.height,0]),n=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),r=new s.BufferGeometry;return r.setAttribute("position",new s.BufferAttribute(t,3)),r.setIndex(new s.BufferAttribute(n,1)),r}createBoxGeometry(e){const t=new s.BoxGeometry(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}createConeGeometry(e){const t=new s.ConeGeometry(e.width/2,e.height,256);return t.translate(0,e.height/2,0),t}createWallGeometry(e){const t=new s.BoxGeometry(e.width,e.height,e.depth||.05,16);return t.translate(0,e.height/2,0),t}createPlaneGeometry(e){const t=new s.BoxGeometry(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}}class A extends D{constructor(){super();i(this,"isDIVEGroup",!0);i(this,"_members");i(this,"_lines");this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}setPosition(e){super.setPosition(e),this._members.forEach(t=>{"isDIVENode"in t&&t.onMove()})}setLinesVisibility(e,t){if(!t){this._lines.forEach(r=>{r.visible=e});return}const n=this._members.indexOf(t);n!==-1&&(this._lines[n].visible=e)}attach(e){if(this._members.includes(e))return this;const t=this.createLine();return this.add(t),this._lines.push(t),super.attach(e),this._members.push(e),this._updateLineTo(t,e),this.setLinesVisibility(!0,e),this}remove(e){const t=this._members.indexOf(e);if(t===-1)return this;const n=this._lines[t];return super.remove(n),this._lines.splice(t,1),super.remove(e),this._members.splice(t,1),this}updateLineTo(e){const t=this._members.indexOf(e);t!==-1&&this._updateLineTo(this._lines[t],e)}createLine(){const e=new s.BufferGeometry,t=new s.LineDashedMaterial({color:6710886,dashSize:.05,gapSize:.025}),n=new s.Line(e,t);return n.visible=!1,n}_updateLineTo(e,t){const n=[new s.Vector3(0,0,0),t.position.clone()];e.geometry.setFromPoints(n),e.computeLineDistances()}}class C extends s.Mesh{constructor(){const e=new s.PlaneGeometry(1,1);e.scale(1e3,1e3,1),e.rotateX(-Math.PI/2);const t=new s.MeshStandardMaterial({color:new s.Color(16777215),side:s.FrontSide});super(e,t);i(this,"isDIVEFloor",!0);this.name="Floor",this.layers.mask=c.PRODUCT_LAYER_MASK,this.receiveShadow=!0}setVisibility(e){this.visible=e}setColor(e){this.material.color=new s.Color(e)}}class z extends s.Object3D{constructor(){super();i(this,"isDIVERoot",!0);i(this,"_floor");this.name="Root",this._floor=new C,this.add(this._floor)}get floor(){return this._floor}computeSceneBB(){const e=new s.Box3;return this.children.forEach(t=>{"isDIVEFloor"in t||t.traverse(n=>{"isObject3D"in n&&e.expandByObject(n)})}),e}getSceneObject(e){let t;return this.traverse(n=>{t||n.userData.id===e.id&&(t=n)}),t}addSceneObject(e){let t=this.getSceneObject(e);if(t)return console.warn(`DIVERoot.addSceneObject: Scene object with id ${e.id} already exists`),t;switch(e.entityType){case"pov":break;case"light":{switch(e.type){case"scene":{t=new k;break}case"ambient":{t=new R;break}case"point":{t=new x;break}default:throw new Error(`DIVERoot.addSceneObject: Unknown light type: ${e.type}`)}t.name=e.name,t.userData.id=e.id,this.add(t),this._updateLight(t,e);break}case"model":{t=new v,t.name=e.name,t.userData.id=e.id,t.userData.uri=e.uri,this.add(t),this._updateModel(t,e);break}case"primitive":{t=new O,t.name=e.name,t.userData.id=e.id,this.add(t),this._updatePrimitive(t,e);break}case"group":{t=new A,t.name=e.name,t.userData.id=e.id,this.add(t),this._updateGroup(t,e);break}default:throw new Error(`DIVERoot.addSceneObject: Unknown entity type: ${e.entityType}`)}return t}updateSceneObject(e){const t=this.getSceneObject(e);if(!t){console.warn(`DIVERoot.updateSceneObject: Scene object with id ${e.id} does not exist`);return}switch(e.entityType){case"pov":break;case"light":{this._updateLight(t,e);break}case"model":{this._updateModel(t,e);break}case"primitive":{this._updatePrimitive(t,e);break}case"group":{this._updateGroup(t,e);break}default:throw new Error(`DIVERoot.updateSceneObject: Unknown entity type: ${e.entityType}`)}}deleteSceneObject(e){const t=this.getSceneObject(e);if(!t){console.warn(`DIVERoot.deleteSceneObject: Object with id ${e.id} not found`);return}switch(e.entityType){case"pov":break;case"light":{this._deleteLight(t);break}case"model":{this._deleteModel(t);break}case"primitive":{this._deletePrimitive(t);break}case"group":{this._deleteGroup(t);break}default:throw new Error(`DIVERoot.deleteSceneObject: Unknown entity type: ${e.entityType}`)}}_updateLight(e,t){t.name!==void 0&&t.name!==null&&(e.name=t.name),t.position!==void 0&&t.position!==null&&e.position.set(t.position.x,t.position.y,t.position.z),t.intensity!==void 0&&t.intensity!==null&&e.setIntensity(t.intensity),t.enabled!==void 0&&t.enabled!==null&&e.setEnabled(t.enabled),t.color!==void 0&&t.color!==null&&e.setColor(new s.Color(t.color)),t.visible!==void 0&&t.visible!==null&&(e.visible=t.visible),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_updateModel(e,t){t.uri!==void 0&&e.setFromURL(t.uri),t.name!==void 0&&(e.name=t.name),t.position!==void 0&&e.setPosition(t.position),t.rotation!==void 0&&e.setRotation(t.rotation),t.scale!==void 0&&e.setScale(t.scale),t.visible!==void 0&&e.setVisibility(t.visible),t.material!==void 0&&e.setMaterial(t.material),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_updatePrimitive(e,t){t.name!==void 0&&(e.name=t.name),t.geometry!==void 0&&e.setGeometry(t.geometry),t.position!==void 0&&e.setPosition(t.position),t.rotation!==void 0&&e.setRotation(t.rotation),t.scale!==void 0&&e.setScale(t.scale),t.visible!==void 0&&e.setVisibility(t.visible),t.material!==void 0&&e.setMaterial(t.material),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_updateGroup(e,t){t.name!==void 0&&(e.name=t.name),t.position!==void 0&&e.setPosition(t.position),t.rotation!==void 0&&e.setRotation(t.rotation),t.scale!==void 0&&e.setScale(t.scale),t.visible!==void 0&&e.setVisibility(t.visible),t.bbVisible!==void 0&&e.setLinesVisibility(t.bbVisible),t.parentId!==void 0&&this._setParent({...t,parentId:t.parentId})}_deleteLight(e){this._detachTransformControls(e),e.parent.remove(e)}_deleteModel(e){this._detachTransformControls(e),e.parent.remove(e)}_deletePrimitive(e){this._detachTransformControls(e),e.parent.remove(e)}_deleteGroup(e){this._detachTransformControls(e);for(let t=e.members.length-1;t>=0;t--)this.attach(e.members[t]);e.parent.remove(e)}_setParent(e){const t=this.getSceneObject(e);if(e.parentId!==null){const n=this.getSceneObject({id:e.parentId,entityType:e.entityType});if(!n)return;n.attach(t)}else this.attach(t)}_detachTransformControls(e){this._findScene(e).children.find(t=>{"isTransformControls"in t&&t.detach()})}_findScene(e){return e.parent!==null?this._findScene(e.parent):e}}const B="#888888",G="#dddddd";class U extends s.Object3D{constructor(){super(),this.name="Grid";const a=new s.GridHelper(100,100,B,G);a.material.depthTest=!1,a.layers.mask=c.HELPER_LAYER_MASK,this.add(a)}setVisibility(a){this.visible=a}}const m={displayFloor:!1,displayGrid:!1,backgroundColor:"#ffffff"};class F extends s.Scene{constructor(e){super();i(this,"isDIVEScene",!0);i(this,"_root");i(this,"_grid");this.setBackground((e==null?void 0:e.backgroundColor)??m.backgroundColor),this._root=new z,this._root.floor.setVisibility((e==null?void 0:e.displayFloor)??m.displayFloor),this.add(this._root),this._grid=new U,this._grid.setVisibility((e==null?void 0:e.displayGrid)??m.displayGrid),this.add(this._grid)}get root(){return this._root}get grid(){return this._grid}setBackground(e){this.background=new s.Color(e)}computeSceneBB(){return this._root.computeSceneBB()}}const Y={enableDamping:!0,dampingFactor:.05,enabled:!0,target:new s.Vector3,minDistance:0,maxDistance:1/0,minZoom:0,maxZoom:1/0,minPolarAngle:0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,maxAzimuthAngle:1/0,enableZoom:!0,zoomSpeed:1,enableRotate:!0,rotateSpeed:1,enablePan:!0,panSpeed:1,screenSpacePanning:!0,keyPanSpeed:7,autoRotate:!1,autoRotateSpeed:2,keys:{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},mouseButtons:{LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},touches:{ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN}},_=class _ extends s.EventDispatcher{constructor(e,t,n){super();i(this,"object");i(this,"domElements");i(this,"enabled",!0);i(this,"target",new s.Vector3);i(this,"minDistance",0);i(this,"maxDistance",1/0);i(this,"minZoom",0);i(this,"maxZoom",1/0);i(this,"minPolarAngle",0);i(this,"maxPolarAngle",Math.PI);i(this,"minAzimuthAngle",-1/0);i(this,"maxAzimuthAngle",1/0);i(this,"enableDamping",!0);i(this,"dampingFactor",.05);i(this,"enableZoom",!0);i(this,"zoomSpeed",1);i(this,"enableRotate",!0);i(this,"rotateSpeed",1);i(this,"enablePan",!0);i(this,"panSpeed",1);i(this,"screenSpacePanning",!0);i(this,"keyPanSpeed",7);i(this,"autoRotate",!1);i(this,"autoRotateSpeed",2);i(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"});i(this,"mouseButtons",{LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN});i(this,"touches",{ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN});i(this,"target0");i(this,"position0");i(this,"zoom0");i(this,"uuid",s.MathUtils.generateUUID());i(this,"state",-1);i(this,"EPS",1e-6);i(this,"spherical",new s.Spherical);i(this,"sphericalDelta",new s.Spherical);i(this,"scale",1);i(this,"panOffset",new s.Vector3);i(this,"zoomChanged",!1);i(this,"rotateStart",new s.Vector2);i(this,"rotateEnd",new s.Vector2);i(this,"rotateDelta",new s.Vector2);i(this,"panStart",new s.Vector2);i(this,"panEnd",new s.Vector2);i(this,"panDelta",new s.Vector2);i(this,"dollyStart",new s.Vector2);i(this,"dollyEnd",new s.Vector2);i(this,"dollyDelta",new s.Vector2);i(this,"pointers",[]);i(this,"pointerPositions",{});i(this,"offset",new s.Vector3);i(this,"quat");i(this,"quatInverse");i(this,"lastPosition",new s.Vector3);i(this,"lastQuaternion",new s.Quaternion);i(this,"lastTarget",new s.Vector3);i(this,"panLeft",(()=>{const e=new s.Vector3;return(t,n)=>{e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),this.panOffset.add(e)}})());i(this,"panUp",(()=>{const e=new s.Vector3;return(t,n)=>{this.screenSpacePanning===!0?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(this.object.up,e)),e.multiplyScalar(t),this.panOffset.add(e)}})());i(this,"onMouseDown",e=>{let t;switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=-1}switch(t){case s.MOUSE.DOLLY:if(this.enableZoom===!1)return;this.handleMouseDownDolly(e),this.state=1;break;case s.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(e),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}break;case s.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(e),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent({type:"start"})});i(this,"onMouseMove",e=>{if(this.enabled!==!1)switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(e);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(e);break}});i(this,"onMouseWheel",e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1||(e.preventDefault(),this.dispatchEvent({type:"start"}),this.handleMouseWheel(e),this.dispatchEvent({type:"end"}))});i(this,"onKeyDown",e=>{this.enabled===!1||this.enablePan===!1||this.handleKeyDown(e)});i(this,"onTouchStart",e=>{switch(this.trackPointer(e),this.pointers.length){case 1:switch(this.touches.ONE){case s.TOUCH.ROTATE:if(this.enableRotate===!1)return;this.handleTouchStartRotate(e),this.state=3;break;case s.TOUCH.PAN:if(this.enablePan===!1)return;this.handleTouchStartPan(e),this.state=4;break;default:this.state=-1}break;case 2:switch(this.touches.TWO){case s.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(e),this.state=5;break;case s.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(e),this.state=6;break;default:this.state=-1}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent({type:"start"})});i(this,"onTouchMove",e=>{switch(this.trackPointer(e),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(e),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(e),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(e),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:this.state=-1}});i(this,"onPointerDown",e=>{if(this.enabled!==!1){if(this.pointers.length===0){const t=e.currentTarget;t.setPointerCapture(e.pointerId),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp)}this.isTrackingPointer(e)||(this.addPointer(e),e.pointerType==="touch"?this.onTouchStart(e):this.onMouseDown(e))}});i(this,"onPointerMove",e=>{this.enabled!==!1&&(e.pointerType==="touch"?this.onTouchMove(e):this.onMouseMove(e))});i(this,"onPointerUp",e=>{if(this.removePointer(e),this.pointers.length===0){const t=e.currentTarget;t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),this.dispatchEvent({type:"end"}),this.state=-1}});i(this,"onPointerCancel",e=>{this.removePointer(e)});i(this,"onContextMenu",e=>{this.enabled!==!1&&e.preventDefault()});this.object=e,this.domElements=Array.isArray(t)?t:[t],Object.assign(this,n),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat=new s.Quaternion().setFromUnitVectors(e.up,new s.Vector3(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.domElements.forEach(r=>this.addEventListeners(r)),this.update()}get domElement(){return this.domElements[0]}tick(){this.enabled&&this.update()}getPolarAngle(){return this.spherical.phi}getAzimuthalAngle(){return this.spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){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}update(){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(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,this.spherical.theta)),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),this.spherical.radius*=this.scale,this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius)),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}dispose(){this.domElements.forEach(e=>this.removeEventListeners(e)),this.dispatchEvent({type:"dispose"})}addDomElements(...e){e.forEach(t=>{this.domElements.includes(t)||(this.domElements.push(t),this.addEventListeners(t))})}removeDomElements(...e){e.forEach(t=>{const n=this.domElements.indexOf(t);n>-1&&(this.removeEventListeners(t),this.domElements.splice(n,1))})}setDomElements(...e){this.removeDomElements(...this.domElements),this.domElements=[],this.addDomElements(...e)}computeEncompassingView(e,t=0){const n=e.center,o=e.sphere.radius,l=this.object.fov*(Math.PI/180),d=this.object.aspect,u=l/2,g=Math.atan(Math.tan(u)*d),f=o/Math.sin(u),E=o/Math.sin(g),w=Math.max(f,E)*(1+t),L=this.object.position.clone().sub(this.target).normalize(),q=L.length()>.001?L:new s.Vector3(0,0,1);return{position:n.clone().add(q.multiplyScalar(w)),target:n}}focusObject(e,t=0){const n=new y(e),r=this.computeEncompassingView(n,t);this.object.position.copy(r.position),this.target.copy(r.target),this.update()}zoomIn(e){this.dollyIn(Math.pow(.95,e??_.DEFAULT_ZOOM_FACTOR)),this.update()}zoomOut(e){this.dollyOut(Math.pow(.95,e??_.DEFAULT_ZOOM_FACTOR)),this.update()}getState(){return{target:this.target.clone(),azimuthalAngle:this.getAzimuthalAngle(),polarAngle:this.getPolarAngle(),distance:this.getDistance(),position:this.object.position.clone(),quaternion:this.object.quaternion.clone()}}setState(e){this.target.copy(e.target),this.object.position.copy(e.position),this.object.quaternion.copy(e.quaternion),this.update()}addEventListeners(e){e.style.touchAction="none",e.addEventListener("contextmenu",this.onContextMenu),e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerCancel),e.addEventListener("wheel",this.onMouseWheel,{passive:!1}),e.addEventListener("keydown",this.onKeyDown)}removeEventListeners(e){e.removeEventListener("contextmenu",this.onContextMenu),e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointercancel",this.onPointerCancel),e.removeEventListener("wheel",this.onMouseWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(e){this.sphericalDelta.theta-=e}rotateUp(e){this.sphericalDelta.phi-=e}pan(e,t,n){const r=new s.Vector3;if("isPerspectiveCamera"in this.object){const o=this.object.position;r.copy(o).sub(this.target);let l=r.length();l*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*l/n.clientHeight,this.object.matrix),this.panUp(2*t*l/n.clientHeight,this.object.matrix)}else"isOrthographicCamera"in this.object?(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitController encountered an unknown camera type - pan disabled."),this.enablePan=!1)}dollyIn(e){"isPerspectiveCamera"in this.object||"isOrthographicCamera"in this.object?this.scale*=e:(console.warn("WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}dollyOut(e){"isPerspectiveCamera"in this.object||"isOrthographicCamera"in this.object?this.scale/=e:(console.warn("WARNING: OrbitController encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}handleMouseDownRotate(e){this.rotateStart.set(e.clientX,e.clientY)}handleMouseDownDolly(e){this.dollyStart.set(e.clientX,e.clientY)}handleMouseDownPan(e){this.panStart.set(e.clientX,e.clientY)}handleMouseMoveRotate(e){this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);const t=e.currentTarget;this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(e){this.dollyEnd.set(e.clientX,e.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()}handleMouseMovePan(e){const t=e.currentTarget;this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y,t),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(e){e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update()}handleKeyDown(e){let t=!1;const n=e.currentTarget;switch(e.code){case this.keys.UP:this.pan(0,this.keyPanSpeed,n),t=!0;break;case this.keys.BOTTOM:this.pan(0,-this.keyPanSpeed,n),t=!0;break;case this.keys.LEFT:this.pan(this.keyPanSpeed,0,n),t=!0;break;case this.keys.RIGHT:this.pan(-this.keyPanSpeed,0,n),t=!0;break}t&&(e.preventDefault(),this.update())}handleTouchStartRotate(e){if(this.pointers.length===1)this.rotateStart.set(e.pageX,e.pageY);else{const t=this.getSecondPointer(e),n=.5*(e.pageX+t.pageX),r=.5*(e.pageY+t.pageY);this.rotateStart.set(n,r)}}handleTouchStartPan(e){if(this.pointers.length===1)this.panStart.set(e.pageX,e.pageY);else{const t=this.getSecondPointer(e),n=.5*(e.pageX+t.pageX),r=.5*(e.pageY+t.pageY);this.panStart.set(n,r)}}handleTouchStartDolly(e){const t=this.getSecondPointer(e),n=e.pageX-t.pageX,r=e.pageY-t.pageY,o=Math.sqrt(n*n+r*r);this.dollyStart.set(0,o)}handleTouchStartDollyPan(e){this.enableZoom&&this.handleTouchStartDolly(e),this.enablePan&&this.handleTouchStartPan(e)}handleTouchStartDollyRotate(e){this.enableZoom&&this.handleTouchStartDolly(e),this.enableRotate&&this.handleTouchStartRotate(e)}handleTouchMoveRotate(e){if(this.pointers.length===1)this.rotateEnd.set(e.pageX,e.pageY);else{const n=this.getSecondPointer(e),r=.5*(e.pageX+n.pageX),o=.5*(e.pageY+n.pageY);this.rotateEnd.set(r,o)}const t=e.currentTarget;this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed),this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(e){if(this.pointers.length===1)this.panEnd.set(e.pageX,e.pageY);else{const n=this.getSecondPointer(e),r=.5*(e.pageX+n.pageX),o=.5*(e.pageY+n.pageY);this.panEnd.set(r,o)}const t=e.currentTarget;this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y,t),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(e){const t=this.getSecondPointer(e),n=e.pageX-t.pageX,r=e.pageY-t.pageY,o=Math.sqrt(n*n+r*r);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}addPointer(e){this.pointers.push(e)}removePointer(e){delete this.pointerPositions[e.pointerId];for(let t=0;t<this.pointers.length;t++)if(this.pointers[t].pointerId==e.pointerId){this.pointers.splice(t,1);return}}trackPointer(e){let t=this.pointerPositions[e.pointerId];t===void 0&&(t=new s.Vector2,this.pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}getSecondPointer(e){return this.pointers[0].pointerId===e.pointerId?this.pointers[1]:this.pointers[0]}isTrackingPointer(e){return this.pointers.some(t=>t.pointerId===e.pointerId)}};i(_,"DEFAULT_ZOOM_FACTOR",1);let S=_;const K=`
2
+ @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
3
+ @@@@+-:::::::---------------------==------------------------------=#@@@@
4
+ @@%=::::.......::---------------------------------------------------------+@@
5
+ @@+:::...........::-----------------------------------------------------------#@@
6
+ @@=:::.........::::::-------------------------------------------------------------%@
7
+ @%:::.......:::::::-----------------------------------------------------------------#@
8
+ @*:::.....:::::-----------------------------------------------------------------------*@
9
+ @%::::::.::::---------------------------------------------------------------------------@@
10
+ @@-:::::::::-----------------------------------------------------------------------------=@
11
+ @%::::::::--------------------------------------------------------------------------------%@
12
+ @+::::::::--------------------------------=@@@@@%-----------------------------------------%@
13
+ @=:::::::--------------------------------*@@ @@+---------------------------------------#@
14
+ @+:::::::-------------------------------*@ @*--------------------------------------%@
15
+ @#::::::::-----------------------------=@@ @@=-------------------------------------%@
16
+ @@-::::::::----------------------------@@ @@------------------------------------=@
17
+ @%:::::::::--------------------------*@ @*-----------------------------------@@
18
+ @*:::::::::-------------------------@@ @@----------------------------------%@
19
+ @#::::::::::----------------------%@ @%--------------------------------%@
20
+ @#:::::::::::-------------------=@@ @@=------------------------------%@
21
+ @@-::::::::::::----------------%@ @%----------------------------=@@
22
+ @@#::::::::::::::------------*@ @*--------------------------#@@
23
+ @@+::::::::::::::::--------@@ @@------------------------+@@
24
+ @@*:::::::::::::::::----@@ @@---------------------+@@
25
+ @@@-:::::::::::::::--#@ @#-----------------=%@@
26
+ @@%-::::::::::::-%@ @%-------------=%@@
27
+ @@@@+:::::::#@@ @@*-------*@@@@
28
+ @@@@@@@ @@@@@@
29
+ `;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const p={autoStart:!0,displayAxes:!1,...m,...c.DIVEPerspectiveCameraDefaultSettings,...P,...Y};class H{constructor(a){i(this,"_instanceId",s.MathUtils.generateUUID());i(this,"_settings");i(this,"_views");i(this,"_mainView");i(this,"_scene");i(this,"_clock");i(this,"_orientationDisplay",null);this._settings={...p,...a??{}},this._clock=new T,this._scene=new F({backgroundColor:(a==null?void 0:a.backgroundColor)??p.backgroundColor,displayGrid:(a==null?void 0:a.displayGrid)??p.displayGrid,displayFloor:(a==null?void 0:a.displayFloor)??p.displayFloor});const e=new b(this._scene,new c.DIVEPerspectiveCamera,this._settings);this._clock.addTicker(e),this._views=[e],this._mainView=e,this._settings.displayAxes&&Promise.resolve().then(()=>require("../plugins/orientationdisplay/index.cjs")).then(({OrientationDisplay:t})=>{this._orientationDisplay=new t(this.mainView.renderer,this.scene,this.mainView.camera),this._clock.addTicker(this._orientationDisplay)}),this._settings.autoStart&&this.start(),console.log("DIVE 2.2.6 initialized successfully!"),console.log(K),window.DIVE.instances.push(this)}static async QuickView(a,e){return Promise.resolve().then(()=>require("../plugins/quickview/index.cjs")).then(({QuickView:t})=>t(a,e))}get engine(){return{scene:this.scene,camera:this.mainView.camera,renderer:this.mainView.renderer,setCanvas:a=>{this.mainView.setCanvas(a)},clock:this.clock,start:()=>{this.start()},stop:()=>{this.stop()},dispose:()=>{this.dispose()}}}get views(){return this._views}get mainView(){return this._mainView}get canvas(){return this.mainView.canvas}get scene(){return this._scene}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}async dispose(){return new Promise(a=>{this._views.forEach(e=>{e.dispose()}),this._views=[],this._orientationDisplay&&(this._clock.removeTicker(this._orientationDisplay),this._orientationDisplay.dispose()),window.DIVE.instances=window.DIVE.instances.filter(e=>e._instanceId!==this._instanceId),a()})}createView(a){const e=new b(this._scene,a??new c.DIVEPerspectiveCamera,{...this._settings,canvas:void 0});return this._views.push(e),this._clock.addTicker(e),this._views.length===1&&(this._mainView=e),e}disposeView(a){this._views=this._views.filter(e=>e!==a),this._clock.removeTicker(a),this._mainView===a&&(this._mainView=this._views[0]),a.dispose()}}const Q=H,W={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"}},J=Object.values(W).map(h=>h.extension);exports.BoundingBox=y;exports.DIVE=H;exports.DIVEAmbientLight=R;exports.DIVEClock=T;exports.DIVEDefaultSettings=p;exports.DIVEEngine=Q;exports.DIVEFloor=C;exports.DIVEGrid=U;exports.DIVEGroup=A;exports.DIVEModel=v;exports.DIVENode=D;exports.DIVEPointLight=x;exports.DIVEPrimitive=O;exports.DIVERenderPipeline=X;exports.DIVERenderer=M;exports.DIVERendererDefaultSettings=P;exports.DIVEResizeManager=V;exports.DIVERoot=z;exports.DIVEScene=F;exports.DIVESceneDefaultSettings=m;exports.DIVESceneLight=k;exports.DIVEView=b;exports.FILE_TYPES=W;exports.GRID_CENTER_LINE_COLOR=B;exports.GRID_SIDE_LINE_COLOR=G;exports.OrbitController=S;exports.OrbitControllerDefaultSettings=Y;exports.SUPPORTED_FILE_TYPES=J;exports.findSceneRecursive=I;
@@ -1,10 +1,11 @@
1
1
  var jt = Object.defineProperty;
2
2
  var Xt = (r, i, t) => i in r ? jt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
3
  var c = (r, i, t) => Xt(r, typeof i != "symbol" ? i + "" : i, t);
4
- import { A as lt, g as ht, h as ct } from "./FileTypes-C6ZTNzXM.mjs";
5
- import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as dt, Float32BufferAttribute as pt, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
4
+ import "./FileTypes-B5EJOgeX.mjs";
5
+ import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as lt, Float32BufferAttribute as ht, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
6
6
  import { f as ot, i as et } from "./findInterface-DbJ5qzbc.mjs";
7
7
  import { P as Ct, U as kt } from "./PerspectiveCamera-BFzE2TQU.mjs";
8
+ import { A as ct, a as dt, b as pt } from "./AxisHelperColors-JLBHYQDi.mjs";
8
9
  const j = new bt(), u = new a(), T = new a(), d = new E(), ut = {
9
10
  X: new a(1, 0, 0),
10
11
  Y: new a(0, 1, 0),
@@ -203,8 +204,8 @@ class Ut extends st {
203
204
  M.translate(0, 0.05, 0);
204
205
  const x = new f(0.08, 0.08, 0.08);
205
206
  x.translate(0, 0.04, 0);
206
- const v = new dt();
207
- v.setAttribute("position", new pt([0, 0, 0, 1, 0, 0], 3));
207
+ const v = new lt();
208
+ v.setAttribute("position", new ht([0, 0, 0, 1, 0, 0], 3));
208
209
  const m = new w(75e-4, 75e-4, 0.5, 3);
209
210
  m.translate(0, 0.25, 0);
210
211
  function b(y, W) {
@@ -212,8 +213,8 @@ class Ut extends st {
212
213
  return S.rotateY(Math.PI / 2), S.rotateX(Math.PI / 2), S;
213
214
  }
214
215
  function Q() {
215
- const y = new dt();
216
- return y.setAttribute("position", new pt([0, 0, 0, 1, 1, 1], 3)), y;
216
+ const y = new lt();
217
+ return y.setAttribute("position", new ht([0, 0, 0, 1, 1, 1], 3)), y;
217
218
  }
218
219
  const A = {
219
220
  X: [
@@ -611,7 +612,7 @@ class Bt {
611
612
  return this._lastPointerDown.distanceTo(this._pointer) > this.POINTER_DRAG_THRESHOLD;
612
613
  }
613
614
  }
614
- const ie = (r) => r.isTransformTool !== void 0;
615
+ const ne = (r) => r.isTransformTool !== void 0;
615
616
  class Nt extends Bt {
616
617
  constructor(t, n) {
617
618
  super(t, n);
@@ -654,7 +655,7 @@ class Nt extends Bt {
654
655
  return t.mode = "translate", t.traverse((n) => {
655
656
  if (!("isMesh" in n)) return;
656
657
  const s = n.material;
657
- n.name === "X" && s.color.set(lt), n.name === "Y" && s.color.set(ht), n.name === "Z" && s.color.set(ct), n.name === "XY" && s.color.set(ct), n.name === "YZ" && s.color.set(lt), n.name === "XZ" && s.color.set(ht);
658
+ n.name === "X" && s.color.set(ct), n.name === "Y" && s.color.set(dt), n.name === "Z" && s.color.set(pt), n.name === "XY" && s.color.set(pt), n.name === "YZ" && s.color.set(ct), n.name === "XZ" && s.color.set(dt);
658
659
  }), t.addEventListener("mouseDown", () => {
659
660
  this._controller.enabled = !1, et(t.object, "isMovable") && t.object.onMoveStart && t.object.onMoveStart();
660
661
  }), t.addEventListener("objectChange", () => {
@@ -667,8 +668,8 @@ class Nt extends Bt {
667
668
  }), t;
668
669
  }
669
670
  }
670
- const ne = (r) => r.isSelectTool !== void 0;
671
- class se extends Nt {
671
+ const se = (r) => r.isSelectTool !== void 0;
672
+ class oe extends Nt {
672
673
  constructor(t, n) {
673
674
  super(t, n);
674
675
  c(this, "isSelectTool", !0);
@@ -709,9 +710,9 @@ class se extends Nt {
709
710
  }
710
711
  }
711
712
  export {
712
- se as D,
713
+ oe as D,
713
714
  Bt as a,
714
- ie as b,
715
+ ne as b,
715
716
  Nt as c,
716
- ne as i
717
+ se as i
717
718
  };
@@ -0,0 +1 @@
1
+ "use strict";var wt=Object.defineProperty;var gt=(r,n,e)=>n in r?wt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>gt(r,typeof n!="symbol"?n+"":n,e);require("./FileTypes-CsaIrcSz.cjs");const t=require("three"),j=require("./findInterface-C6mrvf_t.cjs"),$=require("./PerspectiveCamera-iAsZqrnY.cjs"),Q=require("./AxisHelperColors-BrGqktN5.cjs"),D=new t.Raycaster,p=new t.Vector3,P=new t.Vector3,c=new t.Quaternion,tt={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},U={type:"change"},et={type:"mouseDown"},it={type:"mouseUp",mode:null},nt={type:"objectChange"};class bt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new xt;this._gizmo=o,this.add(o);const s=new Dt;this._plane=s,this.add(s);const a=this;function i(m,y){let A=y;Object.defineProperty(a,m,{get:function(){return A!==void 0?A:y},set:function(x){A!==x&&(A=x,s[m]=x,o[m]=x,a.dispatchEvent({type:m+"-changed",value:x}),a.dispatchEvent(U))}}),a[m]=y,s[m]=y,o[m]=y}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,E=new t.Quaternion,T=new t.Quaternion,z=new t.Vector3,C=new t.Quaternion,K=new t.Vector3,H=new t.Vector3,M=new t.Vector3,S=0,g=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",E),i("worldQuaternionStart",T),i("cameraPosition",z),i("cameraQuaternion",C),i("pointStart",K),i("pointEnd",H),i("rotationAxis",M),i("rotationAngle",S),i("eye",g),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=Mt.bind(this),this._onPointerDown=vt.bind(this),this._onPointerHover=St.bind(this),this._onPointerMove=Pt.bind(this),this._onPointerUp=Et.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&D.setFromCamera(n,this.camera);const e=N(this._gizmo.picker[this.mode],D);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&D.setFromCamera(n,this.camera);const e=N(this._plane,D,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,et.mode=this.mode,this.dispatchEvent(et)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&D.setFromCamera(n,this.camera);const i=N(this._plane,D,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),P.set(d,d,d)}else p.copy(this.pointStart),P.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),P.applyQuaternion(this._worldQuaternionInv),P.divide(p),e.search("X")===-1&&(P.x=1),e.search("Y")===-1&&(P.y=1),e.search("Z")===-1&&(P.z=1);s.scale.copy(this._scaleStart).multiply(P),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(tt[e]),p.copy(tt[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(U),this.dispatchEvent(nt)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(it.mode=this.mode,this.dispatchEvent(it)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(U),this.dispatchEvent(nt),this.pointStart.copy(this.pointEnd))}getRaycaster(){return D}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function Mt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function St(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function vt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Pt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function Et(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function N(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const q=new t.Euler,l=new t.Vector3(0,1,0),ot=new t.Vector3(0,0,0),st=new t.Matrix4,B=new t.Quaternion,F=new t.Quaternion,b=new t.Vector3,rt=new t.Matrix4,O=new t.Vector3(1,0,0),I=new t.Vector3(0,1,0),Z=new t.Vector3(0,0,1),W=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class xt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const E=n.clone();E.color.setHex(65280),E.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const z=n.clone();z.opacity=.25;const C=n.clone();C.color.setHex(16776960),C.opacity=.25,n.clone().color.setHex(16776960);const H=n.clone();H.color.setHex(7895160);const M=new t.CylinderGeometry(0,.04,.1,12);M.translate(0,.05,0);const S=new t.BoxGeometry(.08,.08,.08);S.translate(0,.04,0);const g=new t.BufferGeometry;g.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new t.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function y(_,V){const w=new t.TorusGeometry(_,.0075,3,64,V*Math.PI*2);return w.rotateY(Math.PI/2),w.rotateX(Math.PI/2),w}function A(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const x={X:[[new t.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(M,i),[0,.5,0]],[new t.Mesh(M,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(m,i)]],Z:[[new t.Mesh(M,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(M,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(m,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),z.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},ht={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},ct={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(A(),s),null,null,null,"helper"]],X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},dt={XYZE:[[new t.Mesh(y(.5,1),H),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(y(.5,.5),a)]],Y:[[new t.Mesh(y(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(y(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(y(.75,1),C),null,[0,Math.PI/2,0]]]},pt={AXIS:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},ut={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(m,i)],[new t.Mesh(S,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(m,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),z.clone())]]},ft={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},_t={X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function v(_){const V=new t.Object3D;for(const w in _)for(let G=_[w].length;G--;){const u=_[w][G][0].clone(),L=_[w][G][1],R=_[w][G][2],k=_[w][G][3],yt=_[w][G][4];u.name=w,u.tag=yt,L&&u.position.set(L[0],L[1],L[2]),R&&u.rotation.set(R[0],R[1],R[2]),k&&u.scale.set(k[0],k[1],k[2]),u.updateMatrix();const J=u.geometry.clone();J.applyMatrix4(u.matrix),u.geometry=J,u.renderOrder=1/0,u.position.set(0,0,0),u.rotation.set(0,0,0),u.scale.set(1,1,1),V.add(u)}return V}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=v(x)),this.add(this.gizmo.rotate=v(dt)),this.add(this.gizmo.scale=v(ut)),this.add(this.picker.translate=v(ht)),this.add(this.picker.rotate=v(mt)),this.add(this.picker.scale=v(ft)),this.add(this.helper.translate=v(ct)),this.add(this.helper.rotate=v(pt)),this.add(this.helper.scale=v(_t)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:F;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(q.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(q.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(st.lookAt(ot,l,I)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(B.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(st.lookAt(this.eye,ot,I)),i.name==="X"&&(c.setFromAxisAngle(O,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(I,Math.atan2(l.x,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(Z,Math.atan2(l.y,l.x)),c.multiplyQuaternions(B,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Dt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),W.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),X.copy(I).applyQuaternion(e==="local"?this.worldQuaternion:F),Y.copy(Z).applyQuaternion(e==="local"?this.worldQuaternion:F),l.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(W),b.copy(W).cross(l);break;case"Y":l.copy(this.eye).cross(X),b.copy(X).cross(l);break;case"Z":l.copy(this.eye).cross(Y),b.copy(Y).cross(l);break;case"XY":b.copy(Y);break;case"YZ":b.copy(W);break;case"XZ":l.copy(Y),b.copy(X);break;case"XYZ":case"E":b.set(0,0,0);break}break;case"rotate":default:b.set(0,0,0)}b.length()===0?this.quaternion.copy(this.cameraQuaternion):(rt.lookAt(p.set(0,0,0),b,l),this.quaternion.setFromRotationMatrix(rt)),super.updateMatrixWorld(n)}}class at{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=$.PRODUCT_LAYER_MASK|$.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=j.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=j.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const It=r=>r.isTransformTool!==void 0;class lt extends at{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisible(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new bt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(Q.AxesColorRed),o.name==="Y"&&s.color.set(Q.AxesColorGreen),o.name==="Z"&&s.color.set(Q.AxesColorBlue),o.name==="XY"&&s.color.set(Q.AxesColorBlue),o.name==="YZ"&&s.color.set(Q.AxesColorRed),o.name==="XZ"&&s.color.set(Q.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(j.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tt=r=>r.isSelectTool!==void 0;class At extends lt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisible(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=j.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVEBaseTool=at;exports.DIVESelectTool=At;exports.DIVETransformTool=lt;exports.isSelectTool=Tt;exports.isTransformTool=It;
package/build/dive.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var S=Object.defineProperty;var b=(r,i,e)=>i in r?S(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>b(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./chunks/FileTypes-CXhRE6Gs.cjs"),u=require("./chunks/PerspectiveCamera-iAsZqrnY.cjs"),s=require("three"),I=require("./chunks/findInterface-C6mrvf_t.cjs"),V=require("./chunks/isFileTypeSupported-CrEqYiv9.cjs"),y=require("./chunks/network-error-CdDXil5g.cjs"),w=require("./chunks/parse-error-Dy_EE4rL.cjs"),A=require("./chunks/PovSchema-Co9FznEz.cjs");class E extends s.Object3D{constructor(e,t,o,l,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const c=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(c,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const p=new s.TorusGeometry(t,.1,3,48,o),f=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(p,f),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(l)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function _(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function R(r,i=0){const e=_(r,+i);return _(Math.ceil(e),-i)}function O(r,i=0){const e=_(r,+i);return _(Math.floor(e),-i)}function P(r,i=0){if(r<0)return-P(-r,i);const e=_(r,+i);return _(Math.round(e),-i)}function v(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function H(r,i=0){const e=_(r,+i);return _(Math.round(e),-i).toFixed(i)}function z(r,i=0){const e=_(r,+i);return _(Math.trunc(e),-i)}function G(r){return(s.MathUtils.radToDeg(r)+360)%360}function C(r){return s.MathUtils.degToRad(r)}const x={ceilExp:R,floorExp:O,roundExp:P,toFixedExp:H,truncateExp:z,signedAngleTo:v,radToDeg:G,degToRad:C};class L extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new E("x",1,Math.PI/2,new s.Vector3(1,0,0),h.AxesColorRed)),this.add(new E("y",1,-Math.PI/2,new s.Vector3(0,1,0),h.AxesColorGreen)),this.add(new E("z",1,Math.PI/2,new s.Vector3(0,0,1),h.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(l=>{o?l.highlight=l.axis===e&&o:l.highlight=l.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),l=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=x.signedAngleTo(l,o,e.forwardVector),c=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,c)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class m extends s.Object3D{constructor(e,t,o,l){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(l),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:l,depthTest:!1,depthWrite:!1});const c=new s.Mesh(a,this._lineMaterial);c.layers.mask=u.UI_LAYER_MASK,c.renderOrder=1/0,c.rotateX(Math.PI/2),c.translateY(t/2),this.add(c);const d=new s.CylinderGeometry(.1,.1,t,3),p=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,p),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class T extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new m("x",1,new s.Vector3(1,0,0),h.AxesColorRed)),this.add(new m("y",1,new s.Vector3(0,1,0),h.AxesColorGreen)),this.add(new m("z",1,new s.Vector3(0,0,1),h.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(l=>{o?l.highlight=l.axis===e&&o:l.highlight=l.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,l,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(l),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const c=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:l,depthTest:!1,depthWrite:!1});const d=new s.Mesh(c,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const p=new s.CylinderGeometry(.1,.1,t+a/2,3),f=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(p,f),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class Y extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),h.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),h.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),h.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(l=>{o?l.highlight=l.axis===e&&o:l.highlight=l.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class j extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(l,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const c=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(c,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class N extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new T(e),this._rotateGizmo=new L(e),this._scaleGizmo=new Y(e),this._gizmoPlane=new j,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class F{constructor(){n(this,"isMovable",!0)}}class U{constructor(){n(this,"isSelectable",!0)}}function K(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const l=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,l)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const l=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,l)})}),r}function g(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let c=0;c<r.length;c++)a[c]=g(r[c],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[c,d]of r)a.set(g(c,i),g(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const c of r)a.add(g(c,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const c=Object.getOwnPropertyDescriptor(r,a);if(c)if(c.value!==void 0){const d=g(c.value,i);Object.defineProperty(t,a,{...c,value:d})}else Object.defineProperty(t,a,c)}const l=Object.getOwnPropertySymbols(r);for(const a of l){const c=Object.getOwnPropertyDescriptor(r,a);if(c)if(c.value!==void 0){const d=g(c.value,i);Object.defineProperty(t,a,{...c,value:d})}else Object.defineProperty(t,a,c)}return t}const M=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],l=i[t];if(o.length===0&&l.length===0){e={...e};return}if(o.length!==l.length){e={...e,[t]:i[t]};return}const a=[];if(l.forEach((c,d)=>{const p=M(o[d],l[d]);Object.keys(p).length&&a.push(l[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=M(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function X(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function q(r){return r.entityType==="primitive"}exports.AxesColorBlue=h.AxesColorBlue;exports.AxesColorBlueLetter=h.AxesColorBlueLetter;exports.AxesColorGreen=h.AxesColorGreen;exports.AxesColorGreenLetter=h.AxesColorGreenLetter;exports.AxesColorRed=h.AxesColorRed;exports.AxesColorRedLetter=h.AxesColorRedLetter;exports.BoundingBox=h.BoundingBox;exports.DIVE=h.DIVE;exports.DIVEAmbientLight=h.DIVEAmbientLight;exports.DIVEClock=h.DIVEClock;exports.DIVEDefaultSettings=h.DIVEDefaultSettings;exports.DIVEEngine=h.DIVEEngine;exports.DIVEFloor=h.DIVEFloor;exports.DIVEGrid=h.DIVEGrid;exports.DIVEGroup=h.DIVEGroup;exports.DIVEModel=h.DIVEModel;exports.DIVENode=h.DIVENode;exports.DIVEPointLight=h.DIVEPointLight;exports.DIVEPrimitive=h.DIVEPrimitive;exports.DIVERenderPipeline=h.DIVERenderPipeline;exports.DIVERenderer=h.DIVERenderer;exports.DIVERendererDefaultSettings=h.DIVERendererDefaultSettings;exports.DIVEResizeManager=h.DIVEResizeManager;exports.DIVERoot=h.DIVERoot;exports.DIVEScene=h.DIVEScene;exports.DIVESceneDefaultSettings=h.DIVESceneDefaultSettings;exports.DIVESceneLight=h.DIVESceneLight;exports.DIVEView=h.DIVEView;exports.FILE_TYPES=h.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=h.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=h.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=h.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=h.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.findInterface=I.findInterface;exports.implementsInterface=I.implementsInterface;exports.getFileTypeFromUri=V.getFileTypeFromUri;exports.isFileTypeSupported=V.isFileTypeSupported;exports.FileContentError=y.FileContentError;exports.NetworkError=y.NetworkError;exports.FileTypeError=w.FileTypeError;exports.ParseError=w.ParseError;exports.isModelSchema=A.isModelSchema;exports.isPovSchema=A.isPovSchema;exports.DIVEGizmo=N;exports.DIVEMath=x;exports.DIVEMovable=F;exports.DIVESelectable=U;exports.applyMixins=K;exports.deepClone=g;exports.getObjectDelta=M;exports.isGroupSchema=X;exports.isLightSchema=B;exports.isPrimitiveSchema=q;
1
+ "use strict";var b=Object.defineProperty;var R=(r,i,e)=>i in r?b(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>R(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./chunks/FileTypes-CsaIrcSz.cjs"),u=require("./chunks/PerspectiveCamera-iAsZqrnY.cjs"),_=require("./chunks/AxisHelperColors-BrGqktN5.cjs"),s=require("three"),V=require("./chunks/findInterface-C6mrvf_t.cjs"),y=require("./chunks/isFileTypeSupported-CrEqYiv9.cjs"),w=require("./chunks/network-error-CdDXil5g.cjs"),A=require("./chunks/parse-error-Dy_EE4rL.cjs"),P=require("./chunks/PovSchema-Co9FznEz.cjs");class m extends s.Object3D{constructor(e,t,o,h,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const l=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const g=new s.TorusGeometry(t,.1,3,48,o),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function p(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function O(r,i=0){const e=p(r,+i);return p(Math.ceil(e),-i)}function H(r,i=0){const e=p(r,+i);return p(Math.floor(e),-i)}function x(r,i=0){if(r<0)return-x(-r,i);const e=p(r,+i);return p(Math.round(e),-i)}function v(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function z(r,i=0){const e=p(r,+i);return p(Math.round(e),-i).toFixed(i)}function G(r,i=0){const e=p(r,+i);return p(Math.trunc(e),-i)}function C(r){return(s.MathUtils.radToDeg(r)+360)%360}function L(r){return s.MathUtils.degToRad(r)}const S={ceilExp:O,floorExp:H,roundExp:x,toFixedExp:z,truncateExp:G,signedAngleTo:v,radToDeg:C,degToRad:L};class T extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new m("x",1,Math.PI/2,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new m("y",1,-Math.PI/2,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new m("z",1,Math.PI/2,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=S.signedAngleTo(h,o,e.forwardVector),l=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,l)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,h){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const l=new s.Mesh(a,this._lineMaterial);l.layers.mask=u.UI_LAYER_MASK,l.renderOrder=1/0,l.rotateX(Math.PI/2),l.translateY(t/2),this.add(l);const d=new s.CylinderGeometry(.1,.1,t,3),g=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,g),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class Y extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class M extends s.Object3D{constructor(e,t,o,h,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const l=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const d=new s.Mesh(l,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const g=new s.CylinderGeometry(.1,.1,t+a/2,3),E=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(g,E),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class j extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new M("x",1,new s.Vector3(1,0,0),_.AxesColorRed)),this.add(new M("y",1,new s.Vector3(0,1,0),_.AxesColorGreen)),this.add(new M("z",1,new s.Vector3(0,0,1),_.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class N extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(h,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(l,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class F extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new Y(e),this._rotateGizmo=new T(e),this._scaleGizmo=new j(e),this._gizmoPlane=new N,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class U{constructor(){n(this,"isMovable",!0)}}class K{constructor(){n(this,"isSelectable",!0)}}function X(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,h)})}),r}function f(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let l=0;l<r.length;l++)a[l]=f(r[l],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[l,d]of r)a.set(f(l,i),f(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const l of r)a.add(f(l,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}const h=Object.getOwnPropertySymbols(r);for(const a of h){const l=Object.getOwnPropertyDescriptor(r,a);if(l)if(l.value!==void 0){const d=f(l.value,i);Object.defineProperty(t,a,{...l,value:d})}else Object.defineProperty(t,a,l)}return t}const I=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],h=i[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:i[t]};return}const a=[];if(h.forEach((l,d)=>{const g=I(o[d],h[d]);Object.keys(g).length&&a.push(h[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=I(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function q(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function Z(r){return r.entityType==="primitive"}exports.BoundingBox=c.BoundingBox;exports.DIVE=c.DIVE;exports.DIVEAmbientLight=c.DIVEAmbientLight;exports.DIVEClock=c.DIVEClock;exports.DIVEDefaultSettings=c.DIVEDefaultSettings;exports.DIVEEngine=c.DIVEEngine;exports.DIVEFloor=c.DIVEFloor;exports.DIVEGrid=c.DIVEGrid;exports.DIVEGroup=c.DIVEGroup;exports.DIVEModel=c.DIVEModel;exports.DIVENode=c.DIVENode;exports.DIVEPointLight=c.DIVEPointLight;exports.DIVEPrimitive=c.DIVEPrimitive;exports.DIVERenderPipeline=c.DIVERenderPipeline;exports.DIVERenderer=c.DIVERenderer;exports.DIVERendererDefaultSettings=c.DIVERendererDefaultSettings;exports.DIVEResizeManager=c.DIVEResizeManager;exports.DIVERoot=c.DIVERoot;exports.DIVEScene=c.DIVEScene;exports.DIVESceneDefaultSettings=c.DIVESceneDefaultSettings;exports.DIVESceneLight=c.DIVESceneLight;exports.DIVEView=c.DIVEView;exports.FILE_TYPES=c.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=c.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=c.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=c.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=c.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.AxesColorBlue=_.AxesColorBlue;exports.AxesColorBlueLetter=_.AxesColorBlueLetter;exports.AxesColorGreen=_.AxesColorGreen;exports.AxesColorGreenLetter=_.AxesColorGreenLetter;exports.AxesColorRed=_.AxesColorRed;exports.AxesColorRedLetter=_.AxesColorRedLetter;exports.findInterface=V.findInterface;exports.implementsInterface=V.implementsInterface;exports.getFileTypeFromUri=y.getFileTypeFromUri;exports.isFileTypeSupported=y.isFileTypeSupported;exports.FileContentError=w.FileContentError;exports.NetworkError=w.NetworkError;exports.FileTypeError=A.FileTypeError;exports.ParseError=A.ParseError;exports.isModelSchema=P.isModelSchema;exports.isPovSchema=P.isPovSchema;exports.DIVEGizmo=F;exports.DIVEMath=S;exports.DIVEMovable=U;exports.DIVESelectable=K;exports.applyMixins=X;exports.deepClone=f;exports.getObjectDelta=I;exports.isGroupSchema=q;exports.isLightSchema=B;exports.isPrimitiveSchema=Z;
package/build/dive.mjs CHANGED
@@ -1,16 +1,17 @@
1
1
  var S = Object.defineProperty;
2
2
  var A = (r, s, t) => s in r ? S(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
3
  var i = (r, s, t) => A(r, typeof s != "symbol" ? s + "" : s, t);
4
- import { A as I, g as P, h as V } from "./chunks/FileTypes-C6ZTNzXM.mjs";
5
- import { t as ot, s as ht, r as lt, F as ct, d as dt, y as pt, j as ut, D as ft, i as _t, v as gt, w as mt, x as Et, f as Dt, B as wt, z as yt, C as Mt, m as xt, l as It, k as Pt, n as Vt, E as Ht, p as bt, o as zt, e as vt, q as Ot, I as St, G as At, u as Gt, S as Rt, H as Tt } from "./chunks/FileTypes-C6ZTNzXM.mjs";
4
+ import { B as ot, b as ht, r as lt, f as ct, D as dt, e as pt, o as ut, p as ft, q as _t, d as gt, t as mt, s as Et, u as Dt, i as wt, h as yt, g as Mt, j as xt, v as It, l as Pt, k as Vt, c as bt, m as Ht, F as zt, G as vt, n as Ot, S as St, w as At } from "./chunks/FileTypes-B5EJOgeX.mjs";
6
5
  import { U as d } from "./chunks/PerspectiveCamera-BFzE2TQU.mjs";
7
- import { C as jt, b as Ct, D as Lt, a as Nt, H as Xt, P as Ft } from "./chunks/PerspectiveCamera-BFzE2TQU.mjs";
8
- import { Object3D as f, Color as H, Vector3 as c, TorusGeometry as b, MeshBasicMaterial as g, Mesh as p, MathUtils as v, Euler as G, CylinderGeometry as E, BoxGeometry as R, PlaneGeometry as w } from "three";
9
- import { f as qt, i as Qt } from "./chunks/findInterface-DbJ5qzbc.mjs";
10
- import { g as kt, i as Ut } from "./chunks/isFileTypeSupported-BSpswPHU.mjs";
11
- import { F as Kt, N as Jt } from "./chunks/network-error-BONfHWQq.mjs";
12
- import { F as te, P as ee } from "./chunks/parse-error-DfOPyLWM.mjs";
13
- import { i as se, a as ie } from "./chunks/PovSchema-DWWvr_ED.mjs";
6
+ import { C as Rt, b as Tt, D as Yt, a as jt, H as Ct, P as Lt } from "./chunks/PerspectiveCamera-BFzE2TQU.mjs";
7
+ import { A as I, a as P, b as V } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
8
+ import { e as Xt, d as Ft, c as Zt } from "./chunks/AxisHelperColors-JLBHYQDi.mjs";
9
+ import { Object3D as f, Color as b, Vector3 as c, TorusGeometry as H, MeshBasicMaterial as g, Mesh as p, MathUtils as v, Euler as G, CylinderGeometry as E, BoxGeometry as R, PlaneGeometry as w } from "three";
10
+ import { f as Qt, i as Wt } from "./chunks/findInterface-DbJ5qzbc.mjs";
11
+ import { g as Ut, i as Bt } from "./chunks/isFileTypeSupported-BSpswPHU.mjs";
12
+ import { F as Jt, N as $t } from "./chunks/network-error-BONfHWQq.mjs";
13
+ import { F as ee, P as re } from "./chunks/parse-error-DfOPyLWM.mjs";
14
+ import { i as ie, a as ne } from "./chunks/PovSchema-DWWvr_ED.mjs";
14
15
  class y extends f {
15
16
  constructor(t, e, n, o, a) {
16
17
  super();
@@ -18,14 +19,14 @@ class y extends f {
18
19
  i(this, "isDraggable", !0);
19
20
  i(this, "parent", null);
20
21
  i(this, "axis");
21
- i(this, "_color", new H(16711935));
22
+ i(this, "_color", new b(16711935));
22
23
  i(this, "_colorHover");
23
24
  i(this, "_hovered");
24
25
  i(this, "_highlight");
25
26
  i(this, "_lineMaterial");
26
27
  i(this, "_colliderMesh");
27
28
  this.name = "DIVERadialHandle", this.axis = t, this._color.set(a), this._colorHover = this._color.clone().multiplyScalar(2), this._hovered = !1, this._highlight = !1;
28
- const h = new b(e, 0.01, 13, 48, n);
29
+ const h = new H(e, 0.01, 13, 48, n);
29
30
  this._lineMaterial = new g({
30
31
  color: a,
31
32
  depthTest: !1,
@@ -33,7 +34,7 @@ class y extends f {
33
34
  });
34
35
  const l = new p(h, this._lineMaterial);
35
36
  l.layers.mask = d, l.renderOrder = 1 / 0, this.add(l);
36
- const _ = new b(e, 0.1, 3, 48, n), D = new g({
37
+ const _ = new H(e, 0.1, 3, 48, n), D = new g({
37
38
  color: 16711935,
38
39
  transparent: !0,
39
40
  opacity: 0.15,
@@ -205,7 +206,7 @@ class M extends f {
205
206
  i(this, "isDraggable", !0);
206
207
  i(this, "parent", null);
207
208
  i(this, "axis");
208
- i(this, "_color", new H(16711935));
209
+ i(this, "_color", new b(16711935));
209
210
  i(this, "_colorHover");
210
211
  i(this, "_hovered");
211
212
  i(this, "_highlight");
@@ -325,7 +326,7 @@ class x extends f {
325
326
  i(this, "isDraggable", !0);
326
327
  i(this, "parent", null);
327
328
  i(this, "axis");
328
- i(this, "_color", new H(16711935));
329
+ i(this, "_color", new b(16711935));
329
330
  i(this, "_colorHover");
330
331
  i(this, "_hovered");
331
332
  i(this, "_highlight");
@@ -741,63 +742,63 @@ function it(r) {
741
742
  }
742
743
  export {
743
744
  V as AxesColorBlue,
744
- ot as AxesColorBlueLetter,
745
+ Xt as AxesColorBlueLetter,
745
746
  P as AxesColorGreen,
746
- ht as AxesColorGreenLetter,
747
+ Ft as AxesColorGreenLetter,
747
748
  I as AxesColorRed,
748
- lt as AxesColorRedLetter,
749
- ct as BoundingBox,
750
- jt as COORDINATE_LAYER_MASK,
751
- Ct as DEFAULT_LAYER_MASK,
752
- dt as DIVE,
753
- pt as DIVEAmbientLight,
754
- ut as DIVEClock,
755
- ft as DIVEDefaultSettings,
756
- _t as DIVEEngine,
757
- gt as DIVEFloor,
749
+ Zt as AxesColorRedLetter,
750
+ ot as BoundingBox,
751
+ Rt as COORDINATE_LAYER_MASK,
752
+ Tt as DEFAULT_LAYER_MASK,
753
+ ht as DIVE,
754
+ lt as DIVEAmbientLight,
755
+ ct as DIVEClock,
756
+ dt as DIVEDefaultSettings,
757
+ pt as DIVEEngine,
758
+ ut as DIVEFloor,
758
759
  J as DIVEGizmo,
759
- mt as DIVEGrid,
760
- Et as DIVEGroup,
760
+ ft as DIVEGrid,
761
+ _t as DIVEGroup,
761
762
  F as DIVEMath,
762
- Dt as DIVEModel,
763
+ gt as DIVEModel,
763
764
  $ as DIVEMovable,
764
- wt as DIVENode,
765
- Lt as DIVEPerspectiveCamera,
766
- Nt as DIVEPerspectiveCameraDefaultSettings,
767
- yt as DIVEPointLight,
768
- Mt as DIVEPrimitive,
769
- xt as DIVERenderPipeline,
770
- It as DIVERenderer,
771
- Pt as DIVERendererDefaultSettings,
772
- Vt as DIVEResizeManager,
773
- Ht as DIVERoot,
774
- bt as DIVEScene,
775
- zt as DIVESceneDefaultSettings,
776
- vt as DIVESceneLight,
765
+ mt as DIVENode,
766
+ Yt as DIVEPerspectiveCamera,
767
+ jt as DIVEPerspectiveCameraDefaultSettings,
768
+ Et as DIVEPointLight,
769
+ Dt as DIVEPrimitive,
770
+ wt as DIVERenderPipeline,
771
+ yt as DIVERenderer,
772
+ Mt as DIVERendererDefaultSettings,
773
+ xt as DIVEResizeManager,
774
+ It as DIVERoot,
775
+ Pt as DIVEScene,
776
+ Vt as DIVESceneDefaultSettings,
777
+ bt as DIVESceneLight,
777
778
  tt as DIVESelectable,
778
- Ot as DIVEView,
779
- St as FILE_TYPES,
780
- Kt as FileContentError,
781
- te as FileTypeError,
782
- At as GRID_CENTER_LINE_COLOR,
783
- Gt as GRID_SIDE_LINE_COLOR,
784
- Xt as HELPER_LAYER_MASK,
785
- Jt as NetworkError,
786
- Ft as PRODUCT_LAYER_MASK,
787
- ee as ParseError,
788
- Rt as SUPPORTED_FILE_TYPES,
779
+ Ht as DIVEView,
780
+ zt as FILE_TYPES,
781
+ Jt as FileContentError,
782
+ ee as FileTypeError,
783
+ vt as GRID_CENTER_LINE_COLOR,
784
+ Ot as GRID_SIDE_LINE_COLOR,
785
+ Ct as HELPER_LAYER_MASK,
786
+ $t as NetworkError,
787
+ Lt as PRODUCT_LAYER_MASK,
788
+ re as ParseError,
789
+ St as SUPPORTED_FILE_TYPES,
789
790
  d as UI_LAYER_MASK,
790
791
  et as applyMixins,
791
792
  m as deepClone,
792
- qt as findInterface,
793
- Tt as findSceneRecursive,
794
- kt as getFileTypeFromUri,
793
+ Qt as findInterface,
794
+ At as findSceneRecursive,
795
+ Ut as getFileTypeFromUri,
795
796
  z as getObjectDelta,
796
- Qt as implementsInterface,
797
- Ut as isFileTypeSupported,
797
+ Wt as implementsInterface,
798
+ Bt as isFileTypeSupported,
798
799
  rt as isGroupSchema,
799
800
  st as isLightSchema,
800
- se as isModelSchema,
801
- ie as isPovSchema,
801
+ ie as isModelSchema,
802
+ ne as isPovSchema,
802
803
  it as isPrimitiveSchema
803
804
  };
@@ -66,7 +66,7 @@ export declare class DIVE {
66
66
  private _mainView;
67
67
  private _scene;
68
68
  private _clock;
69
- private orientationDisplay;
69
+ private _orientationDisplay;
70
70
  constructor(settings?: Partial<DIVESettings>);
71
71
  /**
72
72
  * @deprecated This property will be removed in a future version. Please use properties on the DIVE instance and mainView directly.
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var h=(o,e,r)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var l=(o,e,r)=>h(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../systeminfo/index.cjs"),A=require("../assetconverter/index.cjs"),O=require("../../chunks/AssetLoader-rt-Pr_wb.cjs"),w=require("../../chunks/AssetExporter-DsbC2rqv.cjs");var m=(o=>(o.AR_DESKTOP_PLATFORM_ERROR="ar-desktop-platform-error",o.AR_QUICK_LOOK_NOT_SAFARI_ERROR="ar-quicklook-not-safari-error",o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR="ar-quicklook-version-mismatch-error",o.AR_QUICK_LOOK_UNKNOWN_ERROR="ar-quicklook-unknown-error",o))(m||{});class a extends Error{constructor(r,t){super(r);l(this,"type");this.name=this.constructor.name,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}class R extends a{constructor(){super("AR features are not supported on desktop platforms.","ar-desktop-platform-error")}}class p extends a{constructor(){super("ARQuickLook on iOS is only available in Safari.","ar-quicklook-not-safari-error")}}class d extends a{constructor(e,r){super(`ARQuickLook requires iOS version ${r} or later. Current version: ${e}.`,"ar-quicklook-version-mismatch-error"),this.currentVersion=e,this.requiredVersion=r}}class u extends a{constructor(){super("An unknown ARQuickLook compatibility error occurred.","ar-quicklook-unknown-error")}}const k=12;class S{constructor(){l(this,"converter",new A.AssetConverter(new O.AssetLoader,new w.AssetExporter))}async launch(e,r){if(c.SystemInfo.getBrowser()!==c.EBrowser.SAFARI)return Promise.reject(new p);const t=c.SystemInfo.getIOSVersion();if(t&&t.major<k)return Promise.reject(new d(t.full,k));if(!t)return Promise.reject(new u);if(!c.SystemInfo.getSupportsARQuickLook())return Promise.reject(new u);const n=await this.convertToUSDZ(e,r);return this.launchARQuickLook(n,r)}async convertToUSDZ(e,r){const t=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}}),n=new Blob([t],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,r){return new Promise(t=>{(r==null?void 0:r.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",t(),n.click()})}}class _{launch(e,r){const t=self.location.toString(),n=document.createElement("a"),s=this._createParams(t,e,r),i=this._createIntent(t,e,s);n.setAttribute("href",i),n.click()}_createParams(e,r,t){const n=new URL(r,e),s=new URLSearchParams(n.search);return s.set("mode","ar_preferred"),this._applyScaleOption(s,t),this._applyPlacementOption(s,t),this._applySoundOption(s,e),this._applyLinkOption(s,e),s}_applyScaleOption(e,r){(r==null?void 0:r.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,r){(r==null?void 0:r.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,r){if(e.has("sound")){const t=new URL(e.get("sound"),r);e.set("sound",t.toString())}}_applyLinkOption(e,r){if(e.has("link")){const t=new URL(e.get("link"),r);e.set("link",t.toString())}}_createIntent(e,r,t){const n=new URL(e),s=new URL(r,e),i="#model-viewer-no-ar-fallback";return n.hash=i,`intent://arvr.google.com/scene-viewer/1.2?${t.toString()+"&file="+s.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class L{async launch(e,r){const t=c.SystemInfo.getSystem();return t===c.ESystem.IOS?new S().launch(e,r):t===c.ESystem.ANDROID?new _().launch(e,r):Promise.reject(new R)}}exports.ARDesktopPlatformError=R;exports.ARError=a;exports.ARQuickLook=S;exports.ARQuickLookNotSafariError=p;exports.ARQuickLookUnknownError=u;exports.ARQuickLookVersionMismatchError=d;exports.ARSystem=L;exports.EARErrorType=m;exports.SceneViewer=_;
1
+ "use strict";var f=Object.defineProperty;var h=(o,e,r)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var l=(o,e,r)=>h(o,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../systeminfo/index.cjs"),A=require("../assetconverter/index.cjs"),O=require("../../chunks/AssetLoader-Y1WUrflq.cjs"),w=require("../../chunks/AssetExporter-DsbC2rqv.cjs");var m=(o=>(o.AR_DESKTOP_PLATFORM_ERROR="ar-desktop-platform-error",o.AR_QUICK_LOOK_NOT_SAFARI_ERROR="ar-quicklook-not-safari-error",o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR="ar-quicklook-version-mismatch-error",o.AR_QUICK_LOOK_UNKNOWN_ERROR="ar-quicklook-unknown-error",o))(m||{});class a extends Error{constructor(r,t){super(r);l(this,"type");this.name=this.constructor.name,this.type=t,Object.setPrototypeOf(this,new.target.prototype)}}class R extends a{constructor(){super("AR features are not supported on desktop platforms.","ar-desktop-platform-error")}}class p extends a{constructor(){super("ARQuickLook on iOS is only available in Safari.","ar-quicklook-not-safari-error")}}class d extends a{constructor(e,r){super(`ARQuickLook requires iOS version ${r} or later. Current version: ${e}.`,"ar-quicklook-version-mismatch-error"),this.currentVersion=e,this.requiredVersion=r}}class u extends a{constructor(){super("An unknown ARQuickLook compatibility error occurred.","ar-quicklook-unknown-error")}}const k=12;class S{constructor(){l(this,"converter",new A.AssetConverter(new O.AssetLoader,new w.AssetExporter))}async launch(e,r){if(c.SystemInfo.getBrowser()!==c.EBrowser.SAFARI)return Promise.reject(new p);const t=c.SystemInfo.getIOSVersion();if(t&&t.major<k)return Promise.reject(new d(t.full,k));if(!t)return Promise.reject(new u);if(!c.SystemInfo.getSupportsARQuickLook())return Promise.reject(new u);const n=await this.convertToUSDZ(e,r);return this.launchARQuickLook(n,r)}async convertToUSDZ(e,r){const t=await this.converter.convert(e).to("usdz",{quickLookCompatible:!0,ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}}}),n=new Blob([t],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(n)}launchARQuickLook(e,r){return new Promise(t=>{(r==null?void 0:r.arScale)==="fixed"&&(e=e.concat("#allowsContentScaling=0"));const n=document.createElement("a");n.innerHTML="<picture></picture>",n.rel="ar",n.href=e,n.download="scene.usdz",t(),n.click()})}}class _{launch(e,r){const t=self.location.toString(),n=document.createElement("a"),s=this._createParams(t,e,r),i=this._createIntent(t,e,s);n.setAttribute("href",i),n.click()}_createParams(e,r,t){const n=new URL(r,e),s=new URLSearchParams(n.search);return s.set("mode","ar_preferred"),this._applyScaleOption(s,t),this._applyPlacementOption(s,t),this._applySoundOption(s,e),this._applyLinkOption(s,e),s}_applyScaleOption(e,r){(r==null?void 0:r.arScale)==="fixed"&&e.set("resizable","false")}_applyPlacementOption(e,r){(r==null?void 0:r.arPlacement)==="vertical"&&e.set("enable_vertical_placement","true")}_applySoundOption(e,r){if(e.has("sound")){const t=new URL(e.get("sound"),r);e.set("sound",t.toString())}}_applyLinkOption(e,r){if(e.has("link")){const t=new URL(e.get("link"),r);e.set("link",t.toString())}}_createIntent(e,r,t){const n=new URL(e),s=new URL(r,e),i="#model-viewer-no-ar-fallback";return n.hash=i,`intent://arvr.google.com/scene-viewer/1.2?${t.toString()+"&file="+s.toString()}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(n.toString())};end;`}}class L{async launch(e,r){const t=c.SystemInfo.getSystem();return t===c.ESystem.IOS?new S().launch(e,r):t===c.ESystem.ANDROID?new _().launch(e,r):Promise.reject(new R)}}exports.ARDesktopPlatformError=R;exports.ARError=a;exports.ARQuickLook=S;exports.ARQuickLookNotSafariError=p;exports.ARQuickLookUnknownError=u;exports.ARQuickLookVersionMismatchError=d;exports.ARSystem=L;exports.EARErrorType=m;exports.SceneViewer=_;
@@ -3,7 +3,7 @@ var R = (o, e, r) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writab
3
3
  var l = (o, e, r) => R(o, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { SystemInfo as c, EBrowser as d, ESystem as u } from "../systeminfo/index.mjs";
5
5
  import { AssetConverter as h } from "../assetconverter/index.mjs";
6
- import { A as _ } from "../../chunks/AssetLoader-E2Xdqd44.mjs";
6
+ import { A as _ } from "../../chunks/AssetLoader-MNABEWSP.mjs";
7
7
  import { A as f } from "../../chunks/AssetExporter-brT7ogoM.mjs";
8
8
  var S = /* @__PURE__ */ ((o) => (o.AR_DESKTOP_PLATFORM_ERROR = "ar-desktop-platform-error", o.AR_QUICK_LOOK_NOT_SAFARI_ERROR = "ar-quicklook-not-safari-error", o.AR_QUICK_LOOK_VERSION_MISMATCH_ERROR = "ar-quicklook-version-mismatch-error", o.AR_QUICK_LOOK_UNKNOWN_ERROR = "ar-quicklook-unknown-error", o))(S || {});
9
9
  class a extends Error {