@needle-tools/engine 3.35.0-alpha → 3.35.0-beta

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.
@@ -4341,7 +4341,7 @@ void main() {
4341
4341
  `;s+=g(o);const C=Object.keys(I);let a="";for(let r=0;r<C.length;r++){const B=C[r],Q=I[B];if(Kc.has(Q)){a+="";continue}Kc.set(Q,!0),a+=B+":"+i(Q,o+1),r<C.length-1&&(a+=", "),a.length>=60&&(a+=`
4342
4342
  `,a+=g(o),s+=a,a="")}return s+=a,s+=`
4343
4343
  }`,s}return I}function g(I){let o="";for(let s=0;s<I;s++)o+=" ";return o}}const U9=tA("nodevlogs");function ci(t,A=eo.Log){Ts(A,t)}function Wt(t){ci(t,eo.Warn)}function uL(t){ci(t,eo.Error)}let kM;function he(){return U9?!1:kM!==void 0?kM:YI()}function N9(t){kM=t}const Pr=new qr,AI=new S,on=new S,zt=new UA,pL={X:new S(1,0,0),Y:new S(0,1,0),Z:new S(0,0,1)},MM={type:"change"},DL={type:"mouseDown"},yL={type:"mouseUp",mode:null},wL={type:"objectChange"};class F9 extends pA{constructor(A,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 i=new RM;this._gizmo=i,this.add(i);const g=new L9;this._plane=g,this.add(g);const I=this;function o(u,p){let D=p;Object.defineProperty(I,u,{get:function(){return D!==void 0?D:p},set:function(m){D!==m&&(D=m,g[u]=m,i[u]=m,I.dispatchEvent({type:u+"-changed",value:m}),I.dispatchEvent(MM))}}),I[u]=p,g[u]=p,i[u]=p}o("camera",A),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const s=new S,C=new S,a=new UA,r=new UA,B=new S,Q=new UA,E=new S,h=new S,d=new S,l=0,c=new S;o("worldPosition",s),o("worldPositionStart",C),o("worldQuaternion",a),o("worldQuaternionStart",r),o("cameraPosition",B),o("cameraQuaternion",Q),o("pointStart",E),o("pointEnd",h),o("rotationAxis",d),o("rotationAngle",l),o("eye",c),this._offset=new S,this._startNorm=new S,this._endNorm=new S,this._cameraScale=new S,this._parentPosition=new S,this._parentQuaternion=new UA,this._parentQuaternionInv=new UA,this._parentScale=new S,this._worldScaleStart=new S,this._worldQuaternionInv=new UA,this._worldScale=new S,this._positionStart=new S,this._quaternionStart=new UA,this._scaleStart=new S,this._getPointer=K9.bind(this),this._onPointerDown=v9.bind(this),this._onPointerHover=J9.bind(this),this._onPointerMove=b9.bind(this),this._onPointerUp=q9.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){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(this)}pointerHover(A){if(this.object===void 0||this.dragging===!0)return;A!==null&&Pr.setFromCamera(A,this.camera);const e=GM(this._gizmo.picker[this.mode],Pr);e?this.axis=e.object.name:this.axis=null}pointerDown(A){if(!(this.object===void 0||this.dragging===!0||A!=null&&A.button!==0)&&this.axis!==null){A!==null&&Pr.setFromCamera(A,this.camera);const e=GM(this._plane,Pr,!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,DL.mode=this.mode,this.dispatchEvent(DL)}}pointerMove(A){const e=this.axis,i=this.mode,g=this.object;let I=this.space;if(i==="scale"?I="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(I="world"),g===void 0||e===null||this.dragging===!1||A!==null&&A.button!==-1)return;A!==null&&Pr.setFromCamera(A,this.camera);const o=GM(this._plane,Pr,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),I==="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),I==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),g.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(I==="local"&&(g.position.applyQuaternion(zt.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(g.position.x=Math.round(g.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(g.position.y=Math.round(g.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(g.position.z=Math.round(g.position.z/this.translationSnap)*this.translationSnap),g.position.applyQuaternion(this._quaternionStart)),I==="world"&&(g.parent&&g.position.add(AI.setFromMatrixPosition(g.parent.matrixWorld)),e.search("X")!==-1&&(g.position.x=Math.round(g.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(g.position.y=Math.round(g.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(g.position.z=Math.round(g.position.z/this.translationSnap)*this.translationSnap),g.parent&&g.position.sub(AI.setFromMatrixPosition(g.parent.matrixWorld))));else if(i==="scale"){if(e.search("XYZ")!==-1){let s=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(s*=-1),on.set(s,s,s)}else AI.copy(this.pointStart),on.copy(this.pointEnd),AI.applyQuaternion(this._worldQuaternionInv),on.applyQuaternion(this._worldQuaternionInv),on.divide(AI),e.search("X")===-1&&(on.x=1),e.search("Y")===-1&&(on.y=1),e.search("Z")===-1&&(on.z=1);g.scale.copy(this._scaleStart).multiply(on),this.scaleSnap&&(e.search("X")!==-1&&(g.scale.x=Math.round(g.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(g.scale.y=Math.round(g.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(g.scale.z=Math.round(g.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const s=20/this.worldPosition.distanceTo(AI.setFromMatrixPosition(this.camera.matrixWorld));let C=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(AI.copy(this.rotationAxis).cross(this.eye))*s):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(pL[e]),AI.copy(pL[e]),I==="local"&&AI.applyQuaternion(this.worldQuaternion),AI.cross(this.eye),AI.length()===0?C=!0:this.rotationAngle=this._offset.dot(AI.normalize())*s),(e==="E"||C)&&(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),I==="local"&&e!=="E"&&e!=="XYZE"?(g.quaternion.copy(this._quaternionStart),g.quaternion.multiply(zt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),g.quaternion.copy(zt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),g.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(MM),this.dispatchEvent(wL)}}pointerUp(A){A!==null&&A.button!==0||(this.dragging&&this.axis!==null&&(yL.mode=this.mode,this.dispatchEvent(yL)),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(A){A.geometry&&A.geometry.dispose(),A.material&&A.material.dispose()})}attach(A){return this.object=A,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(MM),this.dispatchEvent(wL),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Pr}getMode(){return this.mode}setMode(A){this.mode=A}setTranslationSnap(A){this.translationSnap=A}setRotationSnap(A){this.rotationSnap=A}setScaleSnap(A){this.scaleSnap=A}setSize(A){this.size=A}setSpace(A){this.space=A}}function K9(t){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const A=this.domElement.getBoundingClientRect();return{x:(t.clientX-A.left)/A.width*2-1,y:-(t.clientY-A.top)/A.height*2+1,button:t.button}}}function J9(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t));break}}function v9(t){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function b9(t){this.enabled&&this.pointerMove(this._getPointer(t))}function q9(t){this.enabled&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function GM(t,A,e){const i=A.intersectObject(t,!0);for(let g=0;g<i.length;g++)if(i[g].object.visible||e)return i[g];return!1}const vD=new Ht,Ft=new S(0,1,0),SL=new S(0,0,0),fL=new RA,bD=new UA,qD=new UA,_s=new S,mL=new RA,Jc=new S(1,0,0),jr=new S(0,1,0),vc=new S(0,0,1),LD=new S,bc=new S,qc=new S;class RM extends pA{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const A=new It({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new Si({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=A.clone();i.opacity=.15;const g=e.clone();g.opacity=.5;const I=A.clone();I.color.setHex(16711680);const o=A.clone();o.color.setHex(65280);const s=A.clone();s.color.setHex(255);const C=A.clone();C.color.setHex(16711680),C.opacity=.5;const a=A.clone();a.color.setHex(65280),a.opacity=.5;const r=A.clone();r.color.setHex(255),r.opacity=.5;const B=A.clone();B.opacity=.25;const Q=A.clone();Q.color.setHex(16776960),Q.opacity=.25,A.clone().color.setHex(16776960);const E=A.clone();E.color.setHex(7895160);const h=new Ki(0,.04,.1,12);h.translate(0,.05,0);const d=new qt(.08,.08,.08);d.translate(0,.04,0);const l=new pe;l.setAttribute("position",new Ce([0,0,0,1,0,0],3));const c=new Ki(.0075,.0075,.5,3);c.translate(0,.25,0);function u(v,j){const q=new Ua(v,.0075,3,64,j*Math.PI*2);return q.rotateY(Math.PI/2),q.rotateX(Math.PI/2),q}function p(){const v=new pe;return v.setAttribute("position",new Ce([0,0,0,1,1,1],3)),v}const D={X:[[new uA(h,I),[.5,0,0],[0,0,-Math.PI/2]],[new uA(h,I),[-.5,0,0],[0,0,Math.PI/2]],[new uA(c,I),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new uA(h,o),[0,.5,0]],[new uA(h,o),[0,-.5,0],[Math.PI,0,0]],[new uA(c,o)]],Z:[[new uA(h,s),[0,0,.5],[Math.PI/2,0,0]],[new uA(h,s),[0,0,-.5],[-Math.PI/2,0,0]],[new uA(c,s),null,[Math.PI/2,0,0]]],XYZ:[[new uA(new Ra(.1,0),B.clone()),[0,0,0]]],XY:[[new uA(new qt(.15,.15,.01),r.clone()),[.15,.15,0]]],YZ:[[new uA(new qt(.15,.15,.01),C.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.15,.15,.01),a.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},m={X:[[new uA(new Ki(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new uA(new Ki(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new uA(new Ki(.2,0,.6,4),i),[0,.3,0]],[new uA(new Ki(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new uA(new Ki(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new uA(new Ki(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new uA(new Ra(.2,0),i)]],XY:[[new uA(new qt(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new uA(new qt(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},G={START:[[new uA(new Ra(.01,2),g),null,null,null,"helper"]],END:[[new uA(new Ra(.01,2),g),null,null,null,"helper"]],DELTA:[[new fi(p(),g),null,null,null,"helper"]],X:[[new fi(l,g.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new fi(l,g.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new fi(l,g.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},k={XYZE:[[new uA(u(.5,1),E),null,[0,Math.PI/2,0]]],X:[[new uA(u(.5,.5),I)]],Y:[[new uA(u(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new uA(u(.5,.5),s),null,[0,Math.PI/2,0]]],E:[[new uA(u(.75,1),Q),null,[0,Math.PI/2,0]]]},M={AXIS:[[new fi(l,g.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},K={XYZE:[[new uA(new Ms(.25,10,8),i)]],X:[[new uA(new Ua(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new uA(new Ua(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new uA(new Ua(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new uA(new Ua(.75,.1,2,24),i)]]},f={X:[[new uA(d,I),[.5,0,0],[0,0,-Math.PI/2]],[new uA(c,I),[0,0,0],[0,0,-Math.PI/2]],[new uA(d,I),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new uA(d,o),[0,.5,0]],[new uA(c,o)],[new uA(d,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new uA(d,s),[0,0,.5],[Math.PI/2,0,0]],[new uA(c,s),[0,0,0],[Math.PI/2,0,0]],[new uA(d,s),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new uA(new qt(.15,.15,.01),r),[.15,.15,0]]],YZ:[[new uA(new qt(.15,.15,.01),C),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.15,.15,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new uA(new qt(.1,.1,.1),B.clone())]]},N={X:[[new uA(new Ki(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new uA(new Ki(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new uA(new Ki(.2,0,.6,4),i),[0,.3,0]],[new uA(new Ki(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new uA(new Ki(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new uA(new Ki(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new uA(new qt(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new uA(new qt(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new uA(new qt(.2,.2,.2),i),[0,0,0]]]},H={X:[[new fi(l,g.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new fi(l,g.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new fi(l,g.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function _(v){const j=new pA;for(const q in v)for(let L=v[q].length;L--;){const Y=v[q][L][0].clone(),$=v[q][L][1],X=v[q][L][2],oA=v[q][L][3],yA=v[q][L][4];Y.name=q,Y.tag=yA,$&&Y.position.set($[0],$[1],$[2]),X&&Y.rotation.set(X[0],X[1],X[2]),oA&&Y.scale.set(oA[0],oA[1],oA[2]),Y.updateMatrix();const KA=Y.geometry.clone();KA.applyMatrix4(Y.matrix),Y.geometry=KA,Y.renderOrder=1/0,Y.position.set(0,0,0),Y.rotation.set(0,0,0),Y.scale.set(1,1,1),j.add(Y)}return j}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=_(D)),this.add(this.gizmo.rotate=_(k)),this.add(this.gizmo.scale=_(f)),this.add(this.picker.translate=_(m)),this.add(this.picker.rotate=_(K)),this.add(this.picker.scale=_(N)),this.add(this.helper.translate=_(G)),this.add(this.helper.rotate=_(M)),this.add(this.helper.scale=_(H)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(A){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:qD;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 i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let g=0;g<i.length;g++){const I=i[g];I.visible=!0,I.rotation.set(0,0,0),I.position.copy(this.worldPosition);let o;if(this.camera.isOrthographicCamera?o=(this.camera.top-this.camera.bottom)/this.camera.zoom:o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),I.scale.set(1,1,1).multiplyScalar(o*this.size/4),I.tag==="helper"){I.visible=!1,I.name==="AXIS"?(I.visible=!!this.axis,this.axis==="X"&&(zt.setFromEuler(vD.set(0,0,0)),I.quaternion.copy(e).multiply(zt),Math.abs(Ft.copy(Jc).applyQuaternion(e).dot(this.eye))>.9&&(I.visible=!1)),this.axis==="Y"&&(zt.setFromEuler(vD.set(0,0,Math.PI/2)),I.quaternion.copy(e).multiply(zt),Math.abs(Ft.copy(jr).applyQuaternion(e).dot(this.eye))>.9&&(I.visible=!1)),this.axis==="Z"&&(zt.setFromEuler(vD.set(0,Math.PI/2,0)),I.quaternion.copy(e).multiply(zt),Math.abs(Ft.copy(vc).applyQuaternion(e).dot(this.eye))>.9&&(I.visible=!1)),this.axis==="XYZE"&&(zt.setFromEuler(vD.set(0,Math.PI/2,0)),Ft.copy(this.rotationAxis),I.quaternion.setFromRotationMatrix(fL.lookAt(SL,Ft,jr)),I.quaternion.multiply(zt),I.visible=this.dragging),this.axis==="E"&&(I.visible=!1)):I.name==="START"?(I.position.copy(this.worldPositionStart),I.visible=this.dragging):I.name==="END"?(I.position.copy(this.worldPosition),I.visible=this.dragging):I.name==="DELTA"?(I.position.copy(this.worldPositionStart),I.quaternion.copy(this.worldQuaternionStart),AI.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),AI.applyQuaternion(this.worldQuaternionStart.clone().invert()),I.scale.copy(AI),I.visible=this.dragging):(I.quaternion.copy(e),this.dragging?I.position.copy(this.worldPositionStart):I.position.copy(this.worldPosition),this.axis&&(I.visible=this.axis.search(I.name)!==-1));continue}I.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(I.name==="X"&&Math.abs(Ft.copy(Jc).applyQuaternion(e).dot(this.eye))>.99&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="Y"&&Math.abs(Ft.copy(jr).applyQuaternion(e).dot(this.eye))>.99&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="Z"&&Math.abs(Ft.copy(vc).applyQuaternion(e).dot(this.eye))>.99&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="XY"&&Math.abs(Ft.copy(vc).applyQuaternion(e).dot(this.eye))<.2&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="YZ"&&Math.abs(Ft.copy(Jc).applyQuaternion(e).dot(this.eye))<.2&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="XZ"&&Math.abs(Ft.copy(jr).applyQuaternion(e).dot(this.eye))<.2&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1)):this.mode==="rotate"&&(bD.copy(e),Ft.copy(this.eye).applyQuaternion(zt.copy(e).invert()),I.name.search("E")!==-1&&I.quaternion.setFromRotationMatrix(fL.lookAt(this.eye,SL,jr)),I.name==="X"&&(zt.setFromAxisAngle(Jc,Math.atan2(-Ft.y,Ft.z)),zt.multiplyQuaternions(bD,zt),I.quaternion.copy(zt)),I.name==="Y"&&(zt.setFromAxisAngle(jr,Math.atan2(Ft.x,Ft.z)),zt.multiplyQuaternions(bD,zt),I.quaternion.copy(zt)),I.name==="Z"&&(zt.setFromAxisAngle(vc,Math.atan2(Ft.y,Ft.x)),zt.multiplyQuaternions(bD,zt),I.quaternion.copy(zt))),I.visible=I.visible&&(I.name.indexOf("X")===-1||this.showX),I.visible=I.visible&&(I.name.indexOf("Y")===-1||this.showY),I.visible=I.visible&&(I.name.indexOf("Z")===-1||this.showZ),I.visible=I.visible&&(I.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),I.material._color=I.material._color||I.material.color.clone(),I.material._opacity=I.material._opacity||I.material.opacity,I.material.color.copy(I.material._color),I.material.opacity=I.material._opacity,this.enabled&&this.axis&&(I.name===this.axis||this.axis.split("").some(function(s){return I.name===s}))&&(I.material.color.setHex(16776960),I.material.opacity=1)}super.updateMatrixWorld(A)}}class L9 extends uA{constructor(){super(new Wi(1e5,1e5,2,2),new It({visible:!1,wireframe:!0,side:Et,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(A){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),LD.copy(Jc).applyQuaternion(e==="local"?this.worldQuaternion:qD),bc.copy(jr).applyQuaternion(e==="local"?this.worldQuaternion:qD),qc.copy(vc).applyQuaternion(e==="local"?this.worldQuaternion:qD),Ft.copy(bc),this.mode){case"translate":case"scale":switch(this.axis){case"X":Ft.copy(this.eye).cross(LD),_s.copy(LD).cross(Ft);break;case"Y":Ft.copy(this.eye).cross(bc),_s.copy(bc).cross(Ft);break;case"Z":Ft.copy(this.eye).cross(qc),_s.copy(qc).cross(Ft);break;case"XY":_s.copy(qc);break;case"YZ":_s.copy(LD);break;case"XZ":Ft.copy(qc),_s.copy(bc);break;case"XYZ":case"E":_s.set(0,0,0);break}break;case"rotate":default:_s.set(0,0,0)}_s.length()===0?this.quaternion.copy(this.cameraQuaternion):(mL.lookAt(AI.set(0,0,0),_s,Ft),this.quaternion.setFromRotationMatrix(mL)),super.updateMatrixWorld(A)}}const x9=tA("debugpatch");function xD(t,A,e,i){const g=x9===A;if(!e&&!i)return;const I=A+"___needle";T9(t,A,e,i);const o=Object.getOwnPropertyDescriptor(t,A),s=t[A];g&&console.log("Patch",t.constructor.name,A,o,s),o?(g&&console.log("Apply patch with existing descriptor",t.constructor.name,A,o),typeof o.value=="function"&&(t[A]=ML(o.value,t,A))):(g&&console.log("Create patch with new property",t.constructor.name,A,o),Object.defineProperty(t,A,{set:function(C){if(typeof C=="function")this[I]=ML(C,t,A);else{const a=this[I];GL(t,A,this,a,C),this[I]=C,RL(t,A,this,a,C)}},get:function(){const C=this[I];return typeof C=="function"&&C[I]?C[I]:C}}))}function Y9(t,A,e){const i=NM(t,A);if(i)for(let g=i.length-1;g>=0;g--){const I=i[g];I.prefix===e&&(I.prefix=null),I.postfix===e&&(I.postfix=null),!I.prefix&&!I.postfix&&i.splice(g,1)}}const kL=Symbol("Needle:Patches:WrappedFunction");function ML(t,A,e){if(t[kL])return t;const i=function(...g){GL(A,e,this,...g);const I=t.apply(this,g);return RL(A,e,this,I,...g),I};return i[kL]=!0,i}const YD="Needle:Patches";function UM(){return globalThis[YD]||(globalThis[YD]=new WeakMap),globalThis[YD]}function NM(t,A){const e=UM().get(t);return e?e.get(A):null}function T9(t,A,e,i){let g=UM().get(t);g||(g=new Map,UM().set(t,g));let I=g.get(A);I||(I=[],g.set(A,I)),I.push({prefix:e,postfix:i})}function GL(t,A,e,...i){var g;if(!e)return;const I=NM(t,A);if(I)for(const o of I)(g=o.prefix)==null||g.call(e,...i)}function RL(t,A,e,i,...g){var I;if(!e)return;const o=NM(t,A);if(o)for(const s of o)(I=s.postfix)==null||I.call(e,i,...g)}const UL=Symbol("gltf-loader-internal-usage-tracker"),H9=tA("debugusers"),TD=class{constructor(t){n(this,"parser"),n(this,"_getDependency"),n(this,"_loadingId"),n(this,"_loadedObjects",new Set),this.parser=t,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(t){return TD._loadingProcesses>0}beforeRoot(){TD._loadingProcesses++;const t=this,A=this._getDependency;return this.parser.getDependency=function(e,i){const g=A.call(this,e,i);return g.then(I=>(I&&(t._loadedObjects.add(I),I[UL]=t._loadingId),I)),g},null}afterRoot(t){TD._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const A of this._loadedObjects)delete A[UL],A instanceof pA&&(A.parent||A instanceof uA&&(H9&&console.warn("> GLTF LOADER: Mesh not used in scene!",A),A.material=null,A.geometry=null));return null}};let FM=TD;n(FM,"_loadingProcesses",0);class NL{constructor(){window.addEventListener("unhandledrejection",A=>{var e;if(A.defaultPrevented)return;const i=(e=A?.reason)==null?void 0:e.path;if(i){const g=i[0];g&&g.tagName==="IMG"&&(console.warn(`Could not load image:
