@shopware-ag/dive 2.2.27 → 2.2.29

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.
@@ -1 +1 @@
1
- "use strict";var vt=Object.defineProperty;var Mt=(h,t,e)=>t in h?vt(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var r=(h,t,e)=>Mt(h,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three");require("../../chunks/FileTypes-BYrX0l2L.cjs");const M=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),S=require("../../chunks/findInterface-C6mrvf_t.cjs"),G=require("../../chunks/AxisHelperColors-BrGqktN5.cjs");class lt{constructor(){r(this,"_selected",null);r(this,"_listeners",new Set)}get selected(){return this._selected}select(t){var e,s,o;this._selected!==t&&(this._selected&&((s=(e=this._selected).onDeselect)==null||s.call(e)),this._selected=t,(o=t.onSelect)==null||o.call(t),this.notifyListeners())}deselect(){var t,e;this._selected&&((e=(t=this._selected).onDeselect)==null||e.call(t),this._selected=null,this.notifyListeners())}onChange(t){this._listeners.add(t)}offChange(t){this._listeners.delete(t)}dispose(){this._selected=null,this._listeners.clear()}notifyListeners(){for(const t of this._listeners)t(this._selected)}}class ct{constructor(){r(this,"name","hover");r(this,"priority",20);r(this,"_hovered",null)}get hovered(){return this._hovered}onActivate(){this._hovered=null}onDeactivate(){var t,e;this._hovered&&((e=(t=this._hovered).onPointerLeave)==null||e.call(t),this._hovered=null)}onPointerMove(t){var o,a,n,l,_,w,P;const e=t.modelIntersects[0],s=S.findInterface(e==null?void 0:e.object,"isHoverable");if(e&&s){if(!this._hovered){(o=s.onPointerEnter)==null||o.call(s,e),this._hovered=s;return}if(this._hovered.uuid!==s.uuid){(n=(a=this._hovered).onPointerLeave)==null||n.call(a),(l=s.onPointerEnter)==null||l.call(s,e),this._hovered=s;return}(_=s.onPointerOver)==null||_.call(s,e);return}this._hovered&&((P=(w=this._hovered).onPointerLeave)==null||P.call(w),this._hovered=null)}}const St=h=>h.name==="select";class ${constructor(t){r(this,"name","select");r(this,"priority",30);r(this,"_selectionState");this._selectionState=t}get selected(){return this._selectionState.selected}onActivate(){}onDeactivate(){}onClick(t){const e=t.modelIntersects[0],s=S.findInterface(e==null?void 0:e.object,"isSelectable");if(!e||!s){this._selectionState.deselect();return}const o=this._selectionState.selected;o&&o.uuid===s.uuid||this._selectionState.select(s)}select(t){this._selectionState.select(t)}deselect(){this._selectionState.deselect()}}const A=new i.Raycaster,p=new i.Vector3,T=new i.Vector3,d=new i.Quaternion,it={X:new i.Vector3(1,0,0),Y:new i.Vector3(0,1,0),Z:new i.Vector3(0,0,1)},N={type:"change"},st={type:"mouseDown"},nt={type:"mouseUp",mode:null},ot={type:"objectChange"};class Pt extends i.Object3D{constructor(t,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 s=new At;this._gizmo=s,this.add(s);const o=new Ct;this._plane=o,this.add(o);const a=this;function n(u,f){let L=f;Object.defineProperty(a,u,{get:function(){return L!==void 0?L:f},set:function(I){L!==I&&(L=I,o[u]=I,s[u]=I,a.dispatchEvent({type:u+"-changed",value:I}),a.dispatchEvent(N))}}),a[u]=f,o[u]=f,s[u]=f}n("camera",t),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const l=new i.Vector3,_=new i.Vector3,w=new i.Quaternion,P=new i.Quaternion,R=new i.Vector3,Y=new i.Quaternion,tt=new i.Vector3,j=new i.Vector3,D=new i.Vector3,E=0,b=new i.Vector3;n("worldPosition",l),n("worldPositionStart",_),n("worldQuaternion",w),n("worldQuaternionStart",P),n("cameraPosition",R),n("cameraQuaternion",Y),n("pointStart",tt),n("pointEnd",j),n("rotationAxis",D),n("rotationAngle",E),n("eye",b),this._offset=new i.Vector3,this._startNorm=new i.Vector3,this._endNorm=new i.Vector3,this._cameraScale=new i.Vector3,this._parentPosition=new i.Vector3,this._parentQuaternion=new i.Quaternion,this._parentQuaternionInv=new i.Quaternion,this._parentScale=new i.Vector3,this._worldScaleStart=new i.Vector3,this._worldQuaternionInv=new i.Quaternion,this._worldScale=new i.Vector3,this._positionStart=new i.Vector3,this._quaternionStart=new i.Quaternion,this._scaleStart=new i.Vector3,this._getPointer=Dt.bind(this),this._onPointerDown=xt.bind(this),this._onPointerHover=Et.bind(this),this._onPointerMove=Tt.bind(this),this._onPointerUp=It.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(t){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(t)}pointerHover(t){if(this.object===void 0||this.dragging===!0)return;t!==null&&A.setFromCamera(t,this.camera);const e=K(this._gizmo.picker[this.mode],A);e?this.axis=e.object.name:this.axis=null}pointerDown(t){if(!(this.object===void 0||this.dragging===!0||t!=null&&t.button!==0)&&this.axis!==null){t!==null&&A.setFromCamera(t,this.camera);const e=K(this._plane,A,!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,st.mode=this.mode,this.dispatchEvent(st)}}pointerMove(t){const e=this.axis,s=this.mode,o=this.object;let a=this.space;if(s==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),o===void 0||e===null||this.dragging===!1||t!==null&&t.button!==-1)return;t!==null&&A.setFromCamera(t,this.camera);const n=K(this._plane,A,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),s==="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),o.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(o.position.applyQuaternion(d.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this._quaternionStart)),a==="world"&&(o.parent&&o.position.add(p.setFromMatrixPosition(o.parent.matrixWorld)),e.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(p.setFromMatrixPosition(o.parent.matrixWorld))));else if(s==="scale"){if(e.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),T.set(l,l,l)}else p.copy(this.pointStart),T.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),T.applyQuaternion(this._worldQuaternionInv),T.divide(p),e.search("X")===-1&&(T.x=1),e.search("Y")===-1&&(T.y=1),e.search("Z")===-1&&(T.z=1);o.scale.copy(this._scaleStart).multiply(T),this.scaleSnap&&(e.search("X")!==-1&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const l=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let _=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*l):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(it[e]),p.copy(it[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?_=!0:this.rotationAngle=this._offset.dot(p.normalize())*l),(e==="E"||_)&&(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"?(o.quaternion.copy(this._quaternionStart),o.quaternion.multiply(d.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),o.quaternion.copy(d.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(N),this.dispatchEvent(ot)}}pointerUp(t){t!==null&&t.button!==0||(this.dragging&&this.axis!==null&&(nt.mode=this.mode,this.dispatchEvent(nt)),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(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}attach(t){return this.object=t,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(N),this.dispatchEvent(ot),this.pointStart.copy(this.pointEnd))}getRaycaster(){return A}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}}function Dt(h){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:h.button};{const t=this.domElement.getBoundingClientRect();return{x:(h.clientX-t.left)/t.width*2-1,y:-(h.clientY-t.top)/t.height*2+1,button:h.button}}}function Et(h){if(this.enabled)switch(h.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(h));break}}function xt(h){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(h.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(h)),this.pointerDown(this._getPointer(h)))}function Tt(h){this.enabled&&this.pointerMove(this._getPointer(h))}function It(h){this.enabled&&(this.domElement.releasePointerCapture(h.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(h)))}function K(h,t,e){const s=t.intersectObject(h,!0);for(let o=0;o<s.length;o++)if(s[o].object.visible||e)return s[o];return!1}const B=new i.Euler,c=new i.Vector3(0,1,0),rt=new i.Vector3(0,0,0),at=new i.Matrix4,q=new i.Quaternion,F=new i.Quaternion,v=new i.Vector3,ht=new i.Matrix4,O=new i.Vector3(1,0,0),C=new i.Vector3(0,1,0),X=new i.Vector3(0,0,1),U=new i.Vector3,Q=new i.Vector3,H=new i.Vector3;class At extends i.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const t=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=t.clone();s.opacity=.15;const o=e.clone();o.opacity=.5;const a=t.clone();a.color.setHex(16711680);const n=t.clone();n.color.setHex(65280);const l=t.clone();l.color.setHex(255);const _=t.clone();_.color.setHex(16711680),_.opacity=.5;const w=t.clone();w.color.setHex(65280),w.opacity=.5;const P=t.clone();P.color.setHex(255),P.opacity=.5;const R=t.clone();R.opacity=.25;const Y=t.clone();Y.color.setHex(16776960),Y.opacity=.25,t.clone().color.setHex(16776960);const j=t.clone();j.color.setHex(7895160);const D=new i.CylinderGeometry(0,.04,.1,12);D.translate(0,.05,0);const E=new i.BoxGeometry(.08,.08,.08);E.translate(0,.04,0);const b=new i.BufferGeometry;b.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,0,0],3));const u=new i.CylinderGeometry(.0075,.0075,.5,3);u.translate(0,.25,0);function f(g,k){const y=new i.TorusGeometry(g,.0075,3,64,k*Math.PI*2);return y.rotateY(Math.PI/2),y.rotateX(Math.PI/2),y}function L(){const g=new i.BufferGeometry;return g.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),g}const I={X:[[new i.Mesh(D,a),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(D,a),[-.5,0,0],[0,0,Math.PI/2]],[new i.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new i.Mesh(D,n),[0,.5,0]],[new i.Mesh(D,n),[0,-.5,0],[Math.PI,0,0]],[new i.Mesh(u,n)]],Z:[[new i.Mesh(D,l),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(D,l),[0,0,-.5],[-Math.PI/2,0,0]],[new i.Mesh(u,l),null,[Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.1,0),R.clone()),[0,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),P.clone()),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),_.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),w.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},pt={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.2,0),s)]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},_t={START:[[new i.Mesh(new i.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],END:[[new i.Mesh(new i.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],DELTA:[[new i.Line(L(),o),null,null,null,"helper"]],X:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(b,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(b,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ut={XYZE:[[new i.Mesh(f(.5,1),j),null,[0,Math.PI/2,0]]],X:[[new i.Mesh(f(.5,.5),a)]],Y:[[new i.Mesh(f(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new i.Mesh(f(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new i.Mesh(f(.75,1),Y),null,[0,Math.PI/2,0]]]},mt={AXIS:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},gt={XYZE:[[new i.Mesh(new i.SphereGeometry(.25,10,8),s)]],X:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new i.Mesh(new i.TorusGeometry(.75,.1,2,24),s)]]},ft={X:[[new i.Mesh(E,a),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]],[new i.Mesh(E,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(E,n),[0,.5,0]],[new i.Mesh(u,n)],[new i.Mesh(E,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new i.Mesh(E,l),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(u,l),[0,0,0],[Math.PI/2,0,0]],[new i.Mesh(E,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),P),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),_),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),w),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.1,.1,.1),R.clone())]]},yt={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},wt={X:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(b,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(b,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function x(g){const k=new i.Object3D;for(const y in g)for(let z=g[y].length;z--;){const m=g[y][z][0].clone(),V=g[y][z][1],Z=g[y][z][2],W=g[y][z][3],bt=g[y][z][4];m.name=y,m.tag=bt,V&&m.position.set(V[0],V[1],V[2]),Z&&m.rotation.set(Z[0],Z[1],Z[2]),W&&m.scale.set(W[0],W[1],W[2]),m.updateMatrix();const et=m.geometry.clone();et.applyMatrix4(m.matrix),m.geometry=et,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),k.add(m)}return k}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=x(I)),this.add(this.gizmo.rotate=x(ut)),this.add(this.gizmo.scale=x(ft)),this.add(this.picker.translate=x(pt)),this.add(this.picker.rotate=x(gt)),this.add(this.picker.scale=x(yt)),this.add(this.helper.translate=x(_t)),this.add(this.helper.rotate=x(mt)),this.add(this.helper.scale=x(wt)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const s=(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 o=[];o=o.concat(this.picker[this.mode].children),o=o.concat(this.gizmo[this.mode].children),o=o.concat(this.helper[this.mode].children);for(let a=0;a<o.length;a++){const n=o[a];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let l;if(this.camera.isOrthographicCamera?l=(this.camera.top-this.camera.bottom)/this.camera.zoom:l=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(l*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(d.setFromEuler(B.set(0,0,0)),n.quaternion.copy(s).multiply(d),Math.abs(c.copy(O).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(d.setFromEuler(B.set(0,0,Math.PI/2)),n.quaternion.copy(s).multiply(d),Math.abs(c.copy(C).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(d.setFromEuler(B.set(0,Math.PI/2,0)),n.quaternion.copy(s).multiply(d),Math.abs(c.copy(X).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(d.setFromEuler(B.set(0,Math.PI/2,0)),c.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(at.lookAt(rt,c,C)),n.quaternion.multiply(d),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.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()),n.scale.copy(p),n.visible=this.dragging):(n.quaternion.copy(s),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(s),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(c.copy(O).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(c.copy(C).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(c.copy(X).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(c.copy(X).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(c.copy(O).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(c.copy(C).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(q.copy(s),c.copy(this.eye).applyQuaternion(d.copy(s).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(at.lookAt(this.eye,rt,C)),n.name==="X"&&(d.setFromAxisAngle(O,Math.atan2(-c.y,c.z)),d.multiplyQuaternions(q,d),n.quaternion.copy(d)),n.name==="Y"&&(d.setFromAxisAngle(C,Math.atan2(c.x,c.z)),d.multiplyQuaternions(q,d),n.quaternion.copy(d)),n.name==="Z"&&(d.setFromAxisAngle(X,Math.atan2(c.y,c.x)),d.multiplyQuaternions(q,d),n.quaternion.copy(d))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(_){return n.name===_}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(t)}}class Ct extends i.Mesh{constructor(){super(new i.PlaneGeometry(1e5,1e5,2,2),new i.MeshBasicMaterial({visible:!1,wireframe:!0,side:i.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),U.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),Q.copy(C).applyQuaternion(e==="local"?this.worldQuaternion:F),H.copy(X).applyQuaternion(e==="local"?this.worldQuaternion:F),c.copy(Q),this.mode){case"translate":case"scale":switch(this.axis){case"X":c.copy(this.eye).cross(U),v.copy(U).cross(c);break;case"Y":c.copy(this.eye).cross(Q),v.copy(Q).cross(c);break;case"Z":c.copy(this.eye).cross(H),v.copy(H).cross(c);break;case"XY":v.copy(H);break;case"YZ":v.copy(U);break;case"XZ":c.copy(H),v.copy(Q);break;case"XYZ":case"E":v.set(0,0,0);break}break;case"rotate":default:v.set(0,0,0)}v.length()===0?this.quaternion.copy(this.cameraQuaternion):(ht.lookAt(p.set(0,0,0),v,c),this.quaternion.setFromRotationMatrix(ht)),super.updateMatrixWorld(t)}}const Lt=h=>h.name==="transform";class J{constructor(t,e,s){r(this,"name","transform");r(this,"priority",5);r(this,"_scene");r(this,"_controller");r(this,"_selectionState");r(this,"_gizmo");r(this,"_scaleLinked",!1);r(this,"_gizmoVisible",!0);r(this,"_selectionChangeHandler");this._scene=t,this._controller=e,this._selectionState=s,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo),this._selectionChangeHandler=this.onSelectionChange.bind(this)}get gizmo(){return this._gizmo}get isDragging(){return this._gizmo.dragging}onActivate(){this._selectionState.onChange(this._selectionChangeHandler);const t=this._selectionState.selected;t&&this.attachGizmo(t)}onDeactivate(){this._selectionState.offChange(this._selectionChangeHandler),this._gizmo.detach()}onPointerMove(t){if(this._gizmo.dragging||t.uiIntersects.length>0&&t.uiIntersects.some(s=>this.isGizmoChild(s.object)))return!0}setGizmoMode(t){this._gizmo.mode=t}setGizmoVisible(t){this._gizmoVisible=t;const e=this._scene.children.includes(this._gizmo);t&&!e?(this._scene.add(this._gizmo),this._gizmo.getRaycaster().layers.enableAll()):!t&&e&&(this._scene.remove(this._gizmo),this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(t){this._scaleLinked=t}dispose(){this._selectionState.offChange(this._selectionChangeHandler),this._gizmo.detach(),this._scene.remove(this._gizmo),this._gizmo.dispose()}onSelectionChange(t){t&&S.implementsInterface(t,"isMovable")?this.attachGizmo(t):this._gizmo.detach()}attachGizmo(t){S.implementsInterface(t,"isMovable")&&(this._gizmo.attach(t),this.setGizmoVisible(t.visible&&this._gizmoVisible))}isGizmoChild(t){let e=t;for(;e;){if(e===this._gizmo)return!0;e=e.parent}return!1}initGizmo(){const t=new Pt(this._controller.object,this._controller.domElement);return t.mode="translate",t.traverse(e=>{if(!("isMesh"in e))return;const s=e.material;e.name==="X"&&s.color.set(G.AxesColorRed),e.name==="Y"&&s.color.set(G.AxesColorGreen),e.name==="Z"&&s.color.set(G.AxesColorBlue),e.name==="XY"&&s.color.set(G.AxesColorBlue),e.name==="YZ"&&s.color.set(G.AxesColorRed),e.name==="XZ"&&s.color.set(G.AxesColorGreen)}),t.addEventListener("mouseDown",()=>{var e,s;this._controller.enabled=!1,S.implementsInterface(t.object,"isMovable")&&((s=(e=t.object).onMoveStart)==null||s.call(e))}),t.addEventListener("objectChange",()=>{var e,s;if(S.implementsInterface(t.object,"isMovable")&&((s=(e=t.object).onMove)==null||s.call(e),this._scaleLinked&&t.object)){const o=t.object.scale,a=(o.x+o.y+o.z)/3;t.object.scale.set(a,a,a)}}),t.addEventListener("mouseUp",()=>{var e,s;this._controller.enabled=!0,S.implementsInterface(t.object,"isMovable")&&((s=(e=t.object).onMoveEnd)==null||s.call(e))}),t}}const zt=.001;class dt{constructor(t){r(this,"name","drag");r(this,"priority",10);r(this,"_controller");r(this,"_raycaster");r(this,"_dragging",!1);r(this,"_draggable",null);r(this,"_dragStart",new i.Vector3);r(this,"_dragCurrent",new i.Vector3);r(this,"_dragEnd",new i.Vector3);r(this,"_dragDelta",new i.Vector3);r(this,"_dragRaycastTargets",null);this._controller=t,this._raycaster=new i.Raycaster}get isDragging(){return this._dragging}get draggable(){return this._draggable}onActivate(){this.resetDragState()}onDeactivate(){this._dragging&&this._draggable&&this.endDrag(),this.resetDragState()}onPointerDown(t){var e;t.pointerPrimaryDown&&(this._draggable=S.findInterface((e=t.intersects[0])==null?void 0:e.object,"isDraggable")||null)}onPointerMove(t){if(t.pointerPrimaryDown&&this._draggable&&(this._raycaster.setFromCamera(t.pointer,this._controller.object),this._dragging||t.lastPointerDown.distanceTo(t.pointer)>zt&&this.startDrag(t),this._dragging))return this.updateDrag(t),!0}onPointerUp(t){this._dragging&&(this._raycaster.setFromCamera(t.pointer,this._controller.object),this.endDrag()),this._draggable=null}setDragRaycastTargets(t){this._dragRaycastTargets=t}startDrag(t){var s,o;const e=this.getDragIntersect(t);e&&(this._dragStart.copy(e.point),this._dragCurrent.copy(e.point),this._dragEnd.copy(e.point),this._dragDelta.set(0,0,0),(o=(s=this._draggable)==null?void 0:s.onDragStart)==null||o.call(s,this.createDragEvent()),this._dragging=!0,this._controller.enabled=!1)}updateDrag(t){var s,o;const e=this.getDragIntersect(t);e&&(this._dragCurrent.copy(e.point),this._dragEnd.copy(e.point),this._dragDelta.subVectors(this._dragCurrent,this._dragStart),(o=(s=this._draggable)==null?void 0:s.onDrag)==null||o.call(s,this.createDragEvent()))}endDrag(){var e,s;const t=this.createDragEvent();(s=(e=this._draggable)==null?void 0:e.onDragEnd)==null||s.call(e,t),this._dragging=!1,this._controller.enabled=!0,this.resetDragState()}getDragIntersect(t){return this._dragRaycastTargets?this._raycaster.intersectObjects(this._dragRaycastTargets,!0)[0]||null:t.intersects[0]||null}createDragEvent(){return{dragStart:this._dragStart.clone(),dragCurrent:this._dragCurrent.clone(),dragEnd:this._dragEnd.clone(),dragDelta:this._dragDelta.clone()}}resetDragState(){this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0)}}const Gt=.001;class Rt{constructor(t,e){r(this,"_scene");r(this,"_controller");r(this,"_canvas");r(this,"_tools");r(this,"_activeTools",new Map);r(this,"_sortedActiveTools",[]);r(this,"_selectionState");r(this,"_raycaster");r(this,"_pointer");r(this,"_productLayerMask");r(this,"_uiLayerMask");r(this,"_pointerPrimaryDown",!1);r(this,"_pointerMiddleDown",!1);r(this,"_pointerSecondaryDown",!1);r(this,"_lastPointerDown");r(this,"_boundPointerMove");r(this,"_boundPointerDown");r(this,"_boundPointerUp");r(this,"_boundWheel");this._scene=t,this._controller=e,this._canvas=e.domElement,this._selectionState=new lt,this._raycaster=new i.Raycaster,this._pointer=new i.Vector2,this._lastPointerDown=new i.Vector2,this._productLayerMask=new i.Layers,this._productLayerMask.set(Math.log2(M.PRODUCT_LAYER_MASK)),this._uiLayerMask=new i.Layers,this._uiLayerMask.set(Math.log2(M.UI_LAYER_MASK)),this._tools=new Map([["hover",new ct],["select",new $(this._selectionState)],["transform",new J(t,e,this._selectionState)],["drag",new dt(e)]]),this._boundPointerMove=this.onPointerMove.bind(this),this._boundPointerDown=this.onPointerDown.bind(this),this._boundPointerUp=this.onPointerUp.bind(this),this._boundWheel=this.onWheel.bind(this),this._canvas.addEventListener("pointermove",this._boundPointerMove),this._canvas.addEventListener("pointerdown",this._boundPointerDown),this._canvas.addEventListener("pointerup",this._boundPointerUp),this._canvas.addEventListener("wheel",this._boundWheel)}get selectionState(){return this._selectionState}enableTool(t){var s;const e=this._tools.get(t);e&&(this._activeTools.has(t)||(this._activeTools.set(t,e),this.updateSortedTools(),(s=e.onActivate)==null||s.call(e)))}disableTool(t){var s;const e=this._activeTools.get(t);e&&((s=e.onDeactivate)==null||s.call(e),this._activeTools.delete(t),this.updateSortedTools())}isToolEnabled(t){return this._activeTools.has(t)}getTool(t){return this._tools.get(t)}getActiveTools(){return[...this._sortedActiveTools]}dispose(){var t;for(const e of this._activeTools.values())(t=e.onDeactivate)==null||t.call(e);this._activeTools.clear(),this._tools.clear(),this._sortedActiveTools=[],this._canvas.removeEventListener("pointermove",this._boundPointerMove),this._canvas.removeEventListener("pointerdown",this._boundPointerDown),this._canvas.removeEventListener("pointerup",this._boundPointerUp),this._canvas.removeEventListener("wheel",this._boundWheel),this._selectionState.dispose()}onPointerMove(t){var s;this.updatePointer(t);const e=this.createPointerContext(t);for(const o of this._sortedActiveTools)if((s=o.onPointerMove)==null?void 0:s.call(o,e))break}onPointerDown(t){var s;this.updatePointerState(t,!0),this.updatePointer(t),this._lastPointerDown.copy(this._pointer);const e=this.createPointerContext(t);for(const o of this._sortedActiveTools)if((s=o.onPointerDown)==null?void 0:s.call(o,e))break}onPointerUp(t){var o,a;this.updatePointer(t);const e=this.createPointerContext(t),s=!this.pointerWasDragged();for(const n of this._sortedActiveTools)if((o=n.onPointerUp)==null?void 0:o.call(n,e))break;if(s){for(const n of this._sortedActiveTools)if((a=n.onClick)==null?void 0:a.call(n,e))break}this.updatePointerState(t,!1)}onWheel(t){var s;const e=this.createWheelContext(t);for(const o of this._sortedActiveTools)if((s=o.onWheel)==null?void 0:s.call(o,e))break}createPointerContext(t){const e=this.raycast();return{event:t,pointer:this._pointer.clone(),intersects:e,modelIntersects:this.filterIntersectsByLayer(e,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(e,M.UI_LAYER_MASK),pointerPrimaryDown:this._pointerPrimaryDown,pointerMiddleDown:this._pointerMiddleDown,pointerSecondaryDown:this._pointerSecondaryDown,lastPointerDown:this._lastPointerDown.clone()}}createWheelContext(t){const e=this.raycast();return{event:t,pointer:this._pointer.clone(),intersects:e,modelIntersects:this.filterIntersectsByLayer(e,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(e,M.UI_LAYER_MASK)}}updatePointer(t){this._pointer.x=t.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(t.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object)}updatePointerState(t,e){switch(t.button){case 0:this._pointerPrimaryDown=e;break;case 1:this._pointerMiddleDown=e;break;case 2:this._pointerSecondaryDown=e;break}}raycast(){this._raycaster.layers.mask=M.PRODUCT_LAYER_MASK|M.UI_LAYER_MASK;const t=this._scene.children.filter(e=>e.visible&&"isMesh"in e&&e.isMesh);return this._raycaster.intersectObjects(t,!0)}filterIntersectsByLayer(t,e){return t.filter(s=>(s.object.layers.mask&e)!==0)}updateSortedTools(){this._sortedActiveTools=[...this._activeTools.values()].sort((t,e)=>t.priority-e.priority)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>Gt}useTool(t){const e=["hover","select","transform","drag"];for(const s of e)(s===t||t==="select")&&this.enableTool(s)}getActiveTool(){return this._sortedActiveTools[0]||null}}class Yt{constructor(t,e){r(this,"POINTER_DRAG_THRESHOLD",.001);r(this,"name");r(this,"_canvas");r(this,"_scene");r(this,"_controller");r(this,"_pointer");r(this,"_pointerPrimaryDown");r(this,"_pointerMiddleDown");r(this,"_pointerSecondaryDown");r(this,"_lastPointerDown");r(this,"_lastPointerUp");r(this,"_raycaster");r(this,"_intersects");r(this,"_hovered");r(this,"_dragging");r(this,"_dragStart");r(this,"_dragCurrent");r(this,"_dragEnd");r(this,"_dragDelta");r(this,"_draggable");r(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=t,this._controller=e,this._pointer=new i.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new i.Vector2,this._lastPointerUp=new i.Vector2,this._raycaster=new i.Raycaster,this._raycaster.layers.mask=M.PRODUCT_LAYER_MASK|M.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new i.Vector3,this._dragCurrent=new i.Vector3,this._dragEnd=new i.Vector3,this._dragDelta=new i.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(t){var e;switch(t.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: "+t.button)}this._lastPointerDown.copy(this._pointer),this._draggable=S.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(t){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(t){var s;this._pointer.x=t.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(t.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=S.findInterface((s=this._intersects[0])==null?void 0:s.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(t),this.onDrag(t))}onDrag(t){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(t){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(t):this.onClick(t),t.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(t){}onDragEnd(t){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(t){}raycast(t){const s=(t||this._scene.children).filter(o=>o.visible&&"isMesh"in o&&o.isMesh);return this._raycaster.intersectObjects(s,!0)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}exports.DIVEBaseTool=Yt;exports.DIVESelectTool=$;exports.DIVETransformTool=J;exports.DragTool=dt;exports.HoverTool=ct;exports.SelectTool=$;exports.SelectionState=lt;exports.Toolbox=Rt;exports.TransformTool=J;exports.isSelectTool=St;exports.isTransformTool=Lt;
1
+ "use strict";var vt=Object.defineProperty;var Mt=(h,t,e)=>t in h?vt(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e;var r=(h,t,e)=>Mt(h,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three");require("../../chunks/FileTypes-BQ2AN2gJ.cjs");const M=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),S=require("../../chunks/findInterface-C6mrvf_t.cjs"),G=require("../../chunks/AxisHelperColors-BrGqktN5.cjs");class lt{constructor(){r(this,"_selected",null);r(this,"_listeners",new Set)}get selected(){return this._selected}select(t){var e,s,o;this._selected!==t&&(this._selected&&((s=(e=this._selected).onDeselect)==null||s.call(e)),this._selected=t,(o=t.onSelect)==null||o.call(t),this.notifyListeners())}deselect(){var t,e;this._selected&&((e=(t=this._selected).onDeselect)==null||e.call(t),this._selected=null,this.notifyListeners())}onChange(t){this._listeners.add(t)}offChange(t){this._listeners.delete(t)}dispose(){this._selected=null,this._listeners.clear()}notifyListeners(){for(const t of this._listeners)t(this._selected)}}class ct{constructor(){r(this,"name","hover");r(this,"priority",20);r(this,"_hovered",null)}get hovered(){return this._hovered}onActivate(){this._hovered=null}onDeactivate(){var t,e;this._hovered&&((e=(t=this._hovered).onPointerLeave)==null||e.call(t),this._hovered=null)}onPointerMove(t){var o,a,n,l,_,w,P;const e=t.modelIntersects[0],s=S.findInterface(e==null?void 0:e.object,"isHoverable");if(e&&s){if(!this._hovered){(o=s.onPointerEnter)==null||o.call(s,e),this._hovered=s;return}if(this._hovered.uuid!==s.uuid){(n=(a=this._hovered).onPointerLeave)==null||n.call(a),(l=s.onPointerEnter)==null||l.call(s,e),this._hovered=s;return}(_=s.onPointerOver)==null||_.call(s,e);return}this._hovered&&((P=(w=this._hovered).onPointerLeave)==null||P.call(w),this._hovered=null)}}const St=h=>h.name==="select";class ${constructor(t){r(this,"name","select");r(this,"priority",30);r(this,"_selectionState");this._selectionState=t}get selected(){return this._selectionState.selected}onActivate(){}onDeactivate(){}onClick(t){const e=t.modelIntersects[0],s=S.findInterface(e==null?void 0:e.object,"isSelectable");if(!e||!s){this._selectionState.deselect();return}const o=this._selectionState.selected;o&&o.uuid===s.uuid||this._selectionState.select(s)}select(t){this._selectionState.select(t)}deselect(){this._selectionState.deselect()}}const A=new i.Raycaster,p=new i.Vector3,T=new i.Vector3,d=new i.Quaternion,it={X:new i.Vector3(1,0,0),Y:new i.Vector3(0,1,0),Z:new i.Vector3(0,0,1)},N={type:"change"},st={type:"mouseDown"},nt={type:"mouseUp",mode:null},ot={type:"objectChange"};class Pt extends i.Object3D{constructor(t,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 s=new At;this._gizmo=s,this.add(s);const o=new Ct;this._plane=o,this.add(o);const a=this;function n(u,f){let L=f;Object.defineProperty(a,u,{get:function(){return L!==void 0?L:f},set:function(I){L!==I&&(L=I,o[u]=I,s[u]=I,a.dispatchEvent({type:u+"-changed",value:I}),a.dispatchEvent(N))}}),a[u]=f,o[u]=f,s[u]=f}n("camera",t),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const l=new i.Vector3,_=new i.Vector3,w=new i.Quaternion,P=new i.Quaternion,R=new i.Vector3,Y=new i.Quaternion,tt=new i.Vector3,j=new i.Vector3,D=new i.Vector3,E=0,b=new i.Vector3;n("worldPosition",l),n("worldPositionStart",_),n("worldQuaternion",w),n("worldQuaternionStart",P),n("cameraPosition",R),n("cameraQuaternion",Y),n("pointStart",tt),n("pointEnd",j),n("rotationAxis",D),n("rotationAngle",E),n("eye",b),this._offset=new i.Vector3,this._startNorm=new i.Vector3,this._endNorm=new i.Vector3,this._cameraScale=new i.Vector3,this._parentPosition=new i.Vector3,this._parentQuaternion=new i.Quaternion,this._parentQuaternionInv=new i.Quaternion,this._parentScale=new i.Vector3,this._worldScaleStart=new i.Vector3,this._worldQuaternionInv=new i.Quaternion,this._worldScale=new i.Vector3,this._positionStart=new i.Vector3,this._quaternionStart=new i.Quaternion,this._scaleStart=new i.Vector3,this._getPointer=Dt.bind(this),this._onPointerDown=xt.bind(this),this._onPointerHover=Et.bind(this),this._onPointerMove=Tt.bind(this),this._onPointerUp=It.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(t){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(t)}pointerHover(t){if(this.object===void 0||this.dragging===!0)return;t!==null&&A.setFromCamera(t,this.camera);const e=K(this._gizmo.picker[this.mode],A);e?this.axis=e.object.name:this.axis=null}pointerDown(t){if(!(this.object===void 0||this.dragging===!0||t!=null&&t.button!==0)&&this.axis!==null){t!==null&&A.setFromCamera(t,this.camera);const e=K(this._plane,A,!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,st.mode=this.mode,this.dispatchEvent(st)}}pointerMove(t){const e=this.axis,s=this.mode,o=this.object;let a=this.space;if(s==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),o===void 0||e===null||this.dragging===!1||t!==null&&t.button!==-1)return;t!==null&&A.setFromCamera(t,this.camera);const n=K(this._plane,A,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),s==="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),o.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(o.position.applyQuaternion(d.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this._quaternionStart)),a==="world"&&(o.parent&&o.position.add(p.setFromMatrixPosition(o.parent.matrixWorld)),e.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(p.setFromMatrixPosition(o.parent.matrixWorld))));else if(s==="scale"){if(e.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),T.set(l,l,l)}else p.copy(this.pointStart),T.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),T.applyQuaternion(this._worldQuaternionInv),T.divide(p),e.search("X")===-1&&(T.x=1),e.search("Y")===-1&&(T.y=1),e.search("Z")===-1&&(T.z=1);o.scale.copy(this._scaleStart).multiply(T),this.scaleSnap&&(e.search("X")!==-1&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const l=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let _=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*l):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(it[e]),p.copy(it[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?_=!0:this.rotationAngle=this._offset.dot(p.normalize())*l),(e==="E"||_)&&(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"?(o.quaternion.copy(this._quaternionStart),o.quaternion.multiply(d.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),o.quaternion.copy(d.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(N),this.dispatchEvent(ot)}}pointerUp(t){t!==null&&t.button!==0||(this.dragging&&this.axis!==null&&(nt.mode=this.mode,this.dispatchEvent(nt)),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(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}attach(t){return this.object=t,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(N),this.dispatchEvent(ot),this.pointStart.copy(this.pointEnd))}getRaycaster(){return A}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}}function Dt(h){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:h.button};{const t=this.domElement.getBoundingClientRect();return{x:(h.clientX-t.left)/t.width*2-1,y:-(h.clientY-t.top)/t.height*2+1,button:h.button}}}function Et(h){if(this.enabled)switch(h.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(h));break}}function xt(h){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(h.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(h)),this.pointerDown(this._getPointer(h)))}function Tt(h){this.enabled&&this.pointerMove(this._getPointer(h))}function It(h){this.enabled&&(this.domElement.releasePointerCapture(h.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(h)))}function K(h,t,e){const s=t.intersectObject(h,!0);for(let o=0;o<s.length;o++)if(s[o].object.visible||e)return s[o];return!1}const B=new i.Euler,c=new i.Vector3(0,1,0),rt=new i.Vector3(0,0,0),at=new i.Matrix4,q=new i.Quaternion,F=new i.Quaternion,v=new i.Vector3,ht=new i.Matrix4,O=new i.Vector3(1,0,0),C=new i.Vector3(0,1,0),X=new i.Vector3(0,0,1),U=new i.Vector3,Q=new i.Vector3,H=new i.Vector3;class At extends i.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const t=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=t.clone();s.opacity=.15;const o=e.clone();o.opacity=.5;const a=t.clone();a.color.setHex(16711680);const n=t.clone();n.color.setHex(65280);const l=t.clone();l.color.setHex(255);const _=t.clone();_.color.setHex(16711680),_.opacity=.5;const w=t.clone();w.color.setHex(65280),w.opacity=.5;const P=t.clone();P.color.setHex(255),P.opacity=.5;const R=t.clone();R.opacity=.25;const Y=t.clone();Y.color.setHex(16776960),Y.opacity=.25,t.clone().color.setHex(16776960);const j=t.clone();j.color.setHex(7895160);const D=new i.CylinderGeometry(0,.04,.1,12);D.translate(0,.05,0);const E=new i.BoxGeometry(.08,.08,.08);E.translate(0,.04,0);const b=new i.BufferGeometry;b.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,0,0],3));const u=new i.CylinderGeometry(.0075,.0075,.5,3);u.translate(0,.25,0);function f(g,k){const y=new i.TorusGeometry(g,.0075,3,64,k*Math.PI*2);return y.rotateY(Math.PI/2),y.rotateX(Math.PI/2),y}function L(){const g=new i.BufferGeometry;return g.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),g}const I={X:[[new i.Mesh(D,a),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(D,a),[-.5,0,0],[0,0,Math.PI/2]],[new i.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new i.Mesh(D,n),[0,.5,0]],[new i.Mesh(D,n),[0,-.5,0],[Math.PI,0,0]],[new i.Mesh(u,n)]],Z:[[new i.Mesh(D,l),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(D,l),[0,0,-.5],[-Math.PI/2,0,0]],[new i.Mesh(u,l),null,[Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.1,0),R.clone()),[0,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),P.clone()),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),_.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),w.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},pt={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.2,0),s)]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},_t={START:[[new i.Mesh(new i.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],END:[[new i.Mesh(new i.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],DELTA:[[new i.Line(L(),o),null,null,null,"helper"]],X:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(b,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(b,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ut={XYZE:[[new i.Mesh(f(.5,1),j),null,[0,Math.PI/2,0]]],X:[[new i.Mesh(f(.5,.5),a)]],Y:[[new i.Mesh(f(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new i.Mesh(f(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new i.Mesh(f(.75,1),Y),null,[0,Math.PI/2,0]]]},mt={AXIS:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},gt={XYZE:[[new i.Mesh(new i.SphereGeometry(.25,10,8),s)]],X:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new i.Mesh(new i.TorusGeometry(.75,.1,2,24),s)]]},ft={X:[[new i.Mesh(E,a),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]],[new i.Mesh(E,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(E,n),[0,.5,0]],[new i.Mesh(u,n)],[new i.Mesh(E,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new i.Mesh(E,l),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(u,l),[0,0,0],[Math.PI/2,0,0]],[new i.Mesh(E,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),P),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),_),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),w),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.1,.1,.1),R.clone())]]},yt={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},wt={X:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(b,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(b,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function x(g){const k=new i.Object3D;for(const y in g)for(let z=g[y].length;z--;){const m=g[y][z][0].clone(),V=g[y][z][1],Z=g[y][z][2],W=g[y][z][3],bt=g[y][z][4];m.name=y,m.tag=bt,V&&m.position.set(V[0],V[1],V[2]),Z&&m.rotation.set(Z[0],Z[1],Z[2]),W&&m.scale.set(W[0],W[1],W[2]),m.updateMatrix();const et=m.geometry.clone();et.applyMatrix4(m.matrix),m.geometry=et,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),k.add(m)}return k}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=x(I)),this.add(this.gizmo.rotate=x(ut)),this.add(this.gizmo.scale=x(ft)),this.add(this.picker.translate=x(pt)),this.add(this.picker.rotate=x(gt)),this.add(this.picker.scale=x(yt)),this.add(this.helper.translate=x(_t)),this.add(this.helper.rotate=x(mt)),this.add(this.helper.scale=x(wt)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const s=(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 o=[];o=o.concat(this.picker[this.mode].children),o=o.concat(this.gizmo[this.mode].children),o=o.concat(this.helper[this.mode].children);for(let a=0;a<o.length;a++){const n=o[a];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let l;if(this.camera.isOrthographicCamera?l=(this.camera.top-this.camera.bottom)/this.camera.zoom:l=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(l*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(d.setFromEuler(B.set(0,0,0)),n.quaternion.copy(s).multiply(d),Math.abs(c.copy(O).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(d.setFromEuler(B.set(0,0,Math.PI/2)),n.quaternion.copy(s).multiply(d),Math.abs(c.copy(C).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(d.setFromEuler(B.set(0,Math.PI/2,0)),n.quaternion.copy(s).multiply(d),Math.abs(c.copy(X).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(d.setFromEuler(B.set(0,Math.PI/2,0)),c.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(at.lookAt(rt,c,C)),n.quaternion.multiply(d),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.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()),n.scale.copy(p),n.visible=this.dragging):(n.quaternion.copy(s),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(s),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(c.copy(O).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(c.copy(C).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(c.copy(X).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(c.copy(X).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(c.copy(O).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(c.copy(C).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(q.copy(s),c.copy(this.eye).applyQuaternion(d.copy(s).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(at.lookAt(this.eye,rt,C)),n.name==="X"&&(d.setFromAxisAngle(O,Math.atan2(-c.y,c.z)),d.multiplyQuaternions(q,d),n.quaternion.copy(d)),n.name==="Y"&&(d.setFromAxisAngle(C,Math.atan2(c.x,c.z)),d.multiplyQuaternions(q,d),n.quaternion.copy(d)),n.name==="Z"&&(d.setFromAxisAngle(X,Math.atan2(c.y,c.x)),d.multiplyQuaternions(q,d),n.quaternion.copy(d))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(_){return n.name===_}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(t)}}class Ct extends i.Mesh{constructor(){super(new i.PlaneGeometry(1e5,1e5,2,2),new i.MeshBasicMaterial({visible:!1,wireframe:!0,side:i.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),U.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),Q.copy(C).applyQuaternion(e==="local"?this.worldQuaternion:F),H.copy(X).applyQuaternion(e==="local"?this.worldQuaternion:F),c.copy(Q),this.mode){case"translate":case"scale":switch(this.axis){case"X":c.copy(this.eye).cross(U),v.copy(U).cross(c);break;case"Y":c.copy(this.eye).cross(Q),v.copy(Q).cross(c);break;case"Z":c.copy(this.eye).cross(H),v.copy(H).cross(c);break;case"XY":v.copy(H);break;case"YZ":v.copy(U);break;case"XZ":c.copy(H),v.copy(Q);break;case"XYZ":case"E":v.set(0,0,0);break}break;case"rotate":default:v.set(0,0,0)}v.length()===0?this.quaternion.copy(this.cameraQuaternion):(ht.lookAt(p.set(0,0,0),v,c),this.quaternion.setFromRotationMatrix(ht)),super.updateMatrixWorld(t)}}const Lt=h=>h.name==="transform";class J{constructor(t,e,s){r(this,"name","transform");r(this,"priority",5);r(this,"_scene");r(this,"_controller");r(this,"_selectionState");r(this,"_gizmo");r(this,"_scaleLinked",!1);r(this,"_gizmoVisible",!0);r(this,"_selectionChangeHandler");this._scene=t,this._controller=e,this._selectionState=s,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo),this._selectionChangeHandler=this.onSelectionChange.bind(this)}get gizmo(){return this._gizmo}get isDragging(){return this._gizmo.dragging}onActivate(){this._selectionState.onChange(this._selectionChangeHandler);const t=this._selectionState.selected;t&&this.attachGizmo(t)}onDeactivate(){this._selectionState.offChange(this._selectionChangeHandler),this._gizmo.detach()}onPointerMove(t){if(this._gizmo.dragging||t.uiIntersects.length>0&&t.uiIntersects.some(s=>this.isGizmoChild(s.object)))return!0}setGizmoMode(t){this._gizmo.mode=t}setGizmoVisible(t){this._gizmoVisible=t;const e=this._scene.children.includes(this._gizmo);t&&!e?(this._scene.add(this._gizmo),this._gizmo.getRaycaster().layers.enableAll()):!t&&e&&(this._scene.remove(this._gizmo),this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(t){this._scaleLinked=t}dispose(){this._selectionState.offChange(this._selectionChangeHandler),this._gizmo.detach(),this._scene.remove(this._gizmo),this._gizmo.dispose()}onSelectionChange(t){t&&S.implementsInterface(t,"isMovable")?this.attachGizmo(t):this._gizmo.detach()}attachGizmo(t){S.implementsInterface(t,"isMovable")&&(this._gizmo.attach(t),this.setGizmoVisible(t.visible&&this._gizmoVisible))}isGizmoChild(t){let e=t;for(;e;){if(e===this._gizmo)return!0;e=e.parent}return!1}initGizmo(){const t=new Pt(this._controller.object,this._controller.domElement);return t.mode="translate",t.traverse(e=>{if(!("isMesh"in e))return;const s=e.material;e.name==="X"&&s.color.set(G.AxesColorRed),e.name==="Y"&&s.color.set(G.AxesColorGreen),e.name==="Z"&&s.color.set(G.AxesColorBlue),e.name==="XY"&&s.color.set(G.AxesColorBlue),e.name==="YZ"&&s.color.set(G.AxesColorRed),e.name==="XZ"&&s.color.set(G.AxesColorGreen)}),t.addEventListener("mouseDown",()=>{var e,s;this._controller.enabled=!1,S.implementsInterface(t.object,"isMovable")&&((s=(e=t.object).onMoveStart)==null||s.call(e))}),t.addEventListener("objectChange",()=>{var e,s;if(S.implementsInterface(t.object,"isMovable")&&((s=(e=t.object).onMove)==null||s.call(e),this._scaleLinked&&t.object)){const o=t.object.scale,a=(o.x+o.y+o.z)/3;t.object.scale.set(a,a,a)}}),t.addEventListener("mouseUp",()=>{var e,s;this._controller.enabled=!0,S.implementsInterface(t.object,"isMovable")&&((s=(e=t.object).onMoveEnd)==null||s.call(e))}),t}}const zt=.001;class dt{constructor(t){r(this,"name","drag");r(this,"priority",10);r(this,"_controller");r(this,"_raycaster");r(this,"_dragging",!1);r(this,"_draggable",null);r(this,"_dragStart",new i.Vector3);r(this,"_dragCurrent",new i.Vector3);r(this,"_dragEnd",new i.Vector3);r(this,"_dragDelta",new i.Vector3);r(this,"_dragRaycastTargets",null);this._controller=t,this._raycaster=new i.Raycaster}get isDragging(){return this._dragging}get draggable(){return this._draggable}onActivate(){this.resetDragState()}onDeactivate(){this._dragging&&this._draggable&&this.endDrag(),this.resetDragState()}onPointerDown(t){var e;t.pointerPrimaryDown&&(this._draggable=S.findInterface((e=t.intersects[0])==null?void 0:e.object,"isDraggable")||null)}onPointerMove(t){if(t.pointerPrimaryDown&&this._draggable&&(this._raycaster.setFromCamera(t.pointer,this._controller.object),this._dragging||t.lastPointerDown.distanceTo(t.pointer)>zt&&this.startDrag(t),this._dragging))return this.updateDrag(t),!0}onPointerUp(t){this._dragging&&(this._raycaster.setFromCamera(t.pointer,this._controller.object),this.endDrag()),this._draggable=null}setDragRaycastTargets(t){this._dragRaycastTargets=t}startDrag(t){var s,o;const e=this.getDragIntersect(t);e&&(this._dragStart.copy(e.point),this._dragCurrent.copy(e.point),this._dragEnd.copy(e.point),this._dragDelta.set(0,0,0),(o=(s=this._draggable)==null?void 0:s.onDragStart)==null||o.call(s,this.createDragEvent()),this._dragging=!0,this._controller.enabled=!1)}updateDrag(t){var s,o;const e=this.getDragIntersect(t);e&&(this._dragCurrent.copy(e.point),this._dragEnd.copy(e.point),this._dragDelta.subVectors(this._dragCurrent,this._dragStart),(o=(s=this._draggable)==null?void 0:s.onDrag)==null||o.call(s,this.createDragEvent()))}endDrag(){var e,s;const t=this.createDragEvent();(s=(e=this._draggable)==null?void 0:e.onDragEnd)==null||s.call(e,t),this._dragging=!1,this._controller.enabled=!0,this.resetDragState()}getDragIntersect(t){return this._dragRaycastTargets?this._raycaster.intersectObjects(this._dragRaycastTargets,!0)[0]||null:t.intersects[0]||null}createDragEvent(){return{dragStart:this._dragStart.clone(),dragCurrent:this._dragCurrent.clone(),dragEnd:this._dragEnd.clone(),dragDelta:this._dragDelta.clone()}}resetDragState(){this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0)}}const Gt=.001;class Rt{constructor(t,e){r(this,"_scene");r(this,"_controller");r(this,"_canvas");r(this,"_tools");r(this,"_activeTools",new Map);r(this,"_sortedActiveTools",[]);r(this,"_selectionState");r(this,"_raycaster");r(this,"_pointer");r(this,"_productLayerMask");r(this,"_uiLayerMask");r(this,"_pointerPrimaryDown",!1);r(this,"_pointerMiddleDown",!1);r(this,"_pointerSecondaryDown",!1);r(this,"_lastPointerDown");r(this,"_boundPointerMove");r(this,"_boundPointerDown");r(this,"_boundPointerUp");r(this,"_boundWheel");this._scene=t,this._controller=e,this._canvas=e.domElement,this._selectionState=new lt,this._raycaster=new i.Raycaster,this._pointer=new i.Vector2,this._lastPointerDown=new i.Vector2,this._productLayerMask=new i.Layers,this._productLayerMask.set(Math.log2(M.PRODUCT_LAYER_MASK)),this._uiLayerMask=new i.Layers,this._uiLayerMask.set(Math.log2(M.UI_LAYER_MASK)),this._tools=new Map([["hover",new ct],["select",new $(this._selectionState)],["transform",new J(t,e,this._selectionState)],["drag",new dt(e)]]),this._boundPointerMove=this.onPointerMove.bind(this),this._boundPointerDown=this.onPointerDown.bind(this),this._boundPointerUp=this.onPointerUp.bind(this),this._boundWheel=this.onWheel.bind(this),this._canvas.addEventListener("pointermove",this._boundPointerMove),this._canvas.addEventListener("pointerdown",this._boundPointerDown),this._canvas.addEventListener("pointerup",this._boundPointerUp),this._canvas.addEventListener("wheel",this._boundWheel)}get selectionState(){return this._selectionState}enableTool(t){var s;const e=this._tools.get(t);e&&(this._activeTools.has(t)||(this._activeTools.set(t,e),this.updateSortedTools(),(s=e.onActivate)==null||s.call(e)))}disableTool(t){var s;const e=this._activeTools.get(t);e&&((s=e.onDeactivate)==null||s.call(e),this._activeTools.delete(t),this.updateSortedTools())}isToolEnabled(t){return this._activeTools.has(t)}getTool(t){return this._tools.get(t)}getActiveTools(){return[...this._sortedActiveTools]}dispose(){var t;for(const e of this._activeTools.values())(t=e.onDeactivate)==null||t.call(e);this._activeTools.clear(),this._tools.clear(),this._sortedActiveTools=[],this._canvas.removeEventListener("pointermove",this._boundPointerMove),this._canvas.removeEventListener("pointerdown",this._boundPointerDown),this._canvas.removeEventListener("pointerup",this._boundPointerUp),this._canvas.removeEventListener("wheel",this._boundWheel),this._selectionState.dispose()}onPointerMove(t){var s;this.updatePointer(t);const e=this.createPointerContext(t);for(const o of this._sortedActiveTools)if((s=o.onPointerMove)==null?void 0:s.call(o,e))break}onPointerDown(t){var s;this.updatePointerState(t,!0),this.updatePointer(t),this._lastPointerDown.copy(this._pointer);const e=this.createPointerContext(t);for(const o of this._sortedActiveTools)if((s=o.onPointerDown)==null?void 0:s.call(o,e))break}onPointerUp(t){var o,a;this.updatePointer(t);const e=this.createPointerContext(t),s=!this.pointerWasDragged();for(const n of this._sortedActiveTools)if((o=n.onPointerUp)==null?void 0:o.call(n,e))break;if(s){for(const n of this._sortedActiveTools)if((a=n.onClick)==null?void 0:a.call(n,e))break}this.updatePointerState(t,!1)}onWheel(t){var s;const e=this.createWheelContext(t);for(const o of this._sortedActiveTools)if((s=o.onWheel)==null?void 0:s.call(o,e))break}createPointerContext(t){const e=this.raycast();return{event:t,pointer:this._pointer.clone(),intersects:e,modelIntersects:this.filterIntersectsByLayer(e,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(e,M.UI_LAYER_MASK),pointerPrimaryDown:this._pointerPrimaryDown,pointerMiddleDown:this._pointerMiddleDown,pointerSecondaryDown:this._pointerSecondaryDown,lastPointerDown:this._lastPointerDown.clone()}}createWheelContext(t){const e=this.raycast();return{event:t,pointer:this._pointer.clone(),intersects:e,modelIntersects:this.filterIntersectsByLayer(e,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(e,M.UI_LAYER_MASK)}}updatePointer(t){this._pointer.x=t.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(t.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object)}updatePointerState(t,e){switch(t.button){case 0:this._pointerPrimaryDown=e;break;case 1:this._pointerMiddleDown=e;break;case 2:this._pointerSecondaryDown=e;break}}raycast(){this._raycaster.layers.mask=M.PRODUCT_LAYER_MASK|M.UI_LAYER_MASK;const t=this._scene.children.filter(e=>e.visible&&"isMesh"in e&&e.isMesh);return this._raycaster.intersectObjects(t,!0)}filterIntersectsByLayer(t,e){return t.filter(s=>(s.object.layers.mask&e)!==0)}updateSortedTools(){this._sortedActiveTools=[...this._activeTools.values()].sort((t,e)=>t.priority-e.priority)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>Gt}useTool(t){const e=["hover","select","transform","drag"];for(const s of e)(s===t||t==="select")&&this.enableTool(s)}getActiveTool(){return this._sortedActiveTools[0]||null}}class Yt{constructor(t,e){r(this,"POINTER_DRAG_THRESHOLD",.001);r(this,"name");r(this,"_canvas");r(this,"_scene");r(this,"_controller");r(this,"_pointer");r(this,"_pointerPrimaryDown");r(this,"_pointerMiddleDown");r(this,"_pointerSecondaryDown");r(this,"_lastPointerDown");r(this,"_lastPointerUp");r(this,"_raycaster");r(this,"_intersects");r(this,"_hovered");r(this,"_dragging");r(this,"_dragStart");r(this,"_dragCurrent");r(this,"_dragEnd");r(this,"_dragDelta");r(this,"_draggable");r(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=t,this._controller=e,this._pointer=new i.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new i.Vector2,this._lastPointerUp=new i.Vector2,this._raycaster=new i.Raycaster,this._raycaster.layers.mask=M.PRODUCT_LAYER_MASK|M.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new i.Vector3,this._dragCurrent=new i.Vector3,this._dragEnd=new i.Vector3,this._dragDelta=new i.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(t){var e;switch(t.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: "+t.button)}this._lastPointerDown.copy(this._pointer),this._draggable=S.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(t){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(t){var s;this._pointer.x=t.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(t.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=S.findInterface((s=this._intersects[0])==null?void 0:s.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(t),this.onDrag(t))}onDrag(t){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(t){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(t):this.onClick(t),t.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(t){}onDragEnd(t){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(t){}raycast(t){const s=(t||this._scene.children).filter(o=>o.visible&&"isMesh"in o&&o.isMesh);return this._raycaster.intersectObjects(s,!0)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}exports.DIVEBaseTool=Yt;exports.DIVESelectTool=$;exports.DIVETransformTool=J;exports.DragTool=dt;exports.HoverTool=ct;exports.SelectTool=$;exports.SelectionState=lt;exports.Toolbox=Rt;exports.TransformTool=J;exports.isSelectTool=St;exports.isTransformTool=Lt;
@@ -2,7 +2,7 @@ var Xt = Object.defineProperty;
2
2
  var Yt = (h, t, e) => t in h ? Xt(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
3
3
  var o = (h, t, e) => Yt(h, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { Object3D as lt, Vector3 as l, Quaternion as E, Raycaster as ot, MeshBasicMaterial as Dt, LineBasicMaterial as jt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as dt, Float32BufferAttribute as pt, Mesh as r, OctahedronGeometry as tt, Line as A, TorusGeometry as Q, SphereGeometry as kt, Euler as Qt, Matrix4 as Et, PlaneGeometry as Ot, DoubleSide as Rt, Vector2 as F, Layers as _t } from "three";
5
- import "../../chunks/FileTypes-DpEf5lqX.mjs";
5
+ import "../../chunks/FileTypes-OWYPzqcN.mjs";
6
6
  import { P as G, U as W } from "../../chunks/PerspectiveCamera-BFzE2TQU.mjs";
7
7
  import { f as B, i as O } from "../../chunks/findInterface-DbJ5qzbc.mjs";
8
8
  import { A as ut, a as gt, b as ft } from "../../chunks/AxisHelperColors-JLBHYQDi.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/dive",
3
- "version": "2.2.27",
3
+ "version": "2.2.29",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
6
  "main": "build/dive.cjs",