@shopware-ag/dive 2.2.32 → 2.2.33

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 (27) hide show
  1. package/build/chunks/{AssetCache-Vn_oWUHN.mjs → AssetCache-Bf5zeBf8.mjs} +1 -1
  2. package/build/chunks/{AssetCache-O9Nld7na.cjs → AssetCache-DITWKcA3.cjs} +1 -1
  3. package/build/chunks/{AssetLoader-HisQrhmi.cjs → AssetLoader-Bzy-S1g6.cjs} +1 -1
  4. package/build/chunks/{AssetLoader-DUlGqQ1s.mjs → AssetLoader-C_jb3yoa.mjs} +5 -5
  5. package/build/chunks/{FileTypes-Bj3ppq6g.cjs → FileTypes-BZhCMKod.cjs} +2 -2
  6. package/build/chunks/{FileTypes-BE5iKh0W.mjs → FileTypes-G8UMidQm.mjs} +24 -24
  7. package/build/chunks/{isFileTypeSupported-Caxfgj7U.mjs → isFileTypeSupported-Dm54ZeVd.mjs} +1 -1
  8. package/build/chunks/{isFileTypeSupported-DBxxvNWt.cjs → isFileTypeSupported-DmYBJKl4.cjs} +1 -1
  9. package/build/dive.cjs +1 -1
  10. package/build/dive.mjs +2 -2
  11. package/build/plugins/ar/index.cjs +1 -1
  12. package/build/plugins/ar/index.mjs +1 -1
  13. package/build/plugins/assetcache/index.cjs +1 -1
  14. package/build/plugins/assetcache/index.mjs +1 -1
  15. package/build/plugins/assetloader/index.cjs +1 -1
  16. package/build/plugins/assetloader/index.mjs +4 -3
  17. package/build/plugins/orbitcontroller/index.cjs +1 -1
  18. package/build/plugins/orbitcontroller/index.mjs +1 -1
  19. package/build/plugins/orientationdisplay/index.cjs +1 -1
  20. package/build/plugins/orientationdisplay/index.mjs +1 -1
  21. package/build/plugins/quickview/index.cjs +1 -1
  22. package/build/plugins/quickview/index.mjs +5 -5
  23. package/build/plugins/state/index.cjs +4 -4
  24. package/build/plugins/state/index.mjs +492 -492
  25. package/build/plugins/toolbox/index.cjs +1 -1
  26. package/build/plugins/toolbox/index.mjs +1 -1
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";var vt=Object.defineProperty;var Mt=(h,e,t)=>e in h?vt(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t;var r=(h,e,t)=>Mt(h,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three");require("../../chunks/FileTypes-Bj3ppq6g.cjs");const M=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),S=require("../../chunks/findInterface-C6mrvf_t.cjs"),j=require("../../chunks/AxisHelperColors-BrGqktN5.cjs");class lt{constructor(){r(this,"_selected",null);r(this,"_listeners",new Set)}get selected(){return this._selected}select(e){var t,s,o;this._selected!==e&&(this._selected&&((s=(t=this._selected).onDeselect)==null||s.call(t)),this._selected=e,(o=e.onSelect)==null||o.call(e),this.notifyListeners())}deselect(){var e,t;this._selected&&((t=(e=this._selected).onDeselect)==null||t.call(e),this._selected=null,this.notifyListeners())}onChange(e){this._listeners.add(e)}offChange(e){this._listeners.delete(e)}dispose(){this._selected=null,this._listeners.clear()}notifyListeners(){for(const e of this._listeners)e(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 e,t;this._hovered&&((t=(e=this._hovered).onPointerLeave)==null||t.call(e),this._hovered=null)}onPointerMove(e){var o,a,n,l,_,w,P;const t=e.modelIntersects[0],s=S.findInterface(t==null?void 0:t.object,"isHoverable");if(t&&s){if(!this._hovered){(o=s.onPointerEnter)==null||o.call(s,t),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,t),this._hovered=s;return}(_=s.onPointerOver)==null||_.call(s,t);return}this._hovered&&((P=(w=this._hovered).onPointerLeave)==null||P.call(w),this._hovered=null)}}const St=h=>h.name==="select";class ${constructor(e){r(this,"name","select");r(this,"priority",30);r(this,"_selectionState");this._selectionState=e}get selected(){return this._selectionState.selected}onActivate(){}onDeactivate(){}onClick(e){const t=e.modelIntersects[0],s=S.findInterface(t==null?void 0:t.object,"isSelectable");if(!t||!s){this._selectionState.deselect();return}const o=this._selectionState.selected;o&&o.uuid===s.uuid||this._selectionState.select(s)}select(e){this._selectionState.select(e)}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(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,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",e),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,G=new i.Vector3,R=new i.Quaternion,tt=new i.Vector3,X=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",G),n("cameraQuaternion",R),n("pointStart",tt),n("pointEnd",X),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(e){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(e)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&A.setFromCamera(e,this.camera);const t=K(this._gizmo.picker[this.mode],A);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&A.setFromCamera(e,this.camera);const t=K(this._plane,A,!0);t&&(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(t.point).sub(this.worldPositionStart)),this.dragging=!0,st.mode=this.mode,this.dispatchEvent(st)}}pointerMove(e){const t=this.axis,s=this.mode,o=this.object;let a=this.space;if(s==="scale"?a="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(a="world"),o===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&A.setFromCamera(e,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"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&t!=="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()),t.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),t.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)),t.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),t.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(t.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),t.search("X")===-1&&(T.x=1),t.search("Y")===-1&&(T.y=1),t.search("Z")===-1&&(T.z=1);o.scale.copy(this._scaleStart).multiply(T),this.scaleSnap&&(t.search("X")!==-1&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.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;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(it[t]),p.copy(it[t]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?_=!0:this.rotationAngle=this._offset.dot(p.normalize())*l),(t==="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"&&t!=="E"&&t!=="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(e){e!==null&&e.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(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,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(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Dt(h){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:h.button};{const e=this.domElement.getBoundingClientRect();return{x:(h.clientX-e.left)/e.width*2-1,y:-(h.clientY-e.top)/e.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,e,t){const s=e.intersectObject(h,!0);for(let o=0;o<s.length;o++)if(s[o].object.visible||t)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,H=new i.Vector3(1,0,0),C=new i.Vector3(0,1,0),O=new i.Vector3(0,0,1),U=new i.Vector3,Y=new i.Vector3,Q=new i.Vector3;class At extends i.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const o=t.clone();o.opacity=.5;const a=e.clone();a.color.setHex(16711680);const n=e.clone();n.color.setHex(65280);const l=e.clone();l.color.setHex(255);const _=e.clone();_.color.setHex(16711680),_.opacity=.5;const w=e.clone();w.color.setHex(65280),w.opacity=.5;const P=e.clone();P.color.setHex(255),P.opacity=.5;const G=e.clone();G.opacity=.25;const R=e.clone();R.color.setHex(16776960),R.opacity=.25,e.clone().color.setHex(16776960);const X=e.clone();X.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(m,k){const y=new i.TorusGeometry(m,.0075,3,64,k*Math.PI*2);return y.rotateY(Math.PI/2),y.rotateX(Math.PI/2),y}function L(){const m=new i.BufferGeometry;return m.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),m}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),G.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),X),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),R),null,[0,Math.PI/2,0]]]},gt={AXIS:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={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),G.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(m){const k=new i.Object3D;for(const y in m)for(let z=m[y].length;z--;){const g=m[y][z][0].clone(),V=m[y][z][1],Z=m[y][z][2],W=m[y][z][3],bt=m[y][z][4];g.name=y,g.tag=bt,V&&g.position.set(V[0],V[1],V[2]),Z&&g.rotation.set(Z[0],Z[1],Z[2]),W&&g.scale.set(W[0],W[1],W[2]),g.updateMatrix();const et=g.geometry.clone();et.applyMatrix4(g.matrix),g.geometry=et,g.renderOrder=1/0,g.position.set(0,0,0),g.rotation.set(0,0,0),g.scale.set(1,1,1),k.add(g)}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(mt)),this.add(this.picker.scale=x(yt)),this.add(this.helper.translate=x(_t)),this.add(this.helper.rotate=x(gt)),this.add(this.helper.scale=x(wt)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){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(H).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(O).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(H).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(O).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(O).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(H).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(H,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(O,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(e)}}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(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),U.copy(H).applyQuaternion(t==="local"?this.worldQuaternion:F),Y.copy(C).applyQuaternion(t==="local"?this.worldQuaternion:F),Q.copy(O).applyQuaternion(t==="local"?this.worldQuaternion:F),c.copy(Y),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(Y),v.copy(Y).cross(c);break;case"Z":c.copy(this.eye).cross(Q),v.copy(Q).cross(c);break;case"XY":v.copy(Q);break;case"YZ":v.copy(U);break;case"XZ":c.copy(Q),v.copy(Y);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(e)}}const Lt=h=>h.name==="transform";class J extends i.EventDispatcher{constructor(t,s,o){super();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=s,this._selectionState=o,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(o=>this.isGizmoChild(o.object)))return!0}setGizmoMode(t){this._gizmo.mode=t}setGizmoVisible(t){this._gizmoVisible=t;const s=this._scene.children.includes(this._gizmo);t&&!s?(this._scene.add(this._gizmo),this._gizmo.getRaycaster().layers.enableAll()):!t&&s&&(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 s=t;for(;s;){if(s===this._gizmo)return!0;s=s.parent}return!1}initGizmo(){const t=new Pt(this._controller.object,this._controller.domElement);return t.mode="translate",t.traverse(s=>{if(!("isMesh"in s))return;const o=s.material;s.name==="X"&&o.color.set(j.AxesColorRed),s.name==="Y"&&o.color.set(j.AxesColorGreen),s.name==="Z"&&o.color.set(j.AxesColorBlue),s.name==="XY"&&o.color.set(j.AxesColorBlue),s.name==="YZ"&&o.color.set(j.AxesColorRed),s.name==="XZ"&&o.color.set(j.AxesColorGreen)}),t.addEventListener("mouseDown",()=>{var s,o;this._controller.enabled=!1,S.implementsInterface(t.object,"isMovable")&&((o=(s=t.object).onMoveStart)==null||o.call(s))}),t.addEventListener("objectChange",()=>{var s,o;if(S.implementsInterface(t.object,"isMovable")){if((o=(s=t.object).onMove)==null||o.call(s),this._scaleLinked&&t.object){const a=t.object.scale,n=(a.x+a.y+a.z)/3;t.object.scale.set(n,n,n)}switch(this.dispatchEvent({type:"object-change",object:t.object}),t.mode){case"translate":this.dispatchEvent({type:"object-position-change",object:t.object});break;case"rotate":this.dispatchEvent({type:"object-rotation-change",object:t.object});break;case"scale":this.dispatchEvent({type:"object-scale-change",object:t.object});break}}}),t.addEventListener("mouseUp",()=>{var s,o;this._controller.enabled=!0,S.implementsInterface(t.object,"isMovable")&&((o=(s=t.object).onMoveEnd)==null||o.call(s))}),t}}const zt=.001;class dt{constructor(e){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=e,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(e){var t;e.pointerPrimaryDown&&(this._draggable=S.findInterface((t=e.intersects[0])==null?void 0:t.object,"isDraggable")||null)}onPointerMove(e){if(e.pointerPrimaryDown&&this._draggable&&(this._raycaster.setFromCamera(e.pointer,this._controller.object),this._dragging||e.lastPointerDown.distanceTo(e.pointer)>zt&&this.startDrag(e),this._dragging))return this.updateDrag(e),!0}onPointerUp(e){this._dragging&&(this._raycaster.setFromCamera(e.pointer,this._controller.object),this.endDrag()),this._draggable=null}setDragRaycastTargets(e){this._dragRaycastTargets=e}startDrag(e){var s,o;const t=this.getDragIntersect(e);t&&(this._dragStart.copy(t.point),this._dragCurrent.copy(t.point),this._dragEnd.copy(t.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(e){var s,o;const t=this.getDragIntersect(e);t&&(this._dragCurrent.copy(t.point),this._dragEnd.copy(t.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 t,s;const e=this.createDragEvent();(s=(t=this._draggable)==null?void 0:t.onDragEnd)==null||s.call(t,e),this._dragging=!1,this._controller.enabled=!0,this.resetDragState()}getDragIntersect(e){return this._dragRaycastTargets?this._raycaster.intersectObjects(this._dragRaycastTargets,!0)[0]||null:e.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 jt=.001;class Gt{constructor(e,t){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=e,this._controller=t,this._canvas=t.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(e,t,this._selectionState)],["drag",new dt(t)]]),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(e){var s;const t=this._tools.get(e);t&&(this._activeTools.has(e)||(this._activeTools.set(e,t),this.updateSortedTools(),(s=t.onActivate)==null||s.call(t)))}disableTool(e){var s;const t=this._activeTools.get(e);t&&((s=t.onDeactivate)==null||s.call(t),this._activeTools.delete(e),this.updateSortedTools())}isToolEnabled(e){return this._activeTools.has(e)}getTool(e){return this._tools.get(e)}getActiveTools(){return[...this._sortedActiveTools]}dispose(){var e;for(const t of this._activeTools.values())(e=t.onDeactivate)==null||e.call(t);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(e){var s;this.updatePointer(e);const t=this.createPointerContext(e);for(const o of this._sortedActiveTools)if((s=o.onPointerMove)==null?void 0:s.call(o,t))break}onPointerDown(e){var s;this.updatePointerState(e,!0),this.updatePointer(e),this._lastPointerDown.copy(this._pointer);const t=this.createPointerContext(e);for(const o of this._sortedActiveTools)if((s=o.onPointerDown)==null?void 0:s.call(o,t))break}onPointerUp(e){var o,a;this.updatePointer(e);const t=this.createPointerContext(e),s=!this.pointerWasDragged();for(const n of this._sortedActiveTools)if((o=n.onPointerUp)==null?void 0:o.call(n,t))break;if(s){for(const n of this._sortedActiveTools)if((a=n.onClick)==null?void 0:a.call(n,t))break}this.updatePointerState(e,!1)}onWheel(e){var s;const t=this.createWheelContext(e);for(const o of this._sortedActiveTools)if((s=o.onWheel)==null?void 0:s.call(o,t))break}createPointerContext(e){const t=this.raycast();return{event:e,pointer:this._pointer.clone(),intersects:t,modelIntersects:this.filterIntersectsByLayer(t,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(t,M.UI_LAYER_MASK),pointerPrimaryDown:this._pointerPrimaryDown,pointerMiddleDown:this._pointerMiddleDown,pointerSecondaryDown:this._pointerSecondaryDown,lastPointerDown:this._lastPointerDown.clone()}}createWheelContext(e){const t=this.raycast();return{event:e,pointer:this._pointer.clone(),intersects:t,modelIntersects:this.filterIntersectsByLayer(t,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(t,M.UI_LAYER_MASK)}}updatePointer(e){this._pointer.x=e.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(e.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object)}updatePointerState(e,t){switch(e.button){case 0:this._pointerPrimaryDown=t;break;case 1:this._pointerMiddleDown=t;break;case 2:this._pointerSecondaryDown=t;break}}raycast(){this._raycaster.layers.mask=M.PRODUCT_LAYER_MASK|M.UI_LAYER_MASK;const e=this._scene.children.filter(t=>t.visible&&"isMesh"in t&&t.isMesh);return this._raycaster.intersectObjects(e,!0)}filterIntersectsByLayer(e,t){return e.filter(s=>(s.object.layers.mask&t)!==0)}updateSortedTools(){this._sortedActiveTools=[...this._activeTools.values()].sort((e,t)=>e.priority-t.priority)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>jt}useTool(e){const t=["hover","select","transform","drag"];for(const s of t)(s===e||e==="select")&&this.enableTool(s)}getActiveTool(){return this._sortedActiveTools[0]||null}}class Rt{constructor(e,t){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=t.domElement,this._scene=e,this._controller=t,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(e){var t;switch(e.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: "+e.button)}this._lastPointerDown.copy(this._pointer),this._draggable=S.findInterface((t=this._intersects[0])==null?void 0:t.object,"isDraggable")||null}onDragStart(e){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(e){var s;this._pointer.x=e.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(e.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const t=S.findInterface((s=this._intersects[0])==null?void 0:s.object,"isHoverable");if(this._intersects[0]&&t){if(!this._hovered){t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}if(this._hovered.uuid!==t.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}t.onPointerOver&&t.onPointerOver(this._intersects[0]),this._hovered=t}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(e),this.onDrag(e))}onDrag(e){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const t=this._intersects[0];t&&(this._dragCurrent.copy(t.point.clone()),this._dragEnd.copy(t.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(e){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(e):this.onClick(e),e.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(e){}onDragEnd(e){const t=this._intersects[0];t&&(this._dragEnd.copy(t.point.clone()),this._dragCurrent.copy(t.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(e){}raycast(e){const s=(e||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=Rt;exports.DIVESelectTool=$;exports.DIVETransformTool=J;exports.DragTool=dt;exports.HoverTool=ct;exports.SelectTool=$;exports.SelectionState=lt;exports.Toolbox=Gt;exports.TransformTool=J;exports.isSelectTool=St;exports.isTransformTool=Lt;
1
+ "use strict";var vt=Object.defineProperty;var Mt=(h,e,t)=>e in h?vt(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t;var r=(h,e,t)=>Mt(h,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three");require("../../chunks/FileTypes-BZhCMKod.cjs");const M=require("../../chunks/PerspectiveCamera-iAsZqrnY.cjs"),S=require("../../chunks/findInterface-C6mrvf_t.cjs"),j=require("../../chunks/AxisHelperColors-BrGqktN5.cjs");class lt{constructor(){r(this,"_selected",null);r(this,"_listeners",new Set)}get selected(){return this._selected}select(e){var t,s,o;this._selected!==e&&(this._selected&&((s=(t=this._selected).onDeselect)==null||s.call(t)),this._selected=e,(o=e.onSelect)==null||o.call(e),this.notifyListeners())}deselect(){var e,t;this._selected&&((t=(e=this._selected).onDeselect)==null||t.call(e),this._selected=null,this.notifyListeners())}onChange(e){this._listeners.add(e)}offChange(e){this._listeners.delete(e)}dispose(){this._selected=null,this._listeners.clear()}notifyListeners(){for(const e of this._listeners)e(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 e,t;this._hovered&&((t=(e=this._hovered).onPointerLeave)==null||t.call(e),this._hovered=null)}onPointerMove(e){var o,a,n,l,_,w,P;const t=e.modelIntersects[0],s=S.findInterface(t==null?void 0:t.object,"isHoverable");if(t&&s){if(!this._hovered){(o=s.onPointerEnter)==null||o.call(s,t),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,t),this._hovered=s;return}(_=s.onPointerOver)==null||_.call(s,t);return}this._hovered&&((P=(w=this._hovered).onPointerLeave)==null||P.call(w),this._hovered=null)}}const St=h=>h.name==="select";class ${constructor(e){r(this,"name","select");r(this,"priority",30);r(this,"_selectionState");this._selectionState=e}get selected(){return this._selectionState.selected}onActivate(){}onDeactivate(){}onClick(e){const t=e.modelIntersects[0],s=S.findInterface(t==null?void 0:t.object,"isSelectable");if(!t||!s){this._selectionState.deselect();return}const o=this._selectionState.selected;o&&o.uuid===s.uuid||this._selectionState.select(s)}select(e){this._selectionState.select(e)}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(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,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",e),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,G=new i.Vector3,R=new i.Quaternion,tt=new i.Vector3,X=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",G),n("cameraQuaternion",R),n("pointStart",tt),n("pointEnd",X),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(e){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(e)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&A.setFromCamera(e,this.camera);const t=K(this._gizmo.picker[this.mode],A);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&A.setFromCamera(e,this.camera);const t=K(this._plane,A,!0);t&&(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(t.point).sub(this.worldPositionStart)),this.dragging=!0,st.mode=this.mode,this.dispatchEvent(st)}}pointerMove(e){const t=this.axis,s=this.mode,o=this.object;let a=this.space;if(s==="scale"?a="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(a="world"),o===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&A.setFromCamera(e,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"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&t!=="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()),t.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),t.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)),t.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),t.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(t.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),t.search("X")===-1&&(T.x=1),t.search("Y")===-1&&(T.y=1),t.search("Z")===-1&&(T.z=1);o.scale.copy(this._scaleStart).multiply(T),this.scaleSnap&&(t.search("X")!==-1&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.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;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(it[t]),p.copy(it[t]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?_=!0:this.rotationAngle=this._offset.dot(p.normalize())*l),(t==="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"&&t!=="E"&&t!=="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(e){e!==null&&e.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(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,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(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Dt(h){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:h.button};{const e=this.domElement.getBoundingClientRect();return{x:(h.clientX-e.left)/e.width*2-1,y:-(h.clientY-e.top)/e.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,e,t){const s=e.intersectObject(h,!0);for(let o=0;o<s.length;o++)if(s[o].object.visible||t)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,H=new i.Vector3(1,0,0),C=new i.Vector3(0,1,0),O=new i.Vector3(0,0,1),U=new i.Vector3,Y=new i.Vector3,Q=new i.Vector3;class At extends i.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const o=t.clone();o.opacity=.5;const a=e.clone();a.color.setHex(16711680);const n=e.clone();n.color.setHex(65280);const l=e.clone();l.color.setHex(255);const _=e.clone();_.color.setHex(16711680),_.opacity=.5;const w=e.clone();w.color.setHex(65280),w.opacity=.5;const P=e.clone();P.color.setHex(255),P.opacity=.5;const G=e.clone();G.opacity=.25;const R=e.clone();R.color.setHex(16776960),R.opacity=.25,e.clone().color.setHex(16776960);const X=e.clone();X.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(m,k){const y=new i.TorusGeometry(m,.0075,3,64,k*Math.PI*2);return y.rotateY(Math.PI/2),y.rotateX(Math.PI/2),y}function L(){const m=new i.BufferGeometry;return m.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),m}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),G.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),X),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),R),null,[0,Math.PI/2,0]]]},gt={AXIS:[[new i.Line(b,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={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),G.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(m){const k=new i.Object3D;for(const y in m)for(let z=m[y].length;z--;){const g=m[y][z][0].clone(),V=m[y][z][1],Z=m[y][z][2],W=m[y][z][3],bt=m[y][z][4];g.name=y,g.tag=bt,V&&g.position.set(V[0],V[1],V[2]),Z&&g.rotation.set(Z[0],Z[1],Z[2]),W&&g.scale.set(W[0],W[1],W[2]),g.updateMatrix();const et=g.geometry.clone();et.applyMatrix4(g.matrix),g.geometry=et,g.renderOrder=1/0,g.position.set(0,0,0),g.rotation.set(0,0,0),g.scale.set(1,1,1),k.add(g)}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(mt)),this.add(this.picker.scale=x(yt)),this.add(this.helper.translate=x(_t)),this.add(this.helper.rotate=x(gt)),this.add(this.helper.scale=x(wt)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){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(H).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(O).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(H).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(O).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(O).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(H).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(H,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(O,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(e)}}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(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),U.copy(H).applyQuaternion(t==="local"?this.worldQuaternion:F),Y.copy(C).applyQuaternion(t==="local"?this.worldQuaternion:F),Q.copy(O).applyQuaternion(t==="local"?this.worldQuaternion:F),c.copy(Y),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(Y),v.copy(Y).cross(c);break;case"Z":c.copy(this.eye).cross(Q),v.copy(Q).cross(c);break;case"XY":v.copy(Q);break;case"YZ":v.copy(U);break;case"XZ":c.copy(Q),v.copy(Y);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(e)}}const Lt=h=>h.name==="transform";class J extends i.EventDispatcher{constructor(t,s,o){super();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=s,this._selectionState=o,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(o=>this.isGizmoChild(o.object)))return!0}setGizmoMode(t){this._gizmo.mode=t}setGizmoVisible(t){this._gizmoVisible=t;const s=this._scene.children.includes(this._gizmo);t&&!s?(this._scene.add(this._gizmo),this._gizmo.getRaycaster().layers.enableAll()):!t&&s&&(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 s=t;for(;s;){if(s===this._gizmo)return!0;s=s.parent}return!1}initGizmo(){const t=new Pt(this._controller.object,this._controller.domElement);return t.mode="translate",t.traverse(s=>{if(!("isMesh"in s))return;const o=s.material;s.name==="X"&&o.color.set(j.AxesColorRed),s.name==="Y"&&o.color.set(j.AxesColorGreen),s.name==="Z"&&o.color.set(j.AxesColorBlue),s.name==="XY"&&o.color.set(j.AxesColorBlue),s.name==="YZ"&&o.color.set(j.AxesColorRed),s.name==="XZ"&&o.color.set(j.AxesColorGreen)}),t.addEventListener("mouseDown",()=>{var s,o;this._controller.enabled=!1,S.implementsInterface(t.object,"isMovable")&&((o=(s=t.object).onMoveStart)==null||o.call(s))}),t.addEventListener("objectChange",()=>{var s,o;if(S.implementsInterface(t.object,"isMovable")){if((o=(s=t.object).onMove)==null||o.call(s),this._scaleLinked&&t.object){const a=t.object.scale,n=(a.x+a.y+a.z)/3;t.object.scale.set(n,n,n)}switch(this.dispatchEvent({type:"object-change",object:t.object}),t.mode){case"translate":this.dispatchEvent({type:"object-position-change",object:t.object});break;case"rotate":this.dispatchEvent({type:"object-rotation-change",object:t.object});break;case"scale":this.dispatchEvent({type:"object-scale-change",object:t.object});break}}}),t.addEventListener("mouseUp",()=>{var s,o;this._controller.enabled=!0,S.implementsInterface(t.object,"isMovable")&&((o=(s=t.object).onMoveEnd)==null||o.call(s))}),t}}const zt=.001;class dt{constructor(e){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=e,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(e){var t;e.pointerPrimaryDown&&(this._draggable=S.findInterface((t=e.intersects[0])==null?void 0:t.object,"isDraggable")||null)}onPointerMove(e){if(e.pointerPrimaryDown&&this._draggable&&(this._raycaster.setFromCamera(e.pointer,this._controller.object),this._dragging||e.lastPointerDown.distanceTo(e.pointer)>zt&&this.startDrag(e),this._dragging))return this.updateDrag(e),!0}onPointerUp(e){this._dragging&&(this._raycaster.setFromCamera(e.pointer,this._controller.object),this.endDrag()),this._draggable=null}setDragRaycastTargets(e){this._dragRaycastTargets=e}startDrag(e){var s,o;const t=this.getDragIntersect(e);t&&(this._dragStart.copy(t.point),this._dragCurrent.copy(t.point),this._dragEnd.copy(t.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(e){var s,o;const t=this.getDragIntersect(e);t&&(this._dragCurrent.copy(t.point),this._dragEnd.copy(t.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 t,s;const e=this.createDragEvent();(s=(t=this._draggable)==null?void 0:t.onDragEnd)==null||s.call(t,e),this._dragging=!1,this._controller.enabled=!0,this.resetDragState()}getDragIntersect(e){return this._dragRaycastTargets?this._raycaster.intersectObjects(this._dragRaycastTargets,!0)[0]||null:e.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 jt=.001;class Gt{constructor(e,t){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=e,this._controller=t,this._canvas=t.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(e,t,this._selectionState)],["drag",new dt(t)]]),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(e){var s;const t=this._tools.get(e);t&&(this._activeTools.has(e)||(this._activeTools.set(e,t),this.updateSortedTools(),(s=t.onActivate)==null||s.call(t)))}disableTool(e){var s;const t=this._activeTools.get(e);t&&((s=t.onDeactivate)==null||s.call(t),this._activeTools.delete(e),this.updateSortedTools())}isToolEnabled(e){return this._activeTools.has(e)}getTool(e){return this._tools.get(e)}getActiveTools(){return[...this._sortedActiveTools]}dispose(){var e;for(const t of this._activeTools.values())(e=t.onDeactivate)==null||e.call(t);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(e){var s;this.updatePointer(e);const t=this.createPointerContext(e);for(const o of this._sortedActiveTools)if((s=o.onPointerMove)==null?void 0:s.call(o,t))break}onPointerDown(e){var s;this.updatePointerState(e,!0),this.updatePointer(e),this._lastPointerDown.copy(this._pointer);const t=this.createPointerContext(e);for(const o of this._sortedActiveTools)if((s=o.onPointerDown)==null?void 0:s.call(o,t))break}onPointerUp(e){var o,a;this.updatePointer(e);const t=this.createPointerContext(e),s=!this.pointerWasDragged();for(const n of this._sortedActiveTools)if((o=n.onPointerUp)==null?void 0:o.call(n,t))break;if(s){for(const n of this._sortedActiveTools)if((a=n.onClick)==null?void 0:a.call(n,t))break}this.updatePointerState(e,!1)}onWheel(e){var s;const t=this.createWheelContext(e);for(const o of this._sortedActiveTools)if((s=o.onWheel)==null?void 0:s.call(o,t))break}createPointerContext(e){const t=this.raycast();return{event:e,pointer:this._pointer.clone(),intersects:t,modelIntersects:this.filterIntersectsByLayer(t,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(t,M.UI_LAYER_MASK),pointerPrimaryDown:this._pointerPrimaryDown,pointerMiddleDown:this._pointerMiddleDown,pointerSecondaryDown:this._pointerSecondaryDown,lastPointerDown:this._lastPointerDown.clone()}}createWheelContext(e){const t=this.raycast();return{event:e,pointer:this._pointer.clone(),intersects:t,modelIntersects:this.filterIntersectsByLayer(t,M.PRODUCT_LAYER_MASK),uiIntersects:this.filterIntersectsByLayer(t,M.UI_LAYER_MASK)}}updatePointer(e){this._pointer.x=e.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(e.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object)}updatePointerState(e,t){switch(e.button){case 0:this._pointerPrimaryDown=t;break;case 1:this._pointerMiddleDown=t;break;case 2:this._pointerSecondaryDown=t;break}}raycast(){this._raycaster.layers.mask=M.PRODUCT_LAYER_MASK|M.UI_LAYER_MASK;const e=this._scene.children.filter(t=>t.visible&&"isMesh"in t&&t.isMesh);return this._raycaster.intersectObjects(e,!0)}filterIntersectsByLayer(e,t){return e.filter(s=>(s.object.layers.mask&t)!==0)}updateSortedTools(){this._sortedActiveTools=[...this._activeTools.values()].sort((e,t)=>e.priority-t.priority)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>jt}useTool(e){const t=["hover","select","transform","drag"];for(const s of t)(s===e||e==="select")&&this.enableTool(s)}getActiveTool(){return this._sortedActiveTools[0]||null}}class Rt{constructor(e,t){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=t.domElement,this._scene=e,this._controller=t,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(e){var t;switch(e.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: "+e.button)}this._lastPointerDown.copy(this._pointer),this._draggable=S.findInterface((t=this._intersects[0])==null?void 0:t.object,"isDraggable")||null}onDragStart(e){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(e){var s;this._pointer.x=e.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(e.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const t=S.findInterface((s=this._intersects[0])==null?void 0:s.object,"isHoverable");if(this._intersects[0]&&t){if(!this._hovered){t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}if(this._hovered.uuid!==t.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}t.onPointerOver&&t.onPointerOver(this._intersects[0]),this._hovered=t}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(e),this.onDrag(e))}onDrag(e){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const t=this._intersects[0];t&&(this._dragCurrent.copy(t.point.clone()),this._dragEnd.copy(t.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(e){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(e):this.onClick(e),e.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(e){}onDragEnd(e){const t=this._intersects[0];t&&(this._dragEnd.copy(t.point.clone()),this._dragCurrent.copy(t.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(e){}raycast(e){const s=(e||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=Rt;exports.DIVESelectTool=$;exports.DIVETransformTool=J;exports.DragTool=dt;exports.HoverTool=ct;exports.SelectTool=$;exports.SelectionState=lt;exports.Toolbox=Gt;exports.TransformTool=J;exports.isSelectTool=St;exports.isTransformTool=Lt;
@@ -2,7 +2,7 @@ var Ht = Object.defineProperty;
2
2
  var Xt = (l, e, t) => e in l ? Ht(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
3
  var o = (l, e, t) => Xt(l, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { Object3D as ht, Vector3 as h, Quaternion as E, Raycaster as ot, MeshBasicMaterial as Dt, LineBasicMaterial as kt, 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 Yt, Euler as Qt, Matrix4 as Et, PlaneGeometry as Ot, DoubleSide as Rt, EventDispatcher as Zt, Vector2 as F, Layers as _t } from "three";
5
- import "../../chunks/FileTypes-BE5iKh0W.mjs";
5
+ import "../../chunks/FileTypes-G8UMidQm.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.32",
3
+ "version": "2.2.33",
4
4
  "description": "Shopware Spatial Framework",
5
5
  "type": "module",
6
6
  "main": "build/dive.cjs",