4344
- `+g.src),A.preventDefault())}})}}const HD=tA("trackresources");function FL(){return HD==="dispose"}let Wr=!0;HD===0&&(Wr=!1);function _9(t){Wr=t}function KL(){return Wr}const JL=Symbol("disposable");function KM(t,A){t&&(t[JL]=A,zr&&console.warn("Set disposable",A,t))}const vL=Symbol("disposed");function O9(t){return t[vL]===!0}function Jt(t){var A;if(t){if(t[JL]===!1){zr&&console.warn("Object is marked as not disposable",t);return}if(t[vL]=!0,t instanceof Vg)Jt(t.environment),Jt(t.background),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial);else if(t instanceof Cs)Jt(t.geometry),Jt(t.material),Jt(t.skeleton),Jt(t.bindMatrix),Jt(t.bindMatrixInverse),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof uA)Jt(t.geometry),Jt(t.material),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof pe){zQ(t);for(const e of Object.keys(t.attributes)){const i=t.attributes[e];Jt(i)}}else if(t instanceof ee||t instanceof NI)zr&&console.warn("BufferAttribute dispose not supported",t.count);else if(t instanceof Array)for(const e of t)e instanceof ve&&Jt(e);else if(t instanceof ve){zQ(t);for(const i of Object.keys(t)){const g=t[i];g instanceof Re&&(Jt(g),t[i]=null)}const e=t.uniforms;if(e)for(const i of Object.keys(e)){const g=e[i];g instanceof Re?(Jt(g),e[i]=null):g instanceof SA&&(Jt(g.value),g.value=null)}}else t instanceof Re?(zQ(t),zQ(t.source),((A=t.source)==null?void 0:A.data)instanceof ImageBitmap&&zQ(t.source.data)):t instanceof uh?(zQ(t.boneTexture),t.boneTexture=null):t instanceof sc||!(t instanceof pA)&&zr&&console.warn("Unknown object type",t)}}function zQ(t){t&&((zr||FL()||HD)&&console.warn("\u{1F9E8} FREE",t),t instanceof ImageBitmap?t.close():t instanceof KC?t.data=null:t.dispose())}function bL(t){(t instanceof uA||t instanceof Cs)&&(t.material=null,t.geometry=null)}const P9=new Set;function JM(t,A,e=null,i){if(i||(i=P9,i.clear()),!t)return i;const g=t[Lc];if(g)for(const I of g)i.has(I)||e?.call(null,I)!==!1&&(i.add(I),A&&JM(I,!0,e,i));return i}function j9(t){return t[xc]}const zr=tA("debugresourceusers")||tA("debugmemory"),Lc=Symbol("needle-resource-users"),xc=Symbol("needle-resource-users-count");function cI(t,A){xD(t,A,function(e,i){Wr&&(_D(Lc,this,e,!1),_D(Lc,this,i,!0))})}Wr&&(cI(uA.prototype,"material"),cI(uA.prototype,"geometry"),cI(ve.prototype,"map"),cI(ve.prototype,"bumpMap"),cI(ve.prototype,"alphaMap"),cI(ve.prototype,"normalMap"),cI(ve.prototype,"displacementMap"),cI(ve.prototype,"roughnessMap"),cI(ve.prototype,"metalnessMap"),cI(ve.prototype,"emissiveMap"),cI(ve.prototype,"specularMap"),cI(ve.prototype,"envMap"),cI(ve.prototype,"lightMap"),cI(ve.prototype,"aoMap"),cI(ve.prototype,"gradientMap"));function W9(t){if(Wr===!1)return;const A=t[Lc];if(A)for(const e of A)_D(Lc,e,t,!1)}Wr&&xD(ve.prototype,"dispose",function(){W9(this)});let vM=0;function _D(t,A,e,i){if(vM>0)return;if(Array.isArray(e)){for(const I of e)_D(t,A,I,i);return}if(!e)return;let g=e[t];if(g||(g=new Set),i){if(A&&!g.has(A)){g.add(A);let I=e[xc]||0;I+=1,e[xc]=I,zr&&console.warn(`\u{1F7E2} Added user of "${e.type}"`,A,e,I,"users:",g)}}else if(A&&g.has(A)){g.delete(A);let I=e[xc]||0;I>0&&(I-=1,e[xc]=I),zr&&console.warn(`\u{1F534} Removed user of "${e.type}"`,A,e,I,"users:",g),I<=0&&(FM.isLoading(e)||(HD&&console.warn(`\u{1F534} Removed all user of "${e.type}"`,e),FL()&&Jt(e)))}e[t]=g}try{xD(TC.prototype,"render",function(){vM++},function(){vM--})}catch(t){console.warn("Could not wrap WebGLRenderer.render",t)}var Yc=(t=>(t.Added="component-added",t.Removing="removing-component",t))(Yc||{});const qL=tA("debugcomponentevents");class Tc{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let i=this.eventListeners.get(A);i||(i=[]),i.push(e),this.eventListeners.set(A,i),qL&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const i=this.eventListeners.get(A);if(!i)return;const g=i.indexOf(e);g<0||i.splice(g,1)}static dispatchComponentLifecycleEvent(A,e){const i=this.eventListeners.get(A);if(qL&&console.log("Dispatching event "+A,i),!!i)for(const g of i)g(e)}}n(Tc,"eventListeners",new Map);const LL=tA("debugdefines");ZQ('if(!globalThis[""3.35.0-alpha""]) globalThis[""3.35.0-alpha""] = "0.0.0";'),ZQ('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),ZQ('if(!globalThis[""Fri Mar 22 2024 13:27:42 GMT+0100 (Central European Standard Time)""]) globalThis[""Fri Mar 22 2024 13:27:42 GMT+0100 (Central European Standard Time)""] = "unknown";'),ZQ('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.35.0-alpha";'),ZQ('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),ZQ('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Mar 22 2024 13:27:42 GMT+0100 (Central European Standard Time)";');const zC="3.35.0-alpha",OD="undefined",bM="Fri Mar 22 2024 13:27:42 GMT+0100 (Central European Standard Time)";LL&&console.log(`Engine version: ${zC} (generator: ${OD})
4344
+ `+g.src),A.preventDefault())}})}}const HD=tA("trackresources");function FL(){return HD==="dispose"}let Wr=!0;HD===0&&(Wr=!1);function _9(t){Wr=t}function KL(){return Wr}const JL=Symbol("disposable");function KM(t,A){t&&(t[JL]=A,zr&&console.warn("Set disposable",A,t))}const vL=Symbol("disposed");function O9(t){return t[vL]===!0}function Jt(t){var A;if(t){if(t[JL]===!1){zr&&console.warn("Object is marked as not disposable",t);return}if(t[vL]=!0,t instanceof Vg)Jt(t.environment),Jt(t.background),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial);else if(t instanceof Cs)Jt(t.geometry),Jt(t.material),Jt(t.skeleton),Jt(t.bindMatrix),Jt(t.bindMatrixInverse),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof uA)Jt(t.geometry),Jt(t.material),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof pe){zQ(t);for(const e of Object.keys(t.attributes)){const i=t.attributes[e];Jt(i)}}else if(t instanceof ee||t instanceof NI)zr&&console.warn("BufferAttribute dispose not supported",t.count);else if(t instanceof Array)for(const e of t)e instanceof ve&&Jt(e);else if(t instanceof ve){zQ(t);for(const i of Object.keys(t)){const g=t[i];g instanceof Re&&(Jt(g),t[i]=null)}const e=t.uniforms;if(e)for(const i of Object.keys(e)){const g=e[i];g instanceof Re?(Jt(g),e[i]=null):g instanceof SA&&(Jt(g.value),g.value=null)}}else t instanceof Re?(zQ(t),zQ(t.source),((A=t.source)==null?void 0:A.data)instanceof ImageBitmap&&zQ(t.source.data)):t instanceof uh?(zQ(t.boneTexture),t.boneTexture=null):t instanceof sc||!(t instanceof pA)&&zr&&console.warn("Unknown object type",t)}}function zQ(t){t&&((zr||FL()||HD)&&console.warn("\u{1F9E8} FREE",t),t instanceof ImageBitmap?t.close():t instanceof KC?t.data=null:t.dispose())}function bL(t){(t instanceof uA||t instanceof Cs)&&(t.material=null,t.geometry=null)}const P9=new Set;function JM(t,A,e=null,i){if(i||(i=P9,i.clear()),!t)return i;const g=t[Lc];if(g)for(const I of g)i.has(I)||e?.call(null,I)!==!1&&(i.add(I),A&&JM(I,!0,e,i));return i}function j9(t){return t[xc]}const zr=tA("debugresourceusers")||tA("debugmemory"),Lc=Symbol("needle-resource-users"),xc=Symbol("needle-resource-users-count");function cI(t,A){xD(t,A,function(e,i){Wr&&(_D(Lc,this,e,!1),_D(Lc,this,i,!0))})}Wr&&(cI(uA.prototype,"material"),cI(uA.prototype,"geometry"),cI(ve.prototype,"map"),cI(ve.prototype,"bumpMap"),cI(ve.prototype,"alphaMap"),cI(ve.prototype,"normalMap"),cI(ve.prototype,"displacementMap"),cI(ve.prototype,"roughnessMap"),cI(ve.prototype,"metalnessMap"),cI(ve.prototype,"emissiveMap"),cI(ve.prototype,"specularMap"),cI(ve.prototype,"envMap"),cI(ve.prototype,"lightMap"),cI(ve.prototype,"aoMap"),cI(ve.prototype,"gradientMap"));function W9(t){if(Wr===!1)return;const A=t[Lc];if(A)for(const e of A)_D(Lc,e,t,!1)}Wr&&xD(ve.prototype,"dispose",function(){W9(this)});let vM=0;function _D(t,A,e,i){if(vM>0)return;if(Array.isArray(e)){for(const I of e)_D(t,A,I,i);return}if(!e)return;let g=e[t];if(g||(g=new Set),i){if(A&&!g.has(A)){g.add(A);let I=e[xc]||0;I+=1,e[xc]=I,zr&&console.warn(`\u{1F7E2} Added user of "${e.type}"`,A,e,I,"users:",g)}}else if(A&&g.has(A)){g.delete(A);let I=e[xc]||0;I>0&&(I-=1,e[xc]=I),zr&&console.warn(`\u{1F534} Removed user of "${e.type}"`,A,e,I,"users:",g),I<=0&&(FM.isLoading(e)||(HD&&console.warn(`\u{1F534} Removed all user of "${e.type}"`,e),FL()&&Jt(e)))}e[t]=g}try{xD(TC.prototype,"render",function(){vM++},function(){vM--})}catch(t){console.warn("Could not wrap WebGLRenderer.render",t)}var Yc=(t=>(t.Added="component-added",t.Removing="removing-component",t))(Yc||{});const qL=tA("debugcomponentevents");class Tc{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let i=this.eventListeners.get(A);i||(i=[]),i.push(e),this.eventListeners.set(A,i),qL&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const i=this.eventListeners.get(A);if(!i)return;const g=i.indexOf(e);g<0||i.splice(g,1)}static dispatchComponentLifecycleEvent(A,e){const i=this.eventListeners.get(A);if(qL&&console.log("Dispatching event "+A,i),!!i)for(const g of i)g(e)}}n(Tc,"eventListeners",new Map);const LL=tA("debugdefines");ZQ('if(!globalThis[""3.35.0-beta""]) globalThis[""3.35.0-beta""] = "0.0.0";'),ZQ('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),ZQ('if(!globalThis[""Mon Mar 25 2024 15:03:06 GMT+0100 (Central European Standard Time)""]) globalThis[""Mon Mar 25 2024 15:03:06 GMT+0100 (Central European Standard Time)""] = "unknown";'),ZQ('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.35.0-beta";'),ZQ('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),ZQ('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Mar 25 2024 15:03:06 GMT+0100 (Central European Standard Time)";');const zC="3.35.0-beta",OD="undefined",bM="Mon Mar 25 2024 15:03:06 GMT+0100 (Central European Standard Time)";LL&&console.log(`Engine version: ${zC} (generator: ${OD})
4345
4345
  Project built at ${bM}`);const ZC="needle_isActiveInHierarchy",Zr="builtin_components",Hc="needle_editor_guid";function ZQ(t){try{(0,eval)(t)}catch(A){LL&&console.error(A)}}const _c=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),xL=Symbol("isUsingInstancing"),YL=Symbol("instancingRenderer"),qM=Symbol("instancingAutoUpdateBounds");class Us{static isUsingInstancing(A){return A[xL]===!0}static getRenderer(A){return A[YL]||null}setAutoUpdateBounds(A,e){const i=Us.getRenderer(A);i&&(i[qM]=e)}static markDirty(A,e=!0){if(A&&(this.isUsingInstancing(A)&&(A[_c]=!0,A.matrixWorldNeedsUpdate=!0),e))for(const i of A.children)Us.markDirty(i,!0)}}function Vr(t,A){try{A?t(A):t()}catch(e){return console.error(e),!1}return!0}const LM=tA("debugnewscripts"),z9=tA("debughierarchy"),Zt=[];function Z9(){return Zt.length>0}function PD(t){if(!(t.new_scripts.length<=0)){if(LM&&console.log("Register new components",t.new_scripts.length,[...t.new_scripts],t.alias?"element: "+t.alias:t.hash,t),t.new_scripts_pre_setup_callbacks.length>0){for(const A of t.new_scripts_pre_setup_callbacks)A&&A();t.new_scripts_pre_setup_callbacks.length=0}Zt.length=0,t.new_scripts.length>0&&Zt.push(...t.new_scripts),t.new_scripts.length=0;for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.isComponent!==!0){(he()||LM)&&console.error(`Registered script is not a Needle Engine component.
4346
4346
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4347
4347
  `,e),Zt.splice(A,1),A--;continue}if(e.destroyed)continue;if(!e.gameObject){console.error("MISSING GAMEOBJECT - will ignore",e),Zt.splice(A,1),A--;continue}e.context=t,Oc(e.gameObject),xM(e,t)}catch(e){console.error(e),VC(Zt[A],t),Zt.splice(A,1),A--}for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.destroyed){VC(Zt[A],t),Zt.splice(A,1),A--;continue}if(e.registering)try{e.registering()}catch(i){console.error(i)}e.__internalAwake!==void 0&&(e.gameObject||console.error("MISSING GAMEOBJECT",e,e.gameObject),Oc(e.gameObject),e.activeAndEnabled&&Vr(e.__internalAwake.bind(e)))}catch(e){console.error(e),VC(Zt[A],t),Zt.splice(A,1),A--}for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.destroyed||e.enabled===!1||(Oc(e.gameObject),e.activeAndEnabled===!1))continue;e.__internalEnable!==void 0&&(e.enabled=!0,Vr(e.__internalEnable.bind(e)))}catch(e){console.error(e),VC(Zt[A],t),Zt.splice(A,1),A--}for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.destroyed||!e.gameObject)continue;t.new_script_start.push(e)}catch(e){console.error(e),VC(Zt[A],t),Zt.splice(A,1),A--}Zt.length=0;for(const A of t.new_scripts_post_setup_callbacks)A&&A();t.new_scripts_post_setup_callbacks.length=0}}function V9(t){t&&(t.__internalDisable(!0),VC(t,t.context))}function TL(t,A){for(let e=0;e<t.new_script_start.length;e++)try{const i=t.new_script_start[e];if(A!==void 0&&i.gameObject!==A||i.destroyed||i.activeAndEnabled===!1)continue;Vr(i.__internalAwake.bind(i)),i.enabled&&(Vr(i.__internalEnable.bind(i)),Vr(i.__internalStart.bind(i)),t.new_script_start.splice(e,1),e--)}catch(i){console.error(i),VC(t.new_script_start[e],t),t.new_script_start.splice(e,1),e--}}function xM(t,A){A.scripts.indexOf(t)===-1&&(A.scripts.push(t),t.earlyUpdate&&A.scripts_earlyUpdate.push(t),t.update&&A.scripts_update.push(t),t.lateUpdate&&A.scripts_lateUpdate.push(t),t.onBeforeRender&&A.scripts_onBeforeRender.push(t),t.onAfterRender&&A.scripts_onAfterRender.push(t),t.onPausedChanged&&A.scripts_pausedChanged.push(t),YM(t,null)&&A.new_scripts_xr.push(t),YM(t,"immersive-vr")&&A.scripts_immersive_vr.push(t),YM(t,"immersive-ar")&&A.scripts_immersive_ar.push(t))}function VC(t,A){Fo(t,A.new_scripts),Fo(t,A.new_script_start),Fo(t,A.scripts),Fo(t,A.scripts_earlyUpdate),Fo(t,A.scripts_update),Fo(t,A.scripts_lateUpdate),Fo(t,A.scripts_onBeforeRender),Fo(t,A.scripts_onAfterRender),Fo(t,A.scripts_pausedChanged),Fo(t,A.new_scripts_xr),Fo(t,A.scripts_immersive_vr),Fo(t,A.scripts_immersive_ar),A.stopAllCoroutinesFrom(t)}function Fo(t,A){const e=A.indexOf(t);e>=0&&A.splice(e,1)}function YM(t,A){var e;if(t){const i=t;if(i.onBeforeXR||i.onEnterXR||i.onUpdateXR||i.onLeaveXR||i.onXRControllerAdded||i.onXRControllerRemoved)return!(A!=null&&((e=i.supportsXR)==null?void 0:e.call(i,A))===!1)}return!1}function jD(t){if(t||(t=at.Current.scene),!t){console.trace("Invalid call - no current context.");return}const A=CE(t);HL(t,A,!0)||(LM||he()?console.error(`Error updating hierarchy