@epigraph/solutions 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4201,7 +4201,7 @@ vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
4201
4201
  * https://github.com/yomotsu/camera-controls
4202
4202
  * (c) 2017 @yomotsu
4203
4203
  * Released under the MIT License.
4204
- */const ii={LEFT:1,RIGHT:2,MIDDLE:4},_e=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Io={NONE:0,IN:1,OUT:-1};function fa(o){return o.isPerspectiveCamera}function Cr(o){return o.isOrthographicCamera}const xr=Math.PI*2,Mv=Math.PI/2,xC=1e-5,xc=Math.PI/180;function ss(o,e,t){return Math.max(e,Math.min(t,o))}function Qt(o,e=xC){return Math.abs(o)<e}function Ot(o,e,t=xC){return Qt(o-e,t)}function Rv(o,e){return Math.round(o/e)*e}function Sc(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Cc(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function Qu(o,e,t,i,a=1/0,l){i=Math.max(1e-4,i);const h=2/i,d=h*l,p=1/(1+d+.48*d*d+.235*d*d*d);let m=o-e;const A=e,_=a*i;m=ss(m,-_,_),e=o-m;const b=(t.value+h*m)*l;t.value=(t.value-h*b)*p;let w=e+(m+b)*p;return A-o>0==w>A&&(w=A,t.value=(w-A)/l),w}function Bv(o,e,t,i,a=1/0,l,h){i=Math.max(1e-4,i);const d=2/i,p=d*l,m=1/(1+p+.48*p*p+.235*p*p*p);let A=e.x,_=e.y,b=e.z,w=o.x-A,E=o.y-_,C=o.z-b;const T=A,x=_,P=b,M=a*i,R=M*M,D=w*w+E*E+C*C;if(D>R){const V=Math.sqrt(D);w=w/V*M,E=E/V*M,C=C/V*M}A=o.x-w,_=o.y-E,b=o.z-C;const G=(t.x+d*w)*l,U=(t.y+d*E)*l,H=(t.z+d*C)*l;t.x=(t.x-d*G)*m,t.y=(t.y-d*U)*m,t.z=(t.z-d*H)*m,h.x=A+(w+G)*m,h.y=_+(E+U)*m,h.z=b+(C+H)*m;const k=T-o.x,$=x-o.y,Q=P-o.z,Z=h.x-T,X=h.y-x,s=h.z-P;return k*Z+$*X+Q*s>0&&(h.x=T,h.y=x,h.z=P,t.x=(h.x-T)/l,t.y=(h.y-x)/l,t.z=(h.z-P)/l),h}function Em(o,e){e.set(0,0),o.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=o.length,e.y/=o.length}function xm(o,e){return Cr(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class sF{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const a=this._listeners[e];if(a!==void 0){const l=a.indexOf(t);l!==-1&&a.splice(l,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const a=i.slice(0);for(let l=0,h=a.length;l<h;l++)a[l].call(this,e)}}}var Sm;const rF="3.1.0",qu=1/8,aF=/Mac/.test((Sm=globalThis?.navigator)===null||Sm===void 0?void 0:Sm.platform);let rt,Pv,ju,Cm,_n,ht,Rt,Mo,Tc,As,_s,pa,Lv,Dv,Cn,Ro,Bo,Nv,Tm,Ov,Im,Mm,Wu;class Ua extends sF{static install(e){rt=e.THREE,Pv=Object.freeze(new rt.Vector3(0,0,0)),ju=Object.freeze(new rt.Vector3(0,1,0)),Cm=Object.freeze(new rt.Vector3(0,0,1)),_n=new rt.Vector2,ht=new rt.Vector3,Rt=new rt.Vector3,Mo=new rt.Vector3,Tc=new rt.Vector3,As=new rt.Vector3,_s=new rt.Vector3,pa=new rt.Vector3,Lv=new rt.Vector3,Dv=new rt.Vector3,Cn=new rt.Spherical,Ro=new rt.Spherical,Bo=new rt.Box3,Nv=new rt.Box3,Tm=new rt.Sphere,Ov=new rt.Quaternion,Im=new rt.Quaternion,Mm=new rt.Matrix4,Wu=new rt.Raycaster}static get ACTION(){return _e}set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=_e.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Io.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new rt.Vector3,this._focalOffsetVelocity=new rt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(x,P,M,R)=>{let D,G;if(fa(this._camera)){const U=ht.copy(this._camera.position).sub(this._target),H=this._camera.getEffectiveFOV()*xc,k=U.length()*Math.tan(H*.5);D=this.truckSpeed*x*k/this._elementRect.height,G=this.truckSpeed*P*k/this._elementRect.height}else if(Cr(this._camera)){const U=this._camera;D=this.truckSpeed*x*(U.right-U.left)/U.zoom/this._elementRect.width,G=this.truckSpeed*P*(U.top-U.bottom)/U.zoom/this._elementRect.height}else return;R?(M?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(D,0,!0),this.forward(-G,!0)):M?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y+G,this._focalOffsetEnd.z,!0):this.truck(D,G,!0)},this._rotateInternal=(x,P)=>{const M=xr*this.azimuthRotateSpeed*x/this._elementRect.height,R=xr*this.polarRotateSpeed*P/this._elementRect.height;this.rotate(M,R,!0)},this._dollyInternal=(x,P,M)=>{const R=Math.pow(.95,-x*this.dollySpeed),D=this._sphericalEnd.radius,G=this._sphericalEnd.radius*R,U=ss(G,this.minDistance,this.maxDistance),H=U-G;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(G,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(H,!0),this._dollyToNoClamp(U,!0)):this._dollyToNoClamp(U,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?G:U)-D,this._dollyControlCoord.set(P,M)),this._lastDollyDirection=Math.sign(-x)},this._zoomInternal=(x,P,M)=>{const R=Math.pow(.95,x*this.dollySpeed),D=this._zoom,G=this._zoom*R;this.zoomTo(G,!0),this.dollyToCursor&&(this._changedZoom+=G-D,this._dollyControlCoord.set(P,M))},typeof rt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new rt.Quaternion().setFromUnitVectors(this._camera.up,ju),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=_e.NONE,this._target=new rt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new rt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new rt.Spherical().setFromVector3(ht.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new rt.Vector3,new rt.Vector3,new rt.Vector3,new rt.Vector3],this._updateNearPlaneCorners(),this._boundary=new rt.Box3(new rt.Vector3(-1/0,-1/0,-1/0),new rt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new rt.Vector2,this.mouseButtons={left:_e.ROTATE,middle:_e.DOLLY,right:_e.TRUCK,wheel:fa(this._camera)?_e.DOLLY:Cr(this._camera)?_e.ZOOM:_e.NONE},this.touches={one:_e.TOUCH_ROTATE,two:fa(this._camera)?_e.TOUCH_DOLLY_TRUCK:Cr(this._camera)?_e.TOUCH_ZOOM_TRUCK:_e.NONE,three:_e.TOUCH_TRUCK};const i=new rt.Vector2,a=new rt.Vector2,l=new rt.Vector2,h=x=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),D=x.clientX/R.width,G=x.clientY/R.height;if(D<this._interactiveArea.left||D>this._interactiveArea.right||G<this._interactiveArea.top||G>this._interactiveArea.bottom)return}const P=x.pointerType!=="mouse"?null:(x.buttons&ii.LEFT)===ii.LEFT?ii.LEFT:(x.buttons&ii.MIDDLE)===ii.MIDDLE?ii.MIDDLE:(x.buttons&ii.RIGHT)===ii.RIGHT?ii.RIGHT:null;if(P!==null){const R=this._findPointerByMouseButton(P);R&&this._disposePointer(R)}if((x.buttons&ii.LEFT)===ii.LEFT&&this._lockedPointer)return;const M={pointerId:x.pointerId,clientX:x.clientX,clientY:x.clientY,deltaX:0,deltaY:0,mouseButton:P};this._activePointers.push(M),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),this._isDragging=!0,b(x)},d=x=>{x.cancelable&&x.preventDefault();const P=x.pointerId,M=this._lockedPointer||this._findPointerById(P);if(M){if(M.clientX=x.clientX,M.clientY=x.clientY,M.deltaX=x.movementX,M.deltaY=x.movementY,this._state=0,x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(x.buttons&ii.LEFT)===ii.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(x.buttons&ii.MIDDLE)===ii.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(x.buttons&ii.RIGHT)===ii.RIGHT&&(this._state=this._state|this.mouseButtons.right);w()}},p=x=>{const P=this._findPointerById(x.pointerId);if(!(P&&P===this._lockedPointer)){if(P&&this._disposePointer(P),x.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=_e.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=_e.NONE;E()}};let m=-1;const A=x=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===_e.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const G=this._domElement.getBoundingClientRect(),U=x.clientX/G.width,H=x.clientY/G.height;if(U<this._interactiveArea.left||U>this._interactiveArea.right||H<this._interactiveArea.top||H>this._interactiveArea.bottom)return}if(x.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===_e.ROTATE||this.mouseButtons.wheel===_e.TRUCK){const G=performance.now();m-G<1e3&&this._getClientRect(this._elementRect),m=G}const P=aF?-1:-3,M=x.deltaMode===1||x.ctrlKey?x.deltaY/P:x.deltaY/(P*10),R=this.dollyToCursor?(x.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(x.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case _e.ROTATE:{this._rotateInternal(x.deltaX,x.deltaY),this._isUserControllingRotate=!0;break}case _e.TRUCK:{this._truckInternal(x.deltaX,x.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case _e.SCREEN_PAN:{this._truckInternal(x.deltaX,x.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case _e.OFFSET:{this._truckInternal(x.deltaX,x.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case _e.DOLLY:{this._dollyInternal(-M,R,D),this._isUserControllingDolly=!0;break}case _e.ZOOM:{this._zoomInternal(-M,R,D),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},_=x=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ua.ACTION.NONE){const P=x instanceof PointerEvent?x.pointerId:0,M=this._findPointerById(P);M&&this._disposePointer(M),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p);return}x.preventDefault()}},b=x=>{if(!this._enabled)return;if(Em(this._activePointers,_n),this._getClientRect(this._elementRect),i.copy(_n),a.copy(_n),this._activePointers.length>=2){const M=_n.x-this._activePointers[1].clientX,R=_n.y-this._activePointers[1].clientY,D=Math.sqrt(M*M+R*R);l.set(0,D);const G=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,U=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;a.set(G,U)}if(this._state=0,!x)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in x&&x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(x.buttons&ii.LEFT)===ii.LEFT&&(this._state=this._state|this.mouseButtons.left),(x.buttons&ii.MIDDLE)===ii.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(x.buttons&ii.RIGHT)===ii.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&_e.ZOOM)===_e.ZOOM||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},w=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Em(this._activePointers,_n);const P=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,M=P?-P.deltaX:a.x-_n.x,R=P?-P.deltaY:a.y-_n.y;if(a.copy(_n),((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(M,R),this._isUserControllingRotate=!0),(this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.ZOOM)===_e.ZOOM){const D=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,G=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,U=this.dollyDragInverted?-1:1;(this._state&_e.DOLLY)===_e.DOLLY?(this._dollyInternal(U*R*qu,D,G),this._isUserControllingDolly=!0):(this._zoomInternal(U*R*qu,D,G),this._isUserControllingZoom=!0)}if((this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE){const D=_n.x-this._activePointers[1].clientX,G=_n.y-this._activePointers[1].clientY,U=Math.sqrt(D*D+G*G),H=l.y-U;l.set(0,U);const k=this.dollyToCursor?(a.x-this._elementRect.x)/this._elementRect.width*2-1:0,$=this.dollyToCursor?(a.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET?(this._dollyInternal(H*qu,k,$),this._isUserControllingDolly=!0):(this._zoomInternal(H*qu,k,$),this._isUserControllingZoom=!0)}((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(M,R,!1,!1),this._isUserControllingTruck=!0),((this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(M,R,!1,!0),this._isUserControllingTruck=!0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(M,R,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},E=()=>{Em(this._activePointers,_n),a.copy(_n),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),b())},this.unlockPointer=()=>{var x,P,M;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(x=this._domElement)===null||x===void 0||x.ownerDocument.exitPointerLock(),(P=this._domElement)===null||P===void 0||P.ownerDocument.removeEventListener("pointerlockchange",C),(M=this._domElement)===null||M===void 0||M.ownerDocument.removeEventListener("pointerlockerror",T),this.cancel()};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=x=>{this._domElement=x,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",h),this._domElement.addEventListener("pointercancel",p),this._domElement.addEventListener("wheel",A,{passive:!1}),this._domElement.addEventListener("contextmenu",_)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",h),this._domElement.removeEventListener("pointercancel",p),this._domElement.removeEventListener("wheel",A,{passive:!1}),this._domElement.removeEventListener("contextmenu",_),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==_e.NONE&&(this._state=_e.NONE,this._activePointers.length=0,E())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ss(e.width,0,1),this._interactiveArea.height=ss(e.height,0,1),this._interactiveArea.x=ss(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ss(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const a=ss(e,this.minAzimuthAngle,this.maxAzimuthAngle),l=ss(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=a,this._sphericalEnd.phi=l,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const h=!i||Ot(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ot(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(h)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0,this._dollyToNoClamp(ss(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const h=this._collisionTest(),d=Ot(h,this._spherical.radius);if(!(i>e)&&d)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,h)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const l=!t||Ot(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(l)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Tc).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ss(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||Ot(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),As.multiplyScalar(e),_s.multiplyScalar(-t);const a=ht.copy(As).add(_s),l=Rt.copy(this._targetEnd).add(a);return this.moveTo(l.x,l.y,l.z,i)}forward(e,t=!1){ht.setFromMatrixColumn(this._camera.matrix,0),ht.crossVectors(this._camera.up,ht),ht.multiplyScalar(e);const i=Rt.copy(this._targetEnd).add(ht);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ht.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ht.x,this._targetEnd.y+ht.y,this._targetEnd.z+ht.z,t)}moveTo(e,t,i,a=!1){this._isUserControllingTruck=!1;const l=ht.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,l,this.boundaryFriction),this._needsUpdate=!0,a||this._target.copy(this._targetEnd);const h=!a||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(h)}lookInDirectionOf(e,t,i,a=!1){const d=ht.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(d.x,d.y,d.z,a)}fitToBox(e,t,{cover:i=!1,paddingLeft:a=0,paddingRight:l=0,paddingBottom:h=0,paddingTop:d=0}={}){const p=[],m=e.isBox3?Bo.copy(e):Bo.setFromObject(e);m.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const A=Rv(this._sphericalEnd.theta,Mv),_=Rv(this._sphericalEnd.phi,Mv);p.push(this.rotateTo(A,_,t));const b=ht.setFromSpherical(this._sphericalEnd).normalize(),w=Ov.setFromUnitVectors(b,Cm),E=Ot(Math.abs(b.y),1);E&&w.multiply(Im.setFromAxisAngle(ju,A)),w.multiply(this._yAxisUpSpaceInverse);const C=Nv.makeEmpty();Rt.copy(m.min).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setX(m.max.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setY(m.max.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setZ(m.min.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setZ(m.max.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setY(m.min.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setX(m.min.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).applyQuaternion(w),C.expandByPoint(Rt),C.min.x-=a,C.min.y-=h,C.max.x+=l,C.max.y+=d,w.setFromUnitVectors(Cm,b),E&&w.premultiply(Im.invert()),w.premultiply(this._yAxisUpSpace);const T=C.getSize(ht),x=C.getCenter(Rt).applyQuaternion(w);if(fa(this._camera)){const P=this.getDistanceToFitBox(T.x,T.y,T.z,i);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.dollyTo(P,t)),p.push(this.setFocalOffset(0,0,0,t))}else if(Cr(this._camera)){const P=this._camera,M=P.right-P.left,R=P.top-P.bottom,D=i?Math.max(M/T.x,R/T.y):Math.min(M/T.x,R/T.y);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.zoomTo(D,t)),p.push(this.setFocalOffset(0,0,0,t))}return Promise.all(p)}fitToSphere(e,t){const i=[],l="isObject3D"in e?Ua.createBoundingSphere(e,Tm):Tm.copy(e);if(i.push(this.moveTo(l.center.x,l.center.y,l.center.z,t)),fa(this._camera)){const h=this.getDistanceToFitSphere(l.radius);i.push(this.dollyTo(h,t))}else if(Cr(this._camera)){const h=this._camera.right-this._camera.left,d=this._camera.top-this._camera.bottom,p=2*l.radius,m=Math.min(h/p,d/p);i.push(this.zoomTo(m,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,a,l,h,d=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const p=Rt.set(a,l,h),m=ht.set(e,t,i);this._targetEnd.copy(p),this._sphericalEnd.setFromVector3(m.sub(p).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,d||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!d||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold)&&Ot(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ot(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Ot(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerp(e,t,i,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const l=ht.set(...e.target);if("spherical"in e)Cn.set(...e.spherical);else{const _=Rt.set(...e.position);Cn.setFromVector3(_.sub(l).applyQuaternion(this._yAxisUpSpace))}const h=Mo.set(...t.target);if("spherical"in t)Ro.set(...t.spherical);else{const _=Rt.set(...t.position);Ro.setFromVector3(_.sub(h).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(l.lerp(h,i));const d=Ro.theta-Cn.theta,p=Ro.phi-Cn.phi,m=Ro.radius-Cn.radius;this._sphericalEnd.set(Cn.radius+m*i,Cn.phi+p*i,Cn.theta+d*i),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!a||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold)&&Ot(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ot(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Ot(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerpLookAt(e,t,i,a,l,h,d,p,m,A,_,b,w,E=!1){return this.lerp({position:[e,t,i],target:[a,l,h]},{position:[d,p,m],target:[A,_,b]},w,E)}setPosition(e,t,i,a=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,a)}setTarget(e,t,i,a=!1){const l=this.getPosition(ht),h=this.setLookAt(l.x,l.y,l.z,e,t,i,a);return this._sphericalEnd.phi=ss(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),h}setFocalOffset(e,t,i,a=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,a||this._focalOffset.copy(this._focalOffsetEnd);const l=!a||Ot(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Ot(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Ot(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(l)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),As.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_s.setFromMatrixColumn(this._camera.matrixWorldInverse,1),pa.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const a=ht.set(e,t,i),l=a.distanceTo(this._camera.position),h=a.sub(this._camera.position);As.multiplyScalar(h.x),_s.multiplyScalar(h.y),pa.multiplyScalar(h.z),ht.copy(As).add(_s).add(pa),ht.z=ht.z+l,this.dollyTo(l,!1),this.setFocalOffset(-ht.x,ht.y,-ht.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,a){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new rt.Vector4,typeof e=="number"?this._viewport.set(e,t,i,a):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,a=!1){if(xm(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const l=e/t,h=this._camera.getEffectiveFOV()*xc,d=this._camera.aspect;return((a?l>d:l<d)?t:e/d)*.5/Math.tan(h*.5)+i*.5}getDistanceToFitSphere(e){if(xm(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*xc,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,a=1<this._camera.aspect?t:i;return e/Math.sin(a*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new rt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%xr+xr)%xr,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=xr),this._spherical.theta+=xr*Math.round((this._sphericalEnd.theta-this._spherical.theta)/xr),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!Ot(this._camera.up.x,this._cameraUp0.x)||!Ot(this._camera.up.y,this._cameraUp0.y)||!Ot(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,ju),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ht.subVectors(this._target,this._camera.position).normalize(),t=Rt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,a=this._sphericalEnd.radius-this._spherical.radius,l=Lv.subVectors(this._targetEnd,this._target),h=Dv.subVectors(this._focalOffsetEnd,this._focalOffset),d=this._zoomEnd-this._zoom;if(Qt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Qu(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Qu(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(a))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const _=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Qu(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,_,this.maxSpeed,e),this._needsUpdate=!0}if(Qt(l.x)&&Qt(l.y)&&Qt(l.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const _=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Bv(this._target,this._targetEnd,this._targetVelocity,_,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Qt(h.x)&&Qt(h.y)&&Qt(h.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const _=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Bv(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,_,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Qt(d))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const _=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Qu(this._zoom,this._zoomEnd,this._zoomVelocity,_,1/0,e)}if(this.dollyToCursor){if(fa(this._camera)&&this._changedDolly!==0){const _=this._spherical.radius-this._lastDistance,b=this._camera,w=this._getCameraDirection(Tc),E=ht.copy(w).cross(b.up).normalize();E.lengthSq()===0&&(E.x=1);const C=Rt.crossVectors(E,w),T=this._sphericalEnd.radius*Math.tan(b.getEffectiveFOV()*xc*.5),P=(this._sphericalEnd.radius-_-this._sphericalEnd.radius)/this._sphericalEnd.radius,M=Mo.copy(this._targetEnd).add(E.multiplyScalar(this._dollyControlCoord.x*T*b.aspect)).add(C.multiplyScalar(this._dollyControlCoord.y*T)),R=ht.copy(this._targetEnd).lerp(M,P),D=this._lastDollyDirection===Io.IN&&this._spherical.radius<=this.minDistance,G=this._lastDollyDirection===Io.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(D||G)){this._sphericalEnd.radius-=_,this._spherical.radius-=_;const H=Rt.copy(w).multiplyScalar(-_);R.add(H)}this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedDolly-=_,Qt(this._changedDolly)&&(this._changedDolly=0)}else if(Cr(this._camera)&&this._changedZoom!==0){const _=this._zoom-this._lastZoom,b=this._camera,w=ht.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(b.near+b.far)/(b.near-b.far)).unproject(b),E=Rt.set(0,0,-1).applyQuaternion(b.quaternion),C=Mo.copy(w).add(E.multiplyScalar(-w.dot(b.up))),x=-(this._zoom-_-this._zoom)/this._zoom,P=this._getCameraDirection(Tc),M=this._targetEnd.dot(P),R=ht.copy(this._targetEnd).lerp(C,x),D=R.dot(P),G=P.multiplyScalar(D-M);R.sub(G),this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedZoom-=_,Qt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const p=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,p),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Qt(this._focalOffset.x)||!Qt(this._focalOffset.y)||!Qt(this._focalOffset.z))&&(As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),pa.setFromMatrixColumn(this._camera.matrix,2),As.multiplyScalar(this._focalOffset.x),_s.multiplyScalar(-this._focalOffset.y),pa.multiplyScalar(this._focalOffset.z),ht.copy(As).add(_s).add(pa),this._camera.position.add(ht),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ht.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const A=this._needsUpdate;return A&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):A?(this.dispatchEvent({type:"update"}),Qt(t,this.restThreshold)&&Qt(i,this.restThreshold)&&Qt(a,this.restThreshold)&&Qt(l.x,this.restThreshold)&&Qt(l.y,this.restThreshold)&&Qt(l.z,this.restThreshold)&&Qt(h.x,this.restThreshold)&&Qt(h.y,this.restThreshold)&&Qt(h.z,this.restThreshold)&&Qt(d,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!A&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=A,this._needsUpdate=!1,A}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Sc(this.maxDistance),minZoom:this.minZoom,maxZoom:Sc(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Sc(this.maxPolarAngle),minAzimuthAngle:Sc(this.minAzimuthAngle),maxAzimuthAngle:Sc(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:ht.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Cc(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Cc(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Cc(i.maxPolarAngle),this.minAzimuthAngle=Cc(i.minAzimuthAngle),this.maxAzimuthAngle=Cc(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Cn.setFromVector3(ht.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Cn.theta,Cn.phi,t),this.dollyTo(Cn.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",rF),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const a=t.lengthSq();if(a===0)return e;const l=Rt.copy(t).add(e),d=this._boundary.clampPoint(l,Mo).sub(l),p=d.lengthSq();if(p===0)return e.add(t);if(p===a)return e;if(i===0)return e.add(t).add(d);{const m=1+i*p/t.dot(d);return e.add(Rt.copy(t).multiplyScalar(m)).add(d.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(fa(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*xc,a=Math.tan(i*.5)*t,l=a*e.aspect;this._nearPlaneCorners[0].set(-l,-a,0),this._nearPlaneCorners[1].set(l,-a,0),this._nearPlaneCorners[2].set(l,a,0),this._nearPlaneCorners[3].set(-l,a,0)}else if(Cr(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,a=e.right*t,l=e.top*t,h=e.bottom*t;this._nearPlaneCorners[0].set(i,l,0),this._nearPlaneCorners[1].set(a,l,0),this._nearPlaneCorners[2].set(a,h,0),this._nearPlaneCorners[3].set(i,h,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||xm(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Tc);Mm.lookAt(Pv,i,this._camera.up);for(let a=0;a<4;a++){const l=Rt.copy(this._nearPlaneCorners[a]);l.applyMatrix4(Mm);const h=Mo.addVectors(this._target,l);Wu.set(h,i),Wu.far=this._spherical.radius+1;const d=Wu.intersectObjects(this.colliderMeshes);d.length!==0&&d[0].distance<e&&(e=d[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new rt.Sphere){const i=t,a=i.center;Bo.makeEmpty(),e.traverseVisible(h=>{h.isMesh&&Bo.expandByObject(h)}),Bo.getCenter(a);let l=0;return e.traverseVisible(h=>{if(!h.isMesh)return;const d=h;if(!d.geometry)return;const p=d.geometry.clone();p.applyMatrix4(d.matrixWorld);const A=p.attributes.position;for(let _=0,b=A.count;_<b;_++)ht.fromBufferAttribute(A,_),l=Math.max(l,a.distanceToSquared(ht))}),i.radius=Math.sqrt(l),i}}class vf{constructor(e){this.__position=new se,this.__target=new se,this.setPosition(e.position.x,e.position.y,e.position.z),this.setTarget(e.target.x,e.target.y,e.target.z)}getPosition(){return this.__position}setPosition(e,t,i){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(i)}getTarget(){return this.__target}setTarget(e,t,i){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(i)}}class oF extends vC{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainCameraControls={},this.__screenshotCameraControls={},this.__cameraDirection=new se,this.__cameraSpherical=new hl,this.__savedCameraState={position:new se,target:new se}}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}get screenshotCameraControls(){return this.__screenshotCameraControls}loadConfiguration(e){e.fov&&(this.__cameras.main.fov=e.fov)}getCurrentCameraTransforms(){const e=new se;this.__cameras.main.getWorldPosition(e);const t=new se;return this.__mainCameraControls.getTarget(t),{position:e,target:t}}getCurrentCameraRotation(){return{azimuthAngle:this.__mainCameraControls.azimuthAngle,polarAngle:this.__mainCameraControls.polarAngle,distance:this.__mainCameraControls.distance}}getCameraFocalLength(){return this.__cameras.main.getFocalLength()}setCameraFocalLength(e){this.__cameras.main.setFocalLength(e)}async fitCameraToSceneBounds(e=!0){const t=this._appWcRef.getSceneSphericalBoundsForCameraFocus();return await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(e){const t=this.__mainCameraControls,i=t.currentAction===t.mouseButtons?.right||t.currentAction===t.touches?.two;e.canPan&&i?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):t.currentAction===t.mouseButtons?.left?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"rotate"}):this._appWcRef.eventsManager.cameraControlsStart.fire({type:null})}__onMainCameraControlsControlEnd(){this._appWcRef.eventsManager.inputEnd.fire()}saveCurrentCameraTransforms(){this.__mainCameraControls.getPosition(this.__savedCameraState.position),this.__mainCameraControls.getTarget(this.__savedCameraState.target)}resetCurrentCameraTransformsToLastSavedState(e=!0){const t=new vf({position:{x:this.__savedCameraState.position.x,y:this.__savedCameraState.position.y,z:this.__savedCameraState.position.z},target:{x:this.__savedCameraState.target.x,y:this.__savedCameraState.target.y,z:this.__savedCameraState.target.z}});this.moveCameraToLocation({newCameraTransforms:t,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t}){const i=this._appWcRef.getSceneSphericalBoundsForCameraFocus().radius,a=i<=0?1:i;e&&(this.__mainCameraControls.minDistance=a*e),t&&(this.__mainCameraControls.maxDistance=a*t),this.fitCameraToSceneBounds()}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:-1/0,maxDistance:1/0})}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}normalizeAngle(e){const t=Math.PI*2;return Is.euclideanModulo(e,t)}absoluteAngle(e,t){const i=Math.PI*2,a=e-t;return Is.euclideanModulo(a+Math.PI,i)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:i=!0,targetCameraControlsRef:a=this.__mainCameraControls}){const l=e.getPosition(),h=e.getTarget();a.enabled=!1,this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(l,h),this.__cameraDirection.normalize();const d=l.distanceTo(h);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const p=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(a.azimuthAngle)),m=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(a.polarAngle));a.rotate(p,m,i),a.moveTo(h.x,h.y,h.z,i),a.dollyTo(d,i),t||(a.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:i,transition:a=!0,targetCameraControlsRef:l=this.__mainCameraControls}){e&&l.rotateAzimuthTo(e,a),t&&l.rotatePolarTo(t,a),i&&l.dollyTo(i,a)}async resetCameraToDefault(e){const{canZoom:t,canPan:i,minDistance:a,maxDistance:l,minPolarAngle:h,maxPolarAngle:d,minAzimuthAngle:p,maxAzimuthAngle:m}=e,A=Ua.ACTION;this.__mainCameraControls.mouseButtons.left=A.ROTATE,this.__mainCameraControls.touches.one=A.TOUCH_ROTATE,this.__mainCameraControls.mouseButtons.wheel=t?A.DOLLY:A.NONE,this.__mainCameraControls.touches.two=t?A.TOUCH_DOLLY:A.NONE,this.__mainCameraControls.mouseButtons.middle=A.NONE,this.__mainCameraControls.mouseButtons.right=i?A.TRUCK:A.NONE,this.__mainCameraControls.touches.two=i?A.TOUCH_TRUCK:A.NONE,this.__mainCameraControls.enabled=!0,t&&i&&(this.__mainCameraControls.touches.two=i?A.TOUCH_DOLLY_TRUCK:A.NONE),this.setCameraZoomLimits({minDistance:a??.5,maxDistance:l??5}),this.__mainCameraControls.minPolarAngle=h,this.__mainCameraControls.maxPolarAngle=d,this.__mainCameraControls.minAzimuthAngle=p,this.__mainCameraControls.maxAzimuthAngle=m}async fitCameraToObject({objectToFocus:e,enableTransition:t=!0}){return await this.__mainCameraControls.fitToSphere(e,t)}async wiggleCamera(){const e=this.__mainCameraControls.azimuthAngle,t=[0,.4,-.3,0];for(const i of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+i,!0)}}async setup({mainRenderer:e,screenshotRenderer:t,cameraSettings:i}){const{focalLength:a}=i;this.__cameras={main:new bi(75,window.innerWidth/window.innerHeight,.1,1e3),screenshot:new bi(75,window.innerWidth/window.innerHeight,.1,1e3)},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(100);const l={Vector2:He,Vector3:se,Vector4:Bt,Quaternion:zi,Matrix4:tt,Spherical:hl,Box3:vi,Sphere:vn,Raycaster:l_};Ua.install({THREE:l}),this.__mainCameraControls=new Ua(this.__cameras.main,e.domElement),this.__screenshotCameraControls=new Ua(this.__cameras.screenshot,t.domElement),this.__cameras.main.setFocalLength(a),this.__cameras.main.near=.01,this.__cameras.main.far=1e3,await this.resetCameraToDefault(i),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart(i)}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.appReadyEvent.name,()=>{this.setCameraZoomLimits({minDistance:i.minDistance,maxDistance:i.maxDistance})}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,(h=>{h.detail.saveFirst&&this.saveCurrentCameraTransforms();const{position:d,target:p}=h.detail.cameraTransforms,m=new vf({position:d,target:p});this.moveCameraToLocation({newCameraTransforms:m})})),this._appWcRef.addEventListener(this._appWcRef.eventsManager.hotspotsVisibilityChanged.name,(h=>{const d=this.mainCameraControls,p=h.detail.visible?d.maxDistance+.3:d.maxDistance-.3;d.maxDistance=p}))}}const lF='@font-face{font-family:Helvetica Neue;src:url(https://asset.myepigraph.com/design-assets/fonts/HelveticaNeue/HelveticaNeue-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:PPMori-Regular;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:PPMori-Bold;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Bold.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-BoldItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-ExtraBold.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-ExtraBoldItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Italic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Italic-VariableFont_wght.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Medium.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-MediumItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Regular.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-SemiBold.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-SemiBoldItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-VariableFont_wght.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter-VariableFont_slnt_wght.ttf) format("truetype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter_18pt-Bold.ttf) format("truetype");font-weight:700;font-style:normal;font-display:swap}',cF={Color:{Black:{25:{$type:"color",$value:"rgba(0, 0, 0, 0.0000)"},50:{$type:"color",$value:"rgba(0, 0, 0, 0.0500)"},100:{$type:"color",$value:"rgba(0, 0, 0, 0.1000)"},200:{$type:"color",$value:"rgba(0, 0, 0, 0.2000)"},300:{$type:"color",$value:"rgba(0, 0, 0, 0.3000)"},400:{$type:"color",$value:"rgba(0, 0, 0, 0.4000)"},500:{$type:"color",$value:"rgba(0, 0, 0, 0.5000)"},600:{$type:"color",$value:"rgba(0, 0, 0, 0.6000)"},700:{$type:"color",$value:"rgba(0, 0, 0, 0.7000)"},800:{$type:"color",$value:"rgba(0, 0, 0, 0.8000)"},900:{$type:"color",$value:"rgba(0, 0, 0, 0.9000)"},1e3:{$type:"color",$value:"#000000"}},White:{25:{$type:"color",$value:"rgba(255, 255, 255, 0.0250)"},50:{$type:"color",$value:"rgba(255, 255, 255, 0.0500)"},100:{$type:"color",$value:"rgba(255, 255, 255, 0.1000)"},200:{$type:"color",$value:"rgba(255, 255, 255, 0.2000)"},300:{$type:"color",$value:"rgba(255, 255, 255, 0.3000)"},400:{$type:"color",$value:"rgba(255, 255, 255, 0.4000)"},500:{$type:"color",$value:"rgba(255, 255, 255, 0.5000)"},600:{$type:"color",$value:"rgba(255, 255, 255, 0.6000)"},700:{$type:"color",$value:"rgba(255, 255, 255, 0.7000)"},800:{$type:"color",$value:"rgba(255, 255, 255, 0.8000)"},900:{$type:"color",$value:"rgba(255, 255, 255, 0.9000)"},1e3:{$type:"color",$value:"#ffffff"}},Green:{100:{$type:"color",$value:"#ebffee"},200:{$type:"color",$value:"#cff7d3"},300:{$type:"color",$value:"#aff4c6"},400:{$type:"color",$value:"#85e0a3"},500:{$type:"color",$value:"#14ae5c"},600:{$type:"color",$value:"#009951"},700:{$type:"color",$value:"#008043"},800:{$type:"color",$value:"#02542d"},900:{$type:"color",$value:"#024023"},1e3:{$type:"color",$value:"#062d1b"}},Red:{100:{$type:"color",$value:"#fee9e7"},200:{$type:"color",$value:"#fdd3d0"},300:{$type:"color",$value:"#fcb3ad"},400:{$type:"color",$value:"#f4776a"},500:{$type:"color",$value:"#ec221f"},600:{$type:"color",$value:"#c00f0c"},700:{$type:"color",$value:"#900b09"},800:{$type:"color",$value:"#690807"},900:{$type:"color",$value:"#4d0b0a"},1e3:{$type:"color",$value:"#300603"}},Yellow:{100:{$type:"color",$value:"#fffbeb"},200:{$type:"color",$value:"#fff1c2"},300:{$type:"color",$value:"#ffe8a3"},400:{$type:"color",$value:"#e8b931"},500:{$type:"color",$value:"#e5a000"},600:{$type:"color",$value:"#bf6a02"},700:{$type:"color",$value:"#975102"},800:{$type:"color",$value:"#682d03"},900:{$type:"color",$value:"#522504"},1e3:{$type:"color",$value:"#401b01"}},Blue:{100:{$type:"color",$value:"#fbfdff"},200:{$type:"color",$value:"#eaf4ff"},300:{$type:"color",$value:"#d5ebff"},400:{$type:"color",$value:"#c0e1ff"},500:{$type:"color",$value:"#91d0ff"},600:{$type:"color",$value:"#0094d5"},700:{$type:"color",$value:"#00679b"},800:{$type:"color",$value:"#003a5a"},900:{$type:"color",$value:"#003a5a"},1e3:{$type:"color",$value:"#002133"}},Slate:{100:{$type:"color",$value:"#f5f5f5"},200:{$type:"color",$value:"#e3e3e3"},300:{$type:"color",$value:"#cdcdcd"},400:{$type:"color",$value:"#b2b2b2"},500:{$type:"color",$value:"#949494"},600:{$type:"color",$value:"#767676"},700:{$type:"color",$value:"#5a5a5a"},800:{$type:"color",$value:"#434343"},900:{$type:"color",$value:"#303030"},1e3:{$type:"color",$value:"#242424"}},Grey:{25:{$type:"color",$value:"#f5f5f5"},50:{$type:"color",$value:"#f2f2f2"},100:{$type:"color",$value:"#e6e6e6"},200:{$type:"color",$value:"#cccccc"},300:{$type:"color",$value:"#b3b3b3"},400:{$type:"color",$value:"#999999"},500:{$type:"color",$value:"#7b7b7b"},600:{$type:"color",$value:"#666666"},700:{$type:"color",$value:"#4d4d4d"},800:{$type:"color",$value:"#333333"},900:{$type:"color",$value:"#1a1a1a"},1e3:{$type:"color",$value:"#0d0d0d"}},GreyAlpha:{25:{$type:"color",$value:"rgba(248, 248, 248, 0.8000)"},100:{$type:"color",$value:"rgba(242, 242, 242, 0.8000)"},500:{$type:"color",$value:"rgba(204, 204, 204, 0.2000)"},700:{$type:"color",$value:"rgba(204, 204, 204, 0.6000)"},800:{$type:"color",$value:"rgba(186, 186, 186, 0.6000)"},900:{$type:"color",$value:"rgba(50, 50, 50, 0.9000)"},"05":{$type:"color",$value:"rgba(253, 253, 253, 0.8000)"}}},Unit:{Space:{0:{$type:"number",$value:"0px"},100:{$type:"number",$value:"4px"},150:{$type:"number",$value:"6px"},200:{$type:"number",$value:"8px"},300:{$type:"number",$value:"12px"},400:{$type:"number",$value:"16px"},500:{$type:"number",$value:"20px"},600:{$type:"number",$value:"24px"},800:{$type:"number",$value:"32px"},1e3:{$type:"number",$value:"40px"},1200:{$type:"number",$value:"48px"},1600:{$type:"number",$value:"64px"},2e3:{$type:"number",$value:"80px"},2400:{$type:"number",$value:"96px"},2800:{$type:"number",$value:"112px"},3200:{$type:"number",$value:"128px"},3600:{$type:"number",$value:"144px"},4e3:{$type:"number",$value:"160px"},4400:{$type:"number",$value:"176px"},4800:{$type:"number",$value:"192px"},5200:{$type:"number",$value:"208px"},5600:{$type:"number",$value:"224px"},6e3:{$type:"number",$value:"240px"},6400:{$type:"number",$value:"256px"},7200:{$type:"number",$value:"288px"},8e3:{$type:"number",$value:"320px"},9600:{$type:"number",$value:"384px"},"0125":{$type:"number",$value:"0.5px"},"025":{$type:"number",$value:"1px"},"0325":{$type:"number",$value:"1.5px"},"050":{$type:"number",$value:"2px"}},Stack:{100:{$type:"number",$value:"-4px"},200:{$type:"number",$value:"-8px"},300:{$type:"number",$value:"-12px"},400:{$type:"number",$value:"-16px"},800:{$type:"number",$value:"-32px"},1e3:{$type:"number",$value:"-40px"},1600:{$type:"number",$value:"-64px"},2400:{$type:"number",$value:"-96px"},3200:{$type:"number",$value:"-128px"},4e3:{$type:"number",$value:"-160px"},4800:{$type:"number",$value:"-192px"},5600:{$type:"number",$value:"-224px"},7200:{$type:"number",$value:"-288px"},9600:{$type:"number",$value:"-384px"},"0125":{$type:"number",$value:"-0.5px"},"025":{$type:"number",$value:"-1px"},"0325":{$type:"number",$value:"-1.5px"},"050":{$type:"number",$value:"-2px"},"075":{$type:"number",$value:"-3px"}},Size:{4:{$type:"number",$value:"4px"},6:{$type:"number",$value:"6px"},8:{$type:"number",$value:"8px"},10:{$type:"number",$value:"10px"},12:{$type:"number",$value:"12px"},14:{$type:"number",$value:"14px"},16:{$type:"number",$value:"16px"},18:{$type:"number",$value:"18px"},20:{$type:"number",$value:"20px"},22:{$type:"number",$value:"22px"},24:{$type:"number",$value:"24px"},28:{$type:"number",$value:"28px"},30:{$type:"number",$value:"30px"},32:{$type:"number",$value:"32px"},40:{$type:"number",$value:"40px"},48:{$type:"number",$value:"48px"},64:{$type:"number",$value:"64px"},80:{$type:"number",$value:"80px"},96:{$type:"number",$value:"96px"},112:{$type:"number",$value:"112px"},128:{$type:"number",$value:"128px"},144:{$type:"number",$value:"144px"},160:{$type:"number",$value:"160px"},176:{$type:"number",$value:"176px"},224:{$type:"number",$value:"224px"}},Resolution:{XxsmallScreenMin:{$type:"number",$value:"375px"},XsmallScreenMin:{$type:"number",$value:"480px"},SmallScreenMin:{$type:"number",$value:"576px"},MediumScreenMin:{$type:"number",$value:"768px"},LargeScreenMin:{$type:"number",$value:"992px"},XlargeScreenMin:{$type:"number",$value:"1200px"},XxlargeScreenMin:{$type:"number",$value:"1400px"},XxxsmallScreenMax:{$type:"number",$value:"374px"},XxsmallScreenMax:{$type:"number",$value:"479px"},XsmallScreenMax:{$type:"number",$value:"575px"},SmallScreenMax:{$type:"number",$value:"767px"},MediumScreenMax:{$type:"number",$value:"991px"},LargeScreenMax:{$type:"number",$value:"1199px"},XlargeScreenMax:{$type:"number",$value:"1399px"},XxlargeScreenMax:{$type:"number",$value:"1920px"}}},Font:{Family:{Main:{$type:"string",$value:"PP Mori"},Body:{$type:"string",$value:"Helvetica LT Pro"},Epigraph:{$type:"string",$value:"PP Mori"}}}},SC={Color:{Brand:{Base:{$type:"color",$value:"#335166",$web:"var(--color-brand-base)"},BaseSecondary:{$type:"color",$value:"#2b4354",$web:"var(--color-brand-base-secondary)"},BaseTertiary:{$type:"color",$value:"#202f3a",$web:"var(--color-brand-base-tertiary)"},Accent:{$type:"color",$value:"#4276cf",$web:"var(--color-brand-accent)"},AccentSecondary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-secondary)"},AccentTertiary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-tertiary)"},Light:{$type:"color",$value:"#f8fbf6",$web:"var(--color-brand-light)"},Dark:{$type:"color",$value:"#111b22",$web:"var(--color-brand-dark)"}}},Font:{Brand:{Heading:{$type:"string",$value:"EB Garamond",$web:"var(--font-brand-heading)"},Paragraph:{$type:"string",$value:"Inter",$web:"var(--font-brand-body)"}}},Unit:{Brand:{Radius:{$type:"number",$value:"4px",$web:"var(--unit-brand-radius)"}}}},Se={Color:{Surface:{Plain:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.100}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.50}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.25}"},ShadowSecondary:{$value:"{Primitives.Color.Black.200}"}},Fill:{Accent:{$value:"{BrandPrimitives.Color.Brand.Accent}"},AccentHover:{$value:"{BrandPrimitives.Color.Brand.AccentSecondary}"},AccentPress:{$value:"{BrandPrimitives.Color.Brand.AccentTertiary}"},Base:{$value:"{BrandPrimitives.Color.Brand.Base}"},BaseHover:{$value:"{BrandPrimitives.Color.Brand.BaseSecondary}"},BasePress:{$value:"{BrandPrimitives.Color.Brand.BaseTertiary}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.700}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.300}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.100}"},SubtlePrimary:{$value:"{Primitives.Color.GreyAlpha.100}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.25}"},DangerPrimary:{$value:"{Primitives.Color.Red.600}"},Disabled:{$value:"{Primitives.Color.Grey.200}"},HotspotSecondary:{$value:"{Primitives.Color.GreyAlpha.800}"}},Icon:{NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"}},Text:{Invert:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.700}"},Disabled:{$value:"{Primitives.Color.Grey.300}"}},Border:{AltContrast:{$value:"{BrandPrimitives.Color.Brand.Dark}"},SubtlePrimary:{$value:"{Primitives.Color.Grey.300}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.700}"}}},Size:{Text:{Small:{$value:"{Primitives.Unit.Size.16}"},Medium:{$value:"{Primitives.Unit.Size.18}"},Large:{$value:"{Primitives.Unit.Size.20}"}},Icon:{Small:{$value:"{Primitives.Unit.Size.20}"},Medium:{$value:"{Primitives.Unit.Size.24}"},Large:{$value:"{Primitives.Unit.Size.28}"}},Radius:{Medium:{$value:"{Primitives.Unit.Space.150}"},Full:{$value:"{Primitives.Unit.Space.6000}"}},Stroke:{Regular:{$value:"{Primitives.Unit.Space.025}"},Thick:{$value:"{Primitives.Unit.Space.050}"}},Shadow:{None:{$value:"{Primitives.Unit.Space.0}"},Xsmall:{$value:"{Primitives.Unit.Space.025}"},Small:{$value:"{Primitives.Unit.Space.0325}"}},Blur:{Small:{$value:"{Primitives.Unit.Space.100}"}}},Space:{Padding:{Small:{$value:"{Primitives.Unit.Space.300}"},Medium:{$value:"{Primitives.Unit.Space.400}"},Regular:{$value:"{Primitives.Unit.Space.600}"}},Gap:{Small:{$value:"{Primitives.Unit.Space.200}"},Regular:{$value:"{Primitives.Unit.Space.400}"},Xxlarge:{$value:"{Primitives.Unit.Space.800}"}}},Font:{Family:{CustomH:{$value:"{BrandPrimitives.Font.Brand.Heading}"},CustomP:{$value:"{BrandPrimitives.Font.Brand.Paragraph}"},Main:{$value:"Helvetica Neue"}},Tracking:{Normal:{$value:"{Primitives.Unit.Space.0}"}}}};function be(o){const e=/\{Primitives\.(.*?)}/,t=String(o).match(e),i=/\{BrandPrimitives\.(.*?)}/,a=String(o).match(i);let l=o;if(t){const h=t[1].split(".");l=cF[h[0]][h[1]][h[2]].$value}else if(a){const h=a[1].split("."),d=SC[h[0]][h[1]][h[2]],p=d.$web;l=`${p.substring(0,p.length-1)}, ${d.$value})`}return un(l)}const I_={poweredByEpigraphFooterText:"https://asset.myepigraph.com/design-assets/icons/powered-by-epigraph.svg",splashScreenLogo:"https://asset.myepigraph.com/design-assets/icons/default-splash-screen-image.svg",sampleQrCode:"https://asset.myepigraph.com/design-assets/icons/sample-qr-code.png"};function hF(){const o={};for(const[e,t]of Object.entries(SC))for(const[i,a]of Object.entries(t))for(const[l,h]of Object.entries(a)){const d=`${e}${i}${l}`;o[d]={name:un(h.$web),defaultValue:h.$value,argType:{control:h.$type}}}return o}const uF=hF(),Ll={size:{name:"size",defaultValue:"small",argType:{options:["small","medium","large"],control:"select"}},theme:{name:"theme",defaultValue:"light",argType:{options:["light","dark"],control:"select"}},disabled:{name:"disabled",defaultValue:!1,argType:{control:"boolean"}}};var dF=Object.defineProperty,Kf=(o,e,t,i)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(e,t,a)||a);return a&&dF(e,t,a),a};const Xh=class CC extends ul{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=Ll.theme.defaultValue.toString(),this.size=Ll.size.defaultValue.toString(),CC.ensureFontsAreLoaded()}static{this.styles=[ct`
4204
+ */const ii={LEFT:1,RIGHT:2,MIDDLE:4},_e=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Io={NONE:0,IN:1,OUT:-1};function fa(o){return o.isPerspectiveCamera}function Cr(o){return o.isOrthographicCamera}const xr=Math.PI*2,Mv=Math.PI/2,xC=1e-5,xc=Math.PI/180;function ss(o,e,t){return Math.max(e,Math.min(t,o))}function Qt(o,e=xC){return Math.abs(o)<e}function Ot(o,e,t=xC){return Qt(o-e,t)}function Rv(o,e){return Math.round(o/e)*e}function Sc(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Cc(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function Qu(o,e,t,i,a=1/0,l){i=Math.max(1e-4,i);const h=2/i,d=h*l,p=1/(1+d+.48*d*d+.235*d*d*d);let m=o-e;const A=e,_=a*i;m=ss(m,-_,_),e=o-m;const b=(t.value+h*m)*l;t.value=(t.value-h*b)*p;let w=e+(m+b)*p;return A-o>0==w>A&&(w=A,t.value=(w-A)/l),w}function Bv(o,e,t,i,a=1/0,l,h){i=Math.max(1e-4,i);const d=2/i,p=d*l,m=1/(1+p+.48*p*p+.235*p*p*p);let A=e.x,_=e.y,b=e.z,w=o.x-A,E=o.y-_,C=o.z-b;const T=A,x=_,P=b,M=a*i,R=M*M,D=w*w+E*E+C*C;if(D>R){const V=Math.sqrt(D);w=w/V*M,E=E/V*M,C=C/V*M}A=o.x-w,_=o.y-E,b=o.z-C;const G=(t.x+d*w)*l,U=(t.y+d*E)*l,H=(t.z+d*C)*l;t.x=(t.x-d*G)*m,t.y=(t.y-d*U)*m,t.z=(t.z-d*H)*m,h.x=A+(w+G)*m,h.y=_+(E+U)*m,h.z=b+(C+H)*m;const k=T-o.x,$=x-o.y,Q=P-o.z,Z=h.x-T,X=h.y-x,s=h.z-P;return k*Z+$*X+Q*s>0&&(h.x=T,h.y=x,h.z=P,t.x=(h.x-T)/l,t.y=(h.y-x)/l,t.z=(h.z-P)/l),h}function Em(o,e){e.set(0,0),o.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=o.length,e.y/=o.length}function xm(o,e){return Cr(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class sF{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const a=this._listeners[e];if(a!==void 0){const l=a.indexOf(t);l!==-1&&a.splice(l,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const a=i.slice(0);for(let l=0,h=a.length;l<h;l++)a[l].call(this,e)}}}var Sm;const rF="3.1.0",qu=1/8,aF=/Mac/.test((Sm=globalThis?.navigator)===null||Sm===void 0?void 0:Sm.platform);let rt,Pv,ju,Cm,_n,ht,Rt,Mo,Tc,As,_s,pa,Lv,Dv,Cn,Ro,Bo,Nv,Tm,Ov,Im,Mm,Wu;class Ua extends sF{static install(e){rt=e.THREE,Pv=Object.freeze(new rt.Vector3(0,0,0)),ju=Object.freeze(new rt.Vector3(0,1,0)),Cm=Object.freeze(new rt.Vector3(0,0,1)),_n=new rt.Vector2,ht=new rt.Vector3,Rt=new rt.Vector3,Mo=new rt.Vector3,Tc=new rt.Vector3,As=new rt.Vector3,_s=new rt.Vector3,pa=new rt.Vector3,Lv=new rt.Vector3,Dv=new rt.Vector3,Cn=new rt.Spherical,Ro=new rt.Spherical,Bo=new rt.Box3,Nv=new rt.Box3,Tm=new rt.Sphere,Ov=new rt.Quaternion,Im=new rt.Quaternion,Mm=new rt.Matrix4,Wu=new rt.Raycaster}static get ACTION(){return _e}set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=_e.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Io.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new rt.Vector3,this._focalOffsetVelocity=new rt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(x,P,M,R)=>{let D,G;if(fa(this._camera)){const U=ht.copy(this._camera.position).sub(this._target),H=this._camera.getEffectiveFOV()*xc,k=U.length()*Math.tan(H*.5);D=this.truckSpeed*x*k/this._elementRect.height,G=this.truckSpeed*P*k/this._elementRect.height}else if(Cr(this._camera)){const U=this._camera;D=this.truckSpeed*x*(U.right-U.left)/U.zoom/this._elementRect.width,G=this.truckSpeed*P*(U.top-U.bottom)/U.zoom/this._elementRect.height}else return;R?(M?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(D,0,!0),this.forward(-G,!0)):M?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y+G,this._focalOffsetEnd.z,!0):this.truck(D,G,!0)},this._rotateInternal=(x,P)=>{const M=xr*this.azimuthRotateSpeed*x/this._elementRect.height,R=xr*this.polarRotateSpeed*P/this._elementRect.height;this.rotate(M,R,!0)},this._dollyInternal=(x,P,M)=>{const R=Math.pow(.95,-x*this.dollySpeed),D=this._sphericalEnd.radius,G=this._sphericalEnd.radius*R,U=ss(G,this.minDistance,this.maxDistance),H=U-G;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(G,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(H,!0),this._dollyToNoClamp(U,!0)):this._dollyToNoClamp(U,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?G:U)-D,this._dollyControlCoord.set(P,M)),this._lastDollyDirection=Math.sign(-x)},this._zoomInternal=(x,P,M)=>{const R=Math.pow(.95,x*this.dollySpeed),D=this._zoom,G=this._zoom*R;this.zoomTo(G,!0),this.dollyToCursor&&(this._changedZoom+=G-D,this._dollyControlCoord.set(P,M))},typeof rt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new rt.Quaternion().setFromUnitVectors(this._camera.up,ju),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=_e.NONE,this._target=new rt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new rt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new rt.Spherical().setFromVector3(ht.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new rt.Vector3,new rt.Vector3,new rt.Vector3,new rt.Vector3],this._updateNearPlaneCorners(),this._boundary=new rt.Box3(new rt.Vector3(-1/0,-1/0,-1/0),new rt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new rt.Vector2,this.mouseButtons={left:_e.ROTATE,middle:_e.DOLLY,right:_e.TRUCK,wheel:fa(this._camera)?_e.DOLLY:Cr(this._camera)?_e.ZOOM:_e.NONE},this.touches={one:_e.TOUCH_ROTATE,two:fa(this._camera)?_e.TOUCH_DOLLY_TRUCK:Cr(this._camera)?_e.TOUCH_ZOOM_TRUCK:_e.NONE,three:_e.TOUCH_TRUCK};const i=new rt.Vector2,a=new rt.Vector2,l=new rt.Vector2,h=x=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),D=x.clientX/R.width,G=x.clientY/R.height;if(D<this._interactiveArea.left||D>this._interactiveArea.right||G<this._interactiveArea.top||G>this._interactiveArea.bottom)return}const P=x.pointerType!=="mouse"?null:(x.buttons&ii.LEFT)===ii.LEFT?ii.LEFT:(x.buttons&ii.MIDDLE)===ii.MIDDLE?ii.MIDDLE:(x.buttons&ii.RIGHT)===ii.RIGHT?ii.RIGHT:null;if(P!==null){const R=this._findPointerByMouseButton(P);R&&this._disposePointer(R)}if((x.buttons&ii.LEFT)===ii.LEFT&&this._lockedPointer)return;const M={pointerId:x.pointerId,clientX:x.clientX,clientY:x.clientY,deltaX:0,deltaY:0,mouseButton:P};this._activePointers.push(M),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),this._isDragging=!0,b(x)},d=x=>{x.cancelable&&x.preventDefault();const P=x.pointerId,M=this._lockedPointer||this._findPointerById(P);if(M){if(M.clientX=x.clientX,M.clientY=x.clientY,M.deltaX=x.movementX,M.deltaY=x.movementY,this._state=0,x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(x.buttons&ii.LEFT)===ii.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(x.buttons&ii.MIDDLE)===ii.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(x.buttons&ii.RIGHT)===ii.RIGHT&&(this._state=this._state|this.mouseButtons.right);w()}},p=x=>{const P=this._findPointerById(x.pointerId);if(!(P&&P===this._lockedPointer)){if(P&&this._disposePointer(P),x.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=_e.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=_e.NONE;E()}};let m=-1;const A=x=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===_e.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const G=this._domElement.getBoundingClientRect(),U=x.clientX/G.width,H=x.clientY/G.height;if(U<this._interactiveArea.left||U>this._interactiveArea.right||H<this._interactiveArea.top||H>this._interactiveArea.bottom)return}if(x.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===_e.ROTATE||this.mouseButtons.wheel===_e.TRUCK){const G=performance.now();m-G<1e3&&this._getClientRect(this._elementRect),m=G}const P=aF?-1:-3,M=x.deltaMode===1||x.ctrlKey?x.deltaY/P:x.deltaY/(P*10),R=this.dollyToCursor?(x.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(x.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case _e.ROTATE:{this._rotateInternal(x.deltaX,x.deltaY),this._isUserControllingRotate=!0;break}case _e.TRUCK:{this._truckInternal(x.deltaX,x.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case _e.SCREEN_PAN:{this._truckInternal(x.deltaX,x.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case _e.OFFSET:{this._truckInternal(x.deltaX,x.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case _e.DOLLY:{this._dollyInternal(-M,R,D),this._isUserControllingDolly=!0;break}case _e.ZOOM:{this._zoomInternal(-M,R,D),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},_=x=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ua.ACTION.NONE){const P=x instanceof PointerEvent?x.pointerId:0,M=this._findPointerById(P);M&&this._disposePointer(M),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p);return}x.preventDefault()}},b=x=>{if(!this._enabled)return;if(Em(this._activePointers,_n),this._getClientRect(this._elementRect),i.copy(_n),a.copy(_n),this._activePointers.length>=2){const M=_n.x-this._activePointers[1].clientX,R=_n.y-this._activePointers[1].clientY,D=Math.sqrt(M*M+R*R);l.set(0,D);const G=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,U=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;a.set(G,U)}if(this._state=0,!x)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in x&&x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(x.buttons&ii.LEFT)===ii.LEFT&&(this._state=this._state|this.mouseButtons.left),(x.buttons&ii.MIDDLE)===ii.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(x.buttons&ii.RIGHT)===ii.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&_e.ZOOM)===_e.ZOOM||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},w=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Em(this._activePointers,_n);const P=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,M=P?-P.deltaX:a.x-_n.x,R=P?-P.deltaY:a.y-_n.y;if(a.copy(_n),((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(M,R),this._isUserControllingRotate=!0),(this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.ZOOM)===_e.ZOOM){const D=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,G=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,U=this.dollyDragInverted?-1:1;(this._state&_e.DOLLY)===_e.DOLLY?(this._dollyInternal(U*R*qu,D,G),this._isUserControllingDolly=!0):(this._zoomInternal(U*R*qu,D,G),this._isUserControllingZoom=!0)}if((this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE){const D=_n.x-this._activePointers[1].clientX,G=_n.y-this._activePointers[1].clientY,U=Math.sqrt(D*D+G*G),H=l.y-U;l.set(0,U);const k=this.dollyToCursor?(a.x-this._elementRect.x)/this._elementRect.width*2-1:0,$=this.dollyToCursor?(a.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET?(this._dollyInternal(H*qu,k,$),this._isUserControllingDolly=!0):(this._zoomInternal(H*qu,k,$),this._isUserControllingZoom=!0)}((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(M,R,!1,!1),this._isUserControllingTruck=!0),((this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(M,R,!1,!0),this._isUserControllingTruck=!0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(M,R,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},E=()=>{Em(this._activePointers,_n),a.copy(_n),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),b())},this.unlockPointer=()=>{var x,P,M;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(x=this._domElement)===null||x===void 0||x.ownerDocument.exitPointerLock(),(P=this._domElement)===null||P===void 0||P.ownerDocument.removeEventListener("pointerlockchange",C),(M=this._domElement)===null||M===void 0||M.ownerDocument.removeEventListener("pointerlockerror",T),this.cancel()};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=x=>{this._domElement=x,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",h),this._domElement.addEventListener("pointercancel",p),this._domElement.addEventListener("wheel",A,{passive:!1}),this._domElement.addEventListener("contextmenu",_)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",h),this._domElement.removeEventListener("pointercancel",p),this._domElement.removeEventListener("wheel",A,{passive:!1}),this._domElement.removeEventListener("contextmenu",_),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==_e.NONE&&(this._state=_e.NONE,this._activePointers.length=0,E())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ss(e.width,0,1),this._interactiveArea.height=ss(e.height,0,1),this._interactiveArea.x=ss(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ss(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const a=ss(e,this.minAzimuthAngle,this.maxAzimuthAngle),l=ss(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=a,this._sphericalEnd.phi=l,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const h=!i||Ot(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ot(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(h)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0,this._dollyToNoClamp(ss(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const h=this._collisionTest(),d=Ot(h,this._spherical.radius);if(!(i>e)&&d)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,h)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const l=!t||Ot(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(l)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Tc).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ss(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||Ot(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),As.multiplyScalar(e),_s.multiplyScalar(-t);const a=ht.copy(As).add(_s),l=Rt.copy(this._targetEnd).add(a);return this.moveTo(l.x,l.y,l.z,i)}forward(e,t=!1){ht.setFromMatrixColumn(this._camera.matrix,0),ht.crossVectors(this._camera.up,ht),ht.multiplyScalar(e);const i=Rt.copy(this._targetEnd).add(ht);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ht.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ht.x,this._targetEnd.y+ht.y,this._targetEnd.z+ht.z,t)}moveTo(e,t,i,a=!1){this._isUserControllingTruck=!1;const l=ht.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,l,this.boundaryFriction),this._needsUpdate=!0,a||this._target.copy(this._targetEnd);const h=!a||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(h)}lookInDirectionOf(e,t,i,a=!1){const d=ht.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(d.x,d.y,d.z,a)}fitToBox(e,t,{cover:i=!1,paddingLeft:a=0,paddingRight:l=0,paddingBottom:h=0,paddingTop:d=0}={}){const p=[],m=e.isBox3?Bo.copy(e):Bo.setFromObject(e);m.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const A=Rv(this._sphericalEnd.theta,Mv),_=Rv(this._sphericalEnd.phi,Mv);p.push(this.rotateTo(A,_,t));const b=ht.setFromSpherical(this._sphericalEnd).normalize(),w=Ov.setFromUnitVectors(b,Cm),E=Ot(Math.abs(b.y),1);E&&w.multiply(Im.setFromAxisAngle(ju,A)),w.multiply(this._yAxisUpSpaceInverse);const C=Nv.makeEmpty();Rt.copy(m.min).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setX(m.max.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setY(m.max.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setZ(m.min.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setZ(m.max.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setY(m.min.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setX(m.min.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).applyQuaternion(w),C.expandByPoint(Rt),C.min.x-=a,C.min.y-=h,C.max.x+=l,C.max.y+=d,w.setFromUnitVectors(Cm,b),E&&w.premultiply(Im.invert()),w.premultiply(this._yAxisUpSpace);const T=C.getSize(ht),x=C.getCenter(Rt).applyQuaternion(w);if(fa(this._camera)){const P=this.getDistanceToFitBox(T.x,T.y,T.z,i);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.dollyTo(P,t)),p.push(this.setFocalOffset(0,0,0,t))}else if(Cr(this._camera)){const P=this._camera,M=P.right-P.left,R=P.top-P.bottom,D=i?Math.max(M/T.x,R/T.y):Math.min(M/T.x,R/T.y);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.zoomTo(D,t)),p.push(this.setFocalOffset(0,0,0,t))}return Promise.all(p)}fitToSphere(e,t){const i=[],l="isObject3D"in e?Ua.createBoundingSphere(e,Tm):Tm.copy(e);if(i.push(this.moveTo(l.center.x,l.center.y,l.center.z,t)),fa(this._camera)){const h=this.getDistanceToFitSphere(l.radius);i.push(this.dollyTo(h,t))}else if(Cr(this._camera)){const h=this._camera.right-this._camera.left,d=this._camera.top-this._camera.bottom,p=2*l.radius,m=Math.min(h/p,d/p);i.push(this.zoomTo(m,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,a,l,h,d=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const p=Rt.set(a,l,h),m=ht.set(e,t,i);this._targetEnd.copy(p),this._sphericalEnd.setFromVector3(m.sub(p).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,d||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!d||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold)&&Ot(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ot(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Ot(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerp(e,t,i,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const l=ht.set(...e.target);if("spherical"in e)Cn.set(...e.spherical);else{const _=Rt.set(...e.position);Cn.setFromVector3(_.sub(l).applyQuaternion(this._yAxisUpSpace))}const h=Mo.set(...t.target);if("spherical"in t)Ro.set(...t.spherical);else{const _=Rt.set(...t.position);Ro.setFromVector3(_.sub(h).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(l.lerp(h,i));const d=Ro.theta-Cn.theta,p=Ro.phi-Cn.phi,m=Ro.radius-Cn.radius;this._sphericalEnd.set(Cn.radius+m*i,Cn.phi+p*i,Cn.theta+d*i),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!a||Ot(this._target.x,this._targetEnd.x,this.restThreshold)&&Ot(this._target.y,this._targetEnd.y,this.restThreshold)&&Ot(this._target.z,this._targetEnd.z,this.restThreshold)&&Ot(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ot(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Ot(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerpLookAt(e,t,i,a,l,h,d,p,m,A,_,b,w,E=!1){return this.lerp({position:[e,t,i],target:[a,l,h]},{position:[d,p,m],target:[A,_,b]},w,E)}setPosition(e,t,i,a=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,a)}setTarget(e,t,i,a=!1){const l=this.getPosition(ht),h=this.setLookAt(l.x,l.y,l.z,e,t,i,a);return this._sphericalEnd.phi=ss(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),h}setFocalOffset(e,t,i,a=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,a||this._focalOffset.copy(this._focalOffsetEnd);const l=!a||Ot(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Ot(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Ot(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(l)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),As.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_s.setFromMatrixColumn(this._camera.matrixWorldInverse,1),pa.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const a=ht.set(e,t,i),l=a.distanceTo(this._camera.position),h=a.sub(this._camera.position);As.multiplyScalar(h.x),_s.multiplyScalar(h.y),pa.multiplyScalar(h.z),ht.copy(As).add(_s).add(pa),ht.z=ht.z+l,this.dollyTo(l,!1),this.setFocalOffset(-ht.x,ht.y,-ht.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,a){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new rt.Vector4,typeof e=="number"?this._viewport.set(e,t,i,a):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,a=!1){if(xm(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const l=e/t,h=this._camera.getEffectiveFOV()*xc,d=this._camera.aspect;return((a?l>d:l<d)?t:e/d)*.5/Math.tan(h*.5)+i*.5}getDistanceToFitSphere(e){if(xm(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*xc,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,a=1<this._camera.aspect?t:i;return e/Math.sin(a*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new rt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%xr+xr)%xr,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=xr),this._spherical.theta+=xr*Math.round((this._sphericalEnd.theta-this._spherical.theta)/xr),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!Ot(this._camera.up.x,this._cameraUp0.x)||!Ot(this._camera.up.y,this._cameraUp0.y)||!Ot(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,ju),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ht.subVectors(this._target,this._camera.position).normalize(),t=Rt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,a=this._sphericalEnd.radius-this._spherical.radius,l=Lv.subVectors(this._targetEnd,this._target),h=Dv.subVectors(this._focalOffsetEnd,this._focalOffset),d=this._zoomEnd-this._zoom;if(Qt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Qu(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Qu(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(a))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const _=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Qu(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,_,this.maxSpeed,e),this._needsUpdate=!0}if(Qt(l.x)&&Qt(l.y)&&Qt(l.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const _=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Bv(this._target,this._targetEnd,this._targetVelocity,_,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Qt(h.x)&&Qt(h.y)&&Qt(h.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const _=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Bv(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,_,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Qt(d))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const _=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Qu(this._zoom,this._zoomEnd,this._zoomVelocity,_,1/0,e)}if(this.dollyToCursor){if(fa(this._camera)&&this._changedDolly!==0){const _=this._spherical.radius-this._lastDistance,b=this._camera,w=this._getCameraDirection(Tc),E=ht.copy(w).cross(b.up).normalize();E.lengthSq()===0&&(E.x=1);const C=Rt.crossVectors(E,w),T=this._sphericalEnd.radius*Math.tan(b.getEffectiveFOV()*xc*.5),P=(this._sphericalEnd.radius-_-this._sphericalEnd.radius)/this._sphericalEnd.radius,M=Mo.copy(this._targetEnd).add(E.multiplyScalar(this._dollyControlCoord.x*T*b.aspect)).add(C.multiplyScalar(this._dollyControlCoord.y*T)),R=ht.copy(this._targetEnd).lerp(M,P),D=this._lastDollyDirection===Io.IN&&this._spherical.radius<=this.minDistance,G=this._lastDollyDirection===Io.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(D||G)){this._sphericalEnd.radius-=_,this._spherical.radius-=_;const H=Rt.copy(w).multiplyScalar(-_);R.add(H)}this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedDolly-=_,Qt(this._changedDolly)&&(this._changedDolly=0)}else if(Cr(this._camera)&&this._changedZoom!==0){const _=this._zoom-this._lastZoom,b=this._camera,w=ht.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(b.near+b.far)/(b.near-b.far)).unproject(b),E=Rt.set(0,0,-1).applyQuaternion(b.quaternion),C=Mo.copy(w).add(E.multiplyScalar(-w.dot(b.up))),x=-(this._zoom-_-this._zoom)/this._zoom,P=this._getCameraDirection(Tc),M=this._targetEnd.dot(P),R=ht.copy(this._targetEnd).lerp(C,x),D=R.dot(P),G=P.multiplyScalar(D-M);R.sub(G),this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedZoom-=_,Qt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const p=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,p),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Qt(this._focalOffset.x)||!Qt(this._focalOffset.y)||!Qt(this._focalOffset.z))&&(As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),pa.setFromMatrixColumn(this._camera.matrix,2),As.multiplyScalar(this._focalOffset.x),_s.multiplyScalar(-this._focalOffset.y),pa.multiplyScalar(this._focalOffset.z),ht.copy(As).add(_s).add(pa),this._camera.position.add(ht),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ht.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const A=this._needsUpdate;return A&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):A?(this.dispatchEvent({type:"update"}),Qt(t,this.restThreshold)&&Qt(i,this.restThreshold)&&Qt(a,this.restThreshold)&&Qt(l.x,this.restThreshold)&&Qt(l.y,this.restThreshold)&&Qt(l.z,this.restThreshold)&&Qt(h.x,this.restThreshold)&&Qt(h.y,this.restThreshold)&&Qt(h.z,this.restThreshold)&&Qt(d,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!A&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=A,this._needsUpdate=!1,A}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Sc(this.maxDistance),minZoom:this.minZoom,maxZoom:Sc(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Sc(this.maxPolarAngle),minAzimuthAngle:Sc(this.minAzimuthAngle),maxAzimuthAngle:Sc(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:ht.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Cc(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Cc(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Cc(i.maxPolarAngle),this.minAzimuthAngle=Cc(i.minAzimuthAngle),this.maxAzimuthAngle=Cc(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Cn.setFromVector3(ht.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Cn.theta,Cn.phi,t),this.dollyTo(Cn.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",rF),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const a=t.lengthSq();if(a===0)return e;const l=Rt.copy(t).add(e),d=this._boundary.clampPoint(l,Mo).sub(l),p=d.lengthSq();if(p===0)return e.add(t);if(p===a)return e;if(i===0)return e.add(t).add(d);{const m=1+i*p/t.dot(d);return e.add(Rt.copy(t).multiplyScalar(m)).add(d.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(fa(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*xc,a=Math.tan(i*.5)*t,l=a*e.aspect;this._nearPlaneCorners[0].set(-l,-a,0),this._nearPlaneCorners[1].set(l,-a,0),this._nearPlaneCorners[2].set(l,a,0),this._nearPlaneCorners[3].set(-l,a,0)}else if(Cr(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,a=e.right*t,l=e.top*t,h=e.bottom*t;this._nearPlaneCorners[0].set(i,l,0),this._nearPlaneCorners[1].set(a,l,0),this._nearPlaneCorners[2].set(a,h,0),this._nearPlaneCorners[3].set(i,h,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||xm(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Tc);Mm.lookAt(Pv,i,this._camera.up);for(let a=0;a<4;a++){const l=Rt.copy(this._nearPlaneCorners[a]);l.applyMatrix4(Mm);const h=Mo.addVectors(this._target,l);Wu.set(h,i),Wu.far=this._spherical.radius+1;const d=Wu.intersectObjects(this.colliderMeshes);d.length!==0&&d[0].distance<e&&(e=d[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new rt.Sphere){const i=t,a=i.center;Bo.makeEmpty(),e.traverseVisible(h=>{h.isMesh&&Bo.expandByObject(h)}),Bo.getCenter(a);let l=0;return e.traverseVisible(h=>{if(!h.isMesh)return;const d=h;if(!d.geometry)return;const p=d.geometry.clone();p.applyMatrix4(d.matrixWorld);const A=p.attributes.position;for(let _=0,b=A.count;_<b;_++)ht.fromBufferAttribute(A,_),l=Math.max(l,a.distanceToSquared(ht))}),i.radius=Math.sqrt(l),i}}class vf{constructor(e){this.__position=new se,this.__target=new se,this.setPosition(e.position.x,e.position.y,e.position.z),this.setTarget(e.target.x,e.target.y,e.target.z)}getPosition(){return this.__position}setPosition(e,t,i){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(i)}getTarget(){return this.__target}setTarget(e,t,i){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(i)}}class oF extends vC{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainCameraControls={},this.__screenshotCameraControls={},this.__cameraDirection=new se,this.__cameraSpherical=new hl,this.__savedCameraState={position:new se,target:new se}}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}get screenshotCameraControls(){return this.__screenshotCameraControls}loadConfiguration(e){e.fov&&(this.__cameras.main.fov=e.fov)}getCurrentCameraTransforms(){const e=new se;this.__cameras.main.getWorldPosition(e);const t=new se;return this.__mainCameraControls.getTarget(t),{position:e,target:t}}getCurrentCameraRotation(){return{azimuthAngle:this.__mainCameraControls.azimuthAngle,polarAngle:this.__mainCameraControls.polarAngle,distance:this.__mainCameraControls.distance}}getCameraFocalLength(){return this.__cameras.main.getFocalLength()}setCameraFocalLength(e){this.__cameras.main.setFocalLength(e)}async fitCameraToSceneBounds(e=!0){const t=this._appWcRef.getSceneSphericalBoundsForCameraFocus();return await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(e){const t=this.__mainCameraControls,i=t.currentAction===t.mouseButtons?.right||t.currentAction===t.touches?.two;e.canPan&&i?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):t.currentAction===t.mouseButtons?.left?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"rotate"}):this._appWcRef.eventsManager.cameraControlsStart.fire({type:null})}__onMainCameraControlsControlEnd(){this._appWcRef.eventsManager.inputEnd.fire()}saveCurrentCameraTransforms(){this.__mainCameraControls.getPosition(this.__savedCameraState.position),this.__mainCameraControls.getTarget(this.__savedCameraState.target)}resetCurrentCameraTransformsToLastSavedState(e=!0){const t=new vf({position:{x:this.__savedCameraState.position.x,y:this.__savedCameraState.position.y,z:this.__savedCameraState.position.z},target:{x:this.__savedCameraState.target.x,y:this.__savedCameraState.target.y,z:this.__savedCameraState.target.z}});this.moveCameraToLocation({newCameraTransforms:t,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t,skipCameraFit:i=!1}){const a=this._appWcRef.getSceneSphericalBoundsForCameraFocus().radius,l=a<=0?1:a;e&&(this.__mainCameraControls.minDistance=l*e),t&&(this.__mainCameraControls.maxDistance=l*t),i||this.fitCameraToSceneBounds()}enableCameraZoomLimits(e,t=!1){this.setCameraZoomLimits({minDistance:e.minDistance??.5,maxDistance:e.maxDistance??5,skipCameraFit:t})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:-1/0,maxDistance:1/0})}enableCameraRotationLimits(e){this.__mainCameraControls.minPolarAngle=e.minPolarAngle,this.__mainCameraControls.maxPolarAngle=e.maxPolarAngle,this.__mainCameraControls.minAzimuthAngle=e.minAzimuthAngle,this.__mainCameraControls.maxAzimuthAngle=e.maxAzimuthAngle}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}normalizeAngle(e){const t=Math.PI*2;return Is.euclideanModulo(e,t)}absoluteAngle(e,t){const i=Math.PI*2,a=e-t;return Is.euclideanModulo(a+Math.PI,i)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:i=!0,targetCameraControlsRef:a=this.__mainCameraControls}){const l=e.getPosition(),h=e.getTarget();a.enabled=!1,this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(l,h),this.__cameraDirection.normalize();const d=l.distanceTo(h);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const p=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(a.azimuthAngle)),m=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(a.polarAngle));a.rotate(p,m,i),a.moveTo(h.x,h.y,h.z,i),a.dollyTo(d,i),t||(a.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:i,transition:a=!0,targetCameraControlsRef:l=this.__mainCameraControls}){e&&l.rotateAzimuthTo(e,a),t&&l.rotatePolarTo(t,a),i&&l.dollyTo(i,a)}async resetCameraToDefault(e){const{canZoom:t,canPan:i}=e,a=Ua.ACTION;this.__mainCameraControls.mouseButtons.left=a.ROTATE,this.__mainCameraControls.touches.one=a.TOUCH_ROTATE,this.__mainCameraControls.mouseButtons.wheel=t?a.DOLLY:a.NONE,this.__mainCameraControls.touches.two=t?a.TOUCH_DOLLY:a.NONE,this.__mainCameraControls.mouseButtons.middle=a.NONE,this.__mainCameraControls.mouseButtons.right=i?a.TRUCK:a.NONE,this.__mainCameraControls.touches.two=i?a.TOUCH_TRUCK:a.NONE,this.__mainCameraControls.enabled=!0,t&&i&&(this.__mainCameraControls.touches.two=i?a.TOUCH_DOLLY_TRUCK:a.NONE),this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e)}async fitCameraToObject({objectToFocus:e,enableTransition:t=!0}){return await this.__mainCameraControls.fitToSphere(e,t)}async wiggleCamera(){const e=this.__mainCameraControls.azimuthAngle,t=[0,.4,-.3,0];for(const i of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+i,!0)}}async setup({mainRenderer:e,screenshotRenderer:t,cameraSettings:i}){const{focalLength:a}=i;this.__cameras={main:new bi(75,window.innerWidth/window.innerHeight,.1,1e3),screenshot:new bi(75,window.innerWidth/window.innerHeight,.1,1e3)},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(100);const l={Vector2:He,Vector3:se,Vector4:Bt,Quaternion:zi,Matrix4:tt,Spherical:hl,Box3:vi,Sphere:vn,Raycaster:l_};Ua.install({THREE:l}),this.__mainCameraControls=new Ua(this.__cameras.main,e.domElement),this.__screenshotCameraControls=new Ua(this.__cameras.screenshot,t.domElement),this.__cameras.main.setFocalLength(a),this.__cameras.main.near=.01,this.__cameras.main.far=1e3,await this.resetCameraToDefault(i),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart(i)}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.appReadyEvent.name,()=>{this.setCameraZoomLimits({minDistance:i.minDistance,maxDistance:i.maxDistance})}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,(h=>{h.detail.saveFirst&&this.saveCurrentCameraTransforms();const{position:d,target:p}=h.detail.cameraTransforms,m=new vf({position:d,target:p});this.moveCameraToLocation({newCameraTransforms:m})})),this._appWcRef.addEventListener(this._appWcRef.eventsManager.hotspotsVisibilityChanged.name,(h=>{const d=this.mainCameraControls,p=h.detail.visible?d.maxDistance+.3:d.maxDistance-.3;d.maxDistance=p}))}}const lF='@font-face{font-family:Helvetica Neue;src:url(https://asset.myepigraph.com/design-assets/fonts/HelveticaNeue/HelveticaNeue-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:PPMori-Regular;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:PPMori-Bold;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Bold.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-BoldItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-ExtraBold.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-ExtraBoldItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Italic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Italic-VariableFont_wght.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Medium.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-MediumItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-Regular.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-SemiBold.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-SemiBoldItalic.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:EB Garamond;src:url(https://asset.myepigraph.com/design-assets/fonts/EBGaramond/EBGaramond-VariableFont_wght.ttf) format("truetype");font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter-VariableFont_slnt_wght.ttf) format("truetype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter_18pt-Bold.ttf) format("truetype");font-weight:700;font-style:normal;font-display:swap}',cF={Color:{Black:{25:{$type:"color",$value:"rgba(0, 0, 0, 0.0000)"},50:{$type:"color",$value:"rgba(0, 0, 0, 0.0500)"},100:{$type:"color",$value:"rgba(0, 0, 0, 0.1000)"},200:{$type:"color",$value:"rgba(0, 0, 0, 0.2000)"},300:{$type:"color",$value:"rgba(0, 0, 0, 0.3000)"},400:{$type:"color",$value:"rgba(0, 0, 0, 0.4000)"},500:{$type:"color",$value:"rgba(0, 0, 0, 0.5000)"},600:{$type:"color",$value:"rgba(0, 0, 0, 0.6000)"},700:{$type:"color",$value:"rgba(0, 0, 0, 0.7000)"},800:{$type:"color",$value:"rgba(0, 0, 0, 0.8000)"},900:{$type:"color",$value:"rgba(0, 0, 0, 0.9000)"},1e3:{$type:"color",$value:"#000000"}},White:{25:{$type:"color",$value:"rgba(255, 255, 255, 0.0250)"},50:{$type:"color",$value:"rgba(255, 255, 255, 0.0500)"},100:{$type:"color",$value:"rgba(255, 255, 255, 0.1000)"},200:{$type:"color",$value:"rgba(255, 255, 255, 0.2000)"},300:{$type:"color",$value:"rgba(255, 255, 255, 0.3000)"},400:{$type:"color",$value:"rgba(255, 255, 255, 0.4000)"},500:{$type:"color",$value:"rgba(255, 255, 255, 0.5000)"},600:{$type:"color",$value:"rgba(255, 255, 255, 0.6000)"},700:{$type:"color",$value:"rgba(255, 255, 255, 0.7000)"},800:{$type:"color",$value:"rgba(255, 255, 255, 0.8000)"},900:{$type:"color",$value:"rgba(255, 255, 255, 0.9000)"},1e3:{$type:"color",$value:"#ffffff"}},Green:{100:{$type:"color",$value:"#ebffee"},200:{$type:"color",$value:"#cff7d3"},300:{$type:"color",$value:"#aff4c6"},400:{$type:"color",$value:"#85e0a3"},500:{$type:"color",$value:"#14ae5c"},600:{$type:"color",$value:"#009951"},700:{$type:"color",$value:"#008043"},800:{$type:"color",$value:"#02542d"},900:{$type:"color",$value:"#024023"},1e3:{$type:"color",$value:"#062d1b"}},Red:{100:{$type:"color",$value:"#fee9e7"},200:{$type:"color",$value:"#fdd3d0"},300:{$type:"color",$value:"#fcb3ad"},400:{$type:"color",$value:"#f4776a"},500:{$type:"color",$value:"#ec221f"},600:{$type:"color",$value:"#c00f0c"},700:{$type:"color",$value:"#900b09"},800:{$type:"color",$value:"#690807"},900:{$type:"color",$value:"#4d0b0a"},1e3:{$type:"color",$value:"#300603"}},Yellow:{100:{$type:"color",$value:"#fffbeb"},200:{$type:"color",$value:"#fff1c2"},300:{$type:"color",$value:"#ffe8a3"},400:{$type:"color",$value:"#e8b931"},500:{$type:"color",$value:"#e5a000"},600:{$type:"color",$value:"#bf6a02"},700:{$type:"color",$value:"#975102"},800:{$type:"color",$value:"#682d03"},900:{$type:"color",$value:"#522504"},1e3:{$type:"color",$value:"#401b01"}},Blue:{100:{$type:"color",$value:"#fbfdff"},200:{$type:"color",$value:"#eaf4ff"},300:{$type:"color",$value:"#d5ebff"},400:{$type:"color",$value:"#c0e1ff"},500:{$type:"color",$value:"#91d0ff"},600:{$type:"color",$value:"#0094d5"},700:{$type:"color",$value:"#00679b"},800:{$type:"color",$value:"#003a5a"},900:{$type:"color",$value:"#003a5a"},1e3:{$type:"color",$value:"#002133"}},Slate:{100:{$type:"color",$value:"#f5f5f5"},200:{$type:"color",$value:"#e3e3e3"},300:{$type:"color",$value:"#cdcdcd"},400:{$type:"color",$value:"#b2b2b2"},500:{$type:"color",$value:"#949494"},600:{$type:"color",$value:"#767676"},700:{$type:"color",$value:"#5a5a5a"},800:{$type:"color",$value:"#434343"},900:{$type:"color",$value:"#303030"},1e3:{$type:"color",$value:"#242424"}},Grey:{25:{$type:"color",$value:"#f5f5f5"},50:{$type:"color",$value:"#f2f2f2"},100:{$type:"color",$value:"#e6e6e6"},200:{$type:"color",$value:"#cccccc"},300:{$type:"color",$value:"#b3b3b3"},400:{$type:"color",$value:"#999999"},500:{$type:"color",$value:"#7b7b7b"},600:{$type:"color",$value:"#666666"},700:{$type:"color",$value:"#4d4d4d"},800:{$type:"color",$value:"#333333"},900:{$type:"color",$value:"#1a1a1a"},1e3:{$type:"color",$value:"#0d0d0d"}},GreyAlpha:{25:{$type:"color",$value:"rgba(248, 248, 248, 0.8000)"},100:{$type:"color",$value:"rgba(242, 242, 242, 0.8000)"},500:{$type:"color",$value:"rgba(204, 204, 204, 0.2000)"},700:{$type:"color",$value:"rgba(204, 204, 204, 0.6000)"},800:{$type:"color",$value:"rgba(186, 186, 186, 0.6000)"},900:{$type:"color",$value:"rgba(50, 50, 50, 0.9000)"},"05":{$type:"color",$value:"rgba(253, 253, 253, 0.8000)"}}},Unit:{Space:{0:{$type:"number",$value:"0px"},100:{$type:"number",$value:"4px"},150:{$type:"number",$value:"6px"},200:{$type:"number",$value:"8px"},300:{$type:"number",$value:"12px"},400:{$type:"number",$value:"16px"},500:{$type:"number",$value:"20px"},600:{$type:"number",$value:"24px"},800:{$type:"number",$value:"32px"},1e3:{$type:"number",$value:"40px"},1200:{$type:"number",$value:"48px"},1600:{$type:"number",$value:"64px"},2e3:{$type:"number",$value:"80px"},2400:{$type:"number",$value:"96px"},2800:{$type:"number",$value:"112px"},3200:{$type:"number",$value:"128px"},3600:{$type:"number",$value:"144px"},4e3:{$type:"number",$value:"160px"},4400:{$type:"number",$value:"176px"},4800:{$type:"number",$value:"192px"},5200:{$type:"number",$value:"208px"},5600:{$type:"number",$value:"224px"},6e3:{$type:"number",$value:"240px"},6400:{$type:"number",$value:"256px"},7200:{$type:"number",$value:"288px"},8e3:{$type:"number",$value:"320px"},9600:{$type:"number",$value:"384px"},"0125":{$type:"number",$value:"0.5px"},"025":{$type:"number",$value:"1px"},"0325":{$type:"number",$value:"1.5px"},"050":{$type:"number",$value:"2px"}},Stack:{100:{$type:"number",$value:"-4px"},200:{$type:"number",$value:"-8px"},300:{$type:"number",$value:"-12px"},400:{$type:"number",$value:"-16px"},800:{$type:"number",$value:"-32px"},1e3:{$type:"number",$value:"-40px"},1600:{$type:"number",$value:"-64px"},2400:{$type:"number",$value:"-96px"},3200:{$type:"number",$value:"-128px"},4e3:{$type:"number",$value:"-160px"},4800:{$type:"number",$value:"-192px"},5600:{$type:"number",$value:"-224px"},7200:{$type:"number",$value:"-288px"},9600:{$type:"number",$value:"-384px"},"0125":{$type:"number",$value:"-0.5px"},"025":{$type:"number",$value:"-1px"},"0325":{$type:"number",$value:"-1.5px"},"050":{$type:"number",$value:"-2px"},"075":{$type:"number",$value:"-3px"}},Size:{4:{$type:"number",$value:"4px"},6:{$type:"number",$value:"6px"},8:{$type:"number",$value:"8px"},10:{$type:"number",$value:"10px"},12:{$type:"number",$value:"12px"},14:{$type:"number",$value:"14px"},16:{$type:"number",$value:"16px"},18:{$type:"number",$value:"18px"},20:{$type:"number",$value:"20px"},22:{$type:"number",$value:"22px"},24:{$type:"number",$value:"24px"},28:{$type:"number",$value:"28px"},30:{$type:"number",$value:"30px"},32:{$type:"number",$value:"32px"},40:{$type:"number",$value:"40px"},48:{$type:"number",$value:"48px"},64:{$type:"number",$value:"64px"},80:{$type:"number",$value:"80px"},96:{$type:"number",$value:"96px"},112:{$type:"number",$value:"112px"},128:{$type:"number",$value:"128px"},144:{$type:"number",$value:"144px"},160:{$type:"number",$value:"160px"},176:{$type:"number",$value:"176px"},224:{$type:"number",$value:"224px"}},Resolution:{XxsmallScreenMin:{$type:"number",$value:"375px"},XsmallScreenMin:{$type:"number",$value:"480px"},SmallScreenMin:{$type:"number",$value:"576px"},MediumScreenMin:{$type:"number",$value:"768px"},LargeScreenMin:{$type:"number",$value:"992px"},XlargeScreenMin:{$type:"number",$value:"1200px"},XxlargeScreenMin:{$type:"number",$value:"1400px"},XxxsmallScreenMax:{$type:"number",$value:"374px"},XxsmallScreenMax:{$type:"number",$value:"479px"},XsmallScreenMax:{$type:"number",$value:"575px"},SmallScreenMax:{$type:"number",$value:"767px"},MediumScreenMax:{$type:"number",$value:"991px"},LargeScreenMax:{$type:"number",$value:"1199px"},XlargeScreenMax:{$type:"number",$value:"1399px"},XxlargeScreenMax:{$type:"number",$value:"1920px"}}},Font:{Family:{Main:{$type:"string",$value:"PP Mori"},Body:{$type:"string",$value:"Helvetica LT Pro"},Epigraph:{$type:"string",$value:"PP Mori"}}}},SC={Color:{Brand:{Base:{$type:"color",$value:"#335166",$web:"var(--color-brand-base)"},BaseSecondary:{$type:"color",$value:"#2b4354",$web:"var(--color-brand-base-secondary)"},BaseTertiary:{$type:"color",$value:"#202f3a",$web:"var(--color-brand-base-tertiary)"},Accent:{$type:"color",$value:"#4276cf",$web:"var(--color-brand-accent)"},AccentSecondary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-secondary)"},AccentTertiary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-tertiary)"},Light:{$type:"color",$value:"#f8fbf6",$web:"var(--color-brand-light)"},Dark:{$type:"color",$value:"#111b22",$web:"var(--color-brand-dark)"}}},Font:{Brand:{Heading:{$type:"string",$value:"EB Garamond",$web:"var(--font-brand-heading)"},Paragraph:{$type:"string",$value:"Inter",$web:"var(--font-brand-body)"}}},Unit:{Brand:{Radius:{$type:"number",$value:"4px",$web:"var(--unit-brand-radius)"}}}},Se={Color:{Surface:{Plain:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.100}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.50}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.25}"},ShadowSecondary:{$value:"{Primitives.Color.Black.200}"}},Fill:{Accent:{$value:"{BrandPrimitives.Color.Brand.Accent}"},AccentHover:{$value:"{BrandPrimitives.Color.Brand.AccentSecondary}"},AccentPress:{$value:"{BrandPrimitives.Color.Brand.AccentTertiary}"},Base:{$value:"{BrandPrimitives.Color.Brand.Base}"},BaseHover:{$value:"{BrandPrimitives.Color.Brand.BaseSecondary}"},BasePress:{$value:"{BrandPrimitives.Color.Brand.BaseTertiary}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.700}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.300}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.100}"},SubtlePrimary:{$value:"{Primitives.Color.GreyAlpha.100}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.25}"},DangerPrimary:{$value:"{Primitives.Color.Red.600}"},Disabled:{$value:"{Primitives.Color.Grey.200}"},HotspotSecondary:{$value:"{Primitives.Color.GreyAlpha.800}"}},Icon:{NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"}},Text:{Invert:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.700}"},Disabled:{$value:"{Primitives.Color.Grey.300}"}},Border:{AltContrast:{$value:"{BrandPrimitives.Color.Brand.Dark}"},SubtlePrimary:{$value:"{Primitives.Color.Grey.300}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.700}"}}},Size:{Text:{Small:{$value:"{Primitives.Unit.Size.16}"},Medium:{$value:"{Primitives.Unit.Size.18}"},Large:{$value:"{Primitives.Unit.Size.20}"}},Icon:{Small:{$value:"{Primitives.Unit.Size.20}"},Medium:{$value:"{Primitives.Unit.Size.24}"},Large:{$value:"{Primitives.Unit.Size.28}"}},Radius:{Medium:{$value:"{Primitives.Unit.Space.150}"},Full:{$value:"{Primitives.Unit.Space.6000}"}},Stroke:{Regular:{$value:"{Primitives.Unit.Space.025}"},Thick:{$value:"{Primitives.Unit.Space.050}"}},Shadow:{None:{$value:"{Primitives.Unit.Space.0}"},Xsmall:{$value:"{Primitives.Unit.Space.025}"},Small:{$value:"{Primitives.Unit.Space.0325}"}},Blur:{Small:{$value:"{Primitives.Unit.Space.100}"}}},Space:{Padding:{Small:{$value:"{Primitives.Unit.Space.300}"},Medium:{$value:"{Primitives.Unit.Space.400}"},Regular:{$value:"{Primitives.Unit.Space.600}"}},Gap:{Small:{$value:"{Primitives.Unit.Space.200}"},Regular:{$value:"{Primitives.Unit.Space.400}"},Xxlarge:{$value:"{Primitives.Unit.Space.800}"}}},Font:{Family:{CustomH:{$value:"{BrandPrimitives.Font.Brand.Heading}"},CustomP:{$value:"{BrandPrimitives.Font.Brand.Paragraph}"},Main:{$value:"Helvetica Neue"}},Tracking:{Normal:{$value:"{Primitives.Unit.Space.0}"}}}};function be(o){const e=/\{Primitives\.(.*?)}/,t=String(o).match(e),i=/\{BrandPrimitives\.(.*?)}/,a=String(o).match(i);let l=o;if(t){const h=t[1].split(".");l=cF[h[0]][h[1]][h[2]].$value}else if(a){const h=a[1].split("."),d=SC[h[0]][h[1]][h[2]],p=d.$web;l=`${p.substring(0,p.length-1)}, ${d.$value})`}return un(l)}const I_={poweredByEpigraphFooterText:"https://asset.myepigraph.com/design-assets/icons/powered-by-epigraph.svg",splashScreenLogo:"https://asset.myepigraph.com/design-assets/icons/default-splash-screen-image.svg",sampleQrCode:"https://asset.myepigraph.com/design-assets/icons/sample-qr-code.png"};function hF(){const o={};for(const[e,t]of Object.entries(SC))for(const[i,a]of Object.entries(t))for(const[l,h]of Object.entries(a)){const d=`${e}${i}${l}`;o[d]={name:un(h.$web),defaultValue:h.$value,argType:{control:h.$type}}}return o}const uF=hF(),Ll={size:{name:"size",defaultValue:"small",argType:{options:["small","medium","large"],control:"select"}},theme:{name:"theme",defaultValue:"light",argType:{options:["light","dark"],control:"select"}},disabled:{name:"disabled",defaultValue:!1,argType:{control:"boolean"}}};var dF=Object.defineProperty,Kf=(o,e,t,i)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(e,t,a)||a);return a&&dF(e,t,a),a};const Xh=class CC extends ul{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=Ll.theme.defaultValue.toString(),this.size=Ll.size.defaultValue.toString(),CC.ensureFontsAreLoaded()}static{this.styles=[ct`
4205
4205
  :host {
4206
4206
  font-family: ${be(Se.Font.Family.Main.$value)};
4207
4207
  letter-spacing: 0.5px;
@@ -8530,7 +8530,7 @@ void main() {
8530
8530
  opacity: 0;
8531
8531
  pointer-events: none;
8532
8532
  }
8533
- `]}get timeElapsedSinceLoadBegin(){return parseFloat((performance.now()-this._loadTimeBegin).toFixed(2))}get epigraphAnalytics(){return this._epigraphAnalytics}get identifier(){return this._identifier}get identifierType(){return this._identifierType}get eventsManager(){return this._eventsManager}get canvasSize(){return this.__canvasSize}get loaders(){return this._loaders}get experienceData(){return this._experienceData}get sceneManager(){return this._sceneManager}get cameraManager(){return this._cameraManager}get hasSceneChanged(){return this.__hasSceneChanged}set hasSceneChanged(e){this.__hasSceneChanged=e}get renderEngine(){return this._renderEngine}get isDevEnv(){return this._isDevEnv}enterPickerState(){this.sessionState="hotspotPlacer",this.style.cursor="crosshair",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.renderEngine.scene.remove(this.__viewStateGrid),this.cameraManager.disableCameraZoomLimits(),this.cameraManager.disableCameraRotationLimits(),this.requestUpdate()}enterViewState(){if(this.sessionState="cameraUpdate",this.style.cursor="grab",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hotspotsManager.style.opacity="0.25",this.renderEngine.scene.add(this.__viewStateGrid),this.hotspotsManager.activeHotspot){const e=this.hotspotsManager.activeHotspot.camera,t=new vf({position:e.position,target:e.target});this.cameraManager.moveCameraToLocation({newCameraTransforms:t})}else this.cameraManager.resetCameraToDefault(this.productSettings.camera);this.requestUpdate()}enterDefaultState(){const e=this.sessionState;this.sessionState="default",this.style.cursor="grab",this.hotspotsManager.style.opacity="1",this.renderEngine.scene.remove(this.__viewStateGrid),e==="hotspotPlacer"&&this.cameraManager.resetCameraToDefault(this.productSettings.camera),this.requestUpdate()}renderScreenshotCanvasFrame(){this.renderEngine.screenshotRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().screenshot)}onLoadFailed(e,t){this._eventsManager.appFailedEvent.fire(t);const i=this.timeElapsedSinceLoadBegin,a=new ty(!0,i,e);this._epigraphAnalytics.sendEvent(a),this.showSplashScreen()}getFirstNonProxyFromIntersections(e){let t=null;for(const i of e)if(!(!i?.object||i.object.userData.isProxyMesh===!0)){t=i;break}return t}__getIntersectionsWithScene(e,t){const i=new l_,a=new He;return a.x=e/this.canvasSize.width*2-1,a.y=-(t/this.canvasSize.height)*2+1,i.setFromCamera(a,this.cameraManager.getCameras().main),i.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.rootEntity.children,!0)}getPositionOnMeshFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);if(i.length>0){const a=this.getFirstNonProxyFromIntersections(i);return a===null?null:a.point}else return null}getIntersectionOnProductFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);let a=null;if(i.length>0){const l=this.getFirstNonProxyFromIntersections(i);if(!l?.object)return null;l.object.traverseAncestors(h=>{if(h instanceof Va&&h.isRoot===!1){a={asset:{id:h.asset.id,name:h.asset.name},intersection:{point:l.point,normals:l.normal??null}};return}})}return a}getSceneSphericalBoundsForCameraFocus(){const e=this.sceneManager.currentSceneBounds;e.getCenter(this._boundingSphereCenter);const t=e.getBoundingSphere(new vn(this._boundingSphereCenter));if(this.dimensionsManager?.enabled){const i=this.canvasSize.height/this.canvasSize.width;t.radius+=i}return t}async getUsdzUrlForAr(){return this.__usdzBlobUrl=await this.renderEngine.getSceneAsUsdzUrl(),this.eventsManager.arModelReadyEvent.fire(this.__usdzBlobUrl),this.__usdzBlobUrl}async getGlbUrlForAr(){return this.__glbBlobUrl=await this.renderEngine.getSceneAsGlbUrl(),this.eventsManager.arModelReadyEvent.fire(this.__glbBlobUrl),this.__glbBlobUrl}async launchAR(){if(!this.isLoading)return await this.viewInYourSpaceManager.launchAR()}highlightEntityByAssetId(e){const t=this.sceneManager.sceneStructure.getEntityForAssetId(e);if(!t){window.epigraph.logger.error({title:`No asset found for ID: ${e}`});return}t.highlight()}unhighlightAllEntities(){for(const e of this.sceneManager.sceneStructure.getSceneEntities())e.unhighlight()}async spawnAssetInScene(e){const t=this.sceneManager.sceneStructure.getPossibleConnectionsForAssetInScene(e);if(t.length<=0)return Promise.resolve(void 0);const i=t[0];i.connect();const a=new Va(e);await a.initialize();const l=i.receiver,h=i.plug.clone();this.sceneManager.sceneStructure.add(h);const d=new se;l.getWorldPosition(d),h.position.set(d.x,d.y,d.z),h.attach(a);const p=new zi;return l.getWorldQuaternion(p),h.setRotationFromQuaternion(p),l.attach(a),h.removeFromParent(),Et.dispose3(h),this.eventsManager.structureChangedEvent.fire(),Promise.resolve(a)}showDimensions(){this.dimensionsManager.enabled=!0,this.areDimensionsActive=!0,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),this.cameraManager.fitCameraToSceneBounds()}hideDimensions(e=!1){this.dimensionsManager.enabled=!1,this.areDimensionsActive=!1,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),e||this.cameraManager.fitCameraToSceneBounds()}getDimensions(){const e=this.dimensionsManager.getCurrentDimensionsState(),t=this.dimensionsManager.dimensionsUnit;return{length:e.length.distance,width:e.width.distance,height:e.height.distance,unit:t}}printSceneHierarchy(){this.renderEngine.printSceneHierarchy()}showCameraAim(){this.cameraAimElemRef.classList.remove("hide")}hideCameraAim(){this.cameraAimElemRef.classList.add("hide")}showHelp(){this.isHelpVisible=!0}hideHelp(){this.isHelpVisible=!1}toggleHelp(){this.isHelpVisible=!this.isHelpVisible}showHotspots(){window.epigraph.logger.info({title:"Showing Hotspots"}),this.areHotspotsActive=!0,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!0})}hideHotspots(){window.epigraph.logger.info({title:"Hiding Hotspots"}),this.areHotspotsActive=!1,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!1})}toggleHotspots(){this.hotspotsManager.enabled?this.hideHotspots():this.showHotspots()}updateHotspotsOrder(e){this.hotspotsManager.updateHotspotsOrder(e)}openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i=!1}){this.hotspotsManager.openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i})}closeActiveHotspot(){this.hotspotsManager.closeActiveHotspot()}setActiveHotspotState(e){this.hotspotsManager.setActiveHotspotState(e)}nextHotspot(){return this.hotspotsManager.nextHotspot()}previousHotspot(){return this.hotspotsManager.previousHotspot()}getActiveHotspot(){return this.hotspotsManager.activeHotspot}areHotspotsVisible(){return this.hotspotsManager.enabled}getAllHotspots(){return Array.from(this.hotspotsManager.hotspots.values())}getAllHotspotIds(){return Array.from(this.hotspotsManager.hotspots.keys())}getHotspotById(e){return this.hotspotsManager.hotspots.get(e)}async __onPlayInteractionPrompt(e=2){this.showCameraInteractionPromptIndicator(),await Et.wait(800);for(let t=0;t<e;t++)this.cameraInteractionPromptIndicatorElemRef.classList.add("play-wiggle-animation"),await this.cameraManager.wiggleCamera();this.cameraInteractionPromptIndicatorElemRef.classList.remove("play-wiggle-animation"),this.hideCameraInteractionPromptIndicator(),this._isSceneInteractedWith||setTimeout(()=>{this.__onPlayInteractionPrompt()},3e3)}getAllAnimations(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimations():[]}getAllAnimationNames(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimationNames():[]}playAnimationByName({animationName:e,clampWhenFinished:t=!1,loop:i=!1,repetitions:a=1/0,reverse:l=!1}){if(!e)return;const h=this.getAllAnimationNames();if(!h.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:h});return}const d=h.indexOf(e),p=this.getAllAnimations()[d];return l?(p.timeScale=-1,p.fadeOut(this._animationFadeDurationInMiliseconds*.001)):(p.timeScale=1,p.fadeIn(this._animationFadeDurationInMiliseconds*.001)),p.setLoop(i?$a:El,a),p.clampWhenFinished=t,p.enabled=!0,p.play(),this._activeAnimations.set(e,p),{animationName:e,targetAnimationAction:p}}stopAnimationByName(e){if(!e)return;const t=this.getAllAnimationNames();if(!t.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:t});return}const i=t.indexOf(e),a=this.getAllAnimations()[i];a.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{a.stop()},this._animationFadeDurationInMiliseconds),this._activeAnimations.delete(e)}pauseActiveAnimations(e){for(const t of this._activeAnimations.values())t.paused=!0,e!==void 0&&(t.weight=e)}resumeActiveAnimations(){for(const e of this._activeAnimations.values())e.paused=!1,e.weight=1}stopAllAnimations(){for(const[e,t]of this._activeAnimations.entries())t.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{t.stop(),this._activeAnimations.delete(e)},this._animationFadeDurationInMiliseconds)}postRenderFrameUpdateInEngine(e){try{this.cameraManager.mainCameraControls.update(e),this.debugManager&&this.debugManager.stats.update(),this.renderEngine.mainRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main),this.renderEngine.textRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main)}catch(t){return t}}getScreenPositionFromWorld(e){const t=new He,i=this.cameraManager.getCameras().main,a=this.renderEngine.canvas.clientWidth*.5,l=this.renderEngine.canvas.clientHeight*.5,d=e.clone().project(i);return t.x=(d.x+1)*a,t.y=-(d.y-1)*l,t}_renderAppCanvasContainer(){return this.featuresToEnable.viewer?Ee`
8533
+ `]}get timeElapsedSinceLoadBegin(){return parseFloat((performance.now()-this._loadTimeBegin).toFixed(2))}get epigraphAnalytics(){return this._epigraphAnalytics}get identifier(){return this._identifier}get identifierType(){return this._identifierType}get eventsManager(){return this._eventsManager}get canvasSize(){return this.__canvasSize}get loaders(){return this._loaders}get experienceData(){return this._experienceData}get sceneManager(){return this._sceneManager}get cameraManager(){return this._cameraManager}get hasSceneChanged(){return this.__hasSceneChanged}set hasSceneChanged(e){this.__hasSceneChanged=e}get renderEngine(){return this._renderEngine}get isDevEnv(){return this._isDevEnv}enterPickerState(){this.sessionState="hotspotPlacer",this.style.cursor="crosshair",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.renderEngine.scene.remove(this.__viewStateGrid),this.cameraManager.disableCameraZoomLimits(),this.cameraManager.disableCameraRotationLimits(),this.requestUpdate()}enterViewState(){const e=this.sessionState;if(this.sessionState="cameraUpdate",this.style.cursor="grab",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hotspotsManager.style.opacity="0.25",this.renderEngine.scene.add(this.__viewStateGrid),e==="hotspotPlacer"&&(this.cameraManager.enableCameraZoomLimits(this.productSettings.camera,!0),this.cameraManager.enableCameraRotationLimits(this.productSettings.camera),this.hotspotsManager.activeHotspot)){const t=this.hotspotsManager.activeHotspot.camera,i=new vf({position:t.position,target:t.target});this.cameraManager.moveCameraToLocation({newCameraTransforms:i})}this.requestUpdate()}enterDefaultState(){const e=this.sessionState;this.sessionState="default",this.style.cursor="grab",this.hotspotsManager.style.opacity="1",this.renderEngine.scene.remove(this.__viewStateGrid),e==="hotspotPlacer"&&(this.cameraManager.enableCameraZoomLimits(this.productSettings.camera),this.cameraManager.enableCameraRotationLimits(this.productSettings.camera)),this.requestUpdate()}renderScreenshotCanvasFrame(){this.renderEngine.screenshotRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().screenshot)}onLoadFailed(e,t){this._eventsManager.appFailedEvent.fire(t);const i=this.timeElapsedSinceLoadBegin,a=new ty(!0,i,e);this._epigraphAnalytics.sendEvent(a),this.showSplashScreen()}getFirstNonProxyFromIntersections(e){let t=null;for(const i of e)if(!(!i?.object||i.object.userData.isProxyMesh===!0)){t=i;break}return t}__getIntersectionsWithScene(e,t){const i=new l_,a=new He;return a.x=e/this.canvasSize.width*2-1,a.y=-(t/this.canvasSize.height)*2+1,i.setFromCamera(a,this.cameraManager.getCameras().main),i.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.rootEntity.children,!0)}getPositionOnMeshFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);if(i.length>0){const a=this.getFirstNonProxyFromIntersections(i);return a===null?null:a.point}else return null}getIntersectionOnProductFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);let a=null;if(i.length>0){const l=this.getFirstNonProxyFromIntersections(i);if(!l?.object)return null;l.object.traverseAncestors(h=>{if(h instanceof Va&&h.isRoot===!1){a={asset:{id:h.asset.id,name:h.asset.name},intersection:{point:l.point,normals:l.normal??null}};return}})}return a}getSceneSphericalBoundsForCameraFocus(){const e=this.sceneManager.currentSceneBounds;e.getCenter(this._boundingSphereCenter);const t=e.getBoundingSphere(new vn(this._boundingSphereCenter));if(this.dimensionsManager?.enabled){const i=this.canvasSize.height/this.canvasSize.width;t.radius+=i}return t}async getUsdzUrlForAr(){return this.__usdzBlobUrl=await this.renderEngine.getSceneAsUsdzUrl(),this.eventsManager.arModelReadyEvent.fire(this.__usdzBlobUrl),this.__usdzBlobUrl}async getGlbUrlForAr(){return this.__glbBlobUrl=await this.renderEngine.getSceneAsGlbUrl(),this.eventsManager.arModelReadyEvent.fire(this.__glbBlobUrl),this.__glbBlobUrl}async launchAR(){if(!this.isLoading)return await this.viewInYourSpaceManager.launchAR()}highlightEntityByAssetId(e){const t=this.sceneManager.sceneStructure.getEntityForAssetId(e);if(!t){window.epigraph.logger.error({title:`No asset found for ID: ${e}`});return}t.highlight()}unhighlightAllEntities(){for(const e of this.sceneManager.sceneStructure.getSceneEntities())e.unhighlight()}async spawnAssetInScene(e){const t=this.sceneManager.sceneStructure.getPossibleConnectionsForAssetInScene(e);if(t.length<=0)return Promise.resolve(void 0);const i=t[0];i.connect();const a=new Va(e);await a.initialize();const l=i.receiver,h=i.plug.clone();this.sceneManager.sceneStructure.add(h);const d=new se;l.getWorldPosition(d),h.position.set(d.x,d.y,d.z),h.attach(a);const p=new zi;return l.getWorldQuaternion(p),h.setRotationFromQuaternion(p),l.attach(a),h.removeFromParent(),Et.dispose3(h),this.eventsManager.structureChangedEvent.fire(),Promise.resolve(a)}showDimensions(){this.dimensionsManager.enabled=!0,this.areDimensionsActive=!0,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),this.cameraManager.fitCameraToSceneBounds()}hideDimensions(e=!1){this.dimensionsManager.enabled=!1,this.areDimensionsActive=!1,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),e||this.cameraManager.fitCameraToSceneBounds()}getDimensions(){const e=this.dimensionsManager.getCurrentDimensionsState(),t=this.dimensionsManager.dimensionsUnit;return{length:e.length.distance,width:e.width.distance,height:e.height.distance,unit:t}}printSceneHierarchy(){this.renderEngine.printSceneHierarchy()}showCameraAim(){this.cameraAimElemRef.classList.remove("hide")}hideCameraAim(){this.cameraAimElemRef.classList.add("hide")}showHelp(){this.isHelpVisible=!0}hideHelp(){this.isHelpVisible=!1}toggleHelp(){this.isHelpVisible=!this.isHelpVisible}showHotspots(){window.epigraph.logger.info({title:"Showing Hotspots"}),this.areHotspotsActive=!0,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!0})}hideHotspots(){window.epigraph.logger.info({title:"Hiding Hotspots"}),this.areHotspotsActive=!1,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!1})}toggleHotspots(){this.hotspotsManager.enabled?this.hideHotspots():this.showHotspots()}updateHotspotsOrder(e){this.hotspotsManager.updateHotspotsOrder(e)}openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i=!1}){this.hotspotsManager.openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i})}closeActiveHotspot(){this.hotspotsManager.closeActiveHotspot()}setActiveHotspotState(e){this.hotspotsManager.setActiveHotspotState(e)}nextHotspot(){return this.hotspotsManager.nextHotspot()}previousHotspot(){return this.hotspotsManager.previousHotspot()}getActiveHotspot(){return this.hotspotsManager.activeHotspot}areHotspotsVisible(){return this.hotspotsManager.enabled}getAllHotspots(){return Array.from(this.hotspotsManager.hotspots.values())}getAllHotspotIds(){return Array.from(this.hotspotsManager.hotspots.keys())}getHotspotById(e){return this.hotspotsManager.hotspots.get(e)}async __onPlayInteractionPrompt(e=2){this.showCameraInteractionPromptIndicator(),await Et.wait(800);for(let t=0;t<e;t++)this.cameraInteractionPromptIndicatorElemRef.classList.add("play-wiggle-animation"),await this.cameraManager.wiggleCamera();this.cameraInteractionPromptIndicatorElemRef.classList.remove("play-wiggle-animation"),this.hideCameraInteractionPromptIndicator(),this._isSceneInteractedWith||setTimeout(()=>{this.__onPlayInteractionPrompt()},3e3)}getAllAnimations(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimations():[]}getAllAnimationNames(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimationNames():[]}playAnimationByName({animationName:e,clampWhenFinished:t=!1,loop:i=!1,repetitions:a=1/0,reverse:l=!1}){if(!e)return;const h=this.getAllAnimationNames();if(!h.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:h});return}const d=h.indexOf(e),p=this.getAllAnimations()[d];return l?(p.timeScale=-1,p.fadeOut(this._animationFadeDurationInMiliseconds*.001)):(p.timeScale=1,p.fadeIn(this._animationFadeDurationInMiliseconds*.001)),p.setLoop(i?$a:El,a),p.clampWhenFinished=t,p.enabled=!0,p.play(),this._activeAnimations.set(e,p),{animationName:e,targetAnimationAction:p}}stopAnimationByName(e){if(!e)return;const t=this.getAllAnimationNames();if(!t.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:t});return}const i=t.indexOf(e),a=this.getAllAnimations()[i];a.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{a.stop()},this._animationFadeDurationInMiliseconds),this._activeAnimations.delete(e)}pauseActiveAnimations(e){for(const t of this._activeAnimations.values())t.paused=!0,e!==void 0&&(t.weight=e)}resumeActiveAnimations(){for(const e of this._activeAnimations.values())e.paused=!1,e.weight=1}stopAllAnimations(){for(const[e,t]of this._activeAnimations.entries())t.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{t.stop(),this._activeAnimations.delete(e)},this._animationFadeDurationInMiliseconds)}postRenderFrameUpdateInEngine(e){try{this.cameraManager.mainCameraControls.update(e),this.debugManager&&this.debugManager.stats.update(),this.renderEngine.mainRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main),this.renderEngine.textRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main)}catch(t){return t}}getScreenPositionFromWorld(e){const t=new He,i=this.cameraManager.getCameras().main,a=this.renderEngine.canvas.clientWidth*.5,l=this.renderEngine.canvas.clientHeight*.5,d=e.clone().project(i);return t.x=(d.x+1)*a,t.y=-(d.y-1)*l,t}_renderAppCanvasContainer(){return this.featuresToEnable.viewer?Ee`
8534
8534
  <div id="appCanvasContainer" class="app-canvas-container">
8535
8535
  <span id="cameraAimIndicator" class="camera-aim-indicator hide"></span>
8536
8536
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [