@epigraph/solutions 1.3.0-alpha.2 → 1.3.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.
|
@@ -13018,7 +13018,7 @@ void main() {
|
|
|
13018
13018
|
`+r.fragmentShader.slice(a-1,-1)+`
|
|
13019
13019
|
vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
|
|
13020
13020
|
gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow);
|
|
13021
|
-
}`,r.uniforms.previousShadowMap=this.previousShadowMap,r.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{M6(e)?this.meshes.push({object:e,material:e.material}):T6(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,s=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,r=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=s.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=r}}class Q6{constructor({scene:e,targetRenderer:t,settings:n,appWcRef:s}){this.enabled=!0,this._loggerContext="ACCUMULATIVE SHADOWS",this.__settings={},this.__shadowParams={temporal:!1,limit:1/0},this.__lightParams={amount:6,intensity:parseInt(su.replace(/\D+/g,""))>=155?Math.PI:1,bias:.001,mapSize:1024,size:8,near:.5,far:200},this.api={count:0},this.__gLights=new In,this.__scene=e,this.__targetRenderer=t,this.__settings=n,this.__appWcRef=s,Ki.seededRandom(42),this.setup()}get camera(){return this.__camera}set camera(e){this.__camera=e}enable(){window.epigraph.logger.info({title:"Enabling Accumulative Shadows!",contextOverride:this._loggerContext}),this.enabled=!0,this.__groundPlane.visible=!0}disable(){window.epigraph.logger.info({title:"Disabling Accumulative Shadows!",contextOverride:this._loggerContext}),this.enabled=!1,this.__groundPlane.visible=!1}reset(){this.__progressiveLightMap.clear(),this.__shadowMaterial.opacity=0,this.__shadowMaterial.alphaTest=0,this.api.count=0,!this.__shadowParams.temporal&&this.__settings.shadowParams.frames!==1/0&&this.reCalculate(this.__settings.shadowParams.frames)}__setupEventListeners(){this.__onStructureChanged=this.reset.bind(this),this.__onProductSettingUpdated=()=>{const e=this.__appWcRef.productSettings.shadows.accumulativeShadows;this.__settings=e,this.reset()},this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.structureChangedEvent.name,this.__onStructureChanged),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated)}dispose(){window.epigraph.logger.info({title:"Disposing Accumulative Shadows!",contextOverride:this._loggerContext}),this.__onStructureChanged&&this.__appWcRef.removeEventListener(this.__appWcRef.eventsManager.structureChangedEvent.name,this.__onStructureChanged),this.__onProductSettingUpdated&&this.__appWcRef.removeEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated),this.__groundPlane&&(this.__scene.remove(this.__groundPlane),this.__groundPlane.geometry.dispose()),this.__shadowMaterial&&this.__shadowMaterial.dispose(),this.__scene.remove(this.__gLights);for(const e of[...this.__gLights.children]){const t=e;t.shadow&&(t.shadow.map&&(t.shadow.map.dispose(),t.shadow.map=null),t.shadow.dispose?.()),t.dispose?.(),this.__gLights.remove(t)}this.__progressiveLightMap&&(this.__progressiveLightMap.progressiveLightMap1?.dispose(),this.__progressiveLightMap.progressiveLightMap2?.dispose(),this.__progressiveLightMap.discardMat?.dispose(),this.__progressiveLightMap.targetMat?.dispose()),this.gui&&this.gui.destroy()}get groundPlane(){return this.__groundPlane}setup(){this.__progressiveLightMap=new D6(this.__targetRenderer,this.__scene,1024),this.__shadowMaterial=new R6({map:this.__progressiveLightMap.progressiveLightMap2.texture,transparent:!0,depthWrite:!1,toneMapped:!0,blend:this.__settings.shadowMaterial.blend,alphaTest:0,color:new we(this.__settings.shadowMaterial.color)}),this.__groundPlane=new Je(new bs(1,1).rotateX(-Math.PI/2),this.__shadowMaterial),this.__groundPlane.name="ACCUMULATIVE_SHADOW_GROUND_PLANE",this.__groundPlane.scale.setScalar(this.__settings.shadowParams.scale),this.__groundPlane.receiveShadow=!0,this.__scene.add(this.__groundPlane),this.__progressiveLightMap.configure(this.__groundPlane);for(let e=0;e<this.__lightParams.amount;e++){const t=new yv(16777215,this.__lightParams.intensity/this.__lightParams.amount);t.name="dir_light_"+e,t.castShadow=!0,t.shadow.bias=this.__lightParams.bias,t.shadow.camera.near=this.__lightParams.near,t.shadow.camera.far=this.__lightParams.far,t.shadow.camera.right=this.__lightParams.size/2,t.shadow.camera.left=-this.__lightParams.size/2,t.shadow.camera.top=this.__lightParams.size/2,t.shadow.camera.bottom=-this.__lightParams.size/2,t.shadow.mapSize.width=this.__lightParams.mapSize,t.shadow.mapSize.height=this.__lightParams.mapSize,this.__gLights.add(t)}this.__setupEventListeners()}temporalUpdate(){this.enabled!==!1&&(this.__shadowParams.temporal||this.__settings.shadowParams.frames===1/0)&&this.api.count<this.__settings.shadowParams.frames&&this.api.count<this.__shadowParams.limit&&(this.reCalculate(),this.api.count++)}__randomiseLightPositions(){const e=Object.keys(this.__settings.light.direction).length;for(let t=0;t<this.__gLights.children.length;t++){const n=this.__gLights.children[t];if(Ki.seededRandom()>this.__settings.shadowParams.ambient)n.position.set(this.__settings.light.direction.x+this.__settings.shadowParams.radius*(.5-Ki.seededRandom()),this.__settings.light.direction.y+this.__settings.shadowParams.radius*(.5-Ki.seededRandom()),this.__settings.light.direction.z+this.__settings.shadowParams.radius*(.5-Ki.seededRandom()));else{const s=Math.acos(2*Ki.seededRandom()-1)-Math.PI/2,r=2*Math.PI*Ki.seededRandom();n.position.set(Math.cos(s)*Math.cos(r)*e,Math.abs(Math.cos(s)*Math.sin(r)*e),Math.sin(s)*e)}}}reCalculate(e=1){if(this.__camera){this.__settings.shadowMaterial.blend=Math.max(2,this.__settings.shadowParams.frames===1/0?this.__settings.shadowMaterial.blend:this.__settings.shadowParams.frames),this.__shadowParams.temporal?(this.__shadowMaterial.opacity=Math.min(this.__settings.shadowMaterial.opacity,this.__shadowMaterial.opacity+this.__settings.shadowMaterial.opacity/this.__settings.shadowMaterial.blend),this.__shadowMaterial.alphaTest=Math.min(this.__settings.shadowMaterial.alphaTest,this.__shadowMaterial.alphaTest+this.__settings.shadowMaterial.alphaTest/this.__settings.shadowMaterial.blend),this.__shadowMaterial.color.set(this.__settings.shadowMaterial.color)):(this.__shadowMaterial.opacity=this.__settings.shadowMaterial.opacity,this.__shadowMaterial.color.set(this.__settings.shadowMaterial.color),this.__shadowMaterial.alphaTest=this.__settings.shadowMaterial.alphaTest),this.__scene.add(this.__gLights),this.__progressiveLightMap.prepare();for(let t=0;t<e;t++)this.__randomiseLightPositions(),this.__progressiveLightMap.update(this.__camera,this.__settings.shadowMaterial.blend);this.__scene.remove(this.__gLights),this.__progressiveLightMap.finish()}}}class L6{constructor({scene:e,sceneHierarchyToCastShadow:t,targetRenderer:n,settings:s,appWcRef:r}){this._loggerContext="CONTACT SHADOWS",this.__enabled=!0,this.__settings={},this.__shadowState={shadow:{blur:4,darkness:.6,opacity:1},plane:{color:"#ffffff",opacity:0},showWireframe:!1},this.__shadowGroup=new In,this.__blurPlane={},this.__renderTarget={},this.__renderTargetBlur={},this.__shadowCamera={},this.__depthMaterial={},this.__horizontalBlurMaterial={},this.__verticalBlurMaterial={},this.__planeMaterial={},this.__appWcRef=r,this.__scene=e,this.__sceneHierarchyToCastShadow=t,this.__targetRenderer=n,this.__settings=s,this.__shadowState.shadow.opacity=this.__settings.intensity,this.__shadowState.shadow.blur=this.__settings.softness,this.__planeMaterial.opacity=this.__settings.intensity,this.__planeMaterial.needsUpdate=!0,this.setup()}isEnabled(){return this.__enabled}enable(){window.epigraph.logger.info({title:"Enabling Contact Shadows!",contextOverride:this._loggerContext}),this.__enabled=!0,this.__shadowGroup.visible=!0}disable(){window.epigraph.logger.info({title:"Disabling Contact Shadows!",contextOverride:this._loggerContext}),this.__enabled=!1,this.__shadowGroup.visible=!1}updateSettings(e){this.__settings=e,this.updateShadowIntensity(),this.updateShadowSoftness()}updateShadowSoftness(){this.__shadowState.shadow.blur=this.__settings.softness}updateShadowIntensity(){this.__shadowState.shadow.opacity=this.__settings.intensity,this.__planeMaterial.opacity=this.__settings.intensity,this.__planeMaterial.needsUpdate=!0}dispose(){window.epigraph.logger.info({title:"Disposing Contact Shadows!",contextOverride:this._loggerContext}),this.__onProductSettingUpdated&&this.__appWcRef.removeEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated),this.__renderTarget?.dispose(),this.__renderTargetBlur?.dispose(),this.__planeGeometry?.dispose(),this.__planeMaterial?.dispose?.(),this.__fillPlaneMaterial?.dispose?.(),this.__depthMaterial?.dispose?.(),this.__horizontalBlurMaterial?.dispose?.(),this.__verticalBlurMaterial?.dispose?.(),this.__shadowGroup?.removeFromParent(),this.__shadowGroup?.clear()}__blurShadow(e){this.__blurPlane.visible=!0,this.__blurPlane.material=this.__horizontalBlurMaterial,this.__blurPlane.material.uniforms.tDiffuse.value=this.__renderTarget.texture,this.__horizontalBlurMaterial.uniforms.h.value=e*1/256,this.__targetRenderer.setRenderTarget(this.__renderTargetBlur),this.__targetRenderer.render(this.__blurPlane,this.__shadowCamera),this.__blurPlane.material=this.__verticalBlurMaterial,this.__blurPlane.material.uniforms.tDiffuse.value=this.__renderTargetBlur.texture,this.__verticalBlurMaterial.uniforms.v.value=e*1/256,this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__blurPlane,this.__shadowCamera),this.__blurPlane.visible=!1}__setupEventListeners(){this.__onProductSettingUpdated=()=>{const e=this.__appWcRef.productSettings.shadows.contactShadows;this.updateSettings(e)},this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated)}setup(){if(!this.__enabled)return;const{planeLength:e,planeWidth:t,cameraHeight:n}=this.__settings,s=e,r=t,a=n;this.__shadowGroup.position.y=0,this.__scene.add(this.__shadowGroup),this.__renderTarget=new Sn(512,512),this.__renderTarget.texture.generateMipmaps=!1,this.__renderTargetBlur=new Sn(512,512),this.__renderTargetBlur.texture.generateMipmaps=!1;const o=new bs(r,s).rotateX(Math.PI/2);this.__planeGeometry=o,this.__planeMaterial=new Xn({map:this.__renderTarget.texture,opacity:this.__shadowState.shadow.opacity,transparent:!0,depthWrite:!1});const l=new Je(o,this.__planeMaterial);l.renderOrder=1,this.__shadowGroup.add(l),l.scale.y=-1,this.__blurPlane=new Je(o),this.__blurPlane.visible=!1,this.__shadowGroup.add(this.__blurPlane),this.__fillPlaneMaterial=new Xn({color:this.__shadowState.plane.color,opacity:this.__shadowState.plane.opacity,transparent:!0,depthWrite:!1});const c=new Je(o,this.__fillPlaneMaterial);c.rotateX(Math.PI),this.__shadowGroup.add(c),this.__shadowCamera=new Or(-r/2,r/2,s/2,-s/2,0,a),this.__shadowCamera.rotation.x=Math.PI/2,this.__shadowGroup.add(this.__shadowCamera),this.__depthMaterial=new gv,this.__depthMaterial.userData.darkness={value:this.__shadowState.shadow.darkness},this.__depthMaterial.onBeforeCompile=u=>{u.uniforms.darkness=this.__depthMaterial.userData.darkness,u.fragmentShader=`
|
|
13021
|
+
}`,r.uniforms.previousShadowMap=this.previousShadowMap,r.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{M6(e)?this.meshes.push({object:e,material:e.material}):T6(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const n=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,s=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,r=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(n),this.previousShadowMap.value=s.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=r}}class Q6{constructor({scene:e,targetRenderer:t,settings:n,appWcRef:s}){this.enabled=!0,this._loggerContext="ACCUMULATIVE SHADOWS",this.__settings={},this.__shadowParams={temporal:!1,limit:1/0},this.__lightParams={amount:6,intensity:parseInt(su.replace(/\D+/g,""))>=155?Math.PI:1,bias:.001,mapSize:1024,size:8,near:.5,far:200},this.api={count:0},this.__gLights=new In,this.__scene=e,this.__targetRenderer=t,this.__settings=n,this.__appWcRef=s,this.setup()}get camera(){return this.__camera}set camera(e){this.__camera=e}enable(){window.epigraph.logger.info({title:"Enabling Accumulative Shadows!",contextOverride:this._loggerContext}),this.enabled=!0,this.__groundPlane.visible=!0}disable(){window.epigraph.logger.info({title:"Disabling Accumulative Shadows!",contextOverride:this._loggerContext}),this.enabled=!1,this.__groundPlane.visible=!1}reset(){Ki.seededRandom(42),this.__progressiveLightMap.clear(),this.__shadowMaterial.opacity=0,this.__shadowMaterial.alphaTest=0,this.api.count=0,!this.__shadowParams.temporal&&this.__settings.shadowParams.frames!==1/0&&this.reCalculate(this.__settings.shadowParams.frames)}__setupEventListeners(){this.__onStructureChanged=this.reset.bind(this),this.__onProductSettingUpdated=()=>{const e=this.__appWcRef.productSettings.shadows.accumulativeShadows;this.__settings=e,this.reset()},this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.structureChangedEvent.name,this.__onStructureChanged),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated)}dispose(){window.epigraph.logger.info({title:"Disposing Accumulative Shadows!",contextOverride:this._loggerContext}),this.__onStructureChanged&&this.__appWcRef.removeEventListener(this.__appWcRef.eventsManager.structureChangedEvent.name,this.__onStructureChanged),this.__onProductSettingUpdated&&this.__appWcRef.removeEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated),this.__groundPlane&&(this.__scene.remove(this.__groundPlane),this.__groundPlane.geometry.dispose()),this.__shadowMaterial&&this.__shadowMaterial.dispose(),this.__scene.remove(this.__gLights);for(const e of[...this.__gLights.children]){const t=e;t.shadow&&(t.shadow.map&&(t.shadow.map.dispose(),t.shadow.map=null),t.shadow.dispose?.()),t.dispose?.(),this.__gLights.remove(t)}this.__progressiveLightMap&&(this.__progressiveLightMap.progressiveLightMap1?.dispose(),this.__progressiveLightMap.progressiveLightMap2?.dispose(),this.__progressiveLightMap.discardMat?.dispose(),this.__progressiveLightMap.targetMat?.dispose()),this.gui&&this.gui.destroy()}get groundPlane(){return this.__groundPlane}setup(){this.__progressiveLightMap=new D6(this.__targetRenderer,this.__scene,1024),this.__shadowMaterial=new R6({map:this.__progressiveLightMap.progressiveLightMap2.texture,transparent:!0,depthWrite:!1,toneMapped:!0,blend:this.__settings.shadowMaterial.blend,alphaTest:0,color:new we(this.__settings.shadowMaterial.color)}),this.__groundPlane=new Je(new bs(1,1).rotateX(-Math.PI/2),this.__shadowMaterial),this.__groundPlane.name="ACCUMULATIVE_SHADOW_GROUND_PLANE",this.__groundPlane.scale.setScalar(this.__settings.shadowParams.scale),this.__groundPlane.receiveShadow=!0,this.__scene.add(this.__groundPlane),this.__progressiveLightMap.configure(this.__groundPlane);for(let e=0;e<this.__lightParams.amount;e++){const t=new yv(16777215,this.__lightParams.intensity/this.__lightParams.amount);t.name="dir_light_"+e,t.castShadow=!0,t.shadow.bias=this.__lightParams.bias,t.shadow.camera.near=this.__lightParams.near,t.shadow.camera.far=this.__lightParams.far,t.shadow.camera.right=this.__lightParams.size/2,t.shadow.camera.left=-this.__lightParams.size/2,t.shadow.camera.top=this.__lightParams.size/2,t.shadow.camera.bottom=-this.__lightParams.size/2,t.shadow.mapSize.width=this.__lightParams.mapSize,t.shadow.mapSize.height=this.__lightParams.mapSize,this.__gLights.add(t)}this.__setupEventListeners()}temporalUpdate(){this.enabled!==!1&&(this.__shadowParams.temporal||this.__settings.shadowParams.frames===1/0)&&this.api.count<this.__settings.shadowParams.frames&&this.api.count<this.__shadowParams.limit&&(this.reCalculate(),this.api.count++)}__randomiseLightPositions(){const e=Object.keys(this.__settings.light.direction).length;for(let t=0;t<this.__gLights.children.length;t++){const n=this.__gLights.children[t];if(Ki.seededRandom()>this.__settings.shadowParams.ambient)n.position.set(this.__settings.light.direction.x+this.__settings.shadowParams.radius*(.5-Ki.seededRandom()),this.__settings.light.direction.y+this.__settings.shadowParams.radius*(.5-Ki.seededRandom()),this.__settings.light.direction.z+this.__settings.shadowParams.radius*(.5-Ki.seededRandom()));else{const s=Math.acos(2*Ki.seededRandom()-1)-Math.PI/2,r=2*Math.PI*Ki.seededRandom();n.position.set(Math.cos(s)*Math.cos(r)*e,Math.abs(Math.cos(s)*Math.sin(r)*e),Math.sin(s)*e)}}}reCalculate(e=1){if(this.__camera){this.__settings.shadowMaterial.blend=Math.max(2,this.__settings.shadowParams.frames===1/0?this.__settings.shadowMaterial.blend:this.__settings.shadowParams.frames),this.__shadowParams.temporal?(this.__shadowMaterial.opacity=Math.min(this.__settings.shadowMaterial.opacity,this.__shadowMaterial.opacity+this.__settings.shadowMaterial.opacity/this.__settings.shadowMaterial.blend),this.__shadowMaterial.alphaTest=Math.min(this.__settings.shadowMaterial.alphaTest,this.__shadowMaterial.alphaTest+this.__settings.shadowMaterial.alphaTest/this.__settings.shadowMaterial.blend),this.__shadowMaterial.color.set(this.__settings.shadowMaterial.color)):(this.__shadowMaterial.opacity=this.__settings.shadowMaterial.opacity,this.__shadowMaterial.color.set(this.__settings.shadowMaterial.color),this.__shadowMaterial.alphaTest=this.__settings.shadowMaterial.alphaTest),this.__scene.add(this.__gLights),this.__progressiveLightMap.prepare();for(let t=0;t<e;t++)this.__randomiseLightPositions(),this.__progressiveLightMap.update(this.__camera,this.__settings.shadowMaterial.blend);this.__scene.remove(this.__gLights),this.__progressiveLightMap.finish()}}}class L6{constructor({scene:e,sceneHierarchyToCastShadow:t,targetRenderer:n,settings:s,appWcRef:r}){this._loggerContext="CONTACT SHADOWS",this.__enabled=!0,this.__settings={},this.__shadowState={shadow:{blur:4,darkness:.6,opacity:1},plane:{color:"#ffffff",opacity:0},showWireframe:!1},this.__shadowGroup=new In,this.__blurPlane={},this.__renderTarget={},this.__renderTargetBlur={},this.__shadowCamera={},this.__depthMaterial={},this.__horizontalBlurMaterial={},this.__verticalBlurMaterial={},this.__planeMaterial={},this.__appWcRef=r,this.__scene=e,this.__sceneHierarchyToCastShadow=t,this.__targetRenderer=n,this.__settings=s,this.__shadowState.shadow.opacity=this.__settings.intensity,this.__shadowState.shadow.blur=this.__settings.softness,this.__planeMaterial.opacity=this.__settings.intensity,this.__planeMaterial.needsUpdate=!0,this.setup()}isEnabled(){return this.__enabled}enable(){window.epigraph.logger.info({title:"Enabling Contact Shadows!",contextOverride:this._loggerContext}),this.__enabled=!0,this.__shadowGroup.visible=!0}disable(){window.epigraph.logger.info({title:"Disabling Contact Shadows!",contextOverride:this._loggerContext}),this.__enabled=!1,this.__shadowGroup.visible=!1}updateSettings(e){this.__settings=e,this.updateShadowIntensity(),this.updateShadowSoftness()}updateShadowSoftness(){this.__shadowState.shadow.blur=this.__settings.softness}updateShadowIntensity(){this.__shadowState.shadow.opacity=this.__settings.intensity,this.__planeMaterial.opacity=this.__settings.intensity,this.__planeMaterial.needsUpdate=!0}dispose(){window.epigraph.logger.info({title:"Disposing Contact Shadows!",contextOverride:this._loggerContext}),this.__onProductSettingUpdated&&this.__appWcRef.removeEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated),this.__renderTarget?.dispose(),this.__renderTargetBlur?.dispose(),this.__planeGeometry?.dispose(),this.__planeMaterial?.dispose?.(),this.__fillPlaneMaterial?.dispose?.(),this.__depthMaterial?.dispose?.(),this.__horizontalBlurMaterial?.dispose?.(),this.__verticalBlurMaterial?.dispose?.(),this.__shadowGroup?.removeFromParent(),this.__shadowGroup?.clear()}__blurShadow(e){this.__blurPlane.visible=!0,this.__blurPlane.material=this.__horizontalBlurMaterial,this.__blurPlane.material.uniforms.tDiffuse.value=this.__renderTarget.texture,this.__horizontalBlurMaterial.uniforms.h.value=e*1/256,this.__targetRenderer.setRenderTarget(this.__renderTargetBlur),this.__targetRenderer.render(this.__blurPlane,this.__shadowCamera),this.__blurPlane.material=this.__verticalBlurMaterial,this.__blurPlane.material.uniforms.tDiffuse.value=this.__renderTargetBlur.texture,this.__verticalBlurMaterial.uniforms.v.value=e*1/256,this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__blurPlane,this.__shadowCamera),this.__blurPlane.visible=!1}__setupEventListeners(){this.__onProductSettingUpdated=()=>{const e=this.__appWcRef.productSettings.shadows.contactShadows;this.updateSettings(e)},this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingUpdated)}setup(){if(!this.__enabled)return;const{planeLength:e,planeWidth:t,cameraHeight:n}=this.__settings,s=e,r=t,a=n;this.__shadowGroup.position.y=0,this.__scene.add(this.__shadowGroup),this.__renderTarget=new Sn(512,512),this.__renderTarget.texture.generateMipmaps=!1,this.__renderTargetBlur=new Sn(512,512),this.__renderTargetBlur.texture.generateMipmaps=!1;const o=new bs(r,s).rotateX(Math.PI/2);this.__planeGeometry=o,this.__planeMaterial=new Xn({map:this.__renderTarget.texture,opacity:this.__shadowState.shadow.opacity,transparent:!0,depthWrite:!1});const l=new Je(o,this.__planeMaterial);l.renderOrder=1,this.__shadowGroup.add(l),l.scale.y=-1,this.__blurPlane=new Je(o),this.__blurPlane.visible=!1,this.__shadowGroup.add(this.__blurPlane),this.__fillPlaneMaterial=new Xn({color:this.__shadowState.plane.color,opacity:this.__shadowState.plane.opacity,transparent:!0,depthWrite:!1});const c=new Je(o,this.__fillPlaneMaterial);c.rotateX(Math.PI),this.__shadowGroup.add(c),this.__shadowCamera=new Or(-r/2,r/2,s/2,-s/2,0,a),this.__shadowCamera.rotation.x=Math.PI/2,this.__shadowGroup.add(this.__shadowCamera),this.__depthMaterial=new gv,this.__depthMaterial.userData.darkness={value:this.__shadowState.shadow.darkness},this.__depthMaterial.onBeforeCompile=u=>{u.uniforms.darkness=this.__depthMaterial.userData.darkness,u.fragmentShader=`
|
|
13022
13022
|
uniform float darkness;
|
|
13023
13023
|
${u.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );")}
|
|
13024
13024
|
`},this.__depthMaterial.depthTest=!1,this.__depthMaterial.depthWrite=!1,this.__horizontalBlurMaterial=new kn(h2),this.__horizontalBlurMaterial.depthTest=!1,this.__verticalBlurMaterial=new kn(u2),this.__verticalBlurMaterial.depthTest=!1,this.__setupEventListeners()}reCalculate(){const e=this.__scene.background;this.__scene.background=null,this.__scene.overrideMaterial=this.__depthMaterial;const t=this.__targetRenderer.getClearAlpha();this.__targetRenderer.setClearAlpha(0),this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__sceneHierarchyToCastShadow,this.__shadowCamera),this.__scene.overrideMaterial=null,this.__blurShadow(this.__shadowState.shadow.blur),this.__blurShadow(this.__shadowState.shadow.blur*.4),this.__targetRenderer.setRenderTarget(null),this.__targetRenderer.setClearAlpha(t),this.__scene.background=e}}class N6{constructor(e,t,n,s,r){this.__appWcRef=e,this.__scene=t,this.__sceneHierarchyToCastShadow=n,this.__targetRenderer=s,this.__productSettings=r,this.init()}get accumulativeShadows(){return this.__accumulativeShadows}get contactShadows(){return this.__contactShadows}init(){this.updateShadowType(this.__productSettings.shadows.shadowType)}dispose(){this.__accumulativeShadows&&(this.__accumulativeShadows.dispose(),this.__accumulativeShadows=void 0),this.__contactShadows&&(this.__contactShadows.dispose(),this.__contactShadows=void 0)}updateShadowType(e){switch(e){case"accumulative":this.__accumulativeShadows||(this.__accumulativeShadows=new Q6({scene:this.__scene,targetRenderer:this.__targetRenderer,settings:this.__productSettings.shadows.accumulativeShadows,appWcRef:this.__appWcRef})),this.contactShadows?.disable(),this.accumulativeShadows?.enable();break;case"contact":this.__contactShadows||(this.__contactShadows=new L6({scene:this.__scene,sceneHierarchyToCastShadow:this.__sceneHierarchyToCastShadow,targetRenderer:this.__targetRenderer,settings:this.__productSettings.shadows.contactShadows,appWcRef:this.__appWcRef})),this.accumulativeShadows?.disable(),this.contactShadows?.enable();break;case"none":this.accumulativeShadows?.disable(),this.contactShadows?.disable();break}}}class P6{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,n,s){this.parseAsync(e,s).then(t).catch(n)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,quickLookCompatible:!1,maxTextureSize:1024},t);const n={},s="model.usda";n[s]=null;let r=rD();r+=k6(t);const a={},o={};e.traverseVisible(c=>{if(c.isMesh){const u=c.geometry,h=c.material;if(h.isMeshStandardMaterial){const d="geometries/Geometry_"+u.id+".usda";if(!(d in n)){const A=z6(u);n[d]=O6(A)}h.uuid in a||(a[h.uuid]=h),r+=G6(c,u,h)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",c)}else c.isCamera&&(r+=J6(c))}),r+=U6(),r+=W6(a,o,t.quickLookCompatible),n[s]=qh(r),r=null;for(const c in o){let u=o[c];if(u.isCompressedTexture===!0){if(this.textureUtils===null)throw new Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");u=await this.textureUtils.decompress(u)}const h=F6(u.image,u.flipY,t.maxTextureSize),d=await new Promise(A=>h.toBlob(A,"image/png",1));n[`textures/Texture_${c}.png`]=new Uint8Array(await d.arrayBuffer())}let l=0;for(const c in n){const u=n[c],h=34+c.length;l+=h;const d=l&63;if(d!==4){const A=64-d,p=new Uint8Array(A);n[c]=[u,{extra:{12345:p}}]}l=u.length}return AR(n,{level:0})}}function F6(i,e,t){if(typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&i instanceof ImageBitmap){const n=t/Math.max(i.width,i.height),s=document.createElement("canvas");s.width=i.width*Math.min(1,n),s.height=i.height*Math.min(1,n);const r=s.getContext("2d");return e===!0&&(r.translate(0,s.height),r.scale(1,-1)),r.drawImage(i,0,0,s.width,s.height),s}else throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const wi=7;function rD(){return`#usda 1.0
|
|
@@ -13172,7 +13172,7 @@ ${r.join(`
|
|
|
13172
13172
|
* https://github.com/yomotsu/camera-controls
|
|
13173
13173
|
* (c) 2017 @yomotsu
|
|
13174
13174
|
* Released under the MIT License.
|
|
13175
|
-
*/const Bn={LEFT:1,RIGHT:2,MIDDLE:4},te=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}),Qc={NONE:0,IN:1,OUT:-1};function Xo(i){return i.isPerspectiveCamera}function io(i){return i.isOrthographicCamera}const eo=Math.PI*2,bw=Math.PI/2,oD=1e-5,Wu=Math.PI/180;function er(i,e,t){return Math.max(e,Math.min(t,i))}function dn(i,e=oD){return Math.abs(i)<e}function qt(i,e,t=oD){return dn(i-e,t)}function vw(i,e){return Math.round(i/e)*e}function ju(i){return isFinite(i)?i:i<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Xu(i){return Math.abs(i)<Number.MAX_VALUE?i:i*(1/0)}function Kp(i,e,t,n,s=1/0,r){n=Math.max(1e-4,n);const a=2/n,o=a*r,l=1/(1+o+.48*o*o+.235*o*o*o);let c=i-e;const u=e,h=s*n;c=er(c,-h,h),e=i-c;const d=(t.value+a*c)*r;t.value=(t.value-a*d)*l;let A=e+(c+d)*l;return u-i>0==A>u&&(A=u,t.value=(A-u)/r),A}function xw(i,e,t,n,s=1/0,r,a){n=Math.max(1e-4,n);const o=2/n,l=o*r,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,d=e.z,A=i.x-u,p=i.y-h,g=i.z-d;const m=u,f=h,_=d,y=s*n,E=y*y,b=A*A+p*p+g*g;if(b>E){const P=Math.sqrt(b);A=A/P*y,p=p/P*y,g=g/P*y}u=i.x-A,h=i.y-p,d=i.z-g;const C=(t.x+o*A)*r,x=(t.y+o*p)*r,I=(t.z+o*g)*r;t.x=(t.x-o*C)*c,t.y=(t.y-o*x)*c,t.z=(t.z-o*I)*c,a.x=u+(A+C)*c,a.y=h+(p+x)*c,a.z=d+(g+I)*c;const v=m-i.x,w=f-i.y,S=_-i.z,B=a.x-m,T=a.y-f,D=a.z-_;return v*B+w*T+S*D>0&&(a.x=m,a.y=f,a.z=_,t.x=(a.x-m)/r,t.y=(a.y-f)/r,t.z=(a.z-_)/r),a}function my(i,e){e.set(0,0),i.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=i.length,e.y/=i.length}function _y(i,e){return io(i)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class tY{_listeners={};addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e)}}}const nY="3.1.2",Zp=1/8,iY=/Mac/.test(globalThis?.navigator?.platform);let dt,Cw,ef,yy,Wi,yt,Ft,Lc,Ju,yr,Er,Jo,Iw,ww,hs,Nc,Pc,Sw,Ey,Bw,by,vy,tf;class bh extends tY{static install(e){dt=e.THREE,Cw=Object.freeze(new dt.Vector3(0,0,0)),ef=Object.freeze(new dt.Vector3(0,1,0)),yy=Object.freeze(new dt.Vector3(0,0,1)),Wi=new dt.Vector2,yt=new dt.Vector3,Ft=new dt.Vector3,Lc=new dt.Vector3,Ju=new dt.Vector3,yr=new dt.Vector3,Er=new dt.Vector3,Jo=new dt.Vector3,Iw=new dt.Vector3,ww=new dt.Vector3,hs=new dt.Spherical,Nc=new dt.Spherical,Pc=new dt.Box3,Sw=new dt.Box3,Ey=new dt.Sphere,Bw=new dt.Quaternion,by=new dt.Quaternion,vy=new dt.Matrix4,tf=new dt.Raycaster}static get ACTION(){return te}minPolarAngle=0;maxPolarAngle=Math.PI;minAzimuthAngle=-1/0;maxAzimuthAngle=1/0;minDistance=Number.EPSILON;maxDistance=1/0;infinityDolly=!1;minZoom=.01;maxZoom=1/0;smoothTime=.25;draggingSmoothTime=.125;maxSpeed=1/0;azimuthRotateSpeed=1;polarRotateSpeed=1;dollySpeed=1;dollyDragInverted=!1;truckSpeed=2;dollyToCursor=!1;dragToOffset=!1;boundaryFriction=0;restThreshold=.01;colliderMeshes=[];mouseButtons;touches;cancel=()=>{};lockPointer;unlockPointer;_enabled=!0;_camera;_yAxisUpSpace;_yAxisUpSpaceInverse;_state=te.NONE;_domElement;_viewport=null;_target;_targetEnd;_focalOffset;_focalOffsetEnd;_spherical;_sphericalEnd;_lastDistance;_zoom;_zoomEnd;_lastZoom;_cameraUp0;_target0;_position0;_zoom0;_focalOffset0;_dollyControlCoord;_changedDolly=0;_changedZoom=0;_nearPlaneCorners;_hasRested=!0;_boundary;_boundaryEnclosesCamera=!1;_needsUpdate=!0;_updatedLastTime=!1;_elementRect=new DOMRect;_isDragging=!1;_dragNeedsUpdate=!0;_activePointers=[];_lockedPointer=null;_interactiveArea=new DOMRect(0,0,1,1);_isUserControllingRotate=!1;_isUserControllingDolly=!1;_isUserControllingTruck=!1;_isUserControllingOffset=!1;_isUserControllingZoom=!1;_lastDollyDirection=Qc.NONE;_thetaVelocity={value:0};_phiVelocity={value:0};_radiusVelocity={value:0};_targetVelocity=new dt.Vector3;_focalOffsetVelocity=new dt.Vector3;_zoomVelocity={value:0};set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),typeof dt>"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 dt.Quaternion().setFromUnitVectors(this._camera.up,ef),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=te.NONE,this._target=new dt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new dt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new dt.Spherical().setFromVector3(yt.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 dt.Vector3,new dt.Vector3,new dt.Vector3,new dt.Vector3],this._updateNearPlaneCorners(),this._boundary=new dt.Box3(new dt.Vector3(-1/0,-1/0,-1/0),new dt.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 dt.Vector2,this.mouseButtons={left:te.ROTATE,middle:te.DOLLY,right:te.TRUCK,wheel:Xo(this._camera)?te.DOLLY:io(this._camera)?te.ZOOM:te.NONE},this.touches={one:te.TOUCH_ROTATE,two:Xo(this._camera)?te.TOUCH_DOLLY_TRUCK:io(this._camera)?te.TOUCH_ZOOM_TRUCK:te.NONE,three:te.TOUCH_TRUCK};const n=new dt.Vector2,s=new dt.Vector2,r=new dt.Vector2,a=f=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),b=f.clientX/E.width,C=f.clientY/E.height;if(b<this._interactiveArea.left||b>this._interactiveArea.right||C<this._interactiveArea.top||C>this._interactiveArea.bottom)return}const _=f.pointerType!=="mouse"?null:(f.buttons&Bn.LEFT)===Bn.LEFT?Bn.LEFT:(f.buttons&Bn.MIDDLE)===Bn.MIDDLE?Bn.MIDDLE:(f.buttons&Bn.RIGHT)===Bn.RIGHT?Bn.RIGHT:null;if(_!==null){const E=this._findPointerByMouseButton(_);E&&this._disposePointer(E)}if((f.buttons&Bn.LEFT)===Bn.LEFT&&this._lockedPointer)return;const y={pointerId:f.pointerId,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:_};this._activePointers.push(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,d(f)},o=f=>{f.cancelable&&f.preventDefault();const _=f.pointerId,y=this._lockedPointer||this._findPointerById(_);if(y){if(y.clientX=f.clientX,y.clientY=f.clientY,y.deltaX=f.movementX,y.deltaY=f.movementY,this._state=0,f.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&&(f.buttons&Bn.LEFT)===Bn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);A()}},l=f=>{const _=this._findPointerById(f.pointerId);if(!(_&&_===this._lockedPointer)){if(_&&this._disposePointer(_),f.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=te.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=te.NONE;p()}};let c=-1;const u=f=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===te.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),I=f.clientX/x.width,v=f.clientY/x.height;if(I<this._interactiveArea.left||I>this._interactiveArea.right||v<this._interactiveArea.top||v>this._interactiveArea.bottom)return}if(f.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===te.ROTATE||this.mouseButtons.wheel===te.TRUCK){const x=performance.now();c-x<1e3&&this._getClientRect(this._elementRect),c=x}const _=iY?-1:-3,y=f.deltaMode===1&&!f.ctrlKey?f.deltaY/_:f.deltaY/(_*10),E=this.dollyToCursor?(f.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(f.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(f.ctrlKey?te.ZOOM:this.mouseButtons.wheel){case te.ROTATE:{this._rotateInternal(f.deltaX,f.deltaY),this._isUserControllingRotate=!0;break}case te.TRUCK:{this._truckInternal(f.deltaX,f.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case te.SCREEN_PAN:{this._truckInternal(f.deltaX,f.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case te.OFFSET:{this._truckInternal(f.deltaX,f.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case te.DOLLY:{this._dollyInternal(-y,E,b),this._isUserControllingDolly=!0;break}case te.ZOOM:{this._zoomInternal(-y,E,b),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=f=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===bh.ACTION.NONE){const _=f instanceof PointerEvent?f.pointerId:0,y=this._findPointerById(_);y&&this._disposePointer(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}f.preventDefault()}},d=f=>{if(!this._enabled)return;if(my(this._activePointers,Wi),this._getClientRect(this._elementRect),n.copy(Wi),s.copy(Wi),this._activePointers.length>=2){const y=Wi.x-this._activePointers[1].clientX,E=Wi.y-this._activePointers[1].clientY,b=Math.sqrt(y*y+E*E);r.set(0,b);const C=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,x=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(C,x)}if(this._state=0,!f)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in f&&f.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&&(f.buttons&Bn.LEFT)===Bn.LEFT&&(this._state=this._state|this.mouseButtons.left),(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.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&te.TRUCK)===te.TRUCK||(this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&te.DOLLY)===te.DOLLY||(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&te.ZOOM)===te.ZOOM||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},A=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,my(this._activePointers,Wi);const _=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,y=_?-_.deltaX:s.x-Wi.x,E=_?-_.deltaY:s.y-Wi.y;if(s.copy(Wi),((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(y,E),this._isUserControllingRotate=!0),(this._state&te.DOLLY)===te.DOLLY||(this._state&te.ZOOM)===te.ZOOM){const b=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,C=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,x=this.dollyDragInverted?-1:1;(this._state&te.DOLLY)===te.DOLLY?(this._dollyInternal(x*E*Zp,b,C),this._isUserControllingDolly=!0):(this._zoomInternal(x*E*Zp,b,C),this._isUserControllingZoom=!0)}if((this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE){const b=Wi.x-this._activePointers[1].clientX,C=Wi.y-this._activePointers[1].clientY,x=Math.sqrt(b*b+C*C),I=r.y-x;r.set(0,x);const v=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET?(this._dollyInternal(I*Zp,v,w),this._isUserControllingDolly=!0):(this._zoomInternal(I*Zp,v,w),this._isUserControllingZoom=!0)}((this._state&te.TRUCK)===te.TRUCK||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(y,E,!1,!1),this._isUserControllingTruck=!0),((this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(y,E,!1,!0),this._isUserControllingTruck=!0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(y,E,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},p=()=>{my(this._activePointers,Wi),s.copy(Wi),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",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),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",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",m),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),d())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),this._domElement?.ownerDocument.exitPointerLock(),this._domElement?.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement?.ownerDocument.removeEventListener("pointerlockerror",m),this.cancel()};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},m=()=>{this.unlockPointer()};this._addAllEventListeners=f=>{this._domElement=f,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",m))},this.cancel=()=>{this._state!==te.NONE&&(this._state=te.NONE,this._activePointers.length=0,p())},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=er(e.width,0,1),this._interactiveArea.height=er(e.height,0,1),this._interactiveArea.x=er(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=er(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}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,n=!1){this._isUserControllingRotate=!1;const s=er(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=er(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!n||qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0,this._dollyToNoClamp(er(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=qt(a,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ju).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=er(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||qt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),yr.multiplyScalar(e),Er.multiplyScalar(-t);const s=yt.copy(yr).add(Er),r=Ft.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){yt.setFromMatrixColumn(this._camera.matrix,0),yt.crossVectors(this._camera.up,yt),yt.multiplyScalar(e);const n=Ft.copy(this._targetEnd).add(yt);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return yt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+yt.x,this._targetEnd.y+yt.y,this._targetEnd.z+yt.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const r=yt.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const a=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,n,s=!1){const o=yt.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?Pc.copy(e):Pc.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=vw(this._sphericalEnd.theta,bw),h=vw(this._sphericalEnd.phi,bw);l.push(this.rotateTo(u,h,t));const d=yt.setFromSpherical(this._sphericalEnd).normalize(),A=Bw.setFromUnitVectors(d,yy),p=qt(Math.abs(d.y),1);p&&A.multiply(by.setFromAxisAngle(ef,u)),A.multiply(this._yAxisUpSpaceInverse);const g=Sw.makeEmpty();Ft.copy(c.min).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setX(c.max.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setY(c.max.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setZ(c.min.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setZ(c.max.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setY(c.min.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setX(c.min.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).applyQuaternion(A),g.expandByPoint(Ft),g.min.x-=s,g.min.y-=a,g.max.x+=r,g.max.y+=o,A.setFromUnitVectors(yy,d),p&&A.premultiply(by.invert()),A.premultiply(this._yAxisUpSpace);const m=g.getSize(yt),f=g.getCenter(Ft).applyQuaternion(A);if(Xo(this._camera)){const _=this.getDistanceToFitBox(m.x,m.y,m.z,n);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(io(this._camera)){const _=this._camera,y=_.right-_.left,E=_.top-_.bottom,b=n?Math.max(y/m.x,E/m.y):Math.min(y/m.x,E/m.y);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.zoomTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],r="isObject3D"in e?bh.createBoundingSphere(e,Ey):Ey.copy(e);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),Xo(this._camera)){const a=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(a,t))}else if(io(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*r.radius,c=Math.min(a/l,o/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,r,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const l=Ft.set(s,r,a),c=yt.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerp(e,t,n,s=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const r=yt.set(...e.target);if("spherical"in e)hs.set(...e.spherical);else{const h=Ft.set(...e.position);hs.setFromVector3(h.sub(r).applyQuaternion(this._yAxisUpSpace))}const a=Lc.set(...t.target);if("spherical"in t)Nc.set(...t.spherical);else{const h=Ft.set(...t.position);Nc.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(r.lerp(a,n));const o=Nc.theta-hs.theta,l=Nc.phi-hs.phi,c=Nc.radius-hs.radius;this._sphericalEnd.set(hs.radius+c*n,hs.phi+l*n,hs.theta+o*n),this._needsUpdate=!0,s||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,s,r,a,o,l,c,u,h,d,A,p=!1){return this.lerp({position:[e,t,n],target:[s,r,a]},{position:[o,l,c],target:[u,h,d]},A,p)}setPosition(e,t,n,s=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,n,s=!1){const r=this.getPosition(yt),a=this.setLookAt(r.x,r.y,r.z,e,t,n,s);return this._sphericalEnd.phi=er(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,n,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const r=!s||qt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&qt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&qt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),yr.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Er.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Jo.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=yt.set(e,t,n),r=s.distanceTo(this._camera.position),a=s.sub(this._camera.position);yr.multiplyScalar(a.x),Er.multiplyScalar(a.y),Jo.multiplyScalar(a.z),yt.copy(yr).add(Er).add(Jo),yt.z=yt.z+r,this.dollyTo(r,!1),this.setFocalOffset(-yt.x,yt.y,-yt.z,!1),this.moveTo(e,t,n,!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,n,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new dt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(_y(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,a=this._camera.getEffectiveFOV()*Wu,o=this._camera.aspect;return((s?r>o:r<o)?t:e/o)*.5/Math.tan(a*.5)+n*.5}getDistanceToFitSphere(e){if(_y(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Wu,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:n;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new dt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%eo+eo)%eo,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=eo),this._spherical.theta+=eo*Math.round((this._sphericalEnd.theta-this._spherical.theta)/eo),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(!qt(this._camera.up.x,this._cameraUp0.x)||!qt(this._camera.up.y,this._cameraUp0.y)||!qt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.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,ef),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=yt.subVectors(this._target,this._camera.position).normalize(),t=Ft.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,r=Iw.subVectors(this._targetEnd,this._target),a=ww.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(dn(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Kp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Kp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const h=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Kp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,h,this.maxSpeed,e),this._needsUpdate=!0}if(dn(r.x)&&dn(r.y)&&dn(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const h=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;xw(this._target,this._targetEnd,this._targetVelocity,h,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(dn(a.x)&&dn(a.y)&&dn(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const h=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;xw(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,h,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(dn(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const h=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Kp(this._zoom,this._zoomEnd,this._zoomVelocity,h,1/0,e)}if(this.dollyToCursor){if(Xo(this._camera)&&this._changedDolly!==0){const h=this._spherical.radius-this._lastDistance,d=this._camera,A=this._getCameraDirection(Ju),p=yt.copy(A).cross(d.up).normalize();p.lengthSq()===0&&(p.x=1);const g=Ft.crossVectors(p,A),m=this._sphericalEnd.radius*Math.tan(d.getEffectiveFOV()*Wu*.5),_=(this._sphericalEnd.radius-h-this._sphericalEnd.radius)/this._sphericalEnd.radius,y=Lc.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*m*d.aspect)).add(g.multiplyScalar(this._dollyControlCoord.y*m)),E=yt.copy(this._targetEnd).lerp(y,_),b=this._lastDollyDirection===Qc.IN&&this._spherical.radius<=this.minDistance,C=this._lastDollyDirection===Qc.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(b||C)){this._sphericalEnd.radius-=h,this._spherical.radius-=h;const I=Ft.copy(A).multiplyScalar(-h);E.add(I)}this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedDolly-=h,dn(this._changedDolly)&&(this._changedDolly=0)}else if(io(this._camera)&&this._changedZoom!==0){const h=this._zoom-this._lastZoom,d=this._camera,A=yt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(d.near+d.far)/(d.near-d.far)).unproject(d),p=Ft.set(0,0,-1).applyQuaternion(d.quaternion),g=Lc.copy(A).add(p.multiplyScalar(-A.dot(d.up))),f=-(this._zoom-h-this._zoom)/this._zoom,_=this._getCameraDirection(Ju),y=this._targetEnd.dot(_),E=yt.copy(this._targetEnd).lerp(g,f),b=E.dot(_),C=_.multiplyScalar(b-y);E.sub(C),this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedZoom-=h,dn(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 l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!dn(this._focalOffset.x)||!dn(this._focalOffset.y)||!dn(this._focalOffset.z))&&(this._camera.matrix.compose(this._camera.position,this._camera.quaternion,this._camera.scale),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),Jo.setFromMatrixColumn(this._camera.matrix,2),yr.multiplyScalar(this._focalOffset.x),Er.multiplyScalar(-this._focalOffset.y),Jo.multiplyScalar(this._focalOffset.z),yt.copy(yr).add(Er).add(Jo),this._camera.position.add(yt),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),yt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),dn(t,this.restThreshold)&&dn(n,this.restThreshold)&&dn(s,this.restThreshold)&&dn(r.x,this.restThreshold)&&dn(r.y,this.restThreshold)&&dn(r.z,this.restThreshold)&&dn(a.x,this.restThreshold)&&dn(a.y,this.restThreshold)&&dn(a.z,this.restThreshold)&&dn(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ju(this.maxDistance),minZoom:this.minZoom,maxZoom:ju(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ju(this.maxPolarAngle),minAzimuthAngle:ju(this.minAzimuthAngle),maxAzimuthAngle:ju(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:yt.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 n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Xu(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Xu(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Xu(n.maxPolarAngle),this.minAzimuthAngle=Xu(n.minAzimuthAngle),this.maxAzimuthAngle=Xu(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),hs.setFromVector3(yt.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(hs.theta,hs.phi,t),this.dollyTo(hs.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.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",nY),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,n){const s=t.lengthSq();if(s===0)return e;const r=Ft.copy(t).add(e),o=this._boundary.clampPoint(r,Lc).sub(r),l=o.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(n===0)return e.add(t).add(o);{const c=1+n*l/t.dot(o);return e.add(Ft.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Xo(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*Wu,s=Math.tan(n*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(io(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,r=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,a,0),this._nearPlaneCorners[3].set(n,a,0)}}_truckInternal=(e,t,n,s)=>{let r,a;if(Xo(this._camera)){const o=yt.copy(this._camera.position).sub(this._target),l=this._camera.getEffectiveFOV()*Wu,c=o.length()*Math.tan(l*.5);r=this.truckSpeed*e*c/this._elementRect.height,a=this.truckSpeed*t*c/this._elementRect.height}else if(io(this._camera)){const o=this._camera;r=this.truckSpeed*e*(o.right-o.left)/o.zoom/this._elementRect.width,a=this.truckSpeed*t*(o.top-o.bottom)/o.zoom/this._elementRect.height}else return;s?(n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(r,0,!0),this.forward(-a,!0)):n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(r,a,!0)};_rotateInternal=(e,t)=>{const n=eo*this.azimuthRotateSpeed*e/this._elementRect.height,s=eo*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(n,s,!0)};_dollyInternal=(e,t,n)=>{const s=Math.pow(.95,-e*this.dollySpeed),r=this._sphericalEnd.radius,a=this._sphericalEnd.radius*s,o=er(a,this.minDistance,this.maxDistance),l=o-a;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(l,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-r,this._dollyControlCoord.set(t,n)),this._lastDollyDirection=Math.sign(-e)};_zoomInternal=(e,t,n)=>{const s=Math.pow(.95,e*this.dollySpeed),r=this._zoom,a=this._zoom*s;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-r,this._dollyControlCoord.set(t,n))};_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||_y(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ju);vy.lookAt(Cw,n,this._camera.up);for(let s=0;s<4;s++){const r=Ft.copy(this._nearPlaneCorners[s]);r.applyMatrix4(vy);const a=Lc.addVectors(this._target,r);tf.set(a,n),tf.far=this._spherical.radius+1;const o=tf.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[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 n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_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 dt.Sphere){const n=t,s=n.center;Pc.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&Pc.expandByObject(a)}),Pc.getCenter(s);let r=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a;if(!o.geometry)return;const l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let h=0,d=u.count;h<d;h++)yt.fromBufferAttribute(u,h),r=Math.max(r,s.distanceToSquared(yt))}),n.radius=Math.sqrt(r),n}}class Tw{constructor(e){this.__position=new Q,this.__target=new Q,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,n){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(n)}getTarget(){return this.__target}setTarget(e,t,n){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(n)}}class Gg extends Hv{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainRenderer={},this.__mainCameraControls={},this.__cameraDirection=new Q,this.__cameraSpherical=new Ll,this.__savedCameraState={position:new Q,target:new Q,focalLength:0},this.__currentCameraPosition=new Q,this.__currentTargetPosition=new Q,this.__touchScrollState=null,this.__pointerZoomEnabled=!1}static{this.TAU=Math.PI*2}get cameraActions(){return bh.ACTION}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}getCurrentCameraTransforms(){return this.__cameras.main.getWorldPosition(this.__currentCameraPosition),this.__mainCameraControls.getTarget(this.__currentTargetPosition),{position:this.__currentCameraPosition,target:this.__currentTargetPosition,focalLength:this.__cameras.main.getFocalLength()}}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.getSceneSphericalBounds().clone();if(t.isEmpty()||t.radius<=0)return;let n=this._appWcRef.productSettings.camera.cameraBoundsMultiplier;return this._appWcRef.cameraBoundsMultiplier!==0&&(n=this._appWcRef.cameraBoundsMultiplier),this._appWcRef.aspectRatio<1&&(n=1),t.radius=t.radius*n,await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(){const e=this.__mainCameraControls,t=e.currentAction===e.mouseButtons?.right||e.currentAction===e.touches?.two;this.__cameraSettings.canPan&&t?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):e.currentAction===e.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),this.__savedCameraState.focalLength=this.getCameraFocalLength()}resetCurrentCameraTransformsToLastSavedState(e=!0){this.moveCameraToLocation({newCameraTransforms:this.__savedCameraState,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t}){this._appWcRef.productSettings.camera.canZoom===!1&&(e=null,t=null),e===null&&(e=.001),t===null&&(t=1/0);const n=this._appWcRef.getSceneSphericalBounds().radius;n<0||(this.__mainCameraControls.minDistance=Math.min(e,n),this.__mainCameraControls.maxDistance=n+t)}enableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.ROTATE,this.__mainCameraControls.touches.one=this.cameraActions.TOUCH_ROTATE}disableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.NONE,this.__mainCameraControls.touches.one=this.cameraActions.NONE}enablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY_TRUCK,this.__mainCameraControls.mouseButtons.right=this.cameraActions.TRUCK}disablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.right=this.cameraActions.NONE}enableZoomControls(){if(this._appWcRef.disableZoom){this.disableZoomControls();return}this.__pointerZoomEnabled=!0,this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.DOLLY}disableZoomControls(){this.__pointerZoomEnabled=!1,this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.NONE}enableCameraZoomLimits(e){this.setCameraZoomLimits({minDistance:e.minDistance,maxDistance:e.maxDistance})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:null,maxDistance:null})}enableCameraRotationLimits(e){const{infinitePolarAngle:t,minPolarAngle:n,maxPolarAngle:s,infiniteAzimuthAngle:r,minAzimuthAngle:a,maxAzimuthAngle:o}=e;this.__mainCameraControls.minPolarAngle=t?-1/0:n,this.__mainCameraControls.maxPolarAngle=t?1/0:s,this.__mainCameraControls.minAzimuthAngle=r?-1/0:a,this.__mainCameraControls.maxAzimuthAngle=r?1/0:o}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}updateCameraSettings(e){this.__cameraSettings=JSON.parse(JSON.stringify(e)),this.enableRotationControls();const{canPan:t,canZoom:n}=e;n?this.enableZoomControls():this.disableZoomControls(),t?this.enablePanControls():this.disablePanControls(),this.__mainCameraControls.mouseButtons.middle=this.cameraActions.NONE,this.__mainCameraControls.enabled=!0,this.__cameras.main.setFocalLength(e.focalLength),this.__cameras.main.near=e.nearClip,this.__cameras.main.far=e.farClip,this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e),this._appWcRef.transparentBackground===!1&&(this.__mainRenderer.setClearColor(e.backgroundColor),this.__mainRenderer.setClearAlpha(e.backgroundAlpha))}normalizeAngle(e){return Ki.euclideanModulo(e,Gg.TAU)}absoluteAngle(e,t){const n=e-t;return Ki.euclideanModulo(n+Math.PI,Gg.TAU)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:n=!0,targetCameraControlsRef:s=this.__mainCameraControls,ignoreCameraLimits:r=!1}){e instanceof Tw||(e=new Tw(e));const a=e.getPosition(),o=e.getTarget();if(s.enabled=!1,r===!0)s.setLookAt(a.x,a.y,a.z,o.x,o.y,o.z,n),s.normalizeRotations();else{this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(a,o),this.__cameraDirection.normalize();const l=a.distanceTo(o);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const c=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(s.azimuthAngle)),u=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(s.polarAngle));s.rotate(c,u,n),s.moveTo(o.x,o.y,o.z,n),s.dollyTo(l,n)}t||(s.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:n,transition:s=!0,targetCameraControlsRef:r=this.__mainCameraControls}){e&&r.rotateAzimuthTo(e,s),t&&r.rotatePolarTo(t,s),n&&r.dollyTo(n,s)}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 n of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+n,!0)}}__onProductSettingsUpdated(){this.updateCameraSettings(this._appWcRef.productSettings.camera),this.fitCameraToSceneBounds()}__onCameraMoveToTransform(e){e.detail.saveFirst&&this.saveCurrentCameraTransforms(),this.moveCameraToLocation({newCameraTransforms:e.detail.cameraTransforms,ignoreCameraLimits:e.detail.ignoreCameraLimits})}__onSceneBoundsChanged(){this.__mainCameraControls.setBoundary(this._appWcRef.getSceneBounds())}__setupTouchScrollDetection(){if(!("ontouchstart"in window||navigator.maxTouchPoints>0))return;const t=this.__mainRenderer.domElement,n=this.__mainCameraControls;t.style.touchAction="pan-y",new MutationObserver(()=>{t.style.touchAction!=="pan-y"&&(t.style.touchAction="pan-y")}).observe(t,{attributeFilter:["style"]});const r=5;t.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(this.__touchScrollState={startX:a.clientX,startY:a.clientY,decided:!1,isVerticalScroll:!1})}),document.addEventListener("pointermove",a=>{if(!(!this.__touchScrollState||a.pointerType!=="touch")){if(!this.__touchScrollState.decided){const o=Math.abs(a.clientX-this.__touchScrollState.startX),l=Math.abs(a.clientY-this.__touchScrollState.startY);if(o<r&&l<r)return;this.__touchScrollState.decided=!0,this.__touchScrollState.isVerticalScroll=l>o,this.__touchScrollState.isVerticalScroll&&n.cancel()}this.__touchScrollState.isVerticalScroll&&a.stopImmediatePropagation()}},{capture:!0}),document.addEventListener("pointerup",a=>{!this.__touchScrollState||a.pointerType!=="touch"||(this.__touchScrollState=null)},{capture:!0})}__onWheel(e){if(!e.ctrlKey||!this.__pointerZoomEnabled)return;e.preventDefault(),e.stopImmediatePropagation();const t=new WheelEvent("wheel",{deltaX:e.deltaX,deltaY:e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,ctrlKey:!1,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:e.bubbles,cancelable:e.cancelable});e.target?.dispatchEvent(t)}__setupTrackpadPinchAsDollyHandler(){this.__mainRenderer.domElement.addEventListener("wheel",this.__onWheel.bind(this),{passive:!1})}__setupEventListeners(){this.__setupTouchScrollDetection(),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart()}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingsUpdated.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,this.__onCameraMoveToTransform.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.sceneBoundsChanged.name,this.__onSceneBoundsChanged.bind(this))}async setup({mainRenderer:e}){this.__mainRenderer=e;const t=new $n(75,window.innerWidth/window.innerHeight,.1,1e3);this.__cameras={main:t,screenshot:t.clone()},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(1);const n={Vector2:pe,Vector3:Q,Vector4:Mt,Quaternion:Yt,Matrix4:We,Spherical:Ll,Box3:Rn,Sphere:ts,Raycaster:vv};bh.install({THREE:n}),this.__setupTrackpadPinchAsDollyHandler(),this.__mainCameraControls=new bh(this.__cameras.main,e.domElement),this.__setupEventListeners()}}const sY='@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: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}',rY={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"}}}},lD={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:"Helvetica Neue",$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)"}}}},de={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 oe(i){const e=/\{Primitives\.(.*?)}/,t=String(i).match(e),n=/\{BrandPrimitives\.(.*?)}/,s=String(i).match(n);let r=i;if(t){const a=t[1].split(".");r=rY[a[0]][a[1]][a[2]].$value}else if(s){const a=s[1].split("."),o=lD[a[0]][a[1]][a[2]],l=o.$web;r=`${l.substring(0,l.length-1)}, ${o.$value})`}return zi(r)}const Vv={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 aY(){const i={};for(const[e,t]of Object.entries(lD))for(const[n,s]of Object.entries(t))for(const[r,a]of Object.entries(s)){const o=`${e}${n}${r}`;i[o]={name:zi(a.$web),defaultValue:a.$value,argType:{control:a.$type}}}return i}const oY=aY(),jh={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 lY=Object.defineProperty,du=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&lY(e,t,s),s};const Jl=class cD extends mh{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=jh.theme.defaultValue.toString(),this.size=jh.size.defaultValue.toString(),cD.ensureFontsAreLoaded(),this.addEventListener("click",this.doClick),this.addEventListener("pointerover",this.doHoverStart),this.addEventListener("pointerleave",this.doHoverEnd)}static{this.styles=[ht`
|
|
13175
|
+
*/const Bn={LEFT:1,RIGHT:2,MIDDLE:4},te=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}),Qc={NONE:0,IN:1,OUT:-1};function Xo(i){return i.isPerspectiveCamera}function io(i){return i.isOrthographicCamera}const eo=Math.PI*2,bw=Math.PI/2,oD=1e-5,Wu=Math.PI/180;function er(i,e,t){return Math.max(e,Math.min(t,i))}function dn(i,e=oD){return Math.abs(i)<e}function qt(i,e,t=oD){return dn(i-e,t)}function vw(i,e){return Math.round(i/e)*e}function ju(i){return isFinite(i)?i:i<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Xu(i){return Math.abs(i)<Number.MAX_VALUE?i:i*(1/0)}function Kp(i,e,t,n,s=1/0,r){n=Math.max(1e-4,n);const a=2/n,o=a*r,l=1/(1+o+.48*o*o+.235*o*o*o);let c=i-e;const u=e,h=s*n;c=er(c,-h,h),e=i-c;const d=(t.value+a*c)*r;t.value=(t.value-a*d)*l;let A=e+(c+d)*l;return u-i>0==A>u&&(A=u,t.value=(A-u)/r),A}function xw(i,e,t,n,s=1/0,r,a){n=Math.max(1e-4,n);const o=2/n,l=o*r,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,d=e.z,A=i.x-u,p=i.y-h,g=i.z-d;const m=u,f=h,_=d,y=s*n,E=y*y,b=A*A+p*p+g*g;if(b>E){const P=Math.sqrt(b);A=A/P*y,p=p/P*y,g=g/P*y}u=i.x-A,h=i.y-p,d=i.z-g;const C=(t.x+o*A)*r,x=(t.y+o*p)*r,I=(t.z+o*g)*r;t.x=(t.x-o*C)*c,t.y=(t.y-o*x)*c,t.z=(t.z-o*I)*c,a.x=u+(A+C)*c,a.y=h+(p+x)*c,a.z=d+(g+I)*c;const v=m-i.x,w=f-i.y,S=_-i.z,B=a.x-m,T=a.y-f,D=a.z-_;return v*B+w*T+S*D>0&&(a.x=m,a.y=f,a.z=_,t.x=(a.x-m)/r,t.y=(a.y-f)/r,t.z=(a.z-_)/r),a}function my(i,e){e.set(0,0),i.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=i.length,e.y/=i.length}function _y(i,e){return io(i)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class tY{_listeners={};addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,e)}}}const nY="3.1.2",Zp=1/8,iY=/Mac/.test(globalThis?.navigator?.platform);let dt,Cw,ef,yy,Wi,yt,Ft,Lc,Ju,yr,Er,Jo,Iw,ww,hs,Nc,Pc,Sw,Ey,Bw,by,vy,tf;class bh extends tY{static install(e){dt=e.THREE,Cw=Object.freeze(new dt.Vector3(0,0,0)),ef=Object.freeze(new dt.Vector3(0,1,0)),yy=Object.freeze(new dt.Vector3(0,0,1)),Wi=new dt.Vector2,yt=new dt.Vector3,Ft=new dt.Vector3,Lc=new dt.Vector3,Ju=new dt.Vector3,yr=new dt.Vector3,Er=new dt.Vector3,Jo=new dt.Vector3,Iw=new dt.Vector3,ww=new dt.Vector3,hs=new dt.Spherical,Nc=new dt.Spherical,Pc=new dt.Box3,Sw=new dt.Box3,Ey=new dt.Sphere,Bw=new dt.Quaternion,by=new dt.Quaternion,vy=new dt.Matrix4,tf=new dt.Raycaster}static get ACTION(){return te}minPolarAngle=0;maxPolarAngle=Math.PI;minAzimuthAngle=-1/0;maxAzimuthAngle=1/0;minDistance=Number.EPSILON;maxDistance=1/0;infinityDolly=!1;minZoom=.01;maxZoom=1/0;smoothTime=.25;draggingSmoothTime=.125;maxSpeed=1/0;azimuthRotateSpeed=1;polarRotateSpeed=1;dollySpeed=1;dollyDragInverted=!1;truckSpeed=2;dollyToCursor=!1;dragToOffset=!1;boundaryFriction=0;restThreshold=.01;colliderMeshes=[];mouseButtons;touches;cancel=()=>{};lockPointer;unlockPointer;_enabled=!0;_camera;_yAxisUpSpace;_yAxisUpSpaceInverse;_state=te.NONE;_domElement;_viewport=null;_target;_targetEnd;_focalOffset;_focalOffsetEnd;_spherical;_sphericalEnd;_lastDistance;_zoom;_zoomEnd;_lastZoom;_cameraUp0;_target0;_position0;_zoom0;_focalOffset0;_dollyControlCoord;_changedDolly=0;_changedZoom=0;_nearPlaneCorners;_hasRested=!0;_boundary;_boundaryEnclosesCamera=!1;_needsUpdate=!0;_updatedLastTime=!1;_elementRect=new DOMRect;_isDragging=!1;_dragNeedsUpdate=!0;_activePointers=[];_lockedPointer=null;_interactiveArea=new DOMRect(0,0,1,1);_isUserControllingRotate=!1;_isUserControllingDolly=!1;_isUserControllingTruck=!1;_isUserControllingOffset=!1;_isUserControllingZoom=!1;_lastDollyDirection=Qc.NONE;_thetaVelocity={value:0};_phiVelocity={value:0};_radiusVelocity={value:0};_targetVelocity=new dt.Vector3;_focalOffsetVelocity=new dt.Vector3;_zoomVelocity={value:0};set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),typeof dt>"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 dt.Quaternion().setFromUnitVectors(this._camera.up,ef),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=te.NONE,this._target=new dt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new dt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new dt.Spherical().setFromVector3(yt.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 dt.Vector3,new dt.Vector3,new dt.Vector3,new dt.Vector3],this._updateNearPlaneCorners(),this._boundary=new dt.Box3(new dt.Vector3(-1/0,-1/0,-1/0),new dt.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 dt.Vector2,this.mouseButtons={left:te.ROTATE,middle:te.DOLLY,right:te.TRUCK,wheel:Xo(this._camera)?te.DOLLY:io(this._camera)?te.ZOOM:te.NONE},this.touches={one:te.TOUCH_ROTATE,two:Xo(this._camera)?te.TOUCH_DOLLY_TRUCK:io(this._camera)?te.TOUCH_ZOOM_TRUCK:te.NONE,three:te.TOUCH_TRUCK};const n=new dt.Vector2,s=new dt.Vector2,r=new dt.Vector2,a=f=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),b=f.clientX/E.width,C=f.clientY/E.height;if(b<this._interactiveArea.left||b>this._interactiveArea.right||C<this._interactiveArea.top||C>this._interactiveArea.bottom)return}const _=f.pointerType!=="mouse"?null:(f.buttons&Bn.LEFT)===Bn.LEFT?Bn.LEFT:(f.buttons&Bn.MIDDLE)===Bn.MIDDLE?Bn.MIDDLE:(f.buttons&Bn.RIGHT)===Bn.RIGHT?Bn.RIGHT:null;if(_!==null){const E=this._findPointerByMouseButton(_);E&&this._disposePointer(E)}if((f.buttons&Bn.LEFT)===Bn.LEFT&&this._lockedPointer)return;const y={pointerId:f.pointerId,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:_};this._activePointers.push(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,d(f)},o=f=>{f.cancelable&&f.preventDefault();const _=f.pointerId,y=this._lockedPointer||this._findPointerById(_);if(y){if(y.clientX=f.clientX,y.clientY=f.clientY,y.deltaX=f.movementX,y.deltaY=f.movementY,this._state=0,f.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&&(f.buttons&Bn.LEFT)===Bn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);A()}},l=f=>{const _=this._findPointerById(f.pointerId);if(!(_&&_===this._lockedPointer)){if(_&&this._disposePointer(_),f.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=te.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=te.NONE;p()}};let c=-1;const u=f=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===te.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),I=f.clientX/x.width,v=f.clientY/x.height;if(I<this._interactiveArea.left||I>this._interactiveArea.right||v<this._interactiveArea.top||v>this._interactiveArea.bottom)return}if(f.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===te.ROTATE||this.mouseButtons.wheel===te.TRUCK){const x=performance.now();c-x<1e3&&this._getClientRect(this._elementRect),c=x}const _=iY?-1:-3,y=f.deltaMode===1&&!f.ctrlKey?f.deltaY/_:f.deltaY/(_*10),E=this.dollyToCursor?(f.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(f.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(f.ctrlKey?te.ZOOM:this.mouseButtons.wheel){case te.ROTATE:{this._rotateInternal(f.deltaX,f.deltaY),this._isUserControllingRotate=!0;break}case te.TRUCK:{this._truckInternal(f.deltaX,f.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case te.SCREEN_PAN:{this._truckInternal(f.deltaX,f.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case te.OFFSET:{this._truckInternal(f.deltaX,f.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case te.DOLLY:{this._dollyInternal(-y,E,b),this._isUserControllingDolly=!0;break}case te.ZOOM:{this._zoomInternal(-y,E,b),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=f=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===bh.ACTION.NONE){const _=f instanceof PointerEvent?f.pointerId:0,y=this._findPointerById(_);y&&this._disposePointer(y),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}f.preventDefault()}},d=f=>{if(!this._enabled)return;if(my(this._activePointers,Wi),this._getClientRect(this._elementRect),n.copy(Wi),s.copy(Wi),this._activePointers.length>=2){const y=Wi.x-this._activePointers[1].clientX,E=Wi.y-this._activePointers[1].clientY,b=Math.sqrt(y*y+E*E);r.set(0,b);const C=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,x=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(C,x)}if(this._state=0,!f)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in f&&f.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&&(f.buttons&Bn.LEFT)===Bn.LEFT&&(this._state=this._state|this.mouseButtons.left),(f.buttons&Bn.MIDDLE)===Bn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&Bn.RIGHT)===Bn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.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&te.TRUCK)===te.TRUCK||(this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&te.DOLLY)===te.DOLLY||(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&te.ZOOM)===te.ZOOM||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},A=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,my(this._activePointers,Wi);const _=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,y=_?-_.deltaX:s.x-Wi.x,E=_?-_.deltaY:s.y-Wi.y;if(s.copy(Wi),((this._state&te.ROTATE)===te.ROTATE||(this._state&te.TOUCH_ROTATE)===te.TOUCH_ROTATE||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(y,E),this._isUserControllingRotate=!0),(this._state&te.DOLLY)===te.DOLLY||(this._state&te.ZOOM)===te.ZOOM){const b=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,C=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,x=this.dollyDragInverted?-1:1;(this._state&te.DOLLY)===te.DOLLY?(this._dollyInternal(x*E*Zp,b,C),this._isUserControllingDolly=!0):(this._zoomInternal(x*E*Zp,b,C),this._isUserControllingZoom=!0)}if((this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_ZOOM)===te.TOUCH_ZOOM||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_ZOOM_ROTATE)===te.TOUCH_ZOOM_ROTATE){const b=Wi.x-this._activePointers[1].clientX,C=Wi.y-this._activePointers[1].clientY,x=Math.sqrt(b*b+C*C),I=r.y-x;r.set(0,x);const v=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&te.TOUCH_DOLLY)===te.TOUCH_DOLLY||(this._state&te.TOUCH_DOLLY_ROTATE)===te.TOUCH_DOLLY_ROTATE||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET?(this._dollyInternal(I*Zp,v,w),this._isUserControllingDolly=!0):(this._zoomInternal(I*Zp,v,w),this._isUserControllingZoom=!0)}((this._state&te.TRUCK)===te.TRUCK||(this._state&te.TOUCH_TRUCK)===te.TOUCH_TRUCK||(this._state&te.TOUCH_DOLLY_TRUCK)===te.TOUCH_DOLLY_TRUCK||(this._state&te.TOUCH_ZOOM_TRUCK)===te.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(y,E,!1,!1),this._isUserControllingTruck=!0),((this._state&te.SCREEN_PAN)===te.SCREEN_PAN||(this._state&te.TOUCH_SCREEN_PAN)===te.TOUCH_SCREEN_PAN||(this._state&te.TOUCH_DOLLY_SCREEN_PAN)===te.TOUCH_DOLLY_SCREEN_PAN||(this._state&te.TOUCH_ZOOM_SCREEN_PAN)===te.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(y,E,!1,!0),this._isUserControllingTruck=!0),((this._state&te.OFFSET)===te.OFFSET||(this._state&te.TOUCH_OFFSET)===te.TOUCH_OFFSET||(this._state&te.TOUCH_DOLLY_OFFSET)===te.TOUCH_DOLLY_OFFSET||(this._state&te.TOUCH_ZOOM_OFFSET)===te.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(y,E,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},p=()=>{my(this._activePointers,Wi),s.copy(Wi),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",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),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",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",m),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),d())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),this._domElement?.ownerDocument.exitPointerLock(),this._domElement?.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement?.ownerDocument.removeEventListener("pointerlockerror",m),this.cancel()};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},m=()=>{this.unlockPointer()};this._addAllEventListeners=f=>{this._domElement=f,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",m))},this.cancel=()=>{this._state!==te.NONE&&(this._state=te.NONE,this._activePointers.length=0,p())},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=er(e.width,0,1),this._interactiveArea.height=er(e.height,0,1),this._interactiveArea.x=er(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=er(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}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,n=!1){this._isUserControllingRotate=!1;const s=er(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=er(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!n||qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0,this._dollyToNoClamp(er(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=qt(a,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ju).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=er(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||qt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),yr.multiplyScalar(e),Er.multiplyScalar(-t);const s=yt.copy(yr).add(Er),r=Ft.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){yt.setFromMatrixColumn(this._camera.matrix,0),yt.crossVectors(this._camera.up,yt),yt.multiplyScalar(e);const n=Ft.copy(this._targetEnd).add(yt);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return yt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+yt.x,this._targetEnd.y+yt.y,this._targetEnd.z+yt.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const r=yt.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const a=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,n,s=!1){const o=yt.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?Pc.copy(e):Pc.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=vw(this._sphericalEnd.theta,bw),h=vw(this._sphericalEnd.phi,bw);l.push(this.rotateTo(u,h,t));const d=yt.setFromSpherical(this._sphericalEnd).normalize(),A=Bw.setFromUnitVectors(d,yy),p=qt(Math.abs(d.y),1);p&&A.multiply(by.setFromAxisAngle(ef,u)),A.multiply(this._yAxisUpSpaceInverse);const g=Sw.makeEmpty();Ft.copy(c.min).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setX(c.max.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setY(c.max.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setZ(c.min.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.min).setZ(c.max.z).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setY(c.min.y).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).setX(c.min.x).applyQuaternion(A),g.expandByPoint(Ft),Ft.copy(c.max).applyQuaternion(A),g.expandByPoint(Ft),g.min.x-=s,g.min.y-=a,g.max.x+=r,g.max.y+=o,A.setFromUnitVectors(yy,d),p&&A.premultiply(by.invert()),A.premultiply(this._yAxisUpSpace);const m=g.getSize(yt),f=g.getCenter(Ft).applyQuaternion(A);if(Xo(this._camera)){const _=this.getDistanceToFitBox(m.x,m.y,m.z,n);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(io(this._camera)){const _=this._camera,y=_.right-_.left,E=_.top-_.bottom,b=n?Math.max(y/m.x,E/m.y):Math.min(y/m.x,E/m.y);l.push(this.moveTo(f.x,f.y,f.z,t)),l.push(this.zoomTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],r="isObject3D"in e?bh.createBoundingSphere(e,Ey):Ey.copy(e);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),Xo(this._camera)){const a=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(a,t))}else if(io(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*r.radius,c=Math.min(a/l,o/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,r,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const l=Ft.set(s,r,a),c=yt.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerp(e,t,n,s=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Qc.NONE,this._changedDolly=0;const r=yt.set(...e.target);if("spherical"in e)hs.set(...e.spherical);else{const h=Ft.set(...e.position);hs.setFromVector3(h.sub(r).applyQuaternion(this._yAxisUpSpace))}const a=Lc.set(...t.target);if("spherical"in t)Nc.set(...t.spherical);else{const h=Ft.set(...t.position);Nc.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(r.lerp(a,n));const o=Nc.theta-hs.theta,l=Nc.phi-hs.phi,c=Nc.radius-hs.radius;this._sphericalEnd.set(hs.radius+c*n,hs.phi+l*n,hs.theta+o*n),this._needsUpdate=!0,s||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!s||qt(this._target.x,this._targetEnd.x,this.restThreshold)&&qt(this._target.y,this._targetEnd.y,this.restThreshold)&&qt(this._target.z,this._targetEnd.z,this.restThreshold)&&qt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&qt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&qt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,s,r,a,o,l,c,u,h,d,A,p=!1){return this.lerp({position:[e,t,n],target:[s,r,a]},{position:[o,l,c],target:[u,h,d]},A,p)}setPosition(e,t,n,s=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,n,s=!1){const r=this.getPosition(yt),a=this.setLookAt(r.x,r.y,r.z,e,t,n,s);return this._sphericalEnd.phi=er(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,n,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const r=!s||qt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&qt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&qt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),yr.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Er.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Jo.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=yt.set(e,t,n),r=s.distanceTo(this._camera.position),a=s.sub(this._camera.position);yr.multiplyScalar(a.x),Er.multiplyScalar(a.y),Jo.multiplyScalar(a.z),yt.copy(yr).add(Er).add(Jo),yt.z=yt.z+r,this.dollyTo(r,!1),this.setFocalOffset(-yt.x,yt.y,-yt.z,!1),this.moveTo(e,t,n,!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,n,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new dt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(_y(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,a=this._camera.getEffectiveFOV()*Wu,o=this._camera.aspect;return((s?r>o:r<o)?t:e/o)*.5/Math.tan(a*.5)+n*.5}getDistanceToFitSphere(e){if(_y(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Wu,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:n;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new dt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new dt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%eo+eo)%eo,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=eo),this._spherical.theta+=eo*Math.round((this._sphericalEnd.theta-this._spherical.theta)/eo),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(!qt(this._camera.up.x,this._cameraUp0.x)||!qt(this._camera.up.y,this._cameraUp0.y)||!qt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.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,ef),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=yt.subVectors(this._target,this._camera.position).normalize(),t=Ft.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(yt);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,r=Iw.subVectors(this._targetEnd,this._target),a=ww.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(dn(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Kp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Kp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,h,1/0,e),this._needsUpdate=!0}if(dn(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const h=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Kp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,h,this.maxSpeed,e),this._needsUpdate=!0}if(dn(r.x)&&dn(r.y)&&dn(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const h=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;xw(this._target,this._targetEnd,this._targetVelocity,h,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(dn(a.x)&&dn(a.y)&&dn(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const h=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;xw(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,h,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(dn(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const h=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Kp(this._zoom,this._zoomEnd,this._zoomVelocity,h,1/0,e)}if(this.dollyToCursor){if(Xo(this._camera)&&this._changedDolly!==0){const h=this._spherical.radius-this._lastDistance,d=this._camera,A=this._getCameraDirection(Ju),p=yt.copy(A).cross(d.up).normalize();p.lengthSq()===0&&(p.x=1);const g=Ft.crossVectors(p,A),m=this._sphericalEnd.radius*Math.tan(d.getEffectiveFOV()*Wu*.5),_=(this._sphericalEnd.radius-h-this._sphericalEnd.radius)/this._sphericalEnd.radius,y=Lc.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*m*d.aspect)).add(g.multiplyScalar(this._dollyControlCoord.y*m)),E=yt.copy(this._targetEnd).lerp(y,_),b=this._lastDollyDirection===Qc.IN&&this._spherical.radius<=this.minDistance,C=this._lastDollyDirection===Qc.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(b||C)){this._sphericalEnd.radius-=h,this._spherical.radius-=h;const I=Ft.copy(A).multiplyScalar(-h);E.add(I)}this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedDolly-=h,dn(this._changedDolly)&&(this._changedDolly=0)}else if(io(this._camera)&&this._changedZoom!==0){const h=this._zoom-this._lastZoom,d=this._camera,A=yt.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(d.near+d.far)/(d.near-d.far)).unproject(d),p=Ft.set(0,0,-1).applyQuaternion(d.quaternion),g=Lc.copy(A).add(p.multiplyScalar(-A.dot(d.up))),f=-(this._zoom-h-this._zoom)/this._zoom,_=this._getCameraDirection(Ju),y=this._targetEnd.dot(_),E=yt.copy(this._targetEnd).lerp(g,f),b=E.dot(_),C=_.multiplyScalar(b-y);E.sub(C),this._boundary.clampPoint(E,E);const x=Ft.subVectors(E,this._targetEnd);this._targetEnd.copy(E),this._target.add(x),this._changedZoom-=h,dn(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 l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!dn(this._focalOffset.x)||!dn(this._focalOffset.y)||!dn(this._focalOffset.z))&&(this._camera.matrix.compose(this._camera.position,this._camera.quaternion,this._camera.scale),yr.setFromMatrixColumn(this._camera.matrix,0),Er.setFromMatrixColumn(this._camera.matrix,1),Jo.setFromMatrixColumn(this._camera.matrix,2),yr.multiplyScalar(this._focalOffset.x),Er.multiplyScalar(-this._focalOffset.y),Jo.multiplyScalar(this._focalOffset.z),yt.copy(yr).add(Er).add(Jo),this._camera.position.add(yt),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),yt.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),dn(t,this.restThreshold)&&dn(n,this.restThreshold)&&dn(s,this.restThreshold)&&dn(r.x,this.restThreshold)&&dn(r.y,this.restThreshold)&&dn(r.z,this.restThreshold)&&dn(a.x,this.restThreshold)&&dn(a.y,this.restThreshold)&&dn(a.z,this.restThreshold)&&dn(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ju(this.maxDistance),minZoom:this.minZoom,maxZoom:ju(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ju(this.maxPolarAngle),minAzimuthAngle:ju(this.minAzimuthAngle),maxAzimuthAngle:ju(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:yt.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 n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Xu(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Xu(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Xu(n.maxPolarAngle),this.minAzimuthAngle=Xu(n.minAzimuthAngle),this.maxAzimuthAngle=Xu(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),hs.setFromVector3(yt.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(hs.theta,hs.phi,t),this.dollyTo(hs.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.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",nY),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,n){const s=t.lengthSq();if(s===0)return e;const r=Ft.copy(t).add(e),o=this._boundary.clampPoint(r,Lc).sub(r),l=o.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(n===0)return e.add(t).add(o);{const c=1+n*l/t.dot(o);return e.add(Ft.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Xo(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*Wu,s=Math.tan(n*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(io(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,r=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,a,0),this._nearPlaneCorners[3].set(n,a,0)}}_truckInternal=(e,t,n,s)=>{let r,a;if(Xo(this._camera)){const o=yt.copy(this._camera.position).sub(this._target),l=this._camera.getEffectiveFOV()*Wu,c=o.length()*Math.tan(l*.5);r=this.truckSpeed*e*c/this._elementRect.height,a=this.truckSpeed*t*c/this._elementRect.height}else if(io(this._camera)){const o=this._camera;r=this.truckSpeed*e*(o.right-o.left)/o.zoom/this._elementRect.width,a=this.truckSpeed*t*(o.top-o.bottom)/o.zoom/this._elementRect.height}else return;s?(n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(r,0,!0),this.forward(-a,!0)):n?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y+a,this._focalOffsetEnd.z,!0):this.truck(r,a,!0)};_rotateInternal=(e,t)=>{const n=eo*this.azimuthRotateSpeed*e/this._elementRect.height,s=eo*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(n,s,!0)};_dollyInternal=(e,t,n)=>{const s=Math.pow(.95,-e*this.dollySpeed),r=this._sphericalEnd.radius,a=this._sphericalEnd.radius*s,o=er(a,this.minDistance,this.maxDistance),l=o-a;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(a,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(l,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?a:o)-r,this._dollyControlCoord.set(t,n)),this._lastDollyDirection=Math.sign(-e)};_zoomInternal=(e,t,n)=>{const s=Math.pow(.95,e*this.dollySpeed),r=this._zoom,a=this._zoom*s;this.zoomTo(a,!0),this.dollyToCursor&&(this._changedZoom+=a-r,this._dollyControlCoord.set(t,n))};_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||_y(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ju);vy.lookAt(Cw,n,this._camera.up);for(let s=0;s<4;s++){const r=Ft.copy(this._nearPlaneCorners[s]);r.applyMatrix4(vy);const a=Lc.addVectors(this._target,r);tf.set(a,n),tf.far=this._spherical.radius+1;const o=tf.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[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 n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_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 dt.Sphere){const n=t,s=n.center;Pc.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&Pc.expandByObject(a)}),Pc.getCenter(s);let r=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a;if(!o.geometry)return;const l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let h=0,d=u.count;h<d;h++)yt.fromBufferAttribute(u,h),r=Math.max(r,s.distanceToSquared(yt))}),n.radius=Math.sqrt(r),n}}class Tw{constructor(e){this.__position=new Q,this.__target=new Q,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,n){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(n)}getTarget(){return this.__target}setTarget(e,t,n){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(n)}}class Gg extends Hv{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainRenderer={},this.__mainCameraControls={},this.__cameraDirection=new Q,this.__cameraSpherical=new Ll,this.__savedCameraState={position:new Q,target:new Q,focalLength:0},this.__currentCameraPosition=new Q,this.__currentTargetPosition=new Q,this.__touchScrollState=null,this.__pointerZoomEnabled=!1}static{this.TAU=Math.PI*2}get cameraActions(){return bh.ACTION}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}getCurrentCameraTransforms(){return this.__cameras.main.getWorldPosition(this.__currentCameraPosition),this.__mainCameraControls.getTarget(this.__currentTargetPosition),{position:this.__currentCameraPosition,target:this.__currentTargetPosition,focalLength:this.__cameras.main.getFocalLength()}}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.getSceneSphericalBounds().clone();if(t.isEmpty()||t.radius<=0)return;let n=this._appWcRef.productSettings.camera.cameraBoundsMultiplier;return this._appWcRef.cameraBoundsMultiplier!==0&&(n=this._appWcRef.cameraBoundsMultiplier),this._appWcRef.aspectRatio<1&&(n=1),t.radius=t.radius*n,await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(){const e=this.__mainCameraControls,t=e.currentAction===e.mouseButtons?.right||e.currentAction===e.touches?.two;this.__cameraSettings.canPan&&t?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):e.currentAction===e.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),this.__savedCameraState.focalLength=this.getCameraFocalLength()}resetCurrentCameraTransformsToLastSavedState(e=!0){this.moveCameraToLocation({newCameraTransforms:this.__savedCameraState,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t}){this._appWcRef.productSettings.camera.canZoom===!1&&(e=null,t=null),e===null&&(e=.001),t===null&&(t=1/0);const n=this._appWcRef.getSceneSphericalBounds().radius;n<0||(this.__mainCameraControls.minDistance=Math.min(e,n),this.__mainCameraControls.maxDistance=n+t)}async zoomIn(e=.1){await this.__mainCameraControls.dolly(e,!0)}async zoomOut(e=.1){await this.__mainCameraControls.dolly(-e,!0)}enableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.ROTATE,this.__mainCameraControls.touches.one=this.cameraActions.TOUCH_ROTATE}disableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.NONE,this.__mainCameraControls.touches.one=this.cameraActions.NONE}enablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY_TRUCK,this.__mainCameraControls.mouseButtons.right=this.cameraActions.TRUCK}disablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.right=this.cameraActions.NONE}enableZoomControls(){if(this._appWcRef.disableZoom){this.disableZoomControls();return}this.__pointerZoomEnabled=!0,this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.DOLLY}disableZoomControls(){this.__pointerZoomEnabled=!1,this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.NONE}enableCameraZoomLimits(e){this.setCameraZoomLimits({minDistance:e.minDistance,maxDistance:e.maxDistance})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:null,maxDistance:null})}enableCameraRotationLimits(e){const{infinitePolarAngle:t,minPolarAngle:n,maxPolarAngle:s,infiniteAzimuthAngle:r,minAzimuthAngle:a,maxAzimuthAngle:o}=e;this.__mainCameraControls.minPolarAngle=t?-1/0:n,this.__mainCameraControls.maxPolarAngle=t?1/0:s,this.__mainCameraControls.minAzimuthAngle=r?-1/0:a,this.__mainCameraControls.maxAzimuthAngle=r?1/0:o}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}updateCameraSettings(e){this.__cameraSettings=JSON.parse(JSON.stringify(e)),this.enableRotationControls();const{canPan:t,canZoom:n}=e;n?this.enableZoomControls():this.disableZoomControls(),t?this.enablePanControls():this.disablePanControls(),this.__mainCameraControls.mouseButtons.middle=this.cameraActions.NONE,this.__mainCameraControls.enabled=!0,this.__cameras.main.setFocalLength(e.focalLength),this.__cameras.main.near=e.nearClip,this.__cameras.main.far=e.farClip,this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e),this._appWcRef.transparentBackground===!1&&(this.__mainRenderer.setClearColor(e.backgroundColor),this.__mainRenderer.setClearAlpha(e.backgroundAlpha))}normalizeAngle(e){return Ki.euclideanModulo(e,Gg.TAU)}absoluteAngle(e,t){const n=e-t;return Ki.euclideanModulo(n+Math.PI,Gg.TAU)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:n=!0,targetCameraControlsRef:s=this.__mainCameraControls,ignoreCameraLimits:r=!1}){e instanceof Tw||(e=new Tw(e));const a=e.getPosition(),o=e.getTarget();if(s.enabled=!1,r===!0)s.setLookAt(a.x,a.y,a.z,o.x,o.y,o.z,n),s.normalizeRotations();else{this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(a,o),this.__cameraDirection.normalize();const l=a.distanceTo(o);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const c=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(s.azimuthAngle)),u=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(s.polarAngle));s.rotate(c,u,n),s.moveTo(o.x,o.y,o.z,n),s.dollyTo(l,n)}t||(s.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:n,transition:s=!0,targetCameraControlsRef:r=this.__mainCameraControls}){e&&r.rotateAzimuthTo(e,s),t&&r.rotatePolarTo(t,s),n&&r.dollyTo(n,s)}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 n of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+n,!0)}}__onProductSettingsUpdated(){this.updateCameraSettings(this._appWcRef.productSettings.camera),this.fitCameraToSceneBounds()}__onCameraMoveToTransform(e){e.detail.saveFirst&&this.saveCurrentCameraTransforms(),this.moveCameraToLocation({newCameraTransforms:e.detail.cameraTransforms,ignoreCameraLimits:e.detail.ignoreCameraLimits})}__onSceneBoundsChanged(){this.__mainCameraControls.setBoundary(this._appWcRef.getSceneBounds())}__setupTouchScrollDetection(){if(!("ontouchstart"in window||navigator.maxTouchPoints>0))return;const t=this.__mainRenderer.domElement,n=this.__mainCameraControls;t.style.touchAction="pan-y",new MutationObserver(()=>{t.style.touchAction!=="pan-y"&&(t.style.touchAction="pan-y")}).observe(t,{attributeFilter:["style"]});const r=5;t.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(this.__touchScrollState={startX:a.clientX,startY:a.clientY,decided:!1,isVerticalScroll:!1})}),document.addEventListener("pointermove",a=>{if(!(!this.__touchScrollState||a.pointerType!=="touch")){if(!this.__touchScrollState.decided){const o=Math.abs(a.clientX-this.__touchScrollState.startX),l=Math.abs(a.clientY-this.__touchScrollState.startY);if(o<r&&l<r)return;this.__touchScrollState.decided=!0,this.__touchScrollState.isVerticalScroll=l>o,this.__touchScrollState.isVerticalScroll&&n.cancel()}this.__touchScrollState.isVerticalScroll&&a.stopImmediatePropagation()}},{capture:!0}),document.addEventListener("pointerup",a=>{!this.__touchScrollState||a.pointerType!=="touch"||(this.__touchScrollState=null)},{capture:!0})}__onWheel(e){if(!e.ctrlKey||!this.__pointerZoomEnabled)return;e.preventDefault(),e.stopImmediatePropagation();const t=new WheelEvent("wheel",{deltaX:e.deltaX,deltaY:e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,clientX:e.clientX,clientY:e.clientY,screenX:e.screenX,screenY:e.screenY,ctrlKey:!1,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:e.bubbles,cancelable:e.cancelable});e.target?.dispatchEvent(t)}__setupTrackpadPinchAsDollyHandler(){this.__mainRenderer.domElement.addEventListener("wheel",this.__onWheel.bind(this),{passive:!1})}__setupEventListeners(){this.__setupTouchScrollDetection(),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart()}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.productSettingUpdatedEvent.name,this.__onProductSettingsUpdated.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,this.__onCameraMoveToTransform.bind(this)),this._appWcRef.addEventListener(this._appWcRef.eventsManager.sceneBoundsChanged.name,this.__onSceneBoundsChanged.bind(this))}async setup({mainRenderer:e}){this.__mainRenderer=e;const t=new $n(75,window.innerWidth/window.innerHeight,.1,1e3);this.__cameras={main:t,screenshot:t.clone()},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(1);const n={Vector2:pe,Vector3:Q,Vector4:Mt,Quaternion:Yt,Matrix4:We,Spherical:Ll,Box3:Rn,Sphere:ts,Raycaster:vv};bh.install({THREE:n}),this.__setupTrackpadPinchAsDollyHandler(),this.__mainCameraControls=new bh(this.__cameras.main,e.domElement),this.__setupEventListeners()}}const sY='@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: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}',rY={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"}}}},lD={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:"Helvetica Neue",$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)"}}}},de={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 oe(i){const e=/\{Primitives\.(.*?)}/,t=String(i).match(e),n=/\{BrandPrimitives\.(.*?)}/,s=String(i).match(n);let r=i;if(t){const a=t[1].split(".");r=rY[a[0]][a[1]][a[2]].$value}else if(s){const a=s[1].split("."),o=lD[a[0]][a[1]][a[2]],l=o.$web;r=`${l.substring(0,l.length-1)}, ${o.$value})`}return zi(r)}const Vv={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 aY(){const i={};for(const[e,t]of Object.entries(lD))for(const[n,s]of Object.entries(t))for(const[r,a]of Object.entries(s)){const o=`${e}${n}${r}`;i[o]={name:zi(a.$web),defaultValue:a.$value,argType:{control:a.$type}}}return i}const oY=aY(),jh={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 lY=Object.defineProperty,du=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&lY(e,t,s),s};const Jl=class cD extends mh{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=jh.theme.defaultValue.toString(),this.size=jh.size.defaultValue.toString(),cD.ensureFontsAreLoaded(),this.addEventListener("click",this.doClick),this.addEventListener("pointerover",this.doHoverStart),this.addEventListener("pointerleave",this.doHoverEnd)}static{this.styles=[ht`
|
|
13176
13176
|
:host {
|
|
13177
13177
|
font-family: ${oe(de.Font.Family.Main.$value)};
|
|
13178
13178
|
letter-spacing: 0.5px;
|
|
@@ -17570,7 +17570,7 @@ void main() {
|
|
|
17570
17570
|
`]}static setupWebComponent(){window.customElements.get(og.webComponentName)||window.customElements.define(og.webComponentName,og)}addComment(e,t=!0){const n=new JT({config:e,appWcRef:this.appWcRef,commentsManagerRef:this});if(n.hidden)return;this.comments.set(n.commentId,n);const s=this.appWcRef.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);s&&s.addComment(n),t&&this.updateCommentsOrder(Array.from(this.comments.keys()))}updateComment(e,t){const n=this.comments.get(e);if(!n){window.epigraph.logger.error({title:`Invalid comment ID: ${e}`});return}n.updateConfig(t),this.requestUpdate()}removeComment(e,t=!0){this.comments.delete(e),t&&this.updateCommentsOrder(Array.from(this.comments.keys()))}stepComment(e){const t=this.activeCommentIndex;if(t===null)return;const n=this.commentsOrder.length;let s=t;e==="next"?(s=t+1,s>=n&&(s=0)):e==="prev"&&(s=t-1,s<0&&(s=n-1));const r=this.commentsOrder[s];this.setActiveComment({commentId:r})}nextComment(){return this.stepComment("next"),this.appWcRef.eventsManager.commentNextEvent.fire({comment:this.activeComment}),this.activeComment}previousComment(){return this.stepComment("prev"),this.appWcRef.eventsManager.commentPreviousEvent.fire({comment:this.activeComment}),this.activeComment}openComment({commentId:e,skipCommentOpenEvent:t=!1}){this.appWcRef.playInteractionPrompt=!1,this.setActiveComment({commentId:e}),t||this.appWcRef.eventsManager.commentOpenEvent.fire({comment:this.activeComment})}closeActiveComment(){const e=this.activeComment?.commentId;this.setActiveComment({commentId:null}),this.appWcRef.eventsManager.commentClosedEvent.fire({commentId:e})}updateCommentsOrder(e){this.commentsOrder=e}removeAllComments(){for(const e of this.comments.keys())this.removeComment(e)}setActiveCommentByIndex(e){const t=this.commentsOrder[e];this.setActiveComment({commentId:t})}updateActiveCommentIndex(){this.activeComment?this.activeCommentIndex=this.commentsOrder.indexOf(this.activeComment?.commentId):this.activeCommentIndex=-1}setActiveComment({commentId:e}){if(this.activeComment?.commentId!==e){if(e===null){this.activeComment=void 0,this.updateActiveCommentIndex();return}this.enabled===!1&&(this.enabled=!0),this.activeComment=this.comments.get(e),this.activeComment!==void 0&&(this.updateActiveCommentIndex(),this.activeComment.visited=!0,window.addEventListener("keydown",t=>{t.key==="Escape"&&this.closeActiveComment()},{once:!0}))}}recalculateCommentPositions(){this.requestUpdate()}__renderCommentIndicatorTemplates(){return Array.from(this.comments.values()).map(e=>e.renderAnnotationTemplate(this.activeComment?.commentId))}render(){return this.enabled?re`
|
|
17571
17571
|
${super.render()}
|
|
17572
17572
|
${this.__renderCommentIndicatorTemplates()}
|
|
17573
|
-
`:ye}};Um([H({attribute:!1})],sp.prototype,"comments");Um([H({attribute:!1})],sp.prototype,"commentsOrder");Um([H({attribute:!1})],sp.prototype,"activeComment");Um([H({attribute:!1})],sp.prototype,"activeCommentIndex");let ZJ=sp;class e7 extends Hv{constructor(e){super({appWcRef:e}),this.__screenshots=new Map,this.__screenshotTargetCanvas=document.createElement("canvas"),this.__predefinedScreenshots=new Map,this._loggerContext="SCREENSHOTS MANAGER",window.epigraph.logger.info({title:"Initialising...",contextOverride:this._loggerContext});const t=this._appWcRef.productSettings.screenshots.predefinedCameras;for(const[n,s]of Object.entries(t))this.__predefinedScreenshots.set(n,s)}__showScreenshotCanvas(){document.body.appendChild(this.__screenshotTargetCanvas),this.__screenshotTargetCanvas.style.position="fixed",this.__screenshotTargetCanvas.style.top="0",this.__screenshotTargetCanvas.style.left="0",this.__screenshotTargetCanvas.style.transform="scale(0.25)",this.__screenshotTargetCanvas.style.transformOrigin="top left"}get predefinedScreenshotCameras(){return this.__predefinedScreenshots}clearAllScreenshots(){for(const e of this.__screenshots.values())URL.revokeObjectURL(e);this.__screenshots.clear()}__pixelBufferToBlob(e,t,n){return new Promise((s,r)=>{const a=t*4,o=new Uint8Array(e.length);for(let u=0;u<n;u++){const h=u*a,d=(n-1-u)*a;o.set(e.subarray(h,h+a),d)}const l=new ImageData(new Uint8ClampedArray(o.buffer),t,n);this.__screenshotTargetCanvas.width=t,this.__screenshotTargetCanvas.height=n,this.__screenshotTargetCanvas.getContext("2d").putImageData(l,0,0),this.__screenshotTargetCanvas.toBlob(u=>{u?s(u):r(new Error("Blob generation failed"))},"image/png")})}__resolveCameraTransforms(e){if(typeof e=="string"){const t=this.__predefinedScreenshots.get(e);if(!t)throw new Error(`Invalid predefined camera name for screenshot: ${e}`);return t}return e}async takeScreenshot(e){let t="";const n=Math.floor(e?.width??this._appWcRef.canvasSize.width),s=Math.floor(e?.height??this._appWcRef.canvasSize.height),r=this.__resolveCameraTransforms(e?.camera),a=this._appWcRef.cameraManager.getCameras(),o=a.screenshot;if(o.copy(a.main),o.aspect=n/s,r)if("position"in r){const{position:u,target:h,focalLength:d}=r;o.position.set(u.x,u.y,u.z),o.lookAt(h.x,h.y,h.z),d&&o.setFocalLength(d)}else{const{azimuthAngle:u,polarAngle:h,distance:d}=r,A=this._appWcRef.cameraManager.getCurrentCameraTransforms().target,p=new Q().setFromSpherical(new Ll(d,h,u));o.position.copy(A).add(p),o.lookAt(A)}o.updateProjectionMatrix();const l=this._appWcRef.renderEngine.renderToScreenshotTarget(o,n,s),c=await this.__pixelBufferToBlob(l,n,s).catch(u=>{window.epigraph.logger.error({title:"Couldn't generate blob for the requested screenshot.",details:u})});return c&&(t=URL.createObjectURL(c)),t}async downloadUrlAsFile(e,t){const n=document.createElement("a");n.href=e,n.download=`${t}.png`,n.click(),URL.revokeObjectURL(e)}async downloadScreenshot({fileName:e="screenshot",options:t}={}){const n=await this.takeScreenshot(t);if(!n){window.epigraph.logger.error({title:"Failed to generate screenshot for download.",contextOverride:this._loggerContext});return}return this.downloadUrlAsFile(n,e)}getPredefinedScreenshotCameraConfigByName(e){return this.__predefinedScreenshots.get(e)}addPredefinedScreenshotCamera(e,t){this.__predefinedScreenshots.set(e,t)}deletePredefinedScreenshotCamera(e){this.__predefinedScreenshots.delete(e)}async takeAllPredefinedScreenshots(e,t){if(!(!this.__predefinedScreenshots||this.__predefinedScreenshots.size<=0)){this.clearAllScreenshots();for(const[n,s]of this.__predefinedScreenshots.entries()){const r=await this.takeScreenshot({width:e,height:t,camera:s});this.__screenshots.set(n,r)}return this.__screenshots}}async downloadAllPredefinedScreenshots(e,t){await this.takeAllPredefinedScreenshots(e,t);const n=this._appWcRef.getFileNameForScreenshot();for(const[s,r]of this.__screenshots.entries())this.downloadUrlAsFile(r,`${n}-${s}`)}}var t7=Object.defineProperty,at=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&t7(e,t,s),s},nh=(i=>(i.NONE="",i.SKU="sku",i.SHOPIFY_VARIANT_ID="shopify_variant_id",i.ASIN="asin",i.UPC="upc",i.PRODUCT_VARIANT_UUID="product_variant_uuid",i))(nh||{});const st=class Ud extends iL{constructor(){let e=Gd.PRODUCTION;super(window.__APP_VERSION__,e),this.epigraphWebsiteRedirectUrls={icon:"https://www.epigraph.us",modal:"https://www.epigraph.us"},this.sessionState="default",this.isAppReady=!1,this.sku=Ut.sku.defaultValue.toString(),this.shopify_variant_id=Ut.shopifyVariantId.defaultValue.toString(),this.upc=Ut.upc.defaultValue.toString(),this.asin=Ut.asin.defaultValue.toString(),this.product_variant_uuid=Ut.productVariantUuid.defaultValue.toString(),this.customVersionId="",this.gaMeasurementId="",this.disableZoom=!1,this.modalView=!1,this.hide=!1,this.isLoading=!0,this.apiMode="production",this.debug=!1,this.showSettings=!1,this.dimensionsUnit=Ut.dimensionsUnit.defaultValue.toString(),this.dimensionsUnitSymbol=Ut.dimensionsUnitSymbol.defaultValue.toString(),this.areDimensionsActive=!1,this.areHotspotsActive=!1,this.variantSwitchMode=Ut.variantSwitchMode.defaultValue.toString(),this.areCommentsActive=!1,this.isHelpVisible=!1,this.baseUrlOverride=Ut.baseUrlOverride.defaultValue.toString(),this.cameraBoundsMultiplier=
|
|
17573
|
+
`:ye}};Um([H({attribute:!1})],sp.prototype,"comments");Um([H({attribute:!1})],sp.prototype,"commentsOrder");Um([H({attribute:!1})],sp.prototype,"activeComment");Um([H({attribute:!1})],sp.prototype,"activeCommentIndex");let ZJ=sp;class e7 extends Hv{constructor(e){super({appWcRef:e}),this.__screenshots=new Map,this.__screenshotTargetCanvas=document.createElement("canvas"),this.__predefinedScreenshots=new Map,this._loggerContext="SCREENSHOTS MANAGER",window.epigraph.logger.info({title:"Initialising...",contextOverride:this._loggerContext});const t=this._appWcRef.productSettings.screenshots.predefinedCameras;for(const[n,s]of Object.entries(t))this.__predefinedScreenshots.set(n,s)}__showScreenshotCanvas(){document.body.appendChild(this.__screenshotTargetCanvas),this.__screenshotTargetCanvas.style.position="fixed",this.__screenshotTargetCanvas.style.top="0",this.__screenshotTargetCanvas.style.left="0",this.__screenshotTargetCanvas.style.transform="scale(0.25)",this.__screenshotTargetCanvas.style.transformOrigin="top left"}get predefinedScreenshotCameras(){return this.__predefinedScreenshots}clearAllScreenshots(){for(const e of this.__screenshots.values())URL.revokeObjectURL(e);this.__screenshots.clear()}__pixelBufferToBlob(e,t,n){return new Promise((s,r)=>{const a=t*4,o=new Uint8Array(e.length);for(let u=0;u<n;u++){const h=u*a,d=(n-1-u)*a;o.set(e.subarray(h,h+a),d)}const l=new ImageData(new Uint8ClampedArray(o.buffer),t,n);this.__screenshotTargetCanvas.width=t,this.__screenshotTargetCanvas.height=n,this.__screenshotTargetCanvas.getContext("2d").putImageData(l,0,0),this.__screenshotTargetCanvas.toBlob(u=>{u?s(u):r(new Error("Blob generation failed"))},"image/png")})}__resolveCameraTransforms(e){if(typeof e=="string"){const t=this.__predefinedScreenshots.get(e);if(!t)throw new Error(`Invalid predefined camera name for screenshot: ${e}`);return t}return e}async takeScreenshot(e){let t="";const n=Math.floor(e?.width??this._appWcRef.canvasSize.width),s=Math.floor(e?.height??this._appWcRef.canvasSize.height),r=this.__resolveCameraTransforms(e?.camera),a=this._appWcRef.cameraManager.getCameras(),o=a.screenshot;if(o.copy(a.main),o.aspect=n/s,r)if("position"in r){const{position:u,target:h,focalLength:d}=r;o.position.set(u.x,u.y,u.z),o.lookAt(h.x,h.y,h.z),d&&o.setFocalLength(d)}else{const{azimuthAngle:u,polarAngle:h,distance:d}=r,A=this._appWcRef.cameraManager.getCurrentCameraTransforms().target,p=new Q().setFromSpherical(new Ll(d,h,u));o.position.copy(A).add(p),o.lookAt(A)}o.updateProjectionMatrix();const l=this._appWcRef.renderEngine.renderToScreenshotTarget(o,n,s),c=await this.__pixelBufferToBlob(l,n,s).catch(u=>{window.epigraph.logger.error({title:"Couldn't generate blob for the requested screenshot.",details:u})});return c&&(t=URL.createObjectURL(c)),t}async downloadUrlAsFile(e,t){const n=document.createElement("a");n.href=e,n.download=`${t}.png`,n.click(),URL.revokeObjectURL(e)}async downloadScreenshot({fileName:e="screenshot",options:t}={}){const n=await this.takeScreenshot(t);if(!n){window.epigraph.logger.error({title:"Failed to generate screenshot for download.",contextOverride:this._loggerContext});return}return this.downloadUrlAsFile(n,e)}getPredefinedScreenshotCameraConfigByName(e){return this.__predefinedScreenshots.get(e)}addPredefinedScreenshotCamera(e,t){this.__predefinedScreenshots.set(e,t)}deletePredefinedScreenshotCamera(e){this.__predefinedScreenshots.delete(e)}async takeAllPredefinedScreenshots(e,t){if(!(!this.__predefinedScreenshots||this.__predefinedScreenshots.size<=0)){this.clearAllScreenshots();for(const[n,s]of this.__predefinedScreenshots.entries()){const r=await this.takeScreenshot({width:e,height:t,camera:s});this.__screenshots.set(n,r)}return this.__screenshots}}async downloadAllPredefinedScreenshots(e,t){await this.takeAllPredefinedScreenshots(e,t);const n=this._appWcRef.getFileNameForScreenshot();for(const[s,r]of this.__screenshots.entries())this.downloadUrlAsFile(r,`${n}-${s}`)}}var t7=Object.defineProperty,at=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&t7(e,t,s),s},nh=(i=>(i.NONE="",i.SKU="sku",i.SHOPIFY_VARIANT_ID="shopify_variant_id",i.ASIN="asin",i.UPC="upc",i.PRODUCT_VARIANT_UUID="product_variant_uuid",i))(nh||{});const st=class Ud extends iL{constructor(){let e=Gd.PRODUCTION;super(window.__APP_VERSION__,e),this.epigraphWebsiteRedirectUrls={icon:"https://www.epigraph.us",modal:"https://www.epigraph.us"},this.sessionState="default",this.isAppReady=!1,this.sku=Ut.sku.defaultValue.toString(),this.shopify_variant_id=Ut.shopifyVariantId.defaultValue.toString(),this.upc=Ut.upc.defaultValue.toString(),this.asin=Ut.asin.defaultValue.toString(),this.product_variant_uuid=Ut.productVariantUuid.defaultValue.toString(),this.customVersionId="",this.gaMeasurementId="",this.disableZoom=!1,this.modalView=!1,this.hide=!1,this.isLoading=!0,this.apiMode="production",this.debug=!1,this.showSettings=!1,this.dimensionsUnit=Ut.dimensionsUnit.defaultValue.toString(),this.dimensionsUnitSymbol=Ut.dimensionsUnitSymbol.defaultValue.toString(),this.areDimensionsActive=!1,this.areHotspotsActive=!1,this.variantSwitchMode=Ut.variantSwitchMode.defaultValue.toString(),this.areCommentsActive=!1,this.isHelpVisible=!1,this.baseUrlOverride=Ut.baseUrlOverride.defaultValue.toString(),this.cameraBoundsMultiplier=1,this.isPortraitOrientation=!1,this.didARAutoLaunch=!1,this.transparentBackground=!1,this.splashScreenLogo=Ut.splashScreenLogo.defaultValue.toString(),this.splashScreenText=Ut.splashScreenText.defaultValue.toString(),this.hideUi=!1,this.playInteractionPrompt=!1,this.featuresToEnable={viewer:!0,hotspots:!0,dimensions:!0,viewInYourSpace:!0,help:!0,sceneManager:!0,comments:!1,debugManager:!1},this._hasActiveHotspot=!1,this._isToolsetLargerThanTheLeftBottomQuadrant=!1,this._loadingProgress=0,this._loadTimeBegin=performance.now(),this._loggerContext="EPIGRAPH THREED CODE",this._epigraphAnalytics=new dL(null,null),this._identifier="",this._identifierType="",this._isDevEnv=!1,this._isStagingEnv=!1,this._productSettings=new GJ,this._boundingSphereCenter=new Q,this._loaders=new oA,this._activeAnimations=new Map,this._animationFadeDurationInMiliseconds=1e3,this._isSceneInteractedWith=!1,this.__isLoadingForTheFirstTime=!0,this.__glbBlobUrl="",this.__usdzBlobUrl="",this.__hasSceneChanged=!1,this.__canvasSize={width:0,height:0},this.__raycaster=new vv,this.__pointer=new pe,this.__viewStateGrid=new JM(40,190,0,12829635),this.__interactionPlayCount=0}static{this.webComponentName="epigraph-threed-core"}static setupWebComponent(){window.customElements.get(Ud.webComponentName)||window.customElements.define(Ud.webComponentName,Ud)}static{this.styles=[ht`
|
|
17574
17574
|
:host {
|
|
17575
17575
|
all: initial;
|
|
17576
17576
|
display: flex;
|
|
@@ -18483,7 +18483,7 @@ void main() {
|
|
|
18483
18483
|
<div class="transition-screen" id="transitionScreen">
|
|
18484
18484
|
<epg-loader-circle class="epg-loader-circle" loader-size="35px"></epg-loader-circle>
|
|
18485
18485
|
</div>
|
|
18486
|
-
`}async _resetSession(){this._autoGeneratedProxyMesh?.scale.set(1,1,1),this._autoGeneratedProxyMesh?.position.set(0,0,0),this._autoGeneratedProxyMesh?.updateMatrixWorld(),await this.renderEngine.emptyScene()}__onHotspotChange(e){let t;e.detail.oldHotspotId?t=this.hotspotsManager.hotspots.get(e.detail.oldHotspotId):t=this.hotspotsManager.hotspots.get(e.detail.hotspotId),this._hasActiveHotspot=this.hotspotsManager.activeHotspot!==void 0;const n=t?.animation,s=t?.assetId;if(!n||!s)return;const r=n.loop,a=n.exit;r&&this.stopAnimationByNameAndAssetId(r,s);let o;a?o=this.playAnimationByNameAndAssetId({animationName:a,assetId:s}):o=this.playAnimationByNameAndAssetId({animationName:n.entry,assetId:s,reverse:!0}),setTimeout(()=>{o?.targetAnimationAction.reset(),this._activeAnimations.delete(o?.animationName??"")},this._animationFadeDurationInMiliseconds)}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app.",contextOverride:this._loggerContext}),this.addEventListener(this.eventsManager.experienceUpdatedEvent.name,()=>{if(this.renderEngine.accumulativeShadows&&!this.renderEngine.accumulativeShadows.camera&&(this.renderEngine.accumulativeShadows.camera=this.cameraManager.getCameras().main),this.renderEngine.accumulativeShadows?.reset(),this.renderEngine.contactShadows&&this.renderEngine.contactShadows.updateSettings(this.productSettings.shadows.contactShadows),this.cameraManager.updateCameraSettings(this.productSettings.camera),!this.__isLoadingForTheFirstTime&&this.variantSwitchMode==="seamless"){this.productSettings.camera.initial||requestAnimationFrame(()=>void this.cameraManager.fitCameraToSceneBounds());return}const e=this.productSettings.camera.initial?.skipCameraFit;this.productSettings.camera.initial?this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}).then(()=>{e||this.cameraManager.fitCameraToSceneBounds()}):e||requestAnimationFrame(()=>
|
|
18486
|
+
`}async _resetSession(){this._autoGeneratedProxyMesh?.scale.set(1,1,1),this._autoGeneratedProxyMesh?.position.set(0,0,0),this._autoGeneratedProxyMesh?.updateMatrixWorld(),await this.renderEngine.emptyScene()}__onHotspotChange(e){let t;e.detail.oldHotspotId?t=this.hotspotsManager.hotspots.get(e.detail.oldHotspotId):t=this.hotspotsManager.hotspots.get(e.detail.hotspotId),this._hasActiveHotspot=this.hotspotsManager.activeHotspot!==void 0;const n=t?.animation,s=t?.assetId;if(!n||!s)return;const r=n.loop,a=n.exit;r&&this.stopAnimationByNameAndAssetId(r,s);let o;a?o=this.playAnimationByNameAndAssetId({animationName:a,assetId:s}):o=this.playAnimationByNameAndAssetId({animationName:n.entry,assetId:s,reverse:!0}),setTimeout(()=>{o?.targetAnimationAction.reset(),this._activeAnimations.delete(o?.animationName??"")},this._animationFadeDurationInMiliseconds)}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app.",contextOverride:this._loggerContext}),this.addEventListener(this.eventsManager.experienceUpdatedEvent.name,()=>{if(this.renderEngine.accumulativeShadows&&!this.renderEngine.accumulativeShadows.camera&&(this.renderEngine.accumulativeShadows.camera=this.cameraManager.getCameras().main),this.renderEngine.accumulativeShadows?.reset(),this.renderEngine.contactShadows&&this.renderEngine.contactShadows.updateSettings(this.productSettings.shadows.contactShadows),this.cameraManager.updateCameraSettings(this.productSettings.camera),!this.__isLoadingForTheFirstTime&&this.variantSwitchMode==="seamless"){this.productSettings.camera.initial||requestAnimationFrame(()=>void this.cameraManager.fitCameraToSceneBounds());return}const e=this.productSettings.camera.initial?.skipCameraFit;this.productSettings.camera.initial?this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}).then(()=>{e||this.cameraManager.fitCameraToSceneBounds()}):e||requestAnimationFrame(()=>{this.cameraManager.fitCameraToSceneBounds()})}),this.addEventListener(this.eventsManager.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.eventsManager.cameraControlsStart.name,(e=>{switch(e.detail.type){case"rotate":(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="grabbing");break;case"pan":(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="move"),this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.sessionState==="default"&&this.hotspotsManager.closeActiveHotspot()})),this.addEventListener(this.eventsManager.inputEnd.name,()=>{(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="grab"),this.hideCameraAim()}),this.addEventListener(this.eventsManager.assetLoadProgress.name,(e=>{this._loadingProgress=e.detail.progress})),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,(e=>{this._hasActiveHotspot=!0,this.hideDimensions(!0),this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotNextEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotClosedEvent.name,this.__onHotspotChange.bind(this)),this.addEventListener(this.eventsManager.hotspotNextEvent.name,this.__onHotspotChange.bind(this)),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,this.__onHotspotChange.bind(this)),this.appCanvasContainerElemRef.onpointerdown=e=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp(),this.eventsManager.inputStart.fire({event:e})},this.appCanvasContainerElemRef.onpointermove=e=>{this.eventsManager.inputMove.fire({event:e})},this.appCanvasContainerElemRef.onpointerup=e=>{this.eventsManager.inputEnd.fire({event:e})},this.appCanvasContainerElemRef.onpointerout=e=>{this.eventsManager.inputEnd.fire({event:e})},this.cameraManager.mainCameraControls.addEventListener("update",this._onCameraPositionUpdate.bind(this)),this.hotspotsManager?.addEventListener("pointerdown",()=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp()})}_onCameraPositionUpdate(){this.hotspotsManager?.enabled&&this.hotspotsManager.recalculateHotspotPositions(),this.commentsManager?.enabled&&this.commentsManager.recalculateCommentPositions()}_setupAutoGeneratedProxyContainers(){const e=new $s,t=new Vs({color:65280,opacity:.5,transparent:!0});this._autoGeneratedProxyMesh=new Je(e,t)}get productSettings(){return this._productSettings}async _setup(){window.epigraph.logger.table({title:"Setting up...",contextOverride:this._loggerContext}),this._eventsManager=new LJ(this),this._sceneManager=new x6(this),this._sceneManager.initialize(),this._cameraManager=new Gg({appWcRef:this}),this._cameraManager.initialize();const e=this._sceneManager.sceneStructure.setupRootEntity().catch(t=>{this.onLoadFailed(Hd.SCENE_LOAD_ERROR,t)});await this.setupRenderEngine(),await e,await this._cameraManager.setup({mainRenderer:this.renderEngine.mainRenderer}),this._screenshotsManager=new e7(this),this._setupAutoGeneratedProxyContainers(),this._setupEventListeners(),this.__onWebComponentResize()}_resolveAnimationsOnHotspotEntry(e){this.stopAllAnimations();const t=e.animation,n=e.assetId;if(!t||!n)return;this._activeAnimations.get(t.entry)||this.playAnimationByNameAndAssetId({animationName:t.entry,assetId:n,clampWhenFinished:!0}),setTimeout(()=>{this._activeAnimations.delete(t.entry),this._activeAnimations.get(t.loop)?.loop||this.playAnimationByNameAndAssetId({animationName:t.loop,assetId:n,loop:!0})},this._animationFadeDurationInMiliseconds)}_renderDimensionsManager(){let e=ye;return this.featuresToEnable.dimensions&&(uY.setupWebComponent(),e=re`
|
|
18487
18487
|
<dimensions-manager
|
|
18488
18488
|
id="dimensionsManager"
|
|
18489
18489
|
.appWcRef=${this}
|
|
@@ -18588,7 +18588,7 @@ void main() {
|
|
|
18588
18588
|
id="viewInYourSpaceButton"
|
|
18589
18589
|
?is-loading=${this.isLoading}
|
|
18590
18590
|
></epg-button-view-in-your-space>
|
|
18591
|
-
</slot>`}_renderPoweredByEpigraphButton(){return ye}_renderToolset(){return ye}};s7([H({type:String,attribute:xQ.label.name})],IQ.prototype,"label");let r7=IQ;class wQ extends CQ{constructor(e){super(e)}setCameraZoomLimits({minDistance:e,maxDistance:t}){this._appWcRef.cameraManager.setCameraZoomLimits({minDistance:e,maxDistance:t})}disableCameraZoomLimits(){this._appWcRef.cameraManager.disableCameraZoomLimits()}getCameraTransforms(){return this._appWcRef.cameraManager.getCurrentCameraTransforms()}setCameraTransforms(e){return void this._appWcRef.cameraManager.moveCameraToLocation({newCameraTransforms:e})}getCameraRotation(){return this._appWcRef.cameraManager.getCurrentCameraRotation()}async setCameraRotation(e,t){const{azimuthAngle:n,polarAngle:s,distance:r}=e;return await this._appWcRef.cameraManager.rotateCameraToLocation({azimuthAngle:n,polarAngle:s,distance:r,transition:t})}getCameraFocalLength(){return this._appWcRef.cameraManager.getCameraFocalLength()}setCameraFocalLength(e){this._appWcRef.cameraManager.setCameraFocalLength(e)}getPositionOnMeshFromPoint(e,t){return this._appWcRef.getPositionOnMeshFromPoint(e,t)}getIntersectionOnProductFromPoint(e,t){return this._appWcRef.getIntersectionOnProductFromPoint(e,t)}highlightEntityByAssetId(e){this._appWcRef.highlightEntityByAssetId(e)}unhighlightAllEntities(){this._appWcRef.unhighlightAllEntities()}showDimensions(){this._appWcRef.showDimensions()}hideDimensions(){this._appWcRef.hideDimensions()}areDimensionsVisible(){return this._appWcRef.areDimensionsActive}getDimensions(){return this._appWcRef.getDimensions()}toggleDimensions(){this._appWcRef.toggleDimensions()}getSceneAnimations(){return this._appWcRef.getSceneAnimations()}playAnimationByNameAndId({animationName:e,assetId:t,clampWhenFinished:n=!1,loop:s=!1,repetitions:r=1/0,reverse:a=!1}){this._appWcRef.playAnimationByNameAndAssetId({animationName:e,assetId:t,clampWhenFinished:n,loop:s,repetitions:r,reverse:a})}stopAnimationByNameAndAssetId(e,t){this._appWcRef.stopAnimationByNameAndAssetId(e,t)}pauseActiveAnimations(e){this._appWcRef.pauseActiveAnimations(e)}resumeActiveAnimations(){this._appWcRef.resumeActiveAnimations()}stopAllAnimations(){this._appWcRef.stopAllAnimations()}showHelp(){this._appWcRef.showHelp()}hideHelp(){this._appWcRef.hideHelp()}toggleHelp(){this._appWcRef.toggleHelp()}isHelpVisible(){return this._appWcRef.isHelpVisible}async takeScreenshot(e){return this._appWcRef.takeScreenshot(e)}async downloadScreenshot(e){return this._appWcRef.downloadScreenshot(e)}async takeAllPredefinedScreenshots(e){return this._appWcRef.takeAllPredefinedScreenshots(e)}async downloadAllPredefinedScreenshots(e){return this._appWcRef.downloadAllPredefinedScreenshots(e)}getPredefinedCameraNames(){return this._appWcRef.getPredefinedCameraNames()}getPredefinedCameras(){return this._appWcRef.getPredefinedCameras()}}var a7=Object.defineProperty,o7=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&a7(e,t,s),s};const SQ=class dl extends ax{constructor(){super(),this.featuresToEnable={viewer:!0,hotspots:!1,dimensions:!0,viewInYourSpace:!0,help:!0,sceneManager:!0,comments:!1,debugManager:!1},this.epigraphWebsiteRedirectUrls={icon:"https://www.epigraph.us/?utm_source=epigraph&utm_medium=experience&utm_campaign=powered-by&utm_id=powered-by-icon&utm_content=viewer",modal:"https://www.epigraph.us/?utm_source=epigraph&utm_medium=experience&utm_campaign=powered-by&utm_id=powered-by-modal&utm_content=viewer"},this._loggerContext=dl.webComponentName.toUpperCase(),window.epigraph.logger.info({title:`Initializing ${dl.webComponentName}...`,contextOverride:this._loggerContext}),this.api=new wQ(this)}static{this.webComponentName="epigraph-viewer"}static{this.styles=[super.styles,ht`
|
|
18591
|
+
</slot>`}_renderPoweredByEpigraphButton(){return ye}_renderToolset(){return ye}};s7([H({type:String,attribute:xQ.label.name})],IQ.prototype,"label");let r7=IQ;class wQ extends CQ{constructor(e){super(e)}setCameraZoomLimits({minDistance:e,maxDistance:t}){this._appWcRef.cameraManager.setCameraZoomLimits({minDistance:e,maxDistance:t})}disableCameraZoomLimits(){this._appWcRef.cameraManager.disableCameraZoomLimits()}getCameraTransforms(){return this._appWcRef.cameraManager.getCurrentCameraTransforms()}setCameraTransforms(e){return void this._appWcRef.cameraManager.moveCameraToLocation({newCameraTransforms:e})}getCameraRotation(){return this._appWcRef.cameraManager.getCurrentCameraRotation()}async setCameraRotation(e,t){const{azimuthAngle:n,polarAngle:s,distance:r}=e;return await this._appWcRef.cameraManager.rotateCameraToLocation({azimuthAngle:n,polarAngle:s,distance:r,transition:t})}getCameraFocalLength(){return this._appWcRef.cameraManager.getCameraFocalLength()}setCameraFocalLength(e){this._appWcRef.cameraManager.setCameraFocalLength(e)}getPositionOnMeshFromPoint(e,t){return this._appWcRef.getPositionOnMeshFromPoint(e,t)}getIntersectionOnProductFromPoint(e,t){return this._appWcRef.getIntersectionOnProductFromPoint(e,t)}highlightEntityByAssetId(e){this._appWcRef.highlightEntityByAssetId(e)}unhighlightAllEntities(){this._appWcRef.unhighlightAllEntities()}async zoomIn(e=.1){await this._appWcRef.cameraManager.zoomIn(e)}async zoomOut(e=.1){await this._appWcRef.cameraManager.zoomOut(e)}async resetZoom(){await this._appWcRef.cameraManager.fitCameraToSceneBounds()}showDimensions(){this._appWcRef.showDimensions()}hideDimensions(){this._appWcRef.hideDimensions()}areDimensionsVisible(){return this._appWcRef.areDimensionsActive}getDimensions(){return this._appWcRef.getDimensions()}toggleDimensions(){this._appWcRef.toggleDimensions()}getSceneAnimations(){return this._appWcRef.getSceneAnimations()}playAnimationByNameAndId({animationName:e,assetId:t,clampWhenFinished:n=!1,loop:s=!1,repetitions:r=1/0,reverse:a=!1}){this._appWcRef.playAnimationByNameAndAssetId({animationName:e,assetId:t,clampWhenFinished:n,loop:s,repetitions:r,reverse:a})}stopAnimationByNameAndAssetId(e,t){this._appWcRef.stopAnimationByNameAndAssetId(e,t)}pauseActiveAnimations(e){this._appWcRef.pauseActiveAnimations(e)}resumeActiveAnimations(){this._appWcRef.resumeActiveAnimations()}stopAllAnimations(){this._appWcRef.stopAllAnimations()}showHelp(){this._appWcRef.showHelp()}hideHelp(){this._appWcRef.hideHelp()}toggleHelp(){this._appWcRef.toggleHelp()}isHelpVisible(){return this._appWcRef.isHelpVisible}async takeScreenshot(e){return this._appWcRef.takeScreenshot(e)}async downloadScreenshot(e){return this._appWcRef.downloadScreenshot(e)}async takeAllPredefinedScreenshots(e){return this._appWcRef.takeAllPredefinedScreenshots(e)}async downloadAllPredefinedScreenshots(e){return this._appWcRef.downloadAllPredefinedScreenshots(e)}getPredefinedCameraNames(){return this._appWcRef.getPredefinedCameraNames()}getPredefinedCameras(){return this._appWcRef.getPredefinedCameras()}}var a7=Object.defineProperty,o7=(i,e,t,n)=>{for(var s=void 0,r=i.length-1,a;r>=0;r--)(a=i[r])&&(s=a(e,t,s)||s);return s&&a7(e,t,s),s};const SQ=class dl extends ax{constructor(){super(),this.featuresToEnable={viewer:!0,hotspots:!1,dimensions:!0,viewInYourSpace:!0,help:!0,sceneManager:!0,comments:!1,debugManager:!1},this.epigraphWebsiteRedirectUrls={icon:"https://www.epigraph.us/?utm_source=epigraph&utm_medium=experience&utm_campaign=powered-by&utm_id=powered-by-icon&utm_content=viewer",modal:"https://www.epigraph.us/?utm_source=epigraph&utm_medium=experience&utm_campaign=powered-by&utm_id=powered-by-modal&utm_content=viewer"},this._loggerContext=dl.webComponentName.toUpperCase(),window.epigraph.logger.info({title:`Initializing ${dl.webComponentName}...`,contextOverride:this._loggerContext}),this.api=new wQ(this)}static{this.webComponentName="epigraph-viewer"}static{this.styles=[super.styles,ht`
|
|
18592
18592
|
:host {
|
|
18593
18593
|
position: relative;
|
|
18594
18594
|
}
|